; LLVM IR from abeaumont/competitive-programming :: atcoder/dp (t)

; 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" }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }

@dp = external dso_local global [3001 x [3001 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 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca %"class.std::__cxx11::basic_string", align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  %11 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %12 = getelementptr i8, ptr %11, i64 -24
  %13 = load i64, ptr %12, align 8
  %14 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %13
  %15 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %14, ptr noundef null)
  %16 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr %3) #6
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #6
  %17 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
          to label %18 unwind label %26

18:                                               ; preds = %0
  %19 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) %17, ptr noundef nonnull align 8 dereferenceable(32) %3)
          to label %20 unwind label %26

20:                                               ; preds = %18
  store i64 1, ptr getelementptr inbounds ([3001 x i64], ptr getelementptr inbounds ([3001 x [3001 x i64]], ptr @dp, i64 0, i64 1), i64 0, i64 1), align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 1, ptr %6, align 4, !tbaa !11
  br label %21

21:                                               ; preds = %130, %20
  %22 = load i32, ptr %6, align 4, !tbaa !11
  %23 = load i32, ptr %2, align 4, !tbaa !11
  %24 = icmp slt i32 %22, %23
  br i1 %24, label %30, label %25

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

26:                                               ; preds = %18, %0
  %27 = landingpad { ptr, i32 }
          cleanup
  %28 = extractvalue { ptr, i32 } %27, 0
  store ptr %28, ptr %4, align 8
  %29 = extractvalue { ptr, i32 } %27, 1
  store i32 %29, ptr %5, align 4
  br label %157

30:                                               ; preds = %21
  %31 = load i32, ptr %6, align 4, !tbaa !11
  %32 = sub nsw i32 %31, 1
  %33 = sext i32 %32 to i64
  %34 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %3, i64 noundef %33)
          to label %35 unwind label %46

35:                                               ; preds = %30
  %36 = load i8, ptr %34, align 1, !tbaa !13
  %37 = sext i8 %36 to i32
  %38 = icmp eq i32 %37, 60
  br i1 %38, label %39, label %82

39:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 1, ptr %8, align 4, !tbaa !11
  br label %40

40:                                               ; preds = %78, %39
  %41 = load i32, ptr %8, align 4, !tbaa !11
  %42 = load i32, ptr %6, align 4, !tbaa !11
  %43 = add nsw i32 %42, 1
  %44 = icmp sle i32 %41, %43
  br i1 %44, label %50, label %45

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

46:                                               ; preds = %30
  %47 = landingpad { ptr, i32 }
          cleanup
  %48 = extractvalue { ptr, i32 } %47, 0
  store ptr %48, ptr %4, align 8
  %49 = extractvalue { ptr, i32 } %47, 1
  store i32 %49, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %157

50:                                               ; preds = %40
  %51 = load i32, ptr %6, align 4, !tbaa !11
  %52 = add nsw i32 %51, 1
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [3001 x [3001 x i64]], ptr @dp, i64 0, i64 %53
  %55 = load i32, ptr %8, align 4, !tbaa !11
  %56 = sub nsw i32 %55, 1
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [3001 x i64], ptr %54, i64 0, i64 %57
  %59 = load i64, ptr %58, align 8, !tbaa !8
  %60 = load i32, ptr %6, align 4, !tbaa !11
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [3001 x [3001 x i64]], ptr @dp, i64 0, i64 %61
  %63 = load i32, ptr %8, align 4, !tbaa !11
  %64 = sub nsw i32 %63, 1
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [3001 x i64], ptr %62, i64 0, i64 %65
  %67 = load i64, ptr %66, align 8, !tbaa !8
  %68 = add nsw i64 %59, %67
  %69 = load i32, ptr %6, align 4, !tbaa !11
  %70 = add nsw i32 %69, 1
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [3001 x [3001 x i64]], ptr @dp, i64 0, i64 %71
  %73 = load i32, ptr %8, align 4, !tbaa !11
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [3001 x i64], ptr %72, i64 0, i64 %74
  store i64 %68, ptr %75, align 8, !tbaa !8
  %76 = load i64, ptr %75, align 8, !tbaa !8
  %77 = srem i64 %76, 1000000007
  store i64 %77, ptr %75, align 8, !tbaa !8
  br label %78

78:                                               ; preds = %50
  %79 = load i32, ptr %8, align 4, !tbaa !11
  %80 = add nsw i32 %79, 1
  store i32 %80, ptr %8, align 4, !tbaa !11
  br label %40, !llvm.loop !14

81:                                               ; preds = %45
  br label %129

82:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 1, ptr %9, align 4, !tbaa !11
  br label %83

83:                                               ; preds = %125, %82
  %84 = load i32, ptr %9, align 4, !tbaa !11
  %85 = load i32, ptr %6, align 4, !tbaa !11
  %86 = add nsw i32 %85, 1
  %87 = icmp sle i32 %84, %86
  br i1 %87, label %89, label %88

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

89:                                               ; preds = %83
  %90 = load i32, ptr %6, align 4, !tbaa !11
  %91 = add nsw i32 %90, 1
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [3001 x [3001 x i64]], ptr @dp, i64 0, i64 %92
  %94 = load i32, ptr %9, align 4, !tbaa !11
  %95 = sub nsw i32 %94, 1
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [3001 x i64], ptr %93, i64 0, i64 %96
  %98 = load i64, ptr %97, align 8, !tbaa !8
  %99 = load i32, ptr %6, align 4, !tbaa !11
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [3001 x [3001 x i64]], ptr @dp, i64 0, i64 %100
  %102 = load i32, ptr %6, align 4, !tbaa !11
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [3001 x i64], ptr %101, i64 0, i64 %103
  %105 = load i64, ptr %104, align 8, !tbaa !8
  %106 = add nsw i64 %98, %105
  %107 = load i32, ptr %6, align 4, !tbaa !11
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [3001 x [3001 x i64]], ptr @dp, i64 0, i64 %108
  %110 = load i32, ptr %9, align 4, !tbaa !11
  %111 = sub nsw i32 %110, 1
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [3001 x i64], ptr %109, i64 0, i64 %112
  %114 = load i64, ptr %113, align 8, !tbaa !8
  %115 = sub nsw i64 %106, %114
  %116 = load i32, ptr %6, align 4, !tbaa !11
  %117 = add nsw i32 %116, 1
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [3001 x [3001 x i64]], ptr @dp, i64 0, i64 %118
  %120 = load i32, ptr %9, align 4, !tbaa !11
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [3001 x i64], ptr %119, i64 0, i64 %121
  store i64 %115, ptr %122, align 8, !tbaa !8
  %123 = load i64, ptr %122, align 8, !tbaa !8
  %124 = srem i64 %123, 1000000007
  store i64 %124, ptr %122, align 8, !tbaa !8
  br label %125

125:                                              ; preds = %89
  %126 = load i32, ptr %9, align 4, !tbaa !11
  %127 = add nsw i32 %126, 1
  store i32 %127, ptr %9, align 4, !tbaa !11
  br label %83, !llvm.loop !16

128:                                              ; preds = %88
  br label %129

129:                                              ; preds = %128, %81
  br label %130

130:                                              ; preds = %129
  %131 = load i32, ptr %6, align 4, !tbaa !11
  %132 = add nsw i32 %131, 1
  store i32 %132, ptr %6, align 4, !tbaa !11
  br label %21, !llvm.loop !17

133:                                              ; preds = %25
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %134 = load i32, ptr %2, align 4, !tbaa !11
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [3001 x [3001 x i64]], ptr @dp, i64 0, i64 %135
  %137 = load i32, ptr %2, align 4, !tbaa !11
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds [3001 x i64], ptr %136, i64 0, i64 %138
  %140 = load i64, ptr %139, align 8, !tbaa !8
  store i64 %140, ptr %10, align 8, !tbaa !8
  %141 = load i64, ptr %10, align 8, !tbaa !8
  %142 = icmp slt i64 %141, 0
  br i1 %142, label %143, label %146

143:                                              ; preds = %133
  %144 = load i64, ptr %10, align 8, !tbaa !8
  %145 = add nsw i64 %144, 1000000007
  store i64 %145, ptr %10, align 8, !tbaa !8
  br label %146

146:                                              ; preds = %143, %133
  %147 = load i64, ptr %10, align 8, !tbaa !8
  %148 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %147)
          to label %149 unwind label %153

149:                                              ; preds = %146
  %150 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %148, i8 noundef signext 10)
          to label %151 unwind label %153

151:                                              ; preds = %149
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  %152 = load i32, ptr %1, align 4
  ret i32 %152

153:                                              ; preds = %149, %146
  %154 = landingpad { ptr, i32 }
          cleanup
  %155 = extractvalue { ptr, i32 } %154, 0
  store ptr %155, ptr %4, align 8
  %156 = extractvalue { ptr, i32 } %154, 1
  store i32 %156, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  br label %157

157:                                              ; preds = %153, %46, %26
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %158

158:                                              ; preds = %157
  %159 = load ptr, ptr %4, align 8
  %160 = load i32, ptr %5, align 4
  %161 = insertvalue { ptr, i32 } poison, ptr %159, 0
  %162 = insertvalue { ptr, i32 } %161, i32 %160, 1
  resume { ptr, i32 } %162
}

; 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #3

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #1 align 2

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) #2

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #2

declare i32 @__gxx_personality_v0(...)

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #1 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = !{!12, !12, i64 0}
!12 = !{!"int", !10, i64 0}
!13 = !{!10, !10, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
!17 = distinct !{!17, !15}


; 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" }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }

@dp = external dso_local local_unnamed_addr global [3001 x [3001 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 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca %"class.std::__cxx11::basic_string", align 8
  %3 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %4 = getelementptr i8, ptr %3, i64 -24
  %5 = load i64, ptr %4, align 8
  %6 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %5
  %7 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %6, ptr noundef null)
  %8 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %2) #6
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #6
  %9 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
          to label %10 unwind label %20

10:                                               ; preds = %0
  %11 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef nonnull align 8 dereferenceable(32) %2)
          to label %12 unwind label %20

12:                                               ; preds = %10
  store i64 1, ptr getelementptr inbounds (i8, ptr @dp, i64 24016), align 16, !tbaa !8
  %13 = load i32, ptr %1, align 4, !tbaa !11
  %14 = icmp sgt i32 %13, 1
  br i1 %14, label %.lr.ph, label %.._crit_edge_crit_edge

.._crit_edge_crit_edge:                           ; preds = %12
  %.pre63 = sext i32 %13 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %.loopexit, %.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre63, %.._crit_edge_crit_edge ], [ %60, %.loopexit ]
  %15 = getelementptr inbounds [3001 x [3001 x i64]], ptr @dp, i64 0, i64 %.pre-phi, i64 %.pre-phi
  %16 = load i64, ptr %15, align 8, !tbaa !8
  %17 = icmp slt i64 %16, 0
  %18 = add nsw i64 %16, 1000000007
  %spec.select = select i1 %17, i64 %18, i64 %16
  %19 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %spec.select)
          to label %62 unwind label %65

20:                                               ; preds = %10, %0
  %21 = landingpad { ptr, i32 }
          cleanup
  br label %67

.lr.ph:                                           ; preds = %12, %.loopexit
  %indvar = phi i64 [ %indvar.next, %.loopexit ], [ 0, %12 ]
  %indvars.iv56 = phi i64 [ %26, %.loopexit ], [ 1, %12 ]
  %indvars.iv54 = phi i64 [ %indvars.iv.next55, %.loopexit ], [ 3, %12 ]
  %22 = add nsw i64 %indvars.iv56, -1
  %23 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %2, i64 noundef %22)
  %24 = load i8, ptr %23, align 1, !tbaa !13
  %25 = icmp eq i8 %24, 60
  %26 = add nuw nsw i64 %indvars.iv56, 1
  br i1 %25, label %.preheader, label %.preheader39

.preheader39:                                     ; preds = %.lr.ph
  %27 = getelementptr inbounds [3001 x [3001 x i64]], ptr @dp, i64 0, i64 %indvars.iv56, i64 %indvars.iv56
  %.phi.trans.insert = getelementptr inbounds [3001 x [3001 x i64]], ptr @dp, i64 0, i64 %26, i64 0
  %.pre = load i64, ptr %.phi.trans.insert, align 8, !tbaa !8
  br label %43

.preheader:                                       ; preds = %.lr.ph
  %.phi.trans.insert61 = getelementptr inbounds [3001 x [3001 x i64]], ptr @dp, i64 0, i64 %26, i64 0
  %.pre62 = load i64, ptr %.phi.trans.insert61, align 8, !tbaa !8
  %xtraiter = and i64 %indvar, 1
  %28 = icmp eq i64 %indvar, -1
  br i1 %28, label %.loopexit.loopexit.unr-lcssa, label %.preheader.new

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

30:                                               ; preds = %30, %.preheader.new
  %31 = phi i64 [ %.pre62, %.preheader.new ], [ %42, %30 ]
  %indvars.iv49 = phi i64 [ 1, %.preheader.new ], [ %indvars.iv.next50.1, %30 ]
  %niter = phi i64 [ 0, %.preheader.new ], [ %niter.next.1, %30 ]
  %32 = add nsw i64 %indvars.iv49, -1
  %33 = getelementptr inbounds [3001 x [3001 x i64]], ptr @dp, i64 0, i64 %indvars.iv56, i64 %32
  %34 = load i64, ptr %33, align 8, !tbaa !8
  %35 = add nsw i64 %34, %31
  %36 = getelementptr inbounds [3001 x [3001 x i64]], ptr @dp, i64 0, i64 %26, i64 %indvars.iv49
  %37 = srem i64 %35, 1000000007
  store i64 %37, ptr %36, align 8, !tbaa !8
  %indvars.iv.next50 = add nuw nsw i64 %indvars.iv49, 1
  %38 = getelementptr inbounds [3001 x [3001 x i64]], ptr @dp, i64 0, i64 %indvars.iv56, i64 %indvars.iv49
  %39 = load i64, ptr %38, align 8, !tbaa !8
  %40 = add nsw i64 %39, %37
  %41 = getelementptr inbounds [3001 x [3001 x i64]], ptr @dp, i64 0, i64 %26, i64 %indvars.iv.next50
  %42 = srem i64 %40, 1000000007
  store i64 %42, ptr %41, align 8, !tbaa !8
  %indvars.iv.next50.1 = add nuw nsw i64 %indvars.iv49, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter, %29
  br i1 %niter.ncmp.1, label %.loopexit.loopexit.unr-lcssa, label %30, !llvm.loop !14

43:                                               ; preds = %.preheader39, %43
  %44 = phi i64 [ %.pre, %.preheader39 ], [ %52, %43 ]
  %indvars.iv = phi i64 [ 1, %.preheader39 ], [ %indvars.iv.next, %43 ]
  %45 = add nsw i64 %indvars.iv, -1
  %46 = load i64, ptr %27, align 8, !tbaa !8
  %47 = add nsw i64 %46, %44
  %48 = getelementptr inbounds [3001 x [3001 x i64]], ptr @dp, i64 0, i64 %indvars.iv56, i64 %45
  %49 = load i64, ptr %48, align 8, !tbaa !8
  %50 = sub i64 %47, %49
  %51 = getelementptr inbounds [3001 x [3001 x i64]], ptr @dp, i64 0, i64 %26, i64 %indvars.iv
  %52 = srem i64 %50, 1000000007
  store i64 %52, ptr %51, align 8, !tbaa !8
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond = icmp eq i64 %indvars.iv.next, %indvars.iv54
  br i1 %exitcond, label %.loopexit, label %43, !llvm.loop !16

.loopexit.loopexit.unr-lcssa:                     ; preds = %30, %.preheader
  %.unr = phi i64 [ %.pre62, %.preheader ], [ %42, %30 ]
  %indvars.iv49.unr = phi i64 [ 1, %.preheader ], [ %indvars.iv.next50.1, %30 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.loopexit, label %.loopexit.loopexit.epilog-lcssa

.loopexit.loopexit.epilog-lcssa:                  ; preds = %.loopexit.loopexit.unr-lcssa
  %53 = add nsw i64 %indvars.iv49.unr, -1
  %54 = getelementptr inbounds [3001 x [3001 x i64]], ptr @dp, i64 0, i64 %indvars.iv56, i64 %53
  %55 = load i64, ptr %54, align 8, !tbaa !8
  %56 = add nsw i64 %55, %.unr
  %57 = getelementptr inbounds [3001 x [3001 x i64]], ptr @dp, i64 0, i64 %26, i64 %indvars.iv49.unr
  %58 = srem i64 %56, 1000000007
  store i64 %58, ptr %57, align 8, !tbaa !8
  br label %.loopexit

.loopexit:                                        ; preds = %43, %.loopexit.loopexit.epilog-lcssa, %.loopexit.loopexit.unr-lcssa
  %59 = load i32, ptr %1, align 4, !tbaa !11
  %60 = sext i32 %59 to i64
  %61 = icmp slt i64 %26, %60
  %indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1
  %indvar.next = add i64 %indvar, 1
  br i1 %61, label %.lr.ph, label %._crit_edge, !llvm.loop !17

62:                                               ; preds = %._crit_edge
  %63 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %19, i8 noundef signext 10)
          to label %64 unwind label %65

64:                                               ; preds = %62
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  ret i32 0

65:                                               ; preds = %62, %._crit_edge
  %66 = landingpad { ptr, i32 }
          cleanup
  br label %67

67:                                               ; preds = %65, %20
  %.pn = phi { ptr, i32 } [ %66, %65 ], [ %21, %20 ]
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  resume { ptr, i32 } %.pn
}

; 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #3

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #1 align 2

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2

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

declare i32 @__gxx_personality_v0(...)

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #1 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = !{!12, !12, i64 0}
!12 = !{!"int", !10, i64 0}
!13 = !{!10, !10, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
!17 = distinct !{!17, !15}


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