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

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

@n = external dso_local global i32, align 4
@h = external dso_local global [5010 x i32], align 16
@dp = external dso_local global [5010 x [5010 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 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
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %15 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %16 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %17 = getelementptr i8, ptr %16, i64 -24
  %18 = load i64, ptr %17, align 8
  %19 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %18
  %20 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %19, ptr noundef null)
  %21 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %22 = getelementptr i8, ptr %21, i64 -24
  %23 = load i64, ptr %22, align 8
  %24 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %23
  %25 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %24, ptr noundef null)
  %26 = 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 %27

27:                                               ; preds = %37, %0
  %28 = load i32, ptr %2, align 4, !tbaa !8
  %29 = load i32, ptr @n, align 4, !tbaa !8
  %30 = icmp sle i32 %28, %29
  br i1 %30, label %32, label %31

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

32:                                               ; preds = %27
  %33 = load i32, ptr %2, align 4, !tbaa !8
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [5010 x i32], ptr @h, i64 0, i64 %34
  %36 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %35)
  br label %37

37:                                               ; preds = %32
  %38 = load i32, ptr %2, align 4, !tbaa !8
  %39 = add nsw i32 %38, 1
  store i32 %39, ptr %2, align 4, !tbaa !8
  br label %27, !llvm.loop !11

40:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  store i32 1, ptr %3, align 4, !tbaa !8
  br label %41

41:                                               ; preds = %63, %40
  %42 = load i32, ptr %3, align 4, !tbaa !8
  %43 = load i32, ptr @n, align 4, !tbaa !8
  %44 = icmp sle i32 %42, %43
  br i1 %44, label %46, label %45

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

46:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  store i32 1, ptr %5, align 4, !tbaa !8
  br label %47

47:                                               ; preds = %59, %46
  %48 = load i32, ptr %5, align 4, !tbaa !8
  %49 = load i32, ptr @n, align 4, !tbaa !8
  %50 = icmp sle i32 %48, %49
  br i1 %50, label %52, label %51

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

52:                                               ; preds = %47
  %53 = load i32, ptr %3, align 4, !tbaa !8
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [5010 x [5010 x i32]], ptr @dp, i64 0, i64 %54
  %56 = load i32, ptr %5, align 4, !tbaa !8
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [5010 x i32], ptr %55, i64 0, i64 %57
  store i32 1000000000, ptr %58, align 4, !tbaa !8
  br label %59

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

62:                                               ; preds = %51
  br label %63

63:                                               ; preds = %62
  %64 = load i32, ptr %3, align 4, !tbaa !8
  %65 = add nsw i32 %64, 1
  store i32 %65, ptr %3, align 4, !tbaa !8
  br label %41, !llvm.loop !14

66:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  store i32 0, ptr %6, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  store i32 1, ptr %7, align 4, !tbaa !8
  br label %67

67:                                               ; preds = %84, %66
  %68 = load i32, ptr %7, align 4, !tbaa !8
  %69 = load i32, ptr @n, align 4, !tbaa !8
  %70 = icmp sle i32 %68, %69
  br i1 %70, label %72, label %71

71:                                               ; preds = %67
  store i32 11, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %87

72:                                               ; preds = %67
  %73 = load i32, ptr %7, align 4, !tbaa !8
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [5010 x i32], ptr @h, i64 0, i64 %74
  %76 = load i32, ptr %75, align 4, !tbaa !8
  %77 = load i32, ptr %6, align 4, !tbaa !8
  %78 = add nsw i32 %77, %76
  store i32 %78, ptr %6, align 4, !tbaa !8
  %79 = load i32, ptr %6, align 4, !tbaa !8
  %80 = load i32, ptr %7, align 4, !tbaa !8
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [5010 x [5010 x i32]], ptr @dp, i64 0, i64 %81
  %83 = getelementptr inbounds [5010 x i32], ptr %82, i64 0, i64 1
  store i32 %79, ptr %83, align 4, !tbaa !8
  br label %84

84:                                               ; preds = %72
  %85 = load i32, ptr %7, align 4, !tbaa !8
  %86 = add nsw i32 %85, 1
  store i32 %86, ptr %7, align 4, !tbaa !8
  br label %67, !llvm.loop !15

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

88:                                               ; preds = %202, %87
  %89 = load i32, ptr %8, align 4, !tbaa !8
  %90 = load i32, ptr @n, align 4, !tbaa !8
  %91 = icmp sle i32 %89, %90
  br i1 %91, label %93, label %92

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

