; LLVM IR from eyangch/competitive-programming :: BOI/2013 (tracks)

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

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

@dx = external dso_local global [4 x i32], align 16
@dy = external dso_local global [4 x i32], align 16
@H = external dso_local global i32, align 4
@W = external dso_local global i32, align 4
@_Z1mB5cxx11 = external dso_local global [4000 x %"class.std::__cxx11::basic_string"], align 16
@vis = external dso_local global [4000 x [4000 x i8]], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca %"class.std::deque", align 8
  %4 = alloca %struct.s, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca %struct.s, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca %struct.s, align 4
  %17 = alloca %struct.s, align 4
  store i32 0, ptr %1, align 4
  %18 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %19 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %20 = getelementptr i8, ptr %19, i64 -24
  %21 = load i64, ptr %20, align 8
  %22 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %21
  %23 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %22, ptr noundef null)
  %24 = 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)
  %25 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %24, 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 !8
  br label %26

26:                                               ; preds = %36, %0
  %27 = load i32, ptr %2, align 4, !tbaa !8
  %28 = load i32, ptr @H, align 4, !tbaa !8
  %29 = icmp slt i32 %27, %28
  br i1 %29, label %31, label %30

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

31:                                               ; preds = %26
  %32 = load i32, ptr %2, align 4, !tbaa !8
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [4000 x %"class.std::__cxx11::basic_string"], ptr @_Z1mB5cxx11, i64 0, i64 %33
  %35 = 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) %34)
  br label %36

36:                                               ; preds = %31
  %37 = load i32, ptr %2, align 4, !tbaa !8
  %38 = add nsw i32 %37, 1
  store i32 %38, ptr %2, align 4, !tbaa !8
  br label %26, !llvm.loop !11

39:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 80, ptr %3) #8
  call void @_ZNSt5dequeI1sSaIS0_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(80) %3)
  call void @llvm.lifetime.start.p0(i64 12, ptr %4) #8
  %40 = getelementptr inbounds %struct.s, ptr %4, i32 0, i32 0
  store i32 0, ptr %40, align 4, !tbaa !13
  %41 = getelementptr inbounds %struct.s, ptr %4, i32 0, i32 1
  store i32 0, ptr %41, align 4, !tbaa !15
  %42 = getelementptr inbounds %struct.s, ptr %4, i32 0, i32 2
  store i32 1, ptr %42, align 4, !tbaa !16
  invoke void @_ZNSt5dequeI1sSaIS0_EE9push_backEOS0_(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 4 dereferenceable(12) %4)
          to label %43 unwind label %64

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

44:                                               ; preds = %184, %182, %43
  %45 = call noundef zeroext i1 @_ZNKSt5dequeI1sSaIS0_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %3) #8
  %46 = xor i1 %45, true
  br i1 %46, label %47, label %186

47:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 12, ptr %8) #8
  %48 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt5dequeI1sSaIS0_EE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %3) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %8, ptr align 4 %48, i64 12, i1 false), !tbaa.struct !17
  call void @_ZNSt5dequeI1sSaIS0_EE9pop_frontEv(ptr noundef nonnull align 8 dereferenceable(80) %3) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  %49 = getelementptr inbounds %struct.s, ptr %8, i32 0, i32 0
  %50 = load i32, ptr %49, align 4, !tbaa !13
  store i32 %50, ptr %9, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #8
  %51 = getelementptr inbounds %struct.s, ptr %8, i32 0, i32 1
  %52 = load i32, ptr %51, align 4, !tbaa !15
  store i32 %52, ptr %10, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #8
  %53 = getelementptr inbounds %struct.s, ptr %8, i32 0, i32 2
  %54 = load i32, ptr %53, align 4, !tbaa !16
  store i32 %54, ptr %11, align 4, !tbaa !8
  %55 = load i32, ptr %9, align 4, !tbaa !8
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [4000 x [4000 x i8]], ptr @vis, i64 0, i64 %56
  %58 = load i32, ptr %10, align 4, !tbaa !8
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [4000 x i8], ptr %57, i64 0, i64 %59
  %61 = load i8, ptr %60, align 1, !tbaa !18, !range !20, !noundef !21
  %62 = trunc i8 %61 to i1
  br i1 %62, label %63, label %68

63:                                               ; preds = %47
  store i32 5, ptr %12, align 4
  br label %182, !llvm.loop !22

64:                                               ; preds = %39
  %65 = landingpad { ptr, i32 }
          cleanup
  %66 = extractvalue { ptr, i32 } %65, 0
  store ptr %66, ptr %5, align 8
  %67 = extractvalue { ptr, i32 } %65, 1
  store i32 %67, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 12, ptr %4) #8
  br label %198

68:                                               ; preds = %47
  %69 = load i32, ptr %9, align 4, !tbaa !8
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [4000 x [4000 x i8]], ptr @vis, i64 0, i64 %70
  %72 = load i32, ptr %10, align 4, !tbaa !8
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [4000 x i8], ptr %71, i64 0, i64 %73
  store i8 1, ptr %74, align 1, !tbaa !18
  %75 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %11)
          to label %76 unwind label %82

76:                                               ; preds = %68
  %77 = load i32, ptr %75, align 4, !tbaa !8
  store i32 %77, ptr %7, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #8
  store i32 0, ptr %13, align 4, !tbaa !8
  br label %78

78:                                               ; preds = %177, %76
  %79 = load i32, ptr %13, align 4, !tbaa !8
  %80 = icmp slt i32 %79, 4
  br i1 %80, label %86, label %81

81:                                               ; preds = %78
  store i32 7, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #8
  br label %181

82:                                               ; preds = %68
  %83 = landingpad { ptr, i32 }
          cleanup
  %84 = extractvalue { ptr, i32 } %83, 0
  store ptr %84, ptr %5, align 8
  %85 = extractvalue { ptr, i32 } %83, 1
  store i32 %85, ptr %6, align 4
  br label %185

86:                                               ; preds = %78
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #8
  %87 = load i32, ptr %9, align 4, !tbaa !8
  %88 = load i32, ptr %13, align 4, !tbaa !8
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [4 x i32], ptr @dx, i64 0, i64 %89
  %91 = load i32, ptr %90, align 4, !tbaa !8
  %92 = add nsw i32 %87, %91
  store i32 %92, ptr %14, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #8
  %93 = load i32, ptr %10, align 4, !tbaa !8
  %94 = load i32, ptr %13, align 4, !tbaa !8
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [4 x i32], ptr @dy, i64 0, i64 %95
  %97 = load i32, ptr %96, align 4, !tbaa !8
  %98 = add nsw i32 %93, %97
  store i32 %98, ptr %15, align 4, !tbaa !8
  %99 = load i32, ptr %14, align 4, !tbaa !8
  %100 = icmp slt i32 %99, 0
  br i1 %100, label %123, label %101

101:                                              ; preds = %86
  %102 = load i32, ptr %15, align 4, !tbaa !8
  %103 = icmp slt i32 %102, 0
  br i1 %103, label %123, label %104

104:                                              ; preds = %101
  %105 = load i32, ptr %14, align 4, !tbaa !8
  %106 = load i32, ptr @H, align 4, !tbaa !8
  %107 = icmp sge i32 %105, %106
  br i1 %107, label %123, label %108

108:                                              ; preds = %104
  %109 = load i32, ptr %15, align 4, !tbaa !8
  %110 = load i32, ptr @W, align 4, !tbaa !8
  %111 = icmp sge i32 %109, %110
  br i1 %111, label %123, label %112

112:                                              ; preds = %108
  %113 = load i32, ptr %14, align 4, !tbaa !8
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [4000 x %"class.std::__cxx11::basic_string"], ptr @_Z1mB5cxx11, i64 0, i64 %114
  %116 = load i32, ptr %15, align 4, !tbaa !8
  %117 = sext i32 %116 to i64
  %118 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %115, i64 noundef %117)
          to label %119 unwind label %124

119:                                              ; preds = %112
  %120 = load i8, ptr %118, align 1, !tbaa !23
  %121 = sext i8 %120 to i32
  %122 = icmp eq i32 %121, 46
  br i1 %122, label %123, label %128

123:                                              ; preds = %119, %108, %104, %101, %86
  store i32 9, ptr %12, align 4
  br label %174

124:                                              ; preds = %135, %128, %112
  %125 = landingpad { ptr, i32 }
          cleanup
  %126 = extractvalue { ptr, i32 } %125, 0
  store ptr %126, ptr %5, align 8
  %127 = extractvalue { ptr, i32 } %125, 1
  store i32 %127, ptr %6, align 4
  br label %180

128:                                              ; preds = %119
  %129 = load i32, ptr %9, align 4, !tbaa !8
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [4000 x %"class.std::__cxx11::basic_string"], ptr @_Z1mB5cxx11, i64 0, i64 %130
  %132 = load i32, ptr %10, align 4, !tbaa !8
  %133 = sext i32 %132 to i64
  %134 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %131, i64 noundef %133)
          to label %135 unwind label %124

135:                                              ; preds = %128
  %136 = load i8, ptr %134, align 1, !tbaa !23
  %137 = sext i8 %136 to i32
  %138 = load i32, ptr %14, align 4, !tbaa !8
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [4000 x %"class.std::__cxx11::basic_string"], ptr @_Z1mB5cxx11, i64 0, i64 %139
  %141 = load i32, ptr %15, align 4, !tbaa !8
  %142 = sext i32 %141 to i64
  %143 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %140, i64 noundef %142)
          to label %144 unwind label %124

144:                                              ; preds = %135
  %145 = load i8, ptr %143, align 1, !tbaa !23
  %146 = sext i8 %145 to i32
  %147 = icmp ne i32 %137, %146
  br i1 %147, label %148, label %161

148:                                              ; preds = %144
  call void @llvm.lifetime.start.p0(i64 12, ptr %16) #8
  %149 = getelementptr inbounds %struct.s, ptr %16, i32 0, i32 0
  %150 = load i32, ptr %14, align 4, !tbaa !8
  store i32 %150, ptr %149, align 4, !tbaa !13
  %151 = getelementptr inbounds %struct.s, ptr %16, i32 0, i32 1
  %152 = load i32, ptr %15, align 4, !tbaa !8
  store i32 %152, ptr %151, align 4, !tbaa !15
  %153 = getelementptr inbounds %struct.s, ptr %16, i32 0, i32 2
  %154 = load i32, ptr %11, align 4, !tbaa !8
  %155 = add nsw i32 %154, 1
  store i32 %155, ptr %153, align 4, !tbaa !16
  invoke void @_ZNSt5dequeI1sSaIS0_EE9push_backEOS0_(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 4 dereferenceable(12) %16)
          to label %156 unwind label %157

156:                                              ; preds = %148
  call void @llvm.lifetime.end.p0(i64 12, ptr %16) #8
  br label %173

157:                                              ; preds = %148
  %158 = landingpad { ptr, i32 }
          cleanup
  %159 = extractvalue { ptr, i32 } %158, 0
  store ptr %159, ptr %5, align 8
  %160 = extractvalue { ptr, i32 } %158, 1
  store i32 %160, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 12, ptr %16) #8
  br label %180

161:                                              ; preds = %144
  call void @llvm.lifetime.start.p0(i64 12, ptr %17) #8
  %162 = getelementptr inbounds %struct.s, ptr %17, i32 0, i32 0
  %163 = load i32, ptr %14, align 4, !tbaa !8
  store i32 %163, ptr %162, align 4, !tbaa !13
  %164 = getelementptr inbounds %struct.s, ptr %17, i32 0, i32 1
  %165 = load i32, ptr %15, align 4, !tbaa !8
  store i32 %165, ptr %164, align 4, !tbaa !15
  %166 = getelementptr inbounds %struct.s, ptr %17, i32 0, i32 2
  %167 = load i32, ptr %11, align 4, !tbaa !8
  store i32 %167, ptr %166, align 4, !tbaa !16
  invoke void @_ZNSt5dequeI1sSaIS0_EE10push_frontEOS0_(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 4 dereferenceable(12) %17)
          to label %168 unwind label %169

168:                                              ; preds = %161
  call void @llvm.lifetime.end.p0(i64 12, ptr %17) #8
  br label %173

169:                                              ; preds = %161
  %170 = landingpad { ptr, i32 }
          cleanup
  %171 = extractvalue { ptr, i32 } %170, 0
  store ptr %171, ptr %5, align 8
  %172 = extractvalue { ptr, i32 } %170, 1
  store i32 %172, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 12, ptr %17) #8
  br label %180

173:                                              ; preds = %168, %156
  store i32 0, ptr %12, align 4
  br label %174

174:                                              ; preds = %173, %123
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #8
  %175 = load i32, ptr %12, align 4
  switch i32 %175, label %204 [
    i32 0, label %176
    i32 9, label %177
  ]

176:                                              ; preds = %174
  br label %177

177:                                              ; preds = %176, %174
  %178 = load i32, ptr %13, align 4, !tbaa !8
  %179 = add nsw i32 %178, 1
  store i32 %179, ptr %13, align 4, !tbaa !8
  br label %78, !llvm.loop !24

180:                                              ; preds = %169, %157, %124
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #8
  br label %185

181:                                              ; preds = %81
  store i32 0, ptr %12, align 4
  br label %182

182:                                              ; preds = %181, %63
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %8) #8
  %183 = load i32, ptr %12, align 4
  switch i32 %183, label %204 [
    i32 0, label %184
    i32 5, label %44
  ]

184:                                              ; preds = %182
  br label %44, !llvm.loop !22

185:                                              ; preds = %180, %82
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %8) #8
  br label %197

186:                                              ; preds = %44
  %187 = load i32, ptr %7, align 4, !tbaa !8
  %188 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %187)
          to label %189 unwind label %193

189:                                              ; preds = %186
  %190 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %188, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %191 unwind label %193

191:                                              ; preds = %189
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #8
  call void @_ZNSt5dequeI1sSaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %3) #8
  call void @llvm.lifetime.end.p0(i64 80, ptr %3) #8
  %192 = load i32, ptr %1, align 4
  ret i32 %192

193:                                              ; preds = %189, %186
  %194 = landingpad { ptr, i32 }
          cleanup
  %195 = extractvalue { ptr, i32 } %194, 0
  store ptr %195, ptr %5, align 8
  %196 = extractvalue { ptr, i32 } %194, 1
  store i32 %196, ptr %6, align 4
  br label %197

197:                                              ; preds = %193, %185
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #8
  br label %198

198:                                              ; preds = %197, %64
  call void @_ZNSt5dequeI1sSaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %3) #8
  call void @llvm.lifetime.end.p0(i64 80, ptr %3) #8
  br label %199

199:                                              ; preds = %198
  %200 = load ptr, ptr %5, align 8
  %201 = load i32, ptr %6, align 4
  %202 = insertvalue { ptr, i32 } poison, ptr %200, 0
  %203 = insertvalue { ptr, i32 } %202, i32 %201, 1
  resume { ptr, i32 } %203

204:                                              ; preds = %182, %174
  unreachable
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) #1

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) #2 align 2

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

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

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

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

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

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

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

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

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

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

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

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

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

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


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

@dx = external dso_local local_unnamed_addr global [4 x i32], align 16
@dy = external dso_local local_unnamed_addr global [4 x i32], align 16
@H = external dso_local global i32, align 4
@W = external dso_local global i32, align 4
@_Z1mB5cxx11 = external dso_local global [4000 x %"class.std::__cxx11::basic_string"], align 16
@vis = external dso_local local_unnamed_addr global [4000 x [4000 x i8]], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::deque", align 8
  %2 = alloca %struct.s, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %struct.s, align 4
  %6 = alloca %struct.s, align 4
  %7 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %8 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %9 = getelementptr i8, ptr %8, i64 -24
  %10 = load i64, ptr %9, align 8
  %11 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %10
  %12 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %11, ptr noundef null)
  %13 = 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)
  %14 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %13, ptr noundef nonnull align 4 dereferenceable(4) @W)
  %15 = load i32, ptr @H, align 4, !tbaa !8
  %16 = icmp sgt i32 %15, 0
  br i1 %16, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %0
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %1) #7
  call void @_ZNSt5dequeI1sSaIS0_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(80) %1)
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %2) #7
  store i32 0, ptr %2, align 4, !tbaa !11
  %17 = getelementptr inbounds i8, ptr %2, i64 4
  store i32 0, ptr %17, align 4, !tbaa !13
  %18 = getelementptr inbounds i8, ptr %2, i64 8
  store i32 1, ptr %18, align 4, !tbaa !14
  invoke void @_ZNSt5dequeI1sSaIS0_EE9push_backEOS0_(ptr noundef nonnull align 8 dereferenceable(80) %1, ptr noundef nonnull align 4 dereferenceable(12) %2)
          to label %24 unwind label %37

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %19 = getelementptr inbounds [4000 x %"class.std::__cxx11::basic_string"], ptr @_Z1mB5cxx11, i64 0, i64 %indvars.iv
  %20 = 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) %19)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %21 = load i32, ptr @H, align 4, !tbaa !8
  %22 = sext i32 %21 to i64
  %23 = icmp slt i64 %indvars.iv.next, %22
  br i1 %23, label %.lr.ph, label %._crit_edge, !llvm.loop !15

24:                                               ; preds = %._crit_edge
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %2) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  store i32 0, ptr %3, align 4, !tbaa !8
  %25 = call noundef zeroext i1 @_ZNKSt5dequeI1sSaIS0_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %1) #7
  br i1 %25, label %._crit_edge51, label %.lr.ph50

.lr.ph50:                                         ; preds = %24
  %26 = getelementptr inbounds i8, ptr %5, i64 4
  %27 = getelementptr inbounds i8, ptr %5, i64 8
  %28 = getelementptr inbounds i8, ptr %6, i64 4
  %29 = getelementptr inbounds i8, ptr %6, i64 8
  br label %30

30:                                               ; preds = %.lr.ph50, %.loopexit
  %31 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt5dequeI1sSaIS0_EE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %1) #7
  %.sroa.0.0.copyload = load i32, ptr %31, align 4, !tbaa !8
  %.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %31, i64 4
  %.sroa.5.0.copyload = load i32, ptr %.sroa.5.0..sroa_idx, align 4, !tbaa !8
  %.sroa.6.0..sroa_idx = getelementptr inbounds i8, ptr %31, i64 8
  %.sroa.6.0.copyload = load i32, ptr %.sroa.6.0..sroa_idx, align 4, !tbaa !8
  call void @_ZNSt5dequeI1sSaIS0_EE9pop_frontEv(ptr noundef nonnull align 8 dereferenceable(80) %1) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #7
  store i32 %.sroa.6.0.copyload, ptr %4, align 4, !tbaa !8
  %32 = sext i32 %.sroa.0.0.copyload to i64
  %33 = sext i32 %.sroa.5.0.copyload to i64
  %34 = getelementptr inbounds [4000 x [4000 x i8]], ptr @vis, i64 0, i64 %32, i64 %33
  %35 = load i8, ptr %34, align 1, !tbaa !17, !range !19, !noundef !20
  %36 = trunc nuw i8 %35 to i1
  br i1 %36, label %.loopexit, label %39, !llvm.loop !21

37:                                               ; preds = %._crit_edge
  %38 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %2) #7
  br label %168

39:                                               ; preds = %30
  store i8 1, ptr %34, align 1, !tbaa !17
  %40 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %41 = load i32, ptr %40, align 4, !tbaa !8
  store i32 %41, ptr %3, align 4, !tbaa !8
  %42 = getelementptr inbounds [4000 x %"class.std::__cxx11::basic_string"], ptr @_Z1mB5cxx11, i64 0, i64 %32
  %43 = load i32, ptr @dx, align 16, !tbaa !8
  %44 = add nsw i32 %43, %.sroa.0.0.copyload
  %45 = load i32, ptr @dy, align 16, !tbaa !8
  %46 = add nsw i32 %45, %.sroa.5.0.copyload
  %47 = icmp sgt i32 %44, -1
  %48 = icmp sgt i32 %46, -1
  %or.cond.not46 = select i1 %47, i1 %48, i1 false
  %49 = load i32, ptr @H, align 4
  %.not = icmp slt i32 %44, %49
  %or.cond42 = select i1 %or.cond.not46, i1 %.not, i1 false
  %50 = load i32, ptr @W, align 4
  %.not37 = icmp slt i32 %46, %50
  %or.cond43 = select i1 %or.cond42, i1 %.not37, i1 false
  br i1 %or.cond43, label %51, label %74

51:                                               ; preds = %39
  %52 = zext nneg i32 %44 to i64
  %53 = getelementptr inbounds [4000 x %"class.std::__cxx11::basic_string"], ptr @_Z1mB5cxx11, i64 0, i64 %52
  %54 = zext nneg i32 %46 to i64
  %55 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %53, i64 noundef %54)
  %56 = load i8, ptr %55, align 1, !tbaa !22
  %57 = icmp eq i8 %56, 46
  br i1 %57, label %74, label %58

58:                                               ; preds = %51
  %59 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %42, i64 noundef %33)
  %60 = load i8, ptr %59, align 1, !tbaa !22
  %61 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %53, i64 noundef %54)
  %62 = load i8, ptr %61, align 1, !tbaa !22
  %.not38 = icmp eq i8 %60, %62
  br i1 %.not38, label %69, label %63

63:                                               ; preds = %58
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %5) #7
  store i32 %44, ptr %5, align 4, !tbaa !11
  store i32 %46, ptr %26, align 4, !tbaa !13
  %64 = load i32, ptr %4, align 4, !tbaa !8
  %65 = add nsw i32 %64, 1
  store i32 %65, ptr %27, align 4, !tbaa !14
  invoke void @_ZNSt5dequeI1sSaIS0_EE9push_backEOS0_(ptr noundef nonnull align 8 dereferenceable(80) %1, ptr noundef nonnull align 4 dereferenceable(12) %5)
          to label %66 unwind label %67

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

67:                                               ; preds = %151, %123, %95, %63
  %68 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %5) #7
  br label %158

69:                                               ; preds = %58
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %6) #7
  store i32 %44, ptr %6, align 4, !tbaa !11
  store i32 %46, ptr %28, align 4, !tbaa !13
  %70 = load i32, ptr %4, align 4, !tbaa !8
  store i32 %70, ptr %29, align 4, !tbaa !14
  invoke void @_ZNSt5dequeI1sSaIS0_EE10push_frontEOS0_(ptr noundef nonnull align 8 dereferenceable(80) %1, ptr noundef nonnull align 4 dereferenceable(12) %6)
          to label %71 unwind label %72

71:                                               ; preds = %69
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %6) #7
  br label %74

72:                                               ; preds = %155, %127, %99, %69
  %73 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %6) #7
  br label %158

74:                                               ; preds = %66, %71, %39, %51
  %75 = load i32, ptr getelementptr inbounds (i8, ptr @dx, i64 4), align 4, !tbaa !8
  %76 = add nsw i32 %75, %.sroa.0.0.copyload
  %77 = load i32, ptr getelementptr inbounds (i8, ptr @dy, i64 4), align 4, !tbaa !8
  %78 = add nsw i32 %77, %.sroa.5.0.copyload
  %79 = icmp sgt i32 %76, -1
  %80 = icmp sgt i32 %78, -1
  %or.cond.not46.1 = select i1 %79, i1 %80, i1 false
  %81 = load i32, ptr @H, align 4
  %.not.1 = icmp slt i32 %76, %81
  %or.cond42.1 = select i1 %or.cond.not46.1, i1 %.not.1, i1 false
  %82 = load i32, ptr @W, align 4
  %.not37.1 = icmp slt i32 %78, %82
  %or.cond43.1 = select i1 %or.cond42.1, i1 %.not37.1, i1 false
  br i1 %or.cond43.1, label %83, label %102

83:                                               ; preds = %74
  %84 = zext nneg i32 %76 to i64
  %85 = getelementptr inbounds [4000 x %"class.std::__cxx11::basic_string"], ptr @_Z1mB5cxx11, i64 0, i64 %84
  %86 = zext nneg i32 %78 to i64
  %87 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %85, i64 noundef %86)
  %88 = load i8, ptr %87, align 1, !tbaa !22
  %89 = icmp eq i8 %88, 46
  br i1 %89, label %102, label %90

90:                                               ; preds = %83
  %91 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %42, i64 noundef %33)
  %92 = load i8, ptr %91, align 1, !tbaa !22
  %93 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %85, i64 noundef %86)
  %94 = load i8, ptr %93, align 1, !tbaa !22
  %.not38.1 = icmp eq i8 %92, %94
  br i1 %.not38.1, label %99, label %95

95:                                               ; preds = %90
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %5) #7
  store i32 %76, ptr %5, align 4, !tbaa !11
  store i32 %78, ptr %26, align 4, !tbaa !13
  %96 = load i32, ptr %4, align 4, !tbaa !8
  %97 = add nsw i32 %96, 1
  store i32 %97, ptr %27, align 4, !tbaa !14
  invoke void @_ZNSt5dequeI1sSaIS0_EE9push_backEOS0_(ptr noundef nonnull align 8 dereferenceable(80) %1, ptr noundef nonnull align 4 dereferenceable(12) %5)
          to label %98 unwind label %67

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

99:                                               ; preds = %90
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %6) #7
  store i32 %76, ptr %6, align 4, !tbaa !11
  store i32 %78, ptr %28, align 4, !tbaa !13
  %100 = load i32, ptr %4, align 4, !tbaa !8
  store i32 %100, ptr %29, align 4, !tbaa !14
  invoke void @_ZNSt5dequeI1sSaIS0_EE10push_frontEOS0_(ptr noundef nonnull align 8 dereferenceable(80) %1, ptr noundef nonnull align 4 dereferenceable(12) %6)
          to label %101 unwind label %72

101:                                              ; preds = %99
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %6) #7
  br label %102

102:                                              ; preds = %101, %98, %83, %74
  %103 = load i32, ptr getelementptr inbounds (i8, ptr @dx, i64 8), align 8, !tbaa !8
  %104 = add nsw i32 %103, %.sroa.0.0.copyload
  %105 = load i32, ptr getelementptr inbounds (i8, ptr @dy, i64 8), align 8, !tbaa !8
  %106 = add nsw i32 %105, %.sroa.5.0.copyload
  %107 = icmp sgt i32 %104, -1
  %108 = icmp sgt i32 %106, -1
  %or.cond.not46.2 = select i1 %107, i1 %108, i1 false
  %109 = load i32, ptr @H, align 4
  %.not.2 = icmp slt i32 %104, %109
  %or.cond42.2 = select i1 %or.cond.not46.2, i1 %.not.2, i1 false
  %110 = load i32, ptr @W, align 4
  %.not37.2 = icmp slt i32 %106, %110
  %or.cond43.2 = select i1 %or.cond42.2, i1 %.not37.2, i1 false
  br i1 %or.cond43.2, label %111, label %130

111:                                              ; preds = %102
  %112 = zext nneg i32 %104 to i64
  %113 = getelementptr inbounds [4000 x %"class.std::__cxx11::basic_string"], ptr @_Z1mB5cxx11, i64 0, i64 %112
  %114 = zext nneg i32 %106 to i64
  %115 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %113, i64 noundef %114)
  %116 = load i8, ptr %115, align 1, !tbaa !22
  %117 = icmp eq i8 %116, 46
  br i1 %117, label %130, label %118

118:                                              ; preds = %111
  %119 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %42, i64 noundef %33)
  %120 = load i8, ptr %119, align 1, !tbaa !22
  %121 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %113, i64 noundef %114)
  %122 = load i8, ptr %121, align 1, !tbaa !22
  %.not38.2 = icmp eq i8 %120, %122
  br i1 %.not38.2, label %127, label %123

123:                                              ; preds = %118
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %5) #7
  store i32 %104, ptr %5, align 4, !tbaa !11
  store i32 %106, ptr %26, align 4, !tbaa !13
  %124 = load i32, ptr %4, align 4, !tbaa !8
  %125 = add nsw i32 %124, 1
  store i32 %125, ptr %27, align 4, !tbaa !14
  invoke void @_ZNSt5dequeI1sSaIS0_EE9push_backEOS0_(ptr noundef nonnull align 8 dereferenceable(80) %1, ptr noundef nonnull align 4 dereferenceable(12) %5)
          to label %126 unwind label %67

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

127:                                              ; preds = %118
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %6) #7
  store i32 %104, ptr %6, align 4, !tbaa !11
  store i32 %106, ptr %28, align 4, !tbaa !13
  %128 = load i32, ptr %4, align 4, !tbaa !8
  store i32 %128, ptr %29, align 4, !tbaa !14
  invoke void @_ZNSt5dequeI1sSaIS0_EE10push_frontEOS0_(ptr noundef nonnull align 8 dereferenceable(80) %1, ptr noundef nonnull align 4 dereferenceable(12) %6)
          to label %129 unwind label %72

129:                                              ; preds = %127
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %6) #7
  br label %130

130:                                              ; preds = %129, %126, %111, %102
  %131 = load i32, ptr getelementptr inbounds (i8, ptr @dx, i64 12), align 4, !tbaa !8
  %132 = add nsw i32 %131, %.sroa.0.0.copyload
  %133 = load i32, ptr getelementptr inbounds (i8, ptr @dy, i64 12), align 4, !tbaa !8
  %134 = add nsw i32 %133, %.sroa.5.0.copyload
  %135 = icmp sgt i32 %132, -1
  %136 = icmp sgt i32 %134, -1
  %or.cond.not46.3 = select i1 %135, i1 %136, i1 false
  %137 = load i32, ptr @H, align 4
  %.not.3 = icmp slt i32 %132, %137
  %or.cond42.3 = select i1 %or.cond.not46.3, i1 %.not.3, i1 false
  %138 = load i32, ptr @W, align 4
  %.not37.3 = icmp slt i32 %134, %138
  %or.cond43.3 = select i1 %or.cond42.3, i1 %.not37.3, i1 false
  br i1 %or.cond43.3, label %139, label %.loopexit

139:                                              ; preds = %130
  %140 = zext nneg i32 %132 to i64
  %141 = getelementptr inbounds [4000 x %"class.std::__cxx11::basic_string"], ptr @_Z1mB5cxx11, i64 0, i64 %140
  %142 = zext nneg i32 %134 to i64
  %143 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %141, i64 noundef %142)
  %144 = load i8, ptr %143, align 1, !tbaa !22
  %145 = icmp eq i8 %144, 46
  br i1 %145, label %.loopexit, label %146

146:                                              ; preds = %139
  %147 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %42, i64 noundef %33)
  %148 = load i8, ptr %147, align 1, !tbaa !22
  %149 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %141, i64 noundef %142)
  %150 = load i8, ptr %149, align 1, !tbaa !22
  %.not38.3 = icmp eq i8 %148, %150
  br i1 %.not38.3, label %155, label %151

151:                                              ; preds = %146
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %5) #7
  store i32 %132, ptr %5, align 4, !tbaa !11
  store i32 %134, ptr %26, align 4, !tbaa !13
  %152 = load i32, ptr %4, align 4, !tbaa !8
  %153 = add nsw i32 %152, 1
  store i32 %153, ptr %27, align 4, !tbaa !14
  invoke void @_ZNSt5dequeI1sSaIS0_EE9push_backEOS0_(ptr noundef nonnull align 8 dereferenceable(80) %1, ptr noundef nonnull align 4 dereferenceable(12) %5)
          to label %154 unwind label %67

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

155:                                              ; preds = %146
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %6) #7
  store i32 %132, ptr %6, align 4, !tbaa !11
  store i32 %134, ptr %28, align 4, !tbaa !13
  %156 = load i32, ptr %4, align 4, !tbaa !8
  store i32 %156, ptr %29, align 4, !tbaa !14
  invoke void @_ZNSt5dequeI1sSaIS0_EE10push_frontEOS0_(ptr noundef nonnull align 8 dereferenceable(80) %1, ptr noundef nonnull align 4 dereferenceable(12) %6)
          to label %157 unwind label %72

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

158:                                              ; preds = %72, %67
  %.pn = phi { ptr, i32 } [ %68, %67 ], [ %73, %72 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  br label %167

.loopexit:                                        ; preds = %130, %139, %154, %157, %30
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  %159 = call noundef zeroext i1 @_ZNKSt5dequeI1sSaIS0_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %1) #7
  br i1 %159, label %._crit_edge51, label %30

._crit_edge51:                                    ; preds = %.loopexit, %24
  %160 = load i32, ptr %3, align 4, !tbaa !8
  %161 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %160)
          to label %162 unwind label %165

162:                                              ; preds = %._crit_edge51
  %163 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %161, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %164 unwind label %165

164:                                              ; preds = %162
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  call void @_ZNSt5dequeI1sSaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %1) #7
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %1) #7
  ret i32 0

165:                                              ; preds = %162, %._crit_edge51
  %166 = landingpad { ptr, i32 }
          cleanup
  br label %167

167:                                              ; preds = %165, %158
  %.pn.pn = phi { ptr, i32 } [ %.pn, %158 ], [ %166, %165 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  br label %168

168:                                              ; preds = %167, %37
  %.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn, %167 ], [ %38, %37 ]
  call void @_ZNSt5dequeI1sSaIS0_EED2Ev(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.pn
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) local_unnamed_addr #1

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

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

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

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

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

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

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

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

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

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


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass