; LLVM IR from eyangch/competitive-programming :: Codeforces/1726 (e)

; 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_ostream" = type { ptr, %"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_istream" = type { ptr, i64, %"class.std::basic_ios" }

@MOD = external dso_local global i64, align 8
@f = external dso_local global [300005 x i64], align 16
@fi = external dso_local global [300005 x i64], align 16
@p2 = external dso_local global [300005 x i64], align 16
@aux = external dso_local global [300005 x i64], align 16
@T = external dso_local global i64, align 8
@N = external dso_local global i64, align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@_ZSt3cin = external global %"class.std::basic_istream", 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 nounwind uwtable
declare dso_local noundef i64 @_Z3nCrxx(i64 noundef, i64 noundef) #1

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

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

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

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

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

21:                                               ; preds = %17
  %22 = load i64, ptr %2, align 8, !tbaa !8
  %23 = sub nsw i64 %22, 1
  %24 = getelementptr inbounds [300005 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 [300005 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 %17, !llvm.loop !11

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

36:                                               ; preds = %47, %35
  %37 = load i64, ptr %3, align 8, !tbaa !8
  %38 = icmp slt i64 %37, 300005
  br i1 %38, label %40, label %39

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

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

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

50:                                               ; preds = %39
  store i64 1, ptr @p2, align 16, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  store i64 1, ptr %4, align 8, !tbaa !8
  br label %51

51:                                               ; preds = %65, %50
  %52 = load i64, ptr %4, align 8, !tbaa !8
  %53 = icmp slt i64 %52, 300005
  br i1 %53, label %55, label %54

54:                                               ; preds = %51
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  br label %68

55:                                               ; preds = %51
  %56 = load i64, ptr %4, align 8, !tbaa !8
  %57 = sub nsw i64 %56, 1
  %58 = getelementptr inbounds [300005 x i64], ptr @p2, i64 0, i64 %57
  %59 = load i64, ptr %58, align 8, !tbaa !8
  %60 = mul nsw i64 %59, 2
  %61 = load i64, ptr @MOD, align 8, !tbaa !8
  %62 = srem i64 %60, %61
  %63 = load i64, ptr %4, align 8, !tbaa !8
  %64 = getelementptr inbounds [300005 x i64], ptr @p2, i64 0, i64 %63
  store i64 %62, ptr %64, align 8, !tbaa !8
  br label %65

65:                                               ; preds = %55
  %66 = load i64, ptr %4, align 8, !tbaa !8
  %67 = add nsw i64 %66, 1
  store i64 %67, ptr %4, align 8, !tbaa !8
  br label %51, !llvm.loop !14

68:                                               ; preds = %54
  store i64 1, ptr @aux, align 16, !tbaa !8
  store i64 1, ptr getelementptr inbounds ([300005 x i64], ptr @aux, i64 0, i64 1), align 8, !tbaa !8
  store i64 2, ptr getelementptr inbounds ([300005 x i64], ptr @aux, i64 0, i64 2), align 16, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  store i64 3, ptr %5, align 8, !tbaa !8
  br label %69

69:                                               ; preds = %92, %68
  %70 = load i64, ptr %5, align 8, !tbaa !8
  %71 = icmp slt i64 %70, 300005
  br i1 %71, label %73, label %72

72:                                               ; preds = %69
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  br label %95

73:                                               ; preds = %69
  %74 = load i64, ptr %5, align 8, !tbaa !8
  %75 = sub nsw i64 %74, 1
  %76 = getelementptr inbounds [300005 x i64], ptr @aux, i64 0, i64 %75
  %77 = load i64, ptr %76, align 8, !tbaa !8
  %78 = load i64, ptr %5, align 8, !tbaa !8
  %79 = sub nsw i64 %78, 1
  %80 = load i64, ptr %5, align 8, !tbaa !8
  %81 = sub nsw i64 %80, 2
  %82 = getelementptr inbounds [300005 x i64], ptr @aux, i64 0, i64 %81
  %83 = load i64, ptr %82, align 8, !tbaa !8
  %84 = mul nsw i64 %79, %83
  %85 = load i64, ptr @MOD, align 8, !tbaa !8
  %86 = srem i64 %84, %85
  %87 = add nsw i64 %77, %86
  %88 = load i64, ptr @MOD, align 8, !tbaa !8
  %89 = srem i64 %87, %88
  %90 = load i64, ptr %5, align 8, !tbaa !8
  %91 = getelementptr inbounds [300005 x i64], ptr @aux, i64 0, i64 %90
  store i64 %89, ptr %91, align 8, !tbaa !8
  br label %92

92:                                               ; preds = %73
  %93 = load i64, ptr %5, align 8, !tbaa !8
  %94 = add nsw i64 %93, 1
  store i64 %94, ptr %5, align 8, !tbaa !8
  br label %69, !llvm.loop !15

95:                                               ; preds = %72
  %96 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @T)
  br label %97

97:                                               ; preds = %153, %95
  %98 = load i64, ptr @T, align 8, !tbaa !8
  %99 = add nsw i64 %98, -1
  store i64 %99, ptr @T, align 8, !tbaa !8
  %100 = icmp ne i64 %98, 0
  br i1 %100, label %101, label %157

101:                                              ; preds = %97
  %102 = 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)
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  store i64 0, ptr %6, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  store i64 0, ptr %7, align 8, !tbaa !8
  br label %103

103:                                              ; preds = %150, %101
  %104 = load i64, ptr %7, align 8, !tbaa !8
  %105 = load i64, ptr @N, align 8, !tbaa !8
  %106 = icmp sle i64 %104, %105
  br i1 %106, label %108, label %107

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

108:                                              ; preds = %103
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %109 = load i64, ptr %7, align 8, !tbaa !8
  %110 = sdiv i64 %109, 2
  %111 = load i64, ptr @N, align 8, !tbaa !8
  %112 = add nsw i64 %110, %111
  %113 = load i64, ptr %7, align 8, !tbaa !8
  %114 = sub nsw i64 %112, %113
  %115 = load i64, ptr %7, align 8, !tbaa !8
  %116 = sdiv i64 %115, 2
  %117 = call noundef i64 @_Z3nCrxx(i64 noundef %114, i64 noundef %116)
  store i64 %117, ptr %8, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %118 = load i64, ptr %7, align 8, !tbaa !8
  %119 = sdiv i64 %118, 2
  store i64 %119, ptr %9, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %120 = load i64, ptr %9, align 8, !tbaa !8
  %121 = getelementptr inbounds [300005 x i64], ptr @f, i64 0, i64 %120
  %122 = load i64, ptr %121, align 8, !tbaa !8
  %123 = load i64, ptr %9, align 8, !tbaa !8
  %124 = sdiv i64 %123, 2
  %125 = getelementptr inbounds [300005 x i64], ptr @f, i64 0, i64 %124
  %126 = load i64, ptr %125, align 8, !tbaa !8
  %127 = load i64, ptr @MOD, align 8, !tbaa !8
  %128 = srem i64 %126, %127
  %129 = call noundef i64 @_Z3invx(i64 noundef %128)
  %130 = mul nsw i64 %122, %129
  %131 = load i64, ptr @MOD, align 8, !tbaa !8
  %132 = srem i64 %130, %131
  store i64 %132, ptr %10, align 8, !tbaa !8
  %133 = load i64, ptr %6, align 8, !tbaa !8
  %134 = load i64, ptr %8, align 8, !tbaa !8
  %135 = load i64, ptr %10, align 8, !tbaa !8
  %136 = mul nsw i64 %134, %135
  %137 = load i64, ptr @MOD, align 8, !tbaa !8
  %138 = srem i64 %136, %137
  %139 = load i64, ptr @N, align 8, !tbaa !8
  %140 = load i64, ptr %7, align 8, !tbaa !8
  %141 = sub nsw i64 %139, %140
  %142 = getelementptr inbounds [300005 x i64], ptr @aux, i64 0, i64 %141
  %143 = load i64, ptr %142, align 8, !tbaa !8
  %144 = mul nsw i64 %138, %143
  %145 = load i64, ptr @MOD, align 8, !tbaa !8
  %146 = srem i64 %144, %145
  %147 = add nsw i64 %133, %146
  %148 = load i64, ptr @MOD, align 8, !tbaa !8
  %149 = srem i64 %147, %148
  store i64 %149, ptr %6, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  br label %150

150:                                              ; preds = %108
  %151 = load i64, ptr %7, align 8, !tbaa !8
  %152 = add nsw i64 %151, 4
  store i64 %152, ptr %7, align 8, !tbaa !8
  br label %103, !llvm.loop !16

153:                                              ; preds = %107
  %154 = load i64, ptr %6, align 8, !tbaa !8
  %155 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %154)
  %156 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %155, i8 noundef signext 10)
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  br label %97, !llvm.loop !17

157:                                              ; preds = %97
  %158 = load i32, ptr %1, align 4
  ret i32 %158
}

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

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

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 = { 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 #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #5 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"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 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}


; 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_ostream" = type { ptr, %"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_istream" = type { ptr, i64, %"class.std::basic_ios" }

@MOD = external dso_local local_unnamed_addr global i64, align 8
@f = external dso_local local_unnamed_addr global [300005 x i64], align 16
@fi = external dso_local local_unnamed_addr global [300005 x i64], align 16
@p2 = external dso_local local_unnamed_addr global [300005 x i64], align 16
@aux = external dso_local local_unnamed_addr global [300005 x i64], align 16
@T = external dso_local global i64, align 8
@N = external dso_local global i64, align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8

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

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

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

; 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: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 {
  %1 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %2 = getelementptr i8, ptr %1, i64 -24
  %3 = load i64, ptr %2, align 8
  %4 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %3
  %5 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %4, ptr noundef null)
  %6 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  store i64 1, ptr @f, align 16, !tbaa !8
  %7 = load i64, ptr @MOD, align 8, !tbaa !8
  br label %8

8:                                                ; preds = %8, %0
  %9 = phi i64 [ 1, %0 ], [ %15, %8 ]
  %.040 = phi i64 [ 1, %0 ], [ %17, %8 ]
  %10 = mul nsw i64 %9, %.040
  %11 = srem i64 %10, %7
  %12 = getelementptr inbounds [300005 x i64], ptr @f, i64 0, i64 %.040
  store i64 %11, ptr %12, align 8, !tbaa !8
  %13 = add nuw nsw i64 %.040, 1
  %14 = mul nsw i64 %11, %13
  %15 = srem i64 %14, %7
  %16 = getelementptr inbounds [300005 x i64], ptr @f, i64 0, i64 %13
  store i64 %15, ptr %16, align 8, !tbaa !8
  %17 = add nuw nsw i64 %.040, 2
  %exitcond.not.1 = icmp eq i64 %17, 300005
  br i1 %exitcond.not.1, label %.preheader, label %8, !llvm.loop !11

18:                                               ; preds = %.preheader
  store i64 1, ptr @p2, align 16, !tbaa !8
  %19 = load i64, ptr @MOD, align 8, !tbaa !8
  br label %26

.preheader:                                       ; preds = %8, %.preheader
  %.03341 = phi i64 [ %24, %.preheader ], [ 0, %8 ]
  %20 = getelementptr inbounds [300005 x i64], ptr @f, i64 0, i64 %.03341
  %21 = load i64, ptr %20, align 8, !tbaa !8
  %22 = tail call noundef i64 @_Z3invx(i64 noundef %21)
  %23 = getelementptr inbounds [300005 x i64], ptr @fi, i64 0, i64 %.03341
  store i64 %22, ptr %23, align 8, !tbaa !8
  %24 = add nuw nsw i64 %.03341, 1
  %exitcond51.not = icmp eq i64 %24, 300005
  br i1 %exitcond51.not, label %18, label %.preheader, !llvm.loop !13

25:                                               ; preds = %26
  store i64 1, ptr @aux, align 16, !tbaa !8
  store i64 1, ptr getelementptr inbounds (i8, ptr @aux, i64 8), align 8, !tbaa !8
  store i64 2, ptr getelementptr inbounds (i8, ptr @aux, i64 16), align 16, !tbaa !8
  br label %40

26:                                               ; preds = %26, %18
  %27 = phi i64 [ 1, %18 ], [ %33, %26 ]
  %.03442 = phi i64 [ 1, %18 ], [ %35, %26 ]
  %28 = shl nsw i64 %27, 1
  %29 = srem i64 %28, %19
  %30 = getelementptr inbounds [300005 x i64], ptr @p2, i64 0, i64 %.03442
  store i64 %29, ptr %30, align 8, !tbaa !8
  %31 = add nuw nsw i64 %.03442, 1
  %32 = shl nsw i64 %29, 1
  %33 = srem i64 %32, %19
  %34 = getelementptr inbounds [300005 x i64], ptr @p2, i64 0, i64 %31
  store i64 %33, ptr %34, align 8, !tbaa !8
  %35 = add nuw nsw i64 %.03442, 2
  %exitcond52.not.1 = icmp eq i64 %35, 300005
  br i1 %exitcond52.not.1, label %25, label %26, !llvm.loop !14

36:                                               ; preds = %40
  %37 = 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) @T)
  %38 = load i64, ptr @T, align 8, !tbaa !8
  %39 = add nsw i64 %38, -1
  store i64 %39, ptr @T, align 8, !tbaa !8
  %.not47 = icmp eq i64 %38, 0
  br i1 %.not47, label %._crit_edge50, label %.lr.ph49

40:                                               ; preds = %25, %40
  %41 = phi i64 [ 2, %25 ], [ %49, %40 ]
  %.03743 = phi i64 [ 3, %25 ], [ %51, %40 ]
  %42 = add nsw i64 %.03743, -1
  %43 = add nsw i64 %.03743, -2
  %44 = getelementptr inbounds [300005 x i64], ptr @aux, i64 0, i64 %43
  %45 = load i64, ptr %44, align 8, !tbaa !8
  %46 = mul nsw i64 %45, %42
  %47 = srem i64 %46, %19
  %48 = add nsw i64 %47, %41
  %49 = srem i64 %48, %19
  %50 = getelementptr inbounds [300005 x i64], ptr @aux, i64 0, i64 %.03743
  store i64 %49, ptr %50, align 8, !tbaa !8
  %51 = add nuw nsw i64 %.03743, 1
  %exitcond53.not = icmp eq i64 %51, 300005
  br i1 %exitcond53.not, label %36, label %40, !llvm.loop !15

.lr.ph49:                                         ; preds = %36, %._crit_edge
  %52 = 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)
  %53 = load i64, ptr @N, align 8, !tbaa !8
  %.not3944 = icmp slt i64 %53, 0
  br i1 %.not3944, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph49
  %.036.lcssa = phi i64 [ 0, %.lr.ph49 ], [ %83, %.lr.ph ]
  %54 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.036.lcssa)
  %55 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %54, i8 noundef signext 10)
  %56 = load i64, ptr @T, align 8, !tbaa !8
  %57 = add nsw i64 %56, -1
  store i64 %57, ptr @T, align 8, !tbaa !8
  %.not = icmp eq i64 %56, 0
  br i1 %.not, label %._crit_edge50, label %.lr.ph49, !llvm.loop !16

.lr.ph:                                           ; preds = %.lr.ph49, %.lr.ph
  %58 = phi i64 [ %76, %.lr.ph ], [ %53, %.lr.ph49 ]
  %.03546 = phi i64 [ %84, %.lr.ph ], [ 0, %.lr.ph49 ]
  %.03645 = phi i64 [ %83, %.lr.ph ], [ 0, %.lr.ph49 ]
  %59 = lshr exact i64 %.03546, 1
  %60 = sub i64 %58, %.03546
  %61 = add i64 %60, %59
  %62 = tail call noundef i64 @_Z3nCrxx(i64 noundef %61, i64 noundef %59)
  %63 = getelementptr inbounds [300005 x i64], ptr @f, i64 0, i64 %59
  %64 = load i64, ptr %63, align 16, !tbaa !8
  %65 = lshr exact i64 %.03546, 2
  %66 = getelementptr inbounds [300005 x i64], ptr @f, i64 0, i64 %65
  %67 = load i64, ptr %66, align 8, !tbaa !8
  %68 = load i64, ptr @MOD, align 8, !tbaa !8
  %69 = srem i64 %67, %68
  %70 = tail call noundef i64 @_Z3invx(i64 noundef %69)
  %71 = mul nsw i64 %70, %64
  %72 = load i64, ptr @MOD, align 8, !tbaa !8
  %73 = srem i64 %71, %72
  %74 = mul nsw i64 %73, %62
  %75 = srem i64 %74, %72
  %76 = load i64, ptr @N, align 8, !tbaa !8
  %77 = sub nsw i64 %76, %.03546
  %78 = getelementptr inbounds [300005 x i64], ptr @aux, i64 0, i64 %77
  %79 = load i64, ptr %78, align 8, !tbaa !8
  %80 = mul nsw i64 %79, %75
  %81 = srem i64 %80, %72
  %82 = add nsw i64 %81, %.03645
  %83 = srem i64 %82, %72
  %84 = add nuw nsw i64 %.03546, 4
  %.not39 = icmp sgt i64 %84, %76
  br i1 %.not39, label %._crit_edge, label %.lr.ph, !llvm.loop !17

._crit_edge50:                                    ; preds = %._crit_edge, %36
  ret i32 0
}

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

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 = { 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 #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" }

!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 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}


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