; LLVM IR from eyangch/competitive-programming :: Codeforces/1515 (e)

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

@N = external dso_local global i64, align 8
@M = external dso_local global i64, align 8
@dp = external dso_local global [400 x [400 x i64]], align 16
@fact = external dso_local global [100000 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1

; 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 nounwind uwtable
declare dso_local noundef i64 @_Z3segxx(i64 noundef, i64 noundef) #1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %1 = alloca i32, align 4
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i32, align 4
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  %10 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %11 = getelementptr i8, ptr %10, i64 -24
  %12 = load i64, ptr %11, align 8
  %13 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %12
  %14 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %13, ptr noundef null)
  %15 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %16 = 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)
  %17 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %16, ptr noundef nonnull align 8 dereferenceable(8) @M)
  store i64 1, ptr @fact, align 16, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #6
  store i64 1, ptr %2, align 8, !tbaa !8
  br label %18

18:                                               ; preds = %33, %0
  %19 = load i64, ptr %2, align 8, !tbaa !8
  %20 = icmp slt i64 %19, 100000
  br i1 %20, label %22, label %21

21:                                               ; preds = %18
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #6
  br label %36

22:                                               ; preds = %18
  %23 = load i64, ptr %2, align 8, !tbaa !8
  %24 = sub nsw i64 %23, 1
  %25 = getelementptr inbounds [100000 x i64], ptr @fact, i64 0, i64 %24
  %26 = load i64, ptr %25, align 8, !tbaa !8
  %27 = load i64, ptr %2, align 8, !tbaa !8
  %28 = mul nsw i64 %26, %27
  %29 = load i64, ptr @M, align 8, !tbaa !8
  %30 = srem i64 %28, %29
  %31 = load i64, ptr %2, align 8, !tbaa !8
  %32 = getelementptr inbounds [100000 x i64], ptr @fact, i64 0, i64 %31
  store i64 %30, ptr %32, align 8, !tbaa !8
  br label %33

33:                                               ; preds = %22
  %34 = load i64, ptr %2, align 8, !tbaa !8
  %35 = add nsw i64 %34, 1
  store i64 %35, ptr %2, align 8, !tbaa !8
  br label %18, !llvm.loop !11

36:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #6
  store i64 0, ptr %3, align 8, !tbaa !8
  br label %37

37:                                               ; preds = %52, %36
  %38 = load i64, ptr %3, align 8, !tbaa !8
  %39 = load i64, ptr @N, align 8, !tbaa !8
  %40 = icmp slt i64 %38, %39
  br i1 %40, label %42, label %41

41:                                               ; preds = %37
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  br label %55

42:                                               ; preds = %37
  %43 = load i64, ptr %3, align 8, !tbaa !8
  %44 = add nsw i64 %43, 1
  %45 = load i64, ptr %3, align 8, !tbaa !8
  %46 = add nsw i64 %45, 1
  %47 = call noundef i64 @_Z3segxx(i64 noundef %44, i64 noundef %46)
  %48 = load i64, ptr %3, align 8, !tbaa !8
  %49 = getelementptr inbounds [400 x [400 x i64]], ptr @dp, i64 0, i64 %48
  %50 = load i64, ptr %3, align 8, !tbaa !8
  %51 = getelementptr inbounds [400 x i64], ptr %49, i64 0, i64 %50
  store i64 %47, ptr %51, align 8, !tbaa !8
  br label %52

52:                                               ; preds = %42
  %53 = load i64, ptr %3, align 8, !tbaa !8
  %54 = add nsw i64 %53, 1
  store i64 %54, ptr %3, align 8, !tbaa !8
  br label %37, !llvm.loop !13

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

56:                                               ; preds = %119, %55
  %57 = load i64, ptr %4, align 8, !tbaa !8
  %58 = load i64, ptr @N, align 8, !tbaa !8
  %59 = icmp slt i64 %57, %58
  br i1 %59, label %61, label %60

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

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

