; LLVM IR from eyangch/competitive-programming :: Codeforces/1393 (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::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"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 i64, align 8
@M = external dso_local global i64, align 8
@dp = external dso_local global [2000 x [2000 x i64]], align 16
@vert = external dso_local global [2000 x [2000 x i64]], align 16
@_Z1sB5cxx11 = external dso_local global [2000 x %"class.std::__cxx11::basic_string"], 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 zeroext i1 @_Z2okxxx(i64 noundef, i64 noundef, i64 noundef) #0

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

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

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

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

23:                                               ; preds = %32, %0
  %24 = load i64, ptr %2, align 8, !tbaa !8
  %25 = load i64, ptr @N, align 8, !tbaa !8
  %26 = icmp slt i64 %24, %25
  br i1 %26, label %28, label %27

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

28:                                               ; preds = %23
  %29 = load i64, ptr %2, align 8, !tbaa !8
  %30 = getelementptr inbounds [2000 x %"class.std::__cxx11::basic_string"], ptr @_Z1sB5cxx11, i64 0, i64 %29
  %31 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(32) %30)
  br label %32

32:                                               ; preds = %28
  %33 = load i64, ptr %2, align 8, !tbaa !8
  %34 = add nsw i64 %33, 1
  store i64 %34, ptr %2, align 8, !tbaa !8
  br label %23, !llvm.loop !11

35:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #7
  store i64 0, ptr %3, align 8, !tbaa !8
  br label %36

36:                                               ; preds = %120, %35
  %37 = load i64, ptr %3, align 8, !tbaa !8
  %38 = load i64, ptr @N, align 8, !tbaa !8
  %39 = icmp slt i64 %37, %38
  br i1 %39, label %41, label %40

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

41:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  store i64 0, ptr %5, align 8, !tbaa !8
  br label %42

42:                                               ; preds = %116, %41
  %43 = load i64, ptr %5, align 8, !tbaa !8
  %44 = load i64, ptr @M, align 8, !tbaa !8
  %45 = icmp slt i64 %43, %44
  br i1 %45, label %47, label %46

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

47:                                               ; preds = %42
  %48 = load i64, ptr %3, align 8, !tbaa !8
  %49 = icmp eq i64 %48, 0
  br i1 %49, label %65, label %50

50:                                               ; preds = %47
  %51 = load i64, ptr %3, align 8, !tbaa !8
  %52 = getelementptr inbounds [2000 x %"class.std::__cxx11::basic_string"], ptr @_Z1sB5cxx11, i64 0, i64 %51
  %53 = load i64, ptr %5, align 8, !tbaa !8
  %54 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %52, i64 noundef %53)
  %55 = load i8, ptr %54, align 1, !tbaa !13
  %56 = sext i8 %55 to i32
  %57 = load i64, ptr %3, align 8, !tbaa !8
  %58 = sub nsw i64 %57, 1
  %59 = getelementptr inbounds [2000 x %"class.std::__cxx11::basic_string"], ptr @_Z1sB5cxx11, i64 0, i64 %58
  %60 = load i64, ptr %5, align 8, !tbaa !8
  %61 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %59, i64 noundef %60)
  %62 = load i8, ptr %61, align 1, !tbaa !13
  %63 = sext i8 %62 to i32
  %64 = icmp ne i32 %56, %63
  br i1 %64, label %65, label %70

65:                                               ; preds = %50, %47
  %66 = load i64, ptr %3, align 8, !tbaa !8
  %67 = getelementptr inbounds [2000 x [2000 x i64]], ptr @vert, i64 0, i64 %66
  %68 = load i64, ptr %5, align 8, !tbaa !8
  %69 = getelementptr inbounds [2000 x i64], ptr %67, i64 0, i64 %68
  store i64 1, ptr %69, align 8, !tbaa !8
  br label %116

70:                                               ; preds = %50
  %71 = load i64, ptr %3, align 8, !tbaa !8
  %72 = sub nsw i64 %71, 1
  %73 = getelementptr inbounds [2000 x [2000 x i64]], ptr @vert, i64 0, i64 %72
  %74 = load i64, ptr %5, align 8, !tbaa !8
  %75 = getelementptr inbounds [2000 x i64], ptr %73, i64 0, i64 %74
  %76 = load i64, ptr %75, align 8, !tbaa !8
  %77 = sub nsw i64 %76, 1
  %78 = load i64, ptr %3, align 8, !tbaa !8
  %79 = getelementptr inbounds [2000 x [2000 x i64]], ptr @vert, i64 0, i64 %78
  %80 = load i64, ptr %5, align 8, !tbaa !8
  %81 = getelementptr inbounds [2000 x i64], ptr %79, i64 0, i64 %80
  store i64 %77, ptr %81, align 8, !tbaa !8
  %82 = load i64, ptr %3, align 8, !tbaa !8
  %83 = load i64, ptr %5, align 8, !tbaa !8
  %84 = load i64, ptr %3, align 8, !tbaa !8
  %85 = getelementptr inbounds [2000 x [2000 x i64]], ptr @vert, i64 0, i64 %84
  %86 = load i64, ptr %5, align 8, !tbaa !8
  %87 = getelementptr inbounds [2000 x i64], ptr %85, i64 0, i64 %86
  %88 = load i64, ptr %87, align 8, !tbaa !8
  %89 = add nsw i64 %88, 1
  %90 = call noundef zeroext i1 @_Z2okxxx(i64 noundef %82, i64 noundef %83, i64 noundef %89)
  br i1 %90, label %91, label %115

91:                                               ; preds = %70
  %92 = load i64, ptr %3, align 8, !tbaa !8
  %93 = getelementptr inbounds [2000 x [2000 x i64]], ptr @vert, i64 0, i64 %92
  %94 = load i64, ptr %5, align 8, !tbaa !8
  %95 = getelementptr inbounds [2000 x i64], ptr %93, i64 0, i64 %94
  %96 = load i64, ptr %95, align 8, !tbaa !8
  %97 = add nsw i64 %96, 1
  store i64 %97, ptr %95, align 8, !tbaa !8
  %98 = load i64, ptr %3, align 8, !tbaa !8
  %99 = load i64, ptr %5, align 8, !tbaa !8
  %100 = load i64, ptr %3, align 8, !tbaa !8
  %101 = getelementptr inbounds [2000 x [2000 x i64]], ptr @vert, i64 0, i64 %100
  %102 = load i64, ptr %5, align 8, !tbaa !8
  %103 = getelementptr inbounds [2000 x i64], ptr %101, i64 0, i64 %102
  %104 = load i64, ptr %103, align 8, !tbaa !8
  %105 = add nsw i64 %104, 1
  %106 = call noundef zeroext i1 @_Z2okxxx(i64 noundef %98, i64 noundef %99, i64 noundef %105)
  br i1 %106, label %107, label %114

107:                                              ; preds = %91
  %108 = load i64, ptr %3, align 8, !tbaa !8
  %109 = getelementptr inbounds [2000 x [2000 x i64]], ptr @vert, i64 0, i64 %108
  %110 = load i64, ptr %5, align 8, !tbaa !8
  %111 = getelementptr inbounds [2000 x i64], ptr %109, i64 0, i64 %110
  %112 = load i64, ptr %111, align 8, !tbaa !8
  %113 = add nsw i64 %112, 1
  store i64 %113, ptr %111, align 8, !tbaa !8
  br label %114

114:                                              ; preds = %107, %91
  br label %115

115:                                              ; preds = %114, %70
  br label %116

116:                                              ; preds = %115, %65
  %117 = load i64, ptr %5, align 8, !tbaa !8
  %118 = add nsw i64 %117, 1
  store i64 %118, ptr %5, align 8, !tbaa !8
  br label %42, !llvm.loop !14

119:                                              ; preds = %46
  br label %120

120:                                              ; preds = %119
  %121 = load i64, ptr %3, align 8, !tbaa !8
  %122 = add nsw i64 %121, 1
  store i64 %122, ptr %3, align 8, !tbaa !8
  br label %36, !llvm.loop !15

123:                                              ; preds = %40
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  store i64 0, ptr %6, align 8, !tbaa !8
  br label %124

124:                                              ; preds = %180, %123
  %125 = load i64, ptr %6, align 8, !tbaa !8
  %126 = load i64, ptr @N, align 8, !tbaa !8
  %127 = icmp slt i64 %125, %126
  br i1 %127, label %129, label %128

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

129:                                              ; preds = %124
  %130 = load i64, ptr %6, align 8, !tbaa !8
  %131 = getelementptr inbounds [2000 x [2000 x i64]], ptr @dp, i64 0, i64 %130
  %132 = getelementptr inbounds [2000 x i64], ptr %131, i64 0, i64 0
  store i64 1, ptr %132, align 16, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  store i64 1, ptr %7, align 8, !tbaa !8
  br label %133

133:                                              ; preds = %176, %129
  %134 = load i64, ptr %7, align 8, !tbaa !8
  %135 = load i64, ptr @M, align 8, !tbaa !8
  %136 = icmp slt i64 %134, %135
  br i1 %136, label %138, label %137

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

138:                                              ; preds = %133
  %139 = load i64, ptr %6, align 8, !tbaa !8
  %140 = getelementptr inbounds [2000 x %"class.std::__cxx11::basic_string"], ptr @_Z1sB5cxx11, i64 0, i64 %139
  %141 = load i64, ptr %7, align 8, !tbaa !8
  %142 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %140, i64 noundef %141)
  %143 = load i8, ptr %142, align 1, !tbaa !13
  %144 = sext i8 %143 to i32
  %145 = load i64, ptr %6, align 8, !tbaa !8
  %146 = getelementptr inbounds [2000 x %"class.std::__cxx11::basic_string"], ptr @_Z1sB5cxx11, i64 0, i64 %145
  %147 = load i64, ptr %7, align 8, !tbaa !8
  %148 = sub nsw i64 %147, 1
  %149 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %146, i64 noundef %148)
  %150 = load i8, ptr %149, align 1, !tbaa !13
  %151 = sext i8 %150 to i32
  %152 = icmp ne i32 %144, %151
  br i1 %152, label %153, label %158

153:                                              ; preds = %138
  %154 = load i64, ptr %6, align 8, !tbaa !8
  %155 = getelementptr inbounds [2000 x [2000 x i64]], ptr @dp, i64 0, i64 %154
  %156 = load i64, ptr %7, align 8, !tbaa !8
  %157 = getelementptr inbounds [2000 x i64], ptr %155, i64 0, i64 %156
  store i64 1, ptr %157, align 8, !tbaa !8
  br label %176

158:                                              ; preds = %138
  %159 = load i64, ptr %6, align 8, !tbaa !8
  %160 = getelementptr inbounds [2000 x [2000 x i64]], ptr @vert, i64 0, i64 %159
  %161 = load i64, ptr %7, align 8, !tbaa !8
  %162 = getelementptr inbounds [2000 x i64], ptr %160, i64 0, i64 %161
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  %163 = load i64, ptr %6, align 8, !tbaa !8
  %164 = getelementptr inbounds [2000 x [2000 x i64]], ptr @dp, i64 0, i64 %163
  %165 = load i64, ptr %7, align 8, !tbaa !8
  %166 = sub nsw i64 %165, 1
  %167 = getelementptr inbounds [2000 x i64], ptr %164, i64 0, i64 %166
  %168 = load i64, ptr %167, align 8, !tbaa !8
  %169 = add nsw i64 %168, 1
  store i64 %169, ptr %8, align 8, !tbaa !8
  %170 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %162, ptr noundef nonnull align 8 dereferenceable(8) %8)
  %171 = load i64, ptr %170, align 8, !tbaa !8
  %172 = load i64, ptr %6, align 8, !tbaa !8
  %173 = getelementptr inbounds [2000 x [2000 x i64]], ptr @dp, i64 0, i64 %172
  %174 = load i64, ptr %7, align 8, !tbaa !8
  %175 = getelementptr inbounds [2000 x i64], ptr %173, i64 0, i64 %174
  store i64 %171, ptr %175, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  br label %176

176:                                              ; preds = %158, %153
  %177 = load i64, ptr %7, align 8, !tbaa !8
  %178 = add nsw i64 %177, 1
  store i64 %178, ptr %7, align 8, !tbaa !8
  br label %133, !llvm.loop !16

179:                                              ; preds = %137
  br label %180

180:                                              ; preds = %179
  %181 = load i64, ptr %6, align 8, !tbaa !8
  %182 = add nsw i64 %181, 1
  store i64 %182, ptr %6, align 8, !tbaa !8
  br label %124, !llvm.loop !17

183:                                              ; preds = %128
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  store i64 0, ptr %9, align 8, !tbaa !8
  br label %184

184:                                              ; preds = %248, %183
  %185 = load i64, ptr %9, align 8, !tbaa !8
  %186 = load i64, ptr @N, align 8, !tbaa !8
  %187 = icmp slt i64 %185, %186
  br i1 %187, label %189, label %188

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

189:                                              ; preds = %184
  %190 = load i64, ptr %9, align 8, !tbaa !8
  %191 = getelementptr inbounds [2000 x [2000 x i64]], ptr @dp, i64 0, i64 %190
  %192 = load i64, ptr @M, align 8, !tbaa !8
  %193 = sub nsw i64 %192, 1
  %194 = getelementptr inbounds [2000 x i64], ptr %191, i64 0, i64 %193
  store i64 1, ptr %194, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  %195 = load i64, ptr @M, align 8, !tbaa !8
  %196 = sub nsw i64 %195, 2
  store i64 %196, ptr %10, align 8, !tbaa !8
  br label %197

197:                                              ; preds = %244, %189
  %198 = load i64, ptr %10, align 8, !tbaa !8
  %199 = icmp sge i64 %198, 0
  br i1 %199, label %201, label %200

200:                                              ; preds = %197
  store i32 20, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  br label %247

201:                                              ; preds = %197
  %202 = load i64, ptr %9, align 8, !tbaa !8
  %203 = getelementptr inbounds [2000 x %"class.std::__cxx11::basic_string"], ptr @_Z1sB5cxx11, i64 0, i64 %202
  %204 = load i64, ptr %10, align 8, !tbaa !8
  %205 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %203, i64 noundef %204)
  %206 = load i8, ptr %205, align 1, !tbaa !13
  %207 = sext i8 %206 to i32
  %208 = load i64, ptr %9, align 8, !tbaa !8
  %209 = getelementptr inbounds [2000 x %"class.std::__cxx11::basic_string"], ptr @_Z1sB5cxx11, i64 0, i64 %208
  %210 = load i64, ptr %10, align 8, !tbaa !8
  %211 = add nsw i64 %210, 1
  %212 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %209, i64 noundef %211)
  %213 = load i8, ptr %212, align 1, !tbaa !13
  %214 = sext i8 %213 to i32
  %215 = icmp ne i32 %207, %214
  br i1 %215, label %216, label %221

216:                                              ; preds = %201
  %217 = load i64, ptr %9, align 8, !tbaa !8
  %218 = getelementptr inbounds [2000 x [2000 x i64]], ptr @dp, i64 0, i64 %217
  %219 = load i64, ptr %10, align 8, !tbaa !8
  %220 = getelementptr inbounds [2000 x i64], ptr %218, i64 0, i64 %219
  store i64 1, ptr %220, align 8, !tbaa !8
  br label %244

221:                                              ; preds = %201
  %222 = load i64, ptr %9, align 8, !tbaa !8
  %223 = getelementptr inbounds [2000 x [2000 x i64]], ptr @dp, i64 0, i64 %222
  %224 = load i64, ptr %10, align 8, !tbaa !8
  %225 = getelementptr inbounds [2000 x i64], ptr %223, i64 0, i64 %224
  %226 = load i64, ptr %9, align 8, !tbaa !8
  %227 = getelementptr inbounds [2000 x [2000 x i64]], ptr @vert, i64 0, i64 %226
  %228 = load i64, ptr %10, align 8, !tbaa !8
  %229 = getelementptr inbounds [2000 x i64], ptr %227, i64 0, i64 %228
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  %230 = load i64, ptr %9, align 8, !tbaa !8
  %231 = getelementptr inbounds [2000 x [2000 x i64]], ptr @dp, i64 0, i64 %230
  %232 = load i64, ptr %10, align 8, !tbaa !8
  %233 = add nsw i64 %232, 1
  %234 = getelementptr inbounds [2000 x i64], ptr %231, i64 0, i64 %233
  %235 = load i64, ptr %234, align 8, !tbaa !8
  %236 = add nsw i64 %235, 1
  store i64 %236, ptr %11, align 8, !tbaa !8
  %237 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %229, ptr noundef nonnull align 8 dereferenceable(8) %11)
  %238 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %225, ptr noundef nonnull align 8 dereferenceable(8) %237)
  %239 = load i64, ptr %238, align 8, !tbaa !8
  %240 = load i64, ptr %9, align 8, !tbaa !8
  %241 = getelementptr inbounds [2000 x [2000 x i64]], ptr @dp, i64 0, i64 %240
  %242 = load i64, ptr %10, align 8, !tbaa !8
  %243 = getelementptr inbounds [2000 x i64], ptr %241, i64 0, i64 %242
  store i64 %239, ptr %243, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  br label %244

244:                                              ; preds = %221, %216
  %245 = load i64, ptr %10, align 8, !tbaa !8
  %246 = add nsw i64 %245, -1
  store i64 %246, ptr %10, align 8, !tbaa !8
  br label %197, !llvm.loop !18

247:                                              ; preds = %200
  br label %248

248:                                              ; preds = %247
  %249 = load i64, ptr %9, align 8, !tbaa !8
  %250 = add nsw i64 %249, 1
  store i64 %250, ptr %9, align 8, !tbaa !8
  br label %184, !llvm.loop !19

251:                                              ; preds = %188
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  store i64 0, ptr %12, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  store i64 0, ptr %13, align 8, !tbaa !8
  br label %252

252:                                              ; preds = %275, %251
  %253 = load i64, ptr %13, align 8, !tbaa !8
  %254 = load i64, ptr @N, align 8, !tbaa !8
  %255 = icmp slt i64 %253, %254
  br i1 %255, label %257, label %256

256:                                              ; preds = %252
  store i32 23, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  br label %278

257:                                              ; preds = %252
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  store i64 0, ptr %14, align 8, !tbaa !8
  br label %258

258:                                              ; preds = %271, %257
  %259 = load i64, ptr %14, align 8, !tbaa !8
  %260 = load i64, ptr @M, align 8, !tbaa !8
  %261 = icmp slt i64 %259, %260
  br i1 %261, label %263, label %262

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

263:                                              ; preds = %258
  %264 = load i64, ptr %13, align 8, !tbaa !8
  %265 = getelementptr inbounds [2000 x [2000 x i64]], ptr @dp, i64 0, i64 %264
  %266 = load i64, ptr %14, align 8, !tbaa !8
  %267 = getelementptr inbounds [2000 x i64], ptr %265, i64 0, i64 %266
  %268 = load i64, ptr %267, align 8, !tbaa !8
  %269 = load i64, ptr %12, align 8, !tbaa !8
  %270 = add nsw i64 %269, %268
  store i64 %270, ptr %12, align 8, !tbaa !8
  br label %271

271:                                              ; preds = %263
  %272 = load i64, ptr %14, align 8, !tbaa !8
  %273 = add nsw i64 %272, 1
  store i64 %273, ptr %14, align 8, !tbaa !8
  br label %258, !llvm.loop !20

274:                                              ; preds = %262
  br label %275

275:                                              ; preds = %274
  %276 = load i64, ptr %13, align 8, !tbaa !8
  %277 = add nsw i64 %276, 1
  store i64 %277, ptr %13, align 8, !tbaa !8
  br label %252, !llvm.loop !21

278:                                              ; preds = %256
  %279 = load i64, ptr %12, align 8, !tbaa !8
  %280 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %279)
  %281 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %280, i8 noundef signext 10)
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  %282 = load i32, ptr %1, align 4
  ret i32 %282
}

; 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 zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) #4

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) #4

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

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

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

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 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 = { 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 = !{!"long long", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!10, !10, i64 0}
!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::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"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 i64, align 8
@M = external dso_local global i64, align 8
@dp = external dso_local global [2000 x [2000 x i64]], align 16
@vert = external dso_local global [2000 x [2000 x i64]], align 16
@_Z1sB5cxx11 = external dso_local global [2000 x %"class.std::__cxx11::basic_string"], 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 zeroext i1 @_Z2okxxx(i64 noundef, i64 noundef, i64 noundef) local_unnamed_addr #0

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %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 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %9 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @N)
  %10 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef nonnull align 8 dereferenceable(8) @M)
  %11 = load i64, ptr @N, align 8, !tbaa !8
  %12 = icmp sgt i64 %11, 0
  br i1 %12, label %.lr.ph, label %._crit_edge115

.preheader90:                                     ; preds = %.lr.ph
  %13 = icmp sgt i64 %19, 0
  br i1 %13, label %.preheader89.lr.ph, label %._crit_edge115

.preheader89.lr.ph:                               ; preds = %.preheader90
  %14 = load i64, ptr @M, align 8, !tbaa !8
  %15 = icmp sgt i64 %14, 0
  br i1 %15, label %.preheader89, label %.lr.ph101.split.us

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.08391 = phi i64 [ %18, %.lr.ph ], [ 0, %0 ]
  %16 = getelementptr inbounds [2000 x %"class.std::__cxx11::basic_string"], ptr @_Z1sB5cxx11, i64 0, i64 %.08391
  %17 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(32) %16)
  %18 = add nuw nsw i64 %.08391, 1
  %19 = load i64, ptr @N, align 8, !tbaa !8
  %20 = icmp slt i64 %18, %19
  br i1 %20, label %.lr.ph, label %.preheader90, !llvm.loop !11

.preheader89:                                     ; preds = %.preheader89.lr.ph, %._crit_edge
  %21 = phi i64 [ %47, %._crit_edge ], [ %19, %.preheader89.lr.ph ]
  %22 = phi i64 [ %48, %._crit_edge ], [ %14, %.preheader89.lr.ph ]
  %23 = phi i64 [ %49, %._crit_edge ], [ %14, %.preheader89.lr.ph ]
  %.08294 = phi i64 [ %50, %._crit_edge ], [ 0, %.preheader89.lr.ph ]
  %24 = icmp sgt i64 %23, 0
  br i1 %24, label %.lr.ph93, label %._crit_edge

.lr.ph93:                                         ; preds = %.preheader89
  %25 = icmp eq i64 %.08294, 0
  %26 = getelementptr inbounds [2000 x %"class.std::__cxx11::basic_string"], ptr @_Z1sB5cxx11, i64 0, i64 %.08294
  %27 = add nsw i64 %.08294, -1
  %28 = getelementptr inbounds [2000 x %"class.std::__cxx11::basic_string"], ptr @_Z1sB5cxx11, i64 0, i64 %27
  br i1 %25, label %.lr.ph93.split.us, label %.lr.ph93.split

.lr.ph93.split.us:                                ; preds = %.lr.ph93
  %smax = tail call i64 @llvm.smax.i64(i64 %22, i64 1)
  %min.iters.check = icmp slt i64 %22, 4
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph93.split.us
  %n.vec = and i64 %smax, 9223372036854775804
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %29 = getelementptr inbounds [2000 x [2000 x i64]], ptr @vert, i64 0, i64 0, i64 %index
  %30 = getelementptr inbounds i8, ptr %29, i64 16
  store <2 x i64> <i64 1, i64 1>, ptr %29, align 16, !tbaa !8
  store <2 x i64> <i64 1, i64 1>, ptr %30, align 16, !tbaa !8
  %index.next = add nuw i64 %index, 4
  %31 = icmp eq i64 %index.next, %n.vec
  br i1 %31, label %middle.block, label %vector.body, !llvm.loop !13

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

scalar.ph.preheader:                              ; preds = %middle.block, %.lr.ph93.split.us
  %.08192.us.ph = phi i64 [ 0, %.lr.ph93.split.us ], [ %n.vec, %middle.block ]
  br label %scalar.ph

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %.08192.us = phi i64 [ %33, %scalar.ph ], [ %.08192.us.ph, %scalar.ph.preheader ]
  %32 = getelementptr inbounds [2000 x [2000 x i64]], ptr @vert, i64 0, i64 0, i64 %.08192.us
  store i64 1, ptr %32, align 8, !tbaa !8
  %33 = add nuw nsw i64 %.08192.us, 1
  %exitcond.not = icmp eq i64 %33, %smax
  br i1 %exitcond.not, label %._crit_edge, label %scalar.ph, !llvm.loop !16

.preheader88:                                     ; preds = %._crit_edge
  %34 = icmp sgt i64 %47, 0
  br i1 %34, label %.lr.ph101, label %._crit_edge115

.lr.ph101:                                        ; preds = %.preheader88
  %.pr = load i64, ptr @M, align 8, !tbaa !8
  %35 = icmp sgt i64 %.pr, 1
  br i1 %35, label %.lr.ph101.split, label %.lr.ph101.split.us

.lr.ph101.split.us:                               ; preds = %.preheader89.lr.ph, %.lr.ph101
  %36 = phi i64 [ %47, %.lr.ph101 ], [ %19, %.preheader89.lr.ph ]
  %xtraiter = and i64 %36, 3
  %37 = icmp ult i64 %36, 4
  br i1 %37, label %.lr.ph107.preheader.loopexit.unr-lcssa, label %.lr.ph101.split.us.new

.lr.ph101.split.us.new:                           ; preds = %.lr.ph101.split.us
  %unroll_iter = and i64 %36, 9223372036854775804
  br label %38

38:                                               ; preds = %38, %.lr.ph101.split.us.new
  %.080100.us = phi i64 [ 0, %.lr.ph101.split.us.new ], [ %46, %38 ]
  %niter = phi i64 [ 0, %.lr.ph101.split.us.new ], [ %niter.next.3, %38 ]
  %39 = getelementptr inbounds [2000 x [2000 x i64]], ptr @dp, i64 0, i64 %.080100.us
  store i64 1, ptr %39, align 16, !tbaa !8
  %40 = or disjoint i64 %.080100.us, 1
  %41 = getelementptr inbounds [2000 x [2000 x i64]], ptr @dp, i64 0, i64 %40
  store i64 1, ptr %41, align 16, !tbaa !8
  %42 = or disjoint i64 %.080100.us, 2
  %43 = getelementptr inbounds [2000 x [2000 x i64]], ptr @dp, i64 0, i64 %42
  store i64 1, ptr %43, align 16, !tbaa !8
  %44 = or disjoint i64 %.080100.us, 3
  %45 = getelementptr inbounds [2000 x [2000 x i64]], ptr @dp, i64 0, i64 %44
  store i64 1, ptr %45, align 16, !tbaa !8
  %46 = add nuw nsw i64 %.080100.us, 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 %.lr.ph107.preheader.loopexit.unr-lcssa, label %38, !llvm.loop !17

._crit_edge.loopexit119:                          ; preds = %72
  %.pre = load i64, ptr @N, align 8, !tbaa !8
  br label %._crit_edge

._crit_edge:                                      ; preds = %scalar.ph, %middle.block, %._crit_edge.loopexit119, %.preheader89
  %47 = phi i64 [ %.pre, %._crit_edge.loopexit119 ], [ %21, %.preheader89 ], [ %21, %middle.block ], [ %21, %scalar.ph ]
  %48 = phi i64 [ %74, %._crit_edge.loopexit119 ], [ %22, %.preheader89 ], [ %22, %middle.block ], [ %22, %scalar.ph ]
  %49 = phi i64 [ %74, %._crit_edge.loopexit119 ], [ %23, %.preheader89 ], [ %22, %middle.block ], [ %22, %scalar.ph ]
  %50 = add nuw nsw i64 %.08294, 1
  %51 = icmp slt i64 %50, %47
  br i1 %51, label %.preheader89, label %.preheader88, !llvm.loop !18

.lr.ph93.split:                                   ; preds = %.lr.ph93, %72
  %.08192 = phi i64 [ %73, %72 ], [ 0, %.lr.ph93 ]
  %52 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %26, i64 noundef %.08192)
  %53 = load i8, ptr %52, align 1, !tbaa !20
  %54 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %28, i64 noundef %.08192)
  %55 = load i8, ptr %54, align 1, !tbaa !20
  %.not85 = icmp eq i8 %53, %55
  br i1 %.not85, label %58, label %56

56:                                               ; preds = %.lr.ph93.split
  %57 = getelementptr inbounds [2000 x [2000 x i64]], ptr @vert, i64 0, i64 %.08294, i64 %.08192
  store i64 1, ptr %57, align 8, !tbaa !8
  br label %72

58:                                               ; preds = %.lr.ph93.split
  %59 = getelementptr inbounds [2000 x [2000 x i64]], ptr @vert, i64 0, i64 %27, i64 %.08192
  %60 = load i64, ptr %59, align 8, !tbaa !8
  %61 = add nsw i64 %60, -1
  %62 = getelementptr inbounds [2000 x [2000 x i64]], ptr @vert, i64 0, i64 %.08294, i64 %.08192
  store i64 %61, ptr %62, align 8, !tbaa !8
  %63 = tail call noundef zeroext i1 @_Z2okxxx(i64 noundef %.08294, i64 noundef %.08192, i64 noundef %60)
  br i1 %63, label %64, label %72

64:                                               ; preds = %58
  %65 = load i64, ptr %62, align 8, !tbaa !8
  %66 = add nsw i64 %65, 1
  store i64 %66, ptr %62, align 8, !tbaa !8
  %67 = add nsw i64 %65, 2
  %68 = tail call noundef zeroext i1 @_Z2okxxx(i64 noundef %.08294, i64 noundef %.08192, i64 noundef %67)
  br i1 %68, label %69, label %72

69:                                               ; preds = %64
  %70 = load i64, ptr %62, align 8, !tbaa !8
  %71 = add nsw i64 %70, 1
  store i64 %71, ptr %62, align 8, !tbaa !8
  br label %72

72:                                               ; preds = %58, %69, %64, %56
  %73 = add nuw nsw i64 %.08192, 1
  %74 = load i64, ptr @M, align 8, !tbaa !8
  %75 = icmp slt i64 %73, %74
  br i1 %75, label %.lr.ph93.split, label %._crit_edge.loopexit119, !llvm.loop !21

.preheader87:                                     ; preds = %._crit_edge99
  %76 = icmp sgt i64 %84, 0
  br i1 %76, label %.lr.ph107.preheader, label %._crit_edge115

.lr.ph107.preheader.loopexit.unr-lcssa:           ; preds = %38, %.lr.ph101.split.us
  %.080100.us.unr = phi i64 [ 0, %.lr.ph101.split.us ], [ %46, %38 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.lr.ph107.preheader, label %.epil.preheader

.epil.preheader:                                  ; preds = %.lr.ph107.preheader.loopexit.unr-lcssa, %.epil.preheader
  %.080100.us.epil = phi i64 [ %78, %.epil.preheader ], [ %.080100.us.unr, %.lr.ph107.preheader.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.epil.preheader ], [ 0, %.lr.ph107.preheader.loopexit.unr-lcssa ]
  %77 = getelementptr inbounds [2000 x [2000 x i64]], ptr @dp, i64 0, i64 %.080100.us.epil
  store i64 1, ptr %77, align 16, !tbaa !8
  %78 = add nuw nsw i64 %.080100.us.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 %.lr.ph107.preheader, label %.epil.preheader, !llvm.loop !22

.lr.ph107.preheader:                              ; preds = %.lr.ph107.preheader.loopexit.unr-lcssa, %.epil.preheader, %.preheader87
  %.ph = phi i64 [ %84, %.preheader87 ], [ %36, %.epil.preheader ], [ %36, %.lr.ph107.preheader.loopexit.unr-lcssa ]
  br label %.lr.ph107

.lr.ph101.split:                                  ; preds = %.lr.ph101, %._crit_edge99
  %79 = phi i64 [ %84, %._crit_edge99 ], [ %47, %.lr.ph101 ]
  %80 = phi i64 [ %85, %._crit_edge99 ], [ %.pr, %.lr.ph101 ]
  %.080100 = phi i64 [ %86, %._crit_edge99 ], [ 0, %.lr.ph101 ]
  %81 = getelementptr inbounds [2000 x [2000 x i64]], ptr @dp, i64 0, i64 %.080100
  store i64 1, ptr %81, align 16, !tbaa !8
  %82 = icmp sgt i64 %80, 1
  br i1 %82, label %.lr.ph98, label %._crit_edge99

.lr.ph98:                                         ; preds = %.lr.ph101.split
  %83 = getelementptr inbounds [2000 x %"class.std::__cxx11::basic_string"], ptr @_Z1sB5cxx11, i64 0, i64 %.080100
  br label %88

._crit_edge99.loopexit:                           ; preds = %101
  %.pre127 = load i64, ptr @N, align 8, !tbaa !8
  br label %._crit_edge99

._crit_edge99:                                    ; preds = %._crit_edge99.loopexit, %.lr.ph101.split
  %84 = phi i64 [ %.pre127, %._crit_edge99.loopexit ], [ %79, %.lr.ph101.split ]
  %85 = phi i64 [ %104, %._crit_edge99.loopexit ], [ %80, %.lr.ph101.split ]
  %86 = add nuw nsw i64 %.080100, 1
  %87 = icmp slt i64 %86, %84
  br i1 %87, label %.lr.ph101.split, label %.preheader87, !llvm.loop !24

88:                                               ; preds = %.lr.ph98, %101
  %.07996 = phi i64 [ 1, %.lr.ph98 ], [ %103, %101 ]
  %89 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %83, i64 noundef %.07996)
  %90 = load i8, ptr %89, align 1, !tbaa !20
  %91 = add nsw i64 %.07996, -1
  %92 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %83, i64 noundef %91)
  %93 = load i8, ptr %92, align 1, !tbaa !20
  %.not84 = icmp eq i8 %90, %93
  br i1 %.not84, label %94, label %101

94:                                               ; preds = %88
  %95 = getelementptr inbounds [2000 x [2000 x i64]], ptr @vert, i64 0, i64 %.080100, i64 %.07996
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #8
  %96 = getelementptr inbounds [2000 x [2000 x i64]], ptr @dp, i64 0, i64 %.080100, i64 %91
  %97 = load i64, ptr %96, align 8, !tbaa !8
  %98 = add nsw i64 %97, 1
  store i64 %98, ptr %1, align 8, !tbaa !8
  %99 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %95, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %100 = load i64, ptr %99, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #8
  br label %101

101:                                              ; preds = %88, %94
  %.sink = phi i64 [ %100, %94 ], [ 1, %88 ]
  %102 = getelementptr inbounds [2000 x [2000 x i64]], ptr @dp, i64 0, i64 %.080100, i64 %.07996
  store i64 %.sink, ptr %102, align 8
  %103 = add nuw nsw i64 %.07996, 1
  %104 = load i64, ptr @M, align 8, !tbaa !8
  %105 = icmp slt i64 %103, %104
  br i1 %105, label %88, label %._crit_edge99.loopexit, !llvm.loop !25

.preheader86:                                     ; preds = %._crit_edge105
  %106 = icmp sgt i64 %128, 0
  br i1 %106, label %.preheader.lr.ph, label %._crit_edge115

.preheader.lr.ph:                                 ; preds = %.preheader86
  %107 = load i64, ptr @M, align 8, !tbaa !8
  %108 = icmp sgt i64 %107, 0
  br i1 %108, label %.preheader.us.preheader, label %._crit_edge115

.preheader.us.preheader:                          ; preds = %.preheader.lr.ph
  %min.iters.check147 = icmp ult i64 %107, 4
  %n.vec150 = and i64 %107, 9223372036854775804
  %cmp.n157 = icmp eq i64 %107, %n.vec150
  br label %.preheader.us

.preheader.us:                                    ; preds = %.preheader.us.preheader, %._crit_edge111.us
  %.075114.us = phi i64 [ %120, %._crit_edge111.us ], [ 0, %.preheader.us.preheader ]
  %.076113.us = phi i64 [ %.lcssa, %._crit_edge111.us ], [ 0, %.preheader.us.preheader ]
  br i1 %min.iters.check147, label %scalar.ph146.preheader, label %vector.ph148

vector.ph148:                                     ; preds = %.preheader.us
  %109 = insertelement <2 x i64> <i64 poison, i64 0>, i64 %.076113.us, i64 0
  br label %vector.body152

vector.body152:                                   ; preds = %vector.body152, %vector.ph148
  %index153 = phi i64 [ 0, %vector.ph148 ], [ %index.next156, %vector.body152 ]
  %vec.phi = phi <2 x i64> [ %109, %vector.ph148 ], [ %112, %vector.body152 ]
  %vec.phi154 = phi <2 x i64> [ zeroinitializer, %vector.ph148 ], [ %113, %vector.body152 ]
  %110 = getelementptr inbounds [2000 x [2000 x i64]], ptr @dp, i64 0, i64 %.075114.us, i64 %index153
  %111 = getelementptr inbounds i8, ptr %110, i64 16
  %wide.load = load <2 x i64>, ptr %110, align 16, !tbaa !8
  %wide.load155 = load <2 x i64>, ptr %111, align 16, !tbaa !8
  %112 = add <2 x i64> %wide.load, %vec.phi
  %113 = add <2 x i64> %wide.load155, %vec.phi154
  %index.next156 = add nuw i64 %index153, 4
  %114 = icmp eq i64 %index.next156, %n.vec150
  br i1 %114, label %middle.block145, label %vector.body152, !llvm.loop !26

middle.block145:                                  ; preds = %vector.body152
  %bin.rdx = add <2 x i64> %113, %112
  %115 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
  br i1 %cmp.n157, label %._crit_edge111.us, label %scalar.ph146.preheader

scalar.ph146.preheader:                           ; preds = %middle.block145, %.preheader.us
  %.0109.us.ph = phi i64 [ 0, %.preheader.us ], [ %n.vec150, %middle.block145 ]
  %.1108.us.ph = phi i64 [ %.076113.us, %.preheader.us ], [ %115, %middle.block145 ]
  br label %scalar.ph146

scalar.ph146:                                     ; preds = %scalar.ph146.preheader, %scalar.ph146
  %.0109.us = phi i64 [ %119, %scalar.ph146 ], [ %.0109.us.ph, %scalar.ph146.preheader ]
  %.1108.us = phi i64 [ %118, %scalar.ph146 ], [ %.1108.us.ph, %scalar.ph146.preheader ]
  %116 = getelementptr inbounds [2000 x [2000 x i64]], ptr @dp, i64 0, i64 %.075114.us, i64 %.0109.us
  %117 = load i64, ptr %116, align 8, !tbaa !8
  %118 = add nsw i64 %117, %.1108.us
  %119 = add nuw nsw i64 %.0109.us, 1
  %exitcond125.not = icmp eq i64 %119, %107
  br i1 %exitcond125.not, label %._crit_edge111.us, label %scalar.ph146, !llvm.loop !27

._crit_edge111.us:                                ; preds = %scalar.ph146, %middle.block145
  %.lcssa = phi i64 [ %115, %middle.block145 ], [ %118, %scalar.ph146 ]
  %120 = add nuw nsw i64 %.075114.us, 1
  %exitcond126.not = icmp eq i64 %120, %128
  br i1 %exitcond126.not, label %._crit_edge115, label %.preheader.us, !llvm.loop !28

.lr.ph107:                                        ; preds = %.lr.ph107.preheader, %._crit_edge105
  %121 = phi i64 [ %128, %._crit_edge105 ], [ %.ph, %.lr.ph107.preheader ]
  %.078106 = phi i64 [ %129, %._crit_edge105 ], [ 0, %.lr.ph107.preheader ]
  %122 = load i64, ptr @M, align 8, !tbaa !8
  %123 = add nsw i64 %122, -1
  %124 = getelementptr inbounds [2000 x [2000 x i64]], ptr @dp, i64 0, i64 %.078106, i64 %123
  store i64 1, ptr %124, align 8, !tbaa !8
  %125 = icmp sgt i64 %122, 1
  br i1 %125, label %.lr.ph104, label %._crit_edge105

.lr.ph104:                                        ; preds = %.lr.ph107
  %126 = add nsw i64 %122, -2
  %127 = getelementptr inbounds [2000 x %"class.std::__cxx11::basic_string"], ptr @_Z1sB5cxx11, i64 0, i64 %.078106
  br label %131

._crit_edge105.loopexit:                          ; preds = %147
  %.pre128 = load i64, ptr @N, align 8, !tbaa !8
  br label %._crit_edge105

._crit_edge105:                                   ; preds = %._crit_edge105.loopexit, %.lr.ph107
  %128 = phi i64 [ %.pre128, %._crit_edge105.loopexit ], [ %121, %.lr.ph107 ]
  %129 = add nuw nsw i64 %.078106, 1
  %130 = icmp slt i64 %129, %128
  br i1 %130, label %.lr.ph107, label %.preheader86, !llvm.loop !29

131:                                              ; preds = %.lr.ph104, %147
  %.077102 = phi i64 [ %126, %.lr.ph104 ], [ %148, %147 ]
  %132 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %127, i64 noundef %.077102)
  %133 = load i8, ptr %132, align 1, !tbaa !20
  %134 = add nuw nsw i64 %.077102, 1
  %135 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %127, i64 noundef %134)
  %136 = load i8, ptr %135, align 1, !tbaa !20
  %.not = icmp eq i8 %133, %136
  %137 = getelementptr inbounds [2000 x [2000 x i64]], ptr @dp, i64 0, i64 %.078106, i64 %.077102
  br i1 %.not, label %139, label %138

138:                                              ; preds = %131
  store i64 1, ptr %137, align 8, !tbaa !8
  br label %147

139:                                              ; preds = %131
  %140 = getelementptr inbounds [2000 x [2000 x i64]], ptr @vert, i64 0, i64 %.078106, i64 %.077102
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #8
  %141 = getelementptr inbounds [2000 x [2000 x i64]], ptr @dp, i64 0, i64 %.078106, i64 %134
  %142 = load i64, ptr %141, align 8, !tbaa !8
  %143 = add nsw i64 %142, 1
  store i64 %143, ptr %2, align 8, !tbaa !8
  %144 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %140, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %145 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %137, ptr noundef nonnull align 8 dereferenceable(8) %144)
  %146 = load i64, ptr %145, align 8, !tbaa !8
  store i64 %146, ptr %137, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #8
  br label %147

147:                                              ; preds = %139, %138
  %148 = add nsw i64 %.077102, -1
  %149 = icmp sgt i64 %.077102, 0
  br i1 %149, label %131, label %._crit_edge105.loopexit, !llvm.loop !30

._crit_edge115:                                   ; preds = %._crit_edge111.us, %0, %.preheader90, %.preheader88, %.preheader87, %.preheader.lr.ph, %.preheader86
  %.076.lcssa = phi i64 [ 0, %.preheader86 ], [ 0, %.preheader.lr.ph ], [ 0, %.preheader87 ], [ 0, %.preheader88 ], [ 0, %.preheader90 ], [ 0, %0 ], [ %.lcssa, %._crit_edge111.us ]
  %150 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.076.lcssa)
  %151 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %150, i8 noundef signext 10)
  ret i32 0
}

; 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 zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) local_unnamed_addr #4

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #4

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

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #7

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

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 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 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 = { 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 = !{!"long long", !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, !15, !14}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12, !19}
!19 = !{!"llvm.loop.unswitch.partial.disable"}
!20 = !{!10, !10, i64 0}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.unroll.disable"}
!24 = distinct !{!24, !12, !19}
!25 = distinct !{!25, !12}
!26 = distinct !{!26, !12, !14, !15}
!27 = distinct !{!27, !12, !15, !14}
!28 = distinct !{!28, !12}
!29 = distinct !{!29, !12}
!30 = distinct !{!30, !12}


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