; LLVM IR from tleonhardt/practical_cryptography_engineering :: mbedtls (rsa)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.mbedtls_md_context_t = type { ptr, ptr, ptr }
%struct.mbedtls_rsa_context = type { i32, i64, %struct.mbedtls_mpi, %struct.mbedtls_mpi, %struct.mbedtls_mpi, %struct.mbedtls_mpi, %struct.mbedtls_mpi, %struct.mbedtls_mpi, %struct.mbedtls_mpi, %struct.mbedtls_mpi, %struct.mbedtls_mpi, %struct.mbedtls_mpi, %struct.mbedtls_mpi, %struct.mbedtls_mpi, %struct.mbedtls_mpi, i32, i32 }
%struct.mbedtls_mpi = type { i32, i64, ptr }

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @mbedtls_rsa_public(ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @mbedtls_rsa_private(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local i32 @mbedtls_rsa_rsaes_oaep_encrypt(ptr noundef %0, ptr noundef %1, ptr noundef %2, i32 noundef %3, ptr noundef %4, i64 noundef %5, i64 noundef %6, ptr noundef %7, ptr noundef %8) #2 {
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca i64, align 8
  %17 = alloca i64, align 8
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca i64, align 8
  %21 = alloca i32, align 4
  %22 = alloca ptr, align 8
  %23 = alloca i32, align 4
  %24 = alloca ptr, align 8
  %25 = alloca %struct.mbedtls_md_context_t, align 8
  %26 = alloca i32, align 4
  store ptr %0, ptr %11, align 8, !tbaa !5
  store ptr %1, ptr %12, align 8, !tbaa !5
  store ptr %2, ptr %13, align 8, !tbaa !5
  store i32 %3, ptr %14, align 4, !tbaa !9
  store ptr %4, ptr %15, align 8, !tbaa !5
  store i64 %5, ptr %16, align 8, !tbaa !11
  store i64 %6, ptr %17, align 8, !tbaa !11
  store ptr %7, ptr %18, align 8, !tbaa !5
  store ptr %8, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #5
  %27 = load ptr, ptr %19, align 8, !tbaa !5
  store ptr %27, ptr %22, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #5
  call void @llvm.lifetime.start.p0(i64 24, ptr %25) #5
  %28 = load i32, ptr %14, align 4, !tbaa !9
  %29 = icmp eq i32 %28, 1
  br i1 %29, label %30, label %36

30:                                               ; preds = %9
  %31 = load ptr, ptr %11, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.mbedtls_rsa_context, ptr %31, i32 0, i32 15
  %33 = load i32, ptr %32, align 8, !tbaa !13
  %34 = icmp ne i32 %33, 1
  br i1 %34, label %35, label %36

35:                                               ; preds = %30
  store i32 -16512, ptr %10, align 4
  store i32 1, ptr %26, align 4
  br label %167

36:                                               ; preds = %30, %9
  %37 = load ptr, ptr %12, align 8, !tbaa !5
  %38 = icmp eq ptr %37, null
  br i1 %38, label %39, label %40

39:                                               ; preds = %36
  store i32 -16512, ptr %10, align 4
  store i32 1, ptr %26, align 4
  br label %167

40:                                               ; preds = %36
  %41 = load ptr, ptr %11, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.mbedtls_rsa_context, ptr %41, i32 0, i32 16
  %43 = load i32, ptr %42, align 4, !tbaa !16
  %44 = call ptr @mbedtls_md_info_from_type(i32 noundef %43)
  store ptr %44, ptr %24, align 8, !tbaa !5
  %45 = load ptr, ptr %24, align 8, !tbaa !5
  %46 = icmp eq ptr %45, null
  br i1 %46, label %47, label %48

47:                                               ; preds = %40
  store i32 -16512, ptr %10, align 4
  store i32 1, ptr %26, align 4
  br label %167

48:                                               ; preds = %40
  %49 = load ptr, ptr %11, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.mbedtls_rsa_context, ptr %49, i32 0, i32 1
  %51 = load i64, ptr %50, align 8, !tbaa !17
  store i64 %51, ptr %20, align 8, !tbaa !11
  %52 = load ptr, ptr %24, align 8, !tbaa !5
  %53 = call zeroext i8 @mbedtls_md_get_size(ptr noundef %52)
  %54 = zext i8 %53 to i32
  store i32 %54, ptr %23, align 4, !tbaa !9
  %55 = load i64, ptr %17, align 8, !tbaa !11
  %56 = load i32, ptr %23, align 4, !tbaa !9
  %57 = mul i32 2, %56
  %58 = zext i32 %57 to i64
  %59 = add i64 %55, %58
  %60 = add i64 %59, 2
  %61 = load i64, ptr %17, align 8, !tbaa !11
  %62 = icmp ult i64 %60, %61
  br i1 %62, label %72, label %63

63:                                               ; preds = %48
  %64 = load i64, ptr %20, align 8, !tbaa !11
  %65 = load i64, ptr %17, align 8, !tbaa !11
  %66 = load i32, ptr %23, align 4, !tbaa !9
  %67 = mul i32 2, %66
  %68 = zext i32 %67 to i64
  %69 = add i64 %65, %68
  %70 = add i64 %69, 2
  %71 = icmp ult i64 %64, %70
  br i1 %71, label %72, label %73

72:                                               ; preds = %63, %48
  store i32 -16512, ptr %10, align 4
  store i32 1, ptr %26, align 4
  br label %167

73:                                               ; preds = %63
  %74 = load ptr, ptr %19, align 8, !tbaa !5
  %75 = load i64, ptr %20, align 8, !tbaa !11
  call void @llvm.memset.p0.i64(ptr align 1 %74, i8 0, i64 %75, i1 false)
  %76 = load ptr, ptr %22, align 8, !tbaa !5
  %77 = getelementptr inbounds i8, ptr %76, i32 1
  store ptr %77, ptr %22, align 8, !tbaa !5
  store i8 0, ptr %76, align 1, !tbaa !18
  %78 = load ptr, ptr %12, align 8, !tbaa !5
  %79 = load ptr, ptr %13, align 8, !tbaa !5
  %80 = load ptr, ptr %22, align 8, !tbaa !5
  %81 = load i32, ptr %23, align 4, !tbaa !9
  %82 = zext i32 %81 to i64
  %83 = call i32 %78(ptr noundef %79, ptr noundef %80, i64 noundef %82)
  store i32 %83, ptr %21, align 4, !tbaa !9
  %84 = icmp ne i32 %83, 0
  br i1 %84, label %85, label %88

85:                                               ; preds = %73
  %86 = load i32, ptr %21, align 4, !tbaa !9
  %87 = add nsw i32 -17536, %86
  store i32 %87, ptr %10, align 4
  store i32 1, ptr %26, align 4
  br label %167

88:                                               ; preds = %73
  %89 = load i32, ptr %23, align 4, !tbaa !9
  %90 = load ptr, ptr %22, align 8, !tbaa !5
  %91 = zext i32 %89 to i64
  %92 = getelementptr inbounds i8, ptr %90, i64 %91
  store ptr %92, ptr %22, align 8, !tbaa !5
  %93 = load ptr, ptr %24, align 8, !tbaa !5
  %94 = load ptr, ptr %15, align 8, !tbaa !5
  %95 = load i64, ptr %16, align 8, !tbaa !11
  %96 = load ptr, ptr %22, align 8, !tbaa !5
  %97 = call i32 @mbedtls_md(ptr noundef %93, ptr noundef %94, i64 noundef %95, ptr noundef %96)
  %98 = load i32, ptr %23, align 4, !tbaa !9
  %99 = load ptr, ptr %22, align 8, !tbaa !5
  %100 = zext i32 %98 to i64
  %101 = getelementptr inbounds i8, ptr %99, i64 %100
  store ptr %101, ptr %22, align 8, !tbaa !5
  %102 = load i64, ptr %20, align 8, !tbaa !11
  %103 = load i32, ptr %23, align 4, !tbaa !9
  %104 = mul i32 2, %103
  %105 = zext i32 %104 to i64
  %106 = sub i64 %102, %105
  %107 = sub i64 %106, 2
  %108 = load i64, ptr %17, align 8, !tbaa !11
  %109 = sub i64 %107, %108
  %110 = load ptr, ptr %22, align 8, !tbaa !5
  %111 = getelementptr inbounds i8, ptr %110, i64 %109
  store ptr %111, ptr %22, align 8, !tbaa !5
  %112 = load ptr, ptr %22, align 8, !tbaa !5
  %113 = getelementptr inbounds i8, ptr %112, i32 1
  store ptr %113, ptr %22, align 8, !tbaa !5
  store i8 1, ptr %112, align 1, !tbaa !18
  %114 = load ptr, ptr %22, align 8, !tbaa !5
  %115 = load ptr, ptr %18, align 8, !tbaa !5
  %116 = load i64, ptr %17, align 8, !tbaa !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %114, ptr align 1 %115, i64 %116, i1 false)
  call void @mbedtls_md_init(ptr noundef %25)
  %117 = load ptr, ptr %24, align 8, !tbaa !5
  %118 = call i32 @mbedtls_md_setup(ptr noundef %25, ptr noundef %117, i32 noundef 0)
  store i32 %118, ptr %21, align 4, !tbaa !9
  %119 = icmp ne i32 %118, 0
  br i1 %119, label %120, label %122

120:                                              ; preds = %88
  call void @mbedtls_md_free(ptr noundef %25)
  %121 = load i32, ptr %21, align 4, !tbaa !9
  store i32 %121, ptr %10, align 4
  store i32 1, ptr %26, align 4
  br label %167

122:                                              ; preds = %88
  %123 = load ptr, ptr %19, align 8, !tbaa !5
  %124 = load i32, ptr %23, align 4, !tbaa !9
  %125 = zext i32 %124 to i64
  %126 = getelementptr inbounds i8, ptr %123, i64 %125
  %127 = getelementptr inbounds i8, ptr %126, i64 1
  %128 = load i64, ptr %20, align 8, !tbaa !11
  %129 = load i32, ptr %23, align 4, !tbaa !9
  %130 = zext i32 %129 to i64
  %131 = sub i64 %128, %130
  %132 = sub i64 %131, 1
  %133 = load ptr, ptr %19, align 8, !tbaa !5
  %134 = getelementptr inbounds i8, ptr %133, i64 1
  %135 = load i32, ptr %23, align 4, !tbaa !9
  %136 = zext i32 %135 to i64
  call void @mgf_mask(ptr noundef %127, i64 noundef %132, ptr noundef %134, i64 noundef %136, ptr noundef %25)
  %137 = load ptr, ptr %19, align 8, !tbaa !5
  %138 = getelementptr inbounds i8, ptr %137, i64 1
  %139 = load i32, ptr %23, align 4, !tbaa !9
  %140 = zext i32 %139 to i64
  %141 = load ptr, ptr %19, align 8, !tbaa !5
  %142 = load i32, ptr %23, align 4, !tbaa !9
  %143 = zext i32 %142 to i64
  %144 = getelementptr inbounds i8, ptr %141, i64 %143
  %145 = getelementptr inbounds i8, ptr %144, i64 1
  %146 = load i64, ptr %20, align 8, !tbaa !11
  %147 = load i32, ptr %23, align 4, !tbaa !9
  %148 = zext i32 %147 to i64
  %149 = sub i64 %146, %148
  %150 = sub i64 %149, 1
  call void @mgf_mask(ptr noundef %138, i64 noundef %140, ptr noundef %145, i64 noundef %150, ptr noundef %25)
  call void @mbedtls_md_free(ptr noundef %25)
  %151 = load i32, ptr %14, align 4, !tbaa !9
  %152 = icmp eq i32 %151, 0
  br i1 %152, label %153, label %158

153:                                              ; preds = %122
  %154 = load ptr, ptr %11, align 8, !tbaa !5
  %155 = load ptr, ptr %19, align 8, !tbaa !5
  %156 = load ptr, ptr %19, align 8, !tbaa !5
  %157 = call i32 @mbedtls_rsa_public(ptr noundef %154, ptr noundef %155, ptr noundef %156)
  br label %165

158:                                              ; preds = %122
  %159 = load ptr, ptr %11, align 8, !tbaa !5
  %160 = load ptr, ptr %12, align 8, !tbaa !5
  %161 = load ptr, ptr %13, align 8, !tbaa !5
  %162 = load ptr, ptr %19, align 8, !tbaa !5
  %163 = load ptr, ptr %19, align 8, !tbaa !5
  %164 = call i32 @mbedtls_rsa_private(ptr noundef %159, ptr noundef %160, ptr noundef %161, ptr noundef %162, ptr noundef %163)
  br label %165

165:                                              ; preds = %158, %153
  %166 = phi i32 [ %157, %153 ], [ %164, %158 ]
  store i32 %166, ptr %10, align 4
  store i32 1, ptr %26, align 4
  br label %167

167:                                              ; preds = %165, %120, %85, %72, %47, %39, %35
  call void @llvm.lifetime.end.p0(i64 24, ptr %25) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #5
  %168 = load i32, ptr %10, align 4
  ret i32 %168
}

declare ptr @mbedtls_md_info_from_type(i32 noundef) #3

declare zeroext i8 @mbedtls_md_get_size(ptr noundef) #3

declare i32 @mbedtls_md(ptr noundef, ptr noundef, i64 noundef, ptr noundef) #3

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

declare void @mbedtls_md_init(ptr noundef) #3

declare i32 @mbedtls_md_setup(ptr noundef, ptr noundef, i32 noundef) #3

declare void @mbedtls_md_free(ptr noundef) #3

; Function Attrs: nounwind uwtable
declare hidden void @mgf_mask(ptr noundef, i64 noundef, ptr noundef, i64 noundef, ptr noundef) #2

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !10, i64 328}
!14 = !{!"", !10, i64 0, !12, i64 8, !15, i64 16, !15, i64 40, !15, i64 64, !15, i64 88, !15, i64 112, !15, i64 136, !15, i64 160, !15, i64 184, !15, i64 208, !15, i64 232, !15, i64 256, !15, i64 280, !15, i64 304, !10, i64 328, !10, i64 332}
!15 = !{!"", !10, i64 0, !12, i64 8, !6, i64 16}
!16 = !{!14, !10, i64 332}
!17 = !{!14, !12, i64 8}
!18 = !{!7, !7, i64 0}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.mbedtls_md_context_t = type { ptr, ptr, ptr }

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @mbedtls_rsa_public(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @mbedtls_rsa_private(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local i32 @mbedtls_rsa_rsaes_oaep_encrypt(ptr noundef %0, ptr noundef %1, ptr noundef %2, i32 noundef %3, ptr noundef %4, i64 noundef %5, i64 noundef %6, ptr nocapture noundef readonly %7, ptr noundef %8) local_unnamed_addr #2 {
  %10 = alloca %struct.mbedtls_md_context_t, align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %10) #5
  %11 = icmp eq i32 %3, 1
  br i1 %11, label %12, label %16

12:                                               ; preds = %9
  %13 = getelementptr inbounds i8, ptr %0, i64 328
  %14 = load i32, ptr %13, align 8, !tbaa !5
  %.not = icmp ne i32 %14, 1
  %15 = icmp eq ptr %1, null
  %or.cond70 = or i1 %15, %.not
  br i1 %or.cond70, label %57, label %17

16:                                               ; preds = %9
  %.old = icmp eq ptr %1, null
  br i1 %.old, label %57, label %17

17:                                               ; preds = %12, %16
  %18 = getelementptr inbounds i8, ptr %0, i64 332
  %19 = load i32, ptr %18, align 4, !tbaa !13
  %20 = tail call ptr @mbedtls_md_info_from_type(i32 noundef %19) #5
  %21 = icmp eq ptr %20, null
  br i1 %21, label %57, label %22

22:                                               ; preds = %17
  %23 = getelementptr inbounds i8, ptr %0, i64 8
  %24 = load i64, ptr %23, align 8, !tbaa !14
  %25 = tail call zeroext i8 @mbedtls_md_get_size(ptr noundef nonnull %20) #5
  %26 = zext i8 %25 to i64
  %27 = shl nuw nsw i64 %26, 1
  %28 = add i64 %27, %6
  %29 = add i64 %28, 2
  %30 = icmp ult i64 %29, %6
  %31 = icmp ult i64 %24, %29
  %or.cond = select i1 %30, i1 true, i1 %31
  br i1 %or.cond, label %57, label %32

32:                                               ; preds = %22
  tail call void @llvm.memset.p0.i64(ptr align 1 %8, i8 0, i64 %24, i1 false)
  %33 = getelementptr inbounds i8, ptr %8, i64 1
  store i8 0, ptr %8, align 1, !tbaa !15
  %34 = tail call i32 %1(ptr noundef %2, ptr noundef nonnull %33, i64 noundef %26) #5
  %.not68 = icmp eq i32 %34, 0
  br i1 %.not68, label %37, label %35

35:                                               ; preds = %32
  %36 = add nsw i32 %34, -17536
  br label %57

37:                                               ; preds = %32
  %38 = getelementptr inbounds i8, ptr %33, i64 %26
  %39 = tail call i32 @mbedtls_md(ptr noundef nonnull %20, ptr noundef %4, i64 noundef %5, ptr noundef nonnull %38) #5
  %40 = getelementptr inbounds i8, ptr %38, i64 %26
  %41 = add i64 %24, -2
  %42 = sub i64 %41, %28
  %43 = getelementptr inbounds i8, ptr %40, i64 %42
  %44 = getelementptr inbounds i8, ptr %43, i64 1
  store i8 1, ptr %43, align 1, !tbaa !15
  tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %44, ptr align 1 %7, i64 %6, i1 false)
  call void @mbedtls_md_init(ptr noundef nonnull %10) #5
  %45 = call i32 @mbedtls_md_setup(ptr noundef nonnull %10, ptr noundef nonnull %20, i32 noundef 0) #5
  %.not69 = icmp eq i32 %45, 0
  br i1 %.not69, label %47, label %46

46:                                               ; preds = %37
  call void @mbedtls_md_free(ptr noundef nonnull %10) #5
  br label %57

47:                                               ; preds = %37
  %48 = getelementptr inbounds i8, ptr %8, i64 %26
  %49 = getelementptr inbounds i8, ptr %48, i64 1
  %50 = xor i64 %26, -1
  %51 = add i64 %24, %50
  call void @mgf_mask(ptr noundef nonnull %49, i64 noundef %51, ptr noundef nonnull %33, i64 noundef %26, ptr noundef nonnull %10)
  call void @mgf_mask(ptr noundef nonnull %33, i64 noundef %26, ptr noundef nonnull %49, i64 noundef %51, ptr noundef nonnull %10)
  call void @mbedtls_md_free(ptr noundef nonnull %10) #5
  %52 = icmp eq i32 %3, 0
  br i1 %52, label %53, label %55

53:                                               ; preds = %47
  %54 = call i32 @mbedtls_rsa_public(ptr noundef nonnull %0, ptr noundef nonnull %8, ptr noundef nonnull %8)
  br label %57

55:                                               ; preds = %47
  %56 = call i32 @mbedtls_rsa_private(ptr noundef nonnull %0, ptr noundef nonnull %1, ptr noundef %2, ptr noundef nonnull %8, ptr noundef nonnull %8)
  br label %57

57:                                               ; preds = %53, %55, %22, %17, %16, %12, %46, %35
  %.0 = phi i32 [ %36, %35 ], [ %45, %46 ], [ -16512, %12 ], [ -16512, %16 ], [ -16512, %17 ], [ -16512, %22 ], [ %54, %53 ], [ %56, %55 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %10) #5
  ret i32 %.0
}

declare ptr @mbedtls_md_info_from_type(i32 noundef) local_unnamed_addr #3

declare zeroext i8 @mbedtls_md_get_size(ptr noundef) local_unnamed_addr #3

declare i32 @mbedtls_md(ptr noundef, ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

declare void @mbedtls_md_init(ptr noundef) local_unnamed_addr #3

declare i32 @mbedtls_md_setup(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #3

declare void @mbedtls_md_free(ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare hidden void @mgf_mask(ptr noundef, i64 noundef, ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 328}
!6 = !{!"", !7, i64 0, !10, i64 8, !11, i64 16, !11, i64 40, !11, i64 64, !11, i64 88, !11, i64 112, !11, i64 136, !11, i64 160, !11, i64 184, !11, i64 208, !11, i64 232, !11, i64 256, !11, i64 280, !11, i64 304, !7, i64 328, !7, i64 332}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!"", !7, i64 0, !10, i64 8, !12, i64 16}
!12 = !{!"any pointer", !8, i64 0}
!13 = !{!6, !7, i64 332}
!14 = !{!6, !10, i64 8}
!15 = !{!8, !8, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass