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

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

@stdin = external global ptr, align 8
@stdout = external global ptr, align 8
@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [20 x i8], align 1
@usage = external hidden global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@options = external hidden global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [61 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [63 x i8], align 1
@__FUNCTION__.sm4_gcm_main = external hidden unnamed_addr constant [13 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [31 x i8], align 1

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

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

44:                                               ; preds = %2
  br label %45

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

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

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

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

64:                                               ; preds = %59
  %65 = load i32, ptr %8, align 4, !tbaa !5
  %66 = icmp eq i32 %65, 0
  br i1 %66, label %67, label %71

67:                                               ; preds = %64
  %68 = load ptr, ptr @stderr, align 8, !tbaa !9
  %69 = load ptr, ptr %7, align 8, !tbaa !9
  %70 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %68, ptr noundef @.str.4, ptr noundef %69) #8
  br label %471

71:                                               ; preds = %64
  store i32 1, ptr %8, align 4, !tbaa !5
  br label %315

72:                                               ; preds = %59
  %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.5) #9
  %76 = icmp ne i32 %75, 0
  br i1 %76, label %85, label %77

77:                                               ; preds = %72
  %78 = load i32, ptr %8, align 4, !tbaa !5
  %79 = icmp eq i32 %78, 1
  br i1 %79, label %80, label %84

80:                                               ; preds = %77
  %81 = load ptr, ptr @stderr, align 8, !tbaa !9
  %82 = load ptr, ptr %7, align 8, !tbaa !9
  %83 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %81, ptr noundef @.str.4, ptr noundef %82) #8
  br label %471

84:                                               ; preds = %77
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %314

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

90:                                               ; preds = %85
  %91 = load i32, ptr %4, align 4, !tbaa !5
  %92 = add nsw i32 %91, -1
  store i32 %92, ptr %4, align 4, !tbaa !5
  %93 = icmp slt i32 %92, 1
  br i1 %93, label %94, label %95

94:                                               ; preds = %90
  br label %301

95:                                               ; preds = %90
  %96 = load ptr, ptr %5, align 8, !tbaa !9
  %97 = getelementptr inbounds ptr, ptr %96, i32 1
  store ptr %97, ptr %5, align 8, !tbaa !9
  %98 = load ptr, ptr %97, align 8, !tbaa !9
  store ptr %98, ptr %9, align 8, !tbaa !9
  %99 = load ptr, ptr %9, align 8, !tbaa !9
  %100 = call i64 @strlen(ptr noundef %99) #9
  %101 = icmp ne i64 %100, 32
  br i1 %101, label %102, label %106

102:                                              ; preds = %95
  %103 = load ptr, ptr @stderr, align 8, !tbaa !9
  %104 = load ptr, ptr %7, align 8, !tbaa !9
  %105 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %103, ptr noundef @.str.7, ptr noundef %104) #8
  br label %471

106:                                              ; preds = %95
  %107 = load ptr, ptr %9, align 8, !tbaa !9
  %108 = load ptr, ptr %9, align 8, !tbaa !9
  %109 = call i64 @strlen(ptr noundef %108) #9
  %110 = getelementptr inbounds [16 x i8], ptr %17, i64 0, i64 0
  %111 = call i32 @hex_to_bytes(ptr noundef %107, i64 noundef %109, ptr noundef %110, ptr noundef %18)
  %112 = icmp ne i32 %111, 1
  br i1 %112, label %113, label %117

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

117:                                              ; preds = %106
  br label %313

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

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

127:                                              ; preds = %123
  br label %301

128:                                              ; preds = %123
  %129 = load ptr, ptr %5, align 8, !tbaa !9
  %130 = getelementptr inbounds ptr, ptr %129, i32 1
  store ptr %130, ptr %5, align 8, !tbaa !9
  %131 = load ptr, ptr %130, align 8, !tbaa !9
  store ptr %131, ptr %10, align 8, !tbaa !9
  %132 = load ptr, ptr %10, align 8, !tbaa !9
  %133 = call i64 @strlen(ptr noundef %132) #9
  %134 = icmp ugt i64 %133, 128
  br i1 %134, label %135, label %139

135:                                              ; preds = %128
  %136 = load ptr, ptr @stderr, align 8, !tbaa !9
  %137 = load ptr, ptr %7, align 8, !tbaa !9
  %138 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %136, ptr noundef @.str.10, ptr noundef %137) #8
  br label %471

139:                                              ; preds = %128
  %140 = load ptr, ptr %10, align 8, !tbaa !9
  %141 = load ptr, ptr %10, align 8, !tbaa !9
  %142 = call i64 @strlen(ptr noundef %141) #9
  %143 = getelementptr inbounds [64 x i8], ptr %19, i64 0, i64 0
  %144 = call i32 @hex_to_bytes(ptr noundef %140, i64 noundef %142, ptr noundef %143, ptr noundef %20)
  %145 = icmp ne i32 %144, 1
  br i1 %145, label %146, label %150

146:                                              ; preds = %139
  %147 = load ptr, ptr @stderr, align 8, !tbaa !9
  %148 = load ptr, ptr %7, align 8, !tbaa !9
  %149 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %147, ptr noundef @.str.11, ptr noundef %148) #8
  br label %471

150:                                              ; preds = %139
  br label %312

151:                                              ; preds = %118
  %152 = load ptr, ptr %5, align 8, !tbaa !9
  %153 = load ptr, ptr %152, align 8, !tbaa !9
  %154 = call i32 @strcmp(ptr noundef %153, ptr noundef @.str.12) #9
  %155 = icmp ne i32 %154, 0
  br i1 %155, label %174, label %156

156:                                              ; preds = %151
  %157 = load i32, ptr %4, align 4, !tbaa !5
  %158 = add nsw i32 %157, -1
  store i32 %158, ptr %4, align 4, !tbaa !5
  %159 = icmp slt i32 %158, 1
  br i1 %159, label %160, label %161

160:                                              ; preds = %156
  br label %301

161:                                              ; preds = %156
  %162 = load ptr, ptr %11, align 8, !tbaa !9
  %163 = icmp ne ptr %162, null
  br i1 %163, label %164, label %168

164:                                              ; preds = %161
  %165 = load ptr, ptr @stderr, align 8, !tbaa !9
  %166 = load ptr, ptr %7, align 8, !tbaa !9
  %167 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %165, ptr noundef @.str.13, ptr noundef %166) #8
  br label %301

168:                                              ; preds = %161
  %169 = load ptr, ptr %5, align 8, !tbaa !9
  %170 = getelementptr inbounds ptr, ptr %169, i32 1
  store ptr %170, ptr %5, align 8, !tbaa !9
  %171 = load ptr, ptr %170, align 8, !tbaa !9
  store ptr %171, ptr %11, align 8, !tbaa !9
  %172 = load ptr, ptr %11, align 8, !tbaa !9
  %173 = call i64 @strlen(ptr noundef %172) #9
  store i64 %173, ptr %13, align 8, !tbaa !11
  br label %311

174:                                              ; preds = %151
  %175 = load ptr, ptr %5, align 8, !tbaa !9
  %176 = load ptr, ptr %175, align 8, !tbaa !9
  %177 = call i32 @strcmp(ptr noundef %176, ptr noundef @.str.14) #9
  %178 = icmp ne i32 %177, 0
  br i1 %178, label %218, label %179

179:                                              ; preds = %174
  %180 = load i32, ptr %4, align 4, !tbaa !5
  %181 = add nsw i32 %180, -1
  store i32 %181, ptr %4, align 4, !tbaa !5
  %182 = icmp slt i32 %181, 1
  br i1 %182, label %183, label %184

183:                                              ; preds = %179
  br label %301

184:                                              ; preds = %179
  %185 = load ptr, ptr %11, align 8, !tbaa !9
  %186 = icmp ne ptr %185, null
  br i1 %186, label %187, label %191

187:                                              ; preds = %184
  %188 = load ptr, ptr @stderr, align 8, !tbaa !9
  %189 = load ptr, ptr %7, align 8, !tbaa !9
  %190 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %188, ptr noundef @.str.13, ptr noundef %189) #8
  br label %301

191:                                              ; preds = %184
  %192 = load ptr, ptr %5, align 8, !tbaa !9
  %193 = getelementptr inbounds ptr, ptr %192, i32 1
  store ptr %193, ptr %5, align 8, !tbaa !9
  %194 = load ptr, ptr %193, align 8, !tbaa !9
  store ptr %194, ptr %11, align 8, !tbaa !9
  %195 = load ptr, ptr %11, align 8, !tbaa !9
  %196 = call i64 @strlen(ptr noundef %195) #9
  %197 = udiv i64 %196, 2
  %198 = add i64 %197, 1
  %199 = call noalias ptr @malloc(i64 noundef %198) #10
  store ptr %199, ptr %12, align 8, !tbaa !9
  %200 = icmp ne ptr %199, null
  br i1 %200, label %205, label %201

201:                                              ; preds = %191
  %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.15, ptr noundef %203) #8
  br label %471

205:                                              ; preds = %191
  %206 = load ptr, ptr %11, align 8, !tbaa !9
  %207 = load ptr, ptr %11, align 8, !tbaa !9
  %208 = call i64 @strlen(ptr noundef %207) #9
  %209 = load ptr, ptr %12, align 8, !tbaa !9
  %210 = call i32 @hex_to_bytes(ptr noundef %206, i64 noundef %208, ptr noundef %209, ptr noundef %13)
  %211 = icmp ne i32 %210, 1
  br i1 %211, label %212, label %216

212:                                              ; preds = %205
  %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.16, ptr noundef %214) #8
  br label %471

216:                                              ; preds = %205
  %217 = load ptr, ptr %12, align 8, !tbaa !9
  store ptr %217, ptr %11, align 8, !tbaa !9
  br label %310

218:                                              ; preds = %174
  %219 = load ptr, ptr %5, align 8, !tbaa !9
  %220 = load ptr, ptr %219, align 8, !tbaa !9
  %221 = call i32 @strcmp(ptr noundef %220, ptr noundef @.str.17) #9
  %222 = icmp ne i32 %221, 0
  br i1 %222, label %243, label %223

223:                                              ; preds = %218
  %224 = load i32, ptr %4, align 4, !tbaa !5
  %225 = add nsw i32 %224, -1
  store i32 %225, ptr %4, align 4, !tbaa !5
  %226 = icmp slt i32 %225, 1
  br i1 %226, label %227, label %228

227:                                              ; preds = %223
  br label %301

228:                                              ; preds = %223
  %229 = load ptr, ptr %5, align 8, !tbaa !9
  %230 = getelementptr inbounds ptr, ptr %229, i32 1
  store ptr %230, ptr %5, align 8, !tbaa !9
  %231 = load ptr, ptr %230, align 8, !tbaa !9
  %232 = call i32 @atoi(ptr noundef %231) #9
  store i32 %232, ptr %14, align 4, !tbaa !5
  %233 = load i32, ptr %14, align 4, !tbaa !5
  %234 = icmp slt i32 %233, 12
  br i1 %234, label %238, label %235

235:                                              ; preds = %228
  %236 = load i32, ptr %14, align 4, !tbaa !5
  %237 = icmp sgt i32 %236, 16
  br i1 %237, label %238, label %242

238:                                              ; preds = %235, %228
  %239 = load ptr, ptr @stderr, align 8, !tbaa !9
  %240 = load ptr, ptr %7, align 8, !tbaa !9
  %241 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %239, ptr noundef @.str.18, ptr noundef %240) #8
  br label %471

242:                                              ; preds = %235
  br label %309

243:                                              ; preds = %218
  %244 = load ptr, ptr %5, align 8, !tbaa !9
  %245 = load ptr, ptr %244, align 8, !tbaa !9
  %246 = call i32 @strcmp(ptr noundef %245, ptr noundef @.str.19) #9
  %247 = icmp ne i32 %246, 0
  br i1 %247, label %269, label %248

248:                                              ; preds = %243
  %249 = load i32, ptr %4, align 4, !tbaa !5
  %250 = add nsw i32 %249, -1
  store i32 %250, ptr %4, align 4, !tbaa !5
  %251 = icmp slt i32 %250, 1
  br i1 %251, label %252, label %253

252:                                              ; preds = %248
  br label %301

253:                                              ; preds = %248
  %254 = load ptr, ptr %5, align 8, !tbaa !9
  %255 = getelementptr inbounds ptr, ptr %254, i32 1
  store ptr %255, ptr %5, align 8, !tbaa !9
  %256 = load ptr, ptr %255, align 8, !tbaa !9
  store ptr %256, ptr %15, align 8, !tbaa !9
  %257 = load ptr, ptr %15, align 8, !tbaa !9
  %258 = call noalias ptr @fopen(ptr noundef %257, ptr noundef @.str.20)
  store ptr %258, ptr %21, align 8, !tbaa !9
  %259 = icmp ne ptr %258, null
  br i1 %259, label %268, label %260

260:                                              ; preds = %253
  %261 = load ptr, ptr @stderr, align 8, !tbaa !9
  %262 = load ptr, ptr %7, align 8, !tbaa !9
  %263 = load ptr, ptr %15, align 8, !tbaa !9
  %264 = call ptr @__errno_location() #11
  %265 = load i32, ptr %264, align 4, !tbaa !5
  %266 = call ptr @strerror(i32 noundef %265) #8
  %267 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %261, ptr noundef @.str.21, ptr noundef %262, ptr noundef %263, ptr noundef %266) #8
  br label %471

268:                                              ; preds = %253
  br label %308

269:                                              ; preds = %243
  %270 = load ptr, ptr %5, align 8, !tbaa !9
  %271 = load ptr, ptr %270, align 8, !tbaa !9
  %272 = call i32 @strcmp(ptr noundef %271, ptr noundef @.str.22) #9
  %273 = icmp ne i32 %272, 0
  br i1 %273, label %295, label %274

274:                                              ; preds = %269
  %275 = load i32, ptr %4, align 4, !tbaa !5
  %276 = add nsw i32 %275, -1
  store i32 %276, ptr %4, align 4, !tbaa !5
  %277 = icmp slt i32 %276, 1
  br i1 %277, label %278, label %279

278:                                              ; preds = %274
  br label %301

279:                                              ; preds = %274
  %280 = load ptr, ptr %5, align 8, !tbaa !9
  %281 = getelementptr inbounds ptr, ptr %280, i32 1
  store ptr %281, ptr %5, align 8, !tbaa !9
  %282 = load ptr, ptr %281, align 8, !tbaa !9
  store ptr %282, ptr %16, align 8, !tbaa !9
  %283 = load ptr, ptr %16, align 8, !tbaa !9
  %284 = call noalias ptr @fopen(ptr noundef %283, ptr noundef @.str.23)
  store ptr %284, ptr %22, align 8, !tbaa !9
  %285 = icmp ne ptr %284, null
  br i1 %285, label %294, label %286

286:                                              ; preds = %279
  %287 = load ptr, ptr @stderr, align 8, !tbaa !9
  %288 = load ptr, ptr %7, align 8, !tbaa !9
  %289 = load ptr, ptr %16, align 8, !tbaa !9
  %290 = call ptr @__errno_location() #11
  %291 = load i32, ptr %290, align 4, !tbaa !5
  %292 = call ptr @strerror(i32 noundef %291) #8
  %293 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %287, ptr noundef @.str.21, ptr noundef %288, ptr noundef %289, ptr noundef %292) #8
  br label %471

294:                                              ; preds = %279
  br label %307

295:                                              ; preds = %269
  %296 = load ptr, ptr @stderr, align 8, !tbaa !9
  %297 = load ptr, ptr %7, align 8, !tbaa !9
  %298 = load ptr, ptr %5, align 8, !tbaa !9
  %299 = load ptr, ptr %298, align 8, !tbaa !9
  %300 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %296, ptr noundef @.str.24, ptr noundef %297, ptr noundef %299) #8
  br label %471

301:                                              ; preds = %278, %252, %227, %187, %183, %164, %160, %127, %94
  %302 = load ptr, ptr @stderr, align 8, !tbaa !9
  %303 = load ptr, ptr %7, align 8, !tbaa !9
  %304 = load ptr, ptr %5, align 8, !tbaa !9
  %305 = load ptr, ptr %304, align 8, !tbaa !9
  %306 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %302, ptr noundef @.str.25, ptr noundef %303, ptr noundef %305) #8
  br label %471

307:                                              ; preds = %294
  br label %308

308:                                              ; preds = %307, %268
  br label %309

309:                                              ; preds = %308, %242
  br label %310

310:                                              ; preds = %309, %216
  br label %311

311:                                              ; preds = %310, %168
  br label %312

312:                                              ; preds = %311, %150
  br label %313

313:                                              ; preds = %312, %117
  br label %314

314:                                              ; preds = %313, %84
  br label %315

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

316:                                              ; preds = %315
  %317 = load i32, ptr %4, align 4, !tbaa !5
  %318 = add nsw i32 %317, -1
  store i32 %318, ptr %4, align 4, !tbaa !5
  %319 = load ptr, ptr %5, align 8, !tbaa !9
  %320 = getelementptr inbounds ptr, ptr %319, i32 1
  store ptr %320, ptr %5, align 8, !tbaa !9
  br label %45, !llvm.loop !13

321:                                              ; preds = %45
  %322 = load i32, ptr %8, align 4, !tbaa !5
  %323 = icmp slt i32 %322, 0
  br i1 %323, label %324, label %328

324:                                              ; preds = %321
  %325 = load ptr, ptr @stderr, align 8, !tbaa !9
  %326 = load ptr, ptr %7, align 8, !tbaa !9
  %327 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %325, ptr noundef @.str.26, ptr noundef %326) #8
  br label %471

328:                                              ; preds = %321
  %329 = load ptr, ptr %9, align 8, !tbaa !9
  %330 = icmp ne ptr %329, null
  br i1 %330, label %335, label %331

331:                                              ; preds = %328
  %332 = load ptr, ptr @stderr, align 8, !tbaa !9
  %333 = load ptr, ptr %7, align 8, !tbaa !9
  %334 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %332, ptr noundef @.str.27, ptr noundef %333) #8
  br label %471

335:                                              ; preds = %328
  %336 = load ptr, ptr %10, align 8, !tbaa !9
  %337 = icmp ne ptr %336, null
  br i1 %337, label %342, label %338

338:                                              ; preds = %335
  %339 = load ptr, ptr @stderr, align 8, !tbaa !9
  %340 = load ptr, ptr %7, align 8, !tbaa !9
  %341 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %339, ptr noundef @.str.28, ptr noundef %340) #8
  br label %471

342:                                              ; preds = %335
  %343 = load i32, ptr %8, align 4, !tbaa !5
  %344 = icmp ne i32 %343, 0
  br i1 %344, label %345, label %363

345:                                              ; preds = %342
  %346 = getelementptr inbounds [16 x i8], ptr %17, i64 0, i64 0
  %347 = load i64, ptr %18, align 8, !tbaa !11
  %348 = getelementptr inbounds [64 x i8], ptr %19, i64 0, i64 0
  %349 = load i64, ptr %20, align 8, !tbaa !11
  %350 = load ptr, ptr %11, align 8, !tbaa !9
  %351 = load i64, ptr %13, align 8, !tbaa !11
  %352 = load i32, ptr %14, align 4, !tbaa !5
  %353 = sext i32 %352 to i64
  %354 = call i32 @sm4_gcm_encrypt_init(ptr noundef %23, ptr noundef %346, i64 noundef %347, ptr noundef %348, i64 noundef %349, ptr noundef %350, i64 noundef %351, i64 noundef %353)
  %355 = icmp ne i32 %354, 1
  br i1 %355, label %356, label %362

356:                                              ; preds = %345
  br label %357

357:                                              ; preds = %356
  %358 = load ptr, ptr @stderr, align 8, !tbaa !9
  %359 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %358, ptr noundef @.str.29, ptr noundef @.str.30, i32 noundef 190, ptr noundef @__FUNCTION__.sm4_gcm_main) #8
  br label %360

360:                                              ; preds = %357
  br label %361

361:                                              ; preds = %360
  br label %471

362:                                              ; preds = %345
  br label %381

363:                                              ; preds = %342
  %364 = getelementptr inbounds [16 x i8], ptr %17, i64 0, i64 0
  %365 = load i64, ptr %18, align 8, !tbaa !11
  %366 = getelementptr inbounds [64 x i8], ptr %19, i64 0, i64 0
  %367 = load i64, ptr %20, align 8, !tbaa !11
  %368 = load ptr, ptr %11, align 8, !tbaa !9
  %369 = load i64, ptr %13, align 8, !tbaa !11
  %370 = load i32, ptr %14, align 4, !tbaa !5
  %371 = sext i32 %370 to i64
  %372 = call i32 @sm4_gcm_decrypt_init(ptr noundef %23, ptr noundef %364, i64 noundef %365, ptr noundef %366, i64 noundef %367, ptr noundef %368, i64 noundef %369, i64 noundef %371)
  %373 = icmp ne i32 %372, 1
  br i1 %373, label %374, label %380

374:                                              ; preds = %363
  br label %375

375:                                              ; preds = %374
  %376 = load ptr, ptr @stderr, align 8, !tbaa !9
  %377 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %376, ptr noundef @.str.29, ptr noundef @.str.30, i32 noundef 195, ptr noundef @__FUNCTION__.sm4_gcm_main) #8
  br label %378

378:                                              ; preds = %375
  br label %379

379:                                              ; preds = %378
  br label %471

380:                                              ; preds = %363
  br label %381

381:                                              ; preds = %380, %362
  br label %382

382:                                              ; preds = %430, %381
  %383 = getelementptr inbounds [4096 x i8], ptr %24, i64 0, i64 0
  %384 = load ptr, ptr %21, align 8, !tbaa !9
  %385 = call i64 @fread(ptr noundef %383, i64 noundef 1, i64 noundef 4096, ptr noundef %384)
  store i64 %385, ptr %25, align 8, !tbaa !11
  %386 = icmp ugt i64 %385, 0
  br i1 %386, label %387, label %431

387:                                              ; preds = %382
  %388 = load i32, ptr %8, align 4, !tbaa !5
  %389 = icmp ne i32 %388, 0
  br i1 %389, label %390, label %403

390:                                              ; preds = %387
  %391 = getelementptr inbounds [4096 x i8], ptr %24, i64 0, i64 0
  %392 = load i64, ptr %25, align 8, !tbaa !11
  %393 = getelementptr inbounds [4096 x i8], ptr %24, i64 0, i64 0
  %394 = call i32 @sm4_gcm_encrypt_update(ptr noundef %23, ptr noundef %391, i64 noundef %392, ptr noundef %393, ptr noundef %26)
  %395 = icmp ne i32 %394, 1
  br i1 %395, label %396, label %402

396:                                              ; preds = %390
  br label %397

397:                                              ; preds = %396
  %398 = load ptr, ptr @stderr, align 8, !tbaa !9
  %399 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %398, ptr noundef @.str.29, ptr noundef @.str.30, i32 noundef 203, ptr noundef @__FUNCTION__.sm4_gcm_main) #8
  br label %400

400:                                              ; preds = %397
  br label %401

401:                                              ; preds = %400
  br label %471

402:                                              ; preds = %390
  br label %416

403:                                              ; preds = %387
  %404 = getelementptr inbounds [4096 x i8], ptr %24, i64 0, i64 0
  %405 = load i64, ptr %25, align 8, !tbaa !11
  %406 = getelementptr inbounds [4096 x i8], ptr %24, i64 0, i64 0
  %407 = call i32 @sm4_gcm_decrypt_update(ptr noundef %23, ptr noundef %404, i64 noundef %405, ptr noundef %406, ptr noundef %26)
  %408 = icmp ne i32 %407, 1
  br i1 %408, label %409, label %415

409:                                              ; preds = %403
  br label %410

410:                                              ; preds = %409
  %411 = load ptr, ptr @stderr, align 8, !tbaa !9
  %412 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %411, ptr noundef @.str.29, ptr noundef @.str.30, i32 noundef 208, ptr noundef @__FUNCTION__.sm4_gcm_main) #8
  br label %413

413:                                              ; preds = %410
  br label %414

414:                                              ; preds = %413
  br label %471

415:                                              ; preds = %403
  br label %416

416:                                              ; preds = %415, %402
  %417 = getelementptr inbounds [4096 x i8], ptr %24, i64 0, i64 0
  %418 = load i64, ptr %26, align 8, !tbaa !11
  %419 = load ptr, ptr %22, align 8, !tbaa !9
  %420 = call i64 @fwrite(ptr noundef %417, i64 noundef 1, i64 noundef %418, ptr noundef %419)
  %421 = load i64, ptr %26, align 8, !tbaa !11
  %422 = icmp ne i64 %420, %421
  br i1 %422, label %423, label %430

423:                                              ; preds = %416
  %424 = load ptr, ptr @stderr, align 8, !tbaa !9
  %425 = load ptr, ptr %7, align 8, !tbaa !9
  %426 = call ptr @__errno_location() #11
  %427 = load i32, ptr %426, align 4, !tbaa !5
  %428 = call ptr @strerror(i32 noundef %427) #8
  %429 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %424, ptr noundef @.str.31, ptr noundef %425, ptr noundef %428) #8
  br label %471

430:                                              ; preds = %416
  br label %382, !llvm.loop !15

431:                                              ; preds = %382
  %432 = load i32, ptr %8, align 4, !tbaa !5
  %433 = icmp ne i32 %432, 0
  br i1 %433, label %434, label %445

434:                                              ; preds = %431
  %435 = getelementptr inbounds [4096 x i8], ptr %24, i64 0, i64 0
  %436 = call i32 @sm4_gcm_encrypt_finish(ptr noundef %23, ptr noundef %435, ptr noundef %26)
  %437 = icmp ne i32 %436, 1
  br i1 %437, label %438, label %444

438:                                              ; preds = %434
  br label %439

439:                                              ; preds = %438
  %440 = load ptr, ptr @stderr, align 8, !tbaa !9
  %441 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %440, ptr noundef @.str.29, ptr noundef @.str.30, i32 noundef 220, ptr noundef @__FUNCTION__.sm4_gcm_main) #8
  br label %442

442:                                              ; preds = %439
  br label %443

443:                                              ; preds = %442
  br label %471

444:                                              ; preds = %434
  br label %456

445:                                              ; preds = %431
  %446 = getelementptr inbounds [4096 x i8], ptr %24, i64 0, i64 0
  %447 = call i32 @sm4_gcm_decrypt_finish(ptr noundef %23, ptr noundef %446, ptr noundef %26)
  %448 = icmp ne i32 %447, 1
  br i1 %448, label %449, label %455

449:                                              ; preds = %445
  br label %450

450:                                              ; preds = %449
  %451 = load ptr, ptr @stderr, align 8, !tbaa !9
  %452 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %451, ptr noundef @.str.29, ptr noundef @.str.30, i32 noundef 225, ptr noundef @__FUNCTION__.sm4_gcm_main) #8
  br label %453

453:                                              ; preds = %450
  br label %454

454:                                              ; preds = %453
  br label %471

455:                                              ; preds = %445
  br label %456

456:                                              ; preds = %455, %444
  %457 = getelementptr inbounds [4096 x i8], ptr %24, i64 0, i64 0
  %458 = load i64, ptr %26, align 8, !tbaa !11
  %459 = load ptr, ptr %22, align 8, !tbaa !9
  %460 = call i64 @fwrite(ptr noundef %457, i64 noundef 1, i64 noundef %458, ptr noundef %459)
  %461 = load i64, ptr %26, align 8, !tbaa !11
  %462 = icmp ne i64 %460, %461
  br i1 %462, label %463, label %470

463:                                              ; preds = %456
  %464 = load ptr, ptr @stderr, align 8, !tbaa !9
  %465 = load ptr, ptr %7, align 8, !tbaa !9
  %466 = call ptr @__errno_location() #11
  %467 = load i32, ptr %466, align 4, !tbaa !5
  %468 = call ptr @strerror(i32 noundef %467) #8
  %469 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %464, ptr noundef @.str.31, ptr noundef %465, ptr noundef %468) #8
  br label %471

470:                                              ; preds = %456
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %471

471:                                              ; preds = %470, %463, %454, %443, %423, %414, %401, %379, %361, %338, %331, %324, %301, %295, %286, %260, %238, %212, %201, %146, %135, %113, %102, %80, %67, %53
  %472 = getelementptr inbounds [16 x i8], ptr %17, i64 0, i64 0
  call void @gmssl_secure_clear(ptr noundef %472, i64 noundef 16)
  %473 = getelementptr inbounds [64 x i8], ptr %19, i64 0, i64 0
  call void @gmssl_secure_clear(ptr noundef %473, i64 noundef 64)
  call void @gmssl_secure_clear(ptr noundef %23, i64 noundef 296)
  %474 = getelementptr inbounds [4096 x i8], ptr %24, i64 0, i64 0
  call void @gmssl_secure_clear(ptr noundef %474, i64 noundef 4096)
  %475 = load ptr, ptr %15, align 8, !tbaa !9
  %476 = icmp ne ptr %475, null
  br i1 %476, label %477, label %483

477:                                              ; preds = %471
  %478 = load ptr, ptr %21, align 8, !tbaa !9
  %479 = icmp ne ptr %478, null
  br i1 %479, label %480, label %483

480:                                              ; preds = %477
  %481 = load ptr, ptr %21, align 8, !tbaa !9
  %482 = call i32 @fclose(ptr noundef %481)
  br label %483

483:                                              ; preds = %480, %477, %471
  %484 = load ptr, ptr %16, align 8, !tbaa !9
  %485 = icmp ne ptr %484, null
  br i1 %485, label %486, label %492

486:                                              ; preds = %483
  %487 = load ptr, ptr %22, align 8, !tbaa !9
  %488 = icmp ne ptr %487, null
  br i1 %488, label %489, label %492

489:                                              ; preds = %486
  %490 = load ptr, ptr %22, align 8, !tbaa !9
  %491 = call i32 @fclose(ptr noundef %490)
  br label %492

492:                                              ; preds = %489, %486, %483
  %493 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %493, ptr %3, align 4
  store i32 1, ptr %27, align 4
  br label %494

494:                                              ; preds = %492, %39
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #8
  call void @llvm.lifetime.end.p0(i64 4096, ptr %24) #8
  call void @llvm.lifetime.end.p0(i64 296, ptr %23) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #8
  call void @llvm.lifetime.end.p0(i64 64, ptr %19) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #8
  %495 = load i32, ptr %3, align 4
  ret i32 %495
}

; 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

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 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) #4

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

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

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

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

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

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

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

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

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

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

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

declare i32 @fclose(ptr noundef) #4

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

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


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

@stdin = external local_unnamed_addr global ptr, align 8
@stdout = external local_unnamed_addr global ptr, align 8
@stderr = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [20 x i8], align 1
@usage = external hidden local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@options = external hidden local_unnamed_addr global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [61 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [63 x i8], align 1
@__FUNCTION__.sm4_gcm_main = external hidden unnamed_addr constant [13 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [31 x i8], align 1

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

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

.preheader:                                       ; preds = %2, %157
  %.0104370 = phi ptr [ %.1, %157 ], [ %13, %2 ]
  %.0105369 = phi ptr [ %.1106, %157 ], [ %12, %2 ]
  %.0108368 = phi ptr [ %.1109, %157 ], [ null, %2 ]
  %.0111367 = phi ptr [ %.1112, %157 ], [ null, %2 ]
  %.0114366 = phi i32 [ %.1115, %157 ], [ 16, %2 ]
  %.0116365 = phi ptr [ %.1117, %157 ], [ null, %2 ]
  %.0118364 = phi ptr [ %.1119, %157 ], [ null, %2 ]
  %.0120363 = phi ptr [ %.1121, %157 ], [ null, %2 ]
  %.0122362 = phi i32 [ %.1123, %157 ], [ -1, %2 ]
  %.0124.in361 = phi i32 [ %.1125, %157 ], [ %0, %2 ]
  %.pn360 = phi ptr [ %.1128, %157 ], [ %1, %2 ]
  %.0127371 = getelementptr inbounds i8, ptr %.pn360, i64 8
  %.0124372 = add nsw i32 %.0124.in361, -1
  %19 = load ptr, ptr %.0127371, align 8, !tbaa !5
  %20 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %19, ptr noundef nonnull dereferenceable(1) @.str.1) #11
  %.not157 = icmp eq i32 %20, 0
  br i1 %.not157, label %21, label %26

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

26:                                               ; preds = %.preheader
  %27 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %19, ptr noundef nonnull dereferenceable(1) @.str.3) #11
  %.not158 = icmp eq i32 %27, 0
  br i1 %.not158, label %28, label %33

28:                                               ; preds = %26
  %29 = icmp eq i32 %.0122362, 0
  br i1 %29, label %30, label %157

30:                                               ; preds = %28
  %31 = load ptr, ptr @stderr, align 8, !tbaa !5
  %32 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %31, ptr noundef nonnull @.str.4, ptr noundef %11) #10
  br label %231

33:                                               ; preds = %26
  %34 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %19, ptr noundef nonnull dereferenceable(1) @.str.5) #11
  %.not159 = icmp eq i32 %34, 0
  br i1 %.not159, label %35, label %40

35:                                               ; preds = %33
  %36 = icmp eq i32 %.0122362, 1
  br i1 %36, label %37, label %157

37:                                               ; preds = %35
  %38 = load ptr, ptr @stderr, align 8, !tbaa !5
  %39 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %38, ptr noundef nonnull @.str.4, ptr noundef %11) #10
  br label %231

40:                                               ; preds = %33
  %41 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %19, ptr noundef nonnull dereferenceable(1) @.str.6) #11
  %.not160 = icmp eq i32 %41, 0
  br i1 %.not160, label %42, label %57

42:                                               ; preds = %40
  %43 = add nsw i32 %.0124.in361, -2
  %44 = icmp eq i32 %.0124.in361, 2
  br i1 %44, label %.loopexit, label %45

45:                                               ; preds = %42
  %46 = getelementptr inbounds i8, ptr %.pn360, i64 16
  %47 = load ptr, ptr %46, align 8, !tbaa !5
  %48 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %47) #11
  %.not161 = icmp eq i64 %48, 32
  br i1 %.not161, label %52, label %49

49:                                               ; preds = %45
  %50 = load ptr, ptr @stderr, align 8, !tbaa !5
  %51 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %50, ptr noundef nonnull @.str.7, ptr noundef %11) #10
  br label %231

52:                                               ; preds = %45
  %53 = call i32 @hex_to_bytes(ptr noundef %47, i64 noundef 32, ptr noundef nonnull %4, ptr noundef nonnull %5) #9
  %.not162 = icmp eq i32 %53, 1
  br i1 %.not162, label %157, label %54

54:                                               ; preds = %52
  %55 = load ptr, ptr @stderr, align 8, !tbaa !5
  %56 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %55, ptr noundef nonnull @.str.8, ptr noundef %11) #10
  br label %231

57:                                               ; preds = %40
  %58 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %19, ptr noundef nonnull dereferenceable(1) @.str.9) #11
  %.not163 = icmp eq i32 %58, 0
  br i1 %.not163, label %59, label %75

59:                                               ; preds = %57
  %60 = add nsw i32 %.0124.in361, -2
  %61 = icmp eq i32 %.0124.in361, 2
  br i1 %61, label %.loopexit, label %62

62:                                               ; preds = %59
  %63 = getelementptr inbounds i8, ptr %.pn360, i64 16
  %64 = load ptr, ptr %63, align 8, !tbaa !5
  %65 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %64) #11
  %66 = icmp ugt i64 %65, 128
  br i1 %66, label %67, label %70

67:                                               ; preds = %62
  %68 = load ptr, ptr @stderr, align 8, !tbaa !5
  %69 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %68, ptr noundef nonnull @.str.10, ptr noundef %11) #10
  br label %231

70:                                               ; preds = %62
  %71 = call i32 @hex_to_bytes(ptr noundef %64, i64 noundef %65, ptr noundef nonnull %6, ptr noundef nonnull %7) #9
  %.not164 = icmp eq i32 %71, 1
  br i1 %.not164, label %157, label %72

72:                                               ; preds = %70
  %73 = load ptr, ptr @stderr, align 8, !tbaa !5
  %74 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %73, ptr noundef nonnull @.str.11, ptr noundef %11) #10
  br label %231

75:                                               ; preds = %57
  %76 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %19, ptr noundef nonnull dereferenceable(1) @.str.12) #11
  %.not165 = icmp eq i32 %76, 0
  br i1 %.not165, label %77, label %85

77:                                               ; preds = %75
  %78 = add nsw i32 %.0124.in361, -2
  %79 = icmp eq i32 %.0124.in361, 2
  br i1 %79, label %.loopexit, label %80

80:                                               ; preds = %77
  %.not166 = icmp eq ptr %.0116365, null
  br i1 %.not166, label %81, label %.loopexit.sink.split

81:                                               ; preds = %80
  %82 = getelementptr inbounds i8, ptr %.pn360, i64 16
  %83 = load ptr, ptr %82, align 8, !tbaa !5
  %84 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %83) #11
  store i64 %84, ptr %3, align 8, !tbaa !9
  br label %157

85:                                               ; preds = %75
  %86 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %19, ptr noundef nonnull dereferenceable(1) @.str.14) #11
  %.not167 = icmp eq i32 %86, 0
  br i1 %.not167, label %87, label %106

87:                                               ; preds = %85
  %88 = add nsw i32 %.0124.in361, -2
  %89 = icmp eq i32 %.0124.in361, 2
  br i1 %89, label %.loopexit, label %90

90:                                               ; preds = %87
  %.not168 = icmp eq ptr %.0116365, null
  br i1 %.not168, label %91, label %.loopexit.sink.split

91:                                               ; preds = %90
  %92 = getelementptr inbounds i8, ptr %.pn360, i64 16
  %93 = load ptr, ptr %92, align 8, !tbaa !5
  %94 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %93) #11
  %95 = lshr i64 %94, 1
  %96 = add nuw i64 %95, 1
  %97 = call noalias ptr @malloc(i64 noundef %96) #12
  %.not169 = icmp eq ptr %97, null
  br i1 %.not169, label %98, label %101

98:                                               ; preds = %91
  %99 = load ptr, ptr @stderr, align 8, !tbaa !5
  %100 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %99, ptr noundef nonnull @.str.15, ptr noundef %11) #10
  br label %231

101:                                              ; preds = %91
  %102 = call i32 @hex_to_bytes(ptr noundef %93, i64 noundef %94, ptr noundef nonnull %97, ptr noundef nonnull %3) #9
  %.not170 = icmp eq i32 %102, 1
  br i1 %.not170, label %157, label %103

103:                                              ; preds = %101
  %104 = load ptr, ptr @stderr, align 8, !tbaa !5
  %105 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %104, ptr noundef nonnull @.str.16, ptr noundef %11) #10
  br label %231

106:                                              ; preds = %85
  %107 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %19, ptr noundef nonnull dereferenceable(1) @.str.17) #11
  %.not171 = icmp eq i32 %107, 0
  br i1 %.not171, label %108, label %119

108:                                              ; preds = %106
  %109 = icmp eq i32 %.0124.in361, 2
  br i1 %109, label %.loopexit, label %110

110:                                              ; preds = %108
  %111 = add nsw i32 %.0124.in361, -2
  %112 = getelementptr inbounds i8, ptr %.pn360, i64 16
  %113 = load ptr, ptr %112, align 8, !tbaa !5
  %114 = call i32 @atoi(ptr nocapture noundef %113) #11
  %115 = add i32 %114, -17
  %or.cond = icmp ult i32 %115, -5
  br i1 %or.cond, label %116, label %157

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

119:                                              ; preds = %106
  %120 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %19, ptr noundef nonnull dereferenceable(1) @.str.19) #11
  %.not172 = icmp eq i32 %120, 0
  br i1 %.not172, label %121, label %134

121:                                              ; preds = %119
  %122 = icmp eq i32 %.0124.in361, 2
  br i1 %122, label %.loopexit, label %123

123:                                              ; preds = %121
  %124 = add nsw i32 %.0124.in361, -2
  %125 = getelementptr inbounds i8, ptr %.pn360, i64 16
  %126 = load ptr, ptr %125, align 8, !tbaa !5
  %127 = call noalias ptr @fopen(ptr noundef %126, ptr noundef nonnull @.str.20)
  %.not173 = icmp eq ptr %127, null
  br i1 %.not173, label %128, label %157

128:                                              ; preds = %123
  %129 = load ptr, ptr @stderr, align 8, !tbaa !5
  %130 = tail call ptr @__errno_location() #13
  %131 = load i32, ptr %130, align 4, !tbaa !11
  %132 = call ptr @strerror(i32 noundef %131) #9
  %133 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %129, ptr noundef nonnull @.str.21, ptr noundef %11, ptr noundef %126, ptr noundef %132) #10
  br label %231

134:                                              ; preds = %119
  %135 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %19, ptr noundef nonnull dereferenceable(1) @.str.22) #11
  %.not174 = icmp eq i32 %135, 0
  br i1 %.not174, label %136, label %149

136:                                              ; preds = %134
  %137 = icmp eq i32 %.0124.in361, 2
  br i1 %137, label %.loopexit, label %138

138:                                              ; preds = %136
  %139 = add nsw i32 %.0124.in361, -2
  %140 = getelementptr inbounds i8, ptr %.pn360, i64 16
  %141 = load ptr, ptr %140, align 8, !tbaa !5
  %142 = call noalias ptr @fopen(ptr noundef %141, ptr noundef nonnull @.str.23)
  %.not175 = icmp eq ptr %142, null
  br i1 %.not175, label %143, label %157

143:                                              ; preds = %138
  %144 = load ptr, ptr @stderr, align 8, !tbaa !5
  %145 = tail call ptr @__errno_location() #13
  %146 = load i32, ptr %145, align 4, !tbaa !11
  %147 = call ptr @strerror(i32 noundef %146) #9
  %148 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %144, ptr noundef nonnull @.str.21, ptr noundef %11, ptr noundef %141, ptr noundef %147) #10
  br label %231

149:                                              ; preds = %134
  %150 = load ptr, ptr @stderr, align 8, !tbaa !5
  %151 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %150, ptr noundef nonnull @.str.24, ptr noundef %11, ptr noundef %19) #10
  br label %231

.loopexit.sink.split:                             ; preds = %90, %80
  %152 = load ptr, ptr @stderr, align 8, !tbaa !5
  %153 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %152, ptr noundef nonnull @.str.13, ptr noundef %11) #10
  br label %.loopexit

.loopexit:                                        ; preds = %136, %121, %108, %87, %77, %59, %42, %.loopexit.sink.split
  %154 = load ptr, ptr @stderr, align 8, !tbaa !5
  %155 = load ptr, ptr %.0127371, align 8, !tbaa !5
  %156 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %154, ptr noundef nonnull @.str.25, ptr noundef %11, ptr noundef %155) #10
  br label %231

157:                                              ; preds = %101, %35, %28, %52, %81, %110, %138, %123, %70
  %.1128 = phi ptr [ %140, %138 ], [ %125, %123 ], [ %112, %110 ], [ %82, %81 ], [ %63, %70 ], [ %46, %52 ], [ %.0127371, %28 ], [ %.0127371, %35 ], [ %92, %101 ]
  %.1125 = phi i32 [ %139, %138 ], [ %124, %123 ], [ %111, %110 ], [ %78, %81 ], [ %60, %70 ], [ %43, %52 ], [ %.0124372, %28 ], [ %.0124372, %35 ], [ %88, %101 ]
  %.1123 = phi i32 [ %.0122362, %138 ], [ %.0122362, %123 ], [ %.0122362, %110 ], [ %.0122362, %81 ], [ %.0122362, %70 ], [ %.0122362, %52 ], [ 1, %28 ], [ 0, %35 ], [ %.0122362, %101 ]
  %.1121 = phi ptr [ %.0120363, %138 ], [ %.0120363, %123 ], [ %.0120363, %110 ], [ %.0120363, %81 ], [ %.0120363, %70 ], [ %47, %52 ], [ %.0120363, %28 ], [ %.0120363, %35 ], [ %.0120363, %101 ]
  %.1119 = phi ptr [ %.0118364, %138 ], [ %.0118364, %123 ], [ %.0118364, %110 ], [ %.0118364, %81 ], [ %64, %70 ], [ %.0118364, %52 ], [ %.0118364, %28 ], [ %.0118364, %35 ], [ %.0118364, %101 ]
  %.1117 = phi ptr [ %.0116365, %138 ], [ %.0116365, %123 ], [ %.0116365, %110 ], [ %83, %81 ], [ %.0116365, %70 ], [ %.0116365, %52 ], [ %.0116365, %28 ], [ %.0116365, %35 ], [ %97, %101 ]
  %.1115 = phi i32 [ %.0114366, %138 ], [ %.0114366, %123 ], [ %114, %110 ], [ %.0114366, %81 ], [ %.0114366, %70 ], [ %.0114366, %52 ], [ %.0114366, %28 ], [ %.0114366, %35 ], [ %.0114366, %101 ]
  %.1112 = phi ptr [ %.0111367, %138 ], [ %126, %123 ], [ %.0111367, %110 ], [ %.0111367, %81 ], [ %.0111367, %70 ], [ %.0111367, %52 ], [ %.0111367, %28 ], [ %.0111367, %35 ], [ %.0111367, %101 ]
  %.1109 = phi ptr [ %141, %138 ], [ %.0108368, %123 ], [ %.0108368, %110 ], [ %.0108368, %81 ], [ %.0108368, %70 ], [ %.0108368, %52 ], [ %.0108368, %28 ], [ %.0108368, %35 ], [ %.0108368, %101 ]
  %.1106 = phi ptr [ %.0105369, %138 ], [ %127, %123 ], [ %.0105369, %110 ], [ %.0105369, %81 ], [ %.0105369, %70 ], [ %.0105369, %52 ], [ %.0105369, %28 ], [ %.0105369, %35 ], [ %.0105369, %101 ]
  %.1 = phi ptr [ %142, %138 ], [ %.0104370, %123 ], [ %.0104370, %110 ], [ %.0104370, %81 ], [ %.0104370, %70 ], [ %.0104370, %52 ], [ %.0104370, %28 ], [ %.0104370, %35 ], [ %.0104370, %101 ]
  %158 = icmp sgt i32 %.1125, 1
  br i1 %158, label %.preheader, label %159, !llvm.loop !13

159:                                              ; preds = %157
  %160 = icmp slt i32 %.1123, 0
  br i1 %160, label %161, label %164

161:                                              ; preds = %159
  %162 = load ptr, ptr @stderr, align 8, !tbaa !5
  %163 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %162, ptr noundef nonnull @.str.26, ptr noundef %11) #10
  br label %231

164:                                              ; preds = %159
  %.not = icmp eq ptr %.1121, null
  br i1 %.not, label %165, label %168

165:                                              ; preds = %164
  %166 = load ptr, ptr @stderr, align 8, !tbaa !5
  %167 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %166, ptr noundef nonnull @.str.27, ptr noundef %11) #10
  br label %231

168:                                              ; preds = %164
  %.not146 = icmp eq ptr %.1119, null
  br i1 %.not146, label %169, label %172

169:                                              ; preds = %168
  %170 = load ptr, ptr @stderr, align 8, !tbaa !5
  %171 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %170, ptr noundef nonnull @.str.28, ptr noundef %11) #10
  br label %231

172:                                              ; preds = %168
  %.not147 = icmp eq i32 %.1123, 0
  %173 = load i64, ptr %5, align 8, !tbaa !9
  %174 = load i64, ptr %7, align 8, !tbaa !9
  %175 = load i64, ptr %3, align 8, !tbaa !9
  %176 = sext i32 %.1115 to i64
  br i1 %.not147, label %182, label %177

177:                                              ; preds = %172
  %178 = call i32 @sm4_gcm_encrypt_init(ptr noundef nonnull %8, ptr noundef nonnull %4, i64 noundef %173, ptr noundef nonnull %6, i64 noundef %174, ptr noundef %.1117, i64 noundef %175, i64 noundef %176) #9
  %.not149 = icmp eq i32 %178, 1
  br i1 %.not149, label %.split, label %179

179:                                              ; preds = %177
  %180 = load ptr, ptr @stderr, align 8, !tbaa !5
  %181 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %180, ptr noundef nonnull @.str.29, ptr noundef nonnull @.str.30, i32 noundef 190, ptr noundef nonnull @__FUNCTION__.sm4_gcm_main) #10
  br label %231

182:                                              ; preds = %172
  %183 = call i32 @sm4_gcm_decrypt_init(ptr noundef nonnull %8, ptr noundef nonnull %4, i64 noundef %173, ptr noundef nonnull %6, i64 noundef %174, ptr noundef %.1117, i64 noundef %175, i64 noundef %176) #9
  %.not148 = icmp eq i32 %183, 1
  br i1 %.not148, label %.split.us, label %184

184:                                              ; preds = %182
  %185 = load ptr, ptr @stderr, align 8, !tbaa !5
  %186 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %185, ptr noundef nonnull @.str.29, ptr noundef nonnull @.str.30, i32 noundef 195, ptr noundef nonnull @__FUNCTION__.sm4_gcm_main) #10
  br label %231

.split.us:                                        ; preds = %182, %190
  %187 = call i64 @fread(ptr noundef nonnull %9, i64 noundef 1, i64 noundef 4096, ptr noundef %.1106)
  %.not150.us = icmp eq i64 %187, 0
  br i1 %.not150.us, label %.split374.us, label %188

188:                                              ; preds = %.split.us
  %189 = call i32 @sm4_gcm_decrypt_update(ptr noundef nonnull %8, ptr noundef nonnull %9, i64 noundef %187, ptr noundef nonnull %9, ptr noundef nonnull %10) #9
  %.not154.us = icmp eq i32 %189, 1
  br i1 %.not154.us, label %190, label %.split376.us

190:                                              ; preds = %188
  %191 = load i64, ptr %10, align 8, !tbaa !9
  %192 = call i64 @fwrite(ptr noundef nonnull %9, i64 noundef 1, i64 noundef %191, ptr noundef %.1)
  %193 = load i64, ptr %10, align 8, !tbaa !9
  %.not156.us = icmp eq i64 %192, %193
  br i1 %.not156.us, label %.split.us, label %.split378.us, !llvm.loop !15

.split:                                           ; preds = %177, %202
  %194 = call i64 @fread(ptr noundef nonnull %9, i64 noundef 1, i64 noundef 4096, ptr noundef %.1106)
  %.not150 = icmp eq i64 %194, 0
  br i1 %.not150, label %.split374.us, label %195

195:                                              ; preds = %.split
  %196 = call i32 @sm4_gcm_encrypt_update(ptr noundef nonnull %8, ptr noundef nonnull %9, i64 noundef %194, ptr noundef nonnull %9, ptr noundef nonnull %10) #9
  %.not155 = icmp eq i32 %196, 1
  br i1 %.not155, label %202, label %197

197:                                              ; preds = %195
  %198 = load ptr, ptr @stderr, align 8, !tbaa !5
  %199 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %198, ptr noundef nonnull @.str.29, ptr noundef nonnull @.str.30, i32 noundef 203, ptr noundef nonnull @__FUNCTION__.sm4_gcm_main) #10
  br label %231

.split376.us:                                     ; preds = %188
  %200 = load ptr, ptr @stderr, align 8, !tbaa !5
  %201 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %200, ptr noundef nonnull @.str.29, ptr noundef nonnull @.str.30, i32 noundef 208, ptr noundef nonnull @__FUNCTION__.sm4_gcm_main) #10
  br label %231

202:                                              ; preds = %195
  %203 = load i64, ptr %10, align 8, !tbaa !9
  %204 = call i64 @fwrite(ptr noundef nonnull %9, i64 noundef 1, i64 noundef %203, ptr noundef %.1)
  %205 = load i64, ptr %10, align 8, !tbaa !9
  %.not156 = icmp eq i64 %204, %205
  br i1 %.not156, label %.split, label %.split378.us, !llvm.loop !15

.split378.us:                                     ; preds = %202, %190
  %206 = load ptr, ptr @stderr, align 8, !tbaa !5
  %207 = tail call ptr @__errno_location() #13
  %208 = load i32, ptr %207, align 4, !tbaa !11
  %209 = call ptr @strerror(i32 noundef %208) #9
  %210 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %206, ptr noundef nonnull @.str.31, ptr noundef %11, ptr noundef %209) #10
  br label %231

.split374.us:                                     ; preds = %.split, %.split.us
  br i1 %.not147, label %216, label %211

211:                                              ; preds = %.split374.us
  %212 = call i32 @sm4_gcm_encrypt_finish(ptr noundef nonnull %8, ptr noundef nonnull %9, ptr noundef nonnull %10) #9
  %.not152 = icmp eq i32 %212, 1
  br i1 %.not152, label %221, label %213

213:                                              ; preds = %211
  %214 = load ptr, ptr @stderr, align 8, !tbaa !5
  %215 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %214, ptr noundef nonnull @.str.29, ptr noundef nonnull @.str.30, i32 noundef 220, ptr noundef nonnull @__FUNCTION__.sm4_gcm_main) #10
  br label %231

216:                                              ; preds = %.split374.us
  %217 = call i32 @sm4_gcm_decrypt_finish(ptr noundef nonnull %8, ptr noundef nonnull %9, ptr noundef nonnull %10) #9
  %.not151 = icmp eq i32 %217, 1
  br i1 %.not151, label %221, label %218

218:                                              ; preds = %216
  %219 = load ptr, ptr @stderr, align 8, !tbaa !5
  %220 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %219, ptr noundef nonnull @.str.29, ptr noundef nonnull @.str.30, i32 noundef 225, ptr noundef nonnull @__FUNCTION__.sm4_gcm_main) #10
  br label %231

221:                                              ; preds = %216, %211
  %222 = load i64, ptr %10, align 8, !tbaa !9
  %223 = call i64 @fwrite(ptr noundef nonnull %9, i64 noundef 1, i64 noundef %222, ptr noundef %.1)
  %224 = load i64, ptr %10, align 8, !tbaa !9
  %.not153 = icmp eq i64 %223, %224
  br i1 %.not153, label %231, label %225

225:                                              ; preds = %221
  %226 = load ptr, ptr @stderr, align 8, !tbaa !5
  %227 = tail call ptr @__errno_location() #13
  %228 = load i32, ptr %227, align 4, !tbaa !11
  %229 = call ptr @strerror(i32 noundef %228) #9
  %230 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %226, ptr noundef nonnull @.str.31, ptr noundef %11, ptr noundef %229) #10
  br label %231

231:                                              ; preds = %221, %225, %218, %213, %.split378.us, %.split376.us, %197, %184, %179, %169, %165, %161, %.loopexit, %149, %143, %128, %116, %103, %98, %72, %67, %54, %49, %37, %30, %21
  %.0126 = phi i32 [ 1, %149 ], [ 1, %.loopexit ], [ 1, %143 ], [ 1, %128 ], [ 1, %116 ], [ 1, %103 ], [ 1, %98 ], [ 1, %67 ], [ 1, %72 ], [ 1, %49 ], [ 1, %54 ], [ 1, %37 ], [ 1, %30 ], [ 0, %21 ], [ 1, %161 ], [ 1, %179 ], [ 1, %197 ], [ 1, %.split378.us ], [ 1, %.split376.us ], [ 1, %213 ], [ 1, %225 ], [ 1, %218 ], [ 1, %184 ], [ 1, %169 ], [ 1, %165 ], [ 0, %221 ]
  %.2113 = phi ptr [ %.0111367, %149 ], [ %.0111367, %.loopexit ], [ %.0111367, %143 ], [ %126, %128 ], [ %.0111367, %116 ], [ %.0111367, %103 ], [ %.0111367, %98 ], [ %.0111367, %67 ], [ %.0111367, %72 ], [ %.0111367, %49 ], [ %.0111367, %54 ], [ %.0111367, %37 ], [ %.0111367, %30 ], [ %.0111367, %21 ], [ %.1112, %161 ], [ %.1112, %179 ], [ %.1112, %197 ], [ %.1112, %.split378.us ], [ %.1112, %.split376.us ], [ %.1112, %213 ], [ %.1112, %225 ], [ %.1112, %218 ], [ %.1112, %184 ], [ %.1112, %169 ], [ %.1112, %165 ], [ %.1112, %221 ]
  %.2110 = phi ptr [ %.0108368, %149 ], [ %.0108368, %.loopexit ], [ %141, %143 ], [ %.0108368, %128 ], [ %.0108368, %116 ], [ %.0108368, %103 ], [ %.0108368, %98 ], [ %.0108368, %67 ], [ %.0108368, %72 ], [ %.0108368, %49 ], [ %.0108368, %54 ], [ %.0108368, %37 ], [ %.0108368, %30 ], [ %.0108368, %21 ], [ %.1109, %161 ], [ %.1109, %179 ], [ %.1109, %197 ], [ %.1109, %.split378.us ], [ %.1109, %.split376.us ], [ %.1109, %213 ], [ %.1109, %225 ], [ %.1109, %218 ], [ %.1109, %184 ], [ %.1109, %169 ], [ %.1109, %165 ], [ %.1109, %221 ]
  %.2107 = phi ptr [ %.0105369, %149 ], [ %.0105369, %.loopexit ], [ %.0105369, %143 ], [ null, %128 ], [ %.0105369, %116 ], [ %.0105369, %103 ], [ %.0105369, %98 ], [ %.0105369, %67 ], [ %.0105369, %72 ], [ %.0105369, %49 ], [ %.0105369, %54 ], [ %.0105369, %37 ], [ %.0105369, %30 ], [ %.0105369, %21 ], [ %.1106, %161 ], [ %.1106, %179 ], [ %.1106, %197 ], [ %.1106, %.split378.us ], [ %.1106, %.split376.us ], [ %.1106, %213 ], [ %.1106, %225 ], [ %.1106, %218 ], [ %.1106, %184 ], [ %.1106, %169 ], [ %.1106, %165 ], [ %.1106, %221 ]
  %.2 = phi ptr [ %.0104370, %149 ], [ %.0104370, %.loopexit ], [ null, %143 ], [ %.0104370, %128 ], [ %.0104370, %116 ], [ %.0104370, %103 ], [ %.0104370, %98 ], [ %.0104370, %67 ], [ %.0104370, %72 ], [ %.0104370, %49 ], [ %.0104370, %54 ], [ %.0104370, %37 ], [ %.0104370, %30 ], [ %.0104370, %21 ], [ %.1, %161 ], [ %.1, %179 ], [ %.1, %197 ], [ %.1, %.split378.us ], [ %.1, %.split376.us ], [ %.1, %213 ], [ %.1, %225 ], [ %.1, %218 ], [ %.1, %184 ], [ %.1, %169 ], [ %.1, %165 ], [ %.1, %221 ]
  call void @gmssl_secure_clear(ptr noundef nonnull %4, i64 noundef 16) #9
  call void @gmssl_secure_clear(ptr noundef nonnull %6, i64 noundef 64) #9
  call void @gmssl_secure_clear(ptr noundef nonnull %8, i64 noundef 296) #9
  call void @gmssl_secure_clear(ptr noundef nonnull %9, i64 noundef 4096) #9
  %232 = icmp ne ptr %.2113, null
  %233 = icmp ne ptr %.2107, null
  %or.cond3 = select i1 %232, i1 %233, i1 false
  br i1 %or.cond3, label %234, label %236

234:                                              ; preds = %231
  %235 = call i32 @fclose(ptr noundef nonnull %.2107)
  br label %236

236:                                              ; preds = %234, %231
  %237 = icmp ne ptr %.2110, null
  %238 = icmp ne ptr %.2, null
  %or.cond5 = select i1 %237, i1 %238, i1 false
  br i1 %or.cond5, label %239, label %241

239:                                              ; preds = %236
  %240 = call i32 @fclose(ptr noundef nonnull %.2)
  br label %241

241:                                              ; preds = %236, %239, %15
  %.0 = phi i32 [ 1, %15 ], [ %.0126, %239 ], [ %.0126, %236 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #9
  call void @llvm.lifetime.end.p0(i64 4096, ptr nonnull %9) #9
  call void @llvm.lifetime.end.p0(i64 296, ptr nonnull %8) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #9
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %6) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #9
  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: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #5

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

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

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

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

declare i32 @sm4_gcm_decrypt_init(ptr noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef, ptr noundef, i64 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

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

declare i32 @sm4_gcm_decrypt_update(ptr noundef, ptr noundef, i64 noundef, 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 i32 @sm4_gcm_encrypt_finish(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #4

declare i32 @sm4_gcm_decrypt_finish(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #4

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

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

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 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 #7 = { 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 #8 = { 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 #9 = { nounwind }
attributes #10 = { cold nounwind }
attributes #11 = { nounwind willreturn memory(read) }
attributes #12 = { nounwind allocsize(0) }
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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


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