; LLVM IR from bqi343/cp-notebook :: Contests/USACO Solutions/2014-15/Open 2015 Gold (15 Open G2)

; 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_ifstream" = type { %"class.std::basic_istream.base", %"class.std::basic_filebuf", %"class.std::basic_ios" }
%"class.std::basic_istream.base" = type { ptr, i64 }
%"class.std::basic_filebuf" = type { %"class.std::basic_streambuf", %union.pthread_mutex_t, %"class.std::__basic_file", i32, %struct.__mbstate_t, %struct.__mbstate_t, %struct.__mbstate_t, ptr, i64, i8, i8, i8, i8, ptr, ptr, i8, ptr, ptr, i64, ptr, ptr }
%"class.std::basic_streambuf" = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, %"class.std::locale" }
%"class.std::locale" = type { ptr }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%"class.std::__basic_file" = type <{ ptr, i8, [7 x i8] }>
%struct.__mbstate_t = type { i32, %union.anon }
%union.anon = type { i32 }
%"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::basic_ofstream" = type { %"class.std::basic_ostream.base", %"class.std::basic_filebuf", %"class.std::basic_ios" }
%"class.std::basic_ostream.base" = type { ptr }
%"struct.std::pair" = type { i32, i32 }

@N = external dso_local global i32, align 4
@dp = external dso_local global [500 x [500 x i32]], align 16
@dp1 = external dso_local global [500 x [500 x i32]], align 16
@grid = external dso_local global [500 x [500 x i8]], align 16
@.str = external hidden unnamed_addr constant [11 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [12 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca %"class.std::basic_ifstream", align 8
  %3 = alloca %"class.std::basic_ofstream", align 8
  %4 = alloca ptr, align 8
  %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 %"struct.std::pair", align 4
  %13 = alloca i32, align 4
  %14 = alloca %"struct.std::pair", align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 520, ptr %2) #5
  call void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(256) %2, ptr noundef @.str, i32 noundef 8)
  call void @llvm.lifetime.start.p0(i64 512, ptr %3) #5
  invoke void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(248) %3, ptr noundef @.str.2, i32 noundef 16)
          to label %21 unwind label %29

21:                                               ; preds = %0
  %22 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 4 dereferenceable(4) @N)
          to label %23 unwind label %33

23:                                               ; preds = %21
  %24 = load i32, ptr @N, align 4, !tbaa !5
  %25 = icmp eq i32 %24, 1
  br i1 %25, label %26, label %37

26:                                               ; preds = %23
  %27 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %3, i32 noundef 1)
          to label %28 unwind label %33

28:                                               ; preds = %26
  store i32 0, ptr %1, align 4
  store i32 1, ptr %6, align 4
  br label %434

29:                                               ; preds = %0
  %30 = landingpad { ptr, i32 }
          cleanup
  %31 = extractvalue { ptr, i32 } %30, 0
  store ptr %31, ptr %4, align 8
  %32 = extractvalue { ptr, i32 } %30, 1
  store i32 %32, ptr %5, align 4
  br label %443

33:                                               ; preds = %26, %21
  %34 = landingpad { ptr, i32 }
          cleanup
  %35 = extractvalue { ptr, i32 } %34, 0
  store ptr %35, ptr %4, align 8
  %36 = extractvalue { ptr, i32 } %34, 1
  store i32 %36, ptr %5, align 4
  br label %442

37:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %38

38:                                               ; preds = %66, %37
  %39 = load i32, ptr %7, align 4, !tbaa !5
  %40 = load i32, ptr @N, align 4, !tbaa !5
  %41 = icmp slt i32 %39, %40
  br i1 %41, label %43, label %42

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

43:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %44

44:                                               ; preds = %58, %43
  %45 = load i32, ptr %8, align 4, !tbaa !5
  %46 = load i32, ptr @N, align 4, !tbaa !5
  %47 = icmp slt i32 %45, %46
  br i1 %47, label %49, label %48

48:                                               ; preds = %44
  store i32 5, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %65

49:                                               ; preds = %44
  %50 = load i32, ptr %7, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [500 x [500 x i8]], ptr @grid, i64 0, i64 %51
  %53 = load i32, ptr %8, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [500 x i8], ptr %52, i64 0, i64 %54
  %56 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 1 dereferenceable(1) %55)
          to label %57 unwind label %61

57:                                               ; preds = %49
  br label %58

58:                                               ; preds = %57
  %59 = load i32, ptr %8, align 4, !tbaa !5
  %60 = add nsw i32 %59, 1
  store i32 %60, ptr %8, align 4, !tbaa !5
  br label %44, !llvm.loop !9

61:                                               ; preds = %49
  %62 = landingpad { ptr, i32 }
          cleanup
  %63 = extractvalue { ptr, i32 } %62, 0
  store ptr %63, ptr %4, align 8
  %64 = extractvalue { ptr, i32 } %62, 1
  store i32 %64, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %442

65:                                               ; preds = %48
  br label %66

66:                                               ; preds = %65
  %67 = load i32, ptr %7, align 4, !tbaa !5
  %68 = add nsw i32 %67, 1
  store i32 %68, ptr %7, align 4, !tbaa !5
  br label %38, !llvm.loop !11

69:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %70

70:                                               ; preds = %343, %69
  %71 = load i32, ptr %9, align 4, !tbaa !5
  %72 = load i32, ptr @N, align 4, !tbaa !5
  %73 = sub nsw i32 %72, 1
  %74 = icmp slt i32 %71, %73
  br i1 %74, label %76, label %75

75:                                               ; preds = %70
  store i32 8, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %346

76:                                               ; preds = %70
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %77

77:                                               ; preds = %298, %76
  %78 = load i32, ptr %10, align 4, !tbaa !5
  %79 = load i32, ptr %9, align 4, !tbaa !5
  %80 = add nsw i32 %79, 1
  %81 = icmp slt i32 %78, %80
  br i1 %81, label %83, label %82

82:                                               ; preds = %77
  store i32 11, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %301

83:                                               ; preds = %77
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %84

84:                                               ; preds = %293, %83
  %85 = load i32, ptr %11, align 4, !tbaa !5
  %86 = load i32, ptr %9, align 4, !tbaa !5
  %87 = add nsw i32 %86, 1
  %88 = icmp slt i32 %85, %87
  br i1 %88, label %90, label %89

89:                                               ; preds = %84
  store i32 14, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %297

90:                                               ; preds = %84
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  %91 = load i32, ptr %9, align 4, !tbaa !5
  %92 = load i32, ptr %10, align 4, !tbaa !5
  %93 = sub nsw i32 %91, %92
  store i32 %93, ptr %13, align 4, !tbaa !5
  invoke void @_ZNSt4pairIiiEC2IRiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %12, ptr noundef nonnull align 4 dereferenceable(4) %10, ptr noundef nonnull align 4 dereferenceable(4) %13)
          to label %94 unwind label %118

94:                                               ; preds = %90
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  %95 = load i32, ptr @N, align 4, !tbaa !5
  %96 = sub nsw i32 %95, 1
  %97 = load i32, ptr %11, align 4, !tbaa !5
  %98 = sub nsw i32 %96, %97
  store i32 %98, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  %99 = load i32, ptr @N, align 4, !tbaa !5
  %100 = sub nsw i32 %99, 1
  %101 = load i32, ptr %9, align 4, !tbaa !5
  %102 = sub nsw i32 %100, %101
  %103 = load i32, ptr %11, align 4, !tbaa !5
  %104 = add nsw i32 %102, %103
  store i32 %104, ptr %16, align 4, !tbaa !5
  invoke void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 4 dereferenceable(8) %14, ptr noundef nonnull align 4 dereferenceable(4) %15, ptr noundef nonnull align 4 dereferenceable(4) %16)
          to label %105 unwind label %122

105:                                              ; preds = %94
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  %106 = getelementptr inbounds %"struct.std::pair", ptr %12, i32 0, i32 0
  %107 = load i32, ptr %106, align 4, !tbaa !12
  %108 = getelementptr inbounds %"struct.std::pair", ptr %14, i32 0, i32 0
  %109 = load i32, ptr %108, align 4, !tbaa !12
  %110 = icmp sgt i32 %107, %109
  br i1 %110, label %117, label %111

111:                                              ; preds = %105
  %112 = getelementptr inbounds %"struct.std::pair", ptr %12, i32 0, i32 1
  %113 = load i32, ptr %112, align 4, !tbaa !14
  %114 = getelementptr inbounds %"struct.std::pair", ptr %14, i32 0, i32 1
  %115 = load i32, ptr %114, align 4, !tbaa !14
  %116 = icmp sgt i32 %113, %115
  br i1 %116, label %117, label %126

117:                                              ; preds = %111, %105
  store i32 16, ptr %6, align 4
  br label %290

118:                                              ; preds = %90
  %119 = landingpad { ptr, i32 }
          cleanup
  %120 = extractvalue { ptr, i32 } %119, 0
  store ptr %120, ptr %4, align 8
  %121 = extractvalue { ptr, i32 } %119, 1
  store i32 %121, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %296

122:                                              ; preds = %94
  %123 = landingpad { ptr, i32 }
          cleanup
  %124 = extractvalue { ptr, i32 } %123, 0
  store ptr %124, ptr %4, align 8
  %125 = extractvalue { ptr, i32 } %123, 1
  store i32 %125, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  br label %296

126:                                              ; preds = %111
  %127 = getelementptr inbounds %"struct.std::pair", ptr %12, i32 0, i32 0
  %128 = load i32, ptr %127, align 4, !tbaa !12
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds [500 x [500 x i8]], ptr @grid, i64 0, i64 %129
  %131 = getelementptr inbounds %"struct.std::pair", ptr %12, i32 0, i32 1
  %132 = load i32, ptr %131, align 4, !tbaa !14
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [500 x i8], ptr %130, i64 0, i64 %133
  %135 = load i8, ptr %134, align 1, !tbaa !15
  %136 = sext i8 %135 to i32
  %137 = getelementptr inbounds %"struct.std::pair", ptr %14, i32 0, i32 0
  %138 = load i32, ptr %137, align 4, !tbaa !12
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [500 x [500 x i8]], ptr @grid, i64 0, i64 %139
  %141 = getelementptr inbounds %"struct.std::pair", ptr %14, i32 0, i32 1
  %142 = load i32, ptr %141, align 4, !tbaa !14
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds [500 x i8], ptr %140, i64 0, i64 %143
  %145 = load i8, ptr %144, align 1, !tbaa !15
  %146 = sext i8 %145 to i32
  %147 = icmp eq i32 %136, %146
  br i1 %147, label %148, label %256

148:                                              ; preds = %126
  %149 = load i32, ptr %9, align 4, !tbaa !5
  %150 = icmp sgt i32 %149, 0
  br i1 %150, label %151, label %256

151:                                              ; preds = %148
  %152 = load i32, ptr %10, align 4, !tbaa !5
  %153 = icmp ne i32 %152, 0
  br i1 %153, label %154, label %206

154:                                              ; preds = %151
  %155 = load i32, ptr %11, align 4, !tbaa !5
  %156 = icmp ne i32 %155, 0
  br i1 %156, label %157, label %182

157:                                              ; preds = %154
  %158 = load i32, ptr %10, align 4, !tbaa !5
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds [500 x [500 x i32]], ptr @dp1, i64 0, i64 %159
  %161 = load i32, ptr %11, align 4, !tbaa !5
  %162 = sext i32 %161 to i64
  %163 = getelementptr inbounds [500 x i32], ptr %160, i64 0, i64 %162
  %164 = load i32, ptr %163, align 4, !tbaa !5
  %165 = load i32, ptr %10, align 4, !tbaa !5
  %166 = sub nsw i32 %165, 1
  %167 = sext i32 %166 to i64
  %168 = getelementptr inbounds [500 x [500 x i32]], ptr @dp, i64 0, i64 %167
  %169 = load i32, ptr %11, align 4, !tbaa !5
  %170 = sub nsw i32 %169, 1
  %171 = sext i32 %170 to i64
  %172 = getelementptr inbounds [500 x i32], ptr %168, i64 0, i64 %171
  %173 = load i32, ptr %172, align 4, !tbaa !5
  %174 = add nsw i32 %164, %173
  %175 = srem i32 %174, 1000000007
  %176 = load i32, ptr %10, align 4, !tbaa !5
  %177 = sext i32 %176 to i64
  %178 = getelementptr inbounds [500 x [500 x i32]], ptr @dp1, i64 0, i64 %177
  %179 = load i32, ptr %11, align 4, !tbaa !5
  %180 = sext i32 %179 to i64
  %181 = getelementptr inbounds [500 x i32], ptr %178, i64 0, i64 %180
  store i32 %175, ptr %181, align 4, !tbaa !5
  br label %182

182:                                              ; preds = %157, %154
  %183 = load i32, ptr %10, align 4, !tbaa !5
  %184 = sext i32 %183 to i64
  %185 = getelementptr inbounds [500 x [500 x i32]], ptr @dp1, i64 0, i64 %184
  %186 = load i32, ptr %11, align 4, !tbaa !5
  %187 = sext i32 %186 to i64
  %188 = getelementptr inbounds [500 x i32], ptr %185, i64 0, i64 %187
  %189 = load i32, ptr %188, align 4, !tbaa !5
  %190 = load i32, ptr %10, align 4, !tbaa !5
  %191 = sub nsw i32 %190, 1
  %192 = sext i32 %191 to i64
  %193 = getelementptr inbounds [500 x [500 x i32]], ptr @dp, i64 0, i64 %192
  %194 = load i32, ptr %11, align 4, !tbaa !5
  %195 = sext i32 %194 to i64
  %196 = getelementptr inbounds [500 x i32], ptr %193, i64 0, i64 %195
  %197 = load i32, ptr %196, align 4, !tbaa !5
  %198 = add nsw i32 %189, %197
  %199 = srem i32 %198, 1000000007
  %200 = load i32, ptr %10, align 4, !tbaa !5
  %201 = sext i32 %200 to i64
  %202 = getelementptr inbounds [500 x [500 x i32]], ptr @dp1, i64 0, i64 %201
  %203 = load i32, ptr %11, align 4, !tbaa !5
  %204 = sext i32 %203 to i64
  %205 = getelementptr inbounds [500 x i32], ptr %202, i64 0, i64 %204
  store i32 %199, ptr %205, align 4, !tbaa !5
  br label %206

206:                                              ; preds = %182, %151
  %207 = load i32, ptr %11, align 4, !tbaa !5
  %208 = icmp ne i32 %207, 0
  br i1 %208, label %209, label %233

209:                                              ; preds = %206
  %210 = load i32, ptr %10, align 4, !tbaa !5
  %211 = sext i32 %210 to i64
  %212 = getelementptr inbounds [500 x [500 x i32]], ptr @dp1, i64 0, i64 %211
  %213 = load i32, ptr %11, align 4, !tbaa !5
  %214 = sext i32 %213 to i64
  %215 = getelementptr inbounds [500 x i32], ptr %212, i64 0, i64 %214
  %216 = load i32, ptr %215, align 4, !tbaa !5
  %217 = load i32, ptr %10, align 4, !tbaa !5
  %218 = sext i32 %217 to i64
  %219 = getelementptr inbounds [500 x [500 x i32]], ptr @dp, i64 0, i64 %218
  %220 = load i32, ptr %11, align 4, !tbaa !5
  %221 = sub nsw i32 %220, 1
  %222 = sext i32 %221 to i64
  %223 = getelementptr inbounds [500 x i32], ptr %219, i64 0, i64 %222
  %224 = load i32, ptr %223, align 4, !tbaa !5
  %225 = add nsw i32 %216, %224
  %226 = srem i32 %225, 1000000007
  %227 = load i32, ptr %10, align 4, !tbaa !5
  %228 = sext i32 %227 to i64
  %229 = getelementptr inbounds [500 x [500 x i32]], ptr @dp1, i64 0, i64 %228
  %230 = load i32, ptr %11, align 4, !tbaa !5
  %231 = sext i32 %230 to i64
  %232 = getelementptr inbounds [500 x i32], ptr %229, i64 0, i64 %231
  store i32 %226, ptr %232, align 4, !tbaa !5
  br label %233

233:                                              ; preds = %209, %206
  %234 = load i32, ptr %10, align 4, !tbaa !5
  %235 = sext i32 %234 to i64
  %236 = getelementptr inbounds [500 x [500 x i32]], ptr @dp1, i64 0, i64 %235
  %237 = load i32, ptr %11, align 4, !tbaa !5
  %238 = sext i32 %237 to i64
  %239 = getelementptr inbounds [500 x i32], ptr %236, i64 0, i64 %238
  %240 = load i32, ptr %239, align 4, !tbaa !5
  %241 = load i32, ptr %10, align 4, !tbaa !5
  %242 = sext i32 %241 to i64
  %243 = getelementptr inbounds [500 x [500 x i32]], ptr @dp, i64 0, i64 %242
  %244 = load i32, ptr %11, align 4, !tbaa !5
  %245 = sext i32 %244 to i64
  %246 = getelementptr inbounds [500 x i32], ptr %243, i64 0, i64 %245
  %247 = load i32, ptr %246, align 4, !tbaa !5
  %248 = add nsw i32 %240, %247
  %249 = srem i32 %248, 1000000007
  %250 = load i32, ptr %10, align 4, !tbaa !5
  %251 = sext i32 %250 to i64
  %252 = getelementptr inbounds [500 x [500 x i32]], ptr @dp1, i64 0, i64 %251
  %253 = load i32, ptr %11, align 4, !tbaa !5
  %254 = sext i32 %253 to i64
  %255 = getelementptr inbounds [500 x i32], ptr %252, i64 0, i64 %254
  store i32 %249, ptr %255, align 4, !tbaa !5
  br label %289

256:                                              ; preds = %148, %126
  %257 = getelementptr inbounds %"struct.std::pair", ptr %12, i32 0, i32 0
  %258 = load i32, ptr %257, align 4, !tbaa !12
  %259 = sext i32 %258 to i64
  %260 = getelementptr inbounds [500 x [500 x i8]], ptr @grid, i64 0, i64 %259
  %261 = getelementptr inbounds %"struct.std::pair", ptr %12, i32 0, i32 1
  %262 = load i32, ptr %261, align 4, !tbaa !14
  %263 = sext i32 %262 to i64
  %264 = getelementptr inbounds [500 x i8], ptr %260, i64 0, i64 %263
  %265 = load i8, ptr %264, align 1, !tbaa !15
  %266 = sext i8 %265 to i32
  %267 = getelementptr inbounds %"struct.std::pair", ptr %14, i32 0, i32 0
  %268 = load i32, ptr %267, align 4, !tbaa !12
  %269 = sext i32 %268 to i64
  %270 = getelementptr inbounds [500 x [500 x i8]], ptr @grid, i64 0, i64 %269
  %271 = getelementptr inbounds %"struct.std::pair", ptr %14, i32 0, i32 1
  %272 = load i32, ptr %271, align 4, !tbaa !14
  %273 = sext i32 %272 to i64
  %274 = getelementptr inbounds [500 x i8], ptr %270, i64 0, i64 %273
  %275 = load i8, ptr %274, align 1, !tbaa !15
  %276 = sext i8 %275 to i32
  %277 = icmp eq i32 %266, %276
  br i1 %277, label %278, label %288

278:                                              ; preds = %256
  %279 = load i32, ptr %9, align 4, !tbaa !5
  %280 = icmp eq i32 %279, 0
  br i1 %280, label %281, label %288

281:                                              ; preds = %278
  %282 = load i32, ptr %10, align 4, !tbaa !5
  %283 = sext i32 %282 to i64
  %284 = getelementptr inbounds [500 x [500 x i32]], ptr @dp1, i64 0, i64 %283
  %285 = load i32, ptr %11, align 4, !tbaa !5
  %286 = sext i32 %285 to i64
  %287 = getelementptr inbounds [500 x i32], ptr %284, i64 0, i64 %286
  store i32 1, ptr %287, align 4, !tbaa !5
  br label %288

288:                                              ; preds = %281, %278, %256
  br label %289

289:                                              ; preds = %288, %233
  store i32 0, ptr %6, align 4
  br label %290

290:                                              ; preds = %289, %117
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  %291 = load i32, ptr %6, align 4
  switch i32 %291, label %449 [
    i32 0, label %292
    i32 16, label %293
  ]

292:                                              ; preds = %290
  br label %293

293:                                              ; preds = %292, %290
  %294 = load i32, ptr %11, align 4, !tbaa !5
  %295 = add nsw i32 %294, 1
  store i32 %295, ptr %11, align 4, !tbaa !5
  br label %84, !llvm.loop !16

296:                                              ; preds = %122, %118
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %442

297:                                              ; preds = %89
  br label %298

298:                                              ; preds = %297
  %299 = load i32, ptr %10, align 4, !tbaa !5
  %300 = add nsw i32 %299, 1
  store i32 %300, ptr %10, align 4, !tbaa !5
  br label %77, !llvm.loop !17

301:                                              ; preds = %82
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  store i32 0, ptr %17, align 4, !tbaa !5
  br label %302

302:                                              ; preds = %339, %301
  %303 = load i32, ptr %17, align 4, !tbaa !5
  %304 = load i32, ptr %9, align 4, !tbaa !5
  %305 = add nsw i32 %304, 1
  %306 = icmp slt i32 %303, %305
  br i1 %306, label %308, label %307

307:                                              ; preds = %302
  store i32 17, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  br label %342

308:                                              ; preds = %302
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  store i32 0, ptr %18, align 4, !tbaa !5
  br label %309

309:                                              ; preds = %335, %308
  %310 = load i32, ptr %18, align 4, !tbaa !5
  %311 = load i32, ptr %9, align 4, !tbaa !5
  %312 = add nsw i32 %311, 1
  %313 = icmp slt i32 %310, %312
  br i1 %313, label %315, label %314

314:                                              ; preds = %309
  store i32 20, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  br label %338

315:                                              ; preds = %309
  %316 = load i32, ptr %17, align 4, !tbaa !5
  %317 = sext i32 %316 to i64
  %318 = getelementptr inbounds [500 x [500 x i32]], ptr @dp1, i64 0, i64 %317
  %319 = load i32, ptr %18, align 4, !tbaa !5
  %320 = sext i32 %319 to i64
  %321 = getelementptr inbounds [500 x i32], ptr %318, i64 0, i64 %320
  %322 = load i32, ptr %321, align 4, !tbaa !5
  %323 = load i32, ptr %17, align 4, !tbaa !5
  %324 = sext i32 %323 to i64
  %325 = getelementptr inbounds [500 x [500 x i32]], ptr @dp, i64 0, i64 %324
  %326 = load i32, ptr %18, align 4, !tbaa !5
  %327 = sext i32 %326 to i64
  %328 = getelementptr inbounds [500 x i32], ptr %325, i64 0, i64 %327
  store i32 %322, ptr %328, align 4, !tbaa !5
  %329 = load i32, ptr %17, align 4, !tbaa !5
  %330 = sext i32 %329 to i64
  %331 = getelementptr inbounds [500 x [500 x i32]], ptr @dp1, i64 0, i64 %330
  %332 = load i32, ptr %18, align 4, !tbaa !5
  %333 = sext i32 %332 to i64
  %334 = getelementptr inbounds [500 x i32], ptr %331, i64 0, i64 %333
  store i32 0, ptr %334, align 4, !tbaa !5
  br label %335

335:                                              ; preds = %315
  %336 = load i32, ptr %18, align 4, !tbaa !5
  %337 = add nsw i32 %336, 1
  store i32 %337, ptr %18, align 4, !tbaa !5
  br label %309, !llvm.loop !18

338:                                              ; preds = %314
  br label %339

339:                                              ; preds = %338
  %340 = load i32, ptr %17, align 4, !tbaa !5
  %341 = add nsw i32 %340, 1
  store i32 %341, ptr %17, align 4, !tbaa !5
  br label %302, !llvm.loop !19

342:                                              ; preds = %307
  br label %343

343:                                              ; preds = %342
  %344 = load i32, ptr %9, align 4, !tbaa !5
  %345 = add nsw i32 %344, 1
  store i32 %345, ptr %9, align 4, !tbaa !5
  br label %70, !llvm.loop !20

346:                                              ; preds = %75
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #5
  store i32 0, ptr %19, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #5
  store i32 0, ptr %20, align 4, !tbaa !5
  br label %347

347:                                              ; preds = %427, %346
  %348 = load i32, ptr %20, align 4, !tbaa !5
  %349 = load i32, ptr @N, align 4, !tbaa !5
  %350 = icmp slt i32 %348, %349
  br i1 %350, label %352, label %351

351:                                              ; preds = %347
  store i32 23, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #5
  br label %430

352:                                              ; preds = %347
  %353 = load i32, ptr %19, align 4, !tbaa !5
  %354 = load i32, ptr %20, align 4, !tbaa !5
  %355 = sext i32 %354 to i64
  %356 = getelementptr inbounds [500 x [500 x i32]], ptr @dp, i64 0, i64 %355
  %357 = load i32, ptr @N, align 4, !tbaa !5
  %358 = sub nsw i32 %357, 1
  %359 = load i32, ptr %20, align 4, !tbaa !5
  %360 = sub nsw i32 %358, %359
  %361 = sext i32 %360 to i64
  %362 = getelementptr inbounds [500 x i32], ptr %356, i64 0, i64 %361
  %363 = load i32, ptr %362, align 4, !tbaa !5
  %364 = add nsw i32 %353, %363
  %365 = srem i32 %364, 1000000007
  store i32 %365, ptr %19, align 4, !tbaa !5
  %366 = load i32, ptr @N, align 4, !tbaa !5
  %367 = sub nsw i32 %366, 2
  %368 = load i32, ptr %20, align 4, !tbaa !5
  %369 = sub nsw i32 %367, %368
  %370 = icmp sge i32 %369, 0
  br i1 %370, label %371, label %386

371:                                              ; preds = %352
  %372 = load i32, ptr %19, align 4, !tbaa !5
  %373 = load i32, ptr %20, align 4, !tbaa !5
  %374 = sext i32 %373 to i64
  %375 = getelementptr inbounds [500 x [500 x i32]], ptr @dp, i64 0, i64 %374
  %376 = load i32, ptr @N, align 4, !tbaa !5
  %377 = sub nsw i32 %376, 1
  %378 = load i32, ptr %20, align 4, !tbaa !5
  %379 = sub nsw i32 %377, %378
  %380 = sub nsw i32 %379, 1
  %381 = sext i32 %380 to i64
  %382 = getelementptr inbounds [500 x i32], ptr %375, i64 0, i64 %381
  %383 = load i32, ptr %382, align 4, !tbaa !5
  %384 = add nsw i32 %372, %383
  %385 = srem i32 %384, 1000000007
  store i32 %385, ptr %19, align 4, !tbaa !5
  br label %386

386:                                              ; preds = %371, %352
  %387 = load i32, ptr %20, align 4, !tbaa !5
  %388 = icmp ne i32 %387, 0
  br i1 %388, label %389, label %426

389:                                              ; preds = %386
  %390 = load i32, ptr %19, align 4, !tbaa !5
  %391 = load i32, ptr %20, align 4, !tbaa !5
  %392 = sub nsw i32 %391, 1
  %393 = sext i32 %392 to i64
  %394 = getelementptr inbounds [500 x [500 x i32]], ptr @dp, i64 0, i64 %393
  %395 = load i32, ptr @N, align 4, !tbaa !5
  %396 = sub nsw i32 %395, 1
  %397 = load i32, ptr %20, align 4, !tbaa !5
  %398 = sub nsw i32 %396, %397
  %399 = sext i32 %398 to i64
  %400 = getelementptr inbounds [500 x i32], ptr %394, i64 0, i64 %399
  %401 = load i32, ptr %400, align 4, !tbaa !5
  %402 = add nsw i32 %390, %401
  %403 = srem i32 %402, 1000000007
  store i32 %403, ptr %19, align 4, !tbaa !5
  %404 = load i32, ptr @N, align 4, !tbaa !5
  %405 = sub nsw i32 %404, 2
  %406 = load i32, ptr %20, align 4, !tbaa !5
  %407 = sub nsw i32 %405, %406
  %408 = icmp sge i32 %407, 0
  br i1 %408, label %409, label %425

409:                                              ; preds = %389
  %410 = load i32, ptr %19, align 4, !tbaa !5
  %411 = load i32, ptr %20, align 4, !tbaa !5
  %412 = sub nsw i32 %411, 1
  %413 = sext i32 %412 to i64
  %414 = getelementptr inbounds [500 x [500 x i32]], ptr @dp, i64 0, i64 %413
  %415 = load i32, ptr @N, align 4, !tbaa !5
  %416 = sub nsw i32 %415, 1
  %417 = load i32, ptr %20, align 4, !tbaa !5
  %418 = sub nsw i32 %416, %417
  %419 = sub nsw i32 %418, 1
  %420 = sext i32 %419 to i64
  %421 = getelementptr inbounds [500 x i32], ptr %414, i64 0, i64 %420
  %422 = load i32, ptr %421, align 4, !tbaa !5
  %423 = add nsw i32 %410, %422
  %424 = srem i32 %423, 1000000007
  store i32 %424, ptr %19, align 4, !tbaa !5
  br label %425

425:                                              ; preds = %409, %389
  br label %426

426:                                              ; preds = %425, %386
  br label %427

427:                                              ; preds = %426
  %428 = load i32, ptr %20, align 4, !tbaa !5
  %429 = add nsw i32 %428, 1
  store i32 %429, ptr %20, align 4, !tbaa !5
  br label %347, !llvm.loop !21

430:                                              ; preds = %351
  %431 = load i32, ptr %19, align 4, !tbaa !5
  %432 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %3, i32 noundef %431)
          to label %433 unwind label %438

433:                                              ; preds = %430
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #5
  store i32 0, ptr %6, align 4
  br label %434

434:                                              ; preds = %433, %28
  call void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(248) %3) #5
  call void @llvm.lifetime.end.p0(i64 512, ptr %3) #5
  call void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(256) %2) #5
  call void @llvm.lifetime.end.p0(i64 520, ptr %2) #5
  %435 = load i32, ptr %6, align 4
  switch i32 %435, label %449 [
    i32 0, label %436
    i32 1, label %436
  ]

436:                                              ; preds = %434, %434
  %437 = load i32, ptr %1, align 4
  ret i32 %437

438:                                              ; preds = %430
  %439 = landingpad { ptr, i32 }
          cleanup
  %440 = extractvalue { ptr, i32 } %439, 0
  store ptr %440, ptr %4, align 8
  %441 = extractvalue { ptr, i32 } %439, 1
  store i32 %441, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #5
  br label %442

442:                                              ; preds = %438, %296, %61, %33
  call void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(248) %3) #5
  br label %443

443:                                              ; preds = %442, %29
  call void @llvm.lifetime.end.p0(i64 512, ptr %3) #5
  call void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(256) %2) #5
  call void @llvm.lifetime.end.p0(i64 520, ptr %2) #5
  br label %444

444:                                              ; preds = %443
  %445 = load ptr, ptr %4, align 8
  %446 = load i32, ptr %5, align 4
  %447 = insertvalue { ptr, i32 } poison, ptr %445, 0
  %448 = insertvalue { ptr, i32 } %447, i32 %446, 1
  resume { ptr, i32 } %448

449:                                              ; preds = %434, %290
  unreachable
}

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

; Function Attrs: mustprogress uwtable
declare void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(256), ptr noundef, i32 noundef) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(248), ptr noundef, i32 noundef) unnamed_addr #2 align 2

declare i32 @__gxx_personality_v0(...)

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

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 1 dereferenceable(1)) #3

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIiiEC2IRiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(248)) unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(256)) unnamed_addr #4 align 2

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = !{!13, !6, i64 0}
!13 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!14 = !{!13, !6, i64 4}
!15 = !{!7, !7, i64 0}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}


; 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_ifstream" = type { %"class.std::basic_istream.base", %"class.std::basic_filebuf", %"class.std::basic_ios" }
%"class.std::basic_istream.base" = type { ptr, i64 }
%"class.std::basic_filebuf" = type { %"class.std::basic_streambuf", %union.pthread_mutex_t, %"class.std::__basic_file", i32, %struct.__mbstate_t, %struct.__mbstate_t, %struct.__mbstate_t, ptr, i64, i8, i8, i8, i8, ptr, ptr, i8, ptr, ptr, i64, ptr, ptr }
%"class.std::basic_streambuf" = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, %"class.std::locale" }
%"class.std::locale" = type { ptr }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%"class.std::__basic_file" = type <{ ptr, i8, [7 x i8] }>
%struct.__mbstate_t = type { i32, %union.anon }
%union.anon = type { i32 }
%"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::basic_ofstream" = type { %"class.std::basic_ostream.base", %"class.std::basic_filebuf", %"class.std::basic_ios" }
%"class.std::basic_ostream.base" = type { ptr }
%"struct.std::pair" = type { i32, i32 }

@N = external dso_local global i32, align 4
@dp = external dso_local local_unnamed_addr global [500 x [500 x i32]], align 16
@dp1 = external dso_local local_unnamed_addr global [500 x [500 x i32]], align 16
@grid = external dso_local global [500 x [500 x i8]], align 16
@.str = external hidden unnamed_addr constant [11 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [12 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::basic_ifstream", align 8
  %2 = alloca %"class.std::basic_ofstream", align 8
  %3 = alloca i32, align 4
  %4 = alloca %"struct.std::pair", align 4
  %5 = alloca i32, align 4
  %6 = alloca %"struct.std::pair", align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 520, ptr nonnull %1) #5
  call void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(256) %1, ptr noundef nonnull @.str, i32 noundef 8)
  call void @llvm.lifetime.start.p0(i64 512, ptr nonnull %2) #5
  invoke void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(248) %2, ptr noundef nonnull @.str.2, i32 noundef 16)
          to label %9 unwind label %17

9:                                                ; preds = %0
  %10 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull align 4 dereferenceable(4) @N)
          to label %11 unwind label %19

11:                                               ; preds = %9
  %12 = load i32, ptr @N, align 4, !tbaa !5
  %13 = icmp eq i32 %12, 1
  br i1 %13, label %15, label %.preheader103

.preheader103:                                    ; preds = %11
  %14 = icmp sgt i32 %12, 0
  br i1 %14, label %.preheader102, label %._crit_edge123

15:                                               ; preds = %11
  %16 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %2, i32 noundef 1)
          to label %220 unwind label %19

17:                                               ; preds = %0
  %18 = landingpad { ptr, i32 }
          cleanup
  br label %224

19:                                               ; preds = %15, %9
  %20 = landingpad { ptr, i32 }
          cleanup
  br label %223

.preheader102:                                    ; preds = %.preheader103, %._crit_edge
  %21 = phi i32 [ %26, %._crit_edge ], [ %12, %.preheader103 ]
  %indvars.iv129 = phi i64 [ %indvars.iv.next130, %._crit_edge ], [ 0, %.preheader103 ]
  %22 = icmp sgt i32 %21, 0
  br i1 %22, label %.lr.ph, label %.preheader102.._crit_edge_crit_edge

.preheader102.._crit_edge_crit_edge:              ; preds = %.preheader102
  %.pre197 = sext i32 %21 to i64
  br label %._crit_edge

.preheader101:                                    ; preds = %._crit_edge
  %23 = icmp sgt i32 %26, 1
  br i1 %23, label %.lr.ph119, label %.preheader

.lr.ph119:                                        ; preds = %.preheader101
  %24 = getelementptr inbounds i8, ptr %4, i64 4
  %25 = getelementptr inbounds i8, ptr %6, i64 4
  br label %53

._crit_edge:                                      ; preds = %30, %.preheader102.._crit_edge_crit_edge
  %.pre-phi198 = phi i64 [ %.pre197, %.preheader102.._crit_edge_crit_edge ], [ %32, %30 ]
  %26 = phi i32 [ %21, %.preheader102.._crit_edge_crit_edge ], [ %31, %30 ]
  %indvars.iv.next130 = add nuw nsw i64 %indvars.iv129, 1
  %27 = icmp slt i64 %indvars.iv.next130, %.pre-phi198
  br i1 %27, label %.preheader102, label %.preheader101, !llvm.loop !9

.lr.ph:                                           ; preds = %.preheader102, %30
  %indvars.iv = phi i64 [ %indvars.iv.next, %30 ], [ 0, %.preheader102 ]
  %28 = getelementptr inbounds [500 x [500 x i8]], ptr @grid, i64 0, i64 %indvars.iv129, i64 %indvars.iv
  %29 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_(ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull align 1 dereferenceable(1) %28)
          to label %30 unwind label %34

30:                                               ; preds = %.lr.ph
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %31 = load i32, ptr @N, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = icmp slt i64 %indvars.iv.next, %32
  br i1 %33, label %.lr.ph, label %._crit_edge, !llvm.loop !12

34:                                               ; preds = %.lr.ph
  %35 = landingpad { ptr, i32 }
          cleanup
  br label %223

.loopexit:                                        ; preds = %.loopexit216
  %indvars.iv.next157 = add nuw nsw i64 %indvars.iv156, 1
  %36 = load i32, ptr @N, align 4, !tbaa !5
  %37 = add nsw i32 %36, -1
  %38 = sext i32 %37 to i64
  %39 = icmp slt i64 %indvars.iv.next157, %38
  %indvars.iv.next155 = add nuw nsw i64 %indvars.iv154, 1
  br i1 %39, label %53, label %.preheader, !llvm.loop !13

.preheader:                                       ; preds = %.loopexit, %.preheader101
  %.lcssa104 = phi i32 [ %26, %.preheader101 ], [ %36, %.loopexit ]
  %40 = icmp sgt i32 %.lcssa104, 0
  br i1 %40, label %.lr.ph122, label %._crit_edge123

.lr.ph122:                                        ; preds = %.preheader
  %41 = add nsw i32 %.lcssa104, -2
  %42 = sext i32 %41 to i64
  %43 = zext nneg i32 %.lcssa104 to i64
  %wide.trip.count = zext nneg i32 %.lcssa104 to i64
  %44 = add nsw i64 %43, -1
  %45 = getelementptr inbounds [500 x [500 x i32]], ptr @dp, i64 0, i64 0, i64 %44
  %46 = load i32, ptr %45, align 4, !tbaa !5
  %47 = srem i32 %46, 1000000007
  %.not.peel = icmp eq i32 %.lcssa104, 1
  br i1 %.not.peel, label %._crit_edge123, label %.peel.next166

.peel.next166:                                    ; preds = %.lr.ph122
  %48 = add nsw i64 %43, -2
  %49 = getelementptr inbounds [500 x [500 x i32]], ptr @dp, i64 0, i64 0, i64 %48
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = add nsw i32 %50, %47
  %52 = srem i32 %51, 1000000007
  br label %194

53:                                               ; preds = %.lr.ph119, %.loopexit
  %indvars.iv156 = phi i64 [ 0, %.lr.ph119 ], [ %indvars.iv.next157, %.loopexit ]
  %indvars.iv154 = phi i64 [ 1, %.lr.ph119 ], [ %indvars.iv.next155, %.loopexit ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  %54 = xor i64 %indvars.iv156, -1
  %.not125 = icmp eq i64 %indvars.iv156, 0
  store i32 0, ptr %3, align 4, !tbaa !5
  br i1 %.not125, label %.preheader100, label %.preheader100.us.preheader

.preheader100.us.preheader:                       ; preds = %53
  %55 = trunc nuw nsw i64 %indvars.iv156 to i32
  %56 = trunc nsw i64 %54 to i32
  %exitcond.peel.not = icmp eq i64 %indvars.iv154, 1
  br label %.preheader100.us

.preheader100.us:                                 ; preds = %.preheader100.us.preheader, %.split.us112
  %57 = phi i32 [ 0, %.preheader100.us.preheader ], [ %150, %.split.us112 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  %58 = sub nsw i32 %55, %57
  store i32 %58, ptr %5, align 4, !tbaa !5
  call void @_ZNSt4pairIiiEC2IRiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %4, ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %5)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #5
  %59 = load i32, ptr @N, align 4, !tbaa !5
  %60 = add i32 %59, -1
  store i32 %60, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #5
  %61 = add i32 %59, %56
  store i32 %61, ptr %8, align 4, !tbaa !5
  call void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 4 dereferenceable(8) %6, ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %8)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #5
  %62 = load i32, ptr %4, align 4, !tbaa !14
  %63 = load i32, ptr %6, align 4, !tbaa !14
  %64 = icmp sgt i32 %62, %63
  br i1 %64, label %91, label %65

65:                                               ; preds = %.preheader100.us
  %66 = load i32, ptr %24, align 4, !tbaa !16
  %67 = load i32, ptr %25, align 4, !tbaa !16
  %68 = icmp sgt i32 %66, %67
  br i1 %68, label %91, label %69

69:                                               ; preds = %65
  %70 = sext i32 %62 to i64
  %71 = sext i32 %66 to i64
  %72 = getelementptr inbounds [500 x [500 x i8]], ptr @grid, i64 0, i64 %70, i64 %71
  %73 = load i8, ptr %72, align 1, !tbaa !17
  %74 = sext i32 %63 to i64
  %75 = sext i32 %67 to i64
  %76 = getelementptr inbounds [500 x [500 x i8]], ptr @grid, i64 0, i64 %74, i64 %75
  %77 = load i8, ptr %76, align 1, !tbaa !17
  %78 = icmp eq i8 %73, %77
  br i1 %78, label %79, label %91

79:                                               ; preds = %69
  %80 = load i32, ptr %3, align 4, !tbaa !5
  %.not94.us.peel = icmp eq i32 %80, 0
  br i1 %.not94.us.peel, label %._crit_edge170, label %._crit_edge168

._crit_edge168:                                   ; preds = %79
  %.pre193 = add nsw i32 %80, -1
  %.pre195 = sext i32 %.pre193 to i64
  %.phi.trans.insert = sext i32 %80 to i64
  %.phi.trans.insert169 = getelementptr inbounds [500 x [500 x i32]], ptr @dp1, i64 0, i64 %.phi.trans.insert, i64 0
  %.pre = load i32, ptr %.phi.trans.insert169, align 16, !tbaa !5
  %81 = getelementptr inbounds [500 x [500 x i32]], ptr @dp1, i64 0, i64 %.phi.trans.insert, i64 0
  %82 = getelementptr inbounds [500 x [500 x i32]], ptr @dp, i64 0, i64 %.pre195, i64 0
  %83 = load i32, ptr %82, align 16, !tbaa !5
  %84 = add nsw i32 %83, %.pre
  %85 = srem i32 %84, 1000000007
  store i32 %85, ptr %81, align 16, !tbaa !5
  br label %._crit_edge170

._crit_edge170:                                   ; preds = %._crit_edge168, %79
  %.phi.trans.insert171 = sext i32 %80 to i64
  %.phi.trans.insert172 = getelementptr inbounds [500 x [500 x i32]], ptr @dp1, i64 0, i64 %.phi.trans.insert171, i64 0
  %.pre173 = load i32, ptr %.phi.trans.insert172, align 16, !tbaa !5
  %86 = getelementptr inbounds [500 x [500 x i32]], ptr @dp1, i64 0, i64 %.phi.trans.insert171, i64 0
  %87 = getelementptr inbounds [500 x [500 x i32]], ptr @dp, i64 0, i64 %.phi.trans.insert171, i64 0
  %88 = load i32, ptr %87, align 16, !tbaa !5
  %89 = add nsw i32 %88, %.pre173
  %90 = srem i32 %89, 1000000007
  store i32 %90, ptr %86, align 16, !tbaa !5
  br label %91

91:                                               ; preds = %._crit_edge170, %69, %65, %.preheader100.us
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  br i1 %exitcond.peel.not, label %.split.us112, label %.peel.next

.peel.next:                                       ; preds = %91, %148
  %indvars.iv132 = phi i64 [ %indvars.iv.next133, %148 ], [ 1, %91 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  %92 = load i32, ptr %3, align 4, !tbaa !5
  %93 = sub nsw i32 %55, %92
  store i32 %93, ptr %5, align 4, !tbaa !5
  call void @_ZNSt4pairIiiEC2IRiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %4, ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %5)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #5
  %94 = load i32, ptr @N, align 4, !tbaa !5
  %95 = trunc i64 %indvars.iv132 to i32
  %96 = xor i32 %95, -1
  %97 = add i32 %94, %96
  store i32 %97, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #5
  %98 = add nsw i64 %indvars.iv132, %54
  %99 = trunc nsw i64 %98 to i32
  %100 = add i32 %94, %99
  store i32 %100, ptr %8, align 4, !tbaa !5
  call void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 4 dereferenceable(8) %6, ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %8)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #5
  %101 = load i32, ptr %4, align 4, !tbaa !14
  %102 = load i32, ptr %6, align 4, !tbaa !14
  %103 = icmp sgt i32 %101, %102
  br i1 %103, label %148, label %104

104:                                              ; preds = %.peel.next
  %105 = load i32, ptr %24, align 4, !tbaa !16
  %106 = load i32, ptr %25, align 4, !tbaa !16
  %107 = icmp sgt i32 %105, %106
  br i1 %107, label %148, label %108

108:                                              ; preds = %104
  %109 = sext i32 %101 to i64
  %110 = sext i32 %105 to i64
  %111 = getelementptr inbounds [500 x [500 x i8]], ptr @grid, i64 0, i64 %109, i64 %110
  %112 = load i8, ptr %111, align 1, !tbaa !17
  %113 = sext i32 %102 to i64
  %114 = sext i32 %106 to i64
  %115 = getelementptr inbounds [500 x [500 x i8]], ptr @grid, i64 0, i64 %113, i64 %114
  %116 = load i8, ptr %115, align 1, !tbaa !17
  %117 = icmp eq i8 %112, %116
  br i1 %117, label %118, label %148

118:                                              ; preds = %108
  %119 = load i32, ptr %3, align 4, !tbaa !5
  %.not94.us = icmp eq i32 %119, 0
  br i1 %.not94.us, label %136, label %120

120:                                              ; preds = %118
  %121 = sext i32 %119 to i64
  %122 = getelementptr inbounds [500 x [500 x i32]], ptr @dp1, i64 0, i64 %121, i64 %indvars.iv132
  %123 = load i32, ptr %122, align 4, !tbaa !5
  %124 = add nsw i32 %119, -1
  %125 = sext i32 %124 to i64
  %126 = add nsw i64 %indvars.iv132, -1
  %127 = getelementptr inbounds [500 x [500 x i32]], ptr @dp, i64 0, i64 %125, i64 %126
  %128 = load i32, ptr %127, align 4, !tbaa !5
  %129 = add nsw i32 %128, %123
  %130 = srem i32 %129, 1000000007
  %131 = getelementptr inbounds [500 x [500 x i32]], ptr @dp1, i64 0, i64 %121, i64 %indvars.iv132
  %132 = getelementptr inbounds [500 x [500 x i32]], ptr @dp, i64 0, i64 %125, i64 %indvars.iv132
  %133 = load i32, ptr %132, align 4, !tbaa !5
  %134 = add nsw i32 %133, %130
  %135 = srem i32 %134, 1000000007
  store i32 %135, ptr %131, align 4, !tbaa !5
  br label %136

136:                                              ; preds = %120, %118
  %137 = sext i32 %119 to i64
  %138 = getelementptr inbounds [500 x [500 x i32]], ptr @dp1, i64 0, i64 %137, i64 %indvars.iv132
  %139 = load i32, ptr %138, align 4, !tbaa !5
  %140 = add nsw i64 %indvars.iv132, -1
  %141 = getelementptr inbounds [500 x [500 x i32]], ptr @dp, i64 0, i64 %137, i64 %140
  %142 = load i32, ptr %141, align 4, !tbaa !5
  %143 = add nsw i32 %142, %139
  %144 = srem i32 %143, 1000000007
  %.phi.trans.insert183 = getelementptr inbounds [500 x [500 x i32]], ptr @dp, i64 0, i64 %137, i64 %indvars.iv132
  %.pre184 = load i32, ptr %.phi.trans.insert183, align 4, !tbaa !5
  %145 = getelementptr inbounds [500 x [500 x i32]], ptr @dp1, i64 0, i64 %137, i64 %indvars.iv132
  %146 = add nsw i32 %.pre184, %144
  %147 = srem i32 %146, 1000000007
  store i32 %147, ptr %145, align 4, !tbaa !5
  br label %148

148:                                              ; preds = %108, %136, %104, %.peel.next
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  %indvars.iv.next133 = add nuw nsw i64 %indvars.iv132, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next133, %indvars.iv154
  br i1 %exitcond.not, label %.split.us112, label %.peel.next, !llvm.loop !18

.split.us112:                                     ; preds = %148, %91
  %149 = load i32, ptr %3, align 4, !tbaa !5
  %150 = add nsw i32 %149, 1
  store i32 %150, ptr %3, align 4, !tbaa !5
  %151 = sext i32 %149 to i64
  %.not90.us.not = icmp sgt i64 %indvars.iv156, %151
  br i1 %.not90.us.not, label %.preheader100.us, label %.split115.us, !llvm.loop !20

.preheader100:                                    ; preds = %53, %.preheader100.backedge
  %indvars.iv138 = phi i64 [ %indvars.iv138.be, %.preheader100.backedge ], [ 0, %53 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  %152 = load i32, ptr %3, align 4, !tbaa !5
  %153 = sub nsw i32 0, %152
  store i32 %153, ptr %5, align 4, !tbaa !5
  call void @_ZNSt4pairIiiEC2IRiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %4, ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %5)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #5
  %154 = load i32, ptr @N, align 4, !tbaa !5
  %155 = trunc nuw nsw i64 %indvars.iv138 to i32
  %156 = xor i32 %155, -1
  %157 = add i32 %154, %156
  store i32 %157, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #5
  %158 = trunc i64 %indvars.iv138 to i32
  %159 = add i32 %158, -1
  %160 = add i32 %159, %154
  store i32 %160, ptr %8, align 4, !tbaa !5
  call void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 4 dereferenceable(8) %6, ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %8)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #5
  %161 = load i32, ptr %4, align 4, !tbaa !14
  %162 = load i32, ptr %6, align 4, !tbaa !14
  %163 = icmp sgt i32 %161, %162
  br i1 %163, label %182, label %164

164:                                              ; preds = %.preheader100
  %165 = load i32, ptr %24, align 4, !tbaa !16
  %166 = load i32, ptr %25, align 4, !tbaa !16
  %167 = icmp sgt i32 %165, %166
  br i1 %167, label %182, label %168

168:                                              ; preds = %164
  %169 = sext i32 %161 to i64
  %170 = sext i32 %165 to i64
  %171 = getelementptr inbounds [500 x [500 x i8]], ptr @grid, i64 0, i64 %169, i64 %170
  %172 = load i8, ptr %171, align 1, !tbaa !17
  %173 = sext i32 %162 to i64
  %174 = sext i32 %166 to i64
  %175 = getelementptr inbounds [500 x [500 x i8]], ptr @grid, i64 0, i64 %173, i64 %174
  %176 = load i8, ptr %175, align 1, !tbaa !17
  %177 = icmp eq i8 %172, %176
  br i1 %177, label %178, label %182

178:                                              ; preds = %168
  %179 = load i32, ptr %3, align 4, !tbaa !5
  %180 = sext i32 %179 to i64
  %181 = getelementptr inbounds [500 x [500 x i32]], ptr @dp1, i64 0, i64 %180, i64 %indvars.iv138
  store i32 1, ptr %181, align 4, !tbaa !5
  br label %182

182:                                              ; preds = %178, %168, %164, %.preheader100
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  %indvars.iv.next139 = add nuw nsw i64 %indvars.iv138, 1
  %exitcond142.not = icmp eq i64 %indvars.iv.next139, %indvars.iv154
  br i1 %exitcond142.not, label %.split.us, label %.preheader100.backedge

.preheader100.backedge:                           ; preds = %182, %.split.us
  %indvars.iv138.be = phi i64 [ %indvars.iv.next139, %182 ], [ 0, %.split.us ]
  br label %.preheader100, !llvm.loop !20

.split.us:                                        ; preds = %182
  %183 = load i32, ptr %3, align 4, !tbaa !5
  %184 = add nsw i32 %183, 1
  store i32 %184, ptr %3, align 4, !tbaa !5
  %.not90.not = icmp slt i32 %183, 0
  br i1 %.not90.not, label %.preheader100.backedge, label %.split115.us

.split115.us:                                     ; preds = %.split.us112, %.split.us
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  %min.iters.check = icmp ult i64 %indvars.iv154, 8
  %n.vec = and i64 %indvars.iv154, 9223372036854775800
  %cmp.n = icmp eq i64 %indvars.iv154, %n.vec
  br label %.preheader99

.preheader99:                                     ; preds = %.split115.us, %.loopexit216
  %indvars.iv149 = phi i64 [ 0, %.split115.us ], [ %indvars.iv.next150, %.loopexit216 ]
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.body

scalar.ph.preheader:                              ; preds = %middle.block, %.preheader99
  %indvars.iv144.ph = phi i64 [ 0, %.preheader99 ], [ %n.vec, %middle.block ]
  br label %scalar.ph

vector.body:                                      ; preds = %.preheader99, %vector.body
  %index = phi i64 [ %index.next, %vector.body ], [ 0, %.preheader99 ]
  %185 = getelementptr inbounds [500 x [500 x i32]], ptr @dp1, i64 0, i64 %indvars.iv149, i64 %index
  %186 = getelementptr inbounds i8, ptr %185, i64 16
  %wide.load = load <4 x i32>, ptr %185, align 16, !tbaa !5
  %wide.load215 = load <4 x i32>, ptr %186, align 16, !tbaa !5
  %187 = getelementptr inbounds [500 x [500 x i32]], ptr @dp, i64 0, i64 %indvars.iv149, i64 %index
  %188 = getelementptr inbounds i8, ptr %187, i64 16
  store <4 x i32> %wide.load, ptr %187, align 16, !tbaa !5
  store <4 x i32> %wide.load215, ptr %188, align 16, !tbaa !5
  store <4 x i32> zeroinitializer, ptr %185, align 16, !tbaa !5
  store <4 x i32> zeroinitializer, ptr %186, align 16, !tbaa !5
  %index.next = add nuw i64 %index, 8
  %189 = icmp eq i64 %index.next, %n.vec
  br i1 %189, label %middle.block, label %vector.body, !llvm.loop !21

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

.loopexit216:                                     ; preds = %scalar.ph, %middle.block
  %indvars.iv.next150 = add nuw nsw i64 %indvars.iv149, 1
  %exitcond153.not = icmp eq i64 %indvars.iv.next150, %indvars.iv154
  br i1 %exitcond153.not, label %.loopexit, label %.preheader99, !llvm.loop !24

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv144 = phi i64 [ %indvars.iv.next145, %scalar.ph ], [ %indvars.iv144.ph, %scalar.ph.preheader ]
  %190 = getelementptr inbounds [500 x [500 x i32]], ptr @dp1, i64 0, i64 %indvars.iv149, i64 %indvars.iv144
  %191 = load i32, ptr %190, align 4, !tbaa !5
  %192 = getelementptr inbounds [500 x [500 x i32]], ptr @dp, i64 0, i64 %indvars.iv149, i64 %indvars.iv144
  store i32 %191, ptr %192, align 4, !tbaa !5
  store i32 0, ptr %190, align 4, !tbaa !5
  %indvars.iv.next145 = add nuw nsw i64 %indvars.iv144, 1
  %exitcond148.not = icmp eq i64 %indvars.iv.next145, %indvars.iv154
  br i1 %exitcond148.not, label %.loopexit216, label %scalar.ph, !llvm.loop !25

._crit_edge123:                                   ; preds = %216, %.lr.ph122, %.preheader103, %.preheader
  %.068.lcssa = phi i32 [ 0, %.preheader ], [ 0, %.preheader103 ], [ %47, %.lr.ph122 ], [ %219, %216 ]
  %193 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %2, i32 noundef %.068.lcssa)
          to label %220 unwind label %221

194:                                              ; preds = %.peel.next166, %216
  %indvars.iv161 = phi i64 [ 1, %.peel.next166 ], [ %indvars.iv.next162, %216 ]
  %.068120 = phi i32 [ %52, %.peel.next166 ], [ %219, %216 ]
  %195 = xor i64 %indvars.iv161, -1
  %196 = add nsw i64 %43, %195
  %197 = getelementptr inbounds [500 x [500 x i32]], ptr @dp, i64 0, i64 %indvars.iv161, i64 %196
  %198 = load i32, ptr %197, align 4, !tbaa !5
  %199 = add nsw i32 %198, %.068120
  %200 = srem i32 %199, 1000000007
  %.not = icmp sgt i64 %indvars.iv161, %42
  br i1 %.not, label %.thread202, label %203

.thread202:                                       ; preds = %194
  %201 = add nsw i64 %indvars.iv161, -1
  %202 = getelementptr inbounds [500 x [500 x i32]], ptr @dp, i64 0, i64 %201, i64 %196
  br label %216

203:                                              ; preds = %194
  %204 = add nsw i64 %196, -1
  %205 = getelementptr inbounds [500 x [500 x i32]], ptr @dp, i64 0, i64 %indvars.iv161, i64 %204
  %206 = load i32, ptr %205, align 4, !tbaa !5
  %207 = add nsw i32 %206, %200
  %208 = srem i32 %207, 1000000007
  %209 = add nsw i64 %indvars.iv161, -1
  %210 = getelementptr inbounds [500 x [500 x i32]], ptr @dp, i64 0, i64 %209, i64 %196
  %211 = load i32, ptr %210, align 4, !tbaa !5
  %212 = add nsw i32 %211, %208
  %213 = srem i32 %212, 1000000007
  %214 = add nsw i64 %196, -1
  %215 = getelementptr inbounds [500 x [500 x i32]], ptr @dp, i64 0, i64 %209, i64 %214
  br label %216

216:                                              ; preds = %.thread202, %203
  %.sink = phi ptr [ %202, %.thread202 ], [ %215, %203 ]
  %.sink209 = phi i32 [ %200, %.thread202 ], [ %213, %203 ]
  %217 = load i32, ptr %.sink, align 4, !tbaa !5
  %218 = add nsw i32 %217, %.sink209
  %219 = srem i32 %218, 1000000007
  %indvars.iv.next162 = add nuw nsw i64 %indvars.iv161, 1
  %exitcond164.not = icmp eq i64 %indvars.iv.next162, %wide.trip.count
  br i1 %exitcond164.not, label %._crit_edge123, label %194, !llvm.loop !26

220:                                              ; preds = %._crit_edge123, %15
  call void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(248) %2) #5
  call void @llvm.lifetime.end.p0(i64 512, ptr nonnull %2) #5
  call void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(256) %1) #5
  call void @llvm.lifetime.end.p0(i64 520, ptr nonnull %1) #5
  ret i32 0

221:                                              ; preds = %._crit_edge123
  %222 = landingpad { ptr, i32 }
          cleanup
  br label %223

223:                                              ; preds = %221, %34, %19
  %.pn = phi { ptr, i32 } [ %20, %19 ], [ %35, %34 ], [ %222, %221 ]
  call void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(248) %2) #5
  br label %224

224:                                              ; preds = %223, %17
  %.pn.pn = phi { ptr, i32 } [ %.pn, %223 ], [ %18, %17 ]
  call void @llvm.lifetime.end.p0(i64 512, ptr nonnull %2) #5
  call void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(256) %1) #5
  call void @llvm.lifetime.end.p0(i64 520, ptr nonnull %1) #5
  resume { ptr, i32 } %.pn.pn
}

; 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 uwtable
declare void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(256), ptr noundef, i32 noundef) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(248), ptr noundef, i32 noundef) unnamed_addr #2 align 2

declare i32 @__gxx_personality_v0(...)

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 #3

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #3

; 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 nounwind uwtable
declare dso_local void @_ZNSt4pairIiiEC2IRiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(248)) unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(256)) unnamed_addr #4 align 2

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10, !11}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.unswitch.partial.disable"}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = !{!15, !6, i64 0}
!15 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!16 = !{!15, !6, i64 4}
!17 = !{!7, !7, i64 0}
!18 = distinct !{!18, !10, !19}
!19 = !{!"llvm.loop.peeled.count", i32 1}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10, !22, !23}
!22 = !{!"llvm.loop.isvectorized", i32 1}
!23 = !{!"llvm.loop.unroll.runtime.disable"}
!24 = distinct !{!24, !10}
!25 = distinct !{!25, !10, !23, !22}
!26 = distinct !{!26, !10, !19}


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