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

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

@stderr = external global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [63 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [20 x i8], align 1
@usage = external hidden global ptr, align 8
@.str.14 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [4 x i8], align 1
@options = external hidden global ptr, align 8
@.str.16 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [34 x i8], align 1
@__FUNCTION__.sdftest_main = external hidden unnamed_addr constant [13 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [21 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i32 @test_SDF_ExportSignPublicKey_ECC(i32 noundef) #0

; 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

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

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @test_SDF_ExportEncPublicKey_ECC(i32 noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @test_SDF_GenerateKeyWithEPK_ECC() #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @test_SDF_GenerateKeyWithKEK(i32 noundef) #0

; Function Attrs: nounwind uwtable
define dso_local i32 @sdftest_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 i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 1, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %13 = load ptr, ptr %5, align 8, !tbaa !9
  %14 = getelementptr inbounds ptr, ptr %13, i64 0
  %15 = load ptr, ptr %14, align 8, !tbaa !9
  store ptr %15, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  store ptr null, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 1, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 1, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  store ptr null, ptr %11, align 8, !tbaa !9
  %16 = load i32, ptr %4, align 4, !tbaa !5
  %17 = add nsw i32 %16, -1
  store i32 %17, ptr %4, align 4, !tbaa !5
  %18 = load ptr, ptr %5, align 8, !tbaa !9
  %19 = getelementptr inbounds ptr, ptr %18, i32 1
  store ptr %19, ptr %5, align 8, !tbaa !9
  %20 = load i32, ptr %4, align 4, !tbaa !5
  %21 = icmp slt i32 %20, 1
  br i1 %21, label %22, label %27

22:                                               ; preds = %2
  %23 = load ptr, ptr @stderr, align 8, !tbaa !9
  %24 = load ptr, ptr %7, align 8, !tbaa !9
  %25 = load ptr, ptr @usage, align 8, !tbaa !9
  %26 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %23, ptr noundef @.str.13, ptr noundef %24, ptr noundef %25) #6
  store i32 1, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %258

27:                                               ; preds = %2
  br label %28

28:                                               ; preds = %136, %27
  %29 = load i32, ptr %4, align 4, !tbaa !5
  %30 = icmp sgt i32 %29, 0
  br i1 %30, label %31, label %141

31:                                               ; preds = %28
  %32 = load ptr, ptr %5, align 8, !tbaa !9
  %33 = load ptr, ptr %32, align 8, !tbaa !9
  %34 = call i32 @strcmp(ptr noundef %33, ptr noundef @.str.14) #7
  %35 = icmp ne i32 %34, 0
  br i1 %35, label %42, label %36

36:                                               ; preds = %31
  %37 = load ptr, ptr %7, align 8, !tbaa !9
  %38 = load ptr, ptr @usage, align 8, !tbaa !9
  %39 = call i32 (ptr, ...) @printf(ptr noundef @.str.13, ptr noundef %37, ptr noundef %38)
  %40 = load ptr, ptr @options, align 8, !tbaa !9
  %41 = call i32 (ptr, ...) @printf(ptr noundef @.str.15, ptr noundef %40)
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %256

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

47:                                               ; preds = %42
  %48 = load i32, ptr %4, align 4, !tbaa !5
  %49 = add nsw i32 %48, -1
  store i32 %49, ptr %4, align 4, !tbaa !5
  %50 = icmp slt i32 %49, 1
  br i1 %50, label %51, label %52

51:                                               ; preds = %47
  br label %126

52:                                               ; preds = %47
  %53 = load ptr, ptr %5, align 8, !tbaa !9
  %54 = getelementptr inbounds ptr, ptr %53, i32 1
  store ptr %54, ptr %5, align 8, !tbaa !9
  %55 = load ptr, ptr %54, align 8, !tbaa !9
  store ptr %55, ptr %8, align 8, !tbaa !9
  br label %135

56:                                               ; preds = %42
  %57 = load ptr, ptr %5, align 8, !tbaa !9
  %58 = load ptr, ptr %57, align 8, !tbaa !9
  %59 = call i32 @strcmp(ptr noundef %58, ptr noundef @.str.17) #7
  %60 = icmp ne i32 %59, 0
  br i1 %60, label %81, label %61

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

65:                                               ; preds = %61
  br label %126

66:                                               ; preds = %61
  %67 = load ptr, ptr %5, align 8, !tbaa !9
  %68 = getelementptr inbounds ptr, ptr %67, i32 1
  store ptr %68, ptr %5, align 8, !tbaa !9
  %69 = load ptr, ptr %68, align 8, !tbaa !9
  %70 = call i32 @atoi(ptr noundef %69) #7
  store i32 %70, ptr %9, align 4, !tbaa !5
  %71 = load i32, ptr %9, align 4, !tbaa !5
  %72 = icmp slt i32 %71, 1
  br i1 %72, label %76, label %73

73:                                               ; preds = %66
  %74 = load i32, ptr %9, align 4, !tbaa !5
  %75 = icmp sgt i32 %74, 4096
  br i1 %75, label %76, label %80

76:                                               ; preds = %73, %66
  %77 = load ptr, ptr @stderr, align 8, !tbaa !9
  %78 = load ptr, ptr %7, align 8, !tbaa !9
  %79 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %77, ptr noundef @.str.18, ptr noundef %78) #6
  br label %256

80:                                               ; preds = %73
  br label %134

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

86:                                               ; preds = %81
  %87 = load i32, ptr %4, align 4, !tbaa !5
  %88 = add nsw i32 %87, -1
  store i32 %88, ptr %4, align 4, !tbaa !5
  %89 = icmp slt i32 %88, 1
  br i1 %89, label %90, label %91

90:                                               ; preds = %86
  br label %126

91:                                               ; preds = %86
  %92 = load ptr, ptr %5, align 8, !tbaa !9
  %93 = getelementptr inbounds ptr, ptr %92, i32 1
  store ptr %93, ptr %5, align 8, !tbaa !9
  %94 = load ptr, ptr %93, align 8, !tbaa !9
  %95 = call i32 @atoi(ptr noundef %94) #7
  store i32 %95, ptr %10, align 4, !tbaa !5
  %96 = load i32, ptr %10, align 4, !tbaa !5
  %97 = icmp slt i32 %96, 0
  br i1 %97, label %101, label %98

98:                                               ; preds = %91
  %99 = load i32, ptr %10, align 4, !tbaa !5
  %100 = icmp sgt i32 %99, 4096
  br i1 %100, label %101, label %105

101:                                              ; preds = %98, %91
  %102 = load ptr, ptr @stderr, align 8, !tbaa !9
  %103 = load ptr, ptr %7, align 8, !tbaa !9
  %104 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %102, ptr noundef @.str.20, ptr noundef %103) #6
  br label %256

105:                                              ; preds = %98
  br label %133

106:                                              ; preds = %81
  %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.21) #7
  %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 %126

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

