; LLVM IR from eyangch/competitive-programming :: Codeforces/1731 (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" }

@T = external dso_local global i64, align 8
@N = external dso_local global i64, align 8
@M = external dso_local global i64, align 8
@nm = external dso_local global [1000001 x i64], align 16
@rnm = external dso_local global [1000001 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i32, align 4
  %5 = alloca i64, align 8
  %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) @T)
  br label %17

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

21:                                               ; preds = %17
  %22 = 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)
  %23 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %22, ptr noundef nonnull align 8 dereferenceable(8) @M)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #7
  store i64 0, ptr %2, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #7
  %24 = load i64, ptr @N, align 8, !tbaa !8
  store i64 %24, ptr %3, align 8, !tbaa !8
  br label %25

25:                                               ; preds = %66, %21
  %26 = load i64, ptr %3, align 8, !tbaa !8
  %27 = icmp sgt i64 %26, 0
  br i1 %27, label %29, label %28

28:                                               ; preds = %25
  store i32 4, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #7
  br label %69

29:                                               ; preds = %25
  %30 = load i64, ptr @N, align 8, !tbaa !8
  %31 = load i64, ptr %3, align 8, !tbaa !8
  %32 = sdiv i64 %30, %31
  %33 = load i64, ptr %3, align 8, !tbaa !8
  %34 = getelementptr inbounds [1000001 x i64], ptr @nm, i64 0, i64 %33
  store i64 %32, ptr %34, align 8, !tbaa !8
  %35 = load i64, ptr %3, align 8, !tbaa !8
  %36 = getelementptr inbounds [1000001 x i64], ptr @nm, i64 0, i64 %35
  %37 = load i64, ptr %36, align 8, !tbaa !8
  %38 = load i64, ptr %3, align 8, !tbaa !8
  %39 = getelementptr inbounds [1000001 x i64], ptr @nm, i64 0, i64 %38
  %40 = load i64, ptr %39, align 8, !tbaa !8
  %41 = sub nsw i64 %40, 1
  %42 = mul nsw i64 %37, %41
  %43 = sdiv i64 %42, 2
  %44 = load i64, ptr %3, align 8, !tbaa !8
  %45 = getelementptr inbounds [1000001 x i64], ptr @rnm, i64 0, i64 %44
  store i64 %43, ptr %45, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  %46 = load i64, ptr %3, align 8, !tbaa !8
  %47 = mul nsw i64 2, %46
  store i64 %47, ptr %5, align 8, !tbaa !8
  br label %48

48:                                               ; preds = %61, %29
  %49 = load i64, ptr %5, align 8, !tbaa !8
  %50 = load i64, ptr @N, align 8, !tbaa !8
  %51 = icmp sle i64 %49, %50
  br i1 %51, label %53, label %52

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

53:                                               ; preds = %48
  %54 = load i64, ptr %5, align 8, !tbaa !8
  %55 = getelementptr inbounds [1000001 x i64], ptr @rnm, i64 0, i64 %54
  %56 = load i64, ptr %55, align 8, !tbaa !8
  %57 = load i64, ptr %3, align 8, !tbaa !8
  %58 = getelementptr inbounds [1000001 x i64], ptr @rnm, i64 0, i64 %57
  %59 = load i64, ptr %58, align 8, !tbaa !8
  %60 = sub nsw i64 %59, %56
  store i64 %60, ptr %58, align 8, !tbaa !8
  br label %61

61:                                               ; preds = %53
  %62 = load i64, ptr %3, align 8, !tbaa !8
  %63 = load i64, ptr %5, align 8, !tbaa !8
  %64 = add nsw i64 %63, %62
  store i64 %64, ptr %5, align 8, !tbaa !8
  br label %48, !llvm.loop !11

65:                                               ; preds = %52
  br label %66

66:                                               ; preds = %65
  %67 = load i64, ptr %3, align 8, !tbaa !8
  %68 = add nsw i64 %67, -1
  store i64 %68, ptr %3, align 8, !tbaa !8
  br label %25, !llvm.loop !13

69:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  %70 = load i64, ptr @N, align 8, !tbaa !8
  %71 = sub nsw i64 %70, 1
  store i64 %71, ptr %6, align 8, !tbaa !8
  br label %72

72:                                               ; preds = %126, %124, %69
  %73 = load i64, ptr %6, align 8, !tbaa !8
  %74 = icmp sgt i64 %73, 0
  br i1 %74, label %75, label %127

75:                                               ; preds = %72
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  %76 = load i64, ptr %6, align 8, !tbaa !8
  store i64 %76, ptr %7, align 8, !tbaa !8
  %77 = load i64, ptr %6, align 8, !tbaa !8
  %78 = add nsw i64 %77, 1
  %79 = getelementptr inbounds [1000001 x i64], ptr @rnm, i64 0, i64 %78
  %80 = load i64, ptr %79, align 8, !tbaa !8
  %81 = load i64, ptr %7, align 8, !tbaa !8
  %82 = icmp slt i64 %80, %81
  br i1 %82, label %83, label %86

83:                                               ; preds = %75
  %84 = load i64, ptr %6, align 8, !tbaa !8
  %85 = add nsw i64 %84, -1
  store i64 %85, ptr %6, align 8, !tbaa !8
  store i32 10, ptr %4, align 4
  br label %124, !llvm.loop !14

86:                                               ; preds = %75
  %87 = load i64, ptr %7, align 8, !tbaa !8
  %88 = load i64, ptr @M, align 8, !tbaa !8
  %89 = icmp sgt i64 %87, %88
  br i1 %89, label %90, label %93

90:                                               ; preds = %86
  %91 = load i64, ptr %6, align 8, !tbaa !8
  %92 = add nsw i64 %91, -1
  store i64 %92, ptr %6, align 8, !tbaa !8
  store i32 10, ptr %4, align 4
  br label %124, !llvm.loop !14

93:                                               ; preds = %86
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  %94 = load i64, ptr %6, align 8, !tbaa !8
  %95 = add nsw i64 %94, 1
  %96 = getelementptr inbounds [1000001 x i64], ptr @rnm, i64 0, i64 %95
  %97 = load i64, ptr %96, align 8, !tbaa !8
  %98 = load i64, ptr %7, align 8, !tbaa !8
  %99 = sdiv i64 %97, %98
  store i64 %99, ptr %8, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  %100 = load i64, ptr @M, align 8, !tbaa !8
  %101 = load i64, ptr %7, align 8, !tbaa !8
  %102 = sdiv i64 %100, %101
  store i64 %102, ptr %9, align 8, !tbaa !8
  %103 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %9)
  %104 = load i64, ptr %103, align 8, !tbaa !8
  store i64 %104, ptr %8, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  %105 = load i64, ptr %7, align 8, !tbaa !8
  %106 = load i64, ptr %8, align 8, !tbaa !8
  %107 = mul nsw i64 %105, %106
  %108 = load i64, ptr %6, align 8, !tbaa !8
  %109 = add nsw i64 %108, 1
  %110 = getelementptr inbounds [1000001 x i64], ptr @rnm, i64 0, i64 %109
  %111 = load i64, ptr %110, align 8, !tbaa !8
  %112 = sub nsw i64 %111, %107
  store i64 %112, ptr %110, align 8, !tbaa !8
  %113 = load i64, ptr %7, align 8, !tbaa !8
  %114 = load i64, ptr %8, align 8, !tbaa !8
  %115 = mul nsw i64 %113, %114
  %116 = load i64, ptr @M, align 8, !tbaa !8
  %117 = sub nsw i64 %116, %115
  store i64 %117, ptr @M, align 8, !tbaa !8
  %118 = load i64, ptr %8, align 8, !tbaa !8
  %119 = load i64, ptr %6, align 8, !tbaa !8
  %120 = add nsw i64 %119, 1
  %121 = mul nsw i64 %118, %120
  %122 = load i64, ptr %2, align 8, !tbaa !8
  %123 = add nsw i64 %122, %121
  store i64 %123, ptr %2, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  store i32 0, ptr %4, align 4
  br label %124

124:                                              ; preds = %93, %90, %83
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  %125 = load i32, ptr %4, align 4
  switch i32 %125, label %140 [
    i32 0, label %126
    i32 10, label %72
  ]

126:                                              ; preds = %124
  br label %72, !llvm.loop !14

127:                                              ; preds = %72
  %128 = load i64, ptr @M, align 8, !tbaa !8
  %129 = icmp ne i64 %128, 0
  br i1 %129, label %130, label %133

130:                                              ; preds = %127
  %131 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef -1)
  %132 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %131, i8 noundef signext 10)
  br label %137

133:                                              ; preds = %127
  %134 = load i64, ptr %2, align 8, !tbaa !8
  %135 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %134)
  %136 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %135, i8 noundef signext 10)
  br label %137

137:                                              ; preds = %133, %130
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #7
  br label %17, !llvm.loop !15

138:                                              ; preds = %17
  %139 = load i32, ptr %1, align 4
  ret i32 %139

140:                                              ; preds = %124
  unreachable
}

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

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) #2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) #3 align 2

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #5

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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #2

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

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


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

@T = external dso_local global i64, align 8
@N = external dso_local global i64, align 8
@M = external dso_local global i64, align 8
@nm = external dso_local local_unnamed_addr global [1000001 x i64], align 16
@rnm = external dso_local local_unnamed_addr global [1000001 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i64, align 8
  %2 = alloca i64, 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)
  %9 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @T)
  %10 = load i64, ptr @T, align 8, !tbaa !8
  %11 = add nsw i64 %10, -1
  store i64 %11, ptr @T, align 8, !tbaa !8
  %.not47 = icmp eq i64 %10, 0
  br i1 %.not47, label %._crit_edge50, label %.lr.ph49

.lr.ph49:                                         ; preds = %0, %61
  %12 = 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)
  %13 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %12, ptr noundef nonnull align 8 dereferenceable(8) @M)
  %14 = load i64, ptr @N, align 8, !tbaa !8
  %15 = icmp sgt i64 %14, 0
  br i1 %15, label %.lr.ph40, label %._crit_edge46

._crit_edge41:                                    ; preds = %._crit_edge
  %.not51 = icmp eq i64 %14, 1
  br i1 %.not51, label %._crit_edge46, label %.lr.ph45.preheader

.lr.ph45.preheader:                               ; preds = %._crit_edge41
  %16 = add nsw i64 %14, -1
  br label %.lr.ph45

.lr.ph40:                                         ; preds = %.lr.ph49, %._crit_edge
  %.03338 = phi i64 [ %24, %._crit_edge ], [ %14, %.lr.ph49 ]
  %17 = sdiv i64 %14, %.03338
  %18 = getelementptr inbounds [1000001 x i64], ptr @nm, i64 0, i64 %.03338
  store i64 %17, ptr %18, align 8, !tbaa !8
  %19 = add nsw i64 %17, -1
  %20 = mul nsw i64 %19, %17
  %21 = sdiv i64 %20, 2
  %22 = getelementptr inbounds [1000001 x i64], ptr @rnm, i64 0, i64 %.03338
  store i64 %21, ptr %22, align 8, !tbaa !8
  %23 = shl nuw nsw i64 %.03338, 1
  %.not3536 = icmp sgt i64 %23, %14
  br i1 %.not3536, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph40
  %24 = add nsw i64 %.03338, -1
  %25 = icmp sgt i64 %.03338, 1
  br i1 %25, label %.lr.ph40, label %._crit_edge41, !llvm.loop !11

.lr.ph:                                           ; preds = %.lr.ph40, %.lr.ph
  %26 = phi i64 [ %29, %.lr.ph ], [ %21, %.lr.ph40 ]
  %.03237 = phi i64 [ %30, %.lr.ph ], [ %23, %.lr.ph40 ]
  %27 = getelementptr inbounds [1000001 x i64], ptr @rnm, i64 0, i64 %.03237
  %28 = load i64, ptr %27, align 8, !tbaa !8
  %29 = sub nsw i64 %26, %28
  store i64 %29, ptr %22, align 8, !tbaa !8
  %30 = add nuw nsw i64 %.03237, %.03338
  %.not35 = icmp sgt i64 %30, %14
  br i1 %.not35, label %._crit_edge, label %.lr.ph, !llvm.loop !13

.lr.ph45:                                         ; preds = %.lr.ph45.preheader, %54
  %.043 = phi i64 [ %.1, %54 ], [ 0, %.lr.ph45.preheader ]
  %.03042 = phi i64 [ %.131, %54 ], [ %16, %.lr.ph45.preheader ]
  %31 = add nuw nsw i64 %.03042, 1
  %32 = getelementptr inbounds [1000001 x i64], ptr @rnm, i64 0, i64 %31
  %33 = load i64, ptr %32, align 8, !tbaa !8
  %34 = icmp slt i64 %33, %.03042
  br i1 %34, label %35, label %37

35:                                               ; preds = %.lr.ph45
  %36 = add nsw i64 %.03042, -1
  br label %54, !llvm.loop !14

37:                                               ; preds = %.lr.ph45
  %38 = load i64, ptr @M, align 8, !tbaa !8
  %39 = icmp sgt i64 %.03042, %38
  br i1 %39, label %40, label %42

40:                                               ; preds = %37
  %41 = add nsw i64 %.03042, -1
  br label %54, !llvm.loop !14

42:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #7
  %43 = udiv i64 %33, %.03042
  store i64 %43, ptr %1, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #7
  %44 = udiv i64 %38, %.03042
  store i64 %44, ptr %2, align 8, !tbaa !8
  %45 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %46 = load i64, ptr %45, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #7
  %47 = mul nsw i64 %46, %.03042
  %48 = load i64, ptr %32, align 8, !tbaa !8
  %49 = sub nsw i64 %48, %47
  store i64 %49, ptr %32, align 8, !tbaa !8
  %50 = load i64, ptr @M, align 8, !tbaa !8
  %51 = sub nsw i64 %50, %47
  store i64 %51, ptr @M, align 8, !tbaa !8
  %52 = mul nsw i64 %46, %31
  %53 = add nsw i64 %52, %.043
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #7
  br label %54

54:                                               ; preds = %42, %40, %35
  %.131 = phi i64 [ %36, %35 ], [ %41, %40 ], [ %.03042, %42 ]
  %.1 = phi i64 [ %.043, %35 ], [ %.043, %40 ], [ %53, %42 ]
  %55 = icmp sgt i64 %.131, 0
  br i1 %55, label %.lr.ph45, label %._crit_edge46

._crit_edge46:                                    ; preds = %54, %.lr.ph49, %._crit_edge41
  %.0.lcssa = phi i64 [ 0, %._crit_edge41 ], [ 0, %.lr.ph49 ], [ %.1, %54 ]
  %56 = load i64, ptr @M, align 8, !tbaa !8
  %.not34 = icmp eq i64 %56, 0
  br i1 %.not34, label %59, label %57

57:                                               ; preds = %._crit_edge46
  %58 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef -1)
  br label %61

59:                                               ; preds = %._crit_edge46
  %60 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.0.lcssa)
  br label %61

61:                                               ; preds = %59, %57
  %.sink = phi ptr [ %60, %59 ], [ %58, %57 ]
  %62 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %.sink, i8 noundef signext 10)
  %63 = load i64, ptr @T, align 8, !tbaa !8
  %64 = add nsw i64 %63, -1
  store i64 %64, ptr @T, align 8, !tbaa !8
  %.not = icmp eq i64 %63, 0
  br i1 %.not, label %._crit_edge50, label %.lr.ph49, !llvm.loop !15

._crit_edge50:                                    ; preds = %61, %0
  ret i32 0
}

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

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3 align 2

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #5

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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #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 #3 align 2

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


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