; 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::DirectoryContentsList" = type <{ %"class.juce::ChangeBroadcaster", %"class.juce::TimeSliceClient", %"class.juce::File", ptr, ptr, i32, [4 x i8], %"class.juce::CriticalSection", %"class.juce::OwnedArray.219", %"class.juce::ScopedPointer.224", i8, [7 x i8] }>
%"class.juce::ChangeBroadcaster" = type { ptr, %"class.juce::ChangeBroadcaster::ChangeBroadcasterCallback", %"class.juce::ListenerList.39" }
%"class.juce::ChangeBroadcaster::ChangeBroadcasterCallback" = type { %"class.juce::AsyncUpdater", ptr }
%"class.juce::AsyncUpdater" = type { ptr, %"class.juce::ReferenceCountedObjectPtr.15" }
%"class.juce::ReferenceCountedObjectPtr.15" = type { ptr }
%"class.juce::ListenerList.39" = type { %"class.juce::Array.40" }
%"class.juce::Array.40" = type { %"class.juce::ArrayAllocationBase.41", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase.41" = type <{ %"class.juce::HeapBlock.42", i32, [4 x i8] }>
%"class.juce::HeapBlock.42" = type { ptr }
%"class.juce::TimeSliceClient" = type { ptr, %"class.juce::Time" }
%"class.juce::Time" = type { i64 }
%"class.juce::File" = type { %"class.juce::String" }
%"class.juce::String" = type { %"class.juce::CharPointer_UTF8" }
%"class.juce::CharPointer_UTF8" = 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::OwnedArray.219" = type { %"class.juce::ArrayAllocationBase.220", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase.220" = type <{ %"class.juce::HeapBlock.221", i32, [4 x i8] }>
%"class.juce::HeapBlock.221" = type { ptr }
%"class.juce::ScopedPointer.224" = 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: nounwind
declare noundef i32 @_ZN4juce4Time32getApproximateMillisecondCounterEv() #1

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN4juce21DirectoryContentsList12useTimeSliceEv(ptr noundef nonnull align 8 dereferenceable(177) %0) unnamed_addr #2 align 2 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i8, align 1
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  %8 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  %9 = call noundef i32 @_ZN4juce4Time32getApproximateMillisecondCounterEv() #3
  store i32 %9, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #3
  store i8 0, ptr %5, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  store i32 100, ptr %6, align 4, !tbaa !9
  br label %10

10:                                               ; preds = %32, %1
  %11 = load i32, ptr %6, align 4, !tbaa !9
  %12 = add nsw i32 %11, -1
  store i32 %12, ptr %6, align 4, !tbaa !9
  %13 = icmp sge i32 %12, 0
  br i1 %13, label %15, label %14

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

15:                                               ; preds = %10
  %16 = call noundef zeroext i1 @_ZN4juce21DirectoryContentsList13checkNextFileERb(ptr noundef nonnull align 8 dereferenceable(177) %8, ptr noundef nonnull align 1 dereferenceable(1) %5)
  br i1 %16, label %22, label %17

17:                                               ; preds = %15
  %18 = load i8, ptr %5, align 1, !tbaa !11, !range !13, !noundef !14
  %19 = trunc i8 %18 to i1
  br i1 %19, label %20, label %21

20:                                               ; preds = %17
  call void @_ZN4juce21DirectoryContentsList7changedEv(ptr noundef nonnull align 8 dereferenceable(177) %8)
  br label %21

21:                                               ; preds = %20, %17
  store i32 500, ptr %2, align 4
  store i32 1, ptr %7, align 4
  br label %33

22:                                               ; preds = %15
  %23 = getelementptr inbounds %"class.juce::DirectoryContentsList", ptr %8, i32 0, i32 10
  %24 = load volatile i8, ptr %23, align 8, !tbaa !15, !range !13, !noundef !14
  %25 = trunc i8 %24 to i1
  br i1 %25, label %31, label %26

26:                                               ; preds = %22
  %27 = call noundef i32 @_ZN4juce4Time32getApproximateMillisecondCounterEv() #3
  %28 = load i32, ptr %4, align 4, !tbaa !9
  %29 = add i32 %28, 150
  %30 = icmp ugt i32 %27, %29
  br i1 %30, label %31, label %32

31:                                               ; preds = %26, %22
  store i32 2, ptr %7, align 4
  br label %33

32:                                               ; preds = %26
  br label %10, !llvm.loop !36

33:                                               ; preds = %31, %21, %14
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  %34 = load i32, ptr %7, align 4
  switch i32 %34, label %40 [
    i32 2, label %35
  ]

35:                                               ; preds = %33
  %36 = load i8, ptr %5, align 1, !tbaa !11, !range !13, !noundef !14
  %37 = trunc i8 %36 to i1
  br i1 %37, label %38, label %39

38:                                               ; preds = %35
  call void @_ZN4juce21DirectoryContentsList7changedEv(ptr noundef nonnull align 8 dereferenceable(177) %8)
  br label %39

39:                                               ; preds = %38, %35
  store i32 0, ptr %2, align 4
  store i32 1, ptr %7, align 4
  br label %40

40:                                               ; preds = %39, %33
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  %41 = load i32, ptr %2, align 4
  ret i32 %41
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN4juce21DirectoryContentsList13checkNextFileERb(ptr noundef nonnull align 8 dereferenceable(177), ptr noundef nonnull align 1 dereferenceable(1)) #2 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #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, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = !{!16, !12, i64 176}
!16 = !{!"_ZTSN4juce21DirectoryContentsListE", !17, i64 0, !25, i64 56, !28, i64 72, !6, i64 80, !6, i64 88, !10, i64 96, !31, i64 104, !32, i64 144, !35, i64 168, !12, i64 176}
!17 = !{!"_ZTSN4juce17ChangeBroadcasterE", !18, i64 8, !21, i64 32}
!18 = !{!"_ZTSN4juce17ChangeBroadcaster25ChangeBroadcasterCallbackE", !19, i64 0, !6, i64 16}
!19 = !{!"_ZTSN4juce12AsyncUpdaterE", !20, i64 8}
!20 = !{!"_ZTSN4juce25ReferenceCountedObjectPtrINS_12AsyncUpdater19AsyncUpdaterMessageEEE", !6, i64 0}
!21 = !{!"_ZTSN4juce12ListenerListINS_14ChangeListenerENS_5ArrayIPS1_NS_20DummyCriticalSectionELi0EEEEE", !22, i64 0}
!22 = !{!"_ZTSN4juce5ArrayIPNS_14ChangeListenerENS_20DummyCriticalSectionELi0EEE", !23, i64 0, !10, i64 16}
!23 = !{!"_ZTSN4juce19ArrayAllocationBaseIPNS_14ChangeListenerENS_20DummyCriticalSectionEEE", !24, i64 0, !10, i64 8}
!24 = !{!"_ZTSN4juce9HeapBlockIPNS_14ChangeListenerELb0EEE", !6, i64 0}
!25 = !{!"_ZTSN4juce15TimeSliceClientE", !26, i64 8}
!26 = !{!"_ZTSN4juce4TimeE", !27, i64 0}
!27 = !{!"long long", !7, i64 0}
!28 = !{!"_ZTSN4juce4FileE", !29, i64 0}
!29 = !{!"_ZTSN4juce6StringE", !30, i64 0}
!30 = !{!"_ZTSN4juce16CharPointer_UTF8E", !6, i64 0}
!31 = !{!"_ZTSN4juce15CriticalSectionE", !7, i64 0}
!32 = !{!"_ZTSN4juce10OwnedArrayINS_21DirectoryContentsList8FileInfoENS_20DummyCriticalSectionEEE", !33, i64 0, !10, i64 16}
!33 = !{!"_ZTSN4juce19ArrayAllocationBaseIPNS_21DirectoryContentsList8FileInfoENS_20DummyCriticalSectionEEE", !34, i64 0, !10, i64 8}
!34 = !{!"_ZTSN4juce9HeapBlockIPNS_21DirectoryContentsList8FileInfoELb0EEE", !6, i64 0}
!35 = !{!"_ZTSN4juce13ScopedPointerINS_17DirectoryIteratorEEE", !6, i64 0}
!36 = distinct !{!36, !37}
!37 = !{!"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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

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

; Function Attrs: nounwind
declare noundef i32 @_ZN4juce4Time32getApproximateMillisecondCounterEv() local_unnamed_addr #1

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

; Function Attrs: mustprogress uwtable
define dso_local noundef range(i32 0, 501) i32 @_ZN4juce21DirectoryContentsList12useTimeSliceEv(ptr noundef nonnull align 8 dereferenceable(177) %0) unnamed_addr #2 align 2 {
  %2 = alloca i8, align 1
  %3 = tail call noundef i32 @_ZN4juce4Time32getApproximateMillisecondCounterEv() #3
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %2) #3
  store i8 0, ptr %2, align 1, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 176
  %5 = add i32 %3, 150
  br label %6

6:                                                ; preds = %16, %1
  %.04 = phi i32 [ 100, %1 ], [ %7, %16 ]
  %7 = add nsw i32 %.04, -1
  %.not = icmp eq i32 %.04, 0
  br i1 %.not, label %.critedge, label %8

8:                                                ; preds = %6
  %9 = call noundef zeroext i1 @_ZN4juce21DirectoryContentsList13checkNextFileERb(ptr noundef nonnull align 8 dereferenceable(177) %0, ptr noundef nonnull align 1 dereferenceable(1) %2)
  br i1 %9, label %13, label %10

10:                                               ; preds = %8
  %11 = load i8, ptr %2, align 1, !tbaa !5, !range !9, !noundef !10
  %12 = trunc nuw i8 %11 to i1
  br i1 %12, label %.sink.split, label %21

13:                                               ; preds = %8
  %14 = load volatile i8, ptr %4, align 8, !tbaa !11, !range !9, !noundef !10
  %15 = trunc nuw i8 %14 to i1
  br i1 %15, label %.critedge, label %16

16:                                               ; preds = %13
  %17 = call noundef i32 @_ZN4juce4Time32getApproximateMillisecondCounterEv() #3
  %18 = icmp ugt i32 %17, %5
  br i1 %18, label %.critedge, label %6, !llvm.loop !34

.critedge:                                        ; preds = %13, %16, %6
  %19 = load i8, ptr %2, align 1, !tbaa !5, !range !9, !noundef !10
  %20 = trunc nuw i8 %19 to i1
  br i1 %20, label %.sink.split, label %21

.sink.split:                                      ; preds = %.critedge, %10
  %.1.ph = phi i32 [ 500, %10 ], [ 0, %.critedge ]
  call void @_ZN4juce21DirectoryContentsList7changedEv(ptr noundef nonnull align 8 dereferenceable(177) %0)
  br label %21

21:                                               ; preds = %.sink.split, %.critedge, %10
  %.1 = phi i32 [ 500, %10 ], [ 0, %.critedge ], [ %.1.ph, %.sink.split ]
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %2) #3
  ret i32 %.1
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN4juce21DirectoryContentsList13checkNextFileERb(ptr noundef nonnull align 8 dereferenceable(177), ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #2 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #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 = !{!"bool", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{i8 0, i8 2}
!10 = !{}
!11 = !{!12, !6, i64 176}
!12 = !{!"_ZTSN4juce21DirectoryContentsListE", !13, i64 0, !23, i64 56, !26, i64 72, !17, i64 80, !17, i64 88, !22, i64 96, !29, i64 104, !30, i64 144, !33, i64 168, !6, i64 176}
!13 = !{!"_ZTSN4juce17ChangeBroadcasterE", !14, i64 8, !18, i64 32}
!14 = !{!"_ZTSN4juce17ChangeBroadcaster25ChangeBroadcasterCallbackE", !15, i64 0, !17, i64 16}
!15 = !{!"_ZTSN4juce12AsyncUpdaterE", !16, i64 8}
!16 = !{!"_ZTSN4juce25ReferenceCountedObjectPtrINS_12AsyncUpdater19AsyncUpdaterMessageEEE", !17, i64 0}
!17 = !{!"any pointer", !7, i64 0}
!18 = !{!"_ZTSN4juce12ListenerListINS_14ChangeListenerENS_5ArrayIPS1_NS_20DummyCriticalSectionELi0EEEEE", !19, i64 0}
!19 = !{!"_ZTSN4juce5ArrayIPNS_14ChangeListenerENS_20DummyCriticalSectionELi0EEE", !20, i64 0, !22, i64 16}
!20 = !{!"_ZTSN4juce19ArrayAllocationBaseIPNS_14ChangeListenerENS_20DummyCriticalSectionEEE", !21, i64 0, !22, i64 8}
!21 = !{!"_ZTSN4juce9HeapBlockIPNS_14ChangeListenerELb0EEE", !17, i64 0}
!22 = !{!"int", !7, i64 0}
!23 = !{!"_ZTSN4juce15TimeSliceClientE", !24, i64 8}
!24 = !{!"_ZTSN4juce4TimeE", !25, i64 0}
!25 = !{!"long long", !7, i64 0}
!26 = !{!"_ZTSN4juce4FileE", !27, i64 0}
!27 = !{!"_ZTSN4juce6StringE", !28, i64 0}
!28 = !{!"_ZTSN4juce16CharPointer_UTF8E", !17, i64 0}
!29 = !{!"_ZTSN4juce15CriticalSectionE", !7, i64 0}
!30 = !{!"_ZTSN4juce10OwnedArrayINS_21DirectoryContentsList8FileInfoENS_20DummyCriticalSectionEEE", !31, i64 0, !22, i64 16}
!31 = !{!"_ZTSN4juce19ArrayAllocationBaseIPNS_21DirectoryContentsList8FileInfoENS_20DummyCriticalSectionEEE", !32, i64 0, !22, i64 8}
!32 = !{!"_ZTSN4juce9HeapBlockIPNS_21DirectoryContentsList8FileInfoELb0EEE", !17, i64 0}
!33 = !{!"_ZTSN4juce13ScopedPointerINS_17DirectoryIteratorEEE", !17, i64 0}
!34 = distinct !{!34, !35}
!35 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,SROAPass,SimplifyCFGPass,TailCallElimPass