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

; 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.SM2_DEC_CTX = type { [366 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 [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [40 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @sm2decrypt_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 %struct.SM2_KEY, align 8
  %16 = alloca %struct.SM2_DEC_CTX, align 8
  %17 = alloca [366 x i8], align 16
  %18 = alloca [366 x i8], align 16
  %19 = alloca i64, align 8
  %20 = alloca i64, align 8
  %21 = 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) #6
  store i32 1, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %22 = load ptr, ptr %5, align 8, !tbaa !9
  %23 = getelementptr inbounds ptr, ptr %22, i64 0
  %24 = load ptr, ptr %23, align 8, !tbaa !9
  store ptr %24, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  store ptr null, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  store ptr null, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  store ptr null, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  store ptr null, ptr %11, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  store ptr null, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %25 = load ptr, ptr @stdin, align 8, !tbaa !9
  store ptr %25, ptr %13, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %26 = load ptr, ptr @stdout, align 8, !tbaa !9
  store ptr %26, ptr %14, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 128, ptr %15) #6
  call void @llvm.lifetime.start.p0(i64 376, ptr %16) #6
  call void @llvm.lifetime.start.p0(i64 366, ptr %17) #6
  call void @llvm.lifetime.start.p0(i64 366, ptr %18) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #6
  %27 = load i32, ptr %4, align 4, !tbaa !5
  %28 = add nsw i32 %27, -1
  store i32 %28, ptr %4, align 4, !tbaa !5
  %29 = load ptr, ptr %5, align 8, !tbaa !9
  %30 = getelementptr inbounds ptr, ptr %29, i32 1
  store ptr %30, ptr %5, align 8, !tbaa !9
  %31 = load i32, ptr %4, align 4, !tbaa !5
  %32 = icmp slt i32 %31, 1
  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 @usage, align 8, !tbaa !9
  %37 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %34, ptr noundef @.str, ptr noundef %35, ptr noundef %36) #6
  store i32 1, ptr %3, align 4
  store i32 1, ptr %21, align 4
  br label %267

38:                                               ; preds = %2
  br label %39

39:                                               ; preds = %161, %38
  %40 = load i32, ptr %4, align 4, !tbaa !5
  %41 = icmp sgt i32 %40, 0
  br i1 %41, label %42, label %166

42:                                               ; preds = %39
  %43 = load ptr, ptr %5, align 8, !tbaa !9
  %44 = load ptr, ptr %43, align 8, !tbaa !9
  %45 = call i32 @strcmp(ptr noundef %44, ptr noundef @.str.1) #7
  %46 = icmp ne i32 %45, 0
  br i1 %46, label %53, label %47

47:                                               ; preds = %42
  %48 = load ptr, ptr %7, align 8, !tbaa !9
  %49 = load ptr, ptr @usage, align 8, !tbaa !9
  %50 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef %48, ptr noundef %49)
  %51 = load ptr, ptr @options, align 8, !tbaa !9
  %52 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, ptr noundef %51)
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %240

53:                                               ; preds = %42
  %54 = load ptr, ptr %5, align 8, !tbaa !9
  %55 = load ptr, ptr %54, align 8, !tbaa !9
  %56 = call i32 @strcmp(ptr noundef %55, ptr noundef @.str.3) #7
  %57 = icmp ne i32 %56, 0
  br i1 %57, label %79, label %58

58:                                               ; preds = %53
  %59 = load i32, ptr %4, align 4, !tbaa !5
  %60 = add nsw i32 %59, -1
  store i32 %60, ptr %4, align 4, !tbaa !5
  %61 = icmp slt i32 %60, 1
  br i1 %61, label %62, label %63

62:                                               ; preds = %58
  br label %151

63:                                               ; preds = %58
  %64 = load ptr, ptr %5, align 8, !tbaa !9
  %65 = getelementptr inbounds ptr, ptr %64, i32 1
  store ptr %65, ptr %5, align 8, !tbaa !9
  %66 = load ptr, ptr %65, align 8, !tbaa !9
  store ptr %66, ptr %8, align 8, !tbaa !9
  %67 = load ptr, ptr %8, align 8, !tbaa !9
  %68 = call noalias ptr @fopen(ptr noundef %67, ptr noundef @.str.4)
  store ptr %68, ptr %12, align 8, !tbaa !9
  %69 = icmp ne ptr %68, null
  br i1 %69, label %78, label %70

70:                                               ; preds = %63
  %71 = load ptr, ptr @stderr, align 8, !tbaa !9
  %72 = load ptr, ptr %7, align 8, !tbaa !9
  %73 = load ptr, ptr %8, align 8, !tbaa !9
  %74 = call ptr @__errno_location() #8
  %75 = load i32, ptr %74, align 4, !tbaa !5
  %76 = call ptr @strerror(i32 noundef %75) #6
  %77 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %71, ptr noundef @.str.5, ptr noundef %72, ptr noundef %73, ptr noundef %76) #6
  br label %240

78:                                               ; preds = %63
  br label %160

79:                                               ; preds = %53
  %80 = load ptr, ptr %5, align 8, !tbaa !9
  %81 = load ptr, ptr %80, align 8, !tbaa !9
  %82 = call i32 @strcmp(ptr noundef %81, ptr noundef @.str.6) #7
  %83 = icmp ne i32 %82, 0
  br i1 %83, label %93, label %84

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

88:                                               ; preds = %84
  br label %151

89:                                               ; preds = %84
  %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
  %92 = load ptr, ptr %91, align 8, !tbaa !9
  store ptr %92, ptr %9, align 8, !tbaa !9
  br label %159

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

98:                                               ; preds = %93
  %99 = load i32, ptr %4, align 4, !tbaa !5
  %100 = add nsw i32 %99, -1
  store i32 %100, ptr %4, align 4, !tbaa !5
  %101 = icmp slt i32 %100, 1
  br i1 %101, label %102, label %103

102:                                              ; preds = %98
  br label %151

103:                                              ; preds = %98
  %104 = load ptr, ptr %5, align 8, !tbaa !9
  %105 = getelementptr inbounds ptr, ptr %104, i32 1
  store ptr %105, ptr %5, align 8, !tbaa !9
  %106 = load ptr, ptr %105, align 8, !tbaa !9
  store ptr %106, ptr %10, align 8, !tbaa !9
  %107 = load ptr, ptr %10, align 8, !tbaa !9
  %108 = call noalias ptr @fopen(ptr noundef %107, ptr noundef @.str.4)
  store ptr %108, ptr %13, align 8, !tbaa !9
  %109 = icmp ne ptr %108, null
  br i1 %109, label %118, label %110

110:                                              ; preds = %103
  %111 = load ptr, ptr @stderr, align 8, !tbaa !9
  %112 = load ptr, ptr %7, align 8, !tbaa !9
  %113 = load ptr, ptr %10, align 8, !tbaa !9
  %114 = call ptr @__errno_location() #8
  %115 = load i32, ptr %114, align 4, !tbaa !5
  %116 = call ptr @strerror(i32 noundef %115) #6
  %117 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %111, ptr noundef @.str.5, ptr noundef %112, ptr noundef %113, ptr noundef %116) #6
  br label %240

118:                                              ; preds = %103
  br label %158

119:                                              ; preds = %93
  %120 = load ptr, ptr %5, align 8, !tbaa !9
  %121 = load ptr, ptr %120, align 8, !tbaa !9
  %122 = call i32 @strcmp(ptr noundef %121, ptr noundef @.str.8) #7
  %123 = icmp ne i32 %122, 0
  br i1 %123, label %145, label %124

124:                                              ; preds = %119
  %125 = load i32, ptr %4, align 4, !tbaa !5
  %126 = add nsw i32 %125, -1
  store i32 %126, ptr %4, align 4, !tbaa !5
  %127 = icmp slt i32 %126, 1
  br i1 %127, label %128, label %129

128:                                              ; preds = %124
  br label %151

129:                                              ; preds = %124
  %130 = load ptr, ptr %5, align 8, !tbaa !9
  %131 = getelementptr inbounds ptr, ptr %130, i32 1
  store ptr %131, ptr %5, align 8, !tbaa !9
  %132 = load ptr, ptr %131, align 8, !tbaa !9
  store ptr %132, ptr %11, align 8, !tbaa !9
  %133 = load ptr, ptr %11, align 8, !tbaa !9
  %134 = call noalias ptr @fopen(ptr noundef %133, ptr noundef @.str.9)
  store ptr %134, ptr %14, align 8, !tbaa !9
  %135 = icmp ne ptr %134, null
  br i1 %135, label %144, label %136

136:                                              ; preds = %129
  %137 = load ptr, ptr @stderr, align 8, !tbaa !9
  %138 = load ptr, ptr %7, align 8, !tbaa !9
  %139 = load ptr, ptr %11, align 8, !tbaa !9
  %140 = call ptr @__errno_location() #8
  %141 = load i32, ptr %140, align 4, !tbaa !5
  %142 = call ptr @strerror(i32 noundef %141) #6
  %143 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %137, ptr noundef @.str.5, ptr noundef %138, ptr noundef %139, ptr noundef %142) #6
  br label %240

144:                                              ; preds = %129
  br label %157

145:                                              ; preds = %119
  %146 = load ptr, ptr @stderr, align 8, !tbaa !9
  %147 = load ptr, ptr %7, align 8, !tbaa !9
  %148 = load ptr, ptr %5, align 8, !tbaa !9
  %149 = load ptr, ptr %148, align 8, !tbaa !9
  %150 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %146, ptr noundef @.str.10, ptr noundef %147, ptr noundef %149) #6
  br label %240

151:                                              ; preds = %128, %102, %88, %62
  %152 = load ptr, ptr @stderr, align 8, !tbaa !9
  %153 = load ptr, ptr %7, align 8, !tbaa !9
  %154 = load ptr, ptr %5, align 8, !tbaa !9
  %155 = load ptr, ptr %154, align 8, !tbaa !9
  %156 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %152, ptr noundef @.str.11, ptr noundef %153, ptr noundef %155) #6
  br label %240

157:                                              ; preds = %144
  br label %158

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

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

160:                                              ; preds = %159, %78
  br label %161

161:                                              ; preds = %160
  %162 = load i32, ptr %4, align 4, !tbaa !5
  %163 = add nsw i32 %162, -1
  store i32 %163, ptr %4, align 4, !tbaa !5
  %164 = load ptr, ptr %5, align 8, !tbaa !9
  %165 = getelementptr inbounds ptr, ptr %164, i32 1
  store ptr %165, ptr %5, align 8, !tbaa !9
  br label %39, !llvm.loop !11

166:                                              ; preds = %39
  %167 = load ptr, ptr %8, align 8, !tbaa !9
  %168 = icmp ne ptr %167, null
  br i1 %168, label %173, label %169

169:                                              ; preds = %166
  %170 = load ptr, ptr @stderr, align 8, !tbaa !9
  %171 = load ptr, ptr %7, align 8, !tbaa !9
  %172 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %170, ptr noundef @.str.12, ptr noundef %171) #6
  br label %240

173:                                              ; preds = %166
  %174 = load ptr, ptr %9, align 8, !tbaa !9
  %175 = icmp ne ptr %174, null
  br i1 %175, label %180, label %176

176:                                              ; preds = %173
  %177 = load ptr, ptr @stderr, align 8, !tbaa !9
  %178 = load ptr, ptr %7, align 8, !tbaa !9
  %179 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %177, ptr noundef @.str.13, ptr noundef %178) #6
  br label %240

180:                                              ; preds = %173
  %181 = load ptr, ptr %9, align 8, !tbaa !9
  %182 = load ptr, ptr %12, align 8, !tbaa !9
  %183 = call i32 @sm2_private_key_info_decrypt_from_pem(ptr noundef %15, ptr noundef %181, ptr noundef %182)
  %184 = icmp ne i32 %183, 1
  br i1 %184, label %185, label %189

185:                                              ; preds = %180
  %186 = load ptr, ptr @stderr, align 8, !tbaa !9
  %187 = load ptr, ptr %7, align 8, !tbaa !9
  %188 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %186, ptr noundef @.str.14, ptr noundef %187) #6
  br label %240

189:                                              ; preds = %180
  %190 = getelementptr inbounds [366 x i8], ptr %17, i64 0, i64 0
  %191 = load ptr, ptr %13, align 8, !tbaa !9
  %192 = call i64 @fread(ptr noundef %190, i64 noundef 1, i64 noundef 366, ptr noundef %191)
  store i64 %192, ptr %19, align 8, !tbaa !13
  %193 = icmp ule i64 %192, 0
  br i1 %193, label %194, label %201

194:                                              ; preds = %189
  %195 = load ptr, ptr @stderr, align 8, !tbaa !9
  %196 = load ptr, ptr %7, align 8, !tbaa !9
  %197 = call ptr @__errno_location() #8
  %198 = load i32, ptr %197, align 4, !tbaa !5
  %199 = call ptr @strerror(i32 noundef %198) #6
  %200 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %195, ptr noundef @.str.15, ptr noundef %196, ptr noundef %199) #6
  br label %240

201:                                              ; preds = %189
  %202 = call i32 @sm2_decrypt_init(ptr noundef %16)
  %203 = icmp ne i32 %202, 1
  br i1 %203, label %204, label %208

204:                                              ; preds = %201
  %205 = load ptr, ptr @stderr, align 8, !tbaa !9
  %206 = load ptr, ptr %7, align 8, !tbaa !9
  %207 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %205, ptr noundef @.str.16, ptr noundef %206) #6
  br label %240

208:                                              ; preds = %201
  %209 = getelementptr inbounds [366 x i8], ptr %17, i64 0, i64 0
  %210 = load i64, ptr %19, align 8, !tbaa !13
  %211 = call i32 @sm2_decrypt_update(ptr noundef %16, ptr noundef %209, i64 noundef %210)
  %212 = icmp ne i32 %211, 1
  br i1 %212, label %213, label %217

213:                                              ; preds = %208
  %214 = load ptr, ptr @stderr, align 8, !tbaa !9
  %215 = load ptr, ptr %7, align 8, !tbaa !9
  %216 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %214, ptr noundef @.str.17, ptr noundef %215) #6
  br label %240

217:                                              ; preds = %208
  %218 = getelementptr inbounds [366 x i8], ptr %18, i64 0, i64 0
  %219 = call i32 @sm2_decrypt_finish(ptr noundef %16, ptr noundef %15, ptr noundef %218, ptr noundef %20)
  %220 = icmp ne i32 %219, 1
  br i1 %220, label %221, label %225

221:                                              ; preds = %217
  %222 = load ptr, ptr @stderr, align 8, !tbaa !9
  %223 = load ptr, ptr %7, align 8, !tbaa !9
  %224 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %222, ptr noundef @.str.18, ptr noundef %223) #6
  br label %240

225:                                              ; preds = %217
  %226 = load i64, ptr %20, align 8, !tbaa !13
  %227 = getelementptr inbounds [366 x i8], ptr %18, i64 0, i64 0
  %228 = load i64, ptr %20, align 8, !tbaa !13
  %229 = load ptr, ptr %14, align 8, !tbaa !9
  %230 = call i64 @fwrite(ptr noundef %227, i64 noundef 1, i64 noundef %228, ptr noundef %229)
  %231 = icmp ne i64 %226, %230
  br i1 %231, label %232, label %239

232:                                              ; preds = %225
  %233 = load ptr, ptr @stderr, align 8, !tbaa !9
  %234 = load ptr, ptr %7, align 8, !tbaa !9
  %235 = call ptr @__errno_location() #8
  %236 = load i32, ptr %235, align 4, !tbaa !5
  %237 = call ptr @strerror(i32 noundef %236) #6
  %238 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %233, ptr noundef @.str.19, ptr noundef %234, ptr noundef %237) #6
  br label %240

239:                                              ; preds = %225
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %240

240:                                              ; preds = %239, %232, %221, %213, %204, %194, %185, %176, %169, %151, %145, %136, %110, %70, %47
  call void @gmssl_secure_clear(ptr noundef %15, i64 noundef 128)
  call void @gmssl_secure_clear(ptr noundef %16, i64 noundef 376)
  %241 = getelementptr inbounds [366 x i8], ptr %18, i64 0, i64 0
  call void @gmssl_secure_clear(ptr noundef %241, i64 noundef 366)
  %242 = load ptr, ptr %12, align 8, !tbaa !9
  %243 = icmp ne ptr %242, null
  br i1 %243, label %244, label %247

244:                                              ; preds = %240
  %245 = load ptr, ptr %12, align 8, !tbaa !9
  %246 = call i32 @fclose(ptr noundef %245)
  br label %247

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

250:                                              ; preds = %247
  %251 = load ptr, ptr %13, align 8, !tbaa !9
  %252 = icmp ne ptr %251, null
  br i1 %252, label %253, label %256

253:                                              ; preds = %250
  %254 = load ptr, ptr %13, align 8, !tbaa !9
  %255 = call i32 @fclose(ptr noundef %254)
  br label %256

256:                                              ; preds = %253, %250, %247
  %257 = load ptr, ptr %11, align 8, !tbaa !9
  %258 = icmp ne ptr %257, null
  br i1 %258, label %259, label %265

259:                                              ; preds = %256
  %260 = load ptr, ptr %14, align 8, !tbaa !9
  %261 = icmp ne ptr %260, null
  br i1 %261, label %262, label %265

262:                                              ; preds = %259
  %263 = load ptr, ptr %14, align 8, !tbaa !9
  %264 = call i32 @fclose(ptr noundef %263)
  br label %265

265:                                              ; preds = %262, %259, %256
  %266 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %266, ptr %3, align 4
  store i32 1, ptr %21, align 4
  br label %267

267:                                              ; preds = %265, %33
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 366, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 366, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 376, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 128, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  %268 = load i32, ptr %3, align 4
  ret i32 %268
}

; 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 willreturn memory(read)
declare i32 @strcmp(ptr noundef, ptr noundef) #3

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

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

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

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

declare i32 @sm2_private_key_info_decrypt_from_pem(ptr noundef, ptr noundef, ptr noundef) #4

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

declare i32 @sm2_decrypt_init(ptr noundef) #4

declare i32 @sm2_decrypt_update(ptr noundef, ptr noundef, i64 noundef) #4

declare i32 @sm2_decrypt_finish(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #4

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

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

declare i32 @fclose(ptr noundef) #4

; 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 = { 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 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 #4 = { "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(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 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }
attributes #8 = { 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}


; 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.SM2_DEC_CTX = type { [366 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 [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [40 x i8], align 1

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

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

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

.preheader:                                       ; preds = %.preheader.preheader, %79
  %.062169 = phi ptr [ %.1, %79 ], [ %10, %.preheader.preheader ]
  %.063168 = phi ptr [ %.164, %79 ], [ %9, %.preheader.preheader ]
  %.066167 = phi ptr [ %.167, %79 ], [ null, %.preheader.preheader ]
  %.069166 = phi ptr [ %.170, %79 ], [ null, %.preheader.preheader ]
  %.072165 = phi ptr [ %.173, %79 ], [ null, %.preheader.preheader ]
  %.075164 = phi ptr [ %.176, %79 ], [ null, %.preheader.preheader ]
  %.077163 = phi ptr [ %.178, %79 ], [ null, %.preheader.preheader ]
  %.079.in162 = phi i32 [ %.180, %79 ], [ %0, %.preheader.preheader ]
  %.082161 = phi ptr [ %80, %79 ], [ %12, %.preheader.preheader ]
  %17 = load ptr, ptr %.082161, align 8, !tbaa !5
  %18 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %17, ptr noundef nonnull dereferenceable(1) @.str.1) #9
  %.not102 = icmp eq i32 %18, 0
  br i1 %.not102, label %19, label %24

19:                                               ; preds = %.preheader
  %20 = load ptr, ptr @usage, align 8, !tbaa !5
  %21 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef %8, ptr noundef %20)
  %22 = load ptr, ptr @options, align 8, !tbaa !5
  %23 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef %22)
  br label %128

24:                                               ; preds = %.preheader
  %25 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %17, ptr noundef nonnull dereferenceable(1) @.str.3) #9
  %.not103 = icmp eq i32 %25, 0
  br i1 %.not103, label %26, label %38

26:                                               ; preds = %24
  %27 = icmp eq i32 %.079.in162, 2
  br i1 %27, label %76, label %28

28:                                               ; preds = %26
  %29 = getelementptr inbounds i8, ptr %.082161, i64 8
  %30 = load ptr, ptr %29, align 8, !tbaa !5
  %31 = tail call noalias ptr @fopen(ptr noundef %30, ptr noundef nonnull @.str.4)
  %.not104 = icmp eq ptr %31, null
  br i1 %.not104, label %32, label %79

32:                                               ; preds = %28
  %33 = load ptr, ptr @stderr, align 8, !tbaa !5
  %34 = tail call ptr @__errno_location() #10
  %35 = load i32, ptr %34, align 4, !tbaa !9
  %36 = tail call ptr @strerror(i32 noundef %35) #7
  %37 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %33, ptr noundef nonnull @.str.5, ptr noundef %8, ptr noundef %30, ptr noundef %36) #8
  br label %128

38:                                               ; preds = %24
  %39 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %17, ptr noundef nonnull dereferenceable(1) @.str.6) #9
  %.not105 = icmp eq i32 %39, 0
  br i1 %.not105, label %40, label %45

40:                                               ; preds = %38
  %41 = icmp eq i32 %.079.in162, 2
  br i1 %41, label %76, label %42

42:                                               ; preds = %40
  %43 = getelementptr inbounds i8, ptr %.082161, i64 8
  %44 = load ptr, ptr %43, align 8, !tbaa !5
  br label %79

45:                                               ; preds = %38
  %46 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %17, ptr noundef nonnull dereferenceable(1) @.str.7) #9
  %.not106 = icmp eq i32 %46, 0
  br i1 %.not106, label %47, label %59

47:                                               ; preds = %45
  %48 = icmp eq i32 %.079.in162, 2
  br i1 %48, label %76, label %49

49:                                               ; preds = %47
  %50 = getelementptr inbounds i8, ptr %.082161, i64 8
  %51 = load ptr, ptr %50, align 8, !tbaa !5
  %52 = tail call noalias ptr @fopen(ptr noundef %51, ptr noundef nonnull @.str.4)
  %.not107 = icmp eq ptr %52, null
  br i1 %.not107, label %53, label %79

53:                                               ; preds = %49
  %54 = load ptr, ptr @stderr, align 8, !tbaa !5
  %55 = tail call ptr @__errno_location() #10
  %56 = load i32, ptr %55, align 4, !tbaa !9
  %57 = tail call ptr @strerror(i32 noundef %56) #7
  %58 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %54, ptr noundef nonnull @.str.5, ptr noundef %8, ptr noundef %51, ptr noundef %57) #8
  br label %128

59:                                               ; preds = %45
  %60 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %17, ptr noundef nonnull dereferenceable(1) @.str.8) #9
  %.not108 = icmp eq i32 %60, 0
  br i1 %.not108, label %61, label %73

61:                                               ; preds = %59
  %62 = icmp eq i32 %.079.in162, 2
  br i1 %62, label %76, label %63

63:                                               ; preds = %61
  %64 = getelementptr inbounds i8, ptr %.082161, i64 8
  %65 = load ptr, ptr %64, align 8, !tbaa !5
  %66 = tail call noalias ptr @fopen(ptr noundef %65, ptr noundef nonnull @.str.9)
  %.not109 = icmp eq ptr %66, null
  br i1 %.not109, label %67, label %79

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

73:                                               ; preds = %59
  %74 = load ptr, ptr @stderr, align 8, !tbaa !5
  %75 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %74, ptr noundef nonnull @.str.10, ptr noundef %8, ptr noundef %17) #8
  br label %128

76:                                               ; preds = %61, %47, %40, %26
  %77 = load ptr, ptr @stderr, align 8, !tbaa !5
  %78 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %77, ptr noundef nonnull @.str.11, ptr noundef %8, ptr noundef %17) #8
  br label %128

79:                                               ; preds = %28, %49, %63, %42
  %.178 = phi ptr [ %.077163, %63 ], [ %.077163, %49 ], [ %.077163, %42 ], [ %30, %28 ]
  %.176 = phi ptr [ %.075164, %63 ], [ %.075164, %49 ], [ %44, %42 ], [ %.075164, %28 ]
  %.173 = phi ptr [ %.072165, %63 ], [ %51, %49 ], [ %.072165, %42 ], [ %.072165, %28 ]
  %.170 = phi ptr [ %65, %63 ], [ %.069166, %49 ], [ %.069166, %42 ], [ %.069166, %28 ]
  %.167 = phi ptr [ %.066167, %63 ], [ %.066167, %49 ], [ %.066167, %42 ], [ %31, %28 ]
  %.164 = phi ptr [ %.063168, %63 ], [ %52, %49 ], [ %.063168, %42 ], [ %.063168, %28 ]
  %.1 = phi ptr [ %66, %63 ], [ %.062169, %49 ], [ %.062169, %42 ], [ %.062169, %28 ]
  %.180 = add nsw i32 %.079.in162, -2
  %80 = getelementptr inbounds i8, ptr %.082161, i64 16
  %81 = icmp sgt i32 %.079.in162, 3
  br i1 %81, label %.preheader, label %82, !llvm.loop !11

82:                                               ; preds = %79
  %.not = icmp eq ptr %.178, null
  br i1 %.not, label %83, label %86

83:                                               ; preds = %82
  %84 = load ptr, ptr @stderr, align 8, !tbaa !5
  %85 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %84, ptr noundef nonnull @.str.12, ptr noundef %8) #8
  br label %128

86:                                               ; preds = %82
  %.not96 = icmp eq ptr %.176, null
  br i1 %.not96, label %87, label %90

87:                                               ; preds = %86
  %88 = load ptr, ptr @stderr, align 8, !tbaa !5
  %89 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %88, ptr noundef nonnull @.str.13, ptr noundef %8) #8
  br label %128

90:                                               ; preds = %86
  %91 = call i32 @sm2_private_key_info_decrypt_from_pem(ptr noundef nonnull %3, ptr noundef nonnull %.176, ptr noundef %.167) #7
  %.not97 = icmp eq i32 %91, 1
  br i1 %.not97, label %95, label %92

92:                                               ; preds = %90
  %93 = load ptr, ptr @stderr, align 8, !tbaa !5
  %94 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %93, ptr noundef nonnull @.str.14, ptr noundef %8) #8
  br label %128

95:                                               ; preds = %90
  %96 = call i64 @fread(ptr noundef nonnull %5, i64 noundef 1, i64 noundef 366, ptr noundef %.164)
  %97 = icmp eq i64 %96, 0
  br i1 %97, label %98, label %104

98:                                               ; preds = %95
  %99 = load ptr, ptr @stderr, align 8, !tbaa !5
  %100 = tail call ptr @__errno_location() #10
  %101 = load i32, ptr %100, align 4, !tbaa !9
  %102 = call ptr @strerror(i32 noundef %101) #7
  %103 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %99, ptr noundef nonnull @.str.15, ptr noundef %8, ptr noundef %102) #8
  br label %128

104:                                              ; preds = %95
  %105 = call i32 @sm2_decrypt_init(ptr noundef nonnull %4) #7
  %.not98 = icmp eq i32 %105, 1
  br i1 %.not98, label %109, label %106

106:                                              ; preds = %104
  %107 = load ptr, ptr @stderr, align 8, !tbaa !5
  %108 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %107, ptr noundef nonnull @.str.16, ptr noundef %8) #8
  br label %128

109:                                              ; preds = %104
  %110 = call i32 @sm2_decrypt_update(ptr noundef nonnull %4, ptr noundef nonnull %5, i64 noundef %96) #7
  %.not99 = icmp eq i32 %110, 1
  br i1 %.not99, label %114, label %111

111:                                              ; preds = %109
  %112 = load ptr, ptr @stderr, align 8, !tbaa !5
  %113 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %112, ptr noundef nonnull @.str.17, ptr noundef %8) #8
  br label %128

114:                                              ; preds = %109
  %115 = call i32 @sm2_decrypt_finish(ptr noundef nonnull %4, ptr noundef nonnull %3, ptr noundef nonnull %6, ptr noundef nonnull %7) #7
  %.not100 = icmp eq i32 %115, 1
  br i1 %.not100, label %119, label %116

116:                                              ; preds = %114
  %117 = load ptr, ptr @stderr, align 8, !tbaa !5
  %118 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %117, ptr noundef nonnull @.str.18, ptr noundef %8) #8
  br label %128

119:                                              ; preds = %114
  %120 = load i64, ptr %7, align 8, !tbaa !13
  %121 = call i64 @fwrite(ptr noundef nonnull %6, i64 noundef 1, i64 noundef %120, ptr noundef %.1)
  %.not101 = icmp eq i64 %120, %121
  br i1 %.not101, label %128, label %122

122:                                              ; preds = %119
  %123 = load ptr, ptr @stderr, align 8, !tbaa !5
  %124 = tail call ptr @__errno_location() #10
  %125 = load i32, ptr %124, align 4, !tbaa !9
  %126 = call ptr @strerror(i32 noundef %125) #7
  %127 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %123, ptr noundef nonnull @.str.19, ptr noundef %8, ptr noundef %126) #8
  br label %128

128:                                              ; preds = %119, %122, %116, %111, %106, %98, %92, %87, %83, %76, %73, %67, %53, %32, %19
  %.081 = phi i32 [ 1, %73 ], [ 1, %76 ], [ 1, %67 ], [ 1, %53 ], [ 1, %32 ], [ 0, %19 ], [ 1, %92 ], [ 1, %98 ], [ 1, %106 ], [ 1, %111 ], [ 1, %116 ], [ 1, %122 ], [ 1, %87 ], [ 1, %83 ], [ 0, %119 ]
  %.274 = phi ptr [ %.072165, %73 ], [ %.072165, %76 ], [ %.072165, %67 ], [ %51, %53 ], [ %.072165, %32 ], [ %.072165, %19 ], [ %.173, %92 ], [ %.173, %98 ], [ %.173, %106 ], [ %.173, %111 ], [ %.173, %116 ], [ %.173, %122 ], [ %.173, %87 ], [ %.173, %83 ], [ %.173, %119 ]
  %.271 = phi ptr [ %.069166, %73 ], [ %.069166, %76 ], [ %65, %67 ], [ %.069166, %53 ], [ %.069166, %32 ], [ %.069166, %19 ], [ %.170, %92 ], [ %.170, %98 ], [ %.170, %106 ], [ %.170, %111 ], [ %.170, %116 ], [ %.170, %122 ], [ %.170, %87 ], [ %.170, %83 ], [ %.170, %119 ]
  %.268 = phi ptr [ %.066167, %73 ], [ %.066167, %76 ], [ %.066167, %67 ], [ %.066167, %53 ], [ null, %32 ], [ %.066167, %19 ], [ %.167, %92 ], [ %.167, %98 ], [ %.167, %106 ], [ %.167, %111 ], [ %.167, %116 ], [ %.167, %122 ], [ %.167, %87 ], [ %.167, %83 ], [ %.167, %119 ]
  %.265 = phi ptr [ %.063168, %73 ], [ %.063168, %76 ], [ %.063168, %67 ], [ null, %53 ], [ %.063168, %32 ], [ %.063168, %19 ], [ %.164, %92 ], [ %.164, %98 ], [ %.164, %106 ], [ %.164, %111 ], [ %.164, %116 ], [ %.164, %122 ], [ %.164, %87 ], [ %.164, %83 ], [ %.164, %119 ]
  %.2 = phi ptr [ %.062169, %73 ], [ %.062169, %76 ], [ null, %67 ], [ %.062169, %53 ], [ %.062169, %32 ], [ %.062169, %19 ], [ %.1, %92 ], [ %.1, %98 ], [ %.1, %106 ], [ %.1, %111 ], [ %.1, %116 ], [ %.1, %122 ], [ %.1, %87 ], [ %.1, %83 ], [ %.1, %119 ]
  call void @gmssl_secure_clear(ptr noundef nonnull %3, i64 noundef 128) #7
  call void @gmssl_secure_clear(ptr noundef nonnull %4, i64 noundef 376) #7
  call void @gmssl_secure_clear(ptr noundef nonnull %6, i64 noundef 366) #7
  %.not110 = icmp eq ptr %.268, null
  br i1 %.not110, label %131, label %129

129:                                              ; preds = %128
  %130 = call i32 @fclose(ptr noundef nonnull %.268)
  br label %131

131:                                              ; preds = %129, %128
  %132 = icmp ne ptr %.274, null
  %133 = icmp ne ptr %.265, null
  %or.cond = select i1 %132, i1 %133, i1 false
  br i1 %or.cond, label %134, label %136

134:                                              ; preds = %131
  %135 = call i32 @fclose(ptr noundef nonnull %.265)
  br label %136

136:                                              ; preds = %134, %131
  %137 = icmp ne ptr %.271, null
  %138 = icmp ne ptr %.2, null
  %or.cond3 = select i1 %137, i1 %138, i1 false
  br i1 %or.cond3, label %139, label %141

139:                                              ; preds = %136
  %140 = call i32 @fclose(ptr noundef nonnull %.2)
  br label %141

141:                                              ; preds = %136, %139, %13
  %.0 = phi i32 [ 1, %13 ], [ %.081, %139 ], [ %.081, %136 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #7
  call void @llvm.lifetime.end.p0(i64 366, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 366, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 376, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %3) #7
  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: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #3

; 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

; 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

declare i32 @sm2_private_key_info_decrypt_from_pem(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #6

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

declare i32 @sm2_decrypt_init(ptr noundef) local_unnamed_addr #6

declare i32 @sm2_decrypt_update(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #6

declare i32 @sm2_decrypt_finish(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #6

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

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

; 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

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 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 #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 = { "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 = { cold nounwind }
attributes #9 = { nounwind willreturn memory(read) }
attributes #10 = { 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}


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