; LLVM IR from bqi343/cp-notebook :: Contests/USACO Training/Ch 2/2.1 holstein.ll (Z6searchii)

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

@V = external dso_local global i32, align 4
@G = external dso_local global i32, align 4
@bes = external dso_local global i32, align 4
@req = external dso_local global [25 x i32], align 16
@val = external dso_local global [15 x [25 x i32]], align 16

; Function Attrs: mustprogress uwtable
define dso_local void @_Z6searchii(i32 noundef %0, i32 noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i8, align 1
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  store i32 %0, ptr %3, align 4, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #4
  store i8 0, ptr %5, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %10

10:                                               ; preds = %23, %2
  %11 = load i32, ptr %6, align 4, !tbaa !5
  %12 = load i32, ptr @V, align 4, !tbaa !5
  %13 = icmp slt i32 %11, %12
  br i1 %13, label %15, label %14

14:                                               ; preds = %10
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %26

15:                                               ; preds = %10
  %16 = load i32, ptr %6, align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds [25 x i32], ptr @req, i64 0, i64 %17
  %19 = load i32, ptr %18, align 4, !tbaa !5
  %20 = icmp sgt i32 %19, 0
  br i1 %20, label %21, label %22

21:                                               ; preds = %15
  store i8 1, ptr %5, align 1, !tbaa !9
  br label %22

22:                                               ; preds = %21, %15
  br label %23

23:                                               ; preds = %22
  %24 = load i32, ptr %6, align 4, !tbaa !5
  %25 = add nsw i32 %24, 1
  store i32 %25, ptr %6, align 4, !tbaa !5
  br label %10, !llvm.loop !11

26:                                               ; preds = %14
  %27 = load i8, ptr %5, align 1, !tbaa !9, !range !13, !noundef !14
  %28 = trunc i8 %27 to i1
  br i1 %28, label %48, label %29

29:                                               ; preds = %26
  %30 = load i32, ptr %4, align 4, !tbaa !5
  %31 = call i32 @llvm.ctpop.i32(i32 %30)
  %32 = load i32, ptr @bes, align 4, !tbaa !5
  %33 = call i32 @llvm.ctpop.i32(i32 %32)
  %34 = icmp slt i32 %31, %33
  br i1 %34, label %35, label %37

35:                                               ; preds = %29
  %36 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %36, ptr @bes, align 4, !tbaa !5
  br label %47

37:                                               ; preds = %29
  %38 = load i32, ptr %4, align 4, !tbaa !5
  %39 = call i32 @llvm.ctpop.i32(i32 %38)
  %40 = load i32, ptr @bes, align 4, !tbaa !5
  %41 = call i32 @llvm.ctpop.i32(i32 %40)
  %42 = icmp eq i32 %39, %41
  br i1 %42, label %43, label %46

43:                                               ; preds = %37
  %44 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @bes, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %45 = load i32, ptr %44, align 4, !tbaa !5
  store i32 %45, ptr @bes, align 4, !tbaa !5
  br label %46

46:                                               ; preds = %43, %37
  br label %47

47:                                               ; preds = %46, %35
  store i32 1, ptr %7, align 4
  br label %107

48:                                               ; preds = %26
  %49 = load i32, ptr %3, align 4, !tbaa !5
  %50 = load i32, ptr @G, align 4, !tbaa !5
  %51 = icmp slt i32 %49, %50
  br i1 %51, label %52, label %106

52:                                               ; preds = %48
  %53 = load i32, ptr %3, align 4, !tbaa !5
  %54 = add nsw i32 %53, 1
  %55 = load i32, ptr %4, align 4, !tbaa !5
  call void @_Z6searchii(i32 noundef %54, i32 noundef %55)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %56

56:                                               ; preds = %74, %52
  %57 = load i32, ptr %8, align 4, !tbaa !5
  %58 = load i32, ptr @V, align 4, !tbaa !5
  %59 = icmp slt i32 %57, %58
  br i1 %59, label %61, label %60

60:                                               ; preds = %56
  store i32 5, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %77

61:                                               ; preds = %56
  %62 = load i32, ptr %3, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [15 x [25 x i32]], ptr @val, i64 0, i64 %63
  %65 = load i32, ptr %8, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [25 x i32], ptr %64, i64 0, i64 %66
  %68 = load i32, ptr %67, align 4, !tbaa !5
  %69 = load i32, ptr %8, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [25 x i32], ptr @req, i64 0, i64 %70
  %72 = load i32, ptr %71, align 4, !tbaa !5
  %73 = sub nsw i32 %72, %68
  store i32 %73, ptr %71, align 4, !tbaa !5
  br label %74

74:                                               ; preds = %61
  %75 = load i32, ptr %8, align 4, !tbaa !5
  %76 = add nsw i32 %75, 1
  store i32 %76, ptr %8, align 4, !tbaa !5
  br label %56, !llvm.loop !15

77:                                               ; preds = %60
  %78 = load i32, ptr %3, align 4, !tbaa !5
  %79 = add nsw i32 %78, 1
  %80 = load i32, ptr %4, align 4, !tbaa !5
  %81 = load i32, ptr %3, align 4, !tbaa !5
  %82 = shl i32 1, %81
  %83 = xor i32 %80, %82
  call void @_Z6searchii(i32 noundef %79, i32 noundef %83)
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %84

84:                                               ; preds = %102, %77
  %85 = load i32, ptr %9, align 4, !tbaa !5
  %86 = load i32, ptr @V, align 4, !tbaa !5
  %87 = icmp slt i32 %85, %86
  br i1 %87, label %89, label %88

88:                                               ; preds = %84
  store i32 8, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %105

89:                                               ; preds = %84
  %90 = load i32, ptr %3, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [15 x [25 x i32]], ptr @val, i64 0, i64 %91
  %93 = load i32, ptr %9, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [25 x i32], ptr %92, i64 0, i64 %94
  %96 = load i32, ptr %95, align 4, !tbaa !5
  %97 = load i32, ptr %9, align 4, !tbaa !5
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [25 x i32], ptr @req, i64 0, i64 %98
  %100 = load i32, ptr %99, align 4, !tbaa !5
  %101 = add nsw i32 %100, %96
  store i32 %101, ptr %99, align 4, !tbaa !5
  br label %102

102:                                              ; preds = %89
  %103 = load i32, ptr %9, align 4, !tbaa !5
  %104 = add nsw i32 %103, 1
  store i32 %104, ptr %9, align 4, !tbaa !5
  br label %84, !llvm.loop !16

105:                                              ; preds = %88
  br label %106

106:                                              ; preds = %105, %48
  store i32 0, ptr %7, align 4
  br label %107

107:                                              ; preds = %106, %47
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #4
  %108 = load i32, ptr %7, align 4
  switch i32 %108, label %110 [
    i32 0, label %109
    i32 1, label %109
  ]

109:                                              ; preds = %107, %107
  ret void

110:                                              ; preds = %107
  unreachable
}

; 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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.ctpop.i32(i32) #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #3

attributes #0 = { mustprogress 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { inlinehint mustprogress 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 #4 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}


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

@V = external dso_local local_unnamed_addr global i32, align 4
@G = external dso_local local_unnamed_addr global i32, align 4
@bes = external dso_local global i32, align 4
@req = external dso_local local_unnamed_addr global [25 x i32], align 16
@val = external dso_local local_unnamed_addr global [15 x [25 x i32]], align 16

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_Z6searchii(i32 noundef %0, i32 noundef %1) local_unnamed_addr #0 {
  %3 = alloca i32, align 4
  store i32 %1, ptr %3, align 4, !tbaa !5
  %4 = load i32, ptr @V, align 4, !tbaa !5
  %5 = icmp sgt i32 %4, 0
  br i1 %5, label %.lr.ph.preheader, label %.critedge

.lr.ph.preheader:                                 ; preds = %2
  %wide.trip.count = zext nneg i32 %4 to i64
  %min.iters.check = icmp ult i32 %4, 8
  br i1 %min.iters.check, label %.lr.ph.preheader75, label %vector.ph

.lr.ph.preheader75:                               ; preds = %middle.block, %.lr.ph.preheader
  %indvars.iv.ph = phi i64 [ 0, %.lr.ph.preheader ], [ %n.vec, %middle.block ]
  %.02024.ph = phi i1 [ false, %.lr.ph.preheader ], [ %14, %middle.block ]
  br label %.lr.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %wide.trip.count, 2147483640
  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 i1> [ zeroinitializer, %vector.ph ], [ %10, %vector.body ]
  %vec.phi43 = phi <4 x i1> [ zeroinitializer, %vector.ph ], [ %11, %vector.body ]
  %6 = getelementptr inbounds [25 x i32], ptr @req, i64 0, i64 %index
  %7 = getelementptr inbounds i8, ptr %6, i64 16
  %wide.load = load <4 x i32>, ptr %6, align 16, !tbaa !5
  %wide.load44 = load <4 x i32>, ptr %7, align 16, !tbaa !5
  %8 = icmp sgt <4 x i32> %wide.load, zeroinitializer
  %9 = icmp sgt <4 x i32> %wide.load44, zeroinitializer
  %10 = or <4 x i1> %vec.phi, %8
  %11 = or <4 x i1> %vec.phi43, %9
  %index.next = add nuw i64 %index, 8
  %12 = icmp eq i64 %index.next, %n.vec
  br i1 %12, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  %bin.rdx = or <4 x i1> %11, %10
  %bin.rdx.fr = freeze <4 x i1> %bin.rdx
  %13 = bitcast <4 x i1> %bin.rdx.fr to i4
  %14 = icmp ne i4 %13, 0
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count
  br i1 %cmp.n, label %._crit_edge, label %.lr.ph.preheader75

._crit_edge:                                      ; preds = %.lr.ph, %middle.block
  %spec.select.lcssa = phi i1 [ %14, %middle.block ], [ %spec.select, %.lr.ph ]
  br i1 %spec.select.lcssa, label %27, label %.critedge

.lr.ph:                                           ; preds = %.lr.ph.preheader75, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ %indvars.iv.ph, %.lr.ph.preheader75 ]
  %.02024 = phi i1 [ %spec.select, %.lr.ph ], [ %.02024.ph, %.lr.ph.preheader75 ]
  %15 = getelementptr inbounds [25 x i32], ptr @req, i64 0, i64 %indvars.iv
  %16 = load i32, ptr %15, align 4, !tbaa !5
  %17 = icmp sgt i32 %16, 0
  %spec.select = select i1 %17, i1 true, i1 %.02024
  %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 %.lr.ph, !llvm.loop !13

.critedge:                                        ; preds = %2, %._crit_edge
  %18 = tail call range(i32 0, 33) i32 @llvm.ctpop.i32(i32 %1)
  %19 = load i32, ptr @bes, align 4, !tbaa !5
  %20 = tail call range(i32 0, 33) i32 @llvm.ctpop.i32(i32 %19)
  %21 = icmp ult i32 %18, %20
  br i1 %21, label %.loopexit.sink.split, label %22

22:                                               ; preds = %.critedge
  %23 = icmp eq i32 %18, %20
  br i1 %23, label %24, label %.loopexit

24:                                               ; preds = %22
  %25 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @bes, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %26 = load i32, ptr %25, align 4, !tbaa !5
  br label %.loopexit.sink.split

27:                                               ; preds = %._crit_edge
  %28 = load i32, ptr @G, align 4, !tbaa !5
  %29 = icmp sgt i32 %28, %0
  br i1 %29, label %30, label %.loopexit

30:                                               ; preds = %27
  %31 = add nsw i32 %0, 1
  tail call void @_Z6searchii(i32 noundef %31, i32 noundef %1)
  %32 = load i32, ptr @V, align 4, !tbaa !5
  %33 = icmp sgt i32 %32, 0
  br i1 %33, label %.lr.ph28, label %._crit_edge29

.lr.ph28:                                         ; preds = %30
  %34 = sext i32 %0 to i64
  %wide.trip.count36 = zext nneg i32 %32 to i64
  %min.iters.check47 = icmp ult i32 %32, 8
  br i1 %min.iters.check47, label %scalar.ph46.preheader, label %vector.ph48

scalar.ph46.preheader:                            ; preds = %middle.block45, %.lr.ph28
  %indvars.iv33.ph = phi i64 [ 0, %.lr.ph28 ], [ %n.vec50, %middle.block45 ]
  br label %scalar.ph46

vector.ph48:                                      ; preds = %.lr.ph28
  %n.vec50 = and i64 %wide.trip.count36, 2147483640
  br label %vector.body52

vector.body52:                                    ; preds = %vector.body52, %vector.ph48
  %index53 = phi i64 [ 0, %vector.ph48 ], [ %index.next58, %vector.body52 ]
  %35 = getelementptr inbounds [15 x [25 x i32]], ptr @val, i64 0, i64 %34, i64 %index53
  %36 = getelementptr inbounds i8, ptr %35, i64 16
  %wide.load54 = load <4 x i32>, ptr %35, align 4, !tbaa !5
  %wide.load55 = load <4 x i32>, ptr %36, align 4, !tbaa !5
  %37 = getelementptr inbounds [25 x i32], ptr @req, i64 0, i64 %index53
  %38 = getelementptr inbounds i8, ptr %37, i64 16
  %wide.load56 = load <4 x i32>, ptr %37, align 16, !tbaa !5
  %wide.load57 = load <4 x i32>, ptr %38, align 16, !tbaa !5
  %39 = sub nsw <4 x i32> %wide.load56, %wide.load54
  %40 = sub nsw <4 x i32> %wide.load57, %wide.load55
  store <4 x i32> %39, ptr %37, align 16, !tbaa !5
  store <4 x i32> %40, ptr %38, align 16, !tbaa !5
  %index.next58 = add nuw i64 %index53, 8
  %41 = icmp eq i64 %index.next58, %n.vec50
  br i1 %41, label %middle.block45, label %vector.body52, !llvm.loop !14

middle.block45:                                   ; preds = %vector.body52
  %cmp.n59 = icmp eq i64 %n.vec50, %wide.trip.count36
  br i1 %cmp.n59, label %._crit_edge29, label %scalar.ph46.preheader

._crit_edge29:                                    ; preds = %scalar.ph46, %middle.block45, %30
  %42 = shl nuw i32 1, %0
  %43 = xor i32 %42, %1
  tail call void @_Z6searchii(i32 noundef %31, i32 noundef %43)
  %44 = load i32, ptr @V, align 4, !tbaa !5
  %45 = icmp sgt i32 %44, 0
  br i1 %45, label %.lr.ph32, label %.loopexit

.lr.ph32:                                         ; preds = %._crit_edge29
  %46 = sext i32 %0 to i64
  %wide.trip.count41 = zext nneg i32 %44 to i64
  %min.iters.check62 = icmp ult i32 %44, 8
  br i1 %min.iters.check62, label %scalar.ph61.preheader, label %vector.ph63

scalar.ph61.preheader:                            ; preds = %middle.block60, %.lr.ph32
  %indvars.iv38.ph = phi i64 [ 0, %.lr.ph32 ], [ %n.vec65, %middle.block60 ]
  br label %scalar.ph61

vector.ph63:                                      ; preds = %.lr.ph32
  %n.vec65 = and i64 %wide.trip.count41, 2147483640
  br label %vector.body67

