; LLVM IR from VastoLorde95/Competitive-Programming :: CodeChef/LTIME/LTIME28/Problem A/brute.ll (Z2goiiix)

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

@a = external dso_local global [20 x i64], align 16
@res = external dso_local global i64, align 8
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@d = external dso_local global i32, align 4

; Function Attrs: mustprogress uwtable
define dso_local void @_Z2goiiix(i32 noundef %0, i32 noundef %1, i32 noundef %2, i64 noundef %3) #0 {
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  store i32 %0, ptr %5, align 4, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !5
  store i32 %2, ptr %7, align 4, !tbaa !5
  store i64 %3, ptr %8, align 8, !tbaa !9
  %9 = load i32, ptr %5, align 4, !tbaa !5
  %10 = load i32, ptr @n, align 4, !tbaa !5
  %11 = icmp eq i32 %9, %10
  br i1 %11, label %12, label %19

12:                                               ; preds = %4
  %13 = load i32, ptr %6, align 4, !tbaa !5
  %14 = icmp eq i32 %13, 0
  br i1 %14, label %15, label %18

15:                                               ; preds = %12
  %16 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) @res, ptr noundef nonnull align 8 dereferenceable(8) %8)
  %17 = load i64, ptr %16, align 8, !tbaa !9
  store i64 %17, ptr @res, align 8, !tbaa !9
  br label %18

18:                                               ; preds = %15, %12
  br label %95

19:                                               ; preds = %4
  %20 = load i32, ptr %6, align 4, !tbaa !5
  %21 = icmp eq i32 %20, 0
  br i1 %21, label %22, label %54

22:                                               ; preds = %19
  %23 = load i32, ptr %5, align 4, !tbaa !5
  %24 = load i32, ptr %7, align 4, !tbaa !5
  %25 = sub nsw i32 %23, %24
  %26 = load i32, ptr @d, align 4, !tbaa !5
  %27 = icmp sle i32 %25, %26
  br i1 %27, label %28, label %41

28:                                               ; preds = %22
  %29 = load i32, ptr %7, align 4, !tbaa !5
  %30 = icmp ne i32 %29, -1
  br i1 %30, label %31, label %41

31:                                               ; preds = %28
  %32 = load i32, ptr %5, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [20 x i64], ptr @a, i64 0, i64 %33
  %35 = load i64, ptr %34, align 8, !tbaa !9
  %36 = load i32, ptr @m, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = mul nsw i64 %35, %37
  %39 = load i64, ptr %8, align 8, !tbaa !9
  %40 = add nsw i64 %39, %38
  store i64 %40, ptr %8, align 8, !tbaa !9
  br label %48

41:                                               ; preds = %28, %22
  %42 = load i32, ptr %5, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [20 x i64], ptr @a, i64 0, i64 %43
  %45 = load i64, ptr %44, align 8, !tbaa !9
  %46 = load i64, ptr %8, align 8, !tbaa !9
  %47 = add nsw i64 %46, %45
  store i64 %47, ptr %8, align 8, !tbaa !9
  br label %48

48:                                               ; preds = %41, %31
  %49 = load i32, ptr %5, align 4, !tbaa !5
  %50 = add nsw i32 %49, 1
  %51 = load i32, ptr %6, align 4, !tbaa !5
  %52 = load i32, ptr %7, align 4, !tbaa !5
  %53 = load i64, ptr %8, align 8, !tbaa !9
  call void @_Z2goiiix(i32 noundef %50, i32 noundef %51, i32 noundef %52, i64 noundef %53)
  br label %95

54:                                               ; preds = %19
  %55 = load i32, ptr %5, align 4, !tbaa !5
  %56 = load i32, ptr %7, align 4, !tbaa !5
  %57 = sub nsw i32 %55, %56
  %58 = load i32, ptr @d, align 4, !tbaa !5
  %59 = icmp sle i32 %57, %58
  br i1 %59, label %60, label %77

60:                                               ; preds = %54
  %61 = load i32, ptr %7, align 4, !tbaa !5
  %62 = icmp ne i32 %61, -1
  br i1 %62, label %63, label %77

63:                                               ; preds = %60
  %64 = load i32, ptr %5, align 4, !tbaa !5
  %65 = add nsw i32 %64, 1
  %66 = load i32, ptr %6, align 4, !tbaa !5
  %67 = load i32, ptr %7, align 4, !tbaa !5
  %68 = load i64, ptr %8, align 8, !tbaa !9
  %69 = load i32, ptr %5, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [20 x i64], ptr @a, i64 0, i64 %70
  %72 = load i64, ptr %71, align 8, !tbaa !9
  %73 = load i32, ptr @m, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = mul nsw i64 %72, %74
  %76 = add nsw i64 %68, %75
  call void @_Z2goiiix(i32 noundef %65, i32 noundef %66, i32 noundef %67, i64 noundef %76)
  br label %88

77:                                               ; preds = %60, %54
  %78 = load i32, ptr %5, align 4, !tbaa !5
  %79 = add nsw i32 %78, 1
  %80 = load i32, ptr %6, align 4, !tbaa !5
  %81 = load i32, ptr %7, align 4, !tbaa !5
  %82 = load i64, ptr %8, align 8, !tbaa !9
  %83 = load i32, ptr %5, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [20 x i64], ptr @a, i64 0, i64 %84
  %86 = load i64, ptr %85, align 8, !tbaa !9
  %87 = add nsw i64 %82, %86
  call void @_Z2goiiix(i32 noundef %79, i32 noundef %80, i32 noundef %81, i64 noundef %87)
  br label %88

88:                                               ; preds = %77, %63
  %89 = load i32, ptr %5, align 4, !tbaa !5
  %90 = add nsw i32 %89, 1
  %91 = load i32, ptr %6, align 4, !tbaa !5
  %92 = sub nsw i32 %91, 1
  %93 = load i32, ptr %5, align 4, !tbaa !5
  %94 = load i64, ptr %8, align 8, !tbaa !9
  call void @_Z2goiiix(i32 noundef %90, i32 noundef %92, i32 noundef %93, i64 noundef %94)
  br label %95

95:                                               ; preds = %88, %48, %18
  ret void
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #1

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 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 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}


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

@a = external dso_local local_unnamed_addr global [20 x i64], align 16
@res = external dso_local global i64, align 8
@n = external dso_local local_unnamed_addr global i32, align 4
@m = external dso_local local_unnamed_addr global i32, align 4
@d = external dso_local local_unnamed_addr global i32, align 4

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_Z2goiiix(i32 noundef %0, i32 noundef %1, i32 noundef %2, i64 noundef %3) local_unnamed_addr #0 {
  %5 = alloca i64, align 8
  %6 = load i32, ptr @n, align 4, !tbaa !5
  %7 = icmp eq i32 %6, %0
  br i1 %7, label %tailrecurse._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %4, %tailrecurse.outer
  %indvar = phi i32 [ %indvar.next, %tailrecurse.outer ], [ 0, %4 ]
  %8 = phi i32 [ %122, %tailrecurse.outer ], [ %6, %4 ]
  %.tr31.ph54 = phi i32 [ %.tr.ph52, %tailrecurse.outer ], [ %2, %4 ]
  %.tr30.ph53 = phi i32 [ %121, %tailrecurse.outer ], [ %1, %4 ]
  %.tr.ph52 = phi i32 [ %.sink, %tailrecurse.outer ], [ %0, %4 ]
  %.not = icmp eq i32 %.tr31.ph54, -1
  %9 = load i32, ptr @m, align 4
  %10 = sext i32 %9 to i64
  %11 = icmp eq i32 %.tr30.ph53, 0
  br i1 %.not, label %.lr.ph.split.us.preheader, label %.lr.ph.split.preheader

.lr.ph.split.preheader:                           ; preds = %.lr.ph
  %12 = load i32, ptr @d, align 4
  %13 = sub nsw i32 %.tr.ph52, %.tr31.ph54
  %.not59.peel = icmp sgt i32 %13, %12
  br i1 %11, label %tailrecurse.peel, label %.split.us

tailrecurse.peel:                                 ; preds = %.lr.ph.split.preheader
  %14 = sext i32 %.tr.ph52 to i64
  %15 = getelementptr inbounds [20 x i64], ptr @a, i64 0, i64 %14
  %16 = load i64, ptr %15, align 8, !tbaa !9
  %17 = select i1 %.not59.peel, i64 1, i64 %10
  %.pn.peel = mul nsw i64 %16, %17
  %storemerge.peel = add nsw i64 %.pn.peel, %3
  %18 = add i32 %.tr.ph52, 1
  %19 = icmp eq i32 %8, %18
  br i1 %19, label %tailrecurse._crit_edge.thread, label %.lr.ph.split.peel.next.preheader

.lr.ph.split.peel.next.preheader:                 ; preds = %tailrecurse.peel
  %20 = xor i32 %0, -1
  %21 = sub i32 %20, %indvar
  %22 = add i32 %8, %21
  %min.iters.check = icmp ult i32 %22, 8
  br i1 %min.iters.check, label %.lr.ph.split.peel.next.preheader153, label %vector.scevcheck

.lr.ph.split.peel.next.preheader153:              ; preds = %middle.block, %vector.scevcheck, %.lr.ph.split.peel.next.preheader
  %.tr3239.ph = phi i64 [ %storemerge.peel, %vector.scevcheck ], [ %storemerge.peel, %.lr.ph.split.peel.next.preheader ], [ %50, %middle.block ]
  %.tr37.ph = phi i32 [ %18, %vector.scevcheck ], [ %18, %.lr.ph.split.peel.next.preheader ], [ %ind.end, %middle.block ]
  %23 = sub i32 %8, %.tr37.ph
  %.neg = add i32 %.tr37.ph, 1
  %xtraiter = and i32 %23, 1
  %lcmp.mod.not = icmp eq i32 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.lr.ph.split.peel.next.prol.loopexit, label %.lr.ph.split.peel.next.prol

.lr.ph.split.peel.next.prol:                      ; preds = %.lr.ph.split.peel.next.preheader153
  %24 = sub nsw i32 %.tr37.ph, %.tr31.ph54
  %.not59.prol = icmp sgt i32 %24, %12
  %25 = sext i32 %.tr37.ph to i64
  %26 = getelementptr inbounds [20 x i64], ptr @a, i64 0, i64 %25
  %27 = load i64, ptr %26, align 8, !tbaa !9
  %28 = select i1 %.not59.prol, i64 1, i64 %10
  %.pn.prol = mul nsw i64 %27, %28
  %storemerge.prol = add nsw i64 %.pn.prol, %.tr3239.ph
  %29 = add i32 %.tr37.ph, 1
  br label %.lr.ph.split.peel.next.prol.loopexit

.lr.ph.split.peel.next.prol.loopexit:             ; preds = %.lr.ph.split.peel.next.prol, %.lr.ph.split.peel.next.preheader153
  %storemerge.lcssa.unr = phi i64 [ poison, %.lr.ph.split.peel.next.preheader153 ], [ %storemerge.prol, %.lr.ph.split.peel.next.prol ]
  %.tr3239.unr = phi i64 [ %.tr3239.ph, %.lr.ph.split.peel.next.preheader153 ], [ %storemerge.prol, %.lr.ph.split.peel.next.prol ]
  %.tr37.unr = phi i32 [ %.tr37.ph, %.lr.ph.split.peel.next.preheader153 ], [ %29, %.lr.ph.split.peel.next.prol ]
  %30 = icmp eq i32 %8, %.neg
  br i1 %30, label %tailrecurse._crit_edge.thread, label %.lr.ph.split.peel.next

vector.scevcheck:                                 ; preds = %.lr.ph.split.peel.next.preheader
  %31 = add i32 %indvar, %0
  %reass.sub = sub i32 %8, %31
  %32 = add i32 %reass.sub, -2
  %33 = add i32 %18, %32
  %34 = icmp slt i32 %33, %18
  br i1 %34, label %.lr.ph.split.peel.next.preheader153, label %vector.ph

vector.ph:                                        ; preds = %vector.scevcheck
  %n.vec = and i32 %22, -4
  %ind.end = add i32 %18, %n.vec
  %35 = insertelement <2 x i64> <i64 poison, i64 0>, i64 %storemerge.peel, i64 0
  %.splatinsert = insertelement <2 x i32> poison, i32 %18, i64 0
  %.splat = shufflevector <2 x i32> %.splatinsert, <2 x i32> poison, <2 x i32> zeroinitializer
  %induction = add <2 x i32> %.splat, <i32 0, i32 1>
  %broadcast.splatinsert = insertelement <2 x i32> poison, i32 %.tr31.ph54, i64 0
  %broadcast.splat = shufflevector <2 x i32> %broadcast.splatinsert, <2 x i32> poison, <2 x i32> zeroinitializer
  %broadcast.splatinsert119 = insertelement <2 x i32> poison, i32 %12, i64 0
  %broadcast.splat120 = shufflevector <2 x i32> %broadcast.splatinsert119, <2 x i32> poison, <2 x i32> zeroinitializer
  %broadcast.splatinsert122 = insertelement <2 x i64> poison, i64 %10, i64 0
  %broadcast.splat123 = shufflevector <2 x i64> %broadcast.splatinsert122, <2 x i64> poison, <2 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.phi = phi <2 x i64> [ %35, %vector.ph ], [ %47, %vector.body ]
  %vec.phi117 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %48, %vector.body ]
  %vec.ind = phi <2 x i32> [ %induction, %vector.ph ], [ %vec.ind.next, %vector.body ]
  %step.add = add <2 x i32> %vec.ind, <i32 2, i32 2>
  %offset.idx = add i32 %18, %index
  %36 = sub nsw <2 x i32> %vec.ind, %broadcast.splat
  %37 = sub nsw <2 x i32> %step.add, %broadcast.splat
  %38 = icmp sgt <2 x i32> %36, %broadcast.splat120
  %39 = icmp sgt <2 x i32> %37, %broadcast.splat120
  %40 = sext i32 %offset.idx to i64
  %41 = getelementptr inbounds [20 x i64], ptr @a, i64 0, i64 %40
  %42 = getelementptr inbounds i8, ptr %41, i64 16
  %wide.load = load <2 x i64>, ptr %41, align 8, !tbaa !9
  %wide.load121 = load <2 x i64>, ptr %42, align 8, !tbaa !9
  %43 = select <2 x i1> %38, <2 x i64> <i64 1, i64 1>, <2 x i64> %broadcast.splat123
  %44 = select <2 x i1> %39, <2 x i64> <i64 1, i64 1>, <2 x i64> %broadcast.splat123
  %45 = mul nsw <2 x i64> %wide.load, %43
  %46 = mul nsw <2 x i64> %wide.load121, %44
  %47 = add <2 x i64> %45, %vec.phi
  %48 = add <2 x i64> %46, %vec.phi117
  %index.next = add nuw i32 %index, 4
  %vec.ind.next = add <2 x i32> %vec.ind, <i32 4, i32 4>
  %49 = icmp eq i32 %index.next, %n.vec
  br i1 %49, label %middle.block, label %vector.body, !llvm.loop !11

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <2 x i64> %48, %47
  %50 = tail call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
  %cmp.n = icmp eq i32 %22, %n.vec
  br i1 %cmp.n, label %tailrecurse._crit_edge.thread, label %.lr.ph.split.peel.next.preheader153

.lr.ph.split.us.preheader:                        ; preds = %.lr.ph
  br i1 %11, label %tailrecurse.us.peel, label %.split.us.thread

tailrecurse.us.peel:                              ; preds = %.lr.ph.split.us.preheader
  %51 = sext i32 %.tr.ph52 to i64
  %52 = getelementptr inbounds [20 x i64], ptr @a, i64 0, i64 %51
  %53 = load i64, ptr %52, align 8, !tbaa !9
  %storemerge.us.peel = add nsw i64 %53, %3
  %54 = add i32 %.tr.ph52, 1
  %55 = icmp eq i32 %8, %54
  br i1 %55, label %tailrecurse._crit_edge.thread, label %tailrecurse.us.preheader

tailrecurse.us.preheader:                         ; preds = %tailrecurse.us.peel
  %56 = xor i32 %0, -1
  %57 = sub i32 %56, %indvar
  %58 = add i32 %8, %57
  %min.iters.check133 = icmp ult i32 %58, 14
  br i1 %min.iters.check133, label %tailrecurse.us.preheader151, label %vector.scevcheck124

