; LLVM IR from ARMmbed/mbed-crypto :: library (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 nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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
  store i32 -110, ptr %21, align 4, !tbaa !9
  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
  br label %28

28:                                               ; preds = %9
  br label %29

29:                                               ; preds = %28
  br label %30

30:                                               ; preds = %29
  br label %31

31:                                               ; preds = %30
  br label %32

32:                                               ; preds = %31
  br label %33

33:                                               ; preds = %32
  br label %34

34:                                               ; preds = %33
  br label %35

35:                                               ; preds = %34
  br label %36

36:                                               ; preds = %35
  br label %37

37:                                               ; preds = %36
  br label %38

38:                                               ; preds = %37
  br label %39

39:                                               ; preds = %38
  br label %40

40:                                               ; preds = %39
  br label %41

41:                                               ; preds = %40
  br label %42

42:                                               ; preds = %41
  %43 = load i32, ptr %14, align 4, !tbaa !9
  %44 = icmp eq i32 %43, 1
  br i1 %44, label %45, label %51

45:                                               ; preds = %42
  %46 = load ptr, ptr %11, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.mbedtls_rsa_context, ptr %46, i32 0, i32 15
  %48 = load i32, ptr %47, align 8, !tbaa !13
  %49 = icmp ne i32 %48, 1
  br i1 %49, label %50, label %51

50:                                               ; preds = %45
  store i32 -16512, ptr %10, align 4
  store i32 1, ptr %26, align 4
  br label %203

51:                                               ; preds = %45, %42
  %52 = load ptr, ptr %12, align 8, !tbaa !5
  %53 = icmp eq ptr %52, null
  br i1 %53, label %54, label %55

54:                                               ; preds = %51
  store i32 -16512, ptr %10, align 4
  store i32 1, ptr %26, align 4
  br label %203

55:                                               ; preds = %51
  %56 = load ptr, ptr %11, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.mbedtls_rsa_context, ptr %56, i32 0, i32 16
  %58 = load i32, ptr %57, align 4, !tbaa !16
  %59 = call ptr @mbedtls_md_info_from_type(i32 noundef %58)
  store ptr %59, ptr %24, align 8, !tbaa !5
  %60 = load ptr, ptr %24, align 8, !tbaa !5
  %61 = icmp eq ptr %60, null
  br i1 %61, label %62, label %63

62:                                               ; preds = %55
  store i32 -16512, ptr %10, align 4
  store i32 1, ptr %26, align 4
  br label %203

63:                                               ; preds = %55
  %64 = load ptr, ptr %11, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.mbedtls_rsa_context, ptr %64, i32 0, i32 1
  %66 = load i64, ptr %65, align 8, !tbaa !17
  store i64 %66, ptr %20, align 8, !tbaa !11
  %67 = load ptr, ptr %24, align 8, !tbaa !5
  %68 = call zeroext i8 @mbedtls_md_get_size(ptr noundef %67)
  %69 = zext i8 %68 to i32
  store i32 %69, ptr %23, align 4, !tbaa !9
  %70 = load i64, ptr %17, align 8, !tbaa !11
  %71 = load i32, ptr %23, align 4, !tbaa !9
  %72 = mul i32 2, %71
  %73 = zext i32 %72 to i64
  %74 = add i64 %70, %73
  %75 = add i64 %74, 2
  %76 = load i64, ptr %17, align 8, !tbaa !11
  %77 = icmp ult i64 %75, %76
  br i1 %77, label %87, label %78

78:                                               ; preds = %63
  %79 = load i64, ptr %20, align 8, !tbaa !11
  %80 = load i64, ptr %17, align 8, !tbaa !11
  %81 = load i32, ptr %23, align 4, !tbaa !9
  %82 = mul i32 2, %81
  %83 = zext i32 %82 to i64
  %84 = add i64 %80, %83
  %85 = add i64 %84, 2
  %86 = icmp ult i64 %79, %85
  br i1 %86, label %87, label %88

87:                                               ; preds = %78, %63
  store i32 -16512, ptr %10, align 4
  store i32 1, ptr %26, align 4
  br label %203

88:                                               ; preds = %78
  %89 = load ptr, ptr %19, align 8, !tbaa !5
  %90 = load i64, ptr %20, align 8, !tbaa !11
  call void @llvm.memset.p0.i64(ptr align 1 %89, i8 0, i64 %90, i1 false)
  %91 = load ptr, ptr %22, align 8, !tbaa !5
  %92 = getelementptr inbounds i8, ptr %91, i32 1
  store ptr %92, ptr %22, align 8, !tbaa !5
  store i8 0, ptr %91, align 1, !tbaa !18
  %93 = load ptr, ptr %12, align 8, !tbaa !5
  %94 = load ptr, ptr %13, align 8, !tbaa !5
  %95 = load ptr, ptr %22, align 8, !tbaa !5
  %96 = load i32, ptr %23, align 4, !tbaa !9
  %97 = zext i32 %96 to i64
  %98 = call i32 %93(ptr noundef %94, ptr noundef %95, i64 noundef %97)
  store i32 %98, ptr %21, align 4, !tbaa !9
  %99 = icmp ne i32 %98, 0
  br i1 %99, label %100, label %103

100:                                              ; preds = %88
  %101 = load i32, ptr %21, align 4, !tbaa !9
  %102 = add nsw i32 -17536, %101
  store i32 %102, ptr %10, align 4
  store i32 1, ptr %26, align 4
  br label %203

103:                                              ; preds = %88
  %104 = load i32, ptr %23, align 4, !tbaa !9
  %105 = load ptr, ptr %22, align 8, !tbaa !5
  %106 = zext i32 %104 to i64
  %107 = getelementptr inbounds i8, ptr %105, i64 %106
  store ptr %107, ptr %22, align 8, !tbaa !5
  %108 = load ptr, ptr %24, align 8, !tbaa !5
  %109 = load ptr, ptr %15, align 8, !tbaa !5
  %110 = load i64, ptr %16, align 8, !tbaa !11
  %111 = load ptr, ptr %22, align 8, !tbaa !5
  %112 = call i32 @mbedtls_md(ptr noundef %108, ptr noundef %109, i64 noundef %110, ptr noundef %111)
  store i32 %112, ptr %21, align 4, !tbaa !9
  %113 = icmp ne i32 %112, 0
  br i1 %113, label %114, label %116

114:                                              ; preds = %103
  %115 = load i32, ptr %21, align 4, !tbaa !9
  store i32 %115, ptr %10, align 4
  store i32 1, ptr %26, align 4
  br label %203

116:                                              ; preds = %103
  %117 = load i32, ptr %23, align 4, !tbaa !9
  %118 = load ptr, ptr %22, align 8, !tbaa !5
  %119 = zext i32 %117 to i64
  %120 = getelementptr inbounds i8, ptr %118, i64 %119
  store ptr %120, ptr %22, align 8, !tbaa !5
  %121 = load i64, ptr %20, align 8, !tbaa !11
  %122 = load i32, ptr %23, align 4, !tbaa !9
  %123 = mul i32 2, %122
  %124 = zext i32 %123 to i64
  %125 = sub i64 %121, %124
  %126 = sub i64 %125, 2
  %127 = load i64, ptr %17, align 8, !tbaa !11
  %128 = sub i64 %126, %127
  %129 = load ptr, ptr %22, align 8, !tbaa !5
  %130 = getelementptr inbounds i8, ptr %129, i64 %128
  store ptr %130, ptr %22, align 8, !tbaa !5
  %131 = load ptr, ptr %22, align 8, !tbaa !5
  %132 = getelementptr inbounds i8, ptr %131, i32 1
  store ptr %132, ptr %22, align 8, !tbaa !5
  store i8 1, ptr %131, align 1, !tbaa !18
  %133 = load i64, ptr %17, align 8, !tbaa !11
  %134 = icmp ne i64 %133, 0
  br i1 %134, label %135, label %139

135:                                              ; preds = %116
  %136 = load ptr, ptr %22, align 8, !tbaa !5
  %137 = load ptr, ptr %18, align 8, !tbaa !5
  %138 = load i64, ptr %17, align 8, !tbaa !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %136, ptr align 1 %137, i64 %138, i1 false)
  br label %139

139:                                              ; preds = %135, %116
  call void @mbedtls_md_init(ptr noundef %25)
  %140 = load ptr, ptr %24, align 8, !tbaa !5
  %141 = call i32 @mbedtls_md_setup(ptr noundef %25, ptr noundef %140, i32 noundef 0)
  store i32 %141, ptr %21, align 4, !tbaa !9
  %142 = icmp ne i32 %141, 0
  br i1 %142, label %143, label %144

143:                                              ; preds = %139
  br label %181

144:                                              ; preds = %139
  %145 = load ptr, ptr %19, align 8, !tbaa !5
  %146 = load i32, ptr %23, align 4, !tbaa !9
  %147 = zext i32 %146 to i64
  %148 = getelementptr inbounds i8, ptr %145, i64 %147
  %149 = getelementptr inbounds i8, ptr %148, i64 1
  %150 = load i64, ptr %20, align 8, !tbaa !11
  %151 = load i32, ptr %23, align 4, !tbaa !9
  %152 = zext i32 %151 to i64
  %153 = sub i64 %150, %152
  %154 = sub i64 %153, 1
  %155 = load ptr, ptr %19, align 8, !tbaa !5
  %156 = getelementptr inbounds i8, ptr %155, i64 1
  %157 = load i32, ptr %23, align 4, !tbaa !9
  %158 = zext i32 %157 to i64
  %159 = call i32 @mgf_mask(ptr noundef %149, i64 noundef %154, ptr noundef %156, i64 noundef %158, ptr noundef %25)
  store i32 %159, ptr %21, align 4, !tbaa !9
  %160 = icmp ne i32 %159, 0
  br i1 %160, label %161, label %162

161:                                              ; preds = %144
  br label %181

162:                                              ; preds = %144
  %163 = load ptr, ptr %19, align 8, !tbaa !5
  %164 = getelementptr inbounds i8, ptr %163, i64 1
  %165 = load i32, ptr %23, align 4, !tbaa !9
  %166 = zext i32 %165 to i64
  %167 = load ptr, ptr %19, align 8, !tbaa !5
  %168 = load i32, ptr %23, align 4, !tbaa !9
  %169 = zext i32 %168 to i64
  %170 = getelementptr inbounds i8, ptr %167, i64 %169
  %171 = getelementptr inbounds i8, ptr %170, i64 1
  %172 = load i64, ptr %20, align 8, !tbaa !11
  %173 = load i32, ptr %23, align 4, !tbaa !9
  %174 = zext i32 %173 to i64
  %175 = sub i64 %172, %174
  %176 = sub i64 %175, 1
  %177 = call i32 @mgf_mask(ptr noundef %164, i64 noundef %166, ptr noundef %171, i64 noundef %176, ptr noundef %25)
  store i32 %177, ptr %21, align 4, !tbaa !9
  %178 = icmp ne i32 %177, 0
  br i1 %178, label %179, label %180

179:                                              ; preds = %162
  br label %181

180:                                              ; preds = %162
  br label %181

181:                                              ; preds = %180, %179, %161, %143
  call void @mbedtls_md_free(ptr noundef %25)
  %182 = load i32, ptr %21, align 4, !tbaa !9
  %183 = icmp ne i32 %182, 0
  br i1 %183, label %184, label %186

184:                                              ; preds = %181
  %185 = load i32, ptr %21, align 4, !tbaa !9
  store i32 %185, ptr %10, align 4
  store i32 1, ptr %26, align 4
  br label %203

186:                                              ; preds = %181
  %187 = load i32, ptr %14, align 4, !tbaa !9
  %188 = icmp eq i32 %187, 0
  br i1 %188, label %189, label %194

189:                                              ; preds = %186
  %190 = load ptr, ptr %11, align 8, !tbaa !5
  %191 = load ptr, ptr %19, align 8, !tbaa !5
  %192 = load ptr, ptr %19, align 8, !tbaa !5
  %193 = call i32 @mbedtls_rsa_public(ptr noundef %190, ptr noundef %191, ptr noundef %192)
  br label %201

194:                                              ; preds = %186
  %195 = load ptr, ptr %11, align 8, !tbaa !5
  %196 = load ptr, ptr %12, align 8, !tbaa !5
  %197 = load ptr, ptr %13, align 8, !tbaa !5
  %198 = load ptr, ptr %19, align 8, !tbaa !5
  %199 = load ptr, ptr %19, align 8, !tbaa !5
  %200 = call i32 @mbedtls_rsa_private(ptr noundef %195, ptr noundef %196, ptr noundef %197, ptr noundef %198, ptr noundef %199)
  br label %201

201:                                              ; preds = %194, %189
  %202 = phi i32 [ %193, %189 ], [ %200, %194 ]
  store i32 %202, ptr %10, align 4
  store i32 1, ptr %26, align 4
  br label %203

203:                                              ; preds = %201, %184, %114, %100, %87, %62, %54, %50
  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
  %204 = load i32, ptr %10, align 4
  ret i32 %204
}

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

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

declare void @mbedtls_md_free(ptr noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!"mbedtls_rsa_context", !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 = !{!"mbedtls_mpi", !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 nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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.cond80 = or i1 %15, %.not
  br i1 %or.cond80, label %63, label %17

16:                                               ; preds = %9
  %.old = icmp eq ptr %1, null
  br i1 %.old, label %63, 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 %63, 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 %63, 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
  %.not74 = icmp eq i32 %34, 0
  br i1 %.not74, label %37, label %35

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

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
  %.not75 = icmp eq i32 %39, 0
  br i1 %.not75, label %40, label %63

40:                                               ; preds = %37
  %41 = getelementptr inbounds i8, ptr %38, i64 %26
  %42 = add i64 %24, -2
  %43 = sub i64 %42, %28
  %44 = getelementptr inbounds i8, ptr %41, i64 %43
  store i8 1, ptr %44, align 1, !tbaa !15
  %.not76 = icmp eq i64 %6, 0
  br i1 %.not76, label %47, label %45

45:                                               ; preds = %40
  %46 = getelementptr inbounds i8, ptr %44, i64 1
  tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %46, ptr align 1 %7, i64 %6, i1 false)
  br label %47

47:                                               ; preds = %45, %40
  call void @mbedtls_md_init(ptr noundef nonnull %10) #5
  %48 = call i32 @mbedtls_md_setup(ptr noundef nonnull %10, ptr noundef nonnull %20, i32 noundef 0) #5
  %.not77 = icmp eq i32 %48, 0
  br i1 %.not77, label %49, label %.thread

49:                                               ; preds = %47
  %50 = getelementptr inbounds i8, ptr %8, i64 %26
  %51 = getelementptr inbounds i8, ptr %50, i64 1
  %52 = xor i64 %26, -1
  %53 = add i64 %24, %52
  %54 = call i32 @mgf_mask(ptr noundef nonnull %51, i64 noundef %53, ptr noundef nonnull %33, i64 noundef %26, ptr noundef nonnull %10)
  %.not78 = icmp eq i32 %54, 0
  br i1 %.not78, label %55, label %.thread

.thread:                                          ; preds = %47, %49
  %.064.ph = phi i32 [ %54, %49 ], [ %48, %47 ]
  call void @mbedtls_md_free(ptr noundef nonnull %10) #5
  br label %63

55:                                               ; preds = %49
  %56 = call i32 @mgf_mask(ptr noundef nonnull %33, i64 noundef %26, ptr noundef nonnull %51, i64 noundef %53, ptr noundef nonnull %10)
  call void @mbedtls_md_free(ptr noundef nonnull %10) #5
  %.not79 = icmp eq i32 %56, 0
  br i1 %.not79, label %57, label %63

57:                                               ; preds = %55
  %58 = icmp eq i32 %3, 0
  br i1 %58, label %59, label %61

59:                                               ; preds = %57
  %60 = call i32 @mbedtls_rsa_public(ptr noundef nonnull %0, ptr noundef nonnull %8, ptr noundef nonnull %8)
  br label %63

61:                                               ; preds = %57
  %62 = 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 %63

63:                                               ; preds = %.thread, %59, %61, %55, %37, %22, %17, %16, %12, %35
  %.0 = phi i32 [ %36, %35 ], [ -16512, %12 ], [ -16512, %16 ], [ -16512, %17 ], [ -16512, %22 ], [ %39, %37 ], [ %56, %55 ], [ %60, %59 ], [ %62, %61 ], [ %.064.ph, %.thread ]
  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

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

declare void @mbedtls_md_free(ptr noundef) local_unnamed_addr #3

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!"mbedtls_rsa_context", !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 = !{!"mbedtls_mpi", !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,JumpThreadingPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass