; LLVM IR from kazunetakahashi/atcoder :: 2018/0804_mujin-pc-2018 (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::__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] }
%"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" }

@N = external dso_local global i32, align 4
@M = external dso_local global i32, align 4
@_Z1SB5cxx11 = external dso_local global [2010 x %"class.std::__cxx11::basic_string"], align 16
@cnt = external dso_local global [2010 x [2010 x i64]], align 16
@imos = external dso_local global [2010 x [2010 x [4 x i64]]], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_Z5calc2iii(i32 noundef, i32 noundef, i32 noundef) #1

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

15:                                               ; preds = %25, %0
  %16 = load i32, ptr %2, align 4, !tbaa !5
  %17 = load i32, ptr @N, align 4, !tbaa !5
  %18 = icmp slt i32 %16, %17
  br i1 %18, label %20, label %19

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

20:                                               ; preds = %15
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [2010 x %"class.std::__cxx11::basic_string"], ptr @_Z1SB5cxx11, i64 0, i64 %22
  %24 = call 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) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(32) %23)
  br label %25

25:                                               ; preds = %20
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = add nsw i32 %26, 1
  store i32 %27, ptr %2, align 4, !tbaa !5
  br label %15, !llvm.loop !9

28:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 0, ptr %3, align 4, !tbaa !5
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef @cnt, ptr noundef getelementptr inbounds (i64, ptr @cnt, i64 4040100), ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %29

29:                                               ; preds = %65, %28
  %30 = load i32, ptr %4, align 4, !tbaa !5
  %31 = load i32, ptr @N, align 4, !tbaa !5
  %32 = icmp sle i32 %30, %31
  br i1 %32, label %34, label %33

33:                                               ; preds = %29
  store i32 5, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %68

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

35:                                               ; preds = %61, %34
  %36 = load i32, ptr %6, align 4, !tbaa !5
  %37 = load i32, ptr @M, align 4, !tbaa !5
  %38 = icmp sle i32 %36, %37
  br i1 %38, label %40, label %39

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

40:                                               ; preds = %35
  %41 = load i32, ptr %4, align 4, !tbaa !5
  %42 = sub nsw i32 %41, 1
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [2010 x %"class.std::__cxx11::basic_string"], ptr @_Z1SB5cxx11, i64 0, i64 %43
  %45 = load i32, ptr %6, align 4, !tbaa !5
  %46 = sub nsw i32 %45, 1
  %47 = sext i32 %46 to i64
  %48 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %44, i64 noundef %47)
  %49 = load i8, ptr %48, align 1, !tbaa !11
  %50 = sext i8 %49 to i32
  %51 = icmp eq i32 %50, 46
  %52 = zext i1 %51 to i64
  %53 = select i1 %51, i32 1, i32 0
  %54 = sext i32 %53 to i64
  %55 = load i32, ptr %4, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [2010 x [2010 x i64]], ptr @cnt, i64 0, i64 %56
  %58 = load i32, ptr %6, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [2010 x i64], ptr %57, i64 0, i64 %59
  store i64 %54, ptr %60, align 8, !tbaa !12
  br label %61

61:                                               ; preds = %40
  %62 = load i32, ptr %6, align 4, !tbaa !5
  %63 = add nsw i32 %62, 1
  store i32 %63, ptr %6, align 4, !tbaa !5
  br label %35, !llvm.loop !14

64:                                               ; preds = %39
  br label %65

65:                                               ; preds = %64
  %66 = load i32, ptr %4, align 4, !tbaa !5
  %67 = add nsw i32 %66, 1
  store i32 %67, ptr %4, align 4, !tbaa !5
  br label %29, !llvm.loop !15

68:                                               ; preds = %33
  %69 = load i32, ptr @N, align 4, !tbaa !5
  %70 = add nsw i32 %69, 2
  store i32 %70, ptr @N, align 4, !tbaa !5
  %71 = load i32, ptr @M, align 4, !tbaa !5
  %72 = add nsw i32 %71, 2
  store i32 %72, ptr @M, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 -1, ptr %7, align 4, !tbaa !5
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef @imos, ptr noundef getelementptr inbounds (i64, ptr @imos, i64 16160400), ptr noundef nonnull align 4 dereferenceable(4) %7)
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  store i64 0, ptr %8, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %73

73:                                               ; preds = %112, %68
  %74 = load i32, ptr %9, align 4, !tbaa !5
  %75 = icmp slt i32 %74, 4
  br i1 %75, label %77, label %76

76:                                               ; preds = %73
  store i32 11, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %115

77:                                               ; preds = %73
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %78 = load i32, ptr %9, align 4, !tbaa !5
  %79 = add nsw i32 %78, 1
  %80 = srem i32 %79, 4
  store i32 %80, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %81

81:                                               ; preds = %108, %77
  %82 = load i32, ptr %11, align 4, !tbaa !5
  %83 = load i32, ptr @N, align 4, !tbaa !5
  %84 = icmp slt i32 %82, %83
  br i1 %84, label %86, label %85

85:                                               ; preds = %81
  store i32 14, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %111

86:                                               ; preds = %81
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %87

87:                                               ; preds = %104, %86
  %88 = load i32, ptr %12, align 4, !tbaa !5
  %89 = load i32, ptr @M, align 4, !tbaa !5
  %90 = icmp slt i32 %88, %89
  br i1 %90, label %92, label %91

91:                                               ; preds = %87
  store i32 17, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %107

92:                                               ; preds = %87
  %93 = load i32, ptr %11, align 4, !tbaa !5
  %94 = load i32, ptr %12, align 4, !tbaa !5
  %95 = load i32, ptr %9, align 4, !tbaa !5
  %96 = call noundef i64 @_Z5calc2iii(i32 noundef %93, i32 noundef %94, i32 noundef %95)
  %97 = load i32, ptr %11, align 4, !tbaa !5
  %98 = load i32, ptr %12, align 4, !tbaa !5
  %99 = load i32, ptr %10, align 4, !tbaa !5
  %100 = call noundef i64 @_Z5calc2iii(i32 noundef %97, i32 noundef %98, i32 noundef %99)
  %101 = mul nsw i64 %96, %100
  %102 = load i64, ptr %8, align 8, !tbaa !12
  %103 = add nsw i64 %102, %101
  store i64 %103, ptr %8, align 8, !tbaa !12
  br label %104

104:                                              ; preds = %92
  %105 = load i32, ptr %12, align 4, !tbaa !5
  %106 = add nsw i32 %105, 1
  store i32 %106, ptr %12, align 4, !tbaa !5
  br label %87, !llvm.loop !16

107:                                              ; preds = %91
  br label %108

108:                                              ; preds = %107
  %109 = load i32, ptr %11, align 4, !tbaa !5
  %110 = add nsw i32 %109, 1
  store i32 %110, ptr %11, align 4, !tbaa !5
  br label %81, !llvm.loop !17

111:                                              ; preds = %85
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %112

112:                                              ; preds = %111
  %113 = load i32, ptr %9, align 4, !tbaa !5
  %114 = add nsw i32 %113, 1
  store i32 %114, ptr %9, align 4, !tbaa !5
  br label %73, !llvm.loop !18

115:                                              ; preds = %76
  %116 = load i64, ptr %8, align 8, !tbaa !12
  %117 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %116)
  %118 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %117, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  %119 = load i32, ptr %1, align 4
  ret i32 %119
}

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

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

; 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: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) #5 align 2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #1 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) #1 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { "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 = { 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 #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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"long long", !7, i64 0}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}


; 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::__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] }
%"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" }

@N = external dso_local global i32, align 4
@M = external dso_local global i32, align 4
@_Z1SB5cxx11 = external dso_local global [2010 x %"class.std::__cxx11::basic_string"], align 16
@cnt = external dso_local global [2010 x [2010 x i64]], align 16
@imos = external dso_local global [2010 x [2010 x [4 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_Z5calc2iii(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @N)
  %4 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 4 dereferenceable(4) @M)
  %5 = load i32, ptr @N, align 4, !tbaa !5
  %6 = icmp sgt i32 %5, 0
  br i1 %6, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %0
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  store i32 0, ptr %1, align 4, !tbaa !5
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef nonnull @cnt, ptr noundef nonnull getelementptr inbounds (i8, ptr @cnt, i64 32320800), ptr noundef nonnull align 4 dereferenceable(4) %1)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %7 = load i32, ptr @N, align 4, !tbaa !5
  %.not41 = icmp slt i32 %7, 1
  %.pre70 = load i32, ptr @M, align 4, !tbaa !5
  %8 = icmp slt i32 %.pre70, 1
  %or.cond = select i1 %.not41, i1 true, i1 %8
  br i1 %or.cond, label %._crit_edge43, label %.preheader35

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %9 = getelementptr inbounds [2010 x %"class.std::__cxx11::basic_string"], ptr @_Z1SB5cxx11, i64 0, i64 %indvars.iv
  %10 = tail call 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) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(32) %9)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %11 = load i32, ptr @N, align 4, !tbaa !5
  %12 = sext i32 %11 to i64
  %13 = icmp slt i64 %indvars.iv.next, %12
  br i1 %13, label %.lr.ph, label %._crit_edge, !llvm.loop !9

.preheader35:                                     ; preds = %._crit_edge, %._crit_edge40
  %14 = phi i32 [ %25, %._crit_edge40 ], [ %7, %._crit_edge ]
  %15 = phi i32 [ %26, %._crit_edge40 ], [ %.pre70, %._crit_edge ]
  %indvars.iv67 = phi i64 [ %indvars.iv.next68, %._crit_edge40 ], [ 1, %._crit_edge ]
  %.not3437 = icmp slt i32 %15, 1
  br i1 %.not3437, label %._crit_edge40, label %.lr.ph39

.lr.ph39:                                         ; preds = %.preheader35
  %16 = add nsw i64 %indvars.iv67, -1
  %17 = getelementptr inbounds [2010 x %"class.std::__cxx11::basic_string"], ptr @_Z1SB5cxx11, i64 0, i64 %16
  br label %28

._crit_edge43:                                    ; preds = %._crit_edge40, %._crit_edge
  %18 = phi i32 [ %.pre70, %._crit_edge ], [ %26, %._crit_edge40 ]
  %.lcssa = phi i32 [ %7, %._crit_edge ], [ %25, %._crit_edge40 ]
  %19 = add nsw i32 %.lcssa, 2
  store i32 %19, ptr @N, align 4, !tbaa !5
  %20 = add nsw i32 %18, 2
  store i32 %20, ptr @M, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  store i32 -1, ptr %2, align 4, !tbaa !5
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef nonnull @imos, ptr noundef nonnull getelementptr inbounds (i8, ptr @imos, i64 129283200), ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  %21 = load i32, ptr @N, align 4, !tbaa !5
  %22 = icmp sgt i32 %21, 0
  %23 = load i32, ptr @M, align 4
  %24 = icmp sgt i32 %23, 0
  %or.cond113 = select i1 %22, i1 %24, i1 false
  br i1 %or.cond113, label %.preheader, label %.split56.us

._crit_edge40.loopexit:                           ; preds = %28
  %.pre = load i32, ptr @N, align 4, !tbaa !5
  br label %._crit_edge40

._crit_edge40:                                    ; preds = %._crit_edge40.loopexit, %.preheader35
  %25 = phi i32 [ %.pre, %._crit_edge40.loopexit ], [ %14, %.preheader35 ]
  %26 = phi i32 [ %35, %._crit_edge40.loopexit ], [ %15, %.preheader35 ]
  %indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
  %27 = sext i32 %25 to i64
  %.not.not = icmp slt i64 %indvars.iv67, %27
  br i1 %.not.not, label %.preheader35, label %._crit_edge43, !llvm.loop !11

28:                                               ; preds = %.lr.ph39, %28
  %indvars.iv64 = phi i64 [ 1, %.lr.ph39 ], [ %indvars.iv.next65, %28 ]
  %29 = add nsw i64 %indvars.iv64, -1
  %30 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %17, i64 noundef %29)
  %31 = load i8, ptr %30, align 1, !tbaa !13
  %32 = icmp eq i8 %31, 46
  %33 = zext i1 %32 to i64
  %34 = getelementptr inbounds [2010 x [2010 x i64]], ptr @cnt, i64 0, i64 %indvars.iv67, i64 %indvars.iv64
  store i64 %33, ptr %34, align 8, !tbaa !14
  %indvars.iv.next65 = add nuw nsw i64 %indvars.iv64, 1
  %35 = load i32, ptr @M, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %.not34.not = icmp slt i64 %indvars.iv64, %36
  br i1 %.not34.not, label %28, label %._crit_edge40.loopexit, !llvm.loop !16

.loopexit:                                        ; preds = %._crit_edge47
  %37 = icmp sgt i32 %90, 0
  %.pr = load i32, ptr @M, align 4
  %38 = icmp sgt i32 %.pr, 0
  %or.cond109 = select i1 %37, i1 %38, i1 false
  br i1 %or.cond109, label %.preheader.1, label %.split56.us

.preheader.1:                                     ; preds = %.loopexit, %._crit_edge47.1
  %39 = phi i32 [ %49, %._crit_edge47.1 ], [ %90, %.loopexit ]
  %40 = phi i32 [ %50, %._crit_edge47.1 ], [ %.pr, %.loopexit ]
  %.02750.1 = phi i32 [ %51, %._crit_edge47.1 ], [ 0, %.loopexit ]
  %.149.1 = phi i64 [ %.2.lcssa.1, %._crit_edge47.1 ], [ %.2.lcssa, %.loopexit ]
  %41 = icmp sgt i32 %40, 0
  br i1 %41, label %.lr.ph46.1, label %._crit_edge47.1

.lr.ph46.1:                                       ; preds = %.preheader.1, %.lr.ph46.1
  %.045.1 = phi i32 [ %46, %.lr.ph46.1 ], [ 0, %.preheader.1 ]
  %.244.1 = phi i64 [ %45, %.lr.ph46.1 ], [ %.149.1, %.preheader.1 ]
  %42 = call noundef i64 @_Z5calc2iii(i32 noundef %.02750.1, i32 noundef %.045.1, i32 noundef 1)
  %43 = call noundef i64 @_Z5calc2iii(i32 noundef %.02750.1, i32 noundef %.045.1, i32 noundef 2)
  %44 = mul nsw i64 %43, %42
  %45 = add nsw i64 %44, %.244.1
  %46 = add nuw nsw i32 %.045.1, 1
  %47 = load i32, ptr @M, align 4, !tbaa !5
  %48 = icmp slt i32 %46, %47
  br i1 %48, label %.lr.ph46.1, label %._crit_edge47.loopexit.1, !llvm.loop !17

._crit_edge47.loopexit.1:                         ; preds = %.lr.ph46.1
  %.pre72 = load i32, ptr @N, align 4, !tbaa !5
  br label %._crit_edge47.1

._crit_edge47.1:                                  ; preds = %._crit_edge47.loopexit.1, %.preheader.1
  %49 = phi i32 [ %39, %.preheader.1 ], [ %.pre72, %._crit_edge47.loopexit.1 ]
  %50 = phi i32 [ %40, %.preheader.1 ], [ %47, %._crit_edge47.loopexit.1 ]
  %.2.lcssa.1 = phi i64 [ %.149.1, %.preheader.1 ], [ %45, %._crit_edge47.loopexit.1 ]
  %51 = add nuw nsw i32 %.02750.1, 1
  %52 = icmp slt i32 %51, %49
  br i1 %52, label %.preheader.1, label %.loopexit.1, !llvm.loop !18

.loopexit.1:                                      ; preds = %._crit_edge47.1
  %53 = icmp sgt i32 %49, 0
  %.pr91 = load i32, ptr @M, align 4
  %54 = icmp sgt i32 %.pr91, 0
  %or.cond110 = select i1 %53, i1 %54, i1 false
  br i1 %or.cond110, label %.preheader.2, label %.split56.us

.preheader.2:                                     ; preds = %.loopexit.1, %._crit_edge47.2
  %55 = phi i32 [ %65, %._crit_edge47.2 ], [ %49, %.loopexit.1 ]
  %56 = phi i32 [ %66, %._crit_edge47.2 ], [ %.pr91, %.loopexit.1 ]
  %.02750.2 = phi i32 [ %67, %._crit_edge47.2 ], [ 0, %.loopexit.1 ]
  %.149.2 = phi i64 [ %.2.lcssa.2, %._crit_edge47.2 ], [ %.2.lcssa.1, %.loopexit.1 ]
  %57 = icmp sgt i32 %56, 0
  br i1 %57, label %.lr.ph46.2, label %._crit_edge47.2

.lr.ph46.2:                                       ; preds = %.preheader.2, %.lr.ph46.2
  %.045.2 = phi i32 [ %62, %.lr.ph46.2 ], [ 0, %.preheader.2 ]
  %.244.2 = phi i64 [ %61, %.lr.ph46.2 ], [ %.149.2, %.preheader.2 ]
  %58 = call noundef i64 @_Z5calc2iii(i32 noundef %.02750.2, i32 noundef %.045.2, i32 noundef 2)
  %59 = call noundef i64 @_Z5calc2iii(i32 noundef %.02750.2, i32 noundef %.045.2, i32 noundef 3)
  %60 = mul nsw i64 %59, %58
  %61 = add nsw i64 %60, %.244.2
  %62 = add nuw nsw i32 %.045.2, 1
  %63 = load i32, ptr @M, align 4, !tbaa !5
  %64 = icmp slt i32 %62, %63
  br i1 %64, label %.lr.ph46.2, label %._crit_edge47.loopexit.2, !llvm.loop !17

._crit_edge47.loopexit.2:                         ; preds = %.lr.ph46.2
  %.pre73 = load i32, ptr @N, align 4, !tbaa !5
  br label %._crit_edge47.2

._crit_edge47.2:                                  ; preds = %._crit_edge47.loopexit.2, %.preheader.2
  %65 = phi i32 [ %55, %.preheader.2 ], [ %.pre73, %._crit_edge47.loopexit.2 ]
  %66 = phi i32 [ %56, %.preheader.2 ], [ %63, %._crit_edge47.loopexit.2 ]
  %.2.lcssa.2 = phi i64 [ %.149.2, %.preheader.2 ], [ %61, %._crit_edge47.loopexit.2 ]
  %67 = add nuw nsw i32 %.02750.2, 1
  %68 = icmp slt i32 %67, %65
  br i1 %68, label %.preheader.2, label %.loopexit.2, !llvm.loop !18

.loopexit.2:                                      ; preds = %._crit_edge47.2
  %69 = icmp sgt i32 %65, 0
  %.pr88 = load i32, ptr @M, align 4
  %70 = icmp sgt i32 %.pr88, 0
  %or.cond111 = select i1 %69, i1 %70, i1 false
  br i1 %or.cond111, label %.preheader.3, label %.split56.us

.preheader.3:                                     ; preds = %.loopexit.2, %._crit_edge47.3
  %71 = phi i32 [ %81, %._crit_edge47.3 ], [ %65, %.loopexit.2 ]
  %72 = phi i32 [ %82, %._crit_edge47.3 ], [ %.pr88, %.loopexit.2 ]
  %.02750.3 = phi i32 [ %83, %._crit_edge47.3 ], [ 0, %.loopexit.2 ]
  %.149.3 = phi i64 [ %.2.lcssa.3, %._crit_edge47.3 ], [ %.2.lcssa.2, %.loopexit.2 ]
  %73 = icmp sgt i32 %72, 0
  br i1 %73, label %.lr.ph46.3, label %._crit_edge47.3

.lr.ph46.3:                                       ; preds = %.preheader.3, %.lr.ph46.3
  %.045.3 = phi i32 [ %78, %.lr.ph46.3 ], [ 0, %.preheader.3 ]
  %.244.3 = phi i64 [ %77, %.lr.ph46.3 ], [ %.149.3, %.preheader.3 ]
  %74 = call noundef i64 @_Z5calc2iii(i32 noundef %.02750.3, i32 noundef %.045.3, i32 noundef 3)
  %75 = call noundef i64 @_Z5calc2iii(i32 noundef %.02750.3, i32 noundef %.045.3, i32 noundef 0)
  %76 = mul nsw i64 %75, %74
  %77 = add nsw i64 %76, %.244.3
  %78 = add nuw nsw i32 %.045.3, 1
  %79 = load i32, ptr @M, align 4, !tbaa !5
  %80 = icmp slt i32 %78, %79
  br i1 %80, label %.lr.ph46.3, label %._crit_edge47.loopexit.3, !llvm.loop !17

._crit_edge47.loopexit.3:                         ; preds = %.lr.ph46.3
  %.pre74 = load i32, ptr @N, align 4, !tbaa !5
  br label %._crit_edge47.3

._crit_edge47.3:                                  ; preds = %._crit_edge47.loopexit.3, %.preheader.3
  %81 = phi i32 [ %71, %.preheader.3 ], [ %.pre74, %._crit_edge47.loopexit.3 ]
  %82 = phi i32 [ %72, %.preheader.3 ], [ %79, %._crit_edge47.loopexit.3 ]
  %.2.lcssa.3 = phi i64 [ %.149.3, %.preheader.3 ], [ %77, %._crit_edge47.loopexit.3 ]
  %83 = add nuw nsw i32 %.02750.3, 1
  %84 = icmp slt i32 %83, %81
  br i1 %84, label %.preheader.3, label %.split56.us, !llvm.loop !18

.split56.us:                                      ; preds = %._crit_edge47.3, %.loopexit, %.loopexit.1, %.loopexit.2, %._crit_edge43
  %.us-phi57 = phi i64 [ 0, %._crit_edge43 ], [ %.2.lcssa.2, %.loopexit.2 ], [ %.2.lcssa.1, %.loopexit.1 ], [ %.2.lcssa, %.loopexit ], [ %.2.lcssa.3, %._crit_edge47.3 ]
  %85 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.us-phi57)
  %86 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %85, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  ret i32 0

.preheader:                                       ; preds = %._crit_edge43, %._crit_edge47
  %87 = phi i32 [ %90, %._crit_edge47 ], [ %21, %._crit_edge43 ]
  %88 = phi i32 [ %91, %._crit_edge47 ], [ %23, %._crit_edge43 ]
  %.02750 = phi i32 [ %92, %._crit_edge47 ], [ 0, %._crit_edge43 ]
  %.149 = phi i64 [ %.2.lcssa, %._crit_edge47 ], [ 0, %._crit_edge43 ]
  %89 = icmp sgt i32 %88, 0
  br i1 %89, label %.lr.ph46, label %._crit_edge47

._crit_edge47.loopexit:                           ; preds = %.lr.ph46
  %.pre71 = load i32, ptr @N, align 4, !tbaa !5
  br label %._crit_edge47

._crit_edge47:                                    ; preds = %._crit_edge47.loopexit, %.preheader
  %90 = phi i32 [ %87, %.preheader ], [ %.pre71, %._crit_edge47.loopexit ]
  %91 = phi i32 [ %88, %.preheader ], [ %99, %._crit_edge47.loopexit ]
  %.2.lcssa = phi i64 [ %.149, %.preheader ], [ %97, %._crit_edge47.loopexit ]
  %92 = add nuw nsw i32 %.02750, 1
  %93 = icmp slt i32 %92, %90
  br i1 %93, label %.preheader, label %.loopexit, !llvm.loop !18

.lr.ph46:                                         ; preds = %.preheader, %.lr.ph46
  %.045 = phi i32 [ %98, %.lr.ph46 ], [ 0, %.preheader ]
  %.244 = phi i64 [ %97, %.lr.ph46 ], [ %.149, %.preheader ]
  %94 = call noundef i64 @_Z5calc2iii(i32 noundef %.02750, i32 noundef %.045, i32 noundef 0)
  %95 = call noundef i64 @_Z5calc2iii(i32 noundef %.02750, i32 noundef %.045, i32 noundef 1)
  %96 = mul nsw i64 %95, %94
  %97 = add nsw i64 %96, %.244
  %98 = add nuw nsw i32 %.045, 1
  %99 = load i32, ptr @M, align 4, !tbaa !5
  %100 = icmp slt i32 %98, %99
  br i1 %100, label %.lr.ph46, label %._crit_edge47.loopexit, !llvm.loop !17
}

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 #3

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 #3

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

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


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SCCPPass,SROAPass,SimpleLoopUnswitchPass,SimplifyCFGPass,TailCallElimPass