; LLVM IR from VastoLorde95/Competitive-Programming :: Codejam/2015/Prelim/Problem B (B)

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

%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #8
  %13 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #8
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %14

14:                                               ; preds = %78, %0
  %15 = load i32, ptr %3, align 4, !tbaa !5
  %16 = load i32, ptr %2, align 4, !tbaa !5
  %17 = icmp sle i32 %15, %16
  br i1 %17, label %19, label %18

18:                                               ; preds = %14
  store i32 2, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #8
  br label %81

19:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #8
  %20 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %21 = load i32, ptr %5, align 4, !tbaa !5
  %22 = zext i32 %21 to i64
  %23 = call ptr @llvm.stacksave.p0()
  store ptr %23, ptr %6, align 8
  %24 = alloca i32, i64 %22, align 16
  store i64 %22, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #8
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %25

25:                                               ; preds = %35, %19
  %26 = load i32, ptr %8, align 4, !tbaa !5
  %27 = load i32, ptr %5, align 4, !tbaa !5
  %28 = icmp slt i32 %26, %27
  br i1 %28, label %30, label %29

29:                                               ; preds = %25
  store i32 5, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  br label %38

30:                                               ; preds = %25
  %31 = load i32, ptr %8, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds i32, ptr %24, i64 %32
  %34 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %33)
  br label %35

35:                                               ; preds = %30
  %36 = load i32, ptr %8, align 4, !tbaa !5
  %37 = add nsw i32 %36, 1
  store i32 %37, ptr %8, align 4, !tbaa !5
  br label %25, !llvm.loop !9

38:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  store i32 1000, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #8
  store i32 1, ptr %10, align 4, !tbaa !5
  br label %39

39:                                               ; preds = %66, %38
  %40 = load i32, ptr %10, align 4, !tbaa !5
  %41 = icmp sle i32 %40, 4
  br i1 %41, label %43, label %42

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

43:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #8
  %44 = load i32, ptr %10, align 4, !tbaa !5
  store i32 %44, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %45

45:                                               ; preds = %60, %43
  %46 = load i32, ptr %12, align 4, !tbaa !5
  %47 = load i32, ptr %5, align 4, !tbaa !5
  %48 = icmp slt i32 %46, %47
  br i1 %48, label %50, label %49

49:                                               ; preds = %45
  store i32 11, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  br label %63

50:                                               ; preds = %45
  %51 = load i32, ptr %12, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds i32, ptr %24, i64 %52
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = sub nsw i32 %54, 1
  %56 = load i32, ptr %10, align 4, !tbaa !5
  %57 = sdiv i32 %55, %56
  %58 = load i32, ptr %11, align 4, !tbaa !5
  %59 = add nsw i32 %58, %57
  store i32 %59, ptr %11, align 4, !tbaa !5
  br label %60

60:                                               ; preds = %50
  %61 = load i32, ptr %12, align 4, !tbaa !5
  %62 = add nsw i32 %61, 1
  store i32 %62, ptr %12, align 4, !tbaa !5
  br label %45, !llvm.loop !11

63:                                               ; preds = %49
  %64 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %9, ptr noundef nonnull align 4 dereferenceable(4) %11)
  %65 = load i32, ptr %64, align 4, !tbaa !5
  store i32 %65, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  br label %66

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

69:                                               ; preds = %42
  %70 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
  %71 = load i32, ptr %3, align 4, !tbaa !5
  %72 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %70, i32 noundef %71)
  %73 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %72, ptr noundef @.str.1)
  %74 = load i32, ptr %9, align 4, !tbaa !5
  %75 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %73, i32 noundef %74)
  %76 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %75, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  %77 = load ptr, ptr %6, align 8
  call void @llvm.stackrestore.p0(ptr %77)
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #8
  br label %78

78:                                               ; preds = %69
  %79 = load i32, ptr %3, align 4, !tbaa !5
  %80 = add nsw i32 %79, 1
  store i32 %80, ptr %3, align 4, !tbaa !5
  br label %14, !llvm.loop !13

81:                                               ; preds = %18
  call void @exit(i32 noundef 0) #9
  unreachable
}

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #2

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #5

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #6 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #5

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #7

attributes #0 = { mustprogress norecurse 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 = { "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 = { nocallback nofree nosync nounwind willreturn }
attributes #4 = { 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 #5 = { 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 #6 = { 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 #7 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nounwind }
attributes #9 = { noreturn 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"

%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress norecurse noreturn uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #9
  %5 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %6 = load i32, ptr %1, align 4, !tbaa !5
  %.not22 = icmp slt i32 %6, 1
  br i1 %.not22, label %._crit_edge26, label %.lr.ph25

._crit_edge26:                                    ; preds = %91, %0
  call void @exit(i32 noundef 0) #10
  unreachable

.lr.ph25:                                         ; preds = %0, %91
  %.01523 = phi i32 [ %100, %91 ], [ 1, %0 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #9
  %7 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %8 = load i32, ptr %2, align 4, !tbaa !5
  %9 = zext i32 %8 to i64
  %10 = call ptr @llvm.stacksave.p0()
  %11 = alloca i32, i64 %9, align 16
  %12 = load i32, ptr %2, align 4, !tbaa !5
  %13 = icmp sgt i32 %12, 0
  br i1 %13, label %.lr.ph, label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %.lr.ph25
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #9
  store i32 1000, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #9
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %28

._crit_edge:                                      ; preds = %.lr.ph
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #9
  store i32 1000, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #9
  store i32 1, ptr %4, align 4, !tbaa !5
  %14 = icmp sgt i32 %17, 0
  br i1 %14, label %.lr.ph19.preheader, label %28

.lr.ph:                                           ; preds = %.lr.ph25, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.lr.ph25 ]
  %15 = getelementptr inbounds i32, ptr %11, i64 %indvars.iv
  %16 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %15)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %17 = load i32, ptr %2, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = icmp slt i64 %indvars.iv.next, %18
  br i1 %19, label %.lr.ph, label %._crit_edge, !llvm.loop !9

.lr.ph19.preheader:                               ; preds = %._crit_edge
  %wide.trip.count = zext nneg i32 %17 to i64
  %min.iters.check78 = icmp ult i32 %17, 8
  br i1 %min.iters.check78, label %.lr.ph19.preheader95, label %vector.ph79

.lr.ph19.preheader95:                             ; preds = %middle.block76, %.lr.ph19.preheader
  %indvars.iv28.ph = phi i64 [ 0, %.lr.ph19.preheader ], [ %n.vec81, %middle.block76 ]
  %.ph96 = phi i32 [ 1, %.lr.ph19.preheader ], [ %27, %middle.block76 ]
  br label %.lr.ph19

vector.ph79:                                      ; preds = %.lr.ph19.preheader
  %n.vec81 = and i64 %wide.trip.count, 2147483640
  br label %vector.body83

vector.body83:                                    ; preds = %vector.body83, %vector.ph79
  %index84 = phi i64 [ 0, %vector.ph79 ], [ %index.next89, %vector.body83 ]
  %vec.phi85 = phi <4 x i32> [ <i32 1, i32 0, i32 0, i32 0>, %vector.ph79 ], [ %24, %vector.body83 ]
  %vec.phi86 = phi <4 x i32> [ zeroinitializer, %vector.ph79 ], [ %25, %vector.body83 ]
  %20 = getelementptr inbounds i32, ptr %11, i64 %index84
  %21 = getelementptr inbounds i8, ptr %20, i64 16
  %wide.load87 = load <4 x i32>, ptr %20, align 16, !tbaa !5
  %wide.load88 = load <4 x i32>, ptr %21, align 16, !tbaa !5
  %22 = add nsw <4 x i32> %wide.load87, <i32 -1, i32 -1, i32 -1, i32 -1>
  %23 = add nsw <4 x i32> %wide.load88, <i32 -1, i32 -1, i32 -1, i32 -1>
  %24 = add <4 x i32> %vec.phi85, %22
  %25 = add <4 x i32> %vec.phi86, %23
  %index.next89 = add nuw i64 %index84, 8
  %26 = icmp eq i64 %index.next89, %n.vec81
  br i1 %26, label %middle.block76, label %vector.body83, !llvm.loop !11

middle.block76:                                   ; preds = %vector.body83
  %bin.rdx90 = add <4 x i32> %25, %24
  %27 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx90)
  %cmp.n91 = icmp eq i64 %n.vec81, %wide.trip.count
  br i1 %cmp.n91, label %._crit_edge20, label %.lr.ph19.preheader95

._crit_edge20:                                    ; preds = %.lr.ph19, %middle.block76
  %.lcssa36 = phi i32 [ %27, %middle.block76 ], [ %106, %.lr.ph19 ]
  store i32 %.lcssa36, ptr %4, align 4, !tbaa !5
  br label %28

28:                                               ; preds = %._crit_edge.thread, %._crit_edge20, %._crit_edge
  %29 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %30 = load i32, ptr %29, align 4, !tbaa !5
  store i32 %30, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #9
  store i32 2, ptr %4, align 4, !tbaa !5
  %31 = load i32, ptr %2, align 4, !tbaa !5
  %32 = icmp sgt i32 %31, 0
  br i1 %32, label %.lr.ph19.preheader.1, label %49

.lr.ph19.preheader.1:                             ; preds = %28
  %wide.trip.count.1 = zext nneg i32 %31 to i64
  %min.iters.check61 = icmp ult i32 %31, 8
  br i1 %min.iters.check61, label %.lr.ph19.1.preheader, label %vector.ph62

vector.ph62:                                      ; preds = %.lr.ph19.preheader.1
  %n.vec64 = and i64 %wide.trip.count.1, 2147483640
  br label %vector.body66

vector.body66:                                    ; preds = %vector.body66, %vector.ph62
  %index67 = phi i64 [ 0, %vector.ph62 ], [ %index.next72, %vector.body66 ]
  %vec.phi68 = phi <4 x i32> [ <i32 2, i32 0, i32 0, i32 0>, %vector.ph62 ], [ %39, %vector.body66 ]
  %vec.phi69 = phi <4 x i32> [ zeroinitializer, %vector.ph62 ], [ %40, %vector.body66 ]
  %33 = getelementptr inbounds i32, ptr %11, i64 %index67
  %34 = getelementptr inbounds i8, ptr %33, i64 16
  %wide.load70 = load <4 x i32>, ptr %33, align 16, !tbaa !5
  %wide.load71 = load <4 x i32>, ptr %34, align 16, !tbaa !5
  %35 = add nsw <4 x i32> %wide.load70, <i32 -1, i32 -1, i32 -1, i32 -1>
  %36 = add nsw <4 x i32> %wide.load71, <i32 -1, i32 -1, i32 -1, i32 -1>
  %37 = sdiv <4 x i32> %35, <i32 2, i32 2, i32 2, i32 2>
  %38 = sdiv <4 x i32> %36, <i32 2, i32 2, i32 2, i32 2>
  %39 = add <4 x i32> %vec.phi68, %37
  %40 = add <4 x i32> %vec.phi69, %38
  %index.next72 = add nuw i64 %index67, 8
  %41 = icmp eq i64 %index.next72, %n.vec64
  br i1 %41, label %middle.block59, label %vector.body66, !llvm.loop !14

middle.block59:                                   ; preds = %vector.body66
  %bin.rdx73 = add <4 x i32> %40, %39
  %42 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx73)
  %cmp.n74 = icmp eq i64 %n.vec64, %wide.trip.count.1
  br i1 %cmp.n74, label %._crit_edge20.1, label %.lr.ph19.1.preheader

.lr.ph19.1.preheader:                             ; preds = %middle.block59, %.lr.ph19.preheader.1
  %indvars.iv28.1.ph = phi i64 [ 0, %.lr.ph19.preheader.1 ], [ %n.vec64, %middle.block59 ]
  %.ph94 = phi i32 [ 2, %.lr.ph19.preheader.1 ], [ %42, %middle.block59 ]
  br label %.lr.ph19.1

.lr.ph19.1:                                       ; preds = %.lr.ph19.1.preheader, %.lr.ph19.1
  %indvars.iv28.1 = phi i64 [ %indvars.iv.next29.1, %.lr.ph19.1 ], [ %indvars.iv28.1.ph, %.lr.ph19.1.preheader ]
  %43 = phi i32 [ %48, %.lr.ph19.1 ], [ %.ph94, %.lr.ph19.1.preheader ]
  %44 = getelementptr inbounds i32, ptr %11, i64 %indvars.iv28.1
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %46 = add nsw i32 %45, -1
  %47 = sdiv i32 %46, 2
  %48 = add nsw i32 %43, %47
  %indvars.iv.next29.1 = add nuw nsw i64 %indvars.iv28.1, 1
  %exitcond.1.not = icmp eq i64 %indvars.iv.next29.1, %wide.trip.count.1
  br i1 %exitcond.1.not, label %._crit_edge20.1, label %.lr.ph19.1, !llvm.loop !15

._crit_edge20.1:                                  ; preds = %.lr.ph19.1, %middle.block59
  %.lcssa37 = phi i32 [ %42, %middle.block59 ], [ %48, %.lr.ph19.1 ]
  store i32 %.lcssa37, ptr %4, align 4, !tbaa !5
  br label %49

49:                                               ; preds = %._crit_edge20.1, %28
  %50 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %51 = load i32, ptr %50, align 4, !tbaa !5
  store i32 %51, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #9
  store i32 3, ptr %4, align 4, !tbaa !5
  %52 = load i32, ptr %2, align 4, !tbaa !5
  %53 = icmp sgt i32 %52, 0
  br i1 %53, label %.lr.ph19.preheader.2, label %70

.lr.ph19.preheader.2:                             ; preds = %49
  %wide.trip.count.2 = zext nneg i32 %52 to i64
  %min.iters.check44 = icmp ult i32 %52, 8
  br i1 %min.iters.check44, label %.lr.ph19.2.preheader, label %vector.ph45

vector.ph45:                                      ; preds = %.lr.ph19.preheader.2
  %n.vec47 = and i64 %wide.trip.count.2, 2147483640
  br label %vector.body49

vector.body49:                                    ; preds = %vector.body49, %vector.ph45
  %index50 = phi i64 [ 0, %vector.ph45 ], [ %index.next55, %vector.body49 ]
  %vec.phi51 = phi <4 x i32> [ <i32 3, i32 0, i32 0, i32 0>, %vector.ph45 ], [ %60, %vector.body49 ]
  %vec.phi52 = phi <4 x i32> [ zeroinitializer, %vector.ph45 ], [ %61, %vector.body49 ]
  %54 = getelementptr inbounds i32, ptr %11, i64 %index50
  %55 = getelementptr inbounds i8, ptr %54, i64 16
  %wide.load53 = load <4 x i32>, ptr %54, align 16, !tbaa !5
  %wide.load54 = load <4 x i32>, ptr %55, align 16, !tbaa !5
  %56 = add nsw <4 x i32> %wide.load53, <i32 -1, i32 -1, i32 -1, i32 -1>
  %57 = add nsw <4 x i32> %wide.load54, <i32 -1, i32 -1, i32 -1, i32 -1>
  %58 = sdiv <4 x i32> %56, <i32 3, i32 3, i32 3, i32 3>
  %59 = sdiv <4 x i32> %57, <i32 3, i32 3, i32 3, i32 3>
  %60 = add <4 x i32> %vec.phi51, %58
  %61 = add <4 x i32> %vec.phi52, %59
  %index.next55 = add nuw i64 %index50, 8
  %62 = icmp eq i64 %index.next55, %n.vec47
  br i1 %62, label %middle.block42, label %vector.body49, !llvm.loop !16

middle.block42:                                   ; preds = %vector.body49
  %bin.rdx56 = add <4 x i32> %61, %60
  %63 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx56)
  %cmp.n57 = icmp eq i64 %n.vec47, %wide.trip.count.2
  br i1 %cmp.n57, label %._crit_edge20.2, label %.lr.ph19.2.preheader

.lr.ph19.2.preheader:                             ; preds = %middle.block42, %.lr.ph19.preheader.2
  %indvars.iv28.2.ph = phi i64 [ 0, %.lr.ph19.preheader.2 ], [ %n.vec47, %middle.block42 ]
  %.ph93 = phi i32 [ 3, %.lr.ph19.preheader.2 ], [ %63, %middle.block42 ]
  br label %.lr.ph19.2

.lr.ph19.2:                                       ; preds = %.lr.ph19.2.preheader, %.lr.ph19.2
  %indvars.iv28.2 = phi i64 [ %indvars.iv.next29.2, %.lr.ph19.2 ], [ %indvars.iv28.2.ph, %.lr.ph19.2.preheader ]
  %64 = phi i32 [ %69, %.lr.ph19.2 ], [ %.ph93, %.lr.ph19.2.preheader ]
  %65 = getelementptr inbounds i32, ptr %11, i64 %indvars.iv28.2
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = add nsw i32 %66, -1
  %68 = sdiv i32 %67, 3
  %69 = add nsw i32 %64, %68
  %indvars.iv.next29.2 = add nuw nsw i64 %indvars.iv28.2, 1
  %exitcond.2.not = icmp eq i64 %indvars.iv.next29.2, %wide.trip.count.2
  br i1 %exitcond.2.not, label %._crit_edge20.2, label %.lr.ph19.2, !llvm.loop !17

._crit_edge20.2:                                  ; preds = %.lr.ph19.2, %middle.block42
  %.lcssa38 = phi i32 [ %63, %middle.block42 ], [ %69, %.lr.ph19.2 ]
  store i32 %.lcssa38, ptr %4, align 4, !tbaa !5
  br label %70

70:                                               ; preds = %._crit_edge20.2, %49
  %71 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %72 = load i32, ptr %71, align 4, !tbaa !5
  store i32 %72, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #9
  store i32 4, ptr %4, align 4, !tbaa !5
  %73 = load i32, ptr %2, align 4, !tbaa !5
  %74 = icmp sgt i32 %73, 0
  br i1 %74, label %.lr.ph19.preheader.3, label %91

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

vector.ph:                                        ; preds = %.lr.ph19.preheader.3
  %n.vec = and i64 %wide.trip.count.3, 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 i32> [ <i32 4, i32 0, i32 0, i32 0>, %vector.ph ], [ %81, %vector.body ]
  %vec.phi40 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %82, %vector.body ]
  %75 = getelementptr inbounds i32, ptr %11, i64 %index
  %76 = getelementptr inbounds i8, ptr %75, i64 16
  %wide.load = load <4 x i32>, ptr %75, align 16, !tbaa !5
  %wide.load41 = load <4 x i32>, ptr %76, align 16, !tbaa !5
  %77 = add nsw <4 x i32> %wide.load, <i32 -1, i32 -1, i32 -1, i32 -1>
  %78 = add nsw <4 x i32> %wide.load41, <i32 -1, i32 -1, i32 -1, i32 -1>
  %79 = sdiv <4 x i32> %77, <i32 4, i32 4, i32 4, i32 4>
  %80 = sdiv <4 x i32> %78, <i32 4, i32 4, i32 4, i32 4>
  %81 = add <4 x i32> %vec.phi, %79
  %82 = add <4 x i32> %vec.phi40, %80
  %index.next = add nuw i64 %index, 8
  %83 = icmp eq i64 %index.next, %n.vec
  br i1 %83, label %middle.block, label %vector.body, !llvm.loop !18

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <4 x i32> %82, %81
  %84 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count.3
  br i1 %cmp.n, label %._crit_edge20.3, label %.lr.ph19.3.preheader

.lr.ph19.3.preheader:                             ; preds = %middle.block, %.lr.ph19.preheader.3
  %indvars.iv28.3.ph = phi i64 [ 0, %.lr.ph19.preheader.3 ], [ %n.vec, %middle.block ]
  %.ph = phi i32 [ 4, %.lr.ph19.preheader.3 ], [ %84, %middle.block ]
  br label %.lr.ph19.3

.lr.ph19.3:                                       ; preds = %.lr.ph19.3.preheader, %.lr.ph19.3
  %indvars.iv28.3 = phi i64 [ %indvars.iv.next29.3, %.lr.ph19.3 ], [ %indvars.iv28.3.ph, %.lr.ph19.3.preheader ]
  %85 = phi i32 [ %90, %.lr.ph19.3 ], [ %.ph, %.lr.ph19.3.preheader ]
  %86 = getelementptr inbounds i32, ptr %11, i64 %indvars.iv28.3
  %87 = load i32, ptr %86, align 4, !tbaa !5
  %88 = add nsw i32 %87, -1
  %89 = sdiv i32 %88, 4
  %90 = add nsw i32 %85, %89
  %indvars.iv.next29.3 = add nuw nsw i64 %indvars.iv28.3, 1
  %exitcond.3.not = icmp eq i64 %indvars.iv.next29.3, %wide.trip.count.3
  br i1 %exitcond.3.not, label %._crit_edge20.3, label %.lr.ph19.3, !llvm.loop !19

._crit_edge20.3:                                  ; preds = %.lr.ph19.3, %middle.block
  %.lcssa39 = phi i32 [ %84, %middle.block ], [ %90, %.lr.ph19.3 ]
  store i32 %.lcssa39, ptr %4, align 4, !tbaa !5
  br label %91

91:                                               ; preds = %._crit_edge20.3, %70
  %92 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %93 = load i32, ptr %92, align 4, !tbaa !5
  store i32 %93, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #9
  %94 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str)
  %95 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %94, i32 noundef %.01523)
  %96 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %95, ptr noundef nonnull @.str.1)
  %97 = load i32, ptr %3, align 4, !tbaa !5
  %98 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %96, i32 noundef %97)
  %99 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %98, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #9
  call void @llvm.stackrestore.p0(ptr %10)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #9
  %100 = add nuw nsw i32 %.01523, 1
  %101 = load i32, ptr %1, align 4, !tbaa !5
  %.not.not = icmp slt i32 %.01523, %101
  br i1 %.not.not, label %.lr.ph25, label %._crit_edge26, !llvm.loop !20

.lr.ph19:                                         ; preds = %.lr.ph19.preheader95, %.lr.ph19
  %indvars.iv28 = phi i64 [ %indvars.iv.next29, %.lr.ph19 ], [ %indvars.iv28.ph, %.lr.ph19.preheader95 ]
  %102 = phi i32 [ %106, %.lr.ph19 ], [ %.ph96, %.lr.ph19.preheader95 ]
  %103 = getelementptr inbounds i32, ptr %11, i64 %indvars.iv28
  %104 = load i32, ptr %103, align 4, !tbaa !5
  %105 = add nsw i32 %104, -1
  %106 = add nsw i32 %102, %105
  %indvars.iv.next29 = add nuw nsw i64 %indvars.iv28, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next29, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge20, label %.lr.ph19, !llvm.loop !21
}

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #5

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #6 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #5

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #7

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

attributes #0 = { mustprogress norecurse noreturn 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 willreturn memory(argmem: readwrite) }
attributes #2 = { "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 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { 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 #5 = { 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 #6 = { 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 #7 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #9 = { nounwind }
attributes #10 = { noreturn 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, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !10, !12, !13}
!15 = distinct !{!15, !10, !13, !12}
!16 = distinct !{!16, !10, !12, !13}
!17 = distinct !{!17, !10, !13, !12}
!18 = distinct !{!18, !10, !12, !13}
!19 = distinct !{!19, !10, !13, !12}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10, !13, !12}


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