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

; 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.SM2_KEY = type { %struct.SM2_Z256_POINT, [4 x i64] }
%struct.SM2_Z256_POINT = type { [4 x i64], [4 x i64], [4 x i64] }
%struct.SDF_DEVICE = type { ptr, [41 x i8], [17 x i8], [17 x i8] }
%struct.SDF_KEY = type { ptr, ptr }
%struct.SDF_CBC_CTX = type { %struct.SDF_KEY, [16 x i8], [16 x i8], i64 }

@stdin = external global ptr, align 8
@stdout = external global ptr, align 8
@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [20 x i8], align 1
@usage = external hidden global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@options = external hidden global ptr, align 8
@.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 [46 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [66 x i8], align 1
@__FUNCTION__.sdfencrypt_main = external hidden unnamed_addr constant [16 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [31 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @sdfencrypt_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 ptr, align 8
  %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 ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca %struct.SM2_KEY, align 8
  %18 = alloca [1024 x i8], align 16
  %19 = alloca i64, align 8
  %20 = alloca [16 x i8], align 16
  %21 = alloca [4096 x i8], align 16
  %22 = alloca i64, align 8
  %23 = alloca i64, align 8
  %24 = alloca %struct.SDF_DEVICE, align 8
  %25 = alloca %struct.SDF_KEY, align 8
  %26 = alloca %struct.SDF_CBC_CTX, align 8
  %27 = alloca i32, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  store i32 1, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  %28 = load ptr, ptr %5, align 8, !tbaa !9
  %29 = getelementptr inbounds ptr, ptr %28, i64 0
  %30 = load ptr, ptr %29, align 8, !tbaa !9
  store ptr %30, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  store ptr null, ptr %8, align 8, !tbaa !9
  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
  store ptr null, ptr %11, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  store ptr null, 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
  store ptr null, ptr %14, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  %31 = load ptr, ptr @stdin, align 8, !tbaa !9
  store ptr %31, ptr %15, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  %32 = load ptr, ptr @stdout, align 8, !tbaa !9
  store ptr %32, ptr %16, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 128, ptr %17) #7
  call void @llvm.lifetime.start.p0(i64 1024, ptr %18) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr %20) #7
  call void @llvm.lifetime.start.p0(i64 4096, ptr %21) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #7
  call void @llvm.lifetime.start.p0(i64 88, ptr %24) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr %25) #7
  call void @llvm.lifetime.start.p0(i64 56, ptr %26) #7
  call void @llvm.memset.p0.i64(ptr align 8 %24, i8 0, i64 88, i1 false)
  call void @llvm.memset.p0.i64(ptr align 8 %25, i8 0, i64 16, i1 false)
  call void @llvm.memset.p0.i64(ptr align 8 %26, i8 0, i64 56, i1 false)
  %33 = load i32, ptr %4, align 4, !tbaa !5
  %34 = add nsw i32 %33, -1
  store i32 %34, ptr %4, align 4, !tbaa !5
  %35 = load ptr, ptr %5, align 8, !tbaa !9
  %36 = getelementptr inbounds ptr, ptr %35, i32 1
  store ptr %36, ptr %5, align 8, !tbaa !9
  %37 = load i32, ptr %4, align 4, !tbaa !5
  %38 = icmp slt i32 %37, 1
  br i1 %38, label %39, label %44

39:                                               ; preds = %2
  %40 = load ptr, ptr @stderr, align 8, !tbaa !9
  %41 = load ptr, ptr %7, align 8, !tbaa !9
  %42 = load ptr, ptr @usage, align 8, !tbaa !9
  %43 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %40, ptr noundef @.str, ptr noundef %41, ptr noundef %42) #7
  store i32 1, ptr %3, align 4
  store i32 1, ptr %27, align 4
  br label %403

44:                                               ; preds = %2
  br label %45

45:                                               ; preds = %208, %44
  %46 = load i32, ptr %4, align 4, !tbaa !5
  %47 = icmp sgt i32 %46, 0
  br i1 %47, label %48, label %213

48:                                               ; preds = %45
  %49 = load ptr, ptr %5, align 8, !tbaa !9
  %50 = load ptr, ptr %49, align 8, !tbaa !9
  %51 = call i32 @strcmp(ptr noundef %50, ptr noundef @.str.1) #8
  %52 = icmp ne i32 %51, 0
  br i1 %52, label %59, label %53

53:                                               ; preds = %48
  %54 = load ptr, ptr %7, align 8, !tbaa !9
  %55 = load ptr, ptr @usage, align 8, !tbaa !9
  %56 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef %54, ptr noundef %55)
  %57 = load ptr, ptr @options, align 8, !tbaa !9
  %58 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, ptr noundef %57)
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %380

59:                                               ; preds = %48
  %60 = load ptr, ptr %5, align 8, !tbaa !9
  %61 = load ptr, ptr %60, align 8, !tbaa !9
  %62 = call i32 @strcmp(ptr noundef %61, ptr noundef @.str.3) #8
  %63 = icmp ne i32 %62, 0
  br i1 %63, label %73, label %64

64:                                               ; preds = %59
  %65 = load i32, ptr %4, align 4, !tbaa !5
  %66 = add nsw i32 %65, -1
  store i32 %66, ptr %4, align 4, !tbaa !5
  %67 = icmp slt i32 %66, 1
  br i1 %67, label %68, label %69

68:                                               ; preds = %64
  br label %197

69:                                               ; preds = %64
  %70 = load ptr, ptr %5, align 8, !tbaa !9
  %71 = getelementptr inbounds ptr, ptr %70, i32 1
  store ptr %71, ptr %5, align 8, !tbaa !9
  %72 = load ptr, ptr %71, align 8, !tbaa !9
  store ptr %72, ptr %8, align 8, !tbaa !9
  br label %207

73:                                               ; preds = %59
  %74 = load ptr, ptr %5, align 8, !tbaa !9
  %75 = load ptr, ptr %74, align 8, !tbaa !9
  %76 = call i32 @strcmp(ptr noundef %75, ptr noundef @.str.4) #8
  %77 = icmp ne i32 %76, 0
  br i1 %77, label %106, label %78

78:                                               ; preds = %73
  %79 = load ptr, ptr %10, align 8, !tbaa !9
  %80 = icmp ne ptr %79, null
  br i1 %80, label %81, label %85

81:                                               ; preds = %78
  %82 = load ptr, ptr @stderr, align 8, !tbaa !9
  %83 = load ptr, ptr %7, align 8, !tbaa !9
  %84 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %82, ptr noundef @.str.5, ptr noundef %83) #7
  br label %380

85:                                               ; preds = %78
  %86 = load i32, ptr %4, align 4, !tbaa !5
  %87 = add nsw i32 %86, -1
  store i32 %87, ptr %4, align 4, !tbaa !5
  %88 = icmp slt i32 %87, 1
  br i1 %88, label %89, label %90

89:                                               ; preds = %85
  br label %197

90:                                               ; preds = %85
  %91 = load ptr, ptr %5, align 8, !tbaa !9
  %92 = getelementptr inbounds ptr, ptr %91, i32 1
  store ptr %92, ptr %5, align 8, !tbaa !9
  %93 = load ptr, ptr %92, align 8, !tbaa !9
  store ptr %93, ptr %9, align 8, !tbaa !9
  %94 = load ptr, ptr %9, align 8, !tbaa !9
  %95 = call noalias ptr @fopen(ptr noundef %94, ptr noundef @.str.6)
  store ptr %95, ptr %13, align 8, !tbaa !9
  %96 = icmp ne ptr %95, null
  br i1 %96, label %105, label %97

97:                                               ; preds = %90
  %98 = load ptr, ptr @stderr, align 8, !tbaa !9
  %99 = load ptr, ptr %7, align 8, !tbaa !9
  %100 = load ptr, ptr %9, align 8, !tbaa !9
  %101 = call ptr @__errno_location() #9
  %102 = load i32, ptr %101, align 4, !tbaa !5
  %103 = call ptr @strerror(i32 noundef %102) #7
  %104 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %98, ptr noundef @.str.7, ptr noundef %99, ptr noundef %100, ptr noundef %103) #7
  br label %380

105:                                              ; preds = %90
  br label %206

106:                                              ; preds = %73
  %107 = load ptr, ptr %5, align 8, !tbaa !9
  %108 = load ptr, ptr %107, align 8, !tbaa !9
  %109 = call i32 @strcmp(ptr noundef %108, ptr noundef @.str.8) #8
  %110 = icmp ne i32 %109, 0
  br i1 %110, label %139, label %111

111:                                              ; preds = %106
  %112 = load ptr, ptr %9, align 8, !tbaa !9
  %113 = icmp ne ptr %112, null
  br i1 %113, label %114, label %118

114:                                              ; preds = %111
  %115 = load ptr, ptr @stderr, align 8, !tbaa !9
  %116 = load ptr, ptr %7, align 8, !tbaa !9
  %117 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %115, ptr noundef @.str.5, ptr noundef %116) #7
  br label %380

118:                                              ; preds = %111
  %119 = load i32, ptr %4, align 4, !tbaa !5
  %120 = add nsw i32 %119, -1
  store i32 %120, ptr %4, align 4, !tbaa !5
  %121 = icmp slt i32 %120, 1
  br i1 %121, label %122, label %123

122:                                              ; preds = %118
  br label %197

123:                                              ; preds = %118
  %124 = load ptr, ptr %5, align 8, !tbaa !9
  %125 = getelementptr inbounds ptr, ptr %124, i32 1
  store ptr %125, ptr %5, align 8, !tbaa !9
  %126 = load ptr, ptr %125, align 8, !tbaa !9
  store ptr %126, ptr %10, align 8, !tbaa !9
  %127 = load ptr, ptr %10, align 8, !tbaa !9
  %128 = call noalias ptr @fopen(ptr noundef %127, ptr noundef @.str.6)
  store ptr %128, ptr %14, align 8, !tbaa !9
  %129 = icmp ne ptr %128, null
  br i1 %129, label %138, label %130

130:                                              ; preds = %123
  %131 = load ptr, ptr @stderr, align 8, !tbaa !9
  %132 = load ptr, ptr %7, align 8, !tbaa !9
  %133 = load ptr, ptr %10, align 8, !tbaa !9
  %134 = call ptr @__errno_location() #9
  %135 = load i32, ptr %134, align 4, !tbaa !5
  %136 = call ptr @strerror(i32 noundef %135) #7
  %137 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %131, ptr noundef @.str.7, ptr noundef %132, ptr noundef %133, ptr noundef %136) #7
  br label %380

138:                                              ; preds = %123
  br label %205

139:                                              ; preds = %106
  %140 = load ptr, ptr %5, align 8, !tbaa !9
  %141 = load ptr, ptr %140, align 8, !tbaa !9
  %142 = call i32 @strcmp(ptr noundef %141, ptr noundef @.str.9) #8
  %143 = icmp ne i32 %142, 0
  br i1 %143, label %165, label %144

144:                                              ; preds = %139
  %145 = load i32, ptr %4, align 4, !tbaa !5
  %146 = add nsw i32 %145, -1
  store i32 %146, ptr %4, align 4, !tbaa !5
  %147 = icmp slt i32 %146, 1
  br i1 %147, label %148, label %149

148:                                              ; preds = %144
  br label %197

149:                                              ; preds = %144
  %150 = load ptr, ptr %5, align 8, !tbaa !9
  %151 = getelementptr inbounds ptr, ptr %150, i32 1
  store ptr %151, ptr %5, align 8, !tbaa !9
  %152 = load ptr, ptr %151, align 8, !tbaa !9
  store ptr %152, ptr %11, align 8, !tbaa !9
  %153 = load ptr, ptr %11, align 8, !tbaa !9
  %154 = call noalias ptr @fopen(ptr noundef %153, ptr noundef @.str.6)
  store ptr %154, ptr %15, align 8, !tbaa !9
  %155 = icmp ne ptr %154, null
  br i1 %155, label %164, label %156

156:                                              ; preds = %149
  %157 = load ptr, ptr @stderr, align 8, !tbaa !9
  %158 = load ptr, ptr %7, align 8, !tbaa !9
  %159 = load ptr, ptr %11, align 8, !tbaa !9
  %160 = call ptr @__errno_location() #9
  %161 = load i32, ptr %160, align 4, !tbaa !5
  %162 = call ptr @strerror(i32 noundef %161) #7
  %163 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %157, ptr noundef @.str.7, ptr noundef %158, ptr noundef %159, ptr noundef %162) #7
  br label %380

164:                                              ; preds = %149
  br label %204

165:                                              ; preds = %139
  %166 = load ptr, ptr %5, align 8, !tbaa !9
  %167 = load ptr, ptr %166, align 8, !tbaa !9
  %168 = call i32 @strcmp(ptr noundef %167, ptr noundef @.str.10) #8
  %169 = icmp ne i32 %168, 0
  br i1 %169, label %191, label %170

170:                                              ; preds = %165
  %171 = load i32, ptr %4, align 4, !tbaa !5
  %172 = add nsw i32 %171, -1
  store i32 %172, ptr %4, align 4, !tbaa !5
  %173 = icmp slt i32 %172, 1
  br i1 %173, label %174, label %175

174:                                              ; preds = %170
  br label %197

175:                                              ; preds = %170
  %176 = load ptr, ptr %5, align 8, !tbaa !9
  %177 = getelementptr inbounds ptr, ptr %176, i32 1
  store ptr %177, ptr %5, align 8, !tbaa !9
  %178 = load ptr, ptr %177, align 8, !tbaa !9
  store ptr %178, ptr %12, align 8, !tbaa !9
  %179 = load ptr, ptr %12, align 8, !tbaa !9
  %180 = call noalias ptr @fopen(ptr noundef %179, ptr noundef @.str.11)
  store ptr %180, ptr %16, align 8, !tbaa !9
  %181 = icmp ne ptr %180, null
  br i1 %181, label %190, label %182

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

190:                                              ; preds = %175
  br label %203

191:                                              ; preds = %165
  %192 = load ptr, ptr @stderr, align 8, !tbaa !9
  %193 = load ptr, ptr %7, align 8, !tbaa !9
  %194 = load ptr, ptr %5, align 8, !tbaa !9
  %195 = load ptr, ptr %194, align 8, !tbaa !9
  %196 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %192, ptr noundef @.str.12, ptr noundef %193, ptr noundef %195) #7
  br label %380

197:                                              ; preds = %174, %148, %122, %89, %68
  %198 = load ptr, ptr @stderr, align 8, !tbaa !9
  %199 = load ptr, ptr %7, align 8, !tbaa !9
  %200 = load ptr, ptr %5, align 8, !tbaa !9
  %201 = load ptr, ptr %200, align 8, !tbaa !9
  %202 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %198, ptr noundef @.str.13, ptr noundef %199, ptr noundef %201) #7
  br label %380

203:                                              ; preds = %190
  br label %204

204:                                              ; preds = %203, %164
  br label %205

205:                                              ; preds = %204, %138
  br label %206

206:                                              ; preds = %205, %105
  br label %207

207:                                              ; preds = %206, %69
  br label %208

208:                                              ; preds = %207
  %209 = load i32, ptr %4, align 4, !tbaa !5
  %210 = add nsw i32 %209, -1
  store i32 %210, ptr %4, align 4, !tbaa !5
  %211 = load ptr, ptr %5, align 8, !tbaa !9
  %212 = getelementptr inbounds ptr, ptr %211, i32 1
  store ptr %212, ptr %5, align 8, !tbaa !9
  br label %45, !llvm.loop !11

213:                                              ; preds = %45
  %214 = load ptr, ptr %8, align 8, !tbaa !9
  %215 = icmp ne ptr %214, null
  br i1 %215, label %220, label %216

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

220:                                              ; preds = %213
  %221 = load ptr, ptr %8, align 8, !tbaa !9
  %222 = call i32 @sdf_load_library(ptr noundef %221, ptr noundef null)
  %223 = icmp ne i32 %222, 1
  br i1 %223, label %224, label %228

224:                                              ; preds = %220
  %225 = load ptr, ptr @stderr, align 8, !tbaa !9
  %226 = load ptr, ptr %7, align 8, !tbaa !9
  %227 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %225, ptr noundef @.str.15, ptr noundef %226) #7
  br label %380

228:                                              ; preds = %220
  %229 = call i32 @sdf_open_device(ptr noundef %24)
  %230 = icmp ne i32 %229, 1
  br i1 %230, label %231, label %235

231:                                              ; preds = %228
  %232 = load ptr, ptr @stderr, align 8, !tbaa !9
  %233 = load ptr, ptr %7, align 8, !tbaa !9
  %234 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %232, ptr noundef @.str.16, ptr noundef %233) #7
  br label %380

235:                                              ; preds = %228
  %236 = load ptr, ptr %9, align 8, !tbaa !9
  %237 = icmp ne ptr %236, null
  br i1 %237, label %238, label %247

238:                                              ; preds = %235
  %239 = load ptr, ptr %13, align 8, !tbaa !9
  %240 = call i32 @sm2_public_key_info_from_pem(ptr noundef %17, ptr noundef %239)
  %241 = icmp ne i32 %240, 1
  br i1 %241, label %242, label %246

242:                                              ; preds = %238
  %243 = load ptr, ptr @stderr, align 8, !tbaa !9
  %244 = load ptr, ptr %7, align 8, !tbaa !9
  %245 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %243, ptr noundef @.str.17, ptr noundef %244) #7
  br label %380

246:                                              ; preds = %238
  br label %274

247:                                              ; preds = %235
  %248 = load ptr, ptr %10, align 8, !tbaa !9
  %249 = icmp ne ptr %248, null
  br i1 %249, label %250, label %269

250:                                              ; preds = %247
  %251 = getelementptr inbounds [1024 x i8], ptr %18, i64 0, i64 0
  %252 = load ptr, ptr %14, align 8, !tbaa !9
  %253 = call i32 @x509_cert_from_pem(ptr noundef %251, ptr noundef %19, i64 noundef 1024, ptr noundef %252)
  %254 = icmp ne i32 %253, 1
  br i1 %254, label %255, label %259

255:                                              ; preds = %250
  %256 = load ptr, ptr @stderr, align 8, !tbaa !9
  %257 = load ptr, ptr %7, align 8, !tbaa !9
  %258 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %256, ptr noundef @.str.18, ptr noundef %257) #7
  br label %380

259:                                              ; preds = %250
  %260 = getelementptr inbounds [1024 x i8], ptr %18, i64 0, i64 0
  %261 = load i64, ptr %19, align 8, !tbaa !13
  %262 = call i32 @x509_cert_get_subject_public_key(ptr noundef %260, i64 noundef %261, ptr noundef %17)
  %263 = icmp ne i32 %262, 1
  br i1 %263, label %264, label %268

264:                                              ; preds = %259
  %265 = load ptr, ptr @stderr, align 8, !tbaa !9
  %266 = load ptr, ptr %7, align 8, !tbaa !9
  %267 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %265, ptr noundef @.str.19, ptr noundef %266) #7
  br label %380

268:                                              ; preds = %259
  br label %273

269:                                              ; preds = %247
  %270 = load ptr, ptr @stderr, align 8, !tbaa !9
  %271 = load ptr, ptr %7, align 8, !tbaa !9
  %272 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %270, ptr noundef @.str.20, ptr noundef %271) #7
  br label %380

273:                                              ; preds = %268
  br label %274

274:                                              ; preds = %273, %246
  %275 = getelementptr inbounds [4096 x i8], ptr %21, i64 0, i64 0
  %276 = call i32 @sdf_generate_key(ptr noundef %24, ptr noundef %25, ptr noundef %17, ptr noundef %275, ptr noundef %23)
  %277 = icmp ne i32 %276, 1
  br i1 %277, label %278, label %284

278:                                              ; preds = %274
  br label %279

279:                                              ; preds = %278
  %280 = load ptr, ptr @stderr, align 8, !tbaa !9
  %281 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %280, ptr noundef @.str.21, ptr noundef @.str.22, i32 noundef 173, ptr noundef @__FUNCTION__.sdfencrypt_main) #7
  br label %282

282:                                              ; preds = %279
  br label %283

283:                                              ; preds = %282
  br label %380

284:                                              ; preds = %274
  %285 = getelementptr inbounds [4096 x i8], ptr %21, i64 0, i64 0
  %286 = load i64, ptr %23, align 8, !tbaa !13
  %287 = load ptr, ptr %16, align 8, !tbaa !9
  %288 = call i64 @fwrite(ptr noundef %285, i64 noundef 1, i64 noundef %286, ptr noundef %287)
  %289 = load i64, ptr %23, align 8, !tbaa !13
  %290 = icmp ne i64 %288, %289
  br i1 %290, label %291, label %298

291:                                              ; preds = %284
  %292 = load ptr, ptr @stderr, align 8, !tbaa !9
  %293 = load ptr, ptr %7, align 8, !tbaa !9
  %294 = call ptr @__errno_location() #9
  %295 = load i32, ptr %294, align 4, !tbaa !5
  %296 = call ptr @strerror(i32 noundef %295) #7
  %297 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %292, ptr noundef @.str.23, ptr noundef %293, ptr noundef %296) #7
  br label %380

298:                                              ; preds = %284
  %299 = getelementptr inbounds [16 x i8], ptr %20, i64 0, i64 0
  %300 = call i32 @rand_bytes(ptr noundef %299, i64 noundef 16)
  %301 = getelementptr inbounds [16 x i8], ptr %20, i64 0, i64 0
  %302 = load ptr, ptr %16, align 8, !tbaa !9
  %303 = call i64 @fwrite(ptr noundef %301, i64 noundef 1, i64 noundef 16, ptr noundef %302)
  %304 = icmp ne i64 %303, 16
  br i1 %304, label %305, label %312

305:                                              ; preds = %298
  %306 = load ptr, ptr @stderr, align 8, !tbaa !9
  %307 = load ptr, ptr %7, align 8, !tbaa !9
  %308 = call ptr @__errno_location() #9
  %309 = load i32, ptr %308, align 4, !tbaa !5
  %310 = call ptr @strerror(i32 noundef %309) #7
  %311 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %306, ptr noundef @.str.23, ptr noundef %307, ptr noundef %310) #7
  br label %380

312:                                              ; preds = %298
  %313 = getelementptr inbounds [16 x i8], ptr %20, i64 0, i64 0
  %314 = call i32 @sdf_cbc_encrypt_init(ptr noundef %26, ptr noundef %25, ptr noundef %313)
  %315 = icmp ne i32 %314, 1
  br i1 %315, label %316, label %322

316:                                              ; preds = %312
  br label %317

317:                                              ; preds = %316
  %318 = load ptr, ptr @stderr, align 8, !tbaa !9
  %319 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %318, ptr noundef @.str.21, ptr noundef @.str.22, i32 noundef 190, ptr noundef @__FUNCTION__.sdfencrypt_main) #7
  br label %320

320:                                              ; preds = %317
  br label %321

321:                                              ; preds = %320
  br label %380

322:                                              ; preds = %312
  br label %323

323:                                              ; preds = %354, %322
  %324 = getelementptr inbounds [4096 x i8], ptr %21, i64 0, i64 0
  %325 = load ptr, ptr %15, align 8, !tbaa !9
  %326 = call i64 @fread(ptr noundef %324, i64 noundef 1, i64 noundef 4096, ptr noundef %325)
  store i64 %326, ptr %22, align 8, !tbaa !13
  %327 = icmp ugt i64 %326, 0
  br i1 %327, label %328, label %355

328:                                              ; preds = %323
  %329 = getelementptr inbounds [4096 x i8], ptr %21, i64 0, i64 0
  %330 = load i64, ptr %22, align 8, !tbaa !13
  %331 = getelementptr inbounds [4096 x i8], ptr %21, i64 0, i64 0
  %332 = call i32 @sdf_cbc_encrypt_update(ptr noundef %26, ptr noundef %329, i64 noundef %330, ptr noundef %331, ptr noundef %23)
  %333 = icmp ne i32 %332, 1
  br i1 %333, label %334, label %340

334:                                              ; preds = %328
  br label %335

335:                                              ; preds = %334
  %336 = load ptr, ptr @stderr, align 8, !tbaa !9
  %337 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %336, ptr noundef @.str.21, ptr noundef @.str.22, i32 noundef 195, ptr noundef @__FUNCTION__.sdfencrypt_main) #7
  br label %338

338:                                              ; preds = %335
  br label %339

339:                                              ; preds = %338
  br label %380

340:                                              ; preds = %328
  %341 = getelementptr inbounds [4096 x i8], ptr %21, i64 0, i64 0
  %342 = load i64, ptr %23, align 8, !tbaa !13
  %343 = load ptr, ptr %16, align 8, !tbaa !9
  %344 = call i64 @fwrite(ptr noundef %341, i64 noundef 1, i64 noundef %342, ptr noundef %343)
  %345 = load i64, ptr %23, align 8, !tbaa !13
  %346 = icmp ne i64 %344, %345
  br i1 %346, label %347, label %354

347:                                              ; preds = %340
  %348 = load ptr, ptr @stderr, align 8, !tbaa !9
  %349 = load ptr, ptr %7, align 8, !tbaa !9
  %350 = call ptr @__errno_location() #9
  %351 = load i32, ptr %350, align 4, !tbaa !5
  %352 = call ptr @strerror(i32 noundef %351) #7
  %353 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %348, ptr noundef @.str.23, ptr noundef %349, ptr noundef %352) #7
  br label %380

354:                                              ; preds = %340
  br label %323, !llvm.loop !15

355:                                              ; preds = %323
  %356 = getelementptr inbounds [4096 x i8], ptr %21, i64 0, i64 0
  %357 = call i32 @sdf_cbc_encrypt_finish(ptr noundef %26, ptr noundef %356, ptr noundef %23)
  %358 = icmp ne i32 %357, 1
  br i1 %358, label %359, label %365

359:                                              ; preds = %355
  br label %360

360:                                              ; preds = %359
  %361 = load ptr, ptr @stderr, align 8, !tbaa !9
  %362 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %361, ptr noundef @.str.21, ptr noundef @.str.22, i32 noundef 204, ptr noundef @__FUNCTION__.sdfencrypt_main) #7
  br label %363

363:                                              ; preds = %360
  br label %364

364:                                              ; preds = %363
  br label %380

365:                                              ; preds = %355
  %366 = getelementptr inbounds [4096 x i8], ptr %21, i64 0, i64 0
  %367 = load i64, ptr %23, align 8, !tbaa !13
  %368 = load ptr, ptr %16, align 8, !tbaa !9
  %369 = call i64 @fwrite(ptr noundef %366, i64 noundef 1, i64 noundef %367, ptr noundef %368)
  %370 = load i64, ptr %23, align 8, !tbaa !13
  %371 = icmp ne i64 %369, %370
  br i1 %371, label %372, label %379

372:                                              ; preds = %365
  %373 = load ptr, ptr @stderr, align 8, !tbaa !9
  %374 = load ptr, ptr %7, align 8, !tbaa !9
  %375 = call ptr @__errno_location() #9
  %376 = load i32, ptr %375, align 4, !tbaa !5
  %377 = call ptr @strerror(i32 noundef %376) #7
  %378 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %373, ptr noundef @.str.23, ptr noundef %374, ptr noundef %377) #7
  br label %380

379:                                              ; preds = %365
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %380

380:                                              ; preds = %379, %372, %364, %347, %339, %321, %305, %291, %283, %269, %264, %255, %242, %231, %224, %216, %197, %191, %182, %156, %130, %114, %97, %81, %53
  %381 = call i32 @sdf_destroy_key(ptr noundef %25)
  %382 = call i32 @sdf_close_device(ptr noundef %24)
  call void @sdf_unload_library()
  %383 = getelementptr inbounds [16 x i8], ptr %20, i64 0, i64 0
  call void @gmssl_secure_clear(ptr noundef %383, i64 noundef 16)
  call void @gmssl_secure_clear(ptr noundef %26, i64 noundef 56)
  %384 = load ptr, ptr %11, align 8, !tbaa !9
  %385 = icmp ne ptr %384, null
  br i1 %385, label %386, label %392

386:                                              ; preds = %380
  %387 = load ptr, ptr %15, align 8, !tbaa !9
  %388 = icmp ne ptr %387, null
  br i1 %388, label %389, label %392

389:                                              ; preds = %386
  %390 = load ptr, ptr %15, align 8, !tbaa !9
  %391 = call i32 @fclose(ptr noundef %390)
  br label %392

392:                                              ; preds = %389, %386, %380
  %393 = load ptr, ptr %12, align 8, !tbaa !9
  %394 = icmp ne ptr %393, null
  br i1 %394, label %395, label %401

395:                                              ; preds = %392
  %396 = load ptr, ptr %16, align 8, !tbaa !9
  %397 = icmp ne ptr %396, null
  br i1 %397, label %398, label %401

398:                                              ; preds = %395
  %399 = load ptr, ptr %16, align 8, !tbaa !9
  %400 = call i32 @fclose(ptr noundef %399)
  br label %401

401:                                              ; preds = %398, %395, %392
  %402 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %402, ptr %3, align 4
  store i32 1, ptr %27, align 4
  br label %403

403:                                              ; preds = %401, %39
  call void @llvm.lifetime.end.p0(i64 56, ptr %26) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %25) #7
  call void @llvm.lifetime.end.p0(i64 88, ptr %24) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #7
  call void @llvm.lifetime.end.p0(i64 4096, ptr %21) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %20) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 1024, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 128, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 8, 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 8, 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
  %404 = load i32, ptr %3, align 4
  ret i32 %404
}

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

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

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

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

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

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

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

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

declare i32 @sdf_load_library(ptr noundef, ptr noundef) #5

declare i32 @sdf_open_device(ptr noundef) #5

declare i32 @sm2_public_key_info_from_pem(ptr noundef, ptr noundef) #5

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

declare i32 @x509_cert_get_subject_public_key(ptr noundef, i64 noundef, ptr noundef) #5

declare i32 @sdf_generate_key(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #5

declare i64 @fwrite(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #5

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

declare i32 @sdf_cbc_encrypt_init(ptr noundef, ptr noundef, ptr noundef) #5

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

declare i32 @sdf_cbc_encrypt_update(ptr noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef) #5

declare i32 @sdf_cbc_encrypt_finish(ptr noundef, ptr noundef, ptr noundef) #5

declare i32 @sdf_destroy_key(ptr noundef) #5

declare i32 @sdf_close_device(ptr noundef) #5

declare void @sdf_unload_library() #5

declare void @gmssl_secure_clear(ptr noundef, i64 noundef) #5

declare i32 @fclose(ptr noundef) #5

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

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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { 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 #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 = { "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 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 #7 = { nounwind }
attributes #8 = { nounwind willreturn memory(read) }
attributes #9 = { nounwind willreturn memory(none) }

!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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !14, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = distinct !{!15, !12}


; 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.SM2_KEY = type { %struct.SM2_Z256_POINT, [4 x i64] }
%struct.SM2_Z256_POINT = type { [4 x i64], [4 x i64], [4 x i64] }
%struct.SDF_DEVICE = type { ptr, [41 x i8], [17 x i8], [17 x i8] }
%struct.SDF_KEY = type { ptr, ptr }
%struct.SDF_CBC_CTX = type { %struct.SDF_KEY, [16 x i8], [16 x i8], i64 }

@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 [20 x i8], align 1
@usage = external hidden local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@options = external hidden local_unnamed_addr global ptr, align 8
@.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 [46 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [66 x i8], align 1
@__FUNCTION__.sdfencrypt_main = external hidden unnamed_addr constant [16 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [31 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @sdfencrypt_main(i32 noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = alloca %struct.SM2_KEY, align 8
  %4 = alloca [1024 x i8], align 16
  %5 = alloca i64, align 8
  %6 = alloca [16 x i8], align 16
  %7 = alloca [4096 x i8], align 16
  %8 = alloca i64, align 8
  %9 = alloca %struct.SDF_DEVICE, align 8
  %10 = alloca %struct.SDF_KEY, align 8
  %11 = alloca %struct.SDF_CBC_CTX, align 8
  %12 = load ptr, ptr %1, align 8, !tbaa !5
  %13 = load ptr, ptr @stdin, align 8, !tbaa !5
  %14 = load ptr, ptr @stdout, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %3) #8
  call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %4) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #8
  call void @llvm.lifetime.start.p0(i64 4096, ptr nonnull %7) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #8
  call void @llvm.lifetime.start.p0(i64 88, ptr nonnull %9) #8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %10) #8
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %11) #8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(88) %9, i8 0, i64 88, i1 false)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %10, i8 0, i64 16, i1 false)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(56) %11, i8 0, i64 56, i1 false)
  %15 = icmp slt i32 %0, 2
  br i1 %15, label %17, label %.preheader144.preheader

.preheader144.preheader:                          ; preds = %2
  %16 = getelementptr inbounds i8, ptr %1, i64 8
  br label %.preheader144

17:                                               ; preds = %2
  %18 = load ptr, ptr @stderr, align 8, !tbaa !5
  %19 = load ptr, ptr @usage, align 8, !tbaa !5
  %20 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %18, ptr noundef nonnull @.str, ptr noundef %12, ptr noundef %19) #9
  br label %215

.preheader144:                                    ; preds = %.preheader144.preheader, %105
  %.078248 = phi ptr [ %.1, %105 ], [ %14, %.preheader144.preheader ]
  %.079247 = phi ptr [ %.180, %105 ], [ %13, %.preheader144.preheader ]
  %.082246 = phi ptr [ %.183, %105 ], [ null, %.preheader144.preheader ]
  %.084245 = phi ptr [ %.185, %105 ], [ null, %.preheader144.preheader ]
  %.086244 = phi ptr [ %.187, %105 ], [ null, %.preheader144.preheader ]
  %.089243 = phi ptr [ %.190, %105 ], [ null, %.preheader144.preheader ]
  %.092242 = phi ptr [ %.193, %105 ], [ null, %.preheader144.preheader ]
  %.094241 = phi ptr [ %.195, %105 ], [ null, %.preheader144.preheader ]
  %.096240 = phi ptr [ %.197, %105 ], [ null, %.preheader144.preheader ]
  %.098.in239 = phi i32 [ %.199, %105 ], [ %0, %.preheader144.preheader ]
  %.0101238 = phi ptr [ %106, %105 ], [ %16, %.preheader144.preheader ]
  %21 = load ptr, ptr %.0101238, align 8, !tbaa !5
  %22 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %21, ptr noundef nonnull dereferenceable(1) @.str.1) #10
  %.not132 = icmp eq i32 %22, 0
  br i1 %.not132, label %23, label %28

23:                                               ; preds = %.preheader144
  %24 = load ptr, ptr @usage, align 8, !tbaa !5
  %25 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef %12, ptr noundef %24)
  %26 = load ptr, ptr @options, align 8, !tbaa !5
  %27 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef %26)
  br label %203

28:                                               ; preds = %.preheader144
  %29 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %21, ptr noundef nonnull dereferenceable(1) @.str.3) #10
  %.not133 = icmp eq i32 %29, 0
  br i1 %.not133, label %30, label %35

30:                                               ; preds = %28
  %31 = icmp eq i32 %.098.in239, 2
  br i1 %31, label %102, label %32

32:                                               ; preds = %30
  %33 = getelementptr inbounds i8, ptr %.0101238, i64 8
  %34 = load ptr, ptr %33, align 8, !tbaa !5
  br label %105

35:                                               ; preds = %28
  %36 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %21, ptr noundef nonnull dereferenceable(1) @.str.4) #10
  %.not134 = icmp eq i32 %36, 0
  br i1 %.not134, label %37, label %53

37:                                               ; preds = %35
  %.not135 = icmp eq ptr %.092242, null
  br i1 %.not135, label %41, label %38

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

41:                                               ; preds = %37
  %42 = icmp eq i32 %.098.in239, 2
  br i1 %42, label %102, label %43

43:                                               ; preds = %41
  %44 = getelementptr inbounds i8, ptr %.0101238, i64 8
  %45 = load ptr, ptr %44, align 8, !tbaa !5
  %46 = tail call noalias ptr @fopen(ptr noundef %45, ptr noundef nonnull @.str.6)
  %.not136 = icmp eq ptr %46, null
  br i1 %.not136, label %47, label %105

47:                                               ; preds = %43
  %48 = load ptr, ptr @stderr, align 8, !tbaa !5
  %49 = tail call ptr @__errno_location() #11
  %50 = load i32, ptr %49, align 4, !tbaa !9
  %51 = tail call ptr @strerror(i32 noundef %50) #8
  %52 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %48, ptr noundef nonnull @.str.7, ptr noundef %12, ptr noundef %45, ptr noundef %51) #9
  br label %203

53:                                               ; preds = %35
  %54 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %21, ptr noundef nonnull dereferenceable(1) @.str.8) #10
  %.not137 = icmp eq i32 %54, 0
  br i1 %.not137, label %55, label %71

55:                                               ; preds = %53
  %.not138 = icmp eq ptr %.094241, null
  br i1 %.not138, label %59, label %56

56:                                               ; preds = %55
  %57 = load ptr, ptr @stderr, align 8, !tbaa !5
  %58 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %57, ptr noundef nonnull @.str.5, ptr noundef %12) #9
  br label %203

59:                                               ; preds = %55
  %60 = icmp eq i32 %.098.in239, 2
  br i1 %60, label %102, label %61

61:                                               ; preds = %59
  %62 = getelementptr inbounds i8, ptr %.0101238, i64 8
  %63 = load ptr, ptr %62, align 8, !tbaa !5
  %64 = tail call noalias ptr @fopen(ptr noundef %63, ptr noundef nonnull @.str.6)
  %.not139 = icmp eq ptr %64, null
  br i1 %.not139, label %65, label %105

65:                                               ; preds = %61
  %66 = load ptr, ptr @stderr, align 8, !tbaa !5
  %67 = tail call ptr @__errno_location() #11
  %68 = load i32, ptr %67, align 4, !tbaa !9
  %69 = tail call ptr @strerror(i32 noundef %68) #8
  %70 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %66, ptr noundef nonnull @.str.7, ptr noundef %12, ptr noundef %63, ptr noundef %69) #9
  br label %203

71:                                               ; preds = %53
  %72 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %21, ptr noundef nonnull dereferenceable(1) @.str.9) #10
  %.not140 = icmp eq i32 %72, 0
  br i1 %.not140, label %73, label %85

73:                                               ; preds = %71
  %74 = icmp eq i32 %.098.in239, 2
  br i1 %74, label %102, label %75

75:                                               ; preds = %73
  %76 = getelementptr inbounds i8, ptr %.0101238, i64 8
  %77 = load ptr, ptr %76, align 8, !tbaa !5
  %78 = tail call noalias ptr @fopen(ptr noundef %77, ptr noundef nonnull @.str.6)
  %.not141 = icmp eq ptr %78, null
  br i1 %.not141, label %79, label %105

79:                                               ; preds = %75
  %80 = load ptr, ptr @stderr, align 8, !tbaa !5
  %81 = tail call ptr @__errno_location() #11
  %82 = load i32, ptr %81, align 4, !tbaa !9
  %83 = tail call ptr @strerror(i32 noundef %82) #8
  %84 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %80, ptr noundef nonnull @.str.7, ptr noundef %12, ptr noundef %77, ptr noundef %83) #9
  br label %203

85:                                               ; preds = %71
  %86 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %21, ptr noundef nonnull dereferenceable(1) @.str.10) #10
  %.not142 = icmp eq i32 %86, 0
  br i1 %.not142, label %87, label %99

87:                                               ; preds = %85
  %88 = icmp eq i32 %.098.in239, 2
  br i1 %88, label %102, label %89

89:                                               ; preds = %87
  %90 = getelementptr inbounds i8, ptr %.0101238, i64 8
  %91 = load ptr, ptr %90, align 8, !tbaa !5
  %92 = tail call noalias ptr @fopen(ptr noundef %91, ptr noundef nonnull @.str.11)
  %.not143 = icmp eq ptr %92, null
  br i1 %.not143, label %93, label %105

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

99:                                               ; preds = %85
  %100 = load ptr, ptr @stderr, align 8, !tbaa !5
  %101 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %100, ptr noundef nonnull @.str.12, ptr noundef %12, ptr noundef %21) #9
  br label %203

102:                                              ; preds = %87, %73, %59, %41, %30
  %103 = load ptr, ptr @stderr, align 8, !tbaa !5
  %104 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %103, ptr noundef nonnull @.str.13, ptr noundef %12, ptr noundef %21) #9
  br label %203

105:                                              ; preds = %32, %61, %89, %75, %43
  %.197 = phi ptr [ %.096240, %89 ], [ %.096240, %75 ], [ %.096240, %61 ], [ %.096240, %43 ], [ %34, %32 ]
  %.195 = phi ptr [ %.094241, %89 ], [ %.094241, %75 ], [ null, %61 ], [ %45, %43 ], [ %.094241, %32 ]
  %.193 = phi ptr [ %.092242, %89 ], [ %.092242, %75 ], [ %63, %61 ], [ null, %43 ], [ %.092242, %32 ]
  %.190 = phi ptr [ %.089243, %89 ], [ %77, %75 ], [ %.089243, %61 ], [ %.089243, %43 ], [ %.089243, %32 ]
  %.187 = phi ptr [ %91, %89 ], [ %.086244, %75 ], [ %.086244, %61 ], [ %.086244, %43 ], [ %.086244, %32 ]
  %.185 = phi ptr [ %.084245, %89 ], [ %.084245, %75 ], [ %.084245, %61 ], [ %46, %43 ], [ %.084245, %32 ]
  %.183 = phi ptr [ %.082246, %89 ], [ %.082246, %75 ], [ %64, %61 ], [ %.082246, %43 ], [ %.082246, %32 ]
  %.180 = phi ptr [ %.079247, %89 ], [ %78, %75 ], [ %.079247, %61 ], [ %.079247, %43 ], [ %.079247, %32 ]
  %.1 = phi ptr [ %92, %89 ], [ %.078248, %75 ], [ %.078248, %61 ], [ %.078248, %43 ], [ %.078248, %32 ]
  %.199 = add nsw i32 %.098.in239, -2
  %106 = getelementptr inbounds i8, ptr %.0101238, i64 16
  %107 = icmp sgt i32 %.098.in239, 3
  br i1 %107, label %.preheader144, label %108, !llvm.loop !11

108:                                              ; preds = %105
  %.not = icmp eq ptr %.197, null
  br i1 %.not, label %109, label %112

109:                                              ; preds = %108
  %110 = load ptr, ptr @stderr, align 8, !tbaa !5
  %111 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %110, ptr noundef nonnull @.str.14, ptr noundef %12) #9
  br label %203

112:                                              ; preds = %108
  %113 = tail call i32 @sdf_load_library(ptr noundef nonnull %.197, ptr noundef null) #8
  %.not116 = icmp eq i32 %113, 1
  br i1 %.not116, label %117, label %114

114:                                              ; preds = %112
  %115 = load ptr, ptr @stderr, align 8, !tbaa !5
  %116 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %115, ptr noundef nonnull @.str.15, ptr noundef %12) #9
  br label %203

117:                                              ; preds = %112
  %118 = call i32 @sdf_open_device(ptr noundef nonnull %9) #8
  %.not117 = icmp eq i32 %118, 1
  br i1 %.not117, label %122, label %119

119:                                              ; preds = %117
  %120 = load ptr, ptr @stderr, align 8, !tbaa !5
  %121 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %120, ptr noundef nonnull @.str.16, ptr noundef %12) #9
  br label %203

