; LLVM IR from eyangch/competitive-programming :: Codeforces/909 (c)

; 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: mustprogress nounwind uwtable
declare dso_local void @_Z8pforwardRA5000_xx(ptr noundef nonnull align 8 dereferenceable(40000), i64 noundef) #0

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

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

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

15:                                               ; preds = %32, %0
  %16 = load i64, ptr %4, align 8, !tbaa !5
  %17 = load i64, ptr %2, align 8, !tbaa !5
  %18 = icmp slt i64 %16, %17
  br i1 %18, label %20, label %19

19:                                               ; preds = %15
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  br label %35

20:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #6
  %21 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 1 dereferenceable(1) %5)
  %22 = load i8, ptr %5, align 1, !tbaa !9
  %23 = sext i8 %22 to i32
  %24 = icmp eq i32 %23, 102
  br i1 %24, label %25, label %28

25:                                               ; preds = %20
  %26 = load i64, ptr %4, align 8, !tbaa !5
  %27 = getelementptr inbounds [5000 x i8], ptr %3, i64 0, i64 %26
  store i8 1, ptr %27, align 1, !tbaa !10
  br label %31

28:                                               ; preds = %20
  %29 = load i64, ptr %4, align 8, !tbaa !5
  %30 = getelementptr inbounds [5000 x i8], ptr %3, i64 0, i64 %29
  store i8 0, ptr %30, align 1, !tbaa !10
  br label %31

31:                                               ; preds = %28, %25
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #6
  br label %32

32:                                               ; preds = %31
  %33 = load i64, ptr %4, align 8, !tbaa !5
  %34 = add nsw i64 %33, 1
  store i64 %34, ptr %4, align 8, !tbaa !5
  br label %15, !llvm.loop !12

35:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 80000, ptr %6) #6
  %36 = getelementptr inbounds [2 x [5000 x i64]], ptr %6, i64 0, i64 0
  %37 = getelementptr inbounds [5000 x i64], ptr %36, i64 0, i64 0
  %38 = getelementptr inbounds [2 x [5000 x i64]], ptr %6, i64 0, i64 1
  %39 = getelementptr inbounds [5000 x i64], ptr %38, i64 0, i64 0
  %40 = getelementptr inbounds i64, ptr %39, i64 5000
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 0, ptr %7, align 4, !tbaa !14
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef %37, ptr noundef %40, ptr noundef nonnull align 4 dereferenceable(4) %7)
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  %41 = getelementptr inbounds [2 x [5000 x i64]], ptr %6, i64 0, i64 0
  %42 = getelementptr inbounds [5000 x i64], ptr %41, i64 0, i64 0
  store i64 1, ptr %42, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  store i64 1, ptr %8, align 8, !tbaa !5
  br label %43

43:                                               ; preds = %90, %35
  %44 = load i64, ptr %8, align 8, !tbaa !5
  %45 = load i64, ptr %2, align 8, !tbaa !5
  %46 = icmp slt i64 %44, %45
  br i1 %46, label %48, label %47

47:                                               ; preds = %43
  store i32 5, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  br label %93

48:                                               ; preds = %43
  %49 = getelementptr inbounds [2 x [5000 x i64]], ptr %6, i64 0, i64 0
  %50 = getelementptr inbounds [5000 x i64], ptr %49, i64 0, i64 0
  %51 = getelementptr inbounds [2 x [5000 x i64]], ptr %6, i64 0, i64 0
  %52 = getelementptr inbounds [5000 x i64], ptr %51, i64 0, i64 0
  %53 = load i64, ptr %2, align 8, !tbaa !5
  %54 = getelementptr inbounds i64, ptr %52, i64 %53
  %55 = getelementptr inbounds [2 x [5000 x i64]], ptr %6, i64 0, i64 1
  %56 = getelementptr inbounds [5000 x i64], ptr %55, i64 0, i64 0
  %57 = call noundef ptr @_ZSt4copyIPxS0_ET0_T_S2_S1_(ptr noundef %50, ptr noundef %54, ptr noundef %56)
  %58 = load i64, ptr %8, align 8, !tbaa !5
  %59 = sub nsw i64 %58, 1
  %60 = getelementptr inbounds [5000 x i8], ptr %3, i64 0, i64 %59
  %61 = load i8, ptr %60, align 1, !tbaa !10, !range !16, !noundef !17
  %62 = trunc i8 %61 to i1
  br i1 %62, label %63, label %66

63:                                               ; preds = %48
  %64 = getelementptr inbounds [2 x [5000 x i64]], ptr %6, i64 0, i64 0
  %65 = load i64, ptr %8, align 8, !tbaa !5
  call void @_Z8pforwardRA5000_xx(ptr noundef nonnull align 8 dereferenceable(40000) %64, i64 noundef %65)
  br label %89

66:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  store i64 0, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %67 = load i64, ptr %8, align 8, !tbaa !5
  store i64 %67, ptr %11, align 8, !tbaa !5
  br label %68

68:                                               ; preds = %85, %66
  %69 = load i64, ptr %11, align 8, !tbaa !5
  %70 = icmp sge i64 %69, 0
  br i1 %70, label %72, label %71

71:                                               ; preds = %68
  store i32 8, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  br label %88

72:                                               ; preds = %68
  %73 = getelementptr inbounds [2 x [5000 x i64]], ptr %6, i64 0, i64 1
  %74 = load i64, ptr %11, align 8, !tbaa !5
  %75 = getelementptr inbounds [5000 x i64], ptr %73, i64 0, i64 %74
  %76 = load i64, ptr %75, align 8, !tbaa !5
  %77 = load i64, ptr %10, align 8, !tbaa !5
  %78 = add nsw i64 %77, %76
  store i64 %78, ptr %10, align 8, !tbaa !5
  %79 = load i64, ptr %10, align 8, !tbaa !5
  %80 = srem i64 %79, 1000000007
  store i64 %80, ptr %10, align 8, !tbaa !5
  %81 = load i64, ptr %10, align 8, !tbaa !5
  %82 = getelementptr inbounds [2 x [5000 x i64]], ptr %6, i64 0, i64 0
  %83 = load i64, ptr %11, align 8, !tbaa !5
  %84 = getelementptr inbounds [5000 x i64], ptr %82, i64 0, i64 %83
  store i64 %81, ptr %84, align 8, !tbaa !5
  br label %85

85:                                               ; preds = %72
  %86 = load i64, ptr %11, align 8, !tbaa !5
  %87 = add nsw i64 %86, -1
  store i64 %87, ptr %11, align 8, !tbaa !5
  br label %68, !llvm.loop !18

88:                                               ; preds = %71
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  br label %89

89:                                               ; preds = %88, %63
  br label %90

90:                                               ; preds = %89
  %91 = load i64, ptr %8, align 8, !tbaa !5
  %92 = add nsw i64 %91, 1
  store i64 %92, ptr %8, align 8, !tbaa !5
  br label %43, !llvm.loop !19

93:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  store i64 0, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store i32 0, ptr %13, align 4, !tbaa !14
  br label %94

94:                                               ; preds = %110, %93
  %95 = load i32, ptr %13, align 4, !tbaa !14
  %96 = sext i32 %95 to i64
  %97 = load i64, ptr %2, align 8, !tbaa !5
  %98 = icmp slt i64 %96, %97
  br i1 %98, label %100, label %99

99:                                               ; preds = %94
  store i32 11, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %113

100:                                              ; preds = %94
  %101 = getelementptr inbounds [2 x [5000 x i64]], ptr %6, i64 0, i64 0
  %102 = load i32, ptr %13, align 4, !tbaa !14
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [5000 x i64], ptr %101, i64 0, i64 %103
  %105 = load i64, ptr %104, align 8, !tbaa !5
  %106 = load i64, ptr %12, align 8, !tbaa !5
  %107 = add nsw i64 %106, %105
  store i64 %107, ptr %12, align 8, !tbaa !5
  %108 = load i64, ptr %12, align 8, !tbaa !5
  %109 = srem i64 %108, 1000000007
  store i64 %109, ptr %12, align 8, !tbaa !5
  br label %110

110:                                              ; preds = %100
  %111 = load i32, ptr %13, align 4, !tbaa !14
  %112 = add nsw i32 %111, 1
  store i32 %112, ptr %13, align 4, !tbaa !14
  br label %94, !llvm.loop !20

113:                                              ; preds = %99
  %114 = load i64, ptr %12, align 8, !tbaa !5
  %115 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %114)
  %116 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %115, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 80000, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 5000, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #6
  %117 = load i32, ptr %1, align 4
  ret i32 %117
}

; 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)) #3 align 2

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 1 dereferenceable(1)) #4

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt4copyIPxS0_ET0_T_S2_S1_(ptr noundef, ptr noundef, ptr noundef) #5

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #3 align 2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #3 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

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 = { "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 = { 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 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"bool", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!15, !15, i64 0}
!15 = !{!"int", !7, i64 0}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = distinct !{!18, !13}
!19 = distinct !{!19, !13}
!20 = distinct !{!20, !13}


; 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 nounwind uwtable
declare dso_local void @_Z8pforwardRA5000_xx(ptr noundef nonnull align 8 dereferenceable(40000), i64 noundef) local_unnamed_addr #0

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = alloca i64, align 8
  %2 = alloca [5000 x i8], align 16
  %3 = alloca i8, align 1
  %4 = alloca [2 x [5000 x i64]], align 16
  %5 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #6
  %6 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %1)
  call void @llvm.lifetime.start.p0(i64 5000, ptr nonnull %2) #6
  %7 = load i64, ptr %1, align 8, !tbaa !5
  %8 = icmp sgt i64 %7, 0
  br i1 %8, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %0
  call void @llvm.lifetime.start.p0(i64 80000, ptr nonnull %4) #6
  %9 = getelementptr inbounds i8, ptr %4, i64 40000
  %10 = getelementptr inbounds i8, ptr %4, i64 80000
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #6
  store i32 0, ptr %5, align 4, !tbaa !9
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef nonnull %4, ptr noundef nonnull %10, ptr noundef nonnull align 4 dereferenceable(4) %5)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  store i64 1, ptr %4, align 16, !tbaa !5
  %11 = load i64, ptr %1, align 8, !tbaa !5
  %12 = icmp sgt i64 %11, 1
  br i1 %12, label %.lr.ph38, label %.preheader

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.02731 = phi i64 [ %17, %.lr.ph ], [ 0, %0 ]
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %3) #6
  %13 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 1 dereferenceable(1) %3)
  %14 = load i8, ptr %3, align 1, !tbaa !11
  %15 = icmp eq i8 %14, 102
  %spec.select = zext i1 %15 to i8
  %16 = getelementptr inbounds [5000 x i8], ptr %2, i64 0, i64 %.02731
  store i8 %spec.select, ptr %16, align 1
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %3) #6
  %17 = add nuw nsw i64 %.02731, 1
  %18 = load i64, ptr %1, align 8, !tbaa !5
  %19 = icmp slt i64 %17, %18
  br i1 %19, label %.lr.ph, label %._crit_edge, !llvm.loop !12

.preheader:                                       ; preds = %.loopexit, %._crit_edge
  %.lcssa = phi i64 [ %11, %._crit_edge ], [ %50, %.loopexit ]
  %20 = icmp sgt i64 %.lcssa, 0
  br i1 %20, label %.lr.ph41.preheader, label %._crit_edge42

.lr.ph41.preheader:                               ; preds = %.preheader
  %xtraiter53 = and i64 %.lcssa, 1
  %21 = icmp eq i64 %.lcssa, 1
  br i1 %21, label %._crit_edge42.loopexit.unr-lcssa, label %.lr.ph41.preheader.new

.lr.ph41.preheader.new:                           ; preds = %.lr.ph41.preheader
  %unroll_iter56 = and i64 %.lcssa, 9223372036854775806
  br label %.lr.ph41

.lr.ph38:                                         ; preds = %._crit_edge, %.loopexit
  %indvar = phi i64 [ %indvar.next, %.loopexit ], [ 0, %._crit_edge ]
  %22 = phi i64 [ %50, %.loopexit ], [ %11, %._crit_edge ]
  %.02635 = phi i64 [ %49, %.loopexit ], [ 1, %._crit_edge ]
  %23 = getelementptr inbounds i64, ptr %4, i64 %22
  %24 = call noundef ptr @_ZSt4copyIPxS0_ET0_T_S2_S1_(ptr noundef nonnull %4, ptr noundef nonnull %23, ptr noundef nonnull %9)
  %25 = add nsw i64 %.02635, -1
  %26 = getelementptr inbounds [5000 x i8], ptr %2, i64 0, i64 %25
  %27 = load i8, ptr %26, align 1, !tbaa !14, !range !16, !noundef !17
  %28 = trunc nuw i8 %27 to i1
  br i1 %28, label %31, label %.lr.ph34.preheader

.lr.ph34.preheader:                               ; preds = %.lr.ph38
  %xtraiter = and i64 %indvar, 1
  %29 = icmp eq i64 %indvar, -1
  br i1 %29, label %.loopexit.loopexit.unr-lcssa, label %.lr.ph34.preheader.new

.lr.ph34.preheader.new:                           ; preds = %.lr.ph34.preheader
  %30 = and i64 %indvar, -2
  br label %.lr.ph34

31:                                               ; preds = %.lr.ph38
  call void @_Z8pforwardRA5000_xx(ptr noundef nonnull align 8 dereferenceable(40000) %4, i64 noundef %.02635)
  br label %.loopexit

.lr.ph34:                                         ; preds = %.lr.ph34, %.lr.ph34.preheader.new
  %.02433 = phi i64 [ %.02635, %.lr.ph34.preheader.new ], [ %43, %.lr.ph34 ]
  %.02532 = phi i64 [ 0, %.lr.ph34.preheader.new ], [ %41, %.lr.ph34 ]
  %niter = phi i64 [ 0, %.lr.ph34.preheader.new ], [ %niter.next.1, %.lr.ph34 ]
  %32 = getelementptr inbounds [5000 x i64], ptr %9, i64 0, i64 %.02433
  %33 = load i64, ptr %32, align 8, !tbaa !5
  %34 = add nsw i64 %33, %.02532
  %35 = srem i64 %34, 1000000007
  %36 = getelementptr inbounds [5000 x i64], ptr %4, i64 0, i64 %.02433
  store i64 %35, ptr %36, align 8, !tbaa !5
  %37 = add nsw i64 %.02433, -1
  %38 = getelementptr inbounds [5000 x i64], ptr %9, i64 0, i64 %37
  %39 = load i64, ptr %38, align 8, !tbaa !5
  %40 = add nsw i64 %39, %35
  %41 = srem i64 %40, 1000000007
  %42 = getelementptr inbounds [5000 x i64], ptr %4, i64 0, i64 %37
  store i64 %41, ptr %42, align 8, !tbaa !5
  %43 = add nsw i64 %.02433, -2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1.not = icmp eq i64 %niter, %30
  br i1 %niter.ncmp.1.not, label %.loopexit.loopexit.unr-lcssa, label %.lr.ph34, !llvm.loop !18

.loopexit.loopexit.unr-lcssa:                     ; preds = %.lr.ph34, %.lr.ph34.preheader
  %.02433.unr = phi i64 [ %.02635, %.lr.ph34.preheader ], [ %43, %.lr.ph34 ]
  %.02532.unr = phi i64 [ 0, %.lr.ph34.preheader ], [ %41, %.lr.ph34 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.loopexit, label %.lr.ph34.epil

.lr.ph34.epil:                                    ; preds = %.loopexit.loopexit.unr-lcssa
  %44 = getelementptr inbounds [5000 x i64], ptr %9, i64 0, i64 %.02433.unr
  %45 = load i64, ptr %44, align 8, !tbaa !5
  %46 = add nsw i64 %45, %.02532.unr
  %47 = srem i64 %46, 1000000007
  %48 = getelementptr inbounds [5000 x i64], ptr %4, i64 0, i64 %.02433.unr
  store i64 %47, ptr %48, align 8, !tbaa !5
  br label %.loopexit

.loopexit:                                        ; preds = %.lr.ph34.epil, %.loopexit.loopexit.unr-lcssa, %31
  %49 = add nuw nsw i64 %.02635, 1
  %50 = load i64, ptr %1, align 8, !tbaa !5
  %51 = icmp slt i64 %49, %50
  %indvar.next = add i64 %indvar, 1
  br i1 %51, label %.lr.ph38, label %.preheader, !llvm.loop !19

._crit_edge42.loopexit.unr-lcssa:                 ; preds = %.lr.ph41, %.lr.ph41.preheader
  %.lcssa51.ph = phi i64 [ poison, %.lr.ph41.preheader ], [ %65, %.lr.ph41 ]
  %indvars.iv.unr = phi i64 [ 0, %.lr.ph41.preheader ], [ %indvars.iv.next.1, %.lr.ph41 ]
  %.02339.unr = phi i64 [ 0, %.lr.ph41.preheader ], [ %65, %.lr.ph41 ]
  %lcmp.mod54.not = icmp eq i64 %xtraiter53, 0
  br i1 %lcmp.mod54.not, label %._crit_edge42, label %.lr.ph41.epil

.lr.ph41.epil:                                    ; preds = %._crit_edge42.loopexit.unr-lcssa
  %52 = getelementptr inbounds [5000 x i64], ptr %4, i64 0, i64 %indvars.iv.unr
  %53 = load i64, ptr %52, align 8, !tbaa !5
  %54 = add nsw i64 %53, %.02339.unr
  %55 = srem i64 %54, 1000000007
  br label %._crit_edge42

._crit_edge42:                                    ; preds = %.lr.ph41.epil, %._crit_edge42.loopexit.unr-lcssa, %.preheader
  %.023.lcssa = phi i64 [ 0, %.preheader ], [ %.lcssa51.ph, %._crit_edge42.loopexit.unr-lcssa ], [ %55, %.lr.ph41.epil ]
  %56 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.023.lcssa)
  %57 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %56, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 80000, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 5000, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #6
  ret i32 0

.lr.ph41:                                         ; preds = %.lr.ph41, %.lr.ph41.preheader.new
  %indvars.iv = phi i64 [ 0, %.lr.ph41.preheader.new ], [ %indvars.iv.next.1, %.lr.ph41 ]
  %.02339 = phi i64 [ 0, %.lr.ph41.preheader.new ], [ %65, %.lr.ph41 ]
  %niter57 = phi i64 [ 0, %.lr.ph41.preheader.new ], [ %niter57.next.1, %.lr.ph41 ]
  %58 = getelementptr inbounds [5000 x i64], ptr %4, i64 0, i64 %indvars.iv
  %59 = load i64, ptr %58, align 16, !tbaa !5
  %60 = add nsw i64 %59, %.02339
  %61 = srem i64 %60, 1000000007
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %62 = getelementptr inbounds [5000 x i64], ptr %4, i64 0, i64 %indvars.iv.next
  %63 = load i64, ptr %62, align 8, !tbaa !5
  %64 = add nsw i64 %63, %61
  %65 = srem i64 %64, 1000000007
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %niter57.next.1 = add i64 %niter57, 2
  %niter57.ncmp.1 = icmp eq i64 %niter57.next.1, %unroll_iter56
  br i1 %niter57.ncmp.1, label %._crit_edge42.loopexit.unr-lcssa, label %.lr.ph41, !llvm.loop !20
}

; 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 #3 align 2

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #4

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt4copyIPxS0_ET0_T_S2_S1_(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #5

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) local_unnamed_addr #3 align 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 #3 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

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 = { "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 = { 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 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!15, !15, i64 0}
!15 = !{!"bool", !7, i64 0}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = distinct !{!18, !13}
!19 = distinct !{!19, !13}
!20 = distinct !{!20, !13}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,MergedLoadStoreMotionPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass