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

; 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_SIGN_CTX = type { %struct.SM3_CTX, %struct.SM3_CTX, %struct.SM2_KEY, [4 x i64], [32 x %struct.SM2_SIGN_PRE_COMP], i32, [16 x %struct.SM2_Z256_POINT] }
%struct.SM3_CTX = type { [8 x i32], i64, [64 x i8], i64 }
%struct.SM2_SIGN_PRE_COMP = type { [4 x i64], [4 x i64] }

@.str = external hidden unnamed_addr constant [17 x i8], align 1
@stdin = external global ptr, align 8
@stdout = external global ptr, align 8
@stderr = external global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [20 x i8], align 1
@usage = external hidden global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@options = external hidden global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [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 [35 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [40 x i8], align 1

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

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

39:                                               ; preds = %2
  br label %40

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

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

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

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

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

63:                                               ; preds = %59
  br label %166

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

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

79:                                               ; preds = %64
  br label %176

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

85:                                               ; preds = %80
  %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 %166

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
  br label %175

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

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

103:                                              ; preds = %99
  br label %166

104:                                              ; preds = %99
  %105 = load ptr, ptr %5, align 8, !tbaa !9
  %106 = getelementptr inbounds ptr, ptr %105, i32 1
  store ptr %106, ptr %5, align 8, !tbaa !9
  %107 = load ptr, ptr %106, align 8, !tbaa !9
  store ptr %107, ptr %10, align 8, !tbaa !9
  br label %174

108:                                              ; preds = %94
  %109 = load ptr, ptr %5, align 8, !tbaa !9
  %110 = load ptr, ptr %109, align 8, !tbaa !9
  %111 = call i32 @strcmp(ptr noundef %110, ptr noundef @.str.9) #7
  %112 = icmp ne i32 %111, 0
  br i1 %112, label %134, label %113

113:                                              ; preds = %108
  %114 = load i32, ptr %4, align 4, !tbaa !5
  %115 = add nsw i32 %114, -1
  store i32 %115, ptr %4, align 4, !tbaa !5
  %116 = icmp slt i32 %115, 1
  br i1 %116, label %117, label %118

117:                                              ; preds = %113
  br label %166

118:                                              ; preds = %113
  %119 = load ptr, ptr %5, align 8, !tbaa !9
  %120 = getelementptr inbounds ptr, ptr %119, i32 1
  store ptr %120, ptr %5, align 8, !tbaa !9
  %121 = load ptr, ptr %120, align 8, !tbaa !9
  store ptr %121, ptr %11, align 8, !tbaa !9
  %122 = load ptr, ptr %11, align 8, !tbaa !9
  %123 = call noalias ptr @fopen(ptr noundef %122, ptr noundef @.str.5)
  store ptr %123, ptr %14, align 8, !tbaa !9
  %124 = icmp ne ptr %123, null
  br i1 %124, label %133, label %125

125:                                              ; preds = %118
  %126 = load ptr, ptr @stderr, align 8, !tbaa !9
  %127 = load ptr, ptr %7, align 8, !tbaa !9
  %128 = load ptr, ptr %11, align 8, !tbaa !9
  %129 = call ptr @__errno_location() #8
  %130 = load i32, ptr %129, align 4, !tbaa !5
  %131 = call ptr @strerror(i32 noundef %130) #6
  %132 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %126, ptr noundef @.str.6, ptr noundef %127, ptr noundef %128, ptr noundef %131) #6
  br label %254

133:                                              ; preds = %118
  br label %173

134:                                              ; preds = %108
  %135 = load ptr, ptr %5, align 8, !tbaa !9
  %136 = load ptr, ptr %135, align 8, !tbaa !9
  %137 = call i32 @strcmp(ptr noundef %136, ptr noundef @.str.10) #7
  %138 = icmp ne i32 %137, 0
  br i1 %138, label %160, label %139

139:                                              ; preds = %134
  %140 = load i32, ptr %4, align 4, !tbaa !5
  %141 = add nsw i32 %140, -1
  store i32 %141, ptr %4, align 4, !tbaa !5
  %142 = icmp slt i32 %141, 1
  br i1 %142, label %143, label %144

143:                                              ; preds = %139
  br label %166

144:                                              ; preds = %139
  %145 = load ptr, ptr %5, align 8, !tbaa !9
  %146 = getelementptr inbounds ptr, ptr %145, i32 1
  store ptr %146, ptr %5, align 8, !tbaa !9
  %147 = load ptr, ptr %146, align 8, !tbaa !9
  store ptr %147, ptr %12, align 8, !tbaa !9
  %148 = load ptr, ptr %12, align 8, !tbaa !9
  %149 = call noalias ptr @fopen(ptr noundef %148, ptr noundef @.str.11)
  store ptr %149, ptr %15, align 8, !tbaa !9
  %150 = icmp ne ptr %149, null
  br i1 %150, label %159, label %151

151:                                              ; preds = %144
  %152 = load ptr, ptr @stderr, align 8, !tbaa !9
  %153 = load ptr, ptr %7, align 8, !tbaa !9
  %154 = load ptr, ptr %12, align 8, !tbaa !9
  %155 = call ptr @__errno_location() #8
  %156 = load i32, ptr %155, align 4, !tbaa !5
  %157 = call ptr @strerror(i32 noundef %156) #6
  %158 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %152, ptr noundef @.str.6, ptr noundef %153, ptr noundef %154, ptr noundef %157) #6
  br label %254

159:                                              ; preds = %144
  br label %172

160:                                              ; preds = %134
  %161 = load ptr, ptr @stderr, align 8, !tbaa !9
  %162 = load ptr, ptr %7, align 8, !tbaa !9
  %163 = load ptr, ptr %5, align 8, !tbaa !9
  %164 = load ptr, ptr %163, align 8, !tbaa !9
  %165 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %161, ptr noundef @.str.12, ptr noundef %162, ptr noundef %164) #6
  br label %254

166:                                              ; preds = %143, %117, %103, %89, %63
  %167 = load ptr, ptr @stderr, align 8, !tbaa !9
  %168 = load ptr, ptr %7, align 8, !tbaa !9
  %169 = load ptr, ptr %5, align 8, !tbaa !9
  %170 = load ptr, ptr %169, align 8, !tbaa !9
  %171 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %167, ptr noundef @.str.13, ptr noundef %168, ptr noundef %170) #6
  br label %254

172:                                              ; preds = %159
  br label %173

173:                                              ; preds = %172, %133
  br label %174

174:                                              ; preds = %173, %104
  br label %175

175:                                              ; preds = %174, %90
  br label %176

176:                                              ; preds = %175, %79
  br label %177

177:                                              ; preds = %176
  %178 = load i32, ptr %4, align 4, !tbaa !5
  %179 = add nsw i32 %178, -1
  store i32 %179, ptr %4, align 4, !tbaa !5
  %180 = load ptr, ptr %5, align 8, !tbaa !9
  %181 = getelementptr inbounds ptr, ptr %180, i32 1
  store ptr %181, ptr %5, align 8, !tbaa !9
  br label %40, !llvm.loop !11

182:                                              ; preds = %40
  %183 = load ptr, ptr %8, align 8, !tbaa !9
  %184 = icmp ne ptr %183, null
  br i1 %184, label %189, label %185

185:                                              ; preds = %182
  %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 %254

189:                                              ; preds = %182
  %190 = load ptr, ptr %9, align 8, !tbaa !9
  %191 = icmp ne ptr %190, null
  br i1 %191, label %196, label %192

192:                                              ; preds = %189
  %193 = load ptr, ptr @stderr, align 8, !tbaa !9
  %194 = load ptr, ptr %7, align 8, !tbaa !9
  %195 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %193, ptr noundef @.str.15, ptr noundef %194) #6
  br label %254

196:                                              ; preds = %189
  %197 = load ptr, ptr %9, align 8, !tbaa !9
  %198 = load ptr, ptr %13, align 8, !tbaa !9
  %199 = call i32 @sm2_private_key_info_decrypt_from_pem(ptr noundef %16, ptr noundef %197, ptr noundef %198)
  %200 = icmp ne i32 %199, 1
  br i1 %200, label %201, label %205

201:                                              ; preds = %196
  %202 = load ptr, ptr @stderr, align 8, !tbaa !9
  %203 = load ptr, ptr %7, align 8, !tbaa !9
  %204 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %202, ptr noundef @.str.16, ptr noundef %203) #6
  br label %254

205:                                              ; preds = %196
  %206 = load ptr, ptr %10, align 8, !tbaa !9
  %207 = load ptr, ptr %10, align 8, !tbaa !9
  %208 = call i64 @strlen(ptr noundef %207) #7
  %209 = call i32 @sm2_sign_init(ptr noundef %17, ptr noundef %16, ptr noundef %206, i64 noundef %208)
  %210 = icmp ne i32 %209, 1
  br i1 %210, label %211, label %215

211:                                              ; preds = %205
  %212 = load ptr, ptr @stderr, align 8, !tbaa !9
  %213 = load ptr, ptr %7, align 8, !tbaa !9
  %214 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %212, ptr noundef @.str.17, ptr noundef %213) #6
  br label %254

215:                                              ; preds = %205
  br label %216

216:                                              ; preds = %230, %215
  %217 = getelementptr inbounds [4096 x i8], ptr %18, i64 0, i64 0
  %218 = load ptr, ptr %14, align 8, !tbaa !9
  %219 = call i64 @fread(ptr noundef %217, i64 noundef 1, i64 noundef 4096, ptr noundef %218)
  store i64 %219, ptr %19, align 8, !tbaa !13
  %220 = icmp ugt i64 %219, 0
  br i1 %220, label %221, label %231

221:                                              ; preds = %216
  %222 = getelementptr inbounds [4096 x i8], ptr %18, i64 0, i64 0
  %223 = load i64, ptr %19, align 8, !tbaa !13
  %224 = call i32 @sm2_sign_update(ptr noundef %17, ptr noundef %222, i64 noundef %223)
  %225 = icmp ne i32 %224, 1
  br i1 %225, label %226, label %230

226:                                              ; preds = %221
  %227 = load ptr, ptr @stderr, align 8, !tbaa !9
  %228 = load ptr, ptr %7, align 8, !tbaa !9
  %229 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %227, ptr noundef @.str.17, ptr noundef %228) #6
  br label %254

230:                                              ; preds = %221
  br label %216, !llvm.loop !15

231:                                              ; preds = %216
  %232 = getelementptr inbounds [72 x i8], ptr %20, i64 0, i64 0
  %233 = call i32 @sm2_sign_finish(ptr noundef %17, ptr noundef %232, ptr noundef %21)
  %234 = icmp ne i32 %233, 1
  br i1 %234, label %235, label %239

235:                                              ; preds = %231
  %236 = load ptr, ptr @stderr, align 8, !tbaa !9
  %237 = load ptr, ptr %7, align 8, !tbaa !9
  %238 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %236, ptr noundef @.str.17, ptr noundef %237) #6
  br label %254

239:                                              ; preds = %231
  %240 = getelementptr inbounds [72 x i8], ptr %20, i64 0, i64 0
  %241 = load i64, ptr %21, align 8, !tbaa !13
  %242 = load ptr, ptr %15, align 8, !tbaa !9
  %243 = call i64 @fwrite(ptr noundef %240, i64 noundef 1, i64 noundef %241, ptr noundef %242)
  %244 = load i64, ptr %21, align 8, !tbaa !13
  %245 = icmp ne i64 %243, %244
  br i1 %245, label %246, label %253

246:                                              ; preds = %239
  %247 = load ptr, ptr @stderr, align 8, !tbaa !9
  %248 = load ptr, ptr %7, align 8, !tbaa !9
  %249 = call ptr @__errno_location() #8
  %250 = load i32, ptr %249, align 4, !tbaa !5
  %251 = call ptr @strerror(i32 noundef %250) #6
  %252 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %247, ptr noundef @.str.18, ptr noundef %248, ptr noundef %251) #6
  br label %254

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

254:                                              ; preds = %253, %246, %235, %226, %211, %201, %192, %185, %166, %160, %151, %125, %71, %48
  call void @gmssl_secure_clear(ptr noundef %16, i64 noundef 128)
  call void @gmssl_secure_clear(ptr noundef %17, i64 noundef 3976)
  %255 = load ptr, ptr %13, align 8, !tbaa !9
  %256 = icmp ne ptr %255, null
  br i1 %256, label %257, label %260

257:                                              ; preds = %254
  %258 = load ptr, ptr %13, align 8, !tbaa !9
  %259 = call i32 @fclose(ptr noundef %258)
  br label %260

260:                                              ; preds = %257, %254
  %261 = load ptr, ptr %11, align 8, !tbaa !9
  %262 = icmp ne ptr %261, null
  br i1 %262, label %263, label %269

263:                                              ; preds = %260
  %264 = load ptr, ptr %14, align 8, !tbaa !9
  %265 = icmp ne ptr %264, null
  br i1 %265, label %266, label %269

266:                                              ; preds = %263
  %267 = load ptr, ptr %14, align 8, !tbaa !9
  %268 = call i32 @fclose(ptr noundef %267)
  br label %269

269:                                              ; preds = %266, %263, %260
  %270 = load ptr, ptr %12, align 8, !tbaa !9
  %271 = icmp ne ptr %270, null
  br i1 %271, label %272, label %278

272:                                              ; preds = %269
  %273 = load ptr, ptr %15, align 8, !tbaa !9
  %274 = icmp ne ptr %273, null
  br i1 %274, label %275, label %278

275:                                              ; preds = %272
  %276 = load ptr, ptr %15, align 8, !tbaa !9
  %277 = call i32 @fclose(ptr noundef %276)
  br label %278

278:                                              ; preds = %275, %272, %269
  %279 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %279, ptr %3, align 4
  store i32 1, ptr %22, align 4
  br label %280

280:                                              ; preds = %278, %34
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #6
  call void @llvm.lifetime.end.p0(i64 72, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 4096, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 3976, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 128, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, 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
  %281 = load i32, ptr %3, align 4
  ret i32 %281
}

; 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 i32 @sm2_sign_init(ptr noundef, ptr noundef, ptr noundef, i64 noundef) #4

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

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

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

declare i32 @sm2_sign_finish(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}
!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.SM2_SIGN_CTX = type { %struct.SM3_CTX, %struct.SM3_CTX, %struct.SM2_KEY, [4 x i64], [32 x %struct.SM2_SIGN_PRE_COMP], i32, [16 x %struct.SM2_Z256_POINT] }
%struct.SM3_CTX = type { [8 x i32], i64, [64 x i8], i64 }
%struct.SM2_SIGN_PRE_COMP = type { [4 x i64], [4 x i64] }

@.str = external hidden unnamed_addr constant [17 x i8], align 1
@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.1 = external hidden unnamed_addr constant [20 x i8], align 1
@usage = external hidden local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@options = external hidden local_unnamed_addr global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [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 [35 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [40 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @sm2sign_main(i32 noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = alloca %struct.SM2_KEY, align 8
  %4 = alloca %struct.SM2_SIGN_CTX, align 8
  %5 = alloca [4096 x i8], align 16
  %6 = alloca [72 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 3976, ptr nonnull %4) #7
  call void @llvm.lifetime.start.p0(i64 4096, ptr nonnull %5) #7
  call void @llvm.lifetime.start.p0(i64 72, 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 %.preheader120.preheader

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

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.1, ptr noundef %8, ptr noundef %15) #8
  br label %142

.preheader120:                                    ; preds = %.preheader120.preheader, %86
  %.066186 = phi ptr [ %.1, %86 ], [ %10, %.preheader120.preheader ]
  %.067185 = phi ptr [ %.168, %86 ], [ %9, %.preheader120.preheader ]
  %.070184 = phi ptr [ %.171, %86 ], [ null, %.preheader120.preheader ]
  %.073183 = phi ptr [ %.174, %86 ], [ null, %.preheader120.preheader ]
  %.076182 = phi ptr [ %.177, %86 ], [ null, %.preheader120.preheader ]
  %.079181 = phi ptr [ %.180, %86 ], [ @.str, %.preheader120.preheader ]
  %.081180 = phi ptr [ %.182, %86 ], [ null, %.preheader120.preheader ]
  %.083179 = phi ptr [ %.184, %86 ], [ null, %.preheader120.preheader ]
  %.085.in178 = phi i32 [ %.186, %86 ], [ %0, %.preheader120.preheader ]
  %.088177 = phi ptr [ %87, %86 ], [ %12, %.preheader120.preheader ]
  %17 = load ptr, ptr %.088177, align 8, !tbaa !5
  %18 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %17, ptr noundef nonnull dereferenceable(1) @.str.2) #9
  %.not110 = icmp eq i32 %18, 0
  br i1 %.not110, label %19, label %24

19:                                               ; preds = %.preheader120
  %20 = load ptr, ptr @usage, align 8, !tbaa !5
  %21 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, 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.3, ptr noundef %22)
  br label %129

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

26:                                               ; preds = %24
  %27 = icmp eq i32 %.085.in178, 2
  br i1 %27, label %83, label %28

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

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.6, ptr noundef %8, ptr noundef %30, ptr noundef %36) #8
  br label %129

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

40:                                               ; preds = %38
  %41 = icmp eq i32 %.085.in178, 2
  br i1 %41, label %83, label %42

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

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

47:                                               ; preds = %45
  %48 = icmp eq i32 %.085.in178, 2
  br i1 %48, label %83, label %49

49:                                               ; preds = %47
  %50 = getelementptr inbounds i8, ptr %.088177, i64 8
  %51 = load ptr, ptr %50, align 8, !tbaa !5
  br label %86

52:                                               ; preds = %45
  %53 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %17, ptr noundef nonnull dereferenceable(1) @.str.9) #9
  %.not115 = icmp eq i32 %53, 0
  br i1 %.not115, label %54, label %66

54:                                               ; preds = %52
  %55 = icmp eq i32 %.085.in178, 2
  br i1 %55, label %83, label %56

56:                                               ; preds = %54
  %57 = getelementptr inbounds i8, ptr %.088177, i64 8
  %58 = load ptr, ptr %57, align 8, !tbaa !5
  %59 = tail call noalias ptr @fopen(ptr noundef %58, ptr noundef nonnull @.str.5)
  %.not116 = icmp eq ptr %59, null
  br i1 %.not116, label %60, label %86

60:                                               ; preds = %56
  %61 = load ptr, ptr @stderr, align 8, !tbaa !5
  %62 = tail call ptr @__errno_location() #10
  %63 = load i32, ptr %62, align 4, !tbaa !9
  %64 = tail call ptr @strerror(i32 noundef %63) #7
  %65 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %61, ptr noundef nonnull @.str.6, ptr noundef %8, ptr noundef %58, ptr noundef %64) #8
  br label %129

66:                                               ; preds = %52
  %67 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %17, ptr noundef nonnull dereferenceable(1) @.str.10) #9
  %.not117 = icmp eq i32 %67, 0
  br i1 %.not117, label %68, label %80

68:                                               ; preds = %66
  %69 = icmp eq i32 %.085.in178, 2
  br i1 %69, label %83, label %70

70:                                               ; preds = %68
  %71 = getelementptr inbounds i8, ptr %.088177, i64 8
  %72 = load ptr, ptr %71, align 8, !tbaa !5
  %73 = tail call noalias ptr @fopen(ptr noundef %72, ptr noundef nonnull @.str.11)
  %.not118 = icmp eq ptr %73, null
  br i1 %.not118, label %74, label %86

74:                                               ; preds = %70
  %75 = load ptr, ptr @stderr, align 8, !tbaa !5
  %76 = tail call ptr @__errno_location() #10
  %77 = load i32, ptr %76, align 4, !tbaa !9
  %78 = tail call ptr @strerror(i32 noundef %77) #7
  %79 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %75, ptr noundef nonnull @.str.6, ptr noundef %8, ptr noundef %72, ptr noundef %78) #8
  br label %129

80:                                               ; preds = %66
  %81 = load ptr, ptr @stderr, align 8, !tbaa !5
  %82 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %81, ptr noundef nonnull @.str.12, ptr noundef %8, ptr noundef %17) #8
  br label %129

83:                                               ; preds = %68, %54, %47, %40, %26
  %84 = load ptr, ptr @stderr, align 8, !tbaa !5
  %85 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %84, ptr noundef nonnull @.str.13, ptr noundef %8, ptr noundef %17) #8
  br label %129

86:                                               ; preds = %28, %49, %70, %56, %42
  %.184 = phi ptr [ %.083179, %70 ], [ %.083179, %56 ], [ %.083179, %49 ], [ %.083179, %42 ], [ %30, %28 ]
  %.182 = phi ptr [ %.081180, %70 ], [ %.081180, %56 ], [ %.081180, %49 ], [ %44, %42 ], [ %.081180, %28 ]
  %.180 = phi ptr [ %.079181, %70 ], [ %.079181, %56 ], [ %51, %49 ], [ %.079181, %42 ], [ %.079181, %28 ]
  %.177 = phi ptr [ %.076182, %70 ], [ %58, %56 ], [ %.076182, %49 ], [ %.076182, %42 ], [ %.076182, %28 ]
  %.174 = phi ptr [ %72, %70 ], [ %.073183, %56 ], [ %.073183, %49 ], [ %.073183, %42 ], [ %.073183, %28 ]
  %.171 = phi ptr [ %.070184, %70 ], [ %.070184, %56 ], [ %.070184, %49 ], [ %.070184, %42 ], [ %31, %28 ]
  %.168 = phi ptr [ %.067185, %70 ], [ %59, %56 ], [ %.067185, %49 ], [ %.067185, %42 ], [ %.067185, %28 ]
  %.1 = phi ptr [ %73, %70 ], [ %.066186, %56 ], [ %.066186, %49 ], [ %.066186, %42 ], [ %.066186, %28 ]
  %.186 = add nsw i32 %.085.in178, -2
  %87 = getelementptr inbounds i8, ptr %.088177, i64 16
  %88 = icmp sgt i32 %.085.in178, 3
  br i1 %88, label %.preheader120, label %89, !llvm.loop !11

89:                                               ; preds = %86
  %.not = icmp eq ptr %.184, null
  br i1 %.not, label %90, label %93

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

93:                                               ; preds = %89
  %.not103 = icmp eq ptr %.182, null
  br i1 %.not103, label %94, label %97

94:                                               ; preds = %93
  %95 = load ptr, ptr @stderr, align 8, !tbaa !5
  %96 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %95, ptr noundef nonnull @.str.15, ptr noundef %8) #8
  br label %129

97:                                               ; preds = %93
  %98 = call i32 @sm2_private_key_info_decrypt_from_pem(ptr noundef nonnull %3, ptr noundef nonnull %.182, ptr noundef %.171) #7
  %.not104 = icmp eq i32 %98, 1
  br i1 %.not104, label %102, label %99

99:                                               ; preds = %97
  %100 = load ptr, ptr @stderr, align 8, !tbaa !5
  %101 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %100, ptr noundef nonnull @.str.16, ptr noundef %8) #8
  br label %129

102:                                              ; preds = %97
  %103 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %.180) #9
  %104 = call i32 @sm2_sign_init(ptr noundef nonnull %4, ptr noundef nonnull %3, ptr noundef %.180, i64 noundef %103) #7
  %.not105 = icmp eq i32 %104, 1
  br i1 %.not105, label %.preheader, label %105

105:                                              ; preds = %102
  %106 = load ptr, ptr @stderr, align 8, !tbaa !5
  %107 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %106, ptr noundef nonnull @.str.17, ptr noundef %8) #8
  br label %129

.preheader:                                       ; preds = %102, %109
  %108 = call i64 @fread(ptr noundef nonnull %5, i64 noundef 1, i64 noundef 4096, ptr noundef %.168)
  %.not106 = icmp eq i64 %108, 0
  br i1 %.not106, label %114, label %109

109:                                              ; preds = %.preheader
  %110 = call i32 @sm2_sign_update(ptr noundef nonnull %4, ptr noundef nonnull %5, i64 noundef %108) #7
  %.not109 = icmp eq i32 %110, 1
  br i1 %.not109, label %.preheader, label %111, !llvm.loop !13

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 %129

114:                                              ; preds = %.preheader
  %115 = call i32 @sm2_sign_finish(ptr noundef nonnull %4, ptr noundef nonnull %6, ptr noundef nonnull %7) #7
  %.not107 = icmp eq i32 %115, 1
  br i1 %.not107, 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.17, ptr noundef %8) #8
  br label %129

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

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

129:                                              ; preds = %119, %123, %116, %111, %105, %99, %94, %90, %83, %80, %74, %60, %32, %19
  %.087 = phi i32 [ 1, %80 ], [ 1, %83 ], [ 1, %74 ], [ 1, %60 ], [ 1, %32 ], [ 0, %19 ], [ 1, %99 ], [ 1, %105 ], [ 1, %111 ], [ 1, %116 ], [ 1, %123 ], [ 1, %94 ], [ 1, %90 ], [ 0, %119 ]
  %.278 = phi ptr [ %.076182, %80 ], [ %.076182, %83 ], [ %.076182, %74 ], [ %58, %60 ], [ %.076182, %32 ], [ %.076182, %19 ], [ %.177, %99 ], [ %.177, %105 ], [ %.177, %111 ], [ %.177, %116 ], [ %.177, %123 ], [ %.177, %94 ], [ %.177, %90 ], [ %.177, %119 ]
  %.275 = phi ptr [ %.073183, %80 ], [ %.073183, %83 ], [ %72, %74 ], [ %.073183, %60 ], [ %.073183, %32 ], [ %.073183, %19 ], [ %.174, %99 ], [ %.174, %105 ], [ %.174, %111 ], [ %.174, %116 ], [ %.174, %123 ], [ %.174, %94 ], [ %.174, %90 ], [ %.174, %119 ]
  %.272 = phi ptr [ %.070184, %80 ], [ %.070184, %83 ], [ %.070184, %74 ], [ %.070184, %60 ], [ null, %32 ], [ %.070184, %19 ], [ %.171, %99 ], [ %.171, %105 ], [ %.171, %111 ], [ %.171, %116 ], [ %.171, %123 ], [ %.171, %94 ], [ %.171, %90 ], [ %.171, %119 ]
  %.269 = phi ptr [ %.067185, %80 ], [ %.067185, %83 ], [ %.067185, %74 ], [ null, %60 ], [ %.067185, %32 ], [ %.067185, %19 ], [ %.168, %99 ], [ %.168, %105 ], [ %.168, %111 ], [ %.168, %116 ], [ %.168, %123 ], [ %.168, %94 ], [ %.168, %90 ], [ %.168, %119 ]
  %.2 = phi ptr [ %.066186, %80 ], [ %.066186, %83 ], [ null, %74 ], [ %.066186, %60 ], [ %.066186, %32 ], [ %.066186, %19 ], [ %.1, %99 ], [ %.1, %105 ], [ %.1, %111 ], [ %.1, %116 ], [ %.1, %123 ], [ %.1, %94 ], [ %.1, %90 ], [ %.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 3976) #7
  %.not119 = icmp eq ptr %.272, null
  br i1 %.not119, label %132, label %130

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

132:                                              ; preds = %130, %129
  %133 = icmp ne ptr %.278, null
  %134 = icmp ne ptr %.269, null
  %or.cond = select i1 %133, i1 %134, i1 false
  br i1 %or.cond, label %135, label %137

135:                                              ; preds = %132
  %136 = call i32 @fclose(ptr noundef nonnull %.269)
  br label %137

137:                                              ; preds = %135, %132
  %138 = icmp ne ptr %.275, null
  %139 = icmp ne ptr %.2, null
  %or.cond3 = select i1 %138, i1 %139, i1 false
  br i1 %or.cond3, label %140, label %142

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

142:                                              ; preds = %137, %140, %13
  %.0 = phi i32 [ 1, %13 ], [ %.087, %140 ], [ %.087, %137 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #7
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 4096, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 3976, 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

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

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

; 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_sign_update(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #6

declare i32 @sm2_sign_finish(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 = distinct !{!13, !12}
!14 = !{!15, !15, i64 0}
!15 = !{!"long", !7, i64 0}


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