; LLVM IR from bqi343/cp-notebook :: Contests/USACO Solutions/2016-17/Open 2017/Plat (art)

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

@num = external dso_local global [1000001 x i32], align 16
@lowx = external dso_local global [1000001 x i32], align 16
@highx = external dso_local global [1000001 x i32], align 16
@lowy = external dso_local global [1000001 x i32], align 16
@highy = external dso_local global [1000001 x i32], align 16
@n = external dso_local global i32, align 4
@grid = external dso_local global [1000 x [1000 x i32]], align 16
@numc = external dso_local global i32, align 4
@posi = external dso_local global [1000001 x i8], align 16
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [8 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 i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 520, ptr %2) #6
  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) #6
  invoke void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(248) %3, ptr noundef @.str.1, i32 noundef 16)
          to label %16 unwind label %27

16:                                               ; preds = %0
  %17 = 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 %18 unwind label %31

18:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 1, ptr %6, align 4, !tbaa !5
  br label %19

19:                                               ; preds = %51, %18
  %20 = load i32, ptr %6, align 4, !tbaa !5
  %21 = load i32, ptr @n, align 4, !tbaa !5
  %22 = load i32, ptr @n, align 4, !tbaa !5
  %23 = mul nsw i32 %21, %22
  %24 = add nsw i32 %23, 1
  %25 = icmp slt i32 %20, %24
  br i1 %25, label %35, label %26

26:                                               ; preds = %19
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %54

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

31:                                               ; preds = %16
  %32 = landingpad { ptr, i32 }
          cleanup
  %33 = extractvalue { ptr, i32 } %32, 0
  store ptr %33, ptr %4, align 8
  %34 = extractvalue { ptr, i32 } %32, 1
  store i32 %34, ptr %5, align 4
  br label %265

35:                                               ; preds = %19
  %36 = load i32, ptr %6, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [1000001 x i32], ptr @lowx, i64 0, i64 %37
  store i32 1000000007, ptr %38, align 4, !tbaa !5
  %39 = load i32, ptr %6, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [1000001 x i32], ptr @lowy, i64 0, i64 %40
  store i32 1000000007, ptr %41, align 4, !tbaa !5
  %42 = load i32, ptr %6, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [1000001 x i32], ptr @highx, i64 0, i64 %43
  store i32 -1, ptr %44, align 4, !tbaa !5
  %45 = load i32, ptr %6, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [1000001 x i32], ptr @highy, i64 0, i64 %46
  store i32 -1, ptr %47, align 4, !tbaa !5
  %48 = load i32, ptr %6, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [1000001 x i8], ptr @posi, i64 0, i64 %49
  store i8 1, ptr %50, align 1, !tbaa !9
  br label %51

51:                                               ; preds = %35
  %52 = load i32, ptr %6, align 4, !tbaa !5
  %53 = add nsw i32 %52, 1
  store i32 %53, ptr %6, align 4, !tbaa !5
  br label %19, !llvm.loop !11

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

55:                                               ; preds = %149, %54
  %56 = load i32, ptr %7, align 4, !tbaa !5
  %57 = load i32, ptr @n, align 4, !tbaa !5
  %58 = icmp slt i32 %56, %57
  br i1 %58, label %60, label %59

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

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

61:                                               ; preds = %144, %60
  %62 = load i32, ptr %9, align 4, !tbaa !5
  %63 = load i32, ptr @n, align 4, !tbaa !5
  %64 = icmp slt i32 %62, %63
  br i1 %64, label %66, label %65

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

66:                                               ; preds = %61
  %67 = load i32, ptr %7, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [1000 x [1000 x i32]], ptr @grid, i64 0, i64 %68
  %70 = load i32, ptr %9, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [1000 x i32], ptr %69, i64 0, i64 %71
  %73 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 4 dereferenceable(4) %72)
          to label %74 unwind label %93

74:                                               ; preds = %66
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %75 = load i32, ptr %7, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [1000 x [1000 x i32]], ptr @grid, i64 0, i64 %76
  %78 = load i32, ptr %9, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [1000 x i32], ptr %77, i64 0, i64 %79
  %81 = load i32, ptr %80, align 4, !tbaa !5
  store i32 %81, ptr %10, align 4, !tbaa !5
  %82 = load i32, ptr %10, align 4, !tbaa !5
  %83 = icmp ne i32 %82, 0
  br i1 %83, label %84, label %143

84:                                               ; preds = %74
  %85 = load i32, ptr %10, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [1000001 x i32], ptr @num, i64 0, i64 %86
  %88 = load i32, ptr %87, align 4, !tbaa !5
  %89 = icmp eq i32 %88, 0
  br i1 %89, label %90, label %97

90:                                               ; preds = %84
  %91 = load i32, ptr @numc, align 4, !tbaa !5
  %92 = add nsw i32 %91, 1
  store i32 %92, ptr @numc, align 4, !tbaa !5
  br label %97

93:                                               ; preds = %66
  %94 = landingpad { ptr, i32 }
          cleanup
  %95 = extractvalue { ptr, i32 } %94, 0
  store ptr %95, ptr %4, align 8
  %96 = extractvalue { ptr, i32 } %94, 1
  store i32 %96, ptr %5, align 4
  br label %147

97:                                               ; preds = %90, %84
  %98 = load i32, ptr %10, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [1000001 x i32], ptr @num, i64 0, i64 %99
  %101 = load i32, ptr %100, align 4, !tbaa !5
  %102 = add nsw i32 %101, 1
  store i32 %102, ptr %100, align 4, !tbaa !5
  %103 = load i32, ptr %10, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [1000001 x i32], ptr @lowx, i64 0, i64 %104
  %106 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %105, ptr noundef nonnull align 4 dereferenceable(4) %7)
          to label %107 unwind label %139

107:                                              ; preds = %97
  %108 = load i32, ptr %106, align 4, !tbaa !5
  %109 = load i32, ptr %10, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [1000001 x i32], ptr @lowx, i64 0, i64 %110
  store i32 %108, ptr %111, align 4, !tbaa !5
  %112 = load i32, ptr %10, align 4, !tbaa !5
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [1000001 x i32], ptr @lowx, i64 0, i64 %113
  %115 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %114, ptr noundef nonnull align 4 dereferenceable(4) %7)
          to label %116 unwind label %139

116:                                              ; preds = %107
  %117 = load i32, ptr %115, align 4, !tbaa !5
  %118 = load i32, ptr %10, align 4, !tbaa !5
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [1000001 x i32], ptr @highx, i64 0, i64 %119
  store i32 %117, ptr %120, align 4, !tbaa !5
  %121 = load i32, ptr %10, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [1000001 x i32], ptr @lowy, i64 0, i64 %122
  %124 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %123, ptr noundef nonnull align 4 dereferenceable(4) %9)
          to label %125 unwind label %139

125:                                              ; preds = %116
  %126 = load i32, ptr %124, align 4, !tbaa !5
  %127 = load i32, ptr %10, align 4, !tbaa !5
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [1000001 x i32], ptr @lowy, i64 0, i64 %128
  store i32 %126, ptr %129, align 4, !tbaa !5
  %130 = load i32, ptr %10, align 4, !tbaa !5
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [1000001 x i32], ptr @highy, i64 0, i64 %131
  %133 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %132, ptr noundef nonnull align 4 dereferenceable(4) %9)
          to label %134 unwind label %139

134:                                              ; preds = %125
  %135 = load i32, ptr %133, align 4, !tbaa !5
  %136 = load i32, ptr %10, align 4, !tbaa !5
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [1000001 x i32], ptr @highy, i64 0, i64 %137
  store i32 %135, ptr %138, align 4, !tbaa !5
  br label %143

139:                                              ; preds = %125, %116, %107, %97
  %140 = landingpad { ptr, i32 }
          cleanup
  %141 = extractvalue { ptr, i32 } %140, 0
  store ptr %141, ptr %4, align 8
  %142 = extractvalue { ptr, i32 } %140, 1
  store i32 %142, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %147

143:                                              ; preds = %134, %74
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %144

144:                                              ; preds = %143
  %145 = load i32, ptr %9, align 4, !tbaa !5
  %146 = add nsw i32 %145, 1
  store i32 %146, ptr %9, align 4, !tbaa !5
  br label %61, !llvm.loop !13

147:                                              ; preds = %139, %93
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %265

148:                                              ; preds = %65
  br label %149

149:                                              ; preds = %148
  %150 = load i32, ptr %7, align 4, !tbaa !5
  %151 = add nsw i32 %150, 1
  store i32 %151, ptr %7, align 4, !tbaa !5
  br label %55, !llvm.loop !14

152:                                              ; preds = %59
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  store i32 1, ptr %11, align 4, !tbaa !5
  br label %153

153:                                              ; preds = %225, %152
  %154 = load i32, ptr %11, align 4, !tbaa !5
  %155 = load i32, ptr @n, align 4, !tbaa !5
  %156 = load i32, ptr @n, align 4, !tbaa !5
  %157 = mul nsw i32 %155, %156
  %158 = add nsw i32 %157, 1
  %159 = icmp slt i32 %154, %158
  br i1 %159, label %161, label %160

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

161:                                              ; preds = %153
  %162 = load i32, ptr %11, align 4, !tbaa !5
  %163 = sext i32 %162 to i64
  %164 = getelementptr inbounds [1000001 x i32], ptr @lowx, i64 0, i64 %163
  %165 = load i32, ptr %164, align 4, !tbaa !5
  %166 = icmp ne i32 %165, 1000000007
  br i1 %166, label %167, label %224

167:                                              ; preds = %161
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  %168 = load i32, ptr %11, align 4, !tbaa !5
  %169 = sext i32 %168 to i64
  %170 = getelementptr inbounds [1000001 x i32], ptr @lowx, i64 0, i64 %169
  %171 = load i32, ptr %170, align 4, !tbaa !5
  store i32 %171, ptr %12, align 4, !tbaa !5
  br label %172

172:                                              ; preds = %220, %167
  %173 = load i32, ptr %12, align 4, !tbaa !5
  %174 = load i32, ptr %11, align 4, !tbaa !5
  %175 = sext i32 %174 to i64
  %176 = getelementptr inbounds [1000001 x i32], ptr @highx, i64 0, i64 %175
  %177 = load i32, ptr %176, align 4, !tbaa !5
  %178 = add nsw i32 %177, 1
  %179 = icmp slt i32 %173, %178
  br i1 %179, label %181, label %180

180:                                              ; preds = %172
  store i32 14, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %223

181:                                              ; preds = %172
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  %182 = load i32, ptr %11, align 4, !tbaa !5
  %183 = sext i32 %182 to i64
  %184 = getelementptr inbounds [1000001 x i32], ptr @lowy, i64 0, i64 %183
  %185 = load i32, ptr %184, align 4, !tbaa !5
  store i32 %185, ptr %13, align 4, !tbaa !5
  br label %186

186:                                              ; preds = %216, %181
  %187 = load i32, ptr %13, align 4, !tbaa !5
  %188 = load i32, ptr %11, align 4, !tbaa !5
  %189 = sext i32 %188 to i64
  %190 = getelementptr inbounds [1000001 x i32], ptr @highy, i64 0, i64 %189
  %191 = load i32, ptr %190, align 4, !tbaa !5
  %192 = add nsw i32 %191, 1
  %193 = icmp slt i32 %187, %192
  br i1 %193, label %195, label %194

194:                                              ; preds = %186
  store i32 17, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %219

195:                                              ; preds = %186
  %196 = load i32, ptr %12, align 4, !tbaa !5
  %197 = sext i32 %196 to i64
  %198 = getelementptr inbounds [1000 x [1000 x i32]], ptr @grid, i64 0, i64 %197
  %199 = load i32, ptr %13, align 4, !tbaa !5
  %200 = sext i32 %199 to i64
  %201 = getelementptr inbounds [1000 x i32], ptr %198, i64 0, i64 %200
  %202 = load i32, ptr %201, align 4, !tbaa !5
  %203 = load i32, ptr %11, align 4, !tbaa !5
  %204 = icmp ne i32 %202, %203
  br i1 %204, label %205, label %215

205:                                              ; preds = %195
  %206 = load i32, ptr %12, align 4, !tbaa !5
  %207 = sext i32 %206 to i64
  %208 = getelementptr inbounds [1000 x [1000 x i32]], ptr @grid, i64 0, i64 %207
  %209 = load i32, ptr %13, align 4, !tbaa !5
  %210 = sext i32 %209 to i64
  %211 = getelementptr inbounds [1000 x i32], ptr %208, i64 0, i64 %210
  %212 = load i32, ptr %211, align 4, !tbaa !5
  %213 = sext i32 %212 to i64
  %214 = getelementptr inbounds [1000001 x i8], ptr @posi, i64 0, i64 %213
  store i8 0, ptr %214, align 1, !tbaa !9
  br label %215

215:                                              ; preds = %205, %195
  br label %216

216:                                              ; preds = %215
  %217 = load i32, ptr %13, align 4, !tbaa !5
  %218 = add nsw i32 %217, 1
  store i32 %218, ptr %13, align 4, !tbaa !5
  br label %186, !llvm.loop !15

219:                                              ; preds = %194
  br label %220

220:                                              ; preds = %219
  %221 = load i32, ptr %12, align 4, !tbaa !5
  %222 = add nsw i32 %221, 1
  store i32 %222, ptr %12, align 4, !tbaa !5
  br label %172, !llvm.loop !16

223:                                              ; preds = %180
  br label %224

224:                                              ; preds = %223, %161
  br label %225

225:                                              ; preds = %224
  %226 = load i32, ptr %11, align 4, !tbaa !5
  %227 = add nsw i32 %226, 1
  store i32 %227, ptr %11, align 4, !tbaa !5
  br label %153, !llvm.loop !17

228:                                              ; preds = %160
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  store i32 0, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  store i32 1, ptr %15, align 4, !tbaa !5
  br label %229

229:                                              ; preds = %247, %228
  %230 = load i32, ptr %15, align 4, !tbaa !5
  %231 = load i32, ptr @n, align 4, !tbaa !5
  %232 = load i32, ptr @n, align 4, !tbaa !5
  %233 = mul nsw i32 %231, %232
  %234 = add nsw i32 %233, 1
  %235 = icmp slt i32 %230, %234
  br i1 %235, label %237, label %236

236:                                              ; preds = %229
  store i32 20, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  br label %250

237:                                              ; preds = %229
  %238 = load i32, ptr %15, align 4, !tbaa !5
  %239 = sext i32 %238 to i64
  %240 = getelementptr inbounds [1000001 x i8], ptr @posi, i64 0, i64 %239
  %241 = load i8, ptr %240, align 1, !tbaa !9, !range !18, !noundef !19
  %242 = trunc i8 %241 to i1
  br i1 %242, label %243, label %246

243:                                              ; preds = %237
  %244 = load i32, ptr %14, align 4, !tbaa !5
  %245 = add nsw i32 %244, 1
  store i32 %245, ptr %14, align 4, !tbaa !5
  br label %246

246:                                              ; preds = %243, %237
  br label %247

247:                                              ; preds = %246
  %248 = load i32, ptr %15, align 4, !tbaa !5
  %249 = add nsw i32 %248, 1
  store i32 %249, ptr %15, align 4, !tbaa !5
  br label %229, !llvm.loop !20

250:                                              ; preds = %236
  %251 = load i32, ptr @numc, align 4, !tbaa !5
  %252 = icmp eq i32 %251, 1
  br i1 %252, label %253, label %256

253:                                              ; preds = %250
  %254 = load i32, ptr %14, align 4, !tbaa !5
  %255 = add nsw i32 %254, -1
  store i32 %255, ptr %14, align 4, !tbaa !5
  br label %256

256:                                              ; preds = %253, %250
  %257 = load i32, ptr %14, align 4, !tbaa !5
  %258 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %3, i32 noundef %257)
          to label %259 unwind label %261

259:                                              ; preds = %256
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  call void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(248) %3) #6
  call void @llvm.lifetime.end.p0(i64 512, ptr %3) #6
  call void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(256) %2) #6
  call void @llvm.lifetime.end.p0(i64 520, ptr %2) #6
  %260 = load i32, ptr %1, align 4
  ret i32 %260

261:                                              ; preds = %256
  %262 = landingpad { ptr, i32 }
          cleanup
  %263 = extractvalue { ptr, i32 } %262, 0
  store ptr %263, ptr %4, align 8
  %264 = extractvalue { ptr, i32 } %262, 1
  store i32 %264, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %265

265:                                              ; preds = %261, %147, %31
  call void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(248) %3) #6
  br label %266

266:                                              ; preds = %265, %27
  call void @llvm.lifetime.end.p0(i64 512, ptr %3) #6
  call void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(256) %2) #6
  call void @llvm.lifetime.end.p0(i64 520, ptr %2) #6
  br label %267

267:                                              ; preds = %266
  %268 = load ptr, ptr %4, align 8
  %269 = load i32, ptr %5, align 4
  %270 = insertvalue { ptr, i32 } poison, ptr %268, 0
  %271 = insertvalue { ptr, i32 } %270, i32 %269, 1
  resume { ptr, i32 } %271
}

; 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

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(256)) unnamed_addr #5 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 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress 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 = { 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 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = !{i8 0, i8 2}
!19 = !{}
!20 = distinct !{!20, !12}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::basic_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 }

@num = external dso_local local_unnamed_addr global [1000001 x i32], align 16
@lowx = external dso_local global [1000001 x i32], align 16
@highx = external dso_local local_unnamed_addr global [1000001 x i32], align 16
@lowy = external dso_local global [1000001 x i32], align 16
@highy = external dso_local global [1000001 x i32], align 16
@n = external dso_local global i32, align 4
@grid = external dso_local global [1000 x [1000 x i32]], align 16
@numc = external dso_local local_unnamed_addr global i32, align 4
@posi = external dso_local local_unnamed_addr global [1000001 x i8], align 16
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [8 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 i32, align 4
  call void @llvm.lifetime.start.p0(i64 520, ptr nonnull %1) #8
  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) #8
  invoke void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(248) %2, ptr noundef nonnull @.str.1, i32 noundef 16)
          to label %5 unwind label %19

5:                                                ; preds = %0
  %6 = 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 %.preheader67 unwind label %21

.preheader67:                                     ; preds = %5
  %7 = load i32, ptr @n, align 4, !tbaa !5
  %.not70 = icmp eq i32 %7, 0
  br i1 %.not70, label %._crit_edge99, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %.preheader67
  %8 = mul i32 %7, %7
  %9 = call i32 @llvm.umax.i32(i32 %8, i32 1)
  %umax = zext i32 %9 to i64
  %10 = shl nuw nsw i64 %umax, 2
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) getelementptr inbounds (i8, ptr @highx, i64 4), i8 -1, i64 %10, i1 false), !tbaa !5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) getelementptr inbounds (i8, ptr @highy, i64 4), i8 -1, i64 %10, i1 false), !tbaa !5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(1) getelementptr inbounds (i8, ptr @posi, i64 1), i8 1, i64 %umax, i1 false), !tbaa !9
  %umax106 = call i32 @llvm.umax.i32(i32 %8, i32 1)
  %11 = add i32 %umax106, 1
  %wide.trip.count = zext i32 %11 to i64
  %12 = add nsw i64 %wide.trip.count, -1
  %min.iters.check = icmp ult i64 %12, 8
  br i1 %min.iters.check, label %.lr.ph.preheader154, label %vector.ph

.lr.ph.preheader154:                              ; preds = %middle.block, %.lr.ph.preheader
  %indvars.iv.ph = phi i64 [ 1, %.lr.ph.preheader ], [ %ind.end, %middle.block ]
  br label %.lr.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %12, -8
  %ind.end = or disjoint i64 %n.vec, 1
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %offset.idx = or disjoint i64 %index, 1
  %13 = getelementptr inbounds [1000001 x i32], ptr @lowx, i64 0, i64 %offset.idx
  %14 = getelementptr inbounds i8, ptr %13, i64 16
  store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %13, align 4, !tbaa !5
  store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %14, align 4, !tbaa !5
  %15 = getelementptr inbounds [1000001 x i32], ptr @lowy, i64 0, i64 %offset.idx
  %16 = getelementptr inbounds i8, ptr %15, i64 16
  store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %15, align 4, !tbaa !5
  store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %16, align 4, !tbaa !5
  %index.next = add nuw i64 %index, 8
  %17 = icmp eq i64 %index.next, %n.vec
  br i1 %17, label %middle.block, label %vector.body, !llvm.loop !11

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %12, %n.vec
  br i1 %cmp.n, label %._crit_edge, label %.lr.ph.preheader154

._crit_edge:                                      ; preds = %.lr.ph, %middle.block
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #8
  store i32 0, ptr %3, align 4, !tbaa !5
  %18 = icmp sgt i32 %7, 0
  br i1 %18, label %.lr.ph77.split, label %._crit_edge78

19:                                               ; preds = %0
  %20 = landingpad { ptr, i32 }
          cleanup
  br label %130

21:                                               ; preds = %5
  %22 = landingpad { ptr, i32 }
          cleanup
  br label %129

.lr.ph:                                           ; preds = %.lr.ph.preheader154, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ %indvars.iv.ph, %.lr.ph.preheader154 ]
  %23 = getelementptr inbounds [1000001 x i32], ptr @lowx, i64 0, i64 %indvars.iv
  store i32 1000000007, ptr %23, align 4, !tbaa !5
  %24 = getelementptr inbounds [1000001 x i32], ptr @lowy, i64 0, i64 %indvars.iv
  store i32 1000000007, ptr %24, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !15

._crit_edge78:                                    ; preds = %._crit_edge75, %._crit_edge
  %.lcssa68 = phi i32 [ %7, %._crit_edge ], [ %30, %._crit_edge75 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #8
  %25 = mul i32 %.lcssa68, %.lcssa68
  %.not5588 = icmp eq i32 %.lcssa68, 0
  br i1 %.not5588, label %._crit_edge99, label %.lr.ph93.preheader

.lr.ph93.preheader:                               ; preds = %._crit_edge78
  %umax119 = call i32 @llvm.umax.i32(i32 %25, i32 1)
  %26 = add i32 %umax119, 1
  %wide.trip.count120 = zext i32 %26 to i64
  br label %.lr.ph93

.lr.ph77.split:                                   ; preds = %._crit_edge, %._crit_edge75
  %27 = phi i32 [ %30, %._crit_edge75 ], [ %7, %._crit_edge ]
  %28 = phi i32 [ %32, %._crit_edge75 ], [ 0, %._crit_edge ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #8
  store i32 0, ptr %4, align 4, !tbaa !5
  %29 = icmp sgt i32 %27, 0
  br i1 %29, label %.lr.ph74, label %._crit_edge75

._crit_edge75.loopexit:                           ; preds = %70
  %.pre128 = load i32, ptr %3, align 4, !tbaa !5
  br label %._crit_edge75

._crit_edge75:                                    ; preds = %._crit_edge75.loopexit, %.lr.ph77.split
  %30 = phi i32 [ %73, %._crit_edge75.loopexit ], [ %27, %.lr.ph77.split ]
  %31 = phi i32 [ %.pre128, %._crit_edge75.loopexit ], [ %28, %.lr.ph77.split ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #8
  %32 = add nsw i32 %31, 1
  store i32 %32, ptr %3, align 4, !tbaa !5
  %33 = icmp slt i32 %32, %30
  br i1 %33, label %.lr.ph77.split, label %._crit_edge78, !llvm.loop !16

.lr.ph74:                                         ; preds = %.lr.ph77.split, %70
  %storemerge6172 = phi i32 [ %72, %70 ], [ 0, %.lr.ph77.split ]
  %34 = load i32, ptr %3, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = sext i32 %storemerge6172 to i64
  %37 = getelementptr inbounds [1000 x [1000 x i32]], ptr @grid, i64 0, i64 %35, i64 %36
  %38 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull align 4 dereferenceable(4) %37)
          to label %39 unwind label %54

39:                                               ; preds = %.lr.ph74
  %40 = load i32, ptr %3, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = load i32, ptr %4, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [1000 x [1000 x i32]], ptr @grid, i64 0, i64 %41, i64 %43
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %.not64 = icmp eq i32 %45, 0
  br i1 %.not64, label %70, label %46

46:                                               ; preds = %39
  %47 = sext i32 %45 to i64
  %48 = getelementptr inbounds [1000001 x i32], ptr @num, i64 0, i64 %47
  %49 = load i32, ptr %48, align 4, !tbaa !5
  %50 = icmp eq i32 %49, 0
  br i1 %50, label %51, label %56

51:                                               ; preds = %46
  %52 = load i32, ptr @numc, align 4, !tbaa !5
  %53 = add nsw i32 %52, 1
  store i32 %53, ptr @numc, align 4, !tbaa !5
  br label %56

54:                                               ; preds = %.lr.ph74
  %55 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #8
  br label %129

56:                                               ; preds = %51, %46
  %57 = add nsw i32 %49, 1
  store i32 %57, ptr %48, align 4, !tbaa !5
  %58 = getelementptr inbounds [1000001 x i32], ptr @lowx, i64 0, i64 %47
  %59 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %58, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %60 = load i32, ptr %59, align 4, !tbaa !5
  store i32 %60, ptr %58, align 4, !tbaa !5
  %61 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %58, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %62 = load i32, ptr %61, align 4, !tbaa !5
  %63 = getelementptr inbounds [1000001 x i32], ptr @highx, i64 0, i64 %47
  store i32 %62, ptr %63, align 4, !tbaa !5
  %64 = getelementptr inbounds [1000001 x i32], ptr @lowy, i64 0, i64 %47
  %65 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %64, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %66 = load i32, ptr %65, align 4, !tbaa !5
  store i32 %66, ptr %64, align 4, !tbaa !5
  %67 = getelementptr inbounds [1000001 x i32], ptr @highy, i64 0, i64 %47
  %68 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %67, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %69 = load i32, ptr %68, align 4, !tbaa !5
  store i32 %69, ptr %67, align 4, !tbaa !5
  %.pre = load i32, ptr %4, align 4, !tbaa !5
  br label %70

70:                                               ; preds = %56, %39
  %71 = phi i32 [ %.pre, %56 ], [ %42, %39 ]
  %72 = add nsw i32 %71, 1
  store i32 %72, ptr %4, align 4, !tbaa !5
  %73 = load i32, ptr @n, align 4, !tbaa !5
  %74 = icmp slt i32 %72, %73
  br i1 %74, label %.lr.ph74, label %._crit_edge75.loopexit, !llvm.loop !18

.preheader:                                       ; preds = %.loopexit
  br i1 %.not5588, label %._crit_edge99, label %.lr.ph98.preheader

.lr.ph98.preheader:                               ; preds = %.preheader
  %umax125 = call i32 @llvm.umax.i32(i32 %25, i32 1)
  %75 = add i32 %umax125, 1
  %wide.trip.count126 = zext i32 %75 to i64
  %76 = add nsw i64 %wide.trip.count120, -1
  %min.iters.check137 = icmp ult i64 %76, 8
  br i1 %min.iters.check137, label %.lr.ph98.preheader150, label %vector.ph138

.lr.ph98.preheader150:                            ; preds = %middle.block135, %.lr.ph98.preheader
  %indvars.iv122.ph = phi i64 [ 1, %.lr.ph98.preheader ], [ %ind.end141, %middle.block135 ]
  %.04296.ph = phi i32 [ 0, %.lr.ph98.preheader ], [ %84, %middle.block135 ]
  br label %.lr.ph98

vector.ph138:                                     ; preds = %.lr.ph98.preheader
  %n.vec140 = and i64 %76, -8
  %ind.end141 = or disjoint i64 %n.vec140, 1
  br label %vector.body143

vector.body143:                                   ; preds = %vector.body143, %vector.ph138
  %index144 = phi i64 [ 0, %vector.ph138 ], [ %index.next148, %vector.body143 ]
  %vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph138 ], [ %81, %vector.body143 ]
  %vec.phi145 = phi <4 x i32> [ zeroinitializer, %vector.ph138 ], [ %82, %vector.body143 ]
  %offset.idx146 = or disjoint i64 %index144, 1
  %77 = getelementptr inbounds [1000001 x i8], ptr @posi, i64 0, i64 %offset.idx146
  %78 = getelementptr inbounds i8, ptr %77, i64 4
  %wide.load = load <4 x i8>, ptr %77, align 1, !tbaa !9
  %wide.load147 = load <4 x i8>, ptr %78, align 1, !tbaa !9
  %79 = zext <4 x i8> %wide.load to <4 x i32>
  %80 = zext <4 x i8> %wide.load147 to <4 x i32>
  %81 = add <4 x i32> %vec.phi, %79
  %82 = add <4 x i32> %vec.phi145, %80
  %index.next148 = add nuw i64 %index144, 8
  %83 = icmp eq i64 %index.next148, %n.vec140
  br i1 %83, label %middle.block135, label %vector.body143, !llvm.loop !19

middle.block135:                                  ; preds = %vector.body143
  %bin.rdx = add <4 x i32> %82, %81
  %84 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
  %cmp.n149 = icmp eq i64 %76, %n.vec140
  br i1 %cmp.n149, label %._crit_edge99, label %.lr.ph98.preheader150

.lr.ph93:                                         ; preds = %.lr.ph93.preheader, %.loopexit
  %indvars.iv116 = phi i64 [ 1, %.lr.ph93.preheader ], [ %indvars.iv.next117, %.loopexit ]
  %85 = getelementptr inbounds [1000001 x i32], ptr @lowx, i64 0, i64 %indvars.iv116
  %86 = load i32, ptr %85, align 4, !tbaa !5
  %.not57 = icmp eq i32 %86, 1000000007
  br i1 %.not57, label %.loopexit, label %.preheader66

.preheader66:                                     ; preds = %.lr.ph93
  %87 = getelementptr inbounds [1000001 x i32], ptr @highx, i64 0, i64 %indvars.iv116
  %88 = load i32, ptr %87, align 4, !tbaa !5
  %.not5885 = icmp sgt i32 %86, %88
  br i1 %.not5885, label %.loopexit, label %.lr.ph87

.lr.ph87:                                         ; preds = %.preheader66
  %89 = getelementptr inbounds [1000001 x i32], ptr @lowy, i64 0, i64 %indvars.iv116
  %90 = load i32, ptr %89, align 4, !tbaa !5
  %91 = getelementptr inbounds [1000001 x i32], ptr @highy, i64 0, i64 %indvars.iv116
  %92 = load i32, ptr %91, align 4, !tbaa !5
  %.not5980 = icmp sgt i32 %90, %92
  br i1 %.not5980, label %.loopexit, label %.lr.ph83.preheader

.lr.ph83.preheader:                               ; preds = %.lr.ph87
  %93 = sext i32 %90 to i64
  %94 = add i32 %92, 1
  %95 = sext i32 %86 to i64
  %96 = add i32 %88, 1
  %97 = sub i32 %94, %90
  %xtraiter = and i32 %97, 1
  %lcmp.mod.not = icmp eq i32 %xtraiter, 0
  %indvars.iv.next108.prol = add nsw i64 %93, 1
  %98 = icmp eq i32 %92, %90
  br label %.lr.ph83

.lr.ph83:                                         ; preds = %.lr.ph83.preheader, %._crit_edge84
  %indvars.iv111 = phi i64 [ %95, %.lr.ph83.preheader ], [ %indvars.iv.next112, %._crit_edge84 ]
  br i1 %lcmp.mod.not, label %.prol.loopexit, label %.prol.preheader

.prol.preheader:                                  ; preds = %.lr.ph83
  %99 = getelementptr inbounds [1000 x [1000 x i32]], ptr @grid, i64 0, i64 %indvars.iv111, i64 %93
  %100 = load i32, ptr %99, align 4, !tbaa !5
  %101 = zext i32 %100 to i64
  %.not60.prol = icmp eq i64 %indvars.iv116, %101
  br i1 %.not60.prol, label %.prol.loopexit, label %102

102:                                              ; preds = %.prol.preheader
  %103 = sext i32 %100 to i64
  %104 = getelementptr inbounds [1000001 x i8], ptr @posi, i64 0, i64 %103
  store i8 0, ptr %104, align 1, !tbaa !9
  br label %.prol.loopexit

.prol.loopexit:                                   ; preds = %.prol.preheader, %102, %.lr.ph83
  %indvars.iv107.unr = phi i64 [ %93, %.lr.ph83 ], [ %indvars.iv.next108.prol, %102 ], [ %indvars.iv.next108.prol, %.prol.preheader ]
  br i1 %98, label %._crit_edge84, label %.lr.ph83.new

._crit_edge84:                                    ; preds = %118, %.prol.loopexit
  %indvars.iv.next112 = add nsw i64 %indvars.iv111, 1
  %lftr.wideiv114 = trunc i64 %indvars.iv.next112 to i32
  %exitcond115.not = icmp eq i32 %96, %lftr.wideiv114
  br i1 %exitcond115.not, label %.loopexit, label %.lr.ph83, !llvm.loop !20

.lr.ph83.new:                                     ; preds = %.prol.loopexit, %118
  %indvars.iv107 = phi i64 [ %indvars.iv.next108.1, %118 ], [ %indvars.iv107.unr, %.prol.loopexit ]
  %105 = getelementptr inbounds [1000 x [1000 x i32]], ptr @grid, i64 0, i64 %indvars.iv111, i64 %indvars.iv107
  %106 = load i32, ptr %105, align 4, !tbaa !5
  %107 = zext i32 %106 to i64
  %.not60 = icmp eq i64 %indvars.iv116, %107
  br i1 %.not60, label %111, label %108

108:                                              ; preds = %.lr.ph83.new
  %109 = sext i32 %106 to i64
  %110 = getelementptr inbounds [1000001 x i8], ptr @posi, i64 0, i64 %109
  store i8 0, ptr %110, align 1, !tbaa !9
  br label %111

111:                                              ; preds = %.lr.ph83.new, %108
  %indvars.iv.next108 = add nsw i64 %indvars.iv107, 1
  %112 = getelementptr inbounds [1000 x [1000 x i32]], ptr @grid, i64 0, i64 %indvars.iv111, i64 %indvars.iv.next108
  %113 = load i32, ptr %112, align 4, !tbaa !5
  %114 = zext i32 %113 to i64
  %.not60.1 = icmp eq i64 %indvars.iv116, %114
  br i1 %.not60.1, label %118, label %115

115:                                              ; preds = %111
  %116 = sext i32 %113 to i64
  %117 = getelementptr inbounds [1000001 x i8], ptr @posi, i64 0, i64 %116
  store i8 0, ptr %117, align 1, !tbaa !9
  br label %118

118:                                              ; preds = %115, %111
  %indvars.iv.next108.1 = add nsw i64 %indvars.iv107, 2
  %lftr.wideiv.1 = trunc i64 %indvars.iv.next108.1 to i32
  %exitcond110.not.1 = icmp eq i32 %94, %lftr.wideiv.1
  br i1 %exitcond110.not.1, label %._crit_edge84, label %.lr.ph83.new, !llvm.loop !21

.loopexit:                                        ; preds = %._crit_edge84, %.lr.ph87, %.preheader66, %.lr.ph93
  %indvars.iv.next117 = add nuw nsw i64 %indvars.iv116, 1
  %exitcond121.not = icmp eq i64 %indvars.iv.next117, %wide.trip.count120
  br i1 %exitcond121.not, label %.preheader, label %.lr.ph93, !llvm.loop !22

._crit_edge99:                                    ; preds = %.lr.ph98, %middle.block135, %.preheader67, %._crit_edge78, %.preheader
  %.042.lcssa = phi i32 [ 0, %.preheader ], [ 0, %._crit_edge78 ], [ 0, %.preheader67 ], [ %84, %middle.block135 ], [ %spec.select65, %.lr.ph98 ]
  %119 = load i32, ptr @numc, align 4, !tbaa !5
  %120 = icmp eq i32 %119, 1
  %121 = sext i1 %120 to i32
  %spec.select = add nsw i32 %.042.lcssa, %121
  %122 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %2, i32 noundef %spec.select)
          to label %126 unwind label %127

.lr.ph98:                                         ; preds = %.lr.ph98.preheader150, %.lr.ph98
  %indvars.iv122 = phi i64 [ %indvars.iv.next123, %.lr.ph98 ], [ %indvars.iv122.ph, %.lr.ph98.preheader150 ]
  %.04296 = phi i32 [ %spec.select65, %.lr.ph98 ], [ %.04296.ph, %.lr.ph98.preheader150 ]
  %123 = getelementptr inbounds [1000001 x i8], ptr @posi, i64 0, i64 %indvars.iv122
  %124 = load i8, ptr %123, align 1, !tbaa !9, !range !23, !noundef !24
  %125 = zext nneg i8 %124 to i32
  %spec.select65 = add nuw nsw i32 %.04296, %125
  %indvars.iv.next123 = add nuw nsw i64 %indvars.iv122, 1
  %exitcond127.not = icmp eq i64 %indvars.iv.next123, %wide.trip.count126
  br i1 %exitcond127.not, label %._crit_edge99, label %.lr.ph98, !llvm.loop !25

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

127:                                              ; preds = %._crit_edge99
  %128 = landingpad { ptr, i32 }
          cleanup
  br label %129

129:                                              ; preds = %127, %54, %21
  %.pn = phi { ptr, i32 } [ %55, %54 ], [ %128, %127 ], [ %22, %21 ]
  call void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(248) %2) #8
  br label %130

130:                                              ; preds = %129, %19
  %.pn.pn = phi { ptr, i32 } [ %.pn, %129 ], [ %20, %19 ]
  call void @llvm.lifetime.end.p0(i64 512, ptr nonnull %2) #8
  call void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(256) %1) #8
  call void @llvm.lifetime.end.p0(i64 520, ptr nonnull %1) #8
  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

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

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

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

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

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6

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

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

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


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