vector.body67:                                    ; preds = %vector.body67, %vector.ph63
  %index68 = phi i64 [ 0, %vector.ph63 ], [ %index.next73, %vector.body67 ]
  %47 = getelementptr inbounds [15 x [25 x i32]], ptr @val, i64 0, i64 %46, i64 %index68
  %48 = getelementptr inbounds i8, ptr %47, i64 16
  %wide.load69 = load <4 x i32>, ptr %47, align 4, !tbaa !5
  %wide.load70 = load <4 x i32>, ptr %48, align 4, !tbaa !5
  %49 = getelementptr inbounds [25 x i32], ptr @req, i64 0, i64 %index68
  %50 = getelementptr inbounds i8, ptr %49, i64 16
  %wide.load71 = load <4 x i32>, ptr %49, align 16, !tbaa !5
  %wide.load72 = load <4 x i32>, ptr %50, align 16, !tbaa !5
  %51 = add nsw <4 x i32> %wide.load71, %wide.load69
  %52 = add nsw <4 x i32> %wide.load72, %wide.load70
  store <4 x i32> %51, ptr %49, align 16, !tbaa !5
  store <4 x i32> %52, ptr %50, align 16, !tbaa !5
  %index.next73 = add nuw i64 %index68, 8
  %53 = icmp eq i64 %index.next73, %n.vec65
  br i1 %53, label %middle.block60, label %vector.body67, !llvm.loop !15

middle.block60:                                   ; preds = %vector.body67
  %cmp.n74 = icmp eq i64 %n.vec65, %wide.trip.count41
  br i1 %cmp.n74, label %.loopexit, label %scalar.ph61.preheader

scalar.ph46:                                      ; preds = %scalar.ph46.preheader, %scalar.ph46
  %indvars.iv33 = phi i64 [ %indvars.iv.next34, %scalar.ph46 ], [ %indvars.iv33.ph, %scalar.ph46.preheader ]
  %54 = getelementptr inbounds [15 x [25 x i32]], ptr @val, i64 0, i64 %34, i64 %indvars.iv33
  %55 = load i32, ptr %54, align 4, !tbaa !5
  %56 = getelementptr inbounds [25 x i32], ptr @req, i64 0, i64 %indvars.iv33
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %58 = sub nsw i32 %57, %55
  store i32 %58, ptr %56, align 4, !tbaa !5
  %indvars.iv.next34 = add nuw nsw i64 %indvars.iv33, 1
  %exitcond37.not = icmp eq i64 %indvars.iv.next34, %wide.trip.count36
  br i1 %exitcond37.not, label %._crit_edge29, label %scalar.ph46, !llvm.loop !16

scalar.ph61:                                      ; preds = %scalar.ph61.preheader, %scalar.ph61
  %indvars.iv38 = phi i64 [ %indvars.iv.next39, %scalar.ph61 ], [ %indvars.iv38.ph, %scalar.ph61.preheader ]
  %59 = getelementptr inbounds [15 x [25 x i32]], ptr @val, i64 0, i64 %46, i64 %indvars.iv38
  %60 = load i32, ptr %59, align 4, !tbaa !5
  %61 = getelementptr inbounds [25 x i32], ptr @req, i64 0, i64 %indvars.iv38
  %62 = load i32, ptr %61, align 4, !tbaa !5
  %63 = add nsw i32 %62, %60
  store i32 %63, ptr %61, align 4, !tbaa !5
  %indvars.iv.next39 = add nuw nsw i64 %indvars.iv38, 1
  %exitcond42.not = icmp eq i64 %indvars.iv.next39, %wide.trip.count41
  br i1 %exitcond42.not, label %.loopexit, label %scalar.ph61, !llvm.loop !17

.loopexit.sink.split:                             ; preds = %.critedge, %24
  %.sink = phi i32 [ %26, %24 ], [ %1, %.critedge ]
  store i32 %.sink, ptr @bes, align 4, !tbaa !5
  br label %.loopexit

.loopexit:                                        ; preds = %scalar.ph61, %middle.block60, %.loopexit.sink.split, %._crit_edge29, %27, %22
  ret void
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.ctpop.i32(i32) #1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2

attributes #0 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { inlinehint mustprogress 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" }

!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++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}
!14 = distinct !{!14, !10, !11, !12}
!15 = distinct !{!15, !10, !11, !12}
!16 = distinct !{!16, !10, !12, !11}
!17 = distinct !{!17, !10, !12, !11}


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