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

; 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 uwtable
define dso_local void @_ZN4juce8TreeView18setRootItemVisibleEb(ptr noundef nonnull align 8 dereferenceable(313) %0, i1 noundef zeroext %1) #0 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca i8, align 1
  store ptr %0, ptr %3, align 8, !tbaa !5
  %5 = zext i1 %1 to i8
  store i8 %5, ptr %4, align 1, !tbaa !9
  %6 = load ptr, ptr %3, align 8
  %7 = load i8, ptr %4, align 1, !tbaa !9, !range !11, !noundef !12
  %8 = trunc i8 %7 to i1
  %9 = getelementptr inbounds %"class.juce::TreeView", ptr %6, i32 0, i32 13
  %10 = zext i1 %8 to i8
  store i8 %10, ptr %9, align 2, !tbaa !13
  %11 = getelementptr inbounds %"class.juce::TreeView", ptr %6, i32 0, i32 7
  %12 = load ptr, ptr %11, align 8, !tbaa !49
  %13 = icmp ne ptr %12, null
  br i1 %13, label %14, label %27

14:                                               ; preds = %2
  %15 = getelementptr inbounds %"class.juce::TreeView", ptr %6, i32 0, i32 11
  %16 = load i8, ptr %15, align 4, !tbaa !50, !range !11, !noundef !12
  %17 = trunc i8 %16 to i1
  br i1 %17, label %22, label %18

18:                                               ; preds = %14
  %19 = getelementptr inbounds %"class.juce::TreeView", ptr %6, i32 0, i32 13
  %20 = load i8, ptr %19, align 2, !tbaa !13, !range !11, !noundef !12
  %21 = trunc i8 %20 to i1
  br i1 %21, label %27, label %22

22:                                               ; preds = %18, %14
  %23 = getelementptr inbounds %"class.juce::TreeView", ptr %6, i32 0, i32 7
  %24 = load ptr, ptr %23, align 8, !tbaa !49
  call void @_ZN4juce12TreeViewItem7setOpenEb(ptr noundef nonnull align 8 dereferenceable(73) %24, i1 noundef zeroext false)
  %25 = getelementptr inbounds %"class.juce::TreeView", ptr %6, i32 0, i32 7
  %26 = load ptr, ptr %25, align 8, !tbaa !49
  call void @_ZN4juce12TreeViewItem7setOpenEb(ptr noundef nonnull align 8 dereferenceable(73) %26, i1 noundef zeroext true)
  br label %27

27:                                               ; preds = %22, %18, %2
  call void @_ZN4juce8TreeView12itemsChangedEv(ptr noundef nonnull align 8 dereferenceable(313) %6) #2
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4juce12TreeViewItem7setOpenEb(ptr noundef nonnull align 8 dereferenceable(73), i1 noundef zeroext) #0 align 2

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


; 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 void @_ZN4juce8TreeView18setRootItemVisibleEb(ptr noundef nonnull align 8 dereferenceable(313) %0, i1 noundef zeroext %1) local_unnamed_addr #0 align 2 {
  %3 = zext i1 %1 to i8
  %4 = getelementptr inbounds i8, ptr %0, i64 310
  store i8 %3, ptr %4, align 2, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 280
  %6 = load ptr, ptr %5, align 8, !tbaa !45
  %.not = icmp eq ptr %6, null
  br i1 %.not, label %13, label %7

7:                                                ; preds = %2
  %8 = getelementptr inbounds i8, ptr %0, i64 308
  %9 = load i8, ptr %8, align 4, !tbaa !46, !range !47, !noundef !48
  %10 = trunc nuw i8 %9 to i1
  %.not1 = xor i1 %1, true
  %brmerge = or i1 %.not1, %10
  br i1 %brmerge, label %11, label %13

11:                                               ; preds = %7
  tail call void @_ZN4juce12TreeViewItem7setOpenEb(ptr noundef nonnull align 8 dereferenceable(73) %6, i1 noundef zeroext false)
  %12 = load ptr, ptr %5, align 8, !tbaa !45
  tail call void @_ZN4juce12TreeViewItem7setOpenEb(ptr noundef nonnull align 8 dereferenceable(73) %12, i1 noundef zeroext true)
  br label %13

13:                                               ; preds = %7, %11, %2
  tail call void @_ZN4juce8TreeView12itemsChangedEv(ptr noundef nonnull align 8 dereferenceable(313) %0) #2
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4juce12TreeViewItem7setOpenEb(ptr noundef nonnull align 8 dereferenceable(73), i1 noundef zeroext) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4juce8TreeView12itemsChangedEv(ptr noundef nonnull align 8 dereferenceable(313)) local_unnamed_addr #1 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 = { 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, !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 = !{!6, !11, i64 280}
!46 = !{!6, !44, i64 308}
!47 = !{i8 0, i8 2}
!48 = !{}


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