62:                                               ; preds = %115, %61
  %63 = load i64, ptr %6, align 8, !tbaa !8
  %64 = load i64, ptr %4, align 8, !tbaa !8
  %65 = icmp sle i64 %63, %64
  br i1 %65, label %67, label %66

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

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

68:                                               ; preds = %111, %67
  %69 = load i64, ptr %4, align 8, !tbaa !8
  %70 = load i64, ptr %7, align 8, !tbaa !8
  %71 = sub nsw i64 %69, %70
  %72 = icmp sgt i64 %71, 0
  br i1 %72, label %73, label %78

73:                                               ; preds = %68
  %74 = load i64, ptr %6, align 8, !tbaa !8
  %75 = load i64, ptr %7, align 8, !tbaa !8
  %76 = sub nsw i64 %74, %75
  %77 = icmp sge i64 %76, 0
  br label %78

78:                                               ; preds = %73, %68
  %79 = phi i1 [ false, %68 ], [ %77, %73 ]
  br i1 %79, label %81, label %80

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

81:                                               ; preds = %78
  %82 = load i64, ptr %4, align 8, !tbaa !8
  %83 = getelementptr inbounds [400 x [400 x i64]], ptr @dp, i64 0, i64 %82
  %84 = load i64, ptr %6, align 8, !tbaa !8
  %85 = getelementptr inbounds [400 x i64], ptr %83, i64 0, i64 %84
  %86 = load i64, ptr %85, align 8, !tbaa !8
  %87 = load i64, ptr %4, align 8, !tbaa !8
  %88 = load i64, ptr %7, align 8, !tbaa !8
  %89 = sub nsw i64 %87, %88
  %90 = sub nsw i64 %89, 1
  %91 = getelementptr inbounds [400 x [400 x i64]], ptr @dp, i64 0, i64 %90
  %92 = load i64, ptr %6, align 8, !tbaa !8
  %93 = load i64, ptr %7, align 8, !tbaa !8
  %94 = sub nsw i64 %92, %93
  %95 = getelementptr inbounds [400 x i64], ptr %91, i64 0, i64 %94
  %96 = load i64, ptr %95, align 8, !tbaa !8
  %97 = load i64, ptr %6, align 8, !tbaa !8
  %98 = add nsw i64 %97, 1
  %99 = load i64, ptr %7, align 8, !tbaa !8
  %100 = call noundef i64 @_Z3segxx(i64 noundef %98, i64 noundef %99)
  %101 = mul nsw i64 %96, %100
  %102 = load i64, ptr @M, align 8, !tbaa !8
  %103 = srem i64 %101, %102
  %104 = add nsw i64 %86, %103
  %105 = load i64, ptr @M, align 8, !tbaa !8
  %106 = srem i64 %104, %105
  %107 = load i64, ptr %4, align 8, !tbaa !8
  %108 = getelementptr inbounds [400 x [400 x i64]], ptr @dp, i64 0, i64 %107
  %109 = load i64, ptr %6, align 8, !tbaa !8
  %110 = getelementptr inbounds [400 x i64], ptr %108, i64 0, i64 %109
  store i64 %106, ptr %110, align 8, !tbaa !8
  br label %111

111:                                              ; preds = %81
  %112 = load i64, ptr %7, align 8, !tbaa !8
  %113 = add nsw i64 %112, 1
  store i64 %113, ptr %7, align 8, !tbaa !8
  br label %68, !llvm.loop !14

114:                                              ; preds = %80
  br label %115

115:                                              ; preds = %114
  %116 = load i64, ptr %6, align 8, !tbaa !8
  %117 = add nsw i64 %116, 1
  store i64 %117, ptr %6, align 8, !tbaa !8
  br label %62, !llvm.loop !15

118:                                              ; preds = %66
  br label %119

119:                                              ; preds = %118
  %120 = load i64, ptr %4, align 8, !tbaa !8
  %121 = add nsw i64 %120, 1
  store i64 %121, ptr %4, align 8, !tbaa !8
  br label %56, !llvm.loop !16

122:                                              ; preds = %60
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  store i64 0, ptr %8, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  store i64 0, ptr %9, align 8, !tbaa !8
  br label %123

123:                                              ; preds = %139, %122
  %124 = load i64, ptr %9, align 8, !tbaa !8
  %125 = load i64, ptr @N, align 8, !tbaa !8
  %126 = icmp slt i64 %124, %125
  br i1 %126, label %128, label %127

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

128:                                              ; preds = %123
  %129 = load i64, ptr %8, align 8, !tbaa !8
  %130 = load i64, ptr @N, align 8, !tbaa !8
  %131 = sub nsw i64 %130, 1
  %132 = getelementptr inbounds [400 x [400 x i64]], ptr @dp, i64 0, i64 %131
  %133 = load i64, ptr %9, align 8, !tbaa !8
  %134 = getelementptr inbounds [400 x i64], ptr %132, i64 0, i64 %133
  %135 = load i64, ptr %134, align 8, !tbaa !8
  %136 = add nsw i64 %129, %135
  %137 = load i64, ptr @M, align 8, !tbaa !8
  %138 = srem i64 %136, %137
  store i64 %138, ptr %8, align 8, !tbaa !8
  br label %139

139:                                              ; preds = %128
  %140 = load i64, ptr %9, align 8, !tbaa !8
  %141 = add nsw i64 %140, 1
  store i64 %141, ptr %9, align 8, !tbaa !8
  br label %123, !llvm.loop !17

142:                                              ; preds = %127
  %143 = load i64, ptr %8, align 8, !tbaa !8
  %144 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %143)
  %145 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %144, ptr noundef @.str)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  %146 = load i32, ptr %1, align 4
  ret i32 %146
}

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

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

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { 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 = { 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}
!17 = distinct !{!17, !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" }

@N = external dso_local global i64, align 8
@M = external dso_local global i64, align 8
@dp = external dso_local local_unnamed_addr global [400 x [400 x i64]], align 16
@fact = external dso_local local_unnamed_addr global [100000 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %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) @N)
  %8 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %7, ptr noundef nonnull align 8 dereferenceable(8) @M)
  store i64 1, ptr @fact, align 16, !tbaa !8
  %9 = load i64, ptr @M, align 8, !tbaa !8
  br label %12

.preheader49:                                     ; preds = %12
  %10 = load i64, ptr @N, align 8, !tbaa !8
  %11 = icmp sgt i64 %10, 0
  br i1 %11, label %.lr.ph, label %._crit_edge59

12:                                               ; preds = %12, %0
  %13 = phi i64 [ 1, %0 ], [ %23, %12 ]
  %.04250 = phi i64 [ 1, %0 ], [ %25, %12 ]
  %14 = mul nsw i64 %13, %.04250
  %15 = srem i64 %14, %9
  %16 = getelementptr inbounds [100000 x i64], ptr @fact, i64 0, i64 %.04250
  store i64 %15, ptr %16, align 8, !tbaa !8
  %17 = add nuw nsw i64 %.04250, 1
  %18 = mul nsw i64 %15, %17
  %19 = srem i64 %18, %9
  %20 = getelementptr inbounds [100000 x i64], ptr @fact, i64 0, i64 %17
  store i64 %19, ptr %20, align 8, !tbaa !8
  %21 = add nuw nsw i64 %.04250, 2
  %22 = mul nsw i64 %19, %21
  %23 = srem i64 %22, %9
  %24 = getelementptr inbounds [100000 x i64], ptr @fact, i64 0, i64 %21
  store i64 %23, ptr %24, align 8, !tbaa !8
  %25 = add nuw nsw i64 %.04250, 3
  %exitcond.not.2 = icmp eq i64 %25, 100000
  br i1 %exitcond.not.2, label %.preheader49, label %12, !llvm.loop !11

.preheader48:                                     ; preds = %.lr.ph
  %26 = icmp sgt i64 %30, 1
  br i1 %26, label %.preheader47, label %.preheader

