; LLVM IR from ARMmbed/mbed-crypto :: programs/pkey (gen_key)

; 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.options = type { i32, i32, i32, ptr, i32, i32 }
%struct.mbedtls_pk_context = type { ptr, ptr }
%struct.mbedtls_mpi = type { i32, i64, ptr }
%struct.mbedtls_entropy_context = type { i32, %struct.mbedtls_sha512_context, i32, [20 x %struct.mbedtls_entropy_source_state] }
%struct.mbedtls_sha512_context = type { [2 x i64], [8 x i64], [128 x i8], i32 }
%struct.mbedtls_entropy_source_state = type { ptr, ptr, i64, i64, i32 }
%struct.mbedtls_ctr_drbg_context = type { [16 x i8], i32, i32, i64, i32, %struct.mbedtls_aes_context, ptr, ptr }
%struct.mbedtls_aes_context = type { i32, ptr, [68 x i32] }
%struct.mbedtls_ecp_curve_info = type { i32, i16, i16, ptr }
%struct.mbedtls_ecp_keypair = type { %struct.mbedtls_ecp_group, %struct.mbedtls_mpi, %struct.mbedtls_ecp_point }
%struct.mbedtls_ecp_group = type { i32, %struct.mbedtls_mpi, %struct.mbedtls_mpi, %struct.mbedtls_mpi, %struct.mbedtls_ecp_point, %struct.mbedtls_mpi, i64, i64, i32, ptr, ptr, ptr, ptr, ptr, i64 }
%struct.mbedtls_ecp_point = type { %struct.mbedtls_mpi, %struct.mbedtls_mpi, %struct.mbedtls_mpi }

@.str.2 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [297 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [8 x i8], align 1
@opt = external dso_local global %struct.options, align 8
@.str.7 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [44 x i8], align 1
@stdout = external global ptr, align 8
@.str.19 = external hidden unnamed_addr constant [57 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [52 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.37 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.38 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.39 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.41 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.42 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.43 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.44 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.45 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i32 @dev_random_entropy_poll(ptr noundef, ptr noundef, i64 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
define dso_local i32 @main(i32 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca %struct.mbedtls_pk_context, align 8
  %9 = alloca [1024 x i8], align 16
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca %struct.mbedtls_mpi, align 8
  %14 = alloca %struct.mbedtls_mpi, align 8
  %15 = alloca %struct.mbedtls_mpi, align 8
  %16 = alloca %struct.mbedtls_mpi, align 8
  %17 = alloca %struct.mbedtls_mpi, align 8
  %18 = alloca %struct.mbedtls_mpi, align 8
  %19 = alloca %struct.mbedtls_mpi, align 8
  %20 = alloca %struct.mbedtls_mpi, align 8
  %21 = alloca %struct.mbedtls_entropy_context, align 8
  %22 = alloca %struct.mbedtls_ctr_drbg_context, align 8
  %23 = alloca ptr, align 8
  %24 = alloca ptr, align 8
  %25 = alloca ptr, align 8
  %26 = alloca i32, align 4
  %27 = alloca ptr, align 8
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  store i32 1, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  store i32 1, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #7
  call void @llvm.lifetime.start.p0(i64 1024, ptr %9) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.start.p0(i64 24, ptr %13) #7
  call void @llvm.lifetime.start.p0(i64 24, ptr %14) #7
  call void @llvm.lifetime.start.p0(i64 24, ptr %15) #7
  call void @llvm.lifetime.start.p0(i64 24, ptr %16) #7
  call void @llvm.lifetime.start.p0(i64 24, ptr %17) #7
  call void @llvm.lifetime.start.p0(i64 24, ptr %18) #7
  call void @llvm.lifetime.start.p0(i64 24, ptr %19) #7
  call void @llvm.lifetime.start.p0(i64 24, ptr %20) #7
  call void @llvm.lifetime.start.p0(i64 1032, ptr %21) #7
  call void @llvm.lifetime.start.p0(i64 344, ptr %22) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #7
  store ptr @.str.2, ptr %23, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #7
  call void @mbedtls_mpi_init(ptr noundef %13)
  call void @mbedtls_mpi_init(ptr noundef %14)
  call void @mbedtls_mpi_init(ptr noundef %15)
  call void @mbedtls_mpi_init(ptr noundef %16)
  call void @mbedtls_mpi_init(ptr noundef %17)
  call void @mbedtls_mpi_init(ptr noundef %18)
  call void @mbedtls_mpi_init(ptr noundef %19)
  call void @mbedtls_mpi_init(ptr noundef %20)
  call void @mbedtls_pk_init(ptr noundef %8)
  call void @mbedtls_ctr_drbg_init(ptr noundef %22)
  %28 = getelementptr inbounds [1024 x i8], ptr %9, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 16 %28, i8 0, i64 1024, i1 false)
  %29 = load i32, ptr %4, align 4, !tbaa !5
  %30 = icmp eq i32 %29, 0
  br i1 %30, label %31, label %52

31:                                               ; preds = %2
  br label %32

32:                                               ; preds = %153, %151, %128, %118, %103, %86, %69, %31
  %33 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  %34 = call i32 (ptr, ...) @printf(ptr noundef @.str.4)
  %35 = call ptr @mbedtls_ecp_curve_list()
  store ptr %35, ptr %24, align 8, !tbaa !9
  %36 = load ptr, ptr %24, align 8, !tbaa !9
  %37 = getelementptr inbounds %struct.mbedtls_ecp_curve_info, ptr %36, i32 0, i32 3
  %38 = load ptr, ptr %37, align 8, !tbaa !11
  %39 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, ptr noundef %38)
  br label %40

40:                                               ; preds = %46, %32
  %41 = load ptr, ptr %24, align 8, !tbaa !9
  %42 = getelementptr inbounds %struct.mbedtls_ecp_curve_info, ptr %41, i32 1
  store ptr %42, ptr %24, align 8, !tbaa !9
  %43 = getelementptr inbounds %struct.mbedtls_ecp_curve_info, ptr %42, i32 0, i32 3
  %44 = load ptr, ptr %43, align 8, !tbaa !11
  %45 = icmp ne ptr %44, null
  br i1 %45, label %46, label %51

46:                                               ; preds = %40
  %47 = load ptr, ptr %24, align 8, !tbaa !9
  %48 = getelementptr inbounds %struct.mbedtls_ecp_curve_info, ptr %47, i32 0, i32 3
  %49 = load ptr, ptr %48, align 8, !tbaa !11
  %50 = call i32 (ptr, ...) @printf(ptr noundef @.str.6, ptr noundef %49)
  br label %40, !llvm.loop !14

51:                                               ; preds = %40
  br label %312

52:                                               ; preds = %2
  store i32 1, ptr @opt, align 8, !tbaa !16
  store i32 4096, ptr getelementptr inbounds (%struct.options, ptr @opt, i32 0, i32 1), align 4, !tbaa !18
  %53 = call ptr @mbedtls_ecp_curve_list()
  %54 = getelementptr inbounds %struct.mbedtls_ecp_curve_info, ptr %53, i32 0, i32 0
  %55 = load i32, ptr %54, align 8, !tbaa !19
  store i32 %55, ptr getelementptr inbounds (%struct.options, ptr @opt, i32 0, i32 2), align 8, !tbaa !20
  store ptr @.str.7, ptr getelementptr inbounds (%struct.options, ptr @opt, i32 0, i32 3), align 8, !tbaa !21
  store i32 0, ptr getelementptr inbounds (%struct.options, ptr @opt, i32 0, i32 4), align 8, !tbaa !22
  store i32 0, ptr getelementptr inbounds (%struct.options, ptr @opt, i32 0, i32 5), align 4, !tbaa !23
  store i32 1, ptr %10, align 4, !tbaa !5
  br label %56

56:                                               ; preds = %160, %52
  %57 = load i32, ptr %10, align 4, !tbaa !5
  %58 = load i32, ptr %4, align 4, !tbaa !5
  %59 = icmp slt i32 %57, %58
  br i1 %59, label %60, label %163

60:                                               ; preds = %56
  %61 = load ptr, ptr %5, align 8, !tbaa !9
  %62 = load i32, ptr %10, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds ptr, ptr %61, i64 %63
  %65 = load ptr, ptr %64, align 8, !tbaa !9
  store ptr %65, ptr %11, align 8, !tbaa !9
  %66 = load ptr, ptr %11, align 8, !tbaa !9
  %67 = call ptr @strchr(ptr noundef %66, i32 noundef 61) #8
  store ptr %67, ptr %12, align 8, !tbaa !9
  %68 = icmp eq ptr %67, null
  br i1 %68, label %69, label %70

69:                                               ; preds = %60
  br label %32

70:                                               ; preds = %60
  %71 = load ptr, ptr %12, align 8, !tbaa !9
  %72 = getelementptr inbounds i8, ptr %71, i32 1
  store ptr %72, ptr %12, align 8, !tbaa !9
  store i8 0, ptr %71, align 1, !tbaa !24
  %73 = load ptr, ptr %11, align 8, !tbaa !9
  %74 = call i32 @strcmp(ptr noundef %73, ptr noundef @.str.8) #8
  %75 = icmp eq i32 %74, 0
  br i1 %75, label %76, label %89

76:                                               ; preds = %70
  %77 = load ptr, ptr %12, align 8, !tbaa !9
  %78 = call i32 @strcmp(ptr noundef %77, ptr noundef @.str.9) #8
  %79 = icmp eq i32 %78, 0
  br i1 %79, label %80, label %81

80:                                               ; preds = %76
  store i32 1, ptr @opt, align 8, !tbaa !16
  br label %88

81:                                               ; preds = %76
  %82 = load ptr, ptr %12, align 8, !tbaa !9
  %83 = call i32 @strcmp(ptr noundef %82, ptr noundef @.str.10) #8
  %84 = icmp eq i32 %83, 0
  br i1 %84, label %85, label %86

85:                                               ; preds = %81
  store i32 2, ptr @opt, align 8, !tbaa !16
  br label %87

86:                                               ; preds = %81
  br label %32

87:                                               ; preds = %85
  br label %88

88:                                               ; preds = %87, %80
  br label %159

89:                                               ; preds = %70
  %90 = load ptr, ptr %11, align 8, !tbaa !9
  %91 = call i32 @strcmp(ptr noundef %90, ptr noundef @.str.11) #8
  %92 = icmp eq i32 %91, 0
  br i1 %92, label %93, label %106

93:                                               ; preds = %89
  %94 = load ptr, ptr %12, align 8, !tbaa !9
  %95 = call i32 @strcmp(ptr noundef %94, ptr noundef @.str.12) #8
  %96 = icmp eq i32 %95, 0
  br i1 %96, label %97, label %98

97:                                               ; preds = %93
  store i32 0, ptr getelementptr inbounds (%struct.options, ptr @opt, i32 0, i32 4), align 8, !tbaa !22
  br label %105

98:                                               ; preds = %93
  %99 = load ptr, ptr %12, align 8, !tbaa !9
  %100 = call i32 @strcmp(ptr noundef %99, ptr noundef @.str.13) #8
  %101 = icmp eq i32 %100, 0
  br i1 %101, label %102, label %103

102:                                              ; preds = %98
  store i32 1, ptr getelementptr inbounds (%struct.options, ptr @opt, i32 0, i32 4), align 8, !tbaa !22
  br label %104

103:                                              ; preds = %98
  br label %32

104:                                              ; preds = %102
  br label %105

105:                                              ; preds = %104, %97
  br label %158

106:                                              ; preds = %89
  %107 = load ptr, ptr %11, align 8, !tbaa !9
  %108 = call i32 @strcmp(ptr noundef %107, ptr noundef @.str.14) #8
  %109 = icmp eq i32 %108, 0
  br i1 %109, label %110, label %120

110:                                              ; preds = %106
  %111 = load ptr, ptr %12, align 8, !tbaa !9
  %112 = call i32 @atoi(ptr noundef %111) #8
  store i32 %112, ptr getelementptr inbounds (%struct.options, ptr @opt, i32 0, i32 1), align 4, !tbaa !18
  %113 = load i32, ptr getelementptr inbounds (%struct.options, ptr @opt, i32 0, i32 1), align 4, !tbaa !18
  %114 = icmp slt i32 %113, 1024
  br i1 %114, label %118, label %115

115:                                              ; preds = %110
  %116 = load i32, ptr getelementptr inbounds (%struct.options, ptr @opt, i32 0, i32 1), align 4, !tbaa !18
  %117 = icmp sgt i32 %116, 8192
  br i1 %117, label %118, label %119

118:                                              ; preds = %115, %110
  br label %32

119:                                              ; preds = %115
  br label %157

120:                                              ; preds = %106
  %121 = load ptr, ptr %11, align 8, !tbaa !9
  %122 = call i32 @strcmp(ptr noundef %121, ptr noundef @.str.15) #8
  %123 = icmp eq i32 %122, 0
  br i1 %123, label %124, label %133

124:                                              ; preds = %120
  %125 = load ptr, ptr %12, align 8, !tbaa !9
  %126 = call ptr @mbedtls_ecp_curve_info_from_name(ptr noundef %125)
  store ptr %126, ptr %24, align 8, !tbaa !9
  %127 = icmp eq ptr %126, null
  br i1 %127, label %128, label %129

128:                                              ; preds = %124
  br label %32

129:                                              ; preds = %124
  %130 = load ptr, ptr %24, align 8, !tbaa !9
  %131 = getelementptr inbounds %struct.mbedtls_ecp_curve_info, ptr %130, i32 0, i32 0
  %132 = load i32, ptr %131, align 8, !tbaa !19
  store i32 %132, ptr getelementptr inbounds (%struct.options, ptr @opt, i32 0, i32 2), align 8, !tbaa !20
  br label %156

133:                                              ; preds = %120
  %134 = load ptr, ptr %11, align 8, !tbaa !9
  %135 = call i32 @strcmp(ptr noundef %134, ptr noundef @.str.16) #8
  %136 = icmp eq i32 %135, 0
  br i1 %136, label %137, label %139

137:                                              ; preds = %133
  %138 = load ptr, ptr %12, align 8, !tbaa !9
  store ptr %138, ptr getelementptr inbounds (%struct.options, ptr @opt, i32 0, i32 3), align 8, !tbaa !21
  br label %155

139:                                              ; preds = %133
  %140 = load ptr, ptr %11, align 8, !tbaa !9
  %141 = call i32 @strcmp(ptr noundef %140, ptr noundef @.str.17) #8
  %142 = icmp eq i32 %141, 0
  br i1 %142, label %143, label %153

143:                                              ; preds = %139
  %144 = load ptr, ptr %12, align 8, !tbaa !9
  %145 = call i32 @atoi(ptr noundef %144) #8
  store i32 %145, ptr getelementptr inbounds (%struct.options, ptr @opt, i32 0, i32 5), align 4, !tbaa !23
  %146 = load i32, ptr getelementptr inbounds (%struct.options, ptr @opt, i32 0, i32 5), align 4, !tbaa !23
  %147 = icmp slt i32 %146, 0
  br i1 %147, label %151, label %148

148:                                              ; preds = %143
  %149 = load i32, ptr getelementptr inbounds (%struct.options, ptr @opt, i32 0, i32 5), align 4, !tbaa !23
  %150 = icmp sgt i32 %149, 1
  br i1 %150, label %151, label %152

151:                                              ; preds = %148, %143
  br label %32

152:                                              ; preds = %148
  br label %154

153:                                              ; preds = %139
  br label %32

154:                                              ; preds = %152
  br label %155

155:                                              ; preds = %154, %137
  br label %156

156:                                              ; preds = %155, %129
  br label %157

157:                                              ; preds = %156, %119
  br label %158

158:                                              ; preds = %157, %105
  br label %159

159:                                              ; preds = %158, %88
  br label %160

160:                                              ; preds = %159
  %161 = load i32, ptr %10, align 4, !tbaa !5
  %162 = add nsw i32 %161, 1
  store i32 %162, ptr %10, align 4, !tbaa !5
  br label %56, !llvm.loop !25

163:                                              ; preds = %56
  %164 = call i32 (ptr, ...) @printf(ptr noundef @.str.18)
  %165 = load ptr, ptr @stdout, align 8, !tbaa !9
  %166 = call i32 @fflush(ptr noundef %165)
  call void @mbedtls_entropy_init(ptr noundef %21)
  %167 = load i32, ptr getelementptr inbounds (%struct.options, ptr @opt, i32 0, i32 5), align 4, !tbaa !23
  %168 = icmp ne i32 %167, 0
  br i1 %168, label %169, label %180

169:                                              ; preds = %163
  %170 = call i32 @mbedtls_entropy_add_source(ptr noundef %21, ptr noundef @dev_random_entropy_poll, ptr noundef null, i64 noundef 32, i32 noundef 1)
  store i32 %170, ptr %6, align 4, !tbaa !5
  %171 = icmp ne i32 %170, 0
  br i1 %171, label %172, label %176

172:                                              ; preds = %169
  %173 = load i32, ptr %6, align 4, !tbaa !5
  %174 = sub nsw i32 0, %173
  %175 = call i32 (ptr, ...) @printf(ptr noundef @.str.19, i32 noundef %174)
  br label %312

176:                                              ; preds = %169
  %177 = call i32 (ptr, ...) @printf(ptr noundef @.str.20)
  %178 = load ptr, ptr @stdout, align 8, !tbaa !9
  %179 = call i32 @fflush(ptr noundef %178)
  br label %180

180:                                              ; preds = %176, %163
  %181 = load ptr, ptr %23, align 8, !tbaa !9
  %182 = load ptr, ptr %23, align 8, !tbaa !9
  %183 = call i64 @strlen(ptr noundef %182) #8
  %184 = call i32 @mbedtls_ctr_drbg_seed(ptr noundef %22, ptr noundef @mbedtls_entropy_func, ptr noundef %21, ptr noundef %181, i64 noundef %183)
  store i32 %184, ptr %6, align 4, !tbaa !5
  %185 = icmp ne i32 %184, 0
  br i1 %185, label %186, label %190

186:                                              ; preds = %180
  %187 = load i32, ptr %6, align 4, !tbaa !5
  %188 = sub nsw i32 0, %187
  %189 = call i32 (ptr, ...) @printf(ptr noundef @.str.21, i32 noundef %188)
  br label %312

190:                                              ; preds = %180
  %191 = call i32 (ptr, ...) @printf(ptr noundef @.str.22)
  %192 = load ptr, ptr @stdout, align 8, !tbaa !9
  %193 = call i32 @fflush(ptr noundef %192)
  %194 = load i32, ptr @opt, align 8, !tbaa !16
  %195 = call ptr @mbedtls_pk_info_from_type(i32 noundef %194)
  %196 = call i32 @mbedtls_pk_setup(ptr noundef %8, ptr noundef %195)
  store i32 %196, ptr %6, align 4, !tbaa !5
  %197 = icmp ne i32 %196, 0
  br i1 %197, label %198, label %202

198:                                              ; preds = %190
  %199 = load i32, ptr %6, align 4, !tbaa !5
  %200 = sub nsw i32 0, %199
  %201 = call i32 (ptr, ...) @printf(ptr noundef @.str.23, i32 noundef %200)
  br label %312

202:                                              ; preds = %190
  %203 = load i32, ptr @opt, align 8, !tbaa !16
  %204 = icmp eq i32 %203, 1
  br i1 %204, label %205, label %220

205:                                              ; preds = %202
  %206 = getelementptr inbounds { ptr, ptr }, ptr %8, i32 0, i32 0
  %207 = load ptr, ptr %206, align 8
  %208 = getelementptr inbounds { ptr, ptr }, ptr %8, i32 0, i32 1
  %209 = load ptr, ptr %208, align 8
  %210 = call ptr @mbedtls_pk_rsa(ptr %207, ptr %209)
  %211 = load i32, ptr getelementptr inbounds (%struct.options, ptr @opt, i32 0, i32 1), align 4, !tbaa !18
  %212 = call i32 @mbedtls_rsa_gen_key(ptr noundef %210, ptr noundef @mbedtls_ctr_drbg_random, ptr noundef %22, i32 noundef %211, i32 noundef 65537)
  store i32 %212, ptr %6, align 4, !tbaa !5
  %213 = load i32, ptr %6, align 4, !tbaa !5
  %214 = icmp ne i32 %213, 0
  br i1 %214, label %215, label %219

215:                                              ; preds = %205
  %216 = load i32, ptr %6, align 4, !tbaa !5
  %217 = sub nsw i32 0, %216
  %218 = call i32 (ptr, ...) @printf(ptr noundef @.str.24, i32 noundef %217)
  br label %312

219:                                              ; preds = %205
  br label %241

220:                                              ; preds = %202
  %221 = load i32, ptr @opt, align 8, !tbaa !16
  %222 = icmp eq i32 %221, 2
  br i1 %222, label %223, label %238

223:                                              ; preds = %220
  %224 = load i32, ptr getelementptr inbounds (%struct.options, ptr @opt, i32 0, i32 2), align 8, !tbaa !20
  %225 = getelementptr inbounds { ptr, ptr }, ptr %8, i32 0, i32 0
  %226 = load ptr, ptr %225, align 8
  %227 = getelementptr inbounds { ptr, ptr }, ptr %8, i32 0, i32 1
  %228 = load ptr, ptr %227, align 8
  %229 = call ptr @mbedtls_pk_ec(ptr %226, ptr %228)
  %230 = call i32 @mbedtls_ecp_gen_key(i32 noundef %224, ptr noundef %229, ptr noundef @mbedtls_ctr_drbg_random, ptr noundef %22)
  store i32 %230, ptr %6, align 4, !tbaa !5
  %231 = load i32, ptr %6, align 4, !tbaa !5
  %232 = icmp ne i32 %231, 0
  br i1 %232, label %233, label %237

233:                                              ; preds = %223
  %234 = load i32, ptr %6, align 4, !tbaa !5
  %235 = sub nsw i32 0, %234
  %236 = call i32 (ptr, ...) @printf(ptr noundef @.str.25, i32 noundef %235)
  br label %312

237:                                              ; preds = %223
  br label %240

238:                                              ; preds = %220
  %239 = call i32 (ptr, ...) @printf(ptr noundef @.str.26)
  br label %312

240:                                              ; preds = %237
  br label %241

241:                                              ; preds = %240, %219
  %242 = call i32 (ptr, ...) @printf(ptr noundef @.str.27)
  %243 = call i32 @mbedtls_pk_get_type(ptr noundef %8)
  %244 = icmp eq i32 %243, 1
  br i1 %244, label %245, label %272

245:                                              ; preds = %241
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #7
  %246 = getelementptr inbounds { ptr, ptr }, ptr %8, i32 0, i32 0
  %247 = load ptr, ptr %246, align 8
  %248 = getelementptr inbounds { ptr, ptr }, ptr %8, i32 0, i32 1
  %249 = load ptr, ptr %248, align 8
  %250 = call ptr @mbedtls_pk_rsa(ptr %247, ptr %249)
  store ptr %250, ptr %25, align 8, !tbaa !9
  %251 = load ptr, ptr %25, align 8, !tbaa !9
  %252 = call i32 @mbedtls_rsa_export(ptr noundef %251, ptr noundef %13, ptr noundef %14, ptr noundef %15, ptr noundef %16, ptr noundef %17)
  store i32 %252, ptr %6, align 4, !tbaa !5
  %253 = icmp ne i32 %252, 0
  br i1 %253, label %258, label %254

254:                                              ; preds = %245
  %255 = load ptr, ptr %25, align 8, !tbaa !9
  %256 = call i32 @mbedtls_rsa_export_crt(ptr noundef %255, ptr noundef %18, ptr noundef %19, ptr noundef %20)
  store i32 %256, ptr %6, align 4, !tbaa !5
  %257 = icmp ne i32 %256, 0
  br i1 %257, label %258, label %260

258:                                              ; preds = %254, %245
  %259 = call i32 (ptr, ...) @printf(ptr noundef @.str.28)
  store i32 5, ptr %26, align 4
  br label %269

260:                                              ; preds = %254
  %261 = call i32 @mbedtls_mpi_write_file(ptr noundef @.str.29, ptr noundef %13, i32 noundef 16, ptr noundef null)
  %262 = call i32 @mbedtls_mpi_write_file(ptr noundef @.str.30, ptr noundef %17, i32 noundef 16, ptr noundef null)
  %263 = call i32 @mbedtls_mpi_write_file(ptr noundef @.str.31, ptr noundef %16, i32 noundef 16, ptr noundef null)
  %264 = call i32 @mbedtls_mpi_write_file(ptr noundef @.str.32, ptr noundef %14, i32 noundef 16, ptr noundef null)
  %265 = call i32 @mbedtls_mpi_write_file(ptr noundef @.str.33, ptr noundef %15, i32 noundef 16, ptr noundef null)
  %266 = call i32 @mbedtls_mpi_write_file(ptr noundef @.str.34, ptr noundef %18, i32 noundef 16, ptr noundef null)
  %267 = call i32 @mbedtls_mpi_write_file(ptr noundef @.str.35, ptr noundef %19, i32 noundef 16, ptr noundef null)
  %268 = call i32 @mbedtls_mpi_write_file(ptr noundef @.str.36, ptr noundef %20, i32 noundef 16, ptr noundef null)
  store i32 0, ptr %26, align 4
  br label %269

269:                                              ; preds = %260, %258
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #7
  %270 = load i32, ptr %26, align 4
  switch i32 %270, label %322 [
    i32 0, label %271
    i32 5, label %312
  ]

271:                                              ; preds = %269
  br label %303

272:                                              ; preds = %241
  %273 = call i32 @mbedtls_pk_get_type(ptr noundef %8)
  %274 = icmp eq i32 %273, 2
  br i1 %274, label %275, label %300

275:                                              ; preds = %272
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #7
  %276 = getelementptr inbounds { ptr, ptr }, ptr %8, i32 0, i32 0
  %277 = load ptr, ptr %276, align 8
  %278 = getelementptr inbounds { ptr, ptr }, ptr %8, i32 0, i32 1
  %279 = load ptr, ptr %278, align 8
  %280 = call ptr @mbedtls_pk_ec(ptr %277, ptr %279)
  store ptr %280, ptr %27, align 8, !tbaa !9
  %281 = load ptr, ptr %27, align 8, !tbaa !9
  %282 = getelementptr inbounds %struct.mbedtls_ecp_keypair, ptr %281, i32 0, i32 0
  %283 = getelementptr inbounds %struct.mbedtls_ecp_group, ptr %282, i32 0, i32 0
  %284 = load i32, ptr %283, align 8, !tbaa !26
  %285 = call ptr @mbedtls_ecp_curve_info_from_grp_id(i32 noundef %284)
  %286 = getelementptr inbounds %struct.mbedtls_ecp_curve_info, ptr %285, i32 0, i32 3
  %287 = load ptr, ptr %286, align 8, !tbaa !11
  %288 = call i32 (ptr, ...) @printf(ptr noundef @.str.37, ptr noundef %287)
  %289 = load ptr, ptr %27, align 8, !tbaa !9
  %290 = getelementptr inbounds %struct.mbedtls_ecp_keypair, ptr %289, i32 0, i32 2
  %291 = getelementptr inbounds %struct.mbedtls_ecp_point, ptr %290, i32 0, i32 0
  %292 = call i32 @mbedtls_mpi_write_file(ptr noundef @.str.38, ptr noundef %291, i32 noundef 16, ptr noundef null)
  %293 = load ptr, ptr %27, align 8, !tbaa !9
  %294 = getelementptr inbounds %struct.mbedtls_ecp_keypair, ptr %293, i32 0, i32 2
  %295 = getelementptr inbounds %struct.mbedtls_ecp_point, ptr %294, i32 0, i32 1
  %296 = call i32 @mbedtls_mpi_write_file(ptr noundef @.str.39, ptr noundef %295, i32 noundef 16, ptr noundef null)
  %297 = load ptr, ptr %27, align 8, !tbaa !9
  %298 = getelementptr inbounds %struct.mbedtls_ecp_keypair, ptr %297, i32 0, i32 1
  %299 = call i32 @mbedtls_mpi_write_file(ptr noundef @.str.40, ptr noundef %298, i32 noundef 16, ptr noundef null)
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #7
  br label %302

300:                                              ; preds = %272
  %301 = call i32 (ptr, ...) @printf(ptr noundef @.str.41)
  br label %302

302:                                              ; preds = %300, %275
  br label %303

303:                                              ; preds = %302, %271
  %304 = call i32 (ptr, ...) @printf(ptr noundef @.str.42)
  %305 = load ptr, ptr getelementptr inbounds (%struct.options, ptr @opt, i32 0, i32 3), align 8, !tbaa !21
  %306 = call i32 @write_private_key(ptr noundef %8, ptr noundef %305)
  store i32 %306, ptr %6, align 4, !tbaa !5
  %307 = icmp ne i32 %306, 0
  br i1 %307, label %308, label %310

308:                                              ; preds = %303
  %309 = call i32 (ptr, ...) @printf(ptr noundef @.str.43)
  br label %312

310:                                              ; preds = %303
  %311 = call i32 (ptr, ...) @printf(ptr noundef @.str.44)
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %312

312:                                              ; preds = %310, %308, %269, %238, %233, %215, %198, %186, %172, %51
  %313 = load i32, ptr %7, align 4, !tbaa !5
  %314 = icmp ne i32 %313, 0
  br i1 %314, label %315, label %320

315:                                              ; preds = %312
  %316 = load i32, ptr %6, align 4, !tbaa !5
  %317 = getelementptr inbounds [1024 x i8], ptr %9, i64 0, i64 0
  call void @mbedtls_strerror(i32 noundef %316, ptr noundef %317, i64 noundef 1024)
  %318 = getelementptr inbounds [1024 x i8], ptr %9, i64 0, i64 0
  %319 = call i32 (ptr, ...) @printf(ptr noundef @.str.45, ptr noundef %318)
  br label %320

320:                                              ; preds = %315, %312
  call void @mbedtls_mpi_free(ptr noundef %13)
  call void @mbedtls_mpi_free(ptr noundef %14)
  call void @mbedtls_mpi_free(ptr noundef %15)
  call void @mbedtls_mpi_free(ptr noundef %16)
  call void @mbedtls_mpi_free(ptr noundef %17)
  call void @mbedtls_mpi_free(ptr noundef %18)
  call void @mbedtls_mpi_free(ptr noundef %19)
  call void @mbedtls_mpi_free(ptr noundef %20)
  call void @mbedtls_pk_free(ptr noundef %8)
  call void @mbedtls_ctr_drbg_free(ptr noundef %22)
  call void @mbedtls_entropy_free(ptr noundef %21)
  %321 = load i32, ptr %7, align 4, !tbaa !5
  store i32 %321, ptr %3, align 4
  store i32 1, ptr %26, align 4
  br label %322

322:                                              ; preds = %320, %269
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #7
  call void @llvm.lifetime.end.p0(i64 344, ptr %22) #7
  call void @llvm.lifetime.end.p0(i64 1032, ptr %21) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %20) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 1024, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  %323 = load i32, ptr %3, align 4
  ret i32 %323
}

declare void @mbedtls_mpi_init(ptr noundef) #2

declare void @mbedtls_pk_init(ptr noundef) #2

declare void @mbedtls_ctr_drbg_init(ptr noundef) #2

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

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

declare ptr @mbedtls_ecp_curve_list() #2

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

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

; Function Attrs: inlinehint nounwind willreturn memory(read) uwtable
declare i32 @atoi(ptr noundef nonnull) #5

declare ptr @mbedtls_ecp_curve_info_from_name(ptr noundef) #2

declare i32 @fflush(ptr noundef) #2

declare void @mbedtls_entropy_init(ptr noundef) #2

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

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

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

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

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

declare ptr @mbedtls_pk_info_from_type(i32 noundef) #2

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @mbedtls_pk_rsa(ptr, ptr) #6

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

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @mbedtls_pk_ec(ptr, ptr) #6

declare i32 @mbedtls_pk_get_type(ptr noundef) #2

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

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

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

declare ptr @mbedtls_ecp_curve_info_from_grp_id(i32 noundef) #2

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

declare void @mbedtls_strerror(i32 noundef, ptr noundef, i64 noundef) #2

declare void @mbedtls_mpi_free(ptr noundef) #2

declare void @mbedtls_pk_free(ptr noundef) #2

declare void @mbedtls_ctr_drbg_free(ptr noundef) #2

declare void @mbedtls_entropy_free(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: write) }
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 = { inlinehint nounwind willreturn memory(read) 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 #6 = { inlinehint 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 #7 = { nounwind }
attributes #8 = { 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 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !10, i64 8}
!12 = !{!"mbedtls_ecp_curve_info", !6, i64 0, !13, i64 4, !13, i64 6, !10, i64 8}
!13 = !{!"short", !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!17, !6, i64 0}
!17 = !{!"options", !6, i64 0, !6, i64 4, !6, i64 8, !10, i64 16, !6, i64 24, !6, i64 28}
!18 = !{!17, !6, i64 4}
!19 = !{!12, !6, i64 0}
!20 = !{!17, !6, i64 8}
!21 = !{!17, !10, i64 16}
!22 = !{!17, !6, i64 24}
!23 = !{!17, !6, i64 28}
!24 = !{!7, !7, i64 0}
!25 = distinct !{!25, !15}
!26 = !{!27, !6, i64 0}
!27 = !{!"mbedtls_ecp_keypair", !28, i64 0, !29, i64 248, !31, i64 272}
!28 = !{!"mbedtls_ecp_group", !6, i64 0, !29, i64 8, !29, i64 32, !29, i64 56, !31, i64 80, !29, i64 152, !30, i64 176, !30, i64 184, !6, i64 192, !10, i64 200, !10, i64 208, !10, i64 216, !10, i64 224, !10, i64 232, !30, i64 240}
!29 = !{!"mbedtls_mpi", !6, i64 0, !30, i64 8, !10, i64 16}
!30 = !{!"long", !7, i64 0}
!31 = !{!"mbedtls_ecp_point", !29, i64 0, !29, i64 24, !29, i64 48}


; 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.options = type { i32, i32, i32, ptr, i32, i32 }
%struct.mbedtls_pk_context = type { ptr, ptr }
%struct.mbedtls_mpi = type { i32, i64, ptr }
%struct.mbedtls_entropy_context = type { i32, %struct.mbedtls_sha512_context, i32, [20 x %struct.mbedtls_entropy_source_state] }
%struct.mbedtls_sha512_context = type { [2 x i64], [8 x i64], [128 x i8], i32 }
%struct.mbedtls_entropy_source_state = type { ptr, ptr, i64, i64, i32 }
%struct.mbedtls_ctr_drbg_context = type { [16 x i8], i32, i32, i64, i32, %struct.mbedtls_aes_context, ptr, ptr }
%struct.mbedtls_aes_context = type { i32, ptr, [68 x i32] }

@.str.2 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [297 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [8 x i8], align 1
@opt = external dso_local local_unnamed_addr global %struct.options, align 8
@.str.7 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [44 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@.str.19 = external hidden unnamed_addr constant [57 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [52 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.37 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.38 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.39 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.41 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.42 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.43 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.44 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.45 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i32 @dev_random_entropy_poll(ptr noundef, ptr noundef, i64 noundef, ptr noundef) #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
define dso_local range(i32 0, 2) i32 @main(i32 noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = alloca %struct.mbedtls_pk_context, align 8
  %4 = alloca [1024 x i8], align 16
  %5 = alloca %struct.mbedtls_mpi, align 8
  %6 = alloca %struct.mbedtls_mpi, align 8
  %7 = alloca %struct.mbedtls_mpi, align 8
  %8 = alloca %struct.mbedtls_mpi, align 8
  %9 = alloca %struct.mbedtls_mpi, align 8
  %10 = alloca %struct.mbedtls_mpi, align 8
  %11 = alloca %struct.mbedtls_mpi, align 8
  %12 = alloca %struct.mbedtls_mpi, align 8
  %13 = alloca %struct.mbedtls_entropy_context, align 8
  %14 = alloca %struct.mbedtls_ctr_drbg_context, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #8
  call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %4) #8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %8) #8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %9) #8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %10) #8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %11) #8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %12) #8
  call void @llvm.lifetime.start.p0(i64 1032, ptr nonnull %13) #8
  call void @llvm.lifetime.start.p0(i64 344, ptr nonnull %14) #8
  call void @mbedtls_mpi_init(ptr noundef nonnull %5) #8
  call void @mbedtls_mpi_init(ptr noundef nonnull %6) #8
  call void @mbedtls_mpi_init(ptr noundef nonnull %7) #8
  call void @mbedtls_mpi_init(ptr noundef nonnull %8) #8
  call void @mbedtls_mpi_init(ptr noundef nonnull %9) #8
  call void @mbedtls_mpi_init(ptr noundef nonnull %10) #8
  call void @mbedtls_mpi_init(ptr noundef nonnull %11) #8
  call void @mbedtls_mpi_init(ptr noundef nonnull %12) #8
  call void @mbedtls_pk_init(ptr noundef nonnull %3) #8
  call void @mbedtls_ctr_drbg_init(ptr noundef nonnull %14) #8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1024) %4, i8 0, i64 1024, i1 false)
  %15 = icmp eq i32 %0, 0
  br i1 %15, label %.loopexit88, label %29

.loopexit88:                                      ; preds = %78, %81, %69, %63, %56, %45, %.lr.ph, %2
  %16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  %17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4)
  %18 = call ptr @mbedtls_ecp_curve_list() #8
  %19 = getelementptr inbounds i8, ptr %18, i64 8
  %20 = load ptr, ptr %19, align 8, !tbaa !5
  %21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, ptr noundef %20)
  %22 = getelementptr inbounds i8, ptr %18, i64 24
  %23 = load ptr, ptr %22, align 8, !tbaa !5
  %.not7790 = icmp eq ptr %23, null
  br i1 %.not7790, label %.loopexit, label %.lr.ph93

.lr.ph93:                                         ; preds = %.loopexit88, %.lr.ph93
  %24 = phi ptr [ %28, %.lr.ph93 ], [ %23, %.loopexit88 ]
  %.05091 = phi ptr [ %25, %.lr.ph93 ], [ %18, %.loopexit88 ]
  %25 = getelementptr inbounds i8, ptr %.05091, i64 16
  %26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, ptr noundef nonnull %24)
  %27 = getelementptr inbounds i8, ptr %.05091, i64 40
  %28 = load ptr, ptr %27, align 8, !tbaa !5
  %.not77 = icmp eq ptr %28, null
  br i1 %.not77, label %.loopexit, label %.lr.ph93, !llvm.loop !12

29:                                               ; preds = %2
  store i32 1, ptr @opt, align 8, !tbaa !14
  store i32 4096, ptr getelementptr inbounds (i8, ptr @opt, i64 4), align 4, !tbaa !16
  %30 = call ptr @mbedtls_ecp_curve_list() #8
  %31 = load i32, ptr %30, align 8, !tbaa !17
  store i32 %31, ptr getelementptr inbounds (i8, ptr @opt, i64 8), align 8, !tbaa !18
  store ptr @.str.7, ptr getelementptr inbounds (i8, ptr @opt, i64 16), align 8, !tbaa !19
  store i32 0, ptr getelementptr inbounds (i8, ptr @opt, i64 24), align 8, !tbaa !20
  store i32 0, ptr getelementptr inbounds (i8, ptr @opt, i64 28), align 4, !tbaa !21
  %32 = icmp sgt i32 %0, 1
  br i1 %32, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %29
  %wide.trip.count = zext nneg i32 %0 to i64
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %83
  %indvars.iv = phi i64 [ 1, %.lr.ph.preheader ], [ %indvars.iv.next, %83 ]
  %33 = getelementptr inbounds ptr, ptr %1, i64 %indvars.iv
  %34 = load ptr, ptr %33, align 8, !tbaa !22
  %35 = call ptr @strchr(ptr noundef nonnull dereferenceable(1) %34, i32 noundef 61) #9
  %36 = icmp eq ptr %35, null
  br i1 %36, label %.loopexit88, label %37

37:                                               ; preds = %.lr.ph
  %38 = getelementptr inbounds i8, ptr %35, i64 1
  store i8 0, ptr %35, align 1, !tbaa !23
  %39 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %34, ptr noundef nonnull dereferenceable(1) @.str.8) #9
  %40 = icmp eq i32 %39, 0
  br i1 %40, label %41, label %49

41:                                               ; preds = %37
  %42 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %38, ptr noundef nonnull dereferenceable(1) @.str.9) #9
  %43 = icmp eq i32 %42, 0
  br i1 %43, label %44, label %45

44:                                               ; preds = %41
  store i32 1, ptr @opt, align 8, !tbaa !14
  br label %83

45:                                               ; preds = %41
  %46 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %38, ptr noundef nonnull dereferenceable(1) @.str.10) #9
  %47 = icmp eq i32 %46, 0
  br i1 %47, label %48, label %.loopexit88

48:                                               ; preds = %45
  store i32 2, ptr @opt, align 8, !tbaa !14
  br label %83

49:                                               ; preds = %37
  %50 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %34, ptr noundef nonnull dereferenceable(1) @.str.11) #9
  %51 = icmp eq i32 %50, 0
  br i1 %51, label %52, label %60

52:                                               ; preds = %49
  %53 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %38, ptr noundef nonnull dereferenceable(1) @.str.12) #9
  %54 = icmp eq i32 %53, 0
  br i1 %54, label %55, label %56

55:                                               ; preds = %52
  store i32 0, ptr getelementptr inbounds (i8, ptr @opt, i64 24), align 8, !tbaa !20
  br label %83

56:                                               ; preds = %52
  %57 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %38, ptr noundef nonnull dereferenceable(1) @.str.13) #9
  %58 = icmp eq i32 %57, 0
  br i1 %58, label %59, label %.loopexit88

59:                                               ; preds = %56
  store i32 1, ptr getelementptr inbounds (i8, ptr @opt, i64 24), align 8, !tbaa !20
  br label %83

60:                                               ; preds = %49
  %61 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %34, ptr noundef nonnull dereferenceable(1) @.str.14) #9
  %62 = icmp eq i32 %61, 0
  br i1 %62, label %63, label %66

63:                                               ; preds = %60
  %64 = call i32 @atoi(ptr nocapture noundef %38) #9
  store i32 %64, ptr getelementptr inbounds (i8, ptr @opt, i64 4), align 4, !tbaa !16
  %65 = add i32 %64, -8193
  %or.cond = icmp ult i32 %65, -7169
  br i1 %or.cond, label %.loopexit88, label %83

66:                                               ; preds = %60
  %67 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %34, ptr noundef nonnull dereferenceable(1) @.str.15) #9
  %68 = icmp eq i32 %67, 0
  br i1 %68, label %69, label %74

69:                                               ; preds = %66
  %70 = call ptr @mbedtls_ecp_curve_info_from_name(ptr noundef nonnull %38) #8
  %71 = icmp eq ptr %70, null
  br i1 %71, label %.loopexit88, label %72

72:                                               ; preds = %69
  %73 = load i32, ptr %70, align 8, !tbaa !17
  store i32 %73, ptr getelementptr inbounds (i8, ptr @opt, i64 8), align 8, !tbaa !18
  br label %83

74:                                               ; preds = %66
  %75 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %34, ptr noundef nonnull dereferenceable(1) @.str.16) #9
  %76 = icmp eq i32 %75, 0
  br i1 %76, label %77, label %78

77:                                               ; preds = %74
  store ptr %38, ptr getelementptr inbounds (i8, ptr @opt, i64 16), align 8, !tbaa !19
  br label %83

78:                                               ; preds = %74
  %79 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %34, ptr noundef nonnull dereferenceable(1) @.str.17) #9
  %80 = icmp eq i32 %79, 0
  br i1 %80, label %81, label %.loopexit88

81:                                               ; preds = %78
  %82 = call i32 @atoi(ptr nocapture noundef %38) #9
  store i32 %82, ptr getelementptr inbounds (i8, ptr @opt, i64 28), align 4, !tbaa !21
  %or.cond3 = icmp ugt i32 %82, 1
  br i1 %or.cond3, label %.loopexit88, label %83

83:                                               ; preds = %48, %44, %63, %77, %81, %72, %55, %59
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !24

._crit_edge:                                      ; preds = %83, %29
  %84 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.18)
  %85 = load ptr, ptr @stdout, align 8, !tbaa !22
  %86 = call i32 @fflush(ptr noundef %85)
  call void @mbedtls_entropy_init(ptr noundef nonnull %13) #8
  %87 = load i32, ptr getelementptr inbounds (i8, ptr @opt, i64 28), align 4, !tbaa !21
  %.not = icmp eq i32 %87, 0
  br i1 %.not, label %97, label %88

88:                                               ; preds = %._crit_edge
  %89 = call i32 @mbedtls_entropy_add_source(ptr noundef nonnull %13, ptr noundef nonnull @dev_random_entropy_poll, ptr noundef null, i64 noundef 32, i32 noundef 1) #8
  %.not69 = icmp eq i32 %89, 0
  br i1 %.not69, label %93, label %90

90:                                               ; preds = %88
  %91 = sub nsw i32 0, %89
  %92 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.19, i32 noundef %91)
  br label %.loopexit

93:                                               ; preds = %88
  %94 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.20)
  %95 = load ptr, ptr @stdout, align 8, !tbaa !22
  %96 = call i32 @fflush(ptr noundef %95)
  br label %97

97:                                               ; preds = %93, %._crit_edge
  %98 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) @.str.2) #9
  %99 = call i32 @mbedtls_ctr_drbg_seed(ptr noundef nonnull %14, ptr noundef nonnull @mbedtls_entropy_func, ptr noundef nonnull %13, ptr noundef nonnull @.str.2, i64 noundef %98) #8
  %.not70 = icmp eq i32 %99, 0
  br i1 %.not70, label %103, label %100

100:                                              ; preds = %97
  %101 = sub nsw i32 0, %99
  %102 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.21, i32 noundef %101)
  br label %.loopexit

103:                                              ; preds = %97
  %104 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.22)
  %105 = load ptr, ptr @stdout, align 8, !tbaa !22
  %106 = call i32 @fflush(ptr noundef %105)
  %107 = load i32, ptr @opt, align 8, !tbaa !14
  %108 = call ptr @mbedtls_pk_info_from_type(i32 noundef %107) #8
  %109 = call i32 @mbedtls_pk_setup(ptr noundef nonnull %3, ptr noundef %108) #8
  %.not71 = icmp eq i32 %109, 0
  br i1 %.not71, label %113, label %110

110:                                              ; preds = %103
  %111 = sub nsw i32 0, %109
  %112 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.23, i32 noundef %111)
  br label %.loopexit

113:                                              ; preds = %103
  %114 = load i32, ptr @opt, align 8, !tbaa !14
  switch i32 %114, label %135 [
    i32 1, label %115
    i32 2, label %125
  ]

115:                                              ; preds = %113
  %116 = load ptr, ptr %3, align 8
  %117 = getelementptr inbounds i8, ptr %3, i64 8
  %118 = load ptr, ptr %117, align 8
  %119 = call ptr @mbedtls_pk_rsa(ptr %116, ptr %118)
  %120 = load i32, ptr getelementptr inbounds (i8, ptr @opt, i64 4), align 4, !tbaa !16
  %121 = call i32 @mbedtls_rsa_gen_key(ptr noundef %119, ptr noundef nonnull @mbedtls_ctr_drbg_random, ptr noundef nonnull %14, i32 noundef %120, i32 noundef 65537) #8
  %.not73 = icmp eq i32 %121, 0
  br i1 %.not73, label %137, label %122

122:                                              ; preds = %115
  %123 = sub nsw i32 0, %121
  %124 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.24, i32 noundef %123)
  br label %.loopexit

125:                                              ; preds = %113
  %126 = load i32, ptr getelementptr inbounds (i8, ptr @opt, i64 8), align 8, !tbaa !18
  %127 = load ptr, ptr %3, align 8
  %128 = getelementptr inbounds i8, ptr %3, i64 8
  %129 = load ptr, ptr %128, align 8
  %130 = call ptr @mbedtls_pk_ec(ptr %127, ptr %129)
  %131 = call i32 @mbedtls_ecp_gen_key(i32 noundef %126, ptr noundef %130, ptr noundef nonnull @mbedtls_ctr_drbg_random, ptr noundef nonnull %14) #8
  %.not72 = icmp eq i32 %131, 0
  br i1 %.not72, label %137, label %132

132:                                              ; preds = %125
  %133 = sub nsw i32 0, %131
  %134 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.25, i32 noundef %133)
  br label %.loopexit

135:                                              ; preds = %113
  %136 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.26)
  br label %.loopexit

137:                                              ; preds = %125, %115
  %138 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.27)
  %139 = call i32 @mbedtls_pk_get_type(ptr noundef nonnull %3) #8
  %140 = icmp eq i32 %139, 1
  br i1 %140, label %141, label %159

141:                                              ; preds = %137
  %142 = load ptr, ptr %3, align 8
  %143 = getelementptr inbounds i8, ptr %3, i64 8
  %144 = load ptr, ptr %143, align 8
  %145 = call ptr @mbedtls_pk_rsa(ptr %142, ptr %144)
  %146 = call i32 @mbedtls_rsa_export(ptr noundef %145, ptr noundef nonnull %5, ptr noundef nonnull %6, ptr noundef nonnull %7, ptr noundef nonnull %8, ptr noundef nonnull %9) #8
  %.not74 = icmp eq i32 %146, 0
  br i1 %.not74, label %147, label %157

147:                                              ; preds = %141
  %148 = call i32 @mbedtls_rsa_export_crt(ptr noundef %145, ptr noundef nonnull %10, ptr noundef nonnull %11, ptr noundef nonnull %12) #8
  %.not75 = icmp eq i32 %148, 0
  br i1 %.not75, label %.thread, label %157

.thread:                                          ; preds = %147
  %149 = call i32 @mbedtls_mpi_write_file(ptr noundef nonnull @.str.29, ptr noundef nonnull %5, i32 noundef 16, ptr noundef null) #8
  %150 = call i32 @mbedtls_mpi_write_file(ptr noundef nonnull @.str.30, ptr noundef nonnull %9, i32 noundef 16, ptr noundef null) #8
  %151 = call i32 @mbedtls_mpi_write_file(ptr noundef nonnull @.str.31, ptr noundef nonnull %8, i32 noundef 16, ptr noundef null) #8
  %152 = call i32 @mbedtls_mpi_write_file(ptr noundef nonnull @.str.32, ptr noundef nonnull %6, i32 noundef 16, ptr noundef null) #8
  %153 = call i32 @mbedtls_mpi_write_file(ptr noundef nonnull @.str.33, ptr noundef nonnull %7, i32 noundef 16, ptr noundef null) #8
  %154 = call i32 @mbedtls_mpi_write_file(ptr noundef nonnull @.str.34, ptr noundef nonnull %10, i32 noundef 16, ptr noundef null) #8
  %155 = call i32 @mbedtls_mpi_write_file(ptr noundef nonnull @.str.35, ptr noundef nonnull %11, i32 noundef 16, ptr noundef null) #8
  %156 = call i32 @mbedtls_mpi_write_file(ptr noundef nonnull @.str.36, ptr noundef nonnull %12, i32 noundef 16, ptr noundef null) #8
  br label %180

157:                                              ; preds = %141, %147
  %.049 = phi i32 [ %146, %141 ], [ %148, %147 ]
  %158 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.28)
  br label %.loopexit

159:                                              ; preds = %137
  %160 = call i32 @mbedtls_pk_get_type(ptr noundef nonnull %3) #8
  %161 = icmp eq i32 %160, 2
  br i1 %161, label %162, label %178

