; LLVM IR from guanzhi/GmSSL :: src (sm3_lms)

; 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.SM3_HSS_PUBLIC_KEY = type { i32, %struct.SM3_LMS_PUBLIC_KEY }
%struct.SM3_LMS_PUBLIC_KEY = type { [4 x i8], [4 x i8], [16 x i8], [32 x i8] }
%struct.SM3_LMS_SIGNATURE = type { [4 x i8], [4 x i8], %struct.anon, [25 x [32 x i8]] }
%struct.anon = type { [4 x i8], [34 x [32 x i8]], [32 x i8] }

@stderr = external global ptr, align 8
@.str.14 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [61 x i8], align 1
@__FUNCTION__.sm3_hss_verify = external hidden unnamed_addr constant [15 x i8], align 1

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr 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: 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 @sm3_lms_public_key_from_bytes_ex(ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @sm3_lms_signature_from_bytes_ex(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @sm3_lms_do_verify(ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local void @sm3_lms_digest(ptr noundef, i32 noundef, ptr noundef, ptr noundef, i64 noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local i32 @sm3_hss_verify(ptr noundef %0, ptr noundef %1, ptr noundef %2, i64 noundef %3) #2 {
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i64, align 8
  %16 = alloca i32, align 4
  %17 = alloca [32 x i8], align 16
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store i64 %3, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  %21 = load i64, ptr %9, align 8, !tbaa !9
  %22 = icmp ult i64 %21, 4
  br i1 %22, label %23, label %29

23:                                               ; preds = %4
  br label %24

24:                                               ; preds = %23
  %25 = load ptr, ptr @stderr, align 8, !tbaa !5
  %26 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %25, ptr noundef @.str.14, ptr noundef @.str.15, i32 noundef 1125, ptr noundef @__FUNCTION__.sm3_hss_verify) #3
  br label %27

27:                                               ; preds = %24
  br label %28

28:                                               ; preds = %27
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %16, align 4
  br label %235

29:                                               ; preds = %4
  %30 = load ptr, ptr %8, align 8, !tbaa !5
  %31 = getelementptr inbounds i8, ptr %30, i64 0
  %32 = load i8, ptr %31, align 1, !tbaa !11
  %33 = zext i8 %32 to i32
  %34 = shl i32 %33, 24
  %35 = load ptr, ptr %8, align 8, !tbaa !5
  %36 = getelementptr inbounds i8, ptr %35, i64 1
  %37 = load i8, ptr %36, align 1, !tbaa !11
  %38 = zext i8 %37 to i32
  %39 = shl i32 %38, 16
  %40 = or i32 %34, %39
  %41 = load ptr, ptr %8, align 8, !tbaa !5
  %42 = getelementptr inbounds i8, ptr %41, i64 2
  %43 = load i8, ptr %42, align 1, !tbaa !11
  %44 = zext i8 %43 to i32
  %45 = shl i32 %44, 8
  %46 = or i32 %40, %45
  %47 = load ptr, ptr %8, align 8, !tbaa !5
  %48 = getelementptr inbounds i8, ptr %47, i64 3
  %49 = load i8, ptr %48, align 1, !tbaa !11
  %50 = zext i8 %49 to i32
  %51 = or i32 %46, %50
  store i32 %51, ptr %10, align 4, !tbaa !12
  %52 = load ptr, ptr %8, align 8, !tbaa !5
  %53 = getelementptr inbounds i8, ptr %52, i64 4
  store ptr %53, ptr %8, align 8, !tbaa !5
  %54 = load i64, ptr %9, align 8, !tbaa !9
  %55 = sub i64 %54, 4
  store i64 %55, ptr %9, align 8, !tbaa !9
  %56 = load i32, ptr %10, align 4, !tbaa !12
  %57 = load ptr, ptr %6, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.SM3_HSS_PUBLIC_KEY, ptr %57, i32 0, i32 0
  %59 = load i32, ptr %58, align 4, !tbaa !14
  %60 = sub nsw i32 %59, 1
  %61 = icmp ne i32 %56, %60
  br i1 %61, label %62, label %68

62:                                               ; preds = %29
  br label %63

63:                                               ; preds = %62
  %64 = load ptr, ptr @stderr, align 8, !tbaa !5
  %65 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %64, ptr noundef @.str.14, ptr noundef @.str.15, i32 noundef 1134, ptr noundef @__FUNCTION__.sm3_hss_verify) #3
  br label %66

66:                                               ; preds = %63
  br label %67

67:                                               ; preds = %66
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %16, align 4
  br label %235

68:                                               ; preds = %29
  %69 = load ptr, ptr %6, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.SM3_HSS_PUBLIC_KEY, ptr %69, i32 0, i32 1
  store ptr %70, ptr %12, align 8, !tbaa !5
  store i32 0, ptr %11, align 4, !tbaa !12
  br label %71

71:                                               ; preds = %201, %68
  %72 = load i32, ptr %11, align 4, !tbaa !12
  %73 = load i32, ptr %10, align 4, !tbaa !12
  %74 = icmp slt i32 %72, %73
  br i1 %74, label %75, label %204

75:                                               ; preds = %71
  call void @llvm.lifetime.start.p0(i64 32, ptr %17) #3
  %76 = call i32 @sm3_lms_signature_from_bytes_ex(ptr noundef %14, ptr noundef %15, ptr noundef %8, ptr noundef %9)
  %77 = icmp ne i32 %76, 1
  br i1 %77, label %78, label %84

78:                                               ; preds = %75
  br label %79

79:                                               ; preds = %78
  %80 = load ptr, ptr @stderr, align 8, !tbaa !5
  %81 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %80, ptr noundef @.str.14, ptr noundef @.str.15, i32 noundef 1145, ptr noundef @__FUNCTION__.sm3_hss_verify) #3
  br label %82

82:                                               ; preds = %79
  br label %83

83:                                               ; preds = %82
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %16, align 4
  br label %198

84:                                               ; preds = %75
  %85 = call i32 @sm3_lms_public_key_from_bytes_ex(ptr noundef %13, ptr noundef %8, ptr noundef %9)
  %86 = icmp ne i32 %85, 1
  br i1 %86, label %87, label %93

87:                                               ; preds = %84
  br label %88

88:                                               ; preds = %87
  %89 = load ptr, ptr @stderr, align 8, !tbaa !5
  %90 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %89, ptr noundef @.str.14, ptr noundef @.str.15, i32 noundef 1150, ptr noundef @__FUNCTION__.sm3_hss_verify) #3
  br label %91

91:                                               ; preds = %88
  br label %92

92:                                               ; preds = %91
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %16, align 4
  br label %198

93:                                               ; preds = %84
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #3
  %94 = load ptr, ptr %14, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.SM3_LMS_SIGNATURE, ptr %94, i32 0, i32 0
  %96 = getelementptr inbounds [4 x i8], ptr %95, i64 0, i64 0
  %97 = load i8, ptr %96, align 1, !tbaa !11
  %98 = zext i8 %97 to i32
  %99 = shl i32 %98, 24
  %100 = load ptr, ptr %14, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.SM3_LMS_SIGNATURE, ptr %100, i32 0, i32 0
  %102 = getelementptr inbounds [4 x i8], ptr %101, i64 0, i64 1
  %103 = load i8, ptr %102, align 1, !tbaa !11
  %104 = zext i8 %103 to i32
  %105 = shl i32 %104, 16
  %106 = or i32 %99, %105
  %107 = load ptr, ptr %14, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.SM3_LMS_SIGNATURE, ptr %107, i32 0, i32 0
  %109 = getelementptr inbounds [4 x i8], ptr %108, i64 0, i64 2
  %110 = load i8, ptr %109, align 1, !tbaa !11
  %111 = zext i8 %110 to i32
  %112 = shl i32 %111, 8
  %113 = or i32 %106, %112
  %114 = load ptr, ptr %14, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.SM3_LMS_SIGNATURE, ptr %114, i32 0, i32 0
  %116 = getelementptr inbounds [4 x i8], ptr %115, i64 0, i64 3
  %117 = load i8, ptr %116, align 1, !tbaa !11
  %118 = zext i8 %117 to i32
  %119 = or i32 %113, %118
  store i32 %119, ptr %18, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #3
  %120 = load ptr, ptr %14, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.SM3_LMS_SIGNATURE, ptr %120, i32 0, i32 1
  %122 = getelementptr inbounds [4 x i8], ptr %121, i64 0, i64 0
  %123 = load i8, ptr %122, align 1, !tbaa !11
  %124 = zext i8 %123 to i32
  %125 = shl i32 %124, 24
  %126 = load ptr, ptr %14, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.SM3_LMS_SIGNATURE, ptr %126, i32 0, i32 1
  %128 = getelementptr inbounds [4 x i8], ptr %127, i64 0, i64 1
  %129 = load i8, ptr %128, align 1, !tbaa !11
  %130 = zext i8 %129 to i32
  %131 = shl i32 %130, 16
  %132 = or i32 %125, %131
  %133 = load ptr, ptr %14, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.SM3_LMS_SIGNATURE, ptr %133, i32 0, i32 1
  %135 = getelementptr inbounds [4 x i8], ptr %134, i64 0, i64 2
  %136 = load i8, ptr %135, align 1, !tbaa !11
  %137 = zext i8 %136 to i32
  %138 = shl i32 %137, 8
  %139 = or i32 %132, %138
  %140 = load ptr, ptr %14, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.SM3_LMS_SIGNATURE, ptr %140, i32 0, i32 1
  %142 = getelementptr inbounds [4 x i8], ptr %141, i64 0, i64 3
  %143 = load i8, ptr %142, align 1, !tbaa !11
  %144 = zext i8 %143 to i32
  %145 = or i32 %139, %144
  store i32 %145, ptr %19, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #3
  %146 = load ptr, ptr %14, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.SM3_LMS_SIGNATURE, ptr %146, i32 0, i32 2
  %148 = getelementptr inbounds %struct.anon, ptr %147, i32 0, i32 0
  %149 = getelementptr inbounds [4 x i8], ptr %148, i64 0, i64 0
  %150 = load i8, ptr %149, align 1, !tbaa !11
  %151 = zext i8 %150 to i32
  %152 = shl i32 %151, 24
  %153 = load ptr, ptr %14, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.SM3_LMS_SIGNATURE, ptr %153, i32 0, i32 2
  %155 = getelementptr inbounds %struct.anon, ptr %154, i32 0, i32 0
  %156 = getelementptr inbounds [4 x i8], ptr %155, i64 0, i64 1
  %157 = load i8, ptr %156, align 1, !tbaa !11
  %158 = zext i8 %157 to i32
  %159 = shl i32 %158, 16
  %160 = or i32 %152, %159
  %161 = load ptr, ptr %14, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.SM3_LMS_SIGNATURE, ptr %161, i32 0, i32 2
  %163 = getelementptr inbounds %struct.anon, ptr %162, i32 0, i32 0
  %164 = getelementptr inbounds [4 x i8], ptr %163, i64 0, i64 2
  %165 = load i8, ptr %164, align 1, !tbaa !11
  %166 = zext i8 %165 to i32
  %167 = shl i32 %166, 8
  %168 = or i32 %160, %167
  %169 = load ptr, ptr %14, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct.SM3_LMS_SIGNATURE, ptr %169, i32 0, i32 2
  %171 = getelementptr inbounds %struct.anon, ptr %170, i32 0, i32 0
  %172 = getelementptr inbounds [4 x i8], ptr %171, i64 0, i64 3
  %173 = load i8, ptr %172, align 1, !tbaa !11
  %174 = zext i8 %173 to i32
  %175 = or i32 %168, %174
  store i32 %175, ptr %20, align 4, !tbaa !12
  %176 = load ptr, ptr %12, align 8, !tbaa !5
  %177 = load i32, ptr %19, align 4, !tbaa !12
  %178 = load ptr, ptr %14, align 8, !tbaa !5
  %179 = getelementptr inbounds %struct.SM3_LMS_SIGNATURE, ptr %178, i32 0, i32 2
  %180 = getelementptr inbounds %struct.anon, ptr %179, i32 0, i32 2
  %181 = getelementptr inbounds [32 x i8], ptr %180, i64 0, i64 0
  %182 = load ptr, ptr %13, align 8, !tbaa !5
  %183 = getelementptr inbounds [32 x i8], ptr %17, i64 0, i64 0
  call void @sm3_lms_digest(ptr noundef %176, i32 noundef %177, ptr noundef %181, ptr noundef %182, i64 noundef 56, ptr noundef %183)
  %184 = load ptr, ptr %12, align 8, !tbaa !5
  %185 = getelementptr inbounds [32 x i8], ptr %17, i64 0, i64 0
  %186 = load ptr, ptr %14, align 8, !tbaa !5
  %187 = call i32 @sm3_lms_do_verify(ptr noundef %184, ptr noundef %185, ptr noundef %186)
  %188 = icmp ne i32 %187, 1
  br i1 %188, label %189, label %195

189:                                              ; preds = %93
  br label %190

190:                                              ; preds = %189
  %191 = load ptr, ptr @stderr, align 8, !tbaa !5
  %192 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %191, ptr noundef @.str.14, ptr noundef @.str.15, i32 noundef 1164, ptr noundef @__FUNCTION__.sm3_hss_verify) #3
  br label %193

193:                                              ; preds = %190
  br label %194

194:                                              ; preds = %193
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %16, align 4
  br label %197

195:                                              ; preds = %93
  %196 = load ptr, ptr %13, align 8, !tbaa !5
  store ptr %196, ptr %12, align 8, !tbaa !5
  store i32 0, ptr %16, align 4
  br label %197

197:                                              ; preds = %195, %194
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #3
  br label %198

198:                                              ; preds = %197, %92, %83
  call void @llvm.lifetime.end.p0(i64 32, ptr %17) #3
  %199 = load i32, ptr %16, align 4
  switch i32 %199, label %235 [
    i32 0, label %200
  ]

200:                                              ; preds = %198
  br label %201

201:                                              ; preds = %200
  %202 = load i32, ptr %11, align 4, !tbaa !12
  %203 = add nsw i32 %202, 1
  store i32 %203, ptr %11, align 4, !tbaa !12
  br label %71, !llvm.loop !17

204:                                              ; preds = %71
  %205 = call i32 @sm3_lms_signature_from_bytes_ex(ptr noundef %14, ptr noundef %15, ptr noundef %8, ptr noundef %9)
  %206 = icmp ne i32 %205, 1
  br i1 %206, label %207, label %213

207:                                              ; preds = %204
  br label %208

208:                                              ; preds = %207
  %209 = load ptr, ptr @stderr, align 8, !tbaa !5
  %210 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %209, ptr noundef @.str.14, ptr noundef @.str.15, i32 noundef 1172, ptr noundef @__FUNCTION__.sm3_hss_verify) #3
  br label %211

211:                                              ; preds = %208
  br label %212

212:                                              ; preds = %211
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %16, align 4
  br label %235

213:                                              ; preds = %204
  %214 = load ptr, ptr %12, align 8, !tbaa !5
  %215 = load ptr, ptr %7, align 8, !tbaa !5
  %216 = load ptr, ptr %14, align 8, !tbaa !5
  %217 = call i32 @sm3_lms_do_verify(ptr noundef %214, ptr noundef %215, ptr noundef %216)
  %218 = icmp ne i32 %217, 1
  br i1 %218, label %219, label %225

219:                                              ; preds = %213
  br label %220

220:                                              ; preds = %219
  %221 = load ptr, ptr @stderr, align 8, !tbaa !5
  %222 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %221, ptr noundef @.str.14, ptr noundef @.str.15, i32 noundef 1177, ptr noundef @__FUNCTION__.sm3_hss_verify) #3
  br label %223

223:                                              ; preds = %220
  br label %224

224:                                              ; preds = %223
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %16, align 4
  br label %235

225:                                              ; preds = %213
  %226 = load i64, ptr %9, align 8, !tbaa !9
  %227 = icmp ne i64 %226, 0
  br i1 %227, label %228, label %234

228:                                              ; preds = %225
  br label %229

229:                                              ; preds = %228
  %230 = load ptr, ptr @stderr, align 8, !tbaa !5
  %231 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %230, ptr noundef @.str.14, ptr noundef @.str.15, i32 noundef 1181, ptr noundef @__FUNCTION__.sm3_hss_verify) #3
  br label %232

232:                                              ; preds = %229
  br label %233

233:                                              ; preds = %232
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %16, align 4
  br label %235

234:                                              ; preds = %225
  store i32 1, ptr %5, align 4
  store i32 1, ptr %16, align 4
  br label %235

