; LLVM IR from intel/cryptography-primitives :: sources/ippcp/xmss (wots_internal)

; 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.cpWOTSParams = type { i32, i32, i32, i32, i32, ptr }

; Function Attrs: nounwind uwtable
declare dso_local void @cp_xmss_base_w(ptr noundef, i32 noundef, 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: inlinehint nounwind uwtable
declare hidden void @cp_to_byte(ptr noundef, i32 noundef, i32 noundef) #2

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @cp_xmss_chain(ptr noundef, i8 noundef zeroext, i8 noundef zeroext, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #0

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @cp_xmss_ceil(double noundef) #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @cp_xmss_set_chain_address(ptr noundef, i8 noundef zeroext) #2

; Function Attrs: nounwind uwtable
define dso_local i32 @cp_xmss_WOTS_sign(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6) #0 {
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca ptr, align 8
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  %25 = alloca ptr, align 8
  %26 = alloca ptr, align 8
  %27 = alloca i32, align 4
  %28 = alloca i32, align 4
  store ptr %0, ptr %9, align 8, !tbaa !5
  store ptr %1, ptr %10, align 8, !tbaa !5
  store ptr %2, ptr %11, align 8, !tbaa !5
  store ptr %3, ptr %12, align 8, !tbaa !5
  store ptr %4, ptr %13, align 8, !tbaa !5
  store ptr %5, ptr %14, align 8, !tbaa !5
  store ptr %6, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #3
  store i32 0, ptr %16, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #3
  %29 = load ptr, ptr %15, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.cpWOTSParams, ptr %29, i32 0, i32 3
  %31 = load i32, ptr %30, align 4, !tbaa !11
  store i32 %31, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #3
  %32 = load ptr, ptr %15, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.cpWOTSParams, ptr %32, i32 0, i32 2
  %34 = load i32, ptr %33, align 8, !tbaa !13
  store i32 %34, ptr %18, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #3
  %35 = load i32, ptr %17, align 4, !tbaa !9
  %36 = load i32, ptr %18, align 4, !tbaa !9
  %37 = sub nsw i32 %35, %36
  store i32 %37, ptr %19, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #3
  %38 = load ptr, ptr %15, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.cpWOTSParams, ptr %38, i32 0, i32 0
  %40 = load i32, ptr %39, align 8, !tbaa !14
  store i32 %40, ptr %20, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #3
  %41 = load ptr, ptr %14, align 8, !tbaa !5
  store ptr %41, ptr %21, align 8, !tbaa !5
  %42 = load ptr, ptr %9, align 8, !tbaa !5
  %43 = load ptr, ptr %15, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.cpWOTSParams, ptr %43, i32 0, i32 2
  %45 = load i32, ptr %44, align 8, !tbaa !13
  %46 = load ptr, ptr %21, align 8, !tbaa !5
  %47 = load ptr, ptr %15, align 8, !tbaa !5
  call void @cp_xmss_base_w(ptr noundef %42, i32 noundef %45, ptr noundef %46, ptr noundef %47)
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #3
  store i32 0, ptr %22, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #3
  store i32 0, ptr %23, align 4, !tbaa !9
  br label %48

48:                                               ; preds = %69, %7
  %49 = load i32, ptr %23, align 4, !tbaa !9
  %50 = load ptr, ptr %15, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.cpWOTSParams, ptr %50, i32 0, i32 2
  %52 = load i32, ptr %51, align 8, !tbaa !13
  %53 = icmp slt i32 %49, %52
  br i1 %53, label %55, label %54

54:                                               ; preds = %48
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #3
  br label %72

55:                                               ; preds = %48
  %56 = load i32, ptr %22, align 4, !tbaa !9
  %57 = load ptr, ptr %15, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.cpWOTSParams, ptr %57, i32 0, i32 1
  %59 = load i32, ptr %58, align 4, !tbaa !15
  %60 = add i32 %56, %59
  %61 = sub i32 %60, 1
  %62 = load ptr, ptr %21, align 8, !tbaa !5
  %63 = load i32, ptr %23, align 4, !tbaa !9
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds i8, ptr %62, i64 %64
  %66 = load i8, ptr %65, align 1, !tbaa !16
  %67 = zext i8 %66 to i32
  %68 = sub i32 %61, %67
  store i32 %68, ptr %22, align 4, !tbaa !9
  br label %69

69:                                               ; preds = %55
  %70 = load i32, ptr %23, align 4, !tbaa !9
  %71 = add nsw i32 %70, 1
  store i32 %71, ptr %23, align 4, !tbaa !9
  br label %48, !llvm.loop !17

72:                                               ; preds = %54
  %73 = load i32, ptr %22, align 4, !tbaa !9
  %74 = load i32, ptr %19, align 4, !tbaa !9
  %75 = load ptr, ptr %15, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.cpWOTSParams, ptr %75, i32 0, i32 4
  %77 = load i32, ptr %76, align 8, !tbaa !19
  %78 = mul nsw i32 %74, %77
  %79 = and i32 %78, 7
  %80 = sub nsw i32 8, %79
  %81 = shl i32 %73, %80
  store i32 %81, ptr %22, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #3
  %82 = load i32, ptr %19, align 4, !tbaa !9
  %83 = load ptr, ptr %15, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.cpWOTSParams, ptr %83, i32 0, i32 4
  %85 = load i32, ptr %84, align 8, !tbaa !19
  %86 = mul nsw i32 %82, %85
  %87 = sitofp i32 %86 to double
  %88 = fdiv double %87, 8.000000e+00
  %89 = call i32 @cp_xmss_ceil(double noundef %88)
  store i32 %89, ptr %24, align 4, !tbaa !9
  %90 = load ptr, ptr %21, align 8, !tbaa !5
  %91 = load i32, ptr %17, align 4, !tbaa !9
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds i8, ptr %90, i64 %92
  %94 = load i32, ptr %24, align 4, !tbaa !9
  %95 = load i32, ptr %22, align 4, !tbaa !9
  call void @cp_to_byte(ptr noundef %93, i32 noundef %94, i32 noundef %95)
  %96 = load ptr, ptr %21, align 8, !tbaa !5
  %97 = load i32, ptr %17, align 4, !tbaa !9
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds i8, ptr %96, i64 %98
  %100 = load i32, ptr %19, align 4, !tbaa !9
  %101 = load ptr, ptr %21, align 8, !tbaa !5
  %102 = load i32, ptr %18, align 4, !tbaa !9
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds i8, ptr %101, i64 %103
  %105 = load ptr, ptr %15, align 8, !tbaa !5
  call void @cp_xmss_base_w(ptr noundef %99, i32 noundef %100, ptr noundef %104, ptr noundef %105)
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #3
  %106 = load ptr, ptr %14, align 8, !tbaa !5
  %107 = load i32, ptr %17, align 4, !tbaa !9
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds i8, ptr %106, i64 %108
  store ptr %109, ptr %25, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #3
  %110 = load ptr, ptr %14, align 8, !tbaa !5
  %111 = load i32, ptr %17, align 4, !tbaa !9
  %112 = load i32, ptr %20, align 4, !tbaa !9
  %113 = add nsw i32 %111, %112
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds i8, ptr %110, i64 %114
  store ptr %115, ptr %26, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #3
  store i32 0, ptr %27, align 4, !tbaa !9
  br label %116

116:                                              ; preds = %173, %72
  %117 = load i32, ptr %27, align 4, !tbaa !9
  %118 = load i32, ptr %17, align 4, !tbaa !9
  %119 = icmp slt i32 %117, %118
  br i1 %119, label %121, label %120

120:                                              ; preds = %116
  store i32 5, ptr %28, align 4
  br label %176

121:                                              ; preds = %116
  %122 = load ptr, ptr %26, align 8, !tbaa !5
  %123 = load i32, ptr %20, align 4, !tbaa !9
  %124 = load i32, ptr %27, align 4, !tbaa !9
  call void @cp_to_byte(ptr noundef %122, i32 noundef %123, i32 noundef %124)
  %125 = load ptr, ptr %10, align 8, !tbaa !5
  %126 = load ptr, ptr %26, align 8, !tbaa !5
  %127 = load ptr, ptr %25, align 8, !tbaa !5
  %128 = load ptr, ptr %14, align 8, !tbaa !5
  %129 = load i32, ptr %17, align 4, !tbaa !9
  %130 = load i32, ptr %20, align 4, !tbaa !9
  %131 = mul nsw i32 2, %130
  %132 = add nsw i32 %129, %131
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds i8, ptr %128, i64 %133
  %135 = load ptr, ptr %15, align 8, !tbaa !5
  %136 = call i32 @cp_xmss_prf(ptr noundef %125, ptr noundef %126, ptr noundef %127, ptr noundef %134, ptr noundef %135)
  store i32 %136, ptr %16, align 4, !tbaa !9
  %137 = load i32, ptr %16, align 4, !tbaa !9
  %138 = icmp ne i32 0, %137
  br i1 %138, label %139, label %141

139:                                              ; preds = %121
  %140 = load i32, ptr %16, align 4, !tbaa !9
  store i32 %140, ptr %8, align 4
  store i32 1, ptr %28, align 4
  br label %176

141:                                              ; preds = %121
  %142 = load ptr, ptr %13, align 8, !tbaa !5
  %143 = load i32, ptr %27, align 4, !tbaa !9
  %144 = trunc i32 %143 to i8
  call void @cp_xmss_set_chain_address(ptr noundef %142, i8 noundef zeroext %144)
  %145 = load ptr, ptr %25, align 8, !tbaa !5
  %146 = load ptr, ptr %21, align 8, !tbaa !5
  %147 = load i32, ptr %27, align 4, !tbaa !9
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds i8, ptr %146, i64 %148
  %150 = load i8, ptr %149, align 1, !tbaa !16
  %151 = load ptr, ptr %12, align 8, !tbaa !5
  %152 = load ptr, ptr %13, align 8, !tbaa !5
  %153 = load ptr, ptr %11, align 8, !tbaa !5
  %154 = load i32, ptr %27, align 4, !tbaa !9
  %155 = load i32, ptr %20, align 4, !tbaa !9
  %156 = mul nsw i32 %154, %155
  %157 = sext i32 %156 to i64
  %158 = getelementptr inbounds i8, ptr %153, i64 %157
  %159 = load ptr, ptr %14, align 8, !tbaa !5
  %160 = load i32, ptr %17, align 4, !tbaa !9
  %161 = load i32, ptr %20, align 4, !tbaa !9
  %162 = mul nsw i32 2, %161
  %163 = add nsw i32 %160, %162
  %164 = sext i32 %163 to i64
  %165 = getelementptr inbounds i8, ptr %159, i64 %164
  %166 = load ptr, ptr %15, align 8, !tbaa !5
  %167 = call i32 @cp_xmss_chain(ptr noundef %145, i8 noundef zeroext 0, i8 noundef zeroext %150, ptr noundef %151, ptr noundef %152, ptr noundef %158, ptr noundef %165, ptr noundef %166)
  store i32 %167, ptr %16, align 4, !tbaa !9
  %168 = load i32, ptr %16, align 4, !tbaa !9
  %169 = icmp ne i32 0, %168
  br i1 %169, label %170, label %172

170:                                              ; preds = %141
  %171 = load i32, ptr %16, align 4, !tbaa !9
  store i32 %171, ptr %8, align 4
  store i32 1, ptr %28, align 4
  br label %176

172:                                              ; preds = %141
  br label %173

173:                                              ; preds = %172
  %174 = load i32, ptr %27, align 4, !tbaa !9
  %175 = add nsw i32 %174, 1
  store i32 %175, ptr %27, align 4, !tbaa !9
  br label %116, !llvm.loop !20

176:                                              ; preds = %170, %139, %120
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #3
  %177 = load i32, ptr %28, align 4
  switch i32 %177, label %181 [
    i32 5, label %178
  ]

178:                                              ; preds = %176
  %179 = load ptr, ptr %13, align 8, !tbaa !5
  call void @cp_xmss_set_chain_address(ptr noundef %179, i8 noundef zeroext 0)
  %180 = load i32, ptr %16, align 4, !tbaa !9
  store i32 %180, ptr %8, align 4
  store i32 1, ptr %28, align 4
  br label %181

181:                                              ; preds = %178, %176
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #3
  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
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #3
  %182 = load i32, ptr %8, align 4
  ret i32 %182
}

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 = { inlinehint 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 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 12}
!12 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !6, i64 24}
!13 = !{!12, !10, i64 8}
!14 = !{!12, !10, i64 0}
!15 = !{!12, !10, i64 4}
!16 = !{!7, !7, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!12, !10, i64 16}
!20 = distinct !{!20, !18}


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

; Function Attrs: nounwind uwtable
declare dso_local void @cp_xmss_base_w(ptr noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @cp_to_byte(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @cp_xmss_chain(ptr noundef, i8 noundef zeroext, i8 noundef zeroext, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @cp_xmss_ceil(double noundef) local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @cp_xmss_set_chain_address(ptr noundef, i8 noundef zeroext) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local i32 @cp_xmss_WOTS_sign(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6) local_unnamed_addr #0 {
  %8 = getelementptr inbounds i8, ptr %6, i64 12
  %9 = load i32, ptr %8, align 4, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %6, i64 8
  %11 = load i32, ptr %10, align 8, !tbaa !11
  %12 = sub nsw i32 %9, %11
  %13 = load i32, ptr %6, align 8, !tbaa !12
  tail call void @cp_xmss_base_w(ptr noundef %0, i32 noundef %11, ptr noundef %5, ptr noundef nonnull %6)
  %14 = load i32, ptr %10, align 8, !tbaa !11
  %15 = icmp sgt i32 %14, 0
  br i1 %15, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %7
  %16 = getelementptr inbounds i8, ptr %6, i64 4
  %17 = load i32, ptr %16, align 4, !tbaa !13
  %wide.trip.count = zext nneg i32 %14 to i64
  %min.iters.check = icmp ult i32 %14, 8
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

scalar.ph.preheader:                              ; preds = %middle.block, %.lr.ph
  %indvars.iv.ph = phi i64 [ 0, %.lr.ph ], [ %n.vec, %middle.block ]
  %.07586.ph = phi i32 [ 0, %.lr.ph ], [ %29, %middle.block ]
  br label %scalar.ph

vector.ph:                                        ; preds = %.lr.ph
  %n.vec = and i64 %wide.trip.count, 2147483640
  %broadcast.splatinsert = insertelement <4 x i32> poison, i32 %17, i64 0
  %broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %26, %vector.body ]
  %vec.phi98 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %27, %vector.body ]
  %18 = add <4 x i32> %broadcast.splat, %vec.phi
  %19 = add <4 x i32> %broadcast.splat, %vec.phi98
  %20 = getelementptr inbounds i8, ptr %5, i64 %index
  %21 = getelementptr inbounds i8, ptr %20, i64 4
  %wide.load = load <4 x i8>, ptr %20, align 1, !tbaa !14
  %wide.load99 = load <4 x i8>, ptr %21, align 1, !tbaa !14
  %22 = zext <4 x i8> %wide.load to <4 x i32>
  %23 = zext <4 x i8> %wide.load99 to <4 x i32>
  %24 = xor <4 x i32> %22, <i32 -1, i32 -1, i32 -1, i32 -1>
  %25 = xor <4 x i32> %23, <i32 -1, i32 -1, i32 -1, i32 -1>
  %26 = add <4 x i32> %18, %24
  %27 = add <4 x i32> %19, %25
  %index.next = add nuw i64 %index, 8
  %28 = icmp eq i64 %index.next, %n.vec
  br i1 %28, label %middle.block, label %vector.body, !llvm.loop !15

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <4 x i32> %27, %26
  %29 = tail call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count
  br i1 %cmp.n, label %._crit_edge, label %scalar.ph.preheader

._crit_edge:                                      ; preds = %scalar.ph, %middle.block, %7
  %.075.lcssa = phi i32 [ 0, %7 ], [ %29, %middle.block ], [ %56, %scalar.ph ]
  %30 = getelementptr inbounds i8, ptr %6, i64 16
  %31 = load i32, ptr %30, align 8, !tbaa !19
  %32 = mul nsw i32 %31, %12
  %33 = and i32 %32, 7
  %34 = sub nuw nsw i32 8, %33
  %35 = shl i32 %.075.lcssa, %34
  %36 = sitofp i32 %32 to double
  %37 = fmul double %36, 1.250000e-01
  %38 = tail call i32 @cp_xmss_ceil(double noundef %37)
  %39 = sext i32 %9 to i64
  %40 = getelementptr inbounds i8, ptr %5, i64 %39
  tail call void @cp_to_byte(ptr noundef %40, i32 noundef %38, i32 noundef %35)
  %41 = sext i32 %11 to i64
  %42 = getelementptr inbounds i8, ptr %5, i64 %41
  tail call void @cp_xmss_base_w(ptr noundef %40, i32 noundef %12, ptr noundef %42, ptr noundef nonnull %6)
  %43 = add nsw i32 %13, %9
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds i8, ptr %5, i64 %44
  %.not8287 = icmp sgt i32 %9, 0
  br i1 %.not8287, label %.lr.ph90, label %._crit_edge91

.lr.ph90:                                         ; preds = %._crit_edge
  %46 = shl nsw i32 %13, 1
  %47 = add nsw i32 %46, %9
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds i8, ptr %5, i64 %48
  %50 = sext i32 %13 to i64
  %wide.trip.count96 = zext nneg i32 %9 to i64
  br label %58

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %scalar.ph ], [ %indvars.iv.ph, %scalar.ph.preheader ]
  %.07586 = phi i32 [ %56, %scalar.ph ], [ %.07586.ph, %scalar.ph.preheader ]
  %51 = add i32 %17, %.07586
  %52 = getelementptr inbounds i8, ptr %5, i64 %indvars.iv
  %53 = load i8, ptr %52, align 1, !tbaa !14
  %54 = zext i8 %53 to i32
  %55 = xor i32 %54, -1
  %56 = add i32 %51, %55
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %scalar.ph, !llvm.loop !20

57:                                               ; preds = %61
  %indvars.iv.next94 = add nuw nsw i64 %indvars.iv93, 1
  %exitcond97.not = icmp eq i64 %indvars.iv.next94, %wide.trip.count96
  br i1 %exitcond97.not, label %._crit_edge91, label %58, !llvm.loop !21

58:                                               ; preds = %.lr.ph90, %57
  %indvars.iv93 = phi i64 [ 0, %.lr.ph90 ], [ %indvars.iv.next94, %57 ]
  %59 = trunc nuw nsw i64 %indvars.iv93 to i32
  tail call void @cp_to_byte(ptr noundef %45, i32 noundef %13, i32 noundef %59)
  %60 = tail call i32 @cp_xmss_prf(ptr noundef %1, ptr noundef %45, ptr noundef nonnull %40, ptr noundef %49, ptr noundef nonnull %6)
  %.not = icmp eq i32 %60, 0
  br i1 %.not, label %61, label %.thread

61:                                               ; preds = %58
  %62 = trunc i64 %indvars.iv93 to i8
  tail call void @cp_xmss_set_chain_address(ptr noundef %4, i8 noundef zeroext %62)
  %63 = getelementptr inbounds i8, ptr %5, i64 %indvars.iv93
  %64 = load i8, ptr %63, align 1, !tbaa !14
  %65 = mul nsw i64 %indvars.iv93, %50
  %66 = getelementptr inbounds i8, ptr %2, i64 %65
  %67 = tail call i32 @cp_xmss_chain(ptr noundef nonnull %40, i8 noundef zeroext 0, i8 noundef zeroext %64, ptr noundef %3, ptr noundef %4, ptr noundef %66, ptr noundef %49, ptr noundef nonnull %6)
  %.not81 = icmp eq i32 %67, 0
  br i1 %.not81, label %57, label %.thread

._crit_edge91:                                    ; preds = %57, %._crit_edge
  tail call void @cp_xmss_set_chain_address(ptr noundef %4, i8 noundef zeroext 0)
  br label %.thread

.thread:                                          ; preds = %58, %61, %._crit_edge91
  %.1 = phi i32 [ 0, %._crit_edge91 ], [ %60, %58 ], [ %67, %61 ]
  ret i32 %.1
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #2

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { inlinehint 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 #2 = { nocallback nofree nosync nounwind speculatable 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, !7, i64 12}
!6 = !{!"", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !10, i64 24}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !7, i64 8}
!12 = !{!6, !7, i64 0}
!13 = !{!6, !7, i64 4}
!14 = !{!8, !8, i64 0}
!15 = distinct !{!15, !16, !17, !18}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!"llvm.loop.isvectorized", i32 1}
!18 = !{!"llvm.loop.unroll.runtime.disable"}
!19 = !{!6, !7, i64 16}
!20 = distinct !{!20, !16, !18, !17}
!21 = distinct !{!21, !16}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass