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

; 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.SM4_CBC_MAC_CTX = type { %struct.SM4_KEY, [16 x i8], i64 }
%struct.SM4_KEY = type { [32 x i32] }

@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
@help = 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 [34 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [57 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @sm4_cbc_mac_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 [16 x i8], align 16
  %14 = alloca i64, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca %struct.SM4_CBC_MAC_CTX, align 8
  %18 = alloca [16 x i8], align 16
  %19 = alloca i64, align 8
  %20 = alloca i32, align 4
  %21 = alloca [4096 x i8], align 16
  %22 = alloca i64, align 8
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  store i32 1, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  %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) #7
  store ptr null, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  store i32 0, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  store ptr null, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  store ptr null, ptr %11, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  store ptr null, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr %13) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  %26 = load ptr, ptr @stdin, align 8, !tbaa !9
  store ptr %26, ptr %15, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  %27 = load ptr, ptr @stdout, align 8, !tbaa !9
  store ptr %27, ptr %16, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 152, ptr %17) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr %18) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #7
  %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, ptr noundef %36, ptr noundef %37) #7
  store i32 1, ptr %3, align 4
  store i32 1, ptr %20, align 4
  br label %291

39:                                               ; preds = %2
  br label %40

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

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.1) #8
  %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, ptr noundef %49, ptr noundef %50)
  %52 = load ptr, ptr @help, align 8, !tbaa !9
  %53 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, ptr noundef %52)
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %270

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.3) #8
  %58 = icmp ne i32 %57, 0
  br i1 %58, label %87, 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 %192

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 i64 @strlen(ptr noundef %68) #8
  %70 = icmp ugt i64 %69, 32
  br i1 %70, label %71, label %75

71:                                               ; preds = %64
  %72 = load ptr, ptr @stderr, align 8, !tbaa !9
  %73 = load ptr, ptr %7, align 8, !tbaa !9
  %74 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %72, ptr noundef @.str.4, ptr noundef %73) #7
  br label %270

75:                                               ; preds = %64
  %76 = load ptr, ptr %8, align 8, !tbaa !9
  %77 = load ptr, ptr %8, align 8, !tbaa !9
  %78 = call i64 @strlen(ptr noundef %77) #8
  %79 = getelementptr inbounds [16 x i8], ptr %13, i64 0, i64 0
  %80 = call i32 @hex_to_bytes(ptr noundef %76, i64 noundef %78, ptr noundef %79, ptr noundef %14)
  %81 = icmp ne i32 %80, 1
  br i1 %81, label %82, label %86

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

86:                                               ; preds = %75
  br label %203

87:                                               ; preds = %54
  %88 = load ptr, ptr %5, align 8, !tbaa !9
  %89 = load ptr, ptr %88, align 8, !tbaa !9
  %90 = call i32 @strcmp(ptr noundef %89, ptr noundef @.str.6) #8
  %91 = icmp ne i32 %90, 0
  br i1 %91, label %100, label %92

92:                                               ; preds = %87
  %93 = load i32, ptr %9, align 4, !tbaa !5
  %94 = icmp eq i32 %93, 2
  br i1 %94, label %95, label %99

95:                                               ; preds = %92
  %96 = load ptr, ptr @stderr, align 8, !tbaa !9
  %97 = load ptr, ptr %7, align 8, !tbaa !9
  %98 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %96, ptr noundef @.str.7, ptr noundef %97) #7
  br label %270

99:                                               ; preds = %92
  store i32 1, ptr %9, align 4, !tbaa !5
  br label %202

100:                                              ; preds = %87
  %101 = load ptr, ptr %5, align 8, !tbaa !9
  %102 = load ptr, ptr %101, align 8, !tbaa !9
  %103 = call i32 @strcmp(ptr noundef %102, ptr noundef @.str.8) #8
  %104 = icmp ne i32 %103, 0
  br i1 %104, label %113, label %105

105:                                              ; preds = %100
  %106 = load i32, ptr %9, align 4, !tbaa !5
  %107 = icmp eq i32 %106, 1
  br i1 %107, label %108, label %112

108:                                              ; preds = %105
  %109 = load ptr, ptr @stderr, align 8, !tbaa !9
  %110 = load ptr, ptr %7, align 8, !tbaa !9
  %111 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %109, ptr noundef @.str.7, ptr noundef %110) #7
  br label %270

112:                                              ; preds = %105
  store i32 2, ptr %9, align 4, !tbaa !5
  br label %201

113:                                              ; preds = %100
  %114 = load ptr, ptr %5, align 8, !tbaa !9
  %115 = load ptr, ptr %114, align 8, !tbaa !9
  %116 = call i32 @strcmp(ptr noundef %115, ptr noundef @.str.9) #8
  %117 = icmp ne i32 %116, 0
  br i1 %117, label %134, label %118

118:                                              ; preds = %113
  %119 = load ptr, ptr %11, align 8, !tbaa !9
  %120 = icmp ne ptr %119, null
  br i1 %120, label %121, label %125

121:                                              ; preds = %118
  %122 = load ptr, ptr @stderr, align 8, !tbaa !9
  %123 = load ptr, ptr %7, align 8, !tbaa !9
  %124 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %122, ptr noundef @.str.10, ptr noundef %123) #7
  br label %270

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

129:                                              ; preds = %125
  br label %192

130:                                              ; preds = %125
  %131 = load ptr, ptr %5, align 8, !tbaa !9
  %132 = getelementptr inbounds ptr, ptr %131, i32 1
  store ptr %132, ptr %5, align 8, !tbaa !9
  %133 = load ptr, ptr %132, align 8, !tbaa !9
  store ptr %133, ptr %10, align 8, !tbaa !9
  br label %200

134:                                              ; preds = %113
  %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.11) #8
  %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 %192

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 %11, align 8, !tbaa !9
  %148 = load ptr, ptr %11, align 8, !tbaa !9
  %149 = call noalias ptr @fopen(ptr noundef %148, ptr noundef @.str.12)
  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 %11, align 8, !tbaa !9
  %155 = call ptr @__errno_location() #9
  %156 = load i32, ptr %155, align 4, !tbaa !5
  %157 = call ptr @strerror(i32 noundef %156) #7
  %158 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %152, ptr noundef @.str.13, ptr noundef %153, ptr noundef %154, ptr noundef %157) #7
  br label %270

159:                                              ; preds = %144
  br label %199

160:                                              ; preds = %134
  %161 = load ptr, ptr %5, align 8, !tbaa !9
  %162 = load ptr, ptr %161, align 8, !tbaa !9
  %163 = call i32 @strcmp(ptr noundef %162, ptr noundef @.str.14) #8
  %164 = icmp ne i32 %163, 0
  br i1 %164, label %186, label %165

165:                                              ; preds = %160
  %166 = load i32, ptr %4, align 4, !tbaa !5
  %167 = add nsw i32 %166, -1
  store i32 %167, ptr %4, align 4, !tbaa !5
  %168 = icmp slt i32 %167, 1
  br i1 %168, label %169, label %170

169:                                              ; preds = %165
  br label %192

170:                                              ; preds = %165
  %171 = load ptr, ptr %5, align 8, !tbaa !9
  %172 = getelementptr inbounds ptr, ptr %171, i32 1
  store ptr %172, ptr %5, align 8, !tbaa !9
  %173 = load ptr, ptr %172, align 8, !tbaa !9
  store ptr %173, ptr %12, align 8, !tbaa !9
  %174 = load ptr, ptr %12, align 8, !tbaa !9
  %175 = call noalias ptr @fopen(ptr noundef %174, ptr noundef @.str.15)
  store ptr %175, ptr %16, align 8, !tbaa !9
  %176 = icmp ne ptr %175, null
  br i1 %176, label %185, label %177

177:                                              ; preds = %170
  %178 = load ptr, ptr @stderr, align 8, !tbaa !9
  %179 = load ptr, ptr %7, align 8, !tbaa !9
  %180 = load ptr, ptr %12, align 8, !tbaa !9
  %181 = call ptr @__errno_location() #9
  %182 = load i32, ptr %181, align 4, !tbaa !5
  %183 = call ptr @strerror(i32 noundef %182) #7
  %184 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %178, ptr noundef @.str.13, ptr noundef %179, ptr noundef %180, ptr noundef %183) #7
  br label %270

185:                                              ; preds = %170
  br label %198

186:                                              ; preds = %160
  %187 = load ptr, ptr @stderr, align 8, !tbaa !9
  %188 = load ptr, ptr %7, align 8, !tbaa !9
  %189 = load ptr, ptr %5, align 8, !tbaa !9
  %190 = load ptr, ptr %189, align 8, !tbaa !9
  %191 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %187, ptr noundef @.str.16, ptr noundef %188, ptr noundef %190) #7
  br label %270

192:                                              ; preds = %169, %143, %129, %63
  %193 = load ptr, ptr @stderr, align 8, !tbaa !9
  %194 = load ptr, ptr %7, align 8, !tbaa !9
  %195 = load ptr, ptr %5, align 8, !tbaa !9
  %196 = load ptr, ptr %195, align 8, !tbaa !9
  %197 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %193, ptr noundef @.str.17, ptr noundef %194, ptr noundef %196) #7
  br label %270

198:                                              ; preds = %185
  br label %199

199:                                              ; preds = %198, %159
  br label %200

200:                                              ; preds = %199, %130
  br label %201

201:                                              ; preds = %200, %112
  br label %202

202:                                              ; preds = %201, %99
  br label %203

203:                                              ; preds = %202, %86
  br label %204

204:                                              ; preds = %203
  %205 = load i32, ptr %4, align 4, !tbaa !5
  %206 = add nsw i32 %205, -1
  store i32 %206, ptr %4, align 4, !tbaa !5
  %207 = load ptr, ptr %5, align 8, !tbaa !9
  %208 = getelementptr inbounds ptr, ptr %207, i32 1
  store ptr %208, ptr %5, align 8, !tbaa !9
  br label %40, !llvm.loop !11

209:                                              ; preds = %40
  %210 = load ptr, ptr %8, align 8, !tbaa !9
  %211 = icmp ne ptr %210, null
  br i1 %211, label %216, label %212

212:                                              ; preds = %209
  %213 = load ptr, ptr @stderr, align 8, !tbaa !9
  %214 = load ptr, ptr %7, align 8, !tbaa !9
  %215 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %213, ptr noundef @.str.18, ptr noundef %214) #7
  br label %270

216:                                              ; preds = %209
  %217 = getelementptr inbounds [16 x i8], ptr %13, i64 0, i64 0
  call void @sm4_cbc_mac_init(ptr noundef %17, ptr noundef %217)
  %218 = load ptr, ptr %10, align 8, !tbaa !9
  %219 = icmp ne ptr %218, null
  br i1 %219, label %220, label %224

220:                                              ; preds = %216
  %221 = load ptr, ptr %10, align 8, !tbaa !9
  %222 = load ptr, ptr %10, align 8, !tbaa !9
  %223 = call i64 @strlen(ptr noundef %222) #8
  call void @sm4_cbc_mac_update(ptr noundef %17, ptr noundef %221, i64 noundef %223)
  br label %235

224:                                              ; preds = %216
  call void @llvm.lifetime.start.p0(i64 4096, ptr %21) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #7
  br label %225

225:                                              ; preds = %230, %224
  %226 = getelementptr inbounds [4096 x i8], ptr %21, i64 0, i64 0
  %227 = load ptr, ptr %15, align 8, !tbaa !9
  %228 = call i64 @fread(ptr noundef %226, i64 noundef 1, i64 noundef 4096, ptr noundef %227)
  store i64 %228, ptr %22, align 8, !tbaa !13
  %229 = icmp ugt i64 %228, 0
  br i1 %229, label %230, label %233

230:                                              ; preds = %225
  %231 = getelementptr inbounds [4096 x i8], ptr %21, i64 0, i64 0
  %232 = load i64, ptr %22, align 8, !tbaa !13
  call void @sm4_cbc_mac_update(ptr noundef %17, ptr noundef %231, i64 noundef %232)
  br label %225, !llvm.loop !15

233:                                              ; preds = %225
  %234 = getelementptr inbounds [4096 x i8], ptr %21, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 16 %234, i8 0, i64 4096, i1 false)
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #7
  call void @llvm.lifetime.end.p0(i64 4096, ptr %21) #7
  br label %235

235:                                              ; preds = %233, %220
  %236 = getelementptr inbounds [16 x i8], ptr %18, i64 0, i64 0
  call void @sm4_cbc_mac_finish(ptr noundef %17, ptr noundef %236)
  %237 = load i32, ptr %9, align 4, !tbaa !5
  %238 = icmp sgt i32 %237, 1
  br i1 %238, label %239, label %252

239:                                              ; preds = %235
  %240 = getelementptr inbounds [16 x i8], ptr %18, i64 0, i64 0
  %241 = load ptr, ptr %16, align 8, !tbaa !9
  %242 = call i64 @fwrite(ptr noundef %240, i64 noundef 1, i64 noundef 16, ptr noundef %241)
  %243 = icmp ne i64 %242, 16
  br i1 %243, label %244, label %251

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

251:                                              ; preds = %239
  br label %269

252:                                              ; preds = %235
  store i64 0, ptr %19, align 8, !tbaa !13
  br label %253

253:                                              ; preds = %263, %252
  %254 = load i64, ptr %19, align 8, !tbaa !13
  %255 = icmp ult i64 %254, 16
  br i1 %255, label %256, label %266

256:                                              ; preds = %253
  %257 = load ptr, ptr %16, align 8, !tbaa !9
  %258 = load i64, ptr %19, align 8, !tbaa !13
  %259 = getelementptr inbounds [16 x i8], ptr %18, i64 0, i64 %258
  %260 = load i8, ptr %259, align 1, !tbaa !16
  %261 = zext i8 %260 to i32
  %262 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %257, ptr noundef @.str.20, i32 noundef %261) #7
  br label %263

