; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/142 Division 1/D (D)

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

@dp = external dso_local global [5010 x [5010 x i32]], align 16
@sum = external dso_local global [5010 x i32], align 16
@n = external dso_local global i32, align 4
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

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

21:                                               ; preds = %41, %0
  %22 = load i32, ptr %2, align 4, !tbaa !8
  %23 = load i32, ptr @n, align 4, !tbaa !8
  %24 = icmp sle i32 %22, %23
  br i1 %24, label %26, label %25

25:                                               ; preds = %21
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  br label %44

26:                                               ; preds = %21
  %27 = load i32, ptr %2, align 4, !tbaa !8
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [5010 x i32], ptr @sum, i64 0, i64 %28
  %30 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %29)
  %31 = load i32, ptr %2, align 4, !tbaa !8
  %32 = sub nsw i32 %31, 1
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [5010 x i32], ptr @sum, i64 0, i64 %33
  %35 = load i32, ptr %34, align 4, !tbaa !8
  %36 = load i32, ptr %2, align 4, !tbaa !8
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [5010 x i32], ptr @sum, i64 0, i64 %37
  %39 = load i32, ptr %38, align 4, !tbaa !8
  %40 = add nsw i32 %39, %35
  store i32 %40, ptr %38, align 4, !tbaa !8
  br label %41

41:                                               ; preds = %26
  %42 = load i32, ptr %2, align 4, !tbaa !8
  %43 = add nsw i32 %42, 1
  store i32 %43, ptr %2, align 4, !tbaa !8
  br label %21, !llvm.loop !11

44:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  %45 = load i32, ptr @n, align 4, !tbaa !8
  store i32 %45, ptr %3, align 4, !tbaa !8
  br label %46

46:                                               ; preds = %165, %44
  %47 = load i32, ptr %3, align 4, !tbaa !8
  %48 = icmp sge i32 %47, 1
  br i1 %48, label %50, label %49

49:                                               ; preds = %46
  store i32 5, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  br label %168

50:                                               ; preds = %46
  %51 = load i32, ptr @n, align 4, !tbaa !8
  %52 = load i32, ptr %3, align 4, !tbaa !8
  %53 = sub nsw i32 %51, %52
  %54 = load i32, ptr %3, align 4, !tbaa !8
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [5010 x [5010 x i32]], ptr @dp, i64 0, i64 %55
  %57 = load i32, ptr @n, align 4, !tbaa !8
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [5010 x i32], ptr %56, i64 0, i64 %58
  store i32 %53, ptr %59, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  %60 = load i32, ptr @n, align 4, !tbaa !8
  %61 = sub nsw i32 %60, 1
  store i32 %61, ptr %5, align 4, !tbaa !8
  br label %62

62:                                               ; preds = %161, %50
  %63 = load i32, ptr %5, align 4, !tbaa !8
  %64 = load i32, ptr %3, align 4, !tbaa !8
  %65 = icmp sge i32 %63, %64
  br i1 %65, label %67, label %66

66:                                               ; preds = %62
  store i32 8, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  br label %164

67:                                               ; preds = %62
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  %68 = load i32, ptr %5, align 4, !tbaa !8
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [5010 x i32], ptr @sum, i64 0, i64 %69
  %71 = load i32, ptr %70, align 4, !tbaa !8
  %72 = load i32, ptr %3, align 4, !tbaa !8
  %73 = sub nsw i32 %72, 1
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [5010 x i32], ptr @sum, i64 0, i64 %74
  %76 = load i32, ptr %75, align 4, !tbaa !8
  %77 = sub nsw i32 %71, %76
  store i32 %77, ptr %6, align 4, !tbaa !8
  %78 = load i32, ptr %6, align 4, !tbaa !8
  %79 = load i32, ptr @n, align 4, !tbaa !8
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [5010 x i32], ptr @sum, i64 0, i64 %80
  %82 = load i32, ptr %81, align 4, !tbaa !8
  %83 = load i32, ptr %5, align 4, !tbaa !8
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [5010 x i32], ptr @sum, i64 0, i64 %84
  %86 = load i32, ptr %85, align 4, !tbaa !8
  %87 = sub nsw i32 %82, %86
  %88 = icmp sgt i32 %78, %87
  br i1 %88, label %89, label %99

89:                                               ; preds = %67
  %90 = load i32, ptr @n, align 4, !tbaa !8
  %91 = load i32, ptr %3, align 4, !tbaa !8
  %92 = sub nsw i32 %90, %91
  %93 = load i32, ptr %3, align 4, !tbaa !8
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [5010 x [5010 x i32]], ptr @dp, i64 0, i64 %94
  %96 = load i32, ptr %5, align 4, !tbaa !8
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [5010 x i32], ptr %95, i64 0, i64 %97
  store i32 %92, ptr %98, align 4, !tbaa !8
  store i32 10, ptr %4, align 4
  br label %158

99:                                               ; preds = %67
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  %100 = load i32, ptr %5, align 4, !tbaa !8
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds i32, ptr @sum, i64 %101
  %103 = getelementptr inbounds i32, ptr %102, i64 1
  %104 = load i32, ptr @n, align 4, !tbaa !8
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds i32, ptr @sum, i64 %105
  %107 = getelementptr inbounds i32, ptr %106, i64 1
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  %108 = load i32, ptr %5, align 4, !tbaa !8
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [5010 x i32], ptr @sum, i64 0, i64 %109
  %111 = load i32, ptr %110, align 4, !tbaa !8
  %112 = load i32, ptr %6, align 4, !tbaa !8
  %113 = add nsw i32 %111, %112
  store i32 %113, ptr %8, align 4, !tbaa !8
  %114 = call noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef %103, ptr noundef %107, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %115 = ptrtoint ptr %114 to i64
  %116 = sub i64 %115, ptrtoint (ptr @sum to i64)
  %117 = sdiv exact i64 %116, 4
  %118 = trunc i64 %117 to i32
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  store i32 %118, ptr %7, align 4, !tbaa !8
  %119 = load i32, ptr %5, align 4, !tbaa !8
  %120 = add nsw i32 %119, 1
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [5010 x [5010 x i32]], ptr @dp, i64 0, i64 %121
  %123 = load i32, ptr %7, align 4, !tbaa !8
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [5010 x i32], ptr %122, i64 0, i64 %124
  %126 = load i32, ptr %125, align 4, !tbaa !8
  %127 = load i32, ptr %5, align 4, !tbaa !8
  %128 = add nsw i32 %126, %127
  %129 = load i32, ptr %3, align 4, !tbaa !8
  %130 = sub nsw i32 %128, %129
  %131 = load i32, ptr %3, align 4, !tbaa !8
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [5010 x [5010 x i32]], ptr @dp, i64 0, i64 %132
  %134 = load i32, ptr %5, align 4, !tbaa !8
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [5010 x i32], ptr %133, i64 0, i64 %135
  store i32 %130, ptr %136, align 4, !tbaa !8
  %137 = load i32, ptr %3, align 4, !tbaa !8
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds [5010 x [5010 x i32]], ptr @dp, i64 0, i64 %138
  %140 = load i32, ptr %5, align 4, !tbaa !8
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds [5010 x i32], ptr %139, i64 0, i64 %141
  %143 = load i32, ptr %3, align 4, !tbaa !8
  %144 = sext i32 %143 to i64
  %145 = getelementptr inbounds [5010 x [5010 x i32]], ptr @dp, i64 0, i64 %144
  %146 = load i32, ptr %5, align 4, !tbaa !8
  %147 = add nsw i32 %146, 1
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds [5010 x i32], ptr %145, i64 0, i64 %148
  %150 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %142, ptr noundef nonnull align 4 dereferenceable(4) %149)
  %151 = load i32, ptr %150, align 4, !tbaa !8
  %152 = load i32, ptr %3, align 4, !tbaa !8
  %153 = sext i32 %152 to i64
  %154 = getelementptr inbounds [5010 x [5010 x i32]], ptr @dp, i64 0, i64 %153
  %155 = load i32, ptr %5, align 4, !tbaa !8
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds [5010 x i32], ptr %154, i64 0, i64 %156
  store i32 %151, ptr %157, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  store i32 0, ptr %4, align 4
  br label %158

158:                                              ; preds = %99, %89
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  %159 = load i32, ptr %4, align 4
  switch i32 %159, label %172 [
    i32 0, label %160
    i32 10, label %161
  ]

160:                                              ; preds = %158
  br label %161

161:                                              ; preds = %160, %158
  %162 = load i32, ptr %5, align 4, !tbaa !8
  %163 = add nsw i32 %162, -1
  store i32 %163, ptr %5, align 4, !tbaa !8
  br label %62, !llvm.loop !13

164:                                              ; preds = %66
  br label %165

165:                                              ; preds = %164
  %166 = load i32, ptr %3, align 4, !tbaa !8
  %167 = add nsw i32 %166, -1
  store i32 %167, ptr %3, align 4, !tbaa !8
  br label %46, !llvm.loop !14

168:                                              ; preds = %49
  %169 = load i32, ptr getelementptr inbounds ([5010 x i32], ptr getelementptr inbounds ([5010 x [5010 x i32]], ptr @dp, i64 0, i64 1), i64 0, i64 1), align 4, !tbaa !8
  %170 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %169)
  %171 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %170, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  ret i32 0

172:                                              ; preds = %158
  unreachable
}

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

; 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(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #1

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4)) #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #5

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #6 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 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 #1 = { "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 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #6 = { 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 #7 = { 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}


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

@dp = external dso_local global [5010 x [5010 x i32]], align 16
@sum = external dso_local global [5010 x i32], align 16
@n = external dso_local global i32, align 4
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %3 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %4 = getelementptr i8, ptr %3, i64 -24
  %5 = load i64, ptr %4, align 8
  %6 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %5
  %7 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %6, ptr noundef null)
  %8 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %9 = getelementptr i8, ptr %8, i64 -24
  %10 = load i64, ptr %9, align 8
  %11 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %10
  %12 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %11, ptr noundef null)
  %13 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %14 = load i32, ptr @n, align 4, !tbaa !8
  %.not39 = icmp slt i32 %14, 1
  br i1 %.not39, label %._crit_edge49, label %.lr.ph

.preheader:                                       ; preds = %.lr.ph
  %15 = icmp sgt i32 %24, 0
  br i1 %15, label %.lr.ph48.preheader, label %._crit_edge49

.lr.ph48.preheader:                               ; preds = %.preheader
  %16 = zext nneg i32 %24 to i64
  br label %.lr.ph48

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %0 ]
  %17 = getelementptr inbounds [5010 x i32], ptr @sum, i64 0, i64 %indvars.iv
  %18 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %17)
  %19 = add nsw i64 %indvars.iv, -1
  %20 = getelementptr inbounds [5010 x i32], ptr @sum, i64 0, i64 %19
  %21 = load i32, ptr %20, align 4, !tbaa !8
  %22 = load i32, ptr %17, align 4, !tbaa !8
  %23 = add nsw i32 %22, %21
  store i32 %23, ptr %17, align 4, !tbaa !8
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %24 = load i32, ptr @n, align 4, !tbaa !8
  %25 = sext i32 %24 to i64
  %.not.not = icmp slt i64 %indvars.iv, %25
  br i1 %.not.not, label %.lr.ph, label %.preheader, !llvm.loop !11

._crit_edge49:                                    ; preds = %._crit_edge, %0, %.preheader
  %26 = load i32, ptr getelementptr inbounds (i8, ptr @dp, i64 20044), align 4, !tbaa !8
  %27 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %26)
  %28 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %27, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  ret i32 0

.lr.ph48:                                         ; preds = %.lr.ph48.preheader, %._crit_edge
  %.pre55 = phi i32 [ %24, %.lr.ph48.preheader ], [ %.pre5557, %._crit_edge ]
  %29 = phi i32 [ %24, %.lr.ph48.preheader ], [ %36, %._crit_edge ]
  %indvars.iv52 = phi i64 [ %16, %.lr.ph48.preheader ], [ %34, %._crit_edge ]
  %30 = trunc nuw nsw i64 %indvars.iv52 to i32
  %31 = sub nsw i32 %29, %30
  %32 = sext i32 %29 to i64
  %33 = getelementptr inbounds [5010 x [5010 x i32]], ptr @dp, i64 0, i64 %indvars.iv52, i64 %32
  store i32 %31, ptr %33, align 4, !tbaa !8
  %.not38.not43 = icmp slt i64 %indvars.iv52, %32
  %34 = add nsw i64 %indvars.iv52, -1
  br i1 %.not38.not43, label %.lr.ph46, label %._crit_edge

.lr.ph46:                                         ; preds = %.lr.ph48
  %35 = getelementptr inbounds [5010 x i32], ptr @sum, i64 0, i64 %34
  br label %38

._crit_edge:                                      ; preds = %68, %.lr.ph48
  %.pre5557 = phi i32 [ %.pre55, %.lr.ph48 ], [ %.pre5559, %68 ]
  %36 = phi i32 [ %29, %.lr.ph48 ], [ %69, %68 ]
  %37 = icmp sgt i64 %indvars.iv52, 1
  br i1 %37, label %.lr.ph48, label %._crit_edge49, !llvm.loop !13

38:                                               ; preds = %.lr.ph46, %68
  %.pre5558 = phi i32 [ %.pre55, %.lr.ph46 ], [ %.pre5559, %68 ]
  %39 = phi i32 [ %.pre55, %.lr.ph46 ], [ %69, %68 ]
  %.035.in44 = phi i32 [ %29, %.lr.ph46 ], [ %.03545, %68 ]
  %.03545 = add nsw i32 %.035.in44, -1
  %40 = zext nneg i32 %.03545 to i64
  %41 = getelementptr inbounds [5010 x i32], ptr @sum, i64 0, i64 %40
  %42 = load i32, ptr %41, align 4, !tbaa !8
  %43 = load i32, ptr %35, align 4, !tbaa !8
  %44 = sub nsw i32 %42, %43
  %45 = sext i32 %39 to i64
  %46 = getelementptr inbounds [5010 x i32], ptr @sum, i64 0, i64 %45
  %47 = load i32, ptr %46, align 4, !tbaa !8
  %48 = sub nsw i32 %47, %42
  %49 = icmp sgt i32 %44, %48
  br i1 %49, label %50, label %53

50:                                               ; preds = %38
  %51 = sub nsw i32 %39, %30
  %52 = getelementptr inbounds [5010 x [5010 x i32]], ptr @dp, i64 0, i64 %indvars.iv52, i64 %40
  store i32 %51, ptr %52, align 4, !tbaa !8
  br label %68

53:                                               ; preds = %38
  %gep = getelementptr inbounds i32, ptr getelementptr inbounds (i8, ptr @sum, i64 4), i64 %40
  %gep41 = getelementptr i32, ptr getelementptr inbounds (i8, ptr @sum, i64 4), i64 %45
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  %54 = add nsw i32 %44, %42
  store i32 %54, ptr %1, align 4, !tbaa !8
  %55 = call noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef nonnull %gep, ptr noundef nonnull %gep41, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %56 = ptrtoint ptr %55 to i64
  %57 = sub i64 %56, ptrtoint (ptr @sum to i64)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  %58 = zext nneg i32 %.035.in44 to i64
  %sext = shl i64 %57, 30
  %59 = ashr i64 %sext, 32
  %60 = getelementptr inbounds [5010 x [5010 x i32]], ptr @dp, i64 0, i64 %58, i64 %59
  %61 = load i32, ptr %60, align 4, !tbaa !8
  %62 = sub i32 %.03545, %30
  %63 = add i32 %62, %61
  %64 = getelementptr inbounds [5010 x [5010 x i32]], ptr @dp, i64 0, i64 %indvars.iv52, i64 %40
  store i32 %63, ptr %64, align 4, !tbaa !8
  %65 = getelementptr inbounds [5010 x [5010 x i32]], ptr @dp, i64 0, i64 %indvars.iv52, i64 %58
  %66 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %64, ptr noundef nonnull align 4 dereferenceable(4) %65)
  %67 = load i32, ptr %66, align 4, !tbaa !8
  store i32 %67, ptr %64, align 4, !tbaa !8
  %.pre = load i32, ptr @n, align 4, !tbaa !8
  br label %68

68:                                               ; preds = %53, %50
  %.pre5559 = phi i32 [ %.pre, %53 ], [ %.pre5558, %50 ]
  %69 = phi i32 [ %.pre, %53 ], [ %39, %50 ]
  %70 = sext i32 %.03545 to i64
  %.not38.not = icmp slt i64 %indvars.iv52, %70
  br i1 %.not38.not, label %38, label %._crit_edge, !llvm.loop !14
}

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

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #5

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

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


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