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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef ptr @_ZNK4juce8TreeView12getItemOnRowEi(ptr noundef nonnull align 8 dereferenceable(313) %0, i32 noundef %1) #0 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  %6 = load ptr, ptr %4, align 8
  %7 = getelementptr inbounds %"class.juce::TreeView", ptr %6, i32 0, i32 13
  %8 = load i8, ptr %7, align 2, !tbaa !11, !range !47, !noundef !48
  %9 = trunc i8 %8 to i1
  br i1 %9, label %13, label %10

10:                                               ; preds = %2
  %11 = load i32, ptr %5, align 4, !tbaa !9
  %12 = add nsw i32 %11, 1
  store i32 %12, ptr %5, align 4, !tbaa !9
  br label %13

13:                                               ; preds = %10, %2
  %14 = getelementptr inbounds %"class.juce::TreeView", ptr %6, i32 0, i32 7
  %15 = load ptr, ptr %14, align 8, !tbaa !49
  %16 = icmp ne ptr %15, null
  br i1 %16, label %17, label %25

17:                                               ; preds = %13
  %18 = load i32, ptr %5, align 4, !tbaa !9
  %19 = icmp sge i32 %18, 0
  br i1 %19, label %20, label %25

20:                                               ; preds = %17
  %21 = getelementptr inbounds %"class.juce::TreeView", ptr %6, i32 0, i32 7
  %22 = load ptr, ptr %21, align 8, !tbaa !49
  %23 = load i32, ptr %5, align 4, !tbaa !9
  %24 = call noundef ptr @_ZN4juce12TreeViewItem12getItemOnRowEi(ptr noundef nonnull align 8 dereferenceable(73) %22, i32 noundef %23) #1
  store ptr %24, ptr %3, align 8
  br label %26

25:                                               ; preds = %17, %13
  store ptr null, ptr %3, align 8
  br label %26

26:                                               ; preds = %25, %20
  %27 = load ptr, ptr %3, align 8
  ret ptr %27
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN4juce12TreeViewItem12getItemOnRowEi(ptr noundef nonnull align 8 dereferenceable(73), i32 noundef) #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 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !46, i64 310}
!12 = !{!"_ZTSN4juce8TreeViewE", !13, i64 0, !38, i64 200, !40, i64 216, !41, i64 224, !42, i64 232, !43, i64 240, !6, i64 280, !44, i64 288, !45, i64 296, !10, i64 304, !46, i64 308, !46, i64 309, !46, i64 310, !46, i64 311, !46, i64 312}
!13 = !{!"_ZTSN4juce9ComponentE", !14, i64 0, !15, i64 8, !15, i64 16, !6, i64 24, !17, i64 32, !19, i64 48, !20, i64 56, !21, i64 64, !6, i64 88, !24, i64 96, !6, i64 104, !25, i64 112, !26, i64 120, !27, i64 128, !28, i64 136, !32, i64 160, !36, i64 184, !7, i64 192, !7, i64 196}
!14 = !{!"_ZTSN4juce13MouseListenerE"}
!15 = !{!"_ZTSN4juce6StringE", !16, i64 0}
!16 = !{!"_ZTSN4juce16CharPointer_UTF8E", !6, i64 0}
!17 = !{!"_ZTSN4juce9RectangleIiEE", !18, i64 0, !10, i64 8, !10, i64 12}
!18 = !{!"_ZTSN4juce5PointIiEE", !10, i64 0, !10, i64 4}
!19 = !{!"_ZTSN4juce13ScopedPointerINS_9Component10PositionerEEE", !6, i64 0}
!20 = !{!"_ZTSN4juce13ScopedPointerINS_15AffineTransformEEE", !6, i64 0}
!21 = !{!"_ZTSN4juce5ArrayIPNS_9ComponentENS_20DummyCriticalSectionELi0EEE", !22, i64 0, !10, i64 16}
!22 = !{!"_ZTSN4juce19ArrayAllocationBaseIPNS_9ComponentENS_20DummyCriticalSectionEEE", !23, i64 0, !10, i64 8}
!23 = !{!"_ZTSN4juce9HeapBlockIPNS_9ComponentELb0EEE", !6, i64 0}
!24 = !{!"_ZTSN4juce11MouseCursorE", !6, i64 0}
!25 = !{!"_ZTSN4juce13ScopedPointerINS_20CachedComponentImageEEE", !6, i64 0}
!26 = !{!"_ZTSN4juce13ScopedPointerINS_9Component17MouseListenerListEEE", !6, i64 0}
!27 = !{!"_ZTSN4juce13ScopedPointerINS_5ArrayIPNS_11KeyListenerENS_20DummyCriticalSectionELi0EEEEE", !6, i64 0}
!28 = !{!"_ZTSN4juce12ListenerListINS_17ComponentListenerENS_5ArrayIPS1_NS_20DummyCriticalSectionELi0EEEEE", !29, i64 0}
!29 = !{!"_ZTSN4juce5ArrayIPNS_17ComponentListenerENS_20DummyCriticalSectionELi0EEE", !30, i64 0, !10, i64 16}
!30 = !{!"_ZTSN4juce19ArrayAllocationBaseIPNS_17ComponentListenerENS_20DummyCriticalSectionEEE", !31, i64 0, !10, i64 8}
!31 = !{!"_ZTSN4juce9HeapBlockIPNS_17ComponentListenerELb0EEE", !6, i64 0}
!32 = !{!"_ZTSN4juce13NamedValueSetE", !33, i64 0}
!33 = !{!"_ZTSN4juce5ArrayINS_13NamedValueSet10NamedValueENS_20DummyCriticalSectionELi0EEE", !34, i64 0, !10, i64 16}
!34 = !{!"_ZTSN4juce19ArrayAllocationBaseINS_13NamedValueSet10NamedValueENS_20DummyCriticalSectionEEE", !35, i64 0, !10, i64 8}
!35 = !{!"_ZTSN4juce9HeapBlockINS_13NamedValueSet10NamedValueELb0EEE", !6, i64 0}
!36 = !{!"_ZTSN4juce13WeakReferenceINS_9ComponentENS_22ReferenceCountedObjectEE6MasterE", !37, i64 0}
!37 = !{!"_ZTSN4juce25ReferenceCountedObjectPtrINS_13WeakReferenceINS_9ComponentENS_22ReferenceCountedObjectEE13SharedPointerEEE", !6, i64 0}
!38 = !{!"_ZTSN4juce21SettableTooltipClientE", !39, i64 0, !15, i64 8}
!39 = !{!"_ZTSN4juce13TooltipClientE"}
!40 = !{!"_ZTSN4juce21FileDragAndDropTargetE"}
!41 = !{!"_ZTSN4juce17DragAndDropTargetE"}
!42 = !{!"_ZTSN4juce13ScopedPointerINS_8TreeView12TreeViewportEEE", !6, i64 0}
!43 = !{!"_ZTSN4juce15CriticalSectionE", !7, i64 0}
!44 = !{!"_ZTSN4juce13ScopedPointerINS_8TreeView20InsertPointHighlightEEE", !6, i64 0}
!45 = !{!"_ZTSN4juce13ScopedPointerINS_8TreeView20TargetGroupHighlightEEE", !6, i64 0}
!46 = !{!"bool", !7, i64 0}
!47 = !{i8 0, i8 2}
!48 = !{}
!49 = !{!12, !6, i64 280}


; 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 nounwind uwtable
define dso_local noundef ptr @_ZNK4juce8TreeView12getItemOnRowEi(ptr nocapture noundef nonnull readonly align 8 dereferenceable(313) %0, i32 noundef %1) local_unnamed_addr #0 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 310
  %4 = load i8, ptr %3, align 2, !tbaa !5, !range !45, !noundef !46
  %5 = xor i8 %4, 1
  %not. = zext nneg i8 %5 to i32
  %spec.select = add nsw i32 %not., %1
  %6 = getelementptr inbounds i8, ptr %0, i64 280
  %7 = load ptr, ptr %6, align 8, !tbaa !47
  %8 = icmp ne ptr %7, null
  %9 = icmp sgt i32 %spec.select, -1
  %or.cond = select i1 %8, i1 %9, i1 false
  br i1 %or.cond, label %10, label %12

10:                                               ; preds = %2
  %11 = tail call noundef ptr @_ZN4juce12TreeViewItem12getItemOnRowEi(ptr noundef nonnull align 8 dereferenceable(73) %7, i32 noundef %spec.select) #1
  br label %12

12:                                               ; preds = %2, %10
  %.05 = phi ptr [ %11, %10 ], [ null, %2 ]
  ret ptr %.05
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN4juce12TreeViewItem12getItemOnRowEi(ptr noundef nonnull align 8 dereferenceable(73), i32 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 = { 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, !44, i64 310}
!6 = !{!"_ZTSN4juce8TreeViewE", !7, i64 0, !36, i64 200, !38, i64 216, !39, i64 224, !40, i64 232, !41, i64 240, !11, i64 280, !42, i64 288, !43, i64 296, !16, i64 304, !44, i64 308, !44, i64 309, !44, i64 310, !44, i64 311, !44, i64 312}
!7 = !{!"_ZTSN4juce9ComponentE", !8, i64 0, !9, i64 8, !9, i64 16, !11, i64 24, !14, i64 32, !17, i64 48, !18, i64 56, !19, i64 64, !11, i64 88, !22, i64 96, !11, i64 104, !23, i64 112, !24, i64 120, !25, i64 128, !26, i64 136, !30, i64 160, !34, i64 184, !12, i64 192, !12, i64 196}
!8 = !{!"_ZTSN4juce13MouseListenerE"}
!9 = !{!"_ZTSN4juce6StringE", !10, i64 0}
!10 = !{!"_ZTSN4juce16CharPointer_UTF8E", !11, i64 0}
!11 = !{!"any pointer", !12, i64 0}
!12 = !{!"omnipotent char", !13, i64 0}
!13 = !{!"Simple C++ TBAA"}
!14 = !{!"_ZTSN4juce9RectangleIiEE", !15, i64 0, !16, i64 8, !16, i64 12}
!15 = !{!"_ZTSN4juce5PointIiEE", !16, i64 0, !16, i64 4}
!16 = !{!"int", !12, i64 0}
!17 = !{!"_ZTSN4juce13ScopedPointerINS_9Component10PositionerEEE", !11, i64 0}
!18 = !{!"_ZTSN4juce13ScopedPointerINS_15AffineTransformEEE", !11, i64 0}
!19 = !{!"_ZTSN4juce5ArrayIPNS_9ComponentENS_20DummyCriticalSectionELi0EEE", !20, i64 0, !16, i64 16}
!20 = !{!"_ZTSN4juce19ArrayAllocationBaseIPNS_9ComponentENS_20DummyCriticalSectionEEE", !21, i64 0, !16, i64 8}
!21 = !{!"_ZTSN4juce9HeapBlockIPNS_9ComponentELb0EEE", !11, i64 0}
!22 = !{!"_ZTSN4juce11MouseCursorE", !11, i64 0}
!23 = !{!"_ZTSN4juce13ScopedPointerINS_20CachedComponentImageEEE", !11, i64 0}
!24 = !{!"_ZTSN4juce13ScopedPointerINS_9Component17MouseListenerListEEE", !11, i64 0}
!25 = !{!"_ZTSN4juce13ScopedPointerINS_5ArrayIPNS_11KeyListenerENS_20DummyCriticalSectionELi0EEEEE", !11, i64 0}
!26 = !{!"_ZTSN4juce12ListenerListINS_17ComponentListenerENS_5ArrayIPS1_NS_20DummyCriticalSectionELi0EEEEE", !27, i64 0}
!27 = !{!"_ZTSN4juce5ArrayIPNS_17ComponentListenerENS_20DummyCriticalSectionELi0EEE", !28, i64 0, !16, i64 16}
!28 = !{!"_ZTSN4juce19ArrayAllocationBaseIPNS_17ComponentListenerENS_20DummyCriticalSectionEEE", !29, i64 0, !16, i64 8}
!29 = !{!"_ZTSN4juce9HeapBlockIPNS_17ComponentListenerELb0EEE", !11, i64 0}
!30 = !{!"_ZTSN4juce13NamedValueSetE", !31, i64 0}
!31 = !{!"_ZTSN4juce5ArrayINS_13NamedValueSet10NamedValueENS_20DummyCriticalSectionELi0EEE", !32, i64 0, !16, i64 16}
!32 = !{!"_ZTSN4juce19ArrayAllocationBaseINS_13NamedValueSet10NamedValueENS_20DummyCriticalSectionEEE", !33, i64 0, !16, i64 8}
!33 = !{!"_ZTSN4juce9HeapBlockINS_13NamedValueSet10NamedValueELb0EEE", !11, i64 0}
!34 = !{!"_ZTSN4juce13WeakReferenceINS_9ComponentENS_22ReferenceCountedObjectEE6MasterE", !35, i64 0}
!35 = !{!"_ZTSN4juce25ReferenceCountedObjectPtrINS_13WeakReferenceINS_9ComponentENS_22ReferenceCountedObjectEE13SharedPointerEEE", !11, i64 0}
!36 = !{!"_ZTSN4juce21SettableTooltipClientE", !37, i64 0, !9, i64 8}
!37 = !{!"_ZTSN4juce13TooltipClientE"}
!38 = !{!"_ZTSN4juce21FileDragAndDropTargetE"}
!39 = !{!"_ZTSN4juce17DragAndDropTargetE"}
!40 = !{!"_ZTSN4juce13ScopedPointerINS_8TreeView12TreeViewportEEE", !11, i64 0}
!41 = !{!"_ZTSN4juce15CriticalSectionE", !12, i64 0}
!42 = !{!"_ZTSN4juce13ScopedPointerINS_8TreeView20InsertPointHighlightEEE", !11, i64 0}
!43 = !{!"_ZTSN4juce13ScopedPointerINS_8TreeView20TargetGroupHighlightEEE", !11, i64 0}
!44 = !{!"bool", !12, i64 0}
!45 = !{i8 0, i8 2}
!46 = !{}
!47 = !{!6, !11, i64 280}


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