; LLVM IR from bqi343/cp-notebook :: Contests/USACO Solutions/2015-16/Dec 2015/Silver (15 Dec S1)

; 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.switchs = type { i32, i32, i32, i32, i32 }

@cin = external dso_local global %"class.std::basic_ifstream", align 8
@cout = external dso_local global %"class.std::basic_ofstream", align 8
@grid = external dso_local global [102 x [102 x i32]], align 16
@reachable = external dso_local global [102 x [102 x i32]], align 16
@a = external dso_local global [20000 x %struct.switchs], align 16

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i8, align 1
  %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
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  store i32 0, ptr %4, align 4, !tbaa !5
  %13 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %14 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %13, ptr noundef nonnull align 4 dereferenceable(4) %3)
  store i32 1, ptr getelementptr inbounds ([102 x i32], ptr getelementptr inbounds ([102 x [102 x i32]], ptr @reachable, i64 0, i64 1), i64 0, i64 1), align 4, !tbaa !5
  store i32 1, ptr getelementptr inbounds ([102 x i32], ptr getelementptr inbounds ([102 x [102 x i32]], ptr @reachable, i64 0, i64 1), i64 0, i64 2), align 8, !tbaa !5
  store i32 1, ptr getelementptr inbounds ([102 x i32], ptr getelementptr inbounds ([102 x [102 x i32]], ptr @reachable, i64 0, i64 2), i64 0, i64 1), align 4, !tbaa !5
  store i32 1, ptr getelementptr inbounds ([102 x i32], ptr getelementptr inbounds ([102 x [102 x i32]], ptr @grid, i64 0, i64 1), i64 0, i64 1), align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %15

15:                                               ; preds = %41, %0
  %16 = load i32, ptr %5, align 4, !tbaa !5
  %17 = load i32, ptr %3, align 4, !tbaa !5
  %18 = icmp slt i32 %16, %17
  br i1 %18, label %20, label %19

19:                                               ; preds = %15
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  br label %44

20:                                               ; preds = %15
  %21 = load i32, ptr %5, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [20000 x %struct.switchs], ptr @a, i64 0, i64 %22
  %24 = getelementptr inbounds %struct.switchs, ptr %23, i32 0, i32 0
  %25 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @cin, ptr noundef nonnull align 4 dereferenceable(4) %24)
  %26 = load i32, ptr %5, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [20000 x %struct.switchs], ptr @a, i64 0, i64 %27
  %29 = getelementptr inbounds %struct.switchs, ptr %28, i32 0, i32 1
  %30 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %25, ptr noundef nonnull align 4 dereferenceable(4) %29)
  %31 = load i32, ptr %5, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [20000 x %struct.switchs], ptr @a, i64 0, i64 %32
  %34 = getelementptr inbounds %struct.switchs, ptr %33, i32 0, i32 2
  %35 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %30, ptr noundef nonnull align 4 dereferenceable(4) %34)
  %36 = load i32, ptr %5, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [20000 x %struct.switchs], ptr @a, i64 0, i64 %37
  %39 = getelementptr inbounds %struct.switchs, ptr %38, i32 0, i32 3
  %40 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %35, ptr noundef nonnull align 4 dereferenceable(4) %39)
  br label %41

41:                                               ; preds = %20
  %42 = load i32, ptr %5, align 4, !tbaa !5
  %43 = add nsw i32 %42, 1
  store i32 %43, ptr %5, align 4, !tbaa !5
  br label %15, !llvm.loop !9

44:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #3
  store i8 1, ptr %6, align 1, !tbaa !11
  br label %45

45:                                               ; preds = %231, %44
  %46 = load i8, ptr %6, align 1, !tbaa !11, !range !13, !noundef !14
  %47 = trunc i8 %46 to i1
  %48 = zext i1 %47 to i32
  %49 = icmp eq i32 %48, 1
  br i1 %49, label %50, label %232

50:                                               ; preds = %45
  store i8 0, ptr %6, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  store i32 1, ptr %7, align 4, !tbaa !5
  br label %51

51:                                               ; preds = %158, %50
  %52 = load i32, ptr %7, align 4, !tbaa !5
  %53 = load i32, ptr %2, align 4, !tbaa !5
  %54 = icmp sle i32 %52, %53
  br i1 %54, label %56, label %55

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

56:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  store i32 1, ptr %9, align 4, !tbaa !5
  br label %57

57:                                               ; preds = %154, %56
  %58 = load i32, ptr %9, align 4, !tbaa !5
  %59 = load i32, ptr %2, align 4, !tbaa !5
  %60 = icmp sle i32 %58, %59
  br i1 %60, label %62, label %61

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

62:                                               ; preds = %57
  %63 = load i32, ptr %7, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [102 x [102 x i32]], ptr @grid, i64 0, i64 %64
  %66 = load i32, ptr %9, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [102 x i32], ptr %65, i64 0, i64 %67
  %69 = load i32, ptr %68, align 4, !tbaa !5
  %70 = icmp ne i32 %69, 0
  br i1 %70, label %71, label %153

71:                                               ; preds = %62
  %72 = load i32, ptr %7, align 4, !tbaa !5
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [102 x [102 x i32]], ptr @reachable, i64 0, i64 %73
  %75 = load i32, ptr %9, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [102 x i32], ptr %74, i64 0, i64 %76
  %78 = load i32, ptr %77, align 4, !tbaa !5
  %79 = icmp ne i32 %78, 0
  br i1 %79, label %80, label %153

80:                                               ; preds = %71
  %81 = load i32, ptr %7, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [102 x [102 x i32]], ptr @reachable, i64 0, i64 %82
  %84 = load i32, ptr %9, align 4, !tbaa !5
  %85 = add nsw i32 %84, 1
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [102 x i32], ptr %83, 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 %98

90:                                               ; preds = %80
  %91 = load i32, ptr %7, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [102 x [102 x i32]], ptr @reachable, i64 0, i64 %92
  %94 = load i32, ptr %9, align 4, !tbaa !5
  %95 = add nsw i32 %94, 1
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [102 x i32], ptr %93, i64 0, i64 %96
  store i32 1, ptr %97, align 4, !tbaa !5
  store i8 1, ptr %6, align 1, !tbaa !11
  br label %98

98:                                               ; preds = %90, %80
  %99 = load i32, ptr %7, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [102 x [102 x i32]], ptr @reachable, i64 0, i64 %100
  %102 = load i32, ptr %9, align 4, !tbaa !5
  %103 = sub nsw i32 %102, 1
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [102 x i32], ptr %101, i64 0, i64 %104
  %106 = load i32, ptr %105, align 4, !tbaa !5
  %107 = icmp eq i32 %106, 0
  br i1 %107, label %108, label %116

108:                                              ; preds = %98
  %109 = load i32, ptr %7, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [102 x [102 x i32]], ptr @reachable, i64 0, i64 %110
  %112 = load i32, ptr %9, align 4, !tbaa !5
  %113 = sub nsw i32 %112, 1
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [102 x i32], ptr %111, i64 0, i64 %114
  store i32 1, ptr %115, align 4, !tbaa !5
  store i8 1, ptr %6, align 1, !tbaa !11
  br label %116

116:                                              ; preds = %108, %98
  %117 = load i32, ptr %7, align 4, !tbaa !5
  %118 = add nsw i32 %117, 1
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [102 x [102 x i32]], ptr @reachable, i64 0, i64 %119
  %121 = load i32, ptr %9, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [102 x i32], ptr %120, i64 0, i64 %122
  %124 = load i32, ptr %123, align 4, !tbaa !5
  %125 = icmp eq i32 %124, 0
  br i1 %125, label %126, label %134

126:                                              ; preds = %116
  %127 = load i32, ptr %7, align 4, !tbaa !5
  %128 = add nsw i32 %127, 1
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds [102 x [102 x i32]], ptr @reachable, i64 0, i64 %129
  %131 = load i32, ptr %9, align 4, !tbaa !5
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [102 x i32], ptr %130, i64 0, i64 %132
  store i32 1, ptr %133, align 4, !tbaa !5
  store i8 1, ptr %6, align 1, !tbaa !11
  br label %134

134:                                              ; preds = %126, %116
  %135 = load i32, ptr %7, align 4, !tbaa !5
  %136 = sub nsw i32 %135, 1
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [102 x [102 x i32]], ptr @reachable, i64 0, i64 %137
  %139 = load i32, ptr %9, align 4, !tbaa !5
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [102 x i32], ptr %138, i64 0, i64 %140
  %142 = load i32, ptr %141, align 4, !tbaa !5
  %143 = icmp eq i32 %142, 0
  br i1 %143, label %144, label %152

144:                                              ; preds = %134
  %145 = load i32, ptr %7, align 4, !tbaa !5
  %146 = sub nsw i32 %145, 1
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds [102 x [102 x i32]], ptr @reachable, i64 0, i64 %147
  %149 = load i32, ptr %9, align 4, !tbaa !5
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds [102 x i32], ptr %148, i64 0, i64 %150
  store i32 1, ptr %151, align 4, !tbaa !5
  store i8 1, ptr %6, align 1, !tbaa !11
  br label %152

152:                                              ; preds = %144, %134
  br label %153

153:                                              ; preds = %152, %71, %62
  br label %154

154:                                              ; preds = %153
  %155 = load i32, ptr %9, align 4, !tbaa !5
  %156 = add nsw i32 %155, 1
  store i32 %156, ptr %9, align 4, !tbaa !5
  br label %57, !llvm.loop !15

157:                                              ; preds = %61
  br label %158

158:                                              ; preds = %157
  %159 = load i32, ptr %7, align 4, !tbaa !5
  %160 = add nsw i32 %159, 1
  store i32 %160, ptr %7, align 4, !tbaa !5
  br label %51, !llvm.loop !16

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

162:                                              ; preds = %228, %161
  %163 = load i32, ptr %10, align 4, !tbaa !5
  %164 = load i32, ptr %3, align 4, !tbaa !5
  %165 = icmp slt i32 %163, %164
  br i1 %165, label %167, label %166

166:                                              ; preds = %162
  store i32 13, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  br label %231

167:                                              ; preds = %162
  %168 = load i32, ptr %10, align 4, !tbaa !5
  %169 = sext i32 %168 to i64
  %170 = getelementptr inbounds [20000 x %struct.switchs], ptr @a, i64 0, i64 %169
  %171 = getelementptr inbounds %struct.switchs, ptr %170, i32 0, i32 4
  %172 = load i32, ptr %171, align 4, !tbaa !17
  %173 = icmp eq i32 %172, 0
  br i1 %173, label %174, label %227

174:                                              ; preds = %167
  %175 = load i32, ptr %10, align 4, !tbaa !5
  %176 = sext i32 %175 to i64
  %177 = getelementptr inbounds [20000 x %struct.switchs], ptr @a, i64 0, i64 %176
  %178 = getelementptr inbounds %struct.switchs, ptr %177, i32 0, i32 0
  %179 = load i32, ptr %178, align 4, !tbaa !19
  %180 = sext i32 %179 to i64
  %181 = getelementptr inbounds [102 x [102 x i32]], ptr @grid, i64 0, i64 %180
  %182 = load i32, ptr %10, align 4, !tbaa !5
  %183 = sext i32 %182 to i64
  %184 = getelementptr inbounds [20000 x %struct.switchs], ptr @a, i64 0, i64 %183
  %185 = getelementptr inbounds %struct.switchs, ptr %184, i32 0, i32 1
  %186 = load i32, ptr %185, align 4, !tbaa !20
  %187 = sext i32 %186 to i64
  %188 = getelementptr inbounds [102 x i32], ptr %181, i64 0, i64 %187
  %189 = load i32, ptr %188, align 4, !tbaa !5
  %190 = icmp ne i32 %189, 0
  br i1 %190, label %191, label %227

191:                                              ; preds = %174
  %192 = load i32, ptr %10, align 4, !tbaa !5
  %193 = sext i32 %192 to i64
  %194 = getelementptr inbounds [20000 x %struct.switchs], ptr @a, i64 0, i64 %193
  %195 = getelementptr inbounds %struct.switchs, ptr %194, i32 0, i32 0
  %196 = load i32, ptr %195, align 4, !tbaa !19
  %197 = sext i32 %196 to i64
  %198 = getelementptr inbounds [102 x [102 x i32]], ptr @reachable, i64 0, i64 %197
  %199 = load i32, ptr %10, align 4, !tbaa !5
  %200 = sext i32 %199 to i64
  %201 = getelementptr inbounds [20000 x %struct.switchs], ptr @a, i64 0, i64 %200
  %202 = getelementptr inbounds %struct.switchs, ptr %201, i32 0, i32 1
  %203 = load i32, ptr %202, align 4, !tbaa !20
  %204 = sext i32 %203 to i64
  %205 = getelementptr inbounds [102 x i32], ptr %198, i64 0, i64 %204
  %206 = load i32, ptr %205, align 4, !tbaa !5
  %207 = icmp ne i32 %206, 0
  br i1 %207, label %208, label %227

208:                                              ; preds = %191
  %209 = load i32, ptr %10, align 4, !tbaa !5
  %210 = sext i32 %209 to i64
  %211 = getelementptr inbounds [20000 x %struct.switchs], ptr @a, i64 0, i64 %210
  %212 = getelementptr inbounds %struct.switchs, ptr %211, i32 0, i32 2
  %213 = load i32, ptr %212, align 4, !tbaa !21
  %214 = sext i32 %213 to i64
  %215 = getelementptr inbounds [102 x [102 x i32]], ptr @grid, i64 0, i64 %214
  %216 = load i32, ptr %10, align 4, !tbaa !5
  %217 = sext i32 %216 to i64
  %218 = getelementptr inbounds [20000 x %struct.switchs], ptr @a, i64 0, i64 %217
  %219 = getelementptr inbounds %struct.switchs, ptr %218, i32 0, i32 3
  %220 = load i32, ptr %219, align 4, !tbaa !22
  %221 = sext i32 %220 to i64
  %222 = getelementptr inbounds [102 x i32], ptr %215, i64 0, i64 %221
  store i32 1, ptr %222, align 4, !tbaa !5
  %223 = load i32, ptr %10, align 4, !tbaa !5
  %224 = sext i32 %223 to i64
  %225 = getelementptr inbounds [20000 x %struct.switchs], ptr @a, i64 0, i64 %224
  %226 = getelementptr inbounds %struct.switchs, ptr %225, i32 0, i32 4
  store i32 1, ptr %226, align 4, !tbaa !17
  store i8 1, ptr %6, align 1, !tbaa !11
  br label %227

227:                                              ; preds = %208, %191, %174, %167
  br label %228

228:                                              ; preds = %227
  %229 = load i32, ptr %10, align 4, !tbaa !5
  %230 = add nsw i32 %229, 1
  store i32 %230, ptr %10, align 4, !tbaa !5
  br label %162, !llvm.loop !23

231:                                              ; preds = %166
  br label %45, !llvm.loop !24

232:                                              ; preds = %45
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  store i32 1, ptr %11, align 4, !tbaa !5
  br label %233

233:                                              ; preds = %261, %232
  %234 = load i32, ptr %11, align 4, !tbaa !5
  %235 = load i32, ptr %2, align 4, !tbaa !5
  %236 = icmp sle i32 %234, %235
  br i1 %236, label %238, label %237

237:                                              ; preds = %233
  store i32 16, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  br label %264

238:                                              ; preds = %233
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  store i32 1, ptr %12, align 4, !tbaa !5
  br label %239

239:                                              ; preds = %257, %238
  %240 = load i32, ptr %12, align 4, !tbaa !5
  %241 = load i32, ptr %2, align 4, !tbaa !5
  %242 = icmp sle i32 %240, %241
  br i1 %242, label %244, label %243

243:                                              ; preds = %239
  store i32 19, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  br label %260

244:                                              ; preds = %239
  %245 = load i32, ptr %11, align 4, !tbaa !5
  %246 = sext i32 %245 to i64
  %247 = getelementptr inbounds [102 x [102 x i32]], ptr @grid, i64 0, i64 %246
  %248 = load i32, ptr %12, align 4, !tbaa !5
  %249 = sext i32 %248 to i64
  %250 = getelementptr inbounds [102 x i32], ptr %247, i64 0, i64 %249
  %251 = load i32, ptr %250, align 4, !tbaa !5
  %252 = icmp ne i32 %251, 0
  br i1 %252, label %253, label %256

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

256:                                              ; preds = %253, %244
  br label %257

257:                                              ; preds = %256
  %258 = load i32, ptr %12, align 4, !tbaa !5
  %259 = add nsw i32 %258, 1
  store i32 %259, ptr %12, align 4, !tbaa !5
  br label %239, !llvm.loop !25

260:                                              ; preds = %243
  br label %261

261:                                              ; preds = %260
  %262 = load i32, ptr %11, align 4, !tbaa !5
  %263 = add nsw i32 %262, 1
  store i32 %263, ptr %11, align 4, !tbaa !5
  br label %233, !llvm.loop !26

264:                                              ; preds = %237
  %265 = load i32, ptr %4, align 4, !tbaa !5
  %266 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @cout, i32 noundef %265)
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #3
  %267 = load i32, ptr %1, align 4
  ret i32 %267
}

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

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

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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #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 = { "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 = { 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 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = !{!18, !6, i64 16}
!18 = !{!"_ZTS7switchs", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16}
!19 = !{!18, !6, i64 0}
!20 = !{!18, !6, i64 4}
!21 = !{!18, !6, i64 8}
!22 = !{!18, !6, i64 12}
!23 = distinct !{!23, !10}
!24 = distinct !{!24, !10}
!25 = distinct !{!25, !10}
!26 = distinct !{!26, !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.switchs = type { i32, i32, i32, i32, i32 }

@cin = external dso_local global %"class.std::basic_ifstream", align 8
@cout = external dso_local global %"class.std::basic_ofstream", align 8
@grid = external dso_local local_unnamed_addr global [102 x [102 x i32]], align 16
@reachable = external dso_local local_unnamed_addr global [102 x [102 x i32]], align 16
@a = external dso_local global [20000 x %struct.switchs], align 16

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #4
  %3 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %4 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 4 dereferenceable(4) %2)
  store i32 1, ptr getelementptr inbounds (i8, ptr @reachable, i64 412), align 4, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @reachable, i64 416), align 16, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @reachable, i64 820), align 4, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @grid, i64 412), align 4, !tbaa !5
  %5 = load i32, ptr %2, align 4, !tbaa !5
  %6 = icmp sgt i32 %5, 0
  br i1 %6, label %.lr.ph, label %.critedge.preheader

.critedge.preheader:                              ; preds = %.lr.ph, %0
  %.lcssa = phi i32 [ %5, %0 ], [ %43, %.lr.ph ]
  %.lcssa.fr = freeze i32 %.lcssa
  %7 = load i32, ptr %1, align 4, !tbaa !5
  %.fr92 = freeze i32 %7
  %.not6471 = icmp slt i32 %.fr92, 1
  %8 = icmp sgt i32 %.lcssa.fr, 0
  br i1 %.not6471, label %.critedge.preheader.split.us, label %.critedge.preheader94

.critedge.preheader94:                            ; preds = %.critedge.preheader
  %9 = add nuw i32 %.fr92, 1
  %wide.trip.count = zext i32 %9 to i64
  %wide.trip.count102 = zext nneg i32 %.lcssa.fr to i64
  br label %.critedge

.critedge.preheader.split.us:                     ; preds = %.critedge.preheader
  br i1 %8, label %.critedge.us.us.preheader, label %._crit_edge90, !llvm.loop !9

.critedge.us.us.preheader:                        ; preds = %.critedge.preheader.split.us
  %wide.trip.count106 = zext nneg i32 %.lcssa.fr to i64
  br label %.critedge.us.us

.critedge.us.us:                                  ; preds = %.critedge.us.us.preheader, %.critedge.backedge.us.us
  %.053.us.us = phi i32 [ %.053.be.us.us, %.critedge.backedge.us.us ], [ 1, %.critedge.us.us.preheader ]
  %.not61.us.us = icmp sgt i32 %.053.us.us, %.fr92
  br i1 %.not61.us.us, label %.preheader68.us.us.outer, label %.preheader69.us.us

.preheader68.us.us.outer:                         ; preds = %.critedge.us.us, %.thread
  %indvars.iv104.ph = phi i64 [ %indvars.iv.next105119, %.thread ], [ 0, %.critedge.us.us ]
  %.776.us.us.ph = phi i1 [ true, %.thread ], [ false, %.critedge.us.us ]
  br label %.preheader68.us.us

.preheader68.us.us:                               ; preds = %.preheader68.us.us.outer, %25
  %indvars.iv104 = phi i64 [ %indvars.iv.next105, %25 ], [ %indvars.iv104.ph, %.preheader68.us.us.outer ]
  %10 = getelementptr inbounds [20000 x %struct.switchs], ptr @a, i64 0, i64 %indvars.iv104
  %11 = getelementptr inbounds i8, ptr %10, i64 16
  %12 = load i32, ptr %11, align 4, !tbaa !11
  %13 = icmp eq i32 %12, 0
  br i1 %13, label %14, label %25

14:                                               ; preds = %.preheader68.us.us
  %15 = load i32, ptr %10, align 4, !tbaa !13
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds i8, ptr %10, i64 4
  %18 = load i32, ptr %17, align 4, !tbaa !14
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds [102 x [102 x i32]], ptr @grid, i64 0, i64 %16, i64 %19
  %21 = load i32, ptr %20, align 4, !tbaa !5
  %.not62.us.us = icmp eq i32 %21, 0
  br i1 %.not62.us.us, label %25, label %22

22:                                               ; preds = %14
  %23 = getelementptr inbounds [102 x [102 x i32]], ptr @reachable, i64 0, i64 %16, i64 %19
  %24 = load i32, ptr %23, align 4, !tbaa !5
  %.not63.us.us = icmp eq i32 %24, 0
  br i1 %.not63.us.us, label %25, label %.thread

25:                                               ; preds = %22, %14, %.preheader68.us.us
  %indvars.iv.next105 = add nuw nsw i64 %indvars.iv104, 1
  %exitcond107.not = icmp eq i64 %indvars.iv.next105, %wide.trip.count106
  br i1 %exitcond107.not, label %._crit_edge79.us.us, label %.preheader68.us.us, !llvm.loop !15

.thread:                                          ; preds = %22
  %26 = getelementptr inbounds i8, ptr %10, i64 16
  %27 = getelementptr inbounds i8, ptr %10, i64 8
  %28 = load i32, ptr %27, align 4, !tbaa !16
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds i8, ptr %10, i64 12
  %31 = load i32, ptr %30, align 4, !tbaa !17
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [102 x [102 x i32]], ptr @grid, i64 0, i64 %29, i64 %32
  store i32 1, ptr %33, align 4, !tbaa !5
  store i32 1, ptr %26, align 4, !tbaa !11
  %indvars.iv.next105119 = add nuw nsw i64 %indvars.iv104, 1
  %exitcond107.not120 = icmp eq i64 %indvars.iv.next105119, %wide.trip.count106
  br i1 %exitcond107.not120, label %.critedge.backedge.us.us, label %.preheader68.us.us.outer, !llvm.loop !15

.preheader69.us.us:                               ; preds = %.critedge.us.us
  %34 = add nuw nsw i32 %.053.us.us, 1
  br label %.critedge.backedge.us.us

.critedge.backedge.us.us:                         ; preds = %.thread, %.preheader69.us.us, %._crit_edge79.us.us
  %.053.be.us.us = phi i32 [ %34, %.preheader69.us.us ], [ 1, %._crit_edge79.us.us ], [ 1, %.thread ]
  br label %.critedge.us.us, !llvm.loop !18

._crit_edge79.us.us:                              ; preds = %25
  br i1 %.776.us.us.ph, label %.critedge.backedge.us.us, label %.preheader67

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %35 = getelementptr inbounds [20000 x %struct.switchs], ptr @a, i64 0, i64 %indvars.iv
  %36 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @cin, ptr noundef nonnull align 4 dereferenceable(4) %35)
  %37 = getelementptr inbounds i8, ptr %35, i64 4
  %38 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %36, ptr noundef nonnull align 4 dereferenceable(4) %37)
  %39 = getelementptr inbounds i8, ptr %35, i64 8
  %40 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %38, ptr noundef nonnull align 4 dereferenceable(4) %39)
  %41 = getelementptr inbounds i8, ptr %35, i64 12
  %42 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %40, ptr noundef nonnull align 4 dereferenceable(4) %41)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %43 = load i32, ptr %2, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = icmp slt i64 %indvars.iv.next, %44
  br i1 %45, label %.lr.ph, label %.critedge.preheader, !llvm.loop !19

._crit_edge79:                                    ; preds = %105, %.preheader68
  %.7.lcssa = phi i1 [ %.1, %.preheader68 ], [ %.8, %105 ]
  br i1 %.7.lcssa, label %.critedge.backedge, label %.preheader67

.preheader67:                                     ; preds = %._crit_edge79, %._crit_edge79.us.us
  %.not87 = icmp slt i32 %.fr92, 1
  br i1 %.not87, label %._crit_edge90, label %.preheader.preheader

.preheader.preheader:                             ; preds = %.preheader67
  %46 = add nuw i32 %.fr92, 1
  %wide.trip.count116 = zext i32 %46 to i64
  %47 = zext nneg i32 %.fr92 to i64
  %min.iters.check = icmp ult i32 %.fr92, 8
  %n.vec = and i64 %47, 2147483640
  %ind.end = or disjoint i64 %n.vec, 1
  %cmp.n = icmp eq i64 %n.vec, %47
  br label %.preheader

.critedge:                                        ; preds = %.critedge.preheader94, %.critedge.backedge
  %.1 = phi i1 [ %.1.be, %.critedge.backedge ], [ false, %.critedge.preheader94 ]
  %.053 = phi i32 [ %.053.be, %.critedge.backedge ], [ 1, %.critedge.preheader94 ]
  %.not61 = icmp sgt i32 %.053, %.fr92
  br i1 %.not61, label %.preheader68, label %.preheader69

.preheader69:                                     ; preds = %.critedge
  %48 = zext nneg i32 %.053 to i64
  %49 = add nuw nsw i32 %.053, 1
  %50 = zext nneg i32 %49 to i64
  %51 = add nsw i32 %.053, -1
  %52 = sext i32 %51 to i64
  br label %53

.preheader68:                                     ; preds = %.critedge
  br i1 %8, label %.lr.ph78, label %._crit_edge79, !llvm.loop !9

.critedge.backedge:                               ; preds = %81, %._crit_edge79
  %.1.be = phi i1 [ false, %._crit_edge79 ], [ %.6, %81 ]
  %.053.be = phi i32 [ 1, %._crit_edge79 ], [ %49, %81 ]
  br label %.critedge, !llvm.loop !18

53:                                               ; preds = %.preheader69, %81
  %indvars.iv98 = phi i64 [ 1, %.preheader69 ], [ %indvars.iv.next99, %81 ]
  %.272 = phi i1 [ %.1, %.preheader69 ], [ %.6, %81 ]
  %54 = getelementptr inbounds [102 x [102 x i32]], ptr @grid, i64 0, i64 %48, i64 %indvars.iv98
  %55 = load i32, ptr %54, align 4, !tbaa !5
  %.not65 = icmp eq i32 %55, 0
  br i1 %.not65, label %81, label %56

56:                                               ; preds = %53
  %57 = getelementptr inbounds [102 x [102 x i32]], ptr @reachable, i64 0, i64 %48, i64 %indvars.iv98
  %58 = load i32, ptr %57, align 4, !tbaa !5
  %.not66 = icmp eq i32 %58, 0
  br i1 %.not66, label %81, label %59

59:                                               ; preds = %56
  %60 = add nuw nsw i64 %indvars.iv98, 1
  %61 = getelementptr inbounds [102 x [102 x i32]], ptr @reachable, i64 0, i64 %48, i64 %60
  %62 = load i32, ptr %61, align 4, !tbaa !5
  %63 = icmp eq i32 %62, 0
  br i1 %63, label %64, label %65

64:                                               ; preds = %59
  store i32 1, ptr %61, align 4, !tbaa !5
  br label %65

65:                                               ; preds = %64, %59
  %.3 = phi i1 [ true, %64 ], [ %.272, %59 ]
  %66 = add nsw i64 %indvars.iv98, -1
  %67 = getelementptr inbounds [102 x [102 x i32]], ptr @reachable, i64 0, i64 %48, i64 %66
  %68 = load i32, ptr %67, align 4, !tbaa !5
  %69 = icmp eq i32 %68, 0
  br i1 %69, label %70, label %71

70:                                               ; preds = %65
  store i32 1, ptr %67, align 4, !tbaa !5
  br label %71

71:                                               ; preds = %70, %65
  %.4 = phi i1 [ true, %70 ], [ %.3, %65 ]
  %72 = getelementptr inbounds [102 x [102 x i32]], ptr @reachable, i64 0, i64 %50, i64 %indvars.iv98
  %73 = load i32, ptr %72, align 4, !tbaa !5
  %74 = icmp eq i32 %73, 0
  br i1 %74, label %75, label %76

75:                                               ; preds = %71
  store i32 1, ptr %72, align 4, !tbaa !5
  br label %76

76:                                               ; preds = %75, %71
  %.5 = phi i1 [ true, %75 ], [ %.4, %71 ]
  %77 = getelementptr inbounds [102 x [102 x i32]], ptr @reachable, i64 0, i64 %52, i64 %indvars.iv98
  %78 = load i32, ptr %77, align 4, !tbaa !5
  %79 = icmp eq i32 %78, 0
  br i1 %79, label %80, label %81

80:                                               ; preds = %76
  store i32 1, ptr %77, align 4, !tbaa !5
  br label %81

81:                                               ; preds = %53, %56, %80, %76
  %.6 = phi i1 [ true, %80 ], [ %.5, %76 ], [ %.272, %56 ], [ %.272, %53 ]
  %indvars.iv.next99 = add nuw nsw i64 %indvars.iv98, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next99, %wide.trip.count
  br i1 %exitcond.not, label %.critedge.backedge, label %53, !llvm.loop !20

.lr.ph78:                                         ; preds = %.preheader68, %105
  %indvars.iv100 = phi i64 [ %indvars.iv.next101, %105 ], [ 0, %.preheader68 ]
  %.776 = phi i1 [ %.8, %105 ], [ %.1, %.preheader68 ]
  %82 = getelementptr inbounds [20000 x %struct.switchs], ptr @a, i64 0, i64 %indvars.iv100
  %83 = getelementptr inbounds i8, ptr %82, i64 16
  %84 = load i32, ptr %83, align 4, !tbaa !11
  %85 = icmp eq i32 %84, 0
  br i1 %85, label %86, label %105

86:                                               ; preds = %.lr.ph78
  %87 = load i32, ptr %82, align 4, !tbaa !13
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds i8, ptr %82, i64 4
  %90 = load i32, ptr %89, align 4, !tbaa !14
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [102 x [102 x i32]], ptr @grid, i64 0, i64 %88, i64 %91
  %93 = load i32, ptr %92, align 4, !tbaa !5
  %.not62 = icmp eq i32 %93, 0
  br i1 %.not62, label %105, label %94

94:                                               ; preds = %86
  %95 = getelementptr inbounds [102 x [102 x i32]], ptr @reachable, i64 0, i64 %88, i64 %91
  %96 = load i32, ptr %95, align 4, !tbaa !5
  %.not63 = icmp eq i32 %96, 0
  br i1 %.not63, label %105, label %97

97:                                               ; preds = %94
  %98 = getelementptr inbounds i8, ptr %82, i64 8
  %99 = load i32, ptr %98, align 4, !tbaa !16
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds i8, ptr %82, i64 12
  %102 = load i32, ptr %101, align 4, !tbaa !17
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [102 x [102 x i32]], ptr @grid, i64 0, i64 %100, i64 %103
  store i32 1, ptr %104, align 4, !tbaa !5
  store i32 1, ptr %83, align 4, !tbaa !11
  br label %105

105:                                              ; preds = %.lr.ph78, %86, %94, %97
  %.8 = phi i1 [ true, %97 ], [ %.776, %94 ], [ %.776, %86 ], [ %.776, %.lr.ph78 ]
  %indvars.iv.next101 = add nuw nsw i64 %indvars.iv100, 1
  %exitcond103.not = icmp eq i64 %indvars.iv.next101, %wide.trip.count102
  br i1 %exitcond103.not, label %._crit_edge79, label %.lr.ph78, !llvm.loop !15

.preheader:                                       ; preds = %.preheader.preheader, %._crit_edge85
  %indvars.iv113 = phi i64 [ 1, %.preheader.preheader ], [ %indvars.iv.next114, %._crit_edge85 ]
  %.05688 = phi i32 [ 0, %.preheader.preheader ], [ %spec.select.lcssa, %._crit_edge85 ]
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

scalar.ph.preheader:                              ; preds = %middle.block, %.preheader
  %indvars.iv108.ph = phi i64 [ 1, %.preheader ], [ %ind.end, %middle.block ]
  %.15782.ph = phi i32 [ %.05688, %.preheader ], [ %116, %middle.block ]
  br label %scalar.ph

vector.ph:                                        ; preds = %.preheader
  %106 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %.05688, i64 0
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <4 x i32> [ %106, %vector.ph ], [ %113, %vector.body ]
  %vec.phi139 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %114, %vector.body ]
  %offset.idx = or disjoint i64 %index, 1
  %107 = getelementptr inbounds [102 x [102 x i32]], ptr @grid, i64 0, i64 %indvars.iv113, i64 %offset.idx
  %108 = getelementptr inbounds i8, ptr %107, i64 16
  %wide.load = load <4 x i32>, ptr %107, align 4, !tbaa !5
  %wide.load140 = load <4 x i32>, ptr %108, align 4, !tbaa !5
  %109 = icmp ne <4 x i32> %wide.load, zeroinitializer
  %110 = icmp ne <4 x i32> %wide.load140, zeroinitializer
  %111 = zext <4 x i1> %109 to <4 x i32>
  %112 = zext <4 x i1> %110 to <4 x i32>
  %113 = add <4 x i32> %vec.phi, %111
  %114 = add <4 x i32> %vec.phi139, %112
  %index.next = add nuw i64 %index, 8
  %115 = icmp eq i64 %index.next, %n.vec
  br i1 %115, label %middle.block, label %vector.body, !llvm.loop !21

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <4 x i32> %114, %113
  %116 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
  br i1 %cmp.n, label %._crit_edge85, label %scalar.ph.preheader

._crit_edge90:                                    ; preds = %._crit_edge85, %.critedge.preheader.split.us, %.preheader67
  %.056.lcssa = phi i32 [ 0, %.preheader67 ], [ 0, %.critedge.preheader.split.us ], [ %spec.select.lcssa, %._crit_edge85 ]
  %117 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @cout, i32 noundef %.056.lcssa)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #4
  ret i32 0

._crit_edge85:                                    ; preds = %scalar.ph, %middle.block
  %spec.select.lcssa = phi i32 [ %116, %middle.block ], [ %spec.select, %scalar.ph ]
  %indvars.iv.next114 = add nuw nsw i64 %indvars.iv113, 1
  %exitcond117.not = icmp eq i64 %indvars.iv.next114, %wide.trip.count116
  br i1 %exitcond117.not, label %._crit_edge90, label %.preheader, !llvm.loop !24

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv108 = phi i64 [ %indvars.iv.next109, %scalar.ph ], [ %indvars.iv108.ph, %scalar.ph.preheader ]
  %.15782 = phi i32 [ %spec.select, %scalar.ph ], [ %.15782.ph, %scalar.ph.preheader ]
  %118 = getelementptr inbounds [102 x [102 x i32]], ptr @grid, i64 0, i64 %indvars.iv113, i64 %indvars.iv108
  %119 = load i32, ptr %118, align 4, !tbaa !5
  %.not60 = icmp ne i32 %119, 0
  %120 = zext i1 %.not60 to i32
  %spec.select = add nsw i32 %.15782, %120
  %indvars.iv.next109 = add nuw nsw i64 %indvars.iv108, 1
  %exitcond112.not = icmp eq i64 %indvars.iv.next109, %wide.trip.count116
  br i1 %exitcond112.not, label %._crit_edge85, label %scalar.ph, !llvm.loop !25
}

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

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

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

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

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

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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { 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 = !{!12, !6, i64 16}
!12 = !{!"_ZTS7switchs", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16}
!13 = !{!12, !6, i64 0}
!14 = !{!12, !6, i64 4}
!15 = distinct !{!15, !10}
!16 = !{!12, !6, i64 8}
!17 = !{!12, !6, i64 12}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!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}


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