; 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_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 }

@.str = external hidden unnamed_addr constant [257 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [129 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [129 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [257 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i32 @mbedtls_rsa_import(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #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_complete(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @mbedtls_rsa_init(ptr noundef, i32 noundef, i32 noundef) #0

declare void @mbedtls_mpi_init(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @mbedtls_rsa_check_privkey(ptr noundef) #0

declare void @mbedtls_mpi_free(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local void @mbedtls_rsa_free(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @mbedtls_rsa_check_pubkey(ptr noundef) #0

; 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) #3

; Function Attrs: nounwind uwtable
declare dso_local i32 @mbedtls_rsa_pkcs1_encrypt(ptr noundef, ptr noundef, ptr noundef, i32 noundef, i64 noundef, ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @mbedtls_rsa_pkcs1_decrypt(ptr noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, i64 noundef) #0

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

; Function Attrs: nounwind willreturn memory(read)
declare i32 @memcmp(ptr noundef, ptr noundef, i64 noundef) #4

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

; Function Attrs: nounwind uwtable
define dso_local i32 @mbedtls_rsa_self_test(i32 noundef %0) #0 {
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i64, align 8
  %6 = alloca %struct.mbedtls_rsa_context, align 8
  %7 = alloca [24 x i8], align 16
  %8 = alloca [24 x i8], align 16
  %9 = alloca [128 x i8], align 16
  %10 = alloca [20 x i8], align 16
  %11 = alloca %struct.mbedtls_mpi, align 8
  %12 = alloca i32, align 4
  store i32 %0, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 0, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 336, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 24, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 24, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 128, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 20, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 24, ptr %11) #5
  call void @mbedtls_mpi_init(ptr noundef %11)
  call void @mbedtls_rsa_init(ptr noundef %6, i32 noundef 0, i32 noundef 0)
  br label %13

13:                                               ; preds = %1
  %14 = call i32 @mbedtls_mpi_read_string(ptr noundef %11, i32 noundef 16, ptr noundef @.str)
  store i32 %14, ptr %4, align 4, !tbaa !5
  %15 = icmp ne i32 %14, 0
  br i1 %15, label %16, label %17

16:                                               ; preds = %13
  br label %210

17:                                               ; preds = %13
  br label %18

18:                                               ; preds = %17
  br label %19

19:                                               ; preds = %18
  br label %20

20:                                               ; preds = %19
  %21 = call i32 @mbedtls_rsa_import(ptr noundef %6, ptr noundef %11, ptr noundef null, ptr noundef null, ptr noundef null, ptr noundef null)
  store i32 %21, ptr %4, align 4, !tbaa !5
  %22 = icmp ne i32 %21, 0
  br i1 %22, label %23, label %24

23:                                               ; preds = %20
  br label %210

24:                                               ; preds = %20
  br label %25

25:                                               ; preds = %24
  br label %26

26:                                               ; preds = %25
  br label %27

27:                                               ; preds = %26
  %28 = call i32 @mbedtls_mpi_read_string(ptr noundef %11, i32 noundef 16, ptr noundef @.str.1)
  store i32 %28, ptr %4, align 4, !tbaa !5
  %29 = icmp ne i32 %28, 0
  br i1 %29, label %30, label %31

30:                                               ; preds = %27
  br label %210

31:                                               ; preds = %27
  br label %32

32:                                               ; preds = %31
  br label %33

33:                                               ; preds = %32
  br label %34

34:                                               ; preds = %33
  %35 = call i32 @mbedtls_rsa_import(ptr noundef %6, ptr noundef null, ptr noundef %11, ptr noundef null, ptr noundef null, ptr noundef null)
  store i32 %35, ptr %4, align 4, !tbaa !5
  %36 = icmp ne i32 %35, 0
  br i1 %36, label %37, label %38

37:                                               ; preds = %34
  br label %210

38:                                               ; preds = %34
  br label %39

39:                                               ; preds = %38
  br label %40

40:                                               ; preds = %39
  br label %41

41:                                               ; preds = %40
  %42 = call i32 @mbedtls_mpi_read_string(ptr noundef %11, i32 noundef 16, ptr noundef @.str.2)
  store i32 %42, ptr %4, align 4, !tbaa !5
  %43 = icmp ne i32 %42, 0
  br i1 %43, label %44, label %45

44:                                               ; preds = %41
  br label %210

45:                                               ; preds = %41
  br label %46

46:                                               ; preds = %45
  br label %47

47:                                               ; preds = %46
  br label %48

48:                                               ; preds = %47
  %49 = call i32 @mbedtls_rsa_import(ptr noundef %6, ptr noundef null, ptr noundef null, ptr noundef %11, ptr noundef null, ptr noundef null)
  store i32 %49, ptr %4, align 4, !tbaa !5
  %50 = icmp ne i32 %49, 0
  br i1 %50, label %51, label %52

51:                                               ; preds = %48
  br label %210

52:                                               ; preds = %48
  br label %53

53:                                               ; preds = %52
  br label %54

54:                                               ; preds = %53
  br label %55

55:                                               ; preds = %54
  %56 = call i32 @mbedtls_mpi_read_string(ptr noundef %11, i32 noundef 16, ptr noundef @.str.3)
  store i32 %56, ptr %4, align 4, !tbaa !5
  %57 = icmp ne i32 %56, 0
  br i1 %57, label %58, label %59

58:                                               ; preds = %55
  br label %210

59:                                               ; preds = %55
  br label %60

60:                                               ; preds = %59
  br label %61

61:                                               ; preds = %60
  br label %62

62:                                               ; preds = %61
  %63 = call i32 @mbedtls_rsa_import(ptr noundef %6, ptr noundef null, ptr noundef null, ptr noundef null, ptr noundef %11, ptr noundef null)
  store i32 %63, ptr %4, align 4, !tbaa !5
  %64 = icmp ne i32 %63, 0
  br i1 %64, label %65, label %66

65:                                               ; preds = %62
  br label %210

66:                                               ; preds = %62
  br label %67

67:                                               ; preds = %66
  br label %68

68:                                               ; preds = %67
  br label %69

69:                                               ; preds = %68
  %70 = call i32 @mbedtls_mpi_read_string(ptr noundef %11, i32 noundef 16, ptr noundef @.str.4)
  store i32 %70, ptr %4, align 4, !tbaa !5
  %71 = icmp ne i32 %70, 0
  br i1 %71, label %72, label %73

72:                                               ; preds = %69
  br label %210

73:                                               ; preds = %69
  br label %74

74:                                               ; preds = %73
  br label %75

75:                                               ; preds = %74
  br label %76

76:                                               ; preds = %75
  %77 = call i32 @mbedtls_rsa_import(ptr noundef %6, ptr noundef null, ptr noundef null, ptr noundef null, ptr noundef null, ptr noundef %11)
  store i32 %77, ptr %4, align 4, !tbaa !5
  %78 = icmp ne i32 %77, 0
  br i1 %78, label %79, label %80

79:                                               ; preds = %76
  br label %210

80:                                               ; preds = %76
  br label %81

81:                                               ; preds = %80
  br label %82

82:                                               ; preds = %81
  br label %83

83:                                               ; preds = %82
  %84 = call i32 @mbedtls_rsa_complete(ptr noundef %6)
  store i32 %84, ptr %4, align 4, !tbaa !5
  %85 = icmp ne i32 %84, 0
  br i1 %85, label %86, label %87

86:                                               ; preds = %83
  br label %210

87:                                               ; preds = %83
  br label %88

88:                                               ; preds = %87
  br label %89

89:                                               ; preds = %88
  %90 = load i32, ptr %3, align 4, !tbaa !5
  %91 = icmp ne i32 %90, 0
  br i1 %91, label %92, label %94

92:                                               ; preds = %89
  %93 = call i32 (ptr, ...) @printf(ptr noundef @.str.5)
  br label %94

94:                                               ; preds = %92, %89
  %95 = call i32 @mbedtls_rsa_check_pubkey(ptr noundef %6)
  %96 = icmp ne i32 %95, 0
  br i1 %96, label %100, label %97

97:                                               ; preds = %94
  %98 = call i32 @mbedtls_rsa_check_privkey(ptr noundef %6)
  %99 = icmp ne i32 %98, 0
  br i1 %99, label %100, label %106

100:                                              ; preds = %97, %94
  %101 = load i32, ptr %3, align 4, !tbaa !5
  %102 = icmp ne i32 %101, 0
  br i1 %102, label %103, label %105

103:                                              ; preds = %100
  %104 = call i32 (ptr, ...) @printf(ptr noundef @.str.6)
  br label %105

105:                                              ; preds = %103, %100
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %210

106:                                              ; preds = %97
  %107 = load i32, ptr %3, align 4, !tbaa !5
  %108 = icmp ne i32 %107, 0
  br i1 %108, label %109, label %111

109:                                              ; preds = %106
  %110 = call i32 (ptr, ...) @printf(ptr noundef @.str.7)
  br label %111

111:                                              ; preds = %109, %106
  %112 = getelementptr inbounds [24 x i8], ptr %7, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %112, ptr align 1 @.str.8, i64 24, i1 false)
  %113 = getelementptr inbounds [24 x i8], ptr %7, i64 0, i64 0
  %114 = getelementptr inbounds [128 x i8], ptr %9, i64 0, i64 0
  %115 = call i32 @mbedtls_rsa_pkcs1_encrypt(ptr noundef %6, ptr noundef @myrand, ptr noundef null, i32 noundef 0, i64 noundef 24, ptr noundef %113, ptr noundef %114)
  %116 = icmp ne i32 %115, 0
  br i1 %116, label %117, label %123

117:                                              ; preds = %111
  %118 = load i32, ptr %3, align 4, !tbaa !5
  %119 = icmp ne i32 %118, 0
  br i1 %119, label %120, label %122

120:                                              ; preds = %117
  %121 = call i32 (ptr, ...) @printf(ptr noundef @.str.6)
  br label %122

122:                                              ; preds = %120, %117
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %210

123:                                              ; preds = %111
  %124 = load i32, ptr %3, align 4, !tbaa !5
  %125 = icmp ne i32 %124, 0
  br i1 %125, label %126, label %128

126:                                              ; preds = %123
  %127 = call i32 (ptr, ...) @printf(ptr noundef @.str.9)
  br label %128

128:                                              ; preds = %126, %123
  %129 = getelementptr inbounds [128 x i8], ptr %9, i64 0, i64 0
  %130 = getelementptr inbounds [24 x i8], ptr %8, i64 0, i64 0
  %131 = call i32 @mbedtls_rsa_pkcs1_decrypt(ptr noundef %6, ptr noundef @myrand, ptr noundef null, i32 noundef 1, ptr noundef %5, ptr noundef %129, ptr noundef %130, i64 noundef 24)
  %132 = icmp ne i32 %131, 0
  br i1 %132, label %133, label %139

133:                                              ; preds = %128
  %134 = load i32, ptr %3, align 4, !tbaa !5
  %135 = icmp ne i32 %134, 0
  br i1 %135, label %136, label %138

136:                                              ; preds = %133
  %137 = call i32 (ptr, ...) @printf(ptr noundef @.str.6)
  br label %138

138:                                              ; preds = %136, %133
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %210

139:                                              ; preds = %128
  %140 = getelementptr inbounds [24 x i8], ptr %8, i64 0, i64 0
  %141 = getelementptr inbounds [24 x i8], ptr %7, i64 0, i64 0
  %142 = load i64, ptr %5, align 8, !tbaa !9
  %143 = call i32 @memcmp(ptr noundef %140, ptr noundef %141, i64 noundef %142) #6
  %144 = icmp ne i32 %143, 0
  br i1 %144, label %145, label %151

145:                                              ; preds = %139
  %146 = load i32, ptr %3, align 4, !tbaa !5
  %147 = icmp ne i32 %146, 0
  br i1 %147, label %148, label %150

148:                                              ; preds = %145
  %149 = call i32 (ptr, ...) @printf(ptr noundef @.str.6)
  br label %150

150:                                              ; preds = %148, %145
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %210

151:                                              ; preds = %139
  %152 = load i32, ptr %3, align 4, !tbaa !5
  %153 = icmp ne i32 %152, 0
  br i1 %153, label %154, label %156

154:                                              ; preds = %151
  %155 = call i32 (ptr, ...) @printf(ptr noundef @.str.10)
  br label %156

156:                                              ; preds = %154, %151
  %157 = load i32, ptr %3, align 4, !tbaa !5
  %158 = icmp ne i32 %157, 0
  br i1 %158, label %159, label %161

159:                                              ; preds = %156
  %160 = call i32 (ptr, ...) @printf(ptr noundef @.str.11)
  br label %161

161:                                              ; preds = %159, %156
  %162 = getelementptr inbounds [24 x i8], ptr %7, i64 0, i64 0
  %163 = getelementptr inbounds [20 x i8], ptr %10, i64 0, i64 0
  %164 = call i32 @mbedtls_sha1_ret(ptr noundef %162, i64 noundef 24, ptr noundef %163)
  %165 = icmp ne i32 %164, 0
  br i1 %165, label %166, label %172

166:                                              ; preds = %161
  %167 = load i32, ptr %3, align 4, !tbaa !5
  %168 = icmp ne i32 %167, 0
  br i1 %168, label %169, label %171

169:                                              ; preds = %166
  %170 = call i32 (ptr, ...) @printf(ptr noundef @.str.6)
  br label %171

171:                                              ; preds = %169, %166
  store i32 1, ptr %2, align 4
  store i32 1, ptr %12, align 4
  br label %212

172:                                              ; preds = %161
  %173 = getelementptr inbounds [20 x i8], ptr %10, i64 0, i64 0
  %174 = getelementptr inbounds [128 x i8], ptr %9, i64 0, i64 0
  %175 = call i32 @mbedtls_rsa_pkcs1_sign(ptr noundef %6, ptr noundef @myrand, ptr noundef null, i32 noundef 1, i32 noundef 4, i32 noundef 0, ptr noundef %173, ptr noundef %174)
  %176 = icmp ne i32 %175, 0
  br i1 %176, label %177, label %183

177:                                              ; preds = %172
  %178 = load i32, ptr %3, align 4, !tbaa !5
  %179 = icmp ne i32 %178, 0
  br i1 %179, label %180, label %182

180:                                              ; preds = %177
  %181 = call i32 (ptr, ...) @printf(ptr noundef @.str.6)
  br label %182

182:                                              ; preds = %180, %177
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %210

183:                                              ; preds = %172
  %184 = load i32, ptr %3, align 4, !tbaa !5
  %185 = icmp ne i32 %184, 0
  br i1 %185, label %186, label %188

186:                                              ; preds = %183
  %187 = call i32 (ptr, ...) @printf(ptr noundef @.str.12)
  br label %188

188:                                              ; preds = %186, %183
  %189 = getelementptr inbounds [20 x i8], ptr %10, i64 0, i64 0
  %190 = getelementptr inbounds [128 x i8], ptr %9, i64 0, i64 0
  %191 = call i32 @mbedtls_rsa_pkcs1_verify(ptr noundef %6, ptr noundef null, ptr noundef null, i32 noundef 0, i32 noundef 4, i32 noundef 0, ptr noundef %189, ptr noundef %190)
  %192 = icmp ne i32 %191, 0
  br i1 %192, label %193, label %199

193:                                              ; preds = %188
  %194 = load i32, ptr %3, align 4, !tbaa !5
  %195 = icmp ne i32 %194, 0
  br i1 %195, label %196, label %198

196:                                              ; preds = %193
  %197 = call i32 (ptr, ...) @printf(ptr noundef @.str.6)
  br label %198

198:                                              ; preds = %196, %193
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %210

199:                                              ; preds = %188
  %200 = load i32, ptr %3, align 4, !tbaa !5
  %201 = icmp ne i32 %200, 0
  br i1 %201, label %202, label %204

202:                                              ; preds = %199
  %203 = call i32 (ptr, ...) @printf(ptr noundef @.str.10)
  br label %204

204:                                              ; preds = %202, %199
  %205 = load i32, ptr %3, align 4, !tbaa !5
  %206 = icmp ne i32 %205, 0
  br i1 %206, label %207, label %209

207:                                              ; preds = %204
  %208 = call i32 (ptr, ...) @printf(ptr noundef @.str.13)
  br label %209

209:                                              ; preds = %207, %204
  br label %210

210:                                              ; preds = %209, %198, %182, %150, %138, %122, %105, %86, %79, %72, %65, %58, %51, %44, %37, %30, %23, %16
  call void @mbedtls_mpi_free(ptr noundef %11)
  call void @mbedtls_rsa_free(ptr noundef %6)
  %211 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %211, ptr %2, align 4
  store i32 1, ptr %12, align 4
  br label %212

212:                                              ; preds = %210, %171
  call void @llvm.lifetime.end.p0(i64 24, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 20, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 128, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 336, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  %213 = load i32, ptr %2, align 4
  ret i32 %213
}

declare i32 @mbedtls_mpi_read_string(ptr noundef, i32 noundef, ptr noundef) #2

declare i32 @printf(ptr noundef, ...) #2

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

declare i32 @mbedtls_sha1_ret(ptr noundef, i64 noundef, ptr noundef) #2

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nounwind willreturn memory(read) "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 #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }

!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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !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_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 }

@.str = external hidden unnamed_addr constant [257 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [129 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [129 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [257 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i32 @mbedtls_rsa_import(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #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_complete(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @mbedtls_rsa_init(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

declare void @mbedtls_mpi_init(ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @mbedtls_rsa_check_privkey(ptr noundef) local_unnamed_addr #0

declare void @mbedtls_mpi_free(ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local void @mbedtls_rsa_free(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @mbedtls_rsa_check_pubkey(ptr noundef) local_unnamed_addr #0

; 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) #3

; Function Attrs: nounwind uwtable
declare dso_local i32 @mbedtls_rsa_pkcs1_encrypt(ptr noundef, ptr noundef, ptr noundef, i32 noundef, i64 noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @mbedtls_rsa_pkcs1_decrypt(ptr noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #0

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @mbedtls_rsa_self_test(i32 noundef %0) local_unnamed_addr #0 {
  %2 = alloca i64, align 8
  %3 = alloca %struct.mbedtls_rsa_context, align 8
  %4 = alloca [24 x i8], align 16
  %5 = alloca [24 x i8], align 16
  %6 = alloca [128 x i8], align 16
  %7 = alloca [20 x i8], align 16
  %8 = alloca %struct.mbedtls_mpi, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 336, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #6
  call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %6) #6
  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %7) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %8) #6
  call void @mbedtls_mpi_init(ptr noundef nonnull %8) #6
  call void @mbedtls_rsa_init(ptr noundef nonnull %3, i32 noundef 0, i32 noundef 0)
  %9 = call i32 @mbedtls_mpi_read_string(ptr noundef nonnull %8, i32 noundef 16, ptr noundef nonnull @.str) #6
  %.not = icmp eq i32 %9, 0
  br i1 %.not, label %10, label %.critedge49

10:                                               ; preds = %1
  %11 = call i32 @mbedtls_rsa_import(ptr noundef nonnull %3, ptr noundef nonnull %8, ptr noundef null, ptr noundef null, ptr noundef null, ptr noundef null)
  %.not29 = icmp eq i32 %11, 0
  br i1 %.not29, label %12, label %.critedge49

12:                                               ; preds = %10
  %13 = call i32 @mbedtls_mpi_read_string(ptr noundef nonnull %8, i32 noundef 16, ptr noundef nonnull @.str.1) #6
  %.not30 = icmp eq i32 %13, 0
  br i1 %.not30, label %14, label %.critedge49

14:                                               ; preds = %12
  %15 = call i32 @mbedtls_rsa_import(ptr noundef nonnull %3, ptr noundef null, ptr noundef nonnull %8, ptr noundef null, ptr noundef null, ptr noundef null)
  %.not31 = icmp eq i32 %15, 0
  br i1 %.not31, label %16, label %.critedge49

16:                                               ; preds = %14
  %17 = call i32 @mbedtls_mpi_read_string(ptr noundef nonnull %8, i32 noundef 16, ptr noundef nonnull @.str.2) #6
  %.not32 = icmp eq i32 %17, 0
  br i1 %.not32, label %18, label %.critedge49

18:                                               ; preds = %16
  %19 = call i32 @mbedtls_rsa_import(ptr noundef nonnull %3, ptr noundef null, ptr noundef null, ptr noundef nonnull %8, ptr noundef null, ptr noundef null)
  %.not33 = icmp eq i32 %19, 0
  br i1 %.not33, label %20, label %.critedge49

20:                                               ; preds = %18
  %21 = call i32 @mbedtls_mpi_read_string(ptr noundef nonnull %8, i32 noundef 16, ptr noundef nonnull @.str.3) #6
  %.not34 = icmp eq i32 %21, 0
  br i1 %.not34, label %22, label %.critedge49

22:                                               ; preds = %20
  %23 = call i32 @mbedtls_rsa_import(ptr noundef nonnull %3, ptr noundef null, ptr noundef null, ptr noundef null, ptr noundef nonnull %8, ptr noundef null)
  %.not35 = icmp eq i32 %23, 0
  br i1 %.not35, label %24, label %.critedge49

24:                                               ; preds = %22
  %25 = call i32 @mbedtls_mpi_read_string(ptr noundef nonnull %8, i32 noundef 16, ptr noundef nonnull @.str.4) #6
  %.not36 = icmp eq i32 %25, 0
  br i1 %.not36, label %26, label %.critedge49

26:                                               ; preds = %24
  %27 = call i32 @mbedtls_rsa_import(ptr noundef nonnull %3, ptr noundef null, ptr noundef null, ptr noundef null, ptr noundef null, ptr noundef nonnull %8)
  %.not37 = icmp eq i32 %27, 0
  br i1 %.not37, label %28, label %.critedge49

28:                                               ; preds = %26
  %29 = call i32 @mbedtls_rsa_complete(ptr noundef nonnull %3)
  %.not38 = icmp eq i32 %29, 0
  br i1 %.not38, label %30, label %.critedge49

30:                                               ; preds = %28
  %.not39 = icmp eq i32 %0, 0
  br i1 %.not39, label %33, label %31

31:                                               ; preds = %30
  %32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5)
  br label %33

33:                                               ; preds = %31, %30
  %34 = call i32 @mbedtls_rsa_check_pubkey(ptr noundef nonnull %3)
  %.not40 = icmp eq i32 %34, 0
  br i1 %.not40, label %35, label %37

35:                                               ; preds = %33
  %36 = call i32 @mbedtls_rsa_check_privkey(ptr noundef nonnull %3)
  %.not41 = icmp eq i32 %36, 0
  br i1 %.not41, label %40, label %37

37:                                               ; preds = %35, %33
  br i1 %.not39, label %.critedge49, label %38

38:                                               ; preds = %37
  %39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6)
  br label %.critedge49

40:                                               ; preds = %35
  br i1 %.not39, label %43, label %41

41:                                               ; preds = %40
  %42 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7)
  br label %43

43:                                               ; preds = %41, %40
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(24) %4, ptr noundef nonnull align 1 dereferenceable(24) @.str.8, i64 24, i1 false)
  %44 = call i32 @mbedtls_rsa_pkcs1_encrypt(ptr noundef nonnull %3, ptr noundef nonnull @myrand, ptr noundef null, i32 noundef 0, i64 noundef 24, ptr noundef nonnull %4, ptr noundef nonnull %6)
  %.not42 = icmp eq i32 %44, 0
  br i1 %.not42, label %48, label %45

45:                                               ; preds = %43
  br i1 %.not39, label %.critedge49, label %46

46:                                               ; preds = %45
  %47 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6)
  br label %.critedge49

48:                                               ; preds = %43
  br i1 %.not39, label %49, label %.thread

49:                                               ; preds = %48
  %50 = call i32 @mbedtls_rsa_pkcs1_decrypt(ptr noundef nonnull %3, ptr noundef nonnull @myrand, ptr noundef null, i32 noundef 1, ptr noundef nonnull %2, ptr noundef nonnull %6, ptr noundef nonnull %5, i64 noundef 24)
  %.not43 = icmp eq i32 %50, 0
  br i1 %.not43, label %55, label %.critedge49

.thread:                                          ; preds = %48
  %51 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9)
  %52 = call i32 @mbedtls_rsa_pkcs1_decrypt(ptr noundef nonnull %3, ptr noundef nonnull @myrand, ptr noundef null, i32 noundef 1, ptr noundef nonnull %2, ptr noundef nonnull %6, ptr noundef nonnull %5, i64 noundef 24)
  %.not4350 = icmp eq i32 %52, 0
  br i1 %.not4350, label %.thread52, label %53

53:                                               ; preds = %.thread
  %54 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6)
  br label %.critedge49

55:                                               ; preds = %49
  %56 = load i64, ptr %2, align 8, !tbaa !5
  %bcmp = call i32 @bcmp(ptr nonnull %5, ptr nonnull %4, i64 %56)
  %.not44 = icmp eq i32 %bcmp, 0
  br i1 %.not44, label %.critedge, label %.critedge49

.thread52:                                        ; preds = %.thread
  %57 = load i64, ptr %2, align 8, !tbaa !5
  %bcmp53 = call i32 @bcmp(ptr nonnull %5, ptr nonnull %4, i64 %57)
  %.not4454 = icmp eq i32 %bcmp53, 0
  br i1 %.not4454, label %.critedge.thread, label %58

58:                                               ; preds = %.thread52
  %59 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6)
  br label %.critedge49

.critedge:                                        ; preds = %55
  %60 = call i32 @mbedtls_sha1_ret(ptr noundef nonnull %4, i64 noundef 24, ptr noundef nonnull %7) #6
  %.not45 = icmp eq i32 %60, 0
  br i1 %.not45, label %65, label %78

.critedge.thread:                                 ; preds = %.thread52
  %61 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10)
  %62 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.11)
  %63 = call i32 @mbedtls_sha1_ret(ptr noundef nonnull %4, i64 noundef 24, ptr noundef nonnull %7) #6
  %.not4557 = icmp eq i32 %63, 0
  br i1 %.not4557, label %.thread59, label %.thread58

.thread58:                                        ; preds = %.critedge.thread
  %64 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6)
  br label %78

65:                                               ; preds = %.critedge
  %66 = call i32 @mbedtls_rsa_pkcs1_sign(ptr noundef nonnull %3, ptr noundef nonnull @myrand, ptr noundef null, i32 noundef 1, i32 noundef 4, i32 noundef 0, ptr noundef nonnull %7, ptr noundef nonnull %6)
  %.not46 = icmp eq i32 %66, 0
  br i1 %.not46, label %69, label %.critedge49

.thread59:                                        ; preds = %.critedge.thread
  %67 = call i32 @mbedtls_rsa_pkcs1_sign(ptr noundef nonnull %3, ptr noundef nonnull @myrand, ptr noundef null, i32 noundef 1, i32 noundef 4, i32 noundef 0, ptr noundef nonnull %7, ptr noundef nonnull %6)
  %.not4660 = icmp eq i32 %67, 0
  br i1 %.not4660, label %.thread63, label %.thread61

.thread61:                                        ; preds = %.thread59
  %68 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6)
  br label %.critedge49

69:                                               ; preds = %65
  %70 = call i32 @mbedtls_rsa_pkcs1_verify(ptr noundef nonnull %3, ptr noundef null, ptr noundef null, i32 noundef 0, i32 noundef 4, i32 noundef 0, ptr noundef nonnull %7, ptr noundef nonnull %6)
  %.not47 = icmp ne i32 %70, 0
  %spec.select = zext i1 %.not47 to i32
  br label %.critedge49

.thread63:                                        ; preds = %.thread59
  %71 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.12)
  %72 = call i32 @mbedtls_rsa_pkcs1_verify(ptr noundef nonnull %3, ptr noundef null, ptr noundef null, i32 noundef 0, i32 noundef 4, i32 noundef 0, ptr noundef nonnull %7, ptr noundef nonnull %6)
  %.not4764 = icmp eq i32 %72, 0
  br i1 %.not4764, label %75, label %73

73:                                               ; preds = %.thread63
  %74 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6)
  br label %.critedge49

75:                                               ; preds = %.thread63
  %76 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10)
  %77 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.13)
  br label %.critedge49

.critedge49:                                      ; preds = %65, %69, %55, %49, %73, %.thread61, %58, %53, %45, %46, %37, %38, %75, %28, %26, %24, %22, %20, %18, %16, %14, %12, %10, %1
  %.0 = phi i32 [ %9, %1 ], [ %11, %10 ], [ %13, %12 ], [ %15, %14 ], [ %17, %16 ], [ %19, %18 ], [ %21, %20 ], [ %23, %22 ], [ %25, %24 ], [ %27, %26 ], [ %29, %28 ], [ 0, %75 ], [ 1, %38 ], [ 1, %37 ], [ 1, %46 ], [ 1, %45 ], [ 1, %53 ], [ 1, %58 ], [ 1, %.thread61 ], [ 1, %73 ], [ 1, %49 ], [ 1, %55 ], [ %spec.select, %69 ], [ 1, %65 ]
  call void @mbedtls_mpi_free(ptr noundef nonnull %8) #6
  call void @mbedtls_rsa_free(ptr noundef nonnull %3)
  br label %78

78:                                               ; preds = %.critedge, %.thread58, %.critedge49
  %.017 = phi i32 [ %.0, %.critedge49 ], [ 1, %.thread58 ], [ 1, %.critedge ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 336, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  ret i32 %.017
}

declare i32 @mbedtls_mpi_read_string(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4

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

declare i32 @mbedtls_sha1_ret(ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #5

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nofree nounwind "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 #5 = { nofree nounwind willreturn memory(argmem: read) }
attributes #6 = { 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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


; Effective O3 passes: ConstraintEliminationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,SROAPass,SimplifyCFGPass