; LLVM IR from guanzhi/GmSSL :: tools (cmsencrypt)

; 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"

@stdin = external global ptr, align 8
@stdout = external global ptr, align 8
@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [14 x i8], align 1
@options = external hidden global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [24 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @cmsencrypt_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 ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i64, align 8
  %15 = alloca [16 x i8], align 16
  %16 = alloca [16 x i8], align 16
  %17 = alloca ptr, align 8
  %18 = alloca i64, align 8
  %19 = alloca ptr, align 8
  %20 = alloca i64, align 8
  %21 = alloca ptr, align 8
  %22 = alloca i32, align 4
  %23 = alloca ptr, align 8
  %24 = alloca ptr, align 8
  %25 = alloca i64, align 8
  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 8, ptr %7) #7
  %26 = load ptr, ptr %5, align 8, !tbaa !9
  %27 = getelementptr inbounds ptr, ptr %26, i64 0
  %28 = load ptr, ptr %27, align 8, !tbaa !9
  store ptr %28, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  store i32 0, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  store ptr null, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  store ptr null, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  %29 = load ptr, ptr @stdin, align 8, !tbaa !9
  store ptr %29, ptr %11, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  %30 = load ptr, ptr @stdout, align 8, !tbaa !9
  store ptr %30, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  store ptr null, ptr %13, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr %15) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr %16) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #7
  store ptr null, ptr %17, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #7
  store ptr null, ptr %19, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #7
  %31 = load i32, ptr %4, align 4, !tbaa !5
  %32 = icmp slt i32 %31, 2
  br i1 %32, label %33, label %38

33:                                               ; preds = %2
  %34 = load ptr, ptr @stderr, align 8, !tbaa !9
  %35 = load ptr, ptr %7, align 8, !tbaa !9
  %36 = load ptr, ptr @options, align 8, !tbaa !9
  %37 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %34, ptr noundef @.str, ptr noundef %35, ptr noundef %36) #7
  store i32 1, ptr %3, align 4
  store i32 1, ptr %22, align 4
  br label %329

38:                                               ; preds = %2
  %39 = load i32, ptr %4, align 4, !tbaa !5
  %40 = load ptr, ptr %5, align 8, !tbaa !9
  %41 = call i32 @get_files_size(i32 noundef %39, ptr noundef %40, ptr noundef @.str.1, ptr noundef %14)
  %42 = icmp ne i32 %41, 1
  br i1 %42, label %43, label %44

43:                                               ; preds = %38
  br label %294

44:                                               ; preds = %38
  %45 = load i64, ptr %14, align 8, !tbaa !11
  %46 = icmp ule i64 %45, 0
  br i1 %46, label %47, label %51

47:                                               ; preds = %44
  %48 = load ptr, ptr @stderr, align 8, !tbaa !9
  %49 = load ptr, ptr %7, align 8, !tbaa !9
  %50 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %48, ptr noundef @.str.2, ptr noundef %49) #7
  br label %294

51:                                               ; preds = %44
  %52 = load i64, ptr %14, align 8, !tbaa !11
  %53 = mul i64 %52, 3
  %54 = udiv i64 %53, 4
  store i64 %54, ptr %14, align 8, !tbaa !11
  %55 = load i64, ptr %14, align 8, !tbaa !11
  %56 = call noalias ptr @malloc(i64 noundef %55) #8
  store ptr %56, ptr %13, align 8, !tbaa !9
  %57 = icmp ne ptr %56, null
  br i1 %57, label %62, label %58

58:                                               ; preds = %51
  %59 = load ptr, ptr @stderr, align 8, !tbaa !9
  %60 = load ptr, ptr %7, align 8, !tbaa !9
  %61 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %59, ptr noundef @.str.3, ptr noundef %60) #7
  br label %294

62:                                               ; preds = %51
  %63 = load ptr, ptr %13, align 8, !tbaa !9
  store ptr %63, ptr %21, align 8, !tbaa !9
  %64 = load i32, ptr %4, align 4, !tbaa !5
  %65 = load ptr, ptr %5, align 8, !tbaa !9
  %66 = call i32 @get_files_size(i32 noundef %64, ptr noundef %65, ptr noundef @.str.4, ptr noundef %18)
  %67 = icmp ne i32 %66, 1
  br i1 %67, label %68, label %69

68:                                               ; preds = %62
  br label %294

69:                                               ; preds = %62
  %70 = load i64, ptr %18, align 8, !tbaa !11
  %71 = icmp ule i64 %70, 0
  br i1 %71, label %72, label %76

72:                                               ; preds = %69
  %73 = load ptr, ptr @stderr, align 8, !tbaa !9
  %74 = load ptr, ptr %7, align 8, !tbaa !9
  %75 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %73, ptr noundef @.str.5, ptr noundef %74) #7
  br label %294

76:                                               ; preds = %69
  %77 = load i64, ptr %18, align 8, !tbaa !11
  %78 = call noalias ptr @malloc(i64 noundef %77) #8
  store ptr %78, ptr %17, align 8, !tbaa !9
  %79 = icmp ne ptr %78, null
  br i1 %79, label %87, label %80

80:                                               ; preds = %76
  %81 = load ptr, ptr @stderr, align 8, !tbaa !9
  %82 = load ptr, ptr %7, align 8, !tbaa !9
  %83 = call ptr @__errno_location() #9
  %84 = load i32, ptr %83, align 4, !tbaa !5
  %85 = call ptr @strerror(i32 noundef %84) #7
  %86 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %81, ptr noundef @.str.6, ptr noundef %82, ptr noundef %85) #7
  br label %294

87:                                               ; preds = %76
  %88 = load i32, ptr %4, align 4, !tbaa !5
  %89 = add nsw i32 %88, -1
  store i32 %89, ptr %4, align 4, !tbaa !5
  %90 = load ptr, ptr %5, align 8, !tbaa !9
  %91 = getelementptr inbounds ptr, ptr %90, i32 1
  store ptr %91, ptr %5, align 8, !tbaa !9
  br label %92

92:                                               ; preds = %230, %87
  %93 = load i32, ptr %4, align 4, !tbaa !5
  %94 = icmp sgt i32 %93, 1
  br i1 %94, label %95, label %235

95:                                               ; preds = %92
  %96 = load ptr, ptr %5, align 8, !tbaa !9
  %97 = load ptr, ptr %96, align 8, !tbaa !9
  %98 = call i32 @strcmp(ptr noundef %97, ptr noundef @.str.7) #10
  %99 = icmp ne i32 %98, 0
  br i1 %99, label %104, label %100

100:                                              ; preds = %95
  %101 = load ptr, ptr %7, align 8, !tbaa !9
  %102 = load ptr, ptr @options, align 8, !tbaa !9
  %103 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef %101, ptr noundef %102)
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %294

104:                                              ; preds = %95
  %105 = load ptr, ptr %5, align 8, !tbaa !9
  %106 = load ptr, ptr %105, align 8, !tbaa !9
  %107 = call i32 @strcmp(ptr noundef %106, ptr noundef @.str.1) #10
  %108 = icmp ne i32 %107, 0
  br i1 %108, label %150, label %109

109:                                              ; preds = %104
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #7
  %110 = load i32, ptr %4, align 4, !tbaa !5
  %111 = add nsw i32 %110, -1
  store i32 %111, ptr %4, align 4, !tbaa !5
  %112 = icmp slt i32 %111, 1
  br i1 %112, label %113, label %114

113:                                              ; preds = %109
  store i32 5, ptr %22, align 4
  br label %147

114:                                              ; preds = %109
  %115 = load ptr, ptr %5, align 8, !tbaa !9
  %116 = getelementptr inbounds ptr, ptr %115, i32 1
  store ptr %116, ptr %5, align 8, !tbaa !9
  %117 = load ptr, ptr %116, align 8, !tbaa !9
  store ptr %117, ptr %23, align 8, !tbaa !9
  %118 = load ptr, ptr %23, align 8, !tbaa !9
  %119 = call noalias ptr @fopen(ptr noundef %118, ptr noundef @.str.8)
  store ptr %119, ptr %24, align 8, !tbaa !9
  %120 = icmp ne ptr %119, null
  br i1 %120, label %129, label %121

121:                                              ; preds = %114
  %122 = load ptr, ptr @stderr, align 8, !tbaa !9
  %123 = load ptr, ptr %7, align 8, !tbaa !9
  %124 = load ptr, ptr %23, align 8, !tbaa !9
  %125 = call ptr @__errno_location() #9
  %126 = load i32, ptr %125, align 4, !tbaa !5
  %127 = call ptr @strerror(i32 noundef %126) #7
  %128 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %122, ptr noundef @.str.9, ptr noundef %123, ptr noundef %124, ptr noundef %127) #7
  store i32 2, ptr %22, align 4
  br label %147

129:                                              ; preds = %114
  %130 = load ptr, ptr %21, align 8, !tbaa !9
  %131 = load i64, ptr %14, align 8, !tbaa !11
  %132 = load ptr, ptr %24, align 8, !tbaa !9
  %133 = call i32 @x509_cert_from_pem(ptr noundef %130, ptr noundef %25, i64 noundef %131, ptr noundef %132)
  %134 = icmp ne i32 %133, 1
  br i1 %134, label %135, label %141

135:                                              ; preds = %129
  %136 = load ptr, ptr @stderr, align 8, !tbaa !9
  %137 = load ptr, ptr %7, align 8, !tbaa !9
  %138 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %136, ptr noundef @.str.10, ptr noundef %137) #7
  %139 = load ptr, ptr %24, align 8, !tbaa !9
  %140 = call i32 @fclose(ptr noundef %139)
  store i32 2, ptr %22, align 4
  br label %147

141:                                              ; preds = %129
  %142 = load i64, ptr %25, align 8, !tbaa !11
  %143 = load ptr, ptr %21, align 8, !tbaa !9
  %144 = getelementptr inbounds i8, ptr %143, i64 %142
  store ptr %144, ptr %21, align 8, !tbaa !9
  %145 = load ptr, ptr %24, align 8, !tbaa !9
  %146 = call i32 @fclose(ptr noundef %145)
  store i32 0, ptr %22, align 4
  br label %147

147:                                              ; preds = %141, %135, %121, %113
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #7
  %148 = load i32, ptr %22, align 4
  switch i32 %148, label %329 [
    i32 0, label %149
    i32 5, label %221
    i32 2, label %294
  ]

149:                                              ; preds = %147
  br label %229

150:                                              ; preds = %104
  %151 = load ptr, ptr %5, align 8, !tbaa !9
  %152 = load ptr, ptr %151, align 8, !tbaa !9
  %153 = call i32 @strcmp(ptr noundef %152, ptr noundef @.str.4) #10
  %154 = icmp ne i32 %153, 0
  br i1 %154, label %189, label %155

155:                                              ; preds = %150
  %156 = load i32, ptr %4, align 4, !tbaa !5
  %157 = add nsw i32 %156, -1
  store i32 %157, ptr %4, align 4, !tbaa !5
  %158 = icmp slt i32 %157, 1
  br i1 %158, label %159, label %160

159:                                              ; preds = %155
  br label %221

160:                                              ; preds = %155
  %161 = load ptr, ptr %5, align 8, !tbaa !9
  %162 = getelementptr inbounds ptr, ptr %161, i32 1
  store ptr %162, ptr %5, align 8, !tbaa !9
  %163 = load ptr, ptr %162, align 8, !tbaa !9
  store ptr %163, ptr %9, align 8, !tbaa !9
  %164 = load ptr, ptr %9, align 8, !tbaa !9
  %165 = call noalias ptr @fopen(ptr noundef %164, ptr noundef @.str.8)
  store ptr %165, ptr %11, align 8, !tbaa !9
  %166 = icmp ne ptr %165, null
  br i1 %166, label %175, label %167

167:                                              ; preds = %160
  %168 = load ptr, ptr @stderr, align 8, !tbaa !9
  %169 = load ptr, ptr %7, align 8, !tbaa !9
  %170 = load ptr, ptr %9, align 8, !tbaa !9
  %171 = call ptr @__errno_location() #9
  %172 = load i32, ptr %171, align 4, !tbaa !5
  %173 = call ptr @strerror(i32 noundef %172) #7
  %174 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %168, ptr noundef @.str.9, ptr noundef %169, ptr noundef %170, ptr noundef %173) #7
  br label %294

175:                                              ; preds = %160
  %176 = load ptr, ptr %17, align 8, !tbaa !9
  %177 = load i64, ptr %18, align 8, !tbaa !11
  %178 = load ptr, ptr %11, align 8, !tbaa !9
  %179 = call i64 @fread(ptr noundef %176, i64 noundef 1, i64 noundef %177, ptr noundef %178)
  store i64 %179, ptr %18, align 8, !tbaa !11
  %180 = icmp ule i64 %179, 0
  br i1 %180, label %181, label %188

181:                                              ; preds = %175
  %182 = load ptr, ptr @stderr, align 8, !tbaa !9
  %183 = load ptr, ptr %7, align 8, !tbaa !9
  %184 = call ptr @__errno_location() #9
  %185 = load i32, ptr %184, align 4, !tbaa !5
  %186 = call ptr @strerror(i32 noundef %185) #7
  %187 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %182, ptr noundef @.str.11, ptr noundef %183, ptr noundef %186) #7
  br label %294

188:                                              ; preds = %175
  br label %228

189:                                              ; preds = %150
  %190 = load ptr, ptr %5, align 8, !tbaa !9
  %191 = load ptr, ptr %190, align 8, !tbaa !9
  %192 = call i32 @strcmp(ptr noundef %191, ptr noundef @.str.12) #10
  %193 = icmp ne i32 %192, 0
  br i1 %193, label %215, label %194

194:                                              ; preds = %189
  %195 = load i32, ptr %4, align 4, !tbaa !5
  %196 = add nsw i32 %195, -1
  store i32 %196, ptr %4, align 4, !tbaa !5
  %197 = icmp slt i32 %196, 1
  br i1 %197, label %198, label %199

198:                                              ; preds = %194
  br label %221

199:                                              ; preds = %194
  %200 = load ptr, ptr %5, align 8, !tbaa !9
  %201 = getelementptr inbounds ptr, ptr %200, i32 1
  store ptr %201, ptr %5, align 8, !tbaa !9
  %202 = load ptr, ptr %201, align 8, !tbaa !9
  store ptr %202, ptr %10, align 8, !tbaa !9
  %203 = load ptr, ptr %10, align 8, !tbaa !9
  %204 = call noalias ptr @fopen(ptr noundef %203, ptr noundef @.str.13)
  store ptr %204, ptr %12, align 8, !tbaa !9
  %205 = icmp ne ptr %204, null
  br i1 %205, label %214, label %206

206:                                              ; preds = %199
  %207 = load ptr, ptr @stderr, align 8, !tbaa !9
  %208 = load ptr, ptr %7, align 8, !tbaa !9
  %209 = load ptr, ptr %10, align 8, !tbaa !9
  %210 = call ptr @__errno_location() #9
  %211 = load i32, ptr %210, align 4, !tbaa !5
  %212 = call ptr @strerror(i32 noundef %211) #7
  %213 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %207, ptr noundef @.str.9, ptr noundef %208, ptr noundef %209, ptr noundef %212) #7
  br label %294

214:                                              ; preds = %199
  br label %227

215:                                              ; preds = %189
  %216 = load ptr, ptr @stderr, align 8, !tbaa !9
  %217 = load ptr, ptr %7, align 8, !tbaa !9
  %218 = load ptr, ptr %5, align 8, !tbaa !9
  %219 = load ptr, ptr %218, align 8, !tbaa !9
  %220 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %216, ptr noundef @.str.14, ptr noundef %217, ptr noundef %219) #7
  br label %294

221:                                              ; preds = %198, %159, %147
  %222 = load ptr, ptr @stderr, align 8, !tbaa !9
  %223 = load ptr, ptr %7, align 8, !tbaa !9
  %224 = load ptr, ptr %5, align 8, !tbaa !9
  %225 = load ptr, ptr %224, align 8, !tbaa !9
  %226 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %222, ptr noundef @.str.15, ptr noundef %223, ptr noundef %225) #7
  br label %294

227:                                              ; preds = %214
  br label %228

228:                                              ; preds = %227, %188
  br label %229

229:                                              ; preds = %228, %149
  br label %230

230:                                              ; preds = %229
  %231 = load i32, ptr %4, align 4, !tbaa !5
  %232 = add nsw i32 %231, -1
  store i32 %232, ptr %4, align 4, !tbaa !5
  %233 = load ptr, ptr %5, align 8, !tbaa !9
  %234 = getelementptr inbounds ptr, ptr %233, i32 1
  store ptr %234, ptr %5, align 8, !tbaa !9
  br label %92, !llvm.loop !13

235:                                              ; preds = %92
  %236 = load ptr, ptr %21, align 8, !tbaa !9
  %237 = load ptr, ptr %13, align 8, !tbaa !9
  %238 = ptrtoint ptr %236 to i64
  %239 = ptrtoint ptr %237 to i64
  %240 = sub i64 %238, %239
  store i64 %240, ptr %14, align 8, !tbaa !11
  %241 = getelementptr inbounds [16 x i8], ptr %15, i64 0, i64 0
  %242 = call i32 @rand_bytes(ptr noundef %241, i64 noundef 16)
  %243 = icmp ne i32 %242, 1
  br i1 %243, label %257, label %244

244:                                              ; preds = %235
  %245 = getelementptr inbounds [16 x i8], ptr %16, i64 0, i64 0
  %246 = call i32 @rand_bytes(ptr noundef %245, i64 noundef 16)
  %247 = icmp ne i32 %246, 1
  br i1 %247, label %257, label %248

248:                                              ; preds = %244
  %249 = load ptr, ptr %13, align 8, !tbaa !9
  %250 = load i64, ptr %14, align 8, !tbaa !11
  %251 = getelementptr inbounds [16 x i8], ptr %15, i64 0, i64 0
  %252 = getelementptr inbounds [16 x i8], ptr %16, i64 0, i64 0
  %253 = load ptr, ptr %17, align 8, !tbaa !9
  %254 = load i64, ptr %18, align 8, !tbaa !11
  %255 = call i32 @cms_envelop(ptr noundef null, ptr noundef %20, ptr noundef %249, i64 noundef %250, i32 noundef 98, ptr noundef %251, i64 noundef 16, ptr noundef %252, i64 noundef 16, i32 noundef 118, ptr noundef %253, i64 noundef %254, ptr noundef null, i64 noundef 0, ptr noundef null, i64 noundef 0)
  %256 = icmp ne i32 %255, 1
  br i1 %256, label %257, label %261

257:                                              ; preds = %248, %244, %235
  %258 = load ptr, ptr @stderr, align 8, !tbaa !9
  %259 = load ptr, ptr %7, align 8, !tbaa !9
  %260 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %258, ptr noundef @.str.16, ptr noundef %259) #7
  br label %294

261:                                              ; preds = %248
  %262 = load i64, ptr %20, align 8, !tbaa !11
  %263 = call noalias ptr @malloc(i64 noundef %262) #8
  store ptr %263, ptr %19, align 8, !tbaa !9
  %264 = icmp ne ptr %263, null
  br i1 %264, label %269, label %265

265:                                              ; preds = %261
  %266 = load ptr, ptr @stderr, align 8, !tbaa !9
  %267 = load ptr, ptr %7, align 8, !tbaa !9
  %268 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %266, ptr noundef @.str.3, ptr noundef %267) #7
  br label %294

269:                                              ; preds = %261
  %270 = load ptr, ptr %19, align 8, !tbaa !9
  %271 = load ptr, ptr %13, align 8, !tbaa !9
  %272 = load i64, ptr %14, align 8, !tbaa !11
  %273 = getelementptr inbounds [16 x i8], ptr %15, i64 0, i64 0
  %274 = getelementptr inbounds [16 x i8], ptr %16, i64 0, i64 0
  %275 = load ptr, ptr %17, align 8, !tbaa !9
  %276 = load i64, ptr %18, align 8, !tbaa !11
  %277 = call i32 @cms_envelop(ptr noundef %270, ptr noundef %20, ptr noundef %271, i64 noundef %272, i32 noundef 98, ptr noundef %273, i64 noundef 16, ptr noundef %274, i64 noundef 16, i32 noundef 118, ptr noundef %275, i64 noundef %276, ptr noundef null, i64 noundef 0, ptr noundef null, i64 noundef 0)
  %278 = icmp ne i32 %277, 1
  br i1 %278, label %279, label %283

279:                                              ; preds = %269
  %280 = load ptr, ptr @stderr, align 8, !tbaa !9
  %281 = load ptr, ptr %7, align 8, !tbaa !9
  %282 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %280, ptr noundef @.str.16, ptr noundef %281) #7
  br label %294

283:                                              ; preds = %269
  %284 = load ptr, ptr %19, align 8, !tbaa !9
  %285 = load i64, ptr %20, align 8, !tbaa !11
  %286 = load ptr, ptr %12, align 8, !tbaa !9
  %287 = call i32 @cms_to_pem(ptr noundef %284, i64 noundef %285, ptr noundef %286)
  %288 = icmp ne i32 %287, 1
  br i1 %288, label %289, label %293

289:                                              ; preds = %283
  %290 = load ptr, ptr @stderr, align 8, !tbaa !9
  %291 = load ptr, ptr %7, align 8, !tbaa !9
  %292 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %290, ptr noundef @.str.17, ptr noundef %291) #7
  br label %294

293:                                              ; preds = %283
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %294

294:                                              ; preds = %293, %289, %279, %265, %257, %221, %215, %206, %181, %167, %147, %100, %80, %72, %68, %58, %47, %43
  %295 = load ptr, ptr %9, align 8, !tbaa !9
  %296 = icmp ne ptr %295, null
  br i1 %296, label %297, label %303

297:                                              ; preds = %294
  %298 = load ptr, ptr %11, align 8, !tbaa !9
  %299 = icmp ne ptr %298, null
  br i1 %299, label %300, label %303

300:                                              ; preds = %297
  %301 = load ptr, ptr %11, align 8, !tbaa !9
  %302 = call i32 @fclose(ptr noundef %301)
  br label %303

303:                                              ; preds = %300, %297, %294
  %304 = load ptr, ptr %10, align 8, !tbaa !9
  %305 = icmp ne ptr %304, null
  br i1 %305, label %306, label %312

306:                                              ; preds = %303
  %307 = load ptr, ptr %12, align 8, !tbaa !9
  %308 = icmp ne ptr %307, null
  br i1 %308, label %309, label %312

309:                                              ; preds = %306
  %310 = load ptr, ptr %12, align 8, !tbaa !9
  %311 = call i32 @fclose(ptr noundef %310)
  br label %312

312:                                              ; preds = %309, %306, %303
  %313 = load ptr, ptr %13, align 8, !tbaa !9
  %314 = icmp ne ptr %313, null
  br i1 %314, label %315, label %317

315:                                              ; preds = %312
  %316 = load ptr, ptr %13, align 8, !tbaa !9
  call void @free(ptr noundef %316) #7
  br label %317

317:                                              ; preds = %315, %312
  %318 = load ptr, ptr %17, align 8, !tbaa !9
  %319 = icmp ne ptr %318, null
  br i1 %319, label %320, label %322

320:                                              ; preds = %317
  %321 = load ptr, ptr %17, align 8, !tbaa !9
  call void @free(ptr noundef %321) #7
  br label %322

322:                                              ; preds = %320, %317
  %323 = load ptr, ptr %19, align 8, !tbaa !9
  %324 = icmp ne ptr %323, null
  br i1 %324, label %325, label %327

325:                                              ; preds = %322
  %326 = load ptr, ptr %19, align 8, !tbaa !9
  call void @free(ptr noundef %326) #7
  br label %327

327:                                              ; preds = %325, %322
  %328 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %328, ptr %3, align 4
  store i32 1, ptr %22, align 4
  br label %329

329:                                              ; preds = %327, %147, %33
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, 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 8, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  %330 = load i32, ptr %3, align 4
  ret i32 %330
}

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

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #2

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

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #3

; Function Attrs: nounwind
declare ptr @strerror(i32 noundef) #2

; Function Attrs: nounwind willreturn memory(none)
declare ptr @__errno_location() #4

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

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

declare noalias ptr @fopen(ptr noundef, ptr noundef) #6

declare i32 @x509_cert_from_pem(ptr noundef, ptr noundef, i64 noundef, ptr noundef) #6

declare i32 @fclose(ptr noundef) #6

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

declare i64 @fread(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #6

declare i32 @rand_bytes(ptr noundef, i64 noundef) #6

declare i32 @cms_envelop(ptr noundef, ptr noundef, ptr noundef, i64 noundef, i32 noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef, i32 noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef) #6

declare i32 @cms_to_pem(ptr noundef, i64 noundef, ptr noundef) #6

; Function Attrs: nounwind
declare void @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 = { 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 #3 = { nounwind allocsize(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 #4 = { nounwind willreturn memory(none) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind 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 #6 = { "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 allocsize(0) }
attributes #9 = { nounwind willreturn memory(none) }
attributes #10 = { 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, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"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"

@stdin = external local_unnamed_addr global ptr, align 8
@stdout = external local_unnamed_addr global ptr, align 8
@stderr = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [14 x i8], align 1
@options = external hidden local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [24 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @cmsencrypt_main(i32 noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = alloca i64, align 8
  %4 = alloca [16 x i8], align 16
  %5 = alloca [16 x i8], align 16
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = load ptr, ptr %1, align 8, !tbaa !5
  %10 = load ptr, ptr @stdin, align 8, !tbaa !5
  %11 = load ptr, ptr @stdout, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #9
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #9
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #9
  %12 = icmp slt i32 %0, 2
  br i1 %12, label %13, label %17

13:                                               ; preds = %2
  %14 = load ptr, ptr @stderr, align 8, !tbaa !5
  %15 = load ptr, ptr @options, align 8, !tbaa !5
  %16 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %14, ptr noundef nonnull @.str, ptr noundef %9, ptr noundef %15) #10
  br label %.thread197

17:                                               ; preds = %2
  %18 = call i32 @get_files_size(i32 noundef %0, ptr noundef nonnull %1, ptr noundef nonnull @.str.1, ptr noundef nonnull %3)
  %.not = icmp eq i32 %18, 1
  br i1 %.not, label %19, label %.thread197

19:                                               ; preds = %17
  %20 = load i64, ptr %3, align 8, !tbaa !9
  %21 = icmp eq i64 %20, 0
  br i1 %21, label %22, label %25

22:                                               ; preds = %19
  %23 = load ptr, ptr @stderr, align 8, !tbaa !5
  %24 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %23, ptr noundef nonnull @.str.2, ptr noundef %9) #10
  br label %.thread197

25:                                               ; preds = %19
  %26 = mul i64 %20, 3
  %27 = lshr i64 %26, 2
  store i64 %27, ptr %3, align 8, !tbaa !9
  %28 = call noalias ptr @malloc(i64 noundef %27) #11
  %.not119 = icmp eq ptr %28, null
  br i1 %.not119, label %29, label %32

29:                                               ; preds = %25
  %30 = load ptr, ptr @stderr, align 8, !tbaa !5
  %31 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %30, ptr noundef nonnull @.str.3, ptr noundef %9) #10
  br label %.thread197

32:                                               ; preds = %25
  %33 = call i32 @get_files_size(i32 noundef %0, ptr noundef nonnull %1, ptr noundef nonnull @.str.4, ptr noundef nonnull %6)
  %.not120 = icmp eq i32 %33, 1
  br i1 %.not120, label %34, label %.thread321

34:                                               ; preds = %32
  %35 = load i64, ptr %6, align 8, !tbaa !9
  %36 = icmp eq i64 %35, 0
  br i1 %36, label %37, label %40

37:                                               ; preds = %34
  %38 = load ptr, ptr @stderr, align 8, !tbaa !5
  %39 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %38, ptr noundef nonnull @.str.5, ptr noundef %9) #10
  br label %.thread321

40:                                               ; preds = %34
  %41 = call noalias ptr @malloc(i64 noundef %35) #11
  %.not121 = icmp eq ptr %41, null
  br i1 %.not121, label %42, label %48

42:                                               ; preds = %40
  %43 = load ptr, ptr @stderr, align 8, !tbaa !5
  %44 = tail call ptr @__errno_location() #12
  %45 = load i32, ptr %44, align 4, !tbaa !11
  %46 = call ptr @strerror(i32 noundef %45) #9
  %47 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %43, ptr noundef nonnull @.str.6, ptr noundef %9, ptr noundef %46) #10
  br label %.thread321

48:                                               ; preds = %40
  %.not266 = icmp eq i32 %0, 2
  br i1 %.not266, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %48
  %49 = getelementptr inbounds i8, ptr %1, i64 8
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %115
  %.080.in261 = phi i32 [ %.1, %115 ], [ %0, %.lr.ph.preheader ]
  %.082260 = phi ptr [ %.2, %115 ], [ %28, %.lr.ph.preheader ]
  %.087259 = phi ptr [ %.188, %115 ], [ %11, %.lr.ph.preheader ]
  %.090258 = phi ptr [ %.191, %115 ], [ %10, %.lr.ph.preheader ]
  %.093257 = phi ptr [ %.194, %115 ], [ null, %.lr.ph.preheader ]
  %.096256 = phi ptr [ %.197, %115 ], [ null, %.lr.ph.preheader ]
  %.099255 = phi ptr [ %116, %115 ], [ %49, %.lr.ph.preheader ]
  %50 = load ptr, ptr %.099255, align 8, !tbaa !5
  %51 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %50, ptr noundef nonnull dereferenceable(1) @.str.7) #13
  %.not128 = icmp eq i32 %51, 0
  br i1 %.not128, label %52, label %55

52:                                               ; preds = %.lr.ph
  %53 = load ptr, ptr @options, align 8, !tbaa !5
  %54 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef %9, ptr noundef %53)
  br label %150

55:                                               ; preds = %.lr.ph
  %56 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %50, ptr noundef nonnull dereferenceable(1) @.str.1) #13
  %.not129 = icmp eq i32 %56, 0
  br i1 %.not129, label %57, label %78

57:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #9
  %58 = getelementptr inbounds i8, ptr %.099255, i64 8
  %59 = load ptr, ptr %58, align 8, !tbaa !5
  %60 = call noalias ptr @fopen(ptr noundef %59, ptr noundef nonnull @.str.8)
  %.not130 = icmp eq ptr %60, null
  br i1 %.not130, label %61, label %67

61:                                               ; preds = %57
  %62 = load ptr, ptr @stderr, align 8, !tbaa !5
  %63 = tail call ptr @__errno_location() #12
  %64 = load i32, ptr %63, align 4, !tbaa !11
  %65 = call ptr @strerror(i32 noundef %64) #9
  %66 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %62, ptr noundef nonnull @.str.9, ptr noundef %9, ptr noundef %59, ptr noundef %65) #10
  br label %.thread

67:                                               ; preds = %57
  %68 = load i64, ptr %3, align 8, !tbaa !9
  %69 = call i32 @x509_cert_from_pem(ptr noundef %.082260, ptr noundef nonnull %8, i64 noundef %68, ptr noundef nonnull %60) #9
  %.not131 = icmp eq i32 %69, 1
  br i1 %.not131, label %74, label %70

70:                                               ; preds = %67
  %71 = load ptr, ptr @stderr, align 8, !tbaa !5
  %72 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %71, ptr noundef nonnull @.str.10, ptr noundef %9) #10
  %73 = call i32 @fclose(ptr noundef nonnull %60)
  br label %.thread

.thread:                                          ; preds = %70, %61
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #9
  br label %150

74:                                               ; preds = %67
  %75 = load i64, ptr %8, align 8, !tbaa !9
  %76 = getelementptr inbounds i8, ptr %.082260, i64 %75
  %77 = call i32 @fclose(ptr noundef nonnull %60)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #9
  br label %115

78:                                               ; preds = %55
  %79 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %50, ptr noundef nonnull dereferenceable(1) @.str.4) #13
  %.not132 = icmp eq i32 %79, 0
  br i1 %.not132, label %80, label %100

80:                                               ; preds = %78
  %81 = getelementptr inbounds i8, ptr %.099255, i64 8
  %82 = load ptr, ptr %81, align 8, !tbaa !5
  %83 = call noalias ptr @fopen(ptr noundef %82, ptr noundef nonnull @.str.8)
  %.not133 = icmp eq ptr %83, null
  br i1 %.not133, label %84, label %90

84:                                               ; preds = %80
  %85 = load ptr, ptr @stderr, align 8, !tbaa !5
  %86 = tail call ptr @__errno_location() #12
  %87 = load i32, ptr %86, align 4, !tbaa !11
  %88 = call ptr @strerror(i32 noundef %87) #9
  %89 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %85, ptr noundef nonnull @.str.9, ptr noundef %9, ptr noundef %82, ptr noundef %88) #10
  br label %.thread144

90:                                               ; preds = %80
  %91 = load i64, ptr %6, align 8, !tbaa !9
  %92 = call i64 @fread(ptr noundef nonnull %41, i64 noundef 1, i64 noundef %91, ptr noundef nonnull %83)
  store i64 %92, ptr %6, align 8, !tbaa !9
  %93 = icmp eq i64 %92, 0
  br i1 %93, label %94, label %115

94:                                               ; preds = %90
  %95 = load ptr, ptr @stderr, align 8, !tbaa !5
  %96 = tail call ptr @__errno_location() #12
  %97 = load i32, ptr %96, align 4, !tbaa !11
  %98 = call ptr @strerror(i32 noundef %97) #9
  %99 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %95, ptr noundef nonnull @.str.11, ptr noundef %9, ptr noundef %98) #10
  br label %150

100:                                              ; preds = %78
  %101 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %50, ptr noundef nonnull dereferenceable(1) @.str.12) #13
  %.not134 = icmp eq i32 %101, 0
  br i1 %.not134, label %102, label %112

102:                                              ; preds = %100
  %103 = getelementptr inbounds i8, ptr %.099255, i64 8
  %104 = load ptr, ptr %103, align 8, !tbaa !5
  %105 = call noalias ptr @fopen(ptr noundef %104, ptr noundef nonnull @.str.13)
  %.not135 = icmp eq ptr %105, null
  br i1 %.not135, label %106, label %115

106:                                              ; preds = %102
  %107 = load ptr, ptr @stderr, align 8, !tbaa !5
  %108 = tail call ptr @__errno_location() #12
  %109 = load i32, ptr %108, align 4, !tbaa !11
  %110 = call ptr @strerror(i32 noundef %109) #9
  %111 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %107, ptr noundef nonnull @.str.9, ptr noundef %9, ptr noundef %104, ptr noundef %110) #10
  br label %150

112:                                              ; preds = %100
  %113 = load ptr, ptr @stderr, align 8, !tbaa !5
  %114 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %113, ptr noundef nonnull @.str.14, ptr noundef %9, ptr noundef %50) #10
  br label %150

115:                                              ; preds = %74, %102, %90
  %.197 = phi ptr [ %.096256, %102 ], [ %82, %90 ], [ %.096256, %74 ]
  %.194 = phi ptr [ %104, %102 ], [ %.093257, %90 ], [ %.093257, %74 ]
  %.191 = phi ptr [ %.090258, %102 ], [ %83, %90 ], [ %.090258, %74 ]
  %.188 = phi ptr [ %105, %102 ], [ %.087259, %90 ], [ %.087259, %74 ]
  %.2 = phi ptr [ %.082260, %102 ], [ %.082260, %90 ], [ %76, %74 ]
  %.1 = add nsw i32 %.080.in261, -2
  %116 = getelementptr inbounds i8, ptr %.099255, i64 16
  %117 = icmp sgt i32 %.080.in261, 4
  br i1 %117, label %.lr.ph, label %._crit_edge, !llvm.loop !13

._crit_edge:                                      ; preds = %115, %48
  %.096.lcssa = phi ptr [ null, %48 ], [ %.197, %115 ]
  %.093.lcssa = phi ptr [ null, %48 ], [ %.194, %115 ]
  %.090.lcssa = phi ptr [ %10, %48 ], [ %.191, %115 ]
  %.087.lcssa = phi ptr [ %11, %48 ], [ %.188, %115 ]
  %.082.lcssa = phi ptr [ %28, %48 ], [ %.2, %115 ]
  %118 = ptrtoint ptr %.082.lcssa to i64
  %119 = ptrtoint ptr %28 to i64
  %120 = sub i64 %118, %119
  store i64 %120, ptr %3, align 8, !tbaa !9
  %121 = call i32 @rand_bytes(ptr noundef nonnull %4, i64 noundef 16) #9
  %.not122 = icmp eq i32 %121, 1
  br i1 %.not122, label %122, label %128

122:                                              ; preds = %._crit_edge
  %123 = call i32 @rand_bytes(ptr noundef nonnull %5, i64 noundef 16) #9
  %.not123 = icmp eq i32 %123, 1
  br i1 %.not123, label %124, label %128

124:                                              ; preds = %122
  %125 = load i64, ptr %3, align 8, !tbaa !9
  %126 = load i64, ptr %6, align 8, !tbaa !9
  %127 = call i32 @cms_envelop(ptr noundef null, ptr noundef nonnull %7, ptr noundef nonnull %28, i64 noundef %125, i32 noundef 98, ptr noundef nonnull %4, i64 noundef 16, ptr noundef nonnull %5, i64 noundef 16, i32 noundef 118, ptr noundef nonnull %41, i64 noundef %126, ptr noundef null, i64 noundef 0, ptr noundef null, i64 noundef 0) #9
  %.not124 = icmp eq i32 %127, 1
  br i1 %.not124, label %131, label %128

128:                                              ; preds = %124, %122, %._crit_edge
  %129 = load ptr, ptr @stderr, align 8, !tbaa !5
  %130 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %129, ptr noundef nonnull @.str.16, ptr noundef %9) #10
  br label %150

131:                                              ; preds = %124
  %132 = load i64, ptr %7, align 8, !tbaa !9
  %133 = call noalias ptr @malloc(i64 noundef %132) #11
  %.not125 = icmp eq ptr %133, null
  br i1 %.not125, label %134, label %137

134:                                              ; preds = %131
  %135 = load ptr, ptr @stderr, align 8, !tbaa !5
  %136 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %135, ptr noundef nonnull @.str.3, ptr noundef %9) #10
  br label %150

137:                                              ; preds = %131
  %138 = load i64, ptr %3, align 8, !tbaa !9
  %139 = load i64, ptr %6, align 8, !tbaa !9
  %140 = call i32 @cms_envelop(ptr noundef nonnull %133, ptr noundef nonnull %7, ptr noundef nonnull %28, i64 noundef %138, i32 noundef 98, ptr noundef nonnull %4, i64 noundef 16, ptr noundef nonnull %5, i64 noundef 16, i32 noundef 118, ptr noundef nonnull %41, i64 noundef %139, ptr noundef null, i64 noundef 0, ptr noundef null, i64 noundef 0) #9
  %.not126 = icmp eq i32 %140, 1
  br i1 %.not126, label %144, label %141

141:                                              ; preds = %137
  %142 = load ptr, ptr @stderr, align 8, !tbaa !5
  %143 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %142, ptr noundef nonnull @.str.16, ptr noundef %9) #10
  br label %150

144:                                              ; preds = %137
  %145 = load i64, ptr %7, align 8, !tbaa !9
  %146 = call i32 @cms_to_pem(ptr noundef nonnull %133, i64 noundef %145, ptr noundef %.087.lcssa) #9
  %.not127 = icmp eq i32 %146, 1
  br i1 %.not127, label %150, label %147

147:                                              ; preds = %144
  %148 = load ptr, ptr @stderr, align 8, !tbaa !5
  %149 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %148, ptr noundef nonnull @.str.17, ptr noundef %9) #10
  br label %150

150:                                              ; preds = %.thread, %144, %147, %141, %134, %128, %112, %106, %94, %52
  %.0102 = phi i32 [ 1, %112 ], [ 1, %106 ], [ 1, %94 ], [ 0, %52 ], [ 1, %128 ], [ 1, %141 ], [ 1, %147 ], [ 1, %134 ], [ 0, %144 ], [ 1, %.thread ]
  %.298 = phi ptr [ %.096256, %112 ], [ %.096256, %106 ], [ %82, %94 ], [ %.096256, %52 ], [ %.096.lcssa, %128 ], [ %.096.lcssa, %141 ], [ %.096.lcssa, %147 ], [ %.096.lcssa, %134 ], [ %.096.lcssa, %144 ], [ %.096256, %.thread ]
  %.295 = phi ptr [ %.093257, %112 ], [ %104, %106 ], [ %.093257, %94 ], [ %.093257, %52 ], [ %.093.lcssa, %128 ], [ %.093.lcssa, %141 ], [ %.093.lcssa, %147 ], [ %.093.lcssa, %134 ], [ %.093.lcssa, %144 ], [ %.093257, %.thread ]
  %.292 = phi ptr [ %.090258, %112 ], [ %.090258, %106 ], [ %83, %94 ], [ %.090258, %52 ], [ %.090.lcssa, %128 ], [ %.090.lcssa, %141 ], [ %.090.lcssa, %147 ], [ %.090.lcssa, %134 ], [ %.090.lcssa, %144 ], [ %.090258, %.thread ]
  %.289 = phi ptr [ %.087259, %112 ], [ null, %106 ], [ %.087259, %94 ], [ %.087259, %52 ], [ %.087.lcssa, %128 ], [ %.087.lcssa, %141 ], [ %.087.lcssa, %147 ], [ %.087.lcssa, %134 ], [ %.087.lcssa, %144 ], [ %.087259, %.thread ]
  %.084 = phi ptr [ null, %112 ], [ null, %106 ], [ null, %94 ], [ null, %52 ], [ null, %128 ], [ %133, %141 ], [ %133, %147 ], [ null, %134 ], [ %133, %144 ], [ null, %.thread ]
  %151 = icmp ne ptr %.298, null
  %152 = icmp ne ptr %.292, null
  %or.cond = select i1 %151, i1 %152, i1 false
  br i1 %or.cond, label %153, label %.thread144

153:                                              ; preds = %150
  %154 = call i32 @fclose(ptr noundef nonnull %.292)
  br label %.thread144

.thread144:                                       ; preds = %84, %153, %150
  %.084159 = phi ptr [ %.084, %153 ], [ %.084, %150 ], [ null, %84 ]
  %.289156 = phi ptr [ %.289, %153 ], [ %.289, %150 ], [ %.087259, %84 ]
  %.295155 = phi ptr [ %.295, %153 ], [ %.295, %150 ], [ %.093257, %84 ]
  %.0102154 = phi i32 [ %.0102, %153 ], [ %.0102, %150 ], [ 1, %84 ]
  %155 = icmp ne ptr %.295155, null
  %156 = icmp ne ptr %.289156, null
  %or.cond3 = select i1 %155, i1 %156, i1 false
  br i1 %or.cond3, label %157, label %.thread144.thread.thread180

157:                                              ; preds = %.thread144
  %158 = call i32 @fclose(ptr noundef nonnull %.289156)
  br label %.thread144.thread.thread180

.thread321:                                       ; preds = %42, %37, %32
  call void @free(ptr noundef nonnull %28) #9
  br label %.thread197

.thread144.thread.thread180:                      ; preds = %.thread144, %157
  call void @free(ptr noundef nonnull %28) #9
  call void @free(ptr noundef nonnull %41) #9
  %.not138 = icmp eq ptr %.084159, null
  br i1 %.not138, label %.thread197, label %159

159:                                              ; preds = %.thread144.thread.thread180
  call void @free(ptr noundef nonnull %.084159) #9
  br label %.thread197

.thread197:                                       ; preds = %.thread321, %29, %22, %17, %.thread144.thread.thread180, %159, %13
  %.0 = phi i32 [ 1, %13 ], [ %.0102154, %159 ], [ %.0102154, %.thread144.thread.thread180 ], [ 1, %17 ], [ 1, %22 ], [ 1, %29 ], [ 1, %.thread321 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #9
  ret i32 %.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: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #2

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

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3

; Function Attrs: nounwind
declare ptr @strerror(i32 noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__errno_location() 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 #6

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

; Function Attrs: nofree nounwind
declare noalias noundef ptr @fopen(ptr nocapture noundef readonly, ptr nocapture noundef readonly) local_unnamed_addr #2

declare i32 @x509_cert_from_pem(ptr noundef, ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #7

; Function Attrs: nofree nounwind
declare noundef i32 @fclose(ptr nocapture 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: nofree nounwind
declare noundef i64 @fread(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #2

declare i32 @rand_bytes(ptr noundef, i64 noundef) local_unnamed_addr #7

declare i32 @cms_envelop(ptr noundef, ptr noundef, ptr noundef, i64 noundef, i32 noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef, i32 noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef) local_unnamed_addr #7

declare i32 @cms_to_pem(ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #7

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #8

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 = { 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 #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 nosync nounwind willreturn memory(none) "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 = { 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 #7 = { "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 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 #9 = { nounwind }
attributes #10 = { cold nounwind }
attributes #11 = { nounwind allocsize(0) }
attributes #12 = { nounwind willreturn memory(none) }
attributes #13 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}


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