; LLVM IR from jrouwe/JoltPhysics :: TestFramework/UI/UIElement.ll (ZN9UIElementC2Ev)

; 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.UIElement = type { %class.UIEventListener, i32, ptr, %"class.JPH::Array", %"class.UIElement::Position", %"class.UIElement::Position", %"class.UIElement::Size", %"class.UIElement::Size", %"class.UIElement::Size", %"class.UIElement::Size", i8, i8, i8, i8, i8, i8, i8, %"class.JPH::Array.2", ptr }
%class.UIEventListener = type { ptr }
%"class.JPH::Array" = type { i64, i64, ptr }
%"class.UIElement::Position" = type { i32, %"class.UIElement::Size" }
%"class.UIElement::Size" = type { i32, i32 }
%"class.JPH::Array.2" = type { i64, i64, ptr }

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN9UIElementC2Ev(ptr noundef nonnull align 8 dereferenceable(144) %0) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %5 = load ptr, ptr %2, align 8
  call void @_ZN15UIEventListenerC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %5) #3
  store ptr getelementptr inbounds inrange(-16, 120) ({ [17 x ptr] }, ptr @_ZTV9UIElement, i32 0, i32 0, i32 2), ptr %5, align 8, !tbaa !9
  %6 = getelementptr inbounds %class.UIElement, ptr %5, i32 0, i32 1
  store i32 -1, ptr %6, align 8, !tbaa !11
  %7 = getelementptr inbounds %class.UIElement, ptr %5, i32 0, i32 2
  store ptr null, ptr %7, align 8, !tbaa !23
  %8 = getelementptr inbounds %class.UIElement, ptr %5, i32 0, i32 3
  call void @_ZN3JPH5ArrayIP9UIElementNS_12STLAllocatorIS2_EEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %8) #3
  %9 = getelementptr inbounds %class.UIElement, ptr %5, i32 0, i32 4
  invoke void @_ZN9UIElement8PositionC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %9)
          to label %10 unwind label %30

10:                                               ; preds = %1
  %11 = getelementptr inbounds %class.UIElement, ptr %5, i32 0, i32 5
  invoke void @_ZN9UIElement8PositionC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %11)
          to label %12 unwind label %30

12:                                               ; preds = %10
  %13 = getelementptr inbounds %class.UIElement, ptr %5, i32 0, i32 6
  invoke void @_ZN9UIElement4SizeC2Ev(ptr noundef nonnull align 4 dereferenceable(8) %13)
          to label %14 unwind label %30

14:                                               ; preds = %12
  %15 = getelementptr inbounds %class.UIElement, ptr %5, i32 0, i32 7
  invoke void @_ZN9UIElement4SizeC2Ev(ptr noundef nonnull align 4 dereferenceable(8) %15)
          to label %16 unwind label %30

16:                                               ; preds = %14
  %17 = getelementptr inbounds %class.UIElement, ptr %5, i32 0, i32 8
  invoke void @_ZN9UIElement4SizeC2Ev(ptr noundef nonnull align 4 dereferenceable(8) %17)
          to label %18 unwind label %30

18:                                               ; preds = %16
  %19 = getelementptr inbounds %class.UIElement, ptr %5, i32 0, i32 9
  invoke void @_ZN9UIElement4SizeC2Ev(ptr noundef nonnull align 4 dereferenceable(8) %19)
          to label %20 unwind label %30

20:                                               ; preds = %18
  %21 = getelementptr inbounds %class.UIElement, ptr %5, i32 0, i32 10
  store i8 1, ptr %21, align 8, !tbaa !24
  %22 = getelementptr inbounds %class.UIElement, ptr %5, i32 0, i32 11
  store i8 1, ptr %22, align 1, !tbaa !25
  %23 = getelementptr inbounds %class.UIElement, ptr %5, i32 0, i32 12
  store i8 0, ptr %23, align 2, !tbaa !26
  %24 = getelementptr inbounds %class.UIElement, ptr %5, i32 0, i32 13
  store i8 0, ptr %24, align 1, !tbaa !27
  %25 = getelementptr inbounds %class.UIElement, ptr %5, i32 0, i32 14
  store i8 0, ptr %25, align 4, !tbaa !28
  %26 = getelementptr inbounds %class.UIElement, ptr %5, i32 0, i32 15
  store i8 1, ptr %26, align 1, !tbaa !29
  %27 = getelementptr inbounds %class.UIElement, ptr %5, i32 0, i32 16
  store i8 1, ptr %27, align 2, !tbaa !30
  %28 = getelementptr inbounds %class.UIElement, ptr %5, i32 0, i32 17
  call void @_ZN3JPH5ArrayIP11UIAnimationNS_12STLAllocatorIS2_EEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %28) #3
  %29 = getelementptr inbounds %class.UIElement, ptr %5, i32 0, i32 18
  store ptr null, ptr %29, align 8, !tbaa !31
  ret void

30:                                               ; preds = %18, %16, %14, %12, %10, %1
  %31 = landingpad { ptr, i32 }
          cleanup
  %32 = extractvalue { ptr, i32 } %31, 0
  store ptr %32, ptr %3, align 8
  %33 = extractvalue { ptr, i32 } %31, 1
  store i32 %33, ptr %4, align 4
  call void @_ZN3JPH5ArrayIP9UIElementNS_12STLAllocatorIS2_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %8) #3
  call void @_ZN15UIEventListenerD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %5) #3
  br label %34

34:                                               ; preds = %30
  %35 = load ptr, ptr %3, align 8
  %36 = load i32, ptr %4, align 4
  %37 = insertvalue { ptr, i32 } poison, ptr %35, 0
  %38 = insertvalue { ptr, i32 } %37, i32 %36, 1
  resume { ptr, i32 } %38
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN9UIElement8PositionC2Ev(ptr noundef nonnull align 4 dereferenceable(12)) unnamed_addr #0 align 2

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN15UIEventListenerD2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #2 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 = { 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 #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 = { 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, !14, i64 8}
!12 = !{!"_ZTS9UIElement", !13, i64 0, !14, i64 8, !6, i64 16, !15, i64 24, !17, i64 48, !17, i64 60, !19, i64 72, !19, i64 80, !19, i64 88, !19, i64 96, !21, i64 104, !21, i64 105, !21, i64 106, !21, i64 107, !21, i64 108, !21, i64 109, !21, i64 110, !22, i64 112, !6, i64 136}
!13 = !{!"_ZTS15UIEventListener"}
!14 = !{!"int", !7, i64 0}
!15 = !{!"_ZTSN3JPH5ArrayIP9UIElementNS_12STLAllocatorIS2_EEEE", !16, i64 0, !16, i64 8, !6, i64 16}
!16 = !{!"long", !7, i64 0}
!17 = !{!"_ZTSN9UIElement8PositionE", !18, i64 0, !19, i64 4}
!18 = !{!"_ZTSN9UIElement10EAlignmentE", !7, i64 0}
!19 = !{!"_ZTSN9UIElement4SizeE", !14, i64 0, !20, i64 4}
!20 = !{!"_ZTSN9UIElement6EUnitsE", !7, i64 0}
!21 = !{!"bool", !7, i64 0}
!22 = !{!"_ZTSN3JPH5ArrayIP11UIAnimationNS_12STLAllocatorIS2_EEEE", !16, i64 0, !16, i64 8, !6, i64 16}
!23 = !{!12, !6, i64 16}
!24 = !{!12, !21, i64 104}
!25 = !{!12, !21, i64 105}
!26 = !{!12, !21, i64 106}
!27 = !{!12, !21, i64 107}
!28 = !{!12, !21, i64 108}
!29 = !{!12, !21, i64 109}
!30 = !{!12, !21, i64 110}
!31 = !{!12, !6, i64 136}


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

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN9UIElementC2Ev(ptr noundef nonnull align 8 dereferenceable(144) %0) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  tail call void @_ZN15UIEventListenerC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %0) #3
  store ptr getelementptr inbounds inrange(-16, 120) (i8, ptr @_ZTV9UIElement, i64 16), ptr %0, align 8, !tbaa !5
  %2 = getelementptr inbounds i8, ptr %0, i64 8
  store i32 -1, ptr %2, align 8, !tbaa !8
  %3 = getelementptr inbounds i8, ptr %0, i64 16
  store ptr null, ptr %3, align 8, !tbaa !22
  %4 = getelementptr inbounds i8, ptr %0, i64 24
  tail call void @_ZN3JPH5ArrayIP9UIElementNS_12STLAllocatorIS2_EEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #3
  %5 = getelementptr inbounds i8, ptr %0, i64 48
  invoke void @_ZN9UIElement8PositionC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %5)
          to label %6 unwind label %19

6:                                                ; preds = %1
  %7 = getelementptr inbounds i8, ptr %0, i64 60
  invoke void @_ZN9UIElement8PositionC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %7)
          to label %8 unwind label %19

8:                                                ; preds = %6
  %9 = getelementptr inbounds i8, ptr %0, i64 72
  tail call void @_ZN9UIElement4SizeC2Ev(ptr noundef nonnull align 4 dereferenceable(8) %9)
  %10 = getelementptr inbounds i8, ptr %0, i64 80
  tail call void @_ZN9UIElement4SizeC2Ev(ptr noundef nonnull align 4 dereferenceable(8) %10)
  %11 = getelementptr inbounds i8, ptr %0, i64 88
  tail call void @_ZN9UIElement4SizeC2Ev(ptr noundef nonnull align 4 dereferenceable(8) %11)
  %12 = getelementptr inbounds i8, ptr %0, i64 96
  tail call void @_ZN9UIElement4SizeC2Ev(ptr noundef nonnull align 4 dereferenceable(8) %12)
  %13 = getelementptr inbounds i8, ptr %0, i64 104
  store <4 x i8> <i8 1, i8 1, i8 0, i8 0>, ptr %13, align 8, !tbaa !23
  %14 = getelementptr inbounds i8, ptr %0, i64 108
  store i8 0, ptr %14, align 4, !tbaa !24
  %15 = getelementptr inbounds i8, ptr %0, i64 109
  store i8 1, ptr %15, align 1, !tbaa !25
  %16 = getelementptr inbounds i8, ptr %0, i64 110
  store i8 1, ptr %16, align 2, !tbaa !26
  %17 = getelementptr inbounds i8, ptr %0, i64 112
  tail call void @_ZN3JPH5ArrayIP11UIAnimationNS_12STLAllocatorIS2_EEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %17) #3
  %18 = getelementptr inbounds i8, ptr %0, i64 136
  store ptr null, ptr %18, align 8, !tbaa !27
  ret void

19:                                               ; preds = %6, %1
  %20 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZN3JPH5ArrayIP9UIElementNS_12STLAllocatorIS2_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #3
  tail call void @_ZN15UIEventListenerD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %0) #3
  resume { ptr, i32 } %20
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN9UIElement8PositionC2Ev(ptr noundef nonnull align 4 dereferenceable(12)) unnamed_addr #0 align 2

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN15UIEventListenerD2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #2 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 = { 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 #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 = { 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, !11, i64 8}
!9 = !{!"_ZTS9UIElement", !10, i64 0, !11, i64 8, !13, i64 16, !14, i64 24, !16, i64 48, !16, i64 60, !18, i64 72, !18, i64 80, !18, i64 88, !18, i64 96, !20, i64 104, !20, i64 105, !20, i64 106, !20, i64 107, !20, i64 108, !20, i64 109, !20, i64 110, !21, i64 112, !13, i64 136}
!10 = !{!"_ZTS15UIEventListener"}
!11 = !{!"int", !12, i64 0}
!12 = !{!"omnipotent char", !7, i64 0}
!13 = !{!"any pointer", !12, i64 0}
!14 = !{!"_ZTSN3JPH5ArrayIP9UIElementNS_12STLAllocatorIS2_EEEE", !15, i64 0, !15, i64 8, !13, i64 16}
!15 = !{!"long", !12, i64 0}
!16 = !{!"_ZTSN9UIElement8PositionE", !17, i64 0, !18, i64 4}
!17 = !{!"_ZTSN9UIElement10EAlignmentE", !12, i64 0}
!18 = !{!"_ZTSN9UIElement4SizeE", !11, i64 0, !19, i64 4}
!19 = !{!"_ZTSN9UIElement6EUnitsE", !12, i64 0}
!20 = !{!"bool", !12, i64 0}
!21 = !{!"_ZTSN3JPH5ArrayIP11UIAnimationNS_12STLAllocatorIS2_EEEE", !15, i64 0, !15, i64 8, !13, i64 16}
!22 = !{!9, !13, i64 16}
!23 = !{!20, !20, i64 0}
!24 = !{!9, !20, i64 108}
!25 = !{!9, !20, i64 109}
!26 = !{!9, !20, i64 110}
!27 = !{!9, !13, i64 136}


; Effective O3 passes: EarlyCSEPass,InstCombinePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass