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

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

@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 [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [32 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 [3 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [66 x i8], align 1
@__FUNCTION__.sdfdecrypt_main = external hidden unnamed_addr constant [16 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [31 x i8], align 1

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

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

43:                                               ; preds = %2
  br label %44

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

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

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

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

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

67:                                               ; preds = %63
  br label %167

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

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

77:                                               ; preds = %72
  %78 = load i32, ptr %4, align 4, !tbaa !5
  %79 = add nsw i32 %78, -1
  store i32 %79, ptr %4, align 4, !tbaa !5
  %80 = icmp slt i32 %79, 1
  br i1 %80, label %81, label %82

81:                                               ; preds = %77
  br label %167

82:                                               ; preds = %77
  %83 = load ptr, ptr %5, align 8, !tbaa !9
  %84 = getelementptr inbounds ptr, ptr %83, i32 1
  store ptr %84, ptr %5, align 8, !tbaa !9
  %85 = load ptr, ptr %84, align 8, !tbaa !9
  %86 = call i32 @atoi(ptr noundef %85) #10
  store i32 %86, ptr %9, align 4, !tbaa !5
  %87 = load i32, ptr %9, align 4, !tbaa !5
  %88 = icmp slt i32 %87, 0
  br i1 %88, label %89, label %94

89:                                               ; preds = %82
  %90 = load ptr, ptr @stderr, align 8, !tbaa !9
  %91 = load ptr, ptr %7, align 8, !tbaa !9
  %92 = load i32, ptr %9, align 4, !tbaa !5
  %93 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %90, ptr noundef @.str.5, ptr noundef %91, i32 noundef %92) #9
  br label %373

94:                                               ; preds = %82
  br label %176

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

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

104:                                              ; preds = %100
  br label %167

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

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

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

118:                                              ; preds = %114
  br label %167

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

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

134:                                              ; preds = %119
  br label %174

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

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

144:                                              ; preds = %140
  br label %167

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

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

160:                                              ; preds = %145
  br label %173

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

167:                                              ; preds = %144, %118, %104, %81, %67
  %168 = load ptr, ptr @stderr, align 8, !tbaa !9
  %169 = load ptr, ptr %7, align 8, !tbaa !9
  %170 = load ptr, ptr %5, align 8, !tbaa !9
  %171 = load ptr, ptr %170, align 8, !tbaa !9
  %172 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %168, ptr noundef @.str.13, ptr noundef %169, ptr noundef %171) #9
  br label %373

173:                                              ; preds = %160
  br label %174

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

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

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

177:                                              ; preds = %176, %68
  br label %178

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

183:                                              ; preds = %44
  %184 = load ptr, ptr %8, align 8, !tbaa !9
  %185 = icmp ne ptr %184, null
  br i1 %185, label %190, label %186

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

190:                                              ; preds = %183
  %191 = load ptr, ptr %8, align 8, !tbaa !9
  %192 = call i32 @sdf_load_library(ptr noundef %191, ptr noundef null)
  %193 = icmp ne i32 %192, 1
  br i1 %193, label %194, label %198

194:                                              ; preds = %190
  %195 = load ptr, ptr @stderr, align 8, !tbaa !9
  %196 = load ptr, ptr %7, align 8, !tbaa !9
  %197 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %195, ptr noundef @.str.15, ptr noundef %196) #9
  br label %373

198:                                              ; preds = %190
  %199 = call i32 @sdf_open_device(ptr noundef %19)
  %200 = icmp ne i32 %199, 1
  br i1 %200, label %201, label %205

201:                                              ; preds = %198
  %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) #9
  br label %373

205:                                              ; preds = %198
  %206 = load i32, ptr %9, align 4, !tbaa !5
  %207 = icmp slt i32 %206, 0
  br i1 %207, label %208, label %212

208:                                              ; preds = %205
  %209 = load ptr, ptr @stderr, align 8, !tbaa !9
  %210 = load ptr, ptr %7, align 8, !tbaa !9
  %211 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %209, ptr noundef @.str.17, ptr noundef %210) #9
  br label %373

212:                                              ; preds = %205
  %213 = load ptr, ptr %10, align 8, !tbaa !9
  %214 = icmp ne ptr %213, null
  br i1 %214, label %219, label %215

215:                                              ; preds = %212
  %216 = load ptr, ptr @stderr, align 8, !tbaa !9
  %217 = load ptr, ptr %7, align 8, !tbaa !9
  %218 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %216, ptr noundef @.str.18, ptr noundef %217) #9
  br label %373

219:                                              ; preds = %212
  %220 = getelementptr inbounds [4096 x i8], ptr %16, i64 0, i64 0
  %221 = load ptr, ptr %13, align 8, !tbaa !9
  %222 = call i64 @fread(ptr noundef %220, i64 noundef 1, i64 noundef 4096, ptr noundef %221)
  store i64 %222, ptr %17, align 8, !tbaa !13
  %223 = icmp ule i64 %222, 0
  br i1 %223, label %224, label %231

224:                                              ; preds = %219
  %225 = load ptr, ptr @stderr, align 8, !tbaa !9
  %226 = load ptr, ptr %7, align 8, !tbaa !9
  %227 = call ptr @__errno_location() #11
  %228 = load i32, ptr %227, align 4, !tbaa !5
  %229 = call ptr @strerror(i32 noundef %228) #9
  %230 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %225, ptr noundef @.str.19, ptr noundef %226, ptr noundef %229) #9
  br label %373

231:                                              ; preds = %219
  %232 = load i64, ptr %17, align 8, !tbaa !13
  store i64 %232, ptr %25, align 8, !tbaa !13
  %233 = getelementptr inbounds [4096 x i8], ptr %16, i64 0, i64 0
  store ptr %233, ptr %22, align 8, !tbaa !9
  %234 = call i32 @sm2_ciphertext_from_der(ptr noundef %23, ptr noundef %22, ptr noundef %17)
  %235 = icmp ne i32 %234, 1
  br i1 %235, label %236, label %242

236:                                              ; preds = %231
  br label %237

237:                                              ; preds = %236
  %238 = load ptr, ptr @stderr, align 8, !tbaa !9
  %239 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %238, ptr noundef @.str.20, ptr noundef @.str.21, i32 noundef 157, ptr noundef @__FUNCTION__.sdfdecrypt_main) #9
  br label %240

240:                                              ; preds = %237
  br label %241

241:                                              ; preds = %240
  br label %373

242:                                              ; preds = %231
  %243 = load i64, ptr %17, align 8, !tbaa !13
  %244 = load i64, ptr %25, align 8, !tbaa !13
  %245 = sub i64 %244, %243
  store i64 %245, ptr %25, align 8, !tbaa !13
  %246 = load i64, ptr %17, align 8, !tbaa !13
  %247 = icmp uge i64 %246, 16
  br i1 %247, label %248, label %255

248:                                              ; preds = %242
  %249 = getelementptr inbounds [16 x i8], ptr %15, i64 0, i64 0
  %250 = load ptr, ptr %22, align 8, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %249, ptr align 1 %250, i64 16, i1 false)
  %251 = load ptr, ptr %22, align 8, !tbaa !9
  %252 = getelementptr inbounds i8, ptr %251, i64 16
  store ptr %252, ptr %22, align 8, !tbaa !9
  %253 = load i64, ptr %17, align 8, !tbaa !13
  %254 = sub i64 %253, 16
  store i64 %254, ptr %17, align 8, !tbaa !13
  br label %276

255:                                              ; preds = %242
  %256 = getelementptr inbounds [16 x i8], ptr %15, i64 0, i64 0
  %257 = load ptr, ptr %22, align 8, !tbaa !9
  %258 = load i64, ptr %17, align 8, !tbaa !13
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %256, ptr align 1 %257, i64 %258, i1 false)
  %259 = getelementptr inbounds [16 x i8], ptr %15, i64 0, i64 0
  %260 = load i64, ptr %17, align 8, !tbaa !13
  %261 = getelementptr inbounds i8, ptr %259, i64 %260
  %262 = load i64, ptr %17, align 8, !tbaa !13
  %263 = sub i64 16, %262
  %264 = load ptr, ptr %13, align 8, !tbaa !9
  %265 = call i64 @fread(ptr noundef %261, i64 noundef 1, i64 noundef %263, ptr noundef %264)
  %266 = load i64, ptr %17, align 8, !tbaa !13
  %267 = sub i64 16, %266
  %268 = icmp ne i64 %265, %267
  br i1 %268, label %269, label %275

269:                                              ; preds = %255
  br label %270

270:                                              ; preds = %269
  %271 = load ptr, ptr @stderr, align 8, !tbaa !9
  %272 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %271, ptr noundef @.str.20, ptr noundef @.str.21, i32 noundef 170, ptr noundef @__FUNCTION__.sdfdecrypt_main) #9
  br label %273

273:                                              ; preds = %270
  br label %274

274:                                              ; preds = %273
  br label %373

275:                                              ; preds = %255
  store i64 0, ptr %17, align 8, !tbaa !13
  br label %276

276:                                              ; preds = %275, %248
  %277 = load i32, ptr %9, align 4, !tbaa !5
  %278 = load ptr, ptr %10, align 8, !tbaa !9
  %279 = getelementptr inbounds [4096 x i8], ptr %16, i64 0, i64 0
  %280 = load i64, ptr %25, align 8, !tbaa !13
  %281 = call i32 @sdf_import_key(ptr noundef %19, i32 noundef %277, ptr noundef %278, ptr noundef %279, i64 noundef %280, ptr noundef %20)
  %282 = icmp ne i32 %281, 1
  br i1 %282, label %283, label %289

283:                                              ; preds = %276
  br label %284

284:                                              ; preds = %283
  %285 = load ptr, ptr @stderr, align 8, !tbaa !9
  %286 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %285, ptr noundef @.str.20, ptr noundef @.str.21, i32 noundef 178, ptr noundef @__FUNCTION__.sdfdecrypt_main) #9
  br label %287

287:                                              ; preds = %284
  br label %288

288:                                              ; preds = %287
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %26, align 4
  br label %396

289:                                              ; preds = %276
  %290 = getelementptr inbounds [16 x i8], ptr %15, i64 0, i64 0
  %291 = call i32 @sdf_cbc_decrypt_init(ptr noundef %21, ptr noundef %20, ptr noundef %290)
  %292 = icmp ne i32 %291, 1
  br i1 %292, label %293, label %299

293:                                              ; preds = %289
  br label %294

294:                                              ; preds = %293
  %295 = load ptr, ptr @stderr, align 8, !tbaa !9
  %296 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %295, ptr noundef @.str.20, ptr noundef @.str.21, i32 noundef 184, ptr noundef @__FUNCTION__.sdfdecrypt_main) #9
  br label %297