235:                                              ; preds = %234, %233, %224, %212, %198, %67, %28
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  %236 = load i32, ptr %5, align 4
  ret i32 %236
}

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!15, !13, i64 0}
!15 = !{!"", !13, i64 0, !16, i64 4}
!16 = !{!"", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 24}
!17 = distinct !{!17, !18}
!18 = !{!"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.14 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [61 x i8], align 1
@__FUNCTION__.sm3_hss_verify = external hidden unnamed_addr constant [15 x i8], align 1

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

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

; Function Attrs: mustprogress nocallback nofree 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 @sm3_lms_public_key_from_bytes_ex(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @sm3_lms_signature_from_bytes_ex(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @sm3_lms_do_verify(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local void @sm3_lms_digest(ptr noundef, i32 noundef, ptr noundef, ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @sm3_hss_verify(ptr noundef %0, ptr noundef %1, ptr noundef %2, i64 noundef %3) local_unnamed_addr #2 {
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca [32 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #3
  %11 = icmp ult i64 %3, 4
  br i1 %11, label %12, label %15

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

15:                                               ; preds = %4
  %16 = load i8, ptr %2, align 1, !tbaa !9
  %17 = zext i8 %16 to i32
  %18 = shl nuw i32 %17, 24
  %19 = getelementptr inbounds i8, ptr %2, i64 1
  %20 = load i8, ptr %19, align 1, !tbaa !9
  %21 = zext i8 %20 to i32
  %22 = shl nuw nsw i32 %21, 16
  %23 = or disjoint i32 %22, %18
  %24 = getelementptr inbounds i8, ptr %2, i64 2
  %25 = load i8, ptr %24, align 1, !tbaa !9
  %26 = zext i8 %25 to i32
  %27 = shl nuw nsw i32 %26, 8
  %28 = or disjoint i32 %23, %27
  %29 = getelementptr inbounds i8, ptr %2, i64 3
  %30 = load i8, ptr %29, align 1, !tbaa !9
  %31 = zext i8 %30 to i32
  %32 = or disjoint i32 %28, %31
  %33 = getelementptr inbounds i8, ptr %2, i64 4
  store ptr %33, ptr %5, align 8, !tbaa !5
  %34 = add i64 %3, -4
  store i64 %34, ptr %6, align 8, !tbaa !10
  %35 = load i32, ptr %0, align 4, !tbaa !12
  %36 = add nsw i32 %35, -1
  %.not = icmp eq i32 %32, %36
  br i1 %.not, label %40, label %37

37:                                               ; preds = %15
  %38 = load ptr, ptr @stderr, align 8, !tbaa !5
  %39 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %38, ptr noundef nonnull @.str.14, ptr noundef nonnull @.str.15, i32 noundef 1134, ptr noundef nonnull @__FUNCTION__.sm3_hss_verify) #4
  br label %90

40:                                               ; preds = %15
  %41 = getelementptr inbounds i8, ptr %0, i64 4
  %42 = icmp sgt i32 %32, 0
  br i1 %42, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %40, %72
  %.01232 = phi i32 [ %74, %72 ], [ 0, %40 ]
  %.01331 = phi ptr [ %73, %72 ], [ %41, %40 ]
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %10) #3
  %43 = call i32 @sm3_lms_signature_from_bytes_ex(ptr noundef nonnull %8, ptr noundef nonnull %9, ptr noundef nonnull %5, ptr noundef nonnull %6)
  %.not22 = icmp eq i32 %43, 1
  br i1 %.not22, label %44, label %.thread

44:                                               ; preds = %.lr.ph
  %45 = call i32 @sm3_lms_public_key_from_bytes_ex(ptr noundef nonnull %7, ptr noundef nonnull %5, ptr noundef nonnull %6)
  %.not23 = icmp eq i32 %45, 1
  br i1 %.not23, label %46, label %.thread

46:                                               ; preds = %44
  %47 = load ptr, ptr %8, align 8, !tbaa !5
  %48 = getelementptr inbounds i8, ptr %47, i64 4
  %49 = load i8, ptr %48, align 1, !tbaa !9
  %50 = zext i8 %49 to i32
  %51 = shl nuw i32 %50, 24
  %52 = getelementptr inbounds i8, ptr %47, i64 5
  %53 = load i8, ptr %52, align 1, !tbaa !9
  %54 = zext i8 %53 to i32
  %55 = shl nuw nsw i32 %54, 16
  %56 = or disjoint i32 %55, %51
  %57 = getelementptr inbounds i8, ptr %47, i64 6
  %58 = load i8, ptr %57, align 1, !tbaa !9
  %59 = zext i8 %58 to i32
  %60 = shl nuw nsw i32 %59, 8
  %61 = or disjoint i32 %56, %60
  %62 = getelementptr inbounds i8, ptr %47, i64 7
  %63 = load i8, ptr %62, align 1, !tbaa !9
  %64 = zext i8 %63 to i32
  %65 = or disjoint i32 %61, %64
  %66 = getelementptr inbounds i8, ptr %47, i64 1100
  %67 = load ptr, ptr %7, align 8, !tbaa !5
  call void @sm3_lms_digest(ptr noundef %.01331, i32 noundef %65, ptr noundef nonnull %66, ptr noundef %67, i64 noundef 56, ptr noundef nonnull %10)
  %68 = load ptr, ptr %8, align 8, !tbaa !5
  %69 = call i32 @sm3_lms_do_verify(ptr noundef %.01331, ptr noundef nonnull %10, ptr noundef %68)
  %.not24 = icmp eq i32 %69, 1
  br i1 %.not24, label %72, label %.thread

.thread:                                          ; preds = %46, %44, %.lr.ph
  %.sink33 = phi i32 [ 1145, %.lr.ph ], [ 1150, %44 ], [ 1164, %46 ]
  %70 = load ptr, ptr @stderr, align 8, !tbaa !5
  %71 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %70, ptr noundef nonnull @.str.14, ptr noundef nonnull @.str.15, i32 noundef %.sink33, ptr noundef nonnull @__FUNCTION__.sm3_hss_verify) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %10) #3
  br label %90

72:                                               ; preds = %46
  %73 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %10) #3
  %74 = add nuw nsw i32 %.01232, 1
  %exitcond.not = icmp eq i32 %74, %32
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !16

._crit_edge:                                      ; preds = %72, %40
  %.013.lcssa = phi ptr [ %41, %40 ], [ %73, %72 ]
  %75 = call i32 @sm3_lms_signature_from_bytes_ex(ptr noundef nonnull %8, ptr noundef nonnull %9, ptr noundef nonnull %5, ptr noundef nonnull %6)
  %.not19 = icmp eq i32 %75, 1
  br i1 %.not19, label %79, label %76

76:                                               ; preds = %._crit_edge
  %77 = load ptr, ptr @stderr, align 8, !tbaa !5
  %78 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %77, ptr noundef nonnull @.str.14, ptr noundef nonnull @.str.15, i32 noundef 1172, ptr noundef nonnull @__FUNCTION__.sm3_hss_verify) #4
  br label %90

79:                                               ; preds = %._crit_edge
  %80 = load ptr, ptr %8, align 8, !tbaa !5
  %81 = call i32 @sm3_lms_do_verify(ptr noundef %.013.lcssa, ptr noundef %1, ptr noundef %80)
  %.not20 = icmp eq i32 %81, 1
  br i1 %.not20, label %85, label %82

82:                                               ; preds = %79
  %83 = load ptr, ptr @stderr, align 8, !tbaa !5
  %84 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %83, ptr noundef nonnull @.str.14, ptr noundef nonnull @.str.15, i32 noundef 1177, ptr noundef nonnull @__FUNCTION__.sm3_hss_verify) #4
  br label %90

85:                                               ; preds = %79
  %86 = load i64, ptr %6, align 8, !tbaa !10
  %.not21 = icmp eq i64 %86, 0
  br i1 %.not21, label %90, label %87

87:                                               ; preds = %85
  %88 = load ptr, ptr @stderr, align 8, !tbaa !5
  %89 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %88, ptr noundef nonnull @.str.14, ptr noundef nonnull @.str.15, i32 noundef 1181, ptr noundef nonnull @__FUNCTION__.sm3_hss_verify) #4
  br label %90

90:                                               ; preds = %.thread, %85, %87, %82, %76, %37, %12
  %.3 = phi i32 [ -1, %12 ], [ -1, %37 ], [ -1, %76 ], [ -1, %82 ], [ -1, %87 ], [ 1, %85 ], [ -1, %.thread ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #3
  ret i32 %.3
}

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { nounwind }
attributes #4 = { cold 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 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"long", !7, i64 0}
!12 = !{!13, !14, i64 0}
!13 = !{!"", !14, i64 0, !15, i64 4}
!14 = !{!"int", !7, i64 0}
!15 = !{!"", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 24}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}


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