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

; 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::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 }

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4juce9Component7repaintEv(ptr noundef nonnull align 8 dereferenceable(197)) #0 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4juce12TreeViewItem11setSelectedEbbNS_16NotificationTypeE(ptr noundef nonnull align 8 dereferenceable(73) %0, i1 noundef zeroext %1, i1 noundef zeroext %2, i32 noundef %3) #0 align 2 {
  %5 = alloca ptr, align 8
  %6 = alloca i8, align 1
  %7 = alloca i8, align 1
  %8 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  %9 = zext i1 %1 to i8
  store i8 %9, ptr %6, align 1, !tbaa !9
  %10 = zext i1 %2 to i8
  store i8 %10, ptr %7, align 1, !tbaa !9
  store i32 %3, ptr %8, align 4, !tbaa !11
  %11 = load ptr, ptr %5, align 8
  %12 = load i8, ptr %6, align 1, !tbaa !9, !range !13, !noundef !14
  %13 = trunc i8 %12 to i1
  br i1 %13, label %14, label %20

14:                                               ; preds = %4
  %15 = load ptr, ptr %11, align 8, !tbaa !15
  %16 = getelementptr inbounds ptr, ptr %15, i64 7
  %17 = load ptr, ptr %16, align 8
  %18 = call noundef zeroext i1 %17(ptr noundef nonnull align 8 dereferenceable(73) %11)
  br i1 %18, label %20, label %19

19:                                               ; preds = %14
  br label %60

20:                                               ; preds = %14, %4
  %21 = load i8, ptr %7, align 1, !tbaa !9, !range !13, !noundef !14
  %22 = trunc i8 %21 to i1
  br i1 %22, label %23, label %25

23:                                               ; preds = %20
  %24 = call noundef ptr @_ZN4juce12TreeViewItem15getTopLevelItemEv(ptr noundef nonnull align 8 dereferenceable(73) %11) #2
  call void @_ZN4juce12TreeViewItem22deselectAllRecursivelyEPS0_(ptr noundef nonnull align 8 dereferenceable(73) %24, ptr noundef %11)
  br label %25

25:                                               ; preds = %23, %20
  %26 = load i8, ptr %6, align 1, !tbaa !9, !range !13, !noundef !14
  %27 = trunc i8 %26 to i1
  %28 = zext i1 %27 to i32
  %29 = getelementptr inbounds %"class.juce::TreeViewItem", ptr %11, i32 0, i32 10
  %30 = load i8, ptr %29, align 8
  %31 = and i8 %30, 1
  %32 = trunc i8 %31 to i1
  %33 = zext i1 %32 to i32
  %34 = icmp ne i32 %28, %33
  br i1 %34, label %35, label %60

35:                                               ; preds = %25
  %36 = load i8, ptr %6, align 1, !tbaa !9, !range !13, !noundef !14
  %37 = trunc i8 %36 to i1
  %38 = icmp ne i1 %37, false
  %39 = getelementptr inbounds %"class.juce::TreeViewItem", ptr %11, i32 0, i32 10
  %40 = zext i1 %38 to i8
  %41 = load i8, ptr %39, align 8
  %42 = and i8 %41, -2
  %43 = or i8 %42, %40
  store i8 %43, ptr %39, align 8
  %44 = getelementptr inbounds %"class.juce::TreeViewItem", ptr %11, i32 0, i32 1
  %45 = load ptr, ptr %44, align 8, !tbaa !17
  %46 = icmp ne ptr %45, null
  br i1 %46, label %47, label %50

47:                                               ; preds = %35
  %48 = getelementptr inbounds %"class.juce::TreeViewItem", ptr %11, i32 0, i32 1
  %49 = load ptr, ptr %48, align 8, !tbaa !17
  call void @_ZN4juce9Component7repaintEv(ptr noundef nonnull align 8 dereferenceable(197) %49)
  br label %50

50:                                               ; preds = %47, %35
  %51 = load i32, ptr %8, align 4, !tbaa !11
  %52 = icmp ne i32 %51, 0
  br i1 %52, label %53, label %59

53:                                               ; preds = %50
  %54 = load i8, ptr %6, align 1, !tbaa !9, !range !13, !noundef !14
  %55 = trunc i8 %54 to i1
  %56 = load ptr, ptr %11, align 8, !tbaa !15
  %57 = getelementptr inbounds ptr, ptr %56, i64 15
  %58 = load ptr, ptr %57, align 8
  call void %58(ptr noundef nonnull align 8 dereferenceable(73) %11, i1 noundef zeroext %55)
  br label %59

59:                                               ; preds = %53, %50
  br label %60

60:                                               ; preds = %59, %25, %19
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN4juce12TreeViewItem15getTopLevelItemEv(ptr noundef nonnull align 8 dereferenceable(73)) #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 = !{!12, !12, i64 0}
!12 = !{!"_ZTSN4juce16NotificationTypeE", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = !{!16, !16, i64 0}
!16 = !{!"vtable pointer", !8, i64 0}
!17 = !{!18, !6, i64 8}
!18 = !{!"_ZTSN4juce12TreeViewItemE", !6, i64 8, !6, i64 16, !19, i64 24, !22, i64 48, !22, i64 52, !22, i64 56, !22, i64 60, !22, i64 64, !22, i64 68, !10, i64 72, !10, i64 72, !10, i64 72, !10, i64 72, !10, i64 72, !10, i64 72, !22, i64 72}
!19 = !{!"_ZTSN4juce10OwnedArrayINS_12TreeViewItemENS_20DummyCriticalSectionEEE", !20, i64 0, !22, i64 16}
!20 = !{!"_ZTSN4juce19ArrayAllocationBaseIPNS_12TreeViewItemENS_20DummyCriticalSectionEEE", !21, i64 0, !22, i64 8}
!21 = !{!"_ZTSN4juce9HeapBlockIPNS_12TreeViewItemELb0EEE", !6, i64 0}
!22 = !{!"int", !7, i64 0}


; 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
declare dso_local void @_ZN4juce9Component7repaintEv(ptr noundef nonnull align 8 dereferenceable(197)) local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4juce12TreeViewItem11setSelectedEbbNS_16NotificationTypeE(ptr noundef nonnull align 8 dereferenceable(73) %0, i1 noundef zeroext %1, i1 noundef zeroext %2, i32 noundef %3) local_unnamed_addr #0 align 2 {
  %5 = zext i1 %1 to i8
  br i1 %1, label %6, label %11

6:                                                ; preds = %4
  %7 = load ptr, ptr %0, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %7, i64 56
  %9 = load ptr, ptr %8, align 8
  %10 = tail call noundef zeroext i1 %9(ptr noundef nonnull align 8 dereferenceable(73) %0)
  br i1 %10, label %11, label %30

11:                                               ; preds = %6, %4
  br i1 %2, label %12, label %14

12:                                               ; preds = %11
  %13 = tail call noundef ptr @_ZN4juce12TreeViewItem15getTopLevelItemEv(ptr noundef nonnull align 8 dereferenceable(73) %0) #2
  tail call void @_ZN4juce12TreeViewItem22deselectAllRecursivelyEPS0_(ptr noundef nonnull align 8 dereferenceable(73) %13, ptr noundef nonnull %0)
  br label %14

14:                                               ; preds = %12, %11
  %15 = getelementptr inbounds i8, ptr %0, i64 72
  %16 = load i8, ptr %15, align 8
  %17 = trunc i8 %16 to i1
  %18 = xor i1 %17, %1
  br i1 %18, label %19, label %30

19:                                               ; preds = %14
  %20 = and i8 %16, -2
  %21 = or disjoint i8 %20, %5
  store i8 %21, ptr %15, align 8
  %22 = getelementptr inbounds i8, ptr %0, i64 8
  %23 = load ptr, ptr %22, align 8, !tbaa !8
  %.not = icmp eq ptr %23, null
  br i1 %.not, label %25, label %24

24:                                               ; preds = %19
  tail call void @_ZN4juce9Component7repaintEv(ptr noundef nonnull align 8 dereferenceable(197) %23)
  br label %25

25:                                               ; preds = %24, %19
  %.not6 = icmp eq i32 %3, 0
  br i1 %.not6, label %30, label %26

26:                                               ; preds = %25
  %27 = load ptr, ptr %0, align 8, !tbaa !5
  %28 = getelementptr inbounds i8, ptr %27, i64 120
  %29 = load ptr, ptr %28, align 8
  tail call void %29(ptr noundef nonnull align 8 dereferenceable(73) %0, i1 noundef zeroext %1)
  br label %30

30:                                               ; preds = %25, %26, %6, %14
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN4juce12TreeViewItem15getTopLevelItemEv(ptr noundef nonnull align 8 dereferenceable(73)) 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, !6, i64 0}
!6 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !10, i64 8}
!9 = !{!"_ZTSN4juce12TreeViewItemE", !10, i64 8, !10, i64 16, !12, i64 24, !15, i64 48, !15, i64 52, !15, i64 56, !15, i64 60, !15, i64 64, !15, i64 68, !16, i64 72, !16, i64 72, !16, i64 72, !16, i64 72, !16, i64 72, !16, i64 72, !15, i64 72}
!10 = !{!"any pointer", !11, i64 0}
!11 = !{!"omnipotent char", !7, i64 0}
!12 = !{!"_ZTSN4juce10OwnedArrayINS_12TreeViewItemENS_20DummyCriticalSectionEEE", !13, i64 0, !15, i64 16}
!13 = !{!"_ZTSN4juce19ArrayAllocationBaseIPNS_12TreeViewItemENS_20DummyCriticalSectionEEE", !14, i64 0, !15, i64 8}
!14 = !{!"_ZTSN4juce9HeapBlockIPNS_12TreeViewItemELb0EEE", !10, i64 0}
!15 = !{!"int", !11, i64 0}
!16 = !{!"bool", !11, i64 0}


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