; LLVM IR from kazunetakahashi/atcoder :: 201510_201609/0131 (ARC005_C)

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

%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%struct.point = type { i32, i32 }
%"class.std::stack" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<state, std::allocator<state>>::_Deque_impl" }
%"struct.std::_Deque_base<state, std::allocator<state>>::_Deque_impl" = type { %"struct.std::_Deque_base<state, std::allocator<state>>::_Deque_impl_data" }
%"struct.std::_Deque_base<state, std::allocator<state>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }
%struct.state = type { %struct.point, i32 }

@H = external dso_local global i32, align 4
@W = external dso_local global i32, align 4
@_Z1cB5cxx11 = external dso_local global [510 x %"class.std::__cxx11::basic_string"], align 16
@visited = external dso_local global [510 x [510 x i32]], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [4 x i8], align 1
@_ZL2dx = external hidden constant [4 x i32], align 16
@_ZL2dy = external hidden constant [4 x i32], align 16
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z5visit5state(i64, i32) #1

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca %struct.point, align 4
  %4 = alloca %struct.point, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca %"class.std::stack", align 8
  %9 = alloca %struct.state, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca %struct.state, align 4
  %14 = alloca %struct.state, align 4
  %15 = alloca { i64, i32 }, align 4
  %16 = alloca i32, align 4
  %17 = alloca %struct.state, align 4
  %18 = alloca i32, align 4
  %19 = alloca %struct.point, align 4
  %20 = alloca %struct.state, align 4
  %21 = alloca { i64, i32 }, align 4
  store i32 0, ptr %1, align 4
  %22 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @H)
  %23 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %22, ptr noundef nonnull align 4 dereferenceable(4) @W)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #8
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %24

24:                                               ; preds = %34, %0
  %25 = load i32, ptr %2, align 4, !tbaa !5
  %26 = load i32, ptr @H, align 4, !tbaa !5
  %27 = icmp slt i32 %25, %26
  br i1 %27, label %29, label %28

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

29:                                               ; preds = %24
  %30 = load i32, ptr %2, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [510 x %"class.std::__cxx11::basic_string"], ptr @_Z1cB5cxx11, i64 0, i64 %31
  %33 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(32) %32)
  br label %34

34:                                               ; preds = %29
  %35 = load i32, ptr %2, align 4, !tbaa !5
  %36 = add nsw i32 %35, 1
  store i32 %36, ptr %2, align 4, !tbaa !5
  br label %24, !llvm.loop !9

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

38:                                               ; preds = %85, %37
  %39 = load i32, ptr %5, align 4, !tbaa !5
  %40 = load i32, ptr @H, align 4, !tbaa !5
  %41 = icmp slt i32 %39, %40
  br i1 %41, label %43, label %42

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

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

44:                                               ; preds = %81, %43
  %45 = load i32, ptr %7, align 4, !tbaa !5
  %46 = load i32, ptr @W, align 4, !tbaa !5
  %47 = icmp slt i32 %45, %46
  br i1 %47, label %49, label %48

48:                                               ; preds = %44
  store i32 8, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #8
  br label %84

49:                                               ; preds = %44
  %50 = load i32, ptr %5, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [510 x %"class.std::__cxx11::basic_string"], ptr @_Z1cB5cxx11, i64 0, i64 %51
  %53 = load i32, ptr %7, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %52, i64 noundef %54)
  %56 = load i8, ptr %55, align 1, !tbaa !11
  %57 = sext i8 %56 to i32
  %58 = icmp eq i32 %57, 115
  br i1 %58, label %59, label %64

59:                                               ; preds = %49
  %60 = load i32, ptr %5, align 4, !tbaa !5
  %61 = getelementptr inbounds %struct.point, ptr %3, i32 0, i32 0
  store i32 %60, ptr %61, align 4, !tbaa !12
  %62 = load i32, ptr %7, align 4, !tbaa !5
  %63 = getelementptr inbounds %struct.point, ptr %3, i32 0, i32 1
  store i32 %62, ptr %63, align 4, !tbaa !14
  br label %80

64:                                               ; preds = %49
  %65 = load i32, ptr %5, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [510 x %"class.std::__cxx11::basic_string"], ptr @_Z1cB5cxx11, i64 0, i64 %66
  %68 = load i32, ptr %7, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %67, i64 noundef %69)
  %71 = load i8, ptr %70, align 1, !tbaa !11
  %72 = sext i8 %71 to i32
  %73 = icmp eq i32 %72, 103
  br i1 %73, label %74, label %79

74:                                               ; preds = %64
  %75 = load i32, ptr %5, align 4, !tbaa !5
  %76 = getelementptr inbounds %struct.point, ptr %4, i32 0, i32 0
  store i32 %75, ptr %76, align 4, !tbaa !12
  %77 = load i32, ptr %7, align 4, !tbaa !5
  %78 = getelementptr inbounds %struct.point, ptr %4, i32 0, i32 1
  store i32 %77, ptr %78, align 4, !tbaa !14
  br label %79

