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

@MOD = external dso_local global i64, align 8
@N = external dso_local global i64, align 8
@K = external dso_local global i64, align 8
@f = external dso_local global [300 x i64], align 16
@first = external dso_local global [300 x i64], align 16
@dp = external dso_local global [260 x [260 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 @_Z2bpxx(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 nounwind uwtable
declare dso_local noundef i64 @_Z3invx(i64 noundef) #0

; 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() #2 {
  %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 i32, align 4
  %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) @K)
  %17 = load i64, ptr @N, align 8, !tbaa !8
  %18 = add nsw i64 %17, -1
  store i64 %18, ptr @N, align 8, !tbaa !8
  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 %19

19:                                               ; preds = %34, %0
  %20 = load i64, ptr %2, align 8, !tbaa !8
  %21 = icmp slt i64 %20, 300
  br i1 %21, label %23, label %22

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

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

34:                                               ; preds = %23
  %35 = load i64, ptr %2, align 8, !tbaa !8
  %36 = add nsw i64 %35, 1
  store i64 %36, ptr %2, align 8, !tbaa !8
  br label %19, !llvm.loop !11

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

38:                                               ; preds = %49, %37
  %39 = load i64, ptr %3, align 8, !tbaa !8
  %40 = icmp slt i64 %39, 300
  br i1 %40, label %42, label %41

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

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

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

52:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  store i64 1, ptr %4, align 8, !tbaa !8
  br label %53

53:                                               ; preds = %67, %52
  %54 = load i64, ptr %4, align 8, !tbaa !8
  %55 = load i64, ptr @K, align 8, !tbaa !8
  %56 = icmp sle i64 %54, %55
  br i1 %56, label %58, label %57

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

58:                                               ; preds = %53
  %59 = load i64, ptr %4, align 8, !tbaa !8
  %60 = sub nsw i64 %59, 1
  %61 = getelementptr inbounds [260 x i64], ptr @dp, i64 0, i64 %60
  %62 = load i64, ptr %61, align 8, !tbaa !8
  %63 = load i64, ptr @N, align 8, !tbaa !8
  %64 = add nsw i64 %62, %63
  %65 = load i64, ptr %4, align 8, !tbaa !8
  %66 = getelementptr inbounds [260 x i64], ptr @dp, i64 0, i64 %65
  store i64 %64, ptr %66, align 8, !tbaa !8
  br label %67

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

70:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  store i64 1, ptr %5, align 8, !tbaa !8
  br label %71

71:                                               ; preds = %182, %70
  %72 = load i64, ptr %5, align 8, !tbaa !8
  %73 = load i64, ptr @N, align 8, !tbaa !8
  %74 = icmp slt i64 %72, %73
  br i1 %74, label %76, label %75

75:                                               ; preds = %71
  store i32 11, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  br label %185

76:                                               ; preds = %71
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  store i64 1, ptr %7, align 8, !tbaa !8
  br label %77

77:                                               ; preds = %178, %76
  %78 = load i64, ptr %7, align 8, !tbaa !8
  %79 = load i64, ptr @K, align 8, !tbaa !8
  %80 = icmp sle i64 %78, %79
  br i1 %80, label %82, label %81

81:                                               ; preds = %77
  store i32 14, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  br label %181

82:                                               ; preds = %77
  %83 = load i64, ptr @K, align 8, !tbaa !8
  %84 = load i64, ptr %7, align 8, !tbaa !8
  %85 = sub nsw i64 %83, %84
  %86 = add nsw i64 %85, 1
  %87 = load i64, ptr %5, align 8, !tbaa !8
  %88 = add nsw i64 %87, 1
  %89 = call noundef i64 @_Z3nCrxx(i64 noundef %88, i64 noundef 2)
  %90 = call noundef i64 @_Z2bpxx(i64 noundef %86, i64 noundef %89)
  %91 = load i64, ptr @N, align 8, !tbaa !8
  %92 = load i64, ptr %5, align 8, !tbaa !8
  %93 = add nsw i64 %92, 1
  %94 = call noundef i64 @_Z3nCrxx(i64 noundef %91, i64 noundef %93)
  %95 = mul nsw i64 %90, %94
  %96 = load i64, ptr @MOD, align 8, !tbaa !8
  %97 = srem i64 %95, %96
  %98 = load i64, ptr %5, align 8, !tbaa !8
  %99 = getelementptr inbounds [260 x [260 x i64]], ptr @dp, i64 0, i64 %98
  %100 = load i64, ptr %7, align 8, !tbaa !8
  %101 = getelementptr inbounds [260 x i64], ptr %99, i64 0, i64 %100
  store i64 %97, ptr %101, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  store i64 0, ptr %8, align 8, !tbaa !8
  br label %102

102:                                              ; preds = %156, %82
  %103 = load i64, ptr %8, align 8, !tbaa !8
  %104 = load i64, ptr %5, align 8, !tbaa !8
  %105 = icmp slt i64 %103, %104
  br i1 %105, label %107, label %106

106:                                              ; preds = %102
  store i32 17, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  br label %159

107:                                              ; preds = %102
  %108 = load i64, ptr %5, align 8, !tbaa !8
  %109 = getelementptr inbounds [260 x [260 x i64]], ptr @dp, i64 0, i64 %108
  %110 = load i64, ptr %7, align 8, !tbaa !8
  %111 = getelementptr inbounds [260 x i64], ptr %109, i64 0, i64 %110
  %112 = load i64, ptr %111, align 8, !tbaa !8
  %113 = load i64, ptr @N, align 8, !tbaa !8
  %114 = sub nsw i64 %113, 1
  %115 = load i64, ptr %8, align 8, !tbaa !8
  %116 = sub nsw i64 %114, %115
  %117 = load i64, ptr %5, align 8, !tbaa !8
  %118 = load i64, ptr %8, align 8, !tbaa !8
  %119 = sub nsw i64 %117, %118
  %120 = call noundef i64 @_Z3nCrxx(i64 noundef %116, i64 noundef %119)
  %121 = load i64, ptr @K, align 8, !tbaa !8
  %122 = load i64, ptr %7, align 8, !tbaa !8
  %123 = sub nsw i64 %121, %122
  %124 = add nsw i64 %123, 1
  %125 = load i64, ptr %5, align 8, !tbaa !8
  %126 = load i64, ptr %8, align 8, !tbaa !8
  %127 = sub nsw i64 %125, %126
  %128 = call noundef i64 @_Z3nCrxx(i64 noundef %127, i64 noundef 2)
  %129 = load i64, ptr %5, align 8, !tbaa !8
  %130 = load i64, ptr %8, align 8, !tbaa !8
  %131 = sub nsw i64 %129, %130
  %132 = load i64, ptr %8, align 8, !tbaa !8
  %133 = add nsw i64 %132, 1
  %134 = mul nsw i64 %131, %133
  %135 = load i64, ptr @MOD, align 8, !tbaa !8
  %136 = srem i64 %134, %135
  %137 = add nsw i64 %128, %136
  %138 = call noundef i64 @_Z2bpxx(i64 noundef %124, i64 noundef %137)
  %139 = mul nsw i64 %120, %138
  %140 = load i64, ptr @MOD, align 8, !tbaa !8
  %141 = srem i64 %139, %140
  %142 = load i64, ptr %8, align 8, !tbaa !8
  %143 = getelementptr inbounds [260 x [260 x i64]], ptr @dp, i64 0, i64 %142
  %144 = load i64, ptr %7, align 8, !tbaa !8
  %145 = sub nsw i64 %144, 1
  %146 = getelementptr inbounds [260 x i64], ptr %143, i64 0, i64 %145
  %147 = load i64, ptr %146, align 8, !tbaa !8
  %148 = mul nsw i64 %141, %147
  %149 = add nsw i64 %112, %148
  %150 = load i64, ptr @MOD, align 8, !tbaa !8
  %151 = srem i64 %149, %150
  %152 = load i64, ptr %5, align 8, !tbaa !8
  %153 = getelementptr inbounds [260 x [260 x i64]], ptr @dp, i64 0, i64 %152
  %154 = load i64, ptr %7, align 8, !tbaa !8
  %155 = getelementptr inbounds [260 x i64], ptr %153, i64 0, i64 %154
  store i64 %151, ptr %155, align 8, !tbaa !8
  br label %156

156:                                              ; preds = %107
  %157 = load i64, ptr %8, align 8, !tbaa !8
  %158 = add nsw i64 %157, 1
  store i64 %158, ptr %8, align 8, !tbaa !8
  br label %102, !llvm.loop !15

159:                                              ; preds = %106
  %160 = load i64, ptr %5, align 8, !tbaa !8
  %161 = getelementptr inbounds [260 x [260 x i64]], ptr @dp, i64 0, i64 %160
  %162 = load i64, ptr %7, align 8, !tbaa !8
  %163 = sub nsw i64 %162, 1
  %164 = getelementptr inbounds [260 x i64], ptr %161, i64 0, i64 %163
  %165 = load i64, ptr %164, align 8, !tbaa !8
  %166 = load i64, ptr %5, align 8, !tbaa !8
  %167 = getelementptr inbounds [260 x [260 x i64]], ptr @dp, i64 0, i64 %166
  %168 = load i64, ptr %7, align 8, !tbaa !8
  %169 = getelementptr inbounds [260 x i64], ptr %167, i64 0, i64 %168
  %170 = load i64, ptr %169, align 8, !tbaa !8
  %171 = add nsw i64 %165, %170
  %172 = load i64, ptr @MOD, align 8, !tbaa !8
  %173 = srem i64 %171, %172
  %174 = load i64, ptr %5, align 8, !tbaa !8
  %175 = getelementptr inbounds [260 x [260 x i64]], ptr @dp, i64 0, i64 %174
  %176 = load i64, ptr %7, align 8, !tbaa !8
  %177 = getelementptr inbounds [260 x i64], ptr %175, i64 0, i64 %176
  store i64 %173, ptr %177, align 8, !tbaa !8
  br label %178

178:                                              ; preds = %159
  %179 = load i64, ptr %7, align 8, !tbaa !8
  %180 = add nsw i64 %179, 1
  store i64 %180, ptr %7, align 8, !tbaa !8
  br label %77, !llvm.loop !16

181:                                              ; preds = %81
  br label %182

182:                                              ; preds = %181
  %183 = load i64, ptr %5, align 8, !tbaa !8
  %184 = add nsw i64 %183, 1
  store i64 %184, ptr %5, align 8, !tbaa !8
  br label %71, !llvm.loop !17

185:                                              ; preds = %75
  %186 = load i64, ptr @N, align 8, !tbaa !8
  %187 = sub nsw i64 %186, 1
  %188 = getelementptr inbounds [260 x [260 x i64]], ptr @dp, i64 0, i64 %187
  %189 = load i64, ptr @K, align 8, !tbaa !8
  %190 = getelementptr inbounds [260 x i64], ptr %188, i64 0, i64 %189
  %191 = load i64, ptr %190, align 8, !tbaa !8
  %192 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %191)
  %193 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %192, i8 noundef signext 10)
  %194 = load i32, ptr %1, align 4
  ret i32 %194
}

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

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #4 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 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 = { 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}
!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_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
@N = external dso_local global i64, align 8
@K = external dso_local global i64, align 8
@f = external dso_local local_unnamed_addr global [300 x i64], align 16
@first = external dso_local local_unnamed_addr global [300 x i64], align 16
@dp = external dso_local local_unnamed_addr global [260 x [260 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 @_Z2bpxx(i64 noundef, i64 noundef) local_unnamed_addr #0

; 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: 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) @K)
  %9 = load i64, ptr @N, align 8, !tbaa !8
  %10 = add nsw i64 %9, -1
  store i64 %10, ptr @N, align 8, !tbaa !8
  store i64 1, ptr @f, align 16, !tbaa !8
  %11 = load i64, ptr @MOD, align 8, !tbaa !8
  br label %12

12:                                               ; preds = %18, %0
  %13 = phi i64 [ 1, %0 ], [ %20, %18 ]
  %.05158 = phi i64 [ 1, %0 ], [ %22, %18 ]
  %14 = mul nsw i64 %13, %.05158
  %15 = srem i64 %14, %11
  %16 = getelementptr inbounds [300 x i64], ptr @f, i64 0, i64 %.05158
  store i64 %15, ptr %16, align 8, !tbaa !8
  %17 = add nuw nsw i64 %.05158, 1
  %exitcond.not = icmp eq i64 %17, 300
  br i1 %exitcond.not, label %.preheader57, label %18, !llvm.loop !11

18:                                               ; preds = %12
  %19 = mul nsw i64 %15, %17
  %20 = srem i64 %19, %11
  %21 = getelementptr inbounds [300 x i64], ptr @f, i64 0, i64 %17
  store i64 %20, ptr %21, align 8, !tbaa !8
  %22 = add nuw nsw i64 %.05158, 2
  br label %12

.preheader56:                                     ; preds = %.preheader57
  %23 = load i64, ptr @K, align 8, !tbaa !8
  %.not60 = icmp slt i64 %23, 1
  %.pre76 = load i64, ptr @N, align 8, !tbaa !8
  br i1 %.not60, label %._crit_edge69, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader56
  %.pre = load i64, ptr @dp, align 16, !tbaa !8
  %min.iters.check = icmp ult i64 %23, 4
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

scalar.ph.preheader:                              ; preds = %middle.block, %.lr.ph
  %.ph = phi i64 [ %.pre, %.lr.ph ], [ %ind.end, %middle.block ]
  %.04961.ph = phi i64 [ 1, %.lr.ph ], [ %ind.end89, %middle.block ]
  br label %scalar.ph

vector.ph:                                        ; preds = %.lr.ph
  %n.vec = and i64 %23, 9223372036854775804
  %24 = mul i64 %n.vec, %.pre76
  %ind.end = add i64 %.pre, %24
  %ind.end89 = or disjoint i64 %n.vec, 1
  %.splatinsert = insertelement <2 x i64> poison, i64 %.pre, i64 0
  %.splat = shufflevector <2 x i64> %.splatinsert, <2 x i64> poison, <2 x i32> zeroinitializer
  %.splatinsert91 = insertelement <2 x i64> poison, i64 %.pre76, i64 0
  %.splat92 = shufflevector <2 x i64> %.splatinsert91, <2 x i64> poison, <2 x i32> zeroinitializer
  %25 = mul nuw <2 x i64> %.splat92, <i64 0, i64 1>
  %induction = add <2 x i64> %.splat, %25
  %26 = shl i64 %.pre76, 1
  %.splatinsert93 = insertelement <2 x i64> poison, i64 %26, i64 0
  %.splat94 = shufflevector <2 x i64> %.splatinsert93, <2 x i64> poison, <2 x i32> zeroinitializer
  %broadcast.splatinsert = insertelement <2 x i64> poison, i64 %.pre76, i64 0
  %broadcast.splat = shufflevector <2 x i64> %broadcast.splatinsert, <2 x i64> poison, <2 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.ind = phi <2 x i64> [ %induction, %vector.ph ], [ %vec.ind.next, %vector.body ]
  %step.add = add <2 x i64> %vec.ind, %.splat94
  %offset.idx = or disjoint i64 %index, 1
  %27 = add nsw <2 x i64> %broadcast.splat, %vec.ind
  %28 = add nsw <2 x i64> %broadcast.splat, %step.add
  %29 = getelementptr inbounds [260 x i64], ptr @dp, i64 0, i64 %offset.idx
  %30 = getelementptr inbounds i8, ptr %29, i64 16
  store <2 x i64> %27, ptr %29, align 8, !tbaa !8
  store <2 x i64> %28, ptr %30, align 8, !tbaa !8
  %index.next = add nuw i64 %index, 4
  %vec.ind.next = add <2 x i64> %step.add, %.splat94
  %31 = icmp eq i64 %index.next, %n.vec
  br i1 %31, label %middle.block, label %vector.body, !llvm.loop !13

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %23, %n.vec
  br i1 %cmp.n, label %.preheader55, label %scalar.ph.preheader

.preheader57:                                     ; preds = %12, %.preheader57
  %.05059 = phi i64 [ %36, %.preheader57 ], [ 0, %12 ]
  %32 = getelementptr inbounds [300 x i64], ptr @f, i64 0, i64 %.05059
  %33 = load i64, ptr %32, align 8, !tbaa !8
  %34 = tail call noundef i64 @_Z3invx(i64 noundef %33)
  %35 = getelementptr inbounds [300 x i64], ptr @first, i64 0, i64 %.05059
  store i64 %34, ptr %35, align 8, !tbaa !8
  %36 = add nuw nsw i64 %.05059, 1
  %exitcond73.not = icmp eq i64 %36, 300
  br i1 %exitcond73.not, label %.preheader56, label %.preheader57, !llvm.loop !16

.preheader55:                                     ; preds = %scalar.ph, %middle.block
  %37 = icmp slt i64 %.pre76, 2
  %brmerge = or i1 %37, %.not60
  br i1 %brmerge, label %._crit_edge69, label %.preheader

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %38 = phi i64 [ %39, %scalar.ph ], [ %.ph, %scalar.ph.preheader ]
  %.04961 = phi i64 [ %41, %scalar.ph ], [ %.04961.ph, %scalar.ph.preheader ]
  %39 = add nsw i64 %.pre76, %38
  %40 = getelementptr inbounds [260 x i64], ptr @dp, i64 0, i64 %.04961
  store i64 %39, ptr %40, align 8, !tbaa !8
  %41 = add nuw i64 %.04961, 1
  %exitcond74.not = icmp eq i64 %.04961, %23
  br i1 %exitcond74.not, label %.preheader55, label %scalar.ph, !llvm.loop !17

.preheader:                                       ; preds = %.preheader55, %._crit_edge
  %42 = phi i64 [ %50, %._crit_edge ], [ %.pre76, %.preheader55 ]
  %43 = phi i64 [ %51, %._crit_edge ], [ %23, %.preheader55 ]
  %.04868 = phi i64 [ %.pre78, %._crit_edge ], [ 1, %.preheader55 ]
  %.not5464 = icmp slt i64 %43, 1
  %.pre78 = add nuw nsw i64 %.04868, 1
  br i1 %.not5464, label %._crit_edge, label %.lr.ph67

._crit_edge69:                                    ; preds = %._crit_edge, %.preheader55, %.preheader56
  %44 = phi i64 [ %23, %.preheader55 ], [ %23, %.preheader56 ], [ %51, %._crit_edge ]
  %.lcssa = phi i64 [ %.pre76, %.preheader55 ], [ %.pre76, %.preheader56 ], [ %50, %._crit_edge ]
  %45 = add nsw i64 %.lcssa, -1
  %46 = getelementptr inbounds [260 x [260 x i64]], ptr @dp, i64 0, i64 %45, i64 %44
  %47 = load i64, ptr %46, align 8, !tbaa !8
  %48 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %47)
  %49 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %48, i8 noundef signext 10)
  ret i32 0

._crit_edge.loopexit:                             ; preds = %65
  %.pre77 = load i64, ptr @N, align 8, !tbaa !8
  br label %._crit_edge

._crit_edge:                                      ; preds = %.preheader, %._crit_edge.loopexit
  %50 = phi i64 [ %.pre77, %._crit_edge.loopexit ], [ %42, %.preheader ]
  %51 = phi i64 [ %71, %._crit_edge.loopexit ], [ %43, %.preheader ]
  %52 = icmp slt i64 %.pre78, %50
  br i1 %52, label %.preheader, label %._crit_edge69, !llvm.loop !18

.lr.ph67:                                         ; preds = %.preheader, %65
  %53 = phi i64 [ %71, %65 ], [ %43, %.preheader ]
  %.047.neg66 = phi i64 [ %.047.neg, %65 ], [ -1, %.preheader ]
  %.04765 = phi i64 [ %70, %65 ], [ 1, %.preheader ]
  %54 = add nsw i64 %.047.neg66, 1
  %55 = add i64 %54, %53
  %56 = tail call noundef i64 @_Z3nCrxx(i64 noundef %.pre78, i64 noundef 2)
  %57 = tail call noundef i64 @_Z2bpxx(i64 noundef %55, i64 noundef %56)
  %58 = load i64, ptr @N, align 8, !tbaa !8
  %59 = tail call noundef i64 @_Z3nCrxx(i64 noundef %58, i64 noundef %.pre78)
  %60 = mul nsw i64 %59, %57
  %61 = load i64, ptr @MOD, align 8, !tbaa !8
  %62 = srem i64 %60, %61
  %63 = getelementptr inbounds [260 x [260 x i64]], ptr @dp, i64 0, i64 %.04868, i64 %.04765
  store i64 %62, ptr %63, align 8, !tbaa !8
  %64 = add nsw i64 %.04765, -1
  br label %72

65:                                               ; preds = %72
  %66 = getelementptr inbounds [260 x [260 x i64]], ptr @dp, i64 0, i64 %.04868, i64 %64
  %67 = load i64, ptr %66, align 8, !tbaa !8
  %68 = add nsw i64 %67, %94
  %69 = srem i64 %68, %88
  store i64 %69, ptr %63, align 8, !tbaa !8
  %70 = add nuw nsw i64 %.04765, 1
  %.047.neg = xor i64 %.04765, -1
  %71 = load i64, ptr @K, align 8, !tbaa !8
  %.not54.not = icmp slt i64 %.04765, %71
  br i1 %.not54.not, label %.lr.ph67, label %._crit_edge.loopexit, !llvm.loop !20

72:                                               ; preds = %.lr.ph67, %72
  %.063 = phi i64 [ 0, %.lr.ph67 ], [ %81, %72 ]
  %storemerge62 = phi i64 [ %62, %.lr.ph67 ], [ %94, %72 ]
  %73 = load i64, ptr @N, align 8, !tbaa !8
  %74 = xor i64 %.063, -1
  %75 = add i64 %73, %74
  %76 = sub nsw i64 %.04868, %.063
  %77 = tail call noundef i64 @_Z3nCrxx(i64 noundef %75, i64 noundef %76)
  %78 = load i64, ptr @K, align 8, !tbaa !8
  %79 = add i64 %54, %78
  %80 = tail call noundef i64 @_Z3nCrxx(i64 noundef %76, i64 noundef 2)
  %81 = add nuw nsw i64 %.063, 1
  %82 = mul nsw i64 %76, %81
  %83 = load i64, ptr @MOD, align 8, !tbaa !8
  %84 = srem i64 %82, %83
  %85 = add nsw i64 %84, %80
  %86 = tail call noundef i64 @_Z2bpxx(i64 noundef %79, i64 noundef %85)
  %87 = mul nsw i64 %86, %77
  %88 = load i64, ptr @MOD, align 8, !tbaa !8
  %89 = srem i64 %87, %88
  %90 = getelementptr inbounds [260 x [260 x i64]], ptr @dp, i64 0, i64 %.063, i64 %64
  %91 = load i64, ptr %90, align 8, !tbaa !8
  %92 = mul nsw i64 %91, %89
  %93 = add nsw i64 %92, %storemerge62
  %94 = srem i64 %93, %88
  store i64 %94, ptr %63, align 8, !tbaa !8
  %exitcond75.not = icmp eq i64 %81, %.04868
  br i1 %exitcond75.not, label %65, label %72, !llvm.loop !21
}

; 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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"long long", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12, !14, !15}
!14 = !{!"llvm.loop.isvectorized", i32 1}
!15 = !{!"llvm.loop.unroll.runtime.disable"}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12, !15, !14}
!18 = distinct !{!18, !12, !19}
!19 = !{!"llvm.loop.unswitch.partial.disable"}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !12}


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