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

; 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, ptr, i32, ptr, i32 }
%struct.mbedtls_pk_context = type { ptr, ptr }
%struct.mbedtls_mpi = type { i32, i64, 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 = external hidden unnamed_addr constant [277 x i8], align 1
@opt = external dso_local global %struct.options, align 8
@.str.1 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [33 x i8], align 1
@stdout = external global ptr, align 8
@.str.15 = external hidden unnamed_addr constant [62 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [65 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [7 x i8], align 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 [1024 x i8], align 16
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca %struct.mbedtls_pk_context, 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 ptr, align 8
  %22 = alloca i32, align 4
  %23 = alloca ptr, align 8
  %24 = alloca ptr, align 8
  %25 = 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) #6
  store i32 1, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 1, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1024, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr %13) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr %14) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr %15) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr %16) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr %17) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr %18) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr %19) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr %20) #6
  call void @mbedtls_pk_init(ptr noundef %12)
  %26 = getelementptr inbounds [1024 x i8], ptr %8, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 16 %26, i8 0, i64 1024, i1 false)
  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)
  %27 = load i32, ptr %4, align 4, !tbaa !5
  %28 = icmp eq i32 %27, 0
  br i1 %28, label %29, label %32

29:                                               ; preds = %2
  br label %30

30:                                               ; preds = %280, %112, %97, %80, %63, %46, %29
  %31 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  br label %295

32:                                               ; preds = %2
  store i32 0, ptr @opt, align 8, !tbaa !11
  store ptr @.str.1, ptr getelementptr inbounds (%struct.options, ptr @opt, i32 0, i32 1), align 8, !tbaa !13
  store i32 0, ptr getelementptr inbounds (%struct.options, ptr @opt, i32 0, i32 2), align 8, !tbaa !14
  store ptr @.str.2, ptr getelementptr inbounds (%struct.options, ptr @opt, i32 0, i32 3), align 8, !tbaa !15
  store i32 0, ptr getelementptr inbounds (%struct.options, ptr @opt, i32 0, i32 4), align 8, !tbaa !16
  store i32 1, ptr %9, align 4, !tbaa !5
  br label %33

33:                                               ; preds = %118, %32
  %34 = load i32, ptr %9, align 4, !tbaa !5
  %35 = load i32, ptr %4, align 4, !tbaa !5
  %36 = icmp slt i32 %34, %35
  br i1 %36, label %37, label %121

37:                                               ; preds = %33
  %38 = load ptr, ptr %5, align 8, !tbaa !9
  %39 = load i32, ptr %9, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds ptr, ptr %38, i64 %40
  %42 = load ptr, ptr %41, align 8, !tbaa !9
  store ptr %42, ptr %10, align 8, !tbaa !9
  %43 = load ptr, ptr %10, align 8, !tbaa !9
  %44 = call ptr @strchr(ptr noundef %43, i32 noundef 61) #7
  store ptr %44, ptr %11, align 8, !tbaa !9
  %45 = icmp eq ptr %44, null
  br i1 %45, label %46, label %47

46:                                               ; preds = %37
  br label %30

47:                                               ; preds = %37
  %48 = load ptr, ptr %11, align 8, !tbaa !9
  %49 = getelementptr inbounds i8, ptr %48, i32 1
  store ptr %49, ptr %11, align 8, !tbaa !9
  store i8 0, ptr %48, align 1, !tbaa !17
  %50 = load ptr, ptr %10, align 8, !tbaa !9
  %51 = call i32 @strcmp(ptr noundef %50, ptr noundef @.str.3) #7
  %52 = icmp eq i32 %51, 0
  br i1 %52, label %53, label %66

53:                                               ; preds = %47
  %54 = load ptr, ptr %11, align 8, !tbaa !9
  %55 = call i32 @strcmp(ptr noundef %54, ptr noundef @.str.4) #7
  %56 = icmp eq i32 %55, 0
  br i1 %56, label %57, label %58

57:                                               ; preds = %53
  store i32 1, ptr @opt, align 8, !tbaa !11
  br label %65

58:                                               ; preds = %53
  %59 = load ptr, ptr %11, align 8, !tbaa !9
  %60 = call i32 @strcmp(ptr noundef %59, ptr noundef @.str.5) #7
  %61 = icmp eq i32 %60, 0
  br i1 %61, label %62, label %63

62:                                               ; preds = %58
  store i32 2, ptr @opt, align 8, !tbaa !11
  br label %64

63:                                               ; preds = %58
  br label %30

64:                                               ; preds = %62
  br label %65

65:                                               ; preds = %64, %57
  br label %117

66:                                               ; preds = %47
  %67 = load ptr, ptr %10, align 8, !tbaa !9
  %68 = call i32 @strcmp(ptr noundef %67, ptr noundef @.str.6) #7
  %69 = icmp eq i32 %68, 0
  br i1 %69, label %70, label %83

70:                                               ; preds = %66
  %71 = load ptr, ptr %11, align 8, !tbaa !9
  %72 = call i32 @strcmp(ptr noundef %71, ptr noundef @.str.4) #7
  %73 = icmp eq i32 %72, 0
  br i1 %73, label %74, label %75

74:                                               ; preds = %70
  store i32 1, ptr getelementptr inbounds (%struct.options, ptr @opt, i32 0, i32 2), align 8, !tbaa !14
  br label %82

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

79:                                               ; preds = %75
  store i32 2, ptr getelementptr inbounds (%struct.options, ptr @opt, i32 0, i32 2), align 8, !tbaa !14
  br label %81

80:                                               ; preds = %75
  br label %30

81:                                               ; preds = %79
  br label %82

82:                                               ; preds = %81, %74
  br label %116

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

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

91:                                               ; preds = %87
  store i32 0, ptr getelementptr inbounds (%struct.options, ptr @opt, i32 0, i32 4), align 8, !tbaa !16
  br label %99

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

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

97:                                               ; preds = %92
  br label %30

98:                                               ; preds = %96
  br label %99

99:                                               ; preds = %98, %91
  br label %115

100:                                              ; preds = %83
  %101 = load ptr, ptr %10, align 8, !tbaa !9
  %102 = call i32 @strcmp(ptr noundef %101, ptr noundef @.str.10) #7
  %103 = icmp eq i32 %102, 0
  br i1 %103, label %104, label %106

104:                                              ; preds = %100
  %105 = load ptr, ptr %11, align 8, !tbaa !9
  store ptr %105, ptr getelementptr inbounds (%struct.options, ptr @opt, i32 0, i32 1), align 8, !tbaa !13
  br label %114

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

110:                                              ; preds = %106
  %111 = load ptr, ptr %11, align 8, !tbaa !9
  store ptr %111, ptr getelementptr inbounds (%struct.options, ptr @opt, i32 0, i32 3), align 8, !tbaa !15
  br label %113

112:                                              ; preds = %106
  br label %30

113:                                              ; preds = %110
  br label %114

114:                                              ; preds = %113, %104
  br label %115

115:                                              ; preds = %114, %99
  br label %116

116:                                              ; preds = %115, %82
  br label %117

117:                                              ; preds = %116, %65
  br label %118

118:                                              ; preds = %117
  %119 = load i32, ptr %9, align 4, !tbaa !5
  %120 = add nsw i32 %119, 1
  store i32 %120, ptr %9, align 4, !tbaa !5
  br label %33, !llvm.loop !18

121:                                              ; preds = %33
  %122 = load i32, ptr @opt, align 8, !tbaa !11
  %123 = icmp eq i32 %122, 0
  br i1 %123, label %124, label %129

124:                                              ; preds = %121
  %125 = load i32, ptr getelementptr inbounds (%struct.options, ptr @opt, i32 0, i32 2), align 8, !tbaa !14
  %126 = icmp ne i32 %125, 0
  br i1 %126, label %127, label %129

127:                                              ; preds = %124
  %128 = call i32 (ptr, ...) @printf(ptr noundef @.str.12)
  br label %295

129:                                              ; preds = %124, %121
  %130 = load i32, ptr @opt, align 8, !tbaa !11
  %131 = icmp eq i32 %130, 2
  br i1 %131, label %132, label %137

132:                                              ; preds = %129
  %133 = load i32, ptr getelementptr inbounds (%struct.options, ptr @opt, i32 0, i32 2), align 8, !tbaa !14
  %134 = icmp eq i32 %133, 1
  br i1 %134, label %135, label %137

135:                                              ; preds = %132
  %136 = call i32 (ptr, ...) @printf(ptr noundef @.str.13)
  br label %295

137:                                              ; preds = %132, %129
  %138 = load i32, ptr @opt, align 8, !tbaa !11
  %139 = icmp eq i32 %138, 1
  br i1 %139, label %140, label %215

140:                                              ; preds = %137
  %141 = call i32 (ptr, ...) @printf(ptr noundef @.str.14)
  %142 = load ptr, ptr @stdout, align 8, !tbaa !9
  %143 = call i32 @fflush(ptr noundef %142)
  %144 = load ptr, ptr getelementptr inbounds (%struct.options, ptr @opt, i32 0, i32 1), align 8, !tbaa !13
  %145 = call i32 @mbedtls_pk_parse_keyfile(ptr noundef %12, ptr noundef %144, ptr noundef null)
  store i32 %145, ptr %6, align 4, !tbaa !5
  %146 = load i32, ptr %6, align 4, !tbaa !5
  %147 = icmp ne i32 %146, 0
  br i1 %147, label %148, label %155

148:                                              ; preds = %140
  %149 = load i32, ptr %6, align 4, !tbaa !5
  %150 = getelementptr inbounds [1024 x i8], ptr %8, i64 0, i64 0
  call void @mbedtls_strerror(i32 noundef %149, ptr noundef %150, i64 noundef 1024)
  %151 = load i32, ptr %6, align 4, !tbaa !5
  %152 = sub nsw i32 0, %151
  %153 = getelementptr inbounds [1024 x i8], ptr %8, i64 0, i64 0
  %154 = call i32 (ptr, ...) @printf(ptr noundef @.str.15, i32 noundef %152, ptr noundef %153)
  br label %295

155:                                              ; preds = %140
  %156 = call i32 (ptr, ...) @printf(ptr noundef @.str.16)
  %157 = call i32 (ptr, ...) @printf(ptr noundef @.str.17)
  %158 = call i32 @mbedtls_pk_get_type(ptr noundef %12)
  %159 = icmp eq i32 %158, 1
  br i1 %159, label %160, label %187

160:                                              ; preds = %155
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #6
  %161 = getelementptr inbounds { ptr, ptr }, ptr %12, i32 0, i32 0
  %162 = load ptr, ptr %161, align 8
  %163 = getelementptr inbounds { ptr, ptr }, ptr %12, i32 0, i32 1
  %164 = load ptr, ptr %163, align 8
  %165 = call ptr @mbedtls_pk_rsa(ptr %162, ptr %164)
  store ptr %165, ptr %21, align 8, !tbaa !9
  %166 = load ptr, ptr %21, align 8, !tbaa !9
  %167 = call i32 @mbedtls_rsa_export(ptr noundef %166, ptr noundef %13, ptr noundef %14, ptr noundef %15, ptr noundef %16, ptr noundef %17)
  store i32 %167, ptr %6, align 4, !tbaa !5
  %168 = icmp ne i32 %167, 0
  br i1 %168, label %173, label %169

169:                                              ; preds = %160
  %170 = load ptr, ptr %21, align 8, !tbaa !9
  %171 = call i32 @mbedtls_rsa_export_crt(ptr noundef %170, ptr noundef %18, ptr noundef %19, ptr noundef %20)
  store i32 %171, ptr %6, align 4, !tbaa !5
  %172 = icmp ne i32 %171, 0
  br i1 %172, label %173, label %175

173:                                              ; preds = %169, %160
  %174 = call i32 (ptr, ...) @printf(ptr noundef @.str.18)
  store i32 3, ptr %22, align 4
  br label %184

175:                                              ; preds = %169
  %176 = call i32 @mbedtls_mpi_write_file(ptr noundef @.str.19, ptr noundef %13, i32 noundef 16, ptr noundef null)
  %177 = call i32 @mbedtls_mpi_write_file(ptr noundef @.str.20, ptr noundef %17, i32 noundef 16, ptr noundef null)
  %178 = call i32 @mbedtls_mpi_write_file(ptr noundef @.str.21, ptr noundef %16, i32 noundef 16, ptr noundef null)
  %179 = call i32 @mbedtls_mpi_write_file(ptr noundef @.str.22, ptr noundef %14, i32 noundef 16, ptr noundef null)
  %180 = call i32 @mbedtls_mpi_write_file(ptr noundef @.str.23, ptr noundef %15, i32 noundef 16, ptr noundef null)
  %181 = call i32 @mbedtls_mpi_write_file(ptr noundef @.str.24, ptr noundef %18, i32 noundef 16, ptr noundef null)
  %182 = call i32 @mbedtls_mpi_write_file(ptr noundef @.str.25, ptr noundef %19, i32 noundef 16, ptr noundef null)
  %183 = call i32 @mbedtls_mpi_write_file(ptr noundef @.str.26, ptr noundef %20, i32 noundef 16, ptr noundef null)
  store i32 0, ptr %22, align 4
  br label %184

184:                                              ; preds = %175, %173
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #6
  %185 = load i32, ptr %22, align 4
  switch i32 %185, label %305 [
    i32 0, label %186
    i32 3, label %295
  ]

186:                                              ; preds = %184
  br label %214

187:                                              ; preds = %155
  %188 = call i32 @mbedtls_pk_get_type(ptr noundef %12)
  %189 = icmp eq i32 %188, 2
  br i1 %189, label %190, label %211

190:                                              ; preds = %187
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #6
  %191 = getelementptr inbounds { ptr, ptr }, ptr %12, i32 0, i32 0
  %192 = load ptr, ptr %191, align 8
  %193 = getelementptr inbounds { ptr, ptr }, ptr %12, i32 0, i32 1
  %194 = load ptr, ptr %193, align 8
  %195 = call ptr @mbedtls_pk_ec(ptr %192, ptr %194)
  store ptr %195, ptr %23, align 8, !tbaa !9
  %196 = load ptr, ptr %23, align 8, !tbaa !9
  %197 = getelementptr inbounds %struct.mbedtls_ecp_keypair, ptr %196, i32 0, i32 2
  %198 = getelementptr inbounds %struct.mbedtls_ecp_point, ptr %197, i32 0, i32 0
  %199 = call i32 @mbedtls_mpi_write_file(ptr noundef @.str.27, ptr noundef %198, i32 noundef 16, ptr noundef null)
  %200 = load ptr, ptr %23, align 8, !tbaa !9
  %201 = getelementptr inbounds %struct.mbedtls_ecp_keypair, ptr %200, i32 0, i32 2
  %202 = getelementptr inbounds %struct.mbedtls_ecp_point, ptr %201, i32 0, i32 1
  %203 = call i32 @mbedtls_mpi_write_file(ptr noundef @.str.28, ptr noundef %202, i32 noundef 16, ptr noundef null)
  %204 = load ptr, ptr %23, align 8, !tbaa !9
  %205 = getelementptr inbounds %struct.mbedtls_ecp_keypair, ptr %204, i32 0, i32 2
  %206 = getelementptr inbounds %struct.mbedtls_ecp_point, ptr %205, i32 0, i32 2
  %207 = call i32 @mbedtls_mpi_write_file(ptr noundef @.str.29, ptr noundef %206, i32 noundef 16, ptr noundef null)
  %208 = load ptr, ptr %23, align 8, !tbaa !9
  %209 = getelementptr inbounds %struct.mbedtls_ecp_keypair, ptr %208, i32 0, i32 1
  %210 = call i32 @mbedtls_mpi_write_file(ptr noundef @.str.30, ptr noundef %209, i32 noundef 16, ptr noundef null)
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #6
  br label %213

211:                                              ; preds = %187
  %212 = call i32 (ptr, ...) @printf(ptr noundef @.str.31)
  br label %213

213:                                              ; preds = %211, %190
  br label %214

214:                                              ; preds = %213, %186
  br label %282

215:                                              ; preds = %137
  %216 = load i32, ptr @opt, align 8, !tbaa !11
  %217 = icmp eq i32 %216, 2
  br i1 %217, label %218, label %280

218:                                              ; preds = %215
  %219 = call i32 (ptr, ...) @printf(ptr noundef @.str.32)
  %220 = load ptr, ptr @stdout, align 8, !tbaa !9
  %221 = call i32 @fflush(ptr noundef %220)
  %222 = load ptr, ptr getelementptr inbounds (%struct.options, ptr @opt, i32 0, i32 1), align 8, !tbaa !13
  %223 = call i32 @mbedtls_pk_parse_public_keyfile(ptr noundef %12, ptr noundef %222)
  store i32 %223, ptr %6, align 4, !tbaa !5
  %224 = load i32, ptr %6, align 4, !tbaa !5
  %225 = icmp ne i32 %224, 0
  br i1 %225, label %226, label %233

226:                                              ; preds = %218
  %227 = load i32, ptr %6, align 4, !tbaa !5
  %228 = getelementptr inbounds [1024 x i8], ptr %8, i64 0, i64 0
  call void @mbedtls_strerror(i32 noundef %227, ptr noundef %228, i64 noundef 1024)
  %229 = load i32, ptr %6, align 4, !tbaa !5
  %230 = sub nsw i32 0, %229
  %231 = getelementptr inbounds [1024 x i8], ptr %8, i64 0, i64 0
  %232 = call i32 (ptr, ...) @printf(ptr noundef @.str.33, i32 noundef %230, ptr noundef %231)
  br label %295

233:                                              ; preds = %218
  %234 = call i32 (ptr, ...) @printf(ptr noundef @.str.16)
  %235 = call i32 (ptr, ...) @printf(ptr noundef @.str.17)
  %236 = call i32 @mbedtls_pk_get_type(ptr noundef %12)
  %237 = icmp eq i32 %236, 1
  br i1 %237, label %238, label %255

238:                                              ; preds = %233
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #6
  %239 = getelementptr inbounds { ptr, ptr }, ptr %12, i32 0, i32 0
  %240 = load ptr, ptr %239, align 8
  %241 = getelementptr inbounds { ptr, ptr }, ptr %12, i32 0, i32 1
  %242 = load ptr, ptr %241, align 8
  %243 = call ptr @mbedtls_pk_rsa(ptr %240, ptr %242)
  store ptr %243, ptr %24, align 8, !tbaa !9
  %244 = load ptr, ptr %24, align 8, !tbaa !9
  %245 = call i32 @mbedtls_rsa_export(ptr noundef %244, ptr noundef %13, ptr noundef null, ptr noundef null, ptr noundef null, ptr noundef %17)
  store i32 %245, ptr %6, align 4, !tbaa !5
  %246 = icmp ne i32 %245, 0
  br i1 %246, label %247, label %249

247:                                              ; preds = %238
  %248 = call i32 (ptr, ...) @printf(ptr noundef @.str.18)
  store i32 3, ptr %22, align 4
  br label %252

249:                                              ; preds = %238
  %250 = call i32 @mbedtls_mpi_write_file(ptr noundef @.str.34, ptr noundef %13, i32 noundef 16, ptr noundef null)
  %251 = call i32 @mbedtls_mpi_write_file(ptr noundef @.str.35, ptr noundef %17, i32 noundef 16, ptr noundef null)
  store i32 0, ptr %22, align 4
  br label %252

252:                                              ; preds = %249, %247
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #6
  %253 = load i32, ptr %22, align 4
  switch i32 %253, label %305 [
    i32 0, label %254
    i32 3, label %295
  ]

254:                                              ; preds = %252
  br label %279

255:                                              ; preds = %233
  %256 = call i32 @mbedtls_pk_get_type(ptr noundef %12)
  %257 = icmp eq i32 %256, 2
  br i1 %257, label %258, label %276

258:                                              ; preds = %255
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #6
  %259 = getelementptr inbounds { ptr, ptr }, ptr %12, i32 0, i32 0
  %260 = load ptr, ptr %259, align 8
  %261 = getelementptr inbounds { ptr, ptr }, ptr %12, i32 0, i32 1
  %262 = load ptr, ptr %261, align 8
  %263 = call ptr @mbedtls_pk_ec(ptr %260, ptr %262)
  store ptr %263, ptr %25, align 8, !tbaa !9
  %264 = load ptr, ptr %25, align 8, !tbaa !9
  %265 = getelementptr inbounds %struct.mbedtls_ecp_keypair, ptr %264, i32 0, i32 2
  %266 = getelementptr inbounds %struct.mbedtls_ecp_point, ptr %265, i32 0, i32 0
  %267 = call i32 @mbedtls_mpi_write_file(ptr noundef @.str.27, ptr noundef %266, i32 noundef 16, ptr noundef null)
  %268 = load ptr, ptr %25, align 8, !tbaa !9
  %269 = getelementptr inbounds %struct.mbedtls_ecp_keypair, ptr %268, i32 0, i32 2
  %270 = getelementptr inbounds %struct.mbedtls_ecp_point, ptr %269, i32 0, i32 1
  %271 = call i32 @mbedtls_mpi_write_file(ptr noundef @.str.28, ptr noundef %270, i32 noundef 16, ptr noundef null)
  %272 = load ptr, ptr %25, align 8, !tbaa !9
  %273 = getelementptr inbounds %struct.mbedtls_ecp_keypair, ptr %272, i32 0, i32 2
  %274 = getelementptr inbounds %struct.mbedtls_ecp_point, ptr %273, i32 0, i32 2
  %275 = call i32 @mbedtls_mpi_write_file(ptr noundef @.str.29, ptr noundef %274, i32 noundef 16, ptr noundef null)
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #6
  br label %278

276:                                              ; preds = %255
  %277 = call i32 (ptr, ...) @printf(ptr noundef @.str.31)
  br label %278

278:                                              ; preds = %276, %258
  br label %279

279:                                              ; preds = %278, %254
  br label %281

280:                                              ; preds = %215
  br label %30

281:                                              ; preds = %279
  br label %282

282:                                              ; preds = %281, %214
  %283 = load i32, ptr getelementptr inbounds (%struct.options, ptr @opt, i32 0, i32 2), align 8, !tbaa !14
  %284 = icmp eq i32 %283, 2
  br i1 %284, label %285, label %288

285:                                              ; preds = %282
  %286 = load ptr, ptr getelementptr inbounds (%struct.options, ptr @opt, i32 0, i32 3), align 8, !tbaa !15
  %287 = call i32 @write_public_key(ptr noundef %12, ptr noundef %286)
  br label %288

288:                                              ; preds = %285, %282
  %289 = load i32, ptr getelementptr inbounds (%struct.options, ptr @opt, i32 0, i32 2), align 8, !tbaa !14
  %290 = icmp eq i32 %289, 1
  br i1 %290, label %291, label %294

291:                                              ; preds = %288
  %292 = load ptr, ptr getelementptr inbounds (%struct.options, ptr @opt, i32 0, i32 3), align 8, !tbaa !15
  %293 = call i32 @write_private_key(ptr noundef %12, ptr noundef %292)
  br label %294

294:                                              ; preds = %291, %288
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %295

295:                                              ; preds = %294, %252, %226, %184, %148, %135, %127, %30
  %296 = load i32, ptr %7, align 4, !tbaa !5
  %297 = icmp ne i32 %296, 0
  br i1 %297, label %298, label %303

298:                                              ; preds = %295
  %299 = load i32, ptr %6, align 4, !tbaa !5
  %300 = getelementptr inbounds [1024 x i8], ptr %8, i64 0, i64 0
  call void @mbedtls_strerror(i32 noundef %299, ptr noundef %300, i64 noundef 1024)
  %301 = getelementptr inbounds [1024 x i8], ptr %8, i64 0, i64 0
  %302 = call i32 (ptr, ...) @printf(ptr noundef @.str.36, ptr noundef %301)
  br label %303

303:                                              ; preds = %298, %295
  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 %12)
  %304 = load i32, ptr %7, align 4, !tbaa !5
  store i32 %304, ptr %3, align 4
  store i32 1, ptr %22, align 4
  br label %305

305:                                              ; preds = %303, %252, %184
  call void @llvm.lifetime.end.p0(i64 24, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 1024, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  %306 = load i32, ptr %3, align 4
  ret i32 %306
}

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

declare void @mbedtls_pk_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 void @mbedtls_mpi_init(ptr noundef) #2

declare i32 @printf(ptr noundef, ...) #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

declare i32 @fflush(ptr noundef) #2

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

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

declare i32 @mbedtls_pk_get_type(ptr noundef) #2

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

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

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

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

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

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

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

declare void @mbedtls_mpi_free(ptr noundef) #2

declare void @mbedtls_pk_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 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 = { nounwind }
attributes #7 = { 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, !6, i64 0}
!12 = !{!"options", !6, i64 0, !10, i64 8, !6, i64 16, !10, i64 24, !6, i64 32}
!13 = !{!12, !10, i64 8}
!14 = !{!12, !6, i64 16}
!15 = !{!12, !10, i64 24}
!16 = !{!12, !6, i64 32}
!17 = !{!7, !7, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}


; 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, ptr, i32, ptr, i32 }
%struct.mbedtls_pk_context = type { ptr, ptr }
%struct.mbedtls_mpi = type { i32, i64, ptr }

@.str = external hidden unnamed_addr constant [277 x i8], align 1
@opt = external dso_local local_unnamed_addr global %struct.options, align 8
@.str.1 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [33 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@.str.15 = external hidden unnamed_addr constant [62 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [65 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [7 x i8], align 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 [1024 x i8], align 16
  %4 = alloca %struct.mbedtls_pk_context, align 8
  %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
  call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %3) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #7
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #7
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #7
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #7
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %8) #7
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %9) #7
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %10) #7
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %11) #7
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %12) #7
  call void @mbedtls_pk_init(ptr noundef nonnull %4) #7
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1024) %3, i8 0, i64 1024, i1 false)
  call void @mbedtls_mpi_init(ptr noundef nonnull %5) #7
  call void @mbedtls_mpi_init(ptr noundef nonnull %6) #7
  call void @mbedtls_mpi_init(ptr noundef nonnull %7) #7
  call void @mbedtls_mpi_init(ptr noundef nonnull %8) #7
  call void @mbedtls_mpi_init(ptr noundef nonnull %9) #7
  call void @mbedtls_mpi_init(ptr noundef nonnull %10) #7
  call void @mbedtls_mpi_init(ptr noundef nonnull %11) #7
  call void @mbedtls_mpi_init(ptr noundef nonnull %12) #7
  %13 = icmp eq i32 %0, 0
  br i1 %13, label %.loopexit, label %15

.loopexit:                                        ; preds = %59, %51, %40, %29, %.lr.ph, %15, %125, %2
  %14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  br label %178

15:                                               ; preds = %2
  store i32 0, ptr @opt, align 8, !tbaa !5
  store ptr @.str.1, ptr getelementptr inbounds (i8, ptr @opt, i64 8), align 8, !tbaa !11
  store i32 0, ptr getelementptr inbounds (i8, ptr @opt, i64 16), align 8, !tbaa !12
  store ptr @.str.2, ptr getelementptr inbounds (i8, ptr @opt, i64 24), align 8, !tbaa !13
  store i32 0, ptr getelementptr inbounds (i8, ptr @opt, i64 32), align 8, !tbaa !14
  %16 = icmp sgt i32 %0, 1
  br i1 %16, label %.lr.ph.preheader, label %.loopexit

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

.lr.ph:                                           ; preds = %.lr.ph.preheader, %63
  %indvars.iv = phi i64 [ 1, %.lr.ph.preheader ], [ %indvars.iv.next, %63 ]
  %17 = getelementptr inbounds ptr, ptr %1, i64 %indvars.iv
  %18 = load ptr, ptr %17, align 8, !tbaa !15
  %19 = call ptr @strchr(ptr noundef nonnull dereferenceable(1) %18, i32 noundef 61) #8
  %20 = icmp eq ptr %19, null
  br i1 %20, label %.loopexit, label %21

21:                                               ; preds = %.lr.ph
  %22 = getelementptr inbounds i8, ptr %19, i64 1
  store i8 0, ptr %19, align 1, !tbaa !16
  %23 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %18, ptr noundef nonnull dereferenceable(1) @.str.3) #8
  %24 = icmp eq i32 %23, 0
  br i1 %24, label %25, label %33

25:                                               ; preds = %21
  %26 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %22, ptr noundef nonnull dereferenceable(1) @.str.4) #8
  %27 = icmp eq i32 %26, 0
  br i1 %27, label %28, label %29

28:                                               ; preds = %25
  store i32 1, ptr @opt, align 8, !tbaa !5
  br label %63

29:                                               ; preds = %25
  %30 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %22, ptr noundef nonnull dereferenceable(1) @.str.5) #8
  %31 = icmp eq i32 %30, 0
  br i1 %31, label %32, label %.loopexit

32:                                               ; preds = %29
  store i32 2, ptr @opt, align 8, !tbaa !5
  br label %63

33:                                               ; preds = %21
  %34 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %18, ptr noundef nonnull dereferenceable(1) @.str.6) #8
  %35 = icmp eq i32 %34, 0
  br i1 %35, label %36, label %44

36:                                               ; preds = %33
  %37 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %22, ptr noundef nonnull dereferenceable(1) @.str.4) #8
  %38 = icmp eq i32 %37, 0
  br i1 %38, label %39, label %40

39:                                               ; preds = %36
  store i32 1, ptr getelementptr inbounds (i8, ptr @opt, i64 16), align 8, !tbaa !12
  br label %63

40:                                               ; preds = %36
  %41 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %22, ptr noundef nonnull dereferenceable(1) @.str.5) #8
  %42 = icmp eq i32 %41, 0
  br i1 %42, label %43, label %.loopexit

43:                                               ; preds = %40
  store i32 2, ptr getelementptr inbounds (i8, ptr @opt, i64 16), align 8, !tbaa !12
  br label %63

44:                                               ; preds = %33
  %45 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %18, ptr noundef nonnull dereferenceable(1) @.str.7) #8
  %46 = icmp eq i32 %45, 0
  br i1 %46, label %47, label %55

47:                                               ; preds = %44
  %48 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %22, ptr noundef nonnull dereferenceable(1) @.str.8) #8
  %49 = icmp eq i32 %48, 0
  br i1 %49, label %50, label %51

50:                                               ; preds = %47
  store i32 0, ptr getelementptr inbounds (i8, ptr @opt, i64 32), align 8, !tbaa !14
  br label %63

51:                                               ; preds = %47
  %52 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %22, ptr noundef nonnull dereferenceable(1) @.str.9) #8
  %53 = icmp eq i32 %52, 0
  br i1 %53, label %54, label %.loopexit

54:                                               ; preds = %51
  store i32 1, ptr getelementptr inbounds (i8, ptr @opt, i64 32), align 8, !tbaa !14
  br label %63

55:                                               ; preds = %44
  %56 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %18, ptr noundef nonnull dereferenceable(1) @.str.10) #8
  %57 = icmp eq i32 %56, 0
  br i1 %57, label %58, label %59

58:                                               ; preds = %55
  store ptr %22, ptr getelementptr inbounds (i8, ptr @opt, i64 8), align 8, !tbaa !11
  br label %63

59:                                               ; preds = %55
  %60 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %18, ptr noundef nonnull dereferenceable(1) @.str.11) #8
  %61 = icmp eq i32 %60, 0
  br i1 %61, label %62, label %.loopexit

62:                                               ; preds = %59
  store ptr %22, ptr getelementptr inbounds (i8, ptr @opt, i64 24), align 8, !tbaa !13
  br label %63

63:                                               ; preds = %32, %28, %54, %50, %62, %58, %39, %43
  %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 !17

._crit_edge:                                      ; preds = %63
  %.pre = load i32, ptr @opt, align 8, !tbaa !5
  %.pre77 = load i32, ptr getelementptr inbounds (i8, ptr @opt, i64 16), align 8
  %64 = icmp eq i32 %.pre, 0
  %65 = icmp ne i32 %.pre77, 0
  %or.cond = select i1 %64, i1 %65, i1 false
  br i1 %or.cond, label %66, label %68

66:                                               ; preds = %._crit_edge
  %67 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.12)
  br label %178

68:                                               ; preds = %._crit_edge
  %69 = icmp eq i32 %.pre, 2
  %70 = icmp eq i32 %.pre77, 1
  %or.cond3 = select i1 %69, i1 %70, i1 false
  br i1 %or.cond3, label %71, label %73

71:                                               ; preds = %68
  %72 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.13)
  br label %178

73:                                               ; preds = %68
  %74 = icmp eq i32 %.pre, 1
  br i1 %74, label %75, label %125

75:                                               ; preds = %73
  %76 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.14)
  %77 = load ptr, ptr @stdout, align 8, !tbaa !15
  %78 = call i32 @fflush(ptr noundef %77)
  %79 = load ptr, ptr getelementptr inbounds (i8, ptr @opt, i64 8), align 8, !tbaa !11
  %80 = call i32 @mbedtls_pk_parse_keyfile(ptr noundef nonnull %4, ptr noundef %79, ptr noundef null) #7
  %.not60 = icmp eq i32 %80, 0
  br i1 %.not60, label %84, label %81

81:                                               ; preds = %75
  call void @mbedtls_strerror(i32 noundef %80, ptr noundef nonnull %3, i64 noundef 1024) #7
  %82 = sub nsw i32 0, %80
  %83 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.15, i32 noundef %82, ptr noundef nonnull %3)
  br label %178

84:                                               ; preds = %75
  %85 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.16)
  %86 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.17)
  %87 = call i32 @mbedtls_pk_get_type(ptr noundef nonnull %4) #7
  %88 = icmp eq i32 %87, 1
  br i1 %88, label %89, label %107

89:                                               ; preds = %84
  %90 = load ptr, ptr %4, align 8
  %91 = getelementptr inbounds i8, ptr %4, i64 8
  %92 = load ptr, ptr %91, align 8
  %93 = call ptr @mbedtls_pk_rsa(ptr %90, ptr %92)
  %94 = call i32 @mbedtls_rsa_export(ptr noundef %93, ptr noundef nonnull %5, ptr noundef nonnull %6, ptr noundef nonnull %7, ptr noundef nonnull %8, ptr noundef nonnull %9) #7
  %.not61 = icmp eq i32 %94, 0
  br i1 %.not61, label %95, label %105

95:                                               ; preds = %89
  %96 = call i32 @mbedtls_rsa_export_crt(ptr noundef %93, ptr noundef nonnull %10, ptr noundef nonnull %11, ptr noundef nonnull %12) #7
  %.not62 = icmp eq i32 %96, 0
  br i1 %.not62, label %.thread, label %105

.thread:                                          ; preds = %95
  %97 = call i32 @mbedtls_mpi_write_file(ptr noundef nonnull @.str.19, ptr noundef nonnull %5, i32 noundef 16, ptr noundef null) #7
  %98 = call i32 @mbedtls_mpi_write_file(ptr noundef nonnull @.str.20, ptr noundef nonnull %9, i32 noundef 16, ptr noundef null) #7
  %99 = call i32 @mbedtls_mpi_write_file(ptr noundef nonnull @.str.21, ptr noundef nonnull %8, i32 noundef 16, ptr noundef null) #7
  %100 = call i32 @mbedtls_mpi_write_file(ptr noundef nonnull @.str.22, ptr noundef nonnull %6, i32 noundef 16, ptr noundef null) #7
  %101 = call i32 @mbedtls_mpi_write_file(ptr noundef nonnull @.str.23, ptr noundef nonnull %7, i32 noundef 16, ptr noundef null) #7
  %102 = call i32 @mbedtls_mpi_write_file(ptr noundef nonnull @.str.24, ptr noundef nonnull %10, i32 noundef 16, ptr noundef null) #7
  %103 = call i32 @mbedtls_mpi_write_file(ptr noundef nonnull @.str.25, ptr noundef nonnull %11, i32 noundef 16, ptr noundef null) #7
  %104 = call i32 @mbedtls_mpi_write_file(ptr noundef nonnull @.str.26, ptr noundef nonnull %12, i32 noundef 16, ptr noundef null) #7
  br label %166

105:                                              ; preds = %89, %95
  %.045 = phi i32 [ %94, %89 ], [ %96, %95 ]
  %106 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.18)
  br label %178

107:                                              ; preds = %84
  %108 = call i32 @mbedtls_pk_get_type(ptr noundef nonnull %4) #7
  %109 = icmp eq i32 %108, 2
  br i1 %109, label %110, label %123

110:                                              ; preds = %107
  %111 = load ptr, ptr %4, align 8
  %112 = getelementptr inbounds i8, ptr %4, i64 8
  %113 = load ptr, ptr %112, align 8
  %114 = call ptr @mbedtls_pk_ec(ptr %111, ptr %113)
  %115 = getelementptr inbounds i8, ptr %114, i64 272
  %116 = call i32 @mbedtls_mpi_write_file(ptr noundef nonnull @.str.27, ptr noundef nonnull %115, i32 noundef 16, ptr noundef null) #7
  %117 = getelementptr inbounds i8, ptr %114, i64 296
  %118 = call i32 @mbedtls_mpi_write_file(ptr noundef nonnull @.str.28, ptr noundef nonnull %117, i32 noundef 16, ptr noundef null) #7
  %119 = getelementptr inbounds i8, ptr %114, i64 320
  %120 = call i32 @mbedtls_mpi_write_file(ptr noundef nonnull @.str.29, ptr noundef nonnull %119, i32 noundef 16, ptr noundef null) #7
  %121 = getelementptr inbounds i8, ptr %114, i64 248
  %122 = call i32 @mbedtls_mpi_write_file(ptr noundef nonnull @.str.30, ptr noundef nonnull %121, i32 noundef 16, ptr noundef null) #7
  br label %166

123:                                              ; preds = %107
  %124 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.31)
  br label %166

125:                                              ; preds = %73
  br i1 %69, label %126, label %.loopexit

126:                                              ; preds = %125
  %127 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.32)
  %128 = load ptr, ptr @stdout, align 8, !tbaa !15
  %129 = call i32 @fflush(ptr noundef %128)
  %130 = load ptr, ptr getelementptr inbounds (i8, ptr @opt, i64 8), align 8, !tbaa !11
  %131 = call i32 @mbedtls_pk_parse_public_keyfile(ptr noundef nonnull %4, ptr noundef %130) #7
  %.not = icmp eq i32 %131, 0
  br i1 %.not, label %135, label %132

132:                                              ; preds = %126
  call void @mbedtls_strerror(i32 noundef %131, ptr noundef nonnull %3, i64 noundef 1024) #7
  %133 = sub nsw i32 0, %131
  %134 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.33, i32 noundef %133, ptr noundef nonnull %3)
  br label %178

135:                                              ; preds = %126
  %136 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.16)
  %137 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.17)
  %138 = call i32 @mbedtls_pk_get_type(ptr noundef nonnull %4) #7
  %139 = icmp eq i32 %138, 1
  br i1 %139, label %140, label %150

140:                                              ; preds = %135
  %141 = load ptr, ptr %4, align 8
  %142 = getelementptr inbounds i8, ptr %4, i64 8
  %143 = load ptr, ptr %142, align 8
  %144 = call ptr @mbedtls_pk_rsa(ptr %141, ptr %143)
  %145 = call i32 @mbedtls_rsa_export(ptr noundef %144, ptr noundef nonnull %5, ptr noundef null, ptr noundef null, ptr noundef null, ptr noundef nonnull %9) #7
  %.not59 = icmp eq i32 %145, 0
  br i1 %.not59, label %.thread66, label %148

.thread66:                                        ; preds = %140
  %146 = call i32 @mbedtls_mpi_write_file(ptr noundef nonnull @.str.34, ptr noundef nonnull %5, i32 noundef 16, ptr noundef null) #7
  %147 = call i32 @mbedtls_mpi_write_file(ptr noundef nonnull @.str.35, ptr noundef nonnull %9, i32 noundef 16, ptr noundef null) #7
  br label %166

148:                                              ; preds = %140
  %149 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.18)
  br label %178

150:                                              ; preds = %135
  %151 = call i32 @mbedtls_pk_get_type(ptr noundef nonnull %4) #7
  %152 = icmp eq i32 %151, 2
  br i1 %152, label %153, label %164

153:                                              ; preds = %150
  %154 = load ptr, ptr %4, align 8
  %155 = getelementptr inbounds i8, ptr %4, i64 8
  %156 = load ptr, ptr %155, align 8
  %157 = call ptr @mbedtls_pk_ec(ptr %154, ptr %156)
  %158 = getelementptr inbounds i8, ptr %157, i64 272
  %159 = call i32 @mbedtls_mpi_write_file(ptr noundef nonnull @.str.27, ptr noundef nonnull %158, i32 noundef 16, ptr noundef null) #7
  %160 = getelementptr inbounds i8, ptr %157, i64 296
  %161 = call i32 @mbedtls_mpi_write_file(ptr noundef nonnull @.str.28, ptr noundef nonnull %160, i32 noundef 16, ptr noundef null) #7
  %162 = getelementptr inbounds i8, ptr %157, i64 320
  %163 = call i32 @mbedtls_mpi_write_file(ptr noundef nonnull @.str.29, ptr noundef nonnull %162, i32 noundef 16, ptr noundef null) #7
  br label %166

164:                                              ; preds = %150
  %165 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.31)
  br label %166

166:                                              ; preds = %.thread66, %.thread, %153, %164, %123, %110
  %167 = load i32, ptr getelementptr inbounds (i8, ptr @opt, i64 16), align 8, !tbaa !12
  %168 = icmp eq i32 %167, 2
  br i1 %168, label %169, label %172

169:                                              ; preds = %166
  %170 = load ptr, ptr getelementptr inbounds (i8, ptr @opt, i64 24), align 8, !tbaa !13
  %171 = call i32 @write_public_key(ptr noundef nonnull %4, ptr noundef %170)
  %.pr = load i32, ptr getelementptr inbounds (i8, ptr @opt, i64 16), align 8, !tbaa !12
  br label %172

172:                                              ; preds = %169, %166
  %173 = phi i32 [ %.pr, %169 ], [ %167, %166 ]
  %174 = icmp eq i32 %173, 1
  br i1 %174, label %175, label %180

175:                                              ; preds = %172
  %176 = load ptr, ptr getelementptr inbounds (i8, ptr @opt, i64 24), align 8, !tbaa !13
  %177 = call i32 @write_private_key(ptr noundef nonnull %4, ptr noundef %176)
  br label %180

178:                                              ; preds = %.loopexit, %66, %71, %81, %105, %132, %148
  %.3.ph = phi i32 [ %145, %148 ], [ %131, %132 ], [ %.045, %105 ], [ %80, %81 ], [ 1, %71 ], [ 1, %66 ], [ 1, %.loopexit ]
  call void @mbedtls_strerror(i32 noundef %.3.ph, ptr noundef nonnull %3, i64 noundef 1024) #7
  %179 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.36, ptr noundef nonnull %3)
  br label %180

180:                                              ; preds = %178, %172, %175
  %.04673 = phi i32 [ 1, %178 ], [ 0, %175 ], [ 0, %172 ]
  call void @mbedtls_mpi_free(ptr noundef nonnull %5) #7
  call void @mbedtls_mpi_free(ptr noundef nonnull %6) #7
  call void @mbedtls_mpi_free(ptr noundef nonnull %7) #7
  call void @mbedtls_mpi_free(ptr noundef nonnull %8) #7
  call void @mbedtls_mpi_free(ptr noundef nonnull %9) #7
  call void @mbedtls_mpi_free(ptr noundef nonnull %10) #7
  call void @mbedtls_mpi_free(ptr noundef nonnull %11) #7
  call void @mbedtls_mpi_free(ptr noundef nonnull %12) #7
  call void @mbedtls_pk_free(ptr noundef nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %12) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %11) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %10) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %9) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %3) #7
  ret i32 %.04673
}

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

declare void @mbedtls_pk_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

declare void @mbedtls_mpi_init(ptr noundef) local_unnamed_addr #2

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

; 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: nofree nounwind
declare noundef i32 @fflush(ptr nocapture noundef) local_unnamed_addr #4

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

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

declare i32 @mbedtls_pk_get_type(ptr noundef) local_unnamed_addr #2

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

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

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

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

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

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

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

declare void @mbedtls_mpi_free(ptr noundef) local_unnamed_addr #2

declare void @mbedtls_pk_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 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, !7, i64 0}
!6 = !{!"options", !7, i64 0, !10, i64 8, !7, i64 16, !10, i64 24, !7, i64 32}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !10, i64 8}
!12 = !{!6, !7, i64 16}
!13 = !{!6, !10, i64 24}
!14 = !{!6, !7, i64 32}
!15 = !{!10, !10, i64 0}
!16 = !{!8, !8, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}


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