; LLVM IR from lzyrapx/Competitive-Programming :: BZOJ (BZOJ 4555（多项式求逆）)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@mod = external dso_local global i64, align 8
@F = external dso_local global [1000010 x i32], align 16
@G = external dso_local global [1000010 x i32], align 16
@inv = external dso_local global [1000010 x i64], align 16
@fac = external dso_local global [1000010 x i64], align 16
@ans = external dso_local global i64, align 8
@n = external dso_local global i64, align 8
@m = external dso_local global i64, align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z6qpowerxx(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 void @_Z4initv() #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z7polyInvPiS_i(ptr noundef, ptr noundef, i32 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 i32, align 4
  %5 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @_Z4initv()
  %6 = 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)
  store i64 1, ptr @m, align 8, !tbaa !5
  br label %7

7:                                                ; preds = %11, %0
  %8 = load i64, ptr @m, align 8, !tbaa !5
  %9 = load i64, ptr @n, align 8, !tbaa !5
  %10 = icmp sle i64 %8, %9
  br i1 %10, label %11, label %14

11:                                               ; preds = %7
  %12 = load i64, ptr @m, align 8, !tbaa !5
  %13 = shl i64 %12, 1
  store i64 %13, ptr @m, align 8, !tbaa !5
  br label %7, !llvm.loop !9

14:                                               ; preds = %7
  store i64 1, ptr @fac, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #5
  store i64 1, ptr %2, align 8, !tbaa !5
  br label %15

15:                                               ; preds = %31, %14
  %16 = load i64, ptr %2, align 8, !tbaa !5
  %17 = load i64, ptr @m, align 8, !tbaa !5
  %18 = icmp sle i64 %16, %17
  br i1 %18, label %20, label %19

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

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

31:                                               ; preds = %20
  %32 = load i64, ptr %2, align 8, !tbaa !5
  %33 = add nsw i64 %32, 1
  store i64 %33, ptr %2, align 8, !tbaa !5
  br label %15, !llvm.loop !11

34:                                               ; preds = %19
  store i64 1, ptr getelementptr inbounds ([1000010 x i64], ptr @inv, i64 0, i64 1), align 8, !tbaa !5
  store i64 1, ptr @inv, align 16, !tbaa !5
  %35 = load i64, ptr @m, align 8, !tbaa !5
  %36 = getelementptr inbounds [1000010 x i64], ptr @fac, i64 0, i64 %35
  %37 = load i64, ptr %36, align 8, !tbaa !5
  %38 = load i64, ptr @mod, align 8, !tbaa !5
  %39 = sub nsw i64 %38, 2
  %40 = call noundef i64 @_Z6qpowerxx(i64 noundef %37, i64 noundef %39)
  %41 = load i64, ptr @m, align 8, !tbaa !5
  %42 = getelementptr inbounds [1000010 x i64], ptr @inv, i64 0, i64 %41
  store i64 %40, ptr %42, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  %43 = load i64, ptr @m, align 8, !tbaa !5
  store i64 %43, ptr %3, align 8, !tbaa !5
  br label %44

44:                                               ; preds = %59, %34
  %45 = load i64, ptr %3, align 8, !tbaa !5
  %46 = icmp sge i64 %45, 1
  br i1 %46, label %48, label %47

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

48:                                               ; preds = %44
  %49 = load i64, ptr %3, align 8, !tbaa !5
  %50 = getelementptr inbounds [1000010 x i64], ptr @inv, i64 0, i64 %49
  %51 = load i64, ptr %50, align 8, !tbaa !5
  %52 = load i64, ptr %3, align 8, !tbaa !5
  %53 = mul nsw i64 %51, %52
  %54 = load i64, ptr @mod, align 8, !tbaa !5
  %55 = srem i64 %53, %54
  %56 = load i64, ptr %3, align 8, !tbaa !5
  %57 = sub nsw i64 %56, 1
  %58 = getelementptr inbounds [1000010 x i64], ptr @inv, i64 0, i64 %57
  store i64 %55, ptr %58, align 8, !tbaa !5
  br label %59

59:                                               ; preds = %48
  %60 = load i64, ptr %3, align 8, !tbaa !5
  %61 = add nsw i64 %60, -1
  store i64 %61, ptr %3, align 8, !tbaa !5
  br label %44, !llvm.loop !12

62:                                               ; preds = %47
  store i32 1, ptr @F, align 16, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 1, ptr %4, align 4, !tbaa !13
  br label %63

63:                                               ; preds = %84, %62
  %64 = load i32, ptr %4, align 4, !tbaa !13
  %65 = sext i32 %64 to i64
  %66 = load i64, ptr @n, align 8, !tbaa !5
  %67 = icmp sle i64 %65, %66
  br i1 %67, label %69, label %68

68:                                               ; preds = %63
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %87

69:                                               ; preds = %63
  %70 = load i32, ptr %4, align 4, !tbaa !13
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [1000010 x i64], ptr @inv, i64 0, i64 %71
  %73 = load i64, ptr %72, align 8, !tbaa !5
  %74 = sub nsw i64 0, %73
  %75 = load i64, ptr @mod, align 8, !tbaa !5
  %76 = add nsw i64 %74, %75
  %77 = mul nsw i64 %76, 2
  %78 = load i64, ptr @mod, align 8, !tbaa !5
  %79 = srem i64 %77, %78
  %80 = trunc i64 %79 to i32
  %81 = load i32, ptr %4, align 4, !tbaa !13
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [1000010 x i32], ptr @F, i64 0, i64 %82
  store i32 %80, ptr %83, align 4, !tbaa !13
  br label %84

84:                                               ; preds = %69
  %85 = load i32, ptr %4, align 4, !tbaa !13
  %86 = add nsw i32 %85, 1
  store i32 %86, ptr %4, align 4, !tbaa !13
  br label %63, !llvm.loop !15

87:                                               ; preds = %68
  %88 = load i64, ptr @m, align 8, !tbaa !5
  %89 = trunc i64 %88 to i32
  call void @_Z7polyInvPiS_i(ptr noundef @F, ptr noundef @G, i32 noundef %89)
  store i64 0, ptr @ans, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  %90 = load i64, ptr @n, align 8, !tbaa !5
  %91 = trunc i64 %90 to i32
  store i32 %91, ptr %5, align 4, !tbaa !13
  br label %92

92:                                               ; preds = %114, %87
  %93 = load i32, ptr %5, align 4, !tbaa !13
  %94 = icmp sge i32 %93, 0
  br i1 %94, label %96, label %95

95:                                               ; preds = %92
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %117

96:                                               ; preds = %92
  %97 = load i32, ptr %5, align 4, !tbaa !13
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [1000010 x i32], ptr @G, i64 0, i64 %98
  %100 = load i32, ptr %99, align 4, !tbaa !13
  %101 = sext i32 %100 to i64
  %102 = load i32, ptr %5, align 4, !tbaa !13
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [1000010 x i64], ptr @fac, i64 0, i64 %103
  %105 = load i64, ptr %104, align 8, !tbaa !5
  %106 = mul nsw i64 %101, %105
  %107 = load i64, ptr @mod, align 8, !tbaa !5
  %108 = srem i64 %106, %107
  %109 = load i64, ptr @ans, align 8, !tbaa !5
  %110 = add nsw i64 %109, %108
  store i64 %110, ptr @ans, align 8, !tbaa !5
  %111 = load i64, ptr @mod, align 8, !tbaa !5
  %112 = load i64, ptr @ans, align 8, !tbaa !5
  %113 = srem i64 %112, %111
  store i64 %113, ptr @ans, align 8, !tbaa !5
  br label %114

114:                                              ; preds = %96
  %115 = load i32, ptr %5, align 4, !tbaa !13
  %116 = add nsw i32 %115, -1
  store i32 %116, ptr %5, align 4, !tbaa !13
  br label %92, !llvm.loop !16

117:                                              ; preds = %95
  %118 = load i64, ptr @ans, align 8, !tbaa !5
  %119 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %118)
  %120 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %119, i8 noundef signext 10)
  ret i32 0
}

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

; 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

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 = { 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 = { 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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@mod = external dso_local local_unnamed_addr global i64, align 8
@F = external dso_local global [1000010 x i32], align 16
@G = external dso_local global [1000010 x i32], align 16
@inv = external dso_local local_unnamed_addr global [1000010 x i64], align 16
@fac = external dso_local local_unnamed_addr global [1000010 x i64], align 16
@ans = external dso_local local_unnamed_addr global i64, align 8
@n = external dso_local global i64, align 8
@m = external dso_local local_unnamed_addr global i64, align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z4initv() local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z7polyInvPiS_i(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  tail call void @_Z4initv()
  %1 = 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)
  %2 = load i64, ptr @n, align 8, !tbaa !5
  br label %3

3:                                                ; preds = %3, %0
  %storemerge = phi i64 [ 1, %0 ], [ %4, %3 ]
  %.not = icmp sgt i64 %storemerge, %2
  %4 = shl i64 %storemerge, 1
  br i1 %.not, label %5, label %3, !llvm.loop !9

5:                                                ; preds = %3
  store i64 %storemerge, ptr @m, align 8, !tbaa !5
  store i64 1, ptr @fac, align 16, !tbaa !5
  %.not2326 = icmp slt i64 %storemerge, 1
  %.pre = load i64, ptr @mod, align 8, !tbaa !5
  br i1 %.not2326, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %5
  %xtraiter = and i64 %storemerge, 1
  %6 = icmp eq i64 %storemerge, 1
  br i1 %6, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph.preheader.new

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

._crit_edge.loopexit.unr-lcssa:                   ; preds = %.lr.ph, %.lr.ph.preheader
  %.unr = phi i64 [ 1, %.lr.ph.preheader ], [ %29, %.lr.ph ]
  %.02027.unr = phi i64 [ 1, %.lr.ph.preheader ], [ %31, %.lr.ph ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.lr.ph.epil

.lr.ph.epil:                                      ; preds = %._crit_edge.loopexit.unr-lcssa
  %7 = mul nsw i64 %.unr, %.02027.unr
  %8 = srem i64 %7, %.pre
  %9 = getelementptr inbounds [1000010 x i64], ptr @fac, i64 0, i64 %.02027.unr
  store i64 %8, ptr %9, align 8, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph.epil, %._crit_edge.loopexit.unr-lcssa, %5
  store i64 1, ptr getelementptr inbounds (i8, ptr @inv, i64 8), align 8, !tbaa !5
  store i64 1, ptr @inv, align 16, !tbaa !5
  %10 = getelementptr inbounds [1000010 x i64], ptr @fac, i64 0, i64 %storemerge
  %11 = load i64, ptr %10, align 8, !tbaa !5
  %12 = add nsw i64 %.pre, -2
  %13 = tail call noundef i64 @_Z6qpowerxx(i64 noundef %11, i64 noundef %12)
  %14 = load i64, ptr @m, align 8, !tbaa !5
  %15 = getelementptr inbounds [1000010 x i64], ptr @inv, i64 0, i64 %14
  store i64 %13, ptr %15, align 8, !tbaa !5
  %16 = icmp sgt i64 %14, 0
  br i1 %16, label %.lr.ph30, label %._crit_edge31

.lr.ph30:                                         ; preds = %._crit_edge
  %17 = load i64, ptr @mod, align 8, !tbaa !5
  %xtraiter47 = and i64 %14, 1
  %lcmp.mod48.not = icmp eq i64 %xtraiter47, 0
  br i1 %lcmp.mod48.not, label %.prol.loopexit, label %.prol.loopexit.unr-lcssa

.prol.loopexit.unr-lcssa:                         ; preds = %.lr.ph30
  %18 = mul nsw i64 %13, %14
  %19 = srem i64 %18, %17
  %20 = add nsw i64 %14, -1
  %21 = getelementptr inbounds [1000010 x i64], ptr @inv, i64 0, i64 %20
  store i64 %19, ptr %21, align 8, !tbaa !5
  br label %.prol.loopexit

.prol.loopexit:                                   ; preds = %.prol.loopexit.unr-lcssa, %.lr.ph30
  %.unr49 = phi i64 [ %13, %.lr.ph30 ], [ %19, %.prol.loopexit.unr-lcssa ]
  %.01928.unr = phi i64 [ %14, %.lr.ph30 ], [ %20, %.prol.loopexit.unr-lcssa ]
  %22 = icmp eq i64 %14, 1
  br i1 %22, label %._crit_edge31, label %.lr.ph30.new

.lr.ph:                                           ; preds = %.lr.ph, %.lr.ph.preheader.new
  %23 = phi i64 [ 1, %.lr.ph.preheader.new ], [ %29, %.lr.ph ]
  %.02027 = phi i64 [ 1, %.lr.ph.preheader.new ], [ %31, %.lr.ph ]
  %niter = phi i64 [ 0, %.lr.ph.preheader.new ], [ %niter.next.1, %.lr.ph ]
  %24 = mul nsw i64 %23, %.02027
  %25 = srem i64 %24, %.pre
  %26 = getelementptr inbounds [1000010 x i64], ptr @fac, i64 0, i64 %.02027
  store i64 %25, ptr %26, align 8, !tbaa !5
  %27 = add nuw nsw i64 %.02027, 1
  %28 = mul nsw i64 %25, %27
  %29 = srem i64 %28, %.pre
  %30 = getelementptr inbounds [1000010 x i64], ptr @fac, i64 0, i64 %27
  store i64 %29, ptr %30, align 8, !tbaa !5
  %31 = add nuw nsw i64 %.02027, 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 %._crit_edge.loopexit.unr-lcssa, label %.lr.ph, !llvm.loop !11

._crit_edge31:                                    ; preds = %.prol.loopexit, %.lr.ph30.new, %._crit_edge
  store i32 1, ptr @F, align 16, !tbaa !12
  %32 = load i64, ptr @n, align 8, !tbaa !5
  %.not2432 = icmp slt i64 %32, 1
  br i1 %.not2432, label %._crit_edge36, label %.lr.ph35

.lr.ph35:                                         ; preds = %._crit_edge31
  %33 = load i64, ptr @mod, align 8, !tbaa !5
  %xtraiter50 = and i64 %32, 1
  %34 = icmp eq i64 %32, 1
  br i1 %34, label %._crit_edge36.loopexit.unr-lcssa, label %.lr.ph35.new

.lr.ph35.new:                                     ; preds = %.lr.ph35
  %unroll_iter52 = and i64 %32, 9223372036854775806
  br label %60

.lr.ph30.new:                                     ; preds = %.prol.loopexit, %.lr.ph30.new
  %35 = phi i64 [ %41, %.lr.ph30.new ], [ %.unr49, %.prol.loopexit ]
  %.01928 = phi i64 [ %42, %.lr.ph30.new ], [ %.01928.unr, %.prol.loopexit ]
  %36 = mul nsw i64 %35, %.01928
  %37 = srem i64 %36, %17
  %38 = add nsw i64 %.01928, -1
  %39 = getelementptr inbounds [1000010 x i64], ptr @inv, i64 0, i64 %38
  store i64 %37, ptr %39, align 8, !tbaa !5
  %40 = mul nsw i64 %37, %38
  %41 = srem i64 %40, %17
  %42 = add nsw i64 %.01928, -2
  %43 = getelementptr inbounds [1000010 x i64], ptr @inv, i64 0, i64 %42
  store i64 %41, ptr %43, align 8, !tbaa !5
  %44 = icmp ugt i64 %38, 1
  br i1 %44, label %.lr.ph30.new, label %._crit_edge31, !llvm.loop !14

._crit_edge36.loopexit.unr-lcssa:                 ; preds = %60, %.lr.ph35
  %indvars.iv.unr = phi i64 [ 1, %.lr.ph35 ], [ %indvars.iv.next.1, %60 ]
  %lcmp.mod51.not = icmp eq i64 %xtraiter50, 0
  br i1 %lcmp.mod51.not, label %._crit_edge36, label %._crit_edge36.loopexit.epilog-lcssa

._crit_edge36.loopexit.epilog-lcssa:              ; preds = %._crit_edge36.loopexit.unr-lcssa
  %45 = getelementptr inbounds [1000010 x i64], ptr @inv, i64 0, i64 %indvars.iv.unr
  %46 = load i64, ptr %45, align 8, !tbaa !5
  %47 = sub i64 %33, %46
  %48 = shl nsw i64 %47, 1
  %49 = srem i64 %48, %33
  %50 = trunc i64 %49 to i32
  %51 = getelementptr inbounds [1000010 x i32], ptr @F, i64 0, i64 %indvars.iv.unr
  store i32 %50, ptr %51, align 4, !tbaa !12
  br label %._crit_edge36

._crit_edge36:                                    ; preds = %._crit_edge36.loopexit.epilog-lcssa, %._crit_edge36.loopexit.unr-lcssa, %._crit_edge31
  %52 = trunc i64 %14 to i32
  tail call void @_Z7polyInvPiS_i(ptr noundef nonnull @F, ptr noundef nonnull @G, i32 noundef %52)
  store i64 0, ptr @ans, align 8, !tbaa !5
  %53 = load i64, ptr @n, align 8, !tbaa !5
  %54 = and i64 %53, 2147483648
  %55 = icmp eq i64 %54, 0
  br i1 %55, label %.lr.ph39, label %85

.lr.ph39:                                         ; preds = %._crit_edge36
  %56 = load i64, ptr @mod, align 8, !tbaa !5
  %57 = and i64 %53, 2147483647
  %58 = icmp eq i64 %57, 0
  br i1 %58, label %._crit_edge40.unr-lcssa, label %.lr.ph39.new

.lr.ph39.new:                                     ; preds = %.lr.ph39
  %59 = add nuw nsw i64 %53, 1
  %unroll_iter59 = and i64 %59, 4294967294
  br label %89

60:                                               ; preds = %60, %.lr.ph35.new
  %indvars.iv = phi i64 [ 1, %.lr.ph35.new ], [ %indvars.iv.next.1, %60 ]
  %niter53 = phi i64 [ 0, %.lr.ph35.new ], [ %niter53.next.1, %60 ]
  %61 = getelementptr inbounds [1000010 x i64], ptr @inv, i64 0, i64 %indvars.iv
  %62 = load i64, ptr %61, align 8, !tbaa !5
  %63 = sub i64 %33, %62
  %64 = shl nsw i64 %63, 1
  %65 = srem i64 %64, %33
  %66 = trunc i64 %65 to i32
  %67 = getelementptr inbounds [1000010 x i32], ptr @F, i64 0, i64 %indvars.iv
  store i32 %66, ptr %67, align 4, !tbaa !12
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %68 = getelementptr inbounds [1000010 x i64], ptr @inv, i64 0, i64 %indvars.iv.next
  %69 = load i64, ptr %68, align 8, !tbaa !5
  %70 = sub i64 %33, %69
  %71 = shl nsw i64 %70, 1
  %72 = srem i64 %71, %33
  %73 = trunc i64 %72 to i32
  %74 = getelementptr inbounds [1000010 x i32], ptr @F, i64 0, i64 %indvars.iv.next
  store i32 %73, ptr %74, align 4, !tbaa !12
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %niter53.next.1 = add i64 %niter53, 2
  %niter53.ncmp.1 = icmp eq i64 %niter53.next.1, %unroll_iter52
  br i1 %niter53.ncmp.1, label %._crit_edge36.loopexit.unr-lcssa, label %60, !llvm.loop !15

._crit_edge40.unr-lcssa:                          ; preds = %89, %.lr.ph39
  %.lcssa.ph = phi i64 [ poison, %.lr.ph39 ], [ %108, %89 ]
  %indvars.iv43.unr = phi i64 [ %57, %.lr.ph39 ], [ %indvars.iv.next44.1, %89 ]
  %.unr56 = phi i64 [ 0, %.lr.ph39 ], [ %108, %89 ]
  %75 = and i64 %53, 1
  %lcmp.mod57.not.not = icmp eq i64 %75, 0
  br i1 %lcmp.mod57.not.not, label %._crit_edge40.epilog-lcssa, label %._crit_edge40

._crit_edge40.epilog-lcssa:                       ; preds = %._crit_edge40.unr-lcssa
  %76 = getelementptr inbounds [1000010 x i32], ptr @G, i64 0, i64 %indvars.iv43.unr
  %77 = load i32, ptr %76, align 4, !tbaa !12
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [1000010 x i64], ptr @fac, i64 0, i64 %indvars.iv43.unr
  %80 = load i64, ptr %79, align 8, !tbaa !5
  %81 = mul nsw i64 %80, %78
  %82 = srem i64 %81, %56
  %83 = add nsw i64 %.unr56, %82
  %84 = srem i64 %83, %56
  br label %._crit_edge40

._crit_edge40:                                    ; preds = %._crit_edge40.unr-lcssa, %._crit_edge40.epilog-lcssa
  %.lcssa = phi i64 [ %.lcssa.ph, %._crit_edge40.unr-lcssa ], [ %84, %._crit_edge40.epilog-lcssa ]
  store i64 %.lcssa, ptr @ans, align 8, !tbaa !5
  br label %85

85:                                               ; preds = %._crit_edge40, %._crit_edge36
  %86 = phi i64 [ %.lcssa, %._crit_edge40 ], [ 0, %._crit_edge36 ]
  %87 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %86)
  %88 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %87, i8 noundef signext 10)
  ret i32 0

89:                                               ; preds = %89, %.lr.ph39.new
  %indvars.iv43 = phi i64 [ %57, %.lr.ph39.new ], [ %indvars.iv.next44.1, %89 ]
  %90 = phi i64 [ 0, %.lr.ph39.new ], [ %108, %89 ]
  %niter60 = phi i64 [ 0, %.lr.ph39.new ], [ %niter60.next.1, %89 ]
  %91 = getelementptr inbounds [1000010 x i32], ptr @G, i64 0, i64 %indvars.iv43
  %92 = load i32, ptr %91, align 4, !tbaa !12
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [1000010 x i64], ptr @fac, i64 0, i64 %indvars.iv43
  %95 = load i64, ptr %94, align 8, !tbaa !5
  %96 = mul nsw i64 %95, %93
  %97 = srem i64 %96, %56
  %98 = add nsw i64 %90, %97
  %99 = srem i64 %98, %56
  %indvars.iv.next44 = add nsw i64 %indvars.iv43, -1
  %100 = getelementptr inbounds [1000010 x i32], ptr @G, i64 0, i64 %indvars.iv.next44
  %101 = load i32, ptr %100, align 4, !tbaa !12
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [1000010 x i64], ptr @fac, i64 0, i64 %indvars.iv.next44
  %104 = load i64, ptr %103, align 8, !tbaa !5
  %105 = mul nsw i64 %104, %102
  %106 = srem i64 %105, %56
  %107 = add nsw i64 %99, %106
  %108 = srem i64 %107, %56
  %indvars.iv.next44.1 = add nsw i64 %indvars.iv43, -2
  %niter60.next.1 = add i64 %niter60, 2
  %niter60.ncmp.1 = icmp eq i64 %niter60.next.1, %unroll_iter59
  br i1 %niter60.ncmp.1, label %._crit_edge40.unr-lcssa, label %89, !llvm.loop !16
}

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

; 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 #1 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 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 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 #3 = { 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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}


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