; LLVM IR from ShahjalalShohag/code-library :: Dynamic Programming Optimizations (Divide and Conquer Optimization)

; 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 [4010 x [4010 x i32]], align 16
@c = external dso_local global [4010 x [4010 x i32]], align 16
@dp = external dso_local global [810 x [4010 x i32]], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z2scv() #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 i32 @_Z4costii(i32 noundef, i32 noundef) #2

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

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

15:                                               ; preds = %36, %0
  %16 = load i32, ptr %2, align 4, !tbaa !8
  %17 = load i32, ptr %5, align 4, !tbaa !8
  %18 = icmp sle i32 %16, %17
  br i1 %18, label %19, label %39

19:                                               ; preds = %15
  store i32 1, ptr %3, align 4, !tbaa !8
  br label %20

20:                                               ; preds = %32, %19
  %21 = load i32, ptr %3, align 4, !tbaa !8
  %22 = load i32, ptr %5, align 4, !tbaa !8
  %23 = icmp sle i32 %21, %22
  br i1 %23, label %24, label %35

24:                                               ; preds = %20
  %25 = call noundef i32 @_Z2scv()
  %26 = load i32, ptr %2, align 4, !tbaa !8
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [4010 x [4010 x i32]], ptr @a, i64 0, i64 %27
  %29 = load i32, ptr %3, align 4, !tbaa !8
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [4010 x i32], ptr %28, i64 0, i64 %30
  store i32 %25, ptr %31, align 4, !tbaa !8
  br label %32

32:                                               ; preds = %24
  %33 = load i32, ptr %3, align 4, !tbaa !8
  %34 = add nsw i32 %33, 1
  store i32 %34, ptr %3, align 4, !tbaa !8
  br label %20, !llvm.loop !11

35:                                               ; preds = %20
  br label %36

36:                                               ; preds = %35
  %37 = load i32, ptr %2, align 4, !tbaa !8
  %38 = add nsw i32 %37, 1
  store i32 %38, ptr %2, align 4, !tbaa !8
  br label %15, !llvm.loop !13

39:                                               ; preds = %15
  store i32 1, ptr %2, align 4, !tbaa !8
  br label %40

40:                                               ; preds = %95, %39
  %41 = load i32, ptr %2, align 4, !tbaa !8
  %42 = load i32, ptr %5, align 4, !tbaa !8
  %43 = icmp sle i32 %41, %42
  br i1 %43, label %44, label %98

44:                                               ; preds = %40
  store i32 1, ptr %3, align 4, !tbaa !8
  br label %45

45:                                               ; preds = %91, %44
  %46 = load i32, ptr %3, align 4, !tbaa !8
  %47 = load i32, ptr %5, align 4, !tbaa !8
  %48 = icmp sle i32 %46, %47
  br i1 %48, label %49, label %94

49:                                               ; preds = %45
  %50 = load i32, ptr %2, align 4, !tbaa !8
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [4010 x [4010 x i32]], ptr @a, i64 0, i64 %51
  %53 = load i32, ptr %3, align 4, !tbaa !8
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [4010 x i32], ptr %52, i64 0, i64 %54
  %56 = load i32, ptr %55, align 4, !tbaa !8
  %57 = load i32, ptr %2, align 4, !tbaa !8
  %58 = sub nsw i32 %57, 1
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [4010 x [4010 x i32]], ptr @c, i64 0, i64 %59
  %61 = load i32, ptr %3, align 4, !tbaa !8
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [4010 x i32], ptr %60, i64 0, i64 %62
  %64 = load i32, ptr %63, align 4, !tbaa !8
  %65 = add nsw i32 %56, %64
  %66 = load i32, ptr %2, align 4, !tbaa !8
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [4010 x [4010 x i32]], ptr @c, i64 0, i64 %67
  %69 = load i32, ptr %3, align 4, !tbaa !8
  %70 = sub nsw i32 %69, 1
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [4010 x i32], ptr %68, i64 0, i64 %71
  %73 = load i32, ptr %72, align 4, !tbaa !8
  %74 = add nsw i32 %65, %73
  %75 = load i32, ptr %2, align 4, !tbaa !8
  %76 = sub nsw i32 %75, 1
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [4010 x [4010 x i32]], ptr @c, i64 0, i64 %77
  %79 = load i32, ptr %3, align 4, !tbaa !8
  %80 = sub nsw i32 %79, 1
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [4010 x i32], ptr %78, i64 0, i64 %81
  %83 = load i32, ptr %82, align 4, !tbaa !8
  %84 = sub nsw i32 %74, %83
  %85 = load i32, ptr %2, align 4, !tbaa !8
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [4010 x [4010 x i32]], ptr @c, i64 0, i64 %86
  %88 = load i32, ptr %3, align 4, !tbaa !8
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [4010 x i32], ptr %87, i64 0, i64 %89
  store i32 %84, ptr %90, align 4, !tbaa !8
  br label %91

91:                                               ; preds = %49
  %92 = load i32, ptr %3, align 4, !tbaa !8
  %93 = add nsw i32 %92, 1
  store i32 %93, ptr %3, align 4, !tbaa !8
  br label %45, !llvm.loop !14

94:                                               ; preds = %45
  br label %95

95:                                               ; preds = %94
  %96 = load i32, ptr %2, align 4, !tbaa !8
  %97 = add nsw i32 %96, 1
  store i32 %97, ptr %2, align 4, !tbaa !8
  br label %40, !llvm.loop !15

98:                                               ; preds = %40
  store i32 1, ptr %2, align 4, !tbaa !8
  br label %99

99:                                               ; preds = %119, %98
  %100 = load i32, ptr %2, align 4, !tbaa !8
  %101 = load i32, ptr %4, align 4, !tbaa !8
  %102 = icmp sle i32 %100, %101
  br i1 %102, label %103, label %122

103:                                              ; preds = %99
  store i32 1, ptr %3, align 4, !tbaa !8
  br label %104

104:                                              ; preds = %115, %103
  %105 = load i32, ptr %3, align 4, !tbaa !8
  %106 = load i32, ptr %5, align 4, !tbaa !8
  %107 = icmp sle i32 %105, %106
  br i1 %107, label %108, label %118

108:                                              ; preds = %104
  %109 = load i32, ptr %2, align 4, !tbaa !8
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [810 x [4010 x i32]], ptr @dp, i64 0, i64 %110
  %112 = load i32, ptr %3, align 4, !tbaa !8
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [4010 x i32], ptr %111, i64 0, i64 %113
  store i32 1000000000, ptr %114, align 4, !tbaa !8
  br label %115

115:                                              ; preds = %108
  %116 = load i32, ptr %3, align 4, !tbaa !8
  %117 = add nsw i32 %116, 1
  store i32 %117, ptr %3, align 4, !tbaa !8
  br label %104, !llvm.loop !16

118:                                              ; preds = %104
  br label %119

119:                                              ; preds = %118
  %120 = load i32, ptr %2, align 4, !tbaa !8
  %121 = add nsw i32 %120, 1
  store i32 %121, ptr %2, align 4, !tbaa !8
  br label %99, !llvm.loop !17

122:                                              ; preds = %99
  store i32 1, ptr %2, align 4, !tbaa !8
  br label %123

123:                                              ; preds = %133, %122
  %124 = load i32, ptr %2, align 4, !tbaa !8
  %125 = load i32, ptr %5, align 4, !tbaa !8
  %126 = icmp sle i32 %124, %125
  br i1 %126, label %127, label %136

127:                                              ; preds = %123
  %128 = load i32, ptr %2, align 4, !tbaa !8
  %129 = call noundef i32 @_Z4costii(i32 noundef 1, i32 noundef %128)
  %130 = load i32, ptr %2, align 4, !tbaa !8
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [4010 x i32], ptr getelementptr inbounds ([810 x [4010 x i32]], ptr @dp, i64 0, i64 1), i64 0, i64 %131
  store i32 %129, ptr %132, align 4, !tbaa !8
  br label %133

133:                                              ; preds = %127
  %134 = load i32, ptr %2, align 4, !tbaa !8
  %135 = add nsw i32 %134, 1
  store i32 %135, ptr %2, align 4, !tbaa !8
  br label %123, !llvm.loop !18

136:                                              ; preds = %123
  store i32 2, ptr %2, align 4, !tbaa !8
  br label %137

137:                                              ; preds = %145, %136
  %138 = load i32, ptr %2, align 4, !tbaa !8
  %139 = load i32, ptr %4, align 4, !tbaa !8
  %140 = icmp sle i32 %138, %139
  br i1 %140, label %141, label %148

141:                                              ; preds = %137
  %142 = load i32, ptr %2, align 4, !tbaa !8
  %143 = load i32, ptr %5, align 4, !tbaa !8
  %144 = load i32, ptr %5, align 4, !tbaa !8
  call void @_Z2yoiiiii(i32 noundef %142, i32 noundef 1, i32 noundef %143, i32 noundef 1, i32 noundef %144)
  br label %145

145:                                              ; preds = %141
  %146 = load i32, ptr %2, align 4, !tbaa !8
  %147 = add nsw i32 %146, 1
  store i32 %147, ptr %2, align 4, !tbaa !8
  br label %137, !llvm.loop !19

148:                                              ; preds = %137
  %149 = load i32, ptr %4, align 4, !tbaa !8
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds [810 x [4010 x i32]], ptr @dp, i64 0, i64 %150
  %152 = load i32, ptr %5, align 4, !tbaa !8
  %153 = sext i32 %152 to i64
  %154 = getelementptr inbounds [4010 x i32], ptr %151, i64 0, i64 %153
  %155 = load i32, ptr %154, align 4, !tbaa !8
  %156 = sdiv i32 %155, 2
  %157 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %156)
  %158 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %157, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  ret i32 0
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) #4

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) #2 align 2

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #4

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

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

@a = external dso_local local_unnamed_addr global [4010 x [4010 x i32]], align 16
@c = external dso_local local_unnamed_addr global [4010 x [4010 x i32]], align 16
@dp = external dso_local local_unnamed_addr global [810 x [4010 x i32]], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z4costii(i32 noundef, i32 noundef) local_unnamed_addr #1

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %2 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %3 = getelementptr i8, ptr %2, i64 -24
  %4 = load i64, ptr %3, align 8
  %5 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %4
  %6 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %5, ptr noundef null)
  %7 = tail call noundef i32 @_Z2scv()
  %8 = tail call noundef i32 @_Z2scv()
  %.not66 = icmp slt i32 %7, 1
  br i1 %.not66, label %.preheader60, label %.preheader63.preheader

.preheader63.preheader:                           ; preds = %0
  %9 = add nuw i32 %7, 1
  %wide.trip.count89 = zext i32 %9 to i64
  br label %.preheader63

.preheader63:                                     ; preds = %.preheader63.preheader, %._crit_edge
  %indvars.iv86 = phi i64 [ 1, %.preheader63.preheader ], [ %indvars.iv.next87, %._crit_edge ]
  br label %13

.preheader62:                                     ; preds = %._crit_edge
  br i1 %.not66, label %.preheader60, label %.preheader61.preheader

.preheader61.preheader:                           ; preds = %.preheader62
  %10 = add nuw i32 %7, 1
  %wide.trip.count99 = zext i32 %10 to i64
  %.pre118.pre = load i32, ptr @c, align 16, !tbaa !8
  %11 = zext nneg i32 %7 to i64
  %xtraiter = and i64 %11, 1
  %12 = icmp eq i32 %10, 2
  %unroll_iter = and i64 %11, 2147483646
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br label %.preheader61

13:                                               ; preds = %.preheader63, %13
  %indvars.iv = phi i64 [ 1, %.preheader63 ], [ %indvars.iv.next, %13 ]
  %14 = tail call noundef i32 @_Z2scv()
  %15 = getelementptr inbounds [4010 x [4010 x i32]], ptr @a, i64 0, i64 %indvars.iv86, i64 %indvars.iv
  store i32 %14, ptr %15, align 4, !tbaa !8
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count89
  br i1 %exitcond.not, label %._crit_edge, label %13, !llvm.loop !11

._crit_edge:                                      ; preds = %13
  %indvars.iv.next87 = add nuw nsw i64 %indvars.iv86, 1
  %exitcond90.not = icmp eq i64 %indvars.iv.next87, %wide.trip.count89
  br i1 %exitcond90.not, label %.preheader62, label %.preheader63, !llvm.loop !13

.preheader61:                                     ; preds = %.preheader61.preheader, %._crit_edge70
  %.pre118 = phi i32 [ %.pre118.pre, %.preheader61.preheader ], [ %.pre, %._crit_edge70 ]
  %indvars.iv96 = phi i64 [ 1, %.preheader61.preheader ], [ %indvars.iv.next97, %._crit_edge70 ]
  %16 = add nsw i64 %indvars.iv96, -1
  %.phi.trans.insert = getelementptr inbounds [4010 x [4010 x i32]], ptr @c, i64 0, i64 %indvars.iv96, i64 0
  %.pre = load i32, ptr %.phi.trans.insert, align 8, !tbaa !8
  br i1 %12, label %._crit_edge70.unr-lcssa, label %.preheader61.new

.preheader60:                                     ; preds = %._crit_edge70, %0, %.preheader62
  %.not5276 = icmp slt i32 %8, 1
  br i1 %.not5276, label %.preheader58, label %.preheader59.lr.ph

.preheader59.lr.ph:                               ; preds = %.preheader60
  br i1 %.not66, label %.preheader, label %.preheader59.preheader

.preheader59.preheader:                           ; preds = %.preheader59.lr.ph
  %17 = add nuw i32 %7, 1
  %18 = add nuw i32 %8, 1
  %wide.trip.count109 = zext i32 %18 to i64
  %wide.trip.count104 = zext i32 %17 to i64
  %19 = zext nneg i32 %7 to i64
  %min.iters.check = icmp ult i32 %7, 8
  %n.vec = and i64 %19, 2147483640
  %ind.end = or disjoint i64 %n.vec, 1
  %cmp.n = icmp eq i64 %n.vec, %19
  br label %.preheader59

.preheader61.new:                                 ; preds = %.preheader61, %.preheader61.new
  %20 = phi i32 [ %33, %.preheader61.new ], [ %.pre118, %.preheader61 ]
  %21 = phi i32 [ %36, %.preheader61.new ], [ %.pre, %.preheader61 ]
  %indvars.iv91 = phi i64 [ %indvars.iv.next92.1, %.preheader61.new ], [ 1, %.preheader61 ]
  %niter = phi i64 [ %niter.next.1, %.preheader61.new ], [ 0, %.preheader61 ]
  %22 = getelementptr inbounds [4010 x [4010 x i32]], ptr @a, i64 0, i64 %indvars.iv96, i64 %indvars.iv91
  %23 = load i32, ptr %22, align 4, !tbaa !8
  %24 = getelementptr inbounds [4010 x [4010 x i32]], ptr @c, i64 0, i64 %16, i64 %indvars.iv91
  %25 = load i32, ptr %24, align 4, !tbaa !8
  %26 = add nsw i32 %25, %23
  %27 = add nsw i32 %26, %21
  %28 = sub i32 %27, %20
  %29 = getelementptr inbounds [4010 x [4010 x i32]], ptr @c, i64 0, i64 %indvars.iv96, i64 %indvars.iv91
  store i32 %28, ptr %29, align 4, !tbaa !8
  %indvars.iv.next92 = add nuw nsw i64 %indvars.iv91, 1
  %30 = getelementptr inbounds [4010 x [4010 x i32]], ptr @a, i64 0, i64 %indvars.iv96, i64 %indvars.iv.next92
  %31 = load i32, ptr %30, align 4, !tbaa !8
  %32 = getelementptr inbounds [4010 x [4010 x i32]], ptr @c, i64 0, i64 %16, i64 %indvars.iv.next92
  %33 = load i32, ptr %32, align 4, !tbaa !8
  %34 = add nsw i32 %33, %31
  %35 = add nsw i32 %34, %28
  %36 = sub i32 %35, %25
  %37 = getelementptr inbounds [4010 x [4010 x i32]], ptr @c, i64 0, i64 %indvars.iv96, i64 %indvars.iv.next92
  store i32 %36, ptr %37, align 4, !tbaa !8
  %indvars.iv.next92.1 = add nuw nsw i64 %indvars.iv91, 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 %._crit_edge70.unr-lcssa, label %.preheader61.new, !llvm.loop !14

._crit_edge70.unr-lcssa:                          ; preds = %.preheader61.new, %.preheader61
  %.unr = phi i32 [ %.pre118, %.preheader61 ], [ %33, %.preheader61.new ]
  %.unr120 = phi i32 [ %.pre, %.preheader61 ], [ %36, %.preheader61.new ]
  %indvars.iv91.unr = phi i64 [ 1, %.preheader61 ], [ %indvars.iv.next92.1, %.preheader61.new ]
  br i1 %lcmp.mod.not, label %._crit_edge70, label %._crit_edge70.epilog-lcssa

._crit_edge70.epilog-lcssa:                       ; preds = %._crit_edge70.unr-lcssa
  %38 = getelementptr inbounds [4010 x [4010 x i32]], ptr @a, i64 0, i64 %indvars.iv96, i64 %indvars.iv91.unr
  %39 = load i32, ptr %38, align 4, !tbaa !8
  %40 = getelementptr inbounds [4010 x [4010 x i32]], ptr @c, i64 0, i64 %16, i64 %indvars.iv91.unr
  %41 = load i32, ptr %40, align 4, !tbaa !8
  %42 = add nsw i32 %41, %39
  %43 = add nsw i32 %42, %.unr120
  %44 = sub i32 %43, %.unr
  %45 = getelementptr inbounds [4010 x [4010 x i32]], ptr @c, i64 0, i64 %indvars.iv96, i64 %indvars.iv91.unr
  store i32 %44, ptr %45, align 4, !tbaa !8
  br label %._crit_edge70

._crit_edge70:                                    ; preds = %._crit_edge70.unr-lcssa, %._crit_edge70.epilog-lcssa
  %indvars.iv.next97 = add nuw nsw i64 %indvars.iv96, 1
  %exitcond100.not = icmp eq i64 %indvars.iv.next97, %wide.trip.count99
  br i1 %exitcond100.not, label %.preheader60, label %.preheader61, !llvm.loop !15

.preheader59:                                     ; preds = %.preheader59.preheader, %._crit_edge75
  %indvars.iv106 = phi i64 [ 1, %.preheader59.preheader ], [ %indvars.iv.next107, %._crit_edge75 ]
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.body

scalar.ph.preheader:                              ; preds = %middle.block, %.preheader59
  %indvars.iv101.ph = phi i64 [ 1, %.preheader59 ], [ %ind.end, %middle.block ]
  br label %scalar.ph

vector.body:                                      ; preds = %.preheader59, %vector.body
  %index = phi i64 [ %index.next, %vector.body ], [ 0, %.preheader59 ]
  %offset.idx = or disjoint i64 %index, 1
  %46 = getelementptr inbounds [810 x [4010 x i32]], ptr @dp, i64 0, i64 %indvars.iv106, i64 %offset.idx
  %47 = getelementptr inbounds i8, ptr %46, i64 16
  store <4 x i32> <i32 1000000000, i32 1000000000, i32 1000000000, i32 1000000000>, ptr %46, align 4, !tbaa !8
  store <4 x i32> <i32 1000000000, i32 1000000000, i32 1000000000, i32 1000000000>, ptr %47, align 4, !tbaa !8
  %index.next = add nuw i64 %index, 8
  %48 = icmp eq i64 %index.next, %n.vec
  br i1 %48, label %middle.block, label %vector.body, !llvm.loop !16

middle.block:                                     ; preds = %vector.body
  br i1 %cmp.n, label %._crit_edge75, label %scalar.ph.preheader

.preheader58:                                     ; preds = %._crit_edge75, %.preheader60
  br i1 %.not66, label %.preheader, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %.preheader58
  %49 = add nuw i32 %7, 1
  %wide.trip.count114 = zext i32 %49 to i64
  br label %.lr.ph

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv101 = phi i64 [ %indvars.iv.next102, %scalar.ph ], [ %indvars.iv101.ph, %scalar.ph.preheader ]
  %50 = getelementptr inbounds [810 x [4010 x i32]], ptr @dp, i64 0, i64 %indvars.iv106, i64 %indvars.iv101
  store i32 1000000000, ptr %50, align 4, !tbaa !8
  %indvars.iv.next102 = add nuw nsw i64 %indvars.iv101, 1
  %exitcond105.not = icmp eq i64 %indvars.iv.next102, %wide.trip.count104
  br i1 %exitcond105.not, label %._crit_edge75, label %scalar.ph, !llvm.loop !19

._crit_edge75:                                    ; preds = %scalar.ph, %middle.block
  %indvars.iv.next107 = add nuw nsw i64 %indvars.iv106, 1
  %exitcond110.not = icmp eq i64 %indvars.iv.next107, %wide.trip.count109
  br i1 %exitcond110.not, label %.preheader58, label %.preheader59, !llvm.loop !20

.preheader:                                       ; preds = %.lr.ph, %.preheader59.lr.ph, %.preheader58
  %.not5480 = icmp slt i32 %8, 2
  br i1 %.not5480, label %._crit_edge83, label %.lr.ph82

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv111 = phi i64 [ 1, %.lr.ph.preheader ], [ %indvars.iv.next112, %.lr.ph ]
  %51 = trunc nuw nsw i64 %indvars.iv111 to i32
  %52 = tail call noundef i32 @_Z4costii(i32 noundef 1, i32 noundef %51)
  %53 = getelementptr inbounds [4010 x i32], ptr getelementptr inbounds (i8, ptr @dp, i64 16040), i64 0, i64 %indvars.iv111
  store i32 %52, ptr %53, align 4, !tbaa !8
  %indvars.iv.next112 = add nuw nsw i64 %indvars.iv111, 1
  %exitcond115.not = icmp eq i64 %indvars.iv.next112, %wide.trip.count114
  br i1 %exitcond115.not, label %.preheader, label %.lr.ph, !llvm.loop !21

.lr.ph82:                                         ; preds = %.preheader, %.lr.ph82
  %.481 = phi i32 [ %54, %.lr.ph82 ], [ 2, %.preheader ]
  tail call void @_Z2yoiiiii(i32 noundef %.481, i32 noundef 1, i32 noundef %7, i32 noundef 1, i32 noundef %7)
  %54 = add nuw i32 %.481, 1
  %exitcond116.not = icmp eq i32 %.481, %8
  br i1 %exitcond116.not, label %._crit_edge83, label %.lr.ph82, !llvm.loop !22

._crit_edge83:                                    ; preds = %.lr.ph82, %.preheader
  %55 = sext i32 %8 to i64
  %56 = sext i32 %7 to i64
  %57 = getelementptr inbounds [810 x [4010 x i32]], ptr @dp, i64 0, i64 %55, i64 %56
  %58 = load i32, ptr %57, align 4, !tbaa !8
  %59 = sdiv i32 %58, 2
  %60 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %59)
  %61 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %60, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  ret i32 0
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) local_unnamed_addr #1 align 2

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #3

; 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)) #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 nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 = { 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 = !{!"int", !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, !18}
!17 = !{!"llvm.loop.isvectorized", i32 1}
!18 = !{!"llvm.loop.unroll.runtime.disable"}
!19 = distinct !{!19, !12, !18, !17}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !12}


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