; LLVM IR from tangjz/acm-icpc :: codeforces/1545C.ll (Z5solvev)

; 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::queue" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Deque_impl" }
%"struct.std::_Deque_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Deque_impl" = type { %"struct.std::_Deque_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Deque_impl_data" }
%"struct.std::_Deque_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }
%"struct.std::pair" = type { i32, i32 }
%"class.std::tuple" = type { %"struct.std::_Tuple_impl" }
%"struct.std::_Tuple_impl" = type { %"struct.std::_Tuple_impl.0", %"struct.std::_Head_base.1" }
%"struct.std::_Tuple_impl.0" = type { %"struct.std::_Head_base" }
%"struct.std::_Head_base" = type { ptr }
%"struct.std::_Head_base.1" = type { ptr }

@_ZZ5solvevE1a = external hidden global [1001 x [1001 x i32]], align 16
@_ZZ5solvevE3row = external hidden global [1001 x i8], align 16
@_ZZ5solvevE1e = external hidden global [1001 x [1001 x i8]], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@_ZZ5solvevE4path = external hidden global [1001 x i32], align 16
@_ZZ5solvevE1v = external hidden global i32, align 4
@_ZZ5solvevE3pos = external hidden global [1001 x i32], align 16
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() #0 personality ptr @__gxx_personality_v0 {
  %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 i8, align 1
  %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
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca %"class.std::queue", align 8
  %19 = alloca %"struct.std::pair", align 4
  %20 = alloca i32, align 4
  %21 = alloca ptr, align 8
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  %25 = alloca %"class.std::tuple", align 8
  %26 = alloca i32, align 4
  %27 = alloca %"struct.std::pair", align 4
  %28 = alloca i8, align 1
  %29 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #5
  %30 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %1)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %31

31:                                               ; preds = %138, %0
  %32 = load i32, ptr %2, align 4, !tbaa !5
  %33 = load i32, ptr %1, align 4, !tbaa !5
  %34 = load i32, ptr %1, align 4, !tbaa !5
  %35 = add nsw i32 %33, %34
  %36 = icmp slt i32 %32, %35
  br i1 %36, label %38, label %37

37:                                               ; preds = %31
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  br label %141

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

39:                                               ; preds = %61, %38
  %40 = load i32, ptr %4, align 4, !tbaa !5
  %41 = load i32, ptr %1, align 4, !tbaa !5
  %42 = icmp slt i32 %40, %41
  br i1 %42, label %44, label %43

43:                                               ; preds = %39
  store i32 5, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %64

44:                                               ; preds = %39
  %45 = load i32, ptr %2, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [1001 x [1001 x i32]], ptr @_ZZ5solvevE1a, i64 0, i64 %46
  %48 = getelementptr inbounds [1001 x i32], ptr %47, i64 0, i64 0
  %49 = load i32, ptr %4, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds i32, ptr %48, i64 %50
  %52 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %51)
  %53 = load i32, ptr %2, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [1001 x [1001 x i32]], ptr @_ZZ5solvevE1a, i64 0, i64 %54
  %56 = load i32, ptr %4, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [1001 x i32], ptr %55, i64 0, i64 %57
  %59 = load i32, ptr %58, align 4, !tbaa !5
  %60 = add nsw i32 %59, -1
  store i32 %60, ptr %58, align 4, !tbaa !5
  br label %61

61:                                               ; preds = %44
  %62 = load i32, ptr %4, align 4, !tbaa !5
  %63 = add nsw i32 %62, 1
  store i32 %63, ptr %4, align 4, !tbaa !5
  br label %39, !llvm.loop !9

64:                                               ; preds = %43
  %65 = load i32, ptr %2, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [1001 x i8], ptr @_ZZ5solvevE3row, i64 0, i64 %66
  store i8 1, ptr %67, align 1, !tbaa !11
  %68 = load i32, ptr %2, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [1001 x [1001 x i8]], ptr @_ZZ5solvevE1e, i64 0, i64 %69
  %71 = load i32, ptr %2, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [1001 x i8], ptr %70, i64 0, i64 %72
  store i8 0, ptr %73, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %74

74:                                               ; preds = %134, %64
  %75 = load i32, ptr %5, align 4, !tbaa !5
  %76 = load i32, ptr %2, align 4, !tbaa !5
  %77 = icmp slt i32 %75, %76
  br i1 %77, label %79, label %78

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

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

80:                                               ; preds = %113, %79
  %81 = load i8, ptr %6, align 1, !tbaa !11, !range !13, !noundef !14
  %82 = trunc i8 %81 to i1
  br i1 %82, label %87, label %83

83:                                               ; preds = %80
  %84 = load i32, ptr %7, align 4, !tbaa !5
  %85 = load i32, ptr %1, align 4, !tbaa !5
  %86 = icmp slt i32 %84, %85
  br label %87

87:                                               ; preds = %83, %80
  %88 = phi i1 [ false, %80 ], [ %86, %83 ]
  br i1 %88, label %90, label %89

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

90:                                               ; preds = %87
  %91 = load i32, ptr %2, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [1001 x [1001 x i32]], ptr @_ZZ5solvevE1a, i64 0, i64 %92
  %94 = load i32, ptr %7, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [1001 x i32], ptr %93, i64 0, i64 %95
  %97 = load i32, ptr %96, align 4, !tbaa !5
  %98 = load i32, ptr %5, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [1001 x [1001 x i32]], ptr @_ZZ5solvevE1a, i64 0, i64 %99
  %101 = load i32, ptr %7, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [1001 x i32], ptr %100, i64 0, i64 %102
  %104 = load i32, ptr %103, align 4, !tbaa !5
  %105 = icmp eq i32 %97, %104
  %106 = zext i1 %105 to i32
  %107 = load i8, ptr %6, align 1, !tbaa !11, !range !13, !noundef !14
  %108 = trunc i8 %107 to i1
  %109 = zext i1 %108 to i32
  %110 = or i32 %109, %106
  %111 = icmp ne i32 %110, 0
  %112 = zext i1 %111 to i8
  store i8 %112, ptr %6, align 1, !tbaa !11
  br label %113

113:                                              ; preds = %90
  %114 = load i32, ptr %7, align 4, !tbaa !5
  %115 = add nsw i32 %114, 1
  store i32 %115, ptr %7, align 4, !tbaa !5
  br label %80, !llvm.loop !15

116:                                              ; preds = %89
  %117 = load i8, ptr %6, align 1, !tbaa !11, !range !13, !noundef !14
  %118 = trunc i8 %117 to i1
  %119 = xor i1 %118, true
  %120 = load i32, ptr %5, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [1001 x [1001 x i8]], ptr @_ZZ5solvevE1e, i64 0, i64 %121
  %123 = load i32, ptr %2, align 4, !tbaa !5
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [1001 x i8], ptr %122, i64 0, i64 %124
  %126 = zext i1 %119 to i8
  store i8 %126, ptr %125, align 1, !tbaa !11
  %127 = load i32, ptr %2, align 4, !tbaa !5
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [1001 x [1001 x i8]], ptr @_ZZ5solvevE1e, i64 0, i64 %128
  %130 = load i32, ptr %5, align 4, !tbaa !5
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [1001 x i8], ptr %129, i64 0, i64 %131
  %133 = zext i1 %119 to i8
  store i8 %133, ptr %132, align 1, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #5
  br label %134

134:                                              ; preds = %116
  %135 = load i32, ptr %5, align 4, !tbaa !5
  %136 = add nsw i32 %135, 1
  store i32 %136, ptr %5, align 4, !tbaa !5
  br label %74, !llvm.loop !16

137:                                              ; preds = %78
  br label %138

138:                                              ; preds = %137
  %139 = load i32, ptr %2, align 4, !tbaa !5
  %140 = add nsw i32 %139, 1
  store i32 %140, ptr %2, align 4, !tbaa !5
  br label %31, !llvm.loop !17

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

142:                                              ; preds = %277, %141
  %143 = load i32, ptr %9, align 4, !tbaa !5
  %144 = load i32, ptr %1, align 4, !tbaa !5
  %145 = icmp slt i32 %143, %144
  br i1 %145, label %147, label %146

146:                                              ; preds = %142
  store i32 14, ptr %3, align 4
  br label %280

147:                                              ; preds = %142
  call void @llvm.lifetime.start.p0(i64 1, ptr %10) #5
  store i8 0, ptr %10, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %148

148:                                              ; preds = %265, %147
  %149 = load i32, ptr %11, align 4, !tbaa !5
  %150 = load i32, ptr %1, align 4, !tbaa !5
  %151 = icmp slt i32 %149, %150
  br i1 %151, label %153, label %152

152:                                              ; preds = %148
  store i32 17, ptr %3, align 4
  br label %268

153:                                              ; preds = %148
  store i32 0, ptr @_ZZ5solvevE1v, align 4, !tbaa !5
  br label %154

154:                                              ; preds = %162, %153
  %155 = load i32, ptr @_ZZ5solvevE1v, align 4, !tbaa !5
  %156 = load i32, ptr %1, align 4, !tbaa !5
  %157 = icmp slt i32 %155, %156
  br i1 %157, label %158, label %165

158:                                              ; preds = %154
  %159 = load i32, ptr @_ZZ5solvevE1v, align 4, !tbaa !5
  %160 = sext i32 %159 to i64
  %161 = getelementptr inbounds [1001 x i32], ptr @_ZZ5solvevE3pos, i64 0, i64 %160
  store i32 -1, ptr %161, align 4, !tbaa !5
  br label %162

162:                                              ; preds = %158
  %163 = load i32, ptr @_ZZ5solvevE1v, align 4, !tbaa !5
  %164 = add nsw i32 %163, 1
  store i32 %164, ptr @_ZZ5solvevE1v, align 4, !tbaa !5
  br label %154, !llvm.loop !18

165:                                              ; preds = %154
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %166

166:                                              ; preds = %201, %165
  %167 = load i32, ptr %12, align 4, !tbaa !5
  %168 = load i32, ptr %1, align 4, !tbaa !5
  %169 = load i32, ptr %1, align 4, !tbaa !5
  %170 = add nsw i32 %168, %169
  %171 = icmp slt i32 %167, %170
  br i1 %171, label %173, label %172

172:                                              ; preds = %166
  store i32 23, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %204

173:                                              ; preds = %166
  %174 = load i32, ptr %12, align 4, !tbaa !5
  %175 = sext i32 %174 to i64
  %176 = getelementptr inbounds [1001 x i8], ptr @_ZZ5solvevE3row, i64 0, i64 %175
  %177 = load i8, ptr %176, align 1, !tbaa !11, !range !13, !noundef !14
  %178 = trunc i8 %177 to i1
  br i1 %178, label %180, label %179

179:                                              ; preds = %173
  br label %201

180:                                              ; preds = %173
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  %181 = load i32, ptr %12, align 4, !tbaa !5
  %182 = sext i32 %181 to i64
  %183 = getelementptr inbounds [1001 x [1001 x i32]], ptr @_ZZ5solvevE1a, i64 0, i64 %182
  %184 = load i32, ptr %11, align 4, !tbaa !5
  %185 = sext i32 %184 to i64
  %186 = getelementptr inbounds [1001 x i32], ptr %183, i64 0, i64 %185
  %187 = load i32, ptr %186, align 4, !tbaa !5
  store i32 %187, ptr %13, align 4, !tbaa !5
  %188 = load i32, ptr %13, align 4, !tbaa !5
  %189 = sext i32 %188 to i64
  %190 = getelementptr inbounds [1001 x i32], ptr @_ZZ5solvevE3pos, i64 0, i64 %189
  %191 = load i32, ptr %190, align 4, !tbaa !5
  %192 = icmp eq i32 %191, -1
  br i1 %192, label %193, label %195

193:                                              ; preds = %180
  %194 = load i32, ptr %12, align 4, !tbaa !5
  br label %196

195:                                              ; preds = %180
  br label %196

196:                                              ; preds = %195, %193
  %197 = phi i32 [ %194, %193 ], [ -2, %195 ]
  %198 = load i32, ptr %13, align 4, !tbaa !5
  %199 = sext i32 %198 to i64
  %200 = getelementptr inbounds [1001 x i32], ptr @_ZZ5solvevE3pos, i64 0, i64 %199
  store i32 %197, ptr %200, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %201

201:                                              ; preds = %196, %179
  %202 = load i32, ptr %12, align 4, !tbaa !5
  %203 = add nsw i32 %202, 1
  store i32 %203, ptr %12, align 4, !tbaa !5
  br label %166, !llvm.loop !19

204:                                              ; preds = %172
  store i32 0, ptr @_ZZ5solvevE1v, align 4, !tbaa !5
  br label %205

205:                                              ; preds = %218, %204
  %206 = load i32, ptr @_ZZ5solvevE1v, align 4, !tbaa !5
  %207 = load i32, ptr %1, align 4, !tbaa !5
  %208 = icmp slt i32 %206, %207
  br i1 %208, label %209, label %215

209:                                              ; preds = %205
  %210 = load i32, ptr @_ZZ5solvevE1v, align 4, !tbaa !5
  %211 = sext i32 %210 to i64
  %212 = getelementptr inbounds [1001 x i32], ptr @_ZZ5solvevE3pos, i64 0, i64 %211
  %213 = load i32, ptr %212, align 4, !tbaa !5
  %214 = icmp slt i32 %213, 0
  br label %215

215:                                              ; preds = %209, %205
  %216 = phi i1 [ false, %205 ], [ %214, %209 ]
  br i1 %216, label %217, label %221

217:                                              ; preds = %215
  br label %218

218:                                              ; preds = %217
  %219 = load i32, ptr @_ZZ5solvevE1v, align 4, !tbaa !5
  %220 = add nsw i32 %219, 1
  store i32 %220, ptr @_ZZ5solvevE1v, align 4, !tbaa !5
  br label %205, !llvm.loop !20

221:                                              ; preds = %215
  %222 = load i32, ptr @_ZZ5solvevE1v, align 4, !tbaa !5
  %223 = load i32, ptr %1, align 4, !tbaa !5
  %224 = icmp sge i32 %222, %223
  br i1 %224, label %225, label %226

225:                                              ; preds = %221
  br label %265

226:                                              ; preds = %221
  store i8 1, ptr %10, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  %227 = load i32, ptr @_ZZ5solvevE1v, align 4, !tbaa !5
  %228 = sext i32 %227 to i64
  %229 = getelementptr inbounds [1001 x i32], ptr @_ZZ5solvevE3pos, i64 0, i64 %228
  %230 = load i32, ptr %229, align 4, !tbaa !5
  %231 = load i32, ptr %8, align 4, !tbaa !5
  %232 = add nsw i32 %231, 1
  store i32 %232, ptr %8, align 4, !tbaa !5
  %233 = sext i32 %231 to i64
  %234 = getelementptr inbounds [1001 x i32], ptr @_ZZ5solvevE4path, i64 0, i64 %233
  store i32 %230, ptr %234, align 4, !tbaa !5
  store i32 %230, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  store i32 0, ptr %15, align 4, !tbaa !5
  br label %235

235:                                              ; preds = %261, %226
  %236 = load i32, ptr %15, align 4, !tbaa !5
  %237 = load i32, ptr %1, align 4, !tbaa !5
  %238 = load i32, ptr %1, align 4, !tbaa !5
  %239 = add nsw i32 %237, %238
  %240 = icmp slt i32 %236, %239
  br i1 %240, label %242, label %241

241:                                              ; preds = %235
  store i32 29, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  br label %264

242:                                              ; preds = %235
  %243 = load i32, ptr %14, align 4, !tbaa !5
  %244 = sext i32 %243 to i64
  %245 = getelementptr inbounds [1001 x [1001 x i8]], ptr @_ZZ5solvevE1e, i64 0, i64 %244
  %246 = load i32, ptr %15, align 4, !tbaa !5
  %247 = sext i32 %246 to i64
  %248 = getelementptr inbounds [1001 x i8], ptr %245, i64 0, i64 %247
  %249 = load i8, ptr %248, align 1, !tbaa !11, !range !13, !noundef !14
  %250 = trunc i8 %249 to i1
  %251 = zext i1 %250 to i32
  %252 = load i32, ptr %15, align 4, !tbaa !5
  %253 = sext i32 %252 to i64
  %254 = getelementptr inbounds [1001 x i8], ptr @_ZZ5solvevE3row, i64 0, i64 %253
  %255 = load i8, ptr %254, align 1, !tbaa !11, !range !13, !noundef !14
  %256 = trunc i8 %255 to i1
  %257 = zext i1 %256 to i32
  %258 = and i32 %257, %251
  %259 = icmp ne i32 %258, 0
  %260 = zext i1 %259 to i8
  store i8 %260, ptr %254, align 1, !tbaa !11
  br label %261

261:                                              ; preds = %242
  %262 = load i32, ptr %15, align 4, !tbaa !5
  %263 = add nsw i32 %262, 1
  store i32 %263, ptr %15, align 4, !tbaa !5
  br label %235, !llvm.loop !21

264:                                              ; preds = %241
  store i32 17, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  br label %268

265:                                              ; preds = %225
  %266 = load i32, ptr %11, align 4, !tbaa !5
  %267 = add nsw i32 %266, 1
  store i32 %267, ptr %11, align 4, !tbaa !5
  br label %148, !llvm.loop !22

268:                                              ; preds = %264, %152
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %269

269:                                              ; preds = %268
  %270 = load i8, ptr %10, align 1, !tbaa !11, !range !13, !noundef !14
  %271 = trunc i8 %270 to i1
  br i1 %271, label %273, label %272

272:                                              ; preds = %269
  store i32 14, ptr %3, align 4
  br label %274

273:                                              ; preds = %269
  store i32 0, ptr %3, align 4
  br label %274

274:                                              ; preds = %273, %272
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #5
  %275 = load i32, ptr %3, align 4
  switch i32 %275, label %280 [
    i32 0, label %276
  ]

276:                                              ; preds = %274
  br label %277

277:                                              ; preds = %276
  %278 = load i32, ptr %9, align 4, !tbaa !5
  %279 = add nsw i32 %278, 1
  store i32 %279, ptr %9, align 4, !tbaa !5
  br label %142, !llvm.loop !23

280:                                              ; preds = %274, %146
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %281

281:                                              ; preds = %280
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  store i32 1, ptr %16, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  store i32 0, ptr %17, align 4, !tbaa !5
  br label %282

282:                                              ; preds = %379, %281
  %283 = load i32, ptr %17, align 4, !tbaa !5
  %284 = load i32, ptr %1, align 4, !tbaa !5
  %285 = load i32, ptr %1, align 4, !tbaa !5
  %286 = add nsw i32 %284, %285
  %287 = icmp slt i32 %283, %286
  br i1 %287, label %289, label %288

288:                                              ; preds = %282
  store i32 32, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  br label %383

289:                                              ; preds = %282
  %290 = load i32, ptr %17, align 4, !tbaa !5
  %291 = sext i32 %290 to i64
  %292 = getelementptr inbounds [1001 x i8], ptr @_ZZ5solvevE3row, i64 0, i64 %291
  %293 = load i8, ptr %292, align 1, !tbaa !11, !range !13, !noundef !14
  %294 = trunc i8 %293 to i1
  br i1 %294, label %296, label %295

295:                                              ; preds = %289
  br label %379

296:                                              ; preds = %289
  call void @llvm.lifetime.start.p0(i64 80, ptr %18) #5
  call void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEEC2IS4_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %18)
  %297 = load i32, ptr %17, align 4, !tbaa !5
  %298 = sext i32 %297 to i64
  %299 = getelementptr inbounds [1001 x i8], ptr @_ZZ5solvevE3row, i64 0, i64 %298
  store i8 0, ptr %299, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #5
  store i32 1, ptr %20, align 4, !tbaa !5
  invoke void @_ZNSt4pairIiiEC2IRiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %19, ptr noundef nonnull align 4 dereferenceable(4) %17, ptr noundef nonnull align 4 dereferenceable(4) %20)
          to label %300 unwind label %318

300:                                              ; preds = %296
  invoke void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(80) %18, ptr noundef nonnull align 4 dereferenceable(8) %19)
          to label %301 unwind label %318

301:                                              ; preds = %300
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  br label %302

302:                                              ; preds = %372, %301
  %303 = invoke noundef zeroext i1 @_ZNKSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %18)
          to label %304 unwind label %322

304:                                              ; preds = %302
  %305 = xor i1 %303, true
  br i1 %305, label %306, label %374

306:                                              ; preds = %304
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #5
  %307 = invoke noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %18)
          to label %308 unwind label %326

308:                                              ; preds = %306
  call void @llvm.lifetime.start.p0(i64 16, ptr %25) #5
  call void @_ZSt3tieIJiiEESt5tupleIJDpRT_EES3_(ptr dead_on_unwind writable sret(%"class.std::tuple") align 8 %25, ptr noundef nonnull align 4 dereferenceable(4) %23, ptr noundef nonnull align 4 dereferenceable(4) %24) #5
  %309 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt5tupleIJRiS0_EEaSIiiEENSt9enable_ifIXcl12__assignableIRKT_RKT0_EEERS1_E4typeERKSt4pairIS4_S7_E(ptr noundef nonnull align 8 dereferenceable(16) %25, ptr noundef nonnull align 4 dereferenceable(8) %307) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %25) #5
  %310 = load i32, ptr %24, align 4, !tbaa !5
  %311 = icmp ne i32 %310, 0
  br i1 %311, label %312, label %330

312:                                              ; preds = %308
  %313 = load i32, ptr %23, align 4, !tbaa !5
  %314 = load i32, ptr %8, align 4, !tbaa !5
  %315 = add nsw i32 %314, 1
  store i32 %315, ptr %8, align 4, !tbaa !5
  %316 = sext i32 %314 to i64
  %317 = getelementptr inbounds [1001 x i32], ptr @_ZZ5solvevE4path, i64 0, i64 %316
  store i32 %313, ptr %317, align 4, !tbaa !5
  br label %330

318:                                              ; preds = %300, %296
  %319 = landingpad { ptr, i32 }
          cleanup
  %320 = extractvalue { ptr, i32 } %319, 0
  store ptr %320, ptr %21, align 8
  %321 = extractvalue { ptr, i32 } %319, 1
  store i32 %321, ptr %22, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  br label %382

322:                                              ; preds = %302
  %323 = landingpad { ptr, i32 }
          cleanup
  %324 = extractvalue { ptr, i32 } %323, 0
  store ptr %324, ptr %21, align 8
  %325 = extractvalue { ptr, i32 } %323, 1
  store i32 %325, ptr %22, align 4
  br label %382

326:                                              ; preds = %330, %306
  %327 = landingpad { ptr, i32 }
          cleanup
  %328 = extractvalue { ptr, i32 } %327, 0
  store ptr %328, ptr %21, align 8
  %329 = extractvalue { ptr, i32 } %327, 1
  store i32 %329, ptr %22, align 4
  br label %373

330:                                              ; preds = %312, %308
  invoke void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %18)
          to label %331 unwind label %326

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

332:                                              ; preds = %369, %331
  %333 = load i32, ptr %26, align 4, !tbaa !5
  %334 = load i32, ptr %1, align 4, !tbaa !5
  %335 = load i32, ptr %1, align 4, !tbaa !5
  %336 = add nsw i32 %334, %335
  %337 = icmp slt i32 %333, %336
  br i1 %337, label %339, label %338

338:                                              ; preds = %332
  store i32 37, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #5
  br label %372

339:                                              ; preds = %332
  %340 = load i32, ptr %26, align 4, !tbaa !5
  %341 = sext i32 %340 to i64
  %342 = getelementptr inbounds [1001 x i8], ptr @_ZZ5solvevE3row, i64 0, i64 %341
  %343 = load i8, ptr %342, align 1, !tbaa !11, !range !13, !noundef !14
  %344 = trunc i8 %343 to i1
  br i1 %344, label %345, label %368

345:                                              ; preds = %339
  %346 = load i32, ptr %23, align 4, !tbaa !5
  %347 = sext i32 %346 to i64
  %348 = getelementptr inbounds [1001 x [1001 x i8]], ptr @_ZZ5solvevE1e, i64 0, i64 %347
  %349 = load i32, ptr %26, align 4, !tbaa !5
  %350 = sext i32 %349 to i64
  %351 = getelementptr inbounds [1001 x i8], ptr %348, i64 0, i64 %350
  %352 = load i8, ptr %351, align 1, !tbaa !11, !range !13, !noundef !14
  %353 = trunc i8 %352 to i1
  br i1 %353, label %368, label %354

354:                                              ; preds = %345
  %355 = load i32, ptr %26, align 4, !tbaa !5
  %356 = sext i32 %355 to i64
  %357 = getelementptr inbounds [1001 x i8], ptr @_ZZ5solvevE3row, i64 0, i64 %356
  store i8 0, ptr %357, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr %28) #5
  %358 = load i32, ptr %24, align 4, !tbaa !5
  %359 = icmp ne i32 %358, 0
  %360 = xor i1 %359, true
  %361 = zext i1 %360 to i8
  store i8 %361, ptr %28, align 1, !tbaa !11
  invoke void @_ZNSt4pairIiiEC2IRibTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %27, ptr noundef nonnull align 4 dereferenceable(4) %26, ptr noundef nonnull align 1 dereferenceable(1) %28)
          to label %362 unwind label %364

362:                                              ; preds = %354
  invoke void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(80) %18, ptr noundef nonnull align 4 dereferenceable(8) %27)
          to label %363 unwind label %364

363:                                              ; preds = %362
  call void @llvm.lifetime.end.p0(i64 1, ptr %28) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #5
  br label %368

364:                                              ; preds = %362, %354
  %365 = landingpad { ptr, i32 }
          cleanup
  %366 = extractvalue { ptr, i32 } %365, 0
  store ptr %366, ptr %21, align 8
  %367 = extractvalue { ptr, i32 } %365, 1
  store i32 %367, ptr %22, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %28) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #5
  br label %373

368:                                              ; preds = %363, %345, %339
  br label %369

369:                                              ; preds = %368
  %370 = load i32, ptr %26, align 4, !tbaa !5
  %371 = add nsw i32 %370, 1
  store i32 %371, ptr %26, align 4, !tbaa !5
  br label %332, !llvm.loop !24

372:                                              ; preds = %338
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #5
  br label %302, !llvm.loop !25

373:                                              ; preds = %364, %326
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #5
  br label %382

374:                                              ; preds = %304
  %375 = load i32, ptr %16, align 4, !tbaa !5
  %376 = shl i32 %375, 1
  store i32 %376, ptr %16, align 4, !tbaa !5
  %377 = load i32, ptr %16, align 4, !tbaa !5
  %378 = srem i32 %377, 998244353
  store i32 %378, ptr %16, align 4, !tbaa !5
  call void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %18) #5
  call void @llvm.lifetime.end.p0(i64 80, ptr %18) #5
  br label %379

379:                                              ; preds = %374, %295
  %380 = load i32, ptr %17, align 4, !tbaa !5
  %381 = add nsw i32 %380, 1
  store i32 %381, ptr %17, align 4, !tbaa !5
  br label %282, !llvm.loop !26

382:                                              ; preds = %373, %322, %318
  call void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %18) #5
  call void @llvm.lifetime.end.p0(i64 80, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #5
  br label %410

383:                                              ; preds = %288
  %384 = load i32, ptr %16, align 4, !tbaa !5
  %385 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %384)
  call void @llvm.lifetime.start.p0(i64 4, ptr %29) #5
  store i32 0, ptr %29, align 4, !tbaa !5
  br label %386

386:                                              ; preds = %406, %383
  %387 = load i32, ptr %29, align 4, !tbaa !5
  %388 = load i32, ptr %8, align 4, !tbaa !5
  %389 = icmp slt i32 %387, %388
  br i1 %389, label %391, label %390

390:                                              ; preds = %386
  store i32 40, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #5
  br label %409

391:                                              ; preds = %386
  %392 = load i32, ptr %29, align 4, !tbaa !5
  %393 = sext i32 %392 to i64
  %394 = getelementptr inbounds [1001 x i32], ptr @_ZZ5solvevE4path, i64 0, i64 %393
  %395 = load i32, ptr %394, align 4, !tbaa !5
  %396 = add nsw i32 %395, 1
  %397 = load i32, ptr %29, align 4, !tbaa !5
  %398 = load i32, ptr %8, align 4, !tbaa !5
  %399 = sub nsw i32 %398, 1
  %400 = icmp eq i32 %397, %399
  %401 = zext i1 %400 to i64
  %402 = getelementptr inbounds [3 x i8], ptr @.str.3, i64 0, i64 %401
  %403 = load i8, ptr %402, align 1, !tbaa !27
  %404 = sext i8 %403 to i32
  %405 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %396, i32 noundef %404)
  br label %406

406:                                              ; preds = %391
  %407 = load i32, ptr %29, align 4, !tbaa !5
  %408 = add nsw i32 %407, 1
  store i32 %408, ptr %29, align 4, !tbaa !5
  br label %386, !llvm.loop !28

409:                                              ; preds = %390
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #5
  ret void

410:                                              ; preds = %382
  %411 = load ptr, ptr %21, align 8
  %412 = load i32, ptr %22, align 4
  %413 = insertvalue { ptr, i32 } poison, ptr %411, 0
  %414 = insertvalue { ptr, i32 } %413, i32 %412, 1
  resume { ptr, i32 } %414
}

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

declare i32 @__isoc99_scanf(ptr noundef, ...) #2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEEC2IS4_vEEv(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 4 dereferenceable(8)) #0 align 2

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZSt3tieIJiiEESt5tupleIJDpRT_EES3_(ptr dead_on_unwind noalias writable sret(%"class.std::tuple") align 8, ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt5tupleIJRiS0_EEaSIiiEENSt9enable_ifIXcl12__assignableIRKT_RKT0_EEERS1_E4typeERKSt4pairIS4_S7_E(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(8)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80)) #3 align 2

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

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

declare i32 @printf(ptr noundef, ...) #2

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress 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 #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 = { 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 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !10}
!24 = distinct !{!24, !10}
!25 = distinct !{!25, !10}
!26 = distinct !{!26, !10}
!27 = !{!7, !7, i64 0}
!28 = distinct !{!28, !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::queue" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Deque_impl" }
%"struct.std::_Deque_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Deque_impl" = type { %"struct.std::_Deque_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Deque_impl_data" }
%"struct.std::_Deque_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }
%"struct.std::pair" = type { i32, i32 }
%"class.std::tuple" = type { %"struct.std::_Tuple_impl" }
%"struct.std::_Tuple_impl" = type { %"struct.std::_Tuple_impl.0", %"struct.std::_Head_base.1" }
%"struct.std::_Tuple_impl.0" = type { %"struct.std::_Head_base" }
%"struct.std::_Head_base" = type { ptr }
%"struct.std::_Head_base.1" = type { ptr }

@_ZZ5solvevE1a = external hidden global [1001 x [1001 x i32]], align 16
@_ZZ5solvevE3row = external hidden local_unnamed_addr global [1001 x i8], align 16
@_ZZ5solvevE1e = external hidden local_unnamed_addr global [1001 x [1001 x i8]], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@_ZZ5solvevE4path = external hidden local_unnamed_addr global [1001 x i32], align 16
@_ZZ5solvevE1v = external hidden local_unnamed_addr global i32, align 4
@_ZZ5solvevE3pos = external hidden local_unnamed_addr global [1001 x i32], align 16
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca %"class.std::queue", align 8
  %4 = alloca %"struct.std::pair", align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca %"class.std::tuple", align 8
  %9 = alloca i32, align 4
  %10 = alloca %"struct.std::pair", align 4
  %11 = alloca i8, align 1
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  %12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %13 = load i32, ptr %1, align 4
  %14 = icmp sgt i32 %13, 0
  br i1 %14, label %.preheader94, label %._crit_edge225.thread

.preheader94:                                     ; preds = %0, %._crit_edge111
  %15 = phi i32 [ %73, %._crit_edge111 ], [ %13, %0 ]
  %indvars.iv259 = phi i64 [ %indvars.iv.next260, %._crit_edge111 ], [ 0, %0 ]
  %16 = icmp sgt i32 %15, 0
  br i1 %16, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.preheader94
  %17 = getelementptr inbounds [1001 x [1001 x i32]], ptr @_ZZ5solvevE1a, i64 0, i64 %indvars.iv259
  br label %83

.preheader91:                                     ; preds = %._crit_edge111
  %18 = icmp sgt i32 %73, 0
  br i1 %18, label %.preheader90.lr.ph, label %._crit_edge225.thread

.preheader90.lr.ph:                               ; preds = %.preheader91
  %19 = zext nneg i32 %73 to i64
  %20 = shl nuw nsw i64 %19, 2
  %wide.trip.count276 = zext nneg i32 %94 to i64
  %wide.trip.count291 = zext nneg i32 %94 to i64
  %min.iters.check = icmp ult i32 %94, 8
  %min.iters.check333 = icmp ult i32 %94, 32
  %n.vec = and i64 %wide.trip.count276, 2147483616
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count276
  %n.vec.remaining = and i64 %wide.trip.count276, 24
  %min.epilog.iters.check = icmp eq i64 %n.vec.remaining, 0
  %n.vec338 = and i64 %wide.trip.count276, 2147483640
  %cmp.n343 = icmp eq i64 %n.vec338, %wide.trip.count276
  br label %.preheader90.us

.preheader90.us:                                  ; preds = %._crit_edge181.us, %.preheader90.lr.ph
  %indvars.iv293 = phi i64 [ %indvars.iv.next294, %._crit_edge181.us ], [ 0, %.preheader90.lr.ph ]
  br label %.preheader89.us.us

._crit_edge181.us:                                ; preds = %vec.epilog.scalar.ph, %vec.epilog.middle.block, %middle.block
  %exitcond299.not = icmp eq i64 %indvars.iv.next294, %19
  br i1 %exitcond299.not, label %.thread, label %.preheader90.us, !llvm.loop !5

vec.epilog.scalar.ph:                             ; preds = %vec.epilog.scalar.ph.preheader, %vec.epilog.scalar.ph
  %indvars.iv288 = phi i64 [ %indvars.iv.next289, %vec.epilog.scalar.ph ], [ %indvars.iv288.ph, %vec.epilog.scalar.ph.preheader ]
  %21 = getelementptr inbounds [1001 x [1001 x i8]], ptr @_ZZ5solvevE1e, i64 0, i64 %30, i64 %indvars.iv288
  %22 = load i8, ptr %21, align 1, !tbaa !7, !range !11, !noundef !12
  %23 = getelementptr inbounds [1001 x i8], ptr @_ZZ5solvevE3row, i64 0, i64 %indvars.iv288
  %24 = load i8, ptr %23, align 1, !tbaa !7, !range !11, !noundef !12
  %25 = and i8 %24, %22
  store i8 %25, ptr %23, align 1, !tbaa !7
  %indvars.iv.next289 = add nuw nsw i64 %indvars.iv288, 1
  %exitcond292.not = icmp eq i64 %indvars.iv.next289, %wide.trip.count291
  br i1 %exitcond292.not, label %._crit_edge181.us, label %vec.epilog.scalar.ph, !llvm.loop !13

.split.us.us:                                     ; preds = %..preheader_crit_edge.us.us
  %.us-phi130.us = trunc i64 %indvars.iv278 to i32
  store i32 %.us-phi130.us, ptr @_ZZ5solvevE1v, align 4, !tbaa !16
  %26 = and i64 %indvars.iv278, 4294967295
  %27 = getelementptr inbounds [1001 x i32], ptr @_ZZ5solvevE3pos, i64 0, i64 %26
  %28 = load i32, ptr %27, align 4, !tbaa !16
  %indvars.iv.next294 = add nuw nsw i64 %indvars.iv293, 1
  %29 = getelementptr inbounds [1001 x i32], ptr @_ZZ5solvevE4path, i64 0, i64 %indvars.iv293
  store i32 %28, ptr %29, align 4, !tbaa !16
  %30 = sext i32 %28 to i64
  br i1 %min.iters.check, label %vec.epilog.scalar.ph.preheader, label %vector.main.loop.iter.check

.preheader89.us.us:                               ; preds = %.preheader90.us, %..critedge_crit_edge.us.us
  %indvars.iv283 = phi i64 [ %indvars.iv.next284, %..critedge_crit_edge.us.us ], [ 0, %.preheader90.us ]
  call void @llvm.memset.p0.i64(ptr nonnull align 16 @_ZZ5solvevE3pos, i8 -1, i64 %20, i1 false), !tbaa !16
  br label %35

..preheader_crit_edge.us.us:                      ; preds = %61, %34
  %indvars.iv278 = phi i64 [ %indvars.iv.next279, %34 ], [ 0, %61 ]
  %31 = getelementptr inbounds [1001 x i32], ptr @_ZZ5solvevE3pos, i64 0, i64 %indvars.iv278
  %32 = load i32, ptr %31, align 4, !tbaa !16
  %33 = icmp slt i32 %32, 0
  br i1 %33, label %34, label %.split.us.us

34:                                               ; preds = %..preheader_crit_edge.us.us
  %indvars.iv.next279 = add nuw nsw i64 %indvars.iv278, 1
  %exitcond282.not = icmp eq i64 %indvars.iv.next279, %19
  br i1 %exitcond282.not, label %..critedge_crit_edge.us.us, label %..preheader_crit_edge.us.us, !llvm.loop !18

35:                                               ; preds = %61, %.preheader89.us.us
  %indvars.iv273 = phi i64 [ 0, %.preheader89.us.us ], [ %indvars.iv.next274.1, %61 ]
  %36 = getelementptr inbounds [1001 x i8], ptr @_ZZ5solvevE3row, i64 0, i64 %indvars.iv273
  %37 = load i8, ptr %36, align 2, !tbaa !7, !range !11, !noundef !12
  %38 = trunc nuw i8 %37 to i1
  br i1 %38, label %39, label %48

39:                                               ; preds = %35
  %40 = getelementptr inbounds [1001 x [1001 x i32]], ptr @_ZZ5solvevE1a, i64 0, i64 %indvars.iv273, i64 %indvars.iv283
  %41 = load i32, ptr %40, align 4, !tbaa !16
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [1001 x i32], ptr @_ZZ5solvevE3pos, i64 0, i64 %42
  %44 = load i32, ptr %43, align 4, !tbaa !16
  %45 = icmp eq i32 %44, -1
  %46 = trunc nuw nsw i64 %indvars.iv273 to i32
  %47 = select i1 %45, i32 %46, i32 -2
  store i32 %47, ptr %43, align 4, !tbaa !16
  br label %48

48:                                               ; preds = %39, %35
  %indvars.iv.next274 = or disjoint i64 %indvars.iv273, 1
  %49 = getelementptr inbounds [1001 x i8], ptr @_ZZ5solvevE3row, i64 0, i64 %indvars.iv.next274
  %50 = load i8, ptr %49, align 1, !tbaa !7, !range !11, !noundef !12
  %51 = trunc nuw i8 %50 to i1
  br i1 %51, label %52, label %61

52:                                               ; preds = %48
  %53 = getelementptr inbounds [1001 x [1001 x i32]], ptr @_ZZ5solvevE1a, i64 0, i64 %indvars.iv.next274, i64 %indvars.iv283
  %54 = load i32, ptr %53, align 4, !tbaa !16
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [1001 x i32], ptr @_ZZ5solvevE3pos, i64 0, i64 %55
  %57 = load i32, ptr %56, align 4, !tbaa !16
  %58 = icmp eq i32 %57, -1
  %59 = trunc nuw nsw i64 %indvars.iv.next274 to i32
  %60 = select i1 %58, i32 %59, i32 -2
  store i32 %60, ptr %56, align 4, !tbaa !16
  br label %61

61:                                               ; preds = %52, %48
  %indvars.iv.next274.1 = add nuw nsw i64 %indvars.iv273, 2
  %exitcond277.not.1 = icmp eq i64 %indvars.iv.next274.1, %wide.trip.count276
  br i1 %exitcond277.not.1, label %..preheader_crit_edge.us.us, label %35, !llvm.loop !19

..critedge_crit_edge.us.us:                       ; preds = %34
  %indvars.iv.next284 = add nuw nsw i64 %indvars.iv283, 1
  %exitcond287.not = icmp eq i64 %indvars.iv.next284, %19
  br i1 %exitcond287.not, label %..thread.loopexit_crit_edge, label %.preheader89.us.us, !llvm.loop !20

vector.main.loop.iter.check:                      ; preds = %.split.us.us
  br i1 %min.iters.check333, label %vec.epilog.ph, label %vector.body

vector.body:                                      ; preds = %vector.main.loop.iter.check, %vector.body
  %index = phi i64 [ %index.next, %vector.body ], [ 0, %vector.main.loop.iter.check ]
  %62 = getelementptr inbounds [1001 x [1001 x i8]], ptr @_ZZ5solvevE1e, i64 0, i64 %30, i64 %index
  %63 = getelementptr inbounds i8, ptr %62, i64 16
  %wide.load = load <16 x i8>, ptr %62, align 1, !tbaa !7
  %wide.load334 = load <16 x i8>, ptr %63, align 1, !tbaa !7
  %64 = getelementptr inbounds [1001 x i8], ptr @_ZZ5solvevE3row, i64 0, i64 %index
  %65 = getelementptr inbounds i8, ptr %64, i64 16
  %wide.load335 = load <16 x i8>, ptr %64, align 16, !tbaa !7
  %wide.load336 = load <16 x i8>, ptr %65, align 16, !tbaa !7
  %66 = and <16 x i8> %wide.load335, %wide.load
  %67 = and <16 x i8> %wide.load336, %wide.load334
  store <16 x i8> %66, ptr %64, align 16, !tbaa !7
  store <16 x i8> %67, ptr %65, align 16, !tbaa !7
  %index.next = add nuw i64 %index, 32
  %68 = icmp eq i64 %index.next, %n.vec
  br i1 %68, label %middle.block, label %vector.body, !llvm.loop !21

middle.block:                                     ; preds = %vector.body
  br i1 %cmp.n, label %._crit_edge181.us, label %vec.epilog.iter.check

vec.epilog.iter.check:                            ; preds = %middle.block
  br i1 %min.epilog.iters.check, label %vec.epilog.scalar.ph.preheader, label %vec.epilog.ph

vec.epilog.scalar.ph.preheader:                   ; preds = %vec.epilog.middle.block, %.split.us.us, %vec.epilog.iter.check
  %indvars.iv288.ph = phi i64 [ 0, %.split.us.us ], [ %n.vec, %vec.epilog.iter.check ], [ %n.vec338, %vec.epilog.middle.block ]
  br label %vec.epilog.scalar.ph

vec.epilog.ph:                                    ; preds = %vector.main.loop.iter.check, %vec.epilog.iter.check
  %vec.epilog.resume.val = phi i64 [ %n.vec, %vec.epilog.iter.check ], [ 0, %vector.main.loop.iter.check ]
  br label %vec.epilog.vector.body

vec.epilog.vector.body:                           ; preds = %vec.epilog.vector.body, %vec.epilog.ph
  %index339 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next342, %vec.epilog.vector.body ]
  %69 = getelementptr inbounds [1001 x [1001 x i8]], ptr @_ZZ5solvevE1e, i64 0, i64 %30, i64 %index339
  %wide.load340 = load <8 x i8>, ptr %69, align 1, !tbaa !7
  %70 = getelementptr inbounds [1001 x i8], ptr @_ZZ5solvevE3row, i64 0, i64 %index339
  %wide.load341 = load <8 x i8>, ptr %70, align 8, !tbaa !7
  %71 = and <8 x i8> %wide.load341, %wide.load340
  store <8 x i8> %71, ptr %70, align 8, !tbaa !7
  %index.next342 = add nuw i64 %index339, 8
  %72 = icmp eq i64 %index.next342, %n.vec338
  br i1 %72, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !22

vec.epilog.middle.block:                          ; preds = %vec.epilog.vector.body
  br i1 %cmp.n343, label %._crit_edge181.us, label %vec.epilog.scalar.ph.preheader

._crit_edge:                                      ; preds = %83, %.preheader94
  %73 = phi i32 [ %15, %.preheader94 ], [ %89, %83 ]
  %74 = getelementptr inbounds [1001 x i8], ptr @_ZZ5solvevE3row, i64 0, i64 %indvars.iv259
  store i8 1, ptr %74, align 1, !tbaa !7
  %75 = getelementptr inbounds [1001 x [1001 x i8]], ptr @_ZZ5solvevE1e, i64 0, i64 %indvars.iv259, i64 %indvars.iv259
  store i8 0, ptr %75, align 1, !tbaa !7
  %.not = icmp eq i64 %indvars.iv259, 0
  br i1 %.not, label %._crit_edge111, label %.preheader93.lr.ph

.preheader93.lr.ph:                               ; preds = %._crit_edge
  %76 = icmp slt i32 %73, 1
  br i1 %76, label %.preheader93.us.preheader, label %.preheader93.preheader

.preheader93.us.preheader:                        ; preds = %.preheader93.lr.ph
  %xtraiter = and i64 %indvars.iv259, 1
  %77 = icmp eq i64 %indvars.iv259, 1
  br i1 %77, label %._crit_edge111.loopexit.unr-lcssa, label %.preheader93.us.preheader.new

.preheader93.us.preheader.new:                    ; preds = %.preheader93.us.preheader
  %unroll_iter = and i64 %indvars.iv259, 9223372036854775806
  br label %.preheader93.us

.preheader93.preheader:                           ; preds = %.preheader93.lr.ph
  %78 = zext nneg i32 %73 to i64
  br label %.preheader93

.preheader93.us:                                  ; preds = %.preheader93.us, %.preheader93.us.preheader.new
  %indvars.iv254 = phi i64 [ 0, %.preheader93.us.preheader.new ], [ %indvars.iv.next255.1, %.preheader93.us ]
  %niter = phi i64 [ 0, %.preheader93.us.preheader.new ], [ %niter.next.1, %.preheader93.us ]
  %79 = getelementptr inbounds [1001 x [1001 x i8]], ptr @_ZZ5solvevE1e, i64 0, i64 %indvars.iv254, i64 %indvars.iv259
  store i8 1, ptr %79, align 1, !tbaa !7
  %80 = getelementptr inbounds [1001 x [1001 x i8]], ptr @_ZZ5solvevE1e, i64 0, i64 %indvars.iv259, i64 %indvars.iv254
  store i8 1, ptr %80, align 1, !tbaa !7
  %indvars.iv.next255 = or disjoint i64 %indvars.iv254, 1
  %81 = getelementptr inbounds [1001 x [1001 x i8]], ptr @_ZZ5solvevE1e, i64 0, i64 %indvars.iv.next255, i64 %indvars.iv259
  store i8 1, ptr %81, align 1, !tbaa !7
  %82 = getelementptr inbounds [1001 x [1001 x i8]], ptr @_ZZ5solvevE1e, i64 0, i64 %indvars.iv259, i64 %indvars.iv.next255
  store i8 1, ptr %82, align 1, !tbaa !7
  %indvars.iv.next255.1 = add nuw nsw i64 %indvars.iv254, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge111.loopexit.unr-lcssa, label %.preheader93.us, !llvm.loop !23

83:                                               ; preds = %.lr.ph, %83
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %83 ]
  %84 = getelementptr inbounds i32, ptr %17, i64 %indvars.iv
  %85 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %84)
  %86 = getelementptr inbounds [1001 x [1001 x i32]], ptr @_ZZ5solvevE1a, i64 0, i64 %indvars.iv259, i64 %indvars.iv
  %87 = load i32, ptr %86, align 4, !tbaa !16
  %88 = add nsw i32 %87, -1
  store i32 %88, ptr %86, align 4, !tbaa !16
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %89 = load i32, ptr %1, align 4
  %90 = sext i32 %89 to i64
  %91 = icmp slt i64 %indvars.iv.next, %90
  br i1 %91, label %83, label %._crit_edge, !llvm.loop !24

.preheader93:                                     ; preds = %.preheader93.preheader, %._crit_edge108
  %indvars.iv251 = phi i64 [ 0, %.preheader93.preheader ], [ %indvars.iv.next252, %._crit_edge108 ]
  br label %101

._crit_edge111.loopexit.unr-lcssa:                ; preds = %.preheader93.us, %.preheader93.us.preheader
  %indvars.iv254.unr = phi i64 [ 0, %.preheader93.us.preheader ], [ %indvars.iv.next255.1, %.preheader93.us ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge111, label %.preheader93.us.epil

.preheader93.us.epil:                             ; preds = %._crit_edge111.loopexit.unr-lcssa
  %92 = getelementptr inbounds [1001 x [1001 x i8]], ptr @_ZZ5solvevE1e, i64 0, i64 %indvars.iv254.unr, i64 %indvars.iv259
  store i8 1, ptr %92, align 1, !tbaa !7
  %93 = getelementptr inbounds [1001 x [1001 x i8]], ptr @_ZZ5solvevE1e, i64 0, i64 %indvars.iv259, i64 %indvars.iv254.unr
  store i8 1, ptr %93, align 1, !tbaa !7
  br label %._crit_edge111

._crit_edge111:                                   ; preds = %._crit_edge108, %.preheader93.us.epil, %._crit_edge111.loopexit.unr-lcssa, %._crit_edge
  %indvars.iv.next260 = add nuw nsw i64 %indvars.iv259, 1
  %94 = shl nsw i32 %73, 1
  %95 = sext i32 %94 to i64
  %96 = icmp slt i64 %indvars.iv.next260, %95
  br i1 %96, label %.preheader94, label %.preheader91, !llvm.loop !25

._crit_edge108:                                   ; preds = %101
  %97 = xor i1 %106, true
  %98 = getelementptr inbounds [1001 x [1001 x i8]], ptr @_ZZ5solvevE1e, i64 0, i64 %indvars.iv251, i64 %indvars.iv259
  %99 = zext i1 %97 to i8
  store i8 %99, ptr %98, align 1, !tbaa !7
  %100 = getelementptr inbounds [1001 x [1001 x i8]], ptr @_ZZ5solvevE1e, i64 0, i64 %indvars.iv259, i64 %indvars.iv251
  store i8 %99, ptr %100, align 1, !tbaa !7
  %indvars.iv.next252 = add nuw nsw i64 %indvars.iv251, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next252, %indvars.iv259
  br i1 %exitcond.not, label %._crit_edge111, label %.preheader93, !llvm.loop !23

101:                                              ; preds = %.preheader93, %101
  %indvars.iv249 = phi i64 [ 0, %.preheader93 ], [ %indvars.iv.next250, %101 ]
  %102 = getelementptr inbounds [1001 x [1001 x i32]], ptr @_ZZ5solvevE1a, i64 0, i64 %indvars.iv259, i64 %indvars.iv249
  %103 = load i32, ptr %102, align 4, !tbaa !16
  %104 = getelementptr inbounds [1001 x [1001 x i32]], ptr @_ZZ5solvevE1a, i64 0, i64 %indvars.iv251, i64 %indvars.iv249
  %105 = load i32, ptr %104, align 4, !tbaa !16
  %106 = icmp eq i32 %103, %105
  %indvars.iv.next250 = add nuw nsw i64 %indvars.iv249, 1
  %107 = icmp uge i64 %indvars.iv.next250, %78
  %.not86 = select i1 %106, i1 true, i1 %107
  br i1 %.not86, label %._crit_edge108, label %101, !llvm.loop !26

..thread.loopexit_crit_edge:                      ; preds = %..critedge_crit_edge.us.us
  %.068182.us243 = trunc i64 %indvars.iv293 to i32
  store i32 %73, ptr @_ZZ5solvevE1v, align 4, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  store i32 0, ptr %2, align 4, !tbaa !16
  br i1 %18, label %.lr.ph224.preheader, label %._crit_edge225

._crit_edge225.thread:                            ; preds = %0, %.preheader91
  %108 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 1)
  br label %._crit_edge231

.thread:                                          ; preds = %._crit_edge181.us
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  store i32 0, ptr %2, align 4, !tbaa !16
  br i1 %18, label %.lr.ph224.preheader, label %._crit_edge225

.lr.ph224.preheader:                              ; preds = %..thread.loopexit_crit_edge, %.thread
  %.3222.ph = phi i32 [ %73, %.thread ], [ %.068182.us243, %..thread.loopexit_crit_edge ]
  br label %.lr.ph224

._crit_edge225:                                   ; preds = %163, %..thread.loopexit_crit_edge, %.thread
  %.3.lcssa = phi i32 [ %73, %.thread ], [ %.068182.us243, %..thread.loopexit_crit_edge ], [ %.6, %163 ]
  %.060.lcssa = phi i32 [ 1, %.thread ], [ 1, %..thread.loopexit_crit_edge ], [ %.1, %163 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  %109 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.060.lcssa)
  %110 = icmp sgt i32 %.3.lcssa, 0
  br i1 %110, label %.lr.ph230, label %._crit_edge231

.lr.ph230:                                        ; preds = %._crit_edge225
  %111 = add nsw i32 %.3.lcssa, -1
  %112 = zext nneg i32 %111 to i64
  %wide.trip.count303 = zext nneg i32 %.3.lcssa to i64
  br label %170

.lr.ph224:                                        ; preds = %.lr.ph224.preheader, %163
  %113 = phi i32 [ %164, %163 ], [ %73, %.lr.ph224.preheader ]
  %.060223 = phi i32 [ %.1, %163 ], [ 1, %.lr.ph224.preheader ]
  %.3222 = phi i32 [ %.6, %163 ], [ %.3222.ph, %.lr.ph224.preheader ]
  %storemerge80221 = phi i32 [ %166, %163 ], [ 0, %.lr.ph224.preheader ]
  %114 = sext i32 %storemerge80221 to i64
  %115 = getelementptr inbounds [1001 x i8], ptr @_ZZ5solvevE3row, i64 0, i64 %114
  %116 = load i8, ptr %115, align 1, !tbaa !7, !range !11, !noundef !12
  %117 = trunc nuw i8 %116 to i1
  br i1 %117, label %118, label %163

118:                                              ; preds = %.lr.ph224
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %3) #6
  call void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEEC2IS4_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  %119 = load i32, ptr %2, align 4, !tbaa !16
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [1001 x i8], ptr @_ZZ5solvevE3row, i64 0, i64 %120
  store i8 0, ptr %121, align 1, !tbaa !7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #6
  store i32 1, ptr %5, align 4, !tbaa !16
  call void @_ZNSt4pairIiiEC2IRiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %4, ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %5)
  invoke void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 4 dereferenceable(8) %4)
          to label %122 unwind label %132

122:                                              ; preds = %118
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  %123 = call noundef zeroext i1 @_ZNKSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  br i1 %123, label %._crit_edge219, label %.lr.ph218

.lr.ph218:                                        ; preds = %122, %._crit_edge215
  %.4216 = phi i32 [ %.5, %._crit_edge215 ], [ %.3222, %122 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #6
  %124 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %8) #6
  call void @_ZSt3tieIJiiEESt5tupleIJDpRT_EES3_(ptr dead_on_unwind nonnull writable sret(%"class.std::tuple") align 8 %8, ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %7) #6
  %125 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt5tupleIJRiS0_EEaSIiiEENSt9enable_ifIXcl12__assignableIRKT_RKT0_EEERS1_E4typeERKSt4pairIS4_S7_E(ptr noundef nonnull align 8 dereferenceable(16) %8, ptr noundef nonnull align 4 dereferenceable(8) %124) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #6
  %126 = load i32, ptr %7, align 4, !tbaa !16
  %.not81 = icmp eq i32 %126, 0
  br i1 %.not81, label %134, label %127

127:                                              ; preds = %.lr.ph218
  %128 = load i32, ptr %6, align 4, !tbaa !16
  %129 = add nsw i32 %.4216, 1
  %130 = sext i32 %.4216 to i64
  %131 = getelementptr inbounds [1001 x i32], ptr @_ZZ5solvevE4path, i64 0, i64 %130
  store i32 %128, ptr %131, align 4, !tbaa !16
  br label %134

132:                                              ; preds = %118
  %133 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  br label %169

134:                                              ; preds = %127, %.lr.ph218
  %.5 = phi i32 [ %129, %127 ], [ %.4216, %.lr.ph218 ]
  call void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #6
  store i32 0, ptr %9, align 4, !tbaa !16
  %135 = load i32, ptr %1, align 4, !tbaa !16
  %136 = icmp sgt i32 %135, 0
  br i1 %136, label %.lr.ph214, label %._crit_edge215

._crit_edge215:                                   ; preds = %155, %134
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #6
  %137 = call noundef zeroext i1 @_ZNKSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  br i1 %137, label %._crit_edge219, label %.lr.ph218, !llvm.loop !27

.lr.ph214:                                        ; preds = %134, %155
  %138 = phi i32 [ %156, %155 ], [ %135, %134 ]
  %storemerge82212 = phi i32 [ %158, %155 ], [ 0, %134 ]
  %139 = sext i32 %storemerge82212 to i64
  %140 = getelementptr inbounds [1001 x i8], ptr @_ZZ5solvevE3row, i64 0, i64 %139
  %141 = load i8, ptr %140, align 1, !tbaa !7, !range !11, !noundef !12
  %142 = trunc nuw i8 %141 to i1
  br i1 %142, label %143, label %155

143:                                              ; preds = %.lr.ph214
  %144 = load i32, ptr %6, align 4, !tbaa !16
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds [1001 x [1001 x i8]], ptr @_ZZ5solvevE1e, i64 0, i64 %145, i64 %139
  %147 = load i8, ptr %146, align 1, !tbaa !7, !range !11, !noundef !12
  %148 = trunc nuw i8 %147 to i1
  br i1 %148, label %155, label %149

149:                                              ; preds = %143
  store i8 0, ptr %140, align 1, !tbaa !7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #6
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %11) #6
  %150 = load i32, ptr %7, align 4, !tbaa !16
  %.not83 = icmp eq i32 %150, 0
  %151 = zext i1 %.not83 to i8
  store i8 %151, ptr %11, align 1, !tbaa !7
  call void @_ZNSt4pairIiiEC2IRibTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %10, ptr noundef nonnull align 4 dereferenceable(4) %9, ptr noundef nonnull align 1 dereferenceable(1) %11)
  invoke void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 4 dereferenceable(8) %10)
          to label %152 unwind label %153

152:                                              ; preds = %149
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #6
  %.pre = load i32, ptr %9, align 4, !tbaa !16
  %.pre305 = load i32, ptr %1, align 4, !tbaa !16
  br label %155

153:                                              ; preds = %149
  %154 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #6
  br label %169

155:                                              ; preds = %.lr.ph214, %143, %152
  %156 = phi i32 [ %138, %.lr.ph214 ], [ %138, %143 ], [ %.pre305, %152 ]
  %157 = phi i32 [ %storemerge82212, %.lr.ph214 ], [ %storemerge82212, %143 ], [ %.pre, %152 ]
  %158 = add nsw i32 %157, 1
  store i32 %158, ptr %9, align 4, !tbaa !16
  %159 = shl nsw i32 %156, 1
  %160 = icmp slt i32 %158, %159
  br i1 %160, label %.lr.ph214, label %._crit_edge215, !llvm.loop !28

._crit_edge219:                                   ; preds = %._crit_edge215, %122
  %.4.lcssa = phi i32 [ %.3222, %122 ], [ %.5, %._crit_edge215 ]
  %161 = shl i32 %.060223, 1
  %162 = srem i32 %161, 998244353
  call void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %3) #6
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %3) #6
  %.pre306 = load i32, ptr %2, align 4, !tbaa !16
  %.pre307 = load i32, ptr %1, align 4, !tbaa !16
  br label %163

163:                                              ; preds = %.lr.ph224, %._crit_edge219
  %164 = phi i32 [ %.pre307, %._crit_edge219 ], [ %113, %.lr.ph224 ]
  %165 = phi i32 [ %.pre306, %._crit_edge219 ], [ %storemerge80221, %.lr.ph224 ]
  %.6 = phi i32 [ %.4.lcssa, %._crit_edge219 ], [ %.3222, %.lr.ph224 ]
  %.1 = phi i32 [ %162, %._crit_edge219 ], [ %.060223, %.lr.ph224 ]
  %166 = add nsw i32 %165, 1
  store i32 %166, ptr %2, align 4, !tbaa !16
  %167 = shl nsw i32 %164, 1
  %168 = icmp slt i32 %166, %167
  br i1 %168, label %.lr.ph224, label %._crit_edge225, !llvm.loop !29

169:                                              ; preds = %153, %132
  %.pn = phi { ptr, i32 } [ %154, %153 ], [ %133, %132 ]
  call void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %3) #6
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  resume { ptr, i32 } %.pn

._crit_edge231:                                   ; preds = %170, %._crit_edge225.thread, %._crit_edge225
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  ret void

170:                                              ; preds = %.lr.ph230, %170
  %indvars.iv300 = phi i64 [ 0, %.lr.ph230 ], [ %indvars.iv.next301, %170 ]
  %171 = getelementptr inbounds [1001 x i32], ptr @_ZZ5solvevE4path, i64 0, i64 %indvars.iv300
  %172 = load i32, ptr %171, align 4, !tbaa !16
  %173 = add nsw i32 %172, 1
  %174 = icmp eq i64 %indvars.iv300, %112
  %175 = zext i1 %174 to i64
  %176 = getelementptr inbounds [3 x i8], ptr @.str.3, i64 0, i64 %175
  %177 = load i8, ptr %176, align 1, !tbaa !30
  %178 = sext i8 %177 to i32
  %179 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %173, i32 noundef %178)
  %indvars.iv.next301 = add nuw nsw i64 %indvars.iv300, 1
  %exitcond304.not = icmp eq i64 %indvars.iv.next301, %wide.trip.count303
  br i1 %exitcond304.not, label %._crit_edge231, label %170, !llvm.loop !31
}

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

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) 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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEEC2IS4_vEEv(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #0 align 2

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZSt3tieIJiiEESt5tupleIJDpRT_EES3_(ptr dead_on_unwind noalias writable sret(%"class.std::tuple") align 8, ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt5tupleIJRiS0_EEaSIiiEENSt9enable_ifIXcl12__assignableIRKT_RKT0_EEERS1_E4typeERKSt4pairIS4_S7_E(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #3 align 2

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

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

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

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

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


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