; LLVM IR from eyangch/competitive-programming :: CSES/Graph_Algorithms (labyrinth)

; 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<s, std::allocator
>::_Deque_impl" }
%"struct.std::_Deque_base<s, std::allocator
>::_Deque_impl" = type { %"struct.std::_Deque_base<s, std::allocator
>::_Deque_impl_data" }
%"struct.std::_Deque_base<s, std::allocator
>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }
%struct.s = type { i32, i32, i32 }
%"class.std::stack" = type { %"class.std::deque.0" }
%"class.std::deque.0" = type { %"class.std::_Deque_base.1" }
%"class.std::_Deque_base.1" = type { %"struct.std::_Deque_base<char, std::allocator<char>>::_Deque_impl" }
%"struct.std::_Deque_base<char, std::allocator<char>>::_Deque_impl" = type { %"struct.std::_Deque_base<char, std::allocator<char>>::_Deque_impl_data" }
%"struct.std::_Deque_base<char, std::allocator<char>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator.5", %"struct.std::_Deque_iterator.5" }
%"struct.std::_Deque_iterator.5" = type { ptr, ptr, ptr, ptr }

@dx = external dso_local global [4 x i32], align 16
@dy = external dso_local global [4 x i32], align 16
@t = external dso_local global [4 x i8], align 1
@N = external dso_local global i32, align 4
@M = external dso_local global i32, align 4
@b = external dso_local global [1005 x [1005 x i8]], align 16
@dist = external dso_local global [1000 x [1000 x i32]], align 16

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5printi(i32 noundef) #0

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

; Function Attrs: inlinehint mustprogress uwtable
declare i32 @putchar_unlocked(i32 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 noundef i32 @_Z4getNv() #0

; Function Attrs: inlinehint mustprogress uwtable
declare i32 @getchar_unlocked() #2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 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 i8, align 1
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca %"class.std::queue", align 8
  %14 = alloca %struct.s, align 4
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca %"class.std::stack", align 8
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  %26 = alloca i32, align 4
  %27 = alloca %struct.s, align 4
  store i32 0, ptr %1, align 4
  %28 = call noundef i32 @_Z4getNv()
  store i32 %28, ptr @N, align 4, !tbaa !5
  %29 = call noundef i32 @_Z4getNv()
  store i32 %29, ptr @M, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %30

30:                                               ; preds = %60, %0
  %31 = load i32, ptr %2, align 4, !tbaa !5
  %32 = load i32, ptr @N, align 4, !tbaa !5
  %33 = icmp slt i32 %31, %32
  br i1 %33, label %35, label %34

34:                                               ; preds = %30
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %63

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

36:                                               ; preds = %56, %35
  %37 = load i32, ptr %4, align 4, !tbaa !5
  %38 = load i32, ptr @M, align 4, !tbaa !5
  %39 = icmp slt i32 %37, %38
  br i1 %39, label %41, label %40

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

41:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #6
  br label %42

42:                                               ; preds = %47, %41
  %43 = call i32 @getchar_unlocked()
  %44 = trunc i32 %43 to i8
  store i8 %44, ptr %5, align 1, !tbaa !9
  %45 = sext i8 %44 to i32
  %46 = icmp sle i32 %45, 32
  br i1 %46, label %47, label %48

47:                                               ; preds = %42
  br label %42, !llvm.loop !10

48:                                               ; preds = %42
  %49 = load i8, ptr %5, align 1, !tbaa !9
  %50 = load i32, ptr %2, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [1005 x [1005 x i8]], ptr @b, i64 0, i64 %51
  %53 = load i32, ptr %4, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [1005 x i8], ptr %52, i64 0, i64 %54
  store i8 %49, ptr %55, align 1, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #6
  br label %56

56:                                               ; preds = %48
  %57 = load i32, ptr %4, align 4, !tbaa !5
  %58 = add nsw i32 %57, 1
  store i32 %58, ptr %4, align 4, !tbaa !5
  br label %36, !llvm.loop !12

59:                                               ; preds = %40
  br label %60

60:                                               ; preds = %59
  %61 = load i32, ptr %2, align 4, !tbaa !5
  %62 = add nsw i32 %61, 1
  store i32 %62, ptr %2, align 4, !tbaa !5
  br label %30, !llvm.loop !13

63:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 0, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 0, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 0, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %64

64:                                               ; preds = %106, %63
  %65 = load i32, ptr %10, align 4, !tbaa !5
  %66 = load i32, ptr @N, align 4, !tbaa !5
  %67 = icmp slt i32 %65, %66
  br i1 %67, label %69, label %68

68:                                               ; preds = %64
  store i32 10, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %109

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

70:                                               ; preds = %102, %69
  %71 = load i32, ptr %11, align 4, !tbaa !5
  %72 = load i32, ptr @M, align 4, !tbaa !5
  %73 = icmp slt i32 %71, %72
  br i1 %73, label %75, label %74

74:                                               ; preds = %70
  store i32 13, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %105

75:                                               ; preds = %70
  %76 = load i32, ptr %10, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [1005 x [1005 x i8]], ptr @b, i64 0, i64 %77
  %79 = load i32, ptr %11, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [1005 x i8], ptr %78, i64 0, i64 %80
  %82 = load i8, ptr %81, align 1, !tbaa !9
  %83 = sext i8 %82 to i32
  %84 = icmp eq i32 %83, 65
  br i1 %84, label %85, label %88

85:                                               ; preds = %75
  %86 = load i32, ptr %10, align 4, !tbaa !5
  store i32 %86, ptr %6, align 4, !tbaa !5
  %87 = load i32, ptr %11, align 4, !tbaa !5
  store i32 %87, ptr %7, align 4, !tbaa !5
  br label %88

88:                                               ; preds = %85, %75
  %89 = load i32, ptr %10, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [1005 x [1005 x i8]], ptr @b, i64 0, i64 %90
  %92 = load i32, ptr %11, align 4, !tbaa !5
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [1005 x i8], ptr %91, i64 0, i64 %93
  %95 = load i8, ptr %94, align 1, !tbaa !9
  %96 = sext i8 %95 to i32
  %97 = icmp eq i32 %96, 66
  br i1 %97, label %98, label %101

98:                                               ; preds = %88
  %99 = load i32, ptr %10, align 4, !tbaa !5
  store i32 %99, ptr %8, align 4, !tbaa !5
  %100 = load i32, ptr %11, align 4, !tbaa !5
  store i32 %100, ptr %9, align 4, !tbaa !5
  br label %101

101:                                              ; preds = %98, %88
  br label %102

102:                                              ; preds = %101
  %103 = load i32, ptr %11, align 4, !tbaa !5
  %104 = add nsw i32 %103, 1
  store i32 %104, ptr %11, align 4, !tbaa !5
  br label %70, !llvm.loop !14

105:                                              ; preds = %74
  br label %106

106:                                              ; preds = %105
  %107 = load i32, ptr %10, align 4, !tbaa !5
  %108 = add nsw i32 %107, 1
  store i32 %108, ptr %10, align 4, !tbaa !5
  br label %64, !llvm.loop !15

109:                                              ; preds = %68
  %110 = load i32, ptr @N, align 4, !tbaa !5
  %111 = sub nsw i32 %110, 1
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dist, i64 0, i64 %112
  %114 = getelementptr inbounds [1000 x i32], ptr %113, i64 0, i64 0
  %115 = load i32, ptr @M, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds i32, ptr %114, i64 %116
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 -1, ptr %12, align 4, !tbaa !5
  call void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef @dist, ptr noundef %117, ptr noundef nonnull align 4 dereferenceable(4) %12)
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.start.p0(i64 80, ptr %13) #6
  call void @_ZNSt5queueI1sSt5dequeIS0_SaIS0_EEEC2IS3_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %13)
  call void @llvm.lifetime.start.p0(i64 12, ptr %14) #6
  %118 = getelementptr inbounds %struct.s, ptr %14, i32 0, i32 0
  %119 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %119, ptr %118, align 4, !tbaa !16
  %120 = getelementptr inbounds %struct.s, ptr %14, i32 0, i32 1
  %121 = load i32, ptr %7, align 4, !tbaa !5
  store i32 %121, ptr %120, align 4, !tbaa !18
  %122 = getelementptr inbounds %struct.s, ptr %14, i32 0, i32 2
  store i32 0, ptr %122, align 4, !tbaa !19
  invoke void @_ZNSt5queueI1sSt5dequeIS0_SaIS0_EEE4pushEOS0_(ptr noundef nonnull align 8 dereferenceable(80) %13, ptr noundef nonnull align 4 dereferenceable(12) %14)
          to label %123 unwind label %176

123:                                              ; preds = %109
  call void @llvm.lifetime.end.p0(i64 12, ptr %14) #6
  br label %124

124:                                              ; preds = %372, %370, %123
  %125 = invoke noundef zeroext i1 @_ZNKSt5queueI1sSt5dequeIS0_SaIS0_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %13)
          to label %126 unwind label %180

126:                                              ; preds = %124
  %127 = xor i1 %125, true
  br i1 %127, label %128, label %376

128:                                              ; preds = %126
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  %129 = invoke noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt5queueI1sSt5dequeIS0_SaIS0_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %13)
          to label %130 unwind label %184

130:                                              ; preds = %128
  %131 = getelementptr inbounds %struct.s, ptr %129, i32 0, i32 0
  %132 = load i32, ptr %131, align 4, !tbaa !16
  store i32 %132, ptr %17, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  %133 = invoke noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt5queueI1sSt5dequeIS0_SaIS0_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %13)
          to label %134 unwind label %188

134:                                              ; preds = %130
  %135 = getelementptr inbounds %struct.s, ptr %133, i32 0, i32 1
  %136 = load i32, ptr %135, align 4, !tbaa !18
  store i32 %136, ptr %18, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  %137 = invoke noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt5queueI1sSt5dequeIS0_SaIS0_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %13)
          to label %138 unwind label %192

138:                                              ; preds = %134
  %139 = getelementptr inbounds %struct.s, ptr %137, i32 0, i32 2
  %140 = load i32, ptr %139, align 4, !tbaa !19
  store i32 %140, ptr %19, align 4, !tbaa !5
  invoke void @_ZNSt5queueI1sSt5dequeIS0_SaIS0_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %13)
          to label %141 unwind label %192

141:                                              ; preds = %138
  %142 = load i32, ptr %17, align 4, !tbaa !5
  %143 = icmp slt i32 %142, 0
  br i1 %143, label %175, label %144

144:                                              ; preds = %141
  %145 = load i32, ptr %17, align 4, !tbaa !5
  %146 = load i32, ptr @N, align 4, !tbaa !5
  %147 = icmp sge i32 %145, %146
  br i1 %147, label %175, label %148

148:                                              ; preds = %144
  %149 = load i32, ptr %18, align 4, !tbaa !5
  %150 = icmp slt i32 %149, 0
  br i1 %150, label %175, label %151

151:                                              ; preds = %148
  %152 = load i32, ptr %18, align 4, !tbaa !5
  %153 = load i32, ptr @M, align 4, !tbaa !5
  %154 = icmp sge i32 %152, %153
  br i1 %154, label %175, label %155

155:                                              ; preds = %151
  %156 = load i32, ptr %17, align 4, !tbaa !5
  %157 = sext i32 %156 to i64
  %158 = getelementptr inbounds [1005 x [1005 x i8]], ptr @b, i64 0, i64 %157
  %159 = load i32, ptr %18, align 4, !tbaa !5
  %160 = sext i32 %159 to i64
  %161 = getelementptr inbounds [1005 x i8], ptr %158, i64 0, i64 %160
  %162 = load i8, ptr %161, align 1, !tbaa !9
  %163 = sext i8 %162 to i32
  %164 = icmp eq i32 %163, 35
  br i1 %164, label %175, label %165

165:                                              ; preds = %155
  %166 = load i32, ptr %17, align 4, !tbaa !5
  %167 = sext i32 %166 to i64
  %168 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dist, i64 0, i64 %167
  %169 = load i32, ptr %18, align 4, !tbaa !5
  %170 = sext i32 %169 to i64
  %171 = getelementptr inbounds [1000 x i32], ptr %168, i64 0, i64 %170
  %172 = load i32, ptr %171, align 4, !tbaa !5
  %173 = xor i32 %172, -1
  %174 = icmp ne i32 %173, 0
  br i1 %174, label %175, label %196

175:                                              ; preds = %165, %155, %151, %148, %144, %141
  store i32 16, ptr %3, align 4
  br label %370, !llvm.loop !20

176:                                              ; preds = %109
  %177 = landingpad { ptr, i32 }
          cleanup
  %178 = extractvalue { ptr, i32 } %177, 0
  store ptr %178, ptr %15, align 8
  %179 = extractvalue { ptr, i32 } %177, 1
  store i32 %179, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 12, ptr %14) #6
  br label %387

180:                                              ; preds = %380, %378, %376, %124
  %181 = landingpad { ptr, i32 }
          cleanup
  %182 = extractvalue { ptr, i32 } %181, 0
  store ptr %182, ptr %15, align 8
  %183 = extractvalue { ptr, i32 } %181, 1
  store i32 %183, ptr %16, align 4
  br label %387

184:                                              ; preds = %128
  %185 = landingpad { ptr, i32 }
          cleanup
  %186 = extractvalue { ptr, i32 } %185, 0
  store ptr %186, ptr %15, align 8
  %187 = extractvalue { ptr, i32 } %185, 1
  store i32 %187, ptr %16, align 4
  br label %375

188:                                              ; preds = %130
  %189 = landingpad { ptr, i32 }
          cleanup
  %190 = extractvalue { ptr, i32 } %189, 0
  store ptr %190, ptr %15, align 8
  %191 = extractvalue { ptr, i32 } %189, 1
  store i32 %191, ptr %16, align 4
  br label %374

192:                                              ; preds = %138, %134
  %193 = landingpad { ptr, i32 }
          cleanup
  %194 = extractvalue { ptr, i32 } %193, 0
  store ptr %194, ptr %15, align 8
  %195 = extractvalue { ptr, i32 } %193, 1
  store i32 %195, ptr %16, align 4
  br label %373

196:                                              ; preds = %165
  %197 = load i32, ptr %19, align 4, !tbaa !5
  %198 = load i32, ptr %17, align 4, !tbaa !5
  %199 = sext i32 %198 to i64
  %200 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dist, i64 0, i64 %199
  %201 = load i32, ptr %18, align 4, !tbaa !5
  %202 = sext i32 %201 to i64
  %203 = getelementptr inbounds [1000 x i32], ptr %200, i64 0, i64 %202
  store i32 %197, ptr %203, align 4, !tbaa !5
  %204 = load i32, ptr %17, align 4, !tbaa !5
  %205 = load i32, ptr %8, align 4, !tbaa !5
  %206 = icmp eq i32 %204, %205
  br i1 %206, label %207, label %336

207:                                              ; preds = %196
  %208 = load i32, ptr %18, align 4, !tbaa !5
  %209 = load i32, ptr %9, align 4, !tbaa !5
  %210 = icmp eq i32 %208, %209
  br i1 %210, label %211, label %336

211:                                              ; preds = %207
  call void @llvm.lifetime.start.p0(i64 80, ptr %20) #6
  invoke void @_ZNSt5stackIcSt5dequeIcSaIcEEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %20)
          to label %212 unwind label %238

212:                                              ; preds = %211
  %213 = invoke i32 @putchar_unlocked(i32 noundef 89)
          to label %214 unwind label %242

214:                                              ; preds = %212
  %215 = invoke i32 @putchar_unlocked(i32 noundef 69)
          to label %216 unwind label %242

216:                                              ; preds = %214
  %217 = invoke i32 @putchar_unlocked(i32 noundef 83)
          to label %218 unwind label %242

218:                                              ; preds = %216
  %219 = invoke i32 @putchar_unlocked(i32 noundef 10)
          to label %220 unwind label %242

220:                                              ; preds = %218
  %221 = load i32, ptr %19, align 4, !tbaa !5
  invoke void @_Z5printi(i32 noundef %221)
          to label %222 unwind label %242

222:                                              ; preds = %220
  br label %223

223:                                              ; preds = %317, %222
  %224 = load i32, ptr %17, align 4, !tbaa !5
  %225 = load i32, ptr %6, align 4, !tbaa !5
  %226 = icmp ne i32 %224, %225
  br i1 %226, label %231, label %227

227:                                              ; preds = %223
  %228 = load i32, ptr %18, align 4, !tbaa !5
  %229 = load i32, ptr %7, align 4, !tbaa !5
  %230 = icmp ne i32 %228, %229
  br label %231

231:                                              ; preds = %227, %223
  %232 = phi i1 [ true, %223 ], [ %230, %227 ]
  br i1 %232, label %233, label %318

233:                                              ; preds = %231
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #6
  store i32 0, ptr %21, align 4, !tbaa !5
  br label %234

234:                                              ; preds = %313, %233
  %235 = load i32, ptr %21, align 4, !tbaa !5
  %236 = icmp slt i32 %235, 4
  br i1 %236, label %246, label %237

237:                                              ; preds = %234
  store i32 20, ptr %3, align 4
  br label %316

238:                                              ; preds = %211
  %239 = landingpad { ptr, i32 }
          cleanup
  %240 = extractvalue { ptr, i32 } %239, 0
  store ptr %240, ptr %15, align 8
  %241 = extractvalue { ptr, i32 } %239, 1
  store i32 %241, ptr %16, align 4
  br label %335

242:                                              ; preds = %331, %329, %325, %323, %319, %220, %218, %216, %214, %212
  %243 = landingpad { ptr, i32 }
          cleanup
  %244 = extractvalue { ptr, i32 } %243, 0
  store ptr %244, ptr %15, align 8
  %245 = extractvalue { ptr, i32 } %243, 1
  store i32 %245, ptr %16, align 4
  br label %334

246:                                              ; preds = %234
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #6
  %247 = load i32, ptr %17, align 4, !tbaa !5
  %248 = load i32, ptr %21, align 4, !tbaa !5
  %249 = sext i32 %248 to i64
  %250 = getelementptr inbounds [4 x i32], ptr @dx, i64 0, i64 %249
  %251 = load i32, ptr %250, align 4, !tbaa !5
  %252 = add nsw i32 %247, %251
  store i32 %252, ptr %22, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #6
  %253 = load i32, ptr %18, align 4, !tbaa !5
  %254 = load i32, ptr %21, align 4, !tbaa !5
  %255 = sext i32 %254 to i64
  %256 = getelementptr inbounds [4 x i32], ptr @dy, i64 0, i64 %255
  %257 = load i32, ptr %256, align 4, !tbaa !5
  %258 = add nsw i32 %253, %257
  store i32 %258, ptr %23, align 4, !tbaa !5
  %259 = load i32, ptr %22, align 4, !tbaa !5
  %260 = icmp slt i32 %259, 0
  br i1 %260, label %299, label %261

261:                                              ; preds = %246
  %262 = load i32, ptr %22, align 4, !tbaa !5
  %263 = load i32, ptr @N, align 4, !tbaa !5
  %264 = icmp sge i32 %262, %263
  br i1 %264, label %299, label %265

265:                                              ; preds = %261
  %266 = load i32, ptr %23, align 4, !tbaa !5
  %267 = icmp slt i32 %266, 0
  br i1 %267, label %299, label %268

268:                                              ; preds = %265
  %269 = load i32, ptr %23, align 4, !tbaa !5
  %270 = load i32, ptr @M, align 4, !tbaa !5
  %271 = icmp sge i32 %269, %270
  br i1 %271, label %299, label %272

272:                                              ; preds = %268
  %273 = load i32, ptr %22, align 4, !tbaa !5
  %274 = sext i32 %273 to i64
  %275 = getelementptr inbounds [1005 x [1005 x i8]], ptr @b, i64 0, i64 %274
  %276 = load i32, ptr %23, align 4, !tbaa !5
  %277 = sext i32 %276 to i64
  %278 = getelementptr inbounds [1005 x i8], ptr %275, i64 0, i64 %277
  %279 = load i8, ptr %278, align 1, !tbaa !9
  %280 = sext i8 %279 to i32
  %281 = icmp eq i32 %280, 35
  br i1 %281, label %299, label %282

282:                                              ; preds = %272
  %283 = load i32, ptr %22, align 4, !tbaa !5
  %284 = sext i32 %283 to i64
  %285 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dist, i64 0, i64 %284
  %286 = load i32, ptr %23, align 4, !tbaa !5
  %287 = sext i32 %286 to i64
  %288 = getelementptr inbounds [1000 x i32], ptr %285, i64 0, i64 %287
  %289 = load i32, ptr %288, align 4, !tbaa !5
  %290 = load i32, ptr %17, align 4, !tbaa !5
  %291 = sext i32 %290 to i64
  %292 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dist, i64 0, i64 %291
  %293 = load i32, ptr %18, align 4, !tbaa !5
  %294 = sext i32 %293 to i64
  %295 = getelementptr inbounds [1000 x i32], ptr %292, i64 0, i64 %294
  %296 = load i32, ptr %295, align 4, !tbaa !5
  %297 = sub nsw i32 %296, 1
  %298 = icmp ne i32 %289, %297
  br i1 %298, label %299, label %300

299:                                              ; preds = %282, %272, %268, %265, %261, %246
  store i32 22, ptr %3, align 4
  br label %311

300:                                              ; preds = %282
  %301 = load i32, ptr %21, align 4, !tbaa !5
  %302 = sext i32 %301 to i64
  %303 = getelementptr inbounds [4 x i8], ptr @t, i64 0, i64 %302
  invoke void @_ZNSt5stackIcSt5dequeIcSaIcEEE4pushERKc(ptr noundef nonnull align 8 dereferenceable(80) %20, ptr noundef nonnull align 1 dereferenceable(1) %303)
          to label %304 unwind label %307

304:                                              ; preds = %300
  %305 = load i32, ptr %22, align 4, !tbaa !5
  store i32 %305, ptr %17, align 4, !tbaa !5
  %306 = load i32, ptr %23, align 4, !tbaa !5
  store i32 %306, ptr %18, align 4, !tbaa !5
  store i32 20, ptr %3, align 4
  br label %311

307:                                              ; preds = %300
  %308 = landingpad { ptr, i32 }
          cleanup
  %309 = extractvalue { ptr, i32 } %308, 0
  store ptr %309, ptr %15, align 8
  %310 = extractvalue { ptr, i32 } %308, 1
  store i32 %310, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  br label %334

311:                                              ; preds = %304, %299
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #6
  %312 = load i32, ptr %3, align 4
  switch i32 %312, label %316 [
    i32 22, label %313
  ]

313:                                              ; preds = %311
  %314 = load i32, ptr %21, align 4, !tbaa !5
  %315 = add nsw i32 %314, 1
  store i32 %315, ptr %21, align 4, !tbaa !5
  br label %234, !llvm.loop !21

316:                                              ; preds = %311, %237
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  br label %317

317:                                              ; preds = %316
  br label %223, !llvm.loop !22

318:                                              ; preds = %231
  br label %319

319:                                              ; preds = %330, %318
  %320 = invoke noundef zeroext i1 @_ZNKSt5stackIcSt5dequeIcSaIcEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %20)
          to label %321 unwind label %242

321:                                              ; preds = %319
  %322 = xor i1 %320, true
  br i1 %322, label %323, label %331

323:                                              ; preds = %321
  %324 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt5stackIcSt5dequeIcSaIcEEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %20)
          to label %325 unwind label %242

325:                                              ; preds = %323
  %326 = load i8, ptr %324, align 1, !tbaa !9
  %327 = sext i8 %326 to i32
  %328 = invoke i32 @putchar_unlocked(i32 noundef %327)
          to label %329 unwind label %242

329:                                              ; preds = %325
  invoke void @_ZNSt5stackIcSt5dequeIcSaIcEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %20)
          to label %330 unwind label %242

330:                                              ; preds = %329
  br label %319, !llvm.loop !23

331:                                              ; preds = %321
  %332 = invoke i32 @putchar_unlocked(i32 noundef 10)
          to label %333 unwind label %242

333:                                              ; preds = %331
  store i32 0, ptr %1, align 4
  store i32 1, ptr %3, align 4
  call void @_ZNSt5stackIcSt5dequeIcSaIcEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %20) #6
  call void @llvm.lifetime.end.p0(i64 80, ptr %20) #6
  br label %370

334:                                              ; preds = %307, %242
  call void @_ZNSt5stackIcSt5dequeIcSaIcEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %20) #6
  br label %335

335:                                              ; preds = %334, %238
  call void @llvm.lifetime.end.p0(i64 80, ptr %20) #6
  br label %373

336:                                              ; preds = %207, %196
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #6
  store i32 0, ptr %24, align 4, !tbaa !5
  br label %337

337:                                              ; preds = %362, %336
  %338 = load i32, ptr %24, align 4, !tbaa !5
  %339 = icmp slt i32 %338, 4
  br i1 %339, label %341, label %340

340:                                              ; preds = %337
  store i32 25, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #6
  br label %369

341:                                              ; preds = %337
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #6
  %342 = load i32, ptr %17, align 4, !tbaa !5
  %343 = load i32, ptr %24, align 4, !tbaa !5
  %344 = sext i32 %343 to i64
  %345 = getelementptr inbounds [4 x i32], ptr @dx, i64 0, i64 %344
  %346 = load i32, ptr %345, align 4, !tbaa !5
  %347 = add nsw i32 %342, %346
  store i32 %347, ptr %25, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #6
  %348 = load i32, ptr %18, align 4, !tbaa !5
  %349 = load i32, ptr %24, align 4, !tbaa !5
  %350 = sext i32 %349 to i64
  %351 = getelementptr inbounds [4 x i32], ptr @dy, i64 0, i64 %350
  %352 = load i32, ptr %351, align 4, !tbaa !5
  %353 = add nsw i32 %348, %352
  store i32 %353, ptr %26, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 12, ptr %27) #6
  %354 = getelementptr inbounds %struct.s, ptr %27, i32 0, i32 0
  %355 = load i32, ptr %25, align 4, !tbaa !5
  store i32 %355, ptr %354, align 4, !tbaa !16
  %356 = getelementptr inbounds %struct.s, ptr %27, i32 0, i32 1
  %357 = load i32, ptr %26, align 4, !tbaa !5
  store i32 %357, ptr %356, align 4, !tbaa !18
  %358 = getelementptr inbounds %struct.s, ptr %27, i32 0, i32 2
  %359 = load i32, ptr %19, align 4, !tbaa !5
  %360 = add nsw i32 %359, 1
  store i32 %360, ptr %358, align 4, !tbaa !19
  invoke void @_ZNSt5queueI1sSt5dequeIS0_SaIS0_EEE4pushEOS0_(ptr noundef nonnull align 8 dereferenceable(80) %13, ptr noundef nonnull align 4 dereferenceable(12) %27)
          to label %361 unwind label %365

361:                                              ; preds = %341
  call void @llvm.lifetime.end.p0(i64 12, ptr %27) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #6
  br label %362

362:                                              ; preds = %361
  %363 = load i32, ptr %24, align 4, !tbaa !5
  %364 = add nsw i32 %363, 1
  store i32 %364, ptr %24, align 4, !tbaa !5
  br label %337, !llvm.loop !24

365:                                              ; preds = %341
  %366 = landingpad { ptr, i32 }
          cleanup
  %367 = extractvalue { ptr, i32 } %366, 0
  store ptr %367, ptr %15, align 8
  %368 = extractvalue { ptr, i32 } %366, 1
  store i32 %368, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 12, ptr %27) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #6
  br label %373

369:                                              ; preds = %340
  store i32 0, ptr %3, align 4
  br label %370

370:                                              ; preds = %369, %333, %175
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  %371 = load i32, ptr %3, align 4
  switch i32 %371, label %383 [
    i32 0, label %372
    i32 16, label %124
  ]

372:                                              ; preds = %370
  br label %124, !llvm.loop !20

373:                                              ; preds = %365, %335, %192
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  br label %374

374:                                              ; preds = %373, %188
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  br label %375

375:                                              ; preds = %374, %184
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  br label %387

376:                                              ; preds = %126
  %377 = invoke i32 @putchar_unlocked(i32 noundef 78)
          to label %378 unwind label %180

378:                                              ; preds = %376
  %379 = invoke i32 @putchar_unlocked(i32 noundef 79)
          to label %380 unwind label %180

380:                                              ; preds = %378
  %381 = invoke i32 @putchar_unlocked(i32 noundef 10)
          to label %382 unwind label %180

382:                                              ; preds = %380
  store i32 0, ptr %3, align 4
  br label %383

383:                                              ; preds = %382, %370
  call void @_ZNSt5queueI1sSt5dequeIS0_SaIS0_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %13) #6
  call void @llvm.lifetime.end.p0(i64 80, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  %384 = load i32, ptr %3, align 4
  switch i32 %384, label %393 [
    i32 0, label %385
    i32 1, label %385
  ]

385:                                              ; preds = %383, %383
  %386 = load i32, ptr %1, align 4
  ret i32 %386

387:                                              ; preds = %375, %180, %176
  call void @_ZNSt5queueI1sSt5dequeIS0_SaIS0_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %13) #6
  call void @llvm.lifetime.end.p0(i64 80, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %388

388:                                              ; preds = %387
  %389 = load ptr, ptr %15, align 8
  %390 = load i32, ptr %16, align 4
  %391 = insertvalue { ptr, i32 } poison, ptr %389, 0
  %392 = insertvalue { ptr, i32 } %391, i32 %390, 1
  resume { ptr, i32 } %392

393:                                              ; preds = %383
  unreachable
}

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

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

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

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

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

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

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

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = distinct !{!13, !11}
!14 = distinct !{!14, !11}
!15 = distinct !{!15, !11}
!16 = !{!17, !6, i64 0}
!17 = !{!"_ZTS1s", !6, i64 0, !6, i64 4, !6, i64 8}
!18 = !{!17, !6, i64 4}
!19 = !{!17, !6, i64 8}
!20 = distinct !{!20, !11}
!21 = distinct !{!21, !11}
!22 = distinct !{!22, !11}
!23 = distinct !{!23, !11}
!24 = distinct !{!24, !11}


; 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<s, std::allocator
>::_Deque_impl" }
%"struct.std::_Deque_base<s, std::allocator
>::_Deque_impl" = type { %"struct.std::_Deque_base<s, std::allocator
>::_Deque_impl_data" }
%"struct.std::_Deque_base<s, std::allocator
>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }
%struct.s = type { i32, i32, i32 }
%"class.std::stack" = type { %"class.std::deque.0" }
%"class.std::deque.0" = type { %"class.std::_Deque_base.1" }
%"class.std::_Deque_base.1" = type { %"struct.std::_Deque_base<char, std::allocator<char>>::_Deque_impl" }
%"struct.std::_Deque_base<char, std::allocator<char>>::_Deque_impl" = type { %"struct.std::_Deque_base<char, std::allocator<char>>::_Deque_impl_data" }
%"struct.std::_Deque_base<char, std::allocator<char>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator.5", %"struct.std::_Deque_iterator.5" }
%"struct.std::_Deque_iterator.5" = type { ptr, ptr, ptr, ptr }

@dx = external dso_local local_unnamed_addr global [4 x i32], align 16
@dy = external dso_local local_unnamed_addr global [4 x i32], align 16
@t = external dso_local global [4 x i8], align 1
@N = external dso_local local_unnamed_addr global i32, align 4
@M = external dso_local local_unnamed_addr global i32, align 4
@b = external dso_local local_unnamed_addr global [1005 x [1005 x i8]], align 16
@dist = external dso_local global [1000 x [1000 x i32]], align 16

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5printi(i32 noundef) local_unnamed_addr #0

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

; Function Attrs: inlinehint mustprogress nofree nounwind uwtable
declare noundef i32 @putchar_unlocked(i32 noundef) 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 noundef i32 @_Z4getNv() local_unnamed_addr #0

; Function Attrs: inlinehint mustprogress nofree nounwind uwtable
declare noundef i32 @getchar_unlocked() local_unnamed_addr #2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca %"class.std::queue", align 8
  %3 = alloca %struct.s, align 4
  %4 = alloca %"class.std::stack", align 8
  %5 = alloca %struct.s, align 4
  %6 = tail call noundef i32 @_Z4getNv()
  store i32 %6, ptr @N, align 4, !tbaa !5
  %7 = tail call noundef i32 @_Z4getNv()
  store i32 %7, ptr @M, align 4, !tbaa !5
  %8 = load i32, ptr @N, align 4, !tbaa !5
  %9 = icmp sgt i32 %8, 0
  %10 = icmp sgt i32 %7, 0
  %or.cond = and i1 %9, %10
  br i1 %or.cond, label %.preheader147, label %._crit_edge175

.preheader147:                                    ; preds = %0, %._crit_edge
  %11 = phi i32 [ %35, %._crit_edge ], [ %8, %0 ]
  %12 = phi i32 [ %36, %._crit_edge ], [ %7, %0 ]
  %indvars.iv210 = phi i64 [ %indvars.iv.next211, %._crit_edge ], [ 0, %0 ]
  %13 = icmp sgt i32 %12, 0
  br i1 %13, label %.preheader146, label %._crit_edge

.preheader145:                                    ; preds = %._crit_edge
  %14 = icmp sgt i32 %35, 0
  %15 = icmp sgt i32 %36, 0
  %or.cond243 = and i1 %14, %15
  br i1 %or.cond243, label %.preheader144.us.preheader, label %._crit_edge175

.preheader144.us.preheader:                       ; preds = %.preheader145
  %wide.trip.count219 = zext nneg i32 %35 to i64
  %wide.trip.count = zext nneg i32 %36 to i64
  %xtraiter = and i64 %wide.trip.count, 1
  %16 = icmp eq i32 %36, 1
  %unroll_iter = and i64 %wide.trip.count, 2147483646
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br label %.preheader144.us

.preheader144.us:                                 ; preds = %.preheader144.us.preheader, %._crit_edge165.us
  %indvars.iv216 = phi i64 [ 0, %.preheader144.us.preheader ], [ %indvars.iv.next217, %._crit_edge165.us ]
  %.082174.us = phi i32 [ 0, %.preheader144.us.preheader ], [ %spec.select123.us.lcssa, %._crit_edge165.us ]
  %.0102172.us = phi i32 [ 0, %.preheader144.us.preheader ], [ %.2104.us.lcssa, %._crit_edge165.us ]
  %.0105171.us = phi i32 [ 0, %.preheader144.us.preheader ], [ %.2107.us.lcssa, %._crit_edge165.us ]
  %.0108170.us = phi i32 [ 0, %.preheader144.us.preheader ], [ %spec.select.us.lcssa, %._crit_edge165.us ]
  %17 = trunc nuw nsw i64 %indvars.iv216 to i32
  br i1 %16, label %._crit_edge165.us.unr-lcssa, label %.preheader144.us.new

.preheader144.us.new:                             ; preds = %.preheader144.us, %.preheader144.us.new
  %indvars.iv213 = phi i64 [ %indvars.iv.next214.1, %.preheader144.us.new ], [ 0, %.preheader144.us ]
  %.183164.us = phi i32 [ %spec.select123.us.1, %.preheader144.us.new ], [ %.082174.us, %.preheader144.us ]
  %.1103162.us = phi i32 [ %.2104.us.1, %.preheader144.us.new ], [ %.0102172.us, %.preheader144.us ]
  %.1106161.us = phi i32 [ %.2107.us.1, %.preheader144.us.new ], [ %.0105171.us, %.preheader144.us ]
  %.1109160.us = phi i32 [ %spec.select.us.1, %.preheader144.us.new ], [ %.0108170.us, %.preheader144.us ]
  %niter = phi i64 [ %niter.next.1, %.preheader144.us.new ], [ 0, %.preheader144.us ]
  %18 = getelementptr inbounds [1005 x [1005 x i8]], ptr @b, i64 0, i64 %indvars.iv216, i64 %indvars.iv213
  %19 = load i8, ptr %18, align 1, !tbaa !9
  %20 = icmp eq i8 %19, 65
  %21 = trunc nuw nsw i64 %indvars.iv213 to i32
  %spec.select.us = select i1 %20, i32 %21, i32 %.1109160.us
  %22 = icmp eq i8 %19, 66
  %.2104.us = select i1 %22, i32 %21, i32 %.1103162.us
  %indvars.iv.next214 = or disjoint i64 %indvars.iv213, 1
  %23 = getelementptr inbounds [1005 x [1005 x i8]], ptr @b, i64 0, i64 %indvars.iv216, i64 %indvars.iv.next214
  %24 = load i8, ptr %23, align 1, !tbaa !9
  %25 = icmp eq i8 %24, 65
  %26 = trunc nuw nsw i64 %indvars.iv.next214 to i32
  %spec.select.us.1 = select i1 %25, i32 %26, i32 %spec.select.us
  %27 = select i1 %25, i1 true, i1 %20
  %spec.select123.us.1 = select i1 %27, i32 %17, i32 %.183164.us
  %28 = icmp eq i8 %24, 66
  %29 = select i1 %28, i1 true, i1 %22
  %.2107.us.1 = select i1 %29, i32 %17, i32 %.1106161.us
  %.2104.us.1 = select i1 %28, i32 %26, i32 %.2104.us
  %indvars.iv.next214.1 = add nuw nsw i64 %indvars.iv213, 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_edge165.us.unr-lcssa, label %.preheader144.us.new, !llvm.loop !10

._crit_edge165.us.unr-lcssa:                      ; preds = %.preheader144.us.new, %.preheader144.us
  %spec.select.us.lcssa.ph = phi i32 [ poison, %.preheader144.us ], [ %spec.select.us.1, %.preheader144.us.new ]
  %spec.select123.us.lcssa.ph = phi i32 [ poison, %.preheader144.us ], [ %spec.select123.us.1, %.preheader144.us.new ]
  %.2107.us.lcssa.ph = phi i32 [ poison, %.preheader144.us ], [ %.2107.us.1, %.preheader144.us.new ]
  %.2104.us.lcssa.ph = phi i32 [ poison, %.preheader144.us ], [ %.2104.us.1, %.preheader144.us.new ]
  %indvars.iv213.unr = phi i64 [ 0, %.preheader144.us ], [ %indvars.iv.next214.1, %.preheader144.us.new ]
  %.183164.us.unr = phi i32 [ %.082174.us, %.preheader144.us ], [ %spec.select123.us.1, %.preheader144.us.new ]
  %.1103162.us.unr = phi i32 [ %.0102172.us, %.preheader144.us ], [ %.2104.us.1, %.preheader144.us.new ]
  %.1106161.us.unr = phi i32 [ %.0105171.us, %.preheader144.us ], [ %.2107.us.1, %.preheader144.us.new ]
  %.1109160.us.unr = phi i32 [ %.0108170.us, %.preheader144.us ], [ %spec.select.us.1, %.preheader144.us.new ]
  br i1 %lcmp.mod.not, label %._crit_edge165.us, label %._crit_edge165.us.epilog-lcssa

._crit_edge165.us.epilog-lcssa:                   ; preds = %._crit_edge165.us.unr-lcssa
  %30 = getelementptr inbounds [1005 x [1005 x i8]], ptr @b, i64 0, i64 %indvars.iv216, i64 %indvars.iv213.unr
  %31 = load i8, ptr %30, align 1, !tbaa !9
  %32 = icmp eq i8 %31, 65
  %33 = trunc nuw nsw i64 %indvars.iv213.unr to i32
  %spec.select.us.epil = select i1 %32, i32 %33, i32 %.1109160.us.unr
  %spec.select123.us.epil = select i1 %32, i32 %17, i32 %.183164.us.unr
  %34 = icmp eq i8 %31, 66
  %.2107.us.epil = select i1 %34, i32 %17, i32 %.1106161.us.unr
  %.2104.us.epil = select i1 %34, i32 %33, i32 %.1103162.us.unr
  br label %._crit_edge165.us

._crit_edge165.us:                                ; preds = %._crit_edge165.us.unr-lcssa, %._crit_edge165.us.epilog-lcssa
  %spec.select.us.lcssa = phi i32 [ %spec.select.us.lcssa.ph, %._crit_edge165.us.unr-lcssa ], [ %spec.select.us.epil, %._crit_edge165.us.epilog-lcssa ]
  %spec.select123.us.lcssa = phi i32 [ %spec.select123.us.lcssa.ph, %._crit_edge165.us.unr-lcssa ], [ %spec.select123.us.epil, %._crit_edge165.us.epilog-lcssa ]
  %.2107.us.lcssa = phi i32 [ %.2107.us.lcssa.ph, %._crit_edge165.us.unr-lcssa ], [ %.2107.us.epil, %._crit_edge165.us.epilog-lcssa ]
  %.2104.us.lcssa = phi i32 [ %.2104.us.lcssa.ph, %._crit_edge165.us.unr-lcssa ], [ %.2104.us.epil, %._crit_edge165.us.epilog-lcssa ]
  %indvars.iv.next217 = add nuw nsw i64 %indvars.iv216, 1
  %exitcond220.not = icmp eq i64 %indvars.iv.next217, %wide.trip.count219
  br i1 %exitcond220.not, label %._crit_edge175, label %.preheader144.us, !llvm.loop !12

.preheader146:                                    ; preds = %.preheader147, %43
  %indvars.iv = phi i64 [ %indvars.iv.next, %43 ], [ 0, %.preheader147 ]
  br label %39

._crit_edge.loopexit:                             ; preds = %43
  %.pre = load i32, ptr @N, align 4, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader147
  %35 = phi i32 [ %.pre, %._crit_edge.loopexit ], [ %11, %.preheader147 ]
  %36 = phi i32 [ %45, %._crit_edge.loopexit ], [ %12, %.preheader147 ]
  %indvars.iv.next211 = add nuw nsw i64 %indvars.iv210, 1
  %37 = sext i32 %35 to i64
  %38 = icmp slt i64 %indvars.iv.next211, %37
  br i1 %38, label %.preheader147, label %.preheader145, !llvm.loop !13

39:                                               ; preds = %.preheader146, %39
  %40 = tail call i32 @getchar_unlocked()
  %41 = trunc i32 %40 to i8
  %42 = icmp slt i8 %41, 33
  br i1 %42, label %39, label %43, !llvm.loop !15

43:                                               ; preds = %39
  %44 = getelementptr inbounds [1005 x [1005 x i8]], ptr @b, i64 0, i64 %indvars.iv210, i64 %indvars.iv
  store i8 %41, ptr %44, align 1, !tbaa !9
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %45 = load i32, ptr @M, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = icmp slt i64 %indvars.iv.next, %46
  br i1 %47, label %.preheader146, label %._crit_edge.loopexit, !llvm.loop !16

._crit_edge175:                                   ; preds = %._crit_edge165.us, %0, %.preheader145
  %.lcssa157230 = phi i32 [ %35, %.preheader145 ], [ %8, %0 ], [ %35, %._crit_edge165.us ]
  %48 = phi i32 [ %36, %.preheader145 ], [ %7, %0 ], [ %36, %._crit_edge165.us ]
  %.0108.lcssa = phi i32 [ 0, %.preheader145 ], [ 0, %0 ], [ %spec.select.us.lcssa, %._crit_edge165.us ]
  %.0105.lcssa = phi i32 [ 0, %.preheader145 ], [ 0, %0 ], [ %.2107.us.lcssa, %._crit_edge165.us ]
  %.0102.lcssa = phi i32 [ 0, %.preheader145 ], [ 0, %0 ], [ %.2104.us.lcssa, %._crit_edge165.us ]
  %.082.lcssa = phi i32 [ 0, %.preheader145 ], [ 0, %0 ], [ %spec.select123.us.lcssa, %._crit_edge165.us ]
  %49 = add nsw i32 %.lcssa157230, -1
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dist, i64 0, i64 %50
  %52 = sext i32 %48 to i64
  %53 = getelementptr inbounds i32, ptr %51, i64 %52
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  store i32 -1, ptr %1, align 4, !tbaa !5
  call void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef nonnull @dist, ptr noundef nonnull %53, ptr noundef nonnull align 4 dereferenceable(4) %1)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %2) #7
  call void @_ZNSt5queueI1sSt5dequeIS0_SaIS0_EEEC2IS3_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %2)
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %3) #7
  store i32 %.082.lcssa, ptr %3, align 4, !tbaa !17
  %54 = getelementptr inbounds i8, ptr %3, i64 4
  store i32 %.0108.lcssa, ptr %54, align 4, !tbaa !19
  %55 = getelementptr inbounds i8, ptr %3, i64 8
  store i32 0, ptr %55, align 4, !tbaa !20
  invoke void @_ZNSt5queueI1sSt5dequeIS0_SaIS0_EEE4pushEOS0_(ptr noundef nonnull align 8 dereferenceable(80) %2, ptr noundef nonnull align 4 dereferenceable(12) %3)
          to label %56 unwind label %84

56:                                               ; preds = %._crit_edge175
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %3) #7
  %57 = call noundef zeroext i1 @_ZNKSt5queueI1sSt5dequeIS0_SaIS0_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %2)
  br i1 %57, label %._crit_edge186, label %.lr.ph

.lr.ph:                                           ; preds = %56
  %58 = getelementptr inbounds i8, ptr %5, i64 4
  %59 = getelementptr inbounds i8, ptr %5, i64 8
  br label %60

60:                                               ; preds = %.lr.ph, %.loopexit143
  %61 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt5queueI1sSt5dequeIS0_SaIS0_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %2)
  %62 = load i32, ptr %61, align 4, !tbaa !17
  %63 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt5queueI1sSt5dequeIS0_SaIS0_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %2)
  %64 = getelementptr inbounds i8, ptr %63, i64 4
  %65 = load i32, ptr %64, align 4, !tbaa !19
  %66 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt5queueI1sSt5dequeIS0_SaIS0_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %2)
  %67 = getelementptr inbounds i8, ptr %66, i64 8
  %68 = load i32, ptr %67, align 4, !tbaa !20
  call void @_ZNSt5queueI1sSt5dequeIS0_SaIS0_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %2)
  %69 = icmp slt i32 %62, 0
  br i1 %69, label %.loopexit143, label %70, !llvm.loop !21

70:                                               ; preds = %60
  %71 = load i32, ptr @N, align 4, !tbaa !5
  %72 = icmp slt i32 %62, %71
  %73 = icmp sgt i32 %65, -1
  %or.cond.not136 = select i1 %72, i1 %73, i1 false
  %74 = load i32, ptr @M, align 4
  %.not = icmp slt i32 %65, %74
  %or.cond124 = select i1 %or.cond.not136, i1 %.not, i1 false
  br i1 %or.cond124, label %75, label %.loopexit143, !llvm.loop !21

75:                                               ; preds = %70
  %76 = zext nneg i32 %62 to i64
  %77 = zext nneg i32 %65 to i64
  %78 = getelementptr inbounds [1005 x [1005 x i8]], ptr @b, i64 0, i64 %76, i64 %77
  %79 = load i8, ptr %78, align 1, !tbaa !9
  %80 = icmp eq i8 %79, 35
  br i1 %80, label %.loopexit143, label %81, !llvm.loop !21

81:                                               ; preds = %75
  %82 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dist, i64 0, i64 %76, i64 %77
  %83 = load i32, ptr %82, align 4, !tbaa !5
  %.not116 = icmp eq i32 %83, -1
  br i1 %.not116, label %86, label %.loopexit143, !llvm.loop !21

84:                                               ; preds = %._crit_edge175
  %85 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %3) #7
  br label %229

86:                                               ; preds = %81
  store i32 %68, ptr %82, align 4, !tbaa !5
  %87 = icmp eq i32 %62, %.0105.lcssa
  %88 = icmp eq i32 %65, %.0102.lcssa
  %or.cond125 = select i1 %87, i1 %88, i1 false
  br i1 %or.cond125, label %94, label %.preheader142

.preheader142:                                    ; preds = %86
  %89 = add nsw i32 %68, 1
  %90 = load i32, ptr @dx, align 16, !tbaa !5
  %91 = add nsw i32 %90, %62
  %92 = load i32, ptr @dy, align 16, !tbaa !5
  %93 = add nsw i32 %92, %65
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %5) #7
  store i32 %91, ptr %5, align 4, !tbaa !17
  store i32 %93, ptr %58, align 4, !tbaa !19
  store i32 %89, ptr %59, align 4, !tbaa !20
  invoke void @_ZNSt5queueI1sSt5dequeIS0_SaIS0_EEE4pushEOS0_(ptr noundef nonnull align 8 dereferenceable(80) %2, ptr noundef nonnull align 4 dereferenceable(12) %5)
          to label %207 unwind label %222

94:                                               ; preds = %86
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %4) #7
  invoke void @_ZNSt5stackIcSt5dequeIcSaIcEEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %4)
          to label %95 unwind label %114

95:                                               ; preds = %94
  %96 = call i32 @putchar_unlocked(i32 noundef 89)
  %97 = call i32 @putchar_unlocked(i32 noundef 69)
  %98 = call i32 @putchar_unlocked(i32 noundef 83)
  %99 = call i32 @putchar_unlocked(i32 noundef 10)
  invoke void @_Z5printi(i32 noundef %68)
          to label %.preheader141 unwind label %116

.preheader141:                                    ; preds = %95
  %100 = icmp ne i32 %.0105.lcssa, %.082.lcssa
  %101 = icmp ne i32 %.0102.lcssa, %.0108.lcssa
  %102 = select i1 %100, i1 true, i1 %101
  br i1 %102, label %.preheader140, label %.preheader

.preheader140:                                    ; preds = %.preheader141, %.loopexit
  %.085189 = phi i32 [ %.3, %.loopexit ], [ %.0102.lcssa, %.preheader141 ]
  %.088188 = phi i32 [ %.391, %.loopexit ], [ %.0105.lcssa, %.preheader141 ]
  %103 = load i32, ptr @N, align 4
  %104 = load i32, ptr @M, align 4
  %105 = sext i32 %.088188 to i64
  %106 = sext i32 %.085189 to i64
  %107 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dist, i64 0, i64 %105, i64 %106
  %108 = load i32, ptr @dx, align 16, !tbaa !5
  %109 = add nsw i32 %108, %.088188
  %110 = load i32, ptr @dy, align 16, !tbaa !5
  %111 = add nsw i32 %110, %.085189
  %112 = icmp slt i32 %109, 0
  br i1 %112, label %136, label %118

.preheader:                                       ; preds = %.loopexit, %.preheader141
  %113 = call noundef zeroext i1 @_ZNKSt5stackIcSt5dequeIcSaIcEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %4)
  br i1 %113, label %.thread132, label %.lr.ph190

114:                                              ; preds = %94
  %115 = landingpad { ptr, i32 }
          cleanup
  br label %206

116:                                              ; preds = %95
  %117 = landingpad { ptr, i32 }
          cleanup
  br label %205

118:                                              ; preds = %.preheader140
  %119 = icmp slt i32 %109, %103
  %120 = icmp sgt i32 %111, -1
  %or.cond3.not139 = select i1 %119, i1 %120, i1 false
  %.not117 = icmp slt i32 %111, %104
  %or.cond126 = select i1 %or.cond3.not139, i1 %.not117, i1 false
  br i1 %or.cond126, label %121, label %136

121:                                              ; preds = %118
  %122 = zext nneg i32 %109 to i64
  %123 = zext nneg i32 %111 to i64
  %124 = getelementptr inbounds [1005 x [1005 x i8]], ptr @b, i64 0, i64 %122, i64 %123
  %125 = load i8, ptr %124, align 1, !tbaa !9
  %126 = icmp eq i8 %125, 35
  br i1 %126, label %136, label %127

127:                                              ; preds = %121
  %128 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dist, i64 0, i64 %122, i64 %123
  %129 = load i32, ptr %128, align 4, !tbaa !5
  %130 = load i32, ptr %107, align 4, !tbaa !5
  %131 = add nsw i32 %130, -1
  %.not118 = icmp eq i32 %129, %131
  br i1 %.not118, label %132, label %136

132:                                              ; preds = %191, %171, %151, %127
  %.lcssa196 = phi i64 [ 0, %127 ], [ 1, %151 ], [ 2, %171 ], [ 3, %191 ]
  %.lcssa194 = phi i32 [ %109, %127 ], [ %138, %151 ], [ %158, %171 ], [ %178, %191 ]
  %.lcssa = phi i32 [ %111, %127 ], [ %140, %151 ], [ %160, %171 ], [ %180, %191 ]
  %133 = getelementptr inbounds [4 x i8], ptr @t, i64 0, i64 %.lcssa196
  invoke void @_ZNSt5stackIcSt5dequeIcSaIcEEE4pushERKc(ptr noundef nonnull align 8 dereferenceable(80) %4, ptr noundef nonnull align 1 dereferenceable(1) %133)
          to label %.loopexit unwind label %134

134:                                              ; preds = %132
  %135 = landingpad { ptr, i32 }
          cleanup
  br label %205

136:                                              ; preds = %127, %121, %118, %.preheader140
  %137 = load i32, ptr getelementptr inbounds (i8, ptr @dx, i64 4), align 4, !tbaa !5
  %138 = add nsw i32 %137, %.088188
  %139 = load i32, ptr getelementptr inbounds (i8, ptr @dy, i64 4), align 4, !tbaa !5
  %140 = add nsw i32 %139, %.085189
  %141 = icmp slt i32 %138, 0
  br i1 %141, label %156, label %142

142:                                              ; preds = %136
  %143 = icmp slt i32 %138, %103
  %144 = icmp sgt i32 %140, -1
  %or.cond3.not139.1 = select i1 %143, i1 %144, i1 false
  %.not117.1 = icmp slt i32 %140, %104
  %or.cond126.1 = select i1 %or.cond3.not139.1, i1 %.not117.1, i1 false
  br i1 %or.cond126.1, label %145, label %156

145:                                              ; preds = %142
  %146 = zext nneg i32 %138 to i64
  %147 = zext nneg i32 %140 to i64
  %148 = getelementptr inbounds [1005 x [1005 x i8]], ptr @b, i64 0, i64 %146, i64 %147
  %149 = load i8, ptr %148, align 1, !tbaa !9
  %150 = icmp eq i8 %149, 35
  br i1 %150, label %156, label %151

151:                                              ; preds = %145
  %152 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dist, i64 0, i64 %146, i64 %147
  %153 = load i32, ptr %152, align 4, !tbaa !5
  %154 = load i32, ptr %107, align 4, !tbaa !5
  %155 = add nsw i32 %154, -1
  %.not118.1 = icmp eq i32 %153, %155
  br i1 %.not118.1, label %132, label %156

156:                                              ; preds = %151, %145, %142, %136
  %157 = load i32, ptr getelementptr inbounds (i8, ptr @dx, i64 8), align 8, !tbaa !5
  %158 = add nsw i32 %157, %.088188
  %159 = load i32, ptr getelementptr inbounds (i8, ptr @dy, i64 8), align 8, !tbaa !5
  %160 = add nsw i32 %159, %.085189
  %161 = icmp slt i32 %158, 0
  br i1 %161, label %176, label %162

162:                                              ; preds = %156
  %163 = icmp slt i32 %158, %103
  %164 = icmp sgt i32 %160, -1
  %or.cond3.not139.2 = select i1 %163, i1 %164, i1 false
  %.not117.2 = icmp slt i32 %160, %104
  %or.cond126.2 = select i1 %or.cond3.not139.2, i1 %.not117.2, i1 false
  br i1 %or.cond126.2, label %165, label %176

165:                                              ; preds = %162
  %166 = zext nneg i32 %158 to i64
  %167 = zext nneg i32 %160 to i64
  %168 = getelementptr inbounds [1005 x [1005 x i8]], ptr @b, i64 0, i64 %166, i64 %167
  %169 = load i8, ptr %168, align 1, !tbaa !9
  %170 = icmp eq i8 %169, 35
  br i1 %170, label %176, label %171

171:                                              ; preds = %165
  %172 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dist, i64 0, i64 %166, i64 %167
  %173 = load i32, ptr %172, align 4, !tbaa !5
  %174 = load i32, ptr %107, align 4, !tbaa !5
  %175 = add nsw i32 %174, -1
  %.not118.2 = icmp eq i32 %173, %175
  br i1 %.not118.2, label %132, label %176

176:                                              ; preds = %171, %165, %162, %156
  %177 = load i32, ptr getelementptr inbounds (i8, ptr @dx, i64 12), align 4, !tbaa !5
  %178 = add nsw i32 %177, %.088188
  %179 = load i32, ptr getelementptr inbounds (i8, ptr @dy, i64 12), align 4, !tbaa !5
  %180 = add nsw i32 %179, %.085189
  %181 = icmp slt i32 %178, 0
  br i1 %181, label %.loopexit, label %182

182:                                              ; preds = %176
  %183 = icmp slt i32 %178, %103
  %184 = icmp sgt i32 %180, -1
  %or.cond3.not139.3 = select i1 %183, i1 %184, i1 false
  %.not117.3 = icmp slt i32 %180, %104
  %or.cond126.3 = select i1 %or.cond3.not139.3, i1 %.not117.3, i1 false
  br i1 %or.cond126.3, label %185, label %.loopexit

185:                                              ; preds = %182
  %186 = zext nneg i32 %178 to i64
  %187 = zext nneg i32 %180 to i64
  %188 = getelementptr inbounds [1005 x [1005 x i8]], ptr @b, i64 0, i64 %186, i64 %187
  %189 = load i8, ptr %188, align 1, !tbaa !9
  %190 = icmp eq i8 %189, 35
  br i1 %190, label %.loopexit, label %191

191:                                              ; preds = %185
  %192 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dist, i64 0, i64 %186, i64 %187
  %193 = load i32, ptr %192, align 4, !tbaa !5
  %194 = load i32, ptr %107, align 4, !tbaa !5
  %195 = add nsw i32 %194, -1
  %.not118.3 = icmp eq i32 %193, %195
  br i1 %.not118.3, label %132, label %.loopexit

.loopexit:                                        ; preds = %176, %182, %185, %191, %132
  %.391 = phi i32 [ %.lcssa194, %132 ], [ %.088188, %191 ], [ %.088188, %185 ], [ %.088188, %182 ], [ %.088188, %176 ]
  %.3 = phi i32 [ %.lcssa, %132 ], [ %.085189, %191 ], [ %.085189, %185 ], [ %.085189, %182 ], [ %.085189, %176 ]
  %196 = icmp ne i32 %.391, %.082.lcssa
  %197 = icmp ne i32 %.3, %.0108.lcssa
  %198 = select i1 %196, i1 true, i1 %197
  br i1 %198, label %.preheader140, label %.preheader, !llvm.loop !22

.lr.ph190:                                        ; preds = %.preheader, %.lr.ph190
  %199 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt5stackIcSt5dequeIcSaIcEEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %4)
  %200 = load i8, ptr %199, align 1, !tbaa !9
  %201 = sext i8 %200 to i32
  %202 = call i32 @putchar_unlocked(i32 noundef %201)
  call void @_ZNSt5stackIcSt5dequeIcSaIcEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %4)
  %203 = call noundef zeroext i1 @_ZNKSt5stackIcSt5dequeIcSaIcEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %4)
  br i1 %203, label %.thread132, label %.lr.ph190, !llvm.loop !23

.thread132:                                       ; preds = %.lr.ph190, %.preheader
  %204 = call i32 @putchar_unlocked(i32 noundef 10)
  call void @_ZNSt5stackIcSt5dequeIcSaIcEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %4) #7
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %4) #7
  br label %228

205:                                              ; preds = %134, %116
  %.pn = phi { ptr, i32 } [ %135, %134 ], [ %117, %116 ]
  call void @_ZNSt5stackIcSt5dequeIcSaIcEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %4) #7
  br label %206

206:                                              ; preds = %205, %114
  %.pn.pn = phi { ptr, i32 } [ %.pn, %205 ], [ %115, %114 ]
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %4) #7
  br label %229

207:                                              ; preds = %.preheader142
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %5) #7
  %208 = load i32, ptr getelementptr inbounds (i8, ptr @dx, i64 4), align 4, !tbaa !5
  %209 = add nsw i32 %208, %62
  %210 = load i32, ptr getelementptr inbounds (i8, ptr @dy, i64 4), align 4, !tbaa !5
  %211 = add nsw i32 %210, %65
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %5) #7
  store i32 %209, ptr %5, align 4, !tbaa !17
  store i32 %211, ptr %58, align 4, !tbaa !19
  store i32 %89, ptr %59, align 4, !tbaa !20
  invoke void @_ZNSt5queueI1sSt5dequeIS0_SaIS0_EEE4pushEOS0_(ptr noundef nonnull align 8 dereferenceable(80) %2, ptr noundef nonnull align 4 dereferenceable(12) %5)
          to label %212 unwind label %222

212:                                              ; preds = %207
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %5) #7
  %213 = load i32, ptr getelementptr inbounds (i8, ptr @dx, i64 8), align 8, !tbaa !5
  %214 = add nsw i32 %213, %62
  %215 = load i32, ptr getelementptr inbounds (i8, ptr @dy, i64 8), align 8, !tbaa !5
  %216 = add nsw i32 %215, %65
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %5) #7
  store i32 %214, ptr %5, align 4, !tbaa !17
  store i32 %216, ptr %58, align 4, !tbaa !19
  store i32 %89, ptr %59, align 4, !tbaa !20
  invoke void @_ZNSt5queueI1sSt5dequeIS0_SaIS0_EEE4pushEOS0_(ptr noundef nonnull align 8 dereferenceable(80) %2, ptr noundef nonnull align 4 dereferenceable(12) %5)
          to label %217 unwind label %222

217:                                              ; preds = %212
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %5) #7
  %218 = load i32, ptr getelementptr inbounds (i8, ptr @dx, i64 12), align 4, !tbaa !5
  %219 = add nsw i32 %218, %62
  %220 = load i32, ptr getelementptr inbounds (i8, ptr @dy, i64 12), align 4, !tbaa !5
  %221 = add nsw i32 %220, %65
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %5) #7
  store i32 %219, ptr %5, align 4, !tbaa !17
  store i32 %221, ptr %58, align 4, !tbaa !19
  store i32 %89, ptr %59, align 4, !tbaa !20
  invoke void @_ZNSt5queueI1sSt5dequeIS0_SaIS0_EEE4pushEOS0_(ptr noundef nonnull align 8 dereferenceable(80) %2, ptr noundef nonnull align 4 dereferenceable(12) %5)
          to label %.loopexit143.loopexit unwind label %222

.loopexit143.loopexit:                            ; preds = %217
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %5) #7
  br label %.loopexit143

222:                                              ; preds = %217, %212, %207, %.preheader142
  %223 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %5) #7
  br label %229

.loopexit143:                                     ; preds = %.loopexit143.loopexit, %60, %70, %75, %81
  %224 = call noundef zeroext i1 @_ZNKSt5queueI1sSt5dequeIS0_SaIS0_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %2)
  br i1 %224, label %._crit_edge186, label %60

._crit_edge186:                                   ; preds = %.loopexit143, %56
  %225 = call i32 @putchar_unlocked(i32 noundef 78)
  %226 = call i32 @putchar_unlocked(i32 noundef 79)
  %227 = call i32 @putchar_unlocked(i32 noundef 10)
  br label %228

228:                                              ; preds = %.thread132, %._crit_edge186
  call void @_ZNSt5queueI1sSt5dequeIS0_SaIS0_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %2) #7
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %2) #7
  ret i32 0

229:                                              ; preds = %206, %222, %84
  %.pn.pn.pn.pn = phi { ptr, i32 } [ %85, %84 ], [ %.pn.pn, %206 ], [ %223, %222 ]
  call void @_ZNSt5queueI1sSt5dequeIS0_SaIS0_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %2) #7
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %2) #7
  resume { ptr, i32 } %.pn.pn.pn.pn
}

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

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt5stackIcSt5dequeIcSaIcEEE3topEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #5 align 2

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

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

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

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint mustprogress nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 #7 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = distinct !{!13, !11, !14}
!14 = !{!"llvm.loop.unswitch.partial.disable"}
!15 = distinct !{!15, !11}
!16 = distinct !{!16, !11}
!17 = !{!18, !6, i64 0}
!18 = !{!"_ZTS1s", !6, i64 0, !6, i64 4, !6, i64 8}
!19 = !{!18, !6, i64 4}
!20 = !{!18, !6, i64 8}
!21 = distinct !{!21, !11}
!22 = distinct !{!22, !11}
!23 = distinct !{!23, !11}


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