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

; 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::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"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.3" }
%"class.std::deque.3" = type { %"class.std::_Deque_base.4" }
%"class.std::_Deque_base.4" = 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
@_Z3revB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@N = external dso_local global i32, align 4
@M = external dso_local global i32, align 4
@_Z1gB5cxx11 = external dso_local global [1000 x %"class.std::__cxx11::basic_string"], align 16
@md = external dso_local global [1000 x [1000 x i32]], align 16
@di = external dso_local global [1000 x [1000 x i32]], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #1 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca %"class.std::queue", align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca %struct.s, align 4
  %10 = alloca i32, align 4
  %11 = alloca %struct.s, 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 %struct.s, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca %struct.s, align 4
  %22 = alloca i32, align 4
  %23 = alloca %struct.s, align 4
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  %26 = alloca i32, align 4
  %27 = alloca %"class.std::stack", align 8
  %28 = alloca i32, align 4
  %29 = alloca i32, align 4
  %30 = alloca i32, align 4
  %31 = alloca i32, align 4
  %32 = alloca i32, align 4
  %33 = alloca i32, align 4
  %34 = alloca %struct.s, align 4
  store i32 0, ptr %1, align 4
  %35 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @N)
  %36 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %35, ptr noundef nonnull align 4 dereferenceable(4) @M)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #8
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %37

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

41:                                               ; preds = %37
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #8
  br label %50

42:                                               ; preds = %37
  %43 = load i32, ptr %2, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [1000 x %"class.std::__cxx11::basic_string"], ptr @_Z1gB5cxx11, i64 0, i64 %44
  %46 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(32) %45)
  br label %47

47:                                               ; preds = %42
  %48 = load i32, ptr %2, align 4, !tbaa !5
  %49 = add nsw i32 %48, 1
  store i32 %49, ptr %2, align 4, !tbaa !5
  br label %37, !llvm.loop !9

50:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 80, ptr %3) #8
  call void @_ZNSt5queueI1sSt5dequeIS0_SaIS0_EEEC2IS3_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #8
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %51

51:                                               ; preds = %94, %50
  %52 = load i32, ptr %4, align 4, !tbaa !5
  %53 = load i32, ptr @N, align 4, !tbaa !5
  %54 = icmp slt i32 %52, %53
  br i1 %54, label %56, label %55

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

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

57:                                               ; preds = %89, %56
  %58 = load i32, ptr %6, align 4, !tbaa !5
  %59 = load i32, ptr @M, align 4, !tbaa !5
  %60 = icmp slt i32 %58, %59
  br i1 %60, label %62, label %61

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

62:                                               ; preds = %57
  %63 = load i32, ptr %4, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [1000 x %"class.std::__cxx11::basic_string"], ptr @_Z1gB5cxx11, i64 0, i64 %64
  %66 = load i32, ptr %6, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %65, i64 noundef %67)
          to label %69 unwind label %80

69:                                               ; preds = %62
  %70 = load i8, ptr %68, align 1, !tbaa !11
  %71 = sext i8 %70 to i32
  %72 = icmp eq i32 %71, 77
  br i1 %72, label %73, label %88

73:                                               ; preds = %69
  call void @llvm.lifetime.start.p0(i64 12, ptr %9) #8
  %74 = getelementptr inbounds %struct.s, ptr %9, i32 0, i32 0
  %75 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %75, ptr %74, align 4, !tbaa !12
  %76 = getelementptr inbounds %struct.s, ptr %9, i32 0, i32 1
  %77 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %77, ptr %76, align 4, !tbaa !14
  %78 = getelementptr inbounds %struct.s, ptr %9, i32 0, i32 2
  store i32 0, ptr %78, align 4, !tbaa !15
  invoke void @_ZNSt5queueI1sSt5dequeIS0_SaIS0_EEE4pushEOS0_(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 4 dereferenceable(12) %9)
          to label %79 unwind label %84

79:                                               ; preds = %73
  call void @llvm.lifetime.end.p0(i64 12, ptr %9) #8
  br label %88

80:                                               ; preds = %62
  %81 = landingpad { ptr, i32 }
          cleanup
  %82 = extractvalue { ptr, i32 } %81, 0
  store ptr %82, ptr %7, align 8
  %83 = extractvalue { ptr, i32 } %81, 1
  store i32 %83, ptr %8, align 4
  br label %92

84:                                               ; preds = %73
  %85 = landingpad { ptr, i32 }
          cleanup
  %86 = extractvalue { ptr, i32 } %85, 0
  store ptr %86, ptr %7, align 8
  %87 = extractvalue { ptr, i32 } %85, 1
  store i32 %87, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 12, ptr %9) #8
  br label %92

88:                                               ; preds = %79, %69
  br label %89

89:                                               ; preds = %88
  %90 = load i32, ptr %6, align 4, !tbaa !5
  %91 = add nsw i32 %90, 1
  store i32 %91, ptr %6, align 4, !tbaa !5
  br label %57, !llvm.loop !16

92:                                               ; preds = %84, %80
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #8
  br label %505

93:                                               ; preds = %61
  br label %94

94:                                               ; preds = %93
  %95 = load i32, ptr %4, align 4, !tbaa !5
  %96 = add nsw i32 %95, 1
  store i32 %96, ptr %4, align 4, !tbaa !5
  br label %51, !llvm.loop !17

97:                                               ; preds = %55
  %98 = load i32, ptr @N, align 4, !tbaa !5
  %99 = sub nsw i32 %98, 1
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [1000 x [1000 x i32]], ptr @md, i64 0, i64 %100
  %102 = getelementptr inbounds [1000 x i32], ptr %101, i64 0, i64 0
  %103 = load i32, ptr @M, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds i32, ptr %102, i64 %104
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #8
  store i32 -1, ptr %10, align 4, !tbaa !5
  invoke void @_ZSt4fillIPjiEvT_S1_RKT0_(ptr noundef @md, ptr noundef %105, ptr noundef nonnull align 4 dereferenceable(4) %10)
          to label %106 unwind label %156

106:                                              ; preds = %97
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  br label %107

107:                                              ; preds = %215, %213, %106
  %108 = invoke noundef zeroext i1 @_ZNKSt5queueI1sSt5dequeIS0_SaIS0_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
          to label %109 unwind label %160

109:                                              ; preds = %107
  %110 = xor i1 %108, true
  br i1 %110, label %111, label %218

111:                                              ; preds = %109
  call void @llvm.lifetime.start.p0(i64 12, ptr %11) #8
  %112 = invoke noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt5queueI1sSt5dequeIS0_SaIS0_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
          to label %113 unwind label %164

113:                                              ; preds = %111
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %11, ptr align 4 %112, i64 12, i1 false), !tbaa.struct !18
  invoke void @_ZNSt5queueI1sSt5dequeIS0_SaIS0_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
          to label %114 unwind label %164

114:                                              ; preds = %113
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  %115 = getelementptr inbounds %struct.s, ptr %11, i32 0, i32 0
  %116 = load i32, ptr %115, align 4, !tbaa !12
  store i32 %116, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #8
  %117 = getelementptr inbounds %struct.s, ptr %11, i32 0, i32 1
  %118 = load i32, ptr %117, align 4, !tbaa !14
  store i32 %118, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #8
  %119 = getelementptr inbounds %struct.s, ptr %11, i32 0, i32 2
  %120 = load i32, ptr %119, align 4, !tbaa !15
  store i32 %120, ptr %14, align 4, !tbaa !5
  %121 = load i32, ptr %12, align 4, !tbaa !5
  %122 = icmp slt i32 %121, 0
  br i1 %122, label %155, label %123

123:                                              ; preds = %114
  %124 = load i32, ptr %13, align 4, !tbaa !5
  %125 = icmp slt i32 %124, 0
  br i1 %125, label %155, label %126

126:                                              ; preds = %123
  %127 = load i32, ptr %12, align 4, !tbaa !5
  %128 = load i32, ptr @N, align 4, !tbaa !5
  %129 = icmp sge i32 %127, %128
  br i1 %129, label %155, label %130

130:                                              ; preds = %126
  %131 = load i32, ptr %13, align 4, !tbaa !5
  %132 = load i32, ptr @M, align 4, !tbaa !5
  %133 = icmp sge i32 %131, %132
  br i1 %133, label %155, label %134

134:                                              ; preds = %130
  %135 = load i32, ptr %12, align 4, !tbaa !5
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [1000 x %"class.std::__cxx11::basic_string"], ptr @_Z1gB5cxx11, i64 0, i64 %136
  %138 = load i32, ptr %13, align 4, !tbaa !5
  %139 = sext i32 %138 to i64
  %140 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %137, i64 noundef %139)
          to label %141 unwind label %168

141:                                              ; preds = %134
  %142 = load i8, ptr %140, align 1, !tbaa !11
  %143 = sext i8 %142 to i32
  %144 = icmp eq i32 %143, 35
  br i1 %144, label %155, label %145

145:                                              ; preds = %141
  %146 = load i32, ptr %12, align 4, !tbaa !5
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds [1000 x [1000 x i32]], ptr @md, i64 0, i64 %147
  %149 = load i32, ptr %13, align 4, !tbaa !5
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds [1000 x i32], ptr %148, i64 0, i64 %150
  %152 = load i32, ptr %151, align 4, !tbaa !5
  %153 = xor i32 %152, -1
  %154 = icmp ne i32 %153, 0
  br i1 %154, label %155, label %172

155:                                              ; preds = %145, %141, %130, %126, %123, %114
  store i32 11, ptr %5, align 4
  br label %213, !llvm.loop !19

156:                                              ; preds = %97
  %157 = landingpad { ptr, i32 }
          cleanup
  %158 = extractvalue { ptr, i32 } %157, 0
  store ptr %158, ptr %7, align 8
  %159 = extractvalue { ptr, i32 } %157, 1
  store i32 %159, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  br label %505

160:                                              ; preds = %498, %496, %275, %107
  %161 = landingpad { ptr, i32 }
          cleanup
  %162 = extractvalue { ptr, i32 } %161, 0
  store ptr %162, ptr %7, align 8
  %163 = extractvalue { ptr, i32 } %161, 1
  store i32 %163, ptr %8, align 4
  br label %505

164:                                              ; preds = %113, %111
  %165 = landingpad { ptr, i32 }
          cleanup
  %166 = extractvalue { ptr, i32 } %165, 0
  store ptr %166, ptr %7, align 8
  %167 = extractvalue { ptr, i32 } %165, 1
  store i32 %167, ptr %8, align 4
  br label %217

168:                                              ; preds = %134
  %169 = landingpad { ptr, i32 }
          cleanup
  %170 = extractvalue { ptr, i32 } %169, 0
  store ptr %170, ptr %7, align 8
  %171 = extractvalue { ptr, i32 } %169, 1
  store i32 %171, ptr %8, align 4
  br label %216

172:                                              ; preds = %145
  %173 = load i32, ptr %14, align 4, !tbaa !5
  %174 = load i32, ptr %12, align 4, !tbaa !5
  %175 = sext i32 %174 to i64
  %176 = getelementptr inbounds [1000 x [1000 x i32]], ptr @md, i64 0, i64 %175
  %177 = load i32, ptr %13, align 4, !tbaa !5
  %178 = sext i32 %177 to i64
  %179 = getelementptr inbounds [1000 x i32], ptr %176, i64 0, i64 %178
  store i32 %173, ptr %179, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #8
  store i32 0, ptr %15, align 4, !tbaa !5
  br label %180

180:                                              ; preds = %205, %172
  %181 = load i32, ptr %15, align 4, !tbaa !5
  %182 = icmp slt i32 %181, 4
  br i1 %182, label %184, label %183

183:                                              ; preds = %180
  store i32 13, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #8
  br label %212

184:                                              ; preds = %180
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #8
  %185 = load i32, ptr %12, align 4, !tbaa !5
  %186 = load i32, ptr %15, align 4, !tbaa !5
  %187 = sext i32 %186 to i64
  %188 = getelementptr inbounds [4 x i32], ptr @dx, i64 0, i64 %187
  %189 = load i32, ptr %188, align 4, !tbaa !5
  %190 = add nsw i32 %185, %189
  store i32 %190, ptr %16, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #8
  %191 = load i32, ptr %13, align 4, !tbaa !5
  %192 = load i32, ptr %15, align 4, !tbaa !5
  %193 = sext i32 %192 to i64
  %194 = getelementptr inbounds [4 x i32], ptr @dy, i64 0, i64 %193
  %195 = load i32, ptr %194, align 4, !tbaa !5
  %196 = add nsw i32 %191, %195
  store i32 %196, ptr %17, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 12, ptr %18) #8
  %197 = getelementptr inbounds %struct.s, ptr %18, i32 0, i32 0
  %198 = load i32, ptr %16, align 4, !tbaa !5
  store i32 %198, ptr %197, align 4, !tbaa !12
  %199 = getelementptr inbounds %struct.s, ptr %18, i32 0, i32 1
  %200 = load i32, ptr %17, align 4, !tbaa !5
  store i32 %200, ptr %199, align 4, !tbaa !14
  %201 = getelementptr inbounds %struct.s, ptr %18, i32 0, i32 2
  %202 = load i32, ptr %14, align 4, !tbaa !5
  %203 = add i32 %202, 1
  store i32 %203, ptr %201, align 4, !tbaa !15
  invoke void @_ZNSt5queueI1sSt5dequeIS0_SaIS0_EEE4pushEOS0_(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 4 dereferenceable(12) %18)
          to label %204 unwind label %208

204:                                              ; preds = %184
  call void @llvm.lifetime.end.p0(i64 12, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #8
  br label %205

205:                                              ; preds = %204
  %206 = load i32, ptr %15, align 4, !tbaa !5
  %207 = add nsw i32 %206, 1
  store i32 %207, ptr %15, align 4, !tbaa !5
  br label %180, !llvm.loop !20

208:                                              ; preds = %184
  %209 = landingpad { ptr, i32 }
          cleanup
  %210 = extractvalue { ptr, i32 } %209, 0
  store ptr %210, ptr %7, align 8
  %211 = extractvalue { ptr, i32 } %209, 1
  store i32 %211, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 12, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #8
  br label %216

212:                                              ; preds = %183
  store i32 0, ptr %5, align 4
  br label %213

213:                                              ; preds = %212, %155
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %11) #8
  %214 = load i32, ptr %5, align 4
  switch i32 %214, label %511 [
    i32 0, label %215
    i32 11, label %107
  ]

215:                                              ; preds = %213
  br label %107, !llvm.loop !19

216:                                              ; preds = %208, %168
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  br label %217

217:                                              ; preds = %216, %164
  call void @llvm.lifetime.end.p0(i64 12, ptr %11) #8
  br label %505

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

219:                                              ; preds = %262, %218
  %220 = load i32, ptr %19, align 4, !tbaa !5
  %221 = load i32, ptr @N, align 4, !tbaa !5
  %222 = icmp slt i32 %220, %221
  br i1 %222, label %224, label %223

223:                                              ; preds = %219
  store i32 16, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #8
  br label %265

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

225:                                              ; preds = %257, %224
  %226 = load i32, ptr %20, align 4, !tbaa !5
  %227 = load i32, ptr @M, align 4, !tbaa !5
  %228 = icmp slt i32 %226, %227
  br i1 %228, label %230, label %229

229:                                              ; preds = %225
  store i32 19, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #8
  br label %261

230:                                              ; preds = %225
  %231 = load i32, ptr %19, align 4, !tbaa !5
  %232 = sext i32 %231 to i64
  %233 = getelementptr inbounds [1000 x %"class.std::__cxx11::basic_string"], ptr @_Z1gB5cxx11, i64 0, i64 %232
  %234 = load i32, ptr %20, align 4, !tbaa !5
  %235 = sext i32 %234 to i64
  %236 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %233, i64 noundef %235)
          to label %237 unwind label %248

237:                                              ; preds = %230
  %238 = load i8, ptr %236, align 1, !tbaa !11
  %239 = sext i8 %238 to i32
  %240 = icmp eq i32 %239, 65
  br i1 %240, label %241, label %256

241:                                              ; preds = %237
  call void @llvm.lifetime.start.p0(i64 12, ptr %21) #8
  %242 = getelementptr inbounds %struct.s, ptr %21, i32 0, i32 0
  %243 = load i32, ptr %19, align 4, !tbaa !5
  store i32 %243, ptr %242, align 4, !tbaa !12
  %244 = getelementptr inbounds %struct.s, ptr %21, i32 0, i32 1
  %245 = load i32, ptr %20, align 4, !tbaa !5
  store i32 %245, ptr %244, align 4, !tbaa !14
  %246 = getelementptr inbounds %struct.s, ptr %21, i32 0, i32 2
  store i32 0, ptr %246, align 4, !tbaa !15
  invoke void @_ZNSt5queueI1sSt5dequeIS0_SaIS0_EEE4pushEOS0_(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 4 dereferenceable(12) %21)
          to label %247 unwind label %252

247:                                              ; preds = %241
  call void @llvm.lifetime.end.p0(i64 12, ptr %21) #8
  br label %256

248:                                              ; preds = %230
  %249 = landingpad { ptr, i32 }
          cleanup
  %250 = extractvalue { ptr, i32 } %249, 0
  store ptr %250, ptr %7, align 8
  %251 = extractvalue { ptr, i32 } %249, 1
  store i32 %251, ptr %8, align 4
  br label %260

252:                                              ; preds = %241
  %253 = landingpad { ptr, i32 }
          cleanup
  %254 = extractvalue { ptr, i32 } %253, 0
  store ptr %254, ptr %7, align 8
  %255 = extractvalue { ptr, i32 } %253, 1
  store i32 %255, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 12, ptr %21) #8
  br label %260

256:                                              ; preds = %247, %237
  br label %257

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

260:                                              ; preds = %252, %248
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #8
  br label %505

261:                                              ; preds = %229
  br label %262

262:                                              ; preds = %261
  %263 = load i32, ptr %19, align 4, !tbaa !5
  %264 = add nsw i32 %263, 1
  store i32 %264, ptr %19, align 4, !tbaa !5
  br label %219, !llvm.loop !22

265:                                              ; preds = %223
  %266 = load i32, ptr @N, align 4, !tbaa !5
  %267 = sub nsw i32 %266, 1
  %268 = sext i32 %267 to i64
  %269 = getelementptr inbounds [1000 x [1000 x i32]], ptr @di, i64 0, i64 %268
  %270 = getelementptr inbounds [1000 x i32], ptr %269, i64 0, i64 0
  %271 = load i32, ptr @M, align 4, !tbaa !5
  %272 = sext i32 %271 to i64
  %273 = getelementptr inbounds i32, ptr %270, i64 %272
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #8
  store i32 -1, ptr %22, align 4, !tbaa !5
  invoke void @_ZSt4fillIPjiEvT_S1_RKT0_(ptr noundef @di, ptr noundef %273, ptr noundef nonnull align 4 dereferenceable(4) %22)
          to label %274 unwind label %320

274:                                              ; preds = %265
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #8
  br label %275

275:                                              ; preds = %493, %491, %274
  %276 = invoke noundef zeroext i1 @_ZNKSt5queueI1sSt5dequeIS0_SaIS0_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
          to label %277 unwind label %160

277:                                              ; preds = %275
  %278 = xor i1 %276, true
  br i1 %278, label %279, label %496

279:                                              ; preds = %277
  call void @llvm.lifetime.start.p0(i64 12, ptr %23) #8
  %280 = invoke noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt5queueI1sSt5dequeIS0_SaIS0_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
          to label %281 unwind label %324

281:                                              ; preds = %279
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %23, ptr align 4 %280, i64 12, i1 false), !tbaa.struct !18
  invoke void @_ZNSt5queueI1sSt5dequeIS0_SaIS0_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
          to label %282 unwind label %324

282:                                              ; preds = %281
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #8
  %283 = getelementptr inbounds %struct.s, ptr %23, i32 0, i32 0
  %284 = load i32, ptr %283, align 4, !tbaa !12
  store i32 %284, ptr %24, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #8
  %285 = getelementptr inbounds %struct.s, ptr %23, i32 0, i32 1
  %286 = load i32, ptr %285, align 4, !tbaa !14
  store i32 %286, ptr %25, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #8
  %287 = getelementptr inbounds %struct.s, ptr %23, i32 0, i32 2
  %288 = load i32, ptr %287, align 4, !tbaa !15
  store i32 %288, ptr %26, align 4, !tbaa !5
  %289 = load i32, ptr %24, align 4, !tbaa !5
  %290 = sext i32 %289 to i64
  %291 = getelementptr inbounds [1000 x %"class.std::__cxx11::basic_string"], ptr @_Z1gB5cxx11, i64 0, i64 %290
  %292 = load i32, ptr %25, align 4, !tbaa !5
  %293 = sext i32 %292 to i64
  %294 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %291, i64 noundef %293)
          to label %295 unwind label %328

295:                                              ; preds = %282
  %296 = load i8, ptr %294, align 1, !tbaa !11
  %297 = sext i8 %296 to i32
  %298 = icmp eq i32 %297, 35
  br i1 %298, label %319, label %299

299:                                              ; preds = %295
  %300 = load i32, ptr %24, align 4, !tbaa !5
  %301 = sext i32 %300 to i64
  %302 = getelementptr inbounds [1000 x [1000 x i32]], ptr @di, i64 0, i64 %301
  %303 = load i32, ptr %25, align 4, !tbaa !5
  %304 = sext i32 %303 to i64
  %305 = getelementptr inbounds [1000 x i32], ptr %302, i64 0, i64 %304
  %306 = load i32, ptr %305, align 4, !tbaa !5
  %307 = xor i32 %306, -1
  %308 = icmp ne i32 %307, 0
  br i1 %308, label %319, label %309

309:                                              ; preds = %299
  %310 = load i32, ptr %26, align 4, !tbaa !5
  %311 = load i32, ptr %24, align 4, !tbaa !5
  %312 = sext i32 %311 to i64
  %313 = getelementptr inbounds [1000 x [1000 x i32]], ptr @md, i64 0, i64 %312
  %314 = load i32, ptr %25, align 4, !tbaa !5
  %315 = sext i32 %314 to i64
  %316 = getelementptr inbounds [1000 x i32], ptr %313, i64 0, i64 %315
  %317 = load i32, ptr %316, align 4, !tbaa !5
  %318 = icmp uge i32 %310, %317
  br i1 %318, label %319, label %332

319:                                              ; preds = %309, %299, %295
  store i32 22, ptr %5, align 4
  br label %491, !llvm.loop !23

320:                                              ; preds = %265
  %321 = landingpad { ptr, i32 }
          cleanup
  %322 = extractvalue { ptr, i32 } %321, 0
  store ptr %322, ptr %7, align 8
  %323 = extractvalue { ptr, i32 } %321, 1
  store i32 %323, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #8
  br label %505

324:                                              ; preds = %281, %279
  %325 = landingpad { ptr, i32 }
          cleanup
  %326 = extractvalue { ptr, i32 } %325, 0
  store ptr %326, ptr %7, align 8
  %327 = extractvalue { ptr, i32 } %325, 1
  store i32 %327, ptr %8, align 4
  br label %495

328:                                              ; preds = %362, %359, %357, %355, %282
  %329 = landingpad { ptr, i32 }
          cleanup
  %330 = extractvalue { ptr, i32 } %329, 0
  store ptr %330, ptr %7, align 8
  %331 = extractvalue { ptr, i32 } %329, 1
  store i32 %331, ptr %8, align 4
  br label %494

332:                                              ; preds = %309
  %333 = load i32, ptr %26, align 4, !tbaa !5
  %334 = load i32, ptr %24, align 4, !tbaa !5
  %335 = sext i32 %334 to i64
  %336 = getelementptr inbounds [1000 x [1000 x i32]], ptr @di, i64 0, i64 %335
  %337 = load i32, ptr %25, align 4, !tbaa !5
  %338 = sext i32 %337 to i64
  %339 = getelementptr inbounds [1000 x i32], ptr %336, i64 0, i64 %338
  store i32 %333, ptr %339, align 4, !tbaa !5
  %340 = load i32, ptr %24, align 4, !tbaa !5
  %341 = icmp eq i32 %340, 0
  br i1 %341, label %355, label %342

342:                                              ; preds = %332
  %343 = load i32, ptr %25, align 4, !tbaa !5
  %344 = icmp eq i32 %343, 0
  br i1 %344, label %355, label %345

345:                                              ; preds = %342
  %346 = load i32, ptr %24, align 4, !tbaa !5
  %347 = load i32, ptr @N, align 4, !tbaa !5
  %348 = sub nsw i32 %347, 1
  %349 = icmp eq i32 %346, %348
  br i1 %349, label %355, label %350

350:                                              ; preds = %345
  %351 = load i32, ptr %25, align 4, !tbaa !5
  %352 = load i32, ptr @M, align 4, !tbaa !5
  %353 = sub nsw i32 %352, 1
  %354 = icmp eq i32 %351, %353
  br i1 %354, label %355, label %457

355:                                              ; preds = %350, %345, %342, %332
  %356 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.3)
          to label %357 unwind label %328

357:                                              ; preds = %355
  %358 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %356, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %359 unwind label %328

359:                                              ; preds = %357
  %360 = load i32, ptr %26, align 4, !tbaa !5
  %361 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEj(ptr noundef nonnull align 8 dereferenceable(8) %358, i32 noundef %360)
          to label %362 unwind label %328

362:                                              ; preds = %359
  %363 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %361, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %364 unwind label %328

364:                                              ; preds = %362
  call void @llvm.lifetime.start.p0(i64 80, ptr %27) #8
  invoke void @_ZNSt5stackIcSt5dequeIcSaIcEEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %27)
          to label %365 unwind label %382

365:                                              ; preds = %364
  br label %366

366:                                              ; preds = %439, %365
  %367 = load i32, ptr %24, align 4, !tbaa !5
  %368 = sext i32 %367 to i64
  %369 = getelementptr inbounds [1000 x %"class.std::__cxx11::basic_string"], ptr @_Z1gB5cxx11, i64 0, i64 %368
  %370 = load i32, ptr %25, align 4, !tbaa !5
  %371 = sext i32 %370 to i64
  %372 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %369, i64 noundef %371)
          to label %373 unwind label %386

373:                                              ; preds = %366
  %374 = load i8, ptr %372, align 1, !tbaa !11
  %375 = sext i8 %374 to i32
  %376 = icmp ne i32 %375, 65
  br i1 %376, label %377, label %440

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

378:                                              ; preds = %435, %377
  %379 = load i32, ptr %28, align 4, !tbaa !5
  %380 = icmp slt i32 %379, 4
  br i1 %380, label %390, label %381

381:                                              ; preds = %378
  store i32 26, ptr %5, align 4
  br label %438

382:                                              ; preds = %364
  %383 = landingpad { ptr, i32 }
          cleanup
  %384 = extractvalue { ptr, i32 } %383, 0
  store ptr %384, ptr %7, align 8
  %385 = extractvalue { ptr, i32 } %383, 1
  store i32 %385, ptr %8, align 4
  br label %456

386:                                              ; preds = %452, %450, %447, %445, %441, %366
  %387 = landingpad { ptr, i32 }
          cleanup
  %388 = extractvalue { ptr, i32 } %387, 0
  store ptr %388, ptr %7, align 8
  %389 = extractvalue { ptr, i32 } %387, 1
  store i32 %389, ptr %8, align 4
  br label %455

390:                                              ; preds = %378
  call void @llvm.lifetime.start.p0(i64 4, ptr %29) #8
  %391 = load i32, ptr %24, align 4, !tbaa !5
  %392 = load i32, ptr %28, align 4, !tbaa !5
  %393 = sext i32 %392 to i64
  %394 = getelementptr inbounds [4 x i32], ptr @dx, i64 0, i64 %393
  %395 = load i32, ptr %394, align 4, !tbaa !5
  %396 = add nsw i32 %391, %395
  store i32 %396, ptr %29, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %30) #8
  %397 = load i32, ptr %25, align 4, !tbaa !5
  %398 = load i32, ptr %28, align 4, !tbaa !5
  %399 = sext i32 %398 to i64
  %400 = getelementptr inbounds [4 x i32], ptr @dy, i64 0, i64 %399
  %401 = load i32, ptr %400, align 4, !tbaa !5
  %402 = add nsw i32 %397, %401
  store i32 %402, ptr %30, align 4, !tbaa !5
  %403 = load i32, ptr %29, align 4, !tbaa !5
  %404 = sext i32 %403 to i64
  %405 = getelementptr inbounds [1000 x [1000 x i32]], ptr @di, i64 0, i64 %404
  %406 = load i32, ptr %30, align 4, !tbaa !5
  %407 = sext i32 %406 to i64
  %408 = getelementptr inbounds [1000 x i32], ptr %405, i64 0, i64 %407
  %409 = load i32, ptr %408, align 4, !tbaa !5
  %410 = load i32, ptr %24, align 4, !tbaa !5
  %411 = sext i32 %410 to i64
  %412 = getelementptr inbounds [1000 x [1000 x i32]], ptr @di, i64 0, i64 %411
  %413 = load i32, ptr %25, align 4, !tbaa !5
  %414 = sext i32 %413 to i64
  %415 = getelementptr inbounds [1000 x i32], ptr %412, i64 0, i64 %414
  %416 = load i32, ptr %415, align 4, !tbaa !5
  %417 = sub i32 %416, 1
  %418 = icmp eq i32 %409, %417
  br i1 %418, label %419, label %431

419:                                              ; preds = %390
  %420 = load i32, ptr %28, align 4, !tbaa !5
  %421 = sext i32 %420 to i64
  %422 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z3revB5cxx11, i64 noundef %421)
          to label %423 unwind label %427

423:                                              ; preds = %419
  invoke void @_ZNSt5stackIcSt5dequeIcSaIcEEE4pushERKc(ptr noundef nonnull align 8 dereferenceable(80) %27, ptr noundef nonnull align 1 dereferenceable(1) %422)
          to label %424 unwind label %427

424:                                              ; preds = %423
  %425 = load i32, ptr %29, align 4, !tbaa !5
  store i32 %425, ptr %24, align 4, !tbaa !5
  %426 = load i32, ptr %30, align 4, !tbaa !5
  store i32 %426, ptr %25, align 4, !tbaa !5
  store i32 26, ptr %5, align 4
  br label %432

427:                                              ; preds = %423, %419
  %428 = landingpad { ptr, i32 }
          cleanup
  %429 = extractvalue { ptr, i32 } %428, 0
  store ptr %429, ptr %7, align 8
  %430 = extractvalue { ptr, i32 } %428, 1
  store i32 %430, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %30) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #8
  br label %455

431:                                              ; preds = %390
  store i32 0, ptr %5, align 4
  br label %432

432:                                              ; preds = %431, %424
  call void @llvm.lifetime.end.p0(i64 4, ptr %30) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #8
  %433 = load i32, ptr %5, align 4
  switch i32 %433, label %438 [
    i32 0, label %434
  ]

434:                                              ; preds = %432
  br label %435

435:                                              ; preds = %434
  %436 = load i32, ptr %28, align 4, !tbaa !5
  %437 = add nsw i32 %436, 1
  store i32 %437, ptr %28, align 4, !tbaa !5
  br label %378, !llvm.loop !24

438:                                              ; preds = %432, %381
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #8
  br label %439

439:                                              ; preds = %438
  br label %366, !llvm.loop !25

440:                                              ; preds = %373
  br label %441

441:                                              ; preds = %451, %440
  %442 = invoke noundef zeroext i1 @_ZNKSt5stackIcSt5dequeIcSaIcEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %27)
          to label %443 unwind label %386

443:                                              ; preds = %441
  %444 = xor i1 %442, true
  br i1 %444, label %445, label %452

445:                                              ; preds = %443
  %446 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt5stackIcSt5dequeIcSaIcEEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %27)
          to label %447 unwind label %386

447:                                              ; preds = %445
  %448 = load i8, ptr %446, align 1, !tbaa !11
  %449 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i8 noundef signext %448)
          to label %450 unwind label %386

450:                                              ; preds = %447
  invoke void @_ZNSt5stackIcSt5dequeIcSaIcEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %27)
          to label %451 unwind label %386

451:                                              ; preds = %450
  br label %441, !llvm.loop !26

452:                                              ; preds = %443
  %453 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %454 unwind label %386

454:                                              ; preds = %452
  store i32 0, ptr %1, align 4
  store i32 1, ptr %5, align 4
  call void @_ZNSt5stackIcSt5dequeIcSaIcEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %27) #8
  call void @llvm.lifetime.end.p0(i64 80, ptr %27) #8
  br label %491

455:                                              ; preds = %427, %386
  call void @_ZNSt5stackIcSt5dequeIcSaIcEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %27) #8
  br label %456

456:                                              ; preds = %455, %382
  call void @llvm.lifetime.end.p0(i64 80, ptr %27) #8
  br label %494

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

458:                                              ; preds = %483, %457
  %459 = load i32, ptr %31, align 4, !tbaa !5
  %460 = icmp slt i32 %459, 4
  br i1 %460, label %462, label %461

461:                                              ; preds = %458
  store i32 31, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %31) #8
  br label %490

462:                                              ; preds = %458
  call void @llvm.lifetime.start.p0(i64 4, ptr %32) #8
  %463 = load i32, ptr %24, align 4, !tbaa !5
  %464 = load i32, ptr %31, align 4, !tbaa !5
  %465 = sext i32 %464 to i64
  %466 = getelementptr inbounds [4 x i32], ptr @dx, i64 0, i64 %465
  %467 = load i32, ptr %466, align 4, !tbaa !5
  %468 = add nsw i32 %463, %467
  store i32 %468, ptr %32, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %33) #8
  %469 = load i32, ptr %25, align 4, !tbaa !5
  %470 = load i32, ptr %31, align 4, !tbaa !5
  %471 = sext i32 %470 to i64
  %472 = getelementptr inbounds [4 x i32], ptr @dy, i64 0, i64 %471
  %473 = load i32, ptr %472, align 4, !tbaa !5
  %474 = add nsw i32 %469, %473
  store i32 %474, ptr %33, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 12, ptr %34) #8
  %475 = getelementptr inbounds %struct.s, ptr %34, i32 0, i32 0
  %476 = load i32, ptr %32, align 4, !tbaa !5
  store i32 %476, ptr %475, align 4, !tbaa !12
  %477 = getelementptr inbounds %struct.s, ptr %34, i32 0, i32 1
  %478 = load i32, ptr %33, align 4, !tbaa !5
  store i32 %478, ptr %477, align 4, !tbaa !14
  %479 = getelementptr inbounds %struct.s, ptr %34, i32 0, i32 2
  %480 = load i32, ptr %26, align 4, !tbaa !5
  %481 = add i32 %480, 1
  store i32 %481, ptr %479, align 4, !tbaa !15
  invoke void @_ZNSt5queueI1sSt5dequeIS0_SaIS0_EEE4pushEOS0_(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 4 dereferenceable(12) %34)
          to label %482 unwind label %486

482:                                              ; preds = %462
  call void @llvm.lifetime.end.p0(i64 12, ptr %34) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %33) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %32) #8
  br label %483

483:                                              ; preds = %482
  %484 = load i32, ptr %31, align 4, !tbaa !5
  %485 = add nsw i32 %484, 1
  store i32 %485, ptr %31, align 4, !tbaa !5
  br label %458, !llvm.loop !27

486:                                              ; preds = %462
  %487 = landingpad { ptr, i32 }
          cleanup
  %488 = extractvalue { ptr, i32 } %487, 0
  store ptr %488, ptr %7, align 8
  %489 = extractvalue { ptr, i32 } %487, 1
  store i32 %489, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 12, ptr %34) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %33) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %32) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %31) #8
  br label %494

490:                                              ; preds = %461
  store i32 0, ptr %5, align 4
  br label %491

491:                                              ; preds = %490, %454, %319
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %23) #8
  %492 = load i32, ptr %5, align 4
  switch i32 %492, label %501 [
    i32 0, label %493
    i32 22, label %275
  ]

493:                                              ; preds = %491
  br label %275, !llvm.loop !23

494:                                              ; preds = %486, %456, %328
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #8
  br label %495

495:                                              ; preds = %494, %324
  call void @llvm.lifetime.end.p0(i64 12, ptr %23) #8
  br label %505

496:                                              ; preds = %277
  %497 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.4)
          to label %498 unwind label %160

498:                                              ; preds = %496
  %499 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %497, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %500 unwind label %160

500:                                              ; preds = %498
  store i32 0, ptr %5, align 4
  br label %501

501:                                              ; preds = %500, %491
  call void @_ZNSt5queueI1sSt5dequeIS0_SaIS0_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %3) #8
  call void @llvm.lifetime.end.p0(i64 80, ptr %3) #8
  %502 = load i32, ptr %5, align 4
  switch i32 %502, label %511 [
    i32 0, label %503
    i32 1, label %503
  ]

503:                                              ; preds = %501, %501
  %504 = load i32, ptr %1, align 4
  ret i32 %504

505:                                              ; preds = %495, %320, %260, %217, %160, %156, %92
  call void @_ZNSt5queueI1sSt5dequeIS0_SaIS0_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %3) #8
  call void @llvm.lifetime.end.p0(i64 80, ptr %3) #8
  br label %506

506:                                              ; preds = %505
  %507 = load ptr, ptr %7, align 8
  %508 = load i32, ptr %8, align 4
  %509 = insertvalue { ptr, i32 } poison, ptr %507, 0
  %510 = insertvalue { ptr, i32 } %509, i32 %508, 1
  resume { ptr, i32 } %510

511:                                              ; preds = %501, %213
  unreachable
}

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) #2

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) #4 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)) #3 align 2

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

; 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: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #6

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #5

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #5

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEj(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5stackIcSt5dequeIcSaIcEEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #3 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)) #3 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: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) #5

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

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !6, i64 0}
!13 = !{!"_ZTS1s", !6, i64 0, !6, i64 4, !6, i64 8}
!14 = !{!13, !6, i64 4}
!15 = !{!13, !6, i64 8}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = !{i64 0, i64 4, !5, i64 4, i64 4, !5, i64 8, i64 4, !5}
!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 = distinct !{!27, !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::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"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.3" }
%"class.std::deque.3" = type { %"class.std::_Deque_base.4" }
%"class.std::_Deque_base.4" = 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
@_Z3revB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@N = external dso_local global i32, align 4
@M = external dso_local global i32, align 4
@_Z1gB5cxx11 = external dso_local global [1000 x %"class.std::__cxx11::basic_string"], align 16
@md = external dso_local global [1000 x [1000 x i32]], align 16
@di = external dso_local global [1000 x [1000 x i32]], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::queue", align 8
  %2 = alloca %struct.s, align 4
  %3 = alloca i32, align 4
  %4 = alloca %struct.s, align 4
  %5 = alloca %struct.s, align 4
  %6 = alloca i32, align 4
  %7 = alloca %"class.std::stack", align 8
  %8 = alloca %struct.s, align 4
  %9 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @N)
  %10 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef nonnull align 4 dereferenceable(4) @M)
  %11 = load i32, ptr @N, align 4, !tbaa !5
  %12 = icmp sgt i32 %11, 0
  br i1 %12, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %0
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %1) #7
  call void @_ZNSt5queueI1sSt5dequeIS0_SaIS0_EEEC2IS3_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %1)
  %13 = load i32, ptr @N, align 4, !tbaa !5
  %14 = icmp sgt i32 %13, 0
  %.pre215 = load i32, ptr @M, align 4, !tbaa !5
  br i1 %14, label %.preheader142.lr.ph, label %._crit_edge157

.preheader142.lr.ph:                              ; preds = %._crit_edge
  %15 = getelementptr inbounds i8, ptr %2, i64 4
  %16 = getelementptr inbounds i8, ptr %2, i64 8
  %17 = icmp sgt i32 %.pre215, 0
  br i1 %17, label %.preheader142, label %._crit_edge157

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %18 = getelementptr inbounds [1000 x %"class.std::__cxx11::basic_string"], ptr @_Z1gB5cxx11, i64 0, i64 %indvars.iv
  %19 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(32) %18)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %20 = load i32, ptr @N, align 4, !tbaa !5
  %21 = sext i32 %20 to i64
  %22 = icmp slt i64 %indvars.iv.next, %21
  br i1 %22, label %.lr.ph, label %._crit_edge, !llvm.loop !9

.preheader142:                                    ; preds = %.preheader142.lr.ph, %._crit_edge155
  %23 = phi i32 [ %34, %._crit_edge155 ], [ %13, %.preheader142.lr.ph ]
  %24 = phi i32 [ %35, %._crit_edge155 ], [ %.pre215, %.preheader142.lr.ph ]
  %indvars.iv197 = phi i64 [ %indvars.iv.next198, %._crit_edge155 ], [ 0, %.preheader142.lr.ph ]
  %25 = icmp sgt i32 %24, 0
  br i1 %25, label %.lr.ph154, label %._crit_edge155

.lr.ph154:                                        ; preds = %.preheader142
  %26 = getelementptr inbounds [1000 x %"class.std::__cxx11::basic_string"], ptr @_Z1gB5cxx11, i64 0, i64 %indvars.iv197
  %27 = trunc nuw nsw i64 %indvars.iv197 to i32
  br label %38

._crit_edge157:                                   ; preds = %._crit_edge155, %.preheader142.lr.ph, %._crit_edge
  %28 = phi i32 [ %.pre215, %._crit_edge ], [ %.pre215, %.preheader142.lr.ph ], [ %35, %._crit_edge155 ]
  %.lcssa150 = phi i32 [ %13, %._crit_edge ], [ %13, %.preheader142.lr.ph ], [ %34, %._crit_edge155 ]
  %29 = add nsw i32 %.lcssa150, -1
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [1000 x [1000 x i32]], ptr @md, i64 0, i64 %30
  %32 = sext i32 %28 to i64
  %33 = getelementptr inbounds i32, ptr %31, i64 %32
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  store i32 -1, ptr %3, align 4, !tbaa !5
  invoke void @_ZSt4fillIPjiEvT_S1_RKT0_(ptr noundef nonnull @md, ptr noundef nonnull %33, ptr noundef nonnull align 4 dereferenceable(4) %3)
          to label %51 unwind label %76

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

._crit_edge155:                                   ; preds = %._crit_edge155.loopexit, %.preheader142
  %34 = phi i32 [ %.pre, %._crit_edge155.loopexit ], [ %23, %.preheader142 ]
  %35 = phi i32 [ %48, %._crit_edge155.loopexit ], [ %24, %.preheader142 ]
  %indvars.iv.next198 = add nuw nsw i64 %indvars.iv197, 1
  %36 = sext i32 %34 to i64
  %37 = icmp slt i64 %indvars.iv.next198, %36
  br i1 %37, label %.preheader142, label %._crit_edge157, !llvm.loop !11

38:                                               ; preds = %.lr.ph154, %47
  %indvars.iv194 = phi i64 [ 0, %.lr.ph154 ], [ %indvars.iv.next195, %47 ]
  %39 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %26, i64 noundef %indvars.iv194)
  %40 = load i8, ptr %39, align 1, !tbaa !13
  %41 = icmp eq i8 %40, 77
  br i1 %41, label %42, label %47

42:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %2) #7
  store i32 %27, ptr %2, align 4, !tbaa !14
  %43 = trunc nuw nsw i64 %indvars.iv194 to i32
  store i32 %43, ptr %15, align 4, !tbaa !16
  store i32 0, ptr %16, align 4, !tbaa !17
  invoke void @_ZNSt5queueI1sSt5dequeIS0_SaIS0_EEE4pushEOS0_(ptr noundef nonnull align 8 dereferenceable(80) %1, ptr noundef nonnull align 4 dereferenceable(12) %2)
          to label %44 unwind label %45

44:                                               ; preds = %42
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %2) #7
  br label %47

45:                                               ; preds = %42
  %46 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %2) #7
  br label %261

47:                                               ; preds = %38, %44
  %indvars.iv.next195 = add nuw nsw i64 %indvars.iv194, 1
  %48 = load i32, ptr @M, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = icmp slt i64 %indvars.iv.next195, %49
  br i1 %50, label %38, label %._crit_edge155.loopexit, !llvm.loop !18

51:                                               ; preds = %._crit_edge157
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  %52 = call noundef zeroext i1 @_ZNKSt5queueI1sSt5dequeIS0_SaIS0_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %1)
  br i1 %52, label %.preheader140, label %.lr.ph160

.lr.ph160:                                        ; preds = %51
  %53 = getelementptr inbounds i8, ptr %4, i64 4
  %54 = getelementptr inbounds i8, ptr %4, i64 8
  br label %60

.preheader140:                                    ; preds = %.loopexit141, %51
  %55 = load i32, ptr @N, align 4, !tbaa !5
  %56 = icmp sgt i32 %55, 0
  %.pre217 = load i32, ptr @M, align 4, !tbaa !5
  br i1 %56, label %.preheader139.lr.ph, label %._crit_edge165

.preheader139.lr.ph:                              ; preds = %.preheader140
  %57 = getelementptr inbounds i8, ptr %5, i64 4
  %58 = getelementptr inbounds i8, ptr %5, i64 8
  %59 = icmp sgt i32 %.pre217, 0
  br i1 %59, label %.preheader139, label %._crit_edge165

60:                                               ; preds = %.lr.ph160, %.loopexit141
  %61 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt5queueI1sSt5dequeIS0_SaIS0_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %1)
  %.sroa.070.0.copyload = load i32, ptr %61, align 4, !tbaa !5
  %.sroa.571.0..sroa_idx = getelementptr inbounds i8, ptr %61, i64 4
  %.sroa.571.0.copyload = load i32, ptr %.sroa.571.0..sroa_idx, align 4, !tbaa !5
  %.sroa.672.0..sroa_idx = getelementptr inbounds i8, ptr %61, i64 8
  %.sroa.672.0.copyload = load i32, ptr %.sroa.672.0..sroa_idx, align 4, !tbaa !5
  call void @_ZNSt5queueI1sSt5dequeIS0_SaIS0_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %1)
  %62 = icmp sgt i32 %.sroa.070.0.copyload, -1
  %63 = icmp sgt i32 %.sroa.571.0.copyload, -1
  %or.cond.not134 = select i1 %62, i1 %63, i1 false
  %64 = load i32, ptr @N, align 4
  %.not121 = icmp slt i32 %.sroa.070.0.copyload, %64
  %or.cond126 = select i1 %or.cond.not134, i1 %.not121, i1 false
  %65 = load i32, ptr @M, align 4
  %.not122 = icmp slt i32 %.sroa.571.0.copyload, %65
  %or.cond127 = select i1 %or.cond126, i1 %.not122, i1 false
  br i1 %or.cond127, label %66, label %.loopexit141, !llvm.loop !19

66:                                               ; preds = %60
  %67 = zext nneg i32 %.sroa.070.0.copyload to i64
  %68 = getelementptr inbounds [1000 x %"class.std::__cxx11::basic_string"], ptr @_Z1gB5cxx11, i64 0, i64 %67
  %69 = zext nneg i32 %.sroa.571.0.copyload to i64
  %70 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %68, i64 noundef %69)
  %71 = load i8, ptr %70, align 1, !tbaa !13
  %72 = icmp eq i8 %71, 35
  br i1 %72, label %.loopexit141, label %73, !llvm.loop !19

73:                                               ; preds = %66
  %74 = getelementptr inbounds [1000 x [1000 x i32]], ptr @md, i64 0, i64 %67, i64 %69
  %75 = load i32, ptr %74, align 4, !tbaa !5
  %.not123 = icmp eq i32 %75, -1
  br i1 %.not123, label %80, label %.loopexit141, !llvm.loop !19

76:                                               ; preds = %._crit_edge157
  %77 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  br label %261

78:                                               ; preds = %258, %._crit_edge171
  %79 = landingpad { ptr, i32 }
          cleanup
  br label %261

80:                                               ; preds = %73
  store i32 %.sroa.672.0.copyload, ptr %74, align 4, !tbaa !5
  %81 = add i32 %.sroa.672.0.copyload, 1
  %82 = load i32, ptr @dx, align 16, !tbaa !5
  %83 = add nsw i32 %82, %.sroa.070.0.copyload
  %84 = load i32, ptr @dy, align 16, !tbaa !5
  %85 = add nsw i32 %84, %.sroa.571.0.copyload
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %4) #7
  store i32 %83, ptr %4, align 4, !tbaa !14
  store i32 %85, ptr %53, align 4, !tbaa !16
  store i32 %81, ptr %54, align 4, !tbaa !17
  invoke void @_ZNSt5queueI1sSt5dequeIS0_SaIS0_EEE4pushEOS0_(ptr noundef nonnull align 8 dereferenceable(80) %1, ptr noundef nonnull align 4 dereferenceable(12) %4)
          to label %86 unwind label %101

86:                                               ; preds = %80
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %4) #7
  %87 = load i32, ptr getelementptr inbounds (i8, ptr @dx, i64 4), align 4, !tbaa !5
  %88 = add nsw i32 %87, %.sroa.070.0.copyload
  %89 = load i32, ptr getelementptr inbounds (i8, ptr @dy, i64 4), align 4, !tbaa !5
  %90 = add nsw i32 %89, %.sroa.571.0.copyload
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %4) #7
  store i32 %88, ptr %4, align 4, !tbaa !14
  store i32 %90, ptr %53, align 4, !tbaa !16
  store i32 %81, ptr %54, align 4, !tbaa !17
  invoke void @_ZNSt5queueI1sSt5dequeIS0_SaIS0_EEE4pushEOS0_(ptr noundef nonnull align 8 dereferenceable(80) %1, ptr noundef nonnull align 4 dereferenceable(12) %4)
          to label %91 unwind label %101

91:                                               ; preds = %86
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %4) #7
  %92 = load i32, ptr getelementptr inbounds (i8, ptr @dx, i64 8), align 8, !tbaa !5
  %93 = add nsw i32 %92, %.sroa.070.0.copyload
  %94 = load i32, ptr getelementptr inbounds (i8, ptr @dy, i64 8), align 8, !tbaa !5
  %95 = add nsw i32 %94, %.sroa.571.0.copyload
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %4) #7
  store i32 %93, ptr %4, align 4, !tbaa !14
  store i32 %95, ptr %53, align 4, !tbaa !16
  store i32 %81, ptr %54, align 4, !tbaa !17
  invoke void @_ZNSt5queueI1sSt5dequeIS0_SaIS0_EEE4pushEOS0_(ptr noundef nonnull align 8 dereferenceable(80) %1, ptr noundef nonnull align 4 dereferenceable(12) %4)
          to label %96 unwind label %101

96:                                               ; preds = %91
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %4) #7
  %97 = load i32, ptr getelementptr inbounds (i8, ptr @dx, i64 12), align 4, !tbaa !5
  %98 = add nsw i32 %97, %.sroa.070.0.copyload
  %99 = load i32, ptr getelementptr inbounds (i8, ptr @dy, i64 12), align 4, !tbaa !5
  %100 = add nsw i32 %99, %.sroa.571.0.copyload
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %4) #7
  store i32 %98, ptr %4, align 4, !tbaa !14
  store i32 %100, ptr %53, align 4, !tbaa !16
  store i32 %81, ptr %54, align 4, !tbaa !17
  invoke void @_ZNSt5queueI1sSt5dequeIS0_SaIS0_EEE4pushEOS0_(ptr noundef nonnull align 8 dereferenceable(80) %1, ptr noundef nonnull align 4 dereferenceable(12) %4)
          to label %.loopexit141.loopexit unwind label %101

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

101:                                              ; preds = %96, %91, %86, %80
  %102 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %4) #7
  br label %261

.loopexit141:                                     ; preds = %.loopexit141.loopexit, %60, %66, %73
  %103 = call noundef zeroext i1 @_ZNKSt5queueI1sSt5dequeIS0_SaIS0_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %1)
  br i1 %103, label %.preheader140, label %60

.preheader139:                                    ; preds = %.preheader139.lr.ph, %._crit_edge163
  %104 = phi i32 [ %115, %._crit_edge163 ], [ %55, %.preheader139.lr.ph ]
  %105 = phi i32 [ %116, %._crit_edge163 ], [ %.pre217, %.preheader139.lr.ph ]
  %indvars.iv206 = phi i64 [ %indvars.iv.next207, %._crit_edge163 ], [ 0, %.preheader139.lr.ph ]
  %106 = icmp sgt i32 %105, 0
  br i1 %106, label %.lr.ph162, label %._crit_edge163

.lr.ph162:                                        ; preds = %.preheader139
  %107 = getelementptr inbounds [1000 x %"class.std::__cxx11::basic_string"], ptr @_Z1gB5cxx11, i64 0, i64 %indvars.iv206
  %108 = trunc nuw nsw i64 %indvars.iv206 to i32
  br label %119

._crit_edge165:                                   ; preds = %._crit_edge163, %.preheader139.lr.ph, %.preheader140
  %109 = phi i32 [ %.pre217, %.preheader140 ], [ %.pre217, %.preheader139.lr.ph ], [ %116, %._crit_edge163 ]
  %.lcssa148 = phi i32 [ %55, %.preheader140 ], [ %55, %.preheader139.lr.ph ], [ %115, %._crit_edge163 ]
  %110 = add nsw i32 %.lcssa148, -1
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [1000 x [1000 x i32]], ptr @di, i64 0, i64 %111
  %113 = sext i32 %109 to i64
  %114 = getelementptr inbounds i32, ptr %112, i64 %113
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #7
  store i32 -1, ptr %6, align 4, !tbaa !5
  invoke void @_ZSt4fillIPjiEvT_S1_RKT0_(ptr noundef nonnull @di, ptr noundef nonnull %114, ptr noundef nonnull align 4 dereferenceable(4) %6)
          to label %132 unwind label %150

._crit_edge163.loopexit:                          ; preds = %128
  %.pre216 = load i32, ptr @N, align 4, !tbaa !5
  br label %._crit_edge163

._crit_edge163:                                   ; preds = %._crit_edge163.loopexit, %.preheader139
  %115 = phi i32 [ %.pre216, %._crit_edge163.loopexit ], [ %104, %.preheader139 ]
  %116 = phi i32 [ %129, %._crit_edge163.loopexit ], [ %105, %.preheader139 ]
  %indvars.iv.next207 = add nuw nsw i64 %indvars.iv206, 1
  %117 = sext i32 %115 to i64
  %118 = icmp slt i64 %indvars.iv.next207, %117
  br i1 %118, label %.preheader139, label %._crit_edge165, !llvm.loop !20

119:                                              ; preds = %.lr.ph162, %128
  %indvars.iv203 = phi i64 [ 0, %.lr.ph162 ], [ %indvars.iv.next204, %128 ]
  %120 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %107, i64 noundef %indvars.iv203)
  %121 = load i8, ptr %120, align 1, !tbaa !13
  %122 = icmp eq i8 %121, 65
  br i1 %122, label %123, label %128

123:                                              ; preds = %119
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %5) #7
  store i32 %108, ptr %5, align 4, !tbaa !14
  %124 = trunc nuw nsw i64 %indvars.iv203 to i32
  store i32 %124, ptr %57, align 4, !tbaa !16
  store i32 0, ptr %58, align 4, !tbaa !17
  invoke void @_ZNSt5queueI1sSt5dequeIS0_SaIS0_EEE4pushEOS0_(ptr noundef nonnull align 8 dereferenceable(80) %1, ptr noundef nonnull align 4 dereferenceable(12) %5)
          to label %125 unwind label %126

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

126:                                              ; preds = %123
  %127 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %5) #7
  br label %261

128:                                              ; preds = %119, %125
  %indvars.iv.next204 = add nuw nsw i64 %indvars.iv203, 1
  %129 = load i32, ptr @M, align 4, !tbaa !5
  %130 = sext i32 %129 to i64
  %131 = icmp slt i64 %indvars.iv.next204, %130
  br i1 %131, label %119, label %._crit_edge163.loopexit, !llvm.loop !21

132:                                              ; preds = %._crit_edge165
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #7
  %133 = call noundef zeroext i1 @_ZNKSt5queueI1sSt5dequeIS0_SaIS0_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %1)
  br i1 %133, label %._crit_edge171, label %.lr.ph170

.lr.ph170:                                        ; preds = %132
  %134 = getelementptr inbounds i8, ptr %8, i64 4
  %135 = getelementptr inbounds i8, ptr %8, i64 8
  br label %136

136:                                              ; preds = %.lr.ph170, %.loopexit138
  %137 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt5queueI1sSt5dequeIS0_SaIS0_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %1)
  %.sroa.0.0.copyload = load i32, ptr %137, align 4, !tbaa !5
  %.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %137, i64 4
  %.sroa.5.0.copyload = load i32, ptr %.sroa.5.0..sroa_idx, align 4, !tbaa !5
  %.sroa.6.0..sroa_idx = getelementptr inbounds i8, ptr %137, i64 8
  %.sroa.6.0.copyload = load i32, ptr %.sroa.6.0..sroa_idx, align 4, !tbaa !5
  call void @_ZNSt5queueI1sSt5dequeIS0_SaIS0_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %1)
  %138 = sext i32 %.sroa.0.0.copyload to i64
  %139 = getelementptr inbounds [1000 x %"class.std::__cxx11::basic_string"], ptr @_Z1gB5cxx11, i64 0, i64 %138
  %140 = sext i32 %.sroa.5.0.copyload to i64
  %141 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %139, i64 noundef %140)
  %142 = load i8, ptr %141, align 1, !tbaa !13
  %143 = icmp eq i8 %142, 35
  br i1 %143, label %.loopexit138, label %144, !llvm.loop !22

144:                                              ; preds = %136
  %145 = getelementptr inbounds [1000 x [1000 x i32]], ptr @di, i64 0, i64 %138, i64 %140
  %146 = load i32, ptr %145, align 4, !tbaa !5
  %.not = icmp eq i32 %146, -1
  br i1 %.not, label %147, label %.loopexit138, !llvm.loop !22

147:                                              ; preds = %144
  %148 = getelementptr inbounds [1000 x [1000 x i32]], ptr @md, i64 0, i64 %138, i64 %140
  %149 = load i32, ptr %148, align 4, !tbaa !5
  %.not115 = icmp ult i32 %.sroa.6.0.copyload, %149
  br i1 %.not115, label %154, label %.loopexit138, !llvm.loop !22

150:                                              ; preds = %._crit_edge165
  %151 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #7
  br label %261

152:                                              ; preds = %176, %174, %172, %170
  %153 = landingpad { ptr, i32 }
          cleanup
  br label %261

154:                                              ; preds = %147
  store i32 %.sroa.6.0.copyload, ptr %145, align 4, !tbaa !5
  %155 = icmp eq i32 %.sroa.0.0.copyload, 0
  %156 = icmp eq i32 %.sroa.5.0.copyload, 0
  %or.cond3 = select i1 %155, i1 true, i1 %156
  br i1 %or.cond3, label %170, label %157

157:                                              ; preds = %154
  %158 = load i32, ptr @N, align 4, !tbaa !5
  %159 = add nsw i32 %158, -1
  %160 = icmp eq i32 %.sroa.0.0.copyload, %159
  br i1 %160, label %170, label %161

161:                                              ; preds = %157
  %162 = load i32, ptr @M, align 4, !tbaa !5
  %163 = add nsw i32 %162, -1
  %164 = icmp eq i32 %.sroa.5.0.copyload, %163
  br i1 %164, label %170, label %.preheader137

.preheader137:                                    ; preds = %161
  %165 = add nuw i32 %.sroa.6.0.copyload, 1
  %166 = load i32, ptr @dx, align 16, !tbaa !5
  %167 = add nsw i32 %166, %.sroa.0.0.copyload
  %168 = load i32, ptr @dy, align 16, !tbaa !5
  %169 = add nsw i32 %168, %.sroa.5.0.copyload
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %8) #7
  store i32 %167, ptr %8, align 4, !tbaa !14
  store i32 %169, ptr %134, align 4, !tbaa !16
  store i32 %165, ptr %135, align 4, !tbaa !17
  invoke void @_ZNSt5queueI1sSt5dequeIS0_SaIS0_EEE4pushEOS0_(ptr noundef nonnull align 8 dereferenceable(80) %1, ptr noundef nonnull align 4 dereferenceable(12) %8)
          to label %239 unwind label %254

170:                                              ; preds = %161, %157, %154
  %171 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.3)
          to label %172 unwind label %152

172:                                              ; preds = %170
  %173 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %171, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %174 unwind label %152

174:                                              ; preds = %172
  %175 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEj(ptr noundef nonnull align 8 dereferenceable(8) %173, i32 noundef %.sroa.6.0.copyload)
          to label %176 unwind label %152

176:                                              ; preds = %174
  %177 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %175, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %178 unwind label %152

178:                                              ; preds = %176
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %7) #7
  invoke void @_ZNSt5stackIcSt5dequeIcSaIcEEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
          to label %.preheader136 unwind label %222

.preheader136:                                    ; preds = %178
  %179 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %139, i64 noundef %140)
  %180 = load i8, ptr %179, align 1, !tbaa !13
  %.not116173 = icmp eq i8 %180, 65
  br i1 %.not116173, label %.preheader, label %.preheader135

.preheader135:                                    ; preds = %.preheader136, %.thread
  %.095175 = phi i32 [ %.3, %.thread ], [ %.sroa.5.0.copyload, %.preheader136 ]
  %.098174 = phi i32 [ %.3101, %.thread ], [ %.sroa.0.0.copyload, %.preheader136 ]
  %181 = sext i32 %.098174 to i64
  %182 = sext i32 %.095175 to i64
  %183 = getelementptr inbounds [1000 x [1000 x i32]], ptr @di, i64 0, i64 %181, i64 %182
  %184 = load i32, ptr %183, align 4, !tbaa !5
  %185 = add i32 %184, -1
  %186 = load i32, ptr @dx, align 16, !tbaa !5
  %187 = add nsw i32 %186, %.098174
  %188 = load i32, ptr @dy, align 16, !tbaa !5
  %189 = add nsw i32 %188, %.095175
  %190 = sext i32 %187 to i64
  %191 = sext i32 %189 to i64
  %192 = getelementptr inbounds [1000 x [1000 x i32]], ptr @di, i64 0, i64 %190, i64 %191
  %193 = load i32, ptr %192, align 4, !tbaa !5
  %.not120 = icmp eq i32 %193, %185
  br i1 %.not120, label %224, label %195

.preheader:                                       ; preds = %.thread, %.preheader136
  %194 = call noundef zeroext i1 @_ZNKSt5stackIcSt5dequeIcSaIcEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
  br i1 %194, label %._crit_edge177, label %.lr.ph176

195:                                              ; preds = %.preheader135
  %196 = load i32, ptr getelementptr inbounds (i8, ptr @dx, i64 4), align 4, !tbaa !5
  %197 = add nsw i32 %196, %.098174
  %198 = load i32, ptr getelementptr inbounds (i8, ptr @dy, i64 4), align 4, !tbaa !5
  %199 = add nsw i32 %198, %.095175
  %200 = sext i32 %197 to i64
  %201 = sext i32 %199 to i64
  %202 = getelementptr inbounds [1000 x [1000 x i32]], ptr @di, i64 0, i64 %200, i64 %201
  %203 = load i32, ptr %202, align 4, !tbaa !5
  %.not120.1 = icmp eq i32 %203, %185
  br i1 %.not120.1, label %224, label %204

204:                                              ; preds = %195
  %205 = load i32, ptr getelementptr inbounds (i8, ptr @dx, i64 8), align 8, !tbaa !5
  %206 = add nsw i32 %205, %.098174
  %207 = load i32, ptr getelementptr inbounds (i8, ptr @dy, i64 8), align 8, !tbaa !5
  %208 = add nsw i32 %207, %.095175
  %209 = sext i32 %206 to i64
  %210 = sext i32 %208 to i64
  %211 = getelementptr inbounds [1000 x [1000 x i32]], ptr @di, i64 0, i64 %209, i64 %210
  %212 = load i32, ptr %211, align 4, !tbaa !5
  %.not120.2 = icmp eq i32 %212, %185
  br i1 %.not120.2, label %224, label %213

213:                                              ; preds = %204
  %214 = load i32, ptr getelementptr inbounds (i8, ptr @dx, i64 12), align 4, !tbaa !5
  %215 = add nsw i32 %214, %.098174
  %216 = load i32, ptr getelementptr inbounds (i8, ptr @dy, i64 12), align 4, !tbaa !5
  %217 = add nsw i32 %216, %.095175
  %218 = sext i32 %215 to i64
  %219 = sext i32 %217 to i64
  %220 = getelementptr inbounds [1000 x [1000 x i32]], ptr @di, i64 0, i64 %218, i64 %219
  %221 = load i32, ptr %220, align 4, !tbaa !5
  %.not120.3 = icmp eq i32 %221, %185
  br i1 %.not120.3, label %224, label %.thread

222:                                              ; preds = %178
  %223 = landingpad { ptr, i32 }
          cleanup
  br label %238

.loopexit:                                        ; preds = %.lr.ph176
  %lpad.loopexit = landingpad { ptr, i32 }
          cleanup
  br label %237

.loopexit.split-lp:                               ; preds = %._crit_edge177
  %lpad.loopexit.split-lp = landingpad { ptr, i32 }
          cleanup
  br label %237

224:                                              ; preds = %213, %204, %195, %.preheader135
  %.lcssa183 = phi i64 [ 0, %.preheader135 ], [ 1, %195 ], [ 2, %204 ], [ 3, %213 ]
  %.lcssa181 = phi i32 [ %187, %.preheader135 ], [ %197, %195 ], [ %206, %204 ], [ %215, %213 ]
  %.lcssa = phi i32 [ %189, %.preheader135 ], [ %199, %195 ], [ %208, %204 ], [ %217, %213 ]
  %225 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z3revB5cxx11, i64 noundef %.lcssa183)
  invoke void @_ZNSt5stackIcSt5dequeIcSaIcEEE4pushERKc(ptr noundef nonnull align 8 dereferenceable(80) %7, ptr noundef nonnull align 1 dereferenceable(1) %225)
          to label %..thread_crit_edge unwind label %226

..thread_crit_edge:                               ; preds = %224
  %.pre218 = sext i32 %.lcssa181 to i64
  %.pre219 = sext i32 %.lcssa to i64
  br label %.thread

226:                                              ; preds = %224
  %227 = landingpad { ptr, i32 }
          cleanup
  br label %237

.thread:                                          ; preds = %213, %..thread_crit_edge
  %.pre-phi220 = phi i64 [ %.pre219, %..thread_crit_edge ], [ %182, %213 ]
  %.pre-phi = phi i64 [ %.pre218, %..thread_crit_edge ], [ %181, %213 ]
  %.3101 = phi i32 [ %.lcssa181, %..thread_crit_edge ], [ %.098174, %213 ]
  %.3 = phi i32 [ %.lcssa, %..thread_crit_edge ], [ %.095175, %213 ]
  %228 = getelementptr inbounds [1000 x %"class.std::__cxx11::basic_string"], ptr @_Z1gB5cxx11, i64 0, i64 %.pre-phi
  %229 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %228, i64 noundef %.pre-phi220)
  %230 = load i8, ptr %229, align 1, !tbaa !13
  %.not116 = icmp eq i8 %230, 65
  br i1 %.not116, label %.preheader, label %.preheader135, !llvm.loop !23

.lr.ph176:                                        ; preds = %.preheader, %234
  %231 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt5stackIcSt5dequeIcSaIcEEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
  %232 = load i8, ptr %231, align 1, !tbaa !13
  %233 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i8 noundef signext %232)
          to label %234 unwind label %.loopexit

234:                                              ; preds = %.lr.ph176
  call void @_ZNSt5stackIcSt5dequeIcSaIcEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
  %235 = call noundef zeroext i1 @_ZNKSt5stackIcSt5dequeIcSaIcEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
  br i1 %235, label %._crit_edge177, label %.lr.ph176, !llvm.loop !24

._crit_edge177:                                   ; preds = %234, %.preheader
  %236 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %.thread130 unwind label %.loopexit.split-lp

.thread130:                                       ; preds = %._crit_edge177
  call void @_ZNSt5stackIcSt5dequeIcSaIcEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %7) #7
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %7) #7
  br label %260

237:                                              ; preds = %.loopexit, %.loopexit.split-lp, %226
  %.pn = phi { ptr, i32 } [ %227, %226 ], [ %lpad.loopexit, %.loopexit ], [ %lpad.loopexit.split-lp, %.loopexit.split-lp ]
  call void @_ZNSt5stackIcSt5dequeIcSaIcEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %7) #7
  br label %238

238:                                              ; preds = %237, %222
  %.pn.pn = phi { ptr, i32 } [ %.pn, %237 ], [ %223, %222 ]
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %7) #7
  br label %261

239:                                              ; preds = %.preheader137
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %8) #7
  %240 = load i32, ptr getelementptr inbounds (i8, ptr @dx, i64 4), align 4, !tbaa !5
  %241 = add nsw i32 %240, %.sroa.0.0.copyload
  %242 = load i32, ptr getelementptr inbounds (i8, ptr @dy, i64 4), align 4, !tbaa !5
  %243 = add nsw i32 %242, %.sroa.5.0.copyload
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %8) #7
  store i32 %241, ptr %8, align 4, !tbaa !14
  store i32 %243, ptr %134, align 4, !tbaa !16
  store i32 %165, ptr %135, align 4, !tbaa !17
  invoke void @_ZNSt5queueI1sSt5dequeIS0_SaIS0_EEE4pushEOS0_(ptr noundef nonnull align 8 dereferenceable(80) %1, ptr noundef nonnull align 4 dereferenceable(12) %8)
          to label %244 unwind label %254

244:                                              ; preds = %239
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %8) #7
  %245 = load i32, ptr getelementptr inbounds (i8, ptr @dx, i64 8), align 8, !tbaa !5
  %246 = add nsw i32 %245, %.sroa.0.0.copyload
  %247 = load i32, ptr getelementptr inbounds (i8, ptr @dy, i64 8), align 8, !tbaa !5
  %248 = add nsw i32 %247, %.sroa.5.0.copyload
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %8) #7
  store i32 %246, ptr %8, align 4, !tbaa !14
  store i32 %248, ptr %134, align 4, !tbaa !16
  store i32 %165, ptr %135, align 4, !tbaa !17
  invoke void @_ZNSt5queueI1sSt5dequeIS0_SaIS0_EEE4pushEOS0_(ptr noundef nonnull align 8 dereferenceable(80) %1, ptr noundef nonnull align 4 dereferenceable(12) %8)
          to label %249 unwind label %254

249:                                              ; preds = %244
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %8) #7
  %250 = load i32, ptr getelementptr inbounds (i8, ptr @dx, i64 12), align 4, !tbaa !5
  %251 = add nsw i32 %250, %.sroa.0.0.copyload
  %252 = load i32, ptr getelementptr inbounds (i8, ptr @dy, i64 12), align 4, !tbaa !5
  %253 = add nsw i32 %252, %.sroa.5.0.copyload
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %8) #7
  store i32 %251, ptr %8, align 4, !tbaa !14
  store i32 %253, ptr %134, align 4, !tbaa !16
  store i32 %165, ptr %135, align 4, !tbaa !17
  invoke void @_ZNSt5queueI1sSt5dequeIS0_SaIS0_EEE4pushEOS0_(ptr noundef nonnull align 8 dereferenceable(80) %1, ptr noundef nonnull align 4 dereferenceable(12) %8)
          to label %.loopexit138.loopexit unwind label %254

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

254:                                              ; preds = %249, %244, %239, %.preheader137
  %255 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %8) #7
  br label %261

.loopexit138:                                     ; preds = %.loopexit138.loopexit, %136, %144, %147
  %256 = call noundef zeroext i1 @_ZNKSt5queueI1sSt5dequeIS0_SaIS0_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %1)
  br i1 %256, label %._crit_edge171, label %136

._crit_edge171:                                   ; preds = %.loopexit138, %132
  %257 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.4)
          to label %258 unwind label %78

258:                                              ; preds = %._crit_edge171
  %259 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %257, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %260 unwind label %78

260:                                              ; preds = %.thread130, %258
  call void @_ZNSt5queueI1sSt5dequeIS0_SaIS0_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %1) #7
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %1) #7
  ret i32 0

261:                                              ; preds = %152, %238, %254, %150, %126, %101, %78, %76, %45
  %.pn124 = phi { ptr, i32 } [ %46, %45 ], [ %102, %101 ], [ %127, %126 ], [ %79, %78 ], [ %151, %150 ], [ %77, %76 ], [ %.pn.pn, %238 ], [ %153, %152 ], [ %255, %254 ]
  call void @_ZNSt5queueI1sSt5dequeIS0_SaIS0_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %1) #7
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %1) #7
  resume { ptr, i32 } %.pn124
}

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) local_unnamed_addr #4 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 #3 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt5queueI1sSt5dequeIS0_SaIS0_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #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)) local_unnamed_addr #4 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #5

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #5

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEj(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5stackIcSt5dequeIcSaIcEEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #3 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 #3 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) local_unnamed_addr #5

; 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 #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt5stackIcSt5dequeIcSaIcEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #4 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 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 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12}
!12 = !{!"llvm.loop.unswitch.partial.disable"}
!13 = !{!7, !7, i64 0}
!14 = !{!15, !6, i64 0}
!15 = !{!"_ZTS1s", !6, i64 0, !6, i64 4, !6, i64 8}
!16 = !{!15, !6, i64 4}
!17 = !{!15, !6, i64 8}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10, !12}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !10}
!24 = distinct !{!24, !10}


; 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