; LLVM IR from HarshCasper/NeoAlgo :: C-Plus-Plus/graphs (Bidirectional_search_using_BFS_in_undirected_graph)

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

%"class.std::queue" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl" }
%"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl" = type { %"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl_data" }
%"struct.std::_Deque_base<int, std::allocator<int>>::_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::_Bit_reference" = type { ptr, i64 }

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3bfsRSt5queueIiSt5dequeIiSaIiEEERSt6vectorIbSaIbEERS5_IiS1_EPS9_(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(24), ptr noundef) #0

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

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i64 } @_ZNSt6vectorIbSaIbEEixEm(ptr noundef nonnull align 8 dereferenceable(40), i64 noundef) #0 align 2

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

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

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

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

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z27bidirectional_search_helperiiPSt6vectorIiSaIiEEiRS_IbSaIbEES5_RS1_S6_(i32 noundef %0, i32 noundef %1, ptr noundef %2, i32 noundef %3, ptr noundef nonnull align 8 dereferenceable(40) %4, ptr noundef nonnull align 8 dereferenceable(40) %5, ptr noundef nonnull align 8 dereferenceable(24) %6, ptr noundef nonnull align 8 dereferenceable(24) %7) #0 personality ptr @__gxx_personality_v0 {
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca %"class.std::queue", align 8
  %19 = alloca %"class.std::queue", align 8
  %20 = alloca ptr, align 8
  %21 = alloca i32, align 4
  %22 = alloca %"struct.std::_Bit_reference", align 8
  %23 = alloca %"struct.std::_Bit_reference", align 8
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  %26 = alloca i32, align 4
  %27 = alloca %"struct.std::_Bit_reference", align 8
  %28 = alloca %"struct.std::_Bit_reference", align 8
  %29 = alloca i32, align 4
  store i32 %0, ptr %10, align 4, !tbaa !5
  store i32 %1, ptr %11, align 4, !tbaa !5
  store ptr %2, ptr %12, align 8, !tbaa !9
  store i32 %3, ptr %13, align 4, !tbaa !5
  store ptr %4, ptr %14, align 8, !tbaa !9
  store ptr %5, ptr %15, align 8, !tbaa !9
  store ptr %6, ptr %16, align 8, !tbaa !9
  store ptr %7, ptr %17, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 80, ptr %18) #4
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %18)
  call void @llvm.lifetime.start.p0(i64 80, ptr %19) #4
  invoke void @_ZNSt5queueIiSt5dequeIiSaIiEEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %19)
          to label %30 unwind label %108

30:                                               ; preds = %8
  invoke void @_ZNSt5queueIiSt5dequeIiSaIiEEE4pushERKi(ptr noundef nonnull align 8 dereferenceable(80) %18, ptr noundef nonnull align 4 dereferenceable(4) %10)
          to label %31 unwind label %112

31:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 16, ptr %22) #4
  %32 = load ptr, ptr %14, align 8, !tbaa !9
  %33 = load i32, ptr %10, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = invoke { ptr, i64 } @_ZNSt6vectorIbSaIbEEixEm(ptr noundef nonnull align 8 dereferenceable(40) %32, i64 noundef %34)
          to label %36 unwind label %116

36:                                               ; preds = %31
  %37 = getelementptr inbounds { ptr, i64 }, ptr %22, i32 0, i32 0
  %38 = extractvalue { ptr, i64 } %35, 0
  store ptr %38, ptr %37, align 8
  %39 = getelementptr inbounds { ptr, i64 }, ptr %22, i32 0, i32 1
  %40 = extractvalue { ptr, i64 } %35, 1
  store i64 %40, ptr %39, align 8
  %41 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt14_Bit_referenceaSEb(ptr noundef nonnull align 8 dereferenceable(16) %22, i1 noundef zeroext true) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %22) #4
  invoke void @_ZNSt5queueIiSt5dequeIiSaIiEEE4pushERKi(ptr noundef nonnull align 8 dereferenceable(80) %19, ptr noundef nonnull align 4 dereferenceable(4) %11)
          to label %42 unwind label %112

42:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 16, ptr %23) #4
  %43 = load ptr, ptr %15, align 8, !tbaa !9
  %44 = load i32, ptr %11, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = invoke { ptr, i64 } @_ZNSt6vectorIbSaIbEEixEm(ptr noundef nonnull align 8 dereferenceable(40) %43, i64 noundef %45)
          to label %47 unwind label %120

47:                                               ; preds = %42
  %48 = getelementptr inbounds { ptr, i64 }, ptr %23, i32 0, i32 0
  %49 = extractvalue { ptr, i64 } %46, 0
  store ptr %49, ptr %48, align 8
  %50 = getelementptr inbounds { ptr, i64 }, ptr %23, i32 0, i32 1
  %51 = extractvalue { ptr, i64 } %46, 1
  store i64 %51, ptr %50, align 8
  %52 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt14_Bit_referenceaSEb(ptr noundef nonnull align 8 dereferenceable(16) %23, i1 noundef zeroext true) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %23) #4
  %53 = load ptr, ptr %16, align 8, !tbaa !9
  %54 = load i32, ptr %10, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %53, i64 noundef %55) #4
  store i32 -1, ptr %56, align 4, !tbaa !5
  %57 = load ptr, ptr %17, align 8, !tbaa !9
  %58 = load i32, ptr %11, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %57, i64 noundef %59) #4
  store i32 -1, ptr %60, align 4, !tbaa !5
  br label %61

61:                                               ; preds = %150, %47
  %62 = invoke noundef zeroext i1 @_ZNKSt5queueIiSt5dequeIiSaIiEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %18)
          to label %63 unwind label %112

63:                                               ; preds = %61
  br i1 %62, label %68, label %64

64:                                               ; preds = %63
  %65 = invoke noundef zeroext i1 @_ZNKSt5queueIiSt5dequeIiSaIiEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %19)
          to label %66 unwind label %112

66:                                               ; preds = %64
  %67 = xor i1 %65, true
  br label %68

68:                                               ; preds = %66, %63
  %69 = phi i1 [ false, %63 ], [ %67, %66 ]
  br i1 %69, label %70, label %151

70:                                               ; preds = %68
  %71 = load ptr, ptr %14, align 8, !tbaa !9
  %72 = load ptr, ptr %16, align 8, !tbaa !9
  %73 = load ptr, ptr %12, align 8, !tbaa !9
  invoke void @_Z3bfsRSt5queueIiSt5dequeIiSaIiEEERSt6vectorIbSaIbEERS5_IiS1_EPS9_(ptr noundef nonnull align 8 dereferenceable(80) %18, ptr noundef nonnull align 8 dereferenceable(40) %71, ptr noundef nonnull align 8 dereferenceable(24) %72, ptr noundef %73)
          to label %74 unwind label %112

74:                                               ; preds = %70
  %75 = load ptr, ptr %15, align 8, !tbaa !9
  %76 = load ptr, ptr %17, align 8, !tbaa !9
  %77 = load ptr, ptr %12, align 8, !tbaa !9
  invoke void @_Z3bfsRSt5queueIiSt5dequeIiSaIiEEERSt6vectorIbSaIbEERS5_IiS1_EPS9_(ptr noundef nonnull align 8 dereferenceable(80) %19, ptr noundef nonnull align 8 dereferenceable(40) %75, ptr noundef nonnull align 8 dereferenceable(24) %76, ptr noundef %77)
          to label %78 unwind label %112

78:                                               ; preds = %74
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #4
  store i32 -1, ptr %24, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #4
  store i32 0, ptr %26, align 4, !tbaa !5
  store i32 0, ptr %25, align 4, !tbaa !5
  br label %79

79:                                               ; preds = %134, %78
  %80 = load i32, ptr %25, align 4, !tbaa !5
  %81 = load i32, ptr %13, align 4, !tbaa !5
  %82 = icmp slt i32 %80, %81
  br i1 %82, label %83, label %137

83:                                               ; preds = %79
  call void @llvm.lifetime.start.p0(i64 16, ptr %27) #4
  %84 = load ptr, ptr %14, align 8, !tbaa !9
  %85 = load i32, ptr %25, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  call void @llvm.lifetime.start.p0(i64 16, ptr %28) #4
  %87 = invoke { ptr, i64 } @_ZNSt6vectorIbSaIbEEixEm(ptr noundef nonnull align 8 dereferenceable(40) %84, i64 noundef %86)
          to label %88 unwind label %124

88:                                               ; preds = %83
  %89 = getelementptr inbounds { ptr, i64 }, ptr %27, i32 0, i32 0
  %90 = extractvalue { ptr, i64 } %87, 0
  store ptr %90, ptr %89, align 8
  %91 = getelementptr inbounds { ptr, i64 }, ptr %27, i32 0, i32 1
  %92 = extractvalue { ptr, i64 } %87, 1
  store i64 %92, ptr %91, align 8
  %93 = call noundef zeroext i1 @_ZNKSt14_Bit_referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16) %27) #4
  br i1 %93, label %94, label %105

94:                                               ; preds = %88
  %95 = load ptr, ptr %15, align 8, !tbaa !9
  %96 = load i32, ptr %25, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = invoke { ptr, i64 } @_ZNSt6vectorIbSaIbEEixEm(ptr noundef nonnull align 8 dereferenceable(40) %95, i64 noundef %97)
          to label %99 unwind label %128

99:                                               ; preds = %94
  %100 = getelementptr inbounds { ptr, i64 }, ptr %28, i32 0, i32 0
  %101 = extractvalue { ptr, i64 } %98, 0
  store ptr %101, ptr %100, align 8
  %102 = getelementptr inbounds { ptr, i64 }, ptr %28, i32 0, i32 1
  %103 = extractvalue { ptr, i64 } %98, 1
  store i64 %103, ptr %102, align 8
  %104 = call noundef zeroext i1 @_ZNKSt14_Bit_referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16) %28) #4
  br label %105

105:                                              ; preds = %99, %88
  %106 = phi i1 [ false, %88 ], [ %104, %99 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr %28) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %27) #4
  br i1 %106, label %107, label %133

107:                                              ; preds = %105
  store i32 1, ptr %26, align 4, !tbaa !5
  br label %137

108:                                              ; preds = %8
  %109 = landingpad { ptr, i32 }
          cleanup
  %110 = extractvalue { ptr, i32 } %109, 0
  store ptr %110, ptr %20, align 8
  %111 = extractvalue { ptr, i32 } %109, 1
  store i32 %111, ptr %21, align 4
  br label %155

112:                                              ; preds = %74, %70, %64, %61, %36, %30
  %113 = landingpad { ptr, i32 }
          cleanup
  %114 = extractvalue { ptr, i32 } %113, 0
  store ptr %114, ptr %20, align 8
  %115 = extractvalue { ptr, i32 } %113, 1
  store i32 %115, ptr %21, align 4
  br label %154

116:                                              ; preds = %31
  %117 = landingpad { ptr, i32 }
          cleanup
  %118 = extractvalue { ptr, i32 } %117, 0
  store ptr %118, ptr %20, align 8
  %119 = extractvalue { ptr, i32 } %117, 1
  store i32 %119, ptr %21, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %22) #4
  br label %154

120:                                              ; preds = %42
  %121 = landingpad { ptr, i32 }
          cleanup
  %122 = extractvalue { ptr, i32 } %121, 0
  store ptr %122, ptr %20, align 8
  %123 = extractvalue { ptr, i32 } %121, 1
  store i32 %123, ptr %21, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %23) #4
  br label %154

124:                                              ; preds = %83
  %125 = landingpad { ptr, i32 }
          cleanup
  %126 = extractvalue { ptr, i32 } %125, 0
  store ptr %126, ptr %20, align 8
  %127 = extractvalue { ptr, i32 } %125, 1
  store i32 %127, ptr %21, align 4
  br label %132

128:                                              ; preds = %94
  %129 = landingpad { ptr, i32 }
          cleanup
  %130 = extractvalue { ptr, i32 } %129, 0
  store ptr %130, ptr %20, align 8
  %131 = extractvalue { ptr, i32 } %129, 1
  store i32 %131, ptr %21, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %28) #4
  br label %132

132:                                              ; preds = %128, %124
  call void @llvm.lifetime.end.p0(i64 16, ptr %27) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #4
  br label %154

133:                                              ; preds = %105
  br label %134

134:                                              ; preds = %133
  %135 = load i32, ptr %25, align 4, !tbaa !5
  %136 = add nsw i32 %135, 1
  store i32 %136, ptr %25, align 4, !tbaa !5
  br label %79, !llvm.loop !11

137:                                              ; preds = %107, %79
  %138 = load i32, ptr %26, align 4, !tbaa !5
  %139 = icmp eq i32 %138, 1
  br i1 %139, label %140, label %142

140:                                              ; preds = %137
  %141 = load i32, ptr %25, align 4, !tbaa !5
  store i32 %141, ptr %24, align 4, !tbaa !5
  br label %142

142:                                              ; preds = %140, %137
  %143 = load i32, ptr %24, align 4, !tbaa !5
  %144 = icmp ne i32 %143, -1
  br i1 %144, label %145, label %147

145:                                              ; preds = %142
  %146 = load i32, ptr %24, align 4, !tbaa !5
  store i32 %146, ptr %9, align 4
  store i32 1, ptr %29, align 4
  br label %148

147:                                              ; preds = %142
  store i32 0, ptr %29, align 4
  br label %148

148:                                              ; preds = %147, %145
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #4
  %149 = load i32, ptr %29, align 4
  switch i32 %149, label %152 [
    i32 0, label %150
  ]

150:                                              ; preds = %148
  br label %61, !llvm.loop !13

151:                                              ; preds = %68
  store i32 -1, ptr %9, align 4
  store i32 1, ptr %29, align 4
  br label %152

152:                                              ; preds = %151, %148
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %19) #4
  call void @llvm.lifetime.end.p0(i64 80, ptr %19) #4
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %18) #4
  call void @llvm.lifetime.end.p0(i64 80, ptr %18) #4
  %153 = load i32, ptr %9, align 4
  ret i32 %153

154:                                              ; preds = %132, %120, %116, %112
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %19) #4
  br label %155

155:                                              ; preds = %154, %108
  call void @llvm.lifetime.end.p0(i64 80, ptr %19) #4
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %18) #4
  call void @llvm.lifetime.end.p0(i64 80, ptr %18) #4
  br label %156

156:                                              ; preds = %155
  %157 = load ptr, ptr %20, align 8
  %158 = load i32, ptr %21, align 4
  %159 = insertvalue { ptr, i32 } poison, ptr %157, 0
  %160 = insertvalue { ptr, i32 } %159, i32 %158, 1
  resume { ptr, i32 } %160
}

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

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

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

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !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::queue" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl" }
%"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl" = type { %"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl_data" }
%"struct.std::_Deque_base<int, std::allocator<int>>::_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::_Bit_reference" = type { ptr, i64 }

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3bfsRSt5queueIiSt5dequeIiSaIiEEERSt6vectorIbSaIbEERS5_IiS1_EPS9_(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(24), ptr noundef) local_unnamed_addr #0

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

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i64 } @_ZNSt6vectorIbSaIbEEixEm(ptr noundef nonnull align 8 dereferenceable(40), i64 noundef) local_unnamed_addr #0 align 2

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

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

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

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

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

declare i32 @__gxx_personality_v0(...)

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

17:                                               ; preds = %8
  invoke void @_ZNSt5queueIiSt5dequeIiSaIiEEE4pushERKi(ptr noundef nonnull align 8 dereferenceable(80) %11, ptr noundef nonnull align 4 dereferenceable(4) %9)
          to label %18 unwind label %.loopexit.split-lp

18:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %13) #4
  %19 = load i32, ptr %9, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %21 = invoke { ptr, i64 } @_ZNSt6vectorIbSaIbEEixEm(ptr noundef nonnull align 8 dereferenceable(40) %4, i64 noundef %20)
          to label %22 unwind label %72

22:                                               ; preds = %18
  %23 = extractvalue { ptr, i64 } %21, 0
  store ptr %23, ptr %13, align 8
  %24 = getelementptr inbounds i8, ptr %13, i64 8
  %25 = extractvalue { ptr, i64 } %21, 1
  store i64 %25, ptr %24, align 8
  %26 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt14_Bit_referenceaSEb(ptr noundef nonnull align 8 dereferenceable(16) %13, i1 noundef zeroext true) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %13) #4
  invoke void @_ZNSt5queueIiSt5dequeIiSaIiEEE4pushERKi(ptr noundef nonnull align 8 dereferenceable(80) %12, ptr noundef nonnull align 4 dereferenceable(4) %10)
          to label %27 unwind label %.loopexit.split-lp

27:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %14) #4
  %28 = load i32, ptr %10, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = invoke { ptr, i64 } @_ZNSt6vectorIbSaIbEEixEm(ptr noundef nonnull align 8 dereferenceable(40) %5, i64 noundef %29)
          to label %31 unwind label %74

31:                                               ; preds = %27
  %32 = extractvalue { ptr, i64 } %30, 0
  store ptr %32, ptr %14, align 8
  %33 = getelementptr inbounds i8, ptr %14, i64 8
  %34 = extractvalue { ptr, i64 } %30, 1
  store i64 %34, ptr %33, align 8
  %35 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt14_Bit_referenceaSEb(ptr noundef nonnull align 8 dereferenceable(16) %14, i1 noundef zeroext true) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %14) #4
  %36 = load i32, ptr %9, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef %37) #4
  store i32 -1, ptr %38, align 4, !tbaa !5
  %39 = load i32, ptr %10, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %40) #4
  store i32 -1, ptr %41, align 4, !tbaa !5
  %42 = icmp sgt i32 %3, 0
  %43 = getelementptr inbounds i8, ptr %15, i64 8
  %44 = getelementptr inbounds i8, ptr %16, i64 8
  br i1 %42, label %.split.us.preheader, label %.split

.split.us.preheader:                              ; preds = %31
  %wide.trip.count = zext nneg i32 %3 to i64
  br label %.split.us

.split.us:                                        ; preds = %.split.us.preheader, %._crit_edge.us
  %45 = call noundef zeroext i1 @_ZNKSt5queueIiSt5dequeIiSaIiEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %11)
  br i1 %45, label %.critedge, label %46

46:                                               ; preds = %.split.us
  %47 = call noundef zeroext i1 @_ZNKSt5queueIiSt5dequeIiSaIiEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %12)
  br i1 %47, label %.critedge, label %48

48:                                               ; preds = %46
  invoke void @_Z3bfsRSt5queueIiSt5dequeIiSaIiEEERSt6vectorIbSaIbEERS5_IiS1_EPS9_(ptr noundef nonnull align 8 dereferenceable(80) %11, ptr noundef nonnull align 8 dereferenceable(40) %4, ptr noundef nonnull align 8 dereferenceable(24) %6, ptr noundef %2)
          to label %49 unwind label %.loopexit.split.us

49:                                               ; preds = %48
  invoke void @_Z3bfsRSt5queueIiSt5dequeIiSaIiEEERSt6vectorIbSaIbEERS5_IiS1_EPS9_(ptr noundef nonnull align 8 dereferenceable(80) %12, ptr noundef nonnull align 8 dereferenceable(40) %5, ptr noundef nonnull align 8 dereferenceable(24) %7, ptr noundef %2)
          to label %.preheader.us unwind label %.loopexit.split.us

.preheader.us:                                    ; preds = %49, %61
  %indvars.iv = phi i64 [ %indvars.iv.next, %61 ], [ 0, %49 ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %15) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %16) #4
  %50 = invoke { ptr, i64 } @_ZNSt6vectorIbSaIbEEixEm(ptr noundef nonnull align 8 dereferenceable(40) %4, i64 noundef %indvars.iv)
          to label %51 unwind label %.split44.us

51:                                               ; preds = %.preheader.us
  %52 = extractvalue { ptr, i64 } %50, 0
  store ptr %52, ptr %15, align 8
  %53 = extractvalue { ptr, i64 } %50, 1
  store i64 %53, ptr %43, align 8
  %54 = call noundef zeroext i1 @_ZNKSt14_Bit_referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16) %15) #4
  br i1 %54, label %55, label %.critedge2.us

.critedge2.us:                                    ; preds = %51
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %16) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %15) #4
  br label %61

55:                                               ; preds = %51
  %56 = invoke { ptr, i64 } @_ZNSt6vectorIbSaIbEEixEm(ptr noundef nonnull align 8 dereferenceable(40) %5, i64 noundef %indvars.iv)
          to label %57 unwind label %.split47.us

57:                                               ; preds = %55
  %58 = extractvalue { ptr, i64 } %56, 0
  store ptr %58, ptr %16, align 8
  %59 = extractvalue { ptr, i64 } %56, 1
  store i64 %59, ptr %44, align 8
  %60 = call noundef zeroext i1 @_ZNKSt14_Bit_referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16) %16) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %16) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %15) #4
  br i1 %60, label %._crit_edge.us.split.loop.exit54, label %61

61:                                               ; preds = %57, %.critedge2.us
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge.us, label %.preheader.us, !llvm.loop !9

._crit_edge.us.split.loop.exit54:                 ; preds = %57
  %62 = trunc nuw nsw i64 %indvars.iv to i32
  br label %._crit_edge.us

._crit_edge.us:                                   ; preds = %61, %._crit_edge.us.split.loop.exit54
  %spec.select.us = phi i32 [ %62, %._crit_edge.us.split.loop.exit54 ], [ -1, %61 ]
  %.not.us = icmp eq i32 %spec.select.us, -1
  br i1 %.not.us, label %.split.us, label %.critedge, !llvm.loop !11

.loopexit.split.us:                               ; preds = %49, %48
  %lpad.loopexit.us = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit

.split44.us:                                      ; preds = %.preheader.us
  %63 = landingpad { ptr, i32 }
          cleanup
  br label %76

.split47.us:                                      ; preds = %55
  %64 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %16) #4
  br label %76

.split:                                           ; preds = %31
  %65 = call noundef zeroext i1 @_ZNKSt5queueIiSt5dequeIiSaIiEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %11)
  br i1 %65, label %.critedge, label %.lr.ph

.lr.ph:                                           ; preds = %.split, %.preheader
  %66 = call noundef zeroext i1 @_ZNKSt5queueIiSt5dequeIiSaIiEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %12)
  br i1 %66, label %.critedge, label %67

67:                                               ; preds = %.lr.ph
  invoke void @_Z3bfsRSt5queueIiSt5dequeIiSaIiEEERSt6vectorIbSaIbEERS5_IiS1_EPS9_(ptr noundef nonnull align 8 dereferenceable(80) %11, ptr noundef nonnull align 8 dereferenceable(40) %4, ptr noundef nonnull align 8 dereferenceable(24) %6, ptr noundef %2)
          to label %68 unwind label %.loopexit.split

68:                                               ; preds = %67
  invoke void @_Z3bfsRSt5queueIiSt5dequeIiSaIiEEERSt6vectorIbSaIbEERS5_IiS1_EPS9_(ptr noundef nonnull align 8 dereferenceable(80) %12, ptr noundef nonnull align 8 dereferenceable(40) %5, ptr noundef nonnull align 8 dereferenceable(24) %7, ptr noundef %2)
          to label %.preheader unwind label %.loopexit.split

.preheader:                                       ; preds = %68
  %69 = call noundef zeroext i1 @_ZNKSt5queueIiSt5dequeIiSaIiEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %11)
  br i1 %69, label %.critedge, label %.lr.ph

70:                                               ; preds = %8
  %71 = landingpad { ptr, i32 }
          cleanup
  br label %77

.loopexit.split:                                  ; preds = %67, %68
  %lpad.loopexit = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit

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

72:                                               ; preds = %18
  %73 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %13) #4
  br label %.loopexit

74:                                               ; preds = %27
  %75 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %14) #4
  br label %.loopexit

76:                                               ; preds = %.split47.us, %.split44.us
  %.pn = phi { ptr, i32 } [ %64, %.split47.us ], [ %63, %.split44.us ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %15) #4
  br label %.loopexit

.critedge:                                        ; preds = %.lr.ph, %.preheader, %.split.us, %46, %._crit_edge.us, %.split
  %.us-phi = phi i32 [ -1, %.split ], [ %spec.select.us, %._crit_edge.us ], [ -1, %.split.us ], [ -1, %46 ], [ -1, %.preheader ], [ -1, %.lr.ph ]
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %12) #4
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %12) #4
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %11) #4
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %11) #4
  ret i32 %.us-phi

.loopexit:                                        ; preds = %.loopexit.split-lp, %.loopexit.split.us, %.loopexit.split, %76, %74, %72
  %.pn.pn = phi { ptr, i32 } [ %.pn, %76 ], [ %75, %74 ], [ %73, %72 ], [ %lpad.loopexit.split-lp, %.loopexit.split-lp ], [ %lpad.loopexit, %.loopexit.split ], [ %lpad.loopexit.us, %.loopexit.split.us ]
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %12) #4
  br label %77

77:                                               ; preds = %.loopexit, %70
  %.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn, %.loopexit ], [ %71, %70 ]
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %12) #4
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %11) #4
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %11) #4
  resume { ptr, i32 } %.pn.pn.pn
}

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

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

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

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


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