vector.scevcheck124:                              ; preds = %tailrecurse.us.preheader
  %59 = add i32 %indvar, %0
  %reass.sub150 = sub i32 %8, %59
  %60 = add i32 %reass.sub150, -2
  %61 = add i32 %54, %60
  %62 = icmp slt i32 %61, %54
  br i1 %62, label %tailrecurse.us.preheader151, label %vector.ph134

vector.ph134:                                     ; preds = %vector.scevcheck124
  %n.vec136 = and i32 %58, -4
  %ind.end137 = add i32 %54, %n.vec136
  %63 = insertelement <2 x i64> <i64 poison, i64 0>, i64 %storemerge.us.peel, i64 0
  br label %vector.body139

vector.body139:                                   ; preds = %vector.body139, %vector.ph134
  %index140 = phi i32 [ 0, %vector.ph134 ], [ %index.next146, %vector.body139 ]
  %vec.phi141 = phi <2 x i64> [ %63, %vector.ph134 ], [ %67, %vector.body139 ]
  %vec.phi142 = phi <2 x i64> [ zeroinitializer, %vector.ph134 ], [ %68, %vector.body139 ]
  %offset.idx143 = add i32 %54, %index140
  %64 = sext i32 %offset.idx143 to i64
  %65 = getelementptr inbounds [20 x i64], ptr @a, i64 0, i64 %64
  %66 = getelementptr inbounds i8, ptr %65, i64 16
  %wide.load144 = load <2 x i64>, ptr %65, align 8, !tbaa !9
  %wide.load145 = load <2 x i64>, ptr %66, align 8, !tbaa !9
  %67 = add <2 x i64> %wide.load144, %vec.phi141
  %68 = add <2 x i64> %wide.load145, %vec.phi142
  %index.next146 = add nuw i32 %index140, 4
  %69 = icmp eq i32 %index.next146, %n.vec136
  br i1 %69, label %middle.block131, label %vector.body139, !llvm.loop !15

middle.block131:                                  ; preds = %vector.body139
  %bin.rdx147 = add <2 x i64> %68, %67
  %70 = tail call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx147)
  %cmp.n148 = icmp eq i32 %58, %n.vec136
  br i1 %cmp.n148, label %tailrecurse._crit_edge.thread, label %tailrecurse.us.preheader151

tailrecurse.us.preheader151:                      ; preds = %middle.block131, %vector.scevcheck124, %tailrecurse.us.preheader
  %.tr3239.us.ph = phi i64 [ %storemerge.us.peel, %vector.scevcheck124 ], [ %storemerge.us.peel, %tailrecurse.us.preheader ], [ %70, %middle.block131 ]
  %.tr37.us.ph = phi i32 [ %54, %vector.scevcheck124 ], [ %54, %tailrecurse.us.preheader ], [ %ind.end137, %middle.block131 ]
  %71 = sub i32 %8, %.tr37.us.ph
  %xtraiter173 = and i32 %71, 3
  %lcmp.mod174.not = icmp eq i32 %xtraiter173, 0
  br i1 %lcmp.mod174.not, label %tailrecurse.us.prol.loopexit, label %tailrecurse.us.prol

tailrecurse.us.prol:                              ; preds = %tailrecurse.us.preheader151, %tailrecurse.us.prol
  %.tr3239.us.prol = phi i64 [ %storemerge.us.prol, %tailrecurse.us.prol ], [ %.tr3239.us.ph, %tailrecurse.us.preheader151 ]
  %.tr37.us.prol = phi i32 [ %75, %tailrecurse.us.prol ], [ %.tr37.us.ph, %tailrecurse.us.preheader151 ]
  %prol.iter = phi i32 [ %prol.iter.next, %tailrecurse.us.prol ], [ 0, %tailrecurse.us.preheader151 ]
  %72 = sext i32 %.tr37.us.prol to i64
  %73 = getelementptr inbounds [20 x i64], ptr @a, i64 0, i64 %72
  %74 = load i64, ptr %73, align 8, !tbaa !9
  %storemerge.us.prol = add nsw i64 %74, %.tr3239.us.prol
  %75 = add i32 %.tr37.us.prol, 1
  %prol.iter.next = add i32 %prol.iter, 1
  %prol.iter.cmp.not = icmp eq i32 %prol.iter.next, %xtraiter173
  br i1 %prol.iter.cmp.not, label %tailrecurse.us.prol.loopexit, label %tailrecurse.us.prol, !llvm.loop !16

