; LLVM IR from eyangch/competitive-programming :: Codeforces/1691 (f)

; 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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"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
@f = external dso_local global [200001 x i64], align 16
@fi = external dso_local global [200001 x i64], align 16
@N = external dso_local global i64, align 8
@K = external dso_local global i64, align 8
@G = external dso_local global [200000 x %"class.std::vector"], align 16
@ans = external dso_local global [200000 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z3invx(i64 noundef) #1

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 {
  %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 i64, align 8
  %7 = alloca i32, align 4
  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) @N)
  %15 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %14, ptr noundef nonnull align 8 dereferenceable(8) @K)
  store i64 1, ptr @f, align 16, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #7
  store i64 1, ptr %2, align 8, !tbaa !8
  br label %16

16:                                               ; preds = %32, %0
  %17 = load i64, ptr %2, align 8, !tbaa !8
  %18 = load i64, ptr @N, align 8, !tbaa !8
  %19 = icmp sle i64 %17, %18
  br i1 %19, label %21, label %20

20:                                               ; preds = %16
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #7
  br label %35

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

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

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

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

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

41:                                               ; preds = %36
  %42 = load i64, ptr %3, align 8, !tbaa !8
  %43 = getelementptr inbounds [200001 x i64], ptr @f, i64 0, i64 %42
  %44 = load i64, ptr %43, align 8, !tbaa !8
  %45 = call noundef i64 @_Z3invx(i64 noundef %44)
  %46 = load i64, ptr %3, align 8, !tbaa !8
  %47 = getelementptr inbounds [200001 x i64], ptr @fi, i64 0, i64 %46
  store i64 %45, ptr %47, align 8, !tbaa !8
  br label %48

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

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

52:                                               ; preds = %69, %51
  %53 = load i64, ptr %4, align 8, !tbaa !8
  %54 = load i64, ptr @N, align 8, !tbaa !8
  %55 = sub nsw i64 %54, 1
  %56 = icmp slt i64 %53, %55
  br i1 %56, label %58, label %57

57:                                               ; preds = %52
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #7
  br label %72

58:                                               ; preds = %52
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  %59 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %5)
  %60 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %59, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %61 = load i64, ptr %5, align 8, !tbaa !8
  %62 = add nsw i64 %61, -1
  store i64 %62, ptr %5, align 8, !tbaa !8
  %63 = load i64, ptr %6, align 8, !tbaa !8
  %64 = add nsw i64 %63, -1
  store i64 %64, ptr %6, align 8, !tbaa !8
  %65 = load i64, ptr %5, align 8, !tbaa !8
  %66 = getelementptr inbounds [200000 x %"class.std::vector"], ptr @G, i64 0, i64 %65
  call void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24) %66, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %67 = load i64, ptr %6, align 8, !tbaa !8
  %68 = getelementptr inbounds [200000 x %"class.std::vector"], ptr @G, i64 0, i64 %67
  call void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24) %68, ptr noundef nonnull align 8 dereferenceable(8) %5)
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  br label %69

69:                                               ; preds = %58
  %70 = load i64, ptr %4, align 8, !tbaa !8
  %71 = add nsw i64 %70, 1
  store i64 %71, ptr %4, align 8, !tbaa !8
  br label %52, !llvm.loop !14

72:                                               ; preds = %57
  call void @_Z3dfsxx(i64 noundef 0, i64 noundef -1)
  %73 = load i64, ptr @N, align 8, !tbaa !8
  %74 = getelementptr inbounds i64, ptr @ans, i64 %73
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  store i32 -1, ptr %7, align 4, !tbaa !15
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef @ans, ptr noundef %74, ptr noundef nonnull align 4 dereferenceable(4) %7)
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  call void @_Z7dfs_ansxx(i64 noundef 0, i64 noundef -1)
  %75 = load i64, ptr @N, align 8, !tbaa !8
  %76 = getelementptr inbounds i64, ptr @ans, i64 %75
  %77 = call noundef i64 @_ZSt10accumulateIPxxET0_T_S2_S1_(ptr noundef @ans, ptr noundef %76, i64 noundef 0)
  %78 = load i64, ptr @MOD, align 8, !tbaa !8
  %79 = srem i64 %77, %78
  %80 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %79)
  %81 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %80, i8 noundef signext 10)
  %82 = load i32, ptr %1, align 4
  ret i32 %82
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(8)) #2 align 2

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZSt10accumulateIPxxET0_T_S2_S1_(ptr noundef, ptr noundef, i64 noundef) #6

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


; 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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"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
@f = external dso_local local_unnamed_addr global [200001 x i64], align 16
@fi = external dso_local local_unnamed_addr global [200001 x i64], align 16
@N = external dso_local global i64, align 8
@K = external dso_local global i64, align 8
@G = external dso_local global [200000 x %"class.std::vector"], align 16
@ans = external dso_local global [200000 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z3invx(i64 noundef) local_unnamed_addr #1

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca i32, align 4
  %4 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %5 = getelementptr i8, ptr %4, i64 -24
  %6 = load i64, ptr %5, align 8
  %7 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %6
  %8 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %7, ptr noundef null)
  %9 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %10 = 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)
  %11 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %10, ptr noundef nonnull align 8 dereferenceable(8) @K)
  store i64 1, ptr @f, align 16, !tbaa !8
  %12 = load i64, ptr @N, align 8, !tbaa !8
  %.not16 = icmp slt i64 %12, 1
  br i1 %.not16, label %.preheader15, label %.lr.ph

.lr.ph:                                           ; preds = %0
  %13 = load i64, ptr @MOD, align 8, !tbaa !8
  %xtraiter = and i64 %12, 1
  %14 = icmp eq i64 %12, 1
  br i1 %14, label %.preheader15.loopexit.unr-lcssa, label %.lr.ph.new

.lr.ph.new:                                       ; preds = %.lr.ph
  %unroll_iter = and i64 %12, 9223372036854775806
  br label %18

.preheader15.loopexit.unr-lcssa:                  ; preds = %18, %.lr.ph
  %.unr = phi i64 [ 1, %.lr.ph ], [ %25, %18 ]
  %.01317.unr = phi i64 [ 1, %.lr.ph ], [ %27, %18 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader15, label %.preheader15.loopexit.epilog-lcssa

.preheader15.loopexit.epilog-lcssa:               ; preds = %.preheader15.loopexit.unr-lcssa
  %15 = mul nsw i64 %.unr, %.01317.unr
  %16 = srem i64 %15, %13
  %17 = getelementptr inbounds [200001 x i64], ptr @f, i64 0, i64 %.01317.unr
  store i64 %16, ptr %17, align 8, !tbaa !8
  br label %.preheader15

.preheader15:                                     ; preds = %.preheader15.loopexit.epilog-lcssa, %.preheader15.loopexit.unr-lcssa, %0
  %.not1418 = icmp slt i64 %12, 0
  br i1 %.not1418, label %._crit_edge, label %.lr.ph20

18:                                               ; preds = %18, %.lr.ph.new
  %19 = phi i64 [ 1, %.lr.ph.new ], [ %25, %18 ]
  %.01317 = phi i64 [ 1, %.lr.ph.new ], [ %27, %18 ]
  %niter = phi i64 [ 0, %.lr.ph.new ], [ %niter.next.1, %18 ]
  %20 = mul nsw i64 %19, %.01317
  %21 = srem i64 %20, %13
  %22 = getelementptr inbounds [200001 x i64], ptr @f, i64 0, i64 %.01317
  store i64 %21, ptr %22, align 8, !tbaa !8
  %23 = add nuw i64 %.01317, 1
  %24 = mul nsw i64 %21, %23
  %25 = srem i64 %24, %13
  %26 = getelementptr inbounds [200001 x i64], ptr @f, i64 0, i64 %23
  store i64 %25, ptr %26, align 8, !tbaa !8
  %27 = add nuw i64 %.01317, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %.preheader15.loopexit.unr-lcssa, label %18, !llvm.loop !11

.preheader:                                       ; preds = %.lr.ph20
  %28 = icmp sgt i64 %34, 1
  br i1 %28, label %.lr.ph22, label %._crit_edge

.lr.ph20:                                         ; preds = %.preheader15, %.lr.ph20
  %.01219 = phi i64 [ %33, %.lr.ph20 ], [ 0, %.preheader15 ]
  %29 = getelementptr inbounds [200001 x i64], ptr @f, i64 0, i64 %.01219
  %30 = load i64, ptr %29, align 8, !tbaa !8
  %31 = tail call noundef i64 @_Z3invx(i64 noundef %30)
  %32 = getelementptr inbounds [200001 x i64], ptr @fi, i64 0, i64 %.01219
  store i64 %31, ptr %32, align 8, !tbaa !8
  %33 = add nuw nsw i64 %.01219, 1
  %34 = load i64, ptr @N, align 8, !tbaa !8
  %.not14.not = icmp slt i64 %.01219, %34
  br i1 %.not14.not, label %.lr.ph20, label %.preheader, !llvm.loop !13

._crit_edge:                                      ; preds = %.lr.ph22, %.preheader15, %.preheader
  call void @_Z3dfsxx(i64 noundef 0, i64 noundef -1)
  %35 = load i64, ptr @N, align 8, !tbaa !8
  %36 = getelementptr inbounds i64, ptr @ans, i64 %35
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  store i32 -1, ptr %3, align 4, !tbaa !14
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef nonnull @ans, ptr noundef nonnull %36, ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  call void @_Z7dfs_ansxx(i64 noundef 0, i64 noundef -1)
  %37 = load i64, ptr @N, align 8, !tbaa !8
  %38 = getelementptr inbounds i64, ptr @ans, i64 %37
  %39 = call noundef i64 @_ZSt10accumulateIPxxET0_T_S2_S1_(ptr noundef nonnull @ans, ptr noundef nonnull %38, i64 noundef 0)
  %40 = load i64, ptr @MOD, align 8, !tbaa !8
  %41 = srem i64 %39, %40
  %42 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %41)
  %43 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %42, i8 noundef signext 10)
  ret i32 0

.lr.ph22:                                         ; preds = %.preheader, %.lr.ph22
  %.021 = phi i64 [ %53, %.lr.ph22 ], [ 0, %.preheader ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #7
  %44 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %45 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %44, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %46 = load i64, ptr %1, align 8, !tbaa !8
  %47 = add nsw i64 %46, -1
  store i64 %47, ptr %1, align 8, !tbaa !8
  %48 = load i64, ptr %2, align 8, !tbaa !8
  %49 = add nsw i64 %48, -1
  store i64 %49, ptr %2, align 8, !tbaa !8
  %50 = getelementptr inbounds [200000 x %"class.std::vector"], ptr @G, i64 0, i64 %47
  call void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24) %50, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %51 = load i64, ptr %2, align 8, !tbaa !8
  %52 = getelementptr inbounds [200000 x %"class.std::vector"], ptr @G, i64 0, i64 %51
  call void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24) %52, ptr noundef nonnull align 8 dereferenceable(8) %1)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #7
  %53 = add nuw nsw i64 %.021, 1
  %54 = load i64, ptr @N, align 8, !tbaa !8
  %55 = add nsw i64 %54, -1
  %56 = icmp slt i64 %53, %55
  br i1 %56, label %.lr.ph22, label %._crit_edge, !llvm.loop !16
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2 align 2

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZSt10accumulateIPxxET0_T_S2_S1_(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #6

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


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