; LLVM IR from BehaviorTree/BehaviorTree.CPP :: src/controls (parallel_node)

; 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.BT::ParallelNode" = type <{ %"class.BT::ControlNode", i32, i32, %"class.std::set", i64, i64, i8, [7 x i8] }>
%"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.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 }

@_ZTVN2BT12ParallelNodeE = external dso_local unnamed_addr constant { [8 x ptr] }, align 8

declare void @_ZN2BT11ControlNodeC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNS_10NodeConfigE(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(344)) unnamed_addr #0

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN2BT12ParallelNodeC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNS_10NodeConfigE(ptr noundef nonnull align 8 dereferenceable(113) %0, ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef nonnull align 8 dereferenceable(344) %2) unnamed_addr #2 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %7 = load ptr, ptr %4, align 8
  %8 = load ptr, ptr %5, align 8, !tbaa !5
  %9 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZN2BT11ControlNodeC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNS_10NodeConfigE(ptr noundef nonnull align 8 dereferenceable(40) %7, ptr noundef nonnull align 8 dereferenceable(32) %8, ptr noundef nonnull align 8 dereferenceable(344) %9)
  store ptr getelementptr inbounds inrange(-16, 48) ({ [8 x ptr] }, ptr @_ZTVN2BT12ParallelNodeE, i32 0, i32 0, i32 2), ptr %7, align 8, !tbaa !9
  %10 = getelementptr inbounds %"class.BT::ParallelNode", ptr %7, i32 0, i32 1
  store i32 -1, ptr %10, align 8, !tbaa !11
  %11 = getelementptr inbounds %"class.BT::ParallelNode", ptr %7, i32 0, i32 2
  store i32 1, ptr %11, align 4, !tbaa !36
  %12 = getelementptr inbounds %"class.BT::ParallelNode", ptr %7, i32 0, i32 3
  call void @_ZNSt3setImSt4lessImESaImEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %12) #3
  %13 = getelementptr inbounds %"class.BT::ParallelNode", ptr %7, i32 0, i32 4
  store i64 0, ptr %13, align 8, !tbaa !37
  %14 = getelementptr inbounds %"class.BT::ParallelNode", ptr %7, i32 0, i32 5
  store i64 0, ptr %14, align 8, !tbaa !38
  %15 = getelementptr inbounds %"class.BT::ParallelNode", ptr %7, i32 0, i32 6
  store i8 1, ptr %15, align 8, !tbaa !39
  ret void
}

attributes #0 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress 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 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !25, i64 40}
!12 = !{!"_ZTSN2BT12ParallelNodeE", !13, i64 0, !25, i64 40, !25, i64 44, !26, i64 48, !34, i64 96, !34, i64 104, !35, i64 112}
!13 = !{!"_ZTSN2BT11ControlNodeE", !14, i64 0, !21, i64 16}
!14 = !{!"_ZTSN2BT8TreeNodeE", !15, i64 8}
!15 = !{!"_ZTSSt10unique_ptrIN2BT8TreeNode5PImplESt14default_deleteIS2_EE", !16, i64 0}
!16 = !{!"_ZTSSt15__uniq_ptr_dataIN2BT8TreeNode5PImplESt14default_deleteIS2_ELb1ELb1EE", !17, i64 0}
!17 = !{!"_ZTSSt15__uniq_ptr_implIN2BT8TreeNode5PImplESt14default_deleteIS2_EE", !18, i64 0}
!18 = !{!"_ZTSSt5tupleIJPN2BT8TreeNode5PImplESt14default_deleteIS2_EEE", !19, i64 0}
!19 = !{!"_ZTSSt11_Tuple_implILm0EJPN2BT8TreeNode5PImplESt14default_deleteIS2_EEE", !20, i64 0}
!20 = !{!"_ZTSSt10_Head_baseILm0EPN2BT8TreeNode5PImplELb0EE", !6, i64 0}
!21 = !{!"_ZTSSt6vectorIPN2BT8TreeNodeESaIS2_EE", !22, i64 0}
!22 = !{!"_ZTSSt12_Vector_baseIPN2BT8TreeNodeESaIS2_EE", !23, i64 0}
!23 = !{!"_ZTSNSt12_Vector_baseIPN2BT8TreeNodeESaIS2_EE12_Vector_implE", !24, i64 0}
!24 = !{!"_ZTSNSt12_Vector_baseIPN2BT8TreeNodeESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!25 = !{!"int", !7, i64 0}
!26 = !{!"_ZTSSt3setImSt4lessImESaImEE", !27, i64 0}
!27 = !{!"_ZTSSt8_Rb_treeImmSt9_IdentityImESt4lessImESaImEE", !28, i64 0}
!28 = !{!"_ZTSNSt8_Rb_treeImmSt9_IdentityImESt4lessImESaImEE13_Rb_tree_implIS3_Lb1EEE", !29, i64 0, !31, i64 8}
!29 = !{!"_ZTSSt20_Rb_tree_key_compareISt4lessImEE", !30, i64 0}
!30 = !{!"_ZTSSt4lessImE"}
!31 = !{!"_ZTSSt15_Rb_tree_header", !32, i64 0, !34, i64 32}
!32 = !{!"_ZTSSt18_Rb_tree_node_base", !33, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!33 = !{!"_ZTSSt14_Rb_tree_color", !7, i64 0}
!34 = !{!"long", !7, i64 0}
!35 = !{!"bool", !7, i64 0}
!36 = !{!12, !25, i64 44}
!37 = !{!12, !34, i64 96}
!38 = !{!12, !34, i64 104}
!39 = !{!12, !35, i64 112}


; 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"

@_ZTVN2BT12ParallelNodeE = external dso_local unnamed_addr constant { [8 x ptr] }, align 8

declare void @_ZN2BT11ControlNodeC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNS_10NodeConfigE(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(344)) unnamed_addr #0

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN2BT12ParallelNodeC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNS_10NodeConfigE(ptr noundef nonnull align 8 dereferenceable(113) %0, ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef nonnull align 8 dereferenceable(344) %2) unnamed_addr #2 align 2 {
  tail call void @_ZN2BT11ControlNodeC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNS_10NodeConfigE(ptr noundef nonnull align 8 dereferenceable(40) %0, ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef nonnull align 8 dereferenceable(344) %2)
  store ptr getelementptr inbounds inrange(-16, 48) (i8, ptr @_ZTVN2BT12ParallelNodeE, i64 16), ptr %0, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 40
  store i32 -1, ptr %4, align 8, !tbaa !8
  %5 = getelementptr inbounds i8, ptr %0, i64 44
  store i32 1, ptr %5, align 4, !tbaa !35
  %6 = getelementptr inbounds i8, ptr %0, i64 48
  tail call void @_ZNSt3setImSt4lessImESaImEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %6) #4
  %7 = getelementptr inbounds i8, ptr %0, i64 96
  %8 = getelementptr inbounds i8, ptr %0, i64 112
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %7, i8 0, i64 16, i1 false)
  store i8 1, ptr %8, align 8, !tbaa !36
  ret void
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

attributes #0 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !24, i64 40}
!9 = !{!"_ZTSN2BT12ParallelNodeE", !10, i64 0, !24, i64 40, !24, i64 44, !25, i64 48, !33, i64 96, !33, i64 104, !34, i64 112}
!10 = !{!"_ZTSN2BT11ControlNodeE", !11, i64 0, !20, i64 16}
!11 = !{!"_ZTSN2BT8TreeNodeE", !12, i64 8}
!12 = !{!"_ZTSSt10unique_ptrIN2BT8TreeNode5PImplESt14default_deleteIS2_EE", !13, i64 0}
!13 = !{!"_ZTSSt15__uniq_ptr_dataIN2BT8TreeNode5PImplESt14default_deleteIS2_ELb1ELb1EE", !14, i64 0}
!14 = !{!"_ZTSSt15__uniq_ptr_implIN2BT8TreeNode5PImplESt14default_deleteIS2_EE", !15, i64 0}
!15 = !{!"_ZTSSt5tupleIJPN2BT8TreeNode5PImplESt14default_deleteIS2_EEE", !16, i64 0}
!16 = !{!"_ZTSSt11_Tuple_implILm0EJPN2BT8TreeNode5PImplESt14default_deleteIS2_EEE", !17, i64 0}
!17 = !{!"_ZTSSt10_Head_baseILm0EPN2BT8TreeNode5PImplELb0EE", !18, i64 0}
!18 = !{!"any pointer", !19, i64 0}
!19 = !{!"omnipotent char", !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", !18, i64 0, !18, i64 8, !18, i64 16}
!24 = !{!"int", !19, 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, !33, i64 32}
!31 = !{!"_ZTSSt18_Rb_tree_node_base", !32, i64 0, !18, i64 8, !18, i64 16, !18, i64 24}
!32 = !{!"_ZTSSt14_Rb_tree_color", !19, i64 0}
!33 = !{!"long", !19, i64 0}
!34 = !{!"bool", !19, i64 0}
!35 = !{!9, !24, i64 44}
!36 = !{!9, !34, i64 112}


; Effective O3 passes: InstCombinePass,MemCpyOptPass,SROAPass,TailCallElimPass