; 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN4juce18isPositiveAndBelowIiEEbT_S1_(i32 noundef, i32 noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK4juce12TreeViewItem6isOpenEv(ptr noundef nonnull align 8 dereferenceable(73)) #2 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK4juce10OwnedArrayINS_12TreeViewItemENS_20DummyCriticalSectionEE12getUncheckedEi(ptr noundef nonnull align 8 dereferenceable(20), i32 noundef) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef ptr @_ZN4juce12TreeViewItem19findItemRecursivelyEi(ptr noundef nonnull align 8 dereferenceable(73) %0, i32 noundef %1) #2 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  %10 = load ptr, ptr %4, align 8
  %11 = load i32, ptr %5, align 4, !tbaa !9
  %12 = getelementptr inbounds %"class.juce::TreeViewItem", ptr %10, i32 0, i32 6
  %13 = load i32, ptr %12, align 8, !tbaa !11
  %14 = call noundef zeroext i1 @_ZN4juce18isPositiveAndBelowIiEEbT_S1_(i32 noundef %11, i32 noundef %13) #3
  br i1 %14, label %15, label %66

15:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  %16 = getelementptr inbounds %"class.juce::TreeViewItem", ptr %10, i32 0, i32 5
  %17 = load i32, ptr %16, align 4, !tbaa !17
  store i32 %17, ptr %6, align 4, !tbaa !9
  %18 = load i32, ptr %5, align 4, !tbaa !9
  %19 = load i32, ptr %6, align 4, !tbaa !9
  %20 = icmp slt i32 %18, %19
  br i1 %20, label %21, label %22

21:                                               ; preds = %15
  store ptr %10, ptr %3, align 8
  store i32 1, ptr %7, align 4
  br label %63

22:                                               ; preds = %15
  %23 = call noundef zeroext i1 @_ZNK4juce12TreeViewItem6isOpenEv(ptr noundef nonnull align 8 dereferenceable(73) %10) #3
  br i1 %23, label %24, label %62

24:                                               ; preds = %22
  %25 = load i32, ptr %6, align 4, !tbaa !9
  %26 = load i32, ptr %5, align 4, !tbaa !9
  %27 = sub nsw i32 %26, %25
  store i32 %27, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  store i32 0, ptr %8, align 4, !tbaa !9
  br label %28

28:                                               ; preds = %56, %24
  %29 = load i32, ptr %8, align 4, !tbaa !9
  %30 = getelementptr inbounds %"class.juce::TreeViewItem", ptr %10, i32 0, i32 3
  %31 = call noundef i32 @_ZNK4juce10OwnedArrayINS_12TreeViewItemENS_20DummyCriticalSectionEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %30) #3
  %32 = icmp slt i32 %29, %31
  br i1 %32, label %34, label %33

33:                                               ; preds = %28
  store i32 2, ptr %7, align 4
  br label %59

34:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %35 = getelementptr inbounds %"class.juce::TreeViewItem", ptr %10, i32 0, i32 3
  %36 = load i32, ptr %8, align 4, !tbaa !9
  %37 = call noundef ptr @_ZNK4juce10OwnedArrayINS_12TreeViewItemENS_20DummyCriticalSectionEE12getUncheckedEi(ptr noundef nonnull align 8 dereferenceable(20) %35, i32 noundef %36) #3
  store ptr %37, ptr %9, align 8, !tbaa !5
  %38 = load i32, ptr %5, align 4, !tbaa !9
  %39 = load ptr, ptr %9, align 8, !tbaa !5
  %40 = getelementptr inbounds %"class.juce::TreeViewItem", ptr %39, i32 0, i32 6
  %41 = load i32, ptr %40, align 8, !tbaa !11
  %42 = icmp slt i32 %38, %41
  br i1 %42, label %43, label %47

43:                                               ; preds = %34
  %44 = load ptr, ptr %9, align 8, !tbaa !5
  %45 = load i32, ptr %5, align 4, !tbaa !9
  %46 = call noundef ptr @_ZN4juce12TreeViewItem19findItemRecursivelyEi(ptr noundef nonnull align 8 dereferenceable(73) %44, i32 noundef %45) #3
  store ptr %46, ptr %3, align 8
  store i32 1, ptr %7, align 4
  br label %53

47:                                               ; preds = %34
  %48 = load ptr, ptr %9, align 8, !tbaa !5
  %49 = getelementptr inbounds %"class.juce::TreeViewItem", ptr %48, i32 0, i32 6
  %50 = load i32, ptr %49, align 8, !tbaa !11
  %51 = load i32, ptr %5, align 4, !tbaa !9
  %52 = sub nsw i32 %51, %50
  store i32 %52, ptr %5, align 4, !tbaa !9
  store i32 0, ptr %7, align 4
  br label %53

53:                                               ; preds = %47, %43
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  %54 = load i32, ptr %7, align 4
  switch i32 %54, label %59 [
    i32 0, label %55
  ]

55:                                               ; preds = %53
  br label %56

56:                                               ; preds = %55
  %57 = load i32, ptr %8, align 4, !tbaa !9
  %58 = add nsw i32 %57, 1
  store i32 %58, ptr %8, align 4, !tbaa !9
  br label %28, !llvm.loop !18

59:                                               ; preds = %53, %33
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  %60 = load i32, ptr %7, align 4
  switch i32 %60, label %63 [
    i32 2, label %61
  ]

61:                                               ; preds = %59
  br label %62

62:                                               ; preds = %61, %22
  store i32 0, ptr %7, align 4
  br label %63

63:                                               ; preds = %62, %59, %21
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  %64 = load i32, ptr %7, align 4
  switch i32 %64, label %69 [
    i32 0, label %65
    i32 1, label %67
  ]

65:                                               ; preds = %63
  br label %66

66:                                               ; preds = %65, %2
  store ptr null, ptr %3, align 8
  br label %67

67:                                               ; preds = %66, %63
  %68 = load ptr, ptr %3, align 8
  ret ptr %68

69:                                               ; preds = %63
  unreachable
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 56}
!12 = !{!"_ZTSN4juce12TreeViewItemE", !6, i64 8, !6, i64 16, !13, i64 24, !10, i64 48, !10, i64 52, !10, i64 56, !10, i64 60, !10, i64 64, !10, i64 68, !16, i64 72, !16, i64 72, !16, i64 72, !16, i64 72, !16, i64 72, !16, i64 72, !10, i64 72}
!13 = !{!"_ZTSN4juce10OwnedArrayINS_12TreeViewItemENS_20DummyCriticalSectionEEE", !14, i64 0, !10, i64 16}
!14 = !{!"_ZTSN4juce19ArrayAllocationBaseIPNS_12TreeViewItemENS_20DummyCriticalSectionEEE", !15, i64 0, !10, i64 8}
!15 = !{!"_ZTSN4juce9HeapBlockIPNS_12TreeViewItemELb0EEE", !6, i64 0}
!16 = !{!"bool", !7, i64 0}
!17 = !{!12, !10, i64 52}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}


; 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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN4juce18isPositiveAndBelowIiEEbT_S1_(i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK4juce12TreeViewItem6isOpenEv(ptr noundef nonnull align 8 dereferenceable(73)) local_unnamed_addr #1 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK4juce10OwnedArrayINS_12TreeViewItemENS_20DummyCriticalSectionEE12getUncheckedEi(ptr noundef nonnull align 8 dereferenceable(20), i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef ptr @_ZN4juce12TreeViewItem19findItemRecursivelyEi(ptr noundef nonnull align 8 dereferenceable(73) %0, i32 noundef %1) local_unnamed_addr #1 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 56
  %4 = load i32, ptr %3, align 8, !tbaa !5
  %5 = tail call noundef zeroext i1 @_ZN4juce18isPositiveAndBelowIiEEbT_S1_(i32 noundef %1, i32 noundef %4) #2
  br i1 %5, label %.lr.ph44, label %.thread31

tailrecurse.loopexit:                             ; preds = %.lr.ph
  %6 = tail call noundef zeroext i1 @_ZN4juce18isPositiveAndBelowIiEEbT_S1_(i32 noundef %.02339, i32 noundef %18) #2
  br i1 %6, label %.lr.ph44, label %.thread31

.lr.ph44:                                         ; preds = %2, %tailrecurse.loopexit
  %.tr3543 = phi i32 [ %.02339, %tailrecurse.loopexit ], [ %1, %2 ]
  %.tr42 = phi ptr [ %16, %tailrecurse.loopexit ], [ %0, %2 ]
  %7 = getelementptr inbounds i8, ptr %.tr42, i64 52
  %8 = load i32, ptr %7, align 4, !tbaa !15
  %9 = icmp sgt i32 %8, %.tr3543
  br i1 %9, label %.thread31, label %10

10:                                               ; preds = %.lr.ph44
  %11 = tail call noundef zeroext i1 @_ZNK4juce12TreeViewItem6isOpenEv(ptr noundef nonnull align 8 dereferenceable(73) %.tr42) #2
  br i1 %11, label %12, label %.thread31

12:                                               ; preds = %10
  %13 = getelementptr inbounds i8, ptr %.tr42, i64 24
  %14 = tail call noundef i32 @_ZNK4juce10OwnedArrayINS_12TreeViewItemENS_20DummyCriticalSectionEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %13) #2
  %.not2838 = icmp sgt i32 %14, 0
  br i1 %.not2838, label %.lr.ph.preheader, label %.thread31

.lr.ph.preheader:                                 ; preds = %12
  %15 = sub nsw i32 %.tr3543, %8
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %19
  %.01940 = phi i32 [ %21, %19 ], [ 0, %.lr.ph.preheader ]
  %.02339 = phi i32 [ %20, %19 ], [ %15, %.lr.ph.preheader ]
  %16 = tail call noundef ptr @_ZNK4juce10OwnedArrayINS_12TreeViewItemENS_20DummyCriticalSectionEE12getUncheckedEi(ptr noundef nonnull align 8 dereferenceable(20) %13, i32 noundef %.01940) #2
  %17 = getelementptr inbounds i8, ptr %16, i64 56
  %18 = load i32, ptr %17, align 8, !tbaa !5
  %.not = icmp slt i32 %.02339, %18
  br i1 %.not, label %tailrecurse.loopexit, label %19

19:                                               ; preds = %.lr.ph
  %20 = sub nsw i32 %.02339, %18
  %21 = add nuw nsw i32 %.01940, 1
  %22 = tail call noundef i32 @_ZNK4juce10OwnedArrayINS_12TreeViewItemENS_20DummyCriticalSectionEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %13) #2
  %.not28 = icmp slt i32 %21, %22
  br i1 %.not28, label %.lr.ph, label %.thread31, !llvm.loop !16

.thread31:                                        ; preds = %.lr.ph44, %tailrecurse.loopexit, %10, %12, %19, %2
  %.5 = phi ptr [ null, %2 ], [ null, %19 ], [ null, %12 ], [ %.tr42, %.lr.ph44 ], [ null, %tailrecurse.loopexit ], [ null, %10 ]
  ret ptr %.5
}

attributes #0 = { 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 #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, !13, i64 56}
!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, !13, i64 52}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass