; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/198 Division 2/Problem E (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 }

@n = external dso_local global i32, align 4
@p = external dso_local global [5000 x i32], align 16
@u = external dso_local global [5000 x i32], align 16
@v = external dso_local global [5000 x i32], align 16
@MOD = external dso_local global i64, align 8
@f = external dso_local global [5000 x i64], align 16
@dp = external dso_local global [5000 x [5000 x i64]], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

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

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

8:                                                ; preds = %26, %0
  %9 = load i32, ptr %2, align 4, !tbaa !9
  %10 = icmp slt i32 %9, 5000
  br i1 %10, label %12, label %11

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

12:                                               ; preds = %8
  %13 = load i32, ptr %2, align 4, !tbaa !9
  %14 = sub nsw i32 %13, 1
  %15 = sext i32 %14 to i64
  %16 = getelementptr inbounds [5000 x i64], ptr @f, i64 0, i64 %15
  %17 = load i64, ptr %16, align 8, !tbaa !5
  %18 = load i32, ptr %2, align 4, !tbaa !9
  %19 = sext i32 %18 to i64
  %20 = mul nsw i64 %17, %19
  %21 = load i64, ptr @MOD, align 8, !tbaa !5
  %22 = srem i64 %20, %21
  %23 = load i32, ptr %2, align 4, !tbaa !9
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [5000 x i64], ptr @f, i64 0, i64 %24
  store i64 %22, ptr %25, align 8, !tbaa !5
  br label %26

26:                                               ; preds = %12
  %27 = load i32, ptr %2, align 4, !tbaa !9
  %28 = add nsw i32 %27, 1
  store i32 %28, ptr %2, align 4, !tbaa !9
  br label %8, !llvm.loop !11

29:                                               ; preds = %11
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 0, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 0, ptr %4, align 4, !tbaa !9
  %30 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 1, ptr %5, align 4, !tbaa !9
  br label %31

31:                                               ; preds = %60, %29
  %32 = load i32, ptr %5, align 4, !tbaa !9
  %33 = load i32, ptr @n, align 4, !tbaa !9
  %34 = icmp sle i32 %32, %33
  br i1 %34, label %36, label %35

35:                                               ; preds = %31
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %63

36:                                               ; preds = %31
  %37 = load i32, ptr %5, align 4, !tbaa !9
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [5000 x i32], ptr @p, i64 0, i64 %38
  %40 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %39)
  %41 = load i32, ptr %5, align 4, !tbaa !9
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [5000 x i32], ptr @p, i64 0, i64 %42
  %44 = load i32, ptr %43, align 4, !tbaa !9
  %45 = icmp eq i32 %44, -1
  br i1 %45, label %46, label %49

46:                                               ; preds = %36
  %47 = load i32, ptr %3, align 4, !tbaa !9
  %48 = add nsw i32 %47, 1
  store i32 %48, ptr %3, align 4, !tbaa !9
  br label %59

49:                                               ; preds = %36
  %50 = load i32, ptr %5, align 4, !tbaa !9
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [5000 x i32], ptr @p, i64 0, i64 %51
  %53 = load i32, ptr %52, align 4, !tbaa !9
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [5000 x i32], ptr @v, i64 0, i64 %54
  store i32 1, ptr %55, align 4, !tbaa !9
  %56 = load i32, ptr %5, align 4, !tbaa !9
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [5000 x i32], ptr @u, i64 0, i64 %57
  store i32 1, ptr %58, align 4, !tbaa !9
  br label %59

59:                                               ; preds = %49, %46
  br label %60

60:                                               ; preds = %59
  %61 = load i32, ptr %5, align 4, !tbaa !9
  %62 = add nsw i32 %61, 1
  store i32 %62, ptr %5, align 4, !tbaa !9
  br label %31, !llvm.loop !13

63:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 1, ptr %6, align 4, !tbaa !9
  br label %64

64:                                               ; preds = %85, %63
  %65 = load i32, ptr %6, align 4, !tbaa !9
  %66 = load i32, ptr @n, align 4, !tbaa !9
  %67 = icmp sle i32 %65, %66
  br i1 %67, label %69, label %68

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

69:                                               ; preds = %64
  %70 = load i32, ptr %6, align 4, !tbaa !9
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [5000 x i32], ptr @u, i64 0, i64 %71
  %73 = load i32, ptr %72, align 4, !tbaa !9
  %74 = icmp eq i32 %73, 0
  br i1 %74, label %75, label %84

75:                                               ; preds = %69
  %76 = load i32, ptr %6, align 4, !tbaa !9
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [5000 x i32], ptr @v, i64 0, i64 %77
  %79 = load i32, ptr %78, align 4, !tbaa !9
  %80 = icmp eq i32 %79, 0
  br i1 %80, label %81, label %84

81:                                               ; preds = %75
  %82 = load i32, ptr %4, align 4, !tbaa !9
  %83 = add nsw i32 %82, 1
  store i32 %83, ptr %4, align 4, !tbaa !9
  br label %84

84:                                               ; preds = %81, %75, %69
  br label %85

85:                                               ; preds = %84
  %86 = load i32, ptr %6, align 4, !tbaa !9
  %87 = add nsw i32 %86, 1
  store i32 %87, ptr %6, align 4, !tbaa !9
  br label %64, !llvm.loop !14

88:                                               ; preds = %68
  %89 = load i32, ptr %4, align 4, !tbaa !9
  %90 = load i32, ptr %3, align 4, !tbaa !9
  %91 = sub nsw i32 %90, %89
  store i32 %91, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %92

92:                                               ; preds = %120, %88
  %93 = load i32, ptr %7, align 4, !tbaa !9
  %94 = load i32, ptr @n, align 4, !tbaa !9
  %95 = icmp sle i32 %93, %94
  br i1 %95, label %97, label %96

96:                                               ; preds = %92
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %123

97:                                               ; preds = %92
  %98 = load i32, ptr %7, align 4, !tbaa !9
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [5000 x i64], ptr @f, i64 0, i64 %99
  %101 = load i64, ptr %100, align 8, !tbaa !5
  %102 = load i32, ptr %7, align 4, !tbaa !9
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [5000 x [5000 x i64]], ptr @dp, i64 0, i64 %103
  %105 = getelementptr inbounds [5000 x i64], ptr %104, i64 0, i64 0
  store i64 %101, ptr %105, align 16, !tbaa !5
  %106 = load i32, ptr %7, align 4, !tbaa !9
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [5000 x [5000 x i64]], ptr @dp, i64 0, i64 %107
  %109 = getelementptr inbounds [5000 x i64], ptr %108, i64 0, i64 0
  %110 = load i64, ptr %109, align 16, !tbaa !5
  %111 = load i32, ptr %7, align 4, !tbaa !9
  %112 = sext i32 %111 to i64
  %113 = mul nsw i64 %110, %112
  %114 = load i64, ptr @MOD, align 8, !tbaa !5
  %115 = srem i64 %113, %114
  %116 = load i32, ptr %7, align 4, !tbaa !9
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [5000 x [5000 x i64]], ptr @dp, i64 0, i64 %117
  %119 = getelementptr inbounds [5000 x i64], ptr %118, i64 0, i64 1
  store i64 %115, ptr %119, align 8, !tbaa !5
  br label %120

120:                                              ; preds = %97
  %121 = load i32, ptr %7, align 4, !tbaa !9
  %122 = add nsw i32 %121, 1
  store i32 %122, ptr %7, align 4, !tbaa !9
  br label %92, !llvm.loop !15

123:                                              ; preds = %96
  %124 = load i32, ptr %3, align 4, !tbaa !9
  %125 = load i32, ptr %4, align 4, !tbaa !9
  %126 = call noundef i64 @_Z2goii(i32 noundef %124, i32 noundef %125)
  %127 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %126)
  %128 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %127, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  ret i32 0
}

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

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

declare i32 @__isoc99_scanf(ptr noundef, ...) #3

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #4

attributes #0 = { 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 #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !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 }

@n = external dso_local global i32, align 4
@p = external dso_local global [5000 x i32], align 16
@u = external dso_local local_unnamed_addr global [5000 x i32], align 16
@v = external dso_local local_unnamed_addr global [5000 x i32], align 16
@MOD = external dso_local local_unnamed_addr global i64, align 8
@f = external dso_local local_unnamed_addr global [5000 x i64], align 16
@dp = external dso_local local_unnamed_addr global [5000 x [5000 x i64]], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  store i64 1, ptr @f, align 16, !tbaa !5
  %1 = load i64, ptr @MOD, align 8, !tbaa !5
  br label %5

2:                                                ; preds = %5
  %3 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %4 = load i32, ptr @n, align 4, !tbaa !9
  %.not39 = icmp slt i32 %4, 1
  br i1 %.not39, label %.preheader, label %.lr.ph

5:                                                ; preds = %10, %0
  %6 = phi i64 [ 1, %0 ], [ %12, %10 ]
  %indvars.iv = phi i64 [ 1, %0 ], [ %indvars.iv.next.1, %10 ]
  %7 = mul nsw i64 %6, %indvars.iv
  %8 = srem i64 %7, %1
  %9 = getelementptr inbounds [5000 x i64], ptr @f, i64 0, i64 %indvars.iv
  store i64 %8, ptr %9, align 8, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 5000
  br i1 %exitcond.not, label %2, label %10, !llvm.loop !11

10:                                               ; preds = %5
  %11 = mul nsw i64 %8, %indvars.iv.next
  %12 = srem i64 %11, %1
  %13 = getelementptr inbounds [5000 x i64], ptr @f, i64 0, i64 %indvars.iv.next
  store i64 %12, ptr %13, align 8, !tbaa !5
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  br label %5

.preheader37:                                     ; preds = %26
  %.not3543 = icmp slt i32 %27, 1
  br i1 %.not3543, label %.preheader, label %.lr.ph46.preheader

.lr.ph46.preheader:                               ; preds = %.preheader37
  %14 = zext nneg i32 %27 to i64
  %xtraiter = and i64 %14, 1
  %15 = icmp eq i32 %27, 1
  br i1 %15, label %.preheader.loopexit.unr-lcssa, label %.lr.ph46.preheader.new

.lr.ph46.preheader.new:                           ; preds = %.lr.ph46.preheader
  %unroll_iter = and i64 %14, 2147483646
  br label %.lr.ph46

.lr.ph:                                           ; preds = %2, %26
  %indvars.iv53 = phi i64 [ %indvars.iv.next54, %26 ], [ 1, %2 ]
  %.03140 = phi i32 [ %.132, %26 ], [ 0, %2 ]
  %16 = getelementptr inbounds [5000 x i32], ptr @p, i64 0, i64 %indvars.iv53
  %17 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %16)
  %18 = load i32, ptr %16, align 4, !tbaa !9
  %19 = icmp eq i32 %18, -1
  br i1 %19, label %20, label %22

20:                                               ; preds = %.lr.ph
  %21 = add nsw i32 %.03140, 1
  br label %26

22:                                               ; preds = %.lr.ph
  %23 = sext i32 %18 to i64
  %24 = getelementptr inbounds [5000 x i32], ptr @v, i64 0, i64 %23
  store i32 1, ptr %24, align 4, !tbaa !9
  %25 = getelementptr inbounds [5000 x i32], ptr @u, i64 0, i64 %indvars.iv53
  store i32 1, ptr %25, align 4, !tbaa !9
  br label %26

26:                                               ; preds = %20, %22
  %.132 = phi i32 [ %21, %20 ], [ %.03140, %22 ]
  %indvars.iv.next54 = add nuw nsw i64 %indvars.iv53, 1
  %27 = load i32, ptr @n, align 4, !tbaa !9
  %28 = sext i32 %27 to i64
  %.not.not = icmp slt i64 %indvars.iv53, %28
  br i1 %.not.not, label %.lr.ph, label %.preheader37, !llvm.loop !13

.preheader.loopexit.unr-lcssa:                    ; preds = %56, %.lr.ph46.preheader
  %.1.lcssa.ph = phi i32 [ poison, %.lr.ph46.preheader ], [ %.1.1, %56 ]
  %indvars.iv56.unr = phi i64 [ 1, %.lr.ph46.preheader ], [ %indvars.iv.next57.1, %56 ]
  %.03044.unr = phi i32 [ 0, %.lr.ph46.preheader ], [ %.1.1, %56 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader, label %.lr.ph46.epil

.lr.ph46.epil:                                    ; preds = %.preheader.loopexit.unr-lcssa
  %29 = getelementptr inbounds [5000 x i32], ptr @u, i64 0, i64 %indvars.iv56.unr
  %30 = load i32, ptr %29, align 4, !tbaa !9
  %31 = icmp eq i32 %30, 0
  br i1 %31, label %32, label %.preheader

32:                                               ; preds = %.lr.ph46.epil
  %33 = getelementptr inbounds [5000 x i32], ptr @v, i64 0, i64 %indvars.iv56.unr
  %34 = load i32, ptr %33, align 4, !tbaa !9
  %35 = icmp eq i32 %34, 0
  %36 = zext i1 %35 to i32
  %spec.select.epil = add nsw i32 %.03044.unr, %36
  br label %.preheader

.preheader:                                       ; preds = %.preheader.loopexit.unr-lcssa, %32, %.lr.ph46.epil, %2, %.preheader37
  %.lcssa69 = phi i32 [ %27, %.preheader37 ], [ %4, %2 ], [ %27, %.lr.ph46.epil ], [ %27, %32 ], [ %27, %.preheader.loopexit.unr-lcssa ]
  %.031.lcssa68 = phi i32 [ %.132, %.preheader37 ], [ 0, %2 ], [ %.132, %.lr.ph46.epil ], [ %.132, %32 ], [ %.132, %.preheader.loopexit.unr-lcssa ]
  %.030.lcssa = phi i32 [ 0, %.preheader37 ], [ 0, %2 ], [ %.1.lcssa.ph, %.preheader.loopexit.unr-lcssa ], [ %.03044.unr, %.lr.ph46.epil ], [ %spec.select.epil, %32 ]
  %.not3648 = icmp slt i32 %.lcssa69, 0
  br i1 %.not3648, label %._crit_edge, label %.lr.ph50

.lr.ph50:                                         ; preds = %.preheader
  %37 = load i64, ptr @MOD, align 8, !tbaa !5
  %38 = add nuw i32 %.lcssa69, 1
  %wide.trip.count63 = zext i32 %38 to i64
  %xtraiter71 = and i64 %wide.trip.count63, 1
  %39 = icmp eq i32 %.lcssa69, 0
  br i1 %39, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph50.new

.lr.ph50.new:                                     ; preds = %.lr.ph50
  %unroll_iter73 = and i64 %wide.trip.count63, 4294967294
  br label %67

.lr.ph46:                                         ; preds = %56, %.lr.ph46.preheader.new
  %indvars.iv56 = phi i64 [ 1, %.lr.ph46.preheader.new ], [ %indvars.iv.next57.1, %56 ]
  %.03044 = phi i32 [ 0, %.lr.ph46.preheader.new ], [ %.1.1, %56 ]
  %niter = phi i64 [ 0, %.lr.ph46.preheader.new ], [ %niter.next.1, %56 ]
  %40 = getelementptr inbounds [5000 x i32], ptr @u, i64 0, i64 %indvars.iv56
  %41 = load i32, ptr %40, align 4, !tbaa !9
  %42 = icmp eq i32 %41, 0
  br i1 %42, label %43, label %.lr.ph46.1

43:                                               ; preds = %.lr.ph46
  %44 = getelementptr inbounds [5000 x i32], ptr @v, i64 0, i64 %indvars.iv56
  %45 = load i32, ptr %44, align 4, !tbaa !9
  %46 = icmp eq i32 %45, 0
  %47 = zext i1 %46 to i32
  %spec.select = add nsw i32 %.03044, %47
  br label %.lr.ph46.1

.lr.ph46.1:                                       ; preds = %43, %.lr.ph46
  %.1 = phi i32 [ %.03044, %.lr.ph46 ], [ %spec.select, %43 ]
  %indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
  %48 = getelementptr inbounds [5000 x i32], ptr @u, i64 0, i64 %indvars.iv.next57
  %49 = load i32, ptr %48, align 4, !tbaa !9
  %50 = icmp eq i32 %49, 0
  br i1 %50, label %51, label %56

51:                                               ; preds = %.lr.ph46.1
  %52 = getelementptr inbounds [5000 x i32], ptr @v, i64 0, i64 %indvars.iv.next57
  %53 = load i32, ptr %52, align 4, !tbaa !9
  %54 = icmp eq i32 %53, 0
  %55 = zext i1 %54 to i32
  %spec.select.1 = add nsw i32 %.1, %55
  br label %56

56:                                               ; preds = %51, %.lr.ph46.1
  %.1.1 = phi i32 [ %.1, %.lr.ph46.1 ], [ %spec.select.1, %51 ]
  %indvars.iv.next57.1 = add nuw nsw i64 %indvars.iv56, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %.preheader.loopexit.unr-lcssa, label %.lr.ph46, !llvm.loop !14

._crit_edge.loopexit.unr-lcssa:                   ; preds = %67, %.lr.ph50
  %indvars.iv60.unr = phi i64 [ 0, %.lr.ph50 ], [ %indvars.iv.next61.1, %67 ]
  %lcmp.mod72.not = icmp eq i64 %xtraiter71, 0
  br i1 %lcmp.mod72.not, label %._crit_edge, label %._crit_edge.loopexit.epilog-lcssa

._crit_edge.loopexit.epilog-lcssa:                ; preds = %._crit_edge.loopexit.unr-lcssa
  %57 = getelementptr inbounds [5000 x i64], ptr @f, i64 0, i64 %indvars.iv60.unr
  %58 = load i64, ptr %57, align 8, !tbaa !5
  %59 = getelementptr inbounds [5000 x [5000 x i64]], ptr @dp, i64 0, i64 %indvars.iv60.unr
  store i64 %58, ptr %59, align 16, !tbaa !5
  %60 = mul nsw i64 %58, %indvars.iv60.unr
  %61 = srem i64 %60, %37
  %62 = getelementptr inbounds i8, ptr %59, i64 8
  store i64 %61, ptr %62, align 8, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit.epilog-lcssa, %._crit_edge.loopexit.unr-lcssa, %.preheader
  %63 = sub nsw i32 %.031.lcssa68, %.030.lcssa
  %64 = tail call noundef i64 @_Z2goii(i32 noundef %63, i32 noundef %.030.lcssa)
  %65 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %64)
  %66 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %65, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  ret i32 0

67:                                               ; preds = %67, %.lr.ph50.new
  %indvars.iv60 = phi i64 [ 0, %.lr.ph50.new ], [ %indvars.iv.next61.1, %67 ]
  %niter74 = phi i64 [ 0, %.lr.ph50.new ], [ %niter74.next.1, %67 ]
  %68 = getelementptr inbounds [5000 x i64], ptr @f, i64 0, i64 %indvars.iv60
  %69 = load i64, ptr %68, align 16, !tbaa !5
  %70 = getelementptr inbounds [5000 x [5000 x i64]], ptr @dp, i64 0, i64 %indvars.iv60
  store i64 %69, ptr %70, align 16, !tbaa !5
  %71 = mul nsw i64 %69, %indvars.iv60
  %72 = srem i64 %71, %37
  %73 = getelementptr inbounds i8, ptr %70, i64 8
  store i64 %72, ptr %73, align 8, !tbaa !5
  %indvars.iv.next61 = or disjoint i64 %indvars.iv60, 1
  %74 = getelementptr inbounds [5000 x i64], ptr @f, i64 0, i64 %indvars.iv.next61
  %75 = load i64, ptr %74, align 8, !tbaa !5
  %76 = getelementptr inbounds [5000 x [5000 x i64]], ptr @dp, i64 0, i64 %indvars.iv.next61
  store i64 %75, ptr %76, align 16, !tbaa !5
  %77 = mul nsw i64 %75, %indvars.iv.next61
  %78 = srem i64 %77, %37
  %79 = getelementptr inbounds i8, ptr %76, i64 8
  store i64 %78, ptr %79, align 8, !tbaa !5
  %indvars.iv.next61.1 = add nuw nsw i64 %indvars.iv60, 2
  %niter74.next.1 = add i64 %niter74, 2
  %niter74.ncmp.1 = icmp eq i64 %niter74.next.1, %unroll_iter73
  br i1 %niter74.ncmp.1, label %._crit_edge.loopexit.unr-lcssa, label %67, !llvm.loop !15
}

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #3

attributes #0 = { 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 #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 = { nofree nounwind "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 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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}


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