tailrecurse.us.prol.loopexit:                     ; preds = %tailrecurse.us.prol, %tailrecurse.us.preheader151
  %storemerge.us.lcssa.unr = phi i64 [ poison, %tailrecurse.us.preheader151 ], [ %storemerge.us.prol, %tailrecurse.us.prol ]
  %.tr3239.us.unr = phi i64 [ %.tr3239.us.ph, %tailrecurse.us.preheader151 ], [ %storemerge.us.prol, %tailrecurse.us.prol ]
  %.tr37.us.unr = phi i32 [ %.tr37.us.ph, %tailrecurse.us.preheader151 ], [ %75, %tailrecurse.us.prol ]
  %76 = sub i32 %.tr37.us.ph, %8
  %77 = icmp ugt i32 %76, -4
  br i1 %77, label %tailrecurse._crit_edge.thread, label %tailrecurse.us

tailrecurse.us:                                   ; preds = %tailrecurse.us.prol.loopexit, %tailrecurse.us
  %.tr3239.us = phi i64 [ %storemerge.us.3, %tailrecurse.us ], [ %.tr3239.us.unr, %tailrecurse.us.prol.loopexit ]
  %.tr37.us = phi i32 [ %93, %tailrecurse.us ], [ %.tr37.us.unr, %tailrecurse.us.prol.loopexit ]
  %78 = sext i32 %.tr37.us to i64
  %79 = getelementptr inbounds [20 x i64], ptr @a, i64 0, i64 %78
  %80 = load i64, ptr %79, align 8, !tbaa !9
  %storemerge.us = add nsw i64 %80, %.tr3239.us
  %81 = add i32 %.tr37.us, 1
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [20 x i64], ptr @a, i64 0, i64 %82
  %84 = load i64, ptr %83, align 8, !tbaa !9
  %storemerge.us.1 = add nsw i64 %84, %storemerge.us
  %85 = add i32 %.tr37.us, 2
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [20 x i64], ptr @a, i64 0, i64 %86
  %88 = load i64, ptr %87, align 8, !tbaa !9
  %storemerge.us.2 = add nsw i64 %88, %storemerge.us.1
  %89 = add i32 %.tr37.us, 3
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [20 x i64], ptr @a, i64 0, i64 %90
  %92 = load i64, ptr %91, align 8, !tbaa !9
  %storemerge.us.3 = add nsw i64 %92, %storemerge.us.2
  %93 = add i32 %.tr37.us, 4
  %94 = icmp eq i32 %8, %93
  br i1 %94, label %tailrecurse._crit_edge.thread, label %tailrecurse.us, !llvm.loop !18

tailrecurse._crit_edge.thread:                    ; preds = %.lr.ph.split.peel.next.prol.loopexit, %.lr.ph.split.peel.next, %tailrecurse.us.prol.loopexit, %tailrecurse.us, %middle.block, %middle.block131, %tailrecurse.peel, %tailrecurse.us.peel
  %.tr32.lcssa.ph = phi i64 [ %storemerge.us.peel, %tailrecurse.us.peel ], [ %storemerge.peel, %tailrecurse.peel ], [ %70, %middle.block131 ], [ %50, %middle.block ], [ %storemerge.us.lcssa.unr, %tailrecurse.us.prol.loopexit ], [ %storemerge.us.3, %tailrecurse.us ], [ %storemerge.lcssa.unr, %.lr.ph.split.peel.next.prol.loopexit ], [ %storemerge.1, %.lr.ph.split.peel.next ]
  store i64 %.tr32.lcssa.ph, ptr %5, align 8, !tbaa !9
  br label %96

tailrecurse._crit_edge:                           ; preds = %tailrecurse.outer, %4
  %split40 = phi i32 [ %1, %4 ], [ %121, %tailrecurse.outer ]
  %95 = icmp eq i32 %split40, 0
  store i64 %3, ptr %5, align 8, !tbaa !9
  br i1 %95, label %96, label %124

