; LLVM IR from VastoLorde95/Competitive-Programming :: Hackerrank/Company Contests/Zalando Codesprint 2016/Problem E/E.ll (Z5solvei)

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

@g = external dso_local global [20 x [20 x i32]], align 16
@h = external dso_local global [20 x i32], align 16
@ans = external dso_local global i32, align 4
@cnt = external dso_local global [20 x i32], align 16
@w = external dso_local global i32, align 4
@p = external dso_local global i32, align 4

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvei(i32 noundef %0) #0 {
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  store i32 %0, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  store i32 0, ptr %3, align 4, !tbaa !5
  call void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef @cnt, ptr noundef getelementptr inbounds (i32, ptr @cnt, i64 20), ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  store i32 0, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %10

10:                                               ; preds = %47, %1
  %11 = load i32, ptr %5, align 4, !tbaa !5
  %12 = load i32, ptr @w, align 4, !tbaa !5
  %13 = icmp slt i32 %11, %12
  br i1 %13, label %15, label %14

14:                                               ; preds = %10
  store i32 2, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  br label %50

15:                                               ; preds = %10
  %16 = load i32, ptr %2, align 4, !tbaa !5
  %17 = load i32, ptr %5, align 4, !tbaa !5
  %18 = shl i32 1, %17
  %19 = and i32 %16, %18
  %20 = icmp ne i32 %19, 0
  br i1 %20, label %21, label %46

21:                                               ; preds = %15
  %22 = load i32, ptr %4, align 4, !tbaa !5
  %23 = add nsw i32 %22, 1
  store i32 %23, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %24

24:                                               ; preds = %42, %21
  %25 = load i32, ptr %7, align 4, !tbaa !5
  %26 = load i32, ptr @p, align 4, !tbaa !5
  %27 = icmp slt i32 %25, %26
  br i1 %27, label %29, label %28

28:                                               ; preds = %24
  store i32 5, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %45

29:                                               ; preds = %24
  %30 = load i32, ptr %5, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [20 x [20 x i32]], ptr @g, i64 0, i64 %31
  %33 = load i32, ptr %7, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [20 x i32], ptr %32, i64 0, i64 %34
  %36 = load i32, ptr %35, align 4, !tbaa !5
  %37 = load i32, ptr %7, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [20 x i32], ptr @cnt, i64 0, i64 %38
  %40 = load i32, ptr %39, align 4, !tbaa !5
  %41 = add nsw i32 %40, %36
  store i32 %41, ptr %39, align 4, !tbaa !5
  br label %42

42:                                               ; preds = %29
  %43 = load i32, ptr %7, align 4, !tbaa !5
  %44 = add nsw i32 %43, 1
  store i32 %44, ptr %7, align 4, !tbaa !5
  br label %24, !llvm.loop !9

45:                                               ; preds = %28
  br label %46

46:                                               ; preds = %45, %15
  br label %47

47:                                               ; preds = %46
  %48 = load i32, ptr %5, align 4, !tbaa !5
  %49 = add nsw i32 %48, 1
  store i32 %49, ptr %5, align 4, !tbaa !5
  br label %10, !llvm.loop !11

50:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %51

51:                                               ; preds = %66, %50
  %52 = load i32, ptr %8, align 4, !tbaa !5
  %53 = load i32, ptr @p, align 4, !tbaa !5
  %54 = icmp slt i32 %52, %53
  br i1 %54, label %56, label %55

55:                                               ; preds = %51
  store i32 8, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %69

56:                                               ; preds = %51
  %57 = load i32, ptr %8, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [20 x i32], ptr @h, i64 0, i64 %58
  %60 = load i32, ptr %59, align 4, !tbaa !5
  %61 = load i32, ptr %8, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [20 x i32], ptr @cnt, i64 0, i64 %62
  %64 = load i32, ptr %63, align 4, !tbaa !5
  %65 = sub nsw i32 %64, %60
  store i32 %65, ptr %63, align 4, !tbaa !5
  br label %66

66:                                               ; preds = %56
  %67 = load i32, ptr %8, align 4, !tbaa !5
  %68 = add nsw i32 %67, 1
  store i32 %68, ptr %8, align 4, !tbaa !5
  br label %51, !llvm.loop !12

69:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %70

70:                                               ; preds = %83, %69
  %71 = load i32, ptr %9, align 4, !tbaa !5
  %72 = load i32, ptr @p, align 4, !tbaa !5
  %73 = icmp slt i32 %71, %72
  br i1 %73, label %75, label %74

74:                                               ; preds = %70
  store i32 11, ptr %6, align 4
  br label %86

75:                                               ; preds = %70
  %76 = load i32, ptr %9, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [20 x i32], ptr @cnt, i64 0, i64 %77
  %79 = load i32, ptr %78, align 4, !tbaa !5
  %80 = icmp slt i32 %79, 0
  br i1 %80, label %81, label %82

81:                                               ; preds = %75
  store i32 1, ptr %6, align 4
  br label %86

82:                                               ; preds = %75
  br label %83

83:                                               ; preds = %82
  %84 = load i32, ptr %9, align 4, !tbaa !5
  %85 = add nsw i32 %84, 1
  store i32 %85, ptr %9, align 4, !tbaa !5
  br label %70, !llvm.loop !13

86:                                               ; preds = %81, %74
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  %87 = load i32, ptr %6, align 4
  switch i32 %87, label %91 [
    i32 11, label %88
  ]

88:                                               ; preds = %86
  %89 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @ans, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %90 = load i32, ptr %89, align 4, !tbaa !5
  store i32 %90, ptr @ans, align 4, !tbaa !5
  store i32 0, ptr %6, align 4
  br label %91

91:                                               ; preds = %88, %86
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  %92 = load i32, ptr %6, align 4
  switch i32 %92, label %94 [
    i32 0, label %93
    i32 1, label %93
  ]

93:                                               ; preds = %91, %91
  ret void

94:                                               ; preds = %91
  unreachable
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4)) #1

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { inlinehint 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}


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

@g = external dso_local local_unnamed_addr global [20 x [20 x i32]], align 16
@h = external dso_local local_unnamed_addr global [20 x i32], align 16
@ans = external dso_local global i32, align 4
@cnt = external dso_local global [20 x i32], align 16
@w = external dso_local local_unnamed_addr global i32, align 4
@p = external dso_local local_unnamed_addr global i32, align 4

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvei(i32 noundef %0) local_unnamed_addr #0 {
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  store i32 0, ptr %2, align 4, !tbaa !5
  call void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef nonnull @cnt, ptr noundef nonnull getelementptr inbounds (i8, ptr @cnt, i64 80), ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  %4 = load i32, ptr @w, align 4, !tbaa !5
  %5 = icmp sgt i32 %4, 0
  %.pre = load i32, ptr @p, align 4
  %.fr34 = freeze i32 %.pre
  br i1 %5, label %.lr.ph28, label %.preheader22

.lr.ph28:                                         ; preds = %1
  %6 = icmp sgt i32 %.fr34, 0
  br i1 %6, label %.lr.ph28.split.us.preheader, label %.lr.ph28.split.preheader

.lr.ph28.split.preheader:                         ; preds = %.lr.ph28
  %min.iters.check = icmp ult i32 %4, 8
  br i1 %min.iters.check, label %.lr.ph28.split.preheader88, label %vector.ph

.lr.ph28.split.preheader88:                       ; preds = %middle.block, %.lr.ph28.split.preheader
  %.02026.ph = phi i32 [ 0, %.lr.ph28.split.preheader ], [ %n.vec, %middle.block ]
  %.ph = phi i32 [ 0, %.lr.ph28.split.preheader ], [ %14, %middle.block ]
  br label %.lr.ph28.split

vector.ph:                                        ; preds = %.lr.ph28.split.preheader
  %n.vec = and i32 %4, 2147483640
  %broadcast.splatinsert = insertelement <4 x i32> poison, i32 %0, 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 i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.ind = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
  %vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %11, %vector.body ]
  %vec.phi56 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %12, %vector.body ]
  %step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
  %7 = lshr <4 x i32> %broadcast.splat, %vec.ind
  %8 = lshr <4 x i32> %broadcast.splat, %step.add
  %9 = and <4 x i32> %7, <i32 1, i32 1, i32 1, i32 1>
  %10 = and <4 x i32> %8, <i32 1, i32 1, i32 1, i32 1>
  %11 = add <4 x i32> %vec.phi, %9
  %12 = add <4 x i32> %vec.phi56, %10
  %index.next = add nuw i32 %index, 8
  %vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
  %13 = icmp eq i32 %index.next, %n.vec
  br i1 %13, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <4 x i32> %12, %11
  %14 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
  %cmp.n = icmp eq i32 %4, %n.vec
  br i1 %cmp.n, label %.preheader22, label %.lr.ph28.split.preheader88

.lr.ph28.split.us.preheader:                      ; preds = %.lr.ph28
  %wide.trip.count41 = zext nneg i32 %4 to i64
  %wide.trip.count = zext nneg i32 %.fr34 to i64
  %min.iters.check59 = icmp ult i32 %.fr34, 8
  %n.vec62 = and i64 %wide.trip.count, 2147483640
  %cmp.n70 = icmp eq i64 %n.vec62, %wide.trip.count
  br label %.lr.ph28.split.us

.lr.ph28.split.us:                                ; preds = %.lr.ph28.split.us.preheader, %..loopexit23_crit_edge.us
  %indvars.iv38 = phi i64 [ 0, %.lr.ph28.split.us.preheader ], [ %indvars.iv.next39, %..loopexit23_crit_edge.us ]
  %15 = phi i32 [ 0, %.lr.ph28.split.us.preheader ], [ %32, %..loopexit23_crit_edge.us ]
  %16 = trunc nuw nsw i64 %indvars.iv38 to i32
  %17 = shl nuw i32 1, %16
  %18 = and i32 %17, %0
  %.not21.us = icmp eq i32 %18, 0
  br i1 %.not21.us, label %..loopexit23_crit_edge.us, label %.lr.ph.us.preheader

.lr.ph.us.preheader:                              ; preds = %.lr.ph28.split.us
  br i1 %min.iters.check59, label %.lr.ph.us.preheader87, label %vector.body64

vector.body64:                                    ; preds = %.lr.ph.us.preheader, %vector.body64
  %index65 = phi i64 [ %index.next69, %vector.body64 ], [ 0, %.lr.ph.us.preheader ]
  %19 = getelementptr inbounds [20 x [20 x i32]], ptr @g, i64 0, i64 %indvars.iv38, i64 %index65
  %20 = getelementptr inbounds i8, ptr %19, i64 16
  %wide.load = load <4 x i32>, ptr %19, align 16, !tbaa !5
  %wide.load66 = load <4 x i32>, ptr %20, align 16, !tbaa !5
  %21 = getelementptr inbounds [20 x i32], ptr @cnt, i64 0, i64 %index65
  %22 = getelementptr inbounds i8, ptr %21, i64 16
  %wide.load67 = load <4 x i32>, ptr %21, align 16, !tbaa !5
  %wide.load68 = load <4 x i32>, ptr %22, align 16, !tbaa !5
  %23 = add nsw <4 x i32> %wide.load67, %wide.load
  %24 = add nsw <4 x i32> %wide.load68, %wide.load66
  store <4 x i32> %23, ptr %21, align 16, !tbaa !5
  store <4 x i32> %24, ptr %22, align 16, !tbaa !5
  %index.next69 = add nuw i64 %index65, 8
  %25 = icmp eq i64 %index.next69, %n.vec62
  br i1 %25, label %middle.block57, label %vector.body64, !llvm.loop !13

middle.block57:                                   ; preds = %vector.body64
  br i1 %cmp.n70, label %..loopexit23_crit_edge.us.loopexit, label %.lr.ph.us.preheader87

.lr.ph.us.preheader87:                            ; preds = %middle.block57, %.lr.ph.us.preheader
  %indvars.iv.ph = phi i64 [ 0, %.lr.ph.us.preheader ], [ %n.vec62, %middle.block57 ]
  br label %.lr.ph.us

.lr.ph.us:                                        ; preds = %.lr.ph.us.preheader87, %.lr.ph.us
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph.us ], [ %indvars.iv.ph, %.lr.ph.us.preheader87 ]
  %26 = getelementptr inbounds [20 x [20 x i32]], ptr @g, i64 0, i64 %indvars.iv38, i64 %indvars.iv
  %27 = load i32, ptr %26, align 4, !tbaa !5
  %28 = getelementptr inbounds [20 x i32], ptr @cnt, i64 0, i64 %indvars.iv
  %29 = load i32, ptr %28, align 4, !tbaa !5
  %30 = add nsw i32 %29, %27
  store i32 %30, ptr %28, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond37.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond37.not, label %..loopexit23_crit_edge.us.loopexit, label %.lr.ph.us, !llvm.loop !14

..loopexit23_crit_edge.us.loopexit:               ; preds = %.lr.ph.us, %middle.block57
  %31 = add nsw i32 %15, 1
  br label %..loopexit23_crit_edge.us

..loopexit23_crit_edge.us:                        ; preds = %..loopexit23_crit_edge.us.loopexit, %.lr.ph28.split.us
  %32 = phi i32 [ %15, %.lr.ph28.split.us ], [ %31, %..loopexit23_crit_edge.us.loopexit ]
  %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 %.preheader22, label %.lr.ph28.split.us, !llvm.loop !15

.preheader22:                                     ; preds = %.lr.ph28.split, %..loopexit23_crit_edge.us, %middle.block, %1
  %.lcssa25 = phi i32 [ 0, %1 ], [ %14, %middle.block ], [ %32, %..loopexit23_crit_edge.us ], [ %spec.select, %.lr.ph28.split ]
  store i32 %.lcssa25, ptr %3, align 4, !tbaa !5
  %33 = icmp sgt i32 %.fr34, 0
  br i1 %33, label %.lr.ph.preheader, label %.critedge

.lr.ph.preheader:                                 ; preds = %.preheader22
  %wide.trip.count46 = zext nneg i32 %.fr34 to i64
  %min.iters.check73 = icmp ult i32 %.fr34, 8
  br i1 %min.iters.check73, label %.lr.ph.preheader86, label %vector.ph74

.lr.ph.preheader86:                               ; preds = %middle.block71, %.lr.ph.preheader
  %indvars.iv43.ph = phi i64 [ 0, %.lr.ph.preheader ], [ %n.vec76, %middle.block71 ]
  br label %.lr.ph

vector.ph74:                                      ; preds = %.lr.ph.preheader
  %n.vec76 = and i64 %wide.trip.count46, 2147483640
  br label %vector.body78

vector.body78:                                    ; preds = %vector.body78, %vector.ph74
  %index79 = phi i64 [ 0, %vector.ph74 ], [ %index.next84, %vector.body78 ]
  %34 = getelementptr inbounds [20 x i32], ptr @h, i64 0, i64 %index79
  %35 = getelementptr inbounds i8, ptr %34, i64 16
  %wide.load80 = load <4 x i32>, ptr %34, align 16, !tbaa !5
  %wide.load81 = load <4 x i32>, ptr %35, align 16, !tbaa !5
  %36 = getelementptr inbounds [20 x i32], ptr @cnt, i64 0, i64 %index79
  %37 = getelementptr inbounds i8, ptr %36, i64 16
  %wide.load82 = load <4 x i32>, ptr %36, align 16, !tbaa !5
  %wide.load83 = load <4 x i32>, ptr %37, align 16, !tbaa !5
  %38 = sub nsw <4 x i32> %wide.load82, %wide.load80
  %39 = sub nsw <4 x i32> %wide.load83, %wide.load81
  store <4 x i32> %38, ptr %36, align 16, !tbaa !5
  store <4 x i32> %39, ptr %37, align 16, !tbaa !5
  %index.next84 = add nuw i64 %index79, 8
  %40 = icmp eq i64 %index.next84, %n.vec76
  br i1 %40, label %middle.block71, label %vector.body78, !llvm.loop !16

middle.block71:                                   ; preds = %vector.body78
  %cmp.n85 = icmp eq i64 %n.vec76, %wide.trip.count46
  br i1 %cmp.n85, label %.preheader, label %.lr.ph.preheader86

.lr.ph28.split:                                   ; preds = %.lr.ph28.split.preheader88, %.lr.ph28.split
  %.02026 = phi i32 [ %44, %.lr.ph28.split ], [ %.02026.ph, %.lr.ph28.split.preheader88 ]
  %41 = phi i32 [ %spec.select, %.lr.ph28.split ], [ %.ph, %.lr.ph28.split.preheader88 ]
  %42 = lshr i32 %0, %.02026
  %43 = and i32 %42, 1
  %spec.select = add nuw nsw i32 %41, %43
  %44 = add nuw nsw i32 %.02026, 1
  %exitcond.not = icmp eq i32 %44, %4
  br i1 %exitcond.not, label %.preheader22, label %.lr.ph28.split, !llvm.loop !17

.preheader:                                       ; preds = %.lr.ph, %middle.block71
  br i1 %33, label %.lr.ph33.preheader, label %.critedge

.lr.ph33.preheader:                               ; preds = %.preheader
  %wide.trip.count51 = zext nneg i32 %.fr34 to i64
  br label %.lr.ph33

.lr.ph:                                           ; preds = %.lr.ph.preheader86, %.lr.ph
  %indvars.iv43 = phi i64 [ %indvars.iv.next44, %.lr.ph ], [ %indvars.iv43.ph, %.lr.ph.preheader86 ]
  %45 = getelementptr inbounds [20 x i32], ptr @h, i64 0, i64 %indvars.iv43
  %46 = load i32, ptr %45, align 4, !tbaa !5
  %47 = getelementptr inbounds [20 x i32], ptr @cnt, i64 0, i64 %indvars.iv43
  %48 = load i32, ptr %47, align 4, !tbaa !5
  %49 = sub nsw i32 %48, %46
  store i32 %49, ptr %47, align 4, !tbaa !5
  %indvars.iv.next44 = add nuw nsw i64 %indvars.iv43, 1
  %exitcond47.not = icmp eq i64 %indvars.iv.next44, %wide.trip.count46
  br i1 %exitcond47.not, label %.preheader, label %.lr.ph, !llvm.loop !18

50:                                               ; preds = %.lr.ph33
  %indvars.iv.next49 = add nuw nsw i64 %indvars.iv48, 1
  %exitcond52.not = icmp eq i64 %indvars.iv.next49, %wide.trip.count51
  br i1 %exitcond52.not, label %.critedge, label %.lr.ph33, !llvm.loop !19

.lr.ph33:                                         ; preds = %.lr.ph33.preheader, %50
  %indvars.iv48 = phi i64 [ 0, %.lr.ph33.preheader ], [ %indvars.iv.next49, %50 ]
  %51 = getelementptr inbounds [20 x i32], ptr @cnt, i64 0, i64 %indvars.iv48
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %53 = icmp slt i32 %52, 0
  br i1 %53, label %.loopexit, label %50

.critedge:                                        ; preds = %50, %.preheader22, %.preheader
  %54 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @ans, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %55 = load i32, ptr %54, align 4, !tbaa !5
  store i32 %55, ptr @ans, align 4, !tbaa !5
  br label %.loopexit

.loopexit:                                        ; preds = %.lr.ph33, %.critedge
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  ret void
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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)) local_unnamed_addr #3

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

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 = { inlinehint 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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 = 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, !11, !12}
!14 = distinct !{!14, !10, !12, !11}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10, !11, !12}
!17 = distinct !{!17, !10, !12, !11}
!18 = distinct !{!18, !10, !12, !11}
!19 = distinct !{!19, !10}


; Effective O3 passes: DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,SROAPass,SimplifyCFGPass