.lr.ph:                                           ; preds = %.preheader49, %.lr.ph
  %.04151 = phi i64 [ %27, %.lr.ph ], [ 0, %.preheader49 ]
  %27 = add nuw nsw i64 %.04151, 1
  %28 = tail call noundef i64 @_Z3segxx(i64 noundef %27, i64 noundef %27)
  %29 = getelementptr inbounds [400 x [400 x i64]], ptr @dp, i64 0, i64 %.04151, i64 %.04151
  store i64 %28, ptr %29, align 8, !tbaa !8
  %30 = load i64, ptr @N, align 8, !tbaa !8
  %31 = icmp slt i64 %27, %30
  br i1 %31, label %.lr.ph, label %.preheader48, !llvm.loop !13

.preheader47:                                     ; preds = %.preheader48, %.split.us
  %32 = phi i64 [ %42, %.split.us ], [ %30, %.preheader48 ]
  %indvars.iv = phi i64 [ %indvars.iv.next, %.split.us ], [ 2, %.preheader48 ]
  %.04055 = phi i64 [ %43, %.split.us ], [ 1, %.preheader48 ]
  %33 = add nsw i64 %.04055, -1
  %34 = icmp ugt i64 %.04055, 1
  br i1 %34, label %.preheader46, label %.split.us

.preheader:                                       ; preds = %.split.us, %.preheader48
  %.lcssa = phi i64 [ %30, %.preheader48 ], [ %42, %.split.us ]
  %35 = icmp sgt i64 %.lcssa, 0
  br i1 %35, label %.lr.ph58, label %._crit_edge59

.lr.ph58:                                         ; preds = %.preheader
  %36 = add nsw i64 %.lcssa, -1
  %37 = load i64, ptr @M, align 8, !tbaa !8
  %xtraiter = and i64 %.lcssa, 1
  %38 = icmp eq i64 %.lcssa, 1
  br i1 %38, label %._crit_edge59.loopexit.unr-lcssa, label %.lr.ph58.new

.lr.ph58.new:                                     ; preds = %.lr.ph58
  %unroll_iter = and i64 %.lcssa, 9223372036854775806
  br label %70

.preheader46:                                     ; preds = %.preheader47, %._crit_edge
  %.03954 = phi i64 [ %.pre-phi, %._crit_edge ], [ 0, %.preheader47 ]
  %.not61 = icmp eq i64 %.03954, 0
  br i1 %.not61, label %._crit_edge, label %.lr.ph53

.lr.ph53:                                         ; preds = %.preheader46
  %39 = add nsw i64 %.03954, -1
  %40 = getelementptr inbounds [400 x [400 x i64]], ptr @dp, i64 0, i64 %.04055, i64 %.03954
  %41 = add nuw nsw i64 %.03954, 1
  %.pre = load i64, ptr %40, align 8, !tbaa !8
  br label %45

.split.us.loopexit:                               ; preds = %._crit_edge
  %.pre67 = load i64, ptr @N, align 8, !tbaa !8
  br label %.split.us

.split.us:                                        ; preds = %.preheader47, %.split.us.loopexit
  %42 = phi i64 [ %.pre67, %.split.us.loopexit ], [ %32, %.preheader47 ]
  %43 = add nuw nsw i64 %.04055, 1
  %44 = icmp slt i64 %43, %42
  %indvars.iv.next = add nuw i64 %indvars.iv, 1
  br i1 %44, label %.preheader47, label %.preheader, !llvm.loop !14

._crit_edge:                                      ; preds = %45, %.preheader46
  %.pre-phi = phi i64 [ 1, %.preheader46 ], [ %41, %45 ]
  %exitcond65.not = icmp eq i64 %.pre-phi, %indvars.iv
  br i1 %exitcond65.not, label %.split.us.loopexit, label %.preheader46, !llvm.loop !15

45:                                               ; preds = %.lr.ph53, %45
  %46 = phi i64 [ %.pre, %.lr.ph53 ], [ %57, %45 ]
  %47 = phi i64 [ %39, %.lr.ph53 ], [ %61, %45 ]
  %48 = phi i64 [ %33, %.lr.ph53 ], [ %59, %45 ]
  %.03852 = phi i64 [ 1, %.lr.ph53 ], [ %58, %45 ]
  %49 = add nsw i64 %48, -1
  %50 = getelementptr inbounds [400 x [400 x i64]], ptr @dp, i64 0, i64 %49, i64 %47
  %51 = load i64, ptr %50, align 8, !tbaa !8
  %52 = tail call noundef i64 @_Z3segxx(i64 noundef %41, i64 noundef %.03852)
  %53 = mul nsw i64 %52, %51
  %54 = load i64, ptr @M, align 8, !tbaa !8
  %55 = srem i64 %53, %54
  %56 = add nsw i64 %55, %46
  %57 = srem i64 %56, %54
  store i64 %57, ptr %40, align 8, !tbaa !8
  %58 = add nuw nsw i64 %.03852, 1
  %59 = sub nsw i64 %.04055, %58
  %60 = icmp sgt i64 %59, 0
  %61 = sub nsw i64 %.03954, %58
  %62 = icmp sgt i64 %61, -1
  %63 = select i1 %60, i1 %62, i1 false
  br i1 %63, label %45, label %._crit_edge, !llvm.loop !16

._crit_edge59.loopexit.unr-lcssa:                 ; preds = %70, %.lr.ph58
  %.lcssa76.ph = phi i64 [ poison, %.lr.ph58 ], [ %79, %70 ]
  %.057.unr = phi i64 [ 0, %.lr.ph58 ], [ %80, %70 ]
  %.03756.unr = phi i64 [ 0, %.lr.ph58 ], [ %79, %70 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge59, label %._crit_edge59.loopexit.epilog-lcssa

._crit_edge59.loopexit.epilog-lcssa:              ; preds = %._crit_edge59.loopexit.unr-lcssa
  %64 = getelementptr inbounds [400 x [400 x i64]], ptr @dp, i64 0, i64 %36, i64 %.057.unr
  %65 = load i64, ptr %64, align 8, !tbaa !8
  %66 = add nsw i64 %65, %.03756.unr
  %67 = srem i64 %66, %37
  br label %._crit_edge59

._crit_edge59:                                    ; preds = %._crit_edge59.loopexit.epilog-lcssa, %._crit_edge59.loopexit.unr-lcssa, %.preheader49, %.preheader
  %.037.lcssa = phi i64 [ 0, %.preheader ], [ 0, %.preheader49 ], [ %.lcssa76.ph, %._crit_edge59.loopexit.unr-lcssa ], [ %67, %._crit_edge59.loopexit.epilog-lcssa ]
  %68 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.037.lcssa)
  %69 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %68, ptr noundef nonnull @.str)
  ret i32 0

70:                                               ; preds = %70, %.lr.ph58.new
  %.057 = phi i64 [ 0, %.lr.ph58.new ], [ %80, %70 ]
  %.03756 = phi i64 [ 0, %.lr.ph58.new ], [ %79, %70 ]
  %niter = phi i64 [ 0, %.lr.ph58.new ], [ %niter.next.1, %70 ]
  %71 = getelementptr inbounds [400 x [400 x i64]], ptr @dp, i64 0, i64 %36, i64 %.057
  %72 = load i64, ptr %71, align 16, !tbaa !8
  %73 = add nsw i64 %72, %.03756
  %74 = srem i64 %73, %37
  %75 = or disjoint i64 %.057, 1
  %76 = getelementptr inbounds [400 x [400 x i64]], ptr @dp, i64 0, i64 %36, i64 %75
  %77 = load i64, ptr %76, align 8, !tbaa !8
  %78 = add nsw i64 %77, %74
  %79 = srem i64 %78, %37
  %80 = add nuw nsw i64 %.057, 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 %._crit_edge59.loopexit.unr-lcssa, label %70, !llvm.loop !17
}

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) local_unnamed_addr #0 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_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

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 = { "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" }

!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}
!17 = distinct !{!17, !12}


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