; LLVM IR from modlfo/AudioEngine :: AudioEngine/JuceLibraryCode/juce_gui_basics.ll (ZNK4juce12TreeViewItem15getItemPositionEb)

; 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.juce::Point" = type { i32, i32 }
%"class.juce::Rectangle" = type { %"class.juce::Point", i32, i32 }
%"class.juce::TreeViewItem" = type <{ ptr, ptr, ptr, %"class.juce::OwnedArray.338", i32, i32, i32, i32, i32, i32, i8, [7 x i8] }>
%"class.juce::OwnedArray.338" = type { %"class.juce::ArrayAllocationBase.339", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase.339" = type <{ %"class.juce::HeapBlock.340", i32, [4 x i8] }>
%"class.juce::HeapBlock.340" = type { ptr }
%"class.juce::TreeView" = type <{ %"class.juce::Component.base", [3 x i8], %"class.juce::SettableTooltipClient", %"class.juce::FileDragAndDropTarget", %"class.juce::DragAndDropTarget", %"class.juce::ScopedPointer.283", %"class.juce::CriticalSection", ptr, %"class.juce::ScopedPointer.284", %"class.juce::ScopedPointer.285", i32, i8, i8, i8, i8, i8, [7 x i8] }>
%"class.juce::Component.base" = type <{ %"class.juce::MouseListener", %"class.juce::String", %"class.juce::String", ptr, %"class.juce::Rectangle", %"class.juce::ScopedPointer", %"class.juce::ScopedPointer.0", %"class.juce::Array", ptr, %"class.juce::MouseCursor", ptr, %"class.juce::ScopedPointer.1", %"class.juce::ScopedPointer.2", %"class.juce::ScopedPointer.3", %"class.juce::ListenerList", %"class.juce::NamedValueSet", %"class.juce::WeakReference<juce::Component>::Master", %union.anon, i8 }>
%"class.juce::MouseListener" = type { ptr }
%"class.juce::String" = type { %"class.juce::CharPointer_UTF8" }
%"class.juce::CharPointer_UTF8" = type { ptr }
%"class.juce::ScopedPointer" = type { ptr }
%"class.juce::ScopedPointer.0" = type { ptr }
%"class.juce::Array" = type { %"class.juce::ArrayAllocationBase", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase" = type <{ %"class.juce::HeapBlock", i32, [4 x i8] }>
%"class.juce::HeapBlock" = type { ptr }
%"class.juce::MouseCursor" = type { ptr }
%"class.juce::ScopedPointer.1" = type { ptr }
%"class.juce::ScopedPointer.2" = type { ptr }
%"class.juce::ScopedPointer.3" = type { ptr }
%"class.juce::ListenerList" = type { %"class.juce::Array.4" }
%"class.juce::Array.4" = type { %"class.juce::ArrayAllocationBase.5", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase.5" = type <{ %"class.juce::HeapBlock.6", i32, [4 x i8] }>
%"class.juce::HeapBlock.6" = type { ptr }
%"class.juce::NamedValueSet" = type { %"class.juce::Array.9" }
%"class.juce::Array.9" = type { %"class.juce::ArrayAllocationBase.10", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase.10" = type <{ %"class.juce::HeapBlock.11", i32, [4 x i8] }>
%"class.juce::HeapBlock.11" = type { ptr }
%"class.juce::WeakReference<juce::Component>::Master" = type { %"class.juce::ReferenceCountedObjectPtr" }
%"class.juce::ReferenceCountedObjectPtr" = type { ptr }
%union.anon = type { i32 }
%"class.juce::SettableTooltipClient" = type { %"class.juce::TooltipClient", %"class.juce::String" }
%"class.juce::TooltipClient" = type { ptr }
%"class.juce::FileDragAndDropTarget" = type { ptr }
%"class.juce::DragAndDropTarget" = type { ptr }
%"class.juce::ScopedPointer.283" = type { ptr }
%"class.juce::CriticalSection" = type { %union.pthread_mutex_t }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%"class.juce::ScopedPointer.284" = type { ptr }
%"class.juce::ScopedPointer.285" = type { ptr }

declare i32 @__gxx_personality_v0(...)

; Function Attrs: noinline noreturn nounwind uwtable
declare hidden void @__clang_call_terminate(ptr noundef) #0

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN4juce4jmaxIiEET_S1_S1_(i32 noundef, i32 noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4juce9RectangleIiEC2Eiiii(ptr noundef nonnull align 4 dereferenceable(16), i32 noundef, i32 noundef, i32 noundef, i32 noundef) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNK4juce8Viewport15getViewPositionEv(ptr dead_on_unwind noalias writable sret(%"class.juce::Point") align 4, ptr noundef nonnull align 8 dereferenceable(1224)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK4juce8Viewport12getViewWidthEv(ptr noundef nonnull align 8 dereferenceable(1224)) #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZNK4juce12TreeViewItem15getItemPositionEb(ptr dead_on_unwind noalias writable sret(%"class.juce::Rectangle") align 4 %0, ptr noundef nonnull align 8 dereferenceable(73) %1, i1 noundef zeroext %2) #1 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i8, align 1
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i1, align 1
  %10 = alloca %"class.juce::Point", align 4
  store ptr %0, ptr %4, align 8
  store ptr %1, ptr %5, align 8, !tbaa !5
  %11 = zext i1 %2 to i8
  store i8 %11, ptr %6, align 1, !tbaa !9
  %12 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %13 = call noundef i32 @_ZNK4juce12TreeViewItem10getIndentXEv(ptr noundef nonnull align 8 dereferenceable(73) %12) #4
  store i32 %13, ptr %7, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %14 = getelementptr inbounds %"class.juce::TreeViewItem", ptr %12, i32 0, i32 7
  %15 = load i32, ptr %14, align 4, !tbaa !13
  store i32 %15, ptr %8, align 4, !tbaa !11
  %16 = getelementptr inbounds %"class.juce::TreeViewItem", ptr %12, i32 0, i32 1
  %17 = load ptr, ptr %16, align 8, !tbaa !18
  %18 = icmp ne ptr %17, null
  br i1 %18, label %19, label %30

19:                                               ; preds = %3
  %20 = load i32, ptr %8, align 4, !tbaa !11
  %21 = icmp slt i32 %20, 0
  br i1 %21, label %22, label %30

22:                                               ; preds = %19
  %23 = getelementptr inbounds %"class.juce::TreeViewItem", ptr %12, i32 0, i32 1
  %24 = load ptr, ptr %23, align 8, !tbaa !18
  %25 = getelementptr inbounds %"class.juce::TreeView", ptr %24, i32 0, i32 5
  %26 = call noundef ptr @_ZNK4juce13ScopedPointerINS_8TreeView12TreeViewportEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %25) #4
  %27 = call noundef i32 @_ZNK4juce8Viewport12getViewWidthEv(ptr noundef nonnull align 8 dereferenceable(1224) %26) #4
  %28 = load i32, ptr %7, align 4, !tbaa !11
  %29 = sub nsw i32 %27, %28
  store i32 %29, ptr %8, align 4, !tbaa !11
  br label %30

30:                                               ; preds = %22, %19, %3
  store i1 false, ptr %9, align 1
  %31 = load i32, ptr %7, align 4, !tbaa !11
  %32 = getelementptr inbounds %"class.juce::TreeViewItem", ptr %12, i32 0, i32 4
  %33 = load i32, ptr %32, align 8, !tbaa !19
  %34 = load i32, ptr %8, align 4, !tbaa !11
  %35 = invoke noundef i32 @_ZN4juce4jmaxIiEET_S1_S1_(i32 noundef 0, i32 noundef %34)
          to label %36 unwind label %55

36:                                               ; preds = %30
  %37 = getelementptr inbounds %"class.juce::TreeViewItem", ptr %12, i32 0, i32 6
  %38 = load i32, ptr %37, align 8, !tbaa !20
  call void @_ZN4juce9RectangleIiEC2Eiiii(ptr noundef nonnull align 4 dereferenceable(16) %0, i32 noundef %31, i32 noundef %33, i32 noundef %35, i32 noundef %38) #4
  %39 = load i8, ptr %6, align 1, !tbaa !9, !range !21, !noundef !22
  %40 = trunc i8 %39 to i1
  br i1 %40, label %41, label %51

41:                                               ; preds = %36
  %42 = getelementptr inbounds %"class.juce::TreeViewItem", ptr %12, i32 0, i32 1
  %43 = load ptr, ptr %42, align 8, !tbaa !18
  %44 = icmp ne ptr %43, null
  br i1 %44, label %45, label %51

45:                                               ; preds = %41
  %46 = getelementptr inbounds %"class.juce::TreeViewItem", ptr %12, i32 0, i32 1
  %47 = load ptr, ptr %46, align 8, !tbaa !18
  %48 = getelementptr inbounds %"class.juce::TreeView", ptr %47, i32 0, i32 5
  %49 = call noundef ptr @_ZNK4juce13ScopedPointerINS_8TreeView12TreeViewportEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %48) #4
  call void @_ZNK4juce8Viewport15getViewPositionEv(ptr dead_on_unwind writable sret(%"class.juce::Point") align 4 %10, ptr noundef nonnull align 8 dereferenceable(1224) %49) #4
  %50 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZN4juce9RectangleIiEmIENS_5PointIiEE(ptr noundef nonnull align 4 dereferenceable(16) %0, ptr noundef %10) #4
  br label %51

51:                                               ; preds = %45, %41, %36
  store i1 true, ptr %9, align 1
  %52 = load i1, ptr %9, align 1
  br i1 %52, label %54, label %53

53:                                               ; preds = %51
  call void @_ZN4juce9RectangleIiED2Ev(ptr noundef nonnull align 4 dereferenceable(16) %0) #4
  br label %54

54:                                               ; preds = %53, %51
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  ret void

55:                                               ; preds = %30
  %56 = landingpad { ptr, i32 }
          catch ptr null
  %57 = extractvalue { ptr, i32 } %56, 0
  call void @__clang_call_terminate(ptr %57) #5
  unreachable
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK4juce12TreeViewItem10getIndentXEv(ptr noundef nonnull align 8 dereferenceable(73)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(16) ptr @_ZN4juce9RectangleIiEmIENS_5PointIiEE(ptr noundef nonnull align 4 dereferenceable(16), ptr noundef) #1 align 2

attributes #0 = { noinline noreturn nounwind uwtable "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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
attributes #5 = { noreturn 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 = !{!"bool", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !12, i64 60}
!14 = !{!"_ZTSN4juce12TreeViewItemE", !6, i64 8, !6, i64 16, !15, i64 24, !12, i64 48, !12, i64 52, !12, i64 56, !12, i64 60, !12, i64 64, !12, i64 68, !10, i64 72, !10, i64 72, !10, i64 72, !10, i64 72, !10, i64 72, !10, i64 72, !12, i64 72}
!15 = !{!"_ZTSN4juce10OwnedArrayINS_12TreeViewItemENS_20DummyCriticalSectionEEE", !16, i64 0, !12, i64 16}
!16 = !{!"_ZTSN4juce19ArrayAllocationBaseIPNS_12TreeViewItemENS_20DummyCriticalSectionEEE", !17, i64 0, !12, i64 8}
!17 = !{!"_ZTSN4juce9HeapBlockIPNS_12TreeViewItemELb0EEE", !6, i64 0}
!18 = !{!14, !6, i64 8}
!19 = !{!14, !12, i64 48}
!20 = !{!14, !12, i64 56}
!21 = !{i8 0, i8 2}
!22 = !{}


; 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.juce::Point" = type { i32, i32 }
%"class.juce::Rectangle" = type { %"class.juce::Point", i32, i32 }

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN4juce4jmaxIiEET_S1_S1_(i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4juce9RectangleIiEC2Eiiii(ptr noundef nonnull align 4 dereferenceable(16), i32 noundef, i32 noundef, i32 noundef, i32 noundef) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNK4juce8Viewport15getViewPositionEv(ptr dead_on_unwind noalias writable sret(%"class.juce::Point") align 4, ptr noundef nonnull align 8 dereferenceable(1224)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK4juce8Viewport12getViewWidthEv(ptr noundef nonnull align 8 dereferenceable(1224)) local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZNK4juce12TreeViewItem15getItemPositionEb(ptr dead_on_unwind noalias writable sret(%"class.juce::Rectangle") align 4 %0, ptr noundef nonnull align 8 dereferenceable(73) %1, i1 noundef zeroext %2) local_unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca %"class.juce::Point", align 4
  %5 = tail call noundef i32 @_ZNK4juce12TreeViewItem10getIndentXEv(ptr noundef nonnull align 8 dereferenceable(73) %1) #2
  %6 = getelementptr inbounds i8, ptr %1, i64 60
  %7 = load i32, ptr %6, align 4, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %1, i64 8
  %9 = load ptr, ptr %8, align 8, !tbaa !15
  %10 = icmp ne ptr %9, null
  %11 = icmp slt i32 %7, 0
  %or.cond = select i1 %10, i1 %11, i1 false
  br i1 %or.cond, label %12, label %17

12:                                               ; preds = %3
  %13 = getelementptr inbounds i8, ptr %9, i64 232
  %14 = tail call noundef ptr @_ZNK4juce13ScopedPointerINS_8TreeView12TreeViewportEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %13) #2
  %15 = tail call noundef i32 @_ZNK4juce8Viewport12getViewWidthEv(ptr noundef nonnull align 8 dereferenceable(1224) %14) #2
  %16 = sub nsw i32 %15, %5
  br label %17

17:                                               ; preds = %12, %3
  %.0 = phi i32 [ %16, %12 ], [ %7, %3 ]
  %18 = getelementptr inbounds i8, ptr %1, i64 48
  %19 = load i32, ptr %18, align 8, !tbaa !16
  %20 = tail call noundef i32 @_ZN4juce4jmaxIiEET_S1_S1_(i32 noundef 0, i32 noundef %.0)
  %21 = getelementptr inbounds i8, ptr %1, i64 56
  %22 = load i32, ptr %21, align 8, !tbaa !17
  tail call void @_ZN4juce9RectangleIiEC2Eiiii(ptr noundef nonnull align 4 dereferenceable(16) %0, i32 noundef %5, i32 noundef %19, i32 noundef %20, i32 noundef %22) #2
  br i1 %2, label %23, label %29

23:                                               ; preds = %17
  %24 = load ptr, ptr %8, align 8, !tbaa !15
  %.not = icmp eq ptr %24, null
  br i1 %.not, label %29, label %25

25:                                               ; preds = %23
  %26 = getelementptr inbounds i8, ptr %24, i64 232
  %27 = tail call noundef ptr @_ZNK4juce13ScopedPointerINS_8TreeView12TreeViewportEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %26) #2
  call void @_ZNK4juce8Viewport15getViewPositionEv(ptr dead_on_unwind nonnull writable sret(%"class.juce::Point") align 4 %4, ptr noundef nonnull align 8 dereferenceable(1224) %27) #2
  %28 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZN4juce9RectangleIiEmIENS_5PointIiEE(ptr noundef nonnull align 4 dereferenceable(16) %0, ptr noundef nonnull %4) #2
  br label %29

29:                                               ; preds = %17, %23, %25
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK4juce12TreeViewItem10getIndentXEv(ptr noundef nonnull align 8 dereferenceable(73)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(16) ptr @_ZN4juce9RectangleIiEmIENS_5PointIiEE(ptr noundef nonnull align 4 dereferenceable(16), ptr noundef) local_unnamed_addr #0 align 2

attributes #0 = { 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 #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 = { 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, !13, i64 60}
!6 = !{!"_ZTSN4juce12TreeViewItemE", !7, i64 8, !7, i64 16, !10, i64 24, !13, i64 48, !13, i64 52, !13, i64 56, !13, i64 60, !13, i64 64, !13, i64 68, !14, i64 72, !14, i64 72, !14, i64 72, !14, i64 72, !14, i64 72, !14, i64 72, !13, i64 72}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSN4juce10OwnedArrayINS_12TreeViewItemENS_20DummyCriticalSectionEEE", !11, i64 0, !13, i64 16}
!11 = !{!"_ZTSN4juce19ArrayAllocationBaseIPNS_12TreeViewItemENS_20DummyCriticalSectionEEE", !12, i64 0, !13, i64 8}
!12 = !{!"_ZTSN4juce9HeapBlockIPNS_12TreeViewItemELb0EEE", !7, i64 0}
!13 = !{!"int", !8, i64 0}
!14 = !{!"bool", !8, i64 0}
!15 = !{!6, !7, i64 8}
!16 = !{!6, !13, i64 48}
!17 = !{!6, !13, i64 56}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass