; LLVM IR from bqi343/cp-notebook :: Contests/USACO Solutions/2016-17/Jan 2017/Gold (17 Jan G3)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::queue" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<std::pair<int, std::pair<int, int>>, std::allocator<std::pair<int, std::pair<int, int>>>>::_Deque_impl" }
%"struct.std::_Deque_base<std::pair<int, std::pair<int, int>>, std::allocator<std::pair<int, std::pair<int, int>>>>::_Deque_impl" = type { %"struct.std::_Deque_base<std::pair<int, std::pair<int, int>>, std::allocator<std::pair<int, std::pair<int, int>>>>::_Deque_impl_data" }
%"struct.std::_Deque_base<std::pair<int, std::pair<int, int>>, std::allocator<std::pair<int, std::pair<int, int>>>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }
%"class.std::basic_ifstream" = type { %"class.std::basic_istream.base", %"class.std::basic_filebuf", %"class.std::basic_ios" }
%"class.std::basic_istream.base" = type { ptr, i64 }
%"class.std::basic_filebuf" = type { %"class.std::basic_streambuf", %union.pthread_mutex_t, %"class.std::__basic_file", i32, %struct.__mbstate_t, %struct.__mbstate_t, %struct.__mbstate_t, ptr, i64, i8, i8, i8, i8, ptr, ptr, i8, ptr, ptr, i64, ptr, ptr }
%"class.std::basic_streambuf" = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, %"class.std::locale" }
%"class.std::locale" = type { ptr }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%"class.std::__basic_file" = type <{ ptr, i8, [7 x i8] }>
%struct.__mbstate_t = type { i32, %union.anon }
%union.anon = type { i32 }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::basic_ofstream" = type { %"class.std::basic_ostream.base", %"class.std::basic_filebuf", %"class.std::basic_ios" }
%"class.std::basic_ostream.base" = type { ptr }
%"struct.std::pair" = type { i32, %"struct.std::pair.0" }
%"struct.std::pair.0" = type { i32, i32 }

@grid = external dso_local global [20 x [20 x i8]], align 16
@dp = external dso_local global [1600 x [1600 x i32]], align 16
@N = external dso_local global i32, align 4
@xdir = external dso_local global [4 x i32], align 16
@ydir = external dso_local global [4 x i32], align 16
@q = external dso_local global %"class.std::queue", align 8
@.str = external hidden unnamed_addr constant [10 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [11 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z4packSt4pairIiS_IiiEE(i64, i32) #0

; 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) #1

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i32 } @_Z6unpacki(i32 noundef) #2

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z5validii(i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #4 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca %"class.std::basic_ifstream", align 8
  %3 = alloca %"class.std::basic_ofstream", align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca %"struct.std::pair", align 4
  %10 = alloca i32, align 4
  %11 = alloca %"struct.std::pair.0", align 4
  %12 = alloca i32, align 4
  %13 = alloca %"struct.std::pair", align 4
  %14 = alloca i32, align 4
  %15 = alloca %"struct.std::pair.0", align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca { i64, i32 }, align 4
  %19 = alloca i32, align 4
  %20 = alloca %"struct.std::pair", align 4
  %21 = alloca i32, align 4
  %22 = alloca %"struct.std::pair.0", align 4
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  %25 = alloca { i64, i32 }, align 4
  %26 = alloca %"struct.std::pair", align 4
  %27 = alloca %"struct.std::pair", align 4
  %28 = alloca { i64, i32 }, align 8
  %29 = alloca %"struct.std::pair", align 4
  %30 = alloca { i64, i32 }, align 8
  %31 = alloca %"struct.std::pair", align 4
  %32 = alloca %"struct.std::pair", align 4
  %33 = alloca %"struct.std::pair", align 4
  %34 = alloca { i64, i32 }, align 4
  %35 = alloca %"struct.std::pair", align 4
  %36 = alloca { i64, i32 }, align 4
  %37 = alloca %"struct.std::pair", align 4
  %38 = alloca { i64, i32 }, align 4
  %39 = alloca %"struct.std::pair", align 4
  %40 = alloca { i64, i32 }, align 4
  %41 = alloca %"struct.std::pair", align 4
  %42 = alloca i32, align 4
  %43 = alloca %"struct.std::pair.0", align 4
  %44 = alloca i32, align 4
  %45 = alloca %"struct.std::pair", align 4
  %46 = alloca { i64, i32 }, align 4
  %47 = alloca i32, align 4
  %48 = alloca %"struct.std::pair", align 4
  %49 = alloca { i64, i32 }, align 4
  %50 = alloca %"struct.std::pair", align 4
  %51 = alloca { i64, i32 }, align 4
  %52 = alloca %"struct.std::pair", align 4
  %53 = alloca { i64, i32 }, align 4
  %54 = alloca %"struct.std::pair", align 4
  %55 = alloca { i64, i32 }, align 4
  %56 = alloca %"struct.std::pair", align 4
  %57 = alloca { i64, i32 }, align 4
  %58 = alloca %"struct.std::pair", align 4
  %59 = alloca i32, align 4
  %60 = alloca %"struct.std::pair.0", align 4
  %61 = alloca i32, align 4
  %62 = alloca %"struct.std::pair", align 4
  %63 = alloca { i64, i32 }, align 4
  %64 = alloca i32, align 4
  %65 = alloca %"struct.std::pair", align 4
  %66 = alloca { i64, i32 }, align 4
  %67 = alloca %"struct.std::pair.0", align 4
  %68 = alloca i32, align 4
  %69 = alloca i32, align 4
  %70 = alloca %"struct.std::pair.0", align 4
  %71 = alloca i32, align 4
  %72 = alloca i32, align 4
  %73 = alloca %"struct.std::pair.0", align 4
  %74 = alloca i32, align 4
  %75 = alloca i32, align 4
  %76 = alloca %"struct.std::pair.0", align 4
  %77 = alloca i32, align 4
  %78 = alloca i32, align 4
  %79 = alloca %"struct.std::pair", align 4
  %80 = alloca { i64, i32 }, align 4
  %81 = alloca %"struct.std::pair", align 4
  %82 = alloca { i64, i32 }, align 4
  %83 = alloca %"struct.std::pair", align 4
  %84 = alloca { i64, i32 }, align 4
  %85 = alloca %"struct.std::pair", align 4
  %86 = alloca { i64, i32 }, align 4
  %87 = alloca %"struct.std::pair", align 4
  %88 = alloca i32, align 4
  %89 = alloca %"struct.std::pair.0", align 4
  %90 = alloca i32, align 4
  %91 = alloca %"struct.std::pair", align 4
  %92 = alloca { i64, i32 }, align 4
  %93 = alloca i32, align 4
  %94 = alloca %"struct.std::pair", align 4
  %95 = alloca { i64, i32 }, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 520, ptr %2) #7
  call void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(256) %2, ptr noundef @.str, i32 noundef 8)
  call void @llvm.lifetime.start.p0(i64 512, ptr %3) #7
  invoke void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(248) %3, ptr noundef @.str.1, i32 noundef 16)
          to label %96 unwind label %105

96:                                               ; preds = %0
  %97 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 4 dereferenceable(4) @N)
          to label %98 unwind label %109

98:                                               ; preds = %96
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  %99 = load i32, ptr @N, align 4, !tbaa !5
  %100 = sub nsw i32 %99, 1
  store i32 %100, ptr %6, align 4, !tbaa !5
  br label %101

101:                                              ; preds = %136, %98
  %102 = load i32, ptr %6, align 4, !tbaa !5
  %103 = icmp sge i32 %102, 0
  br i1 %103, label %113, label %104

104:                                              ; preds = %101
  store i32 2, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  br label %139

105:                                              ; preds = %0
  %106 = landingpad { ptr, i32 }
          cleanup
  %107 = extractvalue { ptr, i32 } %106, 0
  store ptr %107, ptr %4, align 8
  %108 = extractvalue { ptr, i32 } %106, 1
  store i32 %108, ptr %5, align 4
  br label %556

109:                                              ; preds = %96
  %110 = landingpad { ptr, i32 }
          cleanup
  %111 = extractvalue { ptr, i32 } %110, 0
  store ptr %111, ptr %4, align 8
  %112 = extractvalue { ptr, i32 } %110, 1
  store i32 %112, ptr %5, align 4
  br label %555

113:                                              ; preds = %101
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %114

114:                                              ; preds = %128, %113
  %115 = load i32, ptr %8, align 4, !tbaa !5
  %116 = load i32, ptr @N, align 4, !tbaa !5
  %117 = icmp slt i32 %115, %116
  br i1 %117, label %119, label %118

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

119:                                              ; preds = %114
  %120 = load i32, ptr %8, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [20 x [20 x i8]], ptr @grid, i64 0, i64 %121
  %123 = load i32, ptr %6, align 4, !tbaa !5
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [20 x i8], ptr %122, i64 0, i64 %124
  %126 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 1 dereferenceable(1) %125)
          to label %127 unwind label %131

127:                                              ; preds = %119
  br label %128

128:                                              ; preds = %127
  %129 = load i32, ptr %8, align 4, !tbaa !5
  %130 = add nsw i32 %129, 1
  store i32 %130, ptr %8, align 4, !tbaa !5
  br label %114, !llvm.loop !9

131:                                              ; preds = %119
  %132 = landingpad { ptr, i32 }
          cleanup
  %133 = extractvalue { ptr, i32 } %132, 0
  store ptr %133, ptr %4, align 8
  %134 = extractvalue { ptr, i32 } %132, 1
  store i32 %134, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  br label %555

135:                                              ; preds = %118
  br label %136

136:                                              ; preds = %135
  %137 = load i32, ptr %6, align 4, !tbaa !5
  %138 = add nsw i32 %137, -1
  store i32 %138, ptr %6, align 4, !tbaa !5
  br label %101, !llvm.loop !11

139:                                              ; preds = %104
  call void @llvm.lifetime.start.p0(i64 12, ptr %9) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  store i32 0, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  store i32 0, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  store i32 0, ptr %16, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  store i32 0, ptr %17, align 4, !tbaa !5
  invoke void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 4 dereferenceable(8) %15, ptr noundef nonnull align 4 dereferenceable(4) %16, ptr noundef nonnull align 4 dereferenceable(4) %17)
          to label %140 unwind label %218

140:                                              ; preds = %139
  invoke void @_ZNSt4pairIiS_IiiEEC2IiS0_TnNSt9enable_ifIXaaclsr5_PCCPE18_ConstructiblePairIT_T0_EEclsr5_PCCPE26_ImplicitlyConvertiblePairIS4_S5_EEEbE4typeELb1EEERKiRKS0_(ptr noundef nonnull align 4 dereferenceable(12) %13, ptr noundef nonnull align 4 dereferenceable(4) %14, ptr noundef nonnull align 4 dereferenceable(8) %15)
          to label %141 unwind label %218

141:                                              ; preds = %140
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %18, ptr align 4 %13, i64 12, i1 false)
  %142 = getelementptr inbounds { i64, i32 }, ptr %18, i32 0, i32 0
  %143 = load i64, ptr %142, align 4
  %144 = getelementptr inbounds { i64, i32 }, ptr %18, i32 0, i32 1
  %145 = load i32, ptr %144, align 4
  %146 = call noundef i32 @_Z4packSt4pairIiS_IiiEE(i64 %143, i32 %145)
  store i32 %146, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #7
  store i32 1, ptr %21, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #7
  store i32 0, ptr %23, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #7
  store i32 0, ptr %24, align 4, !tbaa !5
  invoke void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 4 dereferenceable(8) %22, ptr noundef nonnull align 4 dereferenceable(4) %23, ptr noundef nonnull align 4 dereferenceable(4) %24)
          to label %147 unwind label %222

147:                                              ; preds = %141
  invoke void @_ZNSt4pairIiS_IiiEEC2IiS0_TnNSt9enable_ifIXaaclsr5_PCCPE18_ConstructiblePairIT_T0_EEclsr5_PCCPE26_ImplicitlyConvertiblePairIS4_S5_EEEbE4typeELb1EEERKiRKS0_(ptr noundef nonnull align 4 dereferenceable(12) %20, ptr noundef nonnull align 4 dereferenceable(4) %21, ptr noundef nonnull align 4 dereferenceable(8) %22)
          to label %148 unwind label %222

148:                                              ; preds = %147
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %25, ptr align 4 %20, i64 12, i1 false)
  %149 = getelementptr inbounds { i64, i32 }, ptr %25, i32 0, i32 0
  %150 = load i64, ptr %149, align 4
  %151 = getelementptr inbounds { i64, i32 }, ptr %25, i32 0, i32 1
  %152 = load i32, ptr %151, align 4
  %153 = call noundef i32 @_Z4packSt4pairIiS_IiiEE(i64 %150, i32 %152)
  store i32 %153, ptr %19, align 4, !tbaa !5
  invoke void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 4 dereferenceable(8) %11, ptr noundef nonnull align 4 dereferenceable(4) %12, ptr noundef nonnull align 4 dereferenceable(4) %19)
          to label %154 unwind label %222

154:                                              ; preds = %148
  invoke void @_ZNSt4pairIiS_IiiEEC2IiS0_TnNSt9enable_ifIXaaclsr5_PCCPE18_ConstructiblePairIT_T0_EEclsr5_PCCPE26_ImplicitlyConvertiblePairIS4_S5_EEEbE4typeELb1EEERKiRKS0_(ptr noundef nonnull align 4 dereferenceable(12) %9, ptr noundef nonnull align 4 dereferenceable(4) %10, ptr noundef nonnull align 4 dereferenceable(8) %11)
          to label %155 unwind label %222

155:                                              ; preds = %154
  invoke void @_ZNSt5queueISt4pairIiS0_IiiEESt5dequeIS2_SaIS2_EEE4pushEOS2_(ptr noundef nonnull align 8 dereferenceable(80) @q, ptr noundef nonnull align 4 dereferenceable(12) %9)
          to label %156 unwind label %222

156:                                              ; preds = %155
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr %9) #7
  br label %157

157:                                              ; preds = %548, %156
  br label %158

158:                                              ; preds = %157
  call void @llvm.lifetime.start.p0(i64 12, ptr %26) #7
  %159 = invoke noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt5queueISt4pairIiS0_IiiEESt5dequeIS2_SaIS2_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) @q)
          to label %160 unwind label %227

160:                                              ; preds = %158
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %26, ptr align 4 %159, i64 12, i1 false)
  invoke void @_ZNSt5queueISt4pairIiS0_IiiEESt5dequeIS2_SaIS2_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) @q)
          to label %161 unwind label %227

161:                                              ; preds = %160
  %162 = getelementptr inbounds %"struct.std::pair", ptr %26, i32 0, i32 0
  %163 = load i32, ptr %162, align 4, !tbaa !12
  %164 = sub nsw i32 0, %163
  %165 = getelementptr inbounds %"struct.std::pair", ptr %26, i32 0, i32 1
  %166 = getelementptr inbounds %"struct.std::pair.0", ptr %165, i32 0, i32 0
  %167 = load i32, ptr %166, align 4, !tbaa !15
  %168 = sext i32 %167 to i64
  %169 = getelementptr inbounds [1600 x [1600 x i32]], ptr @dp, i64 0, i64 %168
  %170 = getelementptr inbounds %"struct.std::pair", ptr %26, i32 0, i32 1
  %171 = getelementptr inbounds %"struct.std::pair.0", ptr %170, i32 0, i32 1
  %172 = load i32, ptr %171, align 4, !tbaa !16
  %173 = sext i32 %172 to i64
  %174 = getelementptr inbounds [1600 x i32], ptr %169, i64 0, i64 %173
  store i32 %164, ptr %174, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 12, ptr %27) #7
  %175 = getelementptr inbounds %"struct.std::pair", ptr %26, i32 0, i32 1
  %176 = getelementptr inbounds %"struct.std::pair.0", ptr %175, i32 0, i32 0
  %177 = load i32, ptr %176, align 4, !tbaa !15
  %178 = invoke { i64, i32 } @_Z6unpacki(i32 noundef %177)
          to label %179 unwind label %231

179:                                              ; preds = %161
  store { i64, i32 } %178, ptr %28, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %27, ptr align 8 %28, i64 12, i1 false)
  call void @llvm.lifetime.start.p0(i64 12, ptr %29) #7
  %180 = getelementptr inbounds %"struct.std::pair", ptr %26, i32 0, i32 1
  %181 = getelementptr inbounds %"struct.std::pair.0", ptr %180, i32 0, i32 1
  %182 = load i32, ptr %181, align 4, !tbaa !16
  %183 = invoke { i64, i32 } @_Z6unpacki(i32 noundef %182)
          to label %184 unwind label %235

184:                                              ; preds = %179
  store { i64, i32 } %183, ptr %30, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %29, ptr align 8 %30, i64 12, i1 false)
  %185 = getelementptr inbounds %"struct.std::pair", ptr %27, i32 0, i32 1
  %186 = getelementptr inbounds %"struct.std::pair.0", ptr %185, i32 0, i32 0
  %187 = load i32, ptr %186, align 4, !tbaa !15
  %188 = load i32, ptr @N, align 4, !tbaa !5
  %189 = sub nsw i32 %188, 1
  %190 = icmp eq i32 %187, %189
  br i1 %190, label %191, label %239

191:                                              ; preds = %184
  %192 = getelementptr inbounds %"struct.std::pair", ptr %27, i32 0, i32 1
  %193 = getelementptr inbounds %"struct.std::pair.0", ptr %192, i32 0, i32 1
  %194 = load i32, ptr %193, align 4, !tbaa !16
  %195 = load i32, ptr @N, align 4, !tbaa !5
  %196 = sub nsw i32 %195, 1
  %197 = icmp eq i32 %194, %196
  br i1 %197, label %198, label %239

198:                                              ; preds = %191
  %199 = getelementptr inbounds %"struct.std::pair", ptr %29, i32 0, i32 1
  %200 = getelementptr inbounds %"struct.std::pair.0", ptr %199, i32 0, i32 0
  %201 = load i32, ptr %200, align 4, !tbaa !15
  %202 = load i32, ptr @N, align 4, !tbaa !5
  %203 = sub nsw i32 %202, 1
  %204 = icmp eq i32 %201, %203
  br i1 %204, label %205, label %239

205:                                              ; preds = %198
  %206 = getelementptr inbounds %"struct.std::pair", ptr %29, i32 0, i32 1
  %207 = getelementptr inbounds %"struct.std::pair.0", ptr %206, i32 0, i32 1
  %208 = load i32, ptr %207, align 4, !tbaa !16
  %209 = load i32, ptr @N, align 4, !tbaa !5
  %210 = sub nsw i32 %209, 1
  %211 = icmp eq i32 %208, %210
  br i1 %211, label %212, label %239

212:                                              ; preds = %205
  %213 = getelementptr inbounds %"struct.std::pair", ptr %26, i32 0, i32 0
  %214 = load i32, ptr %213, align 4, !tbaa !12
  %215 = sub nsw i32 0, %214
  %216 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %3, i32 noundef %215)
          to label %217 unwind label %235

217:                                              ; preds = %212
  store i32 0, ptr %1, align 4
  store i32 1, ptr %7, align 4
  br label %546

218:                                              ; preds = %140, %139
  %219 = landingpad { ptr, i32 }
          cleanup
  %220 = extractvalue { ptr, i32 } %219, 0
  store ptr %220, ptr %4, align 8
  %221 = extractvalue { ptr, i32 } %219, 1
  store i32 %221, ptr %5, align 4
  br label %226

222:                                              ; preds = %155, %154, %148, %147, %141
  %223 = landingpad { ptr, i32 }
          cleanup
  %224 = extractvalue { ptr, i32 } %223, 0
  store ptr %224, ptr %4, align 8
  %225 = extractvalue { ptr, i32 } %223, 1
  store i32 %225, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  br label %226

226:                                              ; preds = %222, %218
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr %9) #7
  br label %555

227:                                              ; preds = %160, %158
  %228 = landingpad { ptr, i32 }
          cleanup
  %229 = extractvalue { ptr, i32 } %228, 0
  store ptr %229, ptr %4, align 8
  %230 = extractvalue { ptr, i32 } %228, 1
  store i32 %230, ptr %5, align 4
  br label %552

231:                                              ; preds = %161
  %232 = landingpad { ptr, i32 }
          cleanup
  %233 = extractvalue { ptr, i32 } %232, 0
  store ptr %233, ptr %4, align 8
  %234 = extractvalue { ptr, i32 } %232, 1
  store i32 %234, ptr %5, align 4
  br label %551

235:                                              ; preds = %212, %179
  %236 = landingpad { ptr, i32 }
          cleanup
  %237 = extractvalue { ptr, i32 } %236, 0
  store ptr %237, ptr %4, align 8
  %238 = extractvalue { ptr, i32 } %236, 1
  store i32 %238, ptr %5, align 4
  br label %550

239:                                              ; preds = %205, %198, %191, %184
  call void @llvm.lifetime.start.p0(i64 12, ptr %31) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %31, ptr align 4 %27, i64 12, i1 false)
  call void @llvm.lifetime.start.p0(i64 12, ptr %32) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %32, ptr align 4 %29, i64 12, i1 false)
  %240 = getelementptr inbounds %"struct.std::pair", ptr %31, i32 0, i32 0
  %241 = load i32, ptr %240, align 4, !tbaa !12
  %242 = add nsw i32 %241, 1
  %243 = srem i32 %242, 4
  %244 = getelementptr inbounds %"struct.std::pair", ptr %31, i32 0, i32 0
  store i32 %243, ptr %244, align 4, !tbaa !12
  %245 = getelementptr inbounds %"struct.std::pair", ptr %32, i32 0, i32 0
  %246 = load i32, ptr %245, align 4, !tbaa !12
  %247 = add nsw i32 %246, 1
  %248 = srem i32 %247, 4
  %249 = getelementptr inbounds %"struct.std::pair", ptr %32, i32 0, i32 0
  store i32 %248, ptr %249, align 4, !tbaa !12
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %33, ptr align 4 %31, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %34, ptr align 4 %33, i64 12, i1 false)
  %250 = getelementptr inbounds { i64, i32 }, ptr %34, i32 0, i32 0
  %251 = load i64, ptr %250, align 4
  %252 = getelementptr inbounds { i64, i32 }, ptr %34, i32 0, i32 1
  %253 = load i32, ptr %252, align 4
  %254 = call noundef i32 @_Z4packSt4pairIiS_IiiEE(i64 %251, i32 %253)
  %255 = sext i32 %254 to i64
  %256 = getelementptr inbounds [1600 x [1600 x i32]], ptr @dp, i64 0, i64 %255
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %35, ptr align 4 %32, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %36, ptr align 4 %35, i64 12, i1 false)
  %257 = getelementptr inbounds { i64, i32 }, ptr %36, i32 0, i32 0
  %258 = load i64, ptr %257, align 4
  %259 = getelementptr inbounds { i64, i32 }, ptr %36, i32 0, i32 1
  %260 = load i32, ptr %259, align 4
  %261 = call noundef i32 @_Z4packSt4pairIiS_IiiEE(i64 %258, i32 %260)
  %262 = sext i32 %261 to i64
  %263 = getelementptr inbounds [1600 x i32], ptr %256, i64 0, i64 %262
  %264 = load i32, ptr %263, align 4, !tbaa !5
  %265 = icmp eq i32 %264, 0
  br i1 %265, label %266, label %301

266:                                              ; preds = %239
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %37, ptr align 4 %31, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %38, ptr align 4 %37, i64 12, i1 false)
  %267 = getelementptr inbounds { i64, i32 }, ptr %38, i32 0, i32 0
  %268 = load i64, ptr %267, align 4
  %269 = getelementptr inbounds { i64, i32 }, ptr %38, i32 0, i32 1
  %270 = load i32, ptr %269, align 4
  %271 = call noundef i32 @_Z4packSt4pairIiS_IiiEE(i64 %268, i32 %270)
  %272 = sext i32 %271 to i64
  %273 = getelementptr inbounds [1600 x [1600 x i32]], ptr @dp, i64 0, i64 %272
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %39, ptr align 4 %32, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %40, ptr align 4 %39, i64 12, i1 false)
  %274 = getelementptr inbounds { i64, i32 }, ptr %40, i32 0, i32 0
  %275 = load i64, ptr %274, align 4
  %276 = getelementptr inbounds { i64, i32 }, ptr %40, i32 0, i32 1
  %277 = load i32, ptr %276, align 4
  %278 = call noundef i32 @_Z4packSt4pairIiS_IiiEE(i64 %275, i32 %277)
  %279 = sext i32 %278 to i64
  %280 = getelementptr inbounds [1600 x i32], ptr %273, i64 0, i64 %279
  store i32 -1, ptr %280, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 12, ptr %41) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %42) #7
  %281 = getelementptr inbounds %"struct.std::pair", ptr %26, i32 0, i32 0
  %282 = load i32, ptr %281, align 4, !tbaa !12
  %283 = sub nsw i32 %282, 1
  store i32 %283, ptr %42, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %43) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %44) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %45, ptr align 4 %31, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %46, ptr align 4 %45, i64 12, i1 false)
  %284 = getelementptr inbounds { i64, i32 }, ptr %46, i32 0, i32 0
  %285 = load i64, ptr %284, align 4
  %286 = getelementptr inbounds { i64, i32 }, ptr %46, i32 0, i32 1
  %287 = load i32, ptr %286, align 4
  %288 = call noundef i32 @_Z4packSt4pairIiS_IiiEE(i64 %285, i32 %287)
  store i32 %288, ptr %44, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %47) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %48, ptr align 4 %32, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %49, ptr align 4 %48, i64 12, i1 false)
  %289 = getelementptr inbounds { i64, i32 }, ptr %49, i32 0, i32 0
  %290 = load i64, ptr %289, align 4
  %291 = getelementptr inbounds { i64, i32 }, ptr %49, i32 0, i32 1
  %292 = load i32, ptr %291, align 4
  %293 = call noundef i32 @_Z4packSt4pairIiS_IiiEE(i64 %290, i32 %292)
  store i32 %293, ptr %47, align 4, !tbaa !5
  invoke void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 4 dereferenceable(8) %43, ptr noundef nonnull align 4 dereferenceable(4) %44, ptr noundef nonnull align 4 dereferenceable(4) %47)
          to label %294 unwind label %297

294:                                              ; preds = %266
  invoke void @_ZNSt4pairIiS_IiiEEC2IiS0_TnNSt9enable_ifIXaaclsr5_PCCPE18_ConstructiblePairIT_T0_EEclsr5_PCCPE26_ImplicitlyConvertiblePairIS4_S5_EEEbE4typeELb1EEERKiRKS0_(ptr noundef nonnull align 4 dereferenceable(12) %41, ptr noundef nonnull align 4 dereferenceable(4) %42, ptr noundef nonnull align 4 dereferenceable(8) %43)
          to label %295 unwind label %297

295:                                              ; preds = %294
  invoke void @_ZNSt5queueISt4pairIiS0_IiiEESt5dequeIS2_SaIS2_EEE4pushEOS2_(ptr noundef nonnull align 8 dereferenceable(80) @q, ptr noundef nonnull align 4 dereferenceable(12) %41)
          to label %296 unwind label %297

296:                                              ; preds = %295
  call void @llvm.lifetime.end.p0(i64 4, ptr %47) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %44) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %43) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %42) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr %41) #7
  br label %301

297:                                              ; preds = %295, %294, %266
  %298 = landingpad { ptr, i32 }
          cleanup
  %299 = extractvalue { ptr, i32 } %298, 0
  store ptr %299, ptr %4, align 8
  %300 = extractvalue { ptr, i32 } %298, 1
  store i32 %300, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %47) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %44) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %43) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %42) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr %41) #7
  br label %549

301:                                              ; preds = %296, %239
  %302 = getelementptr inbounds %"struct.std::pair", ptr %27, i32 0, i32 0
  %303 = load i32, ptr %302, align 4, !tbaa !12
  %304 = add nsw i32 %303, 3
  %305 = srem i32 %304, 4
  %306 = getelementptr inbounds %"struct.std::pair", ptr %31, i32 0, i32 0
  store i32 %305, ptr %306, align 4, !tbaa !12
  %307 = getelementptr inbounds %"struct.std::pair", ptr %29, i32 0, i32 0
  %308 = load i32, ptr %307, align 4, !tbaa !12
  %309 = add nsw i32 %308, 3
  %310 = srem i32 %309, 4
  %311 = getelementptr inbounds %"struct.std::pair", ptr %32, i32 0, i32 0
  store i32 %310, ptr %311, align 4, !tbaa !12
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %50, ptr align 4 %31, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %51, ptr align 4 %50, i64 12, i1 false)
  %312 = getelementptr inbounds { i64, i32 }, ptr %51, i32 0, i32 0
  %313 = load i64, ptr %312, align 4
  %314 = getelementptr inbounds { i64, i32 }, ptr %51, i32 0, i32 1
  %315 = load i32, ptr %314, align 4
  %316 = call noundef i32 @_Z4packSt4pairIiS_IiiEE(i64 %313, i32 %315)
  %317 = sext i32 %316 to i64
  %318 = getelementptr inbounds [1600 x [1600 x i32]], ptr @dp, i64 0, i64 %317
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %52, ptr align 4 %32, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %53, ptr align 4 %52, i64 12, i1 false)
  %319 = getelementptr inbounds { i64, i32 }, ptr %53, i32 0, i32 0
  %320 = load i64, ptr %319, align 4
  %321 = getelementptr inbounds { i64, i32 }, ptr %53, i32 0, i32 1
  %322 = load i32, ptr %321, align 4
  %323 = call noundef i32 @_Z4packSt4pairIiS_IiiEE(i64 %320, i32 %322)
  %324 = sext i32 %323 to i64
  %325 = getelementptr inbounds [1600 x i32], ptr %318, i64 0, i64 %324
  %326 = load i32, ptr %325, align 4, !tbaa !5
  %327 = icmp eq i32 %326, 0
  br i1 %327, label %328, label %363

328:                                              ; preds = %301
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %54, ptr align 4 %31, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %55, ptr align 4 %54, i64 12, i1 false)
  %329 = getelementptr inbounds { i64, i32 }, ptr %55, i32 0, i32 0
  %330 = load i64, ptr %329, align 4
  %331 = getelementptr inbounds { i64, i32 }, ptr %55, i32 0, i32 1
  %332 = load i32, ptr %331, align 4
  %333 = call noundef i32 @_Z4packSt4pairIiS_IiiEE(i64 %330, i32 %332)
  %334 = sext i32 %333 to i64
  %335 = getelementptr inbounds [1600 x [1600 x i32]], ptr @dp, i64 0, i64 %334
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %56, ptr align 4 %32, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %57, ptr align 4 %56, i64 12, i1 false)
  %336 = getelementptr inbounds { i64, i32 }, ptr %57, i32 0, i32 0
  %337 = load i64, ptr %336, align 4
  %338 = getelementptr inbounds { i64, i32 }, ptr %57, i32 0, i32 1
  %339 = load i32, ptr %338, align 4
  %340 = call noundef i32 @_Z4packSt4pairIiS_IiiEE(i64 %337, i32 %339)
  %341 = sext i32 %340 to i64
  %342 = getelementptr inbounds [1600 x i32], ptr %335, i64 0, i64 %341
  store i32 -1, ptr %342, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 12, ptr %58) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %59) #7
  %343 = getelementptr inbounds %"struct.std::pair", ptr %26, i32 0, i32 0
  %344 = load i32, ptr %343, align 4, !tbaa !12
  %345 = sub nsw i32 %344, 1
  store i32 %345, ptr %59, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %60) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %61) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %62, ptr align 4 %31, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %63, ptr align 4 %62, i64 12, i1 false)
  %346 = getelementptr inbounds { i64, i32 }, ptr %63, i32 0, i32 0
  %347 = load i64, ptr %346, align 4
  %348 = getelementptr inbounds { i64, i32 }, ptr %63, i32 0, i32 1
  %349 = load i32, ptr %348, align 4
  %350 = call noundef i32 @_Z4packSt4pairIiS_IiiEE(i64 %347, i32 %349)
  store i32 %350, ptr %61, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %64) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %65, ptr align 4 %32, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %66, ptr align 4 %65, i64 12, i1 false)
  %351 = getelementptr inbounds { i64, i32 }, ptr %66, i32 0, i32 0
  %352 = load i64, ptr %351, align 4
  %353 = getelementptr inbounds { i64, i32 }, ptr %66, i32 0, i32 1
  %354 = load i32, ptr %353, align 4
  %355 = call noundef i32 @_Z4packSt4pairIiS_IiiEE(i64 %352, i32 %354)
  store i32 %355, ptr %64, align 4, !tbaa !5
  invoke void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 4 dereferenceable(8) %60, ptr noundef nonnull align 4 dereferenceable(4) %61, ptr noundef nonnull align 4 dereferenceable(4) %64)
          to label %356 unwind label %359

356:                                              ; preds = %328
  invoke void @_ZNSt4pairIiS_IiiEEC2IiS0_TnNSt9enable_ifIXaaclsr5_PCCPE18_ConstructiblePairIT_T0_EEclsr5_PCCPE26_ImplicitlyConvertiblePairIS4_S5_EEEbE4typeELb1EEERKiRKS0_(ptr noundef nonnull align 4 dereferenceable(12) %58, ptr noundef nonnull align 4 dereferenceable(4) %59, ptr noundef nonnull align 4 dereferenceable(8) %60)
          to label %357 unwind label %359

357:                                              ; preds = %356
  invoke void @_ZNSt5queueISt4pairIiS0_IiiEESt5dequeIS2_SaIS2_EEE4pushEOS2_(ptr noundef nonnull align 8 dereferenceable(80) @q, ptr noundef nonnull align 4 dereferenceable(12) %58)
          to label %358 unwind label %359

358:                                              ; preds = %357
  call void @llvm.lifetime.end.p0(i64 4, ptr %64) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %61) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %60) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %59) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr %58) #7
  br label %363

359:                                              ; preds = %357, %356, %328
  %360 = landingpad { ptr, i32 }
          cleanup
  %361 = extractvalue { ptr, i32 } %360, 0
  store ptr %361, ptr %4, align 8
  %362 = extractvalue { ptr, i32 } %360, 1
  store i32 %362, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %64) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %61) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %60) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %59) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr %58) #7
  br label %549

363:                                              ; preds = %358, %301
  %364 = getelementptr inbounds %"struct.std::pair", ptr %27, i32 0, i32 0
  %365 = load i32, ptr %364, align 4, !tbaa !12
  %366 = getelementptr inbounds %"struct.std::pair", ptr %31, i32 0, i32 0
  store i32 %365, ptr %366, align 4, !tbaa !12
  %367 = getelementptr inbounds %"struct.std::pair", ptr %29, i32 0, i32 0
  %368 = load i32, ptr %367, align 4, !tbaa !12
  %369 = getelementptr inbounds %"struct.std::pair", ptr %32, i32 0, i32 0
  store i32 %368, ptr %369, align 4, !tbaa !12
  %370 = getelementptr inbounds %"struct.std::pair", ptr %31, i32 0, i32 1
  call void @llvm.lifetime.start.p0(i64 8, ptr %67) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %68) #7
  %371 = load i32, ptr @N, align 4, !tbaa !5
  %372 = sub nsw i32 %371, 1
  store i32 %372, ptr %68, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %69) #7
  %373 = load i32, ptr @N, align 4, !tbaa !5
  %374 = sub nsw i32 %373, 1
  store i32 %374, ptr %69, align 4, !tbaa !5
  %375 = invoke i64 @_ZSt9make_pairIiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS1_INS2_IT0_E4typeEE6__typeEEOS3_OS8_(ptr noundef nonnull align 4 dereferenceable(4) %68, ptr noundef nonnull align 4 dereferenceable(4) %69)
          to label %376 unwind label %423

376:                                              ; preds = %363
  store i64 %375, ptr %67, align 4
  %377 = invoke noundef zeroext i1 @_ZStneIiiEbRKSt4pairIT_T0_ES5_(ptr noundef nonnull align 4 dereferenceable(8) %370, ptr noundef nonnull align 4 dereferenceable(8) %67)
          to label %378 unwind label %423

378:                                              ; preds = %376
  br i1 %377, label %379, label %399

379:                                              ; preds = %378
  %380 = getelementptr inbounds %"struct.std::pair", ptr %31, i32 0, i32 1
  %381 = getelementptr inbounds %"struct.std::pair.0", ptr %380, i32 0, i32 0
  %382 = load i32, ptr %381, align 4, !tbaa !15
  %383 = getelementptr inbounds %"struct.std::pair", ptr %31, i32 0, i32 0
  %384 = load i32, ptr %383, align 4, !tbaa !12
  %385 = sext i32 %384 to i64
  %386 = getelementptr inbounds [4 x i32], ptr @xdir, i64 0, i64 %385
  %387 = load i32, ptr %386, align 4, !tbaa !5
  %388 = add nsw i32 %382, %387
  %389 = getelementptr inbounds %"struct.std::pair", ptr %31, i32 0, i32 1
  %390 = getelementptr inbounds %"struct.std::pair.0", ptr %389, i32 0, i32 1
  %391 = load i32, ptr %390, align 4, !tbaa !16
  %392 = getelementptr inbounds %"struct.std::pair", ptr %31, i32 0, i32 0
  %393 = load i32, ptr %392, align 4, !tbaa !12
  %394 = sext i32 %393 to i64
  %395 = getelementptr inbounds [4 x i32], ptr @ydir, i64 0, i64 %394
  %396 = load i32, ptr %395, align 4, !tbaa !5
  %397 = add nsw i32 %391, %396
  %398 = call noundef zeroext i1 @_Z5validii(i32 noundef %388, i32 noundef %397)
  br label %399

399:                                              ; preds = %379, %378
  %400 = phi i1 [ false, %378 ], [ %398, %379 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr %69) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %68) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %67) #7
  br i1 %400, label %401, label %431

401:                                              ; preds = %399
  call void @llvm.lifetime.start.p0(i64 8, ptr %70) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %71) #7
  %402 = getelementptr inbounds %"struct.std::pair", ptr %31, i32 0, i32 1
  %403 = getelementptr inbounds %"struct.std::pair.0", ptr %402, i32 0, i32 0
  %404 = load i32, ptr %403, align 4, !tbaa !15
  %405 = getelementptr inbounds %"struct.std::pair", ptr %31, i32 0, i32 0
  %406 = load i32, ptr %405, align 4, !tbaa !12
  %407 = sext i32 %406 to i64
  %408 = getelementptr inbounds [4 x i32], ptr @xdir, i64 0, i64 %407
  %409 = load i32, ptr %408, align 4, !tbaa !5
  %410 = add nsw i32 %404, %409
  store i32 %410, ptr %71, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %72) #7
  %411 = getelementptr inbounds %"struct.std::pair", ptr %31, i32 0, i32 1
  %412 = getelementptr inbounds %"struct.std::pair.0", ptr %411, i32 0, i32 1
  %413 = load i32, ptr %412, align 4, !tbaa !16
  %414 = getelementptr inbounds %"struct.std::pair", ptr %31, i32 0, i32 0
  %415 = load i32, ptr %414, align 4, !tbaa !12
  %416 = sext i32 %415 to i64
  %417 = getelementptr inbounds [4 x i32], ptr @ydir, i64 0, i64 %416
  %418 = load i32, ptr %417, align 4, !tbaa !5
  %419 = add nsw i32 %413, %418
  store i32 %419, ptr %72, align 4, !tbaa !5
  invoke void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 4 dereferenceable(8) %70, ptr noundef nonnull align 4 dereferenceable(4) %71, ptr noundef nonnull align 4 dereferenceable(4) %72)
          to label %420 unwind label %427

420:                                              ; preds = %401
  %421 = getelementptr inbounds %"struct.std::pair", ptr %31, i32 0, i32 1
  %422 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %421, ptr noundef nonnull align 4 dereferenceable(8) %70) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %72) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %71) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %70) #7
  br label %431

423:                                              ; preds = %376, %363
  %424 = landingpad { ptr, i32 }
          cleanup
  %425 = extractvalue { ptr, i32 } %424, 0
  store ptr %425, ptr %4, align 8
  %426 = extractvalue { ptr, i32 } %424, 1
  store i32 %426, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %69) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %68) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %67) #7
  br label %549

427:                                              ; preds = %401
  %428 = landingpad { ptr, i32 }
          cleanup
  %429 = extractvalue { ptr, i32 } %428, 0
  store ptr %429, ptr %4, align 8
  %430 = extractvalue { ptr, i32 } %428, 1
  store i32 %430, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %72) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %71) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %70) #7
  br label %549

431:                                              ; preds = %420, %399
  %432 = getelementptr inbounds %"struct.std::pair", ptr %32, i32 0, i32 1
  call void @llvm.lifetime.start.p0(i64 8, ptr %73) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %74) #7
  %433 = load i32, ptr @N, align 4, !tbaa !5
  %434 = sub nsw i32 %433, 1
  store i32 %434, ptr %74, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %75) #7
  %435 = load i32, ptr @N, align 4, !tbaa !5
  %436 = sub nsw i32 %435, 1
  store i32 %436, ptr %75, align 4, !tbaa !5
  %437 = invoke i64 @_ZSt9make_pairIiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS1_INS2_IT0_E4typeEE6__typeEEOS3_OS8_(ptr noundef nonnull align 4 dereferenceable(4) %74, ptr noundef nonnull align 4 dereferenceable(4) %75)
          to label %438 unwind label %485

438:                                              ; preds = %431
  store i64 %437, ptr %73, align 4
  %439 = invoke noundef zeroext i1 @_ZStneIiiEbRKSt4pairIT_T0_ES5_(ptr noundef nonnull align 4 dereferenceable(8) %432, ptr noundef nonnull align 4 dereferenceable(8) %73)
          to label %440 unwind label %485

440:                                              ; preds = %438
  br i1 %439, label %441, label %461

441:                                              ; preds = %440
  %442 = getelementptr inbounds %"struct.std::pair", ptr %32, i32 0, i32 1
  %443 = getelementptr inbounds %"struct.std::pair.0", ptr %442, i32 0, i32 0
  %444 = load i32, ptr %443, align 4, !tbaa !15
  %445 = getelementptr inbounds %"struct.std::pair", ptr %32, i32 0, i32 0
  %446 = load i32, ptr %445, align 4, !tbaa !12
  %447 = sext i32 %446 to i64
  %448 = getelementptr inbounds [4 x i32], ptr @xdir, i64 0, i64 %447
  %449 = load i32, ptr %448, align 4, !tbaa !5
  %450 = add nsw i32 %444, %449
  %451 = getelementptr inbounds %"struct.std::pair", ptr %32, i32 0, i32 1
  %452 = getelementptr inbounds %"struct.std::pair.0", ptr %451, i32 0, i32 1
  %453 = load i32, ptr %452, align 4, !tbaa !16
  %454 = getelementptr inbounds %"struct.std::pair", ptr %32, i32 0, i32 0
  %455 = load i32, ptr %454, align 4, !tbaa !12
  %456 = sext i32 %455 to i64
  %457 = getelementptr inbounds [4 x i32], ptr @ydir, i64 0, i64 %456
  %458 = load i32, ptr %457, align 4, !tbaa !5
  %459 = add nsw i32 %453, %458
  %460 = call noundef zeroext i1 @_Z5validii(i32 noundef %450, i32 noundef %459)
  br label %461

461:                                              ; preds = %441, %440
  %462 = phi i1 [ false, %440 ], [ %460, %441 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr %75) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %74) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %73) #7
  br i1 %462, label %463, label %493

463:                                              ; preds = %461
  call void @llvm.lifetime.start.p0(i64 8, ptr %76) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %77) #7
  %464 = getelementptr inbounds %"struct.std::pair", ptr %32, i32 0, i32 1
  %465 = getelementptr inbounds %"struct.std::pair.0", ptr %464, i32 0, i32 0
  %466 = load i32, ptr %465, align 4, !tbaa !15
  %467 = getelementptr inbounds %"struct.std::pair", ptr %32, i32 0, i32 0
  %468 = load i32, ptr %467, align 4, !tbaa !12
  %469 = sext i32 %468 to i64
  %470 = getelementptr inbounds [4 x i32], ptr @xdir, i64 0, i64 %469
  %471 = load i32, ptr %470, align 4, !tbaa !5
  %472 = add nsw i32 %466, %471
  store i32 %472, ptr %77, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %78) #7
  %473 = getelementptr inbounds %"struct.std::pair", ptr %32, i32 0, i32 1
  %474 = getelementptr inbounds %"struct.std::pair.0", ptr %473, i32 0, i32 1
  %475 = load i32, ptr %474, align 4, !tbaa !16
  %476 = getelementptr inbounds %"struct.std::pair", ptr %32, i32 0, i32 0
  %477 = load i32, ptr %476, align 4, !tbaa !12
  %478 = sext i32 %477 to i64
  %479 = getelementptr inbounds [4 x i32], ptr @ydir, i64 0, i64 %478
  %480 = load i32, ptr %479, align 4, !tbaa !5
  %481 = add nsw i32 %475, %480
  store i32 %481, ptr %78, align 4, !tbaa !5
  invoke void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 4 dereferenceable(8) %76, ptr noundef nonnull align 4 dereferenceable(4) %77, ptr noundef nonnull align 4 dereferenceable(4) %78)
          to label %482 unwind label %489

482:                                              ; preds = %463
  %483 = getelementptr inbounds %"struct.std::pair", ptr %32, i32 0, i32 1
  %484 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %483, ptr noundef nonnull align 4 dereferenceable(8) %76) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %78) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %77) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %76) #7
  br label %493

485:                                              ; preds = %438, %431
  %486 = landingpad { ptr, i32 }
          cleanup
  %487 = extractvalue { ptr, i32 } %486, 0
  store ptr %487, ptr %4, align 8
  %488 = extractvalue { ptr, i32 } %486, 1
  store i32 %488, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %75) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %74) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %73) #7
  br label %549

489:                                              ; preds = %463
  %490 = landingpad { ptr, i32 }
          cleanup
  %491 = extractvalue { ptr, i32 } %490, 0
  store ptr %491, ptr %4, align 8
  %492 = extractvalue { ptr, i32 } %490, 1
  store i32 %492, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %78) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %77) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %76) #7
  br label %549

493:                                              ; preds = %482, %461
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %79, ptr align 4 %31, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %80, ptr align 4 %79, i64 12, i1 false)
  %494 = getelementptr inbounds { i64, i32 }, ptr %80, i32 0, i32 0
  %495 = load i64, ptr %494, align 4
  %496 = getelementptr inbounds { i64, i32 }, ptr %80, i32 0, i32 1
  %497 = load i32, ptr %496, align 4
  %498 = call noundef i32 @_Z4packSt4pairIiS_IiiEE(i64 %495, i32 %497)
  %499 = sext i32 %498 to i64
  %500 = getelementptr inbounds [1600 x [1600 x i32]], ptr @dp, i64 0, i64 %499
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %81, ptr align 4 %32, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %82, ptr align 4 %81, i64 12, i1 false)
  %501 = getelementptr inbounds { i64, i32 }, ptr %82, i32 0, i32 0
  %502 = load i64, ptr %501, align 4
  %503 = getelementptr inbounds { i64, i32 }, ptr %82, i32 0, i32 1
  %504 = load i32, ptr %503, align 4
  %505 = call noundef i32 @_Z4packSt4pairIiS_IiiEE(i64 %502, i32 %504)
  %506 = sext i32 %505 to i64
  %507 = getelementptr inbounds [1600 x i32], ptr %500, i64 0, i64 %506
  %508 = load i32, ptr %507, align 4, !tbaa !5
  %509 = icmp eq i32 %508, 0
  br i1 %509, label %510, label %545

510:                                              ; preds = %493
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %83, ptr align 4 %31, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %84, ptr align 4 %83, i64 12, i1 false)
  %511 = getelementptr inbounds { i64, i32 }, ptr %84, i32 0, i32 0
  %512 = load i64, ptr %511, align 4
  %513 = getelementptr inbounds { i64, i32 }, ptr %84, i32 0, i32 1
  %514 = load i32, ptr %513, align 4
  %515 = call noundef i32 @_Z4packSt4pairIiS_IiiEE(i64 %512, i32 %514)
  %516 = sext i32 %515 to i64
  %517 = getelementptr inbounds [1600 x [1600 x i32]], ptr @dp, i64 0, i64 %516
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %85, ptr align 4 %32, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %86, ptr align 4 %85, i64 12, i1 false)
  %518 = getelementptr inbounds { i64, i32 }, ptr %86, i32 0, i32 0
  %519 = load i64, ptr %518, align 4
  %520 = getelementptr inbounds { i64, i32 }, ptr %86, i32 0, i32 1
  %521 = load i32, ptr %520, align 4
  %522 = call noundef i32 @_Z4packSt4pairIiS_IiiEE(i64 %519, i32 %521)
  %523 = sext i32 %522 to i64
  %524 = getelementptr inbounds [1600 x i32], ptr %517, i64 0, i64 %523
  store i32 -1, ptr %524, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 12, ptr %87) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %88) #7
  %525 = getelementptr inbounds %"struct.std::pair", ptr %26, i32 0, i32 0
  %526 = load i32, ptr %525, align 4, !tbaa !12
  %527 = sub nsw i32 %526, 1
  store i32 %527, ptr %88, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %89) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %90) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %91, ptr align 4 %31, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %92, ptr align 4 %91, i64 12, i1 false)
  %528 = getelementptr inbounds { i64, i32 }, ptr %92, i32 0, i32 0
  %529 = load i64, ptr %528, align 4
  %530 = getelementptr inbounds { i64, i32 }, ptr %92, i32 0, i32 1
  %531 = load i32, ptr %530, align 4
  %532 = call noundef i32 @_Z4packSt4pairIiS_IiiEE(i64 %529, i32 %531)
  store i32 %532, ptr %90, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %93) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %94, ptr align 4 %32, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %95, ptr align 4 %94, i64 12, i1 false)
  %533 = getelementptr inbounds { i64, i32 }, ptr %95, i32 0, i32 0
  %534 = load i64, ptr %533, align 4
  %535 = getelementptr inbounds { i64, i32 }, ptr %95, i32 0, i32 1
  %536 = load i32, ptr %535, align 4
  %537 = call noundef i32 @_Z4packSt4pairIiS_IiiEE(i64 %534, i32 %536)
  store i32 %537, ptr %93, align 4, !tbaa !5
  invoke void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 4 dereferenceable(8) %89, ptr noundef nonnull align 4 dereferenceable(4) %90, ptr noundef nonnull align 4 dereferenceable(4) %93)
          to label %538 unwind label %541

538:                                              ; preds = %510
  invoke void @_ZNSt4pairIiS_IiiEEC2IiS0_TnNSt9enable_ifIXaaclsr5_PCCPE18_ConstructiblePairIT_T0_EEclsr5_PCCPE26_ImplicitlyConvertiblePairIS4_S5_EEEbE4typeELb1EEERKiRKS0_(ptr noundef nonnull align 4 dereferenceable(12) %87, ptr noundef nonnull align 4 dereferenceable(4) %88, ptr noundef nonnull align 4 dereferenceable(8) %89)
          to label %539 unwind label %541

539:                                              ; preds = %538
  invoke void @_ZNSt5queueISt4pairIiS0_IiiEESt5dequeIS2_SaIS2_EEE4pushEOS2_(ptr noundef nonnull align 8 dereferenceable(80) @q, ptr noundef nonnull align 4 dereferenceable(12) %87)
          to label %540 unwind label %541

540:                                              ; preds = %539
  call void @llvm.lifetime.end.p0(i64 4, ptr %93) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %90) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %89) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %88) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr %87) #7
  br label %545

541:                                              ; preds = %539, %538, %510
  %542 = landingpad { ptr, i32 }
          cleanup
  %543 = extractvalue { ptr, i32 } %542, 0
  store ptr %543, ptr %4, align 8
  %544 = extractvalue { ptr, i32 } %542, 1
  store i32 %544, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %93) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %90) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %89) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %88) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr %87) #7
  br label %549

545:                                              ; preds = %540, %493
  call void @llvm.lifetime.end.p0(i64 12, ptr %32) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr %31) #7
  store i32 0, ptr %7, align 4
  br label %546

546:                                              ; preds = %545, %217
  call void @llvm.lifetime.end.p0(i64 12, ptr %29) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr %27) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr %26) #7
  %547 = load i32, ptr %7, align 4
  switch i32 %547, label %553 [
    i32 0, label %548
  ]

548:                                              ; preds = %546
  br label %157, !llvm.loop !17

549:                                              ; preds = %541, %489, %485, %427, %423, %359, %297
  call void @llvm.lifetime.end.p0(i64 12, ptr %32) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr %31) #7
  br label %550

550:                                              ; preds = %549, %235
  call void @llvm.lifetime.end.p0(i64 12, ptr %29) #7
  br label %551

551:                                              ; preds = %550, %231
  call void @llvm.lifetime.end.p0(i64 12, ptr %27) #7
  br label %552

552:                                              ; preds = %551, %227
  call void @llvm.lifetime.end.p0(i64 12, ptr %26) #7
  br label %555

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

555:                                              ; preds = %552, %226, %131, %109
  call void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(248) %3) #7
  br label %556

556:                                              ; preds = %555, %105
  call void @llvm.lifetime.end.p0(i64 512, ptr %3) #7
  call void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(256) %2) #7
  call void @llvm.lifetime.end.p0(i64 520, ptr %2) #7
  br label %557

557:                                              ; preds = %556
  %558 = load ptr, ptr %4, align 8
  %559 = load i32, ptr %5, align 4
  %560 = insertvalue { ptr, i32 } poison, ptr %558, 0
  %561 = insertvalue { ptr, i32 } %560, i32 %559, 1
  resume { ptr, i32 } %561
}

; Function Attrs: mustprogress uwtable
declare void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(256), ptr noundef, i32 noundef) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(248), ptr noundef, i32 noundef) unnamed_addr #2 align 2

declare i32 @__gxx_personality_v0(...)

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 1 dereferenceable(1)) #5

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZStneIiiEbRKSt4pairIT_T0_ES5_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) #6

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

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

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

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

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


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

%"class.std::queue" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<std::pair<int, std::pair<int, int>>, std::allocator<std::pair<int, std::pair<int, int>>>>::_Deque_impl" }
%"struct.std::_Deque_base<std::pair<int, std::pair<int, int>>, std::allocator<std::pair<int, std::pair<int, int>>>>::_Deque_impl" = type { %"struct.std::_Deque_base<std::pair<int, std::pair<int, int>>, std::allocator<std::pair<int, std::pair<int, int>>>>::_Deque_impl_data" }
%"struct.std::_Deque_base<std::pair<int, std::pair<int, int>>, std::allocator<std::pair<int, std::pair<int, int>>>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }
%"class.std::basic_ifstream" = type { %"class.std::basic_istream.base", %"class.std::basic_filebuf", %"class.std::basic_ios" }
%"class.std::basic_istream.base" = type { ptr, i64 }
%"class.std::basic_filebuf" = type { %"class.std::basic_streambuf", %union.pthread_mutex_t, %"class.std::__basic_file", i32, %struct.__mbstate_t, %struct.__mbstate_t, %struct.__mbstate_t, ptr, i64, i8, i8, i8, i8, ptr, ptr, i8, ptr, ptr, i64, ptr, ptr }
%"class.std::basic_streambuf" = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, %"class.std::locale" }
%"class.std::locale" = type { ptr }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%"class.std::__basic_file" = type <{ ptr, i8, [7 x i8] }>
%struct.__mbstate_t = type { i32, %union.anon }
%union.anon = type { i32 }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::basic_ofstream" = type { %"class.std::basic_ostream.base", %"class.std::basic_filebuf", %"class.std::basic_ios" }
%"class.std::basic_ostream.base" = type { ptr }
%"struct.std::pair" = type { i32, %"struct.std::pair.0" }
%"struct.std::pair.0" = type { i32, i32 }

@grid = external dso_local global [20 x [20 x i8]], align 16
@dp = external dso_local local_unnamed_addr global [1600 x [1600 x i32]], align 16
@N = external dso_local global i32, align 4
@xdir = external dso_local local_unnamed_addr global [4 x i32], align 16
@ydir = external dso_local local_unnamed_addr global [4 x i32], align 16
@q = external dso_local global %"class.std::queue", align 8
@.str = external hidden unnamed_addr constant [10 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [11 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z4packSt4pairIiS_IiiEE(i64, i32) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i32 } @_Z6unpacki(i32 noundef) local_unnamed_addr #1

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z5validii(i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::basic_ifstream", align 8
  %2 = alloca %"class.std::basic_ofstream", align 8
  %3 = alloca %"struct.std::pair", align 4
  %4 = alloca i32, align 4
  %5 = alloca %"struct.std::pair.0", align 4
  %6 = alloca i32, align 4
  %7 = alloca %"struct.std::pair", align 8
  %8 = alloca i32, align 4
  %9 = alloca %"struct.std::pair.0", align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca %"struct.std::pair", align 8
  %14 = alloca i32, align 4
  %15 = alloca %"struct.std::pair.0", align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca %"struct.std::pair", align 8
  %19 = alloca %"struct.std::pair", align 8
  %20 = alloca %"struct.std::pair", align 4
  %21 = alloca i32, align 4
  %22 = alloca %"struct.std::pair.0", align 4
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  %25 = alloca %"struct.std::pair", align 4
  %26 = alloca i32, align 4
  %27 = alloca %"struct.std::pair.0", align 4
  %28 = alloca i32, align 4
  %29 = alloca i32, align 4
  %30 = alloca %"struct.std::pair.0", align 8
  %31 = alloca i32, align 4
  %32 = alloca i32, align 4
  %33 = alloca %"struct.std::pair.0", align 4
  %34 = alloca i32, align 4
  %35 = alloca i32, align 4
  %36 = alloca %"struct.std::pair.0", align 8
  %37 = alloca i32, align 4
  %38 = alloca i32, align 4
  %39 = alloca %"struct.std::pair.0", align 4
  %40 = alloca i32, align 4
  %41 = alloca i32, align 4
  %42 = alloca %"struct.std::pair", align 4
  %43 = alloca i32, align 4
  %44 = alloca %"struct.std::pair.0", align 4
  %45 = alloca i32, align 4
  %46 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 520, ptr nonnull %1) #6
  call void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(256) %1, ptr noundef nonnull @.str, i32 noundef 8)
  call void @llvm.lifetime.start.p0(i64 512, ptr nonnull %2) #6
  invoke void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(248) %2, ptr noundef nonnull @.str.1, i32 noundef 16)
          to label %47 unwind label %59

47:                                               ; preds = %0
  %48 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull align 4 dereferenceable(4) @N)
          to label %49 unwind label %61

49:                                               ; preds = %47
  %50 = load i32, ptr @N, align 4, !tbaa !5
  %51 = icmp sgt i32 %50, 0
  br i1 %51, label %.preheader.preheader, label %._crit_edge

.preheader.preheader:                             ; preds = %49
  %.0110134 = add nsw i32 %50, -1
  %52 = zext nneg i32 %.0110134 to i64
  br label %.preheader

.loopexit125:                                     ; preds = %65, %.preheader
  %53 = phi i32 [ %55, %.preheader ], [ %66, %65 ]
  %indvars.iv.next146 = add nsw i64 %indvars.iv145, -1
  %54 = icmp sgt i64 %indvars.iv145, 0
  br i1 %54, label %.preheader, label %._crit_edge, !llvm.loop !9

.preheader:                                       ; preds = %.preheader.preheader, %.loopexit125
  %55 = phi i32 [ %50, %.preheader.preheader ], [ %53, %.loopexit125 ]
  %indvars.iv145 = phi i64 [ %52, %.preheader.preheader ], [ %indvars.iv.next146, %.loopexit125 ]
  %56 = icmp sgt i32 %55, 0
  br i1 %56, label %.lr.ph, label %.loopexit125

._crit_edge:                                      ; preds = %.loopexit125, %49
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  store i32 0, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #6
  store i32 0, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #6
  store i32 0, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %11) #6
  store i32 0, ptr %11, align 4, !tbaa !5
  call void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 4 dereferenceable(8) %9, ptr noundef nonnull align 4 dereferenceable(4) %10, ptr noundef nonnull align 4 dereferenceable(4) %11)
  call void @_ZNSt4pairIiS_IiiEEC2IiS0_TnNSt9enable_ifIXaaclsr5_PCCPE18_ConstructiblePairIT_T0_EEclsr5_PCCPE26_ImplicitlyConvertiblePairIS4_S5_EEEbE4typeELb1EEERKiRKS0_(ptr noundef nonnull align 4 dereferenceable(12) %7, ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 4 dereferenceable(8) %9)
  %.sroa.093.0.copyload = load i64, ptr %7, align 8
  %.sroa.294.0..sroa_idx = getelementptr inbounds i8, ptr %7, i64 8
  %.sroa.294.0.copyload = load i32, ptr %.sroa.294.0..sroa_idx, align 8
  %57 = call noundef i32 @_Z4packSt4pairIiS_IiiEE(i64 %.sroa.093.0.copyload, i32 %.sroa.294.0.copyload)
  store i32 %57, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %12) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %14) #6
  store i32 1, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %15) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %16) #6
  store i32 0, ptr %16, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %17) #6
  store i32 0, ptr %17, align 4, !tbaa !5
  call void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 4 dereferenceable(8) %15, ptr noundef nonnull align 4 dereferenceable(4) %16, ptr noundef nonnull align 4 dereferenceable(4) %17)
  call void @_ZNSt4pairIiS_IiiEEC2IiS0_TnNSt9enable_ifIXaaclsr5_PCCPE18_ConstructiblePairIT_T0_EEclsr5_PCCPE26_ImplicitlyConvertiblePairIS4_S5_EEEbE4typeELb1EEERKiRKS0_(ptr noundef nonnull align 4 dereferenceable(12) %13, ptr noundef nonnull align 4 dereferenceable(4) %14, ptr noundef nonnull align 4 dereferenceable(8) %15)
  %.sroa.091.0.copyload = load i64, ptr %13, align 8
  %.sroa.292.0..sroa_idx = getelementptr inbounds i8, ptr %13, i64 8
  %.sroa.292.0.copyload = load i32, ptr %.sroa.292.0..sroa_idx, align 8
  %58 = call noundef i32 @_Z4packSt4pairIiS_IiiEE(i64 %.sroa.091.0.copyload, i32 %.sroa.292.0.copyload)
  store i32 %58, ptr %12, align 4, !tbaa !5
  call void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 4 dereferenceable(8) %5, ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %12)
  call void @_ZNSt4pairIiS_IiiEEC2IiS0_TnNSt9enable_ifIXaaclsr5_PCCPE18_ConstructiblePairIT_T0_EEclsr5_PCCPE26_ImplicitlyConvertiblePairIS4_S5_EEEbE4typeELb1EEERKiRKS0_(ptr noundef nonnull align 4 dereferenceable(12) %3, ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(8) %5)
  invoke void @_ZNSt5queueISt4pairIiS0_IiiEESt5dequeIS2_SaIS2_EEE4pushEOS2_(ptr noundef nonnull align 8 dereferenceable(80) @q, ptr noundef nonnull align 4 dereferenceable(12) %3)
          to label %71 unwind label %92

59:                                               ; preds = %0
  %60 = landingpad { ptr, i32 }
          cleanup
  br label %233

61:                                               ; preds = %47
  %62 = landingpad { ptr, i32 }
          cleanup
  br label %232

.lr.ph:                                           ; preds = %.preheader, %65
  %indvars.iv = phi i64 [ %indvars.iv.next, %65 ], [ 0, %.preheader ]
  %63 = getelementptr inbounds [20 x [20 x i8]], ptr @grid, i64 0, i64 %indvars.iv, i64 %indvars.iv145
  %64 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_(ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull align 1 dereferenceable(1) %63)
          to label %65 unwind label %69

65:                                               ; preds = %.lr.ph
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %66 = load i32, ptr @N, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = icmp slt i64 %indvars.iv.next, %67
  br i1 %68, label %.lr.ph, label %.loopexit125, !llvm.loop !12

69:                                               ; preds = %.lr.ph
  %70 = landingpad { ptr, i32 }
          cleanup
  br label %232

71:                                               ; preds = %._crit_edge
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %17) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %15) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %14) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %3) #6
  %.sroa.883.0..sroa_idx = getelementptr inbounds i8, ptr %18, i64 8
  %.sroa.8.0..sroa_idx = getelementptr inbounds i8, ptr %19, i64 8
  %72 = getelementptr inbounds i8, ptr %18, i64 4
  %73 = getelementptr inbounds i8, ptr %19, i64 4
  br label %74

74:                                               ; preds = %.critedge124, %71
  %75 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt5queueISt4pairIiS0_IiiEESt5dequeIS2_SaIS2_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) @q)
  %.sroa.084.0.copyload = load i32, ptr %75, align 4
  %.sroa.9.0..sroa_idx = getelementptr inbounds i8, ptr %75, i64 4
  %.sroa.9.0.copyload = load i32, ptr %.sroa.9.0..sroa_idx, align 4
  %.sroa.11.0..sroa_idx = getelementptr inbounds i8, ptr %75, i64 8
  %.sroa.11.0.copyload = load i32, ptr %.sroa.11.0..sroa_idx, align 4
  call void @_ZNSt5queueISt4pairIiS0_IiiEESt5dequeIS2_SaIS2_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) @q)
  %76 = sub nsw i32 0, %.sroa.084.0.copyload
  %77 = sext i32 %.sroa.9.0.copyload to i64
  %78 = sext i32 %.sroa.11.0.copyload to i64
  %79 = getelementptr inbounds [1600 x [1600 x i32]], ptr @dp, i64 0, i64 %77, i64 %78
  store i32 %76, ptr %79, align 4, !tbaa !5
  %80 = invoke { i64, i32 } @_Z6unpacki(i32 noundef %.sroa.9.0.copyload)
          to label %81 unwind label %94

81:                                               ; preds = %74
  %.fca.0.extract77 = extractvalue { i64, i32 } %80, 0
  %.fca.1.extract78 = extractvalue { i64, i32 } %80, 1
  %.sroa.081.sroa.0.0.extract.trunc = trunc i64 %.fca.0.extract77 to i32
  %82 = invoke { i64, i32 } @_Z6unpacki(i32 noundef %.sroa.11.0.copyload)
          to label %83 unwind label %.loopexit

83:                                               ; preds = %81
  %.sroa.081.sroa.7.0.extract.shift = lshr i64 %.fca.0.extract77, 32
  %.sroa.081.sroa.7.0.extract.trunc = trunc nuw i64 %.sroa.081.sroa.7.0.extract.shift to i32
  %.fca.0.extract = extractvalue { i64, i32 } %82, 0
  %.fca.1.extract = extractvalue { i64, i32 } %82, 1
  %.sroa.075.sroa.0.0.extract.trunc = trunc i64 %.fca.0.extract to i32
  %.sroa.075.sroa.7.0.extract.shift = lshr i64 %.fca.0.extract, 32
  %.sroa.075.sroa.7.0.extract.trunc = trunc nuw i64 %.sroa.075.sroa.7.0.extract.shift to i32
  %84 = load i32, ptr @N, align 4, !tbaa !5
  %85 = add nsw i32 %84, -1
  %86 = icmp eq i32 %85, %.sroa.081.sroa.7.0.extract.trunc
  %87 = icmp eq i32 %.fca.1.extract78, %85
  %or.cond = select i1 %86, i1 %87, i1 false
  %88 = icmp eq i32 %85, %.sroa.075.sroa.7.0.extract.trunc
  %or.cond121 = select i1 %or.cond, i1 %88, i1 false
  %89 = icmp eq i32 %.fca.1.extract, %85
  %or.cond122 = select i1 %or.cond121, i1 %89, i1 false
  br i1 %or.cond122, label %90, label %96

90:                                               ; preds = %83
  %91 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %2, i32 noundef %76)
          to label %231 unwind label %.loopexit.split-lp

92:                                               ; preds = %._crit_edge
  %93 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %17) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %15) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %14) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %3) #6
  br label %232

94:                                               ; preds = %74
  %95 = landingpad { ptr, i32 }
          cleanup
  br label %232

.loopexit:                                        ; preds = %81
  %lpad.loopexit = landingpad { ptr, i32 }
          cleanup
  br label %232

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

96:                                               ; preds = %83
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %18) #6
  store i64 %.fca.0.extract77, ptr %18, align 8
  store i32 %.fca.1.extract78, ptr %.sroa.883.0..sroa_idx, align 8
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %19) #6
  store i64 %.fca.0.extract, ptr %19, align 8
  store i32 %.fca.1.extract, ptr %.sroa.8.0..sroa_idx, align 8
  %97 = add nsw i32 %.sroa.081.sroa.0.0.extract.trunc, 1
  %98 = srem i32 %97, 4
  store i32 %98, ptr %18, align 8, !tbaa !13
  %99 = add nsw i32 %.sroa.075.sroa.0.0.extract.trunc, 1
  %100 = srem i32 %99, 4
  store i32 %100, ptr %19, align 8, !tbaa !13
  %.sroa.071.0.copyload = load i64, ptr %18, align 8
  %101 = call noundef i32 @_Z4packSt4pairIiS_IiiEE(i64 %.sroa.071.0.copyload, i32 %.fca.1.extract78)
  %102 = sext i32 %101 to i64
  %.sroa.067.0.copyload = load i64, ptr %19, align 8
  %.sroa.268.0.copyload = load i32, ptr %.sroa.8.0..sroa_idx, align 8
  %103 = call noundef i32 @_Z4packSt4pairIiS_IiiEE(i64 %.sroa.067.0.copyload, i32 %.sroa.268.0.copyload)
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [1600 x [1600 x i32]], ptr @dp, i64 0, i64 %102, i64 %104
  %106 = load i32, ptr %105, align 4, !tbaa !5
  %107 = icmp eq i32 %106, 0
  br i1 %107, label %108, label %120

108:                                              ; preds = %96
  %.sroa.063.0.copyload = load i64, ptr %18, align 8
  %.sroa.264.0.copyload = load i32, ptr %.sroa.883.0..sroa_idx, align 8
  %109 = call noundef i32 @_Z4packSt4pairIiS_IiiEE(i64 %.sroa.063.0.copyload, i32 %.sroa.264.0.copyload)
  %110 = sext i32 %109 to i64
  %.sroa.059.0.copyload = load i64, ptr %19, align 8
  %.sroa.260.0.copyload = load i32, ptr %.sroa.8.0..sroa_idx, align 8
  %111 = call noundef i32 @_Z4packSt4pairIiS_IiiEE(i64 %.sroa.059.0.copyload, i32 %.sroa.260.0.copyload)
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [1600 x [1600 x i32]], ptr @dp, i64 0, i64 %110, i64 %112
  store i32 -1, ptr %113, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %20) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %21) #6
  %114 = add nsw i32 %.sroa.084.0.copyload, -1
  store i32 %114, ptr %21, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %22) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %23) #6
  %.sroa.055.0.copyload = load i64, ptr %18, align 8
  %.sroa.256.0.copyload = load i32, ptr %.sroa.883.0..sroa_idx, align 8
  %115 = call noundef i32 @_Z4packSt4pairIiS_IiiEE(i64 %.sroa.055.0.copyload, i32 %.sroa.256.0.copyload)
  store i32 %115, ptr %23, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %24) #6
  %.sroa.051.0.copyload = load i64, ptr %19, align 8
  %.sroa.252.0.copyload = load i32, ptr %.sroa.8.0..sroa_idx, align 8
  %116 = call noundef i32 @_Z4packSt4pairIiS_IiiEE(i64 %.sroa.051.0.copyload, i32 %.sroa.252.0.copyload)
  store i32 %116, ptr %24, align 4, !tbaa !5
  call void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 4 dereferenceable(8) %22, ptr noundef nonnull align 4 dereferenceable(4) %23, ptr noundef nonnull align 4 dereferenceable(4) %24)
  call void @_ZNSt4pairIiS_IiiEEC2IiS0_TnNSt9enable_ifIXaaclsr5_PCCPE18_ConstructiblePairIT_T0_EEclsr5_PCCPE26_ImplicitlyConvertiblePairIS4_S5_EEEbE4typeELb1EEERKiRKS0_(ptr noundef nonnull align 4 dereferenceable(12) %20, ptr noundef nonnull align 4 dereferenceable(4) %21, ptr noundef nonnull align 4 dereferenceable(8) %22)
  invoke void @_ZNSt5queueISt4pairIiS0_IiiEESt5dequeIS2_SaIS2_EEE4pushEOS2_(ptr noundef nonnull align 8 dereferenceable(80) @q, ptr noundef nonnull align 4 dereferenceable(12) %20)
          to label %117 unwind label %118

117:                                              ; preds = %108
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %24) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %23) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %22) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %21) #6
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %20) #6
  br label %120

118:                                              ; preds = %108
  %119 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %24) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %23) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %22) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %21) #6
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %20) #6
  br label %230

120:                                              ; preds = %117, %96
  %121 = add nsw i32 %.sroa.081.sroa.0.0.extract.trunc, 3
  %122 = srem i32 %121, 4
  store i32 %122, ptr %18, align 8, !tbaa !13
  %123 = add nsw i32 %.sroa.075.sroa.0.0.extract.trunc, 3
  %124 = srem i32 %123, 4
  store i32 %124, ptr %19, align 8, !tbaa !13
  %.sroa.047.0.copyload = load i64, ptr %18, align 8
  %.sroa.248.0.copyload = load i32, ptr %.sroa.883.0..sroa_idx, align 8
  %125 = call noundef i32 @_Z4packSt4pairIiS_IiiEE(i64 %.sroa.047.0.copyload, i32 %.sroa.248.0.copyload)
  %126 = sext i32 %125 to i64
  %.sroa.043.0.copyload = load i64, ptr %19, align 8
  %.sroa.244.0.copyload = load i32, ptr %.sroa.8.0..sroa_idx, align 8
  %127 = call noundef i32 @_Z4packSt4pairIiS_IiiEE(i64 %.sroa.043.0.copyload, i32 %.sroa.244.0.copyload)
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [1600 x [1600 x i32]], ptr @dp, i64 0, i64 %126, i64 %128
  %130 = load i32, ptr %129, align 4, !tbaa !5
  %131 = icmp eq i32 %130, 0
  br i1 %131, label %132, label %144

132:                                              ; preds = %120
  %.sroa.039.0.copyload = load i64, ptr %18, align 8
  %.sroa.240.0.copyload = load i32, ptr %.sroa.883.0..sroa_idx, align 8
  %133 = call noundef i32 @_Z4packSt4pairIiS_IiiEE(i64 %.sroa.039.0.copyload, i32 %.sroa.240.0.copyload)
  %134 = sext i32 %133 to i64
  %.sroa.035.0.copyload = load i64, ptr %19, align 8
  %.sroa.236.0.copyload = load i32, ptr %.sroa.8.0..sroa_idx, align 8
  %135 = call noundef i32 @_Z4packSt4pairIiS_IiiEE(i64 %.sroa.035.0.copyload, i32 %.sroa.236.0.copyload)
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [1600 x [1600 x i32]], ptr @dp, i64 0, i64 %134, i64 %136
  store i32 -1, ptr %137, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %25) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %26) #6
  %138 = add nsw i32 %.sroa.084.0.copyload, -1
  store i32 %138, ptr %26, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %27) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %28) #6
  %.sroa.031.0.copyload = load i64, ptr %18, align 8
  %.sroa.232.0.copyload = load i32, ptr %.sroa.883.0..sroa_idx, align 8
  %139 = call noundef i32 @_Z4packSt4pairIiS_IiiEE(i64 %.sroa.031.0.copyload, i32 %.sroa.232.0.copyload)
  store i32 %139, ptr %28, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %29) #6
  %.sroa.027.0.copyload = load i64, ptr %19, align 8
  %.sroa.228.0.copyload = load i32, ptr %.sroa.8.0..sroa_idx, align 8
  %140 = call noundef i32 @_Z4packSt4pairIiS_IiiEE(i64 %.sroa.027.0.copyload, i32 %.sroa.228.0.copyload)
  store i32 %140, ptr %29, align 4, !tbaa !5
  call void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 4 dereferenceable(8) %27, ptr noundef nonnull align 4 dereferenceable(4) %28, ptr noundef nonnull align 4 dereferenceable(4) %29)
  call void @_ZNSt4pairIiS_IiiEEC2IiS0_TnNSt9enable_ifIXaaclsr5_PCCPE18_ConstructiblePairIT_T0_EEclsr5_PCCPE26_ImplicitlyConvertiblePairIS4_S5_EEEbE4typeELb1EEERKiRKS0_(ptr noundef nonnull align 4 dereferenceable(12) %25, ptr noundef nonnull align 4 dereferenceable(4) %26, ptr noundef nonnull align 4 dereferenceable(8) %27)
  invoke void @_ZNSt5queueISt4pairIiS0_IiiEESt5dequeIS2_SaIS2_EEE4pushEOS2_(ptr noundef nonnull align 8 dereferenceable(80) @q, ptr noundef nonnull align 4 dereferenceable(12) %25)
          to label %141 unwind label %142

141:                                              ; preds = %132
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %29) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %28) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %27) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %26) #6
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %25) #6
  br label %144

142:                                              ; preds = %132
  %143 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %29) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %28) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %27) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %26) #6
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %25) #6
  br label %230

144:                                              ; preds = %141, %120
  store i32 %.sroa.081.sroa.0.0.extract.trunc, ptr %18, align 8, !tbaa !13
  store i32 %.sroa.075.sroa.0.0.extract.trunc, ptr %19, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %30) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %31) #6
  %145 = load i32, ptr @N, align 4, !tbaa !5
  %146 = add nsw i32 %145, -1
  store i32 %146, ptr %31, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %32) #6
  store i32 %146, ptr %32, align 4, !tbaa !5
  %147 = invoke i64 @_ZSt9make_pairIiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS1_INS2_IT0_E4typeEE6__typeEEOS3_OS8_(ptr noundef nonnull align 4 dereferenceable(4) %31, ptr noundef nonnull align 4 dereferenceable(4) %32)
          to label %148 unwind label %175

148:                                              ; preds = %144
  store i64 %147, ptr %30, align 8
  %149 = invoke noundef zeroext i1 @_ZStneIiiEbRKSt4pairIT_T0_ES5_(ptr noundef nonnull align 4 dereferenceable(8) %72, ptr noundef nonnull align 4 dereferenceable(8) %30)
          to label %150 unwind label %175

150:                                              ; preds = %148
  br i1 %149, label %151, label %.critedge

151:                                              ; preds = %150
  %152 = load i32, ptr %72, align 4, !tbaa !16
  %153 = load i32, ptr %18, align 8, !tbaa !13
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds [4 x i32], ptr @xdir, i64 0, i64 %154
  %156 = load i32, ptr %155, align 4, !tbaa !5
  %157 = add nsw i32 %156, %152
  %158 = load i32, ptr %.sroa.883.0..sroa_idx, align 8, !tbaa !17
  %159 = getelementptr inbounds [4 x i32], ptr @ydir, i64 0, i64 %154
  %160 = load i32, ptr %159, align 4, !tbaa !5
  %161 = add nsw i32 %160, %158
  %162 = call noundef zeroext i1 @_Z5validii(i32 noundef %157, i32 noundef %161)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %32) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %31) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %30) #6
  br i1 %162, label %163, label %177

163:                                              ; preds = %151
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %33) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %34) #6
  %164 = load i32, ptr %72, align 4, !tbaa !16
  %165 = load i32, ptr %18, align 8, !tbaa !13
  %166 = sext i32 %165 to i64
  %167 = getelementptr inbounds [4 x i32], ptr @xdir, i64 0, i64 %166
  %168 = load i32, ptr %167, align 4, !tbaa !5
  %169 = add nsw i32 %168, %164
  store i32 %169, ptr %34, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %35) #6
  %170 = load i32, ptr %.sroa.883.0..sroa_idx, align 8, !tbaa !17
  %171 = getelementptr inbounds [4 x i32], ptr @ydir, i64 0, i64 %166
  %172 = load i32, ptr %171, align 4, !tbaa !5
  %173 = add nsw i32 %172, %170
  store i32 %173, ptr %35, align 4, !tbaa !5
  call void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 4 dereferenceable(8) %33, ptr noundef nonnull align 4 dereferenceable(4) %34, ptr noundef nonnull align 4 dereferenceable(4) %35)
  %174 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %72, ptr noundef nonnull align 4 dereferenceable(8) %33) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %35) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %34) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %33) #6
  br label %177

175:                                              ; preds = %148, %144
  %176 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %32) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %31) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %30) #6
  br label %230

.critedge:                                        ; preds = %150
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %32) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %31) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %30) #6
  br label %177

177:                                              ; preds = %.critedge, %163, %151
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %36) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %37) #6
  %178 = load i32, ptr @N, align 4, !tbaa !5
  %179 = add nsw i32 %178, -1
  store i32 %179, ptr %37, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %38) #6
  store i32 %179, ptr %38, align 4, !tbaa !5
  %180 = invoke i64 @_ZSt9make_pairIiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS1_INS2_IT0_E4typeEE6__typeEEOS3_OS8_(ptr noundef nonnull align 4 dereferenceable(4) %37, ptr noundef nonnull align 4 dereferenceable(4) %38)
          to label %181 unwind label %208

181:                                              ; preds = %177
  store i64 %180, ptr %36, align 8
  %182 = invoke noundef zeroext i1 @_ZStneIiiEbRKSt4pairIT_T0_ES5_(ptr noundef nonnull align 4 dereferenceable(8) %73, ptr noundef nonnull align 4 dereferenceable(8) %36)
          to label %183 unwind label %208

183:                                              ; preds = %181
  br i1 %182, label %184, label %.critedge2

184:                                              ; preds = %183
  %185 = load i32, ptr %73, align 4, !tbaa !16
  %186 = load i32, ptr %19, align 8, !tbaa !13
  %187 = sext i32 %186 to i64
  %188 = getelementptr inbounds [4 x i32], ptr @xdir, i64 0, i64 %187
  %189 = load i32, ptr %188, align 4, !tbaa !5
  %190 = add nsw i32 %189, %185
  %191 = load i32, ptr %.sroa.8.0..sroa_idx, align 8, !tbaa !17
  %192 = getelementptr inbounds [4 x i32], ptr @ydir, i64 0, i64 %187
  %193 = load i32, ptr %192, align 4, !tbaa !5
  %194 = add nsw i32 %193, %191
  %195 = call noundef zeroext i1 @_Z5validii(i32 noundef %190, i32 noundef %194)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %38) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %37) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %36) #6
  br i1 %195, label %196, label %210

196:                                              ; preds = %184
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %39) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %40) #6
  %197 = load i32, ptr %73, align 4, !tbaa !16
  %198 = load i32, ptr %19, align 8, !tbaa !13
  %199 = sext i32 %198 to i64
  %200 = getelementptr inbounds [4 x i32], ptr @xdir, i64 0, i64 %199
  %201 = load i32, ptr %200, align 4, !tbaa !5
  %202 = add nsw i32 %201, %197
  store i32 %202, ptr %40, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %41) #6
  %203 = load i32, ptr %.sroa.8.0..sroa_idx, align 8, !tbaa !17
  %204 = getelementptr inbounds [4 x i32], ptr @ydir, i64 0, i64 %199
  %205 = load i32, ptr %204, align 4, !tbaa !5
  %206 = add nsw i32 %205, %203
  store i32 %206, ptr %41, align 4, !tbaa !5
  call void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 4 dereferenceable(8) %39, ptr noundef nonnull align 4 dereferenceable(4) %40, ptr noundef nonnull align 4 dereferenceable(4) %41)
  %207 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %73, ptr noundef nonnull align 4 dereferenceable(8) %39) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %41) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %40) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %39) #6
  br label %210

208:                                              ; preds = %181, %177
  %209 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %38) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %37) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %36) #6
  br label %230

.critedge2:                                       ; preds = %183
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %38) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %37) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %36) #6
  br label %210

210:                                              ; preds = %.critedge2, %196, %184
  %.sroa.023.0.copyload = load i64, ptr %18, align 8
  %.sroa.224.0.copyload = load i32, ptr %.sroa.883.0..sroa_idx, align 8
  %211 = call noundef i32 @_Z4packSt4pairIiS_IiiEE(i64 %.sroa.023.0.copyload, i32 %.sroa.224.0.copyload)
  %212 = sext i32 %211 to i64
  %.sroa.019.0.copyload = load i64, ptr %19, align 8
  %.sroa.220.0.copyload = load i32, ptr %.sroa.8.0..sroa_idx, align 8
  %213 = call noundef i32 @_Z4packSt4pairIiS_IiiEE(i64 %.sroa.019.0.copyload, i32 %.sroa.220.0.copyload)
  %214 = sext i32 %213 to i64
  %215 = getelementptr inbounds [1600 x [1600 x i32]], ptr @dp, i64 0, i64 %212, i64 %214
  %216 = load i32, ptr %215, align 4, !tbaa !5
  %217 = icmp eq i32 %216, 0
  br i1 %217, label %218, label %.critedge124

218:                                              ; preds = %210
  %.sroa.015.0.copyload = load i64, ptr %18, align 8
  %.sroa.216.0.copyload = load i32, ptr %.sroa.883.0..sroa_idx, align 8
  %219 = call noundef i32 @_Z4packSt4pairIiS_IiiEE(i64 %.sroa.015.0.copyload, i32 %.sroa.216.0.copyload)
  %220 = sext i32 %219 to i64
  %.sroa.011.0.copyload = load i64, ptr %19, align 8
  %.sroa.212.0.copyload = load i32, ptr %.sroa.8.0..sroa_idx, align 8
  %221 = call noundef i32 @_Z4packSt4pairIiS_IiiEE(i64 %.sroa.011.0.copyload, i32 %.sroa.212.0.copyload)
  %222 = sext i32 %221 to i64
  %223 = getelementptr inbounds [1600 x [1600 x i32]], ptr @dp, i64 0, i64 %220, i64 %222
  store i32 -1, ptr %223, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %42) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %43) #6
  %224 = add nsw i32 %.sroa.084.0.copyload, -1
  store i32 %224, ptr %43, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %44) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %45) #6
  %.sroa.07.0.copyload = load i64, ptr %18, align 8
  %.sroa.28.0.copyload = load i32, ptr %.sroa.883.0..sroa_idx, align 8
  %225 = call noundef i32 @_Z4packSt4pairIiS_IiiEE(i64 %.sroa.07.0.copyload, i32 %.sroa.28.0.copyload)
  store i32 %225, ptr %45, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %46) #6
  %.sroa.03.0.copyload = load i64, ptr %19, align 8
  %.sroa.24.0.copyload = load i32, ptr %.sroa.8.0..sroa_idx, align 8
  %226 = call noundef i32 @_Z4packSt4pairIiS_IiiEE(i64 %.sroa.03.0.copyload, i32 %.sroa.24.0.copyload)
  store i32 %226, ptr %46, align 4, !tbaa !5
  call void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 4 dereferenceable(8) %44, ptr noundef nonnull align 4 dereferenceable(4) %45, ptr noundef nonnull align 4 dereferenceable(4) %46)
  call void @_ZNSt4pairIiS_IiiEEC2IiS0_TnNSt9enable_ifIXaaclsr5_PCCPE18_ConstructiblePairIT_T0_EEclsr5_PCCPE26_ImplicitlyConvertiblePairIS4_S5_EEEbE4typeELb1EEERKiRKS0_(ptr noundef nonnull align 4 dereferenceable(12) %42, ptr noundef nonnull align 4 dereferenceable(4) %43, ptr noundef nonnull align 4 dereferenceable(8) %44)
  invoke void @_ZNSt5queueISt4pairIiS0_IiiEESt5dequeIS2_SaIS2_EEE4pushEOS2_(ptr noundef nonnull align 8 dereferenceable(80) @q, ptr noundef nonnull align 4 dereferenceable(12) %42)
          to label %227 unwind label %228

227:                                              ; preds = %218
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %46) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %45) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %44) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %43) #6
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %42) #6
  br label %.critedge124

228:                                              ; preds = %218
  %229 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %46) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %45) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %44) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %43) #6
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %42) #6
  br label %230

.critedge124:                                     ; preds = %227, %210
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %19) #6
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %18) #6
  br label %74

230:                                              ; preds = %228, %208, %175, %142, %118
  %.pn = phi { ptr, i32 } [ %229, %228 ], [ %209, %208 ], [ %176, %175 ], [ %143, %142 ], [ %119, %118 ]
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %19) #6
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %18) #6
  br label %232

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

232:                                              ; preds = %.loopexit, %.loopexit.split-lp, %94, %230, %92, %69, %61
  %.pn118 = phi { ptr, i32 } [ %70, %69 ], [ %93, %92 ], [ %62, %61 ], [ %95, %94 ], [ %.pn, %230 ], [ %lpad.loopexit, %.loopexit ], [ %lpad.loopexit.split-lp, %.loopexit.split-lp ]
  call void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(248) %2) #6
  br label %233

233:                                              ; preds = %232, %59
  %.pn118.pn = phi { ptr, i32 } [ %.pn118, %232 ], [ %60, %59 ]
  call void @llvm.lifetime.end.p0(i64 512, ptr nonnull %2) #6
  call void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(256) %1) #6
  call void @llvm.lifetime.end.p0(i64 520, ptr nonnull %1) #6
  resume { ptr, i32 } %.pn118.pn
}

; Function Attrs: mustprogress uwtable
declare void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(256), ptr noundef, i32 noundef) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(248), ptr noundef, i32 noundef) unnamed_addr #1 align 2

declare i32 @__gxx_personality_v0(...)

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #4

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZStneIiiEbRKSt4pairIT_T0_ES5_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #5

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS1_INS2_IT0_E4typeEE6__typeEEOS3_OS8_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1

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

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

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

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


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