263:                                              ; preds = %256
  %264 = load i64, ptr %19, align 8, !tbaa !13
  %265 = add i64 %264, 1
  store i64 %265, ptr %19, align 8, !tbaa !13
  br label %253, !llvm.loop !17

266:                                              ; preds = %253
  %267 = load ptr, ptr %16, align 8, !tbaa !9
  %268 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %267, ptr noundef @.str.21) #7
  br label %269

269:                                              ; preds = %266, %251
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %270

270:                                              ; preds = %269, %244, %212, %192, %186, %177, %151, %121, %108, %95, %82, %71, %48
  %271 = getelementptr inbounds [16 x i8], ptr %13, i64 0, i64 0
  call void @gmssl_secure_clear(ptr noundef %271, i64 noundef 16)
  call void @gmssl_secure_clear(ptr noundef %17, i64 noundef 152)
  %272 = load ptr, ptr %11, align 8, !tbaa !9
  %273 = icmp ne ptr %272, null
  br i1 %273, label %274, label %280

274:                                              ; preds = %270
  %275 = load ptr, ptr %15, align 8, !tbaa !9
  %276 = icmp ne ptr %275, null
  br i1 %276, label %277, label %280

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

280:                                              ; preds = %277, %274, %270
  %281 = load ptr, ptr %12, align 8, !tbaa !9
  %282 = icmp ne ptr %281, null
  br i1 %282, label %283, label %289

283:                                              ; preds = %280
  %284 = load ptr, ptr %16, align 8, !tbaa !9
  %285 = icmp ne ptr %284, null
  br i1 %285, label %286, label %289

286:                                              ; preds = %283
  %287 = load ptr, ptr %16, align 8, !tbaa !9
  %288 = call i32 @fclose(ptr noundef %287)
  br label %289

289:                                              ; preds = %286, %283, %280
  %290 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %290, ptr %3, align 4
  store i32 1, ptr %20, align 4
  br label %291

291:                                              ; preds = %289, %34
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 152, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  %292 = load i32, ptr %3, align 4
  ret i32 %292
}

; 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

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

declare i32 @hex_to_bytes(ptr noundef, i64 noundef, ptr noundef, 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 void @sm4_cbc_mac_init(ptr noundef, ptr noundef) #4

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

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

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

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

declare void @sm4_cbc_mac_finish(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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !14, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = distinct !{!15, !12}
!16 = !{!7, !7, i64 0}
!17 = distinct !{!17, !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.SM4_CBC_MAC_CTX = type { %struct.SM4_KEY, [16 x i8], i64 }
%struct.SM4_KEY = type { [32 x i32] }

@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
@help = 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 [34 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [57 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @sm4_cbc_mac_main(i32 noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = alloca [16 x i8], align 16
  %4 = alloca i64, align 8
  %5 = alloca %struct.SM4_CBC_MAC_CTX, align 8
  %6 = alloca [16 x i8], align 16
  %7 = alloca [4096 x i8], align 16
  %8 = load ptr, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  %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 152, ptr nonnull %5) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #7
  %11 = icmp slt i32 %0, 2
  br i1 %11, label %12, label %.preheader117

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

.preheader117:                                    ; preds = %2, %103
  %.071209 = phi ptr [ %.1, %103 ], [ %10, %2 ]
  %.072208 = phi ptr [ %.173, %103 ], [ %9, %2 ]
  %.075207 = phi ptr [ %.176, %103 ], [ null, %2 ]
  %.078206 = phi ptr [ %.179, %103 ], [ null, %2 ]
  %.081205 = phi ptr [ %.182, %103 ], [ null, %2 ]
  %.083204 = phi i32 [ %.184, %103 ], [ 0, %2 ]
  %.085203 = phi ptr [ %.186, %103 ], [ null, %2 ]
  %.087.in202 = phi i32 [ %.188, %103 ], [ %0, %2 ]
  %.pn201 = phi ptr [ %.191, %103 ], [ %1, %2 ]
  %.090210 = getelementptr inbounds i8, ptr %.pn201, i64 8
  %.087211 = add nsw i32 %.087.in202, -1
  %16 = load ptr, ptr %.090210, align 8, !tbaa !5
  %17 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %16, ptr noundef nonnull dereferenceable(1) @.str.1) #9
  %.not106 = icmp eq i32 %17, 0
  br i1 %.not106, label %18, label %23

18:                                               ; preds = %.preheader117
  %19 = load ptr, ptr @usage, align 8, !tbaa !5
  %20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef %8, ptr noundef %19)
  %21 = load ptr, ptr @help, align 8, !tbaa !5
  %22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef %21)
  br label %190

23:                                               ; preds = %.preheader117
  %24 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %16, ptr noundef nonnull dereferenceable(1) @.str.3) #9
  %.not107 = icmp eq i32 %24, 0
  br i1 %.not107, label %25, label %41

25:                                               ; preds = %23
  %26 = add nsw i32 %.087.in202, -2
  %27 = icmp eq i32 %.087.in202, 2
  br i1 %27, label %100, label %28

28:                                               ; preds = %25
  %29 = getelementptr inbounds i8, ptr %.pn201, i64 16
  %30 = load ptr, ptr %29, align 8, !tbaa !5
  %31 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %30) #9
  %32 = icmp ugt i64 %31, 32
  br i1 %32, label %33, label %36

33:                                               ; preds = %28
  %34 = load ptr, ptr @stderr, align 8, !tbaa !5
  %35 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %34, ptr noundef nonnull @.str.4, ptr noundef %8) #8
  br label %190

36:                                               ; preds = %28
  %37 = call i32 @hex_to_bytes(ptr noundef %30, i64 noundef %31, ptr noundef nonnull %3, ptr noundef nonnull %4) #7
  %.not108 = icmp eq i32 %37, 1
  br i1 %.not108, label %103, label %38

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

41:                                               ; preds = %23
  %42 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %16, ptr noundef nonnull dereferenceable(1) @.str.6) #9
  %.not109 = icmp eq i32 %42, 0
  br i1 %.not109, label %43, label %48

43:                                               ; preds = %41
  %44 = icmp eq i32 %.083204, 2
  br i1 %44, label %45, label %103

45:                                               ; preds = %43
  %46 = load ptr, ptr @stderr, align 8, !tbaa !5
  %47 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %46, ptr noundef nonnull @.str.7, ptr noundef %8) #8
  br label %190

48:                                               ; preds = %41
  %49 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %16, ptr noundef nonnull dereferenceable(1) @.str.8) #9
  %.not110 = icmp eq i32 %49, 0
  br i1 %.not110, label %50, label %55

50:                                               ; preds = %48
  %51 = icmp eq i32 %.083204, 1
  br i1 %51, label %52, label %103

52:                                               ; preds = %50
  %53 = load ptr, ptr @stderr, align 8, !tbaa !5
  %54 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %53, ptr noundef nonnull @.str.7, ptr noundef %8) #8
  br label %190

55:                                               ; preds = %48
  %56 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %16, ptr noundef nonnull dereferenceable(1) @.str.9) #9
  %.not111 = icmp eq i32 %56, 0
  br i1 %.not111, label %57, label %67

57:                                               ; preds = %55
  %.not112 = icmp eq ptr %.078206, null
  br i1 %.not112, label %61, label %58

58:                                               ; preds = %57
  %59 = load ptr, ptr @stderr, align 8, !tbaa !5
  %60 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %59, ptr noundef nonnull @.str.10, ptr noundef %8) #8
  br label %190

61:                                               ; preds = %57
  %62 = icmp eq i32 %.087.in202, 2
  br i1 %62, label %100, label %63

63:                                               ; preds = %61
  %64 = add nsw i32 %.087.in202, -2
  %65 = getelementptr inbounds i8, ptr %.pn201, i64 16
  %66 = load ptr, ptr %65, align 8, !tbaa !5
  br label %103

67:                                               ; preds = %55
  %68 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %16, ptr noundef nonnull dereferenceable(1) @.str.11) #9
  %.not113 = icmp eq i32 %68, 0
  br i1 %.not113, label %69, label %82

69:                                               ; preds = %67
  %70 = icmp eq i32 %.087.in202, 2
  br i1 %70, label %100, label %71

71:                                               ; preds = %69
  %72 = add nsw i32 %.087.in202, -2
  %73 = getelementptr inbounds i8, ptr %.pn201, i64 16
  %74 = load ptr, ptr %73, align 8, !tbaa !5
  %75 = call noalias ptr @fopen(ptr noundef %74, ptr noundef nonnull @.str.12)
  %.not114 = icmp eq ptr %75, null
  br i1 %.not114, label %76, label %103

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

82:                                               ; preds = %67
  %83 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %16, ptr noundef nonnull dereferenceable(1) @.str.14) #9
  %.not115 = icmp eq i32 %83, 0
  br i1 %.not115, label %84, label %97

84:                                               ; preds = %82
  %85 = icmp eq i32 %.087.in202, 2
  br i1 %85, label %100, label %86

86:                                               ; preds = %84
  %87 = add nsw i32 %.087.in202, -2
  %88 = getelementptr inbounds i8, ptr %.pn201, i64 16
  %89 = load ptr, ptr %88, align 8, !tbaa !5
  %90 = call noalias ptr @fopen(ptr noundef %89, ptr noundef nonnull @.str.15)
  %.not116 = icmp eq ptr %90, null
  br i1 %.not116, label %91, label %103

91:                                               ; preds = %86
  %92 = load ptr, ptr @stderr, align 8, !tbaa !5
  %93 = tail call ptr @__errno_location() #10
  %94 = load i32, ptr %93, align 4, !tbaa !9
  %95 = call ptr @strerror(i32 noundef %94) #7
  %96 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %92, ptr noundef nonnull @.str.13, ptr noundef %8, ptr noundef %89, ptr noundef %95) #8
  br label %190

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

100:                                              ; preds = %84, %69, %61, %25
  %.078206.lcssa227 = phi ptr [ %.078206, %84 ], [ %.078206, %69 ], [ null, %61 ], [ %.078206, %25 ]
  %101 = load ptr, ptr @stderr, align 8, !tbaa !5
  %102 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %101, ptr noundef nonnull @.str.17, ptr noundef %8, ptr noundef %16) #8
  br label %190

103:                                              ; preds = %50, %43, %36, %71, %86, %63
  %.191 = phi ptr [ %88, %86 ], [ %73, %71 ], [ %65, %63 ], [ %29, %36 ], [ %.090210, %43 ], [ %.090210, %50 ]
  %.188 = phi i32 [ %87, %86 ], [ %72, %71 ], [ %64, %63 ], [ %26, %36 ], [ %.087211, %43 ], [ %.087211, %50 ]
  %.186 = phi ptr [ %.085203, %86 ], [ %.085203, %71 ], [ %.085203, %63 ], [ %30, %36 ], [ %.085203, %43 ], [ %.085203, %50 ]
  %.184 = phi i32 [ %.083204, %86 ], [ %.083204, %71 ], [ %.083204, %63 ], [ %.083204, %36 ], [ 1, %43 ], [ 2, %50 ]
  %.182 = phi ptr [ %.081205, %86 ], [ %.081205, %71 ], [ %66, %63 ], [ %.081205, %36 ], [ %.081205, %43 ], [ %.081205, %50 ]
  %.179 = phi ptr [ %.078206, %86 ], [ %74, %71 ], [ null, %63 ], [ %.078206, %36 ], [ %.078206, %43 ], [ %.078206, %50 ]
  %.176 = phi ptr [ %89, %86 ], [ %.075207, %71 ], [ %.075207, %63 ], [ %.075207, %36 ], [ %.075207, %43 ], [ %.075207, %50 ]
  %.173 = phi ptr [ %.072208, %86 ], [ %75, %71 ], [ %.072208, %63 ], [ %.072208, %36 ], [ %.072208, %43 ], [ %.072208, %50 ]
  %.1 = phi ptr [ %90, %86 ], [ %.071209, %71 ], [ %.071209, %63 ], [ %.071209, %36 ], [ %.071209, %43 ], [ %.071209, %50 ]
  %104 = icmp sgt i32 %.188, 1
  br i1 %104, label %.preheader117, label %105, !llvm.loop !11

105:                                              ; preds = %103
  %.not = icmp eq ptr %.186, null
  br i1 %.not, label %106, label %109

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

109:                                              ; preds = %105
  call void @sm4_cbc_mac_init(ptr noundef nonnull %5, ptr noundef nonnull %3) #7
  %.not103 = icmp eq ptr %.182, null
  br i1 %.not103, label %112, label %110

110:                                              ; preds = %109
  %111 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %.182) #9
  call void @sm4_cbc_mac_update(ptr noundef nonnull %5, ptr noundef nonnull %.182, i64 noundef %111) #7
  br label %116

112:                                              ; preds = %109
  call void @llvm.lifetime.start.p0(i64 4096, ptr nonnull %7) #7
  %113 = call i64 @fread(ptr noundef nonnull %7, i64 noundef 1, i64 noundef 4096, ptr noundef %.173)
  %.not104212 = icmp eq i64 %113, 0
  br i1 %.not104212, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %112, %.lr.ph
  %114 = phi i64 [ %115, %.lr.ph ], [ %113, %112 ]
  call void @sm4_cbc_mac_update(ptr noundef nonnull %5, ptr noundef nonnull %7, i64 noundef %114) #7
  %115 = call i64 @fread(ptr noundef nonnull %7, i64 noundef 1, i64 noundef 4096, ptr noundef %.173)
  %.not104 = icmp eq i64 %115, 0
  br i1 %.not104, label %._crit_edge, label %.lr.ph, !llvm.loop !13

._crit_edge:                                      ; preds = %.lr.ph, %112
  call void @llvm.lifetime.end.p0(i64 4096, ptr nonnull %7) #7
  br label %116

116:                                              ; preds = %._crit_edge, %110
  call void @sm4_cbc_mac_finish(ptr noundef nonnull %5, ptr noundef nonnull %6) #7
  %117 = icmp sgt i32 %.184, 1
  br i1 %117, label %182, label %.preheader.preheader

.preheader.preheader:                             ; preds = %116
  %118 = load i8, ptr %6, align 16, !tbaa !14
  %119 = zext i8 %118 to i32
  %120 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %.1, ptr noundef nonnull @.str.20, i32 noundef %119) #7
  %121 = getelementptr inbounds i8, ptr %6, i64 1
  %122 = load i8, ptr %121, align 1, !tbaa !14
  %123 = zext i8 %122 to i32
  %124 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %.1, ptr noundef nonnull @.str.20, i32 noundef %123) #7
  %125 = getelementptr inbounds i8, ptr %6, i64 2
  %126 = load i8, ptr %125, align 2, !tbaa !14
  %127 = zext i8 %126 to i32
  %128 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %.1, ptr noundef nonnull @.str.20, i32 noundef %127) #7
  %129 = getelementptr inbounds i8, ptr %6, i64 3
  %130 = load i8, ptr %129, align 1, !tbaa !14
  %131 = zext i8 %130 to i32
  %132 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %.1, ptr noundef nonnull @.str.20, i32 noundef %131) #7
  %133 = getelementptr inbounds i8, ptr %6, i64 4
  %134 = load i8, ptr %133, align 4, !tbaa !14
  %135 = zext i8 %134 to i32
  %136 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %.1, ptr noundef nonnull @.str.20, i32 noundef %135) #7
  %137 = getelementptr inbounds i8, ptr %6, i64 5
  %138 = load i8, ptr %137, align 1, !tbaa !14
  %139 = zext i8 %138 to i32
  %140 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %.1, ptr noundef nonnull @.str.20, i32 noundef %139) #7
  %141 = getelementptr inbounds i8, ptr %6, i64 6
  %142 = load i8, ptr %141, align 2, !tbaa !14
  %143 = zext i8 %142 to i32
  %144 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %.1, ptr noundef nonnull @.str.20, i32 noundef %143) #7
  %145 = getelementptr inbounds i8, ptr %6, i64 7
  %146 = load i8, ptr %145, align 1, !tbaa !14
  %147 = zext i8 %146 to i32
  %148 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %.1, ptr noundef nonnull @.str.20, i32 noundef %147) #7
  %149 = getelementptr inbounds i8, ptr %6, i64 8
  %150 = load i8, ptr %149, align 8, !tbaa !14
  %151 = zext i8 %150 to i32
  %152 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %.1, ptr noundef nonnull @.str.20, i32 noundef %151) #7
  %153 = getelementptr inbounds i8, ptr %6, i64 9
  %154 = load i8, ptr %153, align 1, !tbaa !14
  %155 = zext i8 %154 to i32
  %156 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %.1, ptr noundef nonnull @.str.20, i32 noundef %155) #7
  %157 = getelementptr inbounds i8, ptr %6, i64 10
  %158 = load i8, ptr %157, align 2, !tbaa !14
  %159 = zext i8 %158 to i32
  %160 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %.1, ptr noundef nonnull @.str.20, i32 noundef %159) #7
  %161 = getelementptr inbounds i8, ptr %6, i64 11
  %162 = load i8, ptr %161, align 1, !tbaa !14
  %163 = zext i8 %162 to i32
  %164 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %.1, ptr noundef nonnull @.str.20, i32 noundef %163) #7
  %165 = getelementptr inbounds i8, ptr %6, i64 12
  %166 = load i8, ptr %165, align 4, !tbaa !14
  %167 = zext i8 %166 to i32
  %168 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %.1, ptr noundef nonnull @.str.20, i32 noundef %167) #7
  %169 = getelementptr inbounds i8, ptr %6, i64 13
  %170 = load i8, ptr %169, align 1, !tbaa !14
  %171 = zext i8 %170 to i32
  %172 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %.1, ptr noundef nonnull @.str.20, i32 noundef %171) #7
  %173 = getelementptr inbounds i8, ptr %6, i64 14
  %174 = load i8, ptr %173, align 2, !tbaa !14
  %175 = zext i8 %174 to i32
  %176 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %.1, ptr noundef nonnull @.str.20, i32 noundef %175) #7
  %177 = getelementptr inbounds i8, ptr %6, i64 15
  %178 = load i8, ptr %177, align 1, !tbaa !14
  %179 = zext i8 %178 to i32
  %180 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %.1, ptr noundef nonnull @.str.20, i32 noundef %179) #7
  %181 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %.1, ptr noundef nonnull @.str.21) #7
  br label %190

182:                                              ; preds = %116
  %183 = call i64 @fwrite(ptr noundef nonnull %6, i64 noundef 1, i64 noundef 16, ptr noundef %.1)
  %.not105 = icmp eq i64 %183, 16
  br i1 %.not105, label %190, label %184

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

190:                                              ; preds = %.preheader.preheader, %182, %184, %106, %100, %97, %91, %76, %58, %52, %45, %38, %33, %18
  %.089 = phi i32 [ 1, %97 ], [ 1, %100 ], [ 1, %91 ], [ 1, %76 ], [ 1, %58 ], [ 1, %52 ], [ 1, %45 ], [ 1, %33 ], [ 1, %38 ], [ 0, %18 ], [ 1, %184 ], [ 1, %106 ], [ 0, %182 ], [ 0, %.preheader.preheader ]
  %.280 = phi ptr [ %.078206, %97 ], [ %.078206.lcssa227, %100 ], [ %.078206, %91 ], [ %74, %76 ], [ %.078206, %58 ], [ %.078206, %52 ], [ %.078206, %45 ], [ %.078206, %33 ], [ %.078206, %38 ], [ %.078206, %18 ], [ %.179, %184 ], [ %.179, %106 ], [ %.179, %182 ], [ %.179, %.preheader.preheader ]
  %.277 = phi ptr [ %.075207, %97 ], [ %.075207, %100 ], [ %89, %91 ], [ %.075207, %76 ], [ %.075207, %58 ], [ %.075207, %52 ], [ %.075207, %45 ], [ %.075207, %33 ], [ %.075207, %38 ], [ %.075207, %18 ], [ %.176, %184 ], [ %.176, %106 ], [ %.176, %182 ], [ %.176, %.preheader.preheader ]
  %.274 = phi ptr [ %.072208, %97 ], [ %.072208, %100 ], [ %.072208, %91 ], [ null, %76 ], [ %.072208, %58 ], [ %.072208, %52 ], [ %.072208, %45 ], [ %.072208, %33 ], [ %.072208, %38 ], [ %.072208, %18 ], [ %.173, %184 ], [ %.173, %106 ], [ %.173, %182 ], [ %.173, %.preheader.preheader ]
  %.2 = phi ptr [ %.071209, %97 ], [ %.071209, %100 ], [ null, %91 ], [ %.071209, %76 ], [ %.071209, %58 ], [ %.071209, %52 ], [ %.071209, %45 ], [ %.071209, %33 ], [ %.071209, %38 ], [ %.071209, %18 ], [ %.1, %184 ], [ %.1, %106 ], [ %.1, %182 ], [ %.1, %.preheader.preheader ]
  call void @gmssl_secure_clear(ptr noundef nonnull %3, i64 noundef 16) #7
  call void @gmssl_secure_clear(ptr noundef nonnull %5, i64 noundef 152) #7
  %191 = icmp ne ptr %.280, null
  %192 = icmp ne ptr %.274, null
  %or.cond = select i1 %191, i1 %192, i1 false
  br i1 %or.cond, label %193, label %195

193:                                              ; preds = %190
  %194 = call i32 @fclose(ptr noundef nonnull %.274)
  br label %195

195:                                              ; preds = %193, %190
  %196 = icmp ne ptr %.277, null
  %197 = icmp ne ptr %.2, null
  %or.cond3 = select i1 %196, i1 %197, i1 false
  br i1 %or.cond3, label %198, label %200

198:                                              ; preds = %195
  %199 = call i32 @fclose(ptr noundef nonnull %.2)
  br label %200

200:                                              ; preds = %195, %198, %12
  %.0 = phi i32 [ 1, %12 ], [ %.089, %198 ], [ %.089, %195 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 152, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 16, 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: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3

declare i32 @hex_to_bytes(ptr noundef, i64 noundef, ptr noundef, ptr noundef) local_unnamed_addr #4

; 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 #5

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

declare void @sm4_cbc_mac_init(ptr noundef, ptr noundef) local_unnamed_addr #4

declare void @sm4_cbc_mac_update(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #4

; Function Attrs: nofree nounwind
declare noundef i64 @fread(ptr nocapture noundef, i64 noundef, i64 noundef, 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

declare void @sm4_cbc_mac_finish(ptr noundef, ptr noundef) local_unnamed_addr #4

; 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 #4

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

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nofree nosync nounwind willreturn memory(none) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { 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 = !{!7, !7, i64 0}


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