93:                                               ; preds = %88
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  %94 = load i32, ptr %8, align 4, !tbaa !8
  %95 = sub nsw i32 %94, 1
  store i32 %95, ptr %9, align 4, !tbaa !8
  br label %96

96:                                               ; preds = %122, %93
  %97 = load i32, ptr %9, align 4, !tbaa !8
  %98 = icmp sge i32 %97, 1
  br i1 %98, label %100, label %99

99:                                               ; preds = %96
  store i32 17, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %125

100:                                              ; preds = %96
  %101 = load i32, ptr %8, align 4, !tbaa !8
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [5010 x [5010 x i32]], ptr @dp, i64 0, i64 %102
  %104 = load i32, ptr %9, align 4, !tbaa !8
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [5010 x i32], ptr %103, i64 0, i64 %105
  %107 = load i32, ptr %8, align 4, !tbaa !8
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [5010 x [5010 x i32]], ptr @dp, i64 0, i64 %108
  %110 = load i32, ptr %9, align 4, !tbaa !8
  %111 = add nsw i32 %110, 1
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [5010 x i32], ptr %109, i64 0, i64 %112
  %114 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %106, ptr noundef nonnull align 4 dereferenceable(4) %113)
  %115 = load i32, ptr %114, align 4, !tbaa !8
  %116 = load i32, ptr %8, align 4, !tbaa !8
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [5010 x [5010 x i32]], ptr @dp, i64 0, i64 %117
  %119 = load i32, ptr %9, align 4, !tbaa !8
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [5010 x i32], ptr %118, i64 0, i64 %120
  store i32 %115, ptr %121, align 4, !tbaa !8
  br label %122

122:                                              ; preds = %100
  %123 = load i32, ptr %9, align 4, !tbaa !8
  %124 = add nsw i32 %123, -1
  store i32 %124, ptr %9, align 4, !tbaa !8
  br label %96, !llvm.loop !16

125:                                              ; preds = %99
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  store i32 0, ptr %10, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  %126 = load i32, ptr %8, align 4, !tbaa !8
  %127 = add nsw i32 %126, 1
  store i32 %127, ptr %11, align 4, !tbaa !8
  br label %128

128:                                              ; preds = %140, %125
  %129 = load i32, ptr %11, align 4, !tbaa !8
  %130 = load i32, ptr @n, align 4, !tbaa !8
  %131 = icmp sle i32 %129, %130
  br i1 %131, label %133, label %132

132:                                              ; preds = %128
  store i32 20, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %143

133:                                              ; preds = %128
  %134 = load i32, ptr %11, align 4, !tbaa !8
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [5010 x i32], ptr @h, i64 0, i64 %135
  %137 = load i32, ptr %136, align 4, !tbaa !8
  %138 = load i32, ptr %10, align 4, !tbaa !8
  %139 = add nsw i32 %138, %137
  store i32 %139, ptr %10, align 4, !tbaa !8
  br label %140

140:                                              ; preds = %133
  %141 = load i32, ptr %11, align 4, !tbaa !8
  %142 = add nsw i32 %141, 1
  store i32 %142, ptr %11, align 4, !tbaa !8
  br label %128, !llvm.loop !17

143:                                              ; preds = %132
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  %144 = load i32, ptr %8, align 4, !tbaa !8
  store i32 %144, ptr %12, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  %145 = load i32, ptr @n, align 4, !tbaa !8
  store i32 %145, ptr %13, align 4, !tbaa !8
  br label %146

146:                                              ; preds = %197, %143
  %147 = load i32, ptr %13, align 4, !tbaa !8
  %148 = load i32, ptr %8, align 4, !tbaa !8
  %149 = icmp sgt i32 %147, %148
  br i1 %149, label %151, label %150

150:                                              ; preds = %146
  store i32 23, ptr %4, align 4
  br label %200

151:                                              ; preds = %146
  br label %152

152:                                              ; preds = %167, %151
  %153 = load i32, ptr %12, align 4, !tbaa !8
  %154 = icmp sgt i32 %153, 0
  br i1 %154, label %155, label %165

155:                                              ; preds = %152
  %156 = load i32, ptr %8, align 4, !tbaa !8
  %157 = sext i32 %156 to i64
  %158 = getelementptr inbounds [5010 x [5010 x i32]], ptr @dp, i64 0, i64 %157
  %159 = load i32, ptr %12, align 4, !tbaa !8
  %160 = sext i32 %159 to i64
  %161 = getelementptr inbounds [5010 x i32], ptr %158, i64 0, i64 %160
  %162 = load i32, ptr %161, align 4, !tbaa !8
  %163 = load i32, ptr %10, align 4, !tbaa !8
  %164 = icmp sgt i32 %162, %163
  br label %165

165:                                              ; preds = %155, %152
  %166 = phi i1 [ false, %152 ], [ %164, %155 ]
  br i1 %166, label %167, label %170

167:                                              ; preds = %165
  %168 = load i32, ptr %12, align 4, !tbaa !8
  %169 = add nsw i32 %168, -1
  store i32 %169, ptr %12, align 4, !tbaa !8
  br label %152, !llvm.loop !18

170:                                              ; preds = %165
  %171 = load i32, ptr %12, align 4, !tbaa !8
  %172 = icmp eq i32 %171, 0
  br i1 %172, label %173, label %174

173:                                              ; preds = %170
  store i32 23, ptr %4, align 4
  br label %200

174:                                              ; preds = %170
  %175 = load i32, ptr %13, align 4, !tbaa !8
  %176 = sext i32 %175 to i64
  %177 = getelementptr inbounds [5010 x [5010 x i32]], ptr @dp, i64 0, i64 %176
  %178 = load i32, ptr %12, align 4, !tbaa !8
  %179 = add nsw i32 %178, 1
  %180 = sext i32 %179 to i64
  %181 = getelementptr inbounds [5010 x i32], ptr %177, i64 0, i64 %180
  %182 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %181, ptr noundef nonnull align 4 dereferenceable(4) %10)
  %183 = load i32, ptr %182, align 4, !tbaa !8
  %184 = load i32, ptr %13, align 4, !tbaa !8
  %185 = sext i32 %184 to i64
  %186 = getelementptr inbounds [5010 x [5010 x i32]], ptr @dp, i64 0, i64 %185
  %187 = load i32, ptr %12, align 4, !tbaa !8
  %188 = add nsw i32 %187, 1
  %189 = sext i32 %188 to i64
  %190 = getelementptr inbounds [5010 x i32], ptr %186, i64 0, i64 %189
  store i32 %183, ptr %190, align 4, !tbaa !8
  %191 = load i32, ptr %13, align 4, !tbaa !8
  %192 = sext i32 %191 to i64
  %193 = getelementptr inbounds [5010 x i32], ptr @h, i64 0, i64 %192
  %194 = load i32, ptr %193, align 4, !tbaa !8
  %195 = load i32, ptr %10, align 4, !tbaa !8
  %196 = sub nsw i32 %195, %194
  store i32 %196, ptr %10, align 4, !tbaa !8
  br label %197

197:                                              ; preds = %174
  %198 = load i32, ptr %13, align 4, !tbaa !8
  %199 = add nsw i32 %198, -1
  store i32 %199, ptr %13, align 4, !tbaa !8
  br label %146, !llvm.loop !19

200:                                              ; preds = %173, %150
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  br label %201

201:                                              ; preds = %200
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  br label %202

202:                                              ; preds = %201
  %203 = load i32, ptr %8, align 4, !tbaa !8
  %204 = add nsw i32 %203, 1
  store i32 %204, ptr %8, align 4, !tbaa !8
  br label %88, !llvm.loop !20

205:                                              ; preds = %92
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  %206 = load i32, ptr @n, align 4, !tbaa !8
  store i32 %206, ptr %14, align 4, !tbaa !8
  br label %207

207:                                              ; preds = %221, %205
  %208 = load i32, ptr %14, align 4, !tbaa !8
  %209 = icmp sge i32 %208, 1
  br i1 %209, label %210, label %219

210:                                              ; preds = %207
  %211 = load i32, ptr @n, align 4, !tbaa !8
  %212 = sext i32 %211 to i64
  %213 = getelementptr inbounds [5010 x [5010 x i32]], ptr @dp, i64 0, i64 %212
  %214 = load i32, ptr %14, align 4, !tbaa !8
  %215 = sext i32 %214 to i64
  %216 = getelementptr inbounds [5010 x i32], ptr %213, i64 0, i64 %215
  %217 = load i32, ptr %216, align 4, !tbaa !8
  %218 = icmp eq i32 %217, 1000000000
  br label %219

219:                                              ; preds = %210, %207
  %220 = phi i1 [ false, %207 ], [ %218, %210 ]
  br i1 %220, label %221, label %224

221:                                              ; preds = %219
  %222 = load i32, ptr %14, align 4, !tbaa !8
  %223 = add nsw i32 %222, -1
  store i32 %223, ptr %14, align 4, !tbaa !8
  br label %207, !llvm.loop !21

224:                                              ; preds = %219
  %225 = load i32, ptr @n, align 4, !tbaa !8
  %226 = load i32, ptr %14, align 4, !tbaa !8
  %227 = sub nsw i32 %225, %226
  %228 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %227)
  %229 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %228, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  %230 = load i32, ptr %1, align 4
  ret i32 %230
}

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

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

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 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 #5 = { 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 = { 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 #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}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !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" }

@n = external dso_local global i32, align 4
@h = external dso_local global [5010 x i32], align 16
@dp = external dso_local global [5010 x [5010 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 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
  %.not79 = icmp slt i32 %14, 1
  br i1 %.not79, label %.preheader71..preheader_crit_edge, label %.lr.ph

.preheader74:                                     ; preds = %.lr.ph
  %.not6384 = icmp slt i32 %19, 1
  br i1 %.not6384, label %.preheader71..preheader_crit_edge, label %.preheader73.preheader

.preheader73.preheader:                           ; preds = %.preheader74
  %15 = add nuw i32 %19, 1
  %wide.trip.count124 = zext i32 %15 to i64
  %16 = zext nneg i32 %19 to i64
  %min.iters.check = icmp ult i32 %19, 8
  %n.vec = and i64 %16, 2147483640
  %ind.end = or disjoint i64 %n.vec, 1
  %cmp.n = icmp eq i64 %n.vec, %16
  br label %.preheader73

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %0 ]
  %17 = getelementptr inbounds [5010 x i32], ptr @h, 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)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %19 = load i32, ptr @n, align 4, !tbaa !8
  %20 = sext i32 %19 to i64
  %.not.not = icmp slt i64 %indvars.iv, %20
  br i1 %.not.not, label %.lr.ph, label %.preheader74, !llvm.loop !11

.preheader73:                                     ; preds = %.preheader73.preheader, %._crit_edge
  %indvars.iv121 = phi i64 [ 1, %.preheader73.preheader ], [ %indvars.iv.next122, %._crit_edge ]
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.body

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

vector.body:                                      ; preds = %.preheader73, %vector.body
  %index = phi i64 [ %index.next, %vector.body ], [ 0, %.preheader73 ]
  %offset.idx = or disjoint i64 %index, 1
  %21 = getelementptr inbounds [5010 x [5010 x i32]], ptr @dp, i64 0, i64 %indvars.iv121, i64 %offset.idx
  %22 = getelementptr inbounds i8, ptr %21, i64 16
  store <4 x i32> <i32 1000000000, i32 1000000000, i32 1000000000, i32 1000000000>, ptr %21, align 4, !tbaa !8
  store <4 x i32> <i32 1000000000, i32 1000000000, i32 1000000000, i32 1000000000>, ptr %22, align 4, !tbaa !8
  %index.next = add nuw i64 %index, 8
  %23 = icmp eq i64 %index.next, %n.vec
  br i1 %23, label %middle.block, label %vector.body, !llvm.loop !13

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

.preheader72:                                     ; preds = %._crit_edge
  br i1 %.not6384, label %.preheader71..preheader_crit_edge, label %.lr.ph89.preheader

.lr.ph89.preheader:                               ; preds = %.preheader72
  %24 = zext nneg i32 %19 to i64
  %25 = add nsw i64 %wide.trip.count124, -2
  %xtraiter = and i64 %24, 3
  %26 = icmp ult i64 %25, 3
  br i1 %26, label %.preheader71.unr-lcssa, label %.lr.ph89.preheader.new

.lr.ph89.preheader.new:                           ; preds = %.lr.ph89.preheader
  %unroll_iter = and i64 %24, 2147483644
  br label %.lr.ph89

._crit_edge:                                      ; preds = %scalar.ph, %middle.block
  %indvars.iv.next122 = add nuw nsw i64 %indvars.iv121, 1
  %exitcond125.not = icmp eq i64 %indvars.iv.next122, %wide.trip.count124
  br i1 %exitcond125.not, label %.preheader72, label %.preheader73, !llvm.loop !16

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv118 = phi i64 [ %indvars.iv.next119, %scalar.ph ], [ %indvars.iv118.ph, %scalar.ph.preheader ]
  %27 = getelementptr inbounds [5010 x [5010 x i32]], ptr @dp, i64 0, i64 %indvars.iv121, i64 %indvars.iv118
  store i32 1000000000, ptr %27, align 4, !tbaa !8
  %indvars.iv.next119 = add nuw nsw i64 %indvars.iv118, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next119, %wide.trip.count124
  br i1 %exitcond.not, label %._crit_edge, label %scalar.ph, !llvm.loop !17

.preheader71.unr-lcssa:                           ; preds = %.lr.ph89, %.lr.ph89.preheader
  %indvars.iv126.unr = phi i64 [ 1, %.lr.ph89.preheader ], [ %indvars.iv.next127.3, %.lr.ph89 ]
  %.05787.unr = phi i32 [ 0, %.lr.ph89.preheader ], [ %47, %.lr.ph89 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader71, label %.lr.ph89.epil

.lr.ph89.epil:                                    ; preds = %.preheader71.unr-lcssa, %.lr.ph89.epil
  %indvars.iv126.epil = phi i64 [ %indvars.iv.next127.epil, %.lr.ph89.epil ], [ %indvars.iv126.unr, %.preheader71.unr-lcssa ]
  %.05787.epil = phi i32 [ %30, %.lr.ph89.epil ], [ %.05787.unr, %.preheader71.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph89.epil ], [ 0, %.preheader71.unr-lcssa ]
  %28 = getelementptr inbounds [5010 x i32], ptr @h, i64 0, i64 %indvars.iv126.epil
  %29 = load i32, ptr %28, align 4, !tbaa !8
  %30 = add nsw i32 %29, %.05787.epil
  %31 = getelementptr inbounds [5010 x [5010 x i32]], ptr @dp, i64 0, i64 %indvars.iv126.epil, i64 1
  store i32 %30, ptr %31, align 4, !tbaa !8
  %indvars.iv.next127.epil = add nuw nsw i64 %indvars.iv126.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %.preheader71, label %.lr.ph89.epil, !llvm.loop !18

.preheader71:                                     ; preds = %.lr.ph89.epil, %.preheader71.unr-lcssa
  br i1 %.not6384, label %.preheader71..preheader_crit_edge, label %.preheader70

.preheader71..preheader_crit_edge:                ; preds = %0, %.preheader74, %.preheader72, %.preheader71
  %32 = phi i32 [ %19, %.preheader71 ], [ %19, %.preheader72 ], [ %19, %.preheader74 ], [ %14, %0 ]
  %.pre151 = sext i32 %32 to i64
  br label %.preheader

.lr.ph89:                                         ; preds = %.lr.ph89, %.lr.ph89.preheader.new
  %indvars.iv126 = phi i64 [ 1, %.lr.ph89.preheader.new ], [ %indvars.iv.next127.3, %.lr.ph89 ]
  %.05787 = phi i32 [ 0, %.lr.ph89.preheader.new ], [ %47, %.lr.ph89 ]
  %niter = phi i64 [ 0, %.lr.ph89.preheader.new ], [ %niter.next.3, %.lr.ph89 ]
  %33 = getelementptr inbounds [5010 x i32], ptr @h, i64 0, i64 %indvars.iv126
  %34 = load i32, ptr %33, align 4, !tbaa !8
  %35 = add nsw i32 %34, %.05787
  %36 = getelementptr inbounds [5010 x [5010 x i32]], ptr @dp, i64 0, i64 %indvars.iv126, i64 1
  store i32 %35, ptr %36, align 4, !tbaa !8
  %indvars.iv.next127 = add nuw nsw i64 %indvars.iv126, 1
  %37 = getelementptr inbounds [5010 x i32], ptr @h, i64 0, i64 %indvars.iv.next127
  %38 = load i32, ptr %37, align 4, !tbaa !8
  %39 = add nsw i32 %38, %35
  %40 = getelementptr inbounds [5010 x [5010 x i32]], ptr @dp, i64 0, i64 %indvars.iv.next127, i64 1
  store i32 %39, ptr %40, align 4, !tbaa !8
  %indvars.iv.next127.1 = add nuw nsw i64 %indvars.iv126, 2
  %41 = getelementptr inbounds [5010 x i32], ptr @h, i64 0, i64 %indvars.iv.next127.1
  %42 = load i32, ptr %41, align 4, !tbaa !8
  %43 = add nsw i32 %42, %39
  %44 = getelementptr inbounds [5010 x [5010 x i32]], ptr @dp, i64 0, i64 %indvars.iv.next127.1, i64 1
  store i32 %43, ptr %44, align 4, !tbaa !8
  %indvars.iv.next127.2 = add nuw nsw i64 %indvars.iv126, 3
  %45 = getelementptr inbounds [5010 x i32], ptr @h, i64 0, i64 %indvars.iv.next127.2
  %46 = load i32, ptr %45, align 4, !tbaa !8
  %47 = add nsw i32 %46, %43
  %48 = getelementptr inbounds [5010 x [5010 x i32]], ptr @dp, i64 0, i64 %indvars.iv.next127.2, i64 1
  store i32 %47, ptr %48, align 4, !tbaa !8
  %indvars.iv.next127.3 = add nuw nsw i64 %indvars.iv126, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %.preheader71.unr-lcssa, label %.lr.ph89, !llvm.loop !20

.preheader70:                                     ; preds = %.preheader71, %.critedge._crit_edge
  %indvar = phi i32 [ %indvar.next, %.critedge._crit_edge ], [ 0, %.preheader71 ]
  %49 = phi i32 [ %95, %.critedge._crit_edge ], [ %19, %.preheader71 ]
  %indvars.iv136 = phi i64 [ %indvars.iv.next137, %.critedge._crit_edge ], [ 2, %.preheader71 ]
  %indvars.iv131 = phi i64 [ %indvars.iv.next132, %.critedge._crit_edge ], [ 1, %.preheader71 ]
  %50 = icmp ugt i64 %indvars.iv131, 1
  br i1 %50, label %.lr.ph91, label %._crit_edge92

.preheader:                                       ; preds = %.critedge._crit_edge, %.preheader71..preheader_crit_edge
  %.pre-phi152 = phi i64 [ %.pre151, %.preheader71..preheader_crit_edge ], [ %.pre-phi, %.critedge._crit_edge ]
  %.lcssa77 = phi i32 [ %32, %.preheader71..preheader_crit_edge ], [ %95, %.critedge._crit_edge ]
  %51 = icmp sgt i32 %.lcssa77, 0
  br i1 %51, label %.lr.ph109, label %.critedge2

._crit_edge92.loopexit:                           ; preds = %.lr.ph91
  %.pre = load i32, ptr @n, align 4, !tbaa !8
  br label %._crit_edge92

._crit_edge92:                                    ; preds = %._crit_edge92.loopexit, %.preheader70
  %52 = phi i32 [ %.pre, %._crit_edge92.loopexit ], [ %49, %.preheader70 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #8
  %indvars.iv.next132 = add nuw nsw i64 %indvars.iv131, 1
  %53 = sext i32 %52 to i64
  %.not6693.not = icmp slt i64 %indvars.iv131, %53
  br i1 %.not6693.not, label %.lr.ph96.preheader, label %.critedge._crit_edge

.lr.ph96.preheader:                               ; preds = %._crit_edge92
  %54 = add i32 %52, 1
  %reass.sub = sub i32 %52, %indvar
  %55 = add i32 %reass.sub, -2
  %56 = zext i32 %55 to i64
  %57 = add nuw nsw i64 %56, 1
  %min.iters.check171 = icmp ult i32 %55, 7
  br i1 %min.iters.check171, label %.lr.ph96.preheader185, label %vector.ph172

.lr.ph96.preheader185:                            ; preds = %middle.block169, %.lr.ph96.preheader
  %indvars.iv138.ph = phi i64 [ %indvars.iv136, %.lr.ph96.preheader ], [ %ind.end175, %middle.block169 ]
  %.ph = phi i32 [ 0, %.lr.ph96.preheader ], [ %63, %middle.block169 ]
  br label %.lr.ph96

vector.ph172:                                     ; preds = %.lr.ph96.preheader
  %n.vec174 = and i64 %57, 8589934584
  %ind.end175 = add nuw i64 %indvars.iv136, %n.vec174
  br label %vector.body177

vector.body177:                                   ; preds = %vector.body177, %vector.ph172
  %index178 = phi i64 [ 0, %vector.ph172 ], [ %index.next182, %vector.body177 ]
  %vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph172 ], [ %60, %vector.body177 ]
  %vec.phi179 = phi <4 x i32> [ zeroinitializer, %vector.ph172 ], [ %61, %vector.body177 ]
  %offset.idx180 = add i64 %indvars.iv136, %index178
  %58 = getelementptr inbounds [5010 x i32], ptr @h, i64 0, i64 %offset.idx180
  %59 = getelementptr inbounds i8, ptr %58, i64 16
  %wide.load = load <4 x i32>, ptr %58, align 4, !tbaa !8
  %wide.load181 = load <4 x i32>, ptr %59, align 4, !tbaa !8
  %60 = add <4 x i32> %vec.phi, %wide.load
  %61 = add <4 x i32> %vec.phi179, %wide.load181
  %index.next182 = add nuw i64 %index178, 8
  %62 = icmp eq i64 %index.next182, %n.vec174
  br i1 %62, label %middle.block169, label %vector.body177, !llvm.loop !21

middle.block169:                                  ; preds = %vector.body177
  %bin.rdx = add <4 x i32> %61, %60
  %63 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
  %cmp.n183 = icmp eq i64 %57, %n.vec174
  br i1 %cmp.n183, label %.preheader69, label %.lr.ph96.preheader185

.lr.ph91:                                         ; preds = %.preheader70, %.lr.ph91
  %indvars.iv133 = phi i64 [ %indvars.iv.next134, %.lr.ph91 ], [ %indvars.iv131, %.preheader70 ]
  %indvars.iv.next134 = add nsw i64 %indvars.iv133, -1
  %64 = and i64 %indvars.iv.next134, 4294967295
  %65 = getelementptr inbounds [5010 x [5010 x i32]], ptr @dp, i64 0, i64 %indvars.iv131, i64 %64
  %66 = getelementptr inbounds [5010 x [5010 x i32]], ptr @dp, i64 0, i64 %indvars.iv131, i64 %indvars.iv133
  %67 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %65, ptr noundef nonnull align 4 dereferenceable(4) %66)
  %68 = load i32, ptr %67, align 4, !tbaa !8
  store i32 %68, ptr %65, align 4, !tbaa !8
  %69 = icmp sgt i64 %indvars.iv133, 2
  br i1 %69, label %.lr.ph91, label %._crit_edge92.loopexit, !llvm.loop !22

.preheader69:                                     ; preds = %.lr.ph96, %middle.block169
  %.lcssa = phi i32 [ %63, %middle.block169 ], [ %74, %.lr.ph96 ]
  store i32 %.lcssa, ptr %1, align 4, !tbaa !8
  br i1 %.not6693.not, label %.preheader68.lr.ph, label %.critedge._crit_edge

.preheader68.lr.ph:                               ; preds = %.preheader69
  %70 = trunc nuw nsw i64 %indvars.iv131 to i32
  br label %.preheader68

.lr.ph96:                                         ; preds = %.lr.ph96.preheader185, %.lr.ph96
  %indvars.iv138 = phi i64 [ %indvars.iv.next139, %.lr.ph96 ], [ %indvars.iv138.ph, %.lr.ph96.preheader185 ]
  %71 = phi i32 [ %74, %.lr.ph96 ], [ %.ph, %.lr.ph96.preheader185 ]
  %72 = getelementptr inbounds [5010 x i32], ptr @h, i64 0, i64 %indvars.iv138
  %73 = load i32, ptr %72, align 4, !tbaa !8
  %74 = add nsw i32 %71, %73
  %indvars.iv.next139 = add nuw nsw i64 %indvars.iv138, 1
  %lftr.wideiv = trunc i64 %indvars.iv.next139 to i32
  %exitcond142.not = icmp eq i32 %54, %lftr.wideiv
  br i1 %exitcond142.not, label %.preheader69, label %.lr.ph96, !llvm.loop !23

.preheader68:                                     ; preds = %.preheader68.lr.ph, %.critedge.thread
  %75 = phi i32 [ %.lcssa, %.preheader68.lr.ph ], [ %93, %.critedge.thread ]
  %indvars.iv143 = phi i64 [ %53, %.preheader68.lr.ph ], [ %indvars.iv.next144, %.critedge.thread ]
  %.052102 = phi i32 [ %70, %.preheader68.lr.ph ], [ %.176, %.critedge.thread ]
  %76 = icmp sgt i32 %.052102, 0
  br i1 %76, label %.lr.ph100, label %.critedge

.lr.ph100:                                        ; preds = %.preheader68, %81
  %.199 = phi i32 [ %82, %81 ], [ %.052102, %.preheader68 ]
  %77 = zext nneg i32 %.199 to i64
  %78 = getelementptr inbounds [5010 x [5010 x i32]], ptr @dp, i64 0, i64 %indvars.iv131, i64 %77
  %79 = load i32, ptr %78, align 4, !tbaa !8
  %80 = icmp sgt i32 %79, %75
  br i1 %80, label %81, label %.critedge.thread

81:                                               ; preds = %.lr.ph100
  %82 = add nsw i32 %.199, -1
  %83 = icmp sgt i32 %.199, 1
  br i1 %83, label %.lr.ph100, label %.critedge._crit_edge.loopexit, !llvm.loop !24

.critedge:                                        ; preds = %.preheader68
  %84 = icmp eq i32 %.052102, 0
  br i1 %84, label %.critedge._crit_edge.loopexit, label %.critedge.thread

.critedge.thread:                                 ; preds = %.lr.ph100, %.critedge
  %.176 = phi i32 [ %.052102, %.critedge ], [ %.199, %.lr.ph100 ]
  %85 = add nsw i32 %.176, 1
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [5010 x [5010 x i32]], ptr @dp, i64 0, i64 %indvars.iv143, i64 %86
  %88 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %87, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %89 = load i32, ptr %88, align 4, !tbaa !8
  store i32 %89, ptr %87, align 4, !tbaa !8
  %90 = getelementptr inbounds [5010 x i32], ptr @h, i64 0, i64 %indvars.iv143
  %91 = load i32, ptr %90, align 4, !tbaa !8
  %92 = load i32, ptr %1, align 4, !tbaa !8
  %93 = sub nsw i32 %92, %91
  store i32 %93, ptr %1, align 4, !tbaa !8
  %indvars.iv.next144 = add nsw i64 %indvars.iv143, -1
  %94 = icmp sgt i64 %indvars.iv.next144, %indvars.iv131
  br i1 %94, label %.preheader68, label %.critedge._crit_edge.loopexit, !llvm.loop !25

.critedge._crit_edge.loopexit:                    ; preds = %.critedge, %.critedge.thread, %81
  %.pre149 = load i32, ptr @n, align 4, !tbaa !8
  %.pre150 = sext i32 %.pre149 to i64
  br label %.critedge._crit_edge

.critedge._crit_edge:                             ; preds = %._crit_edge92, %.critedge._crit_edge.loopexit, %.preheader69
  %.pre-phi = phi i64 [ %.pre150, %.critedge._crit_edge.loopexit ], [ %53, %.preheader69 ], [ %53, %._crit_edge92 ]
  %95 = phi i32 [ %.pre149, %.critedge._crit_edge.loopexit ], [ %52, %.preheader69 ], [ %52, %._crit_edge92 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #8
  %.not65.not = icmp slt i64 %indvars.iv131, %.pre-phi
  %indvars.iv.next137 = add nuw nsw i64 %indvars.iv136, 1
  %indvar.next = add i32 %indvar, 1
  br i1 %.not65.not, label %.preheader70, label %.preheader, !llvm.loop !26

.lr.ph109:                                        ; preds = %.preheader, %100
  %.0108 = phi i32 [ %101, %100 ], [ %.lcssa77, %.preheader ]
  %96 = zext nneg i32 %.0108 to i64
  %97 = getelementptr inbounds [5010 x [5010 x i32]], ptr @dp, i64 0, i64 %.pre-phi152, i64 %96
  %98 = load i32, ptr %97, align 4, !tbaa !8
  %99 = icmp eq i32 %98, 1000000000
  br i1 %99, label %100, label %.critedge2

100:                                              ; preds = %.lr.ph109
  %101 = add nsw i32 %.0108, -1
  %102 = icmp sgt i32 %.0108, 1
  br i1 %102, label %.lr.ph109, label %.critedge2, !llvm.loop !27

.critedge2:                                       ; preds = %.lr.ph109, %100, %.preheader
  %.0.lcssa = phi i32 [ %.lcssa77, %.preheader ], [ 0, %100 ], [ %.0108, %.lr.ph109 ]
  %103 = sub nsw i32 %.lcssa77, %.0.lcssa
  %104 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %103)
  %105 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %104, 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 #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 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 #4

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #7

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 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 #5 = { 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 = { 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 #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { 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, !15}
!14 = !{!"llvm.loop.isvectorized", i32 1}
!15 = !{!"llvm.loop.unroll.runtime.disable"}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12, !15, !14}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.unroll.disable"}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !12, !14, !15}
!22 = distinct !{!22, !12}
!23 = distinct !{!23, !12, !15, !14}
!24 = distinct !{!24, !12}
!25 = distinct !{!25, !12}
!26 = distinct !{!26, !12}
!27 = distinct !{!27, !12}


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