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

@MOD = external dso_local global i64, align 8
@N = external dso_local global i32, align 4
@_Z6secondB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@n11 = external dso_local global [100001 x i64], align 16
@n10 = external dso_local global [100001 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 i32, align 4
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i32, align 4
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %8 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %9 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %10 = getelementptr i8, ptr %9, i64 -24
  %11 = load i64, ptr %10, align 8
  %12 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %11
  %13 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %12, ptr noundef null)
  %14 = 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) @_Z6secondB5cxx11)
  %15 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z6secondB5cxx11) #6
  %16 = trunc i64 %15 to i32
  store i32 %16, ptr @N, align 4, !tbaa !8
  store i64 1, ptr @n10, align 16, !tbaa !11
  store i64 1, ptr @n11, align 16, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 1, ptr %2, align 4, !tbaa !8
  br label %17

17:                                               ; preds = %46, %0
  %18 = load i32, ptr %2, align 4, !tbaa !8
  %19 = load i32, ptr @N, align 4, !tbaa !8
  %20 = icmp slt i32 %18, %19
  br i1 %20, label %22, label %21

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

22:                                               ; preds = %17
  %23 = load i32, ptr %2, align 4, !tbaa !8
  %24 = sub nsw i32 %23, 1
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [100001 x i64], ptr @n11, i64 0, i64 %25
  %27 = load i64, ptr %26, align 8, !tbaa !11
  %28 = mul nsw i64 %27, 10
  %29 = add nsw i64 %28, 1
  %30 = load i64, ptr @MOD, align 8, !tbaa !11
  %31 = srem i64 %29, %30
  %32 = load i32, ptr %2, align 4, !tbaa !8
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [100001 x i64], ptr @n11, i64 0, i64 %33
  store i64 %31, ptr %34, align 8, !tbaa !11
  %35 = load i32, ptr %2, align 4, !tbaa !8
  %36 = sub nsw i32 %35, 1
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [100001 x i64], ptr @n10, i64 0, i64 %37
  %39 = load i64, ptr %38, align 8, !tbaa !11
  %40 = mul nsw i64 %39, 10
  %41 = load i64, ptr @MOD, align 8, !tbaa !11
  %42 = srem i64 %40, %41
  %43 = load i32, ptr %2, align 4, !tbaa !8
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [100001 x i64], ptr @n10, i64 0, i64 %44
  store i64 %42, ptr %45, align 8, !tbaa !11
  br label %46

46:                                               ; preds = %22
  %47 = load i32, ptr %2, align 4, !tbaa !8
  %48 = add nsw i32 %47, 1
  store i32 %48, ptr %2, align 4, !tbaa !8
  br label %17, !llvm.loop !13

49:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #6
  store i64 0, ptr %3, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  store i64 0, ptr %4, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  %50 = load i32, ptr @N, align 4, !tbaa !8
  %51 = sub nsw i32 %50, 1
  store i32 %51, ptr %5, align 4, !tbaa !8
  br label %52

52:                                               ; preds = %86, %49
  %53 = load i32, ptr %5, align 4, !tbaa !8
  %54 = icmp sge i32 %53, 0
  br i1 %54, label %56, label %55

55:                                               ; preds = %52
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  br label %89

56:                                               ; preds = %52
  %57 = load i32, ptr %5, align 4, !tbaa !8
  %58 = sext i32 %57 to i64
  %59 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z6secondB5cxx11, i64 noundef %58)
  %60 = load i8, ptr %59, align 1, !tbaa !15
  %61 = sext i8 %60 to i32
  %62 = sub nsw i32 %61, 48
  %63 = sext i32 %62 to i64
  %64 = load i32, ptr @N, align 4, !tbaa !8
  %65 = sub nsw i32 %64, 1
  %66 = load i32, ptr %5, align 4, !tbaa !8
  %67 = sub nsw i32 %65, %66
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [100001 x i64], ptr @n10, i64 0, i64 %68
  %70 = load i64, ptr %69, align 8, !tbaa !11
  %71 = mul nsw i64 %63, %70
  %72 = load i64, ptr %4, align 8, !tbaa !11
  %73 = add nsw i64 %72, %71
  store i64 %73, ptr %4, align 8, !tbaa !11
  %74 = load i64, ptr @MOD, align 8, !tbaa !11
  %75 = load i64, ptr %4, align 8, !tbaa !11
  %76 = srem i64 %75, %74
  store i64 %76, ptr %4, align 8, !tbaa !11
  %77 = load i64, ptr %4, align 8, !tbaa !11
  %78 = load i32, ptr %5, align 4, !tbaa !8
  %79 = sext i32 %78 to i64
  %80 = mul nsw i64 %77, %79
  %81 = load i64, ptr %3, align 8, !tbaa !11
  %82 = add nsw i64 %81, %80
  store i64 %82, ptr %3, align 8, !tbaa !11
  %83 = load i64, ptr @MOD, align 8, !tbaa !11
  %84 = load i64, ptr %3, align 8, !tbaa !11
  %85 = srem i64 %84, %83
  store i64 %85, ptr %3, align 8, !tbaa !11
  br label %86

86:                                               ; preds = %56
  %87 = load i32, ptr %5, align 4, !tbaa !8
  %88 = add nsw i32 %87, -1
  store i32 %88, ptr %5, align 4, !tbaa !8
  br label %52, !llvm.loop !16

89:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  store i64 0, ptr %6, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 0, ptr %7, align 4, !tbaa !8
  br label %90

90:                                               ; preds = %125, %89
  %91 = load i32, ptr %7, align 4, !tbaa !8
  %92 = load i32, ptr @N, align 4, !tbaa !8
  %93 = sub nsw i32 %92, 1
  %94 = icmp slt i32 %91, %93
  br i1 %94, label %96, label %95

95:                                               ; preds = %90
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %128

96:                                               ; preds = %90
  %97 = load i64, ptr %6, align 8, !tbaa !11
  %98 = mul nsw i64 %97, 10
  store i64 %98, ptr %6, align 8, !tbaa !11
  %99 = load i32, ptr %7, align 4, !tbaa !8
  %100 = sext i32 %99 to i64
  %101 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z6secondB5cxx11, i64 noundef %100)
  %102 = load i8, ptr %101, align 1, !tbaa !15
  %103 = sext i8 %102 to i32
  %104 = sub nsw i32 %103, 48
  %105 = sext i32 %104 to i64
  %106 = load i64, ptr %6, align 8, !tbaa !11
  %107 = add nsw i64 %106, %105
  store i64 %107, ptr %6, align 8, !tbaa !11
  %108 = load i64, ptr @MOD, align 8, !tbaa !11
  %109 = load i64, ptr %6, align 8, !tbaa !11
  %110 = srem i64 %109, %108
  store i64 %110, ptr %6, align 8, !tbaa !11
  %111 = load i32, ptr @N, align 4, !tbaa !8
  %112 = sub nsw i32 %111, 2
  %113 = load i32, ptr %7, align 4, !tbaa !8
  %114 = sub nsw i32 %112, %113
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [100001 x i64], ptr @n11, i64 0, i64 %115
  %117 = load i64, ptr %116, align 8, !tbaa !11
  %118 = load i64, ptr %6, align 8, !tbaa !11
  %119 = mul nsw i64 %117, %118
  %120 = load i64, ptr %3, align 8, !tbaa !11
  %121 = add nsw i64 %120, %119
  store i64 %121, ptr %3, align 8, !tbaa !11
  %122 = load i64, ptr @MOD, align 8, !tbaa !11
  %123 = load i64, ptr %3, align 8, !tbaa !11
  %124 = srem i64 %123, %122
  store i64 %124, ptr %3, align 8, !tbaa !11
  br label %125

125:                                              ; preds = %96
  %126 = load i32, ptr %7, align 4, !tbaa !8
  %127 = add nsw i32 %126, 1
  store i32 %127, ptr %7, align 4, !tbaa !8
  br label %90, !llvm.loop !17

128:                                              ; preds = %95
  %129 = load i64, ptr %3, align 8, !tbaa !11
  %130 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %129)
  %131 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %130, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  ret i32 0
}

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

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

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

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

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

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

; 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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #4 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)) #5

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 = { "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 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 #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !10, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!10, !10, i64 0}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !14}


; 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
@N = external dso_local local_unnamed_addr global i32, align 4
@_Z6secondB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@n11 = external dso_local local_unnamed_addr global [100001 x i64], align 16
@n10 = external dso_local local_unnamed_addr global [100001 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 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %2 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %3 = getelementptr i8, ptr %2, i64 -24
  %4 = load i64, ptr %3, align 8
  %5 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %4
  %6 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %5, ptr noundef null)
  %7 = 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) @_Z6secondB5cxx11)
  %8 = tail call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z6secondB5cxx11) #5
  %9 = trunc i64 %8 to i32
  store i32 %9, ptr @N, align 4, !tbaa !8
  store i64 1, ptr @n10, align 16, !tbaa !11
  store i64 1, ptr @n11, align 16, !tbaa !11
  %10 = icmp sgt i32 %9, 1
  br i1 %10, label %.lr.ph, label %.preheader33

.lr.ph:                                           ; preds = %0
  %11 = load i64, ptr @MOD, align 8, !tbaa !11
  %wide.trip.count = and i64 %8, 2147483647
  br label %14

.preheader33:                                     ; preds = %14, %0
  %12 = icmp sgt i32 %9, 0
  br i1 %12, label %.lr.ph38.preheader, label %._crit_edge

.lr.ph38.preheader:                               ; preds = %.preheader33
  %13 = and i64 %8, 2147483647
  br label %.lr.ph38

14:                                               ; preds = %.lr.ph, %14
  %15 = phi i64 [ 1, %.lr.ph ], [ %22, %14 ]
  %16 = phi i64 [ 1, %.lr.ph ], [ %19, %14 ]
  %indvars.iv = phi i64 [ 1, %.lr.ph ], [ %indvars.iv.next, %14 ]
  %17 = mul nsw i64 %16, 10
  %18 = or disjoint i64 %17, 1
  %19 = srem i64 %18, %11
  %20 = getelementptr inbounds [100001 x i64], ptr @n11, i64 0, i64 %indvars.iv
  store i64 %19, ptr %20, align 8, !tbaa !11
  %21 = mul nsw i64 %15, 10
  %22 = srem i64 %21, %11
  %23 = getelementptr inbounds [100001 x i64], ptr @n10, i64 0, i64 %indvars.iv
  store i64 %22, ptr %23, align 8, !tbaa !11
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.preheader33, label %14, !llvm.loop !13

.preheader:                                       ; preds = %.lr.ph38
  %24 = icmp sgt i32 %29, 1
  br i1 %24, label %.lr.ph42, label %._crit_edge

.lr.ph38:                                         ; preds = %.lr.ph38.preheader, %.lr.ph38
  %indvars.iv46 = phi i64 [ %13, %.lr.ph38.preheader ], [ %indvars.iv.next47, %.lr.ph38 ]
  %.02936 = phi i64 [ 0, %.lr.ph38.preheader ], [ %38, %.lr.ph38 ]
  %.03035 = phi i64 [ 0, %.lr.ph38.preheader ], [ %41, %.lr.ph38 ]
  %indvars.iv.next47 = add nsw i64 %indvars.iv46, -1
  %25 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z6secondB5cxx11, i64 noundef %indvars.iv.next47)
  %26 = load i8, ptr %25, align 1, !tbaa !15
  %27 = sext i8 %26 to i64
  %28 = add nsw i64 %27, -48
  %29 = load i32, ptr @N, align 4, !tbaa !8
  %30 = trunc nuw nsw i64 %indvars.iv46 to i32
  %31 = sub i32 %29, %30
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [100001 x i64], ptr @n10, i64 0, i64 %32
  %34 = load i64, ptr %33, align 8, !tbaa !11
  %35 = mul nsw i64 %28, %34
  %36 = add nsw i64 %35, %.02936
  %37 = load i64, ptr @MOD, align 8, !tbaa !11
  %38 = srem i64 %36, %37
  %39 = mul nsw i64 %38, %indvars.iv.next47
  %40 = add nsw i64 %39, %.03035
  %41 = srem i64 %40, %37
  %42 = icmp ugt i64 %indvars.iv46, 1
  br i1 %42, label %.lr.ph38, label %.preheader, !llvm.loop !16

._crit_edge:                                      ; preds = %.lr.ph42, %.preheader33, %.preheader
  %.1.lcssa = phi i64 [ %41, %.preheader ], [ 0, %.preheader33 ], [ %61, %.lr.ph42 ]
  %43 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.1.lcssa)
  %44 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %43, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  ret i32 0

.lr.ph42:                                         ; preds = %.preheader, %.lr.ph42
  %indvars.iv49 = phi i64 [ %indvars.iv.next50, %.lr.ph42 ], [ 0, %.preheader ]
  %.02740 = phi i64 [ %52, %.lr.ph42 ], [ 0, %.preheader ]
  %.139 = phi i64 [ %61, %.lr.ph42 ], [ %41, %.preheader ]
  %45 = mul nsw i64 %.02740, 10
  %46 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z6secondB5cxx11, i64 noundef %indvars.iv49)
  %47 = load i8, ptr %46, align 1, !tbaa !15
  %48 = sext i8 %47 to i64
  %49 = add i64 %45, -48
  %50 = add i64 %49, %48
  %51 = load i64, ptr @MOD, align 8, !tbaa !11
  %52 = srem i64 %50, %51
  %53 = load i32, ptr @N, align 4, !tbaa !8
  %54 = trunc nuw nsw i64 %indvars.iv49 to i32
  %reass.sub = sub i32 %53, %54
  %55 = add i32 %reass.sub, -2
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [100001 x i64], ptr @n11, i64 0, i64 %56
  %58 = load i64, ptr %57, align 8, !tbaa !11
  %59 = mul nsw i64 %58, %52
  %60 = add nsw i64 %59, %.139
  %61 = srem i64 %60, %51
  %indvars.iv.next50 = add nuw nsw i64 %indvars.iv49, 1
  %62 = add nsw i32 %53, -1
  %63 = sext i32 %62 to i64
  %64 = icmp slt i64 %indvars.iv.next50, %63
  br i1 %64, label %.lr.ph42, label %._crit_edge, !llvm.loop !17
}

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

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2 align 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 #2 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 #3 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 #3 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 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 = { "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 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 #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" }
attributes #5 = { 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 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !10, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!10, !10, i64 0}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !14}


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