; LLVM IR from tangjz/acm-icpc :: 51nod/1121.ll (Z5solvev)

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

%"struct.std::pair" = type { i64, i64 }
%"struct.std::pair.0" = type { i32, i32 }

@p = external dso_local global i32, align 4
@nk = external dso_local global i32, align 4
@N = external dso_local global i64, align 8
@M = external dso_local global i64, align 8
@all = external dso_local global %"struct.std::pair", align 8
@now = external dso_local global %"struct.std::pair", align 8

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_Z7mod_invx(i64 noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3CRTx(i64 noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i64 } @_Z8mod_factx(i64 noundef) #2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() #2 {
  %1 = alloca %"struct.std::pair.0", align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i64, align 8
  %5 = alloca %"struct.std::pair", align 8
  %6 = alloca %"struct.std::pair", align 8
  %7 = alloca %"struct.std::pair", align 8
  %8 = alloca i64, align 8
  %9 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #3
  store i32 1, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  store i32 0, ptr %3, align 4, !tbaa !5
  %10 = call i64 @_ZSt9make_pairIiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS1_INS2_IT0_E4typeEE6__typeEEOS3_OS8_(ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %3)
  store i64 %10, ptr %1, align 4
  %11 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt4pairIxxEaSIiiEENSt9enable_ifIXsr6__and_ISt13is_assignableIRxOT_ES3_IS4_OT0_EEE5valueERS0_E4typeEOS_IS5_S8_E(ptr noundef nonnull align 8 dereferenceable(16) @all, ptr noundef nonnull align 4 dereferenceable(8) %1)
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  %12 = load i64, ptr @N, align 8, !tbaa !9
  %13 = load i64, ptr @M, align 8, !tbaa !9
  %14 = sub nsw i64 %12, %13
  %15 = add nsw i64 %14, 1
  store i64 %15, ptr %4, align 8, !tbaa !9
  br label %16

16:                                               ; preds = %25, %0
  %17 = load i64, ptr %4, align 8, !tbaa !9
  %18 = load i32, ptr @p, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %20 = srem i64 %17, %19
  %21 = icmp eq i64 %20, 0
  br i1 %21, label %22, label %30

22:                                               ; preds = %16
  %23 = load i64, ptr getelementptr inbounds (%"struct.std::pair", ptr @all, i32 0, i32 1), align 8, !tbaa !11
  %24 = add nsw i64 %23, 1
  store i64 %24, ptr getelementptr inbounds (%"struct.std::pair", ptr @all, i32 0, i32 1), align 8, !tbaa !11
  br label %25

25:                                               ; preds = %22
  %26 = load i32, ptr @p, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = load i64, ptr %4, align 8, !tbaa !9
  %29 = sdiv i64 %28, %27
  store i64 %29, ptr %4, align 8, !tbaa !9
  br label %16, !llvm.loop !13

30:                                               ; preds = %16
  %31 = load i64, ptr @all, align 8, !tbaa !15
  %32 = load i64, ptr %4, align 8, !tbaa !9
  %33 = call noundef i64 @_Z7mod_mulxx(i64 noundef %31, i64 noundef %32)
  store i64 %33, ptr @all, align 8, !tbaa !15
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.start.p0(i64 16, ptr %5) #3
  %34 = load i64, ptr @N, align 8, !tbaa !9
  %35 = load i64, ptr @M, align 8, !tbaa !9
  %36 = add nsw i64 %34, %35
  %37 = call { i64, i64 } @_Z8mod_factx(i64 noundef %36)
  %38 = getelementptr inbounds { i64, i64 }, ptr %5, i32 0, i32 0
  %39 = extractvalue { i64, i64 } %37, 0
  store i64 %39, ptr %38, align 8
  %40 = getelementptr inbounds { i64, i64 }, ptr %5, i32 0, i32 1
  %41 = extractvalue { i64, i64 } %37, 1
  store i64 %41, ptr %40, align 8
  %42 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt4pairIxxEaSEOS0_(ptr noundef nonnull align 8 dereferenceable(16) @now, ptr noundef nonnull align 8 dereferenceable(16) %5) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr %5) #3
  %43 = load i64, ptr @all, align 8, !tbaa !15
  %44 = load i64, ptr @now, align 8, !tbaa !15
  %45 = call noundef i64 @_Z7mod_mulxx(i64 noundef %43, i64 noundef %44)
  store i64 %45, ptr @all, align 8, !tbaa !15
  %46 = load i64, ptr getelementptr inbounds (%"struct.std::pair", ptr @now, i32 0, i32 1), align 8, !tbaa !11
  %47 = load i64, ptr getelementptr inbounds (%"struct.std::pair", ptr @all, i32 0, i32 1), align 8, !tbaa !11
  %48 = add nsw i64 %47, %46
  store i64 %48, ptr getelementptr inbounds (%"struct.std::pair", ptr @all, i32 0, i32 1), align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 16, ptr %6) #3
  %49 = load i64, ptr @N, align 8, !tbaa !9
  %50 = add nsw i64 %49, 1
  %51 = call { i64, i64 } @_Z8mod_factx(i64 noundef %50)
  %52 = getelementptr inbounds { i64, i64 }, ptr %6, i32 0, i32 0
  %53 = extractvalue { i64, i64 } %51, 0
  store i64 %53, ptr %52, align 8
  %54 = getelementptr inbounds { i64, i64 }, ptr %6, i32 0, i32 1
  %55 = extractvalue { i64, i64 } %51, 1
  store i64 %55, ptr %54, align 8
  %56 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt4pairIxxEaSEOS0_(ptr noundef nonnull align 8 dereferenceable(16) @now, ptr noundef nonnull align 8 dereferenceable(16) %6) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #3
  %57 = load i64, ptr @all, align 8, !tbaa !15
  %58 = load i64, ptr @now, align 8, !tbaa !15
  %59 = call noundef i64 @_Z7mod_invx(i64 noundef %58)
  %60 = call noundef i64 @_Z7mod_mulxx(i64 noundef %57, i64 noundef %59)
  store i64 %60, ptr @all, align 8, !tbaa !15
  %61 = load i64, ptr getelementptr inbounds (%"struct.std::pair", ptr @now, i32 0, i32 1), align 8, !tbaa !11
  %62 = load i64, ptr getelementptr inbounds (%"struct.std::pair", ptr @all, i32 0, i32 1), align 8, !tbaa !11
  %63 = sub nsw i64 %62, %61
  store i64 %63, ptr getelementptr inbounds (%"struct.std::pair", ptr @all, i32 0, i32 1), align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #3
  %64 = load i64, ptr @M, align 8, !tbaa !9
  %65 = call { i64, i64 } @_Z8mod_factx(i64 noundef %64)
  %66 = getelementptr inbounds { i64, i64 }, ptr %7, i32 0, i32 0
  %67 = extractvalue { i64, i64 } %65, 0
  store i64 %67, ptr %66, align 8
  %68 = getelementptr inbounds { i64, i64 }, ptr %7, i32 0, i32 1
  %69 = extractvalue { i64, i64 } %65, 1
  store i64 %69, ptr %68, align 8
  %70 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt4pairIxxEaSEOS0_(ptr noundef nonnull align 8 dereferenceable(16) @now, ptr noundef nonnull align 8 dereferenceable(16) %7) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #3
  %71 = load i64, ptr @all, align 8, !tbaa !15
  %72 = load i64, ptr @now, align 8, !tbaa !15
  %73 = call noundef i64 @_Z7mod_invx(i64 noundef %72)
  %74 = call noundef i64 @_Z7mod_mulxx(i64 noundef %71, i64 noundef %73)
  store i64 %74, ptr @all, align 8, !tbaa !15
  %75 = load i64, ptr getelementptr inbounds (%"struct.std::pair", ptr @now, i32 0, i32 1), align 8, !tbaa !11
  %76 = load i64, ptr getelementptr inbounds (%"struct.std::pair", ptr @all, i32 0, i32 1), align 8, !tbaa !11
  %77 = sub nsw i64 %76, %75
  store i64 %77, ptr getelementptr inbounds (%"struct.std::pair", ptr @all, i32 0, i32 1), align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  store i64 0, ptr %8, align 8, !tbaa !9
  %78 = load i64, ptr getelementptr inbounds (%"struct.std::pair", ptr @all, i32 0, i32 1), align 8, !tbaa !11
  %79 = load i32, ptr @nk, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = icmp slt i64 %78, %80
  br i1 %81, label %82, label %99

82:                                               ; preds = %30
  %83 = load i64, ptr @all, align 8, !tbaa !15
  store i64 %83, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %84

84:                                               ; preds = %95, %82
  %85 = load i32, ptr %9, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = load i64, ptr getelementptr inbounds (%"struct.std::pair", ptr @all, i32 0, i32 1), align 8, !tbaa !11
  %88 = icmp slt i64 %86, %87
  br i1 %88, label %90, label %89

89:                                               ; preds = %84
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  br label %98

90:                                               ; preds = %84
  %91 = load i64, ptr %8, align 8, !tbaa !9
  %92 = load i32, ptr @p, align 4, !tbaa !5
  %93 = sext i32 %92 to i64
  %94 = call noundef i64 @_Z7mod_mulxx(i64 noundef %91, i64 noundef %93)
  store i64 %94, ptr %8, align 8, !tbaa !9
  br label %95

95:                                               ; preds = %90
  %96 = load i32, ptr %9, align 4, !tbaa !5
  %97 = add nsw i32 %96, 1
  store i32 %97, ptr %9, align 4, !tbaa !5
  br label %84, !llvm.loop !16

98:                                               ; preds = %89
  br label %99

99:                                               ; preds = %98, %30
  %100 = load i64, ptr %8, align 8, !tbaa !9
  call void @_Z3CRTx(i64 noundef %100)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt4pairIxxEaSIiiEENSt9enable_ifIXsr6__and_ISt13is_assignableIRxOT_ES3_IS4_OT0_EEE5valueERS0_E4typeEOS_IS5_S8_E(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(8)) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt4pairIxxEaSEOS0_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #0 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = !{!12, !10, i64 8}
!12 = !{!"_ZTSSt4pairIxxE", !10, i64 0, !10, i64 8}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!12, !10, i64 0}
!16 = distinct !{!16, !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"

%"struct.std::pair" = type { i64, i64 }
%"struct.std::pair.0" = type { i32, i32 }

@p = external dso_local local_unnamed_addr global i32, align 4
@nk = external dso_local local_unnamed_addr global i32, align 4
@N = external dso_local local_unnamed_addr global i64, align 8
@M = external dso_local local_unnamed_addr global i64, align 8
@all = external dso_local global %"struct.std::pair", align 8
@now = external dso_local global %"struct.std::pair", align 8

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_Z7mod_invx(i64 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3CRTx(i64 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i64 } @_Z8mod_factx(i64 noundef) local_unnamed_addr #2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() local_unnamed_addr #2 {
  %1 = alloca %"struct.std::pair.0", align 8
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca %"struct.std::pair", align 8
  %5 = alloca %"struct.std::pair", align 8
  %6 = alloca %"struct.std::pair", align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #3
  store i32 1, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #3
  store i32 0, ptr %3, align 4, !tbaa !5
  %7 = call i64 @_ZSt9make_pairIiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS1_INS2_IT0_E4typeEE6__typeEEOS3_OS8_(ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %3)
  store i64 %7, ptr %1, align 8
  %8 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt4pairIxxEaSIiiEENSt9enable_ifIXsr6__and_ISt13is_assignableIRxOT_ES3_IS4_OT0_EEE5valueERS0_E4typeEOS_IS5_S8_E(ptr noundef nonnull align 8 dereferenceable(16) @all, ptr noundef nonnull align 4 dereferenceable(8) %1)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #3
  %9 = load i64, ptr @N, align 8, !tbaa !9
  %10 = load i64, ptr @M, align 8, !tbaa !9
  %11 = add i64 %9, 1
  %12 = sub i64 %11, %10
  %13 = load i32, ptr @p, align 4, !tbaa !5
  %14 = sext i32 %13 to i64
  %15 = srem i64 %12, %14
  %16 = icmp eq i64 %15, 0
  br i1 %16, label %.lr.ph.preheader, label %22

.lr.ph.preheader:                                 ; preds = %0
  %.promoted = load i64, ptr getelementptr inbounds (i8, ptr @all, i64 8), align 8, !tbaa !11
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %.089 = phi i64 [ %19, %.lr.ph ], [ %12, %.lr.ph.preheader ]
  %17 = phi i64 [ %18, %.lr.ph ], [ %.promoted, %.lr.ph.preheader ]
  %18 = add nsw i64 %17, 1
  %19 = sdiv i64 %.089, %14
  %20 = srem i64 %19, %14
  %21 = icmp eq i64 %20, 0
  br i1 %21, label %.lr.ph, label %._crit_edge, !llvm.loop !13

._crit_edge:                                      ; preds = %.lr.ph
  store i64 %18, ptr getelementptr inbounds (i8, ptr @all, i64 8), align 8, !tbaa !11
  br label %22

22:                                               ; preds = %._crit_edge, %0
  %.08.lcssa = phi i64 [ %19, %._crit_edge ], [ %12, %0 ]
  %23 = load i64, ptr @all, align 8, !tbaa !15
  %24 = call noundef i64 @_Z7mod_mulxx(i64 noundef %23, i64 noundef %.08.lcssa)
  store i64 %24, ptr @all, align 8, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #3
  %25 = load i64, ptr @N, align 8, !tbaa !9
  %26 = load i64, ptr @M, align 8, !tbaa !9
  %27 = add nsw i64 %26, %25
  %28 = call { i64, i64 } @_Z8mod_factx(i64 noundef %27)
  %29 = extractvalue { i64, i64 } %28, 0
  store i64 %29, ptr %4, align 8
  %30 = getelementptr inbounds i8, ptr %4, i64 8
  %31 = extractvalue { i64, i64 } %28, 1
  store i64 %31, ptr %30, align 8
  %32 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt4pairIxxEaSEOS0_(ptr noundef nonnull align 8 dereferenceable(16) @now, ptr noundef nonnull align 8 dereferenceable(16) %4) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #3
  %33 = load i64, ptr @all, align 8, !tbaa !15
  %34 = load i64, ptr @now, align 8, !tbaa !15
  %35 = call noundef i64 @_Z7mod_mulxx(i64 noundef %33, i64 noundef %34)
  store i64 %35, ptr @all, align 8, !tbaa !15
  %36 = load i64, ptr getelementptr inbounds (i8, ptr @now, i64 8), align 8, !tbaa !11
  %37 = load i64, ptr getelementptr inbounds (i8, ptr @all, i64 8), align 8, !tbaa !11
  %38 = add nsw i64 %37, %36
  store i64 %38, ptr getelementptr inbounds (i8, ptr @all, i64 8), align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #3
  %39 = load i64, ptr @N, align 8, !tbaa !9
  %40 = add nsw i64 %39, 1
  %41 = call { i64, i64 } @_Z8mod_factx(i64 noundef %40)
  %42 = extractvalue { i64, i64 } %41, 0
  store i64 %42, ptr %5, align 8
  %43 = getelementptr inbounds i8, ptr %5, i64 8
  %44 = extractvalue { i64, i64 } %41, 1
  store i64 %44, ptr %43, align 8
  %45 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt4pairIxxEaSEOS0_(ptr noundef nonnull align 8 dereferenceable(16) @now, ptr noundef nonnull align 8 dereferenceable(16) %5) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #3
  %46 = load i64, ptr @all, align 8, !tbaa !15
  %47 = load i64, ptr @now, align 8, !tbaa !15
  %48 = call noundef i64 @_Z7mod_invx(i64 noundef %47)
  %49 = call noundef i64 @_Z7mod_mulxx(i64 noundef %46, i64 noundef %48)
  store i64 %49, ptr @all, align 8, !tbaa !15
  %50 = load i64, ptr getelementptr inbounds (i8, ptr @now, i64 8), align 8, !tbaa !11
  %51 = load i64, ptr getelementptr inbounds (i8, ptr @all, i64 8), align 8, !tbaa !11
  %52 = sub nsw i64 %51, %50
  store i64 %52, ptr getelementptr inbounds (i8, ptr @all, i64 8), align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #3
  %53 = load i64, ptr @M, align 8, !tbaa !9
  %54 = call { i64, i64 } @_Z8mod_factx(i64 noundef %53)
  %55 = extractvalue { i64, i64 } %54, 0
  store i64 %55, ptr %6, align 8
  %56 = getelementptr inbounds i8, ptr %6, i64 8
  %57 = extractvalue { i64, i64 } %54, 1
  store i64 %57, ptr %56, align 8
  %58 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt4pairIxxEaSEOS0_(ptr noundef nonnull align 8 dereferenceable(16) @now, ptr noundef nonnull align 8 dereferenceable(16) %6) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #3
  %59 = load i64, ptr @all, align 8, !tbaa !15
  %60 = load i64, ptr @now, align 8, !tbaa !15
  %61 = call noundef i64 @_Z7mod_invx(i64 noundef %60)
  %62 = call noundef i64 @_Z7mod_mulxx(i64 noundef %59, i64 noundef %61)
  store i64 %62, ptr @all, align 8, !tbaa !15
  %63 = load i64, ptr getelementptr inbounds (i8, ptr @now, i64 8), align 8, !tbaa !11
  %64 = load i64, ptr getelementptr inbounds (i8, ptr @all, i64 8), align 8, !tbaa !11
  %65 = sub nsw i64 %64, %63
  store i64 %65, ptr getelementptr inbounds (i8, ptr @all, i64 8), align 8, !tbaa !11
  %66 = load i32, ptr @nk, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = icmp slt i64 %65, %67
  br i1 %68, label %.preheader, label %.loopexit

.preheader:                                       ; preds = %22
  %69 = icmp sgt i64 %65, 0
  br i1 %69, label %.lr.ph12, label %.loopexit

.lr.ph12:                                         ; preds = %.preheader, %.lr.ph12
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph12 ], [ 0, %.preheader ]
  %.0710 = phi i64 [ %72, %.lr.ph12 ], [ %62, %.preheader ]
  %70 = load i32, ptr @p, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = call noundef i64 @_Z7mod_mulxx(i64 noundef %.0710, i64 noundef %71)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %73 = load i64, ptr getelementptr inbounds (i8, ptr @all, i64 8), align 8, !tbaa !11
  %74 = icmp sgt i64 %73, %indvars.iv.next
  br i1 %74, label %.lr.ph12, label %.loopexit, !llvm.loop !16

.loopexit:                                        ; preds = %.lr.ph12, %.preheader, %22
  %.1 = phi i64 [ 0, %22 ], [ %62, %.preheader ], [ %72, %.lr.ph12 ]
  call void @_Z3CRTx(i64 noundef %.1)
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt4pairIxxEaSIiiEENSt9enable_ifIXsr6__and_ISt13is_assignableIRxOT_ES3_IS4_OT0_EEE5valueERS0_E4typeEOS_IS5_S8_E(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt4pairIxxEaSEOS0_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #0 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = !{!12, !10, i64 8}
!12 = !{!"_ZTSSt4pairIxxE", !10, i64 0, !10, i64 8}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!12, !10, i64 0}
!16 = distinct !{!16, !14}


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