120:                                              ; preds = %106
  %121 = load ptr, ptr @stderr, align 8, !tbaa !9
  %122 = load ptr, ptr %7, align 8, !tbaa !9
  %123 = load ptr, ptr %5, align 8, !tbaa !9
  %124 = load ptr, ptr %123, align 8, !tbaa !9
  %125 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %121, ptr noundef @.str.22, ptr noundef %122, ptr noundef %124) #6
  br label %256

126:                                              ; preds = %115, %90, %65, %51
  %127 = load ptr, ptr @stderr, align 8, !tbaa !9
  %128 = load ptr, ptr %7, align 8, !tbaa !9
  %129 = load ptr, ptr %5, align 8, !tbaa !9
  %130 = load ptr, ptr %129, align 8, !tbaa !9
  %131 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %127, ptr noundef @.str.23, ptr noundef %128, ptr noundef %130) #6
  br label %256

132:                                              ; preds = %116
  br label %133

133:                                              ; preds = %132, %105
  br label %134

134:                                              ; preds = %133, %80
  br label %135

135:                                              ; preds = %134, %52
  br label %136

136:                                              ; preds = %135
  %137 = load i32, ptr %4, align 4, !tbaa !5
  %138 = add nsw i32 %137, -1
  store i32 %138, ptr %4, align 4, !tbaa !5
  %139 = load ptr, ptr %5, align 8, !tbaa !9
  %140 = getelementptr inbounds ptr, ptr %139, i32 1
  store ptr %140, ptr %5, align 8, !tbaa !9
  br label %28, !llvm.loop !11

141:                                              ; preds = %28
  %142 = load ptr, ptr %8, align 8, !tbaa !9
  %143 = icmp ne ptr %142, null
  br i1 %143, label %148, label %144

144:                                              ; preds = %141
  %145 = load ptr, ptr @stderr, align 8, !tbaa !9
  %146 = load ptr, ptr %7, align 8, !tbaa !9
  %147 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %145, ptr noundef @.str.24, ptr noundef %146) #6
  br label %256

148:                                              ; preds = %141
  %149 = load ptr, ptr %11, align 8, !tbaa !9
  %150 = icmp ne ptr %149, null
  br i1 %150, label %155, label %151

151:                                              ; preds = %148
  %152 = load ptr, ptr @stderr, align 8, !tbaa !9
  %153 = load ptr, ptr %7, align 8, !tbaa !9
  %154 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %152, ptr noundef @.str.25, ptr noundef %153) #6
  br label %256

155:                                              ; preds = %148
  %156 = load ptr, ptr %8, align 8, !tbaa !9
  %157 = call i32 @SDF_LoadLibrary(ptr noundef %156, ptr noundef null)
  %158 = icmp ne i32 %157, 0
  br i1 %158, label %159, label %165

159:                                              ; preds = %155
  br label %160

160:                                              ; preds = %159
  %161 = load ptr, ptr @stderr, align 8, !tbaa !9
  %162 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %161, ptr noundef @.str.3, ptr noundef @.str.4, i32 noundef 2212, ptr noundef @__FUNCTION__.sdftest_main) #6
  br label %163

163:                                              ; preds = %160
  br label %164

164:                                              ; preds = %163
  br label %250

165:                                              ; preds = %155
  %166 = call i32 @test_SDF_GenerateRandom()
  %167 = icmp ne i32 %166, 1
  br i1 %167, label %168, label %169

168:                                              ; preds = %165
  br label %250

169:                                              ; preds = %165
  %170 = call i32 @test_SDF_Hash()
  %171 = icmp ne i32 %170, 1
  br i1 %171, label %172, label %173

172:                                              ; preds = %169
  br label %250

173:                                              ; preds = %169
  %174 = call i32 @test_SDF_Hash_Z()
  %175 = icmp ne i32 %174, 1
  br i1 %175, label %176, label %177

176:                                              ; preds = %173
  br label %250

177:                                              ; preds = %173
  %178 = load i32, ptr %9, align 4, !tbaa !5
  %179 = call i32 @test_SDF_GenerateKeyWithKEK(i32 noundef %178)
  %180 = icmp ne i32 %179, 1
  br i1 %180, label %181, label %182

181:                                              ; preds = %177
  br label %250

182:                                              ; preds = %177
  %183 = load i32, ptr %9, align 4, !tbaa !5
  %184 = call i32 @test_SDF_CalculateMAC(i32 noundef %183)
  %185 = icmp ne i32 %184, 1
  br i1 %185, label %186, label %187

186:                                              ; preds = %182
  br label %250

187:                                              ; preds = %182
  %188 = load i32, ptr %9, align 4, !tbaa !5
  %189 = call i32 @test_SDF_Encrypt(i32 noundef %188)
  %190 = icmp ne i32 %189, 1
  br i1 %190, label %191, label %192

191:                                              ; preds = %187
  br label %250

192:                                              ; preds = %187
  %193 = load i32, ptr %10, align 4, !tbaa !5
  %194 = load ptr, ptr %11, align 8, !tbaa !9
  %195 = call i32 @test_SDF_Encrypt_SM4_CBC(i32 noundef %193, ptr noundef %194)
  %196 = icmp ne i32 %195, 1
  br i1 %196, label %197, label %198

197:                                              ; preds = %192
  br label %250

198:                                              ; preds = %192
  %199 = load i32, ptr %10, align 4, !tbaa !5
  %200 = load ptr, ptr %11, align 8, !tbaa !9
  %201 = call i32 @test_SDF_Encrypt_SM4_ECB(i32 noundef %199, ptr noundef %200)
  %202 = icmp ne i32 %201, 1
  br i1 %202, label %203, label %204

203:                                              ; preds = %198
  br label %250

204:                                              ; preds = %198
  %205 = call i32 @test_SDF_GenerateKeyPair_ECC()
  %206 = icmp ne i32 %205, 1
  br i1 %206, label %207, label %208

207:                                              ; preds = %204
  br label %250

208:                                              ; preds = %204
  %209 = load i32, ptr %10, align 4, !tbaa !5
  %210 = call i32 @test_SDF_ExportSignPublicKey_ECC(i32 noundef %209)
  %211 = icmp ne i32 %210, 1
  br i1 %211, label %212, label %213

212:                                              ; preds = %208
  br label %250

213:                                              ; preds = %208
  %214 = load i32, ptr %10, align 4, !tbaa !5
  %215 = call i32 @test_SDF_ExportEncPublicKey_ECC(i32 noundef %214)
  %216 = icmp ne i32 %215, 1
  br i1 %216, label %217, label %218

217:                                              ; preds = %213
  br label %250

218:                                              ; preds = %213
  %219 = call i32 @test_SDF_GenerateKeyWithEPK_ECC()
  %220 = icmp ne i32 %219, 1
  br i1 %220, label %221, label %222

221:                                              ; preds = %218
  br label %250

222:                                              ; preds = %218
  %223 = load i32, ptr %10, align 4, !tbaa !5
  %224 = load ptr, ptr %11, align 8, !tbaa !9
  %225 = call i32 @test_SDF_GenerateKeyWithIPK_ECC(i32 noundef %223, ptr noundef %224)
  %226 = icmp ne i32 %225, 1
  br i1 %226, label %227, label %228

227:                                              ; preds = %222
  br label %250

228:                                              ; preds = %222
  %229 = call i32 @test_SDF_ExternalVerify_ECC()
  %230 = icmp ne i32 %229, 1
  br i1 %230, label %231, label %232

231:                                              ; preds = %228
  br label %250

232:                                              ; preds = %228
  %233 = call i32 @test_SDF_ExternalEncrypt_ECC()
  %234 = icmp ne i32 %233, 1
  br i1 %234, label %235, label %236

235:                                              ; preds = %232
  br label %250

236:                                              ; preds = %232
  %237 = load i32, ptr %10, align 4, !tbaa !5
  %238 = load ptr, ptr %11, align 8, !tbaa !9
  %239 = call i32 @test_SDF_InternalSign_ECC(i32 noundef %237, ptr noundef %238)
  %240 = icmp ne i32 %239, 1
  br i1 %240, label %241, label %242

241:                                              ; preds = %236
  br label %250

242:                                              ; preds = %236
  %243 = load i32, ptr %10, align 4, !tbaa !5
  %244 = load ptr, ptr %11, align 8, !tbaa !9
  %245 = call i32 @test_SDF_InternalEncrypt_ECC(i32 noundef %243, ptr noundef %244)
  %246 = icmp ne i32 %245, 1
  br i1 %246, label %247, label %248

247:                                              ; preds = %242
  br label %250

248:                                              ; preds = %242
  %249 = call i32 (ptr, ...) @printf(ptr noundef @.str.26, ptr noundef @.str.4)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %258

250:                                              ; preds = %247, %241, %235, %231, %227, %221, %217, %212, %207, %203, %197, %191, %186, %181, %176, %172, %168, %164
  br label %251

251:                                              ; preds = %250
  %252 = load ptr, ptr @stderr, align 8, !tbaa !9
  %253 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %252, ptr noundef @.str.3, ptr noundef @.str.4, i32 noundef 2255, ptr noundef @__FUNCTION__.sdftest_main) #6
  br label %254

254:                                              ; preds = %251
  br label %255

255:                                              ; preds = %254
  store i32 1, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %258

256:                                              ; preds = %151, %144, %126, %120, %101, %76, %36
  %257 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %257, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %258

258:                                              ; preds = %256, %255, %248, %22
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  %259 = load i32, ptr %3, align 4
  ret i32 %259
}

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

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

declare i32 @SDF_LoadLibrary(ptr noundef, ptr noundef) #3

; Function Attrs: nounwind uwtable
declare hidden i32 @test_SDF_GenerateRandom() #0

; Function Attrs: nounwind uwtable
declare hidden i32 @test_SDF_Hash() #0

; Function Attrs: nounwind uwtable
declare hidden i32 @test_SDF_Hash_Z() #0

; Function Attrs: nounwind uwtable
declare hidden i32 @test_SDF_CalculateMAC(i32 noundef) #0

; Function Attrs: nounwind uwtable
declare hidden i32 @test_SDF_Encrypt(i32 noundef) #0

; Function Attrs: nounwind uwtable
declare hidden i32 @test_SDF_Encrypt_SM4_CBC(i32 noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden i32 @test_SDF_Encrypt_SM4_ECB(i32 noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden i32 @test_SDF_GenerateKeyPair_ECC() #0

; Function Attrs: nounwind uwtable
declare hidden i32 @test_SDF_GenerateKeyWithIPK_ECC(i32 noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden i32 @test_SDF_ExternalVerify_ECC() #0

; Function Attrs: nounwind uwtable
declare hidden i32 @test_SDF_ExternalEncrypt_ECC() #0

; Function Attrs: nounwind uwtable
declare hidden i32 @test_SDF_InternalSign_ECC(i32 noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden i32 @test_SDF_InternalEncrypt_ECC(i32 noundef, ptr noundef) #0

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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind willreturn memory(read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 }
attributes #7 = { nounwind willreturn memory(read) }

!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"}


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

@stderr = external local_unnamed_addr global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [63 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [20 x i8], align 1
@usage = external hidden local_unnamed_addr global ptr, align 8
@.str.14 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [4 x i8], align 1
@options = external hidden local_unnamed_addr global ptr, align 8
@.str.16 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [34 x i8], align 1
@__FUNCTION__.sdftest_main = external hidden unnamed_addr constant [13 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [21 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i32 @test_SDF_ExportSignPublicKey_ECC(i32 noundef) local_unnamed_addr #0

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

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @test_SDF_ExportEncPublicKey_ECC(i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @test_SDF_GenerateKeyWithEPK_ECC() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @test_SDF_GenerateKeyWithKEK(i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @sdftest_main(i32 noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = load ptr, ptr %1, align 8, !tbaa !5
  %4 = icmp slt i32 %0, 2
  br i1 %4, label %6, label %.preheader.preheader

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

6:                                                ; preds = %2
  %7 = load ptr, ptr @stderr, align 8, !tbaa !5
  %8 = load ptr, ptr @usage, align 8, !tbaa !5
  %9 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %7, ptr noundef nonnull @.str.13, ptr noundef %3, ptr noundef %8) #5
  br label %115

.preheader:                                       ; preds = %.preheader.preheader, %60
  %.0128 = phi ptr [ %.1, %60 ], [ null, %.preheader.preheader ]
  %.056127 = phi i32 [ %.157, %60 ], [ 1, %.preheader.preheader ]
  %.058126 = phi i32 [ %.159, %60 ], [ 1, %.preheader.preheader ]
  %.060125 = phi ptr [ %.161, %60 ], [ null, %.preheader.preheader ]
  %.064124 = phi ptr [ %61, %60 ], [ %5, %.preheader.preheader ]
  %.066.in123 = phi i32 [ %.167, %60 ], [ %0, %.preheader.preheader ]
  %10 = load ptr, ptr %.064124, align 8, !tbaa !5
  %11 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %10, ptr noundef nonnull dereferenceable(1) @.str.14) #6
  %.not94 = icmp eq i32 %11, 0
  br i1 %.not94, label %12, label %17

12:                                               ; preds = %.preheader
  %13 = load ptr, ptr @usage, align 8, !tbaa !5
  %14 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.13, ptr noundef %3, ptr noundef %13)
  %15 = load ptr, ptr @options, align 8, !tbaa !5
  %16 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.15, ptr noundef %15)
  br label %115

17:                                               ; preds = %.preheader
  %18 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %10, ptr noundef nonnull dereferenceable(1) @.str.16) #6
  %.not95 = icmp eq i32 %18, 0
  br i1 %.not95, label %19, label %24

19:                                               ; preds = %17
  %20 = icmp eq i32 %.066.in123, 2
  br i1 %20, label %57, label %21

21:                                               ; preds = %19
  %22 = getelementptr inbounds i8, ptr %.064124, i64 8
  %23 = load ptr, ptr %22, align 8, !tbaa !5
  br label %60

24:                                               ; preds = %17
  %25 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %10, ptr noundef nonnull dereferenceable(1) @.str.17) #6
  %.not96 = icmp eq i32 %25, 0
  br i1 %.not96, label %26, label %36

26:                                               ; preds = %24
  %27 = icmp eq i32 %.066.in123, 2
  br i1 %27, label %57, label %28

28:                                               ; preds = %26
  %29 = getelementptr inbounds i8, ptr %.064124, i64 8
  %30 = load ptr, ptr %29, align 8, !tbaa !5
  %31 = tail call i32 @atoi(ptr nocapture noundef %30) #6
  %32 = add i32 %31, -4097
  %or.cond = icmp ult i32 %32, -4096
  br i1 %or.cond, label %33, label %60

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

36:                                               ; preds = %24
  %37 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %10, ptr noundef nonnull dereferenceable(1) @.str.19) #6
  %.not97 = icmp eq i32 %37, 0
  br i1 %.not97, label %38, label %47

38:                                               ; preds = %36
  %39 = icmp eq i32 %.066.in123, 2
  br i1 %39, label %57, label %40

40:                                               ; preds = %38
  %41 = getelementptr inbounds i8, ptr %.064124, i64 8
  %42 = load ptr, ptr %41, align 8, !tbaa !5
  %43 = tail call i32 @atoi(ptr nocapture noundef %42) #6
  %or.cond3 = icmp ugt i32 %43, 4096
  br i1 %or.cond3, label %44, label %60

44:                                               ; preds = %40
  %45 = load ptr, ptr @stderr, align 8, !tbaa !5
  %46 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %45, ptr noundef nonnull @.str.20, ptr noundef %3) #5
  br label %115

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

49:                                               ; preds = %47
  %50 = icmp eq i32 %.066.in123, 2
  br i1 %50, label %57, label %51

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

54:                                               ; preds = %47
  %55 = load ptr, ptr @stderr, align 8, !tbaa !5
  %56 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %55, ptr noundef nonnull @.str.22, ptr noundef %3, ptr noundef %10) #5
  br label %115

57:                                               ; preds = %49, %38, %26, %19
  %58 = load ptr, ptr @stderr, align 8, !tbaa !5
  %59 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %58, ptr noundef nonnull @.str.23, ptr noundef %3, ptr noundef %10) #5
  br label %115

60:                                               ; preds = %21, %51, %40, %28
  %.161 = phi ptr [ %.060125, %51 ], [ %.060125, %40 ], [ %.060125, %28 ], [ %23, %21 ]
  %.159 = phi i32 [ %.058126, %51 ], [ %.058126, %40 ], [ %31, %28 ], [ %.058126, %21 ]
  %.157 = phi i32 [ %.056127, %51 ], [ %43, %40 ], [ %.056127, %28 ], [ %.056127, %21 ]
  %.1 = phi ptr [ %53, %51 ], [ %.0128, %40 ], [ %.0128, %28 ], [ %.0128, %21 ]
  %.167 = add nsw i32 %.066.in123, -2
  %61 = getelementptr inbounds i8, ptr %.064124, i64 16
  %62 = icmp sgt i32 %.066.in123, 3
  br i1 %62, label %.preheader, label %63, !llvm.loop !9

63:                                               ; preds = %60
  %.not = icmp eq ptr %.161, null
  br i1 %.not, label %64, label %67

64:                                               ; preds = %63
  %65 = load ptr, ptr @stderr, align 8, !tbaa !5
  %66 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %65, ptr noundef nonnull @.str.24, ptr noundef %3) #5
  br label %115

67:                                               ; preds = %63
  %.not75 = icmp eq ptr %.1, null
  br i1 %.not75, label %68, label %71

68:                                               ; preds = %67
  %69 = load ptr, ptr @stderr, align 8, !tbaa !5
  %70 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %69, ptr noundef nonnull @.str.25, ptr noundef %3) #5
  br label %115

71:                                               ; preds = %67
  %72 = tail call i32 @SDF_LoadLibrary(ptr noundef nonnull %.161, ptr noundef null) #7
  %.not76 = icmp eq i32 %72, 0
  br i1 %.not76, label %76, label %73

73:                                               ; preds = %71
  %74 = load ptr, ptr @stderr, align 8, !tbaa !5
  %75 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %74, ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.4, i32 noundef 2212, ptr noundef nonnull @__FUNCTION__.sdftest_main) #5
  br label %112

76:                                               ; preds = %71
  %77 = tail call i32 @test_SDF_GenerateRandom()
  %.not77 = icmp eq i32 %77, 1
  br i1 %.not77, label %78, label %112

78:                                               ; preds = %76
  %79 = tail call i32 @test_SDF_Hash()
  %.not78 = icmp eq i32 %79, 1
  br i1 %.not78, label %80, label %112

80:                                               ; preds = %78
  %81 = tail call i32 @test_SDF_Hash_Z()
  %.not79 = icmp eq i32 %81, 1
  br i1 %.not79, label %82, label %112

82:                                               ; preds = %80
  %83 = tail call i32 @test_SDF_GenerateKeyWithKEK(i32 noundef %.159)
  %.not80 = icmp eq i32 %83, 1
  br i1 %.not80, label %84, label %112

84:                                               ; preds = %82
  %85 = tail call i32 @test_SDF_CalculateMAC(i32 noundef %.159)
  %.not81 = icmp eq i32 %85, 1
  br i1 %.not81, label %86, label %112

86:                                               ; preds = %84
  %87 = tail call i32 @test_SDF_Encrypt(i32 noundef %.159)
  %.not82 = icmp eq i32 %87, 1
  br i1 %.not82, label %88, label %112

88:                                               ; preds = %86
  %89 = tail call i32 @test_SDF_Encrypt_SM4_CBC(i32 noundef %.157, ptr noundef nonnull %.1)
  %.not83 = icmp eq i32 %89, 1
  br i1 %.not83, label %90, label %112

90:                                               ; preds = %88
  %91 = tail call i32 @test_SDF_Encrypt_SM4_ECB(i32 noundef %.157, ptr noundef nonnull %.1)
  %.not84 = icmp eq i32 %91, 1
  br i1 %.not84, label %92, label %112

92:                                               ; preds = %90
  %93 = tail call i32 @test_SDF_GenerateKeyPair_ECC()
  %.not85 = icmp eq i32 %93, 1
  br i1 %.not85, label %94, label %112

94:                                               ; preds = %92
  %95 = tail call i32 @test_SDF_ExportSignPublicKey_ECC(i32 noundef %.157)
  %.not86 = icmp eq i32 %95, 1
  br i1 %.not86, label %96, label %112

96:                                               ; preds = %94
  %97 = tail call i32 @test_SDF_ExportEncPublicKey_ECC(i32 noundef %.157)
  %.not87 = icmp eq i32 %97, 1
  br i1 %.not87, label %98, label %112

98:                                               ; preds = %96
  %99 = tail call i32 @test_SDF_GenerateKeyWithEPK_ECC()
  %.not88 = icmp eq i32 %99, 1
  br i1 %.not88, label %100, label %112

100:                                              ; preds = %98
  %101 = tail call i32 @test_SDF_GenerateKeyWithIPK_ECC(i32 noundef %.157, ptr noundef nonnull %.1)
  %.not89 = icmp eq i32 %101, 1
  br i1 %.not89, label %102, label %112

102:                                              ; preds = %100
  %103 = tail call i32 @test_SDF_ExternalVerify_ECC()
  %.not90 = icmp eq i32 %103, 1
  br i1 %.not90, label %104, label %112

104:                                              ; preds = %102
  %105 = tail call i32 @test_SDF_ExternalEncrypt_ECC()
  %.not91 = icmp eq i32 %105, 1
  br i1 %.not91, label %106, label %112

106:                                              ; preds = %104
  %107 = tail call i32 @test_SDF_InternalSign_ECC(i32 noundef %.157, ptr noundef nonnull %.1)
  %.not92 = icmp eq i32 %107, 1
  br i1 %.not92, label %108, label %112

108:                                              ; preds = %106
  %109 = tail call i32 @test_SDF_InternalEncrypt_ECC(i32 noundef %.157, ptr noundef nonnull %.1)
  %.not93 = icmp eq i32 %109, 1
  br i1 %.not93, label %110, label %112

110:                                              ; preds = %108
  %111 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.26, ptr noundef nonnull @.str.4)
  br label %115

112:                                              ; preds = %73, %76, %78, %80, %82, %84, %86, %88, %90, %92, %94, %96, %98, %100, %102, %104, %106, %108
  %113 = load ptr, ptr @stderr, align 8, !tbaa !5
  %114 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %113, ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.4, i32 noundef 2255, ptr noundef nonnull @__FUNCTION__.sdftest_main) #5
  br label %115

115:                                              ; preds = %12, %33, %44, %54, %57, %64, %68, %112, %110, %6
  %.062 = phi i32 [ 1, %6 ], [ 1, %112 ], [ 0, %110 ], [ 1, %54 ], [ 1, %57 ], [ 1, %44 ], [ 1, %33 ], [ 0, %12 ], [ 1, %68 ], [ 1, %64 ]
  ret i32 %.062
}

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

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

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

; Function Attrs: nounwind uwtable
declare hidden i32 @test_SDF_GenerateRandom() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @test_SDF_Hash() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @test_SDF_Hash_Z() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @test_SDF_CalculateMAC(i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @test_SDF_Encrypt(i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @test_SDF_Encrypt_SM4_CBC(i32 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @test_SDF_Encrypt_SM4_ECB(i32 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @test_SDF_GenerateKeyPair_ECC() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @test_SDF_GenerateKeyWithIPK_ECC(i32 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @test_SDF_ExternalVerify_ECC() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @test_SDF_ExternalEncrypt_ECC() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @test_SDF_InternalSign_ECC(i32 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @test_SDF_InternalEncrypt_ECC(i32 noundef, ptr noundef) local_unnamed_addr #0

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 = { 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 #2 = { 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 #3 = { 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 #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 = { cold nounwind }
attributes #6 = { nounwind willreturn memory(read) }
attributes #7 = { nounwind }

!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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


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