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

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.SDF_DEVICE = type { ptr, [41 x i8], [17 x i8], [17 x i8] }
%struct.SDF_PRIVATE_KEY = type { ptr, i32 }
%struct.SDF_SIGN_CTX = type { %struct.SM3_CTX, %struct.SM3_CTX, %struct.SDF_PRIVATE_KEY }
%struct.SM3_CTX = type { [8 x i32], i64, [64 x i8], i64 }

@.str = external hidden unnamed_addr constant [17 x i8], align 1
@stdin = external global ptr, align 8
@stdout = external global ptr, align 8
@stderr = external global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [20 x i8], align 1
@usage = external hidden global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@options = external hidden global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [40 x i8], align 1

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

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

40:                                               ; preds = %2
  br label %41

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

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

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

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

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

64:                                               ; preds = %60
  br label %178

65:                                               ; preds = %60
  %66 = load ptr, ptr %5, align 8, !tbaa !9
  %67 = getelementptr inbounds ptr, ptr %66, i32 1
  store ptr %67, ptr %5, align 8, !tbaa !9
  %68 = load ptr, ptr %67, align 8, !tbaa !9
  store ptr %68, ptr %8, align 8, !tbaa !9
  br label %189

69:                                               ; preds = %55
  %70 = load ptr, ptr %5, align 8, !tbaa !9
  %71 = load ptr, ptr %70, align 8, !tbaa !9
  %72 = call i32 @strcmp(ptr noundef %71, ptr noundef @.str.5) #8
  %73 = icmp ne i32 %72, 0
  br i1 %73, label %92, label %74

74:                                               ; preds = %69
  %75 = load i32, ptr %4, align 4, !tbaa !5
  %76 = add nsw i32 %75, -1
  store i32 %76, ptr %4, align 4, !tbaa !5
  %77 = icmp slt i32 %76, 1
  br i1 %77, label %78, label %79

78:                                               ; preds = %74
  br label %178

79:                                               ; preds = %74
  %80 = load ptr, ptr %5, align 8, !tbaa !9
  %81 = getelementptr inbounds ptr, ptr %80, i32 1
  store ptr %81, ptr %5, align 8, !tbaa !9
  %82 = load ptr, ptr %81, align 8, !tbaa !9
  %83 = call i32 @atoi(ptr noundef %82) #8
  store i32 %83, ptr %9, align 4, !tbaa !5
  %84 = load i32, ptr %9, align 4, !tbaa !5
  %85 = icmp slt i32 %84, 0
  br i1 %85, label %86, label %91

86:                                               ; preds = %79
  %87 = load ptr, ptr @stderr, align 8, !tbaa !9
  %88 = load ptr, ptr %7, align 8, !tbaa !9
  %89 = load i32, ptr %9, align 4, !tbaa !5
  %90 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %87, ptr noundef @.str.6, ptr noundef %88, i32 noundef %89) #7
  br label %295

91:                                               ; preds = %79
  br label %188

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

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

101:                                              ; preds = %97
  br label %178

102:                                              ; preds = %97
  %103 = load ptr, ptr %5, align 8, !tbaa !9
  %104 = getelementptr inbounds ptr, ptr %103, i32 1
  store ptr %104, ptr %5, align 8, !tbaa !9
  %105 = load ptr, ptr %104, align 8, !tbaa !9
  store ptr %105, ptr %10, align 8, !tbaa !9
  br label %187

106:                                              ; preds = %92
  %107 = load ptr, ptr %5, align 8, !tbaa !9
  %108 = load ptr, ptr %107, align 8, !tbaa !9
  %109 = call i32 @strcmp(ptr noundef %108, ptr noundef @.str.8) #8
  %110 = icmp ne i32 %109, 0
  br i1 %110, label %120, label %111

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

115:                                              ; preds = %111
  br label %178

116:                                              ; preds = %111
  %117 = load ptr, ptr %5, align 8, !tbaa !9
  %118 = getelementptr inbounds ptr, ptr %117, i32 1
  store ptr %118, ptr %5, align 8, !tbaa !9
  %119 = load ptr, ptr %118, align 8, !tbaa !9
  store ptr %119, ptr %11, align 8, !tbaa !9
  br label %186

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

125:                                              ; preds = %120
  %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 %178

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 %12, align 8, !tbaa !9
  %134 = load ptr, ptr %12, align 8, !tbaa !9
  %135 = call noalias ptr @fopen(ptr noundef %134, ptr noundef @.str.10)
  store ptr %135, ptr %14, align 8, !tbaa !9
  %136 = icmp ne ptr %135, null
  br i1 %136, label %145, label %137

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

145:                                              ; preds = %130
  br label %185

146:                                              ; preds = %120
  %147 = load ptr, ptr %5, align 8, !tbaa !9
  %148 = load ptr, ptr %147, align 8, !tbaa !9
  %149 = call i32 @strcmp(ptr noundef %148, ptr noundef @.str.12) #8
  %150 = icmp ne i32 %149, 0
  br i1 %150, label %172, label %151

151:                                              ; preds = %146
  %152 = load i32, ptr %4, align 4, !tbaa !5
  %153 = add nsw i32 %152, -1
  store i32 %153, ptr %4, align 4, !tbaa !5
  %154 = icmp slt i32 %153, 1
  br i1 %154, label %155, label %156

155:                                              ; preds = %151
  br label %178

156:                                              ; preds = %151
  %157 = load ptr, ptr %5, align 8, !tbaa !9
  %158 = getelementptr inbounds ptr, ptr %157, i32 1
  store ptr %158, ptr %5, align 8, !tbaa !9
  %159 = load ptr, ptr %158, align 8, !tbaa !9
  store ptr %159, ptr %13, align 8, !tbaa !9
  %160 = load ptr, ptr %13, align 8, !tbaa !9
  %161 = call noalias ptr @fopen(ptr noundef %160, ptr noundef @.str.13)
  store ptr %161, ptr %15, align 8, !tbaa !9
  %162 = icmp ne ptr %161, null
  br i1 %162, label %171, label %163

163:                                              ; preds = %156
  %164 = load ptr, ptr @stderr, align 8, !tbaa !9
  %165 = load ptr, ptr %7, align 8, !tbaa !9
  %166 = load ptr, ptr %13, align 8, !tbaa !9
  %167 = call ptr @__errno_location() #9
  %168 = load i32, ptr %167, align 4, !tbaa !5
  %169 = call ptr @strerror(i32 noundef %168) #7
  %170 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %164, ptr noundef @.str.11, ptr noundef %165, ptr noundef %166, ptr noundef %169) #7
  br label %295

171:                                              ; preds = %156
  br label %184

172:                                              ; preds = %146
  %173 = load ptr, ptr @stderr, align 8, !tbaa !9
  %174 = load ptr, ptr %7, align 8, !tbaa !9
  %175 = load ptr, ptr %5, align 8, !tbaa !9
  %176 = load ptr, ptr %175, align 8, !tbaa !9
  %177 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %173, ptr noundef @.str.14, ptr noundef %174, ptr noundef %176) #7
  br label %295

178:                                              ; preds = %155, %129, %115, %101, %78, %64
  %179 = load ptr, ptr @stderr, align 8, !tbaa !9
  %180 = load ptr, ptr %7, align 8, !tbaa !9
  %181 = load ptr, ptr %5, align 8, !tbaa !9
  %182 = load ptr, ptr %181, align 8, !tbaa !9
  %183 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %179, ptr noundef @.str.15, ptr noundef %180, ptr noundef %182) #7
  br label %295

184:                                              ; preds = %171
  br label %185

185:                                              ; preds = %184, %145
  br label %186

186:                                              ; preds = %185, %116
  br label %187

187:                                              ; preds = %186, %102
  br label %188

188:                                              ; preds = %187, %91
  br label %189

189:                                              ; preds = %188, %65
  br label %190

190:                                              ; preds = %189
  %191 = load i32, ptr %4, align 4, !tbaa !5
  %192 = add nsw i32 %191, -1
  store i32 %192, ptr %4, align 4, !tbaa !5
  %193 = load ptr, ptr %5, align 8, !tbaa !9
  %194 = getelementptr inbounds ptr, ptr %193, i32 1
  store ptr %194, ptr %5, align 8, !tbaa !9
  br label %41, !llvm.loop !11

195:                                              ; preds = %41
  %196 = load ptr, ptr %8, align 8, !tbaa !9
  %197 = icmp ne ptr %196, null
  br i1 %197, label %202, label %198

198:                                              ; preds = %195
  %199 = load ptr, ptr @stderr, align 8, !tbaa !9
  %200 = load ptr, ptr %7, align 8, !tbaa !9
  %201 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %199, ptr noundef @.str.16, ptr noundef %200) #7
  br label %295

202:                                              ; preds = %195
  %203 = load i32, ptr %9, align 4, !tbaa !5
  %204 = icmp slt i32 %203, 0
  br i1 %204, label %205, label %209

205:                                              ; preds = %202
  %206 = load ptr, ptr @stderr, align 8, !tbaa !9
  %207 = load ptr, ptr %7, align 8, !tbaa !9
  %208 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %206, ptr noundef @.str.17, ptr noundef %207) #7
  br label %295

209:                                              ; preds = %202
  %210 = load ptr, ptr %10, 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 %295

216:                                              ; preds = %209
  %217 = load ptr, ptr %8, align 8, !tbaa !9
  %218 = call i32 @sdf_load_library(ptr noundef %217, ptr noundef null)
  %219 = icmp ne i32 %218, 1
  br i1 %219, label %220, label %224

220:                                              ; preds = %216
  %221 = load ptr, ptr @stderr, align 8, !tbaa !9
  %222 = load ptr, ptr %7, align 8, !tbaa !9
  %223 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %221, ptr noundef @.str.19, ptr noundef %222) #7
  br label %295

224:                                              ; preds = %216
  %225 = call i32 @sdf_open_device(ptr noundef %20)
  %226 = icmp ne i32 %225, 1
  br i1 %226, label %227, label %231

227:                                              ; preds = %224
  %228 = load ptr, ptr @stderr, align 8, !tbaa !9
  %229 = load ptr, ptr %7, align 8, !tbaa !9
  %230 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %228, ptr noundef @.str.20, ptr noundef %229) #7
  br label %295

231:                                              ; preds = %224
  %232 = load i32, ptr %9, align 4, !tbaa !5
  %233 = load ptr, ptr %10, align 8, !tbaa !9
  %234 = call i32 @sdf_load_private_key(ptr noundef %20, ptr noundef %21, i32 noundef %232, ptr noundef %233)
  %235 = icmp ne i32 %234, 1
  br i1 %235, label %236, label %242

236:                                              ; preds = %231
  %237 = call i32 @sdf_close_device(ptr noundef %20)
  %238 = load ptr, ptr @stderr, align 8, !tbaa !9
  %239 = load ptr, ptr %7, align 8, !tbaa !9
  %240 = load i32, ptr %9, align 4, !tbaa !5
  %241 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %238, ptr noundef @.str.21, ptr noundef %239, i32 noundef %240) #7
  br label %295

242:                                              ; preds = %231
  %243 = load ptr, ptr %11, align 8, !tbaa !9
  %244 = load ptr, ptr %11, align 8, !tbaa !9
  %245 = call i64 @strlen(ptr noundef %244) #8
  %246 = call i32 @sdf_sign_init(ptr noundef %22, ptr noundef %21, ptr noundef %243, i64 noundef %245)
  %247 = icmp ne i32 %246, 1
  br i1 %247, label %248, label %253

248:                                              ; preds = %242
  %249 = call i32 @sdf_close_device(ptr noundef %20)
  %250 = load ptr, ptr @stderr, align 8, !tbaa !9
  %251 = load ptr, ptr %7, align 8, !tbaa !9
  %252 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %250, ptr noundef @.str.22, ptr noundef %251) #7
  br label %295

253:                                              ; preds = %242
  br label %254

254:                                              ; preds = %269, %253
  %255 = getelementptr inbounds [4096 x i8], ptr %16, i64 0, i64 0
  %256 = load ptr, ptr %14, align 8, !tbaa !9
  %257 = call i64 @fread(ptr noundef %255, i64 noundef 1, i64 noundef 4096, ptr noundef %256)
  store i64 %257, ptr %17, align 8, !tbaa !13
  %258 = icmp ugt i64 %257, 0
  br i1 %258, label %259, label %270

259:                                              ; preds = %254
  %260 = getelementptr inbounds [4096 x i8], ptr %16, i64 0, i64 0
  %261 = load i64, ptr %17, align 8, !tbaa !13
  %262 = call i32 @sdf_sign_update(ptr noundef %22, ptr noundef %260, i64 noundef %261)
  %263 = icmp ne i32 %262, 1
  br i1 %263, label %264, label %269

264:                                              ; preds = %259
  %265 = call i32 @sdf_close_device(ptr noundef %20)
  %266 = load ptr, ptr @stderr, align 8, !tbaa !9
  %267 = load ptr, ptr %7, align 8, !tbaa !9
  %268 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %266, ptr noundef @.str.22, ptr noundef %267) #7
  br label %295

269:                                              ; preds = %259
  br label %254, !llvm.loop !15

270:                                              ; preds = %254
  %271 = getelementptr inbounds [72 x i8], ptr %18, i64 0, i64 0
  %272 = call i32 @sdf_sign_finish(ptr noundef %22, ptr noundef %271, ptr noundef %19)
  %273 = icmp ne i32 %272, 1
  br i1 %273, label %274, label %279

274:                                              ; preds = %270
  %275 = call i32 @sdf_close_device(ptr noundef %20)
  %276 = load ptr, ptr @stderr, align 8, !tbaa !9
  %277 = load ptr, ptr %7, align 8, !tbaa !9
  %278 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %276, ptr noundef @.str.22, ptr noundef %277) #7
  br label %295

279:                                              ; preds = %270
  %280 = call i32 @sdf_close_device(ptr noundef %20)
  %281 = getelementptr inbounds [72 x i8], ptr %18, i64 0, i64 0
  %282 = load i64, ptr %19, align 8, !tbaa !13
  %283 = load ptr, ptr %15, align 8, !tbaa !9
  %284 = call i64 @fwrite(ptr noundef %281, i64 noundef 1, i64 noundef %282, ptr noundef %283)
  %285 = load i64, ptr %19, align 8, !tbaa !13
  %286 = icmp ne i64 %284, %285
  br i1 %286, label %287, label %294

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

294:                                              ; preds = %279
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %295

295:                                              ; preds = %294, %287, %274, %264, %248, %236, %227, %220, %212, %205, %198, %178, %172, %163, %137, %86, %49
  call void @sdf_unload_library()
  %296 = load ptr, ptr %12, align 8, !tbaa !9
  %297 = icmp ne ptr %296, null
  br i1 %297, label %298, label %304

298:                                              ; preds = %295
  %299 = load ptr, ptr %14, align 8, !tbaa !9
  %300 = icmp ne ptr %299, null
  br i1 %300, label %301, label %304

301:                                              ; preds = %298
  %302 = load ptr, ptr %14, align 8, !tbaa !9
  %303 = call i32 @fclose(ptr noundef %302)
  br label %304

304:                                              ; preds = %301, %298, %295
  %305 = load ptr, ptr %13, align 8, !tbaa !9
  %306 = icmp ne ptr %305, null
  br i1 %306, label %307, label %313

307:                                              ; preds = %304
  %308 = load ptr, ptr %15, align 8, !tbaa !9
  %309 = icmp ne ptr %308, null
  br i1 %309, label %310, label %313

310:                                              ; preds = %307
  %311 = load ptr, ptr %15, align 8, !tbaa !9
  %312 = call i32 @fclose(ptr noundef %311)
  br label %313

313:                                              ; preds = %310, %307, %304
  %314 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %314, ptr %3, align 4
  store i32 1, ptr %23, align 4
  br label %315

315:                                              ; preds = %313, %35
  call void @llvm.lifetime.end.p0(i64 240, ptr %22) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %21) #7
  call void @llvm.lifetime.end.p0(i64 88, ptr %20) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 72, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 4096, 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 8, 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
  %316 = load i32, ptr %3, align 4
  ret i32 %316
}

; 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: inlinehint nounwind willreturn memory(read) uwtable
declare i32 @atoi(ptr noundef nonnull) #5

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() #6

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

declare i32 @sdf_open_device(ptr noundef) #4

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

declare i32 @sdf_close_device(ptr noundef) #4

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

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

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

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

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

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

declare void @sdf_unload_library() #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 = { 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 #6 = { 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 = { 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}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.SDF_DEVICE = type { ptr, [41 x i8], [17 x i8], [17 x i8] }
%struct.SDF_PRIVATE_KEY = type { ptr, i32 }
%struct.SDF_SIGN_CTX = type { %struct.SM3_CTX, %struct.SM3_CTX, %struct.SDF_PRIVATE_KEY }
%struct.SM3_CTX = type { [8 x i32], i64, [64 x i8], i64 }

@.str = external hidden unnamed_addr constant [17 x i8], align 1
@stdin = external local_unnamed_addr global ptr, align 8
@stdout = external local_unnamed_addr global ptr, align 8
@stderr = external local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [20 x i8], align 1
@usage = external hidden local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@options = external hidden local_unnamed_addr global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [40 x i8], align 1

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

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

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

.preheader128:                                    ; preds = %.preheader128.preheader, %92
  %.073194 = phi ptr [ %.1, %92 ], [ %11, %.preheader128.preheader ]
  %.074193 = phi ptr [ %.175, %92 ], [ %10, %.preheader128.preheader ]
  %.077192 = phi ptr [ %.178, %92 ], [ null, %.preheader128.preheader ]
  %.080191 = phi ptr [ %.181, %92 ], [ null, %.preheader128.preheader ]
  %.083190 = phi ptr [ %.184, %92 ], [ @.str, %.preheader128.preheader ]
  %.085189 = phi ptr [ %.186, %92 ], [ null, %.preheader128.preheader ]
  %.087188 = phi i32 [ %.188, %92 ], [ -1, %.preheader128.preheader ]
  %.089187 = phi ptr [ %.190, %92 ], [ null, %.preheader128.preheader ]
  %.091.in186 = phi i32 [ %.192, %92 ], [ %0, %.preheader128.preheader ]
  %.094185 = phi ptr [ %93, %92 ], [ %13, %.preheader128.preheader ]
  %18 = load ptr, ptr %.094185, align 8, !tbaa !5
  %19 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %18, ptr noundef nonnull dereferenceable(1) @.str.2) #10
  %.not119 = icmp eq i32 %19, 0
  br i1 %.not119, label %20, label %25

20:                                               ; preds = %.preheader128
  %21 = load ptr, ptr @usage, align 8, !tbaa !5
  %22 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef %9, ptr noundef %21)
  %23 = load ptr, ptr @options, align 8, !tbaa !5
  %24 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef %23)
  br label %154

25:                                               ; preds = %.preheader128
  %26 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %18, ptr noundef nonnull dereferenceable(1) @.str.4) #10
  %.not120 = icmp eq i32 %26, 0
  br i1 %.not120, label %27, label %32

27:                                               ; preds = %25
  %28 = icmp eq i32 %.091.in186, 2
  br i1 %28, label %89, label %29

29:                                               ; preds = %27
  %30 = getelementptr inbounds i8, ptr %.094185, i64 8
  %31 = load ptr, ptr %30, align 8, !tbaa !5
  br label %92

32:                                               ; preds = %25
  %33 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %18, ptr noundef nonnull dereferenceable(1) @.str.5) #10
  %.not121 = icmp eq i32 %33, 0
  br i1 %.not121, label %34, label %44

34:                                               ; preds = %32
  %35 = icmp eq i32 %.091.in186, 2
  br i1 %35, label %89, label %36

36:                                               ; preds = %34
  %37 = getelementptr inbounds i8, ptr %.094185, i64 8
  %38 = load ptr, ptr %37, align 8, !tbaa !5
  %39 = tail call i32 @atoi(ptr nocapture noundef %38) #10
  %40 = icmp slt i32 %39, 0
  br i1 %40, label %41, label %92

41:                                               ; preds = %36
  %42 = load ptr, ptr @stderr, align 8, !tbaa !5
  %43 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %42, ptr noundef nonnull @.str.6, ptr noundef %9, i32 noundef %39) #9
  br label %154

44:                                               ; preds = %32
  %45 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %18, ptr noundef nonnull dereferenceable(1) @.str.7) #10
  %.not122 = icmp eq i32 %45, 0
  br i1 %.not122, label %46, label %51

46:                                               ; preds = %44
  %47 = icmp eq i32 %.091.in186, 2
  br i1 %47, label %89, label %48

48:                                               ; preds = %46
  %49 = getelementptr inbounds i8, ptr %.094185, i64 8
  %50 = load ptr, ptr %49, align 8, !tbaa !5
  br label %92

51:                                               ; preds = %44
  %52 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %18, ptr noundef nonnull dereferenceable(1) @.str.8) #10
  %.not123 = icmp eq i32 %52, 0
  br i1 %.not123, label %53, label %58

53:                                               ; preds = %51
  %54 = icmp eq i32 %.091.in186, 2
  br i1 %54, label %89, label %55

55:                                               ; preds = %53
  %56 = getelementptr inbounds i8, ptr %.094185, i64 8
  %57 = load ptr, ptr %56, align 8, !tbaa !5
  br label %92

58:                                               ; preds = %51
  %59 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %18, ptr noundef nonnull dereferenceable(1) @.str.9) #10
  %.not124 = icmp eq i32 %59, 0
  br i1 %.not124, label %60, label %72

60:                                               ; preds = %58
  %61 = icmp eq i32 %.091.in186, 2
  br i1 %61, label %89, label %62

62:                                               ; preds = %60
  %63 = getelementptr inbounds i8, ptr %.094185, i64 8
  %64 = load ptr, ptr %63, align 8, !tbaa !5
  %65 = tail call noalias ptr @fopen(ptr noundef %64, ptr noundef nonnull @.str.10)
  %.not125 = icmp eq ptr %65, null
  br i1 %.not125, label %66, label %92

66:                                               ; preds = %62
  %67 = load ptr, ptr @stderr, align 8, !tbaa !5
  %68 = tail call ptr @__errno_location() #11
  %69 = load i32, ptr %68, align 4, !tbaa !9
  %70 = tail call ptr @strerror(i32 noundef %69) #8
  %71 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %67, ptr noundef nonnull @.str.11, ptr noundef %9, ptr noundef %64, ptr noundef %70) #9
  br label %154

72:                                               ; preds = %58
  %73 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %18, ptr noundef nonnull dereferenceable(1) @.str.12) #10
  %.not126 = icmp eq i32 %73, 0
  br i1 %.not126, label %74, label %86

74:                                               ; preds = %72
  %75 = icmp eq i32 %.091.in186, 2
  br i1 %75, label %89, label %76

76:                                               ; preds = %74
  %77 = getelementptr inbounds i8, ptr %.094185, i64 8
  %78 = load ptr, ptr %77, align 8, !tbaa !5
  %79 = tail call noalias ptr @fopen(ptr noundef %78, ptr noundef nonnull @.str.13)
  %.not127 = icmp eq ptr %79, null
  br i1 %.not127, label %80, label %92

80:                                               ; preds = %76
  %81 = load ptr, ptr @stderr, align 8, !tbaa !5
  %82 = tail call ptr @__errno_location() #11
  %83 = load i32, ptr %82, align 4, !tbaa !9
  %84 = tail call ptr @strerror(i32 noundef %83) #8
  %85 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %81, ptr noundef nonnull @.str.11, ptr noundef %9, ptr noundef %78, ptr noundef %84) #9
  br label %154

86:                                               ; preds = %72
  %87 = load ptr, ptr @stderr, align 8, !tbaa !5
  %88 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %87, ptr noundef nonnull @.str.14, ptr noundef %9, ptr noundef %18) #9
  br label %154

89:                                               ; preds = %74, %60, %53, %46, %34, %27
  %90 = load ptr, ptr @stderr, align 8, !tbaa !5
  %91 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %90, ptr noundef nonnull @.str.15, ptr noundef %9, ptr noundef %18) #9
  br label %154

92:                                               ; preds = %29, %48, %62, %76, %55, %36
  %.190 = phi ptr [ %.089187, %76 ], [ %.089187, %62 ], [ %.089187, %55 ], [ %.089187, %48 ], [ %.089187, %36 ], [ %31, %29 ]
  %.188 = phi i32 [ %.087188, %76 ], [ %.087188, %62 ], [ %.087188, %55 ], [ %.087188, %48 ], [ %39, %36 ], [ %.087188, %29 ]
  %.186 = phi ptr [ %.085189, %76 ], [ %.085189, %62 ], [ %.085189, %55 ], [ %50, %48 ], [ %.085189, %36 ], [ %.085189, %29 ]
  %.184 = phi ptr [ %.083190, %76 ], [ %.083190, %62 ], [ %57, %55 ], [ %.083190, %48 ], [ %.083190, %36 ], [ %.083190, %29 ]
  %.181 = phi ptr [ %.080191, %76 ], [ %64, %62 ], [ %.080191, %55 ], [ %.080191, %48 ], [ %.080191, %36 ], [ %.080191, %29 ]
  %.178 = phi ptr [ %78, %76 ], [ %.077192, %62 ], [ %.077192, %55 ], [ %.077192, %48 ], [ %.077192, %36 ], [ %.077192, %29 ]
  %.175 = phi ptr [ %.074193, %76 ], [ %65, %62 ], [ %.074193, %55 ], [ %.074193, %48 ], [ %.074193, %36 ], [ %.074193, %29 ]
  %.1 = phi ptr [ %79, %76 ], [ %.073194, %62 ], [ %.073194, %55 ], [ %.073194, %48 ], [ %.073194, %36 ], [ %.073194, %29 ]
  %.192 = add nsw i32 %.091.in186, -2
  %93 = getelementptr inbounds i8, ptr %.094185, i64 16
  %94 = icmp sgt i32 %.091.in186, 3
  br i1 %94, label %.preheader128, label %95, !llvm.loop !11

95:                                               ; preds = %92
  %.not = icmp eq ptr %.190, null
  br i1 %.not, label %96, label %99

96:                                               ; preds = %95
  %97 = load ptr, ptr @stderr, align 8, !tbaa !5
  %98 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %97, ptr noundef nonnull @.str.16, ptr noundef %9) #9
  br label %154

99:                                               ; preds = %95
  %100 = icmp slt i32 %.188, 0
  br i1 %100, label %101, label %104

101:                                              ; preds = %99
  %102 = load ptr, ptr @stderr, align 8, !tbaa !5
  %103 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %102, ptr noundef nonnull @.str.17, ptr noundef %9) #9
  br label %154

104:                                              ; preds = %99
  %.not110 = icmp eq ptr %.186, null
  br i1 %.not110, label %105, label %108

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

108:                                              ; preds = %104
  %109 = tail call i32 @sdf_load_library(ptr noundef nonnull %.190, ptr noundef null) #8
  %.not111 = icmp eq i32 %109, 1
  br i1 %.not111, label %113, label %110

110:                                              ; preds = %108
  %111 = load ptr, ptr @stderr, align 8, !tbaa !5
  %112 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %111, ptr noundef nonnull @.str.19, ptr noundef %9) #9
  br label %154

113:                                              ; preds = %108
  %114 = call i32 @sdf_open_device(ptr noundef nonnull %6) #8
  %.not112 = icmp eq i32 %114, 1
  br i1 %.not112, label %118, label %115

115:                                              ; preds = %113
  %116 = load ptr, ptr @stderr, align 8, !tbaa !5
  %117 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %116, ptr noundef nonnull @.str.20, ptr noundef %9) #9
  br label %154

118:                                              ; preds = %113
  %119 = call i32 @sdf_load_private_key(ptr noundef nonnull %6, ptr noundef nonnull %7, i32 noundef %.188, ptr noundef nonnull %.186) #8
  %.not113 = icmp eq i32 %119, 1
  br i1 %.not113, label %124, label %120

120:                                              ; preds = %118
  %121 = call i32 @sdf_close_device(ptr noundef nonnull %6) #8
  %122 = load ptr, ptr @stderr, align 8, !tbaa !5
  %123 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %122, ptr noundef nonnull @.str.21, ptr noundef %9, i32 noundef %.188) #9
  br label %154

124:                                              ; preds = %118
  %125 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %.184) #10
  %126 = call i32 @sdf_sign_init(ptr noundef nonnull %8, ptr noundef nonnull %7, ptr noundef %.184, i64 noundef %125) #8
  %.not114 = icmp eq i32 %126, 1
  br i1 %.not114, label %.preheader, label %127

127:                                              ; preds = %124
  %128 = call i32 @sdf_close_device(ptr noundef nonnull %6) #8
  %129 = load ptr, ptr @stderr, align 8, !tbaa !5
  %130 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %129, ptr noundef nonnull @.str.22, ptr noundef %9) #9
  br label %154

.preheader:                                       ; preds = %124, %132
  %131 = call i64 @fread(ptr noundef nonnull %3, i64 noundef 1, i64 noundef 4096, ptr noundef %.175)
  %.not115 = icmp eq i64 %131, 0
  br i1 %.not115, label %138, label %132

132:                                              ; preds = %.preheader
  %133 = call i32 @sdf_sign_update(ptr noundef nonnull %8, ptr noundef nonnull %3, i64 noundef %131) #8
  %.not118 = icmp eq i32 %133, 1
  br i1 %.not118, label %.preheader, label %134, !llvm.loop !13

134:                                              ; preds = %132
  %135 = call i32 @sdf_close_device(ptr noundef nonnull %6) #8
  %136 = load ptr, ptr @stderr, align 8, !tbaa !5
  %137 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %136, ptr noundef nonnull @.str.22, ptr noundef %9) #9
  br label %154

138:                                              ; preds = %.preheader
  %139 = call i32 @sdf_sign_finish(ptr noundef nonnull %8, ptr noundef nonnull %4, ptr noundef nonnull %5) #8
  %.not116 = icmp eq i32 %139, 1
  %140 = call i32 @sdf_close_device(ptr noundef nonnull %6) #8
  br i1 %.not116, label %144, label %141

141:                                              ; preds = %138
  %142 = load ptr, ptr @stderr, align 8, !tbaa !5
  %143 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %142, ptr noundef nonnull @.str.22, ptr noundef %9) #9
  br label %154

144:                                              ; preds = %138
  %145 = load i64, ptr %5, align 8, !tbaa !14
  %146 = call i64 @fwrite(ptr noundef nonnull %4, i64 noundef 1, i64 noundef %145, ptr noundef %.1)
  %147 = load i64, ptr %5, align 8, !tbaa !14
  %.not117 = icmp eq i64 %146, %147
  br i1 %.not117, label %154, label %148

148:                                              ; preds = %144
  %149 = load ptr, ptr @stderr, align 8, !tbaa !5
  %150 = tail call ptr @__errno_location() #11
  %151 = load i32, ptr %150, align 4, !tbaa !9
  %152 = call ptr @strerror(i32 noundef %151) #8
  %153 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %149, ptr noundef nonnull @.str.23, ptr noundef %9, ptr noundef %152) #9
  br label %154

154:                                              ; preds = %144, %148, %141, %134, %127, %120, %115, %110, %105, %101, %96, %89, %86, %80, %66, %41, %20
  %.093 = phi i32 [ 1, %86 ], [ 1, %89 ], [ 1, %80 ], [ 1, %66 ], [ 1, %41 ], [ 0, %20 ], [ 1, %101 ], [ 1, %110 ], [ 1, %115 ], [ 1, %120 ], [ 1, %127 ], [ 1, %134 ], [ 1, %141 ], [ 1, %148 ], [ 1, %105 ], [ 1, %96 ], [ 0, %144 ]
  %.282 = phi ptr [ %.080191, %86 ], [ %.080191, %89 ], [ %.080191, %80 ], [ %64, %66 ], [ %.080191, %41 ], [ %.080191, %20 ], [ %.181, %101 ], [ %.181, %110 ], [ %.181, %115 ], [ %.181, %120 ], [ %.181, %127 ], [ %.181, %134 ], [ %.181, %141 ], [ %.181, %148 ], [ %.181, %105 ], [ %.181, %96 ], [ %.181, %144 ]
  %.279 = phi ptr [ %.077192, %86 ], [ %.077192, %89 ], [ %78, %80 ], [ %.077192, %66 ], [ %.077192, %41 ], [ %.077192, %20 ], [ %.178, %101 ], [ %.178, %110 ], [ %.178, %115 ], [ %.178, %120 ], [ %.178, %127 ], [ %.178, %134 ], [ %.178, %141 ], [ %.178, %148 ], [ %.178, %105 ], [ %.178, %96 ], [ %.178, %144 ]
  %.276 = phi ptr [ %.074193, %86 ], [ %.074193, %89 ], [ %.074193, %80 ], [ null, %66 ], [ %.074193, %41 ], [ %.074193, %20 ], [ %.175, %101 ], [ %.175, %110 ], [ %.175, %115 ], [ %.175, %120 ], [ %.175, %127 ], [ %.175, %134 ], [ %.175, %141 ], [ %.175, %148 ], [ %.175, %105 ], [ %.175, %96 ], [ %.175, %144 ]
  %.2 = phi ptr [ %.073194, %86 ], [ %.073194, %89 ], [ null, %80 ], [ %.073194, %66 ], [ %.073194, %41 ], [ %.073194, %20 ], [ %.1, %101 ], [ %.1, %110 ], [ %.1, %115 ], [ %.1, %120 ], [ %.1, %127 ], [ %.1, %134 ], [ %.1, %141 ], [ %.1, %148 ], [ %.1, %105 ], [ %.1, %96 ], [ %.1, %144 ]
  call void @sdf_unload_library() #8
  %155 = icmp ne ptr %.282, null
  %156 = icmp ne ptr %.276, null
  %or.cond = select i1 %155, i1 %156, i1 false
  br i1 %or.cond, label %157, label %159

157:                                              ; preds = %154
  %158 = call i32 @fclose(ptr noundef nonnull %.276)
  br label %159

159:                                              ; preds = %157, %154
  %160 = icmp ne ptr %.279, null
  %161 = icmp ne ptr %.2, null
  %or.cond3 = select i1 %160, i1 %161, i1 false
  br i1 %or.cond3, label %162, label %164

162:                                              ; preds = %159
  %163 = call i32 @fclose(ptr noundef nonnull %.2)
  br label %164

164:                                              ; preds = %159, %162, %14
  %.0 = phi i32 [ 1, %14 ], [ %.093, %162 ], [ %.093, %159 ]
  call void @llvm.lifetime.end.p0(i64 240, ptr nonnull %8) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #8
  call void @llvm.lifetime.end.p0(i64 88, ptr nonnull %6) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #8
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %4) #8
  call void @llvm.lifetime.end.p0(i64 4096, ptr nonnull %3) #8
  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: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare i32 @atoi(ptr nocapture noundef nonnull) 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 i32 @sdf_load_library(ptr noundef, ptr noundef) local_unnamed_addr #7

declare i32 @sdf_open_device(ptr noundef) local_unnamed_addr #7

declare i32 @sdf_load_private_key(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #7

declare i32 @sdf_close_device(ptr noundef) local_unnamed_addr #7

declare i32 @sdf_sign_init(ptr noundef, ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #7

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

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

declare i32 @sdf_sign_update(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #7

declare i32 @sdf_sign_finish(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #7

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

declare void @sdf_unload_library() local_unnamed_addr #7

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

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

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


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