79:                                               ; preds = %74, %64
  br label %80

80:                                               ; preds = %79, %59
  br label %81

81:                                               ; preds = %80
  %82 = load i32, ptr %7, align 4, !tbaa !5
  %83 = add nsw i32 %82, 1
  store i32 %83, ptr %7, align 4, !tbaa !5
  br label %44, !llvm.loop !15

84:                                               ; preds = %48
  br label %85

85:                                               ; preds = %84
  %86 = load i32, ptr %5, align 4, !tbaa !5
  %87 = add nsw i32 %86, 1
  store i32 %87, ptr %5, align 4, !tbaa !5
  br label %38, !llvm.loop !16

88:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 80, ptr %8) #8
  call void @_ZNSt5stackI5stateSt5dequeIS0_SaIS0_EEEC2IS3_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %8)
  call void @llvm.lifetime.start.p0(i64 12, ptr %9) #8
  call void @_ZN5stateC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %9) #8
  %89 = getelementptr inbounds %struct.state, ptr %9, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %89, ptr align 4 %3, i64 8, i1 false), !tbaa.struct !17
  %90 = getelementptr inbounds %struct.state, ptr %9, i32 0, i32 1
  store i32 0, ptr %90, align 4, !tbaa !18
  invoke void @_ZNSt5stackI5stateSt5dequeIS0_SaIS0_EEE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(80) %8, ptr noundef nonnull align 4 dereferenceable(12) %9)
          to label %91 unwind label %137

91:                                               ; preds = %88
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  store i32 3, ptr %12, align 4, !tbaa !5
  invoke void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef @visited, ptr noundef getelementptr inbounds (i32, ptr @visited, i64 260100), ptr noundef nonnull align 4 dereferenceable(4) %12)
          to label %92 unwind label %141

92:                                               ; preds = %91
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  br label %93

93:                                               ; preds = %211, %92
  %94 = invoke noundef zeroext i1 @_ZNKSt5stackI5stateSt5dequeIS0_SaIS0_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %8)
          to label %95 unwind label %137

95:                                               ; preds = %93
  %96 = xor i1 %94, true
  br i1 %96, label %97, label %213

97:                                               ; preds = %95
  call void @llvm.lifetime.start.p0(i64 12, ptr %13) #8
  %98 = invoke noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt5stackI5stateSt5dequeIS0_SaIS0_EEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %8)
          to label %99 unwind label %145

99:                                               ; preds = %97
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %13, ptr align 4 %98, i64 12, i1 false), !tbaa.struct !20
  invoke void @_ZNSt5stackI5stateSt5dequeIS0_SaIS0_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %8)
          to label %100 unwind label %145

100:                                              ; preds = %99
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %14, ptr align 4 %13, i64 12, i1 false), !tbaa.struct !20
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %15, ptr align 4 %14, i64 12, i1 false)
  %101 = getelementptr inbounds { i64, i32 }, ptr %15, i32 0, i32 0
  %102 = load i64, ptr %101, align 4
  %103 = getelementptr inbounds { i64, i32 }, ptr %15, i32 0, i32 1
  %104 = load i32, ptr %103, align 4
  %105 = call noundef zeroext i1 @_Z5visit5state(i64 %102, i32 %104)
  br i1 %105, label %106, label %208

106:                                              ; preds = %100
  %107 = getelementptr inbounds %struct.state, ptr %13, i32 0, i32 1
  %108 = load i32, ptr %107, align 4, !tbaa !18
  %109 = getelementptr inbounds %struct.state, ptr %13, i32 0, i32 0
  %110 = getelementptr inbounds %struct.point, ptr %109, i32 0, i32 0
  %111 = load i32, ptr %110, align 4, !tbaa !21
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [510 x [510 x i32]], ptr @visited, i64 0, i64 %112
  %114 = getelementptr inbounds %struct.state, ptr %13, i32 0, i32 0
  %115 = getelementptr inbounds %struct.point, ptr %114, i32 0, i32 1
  %116 = load i32, ptr %115, align 4, !tbaa !22
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [510 x i32], ptr %113, i64 0, i64 %117
  store i32 %108, ptr %118, align 4, !tbaa !5
  %119 = getelementptr inbounds %struct.state, ptr %13, i32 0, i32 0
  %120 = getelementptr inbounds %struct.point, ptr %119, i32 0, i32 0
  %121 = load i32, ptr %120, align 4, !tbaa !21
  %122 = getelementptr inbounds %struct.point, ptr %4, i32 0, i32 0
  %123 = load i32, ptr %122, align 4, !tbaa !12
  %124 = icmp eq i32 %121, %123
  br i1 %124, label %125, label %149

125:                                              ; preds = %106
  %126 = getelementptr inbounds %struct.state, ptr %13, i32 0, i32 0
  %127 = getelementptr inbounds %struct.point, ptr %126, i32 0, i32 1
  %128 = load i32, ptr %127, align 4, !tbaa !22
  %129 = getelementptr inbounds %struct.point, ptr %4, i32 0, i32 1
  %130 = load i32, ptr %129, align 4, !tbaa !14
  %131 = icmp eq i32 %128, %130
  br i1 %131, label %132, label %149

132:                                              ; preds = %125
  %133 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
          to label %134 unwind label %145

134:                                              ; preds = %132
  %135 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %133, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %136 unwind label %145

136:                                              ; preds = %134
  store i32 0, ptr %1, align 4
  store i32 1, ptr %6, align 4
  br label %209

137:                                              ; preds = %215, %213, %93, %88
  %138 = landingpad { ptr, i32 }
          cleanup
  %139 = extractvalue { ptr, i32 } %138, 0
  store ptr %139, ptr %10, align 8
  %140 = extractvalue { ptr, i32 } %138, 1
  store i32 %140, ptr %11, align 4
  br label %222

141:                                              ; preds = %91
  %142 = landingpad { ptr, i32 }
          cleanup
  %143 = extractvalue { ptr, i32 } %142, 0
  store ptr %143, ptr %10, align 8
  %144 = extractvalue { ptr, i32 } %142, 1
  store i32 %144, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  br label %222

145:                                              ; preds = %134, %132, %99, %97
  %146 = landingpad { ptr, i32 }
          cleanup
  %147 = extractvalue { ptr, i32 } %146, 0
  store ptr %147, ptr %10, align 8
  %148 = extractvalue { ptr, i32 } %146, 1
  store i32 %148, ptr %11, align 4
  br label %212

149:                                              ; preds = %125, %106
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #8
  store i32 0, ptr %16, align 4, !tbaa !5
  br label %150

150:                                              ; preds = %204, %149
  %151 = load i32, ptr %16, align 4, !tbaa !5
  %152 = icmp slt i32 %151, 4
  br i1 %152, label %154, label %153

153:                                              ; preds = %150
  store i32 13, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #8
  br label %207

154:                                              ; preds = %150
  call void @llvm.lifetime.start.p0(i64 12, ptr %17) #8
  call void @_ZN5stateC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %17) #8
  %155 = getelementptr inbounds %struct.state, ptr %13, i32 0, i32 0
  %156 = getelementptr inbounds %struct.point, ptr %155, i32 0, i32 0
  %157 = load i32, ptr %156, align 4, !tbaa !21
  %158 = load i32, ptr %16, align 4, !tbaa !5
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds [4 x i32], ptr @_ZL2dx, i64 0, i64 %159
  %161 = load i32, ptr %160, align 4, !tbaa !5
  %162 = add nsw i32 %157, %161
  %163 = getelementptr inbounds %struct.state, ptr %17, i32 0, i32 0
  %164 = getelementptr inbounds %struct.point, ptr %163, i32 0, i32 0
  store i32 %162, ptr %164, align 4, !tbaa !21
  %165 = getelementptr inbounds %struct.state, ptr %13, i32 0, i32 0
  %166 = getelementptr inbounds %struct.point, ptr %165, i32 0, i32 1
  %167 = load i32, ptr %166, align 4, !tbaa !22
  %168 = load i32, ptr %16, align 4, !tbaa !5
  %169 = sext i32 %168 to i64
  %170 = getelementptr inbounds [4 x i32], ptr @_ZL2dy, i64 0, i64 %169
  %171 = load i32, ptr %170, align 4, !tbaa !5
  %172 = add nsw i32 %167, %171
  %173 = getelementptr inbounds %struct.state, ptr %17, i32 0, i32 0
  %174 = getelementptr inbounds %struct.point, ptr %173, i32 0, i32 1
  store i32 %172, ptr %174, align 4, !tbaa !22
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #8
  %175 = getelementptr inbounds %struct.state, ptr %17, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %19, ptr align 4 %175, i64 8, i1 false), !tbaa.struct !17
  %176 = load i64, ptr %19, align 4
  %177 = invoke noundef i32 @_Z5valid5point(i64 %176)
          to label %178 unwind label %182

178:                                              ; preds = %154
  store i32 %177, ptr %18, align 4, !tbaa !5
  %179 = load i32, ptr %18, align 4, !tbaa !5
  %180 = icmp eq i32 %179, -1
  br i1 %180, label %181, label %186

181:                                              ; preds = %178
  store i32 15, ptr %6, align 4
  br label %201

182:                                              ; preds = %197, %154
  %183 = landingpad { ptr, i32 }
          cleanup
  %184 = extractvalue { ptr, i32 } %183, 0
  store ptr %184, ptr %10, align 8
  %185 = extractvalue { ptr, i32 } %183, 1
  store i32 %185, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #8
  br label %212

186:                                              ; preds = %178
  %187 = getelementptr inbounds %struct.state, ptr %13, i32 0, i32 1
  %188 = load i32, ptr %187, align 4, !tbaa !18
  %189 = load i32, ptr %18, align 4, !tbaa !5
  %190 = add nsw i32 %188, %189
  %191 = getelementptr inbounds %struct.state, ptr %17, i32 0, i32 1
  store i32 %190, ptr %191, align 4, !tbaa !18
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %20, ptr align 4 %17, i64 12, i1 false), !tbaa.struct !20
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %21, ptr align 4 %20, i64 12, i1 false)
  %192 = getelementptr inbounds { i64, i32 }, ptr %21, i32 0, i32 0
  %193 = load i64, ptr %192, align 4
  %194 = getelementptr inbounds { i64, i32 }, ptr %21, i32 0, i32 1
  %195 = load i32, ptr %194, align 4
  %196 = call noundef zeroext i1 @_Z5visit5state(i64 %193, i32 %195)
  br i1 %196, label %197, label %199

197:                                              ; preds = %186
  invoke void @_ZNSt5stackI5stateSt5dequeIS0_SaIS0_EEE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(80) %8, ptr noundef nonnull align 4 dereferenceable(12) %17)
          to label %198 unwind label %182

198:                                              ; preds = %197
  br label %199

199:                                              ; preds = %198, %186
  br label %200

200:                                              ; preds = %199
  store i32 0, ptr %6, align 4
  br label %201

201:                                              ; preds = %200, %181
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %17) #8
  %202 = load i32, ptr %6, align 4
  switch i32 %202, label %228 [
    i32 0, label %203
    i32 15, label %204
  ]

203:                                              ; preds = %201
  br label %204

204:                                              ; preds = %203, %201
  %205 = load i32, ptr %16, align 4, !tbaa !5
  %206 = add nsw i32 %205, 1
  store i32 %206, ptr %16, align 4, !tbaa !5
  br label %150, !llvm.loop !23

207:                                              ; preds = %153
  br label %208

208:                                              ; preds = %207, %100
  store i32 0, ptr %6, align 4
  br label %209

209:                                              ; preds = %208, %136
  call void @llvm.lifetime.end.p0(i64 12, ptr %13) #8
  %210 = load i32, ptr %6, align 4
  switch i32 %210, label %218 [
    i32 0, label %211
  ]

211:                                              ; preds = %209
  br label %93, !llvm.loop !24

212:                                              ; preds = %182, %145
  call void @llvm.lifetime.end.p0(i64 12, ptr %13) #8
  br label %222

213:                                              ; preds = %95
  %214 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.2)
          to label %215 unwind label %137

215:                                              ; preds = %213
  %216 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %214, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %217 unwind label %137

217:                                              ; preds = %215
  store i32 0, ptr %6, align 4
  br label %218

218:                                              ; preds = %217, %209
  call void @llvm.lifetime.end.p0(i64 12, ptr %9) #8
  call void @_ZNSt5stackI5stateSt5dequeIS0_SaIS0_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %8) #8
  call void @llvm.lifetime.end.p0(i64 80, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #8
  %219 = load i32, ptr %6, align 4
  switch i32 %219, label %228 [
    i32 0, label %220
    i32 1, label %220
  ]

220:                                              ; preds = %218, %218
  %221 = load i32, ptr %1, align 4
  ret i32 %221

222:                                              ; preds = %212, %141, %137
  call void @llvm.lifetime.end.p0(i64 12, ptr %9) #8
  call void @_ZNSt5stackI5stateSt5dequeIS0_SaIS0_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %8) #8
  call void @llvm.lifetime.end.p0(i64 80, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #8
  br label %223

223:                                              ; preds = %222
  %224 = load ptr, ptr %10, align 8
  %225 = load i32, ptr %11, align 4
  %226 = insertvalue { ptr, i32 } poison, ptr %224, 0
  %227 = insertvalue { ptr, i32 } %226, i32 %225, 1
  resume { ptr, i32 } %227

228:                                              ; preds = %218, %201
  unreachable
}

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

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN5stateC2Ev(ptr noundef nonnull align 4 dereferenceable(12)) unnamed_addr #6 align 2

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

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

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

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

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

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

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


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

%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::stack" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<state, std::allocator<state>>::_Deque_impl" }
%"struct.std::_Deque_base<state, std::allocator<state>>::_Deque_impl" = type { %"struct.std::_Deque_base<state, std::allocator<state>>::_Deque_impl_data" }
%"struct.std::_Deque_base<state, std::allocator<state>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }
%struct.state = type { %struct.point, i32 }
%struct.point = type { i32, i32 }

@H = external dso_local global i32, align 4
@W = external dso_local global i32, align 4
@_Z1cB5cxx11 = external dso_local global [510 x %"class.std::__cxx11::basic_string"], align 16
@visited = external dso_local global [510 x [510 x i32]], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [4 x i8], align 1
@_ZL2dx = external hidden local_unnamed_addr constant [4 x i32], align 16
@_ZL2dy = external hidden local_unnamed_addr constant [4 x i32], align 16
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z5visit5state(i64, i32) local_unnamed_addr #1

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

.preheader58:                                     ; preds = %.lr.ph
  %9 = icmp sgt i32 %14, 0
  %10 = load i32, ptr @W, align 4
  %11 = icmp sgt i32 %10, 0
  %or.cond99 = select i1 %9, i1 %11, i1 false
  br i1 %or.cond99, label %.preheader57, label %._crit_edge74

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %12 = getelementptr inbounds [510 x %"class.std::__cxx11::basic_string"], ptr @_Z1cB5cxx11, i64 0, i64 %indvars.iv
  %13 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(32) %12)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %14 = load i32, ptr @H, align 4, !tbaa !5
  %15 = sext i32 %14 to i64
  %16 = icmp slt i64 %indvars.iv.next, %15
  br i1 %16, label %.lr.ph, label %.preheader58, !llvm.loop !9

.preheader57:                                     ; preds = %.preheader58, %._crit_edge
  %17 = phi i32 [ %23, %._crit_edge ], [ %14, %.preheader58 ]
  %18 = phi i32 [ %24, %._crit_edge ], [ %10, %.preheader58 ]
  %indvars.iv91 = phi i64 [ %indvars.iv.next92, %._crit_edge ], [ 0, %.preheader58 ]
  %.sroa.538.073 = phi i32 [ %.sroa.538.1.lcssa, %._crit_edge ], [ undef, %.preheader58 ]
  %.sroa.037.072 = phi i32 [ %.sroa.037.1.lcssa, %._crit_edge ], [ undef, %.preheader58 ]
  %.sroa.5.071 = phi i32 [ %.sroa.5.1.lcssa, %._crit_edge ], [ undef, %.preheader58 ]
  %.sroa.036.070 = phi i32 [ %.sroa.036.1.lcssa, %._crit_edge ], [ undef, %.preheader58 ]
  %19 = icmp sgt i32 %18, 0
  br i1 %19, label %.lr.ph65, label %._crit_edge

.lr.ph65:                                         ; preds = %.preheader57
  %20 = getelementptr inbounds [510 x %"class.std::__cxx11::basic_string"], ptr @_Z1cB5cxx11, i64 0, i64 %indvars.iv91
  %21 = trunc nuw nsw i64 %indvars.iv91 to i32
  br label %27

._crit_edge74:                                    ; preds = %._crit_edge, %0, %.preheader58
  %.sroa.036.0.lcssa = phi i32 [ undef, %.preheader58 ], [ undef, %0 ], [ %.sroa.036.1.lcssa, %._crit_edge ]
  %.sroa.5.0.lcssa = phi i32 [ undef, %.preheader58 ], [ undef, %0 ], [ %.sroa.5.1.lcssa, %._crit_edge ]
  %.sroa.037.0.lcssa = phi i32 [ undef, %.preheader58 ], [ undef, %0 ], [ %.sroa.037.1.lcssa, %._crit_edge ]
  %.sroa.538.0.lcssa = phi i32 [ undef, %.preheader58 ], [ undef, %0 ], [ %.sroa.538.1.lcssa, %._crit_edge ]
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %1) #7
  call void @_ZNSt5stackI5stateSt5dequeIS0_SaIS0_EEEC2IS3_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %1)
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %2) #7
  call void @_ZN5stateC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %2) #7
  store i32 %.sroa.037.0.lcssa, ptr %2, align 4, !tbaa !5
  %.sroa.538.0..sroa_idx = getelementptr inbounds i8, ptr %2, i64 4
  store i32 %.sroa.538.0.lcssa, ptr %.sroa.538.0..sroa_idx, align 4, !tbaa !5
  %22 = getelementptr inbounds i8, ptr %2, i64 8
  store i32 0, ptr %22, align 4, !tbaa !11
  invoke void @_ZNSt5stackI5stateSt5dequeIS0_SaIS0_EEE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(80) %1, ptr noundef nonnull align 4 dereferenceable(12) %2)
          to label %40 unwind label %69

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

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader57
  %23 = phi i32 [ %17, %.preheader57 ], [ %.pre, %._crit_edge.loopexit ]
  %24 = phi i32 [ %18, %.preheader57 ], [ %37, %._crit_edge.loopexit ]
  %.sroa.036.1.lcssa = phi i32 [ %.sroa.036.070, %.preheader57 ], [ %.sroa.036.2, %._crit_edge.loopexit ]
  %.sroa.5.1.lcssa = phi i32 [ %.sroa.5.071, %.preheader57 ], [ %.sroa.5.2, %._crit_edge.loopexit ]
  %.sroa.037.1.lcssa = phi i32 [ %.sroa.037.072, %.preheader57 ], [ %.sroa.037.2, %._crit_edge.loopexit ]
  %.sroa.538.1.lcssa = phi i32 [ %.sroa.538.073, %.preheader57 ], [ %.sroa.538.2, %._crit_edge.loopexit ]
  %indvars.iv.next92 = add nuw nsw i64 %indvars.iv91, 1
  %25 = sext i32 %23 to i64
  %26 = icmp slt i64 %indvars.iv.next92, %25
  br i1 %26, label %.preheader57, label %._crit_edge74, !llvm.loop !14

27:                                               ; preds = %.lr.ph65, %36
  %indvars.iv88 = phi i64 [ 0, %.lr.ph65 ], [ %indvars.iv.next89, %36 ]
  %.sroa.538.164 = phi i32 [ %.sroa.538.073, %.lr.ph65 ], [ %.sroa.538.2, %36 ]
  %.sroa.037.163 = phi i32 [ %.sroa.037.072, %.lr.ph65 ], [ %.sroa.037.2, %36 ]
  %.sroa.5.162 = phi i32 [ %.sroa.5.071, %.lr.ph65 ], [ %.sroa.5.2, %36 ]
  %.sroa.036.161 = phi i32 [ %.sroa.036.070, %.lr.ph65 ], [ %.sroa.036.2, %36 ]
  %28 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %20, i64 noundef %indvars.iv88)
  %29 = load i8, ptr %28, align 1, !tbaa !16
  %30 = icmp eq i8 %29, 115
  %31 = trunc nuw nsw i64 %indvars.iv88 to i32
  br i1 %30, label %36, label %32

32:                                               ; preds = %27
  %33 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %20, i64 noundef %indvars.iv88)
  %34 = load i8, ptr %33, align 1, !tbaa !16
  %35 = icmp eq i8 %34, 103
  %spec.select = select i1 %35, i32 %21, i32 %.sroa.036.161
  %spec.select56 = select i1 %35, i32 %31, i32 %.sroa.5.162
  br label %36

36:                                               ; preds = %32, %27
  %.sroa.036.2 = phi i32 [ %.sroa.036.161, %27 ], [ %spec.select, %32 ]
  %.sroa.5.2 = phi i32 [ %.sroa.5.162, %27 ], [ %spec.select56, %32 ]
  %.sroa.037.2 = phi i32 [ %21, %27 ], [ %.sroa.037.163, %32 ]
  %.sroa.538.2 = phi i32 [ %31, %27 ], [ %.sroa.538.164, %32 ]
  %indvars.iv.next89 = add nuw nsw i64 %indvars.iv88, 1
  %37 = load i32, ptr @W, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = icmp slt i64 %indvars.iv.next89, %38
  br i1 %39, label %27, label %._crit_edge.loopexit, !llvm.loop !17

40:                                               ; preds = %._crit_edge74
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  store i32 3, ptr %3, align 4, !tbaa !5
  invoke void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef nonnull @visited, ptr noundef nonnull getelementptr inbounds (i8, ptr @visited, i64 1040400), ptr noundef nonnull align 4 dereferenceable(4) %3)
          to label %41 unwind label %71

41:                                               ; preds = %40
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  %42 = call noundef zeroext i1 @_ZNKSt5stackI5stateSt5dequeIS0_SaIS0_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %1)
  br i1 %42, label %._crit_edge85, label %.lr.ph84

.lr.ph84:                                         ; preds = %41
  %43 = getelementptr inbounds i8, ptr %4, i64 4
  %44 = getelementptr inbounds i8, ptr %4, i64 8
  %45 = load i32, ptr @_ZL2dx, align 16
  %46 = load i32, ptr @_ZL2dy, align 16
  %47 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL2dx, i64 4), align 4
  %48 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL2dy, i64 4), align 4
  %49 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL2dx, i64 8), align 8
  %50 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL2dy, i64 8), align 8
  %51 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL2dx, i64 12), align 4
  %52 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL2dy, i64 12), align 4
  br label %53

53:                                               ; preds = %.lr.ph84, %.loopexit
  %54 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt5stackI5stateSt5dequeIS0_SaIS0_EEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %1)
  %.sroa.013.0.copyload = load i64, ptr %54, align 4
  %.sroa.013.sroa.0.0.extract.trunc = trunc i64 %.sroa.013.0.copyload to i32
  %.sroa.013.sroa.8.0.extract.shift = lshr i64 %.sroa.013.0.copyload, 32
  %.sroa.013.sroa.8.0.extract.trunc = trunc nuw i64 %.sroa.013.sroa.8.0.extract.shift to i32
  %.sroa.11.0..sroa_idx = getelementptr inbounds i8, ptr %54, i64 8
  %.sroa.11.0.copyload = load i32, ptr %.sroa.11.0..sroa_idx, align 4, !tbaa !5
  call void @_ZNSt5stackI5stateSt5dequeIS0_SaIS0_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %1)
  %55 = call noundef zeroext i1 @_Z5visit5state(i64 %.sroa.013.0.copyload, i32 %.sroa.11.0.copyload)
  br i1 %55, label %56, label %.loopexit

56:                                               ; preds = %53
  %sext = shl i64 %.sroa.013.0.copyload, 32
  %57 = ashr exact i64 %sext, 32
  %58 = ashr i64 %.sroa.013.0.copyload, 32
  %59 = getelementptr inbounds [510 x [510 x i32]], ptr @visited, i64 0, i64 %57, i64 %58
  store i32 %.sroa.11.0.copyload, ptr %59, align 4, !tbaa !5
  %60 = icmp eq i32 %.sroa.036.0.lcssa, %.sroa.013.sroa.0.0.extract.trunc
  %61 = icmp eq i32 %.sroa.5.0.lcssa, %.sroa.013.sroa.8.0.extract.trunc
  %or.cond = select i1 %60, i1 %61, i1 false
  br i1 %or.cond, label %65, label %.preheader.preheader

.preheader.preheader:                             ; preds = %56
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %4) #7
  call void @_ZN5stateC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %4) #7
  %62 = add nsw i32 %45, %.sroa.013.sroa.0.0.extract.trunc
  store i32 %62, ptr %4, align 8, !tbaa !18
  %63 = add nsw i32 %46, %.sroa.013.sroa.8.0.extract.trunc
  store i32 %63, ptr %43, align 4, !tbaa !19
  %.sroa.03.0.copyload = load i64, ptr %4, align 8
  %64 = invoke noundef i32 @_Z5valid5point(i64 %.sroa.03.0.copyload)
          to label %75 unwind label %77

65:                                               ; preds = %56
  %66 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str)
          to label %67 unwind label %73

67:                                               ; preds = %65
  %68 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %66, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %.critedge unwind label %73

69:                                               ; preds = %112, %._crit_edge85, %._crit_edge74
  %70 = landingpad { ptr, i32 }
          cleanup
  br label %114

71:                                               ; preds = %40
  %72 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  br label %114

73:                                               ; preds = %67, %65
  %74 = landingpad { ptr, i32 }
          cleanup
  br label %114

75:                                               ; preds = %.preheader.preheader
  %76 = icmp eq i32 %64, -1
  br i1 %76, label %.preheader.1, label %79

77:                                               ; preds = %109, %.preheader.3, %100, %.preheader.2, %91, %.preheader.1, %82, %.preheader.preheader
  %78 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %4) #7
  br label %114

79:                                               ; preds = %75
  %80 = add nsw i32 %64, %.sroa.11.0.copyload
  store i32 %80, ptr %44, align 8, !tbaa !11
  %.sroa.01.0.copyload = load i64, ptr %4, align 8
  %81 = call noundef zeroext i1 @_Z5visit5state(i64 %.sroa.01.0.copyload, i32 %80)
  br i1 %81, label %82, label %.preheader.1

82:                                               ; preds = %79
  invoke void @_ZNSt5stackI5stateSt5dequeIS0_SaIS0_EEE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(80) %1, ptr noundef nonnull align 4 dereferenceable(12) %4)
          to label %.preheader.1 unwind label %77

.preheader.1:                                     ; preds = %82, %79, %75
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %4) #7
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %4) #7
  call void @_ZN5stateC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %4) #7
  %83 = add nsw i32 %47, %.sroa.013.sroa.0.0.extract.trunc
  store i32 %83, ptr %4, align 8, !tbaa !18
  %84 = add nsw i32 %48, %.sroa.013.sroa.8.0.extract.trunc
  store i32 %84, ptr %43, align 4, !tbaa !19
  %.sroa.03.0.copyload.1 = load i64, ptr %4, align 8
  %85 = invoke noundef i32 @_Z5valid5point(i64 %.sroa.03.0.copyload.1)
          to label %86 unwind label %77

86:                                               ; preds = %.preheader.1
  %87 = icmp eq i32 %85, -1
  br i1 %87, label %.preheader.2, label %88

88:                                               ; preds = %86
  %89 = add nsw i32 %85, %.sroa.11.0.copyload
  store i32 %89, ptr %44, align 8, !tbaa !11
  %.sroa.01.0.copyload.1 = load i64, ptr %4, align 8
  %90 = call noundef zeroext i1 @_Z5visit5state(i64 %.sroa.01.0.copyload.1, i32 %89)
  br i1 %90, label %91, label %.preheader.2

91:                                               ; preds = %88
  invoke void @_ZNSt5stackI5stateSt5dequeIS0_SaIS0_EEE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(80) %1, ptr noundef nonnull align 4 dereferenceable(12) %4)
          to label %.preheader.2 unwind label %77

.preheader.2:                                     ; preds = %91, %88, %86
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %4) #7
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %4) #7
  call void @_ZN5stateC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %4) #7
  %92 = add nsw i32 %49, %.sroa.013.sroa.0.0.extract.trunc
  store i32 %92, ptr %4, align 8, !tbaa !18
  %93 = add nsw i32 %50, %.sroa.013.sroa.8.0.extract.trunc
  store i32 %93, ptr %43, align 4, !tbaa !19
  %.sroa.03.0.copyload.2 = load i64, ptr %4, align 8
  %94 = invoke noundef i32 @_Z5valid5point(i64 %.sroa.03.0.copyload.2)
          to label %95 unwind label %77

95:                                               ; preds = %.preheader.2
  %96 = icmp eq i32 %94, -1
  br i1 %96, label %.preheader.3, label %97

97:                                               ; preds = %95
  %98 = add nsw i32 %94, %.sroa.11.0.copyload
  store i32 %98, ptr %44, align 8, !tbaa !11
  %.sroa.01.0.copyload.2 = load i64, ptr %4, align 8
  %99 = call noundef zeroext i1 @_Z5visit5state(i64 %.sroa.01.0.copyload.2, i32 %98)
  br i1 %99, label %100, label %.preheader.3

100:                                              ; preds = %97
  invoke void @_ZNSt5stackI5stateSt5dequeIS0_SaIS0_EEE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(80) %1, ptr noundef nonnull align 4 dereferenceable(12) %4)
          to label %.preheader.3 unwind label %77

.preheader.3:                                     ; preds = %100, %97, %95
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %4) #7
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %4) #7
  call void @_ZN5stateC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %4) #7
  %101 = add nsw i32 %51, %.sroa.013.sroa.0.0.extract.trunc
  store i32 %101, ptr %4, align 8, !tbaa !18
  %102 = add nsw i32 %52, %.sroa.013.sroa.8.0.extract.trunc
  store i32 %102, ptr %43, align 4, !tbaa !19
  %.sroa.03.0.copyload.3 = load i64, ptr %4, align 8
  %103 = invoke noundef i32 @_Z5valid5point(i64 %.sroa.03.0.copyload.3)
          to label %104 unwind label %77

104:                                              ; preds = %.preheader.3
  %105 = icmp eq i32 %103, -1
  br i1 %105, label %.loopexit.loopexit, label %106

106:                                              ; preds = %104
  %107 = add nsw i32 %103, %.sroa.11.0.copyload
  store i32 %107, ptr %44, align 8, !tbaa !11
  %.sroa.01.0.copyload.3 = load i64, ptr %4, align 8
  %108 = call noundef zeroext i1 @_Z5visit5state(i64 %.sroa.01.0.copyload.3, i32 %107)
  br i1 %108, label %109, label %.loopexit.loopexit

109:                                              ; preds = %106
  invoke void @_ZNSt5stackI5stateSt5dequeIS0_SaIS0_EEE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(80) %1, ptr noundef nonnull align 4 dereferenceable(12) %4)
          to label %.loopexit.loopexit unwind label %77

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

.loopexit:                                        ; preds = %.loopexit.loopexit, %53
  %110 = call noundef zeroext i1 @_ZNKSt5stackI5stateSt5dequeIS0_SaIS0_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %1)
  br i1 %110, label %._crit_edge85, label %53, !llvm.loop !20

._crit_edge85:                                    ; preds = %.loopexit, %41
  %111 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.2)
          to label %112 unwind label %69

112:                                              ; preds = %._crit_edge85
  %113 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %111, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %.critedge unwind label %69

.critedge:                                        ; preds = %67, %112
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %2) #7
  call void @_ZNSt5stackI5stateSt5dequeIS0_SaIS0_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %1) #7
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %1) #7
  ret i32 0

114:                                              ; preds = %73, %77, %71, %69
  %.pn.pn = phi { ptr, i32 } [ %70, %69 ], [ %72, %71 ], [ %74, %73 ], [ %78, %77 ]
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %2) #7
  call void @_ZNSt5stackI5stateSt5dequeIS0_SaIS0_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %1) #7
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %1) #7
  resume { ptr, i32 } %.pn.pn
}

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

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN5stateC2Ev(ptr noundef nonnull align 4 dereferenceable(12)) unnamed_addr #5 align 2

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

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

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

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

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


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