; LLVM IR from VastoLorde95/Competitive-Programming :: CodeChef/SNACKDOWN/17/Qualifier/D/D.ll (Z5solvev)

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

@l = external dso_local global [100100 x i64], align 16
@sum = external dso_local global [100100 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() #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 i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  %15 = 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)
  %16 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %15, ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %17

17:                                               ; preds = %27, %0
  %18 = load i32, ptr %3, align 4, !tbaa !5
  %19 = load i32, ptr %1, align 4, !tbaa !5
  %20 = icmp sle i32 %18, %19
  br i1 %20, label %22, label %21

21:                                               ; preds = %17
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  br label %30

22:                                               ; preds = %17
  %23 = load i32, ptr %3, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [100100 x i64], ptr @l, i64 0, i64 %24
  %26 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %25)
  br label %27

27:                                               ; preds = %22
  %28 = load i32, ptr %3, align 4, !tbaa !5
  %29 = add nsw i32 %28, 1
  store i32 %29, ptr %3, align 4, !tbaa !5
  br label %17, !llvm.loop !9

30:                                               ; preds = %21
  %31 = load i32, ptr %1, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds i64, ptr @l, i64 %32
  %34 = getelementptr inbounds i64, ptr %33, i64 1
  call void @_ZSt4sortIPxEvT_S1_(ptr noundef getelementptr inbounds (i64, ptr @l, i64 1), ptr noundef %34)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %35

35:                                               ; preds = %48, %30
  %36 = load i32, ptr %4, align 4, !tbaa !5
  %37 = load i32, ptr %1, align 4, !tbaa !5
  %38 = icmp sle i32 %36, %37
  br i1 %38, label %40, label %39

39:                                               ; preds = %35
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  br label %51

40:                                               ; preds = %35
  %41 = load i32, ptr %4, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [100100 x i64], ptr @l, i64 0, i64 %42
  %44 = load i64, ptr %43, align 8, !tbaa !11
  %45 = load i32, ptr %4, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [100100 x i64], ptr @sum, i64 0, i64 %46
  store i64 %44, ptr %47, align 8, !tbaa !11
  br label %48

48:                                               ; preds = %40
  %49 = load i32, ptr %4, align 4, !tbaa !5
  %50 = add nsw i32 %49, 1
  store i32 %50, ptr %4, align 4, !tbaa !5
  br label %35, !llvm.loop !13

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

52:                                               ; preds = %68, %51
  %53 = load i32, ptr %5, align 4, !tbaa !5
  %54 = load i32, ptr %1, align 4, !tbaa !5
  %55 = icmp sle i32 %53, %54
  br i1 %55, label %57, label %56

56:                                               ; preds = %52
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  br label %71

57:                                               ; preds = %52
  %58 = load i32, ptr %5, align 4, !tbaa !5
  %59 = sub nsw i32 %58, 1
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [100100 x i64], ptr @sum, i64 0, i64 %60
  %62 = load i64, ptr %61, align 8, !tbaa !11
  %63 = load i32, ptr %5, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [100100 x i64], ptr @sum, i64 0, i64 %64
  %66 = load i64, ptr %65, align 8, !tbaa !11
  %67 = add nsw i64 %66, %62
  store i64 %67, ptr %65, align 8, !tbaa !11
  br label %68

68:                                               ; preds = %57
  %69 = load i32, ptr %5, align 4, !tbaa !5
  %70 = add nsw i32 %69, 1
  store i32 %70, ptr %5, align 4, !tbaa !5
  br label %52, !llvm.loop !14

71:                                               ; preds = %56
  br label %72

72:                                               ; preds = %144, %142, %71
  %73 = load i32, ptr %2, align 4, !tbaa !5
  %74 = add nsw i32 %73, -1
  store i32 %74, ptr %2, align 4, !tbaa !5
  %75 = icmp ne i32 %73, 0
  br i1 %75, label %76, label %145

76:                                               ; preds = %72
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %77 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %6)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %78 = load i32, ptr %1, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds i64, ptr @l, i64 %79
  %81 = getelementptr inbounds i64, ptr %80, i64 1
  %82 = call noundef ptr @_ZSt11lower_boundIPxiET_S1_S1_RKT0_(ptr noundef @l, ptr noundef %81, ptr noundef nonnull align 4 dereferenceable(4) %6)
  %83 = ptrtoint ptr %82 to i64
  %84 = sub i64 %83, ptrtoint (ptr @l to i64)
  %85 = sdiv exact i64 %84, 8
  %86 = trunc i64 %85 to i32
  store i32 %86, ptr %7, align 4, !tbaa !5
  %87 = load i32, ptr %7, align 4, !tbaa !5
  %88 = icmp eq i32 %87, 1
  br i1 %88, label %89, label %93

89:                                               ; preds = %76
  %90 = load i32, ptr %1, align 4, !tbaa !5
  %91 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %90)
  %92 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %91, i8 noundef signext 10)
  store i32 11, ptr %8, align 4
  br label %142, !llvm.loop !15

93:                                               ; preds = %76
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 0, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %94 = load i32, ptr %7, align 4, !tbaa !5
  %95 = sub nsw i32 %94, 1
  store i32 %95, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  br label %96

96:                                               ; preds = %135, %93
  %97 = load i32, ptr %9, align 4, !tbaa !5
  %98 = add nsw i32 %97, 1
  %99 = load i32, ptr %10, align 4, !tbaa !5
  %100 = icmp slt i32 %98, %99
  br i1 %100, label %101, label %136

101:                                              ; preds = %96
  %102 = load i32, ptr %9, align 4, !tbaa !5
  %103 = load i32, ptr %10, align 4, !tbaa !5
  %104 = add nsw i32 %102, %103
  %105 = sdiv i32 %104, 2
  store i32 %105, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %106 = load i32, ptr %7, align 4, !tbaa !5
  %107 = load i32, ptr %11, align 4, !tbaa !5
  %108 = sub nsw i32 %106, %107
  %109 = sub nsw i32 %108, 1
  %110 = sext i32 %109 to i64
  %111 = load i32, ptr %6, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = mul nsw i64 %110, %112
  store i64 %113, ptr %12, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  %114 = load i32, ptr %7, align 4, !tbaa !5
  %115 = sub nsw i32 %114, 1
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [100100 x i64], ptr @sum, i64 0, i64 %116
  %118 = load i64, ptr %117, align 8, !tbaa !11
  %119 = load i32, ptr %11, align 4, !tbaa !5
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [100100 x i64], ptr @sum, i64 0, i64 %120
  %122 = load i64, ptr %121, align 8, !tbaa !11
  %123 = sub nsw i64 %118, %122
  store i64 %123, ptr %13, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %124 = load i64, ptr %12, align 8, !tbaa !11
  %125 = load i64, ptr %13, align 8, !tbaa !11
  %126 = sub nsw i64 %124, %125
  store i64 %126, ptr %14, align 8, !tbaa !11
  %127 = load i64, ptr %14, align 8, !tbaa !11
  %128 = load i32, ptr %11, align 4, !tbaa !5
  %129 = sext i32 %128 to i64
  %130 = icmp sgt i64 %127, %129
  br i1 %130, label %131, label %133

131:                                              ; preds = %101
  %132 = load i32, ptr %11, align 4, !tbaa !5
  store i32 %132, ptr %9, align 4, !tbaa !5
  br label %135

133:                                              ; preds = %101
  %134 = load i32, ptr %11, align 4, !tbaa !5
  store i32 %134, ptr %10, align 4, !tbaa !5
  br label %135

135:                                              ; preds = %133, %131
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  br label %96, !llvm.loop !16

136:                                              ; preds = %96
  %137 = load i32, ptr %1, align 4, !tbaa !5
  %138 = load i32, ptr %10, align 4, !tbaa !5
  %139 = sub nsw i32 %137, %138
  %140 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %139)
  %141 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %140, i8 noundef signext 10)
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  store i32 0, ptr %8, align 4
  br label %142

142:                                              ; preds = %136, %89
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  %143 = load i32, ptr %8, align 4
  switch i32 %143, label %146 [
    i32 0, label %144
    i32 11, label %72
  ]

144:                                              ; preds = %142
  br label %72, !llvm.loop !15

145:                                              ; preds = %72
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #4
  ret void

146:                                              ; preds = %142
  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: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) #0 align 2

; 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 uwtable
declare dso_local void @_ZSt4sortIPxEvT_S1_(ptr noundef, ptr noundef) #3

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) #3

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

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 = { "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 = { 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 #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 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !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" }

@l = external dso_local global [100100 x i64], align 16
@sum = external dso_local local_unnamed_addr global [100100 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  %4 = 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)
  %5 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %6 = load i32, ptr %1, align 4, !tbaa !5
  %.not41 = icmp slt i32 %6, 1
  br i1 %.not41, label %.._crit_edge_crit_edge, label %.lr.ph

.._crit_edge_crit_edge:                           ; preds = %0
  %.pre67 = sext i32 %6 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre67, %.._crit_edge_crit_edge ], [ %13, %.lr.ph ]
  %7 = getelementptr inbounds i64, ptr @l, i64 %.pre-phi
  %8 = getelementptr inbounds i8, ptr %7, i64 8
  call void @_ZSt4sortIPxEvT_S1_(ptr noundef nonnull getelementptr inbounds (i8, ptr @l, i64 8), ptr noundef nonnull %8)
  %9 = load i32, ptr %1, align 4, !tbaa !5
  %.not3543 = icmp slt i32 %9, 1
  br i1 %.not3543, label %.preheader, label %.preheader39

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %0 ]
  %10 = getelementptr inbounds [100100 x i64], ptr @l, i64 0, i64 %indvars.iv
  %11 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %10)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %12 = load i32, ptr %1, align 4, !tbaa !5
  %13 = sext i32 %12 to i64
  %.not.not = icmp slt i64 %indvars.iv, %13
  br i1 %.not.not, label %.lr.ph, label %._crit_edge, !llvm.loop !9

.preheader39:                                     ; preds = %._crit_edge
  %14 = zext nneg i32 %9 to i64
  %15 = shl nuw nsw i64 %14, 3
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 8 getelementptr inbounds (i8, ptr @sum, i64 8), ptr nonnull align 8 getelementptr inbounds (i8, ptr @l, i64 8), i64 %15, i1 false), !tbaa !11
  %.not3648 = icmp eq i32 %9, 1
  br i1 %.not3648, label %.preheader, label %.lr.ph50.preheader

.lr.ph50.preheader:                               ; preds = %.preheader39
  %16 = add nuw i32 %9, 1
  %wide.trip.count = zext i32 %16 to i64
  %.pre = load i64, ptr getelementptr inbounds (i8, ptr @sum, i64 8), align 8, !tbaa !11
  %17 = add nsw i64 %wide.trip.count, -2
  %18 = add nsw i64 %wide.trip.count, -3
  %xtraiter = and i64 %17, 3
  %19 = icmp ult i64 %18, 3
  br i1 %19, label %.preheader.loopexit.unr-lcssa, label %.lr.ph50.preheader.new

.lr.ph50.preheader.new:                           ; preds = %.lr.ph50.preheader
  %unroll_iter = and i64 %17, -4
  br label %.lr.ph50

.preheader.loopexit.unr-lcssa:                    ; preds = %.lr.ph50, %.lr.ph50.preheader
  %.unr = phi i64 [ %.pre, %.lr.ph50.preheader ], [ %38, %.lr.ph50 ]
  %indvars.iv64.unr = phi i64 [ 2, %.lr.ph50.preheader ], [ %indvars.iv.next65.3, %.lr.ph50 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader, label %.lr.ph50.epil

.lr.ph50.epil:                                    ; preds = %.preheader.loopexit.unr-lcssa, %.lr.ph50.epil
  %20 = phi i64 [ %23, %.lr.ph50.epil ], [ %.unr, %.preheader.loopexit.unr-lcssa ]
  %indvars.iv64.epil = phi i64 [ %indvars.iv.next65.epil, %.lr.ph50.epil ], [ %indvars.iv64.unr, %.preheader.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph50.epil ], [ 0, %.preheader.loopexit.unr-lcssa ]
  %21 = getelementptr inbounds [100100 x i64], ptr @sum, i64 0, i64 %indvars.iv64.epil
  %22 = load i64, ptr %21, align 8, !tbaa !11
  %23 = add nsw i64 %22, %20
  store i64 %23, ptr %21, align 8, !tbaa !11
  %indvars.iv.next65.epil = add nuw nsw i64 %indvars.iv64.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %.preheader, label %.lr.ph50.epil, !llvm.loop !13

.preheader:                                       ; preds = %.preheader.loopexit.unr-lcssa, %.lr.ph50.epil, %._crit_edge, %.preheader39
  %24 = load i32, ptr %2, align 4, !tbaa !5
  %25 = add nsw i32 %24, -1
  store i32 %25, ptr %2, align 4, !tbaa !5
  %.not3757 = icmp eq i32 %24, 0
  br i1 %.not3757, label %._crit_edge59, label %.lr.ph58

.lr.ph50:                                         ; preds = %.lr.ph50, %.lr.ph50.preheader.new
  %26 = phi i64 [ %.pre, %.lr.ph50.preheader.new ], [ %38, %.lr.ph50 ]
  %indvars.iv64 = phi i64 [ 2, %.lr.ph50.preheader.new ], [ %indvars.iv.next65.3, %.lr.ph50 ]
  %niter = phi i64 [ 0, %.lr.ph50.preheader.new ], [ %niter.next.3, %.lr.ph50 ]
  %27 = getelementptr inbounds [100100 x i64], ptr @sum, i64 0, i64 %indvars.iv64
  %28 = load i64, ptr %27, align 16, !tbaa !11
  %29 = add nsw i64 %28, %26
  store i64 %29, ptr %27, align 16, !tbaa !11
  %indvars.iv.next65 = or disjoint i64 %indvars.iv64, 1
  %30 = getelementptr inbounds [100100 x i64], ptr @sum, i64 0, i64 %indvars.iv.next65
  %31 = load i64, ptr %30, align 8, !tbaa !11
  %32 = add nsw i64 %31, %29
  store i64 %32, ptr %30, align 8, !tbaa !11
  %indvars.iv.next65.1 = add nuw nsw i64 %indvars.iv64, 2
  %33 = getelementptr inbounds [100100 x i64], ptr @sum, i64 0, i64 %indvars.iv.next65.1
  %34 = load i64, ptr %33, align 16, !tbaa !11
  %35 = add nsw i64 %34, %32
  store i64 %35, ptr %33, align 16, !tbaa !11
  %indvars.iv.next65.2 = add nuw nsw i64 %indvars.iv64, 3
  %36 = getelementptr inbounds [100100 x i64], ptr @sum, i64 0, i64 %indvars.iv.next65.2
  %37 = load i64, ptr %36, align 8, !tbaa !11
  %38 = add nsw i64 %37, %35
  store i64 %38, ptr %36, align 8, !tbaa !11
  %indvars.iv.next65.3 = add nuw nsw i64 %indvars.iv64, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %.preheader.loopexit.unr-lcssa, label %.lr.ph50, !llvm.loop !15

.lr.ph58:                                         ; preds = %.preheader, %74
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  %39 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %40 = load i32, ptr %1, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %gep = getelementptr i64, ptr getelementptr inbounds (i8, ptr @l, i64 8), i64 %41
  %42 = call noundef ptr @_ZSt11lower_boundIPxiET_S1_S1_RKT0_(ptr noundef nonnull @l, ptr noundef nonnull %gep, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %43 = ptrtoint ptr %42 to i64
  %44 = sub i64 %43, ptrtoint (ptr @l to i64)
  %45 = lshr exact i64 %44, 3
  %46 = trunc i64 %45 to i32
  %47 = icmp eq i32 %46, 1
  br i1 %47, label %48, label %50

48:                                               ; preds = %.lr.ph58
  %49 = load i32, ptr %1, align 4, !tbaa !5
  br label %74, !llvm.loop !16

50:                                               ; preds = %.lr.ph58
  %51 = add nsw i32 %46, -1
  %52 = icmp sgt i32 %46, 2
  br i1 %52, label %.lr.ph54, label %._crit_edge55

.lr.ph54:                                         ; preds = %50
  %53 = load i32, ptr %3, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = zext nneg i32 %51 to i64
  %56 = getelementptr inbounds [100100 x i64], ptr @sum, i64 0, i64 %55
  %57 = load i64, ptr %56, align 8, !tbaa !11
  br label %58

58:                                               ; preds = %.lr.ph54, %58
  %.03052 = phi i32 [ %51, %.lr.ph54 ], [ %.030., %58 ]
  %.03151 = phi i32 [ 0, %.lr.ph54 ], [ %..031, %58 ]
  %59 = add nuw nsw i32 %.03052, %.03151
  %60 = lshr i32 %59, 1
  %61 = xor i32 %60, -1
  %62 = add nsw i32 %61, %46
  %63 = sext i32 %62 to i64
  %64 = mul nsw i64 %54, %63
  %65 = zext nneg i32 %60 to i64
  %66 = getelementptr inbounds [100100 x i64], ptr @sum, i64 0, i64 %65
  %67 = load i64, ptr %66, align 8, !tbaa !11
  %.neg = sub i64 %67, %57
  %68 = add i64 %.neg, %64
  %69 = icmp sgt i64 %68, %65
  %..031 = select i1 %69, i32 %60, i32 %.03151
  %.030. = select i1 %69, i32 %.03052, i32 %60
  %70 = add nuw nsw i32 %..031, 1
  %71 = icmp slt i32 %70, %.030.
  br i1 %71, label %58, label %._crit_edge55, !llvm.loop !17

._crit_edge55:                                    ; preds = %58, %50
  %.030.lcssa = phi i32 [ %51, %50 ], [ %.030., %58 ]
  %72 = load i32, ptr %1, align 4, !tbaa !5
  %73 = sub nsw i32 %72, %.030.lcssa
  br label %74

74:                                               ; preds = %._crit_edge55, %48
  %.sink69 = phi i32 [ %73, %._crit_edge55 ], [ %49, %48 ]
  %75 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %.sink69)
  %76 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %75, i8 noundef signext 10)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  %77 = load i32, ptr %2, align 4, !tbaa !5
  %78 = add nsw i32 %77, -1
  store i32 %78, ptr %2, align 4, !tbaa !5
  %.not37 = icmp eq i32 %77, 0
  br i1 %.not37, label %._crit_edge59, label %.lr.ph58

._crit_edge59:                                    ; preds = %74, %.preheader
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  ret void
}

; 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 uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #0 align 2

; 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 uwtable
declare dso_local void @_ZSt4sortIPxEvT_S1_(ptr noundef, ptr noundef) local_unnamed_addr #3

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) local_unnamed_addr #3

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #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 = { 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 = { 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 #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}


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