; LLVM IR from yangfengzzz/DigitalVox4 :: vox.render/transform.ll (ZN3vox9Transform19_getParentTransformEv)

; 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.vox::Transform" = type <{ %"class.vox::Component.base", i8, %"class.vox::Point", %"class.vox::Vector", %"class.vox::Quaternion", %"class.vox::Vector", %"class.vox::Point", %"class.vox::Vector", %"class.vox::Quaternion", %"class.vox::Vector", %"class.vox::Matrix", %"class.vox::Matrix", [4 x i8], %"class.vox::UpdateFlagManager", i8, [7 x i8], ptr, i32, [4 x i8] }>
%"class.vox::Component.base" = type <{ ptr, ptr, i8, i8, i8 }>
%"class.vox::Point" = type { float, float, float }
%"class.vox::Quaternion" = type { float, float, float, float }
%"class.vox::Vector" = type { float, float, float }
%"class.vox::Matrix" = type { %"struct.std::array" }
%"struct.std::array" = type { [16 x float] }
%"class.vox::UpdateFlagManager" = type { %"class.std::vector" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<vox::UpdateFlag *, std::allocator<vox::UpdateFlag *>>::_Vector_impl" }
%"struct.std::_Vector_base<vox::UpdateFlag *, std::allocator<vox::UpdateFlag *>>::_Vector_impl" = type { %"struct.std::_Vector_base<vox::UpdateFlag *, std::allocator<vox::UpdateFlag *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<vox::UpdateFlag *, std::allocator<vox::UpdateFlag *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.vox::Component" = type <{ ptr, ptr, i8, i8, i8, [5 x i8] }>
%"class.vox::Entity" = type { %"class.std::__cxx11::basic_string", i32, ptr, i8, %"class.std::vector.7", %"class.std::vector.12", %"class.std::vector.17", ptr, i8, i8, ptr, %"class.std::vector.22", %"class.std::unique_ptr" }
%"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::vector.7" = type { %"struct.std::_Vector_base.8" }
%"struct.std::_Vector_base.8" = type { %"struct.std::_Vector_base<std::unique_ptr<vox::Component>, std::allocator<std::unique_ptr<vox::Component>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::unique_ptr<vox::Component>, std::allocator<std::unique_ptr<vox::Component>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::unique_ptr<vox::Component>, std::allocator<std::unique_ptr<vox::Component>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::unique_ptr<vox::Component>, std::allocator<std::unique_ptr<vox::Component>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.12" = type { %"struct.std::_Vector_base.13" }
%"struct.std::_Vector_base.13" = type { %"struct.std::_Vector_base<vox::Script *, std::allocator<vox::Script *>>::_Vector_impl" }
%"struct.std::_Vector_base<vox::Script *, std::allocator<vox::Script *>>::_Vector_impl" = type { %"struct.std::_Vector_base<vox::Script *, std::allocator<vox::Script *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<vox::Script *, std::allocator<vox::Script *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.17" = type { %"struct.std::_Vector_base.18" }
%"struct.std::_Vector_base.18" = type { %"struct.std::_Vector_base<std::shared_ptr<vox::Entity>, std::allocator<std::shared_ptr<vox::Entity>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::shared_ptr<vox::Entity>, std::allocator<std::shared_ptr<vox::Entity>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::shared_ptr<vox::Entity>, std::allocator<std::shared_ptr<vox::Entity>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::shared_ptr<vox::Entity>, std::allocator<std::shared_ptr<vox::Entity>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.22" = type { %"struct.std::_Vector_base.23" }
%"struct.std::_Vector_base.23" = type { %"struct.std::_Vector_base<vox::Component *, std::allocator<vox::Component *>>::_Vector_impl" }
%"struct.std::_Vector_base<vox::Component *, std::allocator<vox::Component *>>::_Vector_impl" = type { %"struct.std::_Vector_base<vox::Component *, std::allocator<vox::Component *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<vox::Component *, std::allocator<vox::Component *>>::_Vector_impl_data" = type { ptr, ptr, 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.3" }
%"struct.std::_Head_base.3" = type { ptr }

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN3vox9Transform19_getParentTransformEv(ptr noundef nonnull align 8 dereferenceable(300) %0) #0 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  %8 = load ptr, ptr %3, align 8
  %9 = getelementptr inbounds %"class.vox::Transform", ptr %8, i32 0, i32 14
  %10 = load i8, ptr %9, align 8, !tbaa !9, !range !25, !noundef !26
  %11 = trunc i8 %10 to i1
  br i1 %11, label %15, label %12

12:                                               ; preds = %1
  %13 = getelementptr inbounds %"class.vox::Transform", ptr %8, i32 0, i32 16
  %14 = load ptr, ptr %13, align 8, !tbaa !27
  store ptr %14, ptr %2, align 8
  br label %43

15:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  store ptr null, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  %16 = getelementptr inbounds %"class.vox::Component", ptr %8, i32 0, i32 1
  %17 = load ptr, ptr %16, align 8, !tbaa !28
  %18 = call noundef ptr @_ZN3vox6Entity6parentEv(ptr noundef nonnull align 8 dereferenceable(184) %17)
  store ptr %18, ptr %5, align 8, !tbaa !5
  br label %19

19:                                               ; preds = %37, %15
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = icmp ne ptr %20, null
  br i1 %21, label %22, label %38

22:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %23 = load ptr, ptr %5, align 8, !tbaa !5
  %24 = getelementptr inbounds %"class.vox::Entity", ptr %23, i32 0, i32 2
  store ptr %24, ptr %6, align 8, !tbaa !5
  %25 = load ptr, ptr %6, align 8, !tbaa !5
  %26 = load ptr, ptr %25, align 8, !tbaa !5
  %27 = icmp ne ptr %26, null
  br i1 %27, label %28, label %31

28:                                               ; preds = %22
  %29 = load ptr, ptr %6, align 8, !tbaa !5
  %30 = load ptr, ptr %29, align 8, !tbaa !5
  store ptr %30, ptr %4, align 8, !tbaa !5
  store i32 3, ptr %7, align 4
  br label %35

31:                                               ; preds = %22
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = call noundef ptr @_ZN3vox6Entity6parentEv(ptr noundef nonnull align 8 dereferenceable(184) %32)
  store ptr %33, ptr %5, align 8, !tbaa !5
  br label %34

34:                                               ; preds = %31
  store i32 0, ptr %7, align 4
  br label %35

35:                                               ; preds = %34, %28
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  %36 = load i32, ptr %7, align 4
  switch i32 %36, label %45 [
    i32 0, label %37
    i32 3, label %38
  ]

37:                                               ; preds = %35
  br label %19, !llvm.loop !29

38:                                               ; preds = %35, %19
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = getelementptr inbounds %"class.vox::Transform", ptr %8, i32 0, i32 16
  store ptr %39, ptr %40, align 8, !tbaa !27
  %41 = getelementptr inbounds %"class.vox::Transform", ptr %8, i32 0, i32 14
  store i8 0, ptr %41, align 8, !tbaa !9
  %42 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %42, ptr %2, align 8
  store i32 1, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  br label %43

43:                                               ; preds = %38, %12
  %44 = load ptr, ptr %2, align 8
  ret ptr %44

45:                                               ; preds = %35
  unreachable
}

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

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

declare noundef ptr @_ZN3vox6Entity6parentEv(ptr noundef nonnull align 8 dereferenceable(184)) #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 = { "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, !12, i64 280}
!10 = !{!"_ZTSN3vox9TransformE", !11, i64 0, !13, i64 20, !15, i64 32, !16, i64 44, !15, i64 60, !13, i64 72, !15, i64 84, !16, i64 96, !15, i64 112, !17, i64 124, !17, i64 188, !19, i64 256, !12, i64 280, !6, i64 288, !24, i64 296}
!11 = !{!"_ZTSN3vox9ComponentE", !6, i64 8, !12, i64 16, !12, i64 17, !12, i64 18}
!12 = !{!"bool", !7, i64 0}
!13 = !{!"_ZTSN3vox5PointIfLm3EEE", !14, i64 0, !14, i64 4, !14, i64 8}
!14 = !{!"float", !7, i64 0}
!15 = !{!"_ZTSN3vox6VectorIfLm3EEE", !14, i64 0, !14, i64 4, !14, i64 8}
!16 = !{!"_ZTSN3vox10QuaternionIfEE", !14, i64 0, !14, i64 4, !14, i64 8, !14, i64 12}
!17 = !{!"_ZTSN3vox6MatrixIfLm4ELm4EEE", !18, i64 0}
!18 = !{!"_ZTSSt5arrayIfLm16EE", !7, i64 0}
!19 = !{!"_ZTSN3vox17UpdateFlagManagerE", !20, i64 0}
!20 = !{!"_ZTSSt6vectorIPN3vox10UpdateFlagESaIS2_EE", !21, i64 0}
!21 = !{!"_ZTSSt12_Vector_baseIPN3vox10UpdateFlagESaIS2_EE", !22, i64 0}
!22 = !{!"_ZTSNSt12_Vector_baseIPN3vox10UpdateFlagESaIS2_EE12_Vector_implE", !23, i64 0}
!23 = !{!"_ZTSNSt12_Vector_baseIPN3vox10UpdateFlagESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!24 = !{!"int", !7, i64 0}
!25 = !{i8 0, i8 2}
!26 = !{}
!27 = !{!10, !6, i64 288}
!28 = !{!11, !6, i64 8}
!29 = distinct !{!29, !30}
!30 = !{!"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"

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN3vox9Transform19_getParentTransformEv(ptr nocapture noundef nonnull align 8 dereferenceable(300) %0) local_unnamed_addr #0 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 280
  %3 = load i8, ptr %2, align 8, !tbaa !5, !range !24, !noundef !25
  %4 = trunc nuw i8 %3 to i1
  br i1 %4, label %8, label %5

5:                                                ; preds = %1
  %6 = getelementptr inbounds i8, ptr %0, i64 288
  %7 = load ptr, ptr %6, align 8, !tbaa !26
  br label %17

8:                                                ; preds = %1
  %9 = getelementptr inbounds i8, ptr %0, i64 8
  %10 = load ptr, ptr %9, align 8, !tbaa !27
  %11 = tail call noundef ptr @_ZN3vox6Entity6parentEv(ptr noundef nonnull align 8 dereferenceable(184) %10)
  %.not19 = icmp eq ptr %11, null
  br i1 %.not19, label %.thread, label %.lr.ph

.lr.ph:                                           ; preds = %8, %14
  %.01020 = phi ptr [ %15, %14 ], [ %11, %8 ]
  %12 = getelementptr inbounds i8, ptr %.01020, i64 40
  %13 = load ptr, ptr %12, align 8, !tbaa !28
  %.not14 = icmp eq ptr %13, null
  br i1 %.not14, label %14, label %.thread

14:                                               ; preds = %.lr.ph
  %15 = tail call noundef ptr @_ZN3vox6Entity6parentEv(ptr noundef nonnull align 8 dereferenceable(184) %.01020)
  %.not = icmp eq ptr %15, null
  br i1 %.not, label %.thread, label %.lr.ph

.thread:                                          ; preds = %14, %.lr.ph, %8
  %.2 = phi ptr [ null, %8 ], [ %13, %.lr.ph ], [ null, %14 ]
  %16 = getelementptr inbounds i8, ptr %0, i64 288
  store ptr %.2, ptr %16, align 8, !tbaa !26
  store i8 0, ptr %2, align 8, !tbaa !5
  br label %17

17:                                               ; preds = %.thread, %5
  %.09 = phi ptr [ %.2, %.thread ], [ %7, %5 ]
  ret ptr %.09
}

declare noundef ptr @_ZN3vox6Entity6parentEv(ptr noundef nonnull align 8 dereferenceable(184)) local_unnamed_addr #1

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 = { "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" }

!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, !11, i64 280}
!6 = !{!"_ZTSN3vox9TransformE", !7, i64 0, !12, i64 20, !14, i64 32, !15, i64 44, !14, i64 60, !12, i64 72, !14, i64 84, !15, i64 96, !14, i64 112, !16, i64 124, !16, i64 188, !18, i64 256, !11, i64 280, !8, i64 288, !23, i64 296}
!7 = !{!"_ZTSN3vox9ComponentE", !8, i64 8, !11, i64 16, !11, i64 17, !11, i64 18}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"bool", !9, i64 0}
!12 = !{!"_ZTSN3vox5PointIfLm3EEE", !13, i64 0, !13, i64 4, !13, i64 8}
!13 = !{!"float", !9, i64 0}
!14 = !{!"_ZTSN3vox6VectorIfLm3EEE", !13, i64 0, !13, i64 4, !13, i64 8}
!15 = !{!"_ZTSN3vox10QuaternionIfEE", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12}
!16 = !{!"_ZTSN3vox6MatrixIfLm4ELm4EEE", !17, i64 0}
!17 = !{!"_ZTSSt5arrayIfLm16EE", !9, i64 0}
!18 = !{!"_ZTSN3vox17UpdateFlagManagerE", !19, i64 0}
!19 = !{!"_ZTSSt6vectorIPN3vox10UpdateFlagESaIS2_EE", !20, i64 0}
!20 = !{!"_ZTSSt12_Vector_baseIPN3vox10UpdateFlagESaIS2_EE", !21, i64 0}
!21 = !{!"_ZTSNSt12_Vector_baseIPN3vox10UpdateFlagESaIS2_EE12_Vector_implE", !22, i64 0}
!22 = !{!"_ZTSNSt12_Vector_baseIPN3vox10UpdateFlagESaIS2_EE17_Vector_impl_dataE", !8, i64 0, !8, i64 8, !8, i64 16}
!23 = !{!"int", !9, i64 0}
!24 = !{i8 0, i8 2}
!25 = !{}
!26 = !{!6, !8, i64 288}
!27 = !{!7, !8, i64 8}
!28 = !{!8, !8, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass