; LLVM IR from eyangch/competitive-programming :: Codeforces/1629 (f1)

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

@MOD = external dso_local global i64, align 8
@m2 = external dso_local global i64, align 8
@T = external dso_local global i64, align 8
@N = external dso_local global i64, align 8
@M = external dso_local global i64, align 8
@K = external dso_local global i64, align 8
@dp = external dso_local global [2001 x [2001 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 norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  %9 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %10 = getelementptr i8, ptr %9, i64 -24
  %11 = load i64, ptr %10, align 8
  %12 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %11
  %13 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %12, ptr noundef null)
  %14 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %15 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @T)
  br label %16

16:                                               ; preds = %98, %0
  %17 = load i64, ptr @T, align 8, !tbaa !8
  %18 = add nsw i64 %17, -1
  store i64 %18, ptr @T, align 8, !tbaa !8
  %19 = icmp ne i64 %17, 0
  br i1 %19, label %20, label %106

20:                                               ; preds = %16
  %21 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @N)
  %22 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %21, ptr noundef nonnull align 8 dereferenceable(8) @M)
  %23 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %22, ptr noundef nonnull align 8 dereferenceable(8) @K)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #6
  %24 = load i64, ptr @M, align 8, !tbaa !8
  store i64 %24, ptr %2, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #6
  %25 = load i64, ptr @N, align 8, !tbaa !8
  %26 = load i64, ptr @M, align 8, !tbaa !8
  %27 = sub nsw i64 %25, %26
  store i64 %27, ptr %3, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  store i64 0, ptr %4, align 8, !tbaa !8
  br label %28

28:                                               ; preds = %42, %20
  %29 = load i64, ptr %4, align 8, !tbaa !8
  %30 = load i64, ptr %2, align 8, !tbaa !8
  %31 = icmp sle i64 %29, %30
  br i1 %31, label %33, label %32

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

33:                                               ; preds = %28
  %34 = load i64, ptr %4, align 8, !tbaa !8
  %35 = load i64, ptr @K, align 8, !tbaa !8
  %36 = mul nsw i64 %34, %35
  %37 = load i64, ptr @MOD, align 8, !tbaa !8
  %38 = srem i64 %36, %37
  %39 = load i64, ptr %4, align 8, !tbaa !8
  %40 = getelementptr inbounds [2001 x [2001 x i64]], ptr @dp, i64 0, i64 %39
  %41 = getelementptr inbounds [2001 x i64], ptr %40, i64 0, i64 0
  store i64 %38, ptr %41, align 8, !tbaa !8
  br label %42

42:                                               ; preds = %33
  %43 = load i64, ptr %4, align 8, !tbaa !8
  %44 = add nsw i64 %43, 1
  store i64 %44, ptr %4, align 8, !tbaa !8
  br label %28, !llvm.loop !11

45:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  store i64 0, ptr %5, align 8, !tbaa !8
  br label %46

46:                                               ; preds = %54, %45
  %47 = load i64, ptr %5, align 8, !tbaa !8
  %48 = load i64, ptr %3, align 8, !tbaa !8
  %49 = icmp sle i64 %47, %48
  br i1 %49, label %51, label %50

50:                                               ; preds = %46
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  br label %57

51:                                               ; preds = %46
  %52 = load i64, ptr %5, align 8, !tbaa !8
  %53 = getelementptr inbounds [2001 x i64], ptr @dp, i64 0, i64 %52
  store i64 0, ptr %53, align 8, !tbaa !8
  br label %54

54:                                               ; preds = %51
  %55 = load i64, ptr %5, align 8, !tbaa !8
  %56 = add nsw i64 %55, 1
  store i64 %56, ptr %5, align 8, !tbaa !8
  br label %46, !llvm.loop !13

57:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  store i64 1, ptr %6, align 8, !tbaa !8
  br label %58

58:                                               ; preds = %95, %57
  %59 = load i64, ptr %6, align 8, !tbaa !8
  %60 = load i64, ptr %2, align 8, !tbaa !8
  %61 = icmp sle i64 %59, %60
  br i1 %61, label %63, label %62

62:                                               ; preds = %58
  store i32 10, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  br label %98

63:                                               ; preds = %58
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  store i64 1, ptr %8, align 8, !tbaa !8
  br label %64

64:                                               ; preds = %91, %63
  %65 = load i64, ptr %8, align 8, !tbaa !8
  %66 = load i64, ptr %3, align 8, !tbaa !8
  %67 = icmp sle i64 %65, %66
  br i1 %67, label %69, label %68

68:                                               ; preds = %64
  store i32 13, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  br label %94

69:                                               ; preds = %64
  %70 = load i64, ptr %6, align 8, !tbaa !8
  %71 = sub nsw i64 %70, 1
  %72 = getelementptr inbounds [2001 x [2001 x i64]], ptr @dp, i64 0, i64 %71
  %73 = load i64, ptr %8, align 8, !tbaa !8
  %74 = getelementptr inbounds [2001 x i64], ptr %72, i64 0, i64 %73
  %75 = load i64, ptr %74, align 8, !tbaa !8
  %76 = load i64, ptr %6, align 8, !tbaa !8
  %77 = getelementptr inbounds [2001 x [2001 x i64]], ptr @dp, i64 0, i64 %76
  %78 = load i64, ptr %8, align 8, !tbaa !8
  %79 = sub nsw i64 %78, 1
  %80 = getelementptr inbounds [2001 x i64], ptr %77, i64 0, i64 %79
  %81 = load i64, ptr %80, align 8, !tbaa !8
  %82 = add nsw i64 %75, %81
  %83 = load i64, ptr @m2, align 8, !tbaa !8
  %84 = mul nsw i64 %82, %83
  %85 = load i64, ptr @MOD, align 8, !tbaa !8
  %86 = srem i64 %84, %85
  %87 = load i64, ptr %6, align 8, !tbaa !8
  %88 = getelementptr inbounds [2001 x [2001 x i64]], ptr @dp, i64 0, i64 %87
  %89 = load i64, ptr %8, align 8, !tbaa !8
  %90 = getelementptr inbounds [2001 x i64], ptr %88, i64 0, i64 %89
  store i64 %86, ptr %90, align 8, !tbaa !8
  br label %91

91:                                               ; preds = %69
  %92 = load i64, ptr %8, align 8, !tbaa !8
  %93 = add nsw i64 %92, 1
  store i64 %93, ptr %8, align 8, !tbaa !8
  br label %64, !llvm.loop !14

94:                                               ; preds = %68
  br label %95

95:                                               ; preds = %94
  %96 = load i64, ptr %6, align 8, !tbaa !8
  %97 = add nsw i64 %96, 1
  store i64 %97, ptr %6, align 8, !tbaa !8
  br label %58, !llvm.loop !15

98:                                               ; preds = %62
  %99 = load i64, ptr %2, align 8, !tbaa !8
  %100 = getelementptr inbounds [2001 x [2001 x i64]], ptr @dp, i64 0, i64 %99
  %101 = load i64, ptr %3, align 8, !tbaa !8
  %102 = getelementptr inbounds [2001 x i64], ptr %100, i64 0, i64 %101
  %103 = load i64, ptr %102, align 8, !tbaa !8
  %104 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %103)
  %105 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %104, i8 noundef signext 10)
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #6
  br label %16, !llvm.loop !16

106:                                              ; preds = %16
  %107 = load i32, ptr %1, align 4
  ret i32 %107
}

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) #1 align 2

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) #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)) #3 align 2

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

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

; 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) #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

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 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { "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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"long long", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !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" }

@MOD = external dso_local local_unnamed_addr global i64, align 8
@m2 = external dso_local local_unnamed_addr global i64, align 8
@T = external dso_local global i64, align 8
@N = external dso_local global i64, align 8
@M = external dso_local global i64, align 8
@K = external dso_local global i64, align 8
@dp = external dso_local local_unnamed_addr global [2001 x [2001 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 norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %2 = getelementptr i8, ptr %1, i64 -24
  %3 = load i64, ptr %2, align 8
  %4 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %3
  %5 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %4, ptr noundef null)
  %6 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %7 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @T)
  %8 = load i64, ptr @T, align 8, !tbaa !8
  %9 = add nsw i64 %8, -1
  store i64 %9, ptr @T, align 8, !tbaa !8
  %.not46 = icmp eq i64 %8, 0
  br i1 %.not46, label %._crit_edge49, label %.lr.ph48

.lr.ph48:                                         ; preds = %0, %._crit_edge45
  %10 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @N)
  %11 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %10, ptr noundef nonnull align 8 dereferenceable(8) @M)
  %12 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %11, ptr noundef nonnull align 8 dereferenceable(8) @K)
  %13 = load i64, ptr @M, align 8, !tbaa !8
  %14 = load i64, ptr @N, align 8, !tbaa !8
  %15 = sub i64 %14, %13
  %.not2935 = icmp slt i64 %13, 0
  br i1 %.not2935, label %.preheader34, label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph48
  %16 = load i64, ptr @K, align 8, !tbaa !8
  %17 = load i64, ptr @MOD, align 8, !tbaa !8
  %18 = icmp eq i64 %13, 0
  br i1 %18, label %.preheader34.loopexit.unr-lcssa, label %.lr.ph.new

.lr.ph.new:                                       ; preds = %.lr.ph
  %19 = add nuw i64 %13, 1
  %unroll_iter = and i64 %19, -2
  br label %27

.preheader34.loopexit.unr-lcssa:                  ; preds = %27, %.lr.ph
  %.02636.unr = phi i64 [ 0, %.lr.ph ], [ %35, %27 ]
  %20 = and i64 %13, 1
  %lcmp.mod.not.not = icmp eq i64 %20, 0
  br i1 %lcmp.mod.not.not, label %.preheader34.loopexit.epilog-lcssa, label %.preheader34

.preheader34.loopexit.epilog-lcssa:               ; preds = %.preheader34.loopexit.unr-lcssa
  %21 = mul nsw i64 %16, %.02636.unr
  %22 = srem i64 %21, %17
  %23 = getelementptr inbounds [2001 x [2001 x i64]], ptr @dp, i64 0, i64 %.02636.unr
  store i64 %22, ptr %23, align 8, !tbaa !8
  br label %.preheader34

.preheader34:                                     ; preds = %.preheader34.loopexit.epilog-lcssa, %.preheader34.loopexit.unr-lcssa, %.lr.ph48
  %.not3037 = icmp slt i64 %15, 0
  br i1 %.not3037, label %.preheader33, label %.lr.ph39.preheader

.lr.ph39.preheader:                               ; preds = %.preheader34
  %24 = add i64 %14, 1
  %25 = sub i64 %24, %13
  %26 = shl nuw i64 %25, 3
  tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @dp, i8 0, i64 %26, i1 false), !tbaa !8
  br label %.preheader33

27:                                               ; preds = %27, %.lr.ph.new
  %.02636 = phi i64 [ 0, %.lr.ph.new ], [ %35, %27 ]
  %niter = phi i64 [ 0, %.lr.ph.new ], [ %niter.next.1, %27 ]
  %28 = mul nsw i64 %16, %.02636
  %29 = srem i64 %28, %17
  %30 = getelementptr inbounds [2001 x [2001 x i64]], ptr @dp, i64 0, i64 %.02636
  store i64 %29, ptr %30, align 16, !tbaa !8
  %31 = or disjoint i64 %.02636, 1
  %32 = mul nsw i64 %16, %31
  %33 = srem i64 %32, %17
  %34 = getelementptr inbounds [2001 x [2001 x i64]], ptr @dp, i64 0, i64 %31
  store i64 %33, ptr %34, align 8, !tbaa !8
  %35 = add nuw i64 %.02636, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %.preheader34.loopexit.unr-lcssa, label %27, !llvm.loop !11

.preheader33:                                     ; preds = %.lr.ph39.preheader, %.preheader34
  %.not3143 = icmp slt i64 %13, 1
  br i1 %.not3143, label %._crit_edge45, label %.preheader.lr.ph

.preheader.lr.ph:                                 ; preds = %.preheader33
  %.not3240 = icmp slt i64 %15, 1
  %36 = load i64, ptr @m2, align 8
  %37 = load i64, ptr @MOD, align 8
  br i1 %.not3240, label %._crit_edge45, label %.preheader.preheader

.preheader.preheader:                             ; preds = %.preheader.lr.ph
  %.neg = add nuw i64 %13, 1
  %xtraiter54 = and i64 %15, 1
  %38 = icmp eq i64 %14, %.neg
  %unroll_iter56 = and i64 %15, 9223372036854775806
  %lcmp.mod55.not = icmp eq i64 %xtraiter54, 0
  br label %.preheader

.preheader:                                       ; preds = %.preheader.preheader, %._crit_edge
  %.02444 = phi i64 [ %52, %._crit_edge ], [ 1, %.preheader.preheader ]
  %39 = add nsw i64 %.02444, -1
  %.phi.trans.insert = getelementptr inbounds [2001 x [2001 x i64]], ptr @dp, i64 0, i64 %.02444, i64 0
  %.pre = load i64, ptr %.phi.trans.insert, align 8, !tbaa !8
  br i1 %38, label %._crit_edge.unr-lcssa, label %.preheader.new

._crit_edge45:                                    ; preds = %._crit_edge, %.preheader.lr.ph, %.preheader33
  %40 = getelementptr inbounds [2001 x [2001 x i64]], ptr @dp, i64 0, i64 %13, i64 %15
  %41 = load i64, ptr %40, align 8, !tbaa !8
  %42 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %41)
  %43 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %42, i8 noundef signext 10)
  %44 = load i64, ptr @T, align 8, !tbaa !8
  %45 = add nsw i64 %44, -1
  store i64 %45, ptr @T, align 8, !tbaa !8
  %.not = icmp eq i64 %44, 0
  br i1 %.not, label %._crit_edge49, label %.lr.ph48, !llvm.loop !13

._crit_edge.unr-lcssa:                            ; preds = %.preheader.new, %.preheader
  %.unr = phi i64 [ %.pre, %.preheader ], [ %65, %.preheader.new ]
  %.041.unr = phi i64 [ 1, %.preheader ], [ %67, %.preheader.new ]
  br i1 %lcmp.mod55.not, label %._crit_edge, label %._crit_edge.epilog-lcssa

._crit_edge.epilog-lcssa:                         ; preds = %._crit_edge.unr-lcssa
  %46 = getelementptr inbounds [2001 x [2001 x i64]], ptr @dp, i64 0, i64 %39, i64 %.041.unr
  %47 = load i64, ptr %46, align 8, !tbaa !8
  %48 = add nsw i64 %.unr, %47
  %49 = mul nsw i64 %48, %36
  %50 = srem i64 %49, %37
  %51 = getelementptr inbounds [2001 x [2001 x i64]], ptr @dp, i64 0, i64 %.02444, i64 %.041.unr
  store i64 %50, ptr %51, align 8, !tbaa !8
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.unr-lcssa, %._crit_edge.epilog-lcssa
  %52 = add nuw i64 %.02444, 1
  %exitcond52.not = icmp eq i64 %.02444, %13
  br i1 %exitcond52.not, label %._crit_edge45, label %.preheader, !llvm.loop !14

.preheader.new:                                   ; preds = %.preheader, %.preheader.new
  %53 = phi i64 [ %65, %.preheader.new ], [ %.pre, %.preheader ]
  %.041 = phi i64 [ %67, %.preheader.new ], [ 1, %.preheader ]
  %niter57 = phi i64 [ %niter57.next.1, %.preheader.new ], [ 0, %.preheader ]
  %54 = getelementptr inbounds [2001 x [2001 x i64]], ptr @dp, i64 0, i64 %39, i64 %.041
  %55 = load i64, ptr %54, align 8, !tbaa !8
  %56 = add nsw i64 %53, %55
  %57 = mul nsw i64 %56, %36
  %58 = srem i64 %57, %37
  %59 = getelementptr inbounds [2001 x [2001 x i64]], ptr @dp, i64 0, i64 %.02444, i64 %.041
  store i64 %58, ptr %59, align 8, !tbaa !8
  %60 = add nuw i64 %.041, 1
  %61 = getelementptr inbounds [2001 x [2001 x i64]], ptr @dp, i64 0, i64 %39, i64 %60
  %62 = load i64, ptr %61, align 8, !tbaa !8
  %63 = add nsw i64 %58, %62
  %64 = mul nsw i64 %63, %36
  %65 = srem i64 %64, %37
  %66 = getelementptr inbounds [2001 x [2001 x i64]], ptr @dp, i64 0, i64 %.02444, i64 %60
  store i64 %65, ptr %66, align 8, !tbaa !8
  %67 = add nuw i64 %.041, 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_edge.unr-lcssa, label %.preheader.new, !llvm.loop !15

._crit_edge49:                                    ; preds = %._crit_edge45, %0
  ret i32 0
}

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) local_unnamed_addr #1 align 2

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) 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 #3 align 2

; 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 #4

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

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 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { "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 = { 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 #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }

!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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"long long", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}


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