; LLVM IR from Tunghohin/Competitive_Coding :: Codeforces/cf103107_gym_D.ll (Z5solvev)

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

@a = external dso_local global [1010 x i64], align 16
@prefix_mul = external dso_local global [1010 x i64], align 16
@inv = external dso_local global [1010 x i64], align 16
@dp = external dso_local global [1010 x [1010 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 @_Z5q_powxxx(i64 noundef, i64 noundef, i64 noundef) #0

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() #2 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i32, align 4
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #5
  %10 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %1)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #5
  store i64 1, ptr %2, align 8, !tbaa !5
  br label %11

11:                                               ; preds = %20, %0
  %12 = load i64, ptr %2, align 8, !tbaa !5
  %13 = load i64, ptr %1, align 8, !tbaa !5
  %14 = icmp sle i64 %12, %13
  br i1 %14, label %16, label %15

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

16:                                               ; preds = %11
  %17 = load i64, ptr %2, align 8, !tbaa !5
  %18 = getelementptr inbounds [1010 x i64], ptr @a, i64 0, i64 %17
  %19 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %18)
  br label %20

20:                                               ; preds = %16
  %21 = load i64, ptr %2, align 8, !tbaa !5
  %22 = add nsw i64 %21, 1
  store i64 %22, ptr %2, align 8, !tbaa !5
  br label %11, !llvm.loop !9

23:                                               ; preds = %15
  store i64 1, ptr @inv, align 16, !tbaa !5
  store i64 1, ptr @prefix_mul, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  store i64 1, ptr %3, align 8, !tbaa !5
  br label %24

24:                                               ; preds = %47, %23
  %25 = load i64, ptr %3, align 8, !tbaa !5
  %26 = load i64, ptr %1, align 8, !tbaa !5
  %27 = icmp sle i64 %25, %26
  br i1 %27, label %29, label %28

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

29:                                               ; preds = %24
  %30 = load i64, ptr %3, align 8, !tbaa !5
  %31 = sub nsw i64 %30, 1
  %32 = getelementptr inbounds [1010 x i64], ptr @prefix_mul, i64 0, i64 %31
  %33 = load i64, ptr %32, align 8, !tbaa !5
  %34 = load i64, ptr %3, align 8, !tbaa !5
  %35 = getelementptr inbounds [1010 x i64], ptr @a, i64 0, i64 %34
  %36 = load i64, ptr %35, align 8, !tbaa !5
  %37 = mul nsw i64 %33, %36
  %38 = srem i64 %37, 1000003
  %39 = load i64, ptr %3, align 8, !tbaa !5
  %40 = getelementptr inbounds [1010 x i64], ptr @prefix_mul, i64 0, i64 %39
  store i64 %38, ptr %40, align 8, !tbaa !5
  %41 = load i64, ptr %3, align 8, !tbaa !5
  %42 = getelementptr inbounds [1010 x i64], ptr @prefix_mul, i64 0, i64 %41
  %43 = load i64, ptr %42, align 8, !tbaa !5
  %44 = call noundef i64 @_Z5q_powxxx(i64 noundef %43, i64 noundef 1000001, i64 noundef 1000003)
  %45 = load i64, ptr %3, align 8, !tbaa !5
  %46 = getelementptr inbounds [1010 x i64], ptr @inv, i64 0, i64 %45
  store i64 %44, ptr %46, align 8, !tbaa !5
  br label %47

47:                                               ; preds = %29
  %48 = load i64, ptr %3, align 8, !tbaa !5
  %49 = add nsw i64 %48, 1
  store i64 %49, ptr %3, align 8, !tbaa !5
  br label %24, !llvm.loop !11

50:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  store i64 2, ptr %4, align 8, !tbaa !5
  br label %51

51:                                               ; preds = %145, %50
  %52 = load i64, ptr %4, align 8, !tbaa !5
  %53 = load i64, ptr %1, align 8, !tbaa !5
  %54 = icmp sle i64 %52, %53
  br i1 %54, label %56, label %55

55:                                               ; preds = %51
  store i32 8, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  br label %148

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

57:                                               ; preds = %141, %56
  %58 = load i64, ptr %6, align 8, !tbaa !5
  %59 = load i64, ptr %4, align 8, !tbaa !5
  %60 = add nsw i64 %58, %59
  %61 = load i64, ptr %1, align 8, !tbaa !5
  %62 = add nsw i64 %61, 1
  %63 = icmp sle i64 %60, %62
  br i1 %63, label %65, label %64

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

65:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %66 = load i64, ptr %6, align 8, !tbaa !5
  %67 = load i64, ptr %4, align 8, !tbaa !5
  %68 = add nsw i64 %66, %67
  %69 = sub nsw i64 %68, 1
  store i64 %69, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %70 = load i64, ptr %6, align 8, !tbaa !5
  store i64 %70, ptr %8, align 8, !tbaa !5
  br label %71

71:                                               ; preds = %137, %65
  %72 = load i64, ptr %8, align 8, !tbaa !5
  %73 = load i64, ptr %7, align 8, !tbaa !5
  %74 = icmp slt i64 %72, %73
  br i1 %74, label %76, label %75

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

76:                                               ; preds = %71
  %77 = load i64, ptr %6, align 8, !tbaa !5
  %78 = getelementptr inbounds [1010 x [1010 x i64]], ptr @dp, i64 0, i64 %77
  %79 = load i64, ptr %7, align 8, !tbaa !5
  %80 = getelementptr inbounds [1010 x i64], ptr %78, i64 0, i64 %79
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %81 = load i64, ptr %6, align 8, !tbaa !5
  %82 = getelementptr inbounds [1010 x [1010 x i64]], ptr @dp, i64 0, i64 %81
  %83 = load i64, ptr %8, align 8, !tbaa !5
  %84 = getelementptr inbounds [1010 x i64], ptr %82, i64 0, i64 %83
  %85 = load i64, ptr %84, align 8, !tbaa !5
  %86 = load i64, ptr %8, align 8, !tbaa !5
  %87 = add nsw i64 %86, 1
  %88 = getelementptr inbounds [1010 x [1010 x i64]], ptr @dp, i64 0, i64 %87
  %89 = load i64, ptr %7, align 8, !tbaa !5
  %90 = getelementptr inbounds [1010 x i64], ptr %88, i64 0, i64 %89
  %91 = load i64, ptr %90, align 8, !tbaa !5
  %92 = add nsw i64 %85, %91
  %93 = load i64, ptr %7, align 8, !tbaa !5
  %94 = getelementptr inbounds [1010 x i64], ptr @prefix_mul, i64 0, i64 %93
  %95 = load i64, ptr %94, align 8, !tbaa !5
  %96 = load i64, ptr %8, align 8, !tbaa !5
  %97 = getelementptr inbounds [1010 x i64], ptr @inv, i64 0, i64 %96
  %98 = load i64, ptr %97, align 8, !tbaa !5
  %99 = mul nsw i64 %95, %98
  %100 = srem i64 %99, 1000003
  %101 = load i64, ptr %8, align 8, !tbaa !5
  %102 = getelementptr inbounds [1010 x i64], ptr @prefix_mul, i64 0, i64 %101
  %103 = load i64, ptr %102, align 8, !tbaa !5
  %104 = load i64, ptr %6, align 8, !tbaa !5
  %105 = sub nsw i64 %104, 1
  %106 = getelementptr inbounds [1010 x i64], ptr @inv, i64 0, i64 %105
  %107 = load i64, ptr %106, align 8, !tbaa !5
  %108 = mul nsw i64 %103, %107
  %109 = srem i64 %108, 1000003
  %110 = sub nsw i64 %100, %109
  %111 = load i64, ptr %7, align 8, !tbaa !5
  %112 = getelementptr inbounds [1010 x i64], ptr @prefix_mul, i64 0, i64 %111
  %113 = load i64, ptr %112, align 8, !tbaa !5
  %114 = load i64, ptr %8, align 8, !tbaa !5
  %115 = getelementptr inbounds [1010 x i64], ptr @inv, i64 0, i64 %114
  %116 = load i64, ptr %115, align 8, !tbaa !5
  %117 = mul nsw i64 %113, %116
  %118 = srem i64 %117, 1000003
  %119 = load i64, ptr %8, align 8, !tbaa !5
  %120 = getelementptr inbounds [1010 x i64], ptr @prefix_mul, i64 0, i64 %119
  %121 = load i64, ptr %120, align 8, !tbaa !5
  %122 = load i64, ptr %6, align 8, !tbaa !5
  %123 = sub nsw i64 %122, 1
  %124 = getelementptr inbounds [1010 x i64], ptr @inv, i64 0, i64 %123
  %125 = load i64, ptr %124, align 8, !tbaa !5
  %126 = mul nsw i64 %121, %125
  %127 = srem i64 %126, 1000003
  %128 = sub nsw i64 %118, %127
  %129 = mul nsw i64 %110, %128
  %130 = add nsw i64 %92, %129
  store i64 %130, ptr %9, align 8, !tbaa !5
  %131 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %80, ptr noundef nonnull align 8 dereferenceable(8) %9)
  %132 = load i64, ptr %131, align 8, !tbaa !5
  %133 = load i64, ptr %6, align 8, !tbaa !5
  %134 = getelementptr inbounds [1010 x [1010 x i64]], ptr @dp, i64 0, i64 %133
  %135 = load i64, ptr %7, align 8, !tbaa !5
  %136 = getelementptr inbounds [1010 x i64], ptr %134, i64 0, i64 %135
  store i64 %132, ptr %136, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  br label %137

137:                                              ; preds = %76
  %138 = load i64, ptr %8, align 8, !tbaa !5
  %139 = add nsw i64 %138, 1
  store i64 %139, ptr %8, align 8, !tbaa !5
  br label %71, !llvm.loop !12

140:                                              ; preds = %75
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  br label %141

141:                                              ; preds = %140
  %142 = load i64, ptr %6, align 8, !tbaa !5
  %143 = add nsw i64 %142, 1
  store i64 %143, ptr %6, align 8, !tbaa !5
  br label %57, !llvm.loop !13

144:                                              ; preds = %64
  br label %145

145:                                              ; preds = %144
  %146 = load i64, ptr %4, align 8, !tbaa !5
  %147 = add nsw i64 %146, 1
  store i64 %147, ptr %4, align 8, !tbaa !5
  br label %51, !llvm.loop !14

148:                                              ; preds = %55
  %149 = load i64, ptr %1, align 8, !tbaa !5
  %150 = getelementptr inbounds [1010 x i64], ptr getelementptr inbounds ([1010 x [1010 x i64]], ptr @dp, i64 0, i64 1), i64 0, i64 %149
  %151 = load i64, ptr %150, align 8, !tbaa !5
  %152 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %151)
  %153 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %152, i8 noundef signext 10)
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #5
  ret void
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #3

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) #4

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

attributes #0 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { inlinehint 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 #4 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}


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

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

@a = external dso_local global [1010 x i64], align 16
@prefix_mul = external dso_local local_unnamed_addr global [1010 x i64], align 16
@inv = external dso_local local_unnamed_addr global [1010 x i64], align 16
@dp = external dso_local global [1010 x [1010 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 @_Z5q_powxxx(i64 noundef, i64 noundef, i64 noundef) 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 uwtable
define dso_local void @_Z5solvev() local_unnamed_addr #2 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #5
  %3 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %4 = load i64, ptr %1, align 8, !tbaa !5
  %.not48 = icmp slt i64 %4, 1
  br i1 %.not48, label %._crit_edge.thread, label %.lr.ph

._crit_edge.thread:                               ; preds = %0
  store i64 1, ptr @inv, align 16, !tbaa !5
  store i64 1, ptr @prefix_mul, align 16, !tbaa !5
  br label %._crit_edge64

._crit_edge:                                      ; preds = %.lr.ph
  store i64 1, ptr @inv, align 16, !tbaa !5
  store i64 1, ptr @prefix_mul, align 16, !tbaa !5
  %.not4450 = icmp slt i64 %8, 1
  br i1 %.not4450, label %._crit_edge64, label %.lr.ph53

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.03749 = phi i64 [ %7, %.lr.ph ], [ 1, %0 ]
  %5 = getelementptr inbounds [1010 x i64], ptr @a, i64 0, i64 %.03749
  %6 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %5)
  %7 = add nuw nsw i64 %.03749, 1
  %8 = load i64, ptr %1, align 8, !tbaa !5
  %.not.not = icmp slt i64 %.03749, %8
  br i1 %.not.not, label %.lr.ph, label %._crit_edge, !llvm.loop !9

.preheader47:                                     ; preds = %.lr.ph53
  %.not4562 = icmp slt i64 %20, 2
  br i1 %.not4562, label %._crit_edge64, label %.preheader

.lr.ph53:                                         ; preds = %._crit_edge, %.lr.ph53
  %.04051 = phi i64 [ %19, %.lr.ph53 ], [ 1, %._crit_edge ]
  %9 = add nsw i64 %.04051, -1
  %10 = getelementptr inbounds [1010 x i64], ptr @prefix_mul, i64 0, i64 %9
  %11 = load i64, ptr %10, align 8, !tbaa !5
  %12 = getelementptr inbounds [1010 x i64], ptr @a, i64 0, i64 %.04051
  %13 = load i64, ptr %12, align 8, !tbaa !5
  %14 = mul nsw i64 %13, %11
  %15 = srem i64 %14, 1000003
  %16 = getelementptr inbounds [1010 x i64], ptr @prefix_mul, i64 0, i64 %.04051
  store i64 %15, ptr %16, align 8, !tbaa !5
  %17 = call noundef i64 @_Z5q_powxxx(i64 noundef %15, i64 noundef 1000001, i64 noundef 1000003)
  %18 = getelementptr inbounds [1010 x i64], ptr @inv, i64 0, i64 %.04051
  store i64 %17, ptr %18, align 8, !tbaa !5
  %19 = add nuw nsw i64 %.04051, 1
  %20 = load i64, ptr %1, align 8, !tbaa !5
  %.not44.not = icmp slt i64 %.04051, %20
  br i1 %.not44.not, label %.lr.ph53, label %.preheader47, !llvm.loop !11

.preheader:                                       ; preds = %.preheader47, %._crit_edge61
  %21 = phi i64 [ %27, %._crit_edge61 ], [ %20, %.preheader47 ]
  %.03963 = phi i64 [ %22, %._crit_edge61 ], [ 2, %.preheader47 ]
  %22 = add nuw nsw i64 %.03963, 1
  %.not4658 = icmp sgt i64 %.03963, %21
  br i1 %.not4658, label %._crit_edge61, label %.lr.ph60

._crit_edge64:                                    ; preds = %._crit_edge61, %._crit_edge.thread, %._crit_edge, %.preheader47
  %.lcssa = phi i64 [ %20, %.preheader47 ], [ %4, %._crit_edge.thread ], [ %8, %._crit_edge ], [ %27, %._crit_edge61 ]
  %23 = getelementptr inbounds [1010 x i64], ptr getelementptr inbounds (i8, ptr @dp, i64 8080), i64 0, i64 %.lcssa
  %24 = load i64, ptr %23, align 8, !tbaa !5
  %25 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %24)
  %26 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %25, i8 noundef signext 10)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #5
  ret void

._crit_edge61:                                    ; preds = %._crit_edge57, %.preheader
  %27 = phi i64 [ %21, %.preheader ], [ %37, %._crit_edge57 ]
  %.not45.not = icmp slt i64 %.03963, %27
  br i1 %.not45.not, label %.preheader, label %._crit_edge64, !llvm.loop !12

.lr.ph60:                                         ; preds = %.preheader, %._crit_edge57
  %28 = phi i64 [ %37, %._crit_edge57 ], [ %21, %.preheader ]
  %29 = phi i64 [ %38, %._crit_edge57 ], [ %21, %.preheader ]
  %indvars.iv = phi i64 [ %indvars.iv.next, %._crit_edge57 ], [ %.03963, %.preheader ]
  %30 = phi i64 [ %40, %._crit_edge57 ], [ %22, %.preheader ]
  %.03859 = phi i64 [ %39, %._crit_edge57 ], [ 1, %.preheader ]
  %31 = add nsw i64 %30, -1
  %32 = icmp slt i64 %.03859, %31
  br i1 %32, label %.lr.ph56, label %._crit_edge57

.lr.ph56:                                         ; preds = %.lr.ph60
  %33 = getelementptr inbounds [1010 x [1010 x i64]], ptr @dp, i64 0, i64 %.03859, i64 %31
  %34 = getelementptr inbounds [1010 x i64], ptr @prefix_mul, i64 0, i64 %31
  %35 = add nsw i64 %.03859, -1
  %36 = getelementptr inbounds [1010 x i64], ptr @inv, i64 0, i64 %35
  br label %42

._crit_edge57.loopexit:                           ; preds = %42
  %.pre = load i64, ptr %1, align 8, !tbaa !5
  br label %._crit_edge57

._crit_edge57:                                    ; preds = %._crit_edge57.loopexit, %.lr.ph60
  %37 = phi i64 [ %.pre, %._crit_edge57.loopexit ], [ %28, %.lr.ph60 ]
  %38 = phi i64 [ %.pre, %._crit_edge57.loopexit ], [ %29, %.lr.ph60 ]
  %39 = add nuw nsw i64 %.03859, 1
  %40 = add nuw nsw i64 %39, %.03963
  %41 = add nsw i64 %38, 1
  %.not46 = icmp sgt i64 %40, %41
  %indvars.iv.next = add i64 %indvars.iv, 1
  br i1 %.not46, label %._crit_edge61, label %.lr.ph60, !llvm.loop !13

42:                                               ; preds = %.lr.ph56, %42
  %.054 = phi i64 [ %.03859, %.lr.ph56 ], [ %45, %42 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #5
  %43 = getelementptr inbounds [1010 x [1010 x i64]], ptr @dp, i64 0, i64 %.03859, i64 %.054
  %44 = load i64, ptr %43, align 8, !tbaa !5
  %45 = add nuw nsw i64 %.054, 1
  %46 = getelementptr inbounds [1010 x [1010 x i64]], ptr @dp, i64 0, i64 %45, i64 %31
  %47 = load i64, ptr %46, align 8, !tbaa !5
  %48 = add nsw i64 %47, %44
  %49 = load i64, ptr %34, align 8, !tbaa !5
  %50 = getelementptr inbounds [1010 x i64], ptr @inv, i64 0, i64 %.054
  %51 = load i64, ptr %50, align 8, !tbaa !5
  %52 = mul nsw i64 %51, %49
  %53 = srem i64 %52, 1000003
  %54 = getelementptr inbounds [1010 x i64], ptr @prefix_mul, i64 0, i64 %.054
  %55 = load i64, ptr %54, align 8, !tbaa !5
  %56 = load i64, ptr %36, align 8, !tbaa !5
  %57 = mul nsw i64 %56, %55
  %58 = srem i64 %57, 1000003
  %59 = sub nsw i64 %53, %58
  %60 = mul nsw i64 %59, %59
  %61 = add nsw i64 %48, %60
  store i64 %61, ptr %2, align 8, !tbaa !5
  %62 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %33, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %63 = load i64, ptr %62, align 8, !tbaa !5
  store i64 %63, ptr %33, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #5
  %exitcond.not = icmp eq i64 %45, %indvars.iv
  br i1 %exitcond.not, label %._crit_edge57.loopexit, label %42, !llvm.loop !14
}

; 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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3

; 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 #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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { inlinehint 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 #4 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}


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