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

@MOD = external dso_local global i64, align 8
@T = external dso_local global i64, align 8
@N = external dso_local global i64, align 8
@M = external dso_local global i64, align 8
@p2 = external dso_local global [5000000 x i64], align 16
@_Z1sB5cxx11 = external dso_local global [2000 x %"class.std::__cxx11::basic_string"], 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 i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i32, align 4
  %7 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  %8 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %9 = getelementptr i8, ptr %8, i64 -24
  %10 = load i64, ptr %9, align 8
  %11 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %10
  %12 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %11, ptr noundef null)
  %13 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %14 = 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)
  store i64 1, ptr @p2, 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 %15

15:                                               ; preds = %29, %0
  %16 = load i64, ptr %2, align 8, !tbaa !8
  %17 = icmp slt i64 %16, 5000000
  br i1 %17, label %19, label %18

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

19:                                               ; preds = %15
  %20 = load i64, ptr %2, align 8, !tbaa !8
  %21 = sub nsw i64 %20, 1
  %22 = getelementptr inbounds [5000000 x i64], ptr @p2, i64 0, i64 %21
  %23 = load i64, ptr %22, align 8, !tbaa !8
  %24 = mul nsw i64 %23, 2
  %25 = load i64, ptr @MOD, align 8, !tbaa !8
  %26 = srem i64 %24, %25
  %27 = load i64, ptr %2, align 8, !tbaa !8
  %28 = getelementptr inbounds [5000000 x i64], ptr @p2, i64 0, i64 %27
  store i64 %26, ptr %28, align 8, !tbaa !8
  br label %29

29:                                               ; preds = %19
  %30 = load i64, ptr %2, align 8, !tbaa !8
  %31 = add nsw i64 %30, 1
  store i64 %31, ptr %2, align 8, !tbaa !8
  br label %15, !llvm.loop !11

32:                                               ; preds = %18
  br label %33

33:                                               ; preds = %98, %32
  %34 = load i64, ptr @T, align 8, !tbaa !8
  %35 = add nsw i64 %34, -1
  store i64 %35, ptr @T, align 8, !tbaa !8
  %36 = icmp ne i64 %34, 0
  br i1 %36, label %37, label %102

37:                                               ; preds = %33
  %38 = 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)
  %39 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %38, ptr noundef nonnull align 8 dereferenceable(8) @M)
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #6
  store i64 0, ptr %3, align 8, !tbaa !8
  br label %40

40:                                               ; preds = %49, %37
  %41 = load i64, ptr %3, align 8, !tbaa !8
  %42 = load i64, ptr @N, align 8, !tbaa !8
  %43 = icmp slt i64 %41, %42
  br i1 %43, label %45, label %44

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

45:                                               ; preds = %40
  %46 = load i64, ptr %3, align 8, !tbaa !8
  %47 = getelementptr inbounds [2000 x %"class.std::__cxx11::basic_string"], ptr @_Z1sB5cxx11, i64 0, i64 %46
  %48 = 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) %47)
  br label %49

49:                                               ; preds = %45
  %50 = load i64, ptr %3, align 8, !tbaa !8
  %51 = add nsw i64 %50, 1
  store i64 %51, ptr %3, align 8, !tbaa !8
  br label %40, !llvm.loop !13

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

53:                                               ; preds = %80, %52
  %54 = load i64, ptr %5, align 8, !tbaa !8
  %55 = load i64, ptr @N, align 8, !tbaa !8
  %56 = icmp slt i64 %54, %55
  br i1 %56, label %58, label %57

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

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

59:                                               ; preds = %76, %58
  %60 = load i64, ptr %7, align 8, !tbaa !8
  %61 = load i64, ptr @M, align 8, !tbaa !8
  %62 = icmp slt i64 %60, %61
  br i1 %62, label %64, label %63

63:                                               ; preds = %59
  store i32 13, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  br label %79

64:                                               ; preds = %59
  %65 = load i64, ptr %5, align 8, !tbaa !8
  %66 = getelementptr inbounds [2000 x %"class.std::__cxx11::basic_string"], ptr @_Z1sB5cxx11, i64 0, i64 %65
  %67 = load i64, ptr %7, align 8, !tbaa !8
  %68 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %66, i64 noundef %67)
  %69 = load i8, ptr %68, align 1, !tbaa !14
  %70 = sext i8 %69 to i32
  %71 = icmp eq i32 %70, 35
  br i1 %71, label %72, label %75

72:                                               ; preds = %64
  %73 = load i64, ptr %4, align 8, !tbaa !8
  %74 = add nsw i64 %73, 1
  store i64 %74, ptr %4, align 8, !tbaa !8
  br label %75

75:                                               ; preds = %72, %64
  br label %76

76:                                               ; preds = %75
  %77 = load i64, ptr %7, align 8, !tbaa !8
  %78 = add nsw i64 %77, 1
  store i64 %78, ptr %7, align 8, !tbaa !8
  br label %59, !llvm.loop !15

79:                                               ; preds = %63
  br label %80

80:                                               ; preds = %79
  %81 = load i64, ptr %5, align 8, !tbaa !8
  %82 = add nsw i64 %81, 1
  store i64 %82, ptr %5, align 8, !tbaa !8
  br label %53, !llvm.loop !16

83:                                               ; preds = %57
  %84 = load i64, ptr %4, align 8, !tbaa !8
  %85 = load i64, ptr @N, align 8, !tbaa !8
  %86 = load i64, ptr @M, align 8, !tbaa !8
  %87 = mul nsw i64 %85, %86
  %88 = icmp eq i64 %84, %87
  br i1 %88, label %89, label %94

89:                                               ; preds = %83
  %90 = load i64, ptr %4, align 8, !tbaa !8
  %91 = getelementptr inbounds [5000000 x i64], ptr @p2, i64 0, i64 %90
  %92 = load i64, ptr %91, align 8, !tbaa !8
  %93 = sub nsw i64 %92, 1
  br label %98

94:                                               ; preds = %83
  %95 = load i64, ptr %4, align 8, !tbaa !8
  %96 = getelementptr inbounds [5000000 x i64], ptr @p2, i64 0, i64 %95
  %97 = load i64, ptr %96, align 8, !tbaa !8
  br label %98

98:                                               ; preds = %94, %89
  %99 = phi i64 [ %93, %89 ], [ %97, %94 ]
  %100 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %99)
  %101 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %100, i8 noundef signext 10)
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  br label %33, !llvm.loop !17

102:                                              ; preds = %33
  %103 = load i32, ptr %1, align 4
  ret i32 %103
}

; 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

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

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

; 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 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 = !{!10, !10, i64 0}
!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::__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" }

@MOD = external dso_local local_unnamed_addr global i64, align 8
@T = external dso_local global i64, align 8
@N = external dso_local global i64, align 8
@M = external dso_local global i64, align 8
@p2 = external dso_local local_unnamed_addr global [5000000 x i64], align 16
@_Z1sB5cxx11 = external dso_local global [2000 x %"class.std::__cxx11::basic_string"], 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 = 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) @T)
  store i64 1, ptr @p2, align 16, !tbaa !8
  %8 = load i64, ptr @MOD, align 8, !tbaa !8
  br label %11

.preheader24:                                     ; preds = %11
  %9 = load i64, ptr @T, align 8, !tbaa !8
  %10 = add nsw i64 %9, -1
  store i64 %10, ptr @T, align 8, !tbaa !8
  %.not36 = icmp eq i64 %9, 0
  br i1 %.not36, label %._crit_edge38, label %.lr.ph37

11:                                               ; preds = %17, %0
  %12 = phi i64 [ 1, %0 ], [ %19, %17 ]
  %.02125 = phi i64 [ 1, %0 ], [ %21, %17 ]
  %13 = shl nsw i64 %12, 1
  %14 = srem i64 %13, %8
  %15 = getelementptr inbounds [5000000 x i64], ptr @p2, i64 0, i64 %.02125
  store i64 %14, ptr %15, align 8, !tbaa !8
  %16 = add nuw nsw i64 %.02125, 1
  %exitcond.not = icmp eq i64 %16, 5000000
  br i1 %exitcond.not, label %.preheader24, label %17, !llvm.loop !11

17:                                               ; preds = %11
  %18 = shl nsw i64 %14, 1
  %19 = srem i64 %18, %8
  %20 = getelementptr inbounds [5000000 x i64], ptr @p2, i64 0, i64 %16
  store i64 %19, ptr %20, align 8, !tbaa !8
  %21 = add nuw nsw i64 %.02125, 2
  br label %11

.lr.ph37:                                         ; preds = %.preheader24, %._crit_edge32
  %22 = 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)
  %23 = tail 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)
  %24 = load i64, ptr @N, align 8, !tbaa !8
  %25 = icmp sgt i64 %24, 0
  br i1 %25, label %.lr.ph, label %.preheader23.thread

.preheader23.thread:                              ; preds = %.lr.ph37
  %.pre4142 = load i64, ptr @M, align 8, !tbaa !8
  br label %._crit_edge32

.preheader23:                                     ; preds = %.lr.ph
  %26 = icmp sgt i64 %31, 0
  %.pre41 = load i64, ptr @M, align 8, !tbaa !8
  %27 = icmp sgt i64 %.pre41, 0
  %or.cond = select i1 %26, i1 %27, i1 false
  br i1 %or.cond, label %.preheader, label %._crit_edge32

.lr.ph:                                           ; preds = %.lr.ph37, %.lr.ph
  %.02026 = phi i64 [ %30, %.lr.ph ], [ 0, %.lr.ph37 ]
  %28 = getelementptr inbounds [2000 x %"class.std::__cxx11::basic_string"], ptr @_Z1sB5cxx11, i64 0, i64 %.02026
  %29 = 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) %28)
  %30 = add nuw nsw i64 %.02026, 1
  %31 = load i64, ptr @N, align 8, !tbaa !8
  %32 = icmp slt i64 %30, %31
  br i1 %32, label %.lr.ph, label %.preheader23, !llvm.loop !13

.preheader:                                       ; preds = %.preheader23, %._crit_edge
  %33 = phi i64 [ %48, %._crit_edge ], [ %31, %.preheader23 ]
  %34 = phi i64 [ %49, %._crit_edge ], [ %.pre41, %.preheader23 ]
  %.01831 = phi i64 [ %50, %._crit_edge ], [ 0, %.preheader23 ]
  %.01930 = phi i64 [ %.1.lcssa, %._crit_edge ], [ 0, %.preheader23 ]
  %35 = icmp sgt i64 %34, 0
  br i1 %35, label %.lr.ph29, label %._crit_edge

.lr.ph29:                                         ; preds = %.preheader
  %36 = getelementptr inbounds [2000 x %"class.std::__cxx11::basic_string"], ptr @_Z1sB5cxx11, i64 0, i64 %.01831
  br label %52

._crit_edge32:                                    ; preds = %._crit_edge, %.preheader23.thread, %.preheader23
  %37 = phi i64 [ %.pre41, %.preheader23 ], [ %.pre4142, %.preheader23.thread ], [ %49, %._crit_edge ]
  %.019.lcssa = phi i64 [ 0, %.preheader23 ], [ 0, %.preheader23.thread ], [ %.1.lcssa, %._crit_edge ]
  %.lcssa = phi i64 [ %31, %.preheader23 ], [ %24, %.preheader23.thread ], [ %48, %._crit_edge ]
  %38 = mul nsw i64 %37, %.lcssa
  %39 = icmp eq i64 %.019.lcssa, %38
  %40 = getelementptr inbounds [5000000 x i64], ptr @p2, i64 0, i64 %.019.lcssa
  %41 = load i64, ptr %40, align 8, !tbaa !8
  %42 = sext i1 %39 to i64
  %43 = add nsw i64 %41, %42
  %44 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %43)
  %45 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %44, i8 noundef signext 10)
  %46 = load i64, ptr @T, align 8, !tbaa !8
  %47 = add nsw i64 %46, -1
  store i64 %47, ptr @T, align 8, !tbaa !8
  %.not = icmp eq i64 %46, 0
  br i1 %.not, label %._crit_edge38, label %.lr.ph37, !llvm.loop !14

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

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader
  %48 = phi i64 [ %33, %.preheader ], [ %.pre, %._crit_edge.loopexit ]
  %49 = phi i64 [ %34, %.preheader ], [ %58, %._crit_edge.loopexit ]
  %.1.lcssa = phi i64 [ %.01930, %.preheader ], [ %spec.select, %._crit_edge.loopexit ]
  %50 = add nuw nsw i64 %.01831, 1
  %51 = icmp slt i64 %50, %48
  br i1 %51, label %.preheader, label %._crit_edge32, !llvm.loop !15

52:                                               ; preds = %.lr.ph29, %52
  %.028 = phi i64 [ 0, %.lr.ph29 ], [ %57, %52 ]
  %.127 = phi i64 [ %.01930, %.lr.ph29 ], [ %spec.select, %52 ]
  %53 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %36, i64 noundef %.028)
  %54 = load i8, ptr %53, align 1, !tbaa !17
  %55 = icmp eq i8 %54, 35
  %56 = zext i1 %55 to i64
  %spec.select = add nsw i64 %.127, %56
  %57 = add nuw nsw i64 %.028, 1
  %58 = load i64, ptr @M, align 8, !tbaa !8
  %59 = icmp slt i64 %57, %58
  br i1 %59, label %52, label %._crit_edge.loopexit, !llvm.loop !18

._crit_edge38:                                    ; preds = %._crit_edge32, %.preheader24
  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

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

; 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: 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 #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 = { 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}
!16 = !{!"llvm.loop.unswitch.partial.disable"}
!17 = !{!10, !10, i64 0}
!18 = distinct !{!18, !12}


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