96:                                               ; preds = %tailrecurse._crit_edge.thread, %tailrecurse._crit_edge
  %97 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) @res, ptr noundef nonnull align 8 dereferenceable(8) %5)
  %98 = load i64, ptr %97, align 8, !tbaa !9
  store i64 %98, ptr @res, align 8, !tbaa !9
  br label %124

.lr.ph.split.peel.next:                           ; preds = %.lr.ph.split.peel.next.prol.loopexit, %.lr.ph.split.peel.next
  %.tr3239 = phi i64 [ %storemerge.1, %.lr.ph.split.peel.next ], [ %.tr3239.unr, %.lr.ph.split.peel.next.prol.loopexit ]
  %.tr37 = phi i32 [ %110, %.lr.ph.split.peel.next ], [ %.tr37.unr, %.lr.ph.split.peel.next.prol.loopexit ]
  %99 = sub nsw i32 %.tr37, %.tr31.ph54
  %.not59 = icmp sgt i32 %99, %12
  %100 = sext i32 %.tr37 to i64
  %101 = getelementptr inbounds [20 x i64], ptr @a, i64 0, i64 %100
  %102 = load i64, ptr %101, align 8, !tbaa !9
  %103 = select i1 %.not59, i64 1, i64 %10
  %.pn = mul nsw i64 %102, %103
  %storemerge = add nsw i64 %.pn, %.tr3239
  %104 = add i32 %.tr37, 1
  %105 = sub nsw i32 %104, %.tr31.ph54
  %.not59.1 = icmp sgt i32 %105, %12
  %106 = sext i32 %104 to i64
  %107 = getelementptr inbounds [20 x i64], ptr @a, i64 0, i64 %106
  %108 = load i64, ptr %107, align 8, !tbaa !9
  %109 = select i1 %.not59.1, i64 1, i64 %10
  %.pn.1 = mul nsw i64 %108, %109
  %storemerge.1 = add nsw i64 %.pn.1, %storemerge
  %110 = add i32 %.tr37, 2
  %111 = icmp eq i32 %8, %110
  br i1 %111, label %tailrecurse._crit_edge.thread, label %.lr.ph.split.peel.next, !llvm.loop !19

.split.us:                                        ; preds = %.lr.ph.split.preheader
  br i1 %.not59.peel, label %.split.us.thread, label %112

112:                                              ; preds = %.split.us
  %113 = sext i32 %.tr.ph52 to i64
  %114 = getelementptr inbounds [20 x i64], ptr @a, i64 0, i64 %113
  %115 = load i64, ptr %114, align 8, !tbaa !9
  %116 = mul nsw i64 %115, %10
  br label %tailrecurse.outer

.split.us.thread:                                 ; preds = %.lr.ph.split.us.preheader, %.split.us
  %117 = sext i32 %.tr.ph52 to i64
  %118 = getelementptr inbounds [20 x i64], ptr @a, i64 0, i64 %117
  %119 = load i64, ptr %118, align 8, !tbaa !9
  br label %tailrecurse.outer

tailrecurse.outer:                                ; preds = %.split.us.thread, %112
  %.sink96 = phi i64 [ %119, %.split.us.thread ], [ %116, %112 ]
  %.sink = add i32 %.tr.ph52, 1
  %120 = add nsw i64 %.sink96, %3
  tail call void @_Z2goiiix(i32 noundef %.sink, i32 noundef %.tr30.ph53, i32 noundef %.tr31.ph54, i64 noundef %120)
  %121 = add nsw i32 %.tr30.ph53, -1
  %122 = load i32, ptr @n, align 4, !tbaa !5
  %123 = icmp eq i32 %122, %.sink
  %indvar.next = add i32 %indvar, 1
  br i1 %123, label %tailrecurse._crit_edge, label %.lr.ph

124:                                              ; preds = %tailrecurse._crit_edge, %96
  ret void
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #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 = { 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 #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, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12, !13, !14}
!12 = !{!"llvm.loop.peeled.count", i32 1}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !12, !13, !14}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.unroll.disable"}
!18 = distinct !{!18, !12, !13}
!19 = distinct !{!19, !12, !13}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopFullUnrollPass,LoopInstSimplifyPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass