; LLVM IR from ravireddy07/cpp-book :: src/Code-Chef (CRDGAME2_Chef and Trump Cards)

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

@_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 void @_Z9factorialv() #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 nounwind uwtable
declare dso_local noundef i64 @_Z5poweryy(i64 noundef, i64 noundef) #0

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i64, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i32, align 4
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  call void @_Z9factorialv()
  %15 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %16 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %17 = getelementptr i8, ptr %16, i64 -24
  %18 = load i64, ptr %17, align 8
  %19 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %18
  %20 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %19, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  %21 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
  br label %22

22:                                               ; preds = %118, %115, %0
  %23 = load i32, ptr %2, align 4, !tbaa !8
  %24 = add nsw i32 %23, -1
  store i32 %24, ptr %2, align 4, !tbaa !8
  %25 = icmp ne i32 %23, 0
  br i1 %25, label %26, label %119

26:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #7
  %27 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERy(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %28 = load i64, ptr %3, align 8, !tbaa !11
  %29 = call ptr @llvm.stacksave.p0()
  store ptr %29, ptr %4, align 8
  %30 = alloca i64, i64 %28, align 16
  store i64 %28, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  store i64 0, ptr %6, align 8, !tbaa !11
  br label %31

31:                                               ; preds = %40, %26
  %32 = load i64, ptr %6, align 8, !tbaa !11
  %33 = load i64, ptr %3, align 8, !tbaa !11
  %34 = icmp ult i64 %32, %33
  br i1 %34, label %36, label %35

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

36:                                               ; preds = %31
  %37 = load i64, ptr %6, align 8, !tbaa !11
  %38 = getelementptr inbounds i64, ptr %30, i64 %37
  %39 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERy(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %38)
  br label %40

40:                                               ; preds = %36
  %41 = load i64, ptr %6, align 8, !tbaa !11
  %42 = add i64 %41, 1
  store i64 %42, ptr %6, align 8, !tbaa !11
  br label %31, !llvm.loop !13

43:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  %44 = load i64, ptr %3, align 8, !tbaa !11
  %45 = call noundef i64 @_Z5poweryy(i64 noundef 2, i64 noundef %44)
  %46 = urem i64 %45, 1000000007
  store i64 %46, ptr %7, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  %47 = getelementptr inbounds i64, ptr %30, i64 0
  %48 = load i64, ptr %47, align 16, !tbaa !11
  store i64 %48, ptr %8, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  store i64 1, ptr %9, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  store i64 1, ptr %10, align 8, !tbaa !11
  br label %49

49:                                               ; preds = %75, %43
  %50 = load i64, ptr %10, align 8, !tbaa !11
  %51 = load i64, ptr %3, align 8, !tbaa !11
  %52 = icmp ult i64 %50, %51
  br i1 %52, label %54, label %53

53:                                               ; preds = %49
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  br label %78

54:                                               ; preds = %49
  %55 = load i64, ptr %10, align 8, !tbaa !11
  %56 = getelementptr inbounds i64, ptr %30, i64 %55
  %57 = load i64, ptr %56, align 8, !tbaa !11
  %58 = load i64, ptr %8, align 8, !tbaa !11
  %59 = icmp ugt i64 %57, %58
  br i1 %59, label %60, label %64

60:                                               ; preds = %54
  %61 = load i64, ptr %10, align 8, !tbaa !11
  %62 = getelementptr inbounds i64, ptr %30, i64 %61
  %63 = load i64, ptr %62, align 8, !tbaa !11
  store i64 %63, ptr %8, align 8, !tbaa !11
  store i64 1, ptr %9, align 8, !tbaa !11
  br label %74

64:                                               ; preds = %54
  %65 = load i64, ptr %10, align 8, !tbaa !11
  %66 = getelementptr inbounds i64, ptr %30, i64 %65
  %67 = load i64, ptr %66, align 8, !tbaa !11
  %68 = load i64, ptr %8, align 8, !tbaa !11
  %69 = icmp eq i64 %67, %68
  br i1 %69, label %70, label %73

70:                                               ; preds = %64
  %71 = load i64, ptr %9, align 8, !tbaa !11
  %72 = add i64 %71, 1
  store i64 %72, ptr %9, align 8, !tbaa !11
  br label %73

73:                                               ; preds = %70, %64
  br label %74

74:                                               ; preds = %73, %60
  br label %75

75:                                               ; preds = %74
  %76 = load i64, ptr %10, align 8, !tbaa !11
  %77 = add i64 %76, 1
  store i64 %77, ptr %10, align 8, !tbaa !11
  br label %49, !llvm.loop !15

78:                                               ; preds = %53
  %79 = load i64, ptr %9, align 8, !tbaa !11
  %80 = urem i64 %79, 2
  %81 = icmp eq i64 %80, 1
  br i1 %81, label %82, label %87

82:                                               ; preds = %78
  %83 = load i64, ptr %7, align 8, !tbaa !11
  %84 = urem i64 %83, 1000000007
  %85 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEy(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %84)
  %86 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %85, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  store i32 2, ptr %11, align 4
  br label %115, !llvm.loop !16

87:                                               ; preds = %78
  %88 = load i64, ptr %3, align 8, !tbaa !11
  %89 = load i64, ptr %9, align 8, !tbaa !11
  %90 = sub i64 %88, %89
  %91 = call noundef i64 @_Z5poweryy(i64 noundef 2, i64 noundef %90)
  %92 = urem i64 %91, 1000000007
  store i64 %92, ptr %8, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  %93 = load i64, ptr %9, align 8, !tbaa !11
  %94 = load i64, ptr %9, align 8, !tbaa !11
  %95 = udiv i64 %94, 2
  %96 = call noundef i64 @_Z13nCrModPFermatyy(i64 noundef %93, i64 noundef %95)
  %97 = urem i64 %96, 1000000007
  store i64 %97, ptr %12, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %98 = load i64, ptr %8, align 8, !tbaa !11
  %99 = urem i64 %98, 1000000007
  %100 = load i64, ptr %12, align 8, !tbaa !11
  %101 = urem i64 %100, 1000000007
  %102 = mul i64 %99, %101
  %103 = urem i64 %102, 1000000007
  store i64 %103, ptr %13, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %104 = load i64, ptr %7, align 8, !tbaa !11
  %105 = urem i64 %104, 1000000007
  %106 = load i64, ptr %13, align 8, !tbaa !11
  %107 = urem i64 %106, 1000000007
  %108 = sub i64 %105, %107
  %109 = add i64 %108, 1000000007
  %110 = urem i64 %109, 1000000007
  store i64 %110, ptr %14, align 8, !tbaa !11
  %111 = load i64, ptr %14, align 8, !tbaa !11
  %112 = urem i64 %111, 1000000007
  %113 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEy(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %112)
  %114 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %113, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  store i32 0, ptr %11, align 4
  br label %115

115:                                              ; preds = %87, %82
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  %116 = load ptr, ptr %4, align 8
  call void @llvm.stackrestore.p0(ptr %116)
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #7
  %117 = load i32, ptr %11, align 4
  switch i32 %117, label %121 [
    i32 0, label %118
    i32 2, label %22
  ]

118:                                              ; preds = %115
  br label %22, !llvm.loop !16

119:                                              ; preds = %22
  store i32 0, ptr %1, align 4
  store i32 1, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  %120 = load i32, ptr %1, align 4
  ret i32 %120

121:                                              ; preds = %115
  unreachable
}

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) #0 align 2

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #3

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

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #5

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

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #5

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 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 = { "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 = { 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 = { nocallback nofree nosync nounwind willreturn }
attributes #6 = { 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 #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 = !{!"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 = distinct !{!15, !14}
!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"

%"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" }

@_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 void @_Z9factorialv() 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 nounwind uwtable
declare dso_local noundef i64 @_Z5poweryy(i64 noundef, i64 noundef) local_unnamed_addr #0

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = alloca i32, align 4
  %2 = alloca i64, align 8
  tail call void @_Z9factorialv()
  %3 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %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)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #8
  %9 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %10 = load i32, ptr %1, align 4, !tbaa !8
  %11 = add nsw i32 %10, -1
  store i32 %11, ptr %1, align 4, !tbaa !8
  %.not41 = icmp eq i32 %10, 0
  br i1 %.not41, label %._crit_edge44, label %.lr.ph43

.lr.ph43:                                         ; preds = %0, %._crit_edge38.thread
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #8
  %12 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERy(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %13 = load i64, ptr %2, align 8, !tbaa !11
  %14 = call ptr @llvm.stacksave.p0()
  %15 = alloca i64, i64 %13, align 16
  %16 = load i64, ptr %2, align 8, !tbaa !11
  %.not45 = icmp eq i64 %16, 0
  br i1 %.not45, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph43
  %.lcssa = phi i64 [ 0, %.lr.ph43 ], [ %27, %.lr.ph ]
  %17 = call noundef i64 @_Z5poweryy(i64 noundef 2, i64 noundef %.lcssa)
  %18 = urem i64 %17, 1000000007
  %19 = load i64, ptr %2, align 8, !tbaa !11
  %20 = icmp ugt i64 %19, 1
  br i1 %20, label %.lr.ph37.preheader, label %._crit_edge38.thread, !llvm.loop !13

.lr.ph37.preheader:                               ; preds = %._crit_edge
  %21 = load i64, ptr %15, align 16, !tbaa !11
  %22 = add i64 %19, -1
  %xtraiter = and i64 %22, 1
  %23 = icmp eq i64 %19, 2
  br i1 %23, label %._crit_edge38.unr-lcssa, label %.lr.ph37.preheader.new

.lr.ph37.preheader.new:                           ; preds = %.lr.ph37.preheader
  %unroll_iter = and i64 %22, -2
  %invariant.gep = getelementptr i8, ptr %15, i64 8
  br label %.lr.ph37

.lr.ph:                                           ; preds = %.lr.ph43, %.lr.ph
  %.032 = phi i64 [ %26, %.lr.ph ], [ 0, %.lr.ph43 ]
  %24 = getelementptr inbounds i64, ptr %15, i64 %.032
  %25 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERy(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %24)
  %26 = add nuw i64 %.032, 1
  %27 = load i64, ptr %2, align 8, !tbaa !11
  %28 = icmp ult i64 %26, %27
  br i1 %28, label %.lr.ph, label %._crit_edge, !llvm.loop !15

._crit_edge38.unr-lcssa:                          ; preds = %.lr.ph37, %.lr.ph37.preheader
  %.125.lcssa.ph = phi i64 [ poison, %.lr.ph37.preheader ], [ %.125.1, %.lr.ph37 ]
  %.02235.unr = phi i64 [ %21, %.lr.ph37.preheader ], [ %.1.1, %.lr.ph37 ]
  %.02334.unr = phi i64 [ 1, %.lr.ph37.preheader ], [ %44, %.lr.ph37 ]
  %.02433.unr = phi i64 [ 1, %.lr.ph37.preheader ], [ %.125.1, %.lr.ph37 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge38, label %.lr.ph37.epil

.lr.ph37.epil:                                    ; preds = %._crit_edge38.unr-lcssa
  %29 = getelementptr inbounds i64, ptr %15, i64 %.02334.unr
  %30 = load i64, ptr %29, align 8, !tbaa !11
  %31 = icmp ugt i64 %30, %.02235.unr
  %32 = icmp eq i64 %30, %.02235.unr
  %33 = zext i1 %32 to i64
  %spec.select.epil = add i64 %.02433.unr, %33
  %.125.epil = select i1 %31, i64 1, i64 %spec.select.epil
  br label %._crit_edge38

._crit_edge38:                                    ; preds = %._crit_edge38.unr-lcssa, %.lr.ph37.epil
  %.125.lcssa = phi i64 [ %.125.lcssa.ph, %._crit_edge38.unr-lcssa ], [ %.125.epil, %.lr.ph37.epil ]
  %34 = and i64 %.125.lcssa, 1
  %.not30 = icmp eq i64 %34, 0
  br i1 %.not30, label %45, label %._crit_edge38.thread, !llvm.loop !13

.lr.ph37:                                         ; preds = %.lr.ph37, %.lr.ph37.preheader.new
  %.02235 = phi i64 [ %21, %.lr.ph37.preheader.new ], [ %.1.1, %.lr.ph37 ]
  %.02334 = phi i64 [ 1, %.lr.ph37.preheader.new ], [ %44, %.lr.ph37 ]
  %.02433 = phi i64 [ 1, %.lr.ph37.preheader.new ], [ %.125.1, %.lr.ph37 ]
  %niter = phi i64 [ 0, %.lr.ph37.preheader.new ], [ %niter.next.1, %.lr.ph37 ]
  %35 = getelementptr inbounds i64, ptr %15, i64 %.02334
  %36 = load i64, ptr %35, align 8, !tbaa !11
  %37 = icmp ugt i64 %36, %.02235
  %38 = icmp eq i64 %36, %.02235
  %39 = zext i1 %38 to i64
  %spec.select = add i64 %.02433, %39
  %.125 = select i1 %37, i64 1, i64 %spec.select
  %.1 = call i64 @llvm.umax.i64(i64 %36, i64 %.02235)
  %gep = getelementptr i64, ptr %invariant.gep, i64 %.02334
  %40 = load i64, ptr %gep, align 8, !tbaa !11
  %41 = icmp ugt i64 %40, %.1
  %42 = icmp eq i64 %40, %.1
  %43 = zext i1 %42 to i64
  %spec.select.1 = add i64 %.125, %43
  %.125.1 = select i1 %41, i64 1, i64 %spec.select.1
  %.1.1 = call i64 @llvm.umax.i64(i64 %40, i64 %.1)
  %44 = add nuw i64 %.02334, 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_edge38.unr-lcssa, label %.lr.ph37, !llvm.loop !16

45:                                               ; preds = %._crit_edge38
  %46 = sub i64 %19, %.125.lcssa
  %47 = call noundef i64 @_Z5poweryy(i64 noundef 2, i64 noundef %46)
  %48 = urem i64 %47, 1000000007
  %49 = lshr exact i64 %.125.lcssa, 1
  %50 = call noundef i64 @_Z13nCrModPFermatyy(i64 noundef %.125.lcssa, i64 noundef %49)
  %51 = urem i64 %50, 1000000007
  %52 = mul nuw nsw i64 %51, %48
  %53 = urem i64 %52, 1000000007
  %54 = add nuw nsw i64 %18, 1000000007
  %55 = sub nuw nsw i64 %54, %53
  %56 = urem i64 %55, 1000000007
  br label %._crit_edge38.thread

._crit_edge38.thread:                             ; preds = %._crit_edge38, %._crit_edge, %45
  %.sink50 = phi i64 [ %56, %45 ], [ %18, %._crit_edge ], [ %18, %._crit_edge38 ]
  %57 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEy(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.sink50)
  %58 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %57, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.stackrestore.p0(ptr %14)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #8
  %59 = load i32, ptr %1, align 4, !tbaa !8
  %60 = add nsw i32 %59, -1
  store i32 %60, ptr %1, align 4, !tbaa !8
  %.not = icmp eq i32 %59, 0
  br i1 %.not, label %._crit_edge44, label %.lr.ph43

._crit_edge44:                                    ; preds = %._crit_edge38.thread, %0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #8
  ret i32 0
}

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) local_unnamed_addr #0 align 2

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #5

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEy(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) local_unnamed_addr #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) local_unnamed_addr #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)) #6

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #5

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umax.i64(i64, i64) #7

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 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 = { "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 = { 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 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #6 = { 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 #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { 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 = distinct !{!15, !14}
!16 = distinct !{!16, !14}


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