; LLVM IR from eyangch/competitive-programming :: Codeforces/1768 (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_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" }

@N = external dso_local global i64, align 8
@MOD = external dso_local global i64, align 8
@f = external dso_local global [3000001 x i64], align 16
@fi = external dso_local global [3000001 x i64], align 16
@iv = external dso_local global [3000001 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 nounwind uwtable
declare dso_local noundef i64 @_Z3nCrxx(i64 noundef, i64 noundef) #0

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

17:                                               ; preds = %39, %0
  %18 = load i64, ptr %2, align 8, !tbaa !8
  %19 = load i64, ptr @N, align 8, !tbaa !8
  %20 = mul nsw i64 3, %19
  %21 = icmp sle i64 %18, %20
  br i1 %21, label %23, label %22

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

23:                                               ; preds = %17
  %24 = load i64, ptr @MOD, align 8, !tbaa !8
  %25 = load i64, ptr %2, align 8, !tbaa !8
  %26 = srem i64 %24, %25
  %27 = getelementptr inbounds [3000001 x i64], ptr @iv, i64 0, i64 %26
  %28 = load i64, ptr %27, align 8, !tbaa !8
  %29 = load i64, ptr @MOD, align 8, !tbaa !8
  %30 = load i64, ptr @MOD, align 8, !tbaa !8
  %31 = load i64, ptr %2, align 8, !tbaa !8
  %32 = sdiv i64 %30, %31
  %33 = sub nsw i64 %29, %32
  %34 = mul nsw i64 %28, %33
  %35 = load i64, ptr @MOD, align 8, !tbaa !8
  %36 = srem i64 %34, %35
  %37 = load i64, ptr %2, align 8, !tbaa !8
  %38 = getelementptr inbounds [3000001 x i64], ptr @iv, i64 0, i64 %37
  store i64 %36, ptr %38, align 8, !tbaa !8
  br label %39

39:                                               ; preds = %23
  %40 = load i64, ptr %2, align 8, !tbaa !8
  %41 = add nsw i64 %40, 1
  store i64 %41, ptr %2, align 8, !tbaa !8
  br label %17, !llvm.loop !11

42:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #6
  store i64 1, ptr %3, align 8, !tbaa !8
  br label %43

43:                                               ; preds = %72, %42
  %44 = load i64, ptr %3, align 8, !tbaa !8
  %45 = load i64, ptr @N, align 8, !tbaa !8
  %46 = mul nsw i64 3, %45
  %47 = icmp sle i64 %44, %46
  br i1 %47, label %49, label %48

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

49:                                               ; preds = %43
  %50 = load i64, ptr %3, align 8, !tbaa !8
  %51 = sub nsw i64 %50, 1
  %52 = getelementptr inbounds [3000001 x i64], ptr @f, i64 0, i64 %51
  %53 = load i64, ptr %52, align 8, !tbaa !8
  %54 = load i64, ptr %3, align 8, !tbaa !8
  %55 = mul nsw i64 %53, %54
  %56 = load i64, ptr @MOD, align 8, !tbaa !8
  %57 = srem i64 %55, %56
  %58 = load i64, ptr %3, align 8, !tbaa !8
  %59 = getelementptr inbounds [3000001 x i64], ptr @f, i64 0, i64 %58
  store i64 %57, ptr %59, align 8, !tbaa !8
  %60 = load i64, ptr %3, align 8, !tbaa !8
  %61 = getelementptr inbounds [3000001 x i64], ptr @iv, i64 0, i64 %60
  %62 = load i64, ptr %61, align 8, !tbaa !8
  %63 = load i64, ptr %3, align 8, !tbaa !8
  %64 = sub nsw i64 %63, 1
  %65 = getelementptr inbounds [3000001 x i64], ptr @fi, i64 0, i64 %64
  %66 = load i64, ptr %65, align 8, !tbaa !8
  %67 = mul nsw i64 %62, %66
  %68 = load i64, ptr @MOD, align 8, !tbaa !8
  %69 = srem i64 %67, %68
  %70 = load i64, ptr %3, align 8, !tbaa !8
  %71 = getelementptr inbounds [3000001 x i64], ptr @fi, i64 0, i64 %70
  store i64 %69, ptr %71, align 8, !tbaa !8
  br label %72

72:                                               ; preds = %49
  %73 = load i64, ptr %3, align 8, !tbaa !8
  %74 = add nsw i64 %73, 1
  store i64 %74, ptr %3, align 8, !tbaa !8
  br label %43, !llvm.loop !13

75:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  store i64 1, ptr %4, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  %76 = load i64, ptr @N, align 8, !tbaa !8
  %77 = getelementptr inbounds [3000001 x i64], ptr @f, i64 0, i64 %76
  %78 = load i64, ptr %77, align 8, !tbaa !8
  %79 = sub nsw i64 %78, 1
  %80 = load i64, ptr @N, align 8, !tbaa !8
  %81 = mul nsw i64 2, %80
  %82 = getelementptr inbounds [3000001 x i64], ptr @f, i64 0, i64 %81
  %83 = load i64, ptr %82, align 8, !tbaa !8
  %84 = sub nsw i64 %83, 1
  %85 = load i64, ptr @N, align 8, !tbaa !8
  %86 = getelementptr inbounds [3000001 x i64], ptr @f, i64 0, i64 %85
  %87 = load i64, ptr %86, align 8, !tbaa !8
  %88 = sub nsw i64 %87, 1
  %89 = sub nsw i64 %84, %88
  %90 = mul nsw i64 %89, 2
  %91 = add nsw i64 %79, %90
  store i64 %91, ptr %5, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %92 = load i64, ptr @N, align 8, !tbaa !8
  %93 = getelementptr inbounds [3000001 x i64], ptr @f, i64 0, i64 %92
  %94 = load i64, ptr %93, align 8, !tbaa !8
  %95 = load i64, ptr @N, align 8, !tbaa !8
  %96 = mul nsw i64 2, %95
  %97 = getelementptr inbounds [3000001 x i64], ptr @f, i64 0, i64 %96
  %98 = load i64, ptr %97, align 8, !tbaa !8
  %99 = mul nsw i64 %94, %98
  %100 = load i64, ptr @MOD, align 8, !tbaa !8
  %101 = srem i64 %99, %100
  %102 = load i64, ptr @N, align 8, !tbaa !8
  %103 = mul nsw i64 2, %102
  %104 = load i64, ptr @N, align 8, !tbaa !8
  %105 = call noundef i64 @_Z3nCrxx(i64 noundef %103, i64 noundef %104)
  %106 = mul nsw i64 %101, %105
  %107 = load i64, ptr @MOD, align 8, !tbaa !8
  %108 = srem i64 %106, %107
  %109 = mul nsw i64 %108, 2
  %110 = load i64, ptr @MOD, align 8, !tbaa !8
  %111 = srem i64 %109, %110
  %112 = load i64, ptr %4, align 8, !tbaa !8
  %113 = load i64, ptr %5, align 8, !tbaa !8
  %114 = add nsw i64 %112, %113
  %115 = sub nsw i64 %111, %114
  %116 = load i64, ptr @MOD, align 8, !tbaa !8
  %117 = srem i64 %115, %116
  %118 = load i64, ptr @MOD, align 8, !tbaa !8
  %119 = add nsw i64 %117, %118
  %120 = load i64, ptr @MOD, align 8, !tbaa !8
  %121 = srem i64 %119, %120
  store i64 %121, 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 %122

122:                                              ; preds = %168, %75
  %123 = load i64, ptr %7, align 8, !tbaa !8
  %124 = load i64, ptr @N, align 8, !tbaa !8
  %125 = icmp sle i64 %123, %124
  br i1 %125, label %127, label %126

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

127:                                              ; preds = %122
  %128 = load i64, ptr @N, align 8, !tbaa !8
  %129 = load i64, ptr @N, align 8, !tbaa !8
  %130 = load i64, ptr %7, align 8, !tbaa !8
  %131 = sub nsw i64 %129, %130
  %132 = call noundef i64 @_Z3nCrxx(i64 noundef %128, i64 noundef %131)
  %133 = load i64, ptr @N, align 8, !tbaa !8
  %134 = load i64, ptr %7, align 8, !tbaa !8
  %135 = call noundef i64 @_Z3nCrxx(i64 noundef %133, i64 noundef %134)
  %136 = mul nsw i64 %132, %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 = mul nsw i64 2, %139
  %141 = load i64, ptr %7, align 8, !tbaa !8
  %142 = sub nsw i64 %140, %141
  %143 = load i64, ptr @N, align 8, !tbaa !8
  %144 = call noundef i64 @_Z3nCrxx(i64 noundef %142, i64 noundef %143)
  %145 = mul nsw i64 %138, %144
  %146 = load i64, ptr @MOD, align 8, !tbaa !8
  %147 = srem i64 %145, %146
  %148 = load i64, ptr @N, align 8, !tbaa !8
  %149 = getelementptr inbounds [3000001 x i64], ptr @f, i64 0, i64 %148
  %150 = load i64, ptr %149, align 8, !tbaa !8
  %151 = mul nsw i64 %147, %150
  %152 = load i64, ptr @MOD, align 8, !tbaa !8
  %153 = srem i64 %151, %152
  %154 = load i64, ptr @N, align 8, !tbaa !8
  %155 = getelementptr inbounds [3000001 x i64], ptr @f, i64 0, i64 %154
  %156 = load i64, ptr %155, align 8, !tbaa !8
  %157 = mul nsw i64 %153, %156
  %158 = load i64, ptr @MOD, align 8, !tbaa !8
  %159 = srem i64 %157, %158
  %160 = load i64, ptr @N, align 8, !tbaa !8
  %161 = getelementptr inbounds [3000001 x i64], ptr @f, i64 0, i64 %160
  %162 = load i64, ptr %161, align 8, !tbaa !8
  %163 = mul nsw i64 %159, %162
  %164 = load i64, ptr @MOD, align 8, !tbaa !8
  %165 = srem i64 %163, %164
  %166 = load i64, ptr %6, align 8, !tbaa !8
  %167 = sub nsw i64 %166, %165
  store i64 %167, ptr %6, align 8, !tbaa !8
  br label %168

168:                                              ; preds = %127
  %169 = load i64, ptr %7, align 8, !tbaa !8
  %170 = add nsw i64 %169, 1
  store i64 %170, ptr %7, align 8, !tbaa !8
  br label %122, !llvm.loop !14

171:                                              ; preds = %126
  %172 = load i64, ptr %6, align 8, !tbaa !8
  %173 = load i64, ptr @MOD, align 8, !tbaa !8
  %174 = srem i64 %172, %173
  %175 = load i64, ptr @MOD, align 8, !tbaa !8
  %176 = add nsw i64 %174, %175
  %177 = load i64, ptr @MOD, align 8, !tbaa !8
  %178 = srem i64 %176, %177
  store i64 %178, ptr %6, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %179 = load i64, ptr @N, align 8, !tbaa !8
  %180 = mul nsw i64 3, %179
  %181 = getelementptr inbounds [3000001 x i64], ptr @f, i64 0, i64 %180
  %182 = load i64, ptr %181, align 8, !tbaa !8
  %183 = load i64, ptr %4, align 8, !tbaa !8
  %184 = sub nsw i64 %182, %183
  %185 = load i64, ptr %5, align 8, !tbaa !8
  %186 = sub nsw i64 %184, %185
  %187 = load i64, ptr %6, align 8, !tbaa !8
  %188 = sub nsw i64 %186, %187
  %189 = load i64, ptr @MOD, align 8, !tbaa !8
  %190 = srem i64 %188, %189
  %191 = load i64, ptr @MOD, align 8, !tbaa !8
  %192 = add nsw i64 %190, %191
  %193 = load i64, ptr @MOD, align 8, !tbaa !8
  %194 = srem i64 %192, %193
  store i64 %194, ptr %8, align 8, !tbaa !8
  %195 = load i64, ptr %5, align 8, !tbaa !8
  %196 = load i64, ptr %6, align 8, !tbaa !8
  %197 = mul nsw i64 2, %196
  %198 = load i64, ptr @MOD, align 8, !tbaa !8
  %199 = srem i64 %197, %198
  %200 = add nsw i64 %195, %199
  %201 = load i64, ptr %8, align 8, !tbaa !8
  %202 = mul nsw i64 3, %201
  %203 = load i64, ptr @MOD, align 8, !tbaa !8
  %204 = srem i64 %202, %203
  %205 = add nsw i64 %200, %204
  %206 = load i64, ptr @MOD, align 8, !tbaa !8
  %207 = srem i64 %205, %206
  %208 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %207)
  %209 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %208, i8 noundef signext 10)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  %210 = load i32, ptr %1, align 4
  ret i32 %210
}

; 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 zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) #2

; 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

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

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

; 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) #3 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 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 #2 = { "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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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}


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

@N = external dso_local global i64, align 8
@MOD = external dso_local global i64, align 8
@f = external dso_local local_unnamed_addr global [3000001 x i64], align 16
@fi = external dso_local local_unnamed_addr global [3000001 x i64], align 16
@iv = external dso_local local_unnamed_addr global [3000001 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 nounwind uwtable
declare dso_local noundef i64 @_Z3nCrxx(i64 noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %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)
  %7 = 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)
  %8 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %7, ptr noundef nonnull align 8 dereferenceable(8) @MOD)
  store i64 1, ptr @fi, align 16, !tbaa !8
  store i64 1, ptr @f, align 16, !tbaa !8
  store i64 1, ptr getelementptr inbounds (i8, ptr @iv, i64 8), align 8, !tbaa !8
  store i64 1, ptr @iv, align 16, !tbaa !8
  %9 = load i64, ptr @N, align 8, !tbaa !8
  %10 = mul i64 %9, 3
  %.not40 = icmp slt i64 %9, 1
  %.pre.pre = load i64, ptr @MOD, align 8, !tbaa !8
  br i1 %.not40, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %0
  %smax = tail call i64 @llvm.smax.i64(i64 %10, i64 2)
  br label %11

.preheader:                                       ; preds = %11
  br i1 %.not40, label %._crit_edge, label %.lr.ph45

.lr.ph45:                                         ; preds = %.preheader
  %smax56 = tail call i64 @llvm.smax.i64(i64 %10, i64 1)
  br label %42

11:                                               ; preds = %.lr.ph, %11
  %.041 = phi i64 [ 2, %.lr.ph ], [ %20, %11 ]
  %12 = srem i64 %.pre.pre, %.041
  %13 = getelementptr inbounds [3000001 x i64], ptr @iv, i64 0, i64 %12
  %14 = load i64, ptr %13, align 8, !tbaa !8
  %15 = sdiv i64 %.pre.pre, %.041
  %16 = sub nsw i64 %.pre.pre, %15
  %17 = mul nsw i64 %16, %14
  %18 = srem i64 %17, %.pre.pre
  %19 = getelementptr inbounds [3000001 x i64], ptr @iv, i64 0, i64 %.041
  store i64 %18, ptr %19, align 8, !tbaa !8
  %20 = add nuw i64 %.041, 1
  %exitcond.not = icmp eq i64 %.041, %smax
  br i1 %exitcond.not, label %.preheader, label %11, !llvm.loop !11

._crit_edge:                                      ; preds = %42, %0, %.preheader
  %21 = getelementptr inbounds [3000001 x i64], ptr @f, i64 0, i64 %9
  %22 = load i64, ptr %21, align 8, !tbaa !8
  %23 = shl nsw i64 %9, 1
  %24 = getelementptr inbounds [3000001 x i64], ptr @f, i64 0, i64 %23
  %25 = load i64, ptr %24, align 16, !tbaa !8
  %26 = sub i64 %25, %22
  %27 = shl nsw i64 %26, 1
  %28 = mul nsw i64 %25, %22
  %29 = srem i64 %28, %.pre.pre
  %30 = tail call noundef i64 @_Z3nCrxx(i64 noundef %23, i64 noundef %9)
  %31 = mul nsw i64 %30, %29
  %32 = load i64, ptr @MOD, align 8, !tbaa !8
  %33 = srem i64 %31, %32
  %34 = shl nsw i64 %33, 1
  %35 = srem i64 %34, %32
  %36 = add i64 %27, %22
  %37 = sub i64 %35, %36
  %38 = srem i64 %37, %32
  %39 = add nsw i64 %38, %32
  %40 = srem i64 %39, %32
  %41 = load i64, ptr @N, align 8, !tbaa !8
  %.not3446 = icmp slt i64 %41, 0
  br i1 %.not3446, label %._crit_edge51, label %.lr.ph50

42:                                               ; preds = %.lr.ph45, %42
  %43 = phi i64 [ 1, %.lr.ph45 ], [ %51, %42 ]
  %44 = phi i64 [ 1, %.lr.ph45 ], [ %46, %42 ]
  %.03144 = phi i64 [ 1, %.lr.ph45 ], [ %53, %42 ]
  %45 = mul nsw i64 %44, %.03144
  %46 = srem i64 %45, %.pre.pre
  %47 = getelementptr inbounds [3000001 x i64], ptr @f, i64 0, i64 %.03144
  store i64 %46, ptr %47, align 8, !tbaa !8
  %48 = getelementptr inbounds [3000001 x i64], ptr @iv, i64 0, i64 %.03144
  %49 = load i64, ptr %48, align 8, !tbaa !8
  %50 = mul nsw i64 %43, %49
  %51 = srem i64 %50, %.pre.pre
  %52 = getelementptr inbounds [3000001 x i64], ptr @fi, i64 0, i64 %.03144
  store i64 %51, ptr %52, align 8, !tbaa !8
  %53 = add nuw i64 %.03144, 1
  %exitcond57.not = icmp eq i64 %.03144, %smax56
  br i1 %exitcond57.not, label %._crit_edge, label %42, !llvm.loop !13

._crit_edge51:                                    ; preds = %.lr.ph50, %._crit_edge
  %54 = phi i64 [ %32, %._crit_edge ], [ %89, %.lr.ph50 ]
  %.030.lcssa = phi i64 [ %40, %._crit_edge ], [ %100, %.lr.ph50 ]
  %.lcssa = phi i64 [ %41, %._crit_edge ], [ %91, %.lr.ph50 ]
  %55 = add i64 %36, -1
  %56 = srem i64 %.030.lcssa, %54
  %57 = add nsw i64 %56, %54
  %58 = srem i64 %57, %54
  %59 = mul nsw i64 %.lcssa, 3
  %60 = getelementptr inbounds [3000001 x i64], ptr @f, i64 0, i64 %59
  %61 = load i64, ptr %60, align 8, !tbaa !8
  %62 = add i64 %58, %36
  %63 = sub i64 %61, %62
  %64 = srem i64 %63, %54
  %65 = add nsw i64 %64, %54
  %66 = srem i64 %65, %54
  %67 = shl nsw i64 %58, 1
  %68 = srem i64 %67, %54
  %69 = add nsw i64 %68, %55
  %70 = mul nsw i64 %66, 3
  %71 = srem i64 %70, %54
  %72 = add nsw i64 %69, %71
  %73 = srem i64 %72, %54
  %74 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %73)
  %75 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %74, i8 noundef signext 10)
  ret i32 0

.lr.ph50:                                         ; preds = %._crit_edge, %.lr.ph50
  %76 = phi i64 [ %91, %.lr.ph50 ], [ %41, %._crit_edge ]
  %.02948 = phi i64 [ %101, %.lr.ph50 ], [ 0, %._crit_edge ]
  %.03047 = phi i64 [ %100, %.lr.ph50 ], [ %40, %._crit_edge ]
  %77 = sub nsw i64 %76, %.02948
  %78 = tail call noundef i64 @_Z3nCrxx(i64 noundef %76, i64 noundef %77)
  %79 = load i64, ptr @N, align 8, !tbaa !8
  %80 = tail call noundef i64 @_Z3nCrxx(i64 noundef %79, i64 noundef %.02948)
  %81 = mul nsw i64 %80, %78
  %82 = load i64, ptr @MOD, align 8, !tbaa !8
  %83 = srem i64 %81, %82
  %84 = load i64, ptr @N, align 8, !tbaa !8
  %85 = shl nsw i64 %84, 1
  %86 = sub nsw i64 %85, %.02948
  %87 = tail call noundef i64 @_Z3nCrxx(i64 noundef %86, i64 noundef %84)
  %88 = mul nsw i64 %87, %83
  %89 = load i64, ptr @MOD, align 8, !tbaa !8
  %90 = srem i64 %88, %89
  %91 = load i64, ptr @N, align 8, !tbaa !8
  %92 = getelementptr inbounds [3000001 x i64], ptr @f, i64 0, i64 %91
  %93 = load i64, ptr %92, align 8, !tbaa !8
  %94 = mul nsw i64 %93, %90
  %95 = srem i64 %94, %89
  %96 = mul nsw i64 %95, %93
  %97 = srem i64 %96, %89
  %98 = mul nsw i64 %97, %93
  %99 = srem i64 %98, %89
  %100 = sub nsw i64 %.03047, %99
  %101 = add nuw nsw i64 %.02948, 1
  %.not34.not = icmp slt i64 %.02948, %91
  br i1 %.not34.not, label %.lr.ph50, label %._crit_edge51, !llvm.loop !14
}

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

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #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 = { 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 #2 = { "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 = { 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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}


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