162:                                              ; preds = %159
  %163 = load ptr, ptr %3, align 8
  %164 = getelementptr inbounds i8, ptr %3, i64 8
  %165 = load ptr, ptr %164, align 8
  %166 = call ptr @mbedtls_pk_ec(ptr %163, ptr %165)
  %167 = load i32, ptr %166, align 8, !tbaa !25
  %168 = call ptr @mbedtls_ecp_curve_info_from_grp_id(i32 noundef %167) #8
  %169 = getelementptr inbounds i8, ptr %168, i64 8
  %170 = load ptr, ptr %169, align 8, !tbaa !5
  %171 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.37, ptr noundef %170)
  %172 = getelementptr inbounds i8, ptr %166, i64 272
  %173 = call i32 @mbedtls_mpi_write_file(ptr noundef nonnull @.str.38, ptr noundef nonnull %172, i32 noundef 16, ptr noundef null) #8
  %174 = getelementptr inbounds i8, ptr %166, i64 296
  %175 = call i32 @mbedtls_mpi_write_file(ptr noundef nonnull @.str.39, ptr noundef nonnull %174, i32 noundef 16, ptr noundef null) #8
  %176 = getelementptr inbounds i8, ptr %166, i64 248
  %177 = call i32 @mbedtls_mpi_write_file(ptr noundef nonnull @.str.40, ptr noundef nonnull %176, i32 noundef 16, ptr noundef null) #8
  br label %180

178:                                              ; preds = %159
  %179 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.41)
  br label %180

180:                                              ; preds = %.thread, %162, %178
  %181 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.42)
  %182 = load ptr, ptr getelementptr inbounds (i8, ptr @opt, i64 16), align 8, !tbaa !19
  %183 = call i32 @write_private_key(ptr noundef nonnull %3, ptr noundef %182)
  %.not76 = icmp eq i32 %183, 0
  br i1 %.not76, label %186, label %184

184:                                              ; preds = %180
  %185 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.43)
  br label %.loopexit

186:                                              ; preds = %180
  %187 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.44)
  br label %189

.loopexit:                                        ; preds = %.lr.ph93, %.loopexit88, %90, %100, %110, %122, %157, %184, %132, %135
  %.2.ph = phi i32 [ 0, %135 ], [ %131, %132 ], [ %183, %184 ], [ %.049, %157 ], [ %121, %122 ], [ %109, %110 ], [ %99, %100 ], [ %89, %90 ], [ 1, %.loopexit88 ], [ 1, %.lr.ph93 ]
  call void @mbedtls_strerror(i32 noundef %.2.ph, ptr noundef nonnull %4, i64 noundef 1024) #8
  %188 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.45, ptr noundef nonnull %4)
  br label %189

189:                                              ; preds = %.loopexit, %186
  %.05186 = phi i32 [ 1, %.loopexit ], [ 0, %186 ]
  call void @mbedtls_mpi_free(ptr noundef nonnull %5) #8
  call void @mbedtls_mpi_free(ptr noundef nonnull %6) #8
  call void @mbedtls_mpi_free(ptr noundef nonnull %7) #8
  call void @mbedtls_mpi_free(ptr noundef nonnull %8) #8
  call void @mbedtls_mpi_free(ptr noundef nonnull %9) #8
  call void @mbedtls_mpi_free(ptr noundef nonnull %10) #8
  call void @mbedtls_mpi_free(ptr noundef nonnull %11) #8
  call void @mbedtls_mpi_free(ptr noundef nonnull %12) #8
  call void @mbedtls_pk_free(ptr noundef nonnull %3) #8
  call void @mbedtls_ctr_drbg_free(ptr noundef nonnull %14) #8
  call void @mbedtls_entropy_free(ptr noundef nonnull %13) #8
  call void @llvm.lifetime.end.p0(i64 344, ptr nonnull %14) #8
  call void @llvm.lifetime.end.p0(i64 1032, ptr nonnull %13) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %12) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %11) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %10) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %9) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #8
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %4) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #8
  ret i32 %.05186
}

declare void @mbedtls_mpi_init(ptr noundef) local_unnamed_addr #2

declare void @mbedtls_pk_init(ptr noundef) local_unnamed_addr #2

declare void @mbedtls_ctr_drbg_init(ptr noundef) local_unnamed_addr #2

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

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

declare ptr @mbedtls_ecp_curve_list() local_unnamed_addr #2

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare ptr @strchr(ptr noundef, i32 noundef) local_unnamed_addr #5

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

; Function Attrs: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare i32 @atoi(ptr nocapture noundef nonnull) local_unnamed_addr #6

declare ptr @mbedtls_ecp_curve_info_from_name(ptr noundef) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noundef i32 @fflush(ptr nocapture noundef) local_unnamed_addr #4

declare void @mbedtls_entropy_init(ptr noundef) local_unnamed_addr #2

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

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

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #5

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

declare ptr @mbedtls_pk_info_from_type(i32 noundef) local_unnamed_addr #2

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @mbedtls_pk_rsa(ptr, ptr) local_unnamed_addr #7

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

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @mbedtls_pk_ec(ptr, ptr) local_unnamed_addr #7

declare i32 @mbedtls_pk_get_type(ptr noundef) local_unnamed_addr #2

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

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

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

declare ptr @mbedtls_ecp_curve_info_from_grp_id(i32 noundef) local_unnamed_addr #2

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

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

declare void @mbedtls_mpi_free(ptr noundef) local_unnamed_addr #2

declare void @mbedtls_pk_free(ptr noundef) local_unnamed_addr #2

declare void @mbedtls_ctr_drbg_free(ptr noundef) local_unnamed_addr #2

declare void @mbedtls_entropy_free(ptr noundef) local_unnamed_addr #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 = { 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: write) }
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 = { mustprogress nofree nounwind willreturn memory(argmem: 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 #6 = { inlinehint mustprogress nofree nounwind willreturn memory(read) 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 #7 = { inlinehint 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 #8 = { nounwind }
attributes #9 = { 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, !11, i64 8}
!6 = !{!"mbedtls_ecp_curve_info", !7, i64 0, !10, i64 4, !10, i64 6, !11, i64 8}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"short", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!15, !7, i64 0}
!15 = !{!"options", !7, i64 0, !7, i64 4, !7, i64 8, !11, i64 16, !7, i64 24, !7, i64 28}
!16 = !{!15, !7, i64 4}
!17 = !{!6, !7, i64 0}
!18 = !{!15, !7, i64 8}
!19 = !{!15, !11, i64 16}
!20 = !{!15, !7, i64 24}
!21 = !{!15, !7, i64 28}
!22 = !{!11, !11, i64 0}
!23 = !{!8, !8, i64 0}
!24 = distinct !{!24, !13}
!25 = !{!26, !7, i64 0}
!26 = !{!"mbedtls_ecp_keypair", !27, i64 0, !28, i64 248, !30, i64 272}
!27 = !{!"mbedtls_ecp_group", !7, i64 0, !28, i64 8, !28, i64 32, !28, i64 56, !30, i64 80, !28, i64 152, !29, i64 176, !29, i64 184, !7, i64 192, !11, i64 200, !11, i64 208, !11, i64 216, !11, i64 224, !11, i64 232, !29, i64 240}
!28 = !{!"mbedtls_mpi", !7, i64 0, !29, i64 8, !11, i64 16}
!29 = !{!"long", !8, i64 0}
!30 = !{!"mbedtls_ecp_point", !28, i64 0, !28, i64 24, !28, i64 48}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass