; LLVM IR from kazunetakahashi/atcoder :: 2019/0217_nikkei2019-final (E3)

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

@p = external dso_local global [100010 x i64], align 16
@N = external dso_local global i64, align 8
@K = external dso_local global i64, align 8
@DP = external dso_local global [5010 x [5010 x i64]], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cerr = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z5powerx(i64 noundef) #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 i64, align 8
  %5 = alloca i32, align 4
  %6 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  store i64 1, ptr @p, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 1, ptr %2, align 4, !tbaa !9
  br label %7

7:                                                ; preds = %22, %0
  %8 = load i32, ptr %2, align 4, !tbaa !9
  %9 = icmp slt i32 %8, 100010
  br i1 %9, label %11, label %10

10:                                               ; preds = %7
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  br label %25

11:                                               ; preds = %7
  %12 = load i32, ptr %2, align 4, !tbaa !9
  %13 = sub nsw i32 %12, 1
  %14 = sext i32 %13 to i64
  %15 = getelementptr inbounds [100010 x i64], ptr @p, i64 0, i64 %14
  %16 = load i64, ptr %15, align 8, !tbaa !5
  %17 = mul nsw i64 %16, 2
  %18 = srem i64 %17, 1000000007
  %19 = load i32, ptr %2, align 4, !tbaa !9
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [100010 x i64], ptr @p, i64 0, i64 %20
  store i64 %18, ptr %21, align 8, !tbaa !5
  br label %22

22:                                               ; preds = %11
  %23 = load i32, ptr %2, align 4, !tbaa !9
  %24 = add nsw i32 %23, 1
  store i32 %24, ptr %2, align 4, !tbaa !9
  br label %7, !llvm.loop !11

25:                                               ; preds = %10
  %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) @N)
  %27 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %26, ptr noundef nonnull align 8 dereferenceable(8) @K)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 0, ptr %3, align 4, !tbaa !9
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef @DP, ptr noundef getelementptr inbounds (i64, ptr @DP, i64 25100100), ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  store i64 1, ptr @DP, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  store i64 0, ptr %4, align 8, !tbaa !5
  br label %28

28:                                               ; preds = %126, %25
  %29 = load i64, ptr %4, align 8, !tbaa !5
  %30 = load i64, ptr @N, align 8, !tbaa !5
  %31 = icmp slt i64 %29, %30
  br i1 %31, label %33, label %32

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

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

34:                                               ; preds = %122, %33
  %35 = load i64, ptr %6, align 8, !tbaa !5
  %36 = load i64, ptr %4, align 8, !tbaa !5
  %37 = icmp sle i64 %35, %36
  br i1 %37, label %39, label %38

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

39:                                               ; preds = %34
  %40 = load i64, ptr @N, align 8, !tbaa !5
  %41 = icmp slt i64 %40, 100
  br i1 %41, label %42, label %57

42:                                               ; preds = %39
  %43 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cerr, ptr noundef @.str)
  %44 = load i64, ptr %6, align 8, !tbaa !5
  %45 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) %43, i64 noundef %44)
  %46 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %45, ptr noundef @.str.1)
  %47 = load i64, ptr %4, align 8, !tbaa !5
  %48 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) %46, i64 noundef %47)
  %49 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %48, ptr noundef @.str.2)
  %50 = load i64, ptr %6, align 8, !tbaa !5
  %51 = getelementptr inbounds [5010 x [5010 x i64]], ptr @DP, i64 0, i64 %50
  %52 = load i64, ptr %4, align 8, !tbaa !5
  %53 = getelementptr inbounds [5010 x i64], ptr %51, i64 0, i64 %52
  %54 = load i64, ptr %53, align 8, !tbaa !5
  %55 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) %49, i64 noundef %54)
  %56 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %55, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %57

57:                                               ; preds = %42, %39
  %58 = load i64, ptr %6, align 8, !tbaa !5
  %59 = getelementptr inbounds [5010 x [5010 x i64]], ptr @DP, i64 0, i64 %58
  %60 = load i64, ptr %4, align 8, !tbaa !5
  %61 = getelementptr inbounds [5010 x i64], ptr %59, i64 0, i64 %60
  %62 = load i64, ptr %61, align 8, !tbaa !5
  %63 = load i64, ptr %4, align 8, !tbaa !5
  %64 = load i64, ptr %6, align 8, !tbaa !5
  %65 = sub nsw i64 %63, %64
  %66 = load i64, ptr @K, align 8, !tbaa !5
  %67 = sub nsw i64 %65, %66
  %68 = call noundef i64 @_Z5powerx(i64 noundef %67)
  %69 = mul nsw i64 %62, %68
  %70 = srem i64 %69, 1000000007
  %71 = load i64, ptr %6, align 8, !tbaa !5
  %72 = getelementptr inbounds [5010 x [5010 x i64]], ptr @DP, i64 0, i64 %71
  %73 = load i64, ptr %4, align 8, !tbaa !5
  %74 = add nsw i64 %73, 1
  %75 = getelementptr inbounds [5010 x i64], ptr %72, i64 0, i64 %74
  %76 = load i64, ptr %75, align 8, !tbaa !5
  %77 = add nsw i64 %76, %70
  store i64 %77, ptr %75, align 8, !tbaa !5
  %78 = load i64, ptr %6, align 8, !tbaa !5
  %79 = getelementptr inbounds [5010 x [5010 x i64]], ptr @DP, i64 0, i64 %78
  %80 = load i64, ptr %4, align 8, !tbaa !5
  %81 = add nsw i64 %80, 1
  %82 = getelementptr inbounds [5010 x i64], ptr %79, i64 0, i64 %81
  %83 = load i64, ptr %82, align 8, !tbaa !5
  %84 = srem i64 %83, 1000000007
  store i64 %84, ptr %82, align 8, !tbaa !5
  %85 = load i64, ptr %6, align 8, !tbaa !5
  %86 = getelementptr inbounds [5010 x [5010 x i64]], ptr @DP, i64 0, i64 %85
  %87 = load i64, ptr %4, align 8, !tbaa !5
  %88 = getelementptr inbounds [5010 x i64], ptr %86, i64 0, i64 %87
  %89 = load i64, ptr %88, align 8, !tbaa !5
  %90 = load i64, ptr %4, align 8, !tbaa !5
  %91 = add nsw i64 %90, 1
  %92 = load i64, ptr @K, align 8, !tbaa !5
  %93 = sub nsw i64 %91, %92
  %94 = call noundef i64 @_Z5powerx(i64 noundef %93)
  %95 = add nsw i64 %94, 1000000007
  %96 = load i64, ptr %4, align 8, !tbaa !5
  %97 = load i64, ptr %6, align 8, !tbaa !5
  %98 = sub nsw i64 %96, %97
  %99 = load i64, ptr @K, align 8, !tbaa !5
  %100 = sub nsw i64 %98, %99
  %101 = call noundef i64 @_Z5powerx(i64 noundef %100)
  %102 = sub nsw i64 %95, %101
  %103 = mul nsw i64 %89, %102
  %104 = srem i64 %103, 1000000007
  %105 = srem i64 %104, 1000000007
  %106 = load i64, ptr %4, align 8, !tbaa !5
  %107 = add nsw i64 %106, 1
  %108 = getelementptr inbounds [5010 x [5010 x i64]], ptr @DP, i64 0, i64 %107
  %109 = load i64, ptr %4, align 8, !tbaa !5
  %110 = add nsw i64 %109, 1
  %111 = getelementptr inbounds [5010 x i64], ptr %108, i64 0, i64 %110
  %112 = load i64, ptr %111, align 8, !tbaa !5
  %113 = add nsw i64 %112, %105
  store i64 %113, ptr %111, align 8, !tbaa !5
  %114 = load i64, ptr %4, align 8, !tbaa !5
  %115 = add nsw i64 %114, 1
  %116 = getelementptr inbounds [5010 x [5010 x i64]], ptr @DP, i64 0, i64 %115
  %117 = load i64, ptr %4, align 8, !tbaa !5
  %118 = add nsw i64 %117, 1
  %119 = getelementptr inbounds [5010 x i64], ptr %116, i64 0, i64 %118
  %120 = load i64, ptr %119, align 8, !tbaa !5
  %121 = srem i64 %120, 1000000007
  store i64 %121, ptr %119, align 8, !tbaa !5
  br label %122

122:                                              ; preds = %57
  %123 = load i64, ptr %6, align 8, !tbaa !5
  %124 = add nsw i64 %123, 1
  store i64 %124, ptr %6, align 8, !tbaa !5
  br label %34, !llvm.loop !13

125:                                              ; preds = %38
  br label %126

126:                                              ; preds = %125
  %127 = load i64, ptr %4, align 8, !tbaa !5
  %128 = add nsw i64 %127, 1
  store i64 %128, ptr %4, align 8, !tbaa !5
  br label %28, !llvm.loop !14

129:                                              ; preds = %32
  %130 = load i64, ptr @N, align 8, !tbaa !5
  %131 = getelementptr inbounds [5010 x [5010 x i64]], ptr @DP, i64 0, i64 %130
  %132 = load i64, ptr @N, align 8, !tbaa !5
  %133 = getelementptr inbounds [5010 x i64], ptr %131, i64 0, i64 %132
  %134 = load i64, ptr %133, align 8, !tbaa !5
  %135 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %134)
  %136 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %135, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %137 = load i32, ptr %1, align 4
  ret i32 %137
}

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

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

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

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

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 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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" }

@p = external dso_local local_unnamed_addr global [100010 x i64], align 16
@N = external dso_local global i64, align 8
@K = external dso_local global i64, align 8
@DP = external dso_local global [5010 x [5010 x i64]], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cerr = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z5powerx(i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = alloca i32, align 4
  store i64 1, ptr @p, align 16, !tbaa !5
  br label %7

2:                                                ; preds = %7
  %3 = 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)
  %4 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 8 dereferenceable(8) @K)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  store i32 0, ptr %1, align 4, !tbaa !9
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef nonnull @DP, ptr noundef nonnull getelementptr inbounds (i8, ptr @DP, i64 200800800), ptr noundef nonnull align 4 dereferenceable(4) %1)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  store i64 1, ptr @DP, align 16, !tbaa !5
  %5 = load i64, ptr @N, align 8, !tbaa !5
  %6 = icmp sgt i64 %5, 0
  br i1 %6, label %.preheader, label %._crit_edge

7:                                                ; preds = %12, %0
  %8 = phi i64 [ 1, %0 ], [ %14, %12 ]
  %indvars.iv = phi i64 [ 1, %0 ], [ %indvars.iv.next.1, %12 ]
  %9 = shl nsw i64 %8, 1
  %10 = srem i64 %9, 1000000007
  %11 = getelementptr inbounds [100010 x i64], ptr @p, i64 0, i64 %indvars.iv
  store i64 %10, ptr %11, align 8, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 100010
  br i1 %exitcond.not, label %2, label %12, !llvm.loop !11

12:                                               ; preds = %7
  %13 = shl nsw i64 %10, 1
  %14 = srem i64 %13, 1000000007
  %15 = getelementptr inbounds [100010 x i64], ptr @p, i64 0, i64 %indvars.iv.next
  store i64 %14, ptr %15, align 8, !tbaa !5
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  br label %7

.preheader:                                       ; preds = %2, %22
  %indvars.iv39 = phi i64 [ %indvars.iv.next40, %22 ], [ 1, %2 ]
  %.03136 = phi i64 [ %16, %22 ], [ 0, %2 ]
  %16 = add nuw nsw i64 %.03136, 1
  %17 = getelementptr inbounds [5010 x [5010 x i64]], ptr @DP, i64 0, i64 %16, i64 %16
  br label %25

._crit_edge:                                      ; preds = %22, %2
  %.lcssa = phi i64 [ %5, %2 ], [ %23, %22 ]
  %18 = getelementptr inbounds [5010 x [5010 x i64]], ptr @DP, i64 0, i64 %.lcssa, i64 %.lcssa
  %19 = load i64, ptr %18, align 8, !tbaa !5
  %20 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %19)
  %21 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %20, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  ret i32 0

22:                                               ; preds = %38
  %23 = load i64, ptr @N, align 8, !tbaa !5
  %24 = icmp slt i64 %16, %23
  %indvars.iv.next40 = add nuw i64 %indvars.iv39, 1
  br i1 %24, label %.preheader, label %._crit_edge, !llvm.loop !13

25:                                               ; preds = %.preheader, %38
  %.035 = phi i64 [ 0, %.preheader ], [ %65, %38 ]
  %26 = load i64, ptr @N, align 8, !tbaa !5
  %27 = icmp slt i64 %26, 100
  br i1 %27, label %28, label %38

28:                                               ; preds = %25
  %29 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cerr, ptr noundef nonnull @.str)
  %30 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) %29, i64 noundef %.035)
  %31 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %30, ptr noundef nonnull @.str.1)
  %32 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) %31, i64 noundef %.03136)
  %33 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %32, ptr noundef nonnull @.str.2)
  %34 = getelementptr inbounds [5010 x [5010 x i64]], ptr @DP, i64 0, i64 %.035, i64 %.03136
  %35 = load i64, ptr %34, align 8, !tbaa !5
  %36 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) %33, i64 noundef %35)
  %37 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %36, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %38

38:                                               ; preds = %28, %25
  %39 = getelementptr inbounds [5010 x [5010 x i64]], ptr @DP, i64 0, i64 %.035, i64 %.03136
  %40 = load i64, ptr %39, align 8, !tbaa !5
  %41 = sub nsw i64 %.03136, %.035
  %42 = load i64, ptr @K, align 8, !tbaa !5
  %43 = sub nsw i64 %41, %42
  %44 = call noundef i64 @_Z5powerx(i64 noundef %43)
  %45 = mul nsw i64 %44, %40
  %46 = srem i64 %45, 1000000007
  %47 = getelementptr inbounds [5010 x [5010 x i64]], ptr @DP, i64 0, i64 %.035, i64 %16
  %48 = load i64, ptr %47, align 8, !tbaa !5
  %49 = add nsw i64 %46, %48
  %50 = srem i64 %49, 1000000007
  store i64 %50, ptr %47, align 8, !tbaa !5
  %51 = load i64, ptr %39, align 8, !tbaa !5
  %52 = load i64, ptr @K, align 8, !tbaa !5
  %53 = sub nsw i64 %16, %52
  %54 = call noundef i64 @_Z5powerx(i64 noundef %53)
  %55 = add nsw i64 %54, 1000000007
  %56 = load i64, ptr @K, align 8, !tbaa !5
  %57 = sub nsw i64 %41, %56
  %58 = call noundef i64 @_Z5powerx(i64 noundef %57)
  %59 = sub i64 %55, %58
  %60 = mul nsw i64 %59, %51
  %61 = srem i64 %60, 1000000007
  %62 = load i64, ptr %17, align 8, !tbaa !5
  %63 = add nsw i64 %61, %62
  %64 = srem i64 %63, 1000000007
  store i64 %64, ptr %17, align 8, !tbaa !5
  %65 = add nuw nsw i64 %.035, 1
  %exitcond41.not = icmp eq i64 %65, %indvars.iv39
  br i1 %exitcond41.not, label %22, label %25, !llvm.loop !14
}

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

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

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

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 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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}


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