122:                                              ; preds = %117
  %.not118 = icmp eq ptr %.195, null
  br i1 %.not118, label %128, label %123

123:                                              ; preds = %122
  %124 = call i32 @sm2_public_key_info_from_pem(ptr noundef nonnull %3, ptr noundef %.185) #8
  %.not122 = icmp eq i32 %124, 1
  br i1 %.not122, label %143, label %125

125:                                              ; preds = %123
  %126 = load ptr, ptr @stderr, align 8, !tbaa !5
  %127 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %126, ptr noundef nonnull @.str.17, ptr noundef %12) #9
  br label %203

128:                                              ; preds = %122
  %.not119 = icmp eq ptr %.193, null
  br i1 %.not119, label %140, label %129

129:                                              ; preds = %128
  %130 = call i32 @x509_cert_from_pem(ptr noundef nonnull %4, ptr noundef nonnull %5, i64 noundef 1024, ptr noundef %.183) #8
  %.not120 = icmp eq i32 %130, 1
  br i1 %.not120, label %134, label %131

131:                                              ; preds = %129
  %132 = load ptr, ptr @stderr, align 8, !tbaa !5
  %133 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %132, ptr noundef nonnull @.str.18, ptr noundef %12) #9
  br label %203

134:                                              ; preds = %129
  %135 = load i64, ptr %5, align 8, !tbaa !13
  %136 = call i32 @x509_cert_get_subject_public_key(ptr noundef nonnull %4, i64 noundef %135, ptr noundef nonnull %3) #8
  %.not121 = icmp eq i32 %136, 1
  br i1 %.not121, label %143, label %137

137:                                              ; preds = %134
  %138 = load ptr, ptr @stderr, align 8, !tbaa !5
  %139 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %138, ptr noundef nonnull @.str.19, ptr noundef %12) #9
  br label %203

140:                                              ; preds = %128
  %141 = load ptr, ptr @stderr, align 8, !tbaa !5
  %142 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %141, ptr noundef nonnull @.str.20, ptr noundef %12) #9
  br label %203

143:                                              ; preds = %134, %123
  %144 = call i32 @sdf_generate_key(ptr noundef nonnull %9, ptr noundef nonnull %10, ptr noundef nonnull %3, ptr noundef nonnull %7, ptr noundef nonnull %8) #8
  %.not123 = icmp eq i32 %144, 1
  br i1 %.not123, label %148, label %145

145:                                              ; preds = %143
  %146 = load ptr, ptr @stderr, align 8, !tbaa !5
  %147 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %146, ptr noundef nonnull @.str.21, ptr noundef nonnull @.str.22, i32 noundef 173, ptr noundef nonnull @__FUNCTION__.sdfencrypt_main) #9
  br label %203

148:                                              ; preds = %143
  %149 = load i64, ptr %8, align 8, !tbaa !13
  %150 = call i64 @fwrite(ptr noundef nonnull %7, i64 noundef 1, i64 noundef %149, ptr noundef %.1)
  %151 = load i64, ptr %8, align 8, !tbaa !13
  %.not124 = icmp eq i64 %150, %151
  br i1 %.not124, label %158, label %152

152:                                              ; preds = %148
  %153 = load ptr, ptr @stderr, align 8, !tbaa !5
  %154 = tail call ptr @__errno_location() #11
  %155 = load i32, ptr %154, align 4, !tbaa !9
  %156 = call ptr @strerror(i32 noundef %155) #8
  %157 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %153, ptr noundef nonnull @.str.23, ptr noundef %12, ptr noundef %156) #9
  br label %203

158:                                              ; preds = %148
  %159 = call i32 @rand_bytes(ptr noundef nonnull %6, i64 noundef 16) #8
  %160 = call i64 @fwrite(ptr noundef nonnull %6, i64 noundef 1, i64 noundef 16, ptr noundef %.1)
  %.not125 = icmp eq i64 %160, 16
  br i1 %.not125, label %167, label %161

161:                                              ; preds = %158
  %162 = load ptr, ptr @stderr, align 8, !tbaa !5
  %163 = tail call ptr @__errno_location() #11
  %164 = load i32, ptr %163, align 4, !tbaa !9
  %165 = call ptr @strerror(i32 noundef %164) #8
  %166 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %162, ptr noundef nonnull @.str.23, ptr noundef %12, ptr noundef %165) #9
  br label %203

167:                                              ; preds = %158
  %168 = call i32 @sdf_cbc_encrypt_init(ptr noundef nonnull %11, ptr noundef nonnull %10, ptr noundef nonnull %6) #8
  %.not126 = icmp eq i32 %168, 1
  br i1 %.not126, label %.preheader, label %169

169:                                              ; preds = %167
  %170 = load ptr, ptr @stderr, align 8, !tbaa !5
  %171 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %170, ptr noundef nonnull @.str.21, ptr noundef nonnull @.str.22, i32 noundef 190, ptr noundef nonnull @__FUNCTION__.sdfencrypt_main) #9
  br label %203

.preheader:                                       ; preds = %167, %178
  %172 = call i64 @fread(ptr noundef nonnull %7, i64 noundef 1, i64 noundef 4096, ptr noundef %.180)
  %.not127 = icmp eq i64 %172, 0
  br i1 %.not127, label %188, label %173

173:                                              ; preds = %.preheader
  %174 = call i32 @sdf_cbc_encrypt_update(ptr noundef nonnull %11, ptr noundef nonnull %7, i64 noundef %172, ptr noundef nonnull %7, ptr noundef nonnull %8) #8
  %.not130 = icmp eq i32 %174, 1
  br i1 %.not130, label %178, label %175

175:                                              ; preds = %173
  %176 = load ptr, ptr @stderr, align 8, !tbaa !5
  %177 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %176, ptr noundef nonnull @.str.21, ptr noundef nonnull @.str.22, i32 noundef 195, ptr noundef nonnull @__FUNCTION__.sdfencrypt_main) #9
  br label %203

178:                                              ; preds = %173
  %179 = load i64, ptr %8, align 8, !tbaa !13
  %180 = call i64 @fwrite(ptr noundef nonnull %7, i64 noundef 1, i64 noundef %179, ptr noundef %.1)
  %181 = load i64, ptr %8, align 8, !tbaa !13
  %.not131 = icmp eq i64 %180, %181
  br i1 %.not131, label %.preheader, label %182, !llvm.loop !15

182:                                              ; preds = %178
  %183 = load ptr, ptr @stderr, align 8, !tbaa !5
  %184 = tail call ptr @__errno_location() #11
  %185 = load i32, ptr %184, align 4, !tbaa !9
  %186 = call ptr @strerror(i32 noundef %185) #8
  %187 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %183, ptr noundef nonnull @.str.23, ptr noundef %12, ptr noundef %186) #9
  br label %203

188:                                              ; preds = %.preheader
  %189 = call i32 @sdf_cbc_encrypt_finish(ptr noundef nonnull %11, ptr noundef nonnull %7, ptr noundef nonnull %8) #8
  %.not128 = icmp eq i32 %189, 1
  br i1 %.not128, label %193, label %190

190:                                              ; preds = %188
  %191 = load ptr, ptr @stderr, align 8, !tbaa !5
  %192 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %191, ptr noundef nonnull @.str.21, ptr noundef nonnull @.str.22, i32 noundef 204, ptr noundef nonnull @__FUNCTION__.sdfencrypt_main) #9
  br label %203

193:                                              ; preds = %188
  %194 = load i64, ptr %8, align 8, !tbaa !13
  %195 = call i64 @fwrite(ptr noundef nonnull %7, i64 noundef 1, i64 noundef %194, ptr noundef %.1)
  %196 = load i64, ptr %8, align 8, !tbaa !13
  %.not129 = icmp eq i64 %195, %196
  br i1 %.not129, label %203, label %197

197:                                              ; preds = %193
  %198 = load ptr, ptr @stderr, align 8, !tbaa !5
  %199 = tail call ptr @__errno_location() #11
  %200 = load i32, ptr %199, align 4, !tbaa !9
  %201 = call ptr @strerror(i32 noundef %200) #8
  %202 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %198, ptr noundef nonnull @.str.23, ptr noundef %12, ptr noundef %201) #9
  br label %203

203:                                              ; preds = %193, %197, %190, %182, %175, %169, %161, %152, %145, %140, %137, %131, %125, %119, %114, %109, %102, %99, %93, %79, %65, %56, %47, %38, %23
  %.0100 = phi i32 [ 1, %99 ], [ 1, %102 ], [ 1, %93 ], [ 1, %79 ], [ 1, %56 ], [ 1, %65 ], [ 1, %38 ], [ 1, %47 ], [ 0, %23 ], [ 1, %114 ], [ 1, %119 ], [ 1, %125 ], [ 1, %145 ], [ 1, %152 ], [ 1, %161 ], [ 1, %169 ], [ 1, %175 ], [ 1, %182 ], [ 1, %190 ], [ 1, %197 ], [ 1, %131 ], [ 1, %137 ], [ 1, %140 ], [ 1, %109 ], [ 0, %193 ]
  %.291 = phi ptr [ %.089243, %99 ], [ %.089243, %102 ], [ %.089243, %93 ], [ %77, %79 ], [ %.089243, %56 ], [ %.089243, %65 ], [ %.089243, %38 ], [ %.089243, %47 ], [ %.089243, %23 ], [ %.190, %114 ], [ %.190, %119 ], [ %.190, %125 ], [ %.190, %145 ], [ %.190, %152 ], [ %.190, %161 ], [ %.190, %169 ], [ %.190, %175 ], [ %.190, %182 ], [ %.190, %190 ], [ %.190, %197 ], [ %.190, %131 ], [ %.190, %137 ], [ %.190, %140 ], [ %.190, %109 ], [ %.190, %193 ]
  %.288 = phi ptr [ %.086244, %99 ], [ %.086244, %102 ], [ %91, %93 ], [ %.086244, %79 ], [ %.086244, %56 ], [ %.086244, %65 ], [ %.086244, %38 ], [ %.086244, %47 ], [ %.086244, %23 ], [ %.187, %114 ], [ %.187, %119 ], [ %.187, %125 ], [ %.187, %145 ], [ %.187, %152 ], [ %.187, %161 ], [ %.187, %169 ], [ %.187, %175 ], [ %.187, %182 ], [ %.187, %190 ], [ %.187, %197 ], [ %.187, %131 ], [ %.187, %137 ], [ %.187, %140 ], [ %.187, %109 ], [ %.187, %193 ]
  %.281 = phi ptr [ %.079247, %99 ], [ %.079247, %102 ], [ %.079247, %93 ], [ null, %79 ], [ %.079247, %56 ], [ %.079247, %65 ], [ %.079247, %38 ], [ %.079247, %47 ], [ %.079247, %23 ], [ %.180, %114 ], [ %.180, %119 ], [ %.180, %125 ], [ %.180, %145 ], [ %.180, %152 ], [ %.180, %161 ], [ %.180, %169 ], [ %.180, %175 ], [ %.180, %182 ], [ %.180, %190 ], [ %.180, %197 ], [ %.180, %131 ], [ %.180, %137 ], [ %.180, %140 ], [ %.180, %109 ], [ %.180, %193 ]
  %.2 = phi ptr [ %.078248, %99 ], [ %.078248, %102 ], [ null, %93 ], [ %.078248, %79 ], [ %.078248, %56 ], [ %.078248, %65 ], [ %.078248, %38 ], [ %.078248, %47 ], [ %.078248, %23 ], [ %.1, %114 ], [ %.1, %119 ], [ %.1, %125 ], [ %.1, %145 ], [ %.1, %152 ], [ %.1, %161 ], [ %.1, %169 ], [ %.1, %175 ], [ %.1, %182 ], [ %.1, %190 ], [ %.1, %197 ], [ %.1, %131 ], [ %.1, %137 ], [ %.1, %140 ], [ %.1, %109 ], [ %.1, %193 ]
  %204 = call i32 @sdf_destroy_key(ptr noundef nonnull %10) #8
  %205 = call i32 @sdf_close_device(ptr noundef nonnull %9) #8
  call void @sdf_unload_library() #8
  call void @gmssl_secure_clear(ptr noundef nonnull %6, i64 noundef 16) #8
  call void @gmssl_secure_clear(ptr noundef nonnull %11, i64 noundef 56) #8
  %206 = icmp ne ptr %.291, null
  %207 = icmp ne ptr %.281, null
  %or.cond = select i1 %206, i1 %207, i1 false
  br i1 %or.cond, label %208, label %210

208:                                              ; preds = %203
  %209 = call i32 @fclose(ptr noundef nonnull %.281)
  br label %210

210:                                              ; preds = %208, %203
  %211 = icmp ne ptr %.288, null
  %212 = icmp ne ptr %.2, null
  %or.cond3 = select i1 %211, i1 %212, i1 false
  br i1 %or.cond3, label %213, label %215

213:                                              ; preds = %210
  %214 = call i32 @fclose(ptr noundef nonnull %.2)
  br label %215

215:                                              ; preds = %210, %213, %17
  %.0 = phi i32 [ 1, %17 ], [ %.0100, %213 ], [ %.0100, %210 ]
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %11) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %10) #8
  call void @llvm.lifetime.end.p0(i64 88, ptr nonnull %9) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #8
  call void @llvm.lifetime.end.p0(i64 4096, ptr nonnull %7) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #8
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %4) #8
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %3) #8
  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: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

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

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

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

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

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

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__errno_location() local_unnamed_addr #6

declare i32 @sdf_load_library(ptr noundef, ptr noundef) local_unnamed_addr #7

declare i32 @sdf_open_device(ptr noundef) local_unnamed_addr #7

declare i32 @sm2_public_key_info_from_pem(ptr noundef, ptr noundef) local_unnamed_addr #7

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

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

declare i32 @sdf_generate_key(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #7

; Function Attrs: nofree nounwind
declare noundef i64 @fwrite(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #3

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

declare i32 @sdf_cbc_encrypt_init(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #7

; Function Attrs: nofree nounwind
declare noundef i64 @fread(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #3

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

declare i32 @sdf_cbc_encrypt_finish(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #7

declare i32 @sdf_destroy_key(ptr noundef) local_unnamed_addr #7

declare i32 @sdf_close_device(ptr noundef) local_unnamed_addr #7

declare void @sdf_unload_library() local_unnamed_addr #7

declare void @gmssl_secure_clear(ptr noundef, i64 noundef) local_unnamed_addr #7

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

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

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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { 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 #4 = { 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 #5 = { 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 #6 = { 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 #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 = { nounwind }
attributes #9 = { cold nounwind }
attributes #10 = { nounwind willreturn memory(read) }
attributes #11 = { nounwind willreturn memory(none) }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !14, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = distinct !{!15, !12}


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