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

; 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::DirectoryContentsDisplayComponent" = type { ptr, ptr, %"class.juce::ListenerList.213" }
%"class.juce::ListenerList.213" = type { %"class.juce::Array.214" }
%"class.juce::Array.214" = type { %"class.juce::ArrayAllocationBase.215", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase.215" = type <{ %"class.juce::HeapBlock.216", i32, [4 x i8] }>
%"class.juce::HeapBlock.216" = type { ptr }

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #0

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

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

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4juce17FileTreeComponent7refreshEv(ptr noundef nonnull align 8 dereferenceable(372) %0) #4 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %6 = load ptr, ptr %2, align 8
  call void @_ZN4juce8TreeView14deleteRootItemEv(ptr noundef nonnull align 8 dereferenceable(313) %6)
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  %7 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 208) #6
  %8 = getelementptr inbounds i8, ptr %6, i64 320
  %9 = getelementptr inbounds %"class.juce::DirectoryContentsDisplayComponent", ptr %8, i32 0, i32 1
  %10 = load ptr, ptr %9, align 8, !tbaa !9
  %11 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK4juce21DirectoryContentsList12getDirectoryEv(ptr noundef nonnull align 8 dereferenceable(177) %10) #5
  %12 = getelementptr inbounds i8, ptr %6, i64 320
  %13 = getelementptr inbounds %"class.juce::DirectoryContentsDisplayComponent", ptr %12, i32 0, i32 1
  %14 = load ptr, ptr %13, align 8, !tbaa !9
  %15 = call noundef nonnull align 8 dereferenceable(400) ptr @_ZNK4juce21DirectoryContentsList18getTimeSliceThreadEv(ptr noundef nonnull align 8 dereferenceable(177) %14) #5
  invoke void @_ZN4juce16FileListTreeItemC2ERNS_17FileTreeComponentEPNS_21DirectoryContentsListEiRKNS_4FileERNS_15TimeSliceThreadE(ptr noundef nonnull align 8 dereferenceable(208) %7, ptr noundef nonnull align 8 dereferenceable(372) %6, ptr noundef null, i32 noundef 0, ptr noundef nonnull align 8 dereferenceable(8) %11, ptr noundef nonnull align 8 dereferenceable(400) %15)
          to label %16 unwind label %22

16:                                               ; preds = %1
  store ptr %7, ptr %3, align 8, !tbaa !5
  %17 = load ptr, ptr %3, align 8, !tbaa !5
  %18 = getelementptr inbounds i8, ptr %6, i64 320
  %19 = getelementptr inbounds %"class.juce::DirectoryContentsDisplayComponent", ptr %18, i32 0, i32 1
  %20 = load ptr, ptr %19, align 8, !tbaa !9
  call void @_ZN4juce16FileListTreeItem18setSubContentsListEPNS_21DirectoryContentsListEb(ptr noundef nonnull align 8 dereferenceable(208) %17, ptr noundef %20, i1 noundef zeroext false)
  %21 = load ptr, ptr %3, align 8, !tbaa !5
  call void @_ZN4juce8TreeView11setRootItemEPNS_12TreeViewItemE(ptr noundef nonnull align 8 dereferenceable(313) %6, ptr noundef %21)
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  ret void

22:                                               ; preds = %1
  %23 = landingpad { ptr, i32 }
          cleanup
  %24 = extractvalue { ptr, i32 } %23, 0
  store ptr %24, ptr %4, align 8
  %25 = extractvalue { ptr, i32 } %23, 1
  store i32 %25, ptr %5, align 4
  call void @_ZdlPvm(ptr noundef %7, i64 noundef 208) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  br label %26

26:                                               ; preds = %22
  %27 = load ptr, ptr %4, align 8
  %28 = load i32, ptr %5, align 4
  %29 = insertvalue { ptr, i32 } poison, ptr %27, 0
  %30 = insertvalue { ptr, i32 } %29, i32 %28, 1
  resume { ptr, i32 } %30
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4juce8TreeView14deleteRootItemEv(ptr noundef nonnull align 8 dereferenceable(313)) #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4juce16FileListTreeItemC2ERNS_17FileTreeComponentEPNS_21DirectoryContentsListEiRKNS_4FileERNS_15TimeSliceThreadE(ptr noundef nonnull align 8 dereferenceable(208), ptr noundef nonnull align 8 dereferenceable(372), ptr noundef, i32 noundef, ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(400)) unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4juce16FileListTreeItem18setSubContentsListEPNS_21DirectoryContentsListEb(ptr noundef nonnull align 8 dereferenceable(208), ptr noundef, i1 noundef zeroext) #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4juce8TreeView11setRootItemEPNS_12TreeViewItemE(ptr noundef nonnull align 8 dereferenceable(313), ptr noundef) #4 align 2

attributes #0 = { nobuiltin nounwind "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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nobuiltin allocsize(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 = { 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 = { 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 #5 = { nounwind }
attributes #6 = { builtin allocsize(0) }
attributes #7 = { builtin 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, !6, i64 8}
!10 = !{!"_ZTSN4juce33DirectoryContentsDisplayComponentE", !6, i64 8, !11, i64 16}
!11 = !{!"_ZTSN4juce12ListenerListINS_19FileBrowserListenerENS_5ArrayIPS1_NS_20DummyCriticalSectionELi0EEEEE", !12, i64 0}
!12 = !{!"_ZTSN4juce5ArrayIPNS_19FileBrowserListenerENS_20DummyCriticalSectionELi0EEE", !13, i64 0, !15, i64 16}
!13 = !{!"_ZTSN4juce19ArrayAllocationBaseIPNS_19FileBrowserListenerENS_20DummyCriticalSectionEEE", !14, i64 0, !15, i64 8}
!14 = !{!"_ZTSN4juce9HeapBlockIPNS_19FileBrowserListenerELb0EEE", !6, i64 0}
!15 = !{!"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"

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr #1

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4juce17FileTreeComponent7refreshEv(ptr noundef nonnull align 8 dereferenceable(372) %0) local_unnamed_addr #3 align 2 personality ptr @__gxx_personality_v0 {
  tail call void @_ZN4juce8TreeView14deleteRootItemEv(ptr noundef nonnull align 8 dereferenceable(313) %0)
  %2 = tail call noalias noundef nonnull dereferenceable(208) ptr @_Znwm(i64 noundef 208) #4
  %3 = getelementptr inbounds i8, ptr %0, i64 328
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK4juce21DirectoryContentsList12getDirectoryEv(ptr noundef nonnull align 8 dereferenceable(177) %4) #5
  %6 = load ptr, ptr %3, align 8, !tbaa !5
  %7 = tail call noundef nonnull align 8 dereferenceable(400) ptr @_ZNK4juce21DirectoryContentsList18getTimeSliceThreadEv(ptr noundef nonnull align 8 dereferenceable(177) %6) #5
  invoke void @_ZN4juce16FileListTreeItemC2ERNS_17FileTreeComponentEPNS_21DirectoryContentsListEiRKNS_4FileERNS_15TimeSliceThreadE(ptr noundef nonnull align 8 dereferenceable(208) %2, ptr noundef nonnull align 8 dereferenceable(372) %0, ptr noundef null, i32 noundef 0, ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(400) %7)
          to label %8 unwind label %10

8:                                                ; preds = %1
  %9 = load ptr, ptr %3, align 8, !tbaa !5
  tail call void @_ZN4juce16FileListTreeItem18setSubContentsListEPNS_21DirectoryContentsListEb(ptr noundef nonnull align 8 dereferenceable(208) %2, ptr noundef %9, i1 noundef zeroext false)
  tail call void @_ZN4juce8TreeView11setRootItemEPNS_12TreeViewItemE(ptr noundef nonnull align 8 dereferenceable(313) %0, ptr noundef nonnull %2)
  ret void

10:                                               ; preds = %1
  %11 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZdlPvm(ptr noundef nonnull %2, i64 noundef 208) #6
  resume { ptr, i32 } %11
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(400) ptr @_ZNK4juce21DirectoryContentsList18getTimeSliceThreadEv(ptr noundef nonnull align 8 dereferenceable(177)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4juce8TreeView14deleteRootItemEv(ptr noundef nonnull align 8 dereferenceable(313)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4juce16FileListTreeItemC2ERNS_17FileTreeComponentEPNS_21DirectoryContentsListEiRKNS_4FileERNS_15TimeSliceThreadE(ptr noundef nonnull align 8 dereferenceable(208), ptr noundef nonnull align 8 dereferenceable(372), ptr noundef, i32 noundef, ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(400)) unnamed_addr #3 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4juce8TreeView11setRootItemEPNS_12TreeViewItemE(ptr noundef nonnull align 8 dereferenceable(313), ptr noundef) local_unnamed_addr #3 align 2

attributes #0 = { nobuiltin nounwind "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 = { nobuiltin allocsize(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 = { 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 #4 = { builtin allocsize(0) }
attributes #5 = { nounwind }
attributes #6 = { builtin 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, !7, i64 8}
!6 = !{!"_ZTSN4juce33DirectoryContentsDisplayComponentE", !7, i64 8, !10, i64 16}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSN4juce12ListenerListINS_19FileBrowserListenerENS_5ArrayIPS1_NS_20DummyCriticalSectionELi0EEEEE", !11, i64 0}
!11 = !{!"_ZTSN4juce5ArrayIPNS_19FileBrowserListenerENS_20DummyCriticalSectionELi0EEE", !12, i64 0, !14, i64 16}
!12 = !{!"_ZTSN4juce19ArrayAllocationBaseIPNS_19FileBrowserListenerENS_20DummyCriticalSectionEEE", !13, i64 0, !14, i64 8}
!13 = !{!"_ZTSN4juce9HeapBlockIPNS_19FileBrowserListenerELb0EEE", !7, i64 0}
!14 = !{!"int", !8, i64 0}


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