297:                                              ; preds = %294
  br label %298

298:                                              ; preds = %297
  br label %373

299:                                              ; preds = %289
  %300 = load i64, ptr %17, align 8, !tbaa !13
  %301 = icmp ne i64 %300, 0
  br i1 %301, label %302, label %315

302:                                              ; preds = %299
  %303 = load ptr, ptr %22, align 8, !tbaa !9
  %304 = load i64, ptr %17, align 8, !tbaa !13
  %305 = getelementptr inbounds [4096 x i8], ptr %16, i64 0, i64 0
  %306 = call i32 @sdf_cbc_decrypt_update(ptr noundef %21, ptr noundef %303, i64 noundef %304, ptr noundef %305, ptr noundef %18)
  %307 = icmp ne i32 %306, 1
  br i1 %307, label %308, label %314

308:                                              ; preds = %302
  br label %309

309:                                              ; preds = %308
  %310 = load ptr, ptr @stderr, align 8, !tbaa !9
  %311 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %310, ptr noundef @.str.20, ptr noundef @.str.21, i32 noundef 189, ptr noundef @__FUNCTION__.sdfdecrypt_main) #9
  br label %312

312:                                              ; preds = %309
  br label %313

313:                                              ; preds = %312
  br label %373

314:                                              ; preds = %302
  br label %315

315:                                              ; preds = %314, %299
  br label %316

316:                                              ; preds = %347, %315
  %317 = getelementptr inbounds [4096 x i8], ptr %16, i64 0, i64 0
  %318 = load ptr, ptr %13, align 8, !tbaa !9
  %319 = call i64 @fread(ptr noundef %317, i64 noundef 1, i64 noundef 4096, ptr noundef %318)
  store i64 %319, ptr %17, align 8, !tbaa !13
  %320 = icmp ugt i64 %319, 0
  br i1 %320, label %321, label %348

321:                                              ; preds = %316
  %322 = getelementptr inbounds [4096 x i8], ptr %16, i64 0, i64 0
  %323 = load i64, ptr %17, align 8, !tbaa !13
  %324 = getelementptr inbounds [4096 x i8], ptr %16, i64 0, i64 0
  %325 = call i32 @sdf_cbc_decrypt_update(ptr noundef %21, ptr noundef %322, i64 noundef %323, ptr noundef %324, ptr noundef %18)
  %326 = icmp ne i32 %325, 1
  br i1 %326, label %327, label %333

327:                                              ; preds = %321
  br label %328

328:                                              ; preds = %327
  %329 = load ptr, ptr @stderr, align 8, !tbaa !9
  %330 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %329, ptr noundef @.str.20, ptr noundef @.str.21, i32 noundef 195, ptr noundef @__FUNCTION__.sdfdecrypt_main) #9
  br label %331

331:                                              ; preds = %328
  br label %332

332:                                              ; preds = %331
  br label %373

333:                                              ; preds = %321
  %334 = getelementptr inbounds [4096 x i8], ptr %16, i64 0, i64 0
  %335 = load i64, ptr %18, align 8, !tbaa !13
  %336 = load ptr, ptr %14, align 8, !tbaa !9
  %337 = call i64 @fwrite(ptr noundef %334, i64 noundef 1, i64 noundef %335, ptr noundef %336)
  %338 = load i64, ptr %18, align 8, !tbaa !13
  %339 = icmp ne i64 %337, %338
  br i1 %339, label %340, label %347

340:                                              ; preds = %333
  %341 = load ptr, ptr @stderr, align 8, !tbaa !9
  %342 = load ptr, ptr %7, align 8, !tbaa !9
  %343 = call ptr @__errno_location() #11
  %344 = load i32, ptr %343, align 4, !tbaa !5
  %345 = call ptr @strerror(i32 noundef %344) #9
  %346 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %341, ptr noundef @.str.22, ptr noundef %342, ptr noundef %345) #9
  br label %373

347:                                              ; preds = %333
  br label %316, !llvm.loop !15

348:                                              ; preds = %316
  %349 = getelementptr inbounds [4096 x i8], ptr %16, i64 0, i64 0
  %350 = call i32 @sdf_cbc_decrypt_finish(ptr noundef %21, ptr noundef %349, ptr noundef %18)
  %351 = icmp ne i32 %350, 1
  br i1 %351, label %352, label %358

352:                                              ; preds = %348
  br label %353

353:                                              ; preds = %352
  %354 = load ptr, ptr @stderr, align 8, !tbaa !9
  %355 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %354, ptr noundef @.str.20, ptr noundef @.str.21, i32 noundef 204, ptr noundef @__FUNCTION__.sdfdecrypt_main) #9
  br label %356

356:                                              ; preds = %353
  br label %357

357:                                              ; preds = %356
  br label %373

358:                                              ; preds = %348
  %359 = getelementptr inbounds [4096 x i8], ptr %16, i64 0, i64 0
  %360 = load i64, ptr %18, align 8, !tbaa !13
  %361 = load ptr, ptr %14, align 8, !tbaa !9
  %362 = call i64 @fwrite(ptr noundef %359, i64 noundef 1, i64 noundef %360, ptr noundef %361)
  %363 = load i64, ptr %18, align 8, !tbaa !13
  %364 = icmp ne i64 %362, %363
  br i1 %364, label %365, label %372

365:                                              ; preds = %358
  %366 = load ptr, ptr @stderr, align 8, !tbaa !9
  %367 = load ptr, ptr %7, align 8, !tbaa !9
  %368 = call ptr @__errno_location() #11
  %369 = load i32, ptr %368, align 4, !tbaa !5
  %370 = call ptr @strerror(i32 noundef %369) #9
  %371 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %366, ptr noundef @.str.22, ptr noundef %367, ptr noundef %370) #9
  br label %373

372:                                              ; preds = %358
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %373

373:                                              ; preds = %372, %365, %357, %340, %332, %313, %298, %274, %241, %224, %215, %208, %201, %194, %186, %167, %161, %152, %126, %89, %52
  %374 = call i32 @sdf_destroy_key(ptr noundef %20)
  %375 = call i32 @sdf_close_device(ptr noundef %19)
  call void @sdf_unload_library()
  %376 = getelementptr inbounds [16 x i8], ptr %15, i64 0, i64 0
  call void @gmssl_secure_clear(ptr noundef %376, i64 noundef 16)
  call void @gmssl_secure_clear(ptr noundef %21, i64 noundef 56)
  %377 = load ptr, ptr %11, align 8, !tbaa !9
  %378 = icmp ne ptr %377, null
  br i1 %378, label %379, label %385

379:                                              ; preds = %373
  %380 = load ptr, ptr %13, align 8, !tbaa !9
  %381 = icmp ne ptr %380, null
  br i1 %381, label %382, label %385

382:                                              ; preds = %379
  %383 = load ptr, ptr %13, align 8, !tbaa !9
  %384 = call i32 @fclose(ptr noundef %383)
  br label %385

385:                                              ; preds = %382, %379, %373
  %386 = load ptr, ptr %12, align 8, !tbaa !9
  %387 = icmp ne ptr %386, null
  br i1 %387, label %388, label %394

388:                                              ; preds = %385
  %389 = load ptr, ptr %14, align 8, !tbaa !9
  %390 = icmp ne ptr %389, null
  br i1 %390, label %391, label %394

391:                                              ; preds = %388
  %392 = load ptr, ptr %14, align 8, !tbaa !9
  %393 = call i32 @fclose(ptr noundef %392)
  br label %394

394:                                              ; preds = %391, %388, %385
  %395 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %395, ptr %3, align 4
  store i32 1, ptr %26, align 4
  br label %396

396:                                              ; preds = %394, %288, %38
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #9
  call void @llvm.lifetime.end.p0(i64 352, ptr %23) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #9
  call void @llvm.lifetime.end.p0(i64 56, ptr %21) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr %20) #9
  call void @llvm.lifetime.end.p0(i64 88, ptr %19) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #9
  call void @llvm.lifetime.end.p0(i64 4096, ptr %16) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr %15) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #9
  %397 = load i32, ptr %3, align 4
  ret i32 %397
}

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

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

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

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

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

; Function Attrs: inlinehint nounwind willreturn memory(read) uwtable
declare i32 @atoi(ptr noundef nonnull) #6

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

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

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

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

declare i32 @sdf_open_device(ptr noundef) #5

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #8

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

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

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

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

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

declare i32 @sdf_destroy_key(ptr noundef) #5

declare i32 @sdf_close_device(ptr noundef) #5

declare void @sdf_unload_library() #5

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

declare i32 @fclose(ptr noundef) #5

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

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind willreturn memory(read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { inlinehint nounwind willreturn memory(read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nounwind 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 #8 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #9 = { nounwind }
attributes #10 = { nounwind willreturn memory(read) }
attributes #11 = { nounwind willreturn memory(none) }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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.SDF_DEVICE = type { ptr, [41 x i8], [17 x i8], [17 x i8] }
%struct.SDF_KEY = type { ptr, ptr }
%struct.SDF_CBC_CTX = type { %struct.SDF_KEY, [16 x i8], [16 x i8], i64 }
%struct.SM2_CIPHERTEXT = type { %struct.SM2_POINT, [32 x i8], i8, [255 x i8] }
%struct.SM2_POINT = type { [32 x i8], [32 x i8] }

@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 [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [32 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 [3 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [66 x i8], align 1
@__FUNCTION__.sdfdecrypt_main = external hidden unnamed_addr constant [16 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [31 x i8], align 1

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

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

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

.preheader:                                       ; preds = %.preheader.preheader, %88
  %.069186 = phi ptr [ %.1, %88 ], [ %14, %.preheader.preheader ]
  %.070185 = phi ptr [ %.171, %88 ], [ %13, %.preheader.preheader ]
  %.073184 = phi ptr [ %.174, %88 ], [ null, %.preheader.preheader ]
  %.076183 = phi ptr [ %.177, %88 ], [ null, %.preheader.preheader ]
  %.079182 = phi ptr [ %.180, %88 ], [ null, %.preheader.preheader ]
  %.081181 = phi i32 [ %.182, %88 ], [ -1, %.preheader.preheader ]
  %.083180 = phi ptr [ %.184, %88 ], [ null, %.preheader.preheader ]
  %.085.in179 = phi i32 [ %.186, %88 ], [ %0, %.preheader.preheader ]
  %.088178 = phi ptr [ %89, %88 ], [ %16, %.preheader.preheader ]
  %21 = load ptr, ptr %.088178, align 8, !tbaa !5
  %22 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %21, ptr noundef nonnull dereferenceable(1) @.str.1) #12
  %.not120 = icmp eq i32 %22, 0
  br i1 %.not120, label %23, label %28

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

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

30:                                               ; preds = %28
  %31 = icmp eq i32 %.085.in179, 2
  br i1 %31, label %85, label %32

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

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

37:                                               ; preds = %35
  %38 = icmp eq i32 %.085.in179, 2
  br i1 %38, label %85, label %39

39:                                               ; preds = %37
  %40 = getelementptr inbounds i8, ptr %.088178, i64 8
  %41 = load ptr, ptr %40, align 8, !tbaa !5
  %42 = tail call i32 @atoi(ptr nocapture noundef %41) #12
  %43 = icmp slt i32 %42, 0
  br i1 %43, label %44, label %88

44:                                               ; preds = %39
  %45 = load ptr, ptr @stderr, align 8, !tbaa !5
  %46 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %45, ptr noundef nonnull @.str.5, ptr noundef %12, i32 noundef %42) #11
  br label %195

47:                                               ; preds = %35
  %48 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %21, ptr noundef nonnull dereferenceable(1) @.str.6) #12
  %.not123 = icmp eq i32 %48, 0
  br i1 %.not123, label %49, label %54

49:                                               ; preds = %47
  %50 = icmp eq i32 %.085.in179, 2
  br i1 %50, label %85, label %51

51:                                               ; preds = %49
  %52 = getelementptr inbounds i8, ptr %.088178, i64 8
  %53 = load ptr, ptr %52, align 8, !tbaa !5
  br label %88

54:                                               ; preds = %47
  %55 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %21, ptr noundef nonnull dereferenceable(1) @.str.7) #12
  %.not124 = icmp eq i32 %55, 0
  br i1 %.not124, label %56, label %68

56:                                               ; preds = %54
  %57 = icmp eq i32 %.085.in179, 2
  br i1 %57, label %85, label %58

58:                                               ; preds = %56
  %59 = getelementptr inbounds i8, ptr %.088178, i64 8
  %60 = load ptr, ptr %59, align 8, !tbaa !5
  %61 = tail call noalias ptr @fopen(ptr noundef %60, ptr noundef nonnull @.str.8)
  %.not125 = icmp eq ptr %61, null
  br i1 %.not125, label %62, label %88

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

68:                                               ; preds = %54
  %69 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %21, ptr noundef nonnull dereferenceable(1) @.str.10) #12
  %.not126 = icmp eq i32 %69, 0
  br i1 %.not126, label %70, label %82

70:                                               ; preds = %68
  %71 = icmp eq i32 %.085.in179, 2
  br i1 %71, label %85, label %72

72:                                               ; preds = %70
  %73 = getelementptr inbounds i8, ptr %.088178, i64 8
  %74 = load ptr, ptr %73, align 8, !tbaa !5
  %75 = tail call noalias ptr @fopen(ptr noundef %74, ptr noundef nonnull @.str.11)
  %.not127 = icmp eq ptr %75, null
  br i1 %.not127, label %76, label %88

76:                                               ; preds = %72
  %77 = load ptr, ptr @stderr, align 8, !tbaa !5
  %78 = tail call ptr @__errno_location() #13
  %79 = load i32, ptr %78, align 4, !tbaa !9
  %80 = tail call ptr @strerror(i32 noundef %79) #10
  %81 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %77, ptr noundef nonnull @.str.9, ptr noundef %12, ptr noundef %74, ptr noundef %80) #11
  br label %195

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

85:                                               ; preds = %70, %56, %49, %37, %30
  %86 = load ptr, ptr @stderr, align 8, !tbaa !5
  %87 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %86, ptr noundef nonnull @.str.13, ptr noundef %12, ptr noundef %21) #11
  br label %195

88:                                               ; preds = %32, %51, %72, %58, %39
  %.184 = phi ptr [ %.083180, %72 ], [ %.083180, %58 ], [ %.083180, %51 ], [ %.083180, %39 ], [ %34, %32 ]
  %.182 = phi i32 [ %.081181, %72 ], [ %.081181, %58 ], [ %.081181, %51 ], [ %42, %39 ], [ %.081181, %32 ]
  %.180 = phi ptr [ %.079182, %72 ], [ %.079182, %58 ], [ %53, %51 ], [ %.079182, %39 ], [ %.079182, %32 ]
  %.177 = phi ptr [ %.076183, %72 ], [ %60, %58 ], [ %.076183, %51 ], [ %.076183, %39 ], [ %.076183, %32 ]
  %.174 = phi ptr [ %74, %72 ], [ %.073184, %58 ], [ %.073184, %51 ], [ %.073184, %39 ], [ %.073184, %32 ]
  %.171 = phi ptr [ %.070185, %72 ], [ %61, %58 ], [ %.070185, %51 ], [ %.070185, %39 ], [ %.070185, %32 ]
  %.1 = phi ptr [ %75, %72 ], [ %.069186, %58 ], [ %.069186, %51 ], [ %.069186, %39 ], [ %.069186, %32 ]
  %.186 = add nsw i32 %.085.in179, -2
  %89 = getelementptr inbounds i8, ptr %.088178, i64 16
  %90 = icmp sgt i32 %.085.in179, 3
  br i1 %90, label %.preheader, label %91, !llvm.loop !11

91:                                               ; preds = %88
  %.not = icmp eq ptr %.184, null
  br i1 %.not, label %92, label %95

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

95:                                               ; preds = %91
  %96 = tail call i32 @sdf_load_library(ptr noundef nonnull %.184, ptr noundef null) #10
  %.not106 = icmp eq i32 %96, 1
  br i1 %.not106, label %100, label %97

97:                                               ; preds = %95
  %98 = load ptr, ptr @stderr, align 8, !tbaa !5
  %99 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %98, ptr noundef nonnull @.str.15, ptr noundef %12) #11
  br label %195

100:                                              ; preds = %95
  %101 = call i32 @sdf_open_device(ptr noundef nonnull %7) #10
  %.not107 = icmp eq i32 %101, 1
  br i1 %.not107, label %105, label %102

102:                                              ; preds = %100
  %103 = load ptr, ptr @stderr, align 8, !tbaa !5
  %104 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %103, ptr noundef nonnull @.str.16, ptr noundef %12) #11
  br label %195

105:                                              ; preds = %100
  %106 = icmp slt i32 %.182, 0
  br i1 %106, label %107, label %110

107:                                              ; preds = %105
  %108 = load ptr, ptr @stderr, align 8, !tbaa !5
  %109 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %108, ptr noundef nonnull @.str.17, ptr noundef %12) #11
  br label %195

110:                                              ; preds = %105
  %.not108 = icmp eq ptr %.180, null
  br i1 %.not108, label %111, label %114

111:                                              ; preds = %110
  %112 = load ptr, ptr @stderr, align 8, !tbaa !5
  %113 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %112, ptr noundef nonnull @.str.18, ptr noundef %12) #11
  br label %195

114:                                              ; preds = %110
  %115 = call i64 @fread(ptr noundef nonnull %4, i64 noundef 1, i64 noundef 4096, ptr noundef %.171)
  store i64 %115, ptr %5, align 8, !tbaa !13
  %116 = icmp eq i64 %115, 0
  br i1 %116, label %117, label %123

117:                                              ; preds = %114
  %118 = load ptr, ptr @stderr, align 8, !tbaa !5
  %119 = tail call ptr @__errno_location() #13
  %120 = load i32, ptr %119, align 4, !tbaa !9
  %121 = call ptr @strerror(i32 noundef %120) #10
  %122 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %118, ptr noundef nonnull @.str.19, ptr noundef %12, ptr noundef %121) #11
  br label %195

123:                                              ; preds = %114
  store ptr %4, ptr %10, align 8, !tbaa !5
  %124 = call i32 @sm2_ciphertext_from_der(ptr noundef nonnull %11, ptr noundef nonnull %10, ptr noundef nonnull %5) #10
  %.not109 = icmp eq i32 %124, 1
  br i1 %.not109, label %128, label %125

125:                                              ; preds = %123
  %126 = load ptr, ptr @stderr, align 8, !tbaa !5
  %127 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %126, ptr noundef nonnull @.str.20, ptr noundef nonnull @.str.21, i32 noundef 157, ptr noundef nonnull @__FUNCTION__.sdfdecrypt_main) #11
  br label %195

128:                                              ; preds = %123
  %129 = load i64, ptr %5, align 8, !tbaa !13
  %130 = sub i64 %115, %129
  %131 = icmp ugt i64 %129, 15
  %132 = load ptr, ptr %10, align 8, !tbaa !5
  br i1 %131, label %133, label %136

133:                                              ; preds = %128
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %3, ptr noundef nonnull align 1 dereferenceable(16) %132, i64 16, i1 false)
  %134 = getelementptr inbounds i8, ptr %132, i64 16
  store ptr %134, ptr %10, align 8, !tbaa !5
  %135 = add i64 %129, -16
  br label %145

136:                                              ; preds = %128
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %3, ptr align 1 %132, i64 %129, i1 false)
  %137 = getelementptr inbounds i8, ptr %3, i64 %129
  %138 = sub nuw nsw i64 16, %129
  %139 = call i64 @fread(ptr noundef nonnull %137, i64 noundef 1, i64 noundef %138, ptr noundef %.171)
  %140 = load i64, ptr %5, align 8, !tbaa !13
  %141 = sub i64 16, %140
  %.not110 = icmp eq i64 %139, %141
  br i1 %.not110, label %145, label %142

142:                                              ; preds = %136
  %143 = load ptr, ptr @stderr, align 8, !tbaa !5
  %144 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %143, ptr noundef nonnull @.str.20, ptr noundef nonnull @.str.21, i32 noundef 170, ptr noundef nonnull @__FUNCTION__.sdfdecrypt_main) #11
  br label %195

145:                                              ; preds = %136, %133
  %storemerge = phi i64 [ %135, %133 ], [ 0, %136 ]
  store i64 %storemerge, ptr %5, align 8, !tbaa !13
  %146 = call i32 @sdf_import_key(ptr noundef nonnull %7, i32 noundef %.182, ptr noundef nonnull %.180, ptr noundef nonnull %4, i64 noundef %130, ptr noundef nonnull %8) #10
  %.not111 = icmp eq i32 %146, 1
  br i1 %.not111, label %150, label %147

147:                                              ; preds = %145
  %148 = load ptr, ptr @stderr, align 8, !tbaa !5
  %149 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %148, ptr noundef nonnull @.str.20, ptr noundef nonnull @.str.21, i32 noundef 178, ptr noundef nonnull @__FUNCTION__.sdfdecrypt_main) #11
  br label %207

150:                                              ; preds = %145
  %151 = call i32 @sdf_cbc_decrypt_init(ptr noundef nonnull %9, ptr noundef nonnull %8, ptr noundef nonnull %3) #10
  %.not112 = icmp eq i32 %151, 1
  br i1 %.not112, label %155, label %152

152:                                              ; preds = %150
  %153 = load ptr, ptr @stderr, align 8, !tbaa !5
  %154 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %153, ptr noundef nonnull @.str.20, ptr noundef nonnull @.str.21, i32 noundef 184, ptr noundef nonnull @__FUNCTION__.sdfdecrypt_main) #11
  br label %195

155:                                              ; preds = %150
  %156 = load i64, ptr %5, align 8, !tbaa !13
  %.not113 = icmp eq i64 %156, 0
  br i1 %.not113, label %.preheader286, label %157

.preheader286:                                    ; preds = %157, %155
  br label %163

157:                                              ; preds = %155
  %158 = load ptr, ptr %10, align 8, !tbaa !5
  %159 = call i32 @sdf_cbc_decrypt_update(ptr noundef nonnull %9, ptr noundef %158, i64 noundef %156, ptr noundef nonnull %4, ptr noundef nonnull %6) #10
  %.not114 = icmp eq i32 %159, 1
  br i1 %.not114, label %.preheader286, label %160

160:                                              ; preds = %157
  %161 = load ptr, ptr @stderr, align 8, !tbaa !5
  %162 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %161, ptr noundef nonnull @.str.20, ptr noundef nonnull @.str.21, i32 noundef 189, ptr noundef nonnull @__FUNCTION__.sdfdecrypt_main) #11
  br label %195

163:                                              ; preds = %.preheader286, %170
  %164 = call i64 @fread(ptr noundef nonnull %4, i64 noundef 1, i64 noundef 4096, ptr noundef %.171)
  store i64 %164, ptr %5, align 8, !tbaa !13
  %.not115 = icmp eq i64 %164, 0
  br i1 %.not115, label %180, label %165

165:                                              ; preds = %163
  %166 = call i32 @sdf_cbc_decrypt_update(ptr noundef nonnull %9, ptr noundef nonnull %4, i64 noundef %164, ptr noundef nonnull %4, ptr noundef nonnull %6) #10
  %.not118 = icmp eq i32 %166, 1
  br i1 %.not118, label %170, label %167

167:                                              ; preds = %165
  %168 = load ptr, ptr @stderr, align 8, !tbaa !5
  %169 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %168, ptr noundef nonnull @.str.20, ptr noundef nonnull @.str.21, i32 noundef 195, ptr noundef nonnull @__FUNCTION__.sdfdecrypt_main) #11
  br label %195

170:                                              ; preds = %165
  %171 = load i64, ptr %6, align 8, !tbaa !13
  %172 = call i64 @fwrite(ptr noundef nonnull %4, i64 noundef 1, i64 noundef %171, ptr noundef %.1)
  %173 = load i64, ptr %6, align 8, !tbaa !13
  %.not119 = icmp eq i64 %172, %173
  br i1 %.not119, label %163, label %174, !llvm.loop !15

174:                                              ; preds = %170
  %175 = load ptr, ptr @stderr, align 8, !tbaa !5
  %176 = tail call ptr @__errno_location() #13
  %177 = load i32, ptr %176, align 4, !tbaa !9
  %178 = call ptr @strerror(i32 noundef %177) #10
  %179 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %175, ptr noundef nonnull @.str.22, ptr noundef %12, ptr noundef %178) #11
  br label %195

180:                                              ; preds = %163
  %181 = call i32 @sdf_cbc_decrypt_finish(ptr noundef nonnull %9, ptr noundef nonnull %4, ptr noundef nonnull %6) #10
  %.not116 = icmp eq i32 %181, 1
  br i1 %.not116, label %185, label %182

182:                                              ; preds = %180
  %183 = load ptr, ptr @stderr, align 8, !tbaa !5
  %184 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %183, ptr noundef nonnull @.str.20, ptr noundef nonnull @.str.21, i32 noundef 204, ptr noundef nonnull @__FUNCTION__.sdfdecrypt_main) #11
  br label %195

185:                                              ; preds = %180
  %186 = load i64, ptr %6, align 8, !tbaa !13
  %187 = call i64 @fwrite(ptr noundef nonnull %4, i64 noundef 1, i64 noundef %186, ptr noundef %.1)
  %188 = load i64, ptr %6, align 8, !tbaa !13
  %.not117 = icmp eq i64 %187, %188
  br i1 %.not117, label %195, label %189

189:                                              ; preds = %185
  %190 = load ptr, ptr @stderr, align 8, !tbaa !5
  %191 = tail call ptr @__errno_location() #13
  %192 = load i32, ptr %191, align 4, !tbaa !9
  %193 = call ptr @strerror(i32 noundef %192) #10
  %194 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %190, ptr noundef nonnull @.str.22, ptr noundef %12, ptr noundef %193) #11
  br label %195

195:                                              ; preds = %185, %189, %182, %174, %167, %160, %152, %142, %125, %117, %111, %107, %102, %97, %92, %85, %82, %76, %62, %44, %23
  %.087 = phi i32 [ 1, %82 ], [ 1, %85 ], [ 1, %76 ], [ 1, %62 ], [ 1, %44 ], [ 0, %23 ], [ 1, %97 ], [ 1, %102 ], [ 1, %107 ], [ 1, %117 ], [ 1, %125 ], [ 1, %152 ], [ 1, %160 ], [ 1, %167 ], [ 1, %174 ], [ 1, %182 ], [ 1, %189 ], [ 1, %142 ], [ 1, %111 ], [ 1, %92 ], [ 0, %185 ]
  %.278 = phi ptr [ %.076183, %82 ], [ %.076183, %85 ], [ %.076183, %76 ], [ %60, %62 ], [ %.076183, %44 ], [ %.076183, %23 ], [ %.177, %97 ], [ %.177, %102 ], [ %.177, %107 ], [ %.177, %117 ], [ %.177, %125 ], [ %.177, %152 ], [ %.177, %160 ], [ %.177, %167 ], [ %.177, %174 ], [ %.177, %182 ], [ %.177, %189 ], [ %.177, %142 ], [ %.177, %111 ], [ %.177, %92 ], [ %.177, %185 ]
  %.275 = phi ptr [ %.073184, %82 ], [ %.073184, %85 ], [ %74, %76 ], [ %.073184, %62 ], [ %.073184, %44 ], [ %.073184, %23 ], [ %.174, %97 ], [ %.174, %102 ], [ %.174, %107 ], [ %.174, %117 ], [ %.174, %125 ], [ %.174, %152 ], [ %.174, %160 ], [ %.174, %167 ], [ %.174, %174 ], [ %.174, %182 ], [ %.174, %189 ], [ %.174, %142 ], [ %.174, %111 ], [ %.174, %92 ], [ %.174, %185 ]
  %.272 = phi ptr [ %.070185, %82 ], [ %.070185, %85 ], [ %.070185, %76 ], [ null, %62 ], [ %.070185, %44 ], [ %.070185, %23 ], [ %.171, %97 ], [ %.171, %102 ], [ %.171, %107 ], [ %.171, %117 ], [ %.171, %125 ], [ %.171, %152 ], [ %.171, %160 ], [ %.171, %167 ], [ %.171, %174 ], [ %.171, %182 ], [ %.171, %189 ], [ %.171, %142 ], [ %.171, %111 ], [ %.171, %92 ], [ %.171, %185 ]
  %.2 = phi ptr [ %.069186, %82 ], [ %.069186, %85 ], [ null, %76 ], [ %.069186, %62 ], [ %.069186, %44 ], [ %.069186, %23 ], [ %.1, %97 ], [ %.1, %102 ], [ %.1, %107 ], [ %.1, %117 ], [ %.1, %125 ], [ %.1, %152 ], [ %.1, %160 ], [ %.1, %167 ], [ %.1, %174 ], [ %.1, %182 ], [ %.1, %189 ], [ %.1, %142 ], [ %.1, %111 ], [ %.1, %92 ], [ %.1, %185 ]
  %196 = call i32 @sdf_destroy_key(ptr noundef nonnull %8) #10
  %197 = call i32 @sdf_close_device(ptr noundef nonnull %7) #10
  call void @sdf_unload_library() #10
  call void @gmssl_secure_clear(ptr noundef nonnull %3, i64 noundef 16) #10
  call void @gmssl_secure_clear(ptr noundef nonnull %9, i64 noundef 56) #10
  %198 = icmp ne ptr %.278, null
  %199 = icmp ne ptr %.272, null
  %or.cond = select i1 %198, i1 %199, i1 false
  br i1 %or.cond, label %200, label %202

200:                                              ; preds = %195
  %201 = call i32 @fclose(ptr noundef nonnull %.272)
  br label %202

202:                                              ; preds = %200, %195
  %203 = icmp ne ptr %.275, null
  %204 = icmp ne ptr %.2, null
  %or.cond3 = select i1 %203, i1 %204, i1 false
  br i1 %or.cond3, label %205, label %207

205:                                              ; preds = %202
  %206 = call i32 @fclose(ptr noundef nonnull %.2)
  br label %207

207:                                              ; preds = %202, %205, %147, %17
  %.0 = phi i32 [ 1, %17 ], [ -1, %147 ], [ %.087, %205 ], [ %.087, %202 ]
  call void @llvm.lifetime.end.p0(i64 352, ptr nonnull %11) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #10
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %9) #10
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #10
  call void @llvm.lifetime.end.p0(i64 88, ptr nonnull %7) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #10
  call void @llvm.lifetime.end.p0(i64 4096, ptr nonnull %4) #10
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #10
  ret i32 %.0
}

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

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

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

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

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

; Function Attrs: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare i32 @atoi(ptr nocapture noundef nonnull) local_unnamed_addr #5

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

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

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

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

declare i32 @sdf_open_device(ptr noundef) local_unnamed_addr #8

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

declare i32 @sm2_ciphertext_from_der(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #8

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #9

declare i32 @sdf_import_key(ptr noundef, i32 noundef, ptr noundef, ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #8

declare i32 @sdf_cbc_decrypt_init(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #8

declare i32 @sdf_cbc_decrypt_update(ptr noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef) local_unnamed_addr #8

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

declare i32 @sdf_cbc_decrypt_finish(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #8

declare i32 @sdf_destroy_key(ptr noundef) local_unnamed_addr #8

declare i32 @sdf_close_device(ptr noundef) local_unnamed_addr #8

declare void @sdf_unload_library() local_unnamed_addr #8

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

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

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

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind "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 = { 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 #8 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #10 = { nounwind }
attributes #11 = { cold nounwind }
attributes #12 = { nounwind willreturn memory(read) }
attributes #13 = { nounwind willreturn memory(none) }

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

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


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