; LLVM IR from AdarshGaur/Competitive-Programming :: Codeforces/Random Problems/B. Biridian Forest.ll (Z3bfsll)

; 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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<long, std::allocator<long>>::_Vector_impl" }
%"struct.std::_Vector_base<long, std::allocator<long>>::_Vector_impl" = type { %"struct.std::_Vector_base<long, std::allocator<long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<long, std::allocator<long>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::queue" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<std::pair<long, long>, std::allocator<std::pair<long, long>>>::_Deque_impl" }
%"struct.std::_Deque_base<std::pair<long, long>, std::allocator<std::pair<long, long>>>::_Deque_impl" = type { %"struct.std::_Deque_base<std::pair<long, long>, std::allocator<std::pair<long, long>>>::_Deque_impl_data" }
%"struct.std::_Deque_base<std::pair<long, long>, std::allocator<std::pair<long, long>>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }
%"struct.std::pair" = type { i64, i64 }

@_Z6secondB5cxx11 = external dso_local global %"class.std::vector", align 8
@r = external dso_local global i64, align 8
@c = external dso_local global i64, align 8
@dis1 = external dso_local global i64, align 8
@vis = external dso_local global [1002 x [1002 x i8]], align 16
@dis = external dso_local global [1002 x [1002 x i64]], align 16
@dx = external dso_local global %"class.std::vector.0", align 8
@dy = external dso_local global %"class.std::vector.0", align 8

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

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z3bfsll(i64 noundef %0, i64 noundef %1) #2 personality ptr @__gxx_personality_v0 {
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca %"class.std::queue", align 8
  %6 = alloca %"struct.std::pair", align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca %"struct.std::pair", align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i32, align 4
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  %16 = alloca %"struct.std::pair", align 8
  store i64 %0, ptr %3, align 8, !tbaa !5
  store i64 %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 80, ptr %5) #5
  call void @_ZNSt5queueISt4pairIllESt5dequeIS1_SaIS1_EEEC2IS4_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
  call void @llvm.lifetime.start.p0(i64 16, ptr %6) #5
  invoke void @_ZNSt4pairIllEC2IRlS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 8 dereferenceable(16) %6, ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4)
          to label %17 unwind label %48

17:                                               ; preds = %2
  invoke void @_ZNSt5queueISt4pairIllESt5dequeIS1_SaIS1_EEE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(80) %5, ptr noundef nonnull align 8 dereferenceable(16) %6)
          to label %18 unwind label %48

18:                                               ; preds = %17
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #5
  %19 = load i64, ptr %3, align 8, !tbaa !5
  %20 = getelementptr inbounds [1002 x [1002 x i8]], ptr @vis, i64 0, i64 %19
  %21 = load i64, ptr %4, align 8, !tbaa !5
  %22 = getelementptr inbounds [1002 x i8], ptr %20, i64 0, i64 %21
  store i8 1, ptr %22, align 1, !tbaa !9
  br label %23

23:                                               ; preds = %144, %18
  %24 = invoke noundef zeroext i1 @_ZNKSt5queueISt4pairIllESt5dequeIS1_SaIS1_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
          to label %25 unwind label %52

25:                                               ; preds = %23
  %26 = xor i1 %24, true
  br i1 %26, label %27, label %147

27:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #5
  %28 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt5queueISt4pairIllESt5dequeIS1_SaIS1_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
          to label %29 unwind label %56

29:                                               ; preds = %27
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %9, ptr align 8 %28, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %30 = getelementptr inbounds %"struct.std::pair", ptr %9, i32 0, i32 0
  %31 = load i64, ptr %30, align 8, !tbaa !11
  store i64 %31, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %32 = getelementptr inbounds %"struct.std::pair", ptr %9, i32 0, i32 1
  %33 = load i64, ptr %32, align 8, !tbaa !13
  store i64 %33, ptr %11, align 8, !tbaa !5
  %34 = load i64, ptr %10, align 8, !tbaa !5
  %35 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @_Z6secondB5cxx11, i64 noundef %34) #5
  %36 = load i64, ptr %11, align 8, !tbaa !5
  %37 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %35, i64 noundef %36)
          to label %38 unwind label %60

38:                                               ; preds = %29
  %39 = load i8, ptr %37, align 1, !tbaa !14
  %40 = sext i8 %39 to i32
  %41 = icmp eq i32 %40, 69
  br i1 %41, label %42, label %64

42:                                               ; preds = %38
  %43 = load i64, ptr %10, align 8, !tbaa !5
  %44 = getelementptr inbounds [1002 x [1002 x i64]], ptr @dis, i64 0, i64 %43
  %45 = load i64, ptr %11, align 8, !tbaa !5
  %46 = getelementptr inbounds [1002 x i64], ptr %44, i64 0, i64 %45
  %47 = load i64, ptr %46, align 8, !tbaa !5
  store i64 %47, ptr @dis1, align 8, !tbaa !5
  store i32 3, ptr %12, align 4
  br label %142

48:                                               ; preds = %17, %2
  %49 = landingpad { ptr, i32 }
          cleanup
  %50 = extractvalue { ptr, i32 } %49, 0
  store ptr %50, ptr %7, align 8
  %51 = extractvalue { ptr, i32 } %49, 1
  store i32 %51, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #5
  br label %148

52:                                               ; preds = %23
  %53 = landingpad { ptr, i32 }
          cleanup
  %54 = extractvalue { ptr, i32 } %53, 0
  store ptr %54, ptr %7, align 8
  %55 = extractvalue { ptr, i32 } %53, 1
  store i32 %55, ptr %8, align 4
  br label %148

56:                                               ; preds = %27
  %57 = landingpad { ptr, i32 }
          cleanup
  %58 = extractvalue { ptr, i32 } %57, 0
  store ptr %58, ptr %7, align 8
  %59 = extractvalue { ptr, i32 } %57, 1
  store i32 %59, ptr %8, align 4
  br label %146

60:                                               ; preds = %64, %29
  %61 = landingpad { ptr, i32 }
          cleanup
  %62 = extractvalue { ptr, i32 } %61, 0
  store ptr %62, ptr %7, align 8
  %63 = extractvalue { ptr, i32 } %61, 1
  store i32 %63, ptr %8, align 4
  br label %145

64:                                               ; preds = %38
  invoke void @_ZNSt5queueISt4pairIllESt5dequeIS1_SaIS1_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
          to label %65 unwind label %60

65:                                               ; preds = %64
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  store i64 0, ptr %13, align 8, !tbaa !5
  br label %66

66:                                               ; preds = %137, %65
  %67 = load i64, ptr %13, align 8, !tbaa !5
  %68 = icmp slt i64 %67, 4
  br i1 %68, label %70, label %69

69:                                               ; preds = %66
  store i32 4, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  br label %141

70:                                               ; preds = %66
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %71 = load i64, ptr %10, align 8, !tbaa !5
  %72 = load i64, ptr %13, align 8, !tbaa !5
  %73 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @dx, i64 noundef %72) #5
  %74 = load i64, ptr %73, align 8, !tbaa !5
  %75 = add nsw i64 %71, %74
  store i64 %75, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %76 = load i64, ptr %11, align 8, !tbaa !5
  %77 = load i64, ptr %13, align 8, !tbaa !5
  %78 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @dy, i64 noundef %77) #5
  %79 = load i64, ptr %78, align 8, !tbaa !5
  %80 = add nsw i64 %76, %79
  store i64 %80, ptr %15, align 8, !tbaa !5
  %81 = load i64, ptr %14, align 8, !tbaa !5
  %82 = load i64, ptr @r, align 8, !tbaa !5
  %83 = icmp slt i64 %81, %82
  br i1 %83, label %84, label %136

84:                                               ; preds = %70
  %85 = load i64, ptr %14, align 8, !tbaa !5
  %86 = icmp sge i64 %85, 0
  br i1 %86, label %87, label %136

87:                                               ; preds = %84
  %88 = load i64, ptr %15, align 8, !tbaa !5
  %89 = icmp sge i64 %88, 0
  br i1 %89, label %90, label %136

90:                                               ; preds = %87
  %91 = load i64, ptr %15, align 8, !tbaa !5
  %92 = load i64, ptr @c, align 8, !tbaa !5
  %93 = icmp slt i64 %91, %92
  br i1 %93, label %94, label %136

94:                                               ; preds = %90
  %95 = load i64, ptr %14, align 8, !tbaa !5
  %96 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @_Z6secondB5cxx11, i64 noundef %95) #5
  %97 = load i64, ptr %15, align 8, !tbaa !5
  %98 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %96, i64 noundef %97)
          to label %99 unwind label %127

99:                                               ; preds = %94
  %100 = load i8, ptr %98, align 1, !tbaa !14
  %101 = sext i8 %100 to i32
  %102 = icmp ne i32 %101, 84
  br i1 %102, label %103, label %136

103:                                              ; preds = %99
  %104 = load i64, ptr %14, align 8, !tbaa !5
  %105 = getelementptr inbounds [1002 x [1002 x i8]], ptr @vis, i64 0, i64 %104
  %106 = load i64, ptr %15, align 8, !tbaa !5
  %107 = getelementptr inbounds [1002 x i8], ptr %105, i64 0, i64 %106
  %108 = load i8, ptr %107, align 1, !tbaa !9, !range !15, !noundef !16
  %109 = trunc i8 %108 to i1
  br i1 %109, label %135, label %110

110:                                              ; preds = %103
  call void @llvm.lifetime.start.p0(i64 16, ptr %16) #5
  invoke void @_ZNSt4pairIllEC2IRlS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 8 dereferenceable(16) %16, ptr noundef nonnull align 8 dereferenceable(8) %14, ptr noundef nonnull align 8 dereferenceable(8) %15)
          to label %111 unwind label %131

111:                                              ; preds = %110
  invoke void @_ZNSt5queueISt4pairIllESt5dequeIS1_SaIS1_EEE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(80) %5, ptr noundef nonnull align 8 dereferenceable(16) %16)
          to label %112 unwind label %131

112:                                              ; preds = %111
  call void @llvm.lifetime.end.p0(i64 16, ptr %16) #5
  %113 = load i64, ptr %14, align 8, !tbaa !5
  %114 = getelementptr inbounds [1002 x [1002 x i8]], ptr @vis, i64 0, i64 %113
  %115 = load i64, ptr %15, align 8, !tbaa !5
  %116 = getelementptr inbounds [1002 x i8], ptr %114, i64 0, i64 %115
  store i8 1, ptr %116, align 1, !tbaa !9
  %117 = load i64, ptr %10, align 8, !tbaa !5
  %118 = getelementptr inbounds [1002 x [1002 x i64]], ptr @dis, i64 0, i64 %117
  %119 = load i64, ptr %11, align 8, !tbaa !5
  %120 = getelementptr inbounds [1002 x i64], ptr %118, i64 0, i64 %119
  %121 = load i64, ptr %120, align 8, !tbaa !5
  %122 = add nsw i64 %121, 1
  %123 = load i64, ptr %14, align 8, !tbaa !5
  %124 = getelementptr inbounds [1002 x [1002 x i64]], ptr @dis, i64 0, i64 %123
  %125 = load i64, ptr %15, align 8, !tbaa !5
  %126 = getelementptr inbounds [1002 x i64], ptr %124, i64 0, i64 %125
  store i64 %122, ptr %126, align 8, !tbaa !5
  br label %135

127:                                              ; preds = %94
  %128 = landingpad { ptr, i32 }
          cleanup
  %129 = extractvalue { ptr, i32 } %128, 0
  store ptr %129, ptr %7, align 8
  %130 = extractvalue { ptr, i32 } %128, 1
  store i32 %130, ptr %8, align 4
  br label %140

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

135:                                              ; preds = %112, %103
  br label %136

136:                                              ; preds = %135, %99, %90, %87, %84, %70
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  br label %137

137:                                              ; preds = %136
  %138 = load i64, ptr %13, align 8, !tbaa !5
  %139 = add nsw i64 %138, 1
  store i64 %139, ptr %13, align 8, !tbaa !5
  br label %66, !llvm.loop !17

140:                                              ; preds = %131, %127
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  br label %145

141:                                              ; preds = %69
  store i32 0, ptr %12, align 4
  br label %142

142:                                              ; preds = %141, %42
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #5
  %143 = load i32, ptr %12, align 4
  switch i32 %143, label %154 [
    i32 0, label %144
    i32 3, label %147
  ]

144:                                              ; preds = %142
  br label %23, !llvm.loop !19

145:                                              ; preds = %140, %60
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br label %146

146:                                              ; preds = %145, %56
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #5
  br label %148

147:                                              ; preds = %142, %25
  call void @_ZNSt5queueISt4pairIllESt5dequeIS1_SaIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %5) #5
  call void @llvm.lifetime.end.p0(i64 80, ptr %5) #5
  ret void

148:                                              ; preds = %146, %52, %48
  call void @_ZNSt5queueISt4pairIllESt5dequeIS1_SaIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %5) #5
  call void @llvm.lifetime.end.p0(i64 80, ptr %5) #5
  br label %149

149:                                              ; preds = %148
  %150 = load ptr, ptr %7, align 8
  %151 = load i32, ptr %8, align 4
  %152 = insertvalue { ptr, i32 } poison, ptr %150, 0
  %153 = insertvalue { ptr, i32 } %152, i32 %151, 1
  resume { ptr, i32 } %153

154:                                              ; preds = %142
  unreachable
}

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIllEC2IRlS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #3 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #3 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #3 align 2

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

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


; 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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<long, std::allocator<long>>::_Vector_impl" }
%"struct.std::_Vector_base<long, std::allocator<long>>::_Vector_impl" = type { %"struct.std::_Vector_base<long, std::allocator<long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<long, std::allocator<long>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::queue" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<std::pair<long, long>, std::allocator<std::pair<long, long>>>::_Deque_impl" }
%"struct.std::_Deque_base<std::pair<long, long>, std::allocator<std::pair<long, long>>>::_Deque_impl" = type { %"struct.std::_Deque_base<std::pair<long, long>, std::allocator<std::pair<long, long>>>::_Deque_impl_data" }
%"struct.std::_Deque_base<std::pair<long, long>, std::allocator<std::pair<long, long>>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }
%"struct.std::pair" = type { i64, i64 }

@_Z6secondB5cxx11 = external dso_local global %"class.std::vector", align 8
@r = external dso_local local_unnamed_addr global i64, align 8
@c = external dso_local local_unnamed_addr global i64, align 8
@dis1 = external dso_local local_unnamed_addr global i64, align 8
@vis = external dso_local local_unnamed_addr global [1002 x [1002 x i8]], align 16
@dis = external dso_local local_unnamed_addr global [1002 x [1002 x i64]], align 16
@dx = external dso_local global %"class.std::vector.0", align 8
@dy = external dso_local global %"class.std::vector.0", align 8

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z3bfsll(i64 noundef %0, i64 noundef %1) local_unnamed_addr #1 personality ptr @__gxx_personality_v0 {
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca %"class.std::queue", align 8
  %6 = alloca %"struct.std::pair", align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca %"struct.std::pair", align 8
  store i64 %0, ptr %3, align 8, !tbaa !5
  store i64 %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %5) #4
  call void @_ZNSt5queueISt4pairIllESt5dequeIS1_SaIS1_EEEC2IS4_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #4
  call void @_ZNSt4pairIllEC2IRlS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 8 dereferenceable(16) %6, ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4)
  invoke void @_ZNSt5queueISt4pairIllESt5dequeIS1_SaIS1_EEE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(80) %5, ptr noundef nonnull align 8 dereferenceable(16) %6)
          to label %10 unwind label %22

10:                                               ; preds = %2
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #4
  %11 = load i64, ptr %3, align 8, !tbaa !5
  %12 = load i64, ptr %4, align 8, !tbaa !5
  %13 = getelementptr inbounds [1002 x [1002 x i8]], ptr @vis, i64 0, i64 %11, i64 %12
  store i8 1, ptr %13, align 1, !tbaa !9
  %14 = call noundef zeroext i1 @_ZNKSt5queueISt4pairIllESt5dequeIS1_SaIS1_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
  br i1 %14, label %.loopexit27, label %.lr.ph

.lr.ph:                                           ; preds = %10, %.loopexit
  %15 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt5queueISt4pairIllESt5dequeIS1_SaIS1_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
  %.sroa.0.0.copyload = load i64, ptr %15, align 8
  %.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %15, i64 8
  %.sroa.5.0.copyload = load i64, ptr %.sroa.5.0..sroa_idx, align 8
  %16 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @_Z6secondB5cxx11, i64 noundef %.sroa.0.0.copyload) #4
  %17 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %16, i64 noundef %.sroa.5.0.copyload)
  %18 = load i8, ptr %17, align 1, !tbaa !11
  %19 = icmp eq i8 %18, 69
  br i1 %19, label %.thread, label %24

.thread:                                          ; preds = %.lr.ph
  %20 = getelementptr inbounds [1002 x [1002 x i64]], ptr @dis, i64 0, i64 %.sroa.0.0.copyload, i64 %.sroa.5.0.copyload
  %21 = load i64, ptr %20, align 8, !tbaa !5
  store i64 %21, ptr @dis1, align 8, !tbaa !5
  br label %.loopexit27

22:                                               ; preds = %2
  %23 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #4
  br label %160

24:                                               ; preds = %.lr.ph
  call void @_ZNSt5queueISt4pairIllESt5dequeIS1_SaIS1_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
  %25 = getelementptr inbounds [1002 x [1002 x i64]], ptr @dis, i64 0, i64 %.sroa.0.0.copyload, i64 %.sroa.5.0.copyload
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #4
  %26 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @dx, i64 noundef 0) #4
  %27 = load i64, ptr %26, align 8, !tbaa !5
  %28 = add nsw i64 %27, %.sroa.0.0.copyload
  store i64 %28, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #4
  %29 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @dy, i64 noundef 0) #4
  %30 = load i64, ptr %29, align 8, !tbaa !5
  %31 = add nsw i64 %30, %.sroa.5.0.copyload
  store i64 %31, ptr %8, align 8, !tbaa !5
  %32 = load i64, ptr %7, align 8
  %33 = load i64, ptr @r, align 8, !tbaa !5
  %34 = icmp slt i64 %32, %33
  %35 = icmp sgt i64 %32, -1
  %or.cond = and i1 %35, %34
  %36 = icmp sgt i64 %31, -1
  %or.cond3 = select i1 %or.cond, i1 %36, i1 false
  %37 = load i64, ptr @c, align 8
  %38 = icmp slt i64 %31, %37
  %or.cond24 = select i1 %or.cond3, i1 %38, i1 false
  br i1 %or.cond24, label %39, label %60

39:                                               ; preds = %24
  %40 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @_Z6secondB5cxx11, i64 noundef %32) #4
  %41 = load i64, ptr %8, align 8, !tbaa !5
  %42 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %40, i64 noundef %41)
  %43 = load i8, ptr %42, align 1, !tbaa !11
  %.not = icmp eq i8 %43, 84
  br i1 %.not, label %60, label %44

44:                                               ; preds = %39
  %45 = load i64, ptr %7, align 8, !tbaa !5
  %46 = load i64, ptr %8, align 8, !tbaa !5
  %47 = getelementptr inbounds [1002 x [1002 x i8]], ptr @vis, i64 0, i64 %45, i64 %46
  %48 = load i8, ptr %47, align 1, !tbaa !9, !range !12, !noundef !13
  %49 = trunc nuw i8 %48 to i1
  br i1 %49, label %60, label %50

50:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %9) #4
  call void @_ZNSt4pairIllEC2IRlS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8)
  invoke void @_ZNSt5queueISt4pairIllESt5dequeIS1_SaIS1_EEE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(80) %5, ptr noundef nonnull align 8 dereferenceable(16) %9)
          to label %51 unwind label %58

51:                                               ; preds = %50
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #4
  %52 = load i64, ptr %7, align 8, !tbaa !5
  %53 = load i64, ptr %8, align 8, !tbaa !5
  %54 = getelementptr inbounds [1002 x [1002 x i8]], ptr @vis, i64 0, i64 %52, i64 %53
  store i8 1, ptr %54, align 1, !tbaa !9
  %55 = load i64, ptr %25, align 8, !tbaa !5
  %56 = add nsw i64 %55, 1
  %57 = getelementptr inbounds [1002 x [1002 x i64]], ptr @dis, i64 0, i64 %52, i64 %53
  store i64 %56, ptr %57, align 8, !tbaa !5
  br label %60

58:                                               ; preds = %151, %118, %85, %50
  %59 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #4
  br label %160

60:                                               ; preds = %44, %51, %39, %24
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #4
  %61 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @dx, i64 noundef 1) #4
  %62 = load i64, ptr %61, align 8, !tbaa !5
  %63 = add nsw i64 %62, %.sroa.0.0.copyload
  store i64 %63, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #4
  %64 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @dy, i64 noundef 1) #4
  %65 = load i64, ptr %64, align 8, !tbaa !5
  %66 = add nsw i64 %65, %.sroa.5.0.copyload
  store i64 %66, ptr %8, align 8, !tbaa !5
  %67 = load i64, ptr %7, align 8
  %68 = load i64, ptr @r, align 8, !tbaa !5
  %69 = icmp slt i64 %67, %68
  %70 = icmp sgt i64 %67, -1
  %or.cond.1 = and i1 %70, %69
  %71 = icmp sgt i64 %66, -1
  %or.cond3.1 = select i1 %or.cond.1, i1 %71, i1 false
  %72 = load i64, ptr @c, align 8
  %73 = icmp slt i64 %66, %72
  %or.cond24.1 = select i1 %or.cond3.1, i1 %73, i1 false
  br i1 %or.cond24.1, label %74, label %93

74:                                               ; preds = %60
  %75 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @_Z6secondB5cxx11, i64 noundef %67) #4
  %76 = load i64, ptr %8, align 8, !tbaa !5
  %77 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %75, i64 noundef %76)
  %78 = load i8, ptr %77, align 1, !tbaa !11
  %.not.1 = icmp eq i8 %78, 84
  br i1 %.not.1, label %93, label %79

79:                                               ; preds = %74
  %80 = load i64, ptr %7, align 8, !tbaa !5
  %81 = load i64, ptr %8, align 8, !tbaa !5
  %82 = getelementptr inbounds [1002 x [1002 x i8]], ptr @vis, i64 0, i64 %80, i64 %81
  %83 = load i8, ptr %82, align 1, !tbaa !9, !range !12, !noundef !13
  %84 = trunc nuw i8 %83 to i1
  br i1 %84, label %93, label %85

85:                                               ; preds = %79
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %9) #4
  call void @_ZNSt4pairIllEC2IRlS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8)
  invoke void @_ZNSt5queueISt4pairIllESt5dequeIS1_SaIS1_EEE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(80) %5, ptr noundef nonnull align 8 dereferenceable(16) %9)
          to label %86 unwind label %58

86:                                               ; preds = %85
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #4
  %87 = load i64, ptr %7, align 8, !tbaa !5
  %88 = load i64, ptr %8, align 8, !tbaa !5
  %89 = getelementptr inbounds [1002 x [1002 x i8]], ptr @vis, i64 0, i64 %87, i64 %88
  store i8 1, ptr %89, align 1, !tbaa !9
  %90 = load i64, ptr %25, align 8, !tbaa !5
  %91 = add nsw i64 %90, 1
  %92 = getelementptr inbounds [1002 x [1002 x i64]], ptr @dis, i64 0, i64 %87, i64 %88
  store i64 %91, ptr %92, align 8, !tbaa !5
  br label %93

93:                                               ; preds = %86, %79, %74, %60
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #4
  %94 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @dx, i64 noundef 2) #4
  %95 = load i64, ptr %94, align 8, !tbaa !5
  %96 = add nsw i64 %95, %.sroa.0.0.copyload
  store i64 %96, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #4
  %97 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @dy, i64 noundef 2) #4
  %98 = load i64, ptr %97, align 8, !tbaa !5
  %99 = add nsw i64 %98, %.sroa.5.0.copyload
  store i64 %99, ptr %8, align 8, !tbaa !5
  %100 = load i64, ptr %7, align 8
  %101 = load i64, ptr @r, align 8, !tbaa !5
  %102 = icmp slt i64 %100, %101
  %103 = icmp sgt i64 %100, -1
  %or.cond.2 = and i1 %103, %102
  %104 = icmp sgt i64 %99, -1
  %or.cond3.2 = select i1 %or.cond.2, i1 %104, i1 false
  %105 = load i64, ptr @c, align 8
  %106 = icmp slt i64 %99, %105
  %or.cond24.2 = select i1 %or.cond3.2, i1 %106, i1 false
  br i1 %or.cond24.2, label %107, label %126

107:                                              ; preds = %93
  %108 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @_Z6secondB5cxx11, i64 noundef %100) #4
  %109 = load i64, ptr %8, align 8, !tbaa !5
  %110 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %108, i64 noundef %109)
  %111 = load i8, ptr %110, align 1, !tbaa !11
  %.not.2 = icmp eq i8 %111, 84
  br i1 %.not.2, label %126, label %112

112:                                              ; preds = %107
  %113 = load i64, ptr %7, align 8, !tbaa !5
  %114 = load i64, ptr %8, align 8, !tbaa !5
  %115 = getelementptr inbounds [1002 x [1002 x i8]], ptr @vis, i64 0, i64 %113, i64 %114
  %116 = load i8, ptr %115, align 1, !tbaa !9, !range !12, !noundef !13
  %117 = trunc nuw i8 %116 to i1
  br i1 %117, label %126, label %118

118:                                              ; preds = %112
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %9) #4
  call void @_ZNSt4pairIllEC2IRlS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8)
  invoke void @_ZNSt5queueISt4pairIllESt5dequeIS1_SaIS1_EEE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(80) %5, ptr noundef nonnull align 8 dereferenceable(16) %9)
          to label %119 unwind label %58

119:                                              ; preds = %118
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #4
  %120 = load i64, ptr %7, align 8, !tbaa !5
  %121 = load i64, ptr %8, align 8, !tbaa !5
  %122 = getelementptr inbounds [1002 x [1002 x i8]], ptr @vis, i64 0, i64 %120, i64 %121
  store i8 1, ptr %122, align 1, !tbaa !9
  %123 = load i64, ptr %25, align 8, !tbaa !5
  %124 = add nsw i64 %123, 1
  %125 = getelementptr inbounds [1002 x [1002 x i64]], ptr @dis, i64 0, i64 %120, i64 %121
  store i64 %124, ptr %125, align 8, !tbaa !5
  br label %126

126:                                              ; preds = %119, %112, %107, %93
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #4
  %127 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @dx, i64 noundef 3) #4
  %128 = load i64, ptr %127, align 8, !tbaa !5
  %129 = add nsw i64 %128, %.sroa.0.0.copyload
  store i64 %129, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #4
  %130 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @dy, i64 noundef 3) #4
  %131 = load i64, ptr %130, align 8, !tbaa !5
  %132 = add nsw i64 %131, %.sroa.5.0.copyload
  store i64 %132, ptr %8, align 8, !tbaa !5
  %133 = load i64, ptr %7, align 8
  %134 = load i64, ptr @r, align 8, !tbaa !5
  %135 = icmp slt i64 %133, %134
  %136 = icmp sgt i64 %133, -1
  %or.cond.3 = and i1 %136, %135
  %137 = icmp sgt i64 %132, -1
  %or.cond3.3 = select i1 %or.cond.3, i1 %137, i1 false
  %138 = load i64, ptr @c, align 8
  %139 = icmp slt i64 %132, %138
  %or.cond24.3 = select i1 %or.cond3.3, i1 %139, i1 false
  br i1 %or.cond24.3, label %140, label %.loopexit

140:                                              ; preds = %126
  %141 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @_Z6secondB5cxx11, i64 noundef %133) #4
  %142 = load i64, ptr %8, align 8, !tbaa !5
  %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 !11
  %.not.3 = icmp eq i8 %144, 84
  br i1 %.not.3, label %.loopexit, label %145

145:                                              ; preds = %140
  %146 = load i64, ptr %7, align 8, !tbaa !5
  %147 = load i64, ptr %8, align 8, !tbaa !5
  %148 = getelementptr inbounds [1002 x [1002 x i8]], ptr @vis, i64 0, i64 %146, i64 %147
  %149 = load i8, ptr %148, align 1, !tbaa !9, !range !12, !noundef !13
  %150 = trunc nuw i8 %149 to i1
  br i1 %150, label %.loopexit, label %151

151:                                              ; preds = %145
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %9) #4
  call void @_ZNSt4pairIllEC2IRlS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8)
  invoke void @_ZNSt5queueISt4pairIllESt5dequeIS1_SaIS1_EEE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(80) %5, ptr noundef nonnull align 8 dereferenceable(16) %9)
          to label %152 unwind label %58

152:                                              ; preds = %151
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #4
  %153 = load i64, ptr %7, align 8, !tbaa !5
  %154 = load i64, ptr %8, align 8, !tbaa !5
  %155 = getelementptr inbounds [1002 x [1002 x i8]], ptr @vis, i64 0, i64 %153, i64 %154
  store i8 1, ptr %155, align 1, !tbaa !9
  %156 = load i64, ptr %25, align 8, !tbaa !5
  %157 = add nsw i64 %156, 1
  %158 = getelementptr inbounds [1002 x [1002 x i64]], ptr @dis, i64 0, i64 %153, i64 %154
  store i64 %157, ptr %158, align 8, !tbaa !5
  br label %.loopexit

.loopexit:                                        ; preds = %152, %145, %140, %126
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #4
  %159 = call noundef zeroext i1 @_ZNKSt5queueISt4pairIllESt5dequeIS1_SaIS1_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
  br i1 %159, label %.loopexit27, label %.lr.ph

.loopexit27:                                      ; preds = %.loopexit, %10, %.thread
  call void @_ZNSt5queueISt4pairIllESt5dequeIS1_SaIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %5) #4
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %5) #4
  ret void

160:                                              ; preds = %58, %22
  %.pn = phi { ptr, i32 } [ %59, %58 ], [ %23, %22 ]
  call void @_ZNSt5queueISt4pairIllESt5dequeIS1_SaIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %5) #4
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %5) #4
  resume { ptr, i32 } %.pn
}

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

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

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

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #2 align 2

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress 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 = { 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 #4 = { 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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{i8 0, i8 2}
!13 = !{}


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