; LLVM IR from Izaron/ACM-ICPC :: Timus Online Judge/Volume 11/2018. The Debut Album (main)

; 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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #1 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca [50005 x [2 x i64]], align 16
  %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
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  %11 = 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)
  %12 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %11, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %13 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %12, ptr noundef nonnull align 4 dereferenceable(4) %4)
  call void @llvm.lifetime.start.p0(i64 800080, ptr %5) #4
  %14 = getelementptr inbounds [50005 x [2 x i64]], ptr %5, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 16 %14, i8 0, i64 800080, i1 false)
  %15 = getelementptr inbounds [50005 x [2 x i64]], ptr %5, i64 0, i64 1
  %16 = getelementptr inbounds [2 x i64], ptr %15, i64 0, i64 0
  store i64 1, ptr %16, align 16, !tbaa !5
  %17 = getelementptr inbounds [50005 x [2 x i64]], ptr %5, i64 0, i64 1
  %18 = getelementptr inbounds [2 x i64], ptr %17, i64 0, i64 1
  store i64 1, ptr %18, align 8, !tbaa !5
  %19 = getelementptr inbounds [50005 x [2 x i64]], ptr %5, i64 0, i64 0
  %20 = getelementptr inbounds [2 x i64], ptr %19, i64 0, i64 0
  store i64 1, ptr %20, align 16, !tbaa !5
  %21 = getelementptr inbounds [50005 x [2 x i64]], ptr %5, i64 0, i64 0
  %22 = getelementptr inbounds [2 x i64], ptr %21, i64 0, i64 1
  store i64 1, ptr %22, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 2, ptr %6, align 4, !tbaa !9
  br label %23

23:                                               ; preds = %101, %0
  %24 = load i32, ptr %6, align 4, !tbaa !9
  %25 = load i32, ptr %2, align 4, !tbaa !9
  %26 = icmp sle i32 %24, %25
  br i1 %26, label %28, label %27

27:                                               ; preds = %23
  store i32 2, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %104

28:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %29 = load i32, ptr %6, align 4, !tbaa !9
  %30 = sub nsw i32 %29, 1
  store i32 %30, ptr %8, align 4, !tbaa !9
  br label %31

31:                                               ; preds = %54, %28
  %32 = load i32, ptr %8, align 4, !tbaa !9
  %33 = load i32, ptr %6, align 4, !tbaa !9
  %34 = load i32, ptr %4, align 4, !tbaa !9
  %35 = sub nsw i32 %33, %34
  %36 = icmp sge i32 %32, %35
  br i1 %36, label %38, label %37

37:                                               ; preds = %31
  store i32 5, ptr %7, align 4
  br label %57

38:                                               ; preds = %31
  %39 = load i32, ptr %8, align 4, !tbaa !9
  %40 = icmp eq i32 %39, -1
  br i1 %40, label %41, label %42

41:                                               ; preds = %38
  store i32 5, ptr %7, align 4
  br label %57

42:                                               ; preds = %38
  %43 = load i32, ptr %8, align 4, !tbaa !9
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [50005 x [2 x i64]], ptr %5, i64 0, i64 %44
  %46 = getelementptr inbounds [2 x i64], ptr %45, i64 0, i64 1
  %47 = load i64, ptr %46, align 8, !tbaa !5
  %48 = load i32, ptr %6, align 4, !tbaa !9
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [50005 x [2 x i64]], ptr %5, i64 0, i64 %49
  %51 = getelementptr inbounds [2 x i64], ptr %50, i64 0, i64 0
  %52 = load i64, ptr %51, align 16, !tbaa !5
  %53 = add nsw i64 %52, %47
  store i64 %53, ptr %51, align 16, !tbaa !5
  br label %54

54:                                               ; preds = %42
  %55 = load i32, ptr %8, align 4, !tbaa !9
  %56 = add nsw i32 %55, -1
  store i32 %56, ptr %8, align 4, !tbaa !9
  br label %31, !llvm.loop !11

57:                                               ; preds = %41, %37
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %58

58:                                               ; preds = %57
  %59 = load i32, ptr %6, align 4, !tbaa !9
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [50005 x [2 x i64]], ptr %5, i64 0, i64 %60
  %62 = getelementptr inbounds [2 x i64], ptr %61, i64 0, i64 0
  %63 = load i64, ptr %62, align 16, !tbaa !5
  %64 = srem i64 %63, 1000000007
  store i64 %64, ptr %62, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %65 = load i32, ptr %6, align 4, !tbaa !9
  %66 = sub nsw i32 %65, 1
  store i32 %66, ptr %9, align 4, !tbaa !9
  br label %67

67:                                               ; preds = %90, %58
  %68 = load i32, ptr %9, align 4, !tbaa !9
  %69 = load i32, ptr %6, align 4, !tbaa !9
  %70 = load i32, ptr %3, align 4, !tbaa !9
  %71 = sub nsw i32 %69, %70
  %72 = icmp sge i32 %68, %71
  br i1 %72, label %74, label %73

73:                                               ; preds = %67
  store i32 8, ptr %7, align 4
  br label %93

74:                                               ; preds = %67
  %75 = load i32, ptr %9, align 4, !tbaa !9
  %76 = icmp eq i32 %75, -1
  br i1 %76, label %77, label %78

77:                                               ; preds = %74
  store i32 8, ptr %7, align 4
  br label %93

78:                                               ; preds = %74
  %79 = load i32, ptr %9, align 4, !tbaa !9
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [50005 x [2 x i64]], ptr %5, i64 0, i64 %80
  %82 = getelementptr inbounds [2 x i64], ptr %81, i64 0, i64 0
  %83 = load i64, ptr %82, align 16, !tbaa !5
  %84 = load i32, ptr %6, align 4, !tbaa !9
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [50005 x [2 x i64]], ptr %5, i64 0, i64 %85
  %87 = getelementptr inbounds [2 x i64], ptr %86, i64 0, i64 1
  %88 = load i64, ptr %87, align 8, !tbaa !5
  %89 = add nsw i64 %88, %83
  store i64 %89, ptr %87, align 8, !tbaa !5
  br label %90

90:                                               ; preds = %78
  %91 = load i32, ptr %9, align 4, !tbaa !9
  %92 = add nsw i32 %91, -1
  store i32 %92, ptr %9, align 4, !tbaa !9
  br label %67, !llvm.loop !13

93:                                               ; preds = %77, %73
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %94

94:                                               ; preds = %93
  %95 = load i32, ptr %6, align 4, !tbaa !9
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [50005 x [2 x i64]], ptr %5, i64 0, i64 %96
  %98 = getelementptr inbounds [2 x i64], ptr %97, i64 0, i64 1
  %99 = load i64, ptr %98, align 8, !tbaa !5
  %100 = srem i64 %99, 1000000007
  store i64 %100, ptr %98, align 8, !tbaa !5
  br label %101

101:                                              ; preds = %94
  %102 = load i32, ptr %6, align 4, !tbaa !9
  %103 = add nsw i32 %102, 1
  store i32 %103, ptr %6, align 4, !tbaa !9
  br label %23, !llvm.loop !14

104:                                              ; preds = %27
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %105 = load i32, ptr %2, align 4, !tbaa !9
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [50005 x [2 x i64]], ptr %5, i64 0, i64 %106
  %108 = getelementptr inbounds [2 x i64], ptr %107, i64 0, i64 0
  %109 = load i64, ptr %108, align 16, !tbaa !5
  %110 = load i32, ptr %2, align 4, !tbaa !9
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [50005 x [2 x i64]], ptr %5, i64 0, i64 %111
  %113 = getelementptr inbounds [2 x i64], ptr %112, i64 0, i64 1
  %114 = load i64, ptr %113, align 8, !tbaa !5
  %115 = add nsw i64 %109, %114
  %116 = trunc i64 %115 to i32
  store i32 %116, ptr %10, align 4, !tbaa !9
  %117 = load i32, ptr %10, align 4, !tbaa !9
  %118 = srem i32 %117, 1000000007
  store i32 %118, ptr %10, align 4, !tbaa !9
  %119 = load i32, ptr %10, align 4, !tbaa !9
  %120 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %119)
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 800080, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  %121 = load i32, ptr %1, align 4
  ret i32 %121
}

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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 nounwind willreturn memory(argmem: write) }
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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}


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

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca [50005 x [2 x i64]], align 16
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  %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 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %7 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %6, ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @llvm.lifetime.start.p0(i64 800080, ptr nonnull %4) #5
  %8 = getelementptr inbounds i8, ptr %4, i64 32
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(800080) %8, i8 0, i64 800048, i1 false)
  %9 = getelementptr inbounds i8, ptr %4, i64 16
  store i64 1, ptr %9, align 16, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %4, i64 24
  store i64 1, ptr %10, align 8, !tbaa !5
  store i64 1, ptr %4, align 16, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %4, i64 8
  store i64 1, ptr %11, align 8, !tbaa !5
  %12 = load i32, ptr %1, align 4, !tbaa !9
  %.not37 = icmp slt i32 %12, 2
  br i1 %.not37, label %._crit_edge41, label %.lr.ph40

.lr.ph40:                                         ; preds = %0
  %13 = load i32, ptr %3, align 4, !tbaa !9
  %14 = load i32, ptr %2, align 4, !tbaa !9
  %15 = sext i32 %13 to i64
  %16 = sext i32 %14 to i64
  %17 = add nuw i32 %12, 1
  %wide.trip.count = zext i32 %17 to i64
  %.not2427.not = icmp sgt i32 %13, 0
  %.not2530.not = icmp sgt i32 %14, 0
  br label %27

._crit_edge41:                                    ; preds = %._crit_edge53, %0
  %18 = sext i32 %12 to i64
  %19 = getelementptr inbounds [50005 x [2 x i64]], ptr %4, i64 0, i64 %18
  %20 = load i64, ptr %19, align 16, !tbaa !5
  %21 = getelementptr inbounds i8, ptr %19, i64 8
  %22 = load i64, ptr %21, align 8, !tbaa !5
  %23 = add nsw i64 %22, %20
  %24 = trunc i64 %23 to i32
  %25 = srem i32 %24, 1000000007
  %26 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %25)
  call void @llvm.lifetime.end.p0(i64 800080, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  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 i32 0

27:                                               ; preds = %.lr.ph40, %._crit_edge53
  %indvar = phi i64 [ 0, %.lr.ph40 ], [ %indvar.next, %._crit_edge53 ]
  %indvars.iv49 = phi i64 [ 2, %.lr.ph40 ], [ %indvars.iv.next50, %._crit_edge53 ]
  %indvars.iv = phi i64 [ 1, %.lr.ph40 ], [ %indvars.iv.next, %._crit_edge53 ]
  %reass.sub = sub i64 %indvar, %15
  %28 = add i64 %reass.sub, 2
  %smin59 = call i64 @llvm.smin.i64(i64 %28, i64 %indvars.iv)
  %29 = sub i64 %indvars.iv, %smin59
  %umin60 = call i64 @llvm.umin.i64(i64 %indvars.iv, i64 %29)
  %30 = add nuw nsw i64 %umin60, 1
  %reass.sub78 = sub i64 %indvar, %16
  %31 = add i64 %reass.sub78, 2
  %smin = call i64 @llvm.smin.i64(i64 %31, i64 %indvars.iv)
  %32 = sub i64 %indvars.iv, %smin
  %umin = call i64 @llvm.umin.i64(i64 %indvars.iv, i64 %32)
  %33 = add nuw nsw i64 %umin, 1
  %34 = sub nsw i64 %indvars.iv49, %15
  %35 = getelementptr inbounds [50005 x [2 x i64]], ptr %4, i64 0, i64 %indvars.iv49
  %.promoted = load i64, ptr %35, align 16, !tbaa !5
  br i1 %.not2427.not, label %.lr.ph.preheader, label %._crit_edge52

.lr.ph.preheader:                                 ; preds = %27
  %min.iters.check63 = icmp ult i64 %umin60, 3
  br i1 %min.iters.check63, label %.lr.ph.preheader80, label %vector.ph64

vector.ph64:                                      ; preds = %.lr.ph.preheader
  %n.vec66 = and i64 %30, 9223372036854775804
  %ind.end67 = sub nsw i64 %indvars.iv, %n.vec66
  %36 = insertelement <2 x i64> <i64 poison, i64 0>, i64 %.promoted, i64 0
  br label %vector.body69

vector.body69:                                    ; preds = %vector.body69, %vector.ph64
  %index70 = phi i64 [ 0, %vector.ph64 ], [ %index.next74, %vector.body69 ]
  %vec.phi71 = phi <2 x i64> [ %36, %vector.ph64 ], [ %52, %vector.body69 ]
  %vec.phi72 = phi <2 x i64> [ zeroinitializer, %vector.ph64 ], [ %53, %vector.body69 ]
  %offset.idx73 = sub i64 %indvars.iv, %index70
  %37 = add i64 %offset.idx73, -1
  %38 = add i64 %offset.idx73, -2
  %39 = add i64 %offset.idx73, -3
  %40 = getelementptr inbounds [50005 x [2 x i64]], ptr %4, i64 0, i64 %offset.idx73, i64 1
  %41 = getelementptr inbounds [50005 x [2 x i64]], ptr %4, i64 0, i64 %37, i64 1
  %42 = getelementptr inbounds [50005 x [2 x i64]], ptr %4, i64 0, i64 %38, i64 1
  %43 = getelementptr inbounds [50005 x [2 x i64]], ptr %4, i64 0, i64 %39, i64 1
  %44 = load i64, ptr %40, align 8, !tbaa !5
  %45 = load i64, ptr %41, align 8, !tbaa !5
  %46 = insertelement <2 x i64> poison, i64 %44, i64 0
  %47 = insertelement <2 x i64> %46, i64 %45, i64 1
  %48 = load i64, ptr %42, align 8, !tbaa !5
  %49 = load i64, ptr %43, align 8, !tbaa !5
  %50 = insertelement <2 x i64> poison, i64 %48, i64 0
  %51 = insertelement <2 x i64> %50, i64 %49, i64 1
  %52 = add <2 x i64> %vec.phi71, %47
  %53 = add <2 x i64> %vec.phi72, %51
  %index.next74 = add nuw i64 %index70, 4
  %54 = icmp eq i64 %index.next74, %n.vec66
  br i1 %54, label %middle.block61, label %vector.body69, !llvm.loop !11

middle.block61:                                   ; preds = %vector.body69
  %bin.rdx75 = add <2 x i64> %53, %52
  %55 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx75)
  %cmp.n76 = icmp eq i64 %30, %n.vec66
  br i1 %cmp.n76, label %._crit_edge52, label %.lr.ph.preheader80

.lr.ph.preheader80:                               ; preds = %middle.block61, %.lr.ph.preheader
  %indvars.iv43.ph = phi i64 [ %indvars.iv, %.lr.ph.preheader ], [ %ind.end67, %middle.block61 ]
  %.ph81 = phi i64 [ %.promoted, %.lr.ph.preheader ], [ %55, %middle.block61 ]
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader80, %.lr.ph
  %indvars.iv43 = phi i64 [ %indvars.iv.next44, %.lr.ph ], [ %indvars.iv43.ph, %.lr.ph.preheader80 ]
  %56 = phi i64 [ %59, %.lr.ph ], [ %.ph81, %.lr.ph.preheader80 ]
  %57 = getelementptr inbounds [50005 x [2 x i64]], ptr %4, i64 0, i64 %indvars.iv43, i64 1
  %58 = load i64, ptr %57, align 8, !tbaa !5
  %59 = add nsw i64 %56, %58
  %indvars.iv.next44 = add nsw i64 %indvars.iv43, -1
  %.not24 = icmp sle i64 %indvars.iv43, %34
  %60 = icmp eq i64 %indvars.iv43, 0
  %or.cond = or i1 %60, %.not24
  br i1 %or.cond, label %._crit_edge52, label %.lr.ph, !llvm.loop !15

._crit_edge52:                                    ; preds = %.lr.ph, %middle.block61, %27
  %61 = phi i64 [ %.promoted, %27 ], [ %55, %middle.block61 ], [ %59, %.lr.ph ]
  %62 = getelementptr inbounds [50005 x [2 x i64]], ptr %4, i64 0, i64 %indvars.iv49
  %63 = srem i64 %61, 1000000007
  store i64 %63, ptr %62, align 16, !tbaa !5
  %64 = sub nsw i64 %indvars.iv49, %16
  %65 = getelementptr inbounds i8, ptr %62, i64 8
  %.promoted35 = load i64, ptr %65, align 8, !tbaa !5
  br i1 %.not2530.not, label %.lr.ph33.preheader, label %._crit_edge53

.lr.ph33.preheader:                               ; preds = %._crit_edge52
  %min.iters.check = icmp ult i64 %umin, 3
  br i1 %min.iters.check, label %.lr.ph33.preheader79, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph33.preheader
  %n.vec = and i64 %33, 9223372036854775804
  %ind.end = sub nsw i64 %indvars.iv, %n.vec
  %66 = insertelement <2 x i64> <i64 poison, i64 0>, i64 %.promoted35, i64 0
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <2 x i64> [ %66, %vector.ph ], [ %82, %vector.body ]
  %vec.phi58 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %83, %vector.body ]
  %offset.idx = sub i64 %indvars.iv, %index
  %67 = add i64 %offset.idx, -1
  %68 = add i64 %offset.idx, -2
  %69 = add i64 %offset.idx, -3
  %70 = getelementptr inbounds [50005 x [2 x i64]], ptr %4, i64 0, i64 %offset.idx
  %71 = getelementptr inbounds [50005 x [2 x i64]], ptr %4, i64 0, i64 %67
  %72 = getelementptr inbounds [50005 x [2 x i64]], ptr %4, i64 0, i64 %68
  %73 = getelementptr inbounds [50005 x [2 x i64]], ptr %4, i64 0, i64 %69
  %74 = load i64, ptr %70, align 16, !tbaa !5
  %75 = load i64, ptr %71, align 16, !tbaa !5
  %76 = insertelement <2 x i64> poison, i64 %74, i64 0
  %77 = insertelement <2 x i64> %76, i64 %75, i64 1
  %78 = load i64, ptr %72, align 16, !tbaa !5
  %79 = load i64, ptr %73, align 16, !tbaa !5
  %80 = insertelement <2 x i64> poison, i64 %78, i64 0
  %81 = insertelement <2 x i64> %80, i64 %79, i64 1
  %82 = add <2 x i64> %vec.phi, %77
  %83 = add <2 x i64> %vec.phi58, %81
  %index.next = add nuw i64 %index, 4
  %84 = icmp eq i64 %index.next, %n.vec
  br i1 %84, label %middle.block, label %vector.body, !llvm.loop !16

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <2 x i64> %83, %82
  %85 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
  %cmp.n = icmp eq i64 %33, %n.vec
  br i1 %cmp.n, label %._crit_edge53, label %.lr.ph33.preheader79

.lr.ph33.preheader79:                             ; preds = %middle.block, %.lr.ph33.preheader
  %indvars.iv46.ph = phi i64 [ %indvars.iv, %.lr.ph33.preheader ], [ %ind.end, %middle.block ]
  %.ph = phi i64 [ %.promoted35, %.lr.ph33.preheader ], [ %85, %middle.block ]
  br label %.lr.ph33

.lr.ph33:                                         ; preds = %.lr.ph33.preheader79, %.lr.ph33
  %indvars.iv46 = phi i64 [ %indvars.iv.next47, %.lr.ph33 ], [ %indvars.iv46.ph, %.lr.ph33.preheader79 ]
  %86 = phi i64 [ %89, %.lr.ph33 ], [ %.ph, %.lr.ph33.preheader79 ]
  %87 = getelementptr inbounds [50005 x [2 x i64]], ptr %4, i64 0, i64 %indvars.iv46
  %88 = load i64, ptr %87, align 16, !tbaa !5
  %89 = add nsw i64 %86, %88
  %indvars.iv.next47 = add nsw i64 %indvars.iv46, -1
  %.not25 = icmp sle i64 %indvars.iv46, %64
  %90 = icmp eq i64 %indvars.iv46, 0
  %or.cond26 = or i1 %90, %.not25
  br i1 %or.cond26, label %._crit_edge53, label %.lr.ph33, !llvm.loop !17

._crit_edge53:                                    ; preds = %.lr.ph33, %middle.block, %._crit_edge52
  %91 = phi i64 [ %.promoted35, %._crit_edge52 ], [ %85, %middle.block ], [ %89, %.lr.ph33 ]
  %92 = getelementptr inbounds i8, ptr %62, i64 8
  %93 = srem i64 %91, 1000000007
  store i64 %93, ptr %92, align 8, !tbaa !5
  %indvars.iv.next50 = add nuw nsw i64 %indvars.iv49, 1
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next50, %wide.trip.count
  %indvar.next = add i64 %indvar, 1
  br i1 %exitcond.not, label %._crit_edge41, label %27, !llvm.loop !18
}

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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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 nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #4

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umin.i64(i64, i64) #4

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 nounwind willreturn memory(argmem: write) }
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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12, !13, !14}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !12, !14, !13}
!16 = distinct !{!16, !12, !13, !14}
!17 = distinct !{!17, !12, !14, !13}
!18 = distinct !{!18, !12}


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