; LLVM IR from BehaviorTree/BehaviorTree.CPP :: src/controls/parallel_all_node.ll (ZN2BT15ParallelAllNode4tickEv)

; 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.nonstd::expected_lite::expected" = type { %"class.nonstd::expected_lite::detail::storage_t" }
%"class.nonstd::expected_lite::detail::storage_t" = type { %"class.nonstd::expected_lite::detail::storage_t_impl.base", [7 x i8] }
%"class.nonstd::expected_lite::detail::storage_t_impl.base" = type <{ %union.anon.27, i8 }>
%union.anon.27 = type { %"class.std::__cxx11::basic_string" }
%"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::allocator" = type { i8 }
%"struct.std::pair" = type <{ %"struct.std::_Rb_tree_const_iterator", i8, [7 x i8] }>
%"struct.std::_Rb_tree_const_iterator" = type { ptr }
%"class.BT::ControlNode" = type { %"class.BT::TreeNode", %"class.std::vector" }
%"class.BT::TreeNode" = type { ptr, %"class.std::unique_ptr" }
%"class.std::unique_ptr" = type { %"struct.std::__uniq_ptr_data" }
%"struct.std::__uniq_ptr_data" = type { %"class.std::__uniq_ptr_impl" }
%"class.std::__uniq_ptr_impl" = type { %"class.std::tuple" }
%"class.std::tuple" = type { %"struct.std::_Tuple_impl" }
%"struct.std::_Tuple_impl" = type { %"struct.std::_Head_base.1" }
%"struct.std::_Head_base.1" = type { ptr }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<BT::TreeNode *, std::allocator<BT::TreeNode *>>::_Vector_impl" }
%"struct.std::_Vector_base<BT::TreeNode *, std::allocator<BT::TreeNode *>>::_Vector_impl" = type { %"struct.std::_Vector_base<BT::TreeNode *, std::allocator<BT::TreeNode *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<BT::TreeNode *, std::allocator<BT::TreeNode *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.BT::ParallelAllNode" = type { %"class.BT::ControlNode", i64, %"class.std::set", i64 }
%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<unsigned long, unsigned long, std::_Identity<unsigned long>, std::less<unsigned long>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<unsigned long, unsigned long, std::_Identity<unsigned long>, std::less<unsigned long>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }

@.str.11 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [49 x i8], align 1
@_ZTIN2BT12RuntimeErrorE = external dso_local constant { ptr, ptr, ptr }, align 8
@.str.13 = external hidden unnamed_addr constant [59 x i8], align 1
@_ZTIN2BT10LogicErrorE = external dso_local constant { ptr, ptr, ptr }, align 8
@.str.14 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [37 x i8], align 1

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

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 2

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

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 nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN2BT15ParallelAllNode4tickEv(ptr noundef nonnull align 8 dereferenceable(104) %0) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca %"class.nonstd::expected_lite::expected", align 8
  %6 = alloca %"class.std::__cxx11::basic_string", align 8
  %7 = alloca %"class.std::allocator", align 1
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca %"struct.std::pair", align 8
  %17 = alloca %"struct.std::pair", align 8
  %18 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  %19 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 0, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 40, ptr %5) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #6
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %7) #6
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %6, ptr noundef @.str.11, ptr noundef nonnull align 1 dereferenceable(1) %7)
          to label %20 unwind label %27

20:                                               ; preds = %1
  invoke void @_ZNK2BT8TreeNode8getInputIiEEN6nonstd13expected_lite8expectedISt9monostateNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEERKSB_RT_(ptr dead_on_unwind writable sret(%"class.nonstd::expected_lite::expected") align 8 %5, ptr noundef nonnull align 8 dereferenceable(16) %19, ptr noundef nonnull align 8 dereferenceable(32) %6, ptr noundef nonnull align 4 dereferenceable(4) %4)
          to label %21 unwind label %31

21:                                               ; preds = %20
  %22 = call noundef zeroext i1 @_ZNK6nonstd13expected_lite8expectedISt9monostateNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEcvbEv(ptr noundef nonnull align 8 dereferenceable(40) %5) #6
  %23 = xor i1 %22, true
  call void @_ZN6nonstd13expected_lite8expectedISt9monostateNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEED2Ev(ptr noundef nonnull align 8 dereferenceable(40) %5) #6
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #6
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %7) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 40, ptr %5) #6
  br i1 %23, label %24, label %40

24:                                               ; preds = %21
  %25 = call ptr @__cxa_allocate_exception(i64 40) #6
  invoke void @_ZN2BT12RuntimeErrorC2IJA49_cEEEDpRKT_(ptr noundef nonnull align 8 dereferenceable(40) %25, ptr noundef nonnull align 1 dereferenceable(49) @.str.12)
          to label %26 unwind label %36

26:                                               ; preds = %24
  call void @__cxa_throw(ptr %25, ptr @_ZTIN2BT12RuntimeErrorE, ptr @_ZN2BT21BehaviorTreeExceptionD2Ev) #7
  unreachable

27:                                               ; preds = %1
  %28 = landingpad { ptr, i32 }
          cleanup
  %29 = extractvalue { ptr, i32 } %28, 0
  store ptr %29, ptr %8, align 8
  %30 = extractvalue { ptr, i32 } %28, 1
  store i32 %30, ptr %9, align 4
  br label %35

31:                                               ; preds = %20
  %32 = landingpad { ptr, i32 }
          cleanup
  %33 = extractvalue { ptr, i32 } %32, 0
  store ptr %33, ptr %8, align 8
  %34 = extractvalue { ptr, i32 } %32, 1
  store i32 %34, ptr %9, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #6
  br label %35

35:                                               ; preds = %31, %27
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %7) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 40, ptr %5) #6
  br label %141

36:                                               ; preds = %24
  %37 = landingpad { ptr, i32 }
          cleanup
  %38 = extractvalue { ptr, i32 } %37, 0
  store ptr %38, ptr %8, align 8
  %39 = extractvalue { ptr, i32 } %37, 1
  store i32 %39, ptr %9, align 4
  call void @__cxa_free_exception(ptr %25) #6
  br label %141

40:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %41 = getelementptr inbounds %"class.BT::ControlNode", ptr %19, i32 0, i32 1
  %42 = call noundef i64 @_ZNKSt6vectorIPN2BT8TreeNodeESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %41) #6
  store i64 %42, ptr %10, align 8, !tbaa !11
  %43 = load i32, ptr %4, align 4, !tbaa !9
  call void @_ZN2BT15ParallelAllNode19setFailureThresholdEi(ptr noundef nonnull align 8 dereferenceable(104) %19, i32 noundef %43)
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  store i64 0, ptr %11, align 8, !tbaa !11
  %44 = load i64, ptr %10, align 8, !tbaa !11
  %45 = getelementptr inbounds %"class.BT::ParallelAllNode", ptr %19, i32 0, i32 1
  %46 = load i64, ptr %45, align 8, !tbaa !13
  %47 = icmp ult i64 %44, %46
  br i1 %47, label %48, label %55

48:                                               ; preds = %40
  %49 = call ptr @__cxa_allocate_exception(i64 40) #6
  invoke void @_ZN2BT10LogicErrorC2IJA59_cEEEDpRKT_(ptr noundef nonnull align 8 dereferenceable(40) %49, ptr noundef nonnull align 1 dereferenceable(59) @.str.13)
          to label %50 unwind label %51

50:                                               ; preds = %48
  call void @__cxa_throw(ptr %49, ptr @_ZTIN2BT10LogicErrorE, ptr @_ZN2BT21BehaviorTreeExceptionD2Ev) #7
  unreachable

51:                                               ; preds = %48
  %52 = landingpad { ptr, i32 }
          cleanup
  %53 = extractvalue { ptr, i32 } %52, 0
  store ptr %53, ptr %8, align 8
  %54 = extractvalue { ptr, i32 } %52, 1
  store i32 %54, ptr %9, align 4
  call void @__cxa_free_exception(ptr %49) #6
  br label %140

55:                                               ; preds = %40
  call void @_ZN2BT8TreeNode9setStatusENS_10NodeStatusE(ptr noundef nonnull align 8 dereferenceable(16) %19, i32 noundef 1)
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  store i64 0, ptr %12, align 8, !tbaa !11
  br label %56

56:                                               ; preds = %111, %55
  %57 = load i64, ptr %12, align 8, !tbaa !11
  %58 = load i64, ptr %10, align 8, !tbaa !11
  %59 = icmp ult i64 %57, %58
  br i1 %59, label %61, label %60

60:                                               ; preds = %56
  store i32 2, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  br label %114

61:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %62 = getelementptr inbounds %"class.BT::ControlNode", ptr %19, i32 0, i32 1
  %63 = load i64, ptr %12, align 8, !tbaa !11
  %64 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIPN2BT8TreeNodeESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %62, i64 noundef %63) #6
  %65 = load ptr, ptr %64, align 8, !tbaa !5
  store ptr %65, ptr %14, align 8, !tbaa !5
  %66 = getelementptr inbounds %"class.BT::ParallelAllNode", ptr %19, i32 0, i32 2
  %67 = call noundef i64 @_ZNKSt3setImSt4lessImESaImEE5countERKm(ptr noundef nonnull align 8 dereferenceable(48) %66, ptr noundef nonnull align 8 dereferenceable(8) %12)
  %68 = icmp ne i64 %67, 0
  br i1 %68, label %69, label %70

69:                                               ; preds = %61
  store i32 4, ptr %13, align 4
  br label %108

70:                                               ; preds = %61
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  %71 = load ptr, ptr %14, align 8, !tbaa !5
  %72 = load ptr, ptr %71, align 8, !tbaa !35
  %73 = getelementptr inbounds ptr, ptr %72, i64 2
  %74 = load ptr, ptr %73, align 8
  %75 = call noundef i32 %74(ptr noundef nonnull align 8 dereferenceable(16) %71)
  store i32 %75, ptr %15, align 4, !tbaa !37
  %76 = load i32, ptr %15, align 4, !tbaa !37
  switch i32 %76, label %107 [
    i32 2, label %77
    i32 3, label %84
    i32 1, label %94
    i32 4, label %95
    i32 0, label %98
  ]

77:                                               ; preds = %70
  %78 = getelementptr inbounds %"class.BT::ParallelAllNode", ptr %19, i32 0, i32 2
  %79 = call { ptr, i8 } @_ZNSt3setImSt4lessImESaImEE6insertERKm(ptr noundef nonnull align 8 dereferenceable(48) %78, ptr noundef nonnull align 8 dereferenceable(8) %12)
  %80 = getelementptr inbounds { ptr, i8 }, ptr %16, i32 0, i32 0
  %81 = extractvalue { ptr, i8 } %79, 0
  store ptr %81, ptr %80, align 8
  %82 = getelementptr inbounds { ptr, i8 }, ptr %16, i32 0, i32 1
  %83 = extractvalue { ptr, i8 } %79, 1
  store i8 %83, ptr %82, align 8
  br label %107

84:                                               ; preds = %70
  %85 = getelementptr inbounds %"class.BT::ParallelAllNode", ptr %19, i32 0, i32 2
  %86 = call { ptr, i8 } @_ZNSt3setImSt4lessImESaImEE6insertERKm(ptr noundef nonnull align 8 dereferenceable(48) %85, ptr noundef nonnull align 8 dereferenceable(8) %12)
  %87 = getelementptr inbounds { ptr, i8 }, ptr %17, i32 0, i32 0
  %88 = extractvalue { ptr, i8 } %86, 0
  store ptr %88, ptr %87, align 8
  %89 = getelementptr inbounds { ptr, i8 }, ptr %17, i32 0, i32 1
  %90 = extractvalue { ptr, i8 } %86, 1
  store i8 %90, ptr %89, align 8
  %91 = getelementptr inbounds %"class.BT::ParallelAllNode", ptr %19, i32 0, i32 3
  %92 = load i64, ptr %91, align 8, !tbaa !39
  %93 = add i64 %92, 1
  store i64 %93, ptr %91, align 8, !tbaa !39
  br label %107

94:                                               ; preds = %70
  br label %107

95:                                               ; preds = %70
  %96 = load i64, ptr %11, align 8, !tbaa !11
  %97 = add i64 %96, 1
  store i64 %97, ptr %11, align 8, !tbaa !11
  br label %107

98:                                               ; preds = %70
  %99 = call ptr @__cxa_allocate_exception(i64 40) #6
  %100 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNK2BT8TreeNode4nameB5cxx11Ev(ptr noundef nonnull align 8 dereferenceable(16) %19)
          to label %101 unwind label %103

101:                                              ; preds = %98
  invoke void @_ZN2BT10LogicErrorC2IJA2_cNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEA37_cEEEDpRKT_(ptr noundef nonnull align 8 dereferenceable(40) %99, ptr noundef nonnull align 1 dereferenceable(2) @.str.14, ptr noundef nonnull align 8 dereferenceable(32) %100, ptr noundef nonnull align 1 dereferenceable(37) @.str.15)
          to label %102 unwind label %103

102:                                              ; preds = %101
  call void @__cxa_throw(ptr %99, ptr @_ZTIN2BT10LogicErrorE, ptr @_ZN2BT21BehaviorTreeExceptionD2Ev) #7
  unreachable

103:                                              ; preds = %101, %98
  %104 = landingpad { ptr, i32 }
          cleanup
  %105 = extractvalue { ptr, i32 } %104, 0
  store ptr %105, ptr %8, align 8
  %106 = extractvalue { ptr, i32 } %104, 1
  store i32 %106, ptr %9, align 4
  call void @__cxa_free_exception(ptr %99) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  br label %140

107:                                              ; preds = %95, %94, %84, %77, %70
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  store i32 0, ptr %13, align 4
  br label %108

108:                                              ; preds = %107, %69
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  %109 = load i32, ptr %13, align 4
  switch i32 %109, label %147 [
    i32 0, label %110
    i32 4, label %111
  ]

110:                                              ; preds = %108
  br label %111

111:                                              ; preds = %110, %108
  %112 = load i64, ptr %12, align 8, !tbaa !11
  %113 = add i64 %112, 1
  store i64 %113, ptr %12, align 8, !tbaa !11
  br label %56, !llvm.loop !40

114:                                              ; preds = %60
  %115 = load i64, ptr %11, align 8, !tbaa !11
  %116 = load i64, ptr %10, align 8, !tbaa !11
  %117 = icmp eq i64 %115, %116
  br i1 %117, label %118, label %119

118:                                              ; preds = %114
  store i32 4, ptr %2, align 4
  store i32 1, ptr %13, align 4
  br label %138

119:                                              ; preds = %114
  %120 = load i64, ptr %11, align 8, !tbaa !11
  %121 = getelementptr inbounds %"class.BT::ParallelAllNode", ptr %19, i32 0, i32 2
  %122 = call noundef i64 @_ZNKSt3setImSt4lessImESaImEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %121) #6
  %123 = add i64 %120, %122
  %124 = load i64, ptr %10, align 8, !tbaa !11
  %125 = icmp uge i64 %123, %124
  br i1 %125, label %126, label %137

126:                                              ; preds = %119
  call void @_ZN2BT11ControlNode12haltChildrenEv(ptr noundef nonnull align 8 dereferenceable(40) %19)
  %127 = getelementptr inbounds %"class.BT::ParallelAllNode", ptr %19, i32 0, i32 2
  call void @_ZNSt3setImSt4lessImESaImEE5clearEv(ptr noundef nonnull align 8 dereferenceable(48) %127) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  %128 = getelementptr inbounds %"class.BT::ParallelAllNode", ptr %19, i32 0, i32 3
  %129 = load i64, ptr %128, align 8, !tbaa !39
  %130 = getelementptr inbounds %"class.BT::ParallelAllNode", ptr %19, i32 0, i32 1
  %131 = load i64, ptr %130, align 8, !tbaa !13
  %132 = icmp uge i64 %129, %131
  %133 = zext i1 %132 to i64
  %134 = select i1 %132, i32 3, i32 2
  store i32 %134, ptr %18, align 4, !tbaa !37
  %135 = getelementptr inbounds %"class.BT::ParallelAllNode", ptr %19, i32 0, i32 3
  store i64 0, ptr %135, align 8, !tbaa !39
  %136 = load i32, ptr %18, align 4, !tbaa !37
  store i32 %136, ptr %2, align 4
  store i32 1, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  br label %138

137:                                              ; preds = %119
  store i32 1, ptr %2, align 4
  store i32 1, ptr %13, align 4
  br label %138

138:                                              ; preds = %137, %126, %118
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  %139 = load i32, ptr %2, align 4
  ret i32 %139

140:                                              ; preds = %103, %51
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  br label %141

141:                                              ; preds = %140, %36, %35
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %142

142:                                              ; preds = %141
  %143 = load ptr, ptr %8, align 8
  %144 = load i32, ptr %9, align 4
  %145 = insertvalue { ptr, i32 } poison, ptr %143, 0
  %146 = insertvalue { ptr, i32 } %145, i32 %144, 1
  resume { ptr, i32 } %146

147:                                              ; preds = %108
  unreachable
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK2BT8TreeNode8getInputIiEEN6nonstd13expected_lite8expectedISt9monostateNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEERKSB_RT_(ptr dead_on_unwind noalias writable sret(%"class.nonstd::expected_lite::expected") align 8, ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 4 dereferenceable(4)) #3 align 2

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

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

declare ptr @__cxa_allocate_exception(i64)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2BT12RuntimeErrorC2IJA49_cEEEDpRKT_(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 1 dereferenceable(49)) unnamed_addr #2 align 2

declare void @__cxa_free_exception(ptr)

declare void @__cxa_throw(ptr, ptr, ptr)

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2BT15ParallelAllNode19setFailureThresholdEi(ptr noundef nonnull align 8 dereferenceable(104), i32 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2BT10LogicErrorC2IJA59_cEEEDpRKT_(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 1 dereferenceable(59)) unnamed_addr #2 align 2

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

declare void @_ZN2BT8TreeNode9setStatusENS_10NodeStatusE(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) #5

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

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

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setImSt4lessImESaImEE6insertERKm(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) #2 align 2

declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNK2BT8TreeNode4nameB5cxx11Ev(ptr noundef nonnull align 8 dereferenceable(16)) #5

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2BT10LogicErrorC2IJA2_cNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEA37_cEEEDpRKT_(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 1 dereferenceable(2), ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 1 dereferenceable(37)) unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt3setImSt4lessImESaImEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48)) #1 align 2

declare void @_ZN2BT11ControlNode12haltChildrenEv(ptr noundef nonnull align 8 dereferenceable(40)) #5

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

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

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

!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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !12, i64 40}
!14 = !{!"_ZTSN2BT15ParallelAllNodeE", !15, i64 0, !12, i64 40, !27, i64 48, !12, i64 96}
!15 = !{!"_ZTSN2BT11ControlNodeE", !16, i64 0, !23, i64 16}
!16 = !{!"_ZTSN2BT8TreeNodeE", !17, i64 8}
!17 = !{!"_ZTSSt10unique_ptrIN2BT8TreeNode5PImplESt14default_deleteIS2_EE", !18, i64 0}
!18 = !{!"_ZTSSt15__uniq_ptr_dataIN2BT8TreeNode5PImplESt14default_deleteIS2_ELb1ELb1EE", !19, i64 0}
!19 = !{!"_ZTSSt15__uniq_ptr_implIN2BT8TreeNode5PImplESt14default_deleteIS2_EE", !20, i64 0}
!20 = !{!"_ZTSSt5tupleIJPN2BT8TreeNode5PImplESt14default_deleteIS2_EEE", !21, i64 0}
!21 = !{!"_ZTSSt11_Tuple_implILm0EJPN2BT8TreeNode5PImplESt14default_deleteIS2_EEE", !22, i64 0}
!22 = !{!"_ZTSSt10_Head_baseILm0EPN2BT8TreeNode5PImplELb0EE", !6, i64 0}
!23 = !{!"_ZTSSt6vectorIPN2BT8TreeNodeESaIS2_EE", !24, i64 0}
!24 = !{!"_ZTSSt12_Vector_baseIPN2BT8TreeNodeESaIS2_EE", !25, i64 0}
!25 = !{!"_ZTSNSt12_Vector_baseIPN2BT8TreeNodeESaIS2_EE12_Vector_implE", !26, i64 0}
!26 = !{!"_ZTSNSt12_Vector_baseIPN2BT8TreeNodeESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!27 = !{!"_ZTSSt3setImSt4lessImESaImEE", !28, i64 0}
!28 = !{!"_ZTSSt8_Rb_treeImmSt9_IdentityImESt4lessImESaImEE", !29, i64 0}
!29 = !{!"_ZTSNSt8_Rb_treeImmSt9_IdentityImESt4lessImESaImEE13_Rb_tree_implIS3_Lb1EEE", !30, i64 0, !32, i64 8}
!30 = !{!"_ZTSSt20_Rb_tree_key_compareISt4lessImEE", !31, i64 0}
!31 = !{!"_ZTSSt4lessImE"}
!32 = !{!"_ZTSSt15_Rb_tree_header", !33, i64 0, !12, i64 32}
!33 = !{!"_ZTSSt18_Rb_tree_node_base", !34, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!34 = !{!"_ZTSSt14_Rb_tree_color", !7, i64 0}
!35 = !{!36, !36, i64 0}
!36 = !{!"vtable pointer", !8, i64 0}
!37 = !{!38, !38, i64 0}
!38 = !{!"_ZTSN2BT10NodeStatusE", !7, i64 0}
!39 = !{!14, !12, i64 96}
!40 = distinct !{!40, !41}
!41 = !{!"llvm.loop.mustprogress"}


; 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.nonstd::expected_lite::expected" = type { %"class.nonstd::expected_lite::detail::storage_t" }
%"class.nonstd::expected_lite::detail::storage_t" = type { %"class.nonstd::expected_lite::detail::storage_t_impl.base", [7 x i8] }
%"class.nonstd::expected_lite::detail::storage_t_impl.base" = type <{ %union.anon.27, i8 }>
%union.anon.27 = type { %"class.std::__cxx11::basic_string" }
%"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::allocator" = type { i8 }

@.str.11 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [49 x i8], align 1
@_ZTIN2BT12RuntimeErrorE = external dso_local constant { ptr, ptr, ptr }, align 8
@.str.13 = external hidden unnamed_addr constant [59 x i8], align 1
@_ZTIN2BT10LogicErrorE = external dso_local constant { ptr, ptr, ptr }, align 8
@.str.14 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [37 x i8], align 1

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

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 2

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

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 nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef range(i32 1, 5) i32 @_ZN2BT15ParallelAllNode4tickEv(ptr noundef nonnull align 8 dereferenceable(104) %0) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca i32, align 4
  %3 = alloca %"class.nonstd::expected_lite::expected", align 8
  %4 = alloca %"class.std::__cxx11::basic_string", align 8
  %5 = alloca %"class.std::allocator", align 1
  %6 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  store i32 0, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %5) #6
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #6
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %4, ptr noundef nonnull @.str.11, ptr noundef nonnull align 1 dereferenceable(1) %5)
          to label %7 unwind label %13

7:                                                ; preds = %1
  invoke void @_ZNK2BT8TreeNode8getInputIiEEN6nonstd13expected_lite8expectedISt9monostateNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEERKSB_RT_(ptr dead_on_unwind nonnull writable sret(%"class.nonstd::expected_lite::expected") align 8 %3, ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull align 8 dereferenceable(32) %4, ptr noundef nonnull align 4 dereferenceable(4) %2)
          to label %8 unwind label %15

8:                                                ; preds = %7
  %9 = call noundef zeroext i1 @_ZNK6nonstd13expected_lite8expectedISt9monostateNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEcvbEv(ptr noundef nonnull align 8 dereferenceable(40) %3) #6
  call void @_ZN6nonstd13expected_lite8expectedISt9monostateNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEED2Ev(ptr noundef nonnull align 8 dereferenceable(40) %3) #6
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #6
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %3) #6
  br i1 %9, label %20, label %10

10:                                               ; preds = %8
  %11 = call ptr @__cxa_allocate_exception(i64 40) #6
  invoke void @_ZN2BT12RuntimeErrorC2IJA49_cEEEDpRKT_(ptr noundef nonnull align 8 dereferenceable(40) %11, ptr noundef nonnull align 1 dereferenceable(49) @.str.12)
          to label %12 unwind label %18

12:                                               ; preds = %10
  call void @__cxa_throw(ptr nonnull %11, ptr nonnull @_ZTIN2BT12RuntimeErrorE, ptr nonnull @_ZN2BT21BehaviorTreeExceptionD2Ev) #7
  unreachable

13:                                               ; preds = %1
  %14 = landingpad { ptr, i32 }
          cleanup
  br label %17

15:                                               ; preds = %7
  %16 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #6
  br label %17

17:                                               ; preds = %15, %13
  %.pn = phi { ptr, i32 } [ %16, %15 ], [ %14, %13 ]
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %3) #6
  br label %74

18:                                               ; preds = %10
  %19 = landingpad { ptr, i32 }
          cleanup
  call void @__cxa_free_exception(ptr %11) #6
  br label %74

20:                                               ; preds = %8
  %21 = getelementptr inbounds i8, ptr %0, i64 16
  %22 = call noundef i64 @_ZNKSt6vectorIPN2BT8TreeNodeESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %21) #6
  %23 = load i32, ptr %2, align 4, !tbaa !5
  call void @_ZN2BT15ParallelAllNode19setFailureThresholdEi(ptr noundef nonnull align 8 dereferenceable(104) %0, i32 noundef %23)
  %24 = getelementptr inbounds i8, ptr %0, i64 40
  %25 = load i64, ptr %24, align 8, !tbaa !9
  %26 = icmp ult i64 %22, %25
  br i1 %26, label %27, label %32

27:                                               ; preds = %20
  %28 = call ptr @__cxa_allocate_exception(i64 40) #6
  invoke void @_ZN2BT10LogicErrorC2IJA59_cEEEDpRKT_(ptr noundef nonnull align 8 dereferenceable(40) %28, ptr noundef nonnull align 1 dereferenceable(59) @.str.13)
          to label %29 unwind label %30

29:                                               ; preds = %27
  call void @__cxa_throw(ptr nonnull %28, ptr nonnull @_ZTIN2BT10LogicErrorE, ptr nonnull @_ZN2BT21BehaviorTreeExceptionD2Ev) #7
  unreachable

30:                                               ; preds = %27
  %31 = landingpad { ptr, i32 }
          cleanup
  call void @__cxa_free_exception(ptr %28) #6
  br label %74

32:                                               ; preds = %20
  call void @_ZN2BT8TreeNode9setStatusENS_10NodeStatusE(ptr noundef nonnull align 8 dereferenceable(16) %0, i32 noundef 1)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  store i64 0, ptr %6, align 8, !tbaa !33
  %.not34 = icmp eq i64 %22, 0
  br i1 %.not34, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %32
  %33 = getelementptr inbounds i8, ptr %0, i64 48
  %34 = getelementptr inbounds i8, ptr %0, i64 96
  br label %36

._crit_edge:                                      ; preds = %60, %32
  %.019.lcssa = phi i64 [ 0, %32 ], [ %.221, %60 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  %35 = icmp eq i64 %.019.lcssa, %22
  br i1 %35, label %73, label %64

36:                                               ; preds = %.lr.ph, %60
  %.01933 = phi i64 [ 0, %.lr.ph ], [ %.221, %60 ]
  %storemerge32 = phi i64 [ 0, %.lr.ph ], [ %62, %60 ]
  %37 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIPN2BT8TreeNodeESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %21, i64 noundef %storemerge32) #6
  %38 = load ptr, ptr %37, align 8, !tbaa !34
  %39 = call noundef i64 @_ZNKSt3setImSt4lessImESaImEE5countERKm(ptr noundef nonnull align 8 dereferenceable(48) %33, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %.not26 = icmp eq i64 %39, 0
  br i1 %.not26, label %40, label %60

40:                                               ; preds = %36
  %41 = load ptr, ptr %38, align 8, !tbaa !35
  %42 = getelementptr inbounds i8, ptr %41, i64 16
  %43 = load ptr, ptr %42, align 8
  %44 = call noundef i32 %43(ptr noundef nonnull align 8 dereferenceable(16) %38)
  switch i32 %44, label %60 [
    i32 2, label %45
    i32 3, label %47
    i32 0, label %53
    i32 4, label %51
  ]

45:                                               ; preds = %40
  %46 = call { ptr, i8 } @_ZNSt3setImSt4lessImESaImEE6insertERKm(ptr noundef nonnull align 8 dereferenceable(48) %33, ptr noundef nonnull align 8 dereferenceable(8) %6)
  br label %60

47:                                               ; preds = %40
  %48 = call { ptr, i8 } @_ZNSt3setImSt4lessImESaImEE6insertERKm(ptr noundef nonnull align 8 dereferenceable(48) %33, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %49 = load i64, ptr %34, align 8, !tbaa !37
  %50 = add i64 %49, 1
  store i64 %50, ptr %34, align 8, !tbaa !37
  br label %60

51:                                               ; preds = %40
  %52 = add i64 %.01933, 1
  br label %60

53:                                               ; preds = %40
  %54 = call ptr @__cxa_allocate_exception(i64 40) #6
  %55 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNK2BT8TreeNode4nameB5cxx11Ev(ptr noundef nonnull align 8 dereferenceable(16) %0)
          to label %56 unwind label %58

56:                                               ; preds = %53
  invoke void @_ZN2BT10LogicErrorC2IJA2_cNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEA37_cEEEDpRKT_(ptr noundef nonnull align 8 dereferenceable(40) %54, ptr noundef nonnull align 1 dereferenceable(2) @.str.14, ptr noundef nonnull align 8 dereferenceable(32) %55, ptr noundef nonnull align 1 dereferenceable(37) @.str.15)
          to label %57 unwind label %58

57:                                               ; preds = %56
  call void @__cxa_throw(ptr nonnull %54, ptr nonnull @_ZTIN2BT10LogicErrorE, ptr nonnull @_ZN2BT21BehaviorTreeExceptionD2Ev) #7
  unreachable

58:                                               ; preds = %56, %53
  %59 = landingpad { ptr, i32 }
          cleanup
  call void @__cxa_free_exception(ptr %54) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  br label %74

60:                                               ; preds = %40, %45, %47, %51, %36
  %.221 = phi i64 [ %.01933, %36 ], [ %.01933, %40 ], [ %52, %51 ], [ %.01933, %47 ], [ %.01933, %45 ]
  %61 = load i64, ptr %6, align 8, !tbaa !33
  %62 = add i64 %61, 1
  store i64 %62, ptr %6, align 8, !tbaa !33
  %63 = icmp ult i64 %62, %22
  br i1 %63, label %36, label %._crit_edge, !llvm.loop !38

64:                                               ; preds = %._crit_edge
  %65 = getelementptr inbounds i8, ptr %0, i64 48
  %66 = call noundef i64 @_ZNKSt3setImSt4lessImESaImEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %65) #6
  %67 = add i64 %66, %.019.lcssa
  %.not = icmp ult i64 %67, %22
  br i1 %.not, label %73, label %68

68:                                               ; preds = %64
  call void @_ZN2BT11ControlNode12haltChildrenEv(ptr noundef nonnull align 8 dereferenceable(40) %0)
  call void @_ZNSt3setImSt4lessImESaImEE5clearEv(ptr noundef nonnull align 8 dereferenceable(48) %65) #6
  %69 = getelementptr inbounds i8, ptr %0, i64 96
  %70 = load i64, ptr %69, align 8, !tbaa !37
  %71 = load i64, ptr %24, align 8, !tbaa !9
  %.not25 = icmp ult i64 %70, %71
  %72 = select i1 %.not25, i32 2, i32 3
  store i64 0, ptr %69, align 8, !tbaa !37
  br label %73

73:                                               ; preds = %64, %._crit_edge, %68
  %.0 = phi i32 [ %72, %68 ], [ 4, %._crit_edge ], [ 1, %64 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  ret i32 %.0

74:                                               ; preds = %30, %58, %18, %17
  %.pn29 = phi { ptr, i32 } [ %19, %18 ], [ %.pn, %17 ], [ %31, %30 ], [ %59, %58 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  resume { ptr, i32 } %.pn29
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK2BT8TreeNode8getInputIiEEN6nonstd13expected_lite8expectedISt9monostateNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEERKSB_RT_(ptr dead_on_unwind noalias writable sret(%"class.nonstd::expected_lite::expected") align 8, ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3 align 2

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

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

declare ptr @__cxa_allocate_exception(i64) local_unnamed_addr

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2BT12RuntimeErrorC2IJA49_cEEEDpRKT_(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 1 dereferenceable(49)) unnamed_addr #2 align 2

declare void @__cxa_free_exception(ptr) local_unnamed_addr

declare void @__cxa_throw(ptr, ptr, ptr) local_unnamed_addr

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2BT15ParallelAllNode19setFailureThresholdEi(ptr noundef nonnull align 8 dereferenceable(104), i32 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2BT10LogicErrorC2IJA59_cEEEDpRKT_(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 1 dereferenceable(59)) unnamed_addr #2 align 2

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

declare void @_ZN2BT8TreeNode9setStatusENS_10NodeStatusE(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) local_unnamed_addr #5

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

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

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setImSt4lessImESaImEE6insertERKm(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2 align 2

declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNK2BT8TreeNode4nameB5cxx11Ev(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #5

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2BT10LogicErrorC2IJA2_cNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEA37_cEEEDpRKT_(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 1 dereferenceable(2), ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 1 dereferenceable(37)) unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt3setImSt4lessImESaImEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #1 align 2

declare void @_ZN2BT11ControlNode12haltChildrenEv(ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #5

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

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

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

!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, !24, i64 40}
!10 = !{!"_ZTSN2BT15ParallelAllNodeE", !11, i64 0, !24, i64 40, !25, i64 48, !24, i64 96}
!11 = !{!"_ZTSN2BT11ControlNodeE", !12, i64 0, !20, i64 16}
!12 = !{!"_ZTSN2BT8TreeNodeE", !13, i64 8}
!13 = !{!"_ZTSSt10unique_ptrIN2BT8TreeNode5PImplESt14default_deleteIS2_EE", !14, i64 0}
!14 = !{!"_ZTSSt15__uniq_ptr_dataIN2BT8TreeNode5PImplESt14default_deleteIS2_ELb1ELb1EE", !15, i64 0}
!15 = !{!"_ZTSSt15__uniq_ptr_implIN2BT8TreeNode5PImplESt14default_deleteIS2_EE", !16, i64 0}
!16 = !{!"_ZTSSt5tupleIJPN2BT8TreeNode5PImplESt14default_deleteIS2_EEE", !17, i64 0}
!17 = !{!"_ZTSSt11_Tuple_implILm0EJPN2BT8TreeNode5PImplESt14default_deleteIS2_EEE", !18, i64 0}
!18 = !{!"_ZTSSt10_Head_baseILm0EPN2BT8TreeNode5PImplELb0EE", !19, i64 0}
!19 = !{!"any pointer", !7, i64 0}
!20 = !{!"_ZTSSt6vectorIPN2BT8TreeNodeESaIS2_EE", !21, i64 0}
!21 = !{!"_ZTSSt12_Vector_baseIPN2BT8TreeNodeESaIS2_EE", !22, i64 0}
!22 = !{!"_ZTSNSt12_Vector_baseIPN2BT8TreeNodeESaIS2_EE12_Vector_implE", !23, i64 0}
!23 = !{!"_ZTSNSt12_Vector_baseIPN2BT8TreeNodeESaIS2_EE17_Vector_impl_dataE", !19, i64 0, !19, i64 8, !19, i64 16}
!24 = !{!"long", !7, i64 0}
!25 = !{!"_ZTSSt3setImSt4lessImESaImEE", !26, i64 0}
!26 = !{!"_ZTSSt8_Rb_treeImmSt9_IdentityImESt4lessImESaImEE", !27, i64 0}
!27 = !{!"_ZTSNSt8_Rb_treeImmSt9_IdentityImESt4lessImESaImEE13_Rb_tree_implIS3_Lb1EEE", !28, i64 0, !30, i64 8}
!28 = !{!"_ZTSSt20_Rb_tree_key_compareISt4lessImEE", !29, i64 0}
!29 = !{!"_ZTSSt4lessImE"}
!30 = !{!"_ZTSSt15_Rb_tree_header", !31, i64 0, !24, i64 32}
!31 = !{!"_ZTSSt18_Rb_tree_node_base", !32, i64 0, !19, i64 8, !19, i64 16, !19, i64 24}
!32 = !{!"_ZTSSt14_Rb_tree_color", !7, i64 0}
!33 = !{!24, !24, i64 0}
!34 = !{!19, !19, i64 0}
!35 = !{!36, !36, i64 0}
!36 = !{!"vtable pointer", !8, i64 0}
!37 = !{!10, !24, i64 96}
!38 = distinct !{!38, !39}
!39 = !{!"llvm.loop.mustprogress"}


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