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

; 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::UndoManager" = type <{ %"class.juce::ChangeBroadcaster", %"class.juce::OwnedArray.38", %"class.juce::OwnedArray.38", %"class.juce::String", i32, i32, i32, i32, i8, i8, [6 x i8] }>
%"class.juce::ChangeBroadcaster" = type { ptr, %"class.juce::ChangeBroadcaster::ChangeBroadcasterCallback", %"class.juce::ListenerList.32" }
%"class.juce::ChangeBroadcaster::ChangeBroadcasterCallback" = type { %"class.juce::AsyncUpdater", ptr }
%"class.juce::AsyncUpdater" = type { ptr, %"class.juce::ReferenceCountedObjectPtr" }
%"class.juce::ReferenceCountedObjectPtr" = type { ptr }
%"class.juce::ListenerList.32" = type { %"class.juce::Array.33" }
%"class.juce::Array.33" = type { %"class.juce::ArrayAllocationBase.34", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase.34" = type <{ %"class.juce::HeapBlock.35", i32, [4 x i8] }>
%"class.juce::HeapBlock.35" = type { ptr }
%"class.juce::OwnedArray.38" = type { %"class.juce::ArrayAllocationBase.39", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase.39" = type <{ %"class.juce::HeapBlock.40", i32, [4 x i8] }>
%"class.juce::HeapBlock.40" = type { ptr }
%"class.juce::String" = type { %"class.juce::CharPointer_UTF8" }
%"class.juce::CharPointer_UTF8" = 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: mustprogress uwtable
declare dso_local void @_ZN4juce10OwnedArrayINS_11UndoManager9ActionSetENS_20DummyCriticalSectionEE5clearEb(ptr noundef nonnull align 8 dereferenceable(20), i1 noundef zeroext) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4juce11UndoManager29moveFutureTransactionsToStashEv(ptr noundef nonnull align 8 dereferenceable(130) %0) #1 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %4 = load ptr, ptr %2, align 8
  %5 = getelementptr inbounds %"class.juce::UndoManager", ptr %4, i32 0, i32 7
  %6 = load i32, ptr %5, align 4, !tbaa !9
  %7 = getelementptr inbounds %"class.juce::UndoManager", ptr %4, i32 0, i32 1
  %8 = call noundef i32 @_ZNK4juce10OwnedArrayINS_11UndoManager9ActionSetENS_20DummyCriticalSectionEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %7) #4
  %9 = icmp slt i32 %6, %8
  br i1 %9, label %10, label %32

10:                                               ; preds = %1
  %11 = getelementptr inbounds %"class.juce::UndoManager", ptr %4, i32 0, i32 2
  call void @_ZN4juce10OwnedArrayINS_11UndoManager9ActionSetENS_20DummyCriticalSectionEE5clearEb(ptr noundef nonnull align 8 dereferenceable(20) %11, i1 noundef zeroext true)
  br label %12

12:                                               ; preds = %18, %10
  %13 = getelementptr inbounds %"class.juce::UndoManager", ptr %4, i32 0, i32 7
  %14 = load i32, ptr %13, align 4, !tbaa !9
  %15 = getelementptr inbounds %"class.juce::UndoManager", ptr %4, i32 0, i32 1
  %16 = call noundef i32 @_ZNK4juce10OwnedArrayINS_11UndoManager9ActionSetENS_20DummyCriticalSectionEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %15) #4
  %17 = icmp slt i32 %14, %16
  br i1 %17, label %18, label %31

18:                                               ; preds = %12
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  %19 = getelementptr inbounds %"class.juce::UndoManager", ptr %4, i32 0, i32 1
  %20 = getelementptr inbounds %"class.juce::UndoManager", ptr %4, i32 0, i32 7
  %21 = load i32, ptr %20, align 4, !tbaa !9
  %22 = call noundef ptr @_ZN4juce10OwnedArrayINS_11UndoManager9ActionSetENS_20DummyCriticalSectionEE15removeAndReturnEi(ptr noundef nonnull align 8 dereferenceable(20) %19, i32 noundef %21)
  store ptr %22, ptr %3, align 8, !tbaa !5
  %23 = getelementptr inbounds %"class.juce::UndoManager", ptr %4, i32 0, i32 2
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  %25 = call noundef ptr @_ZN4juce10OwnedArrayINS_11UndoManager9ActionSetENS_20DummyCriticalSectionEE3addEPS2_(ptr noundef nonnull align 8 dereferenceable(20) %23, ptr noundef %24) #4
  %26 = load ptr, ptr %3, align 8, !tbaa !5
  %27 = call noundef i32 @_ZNK4juce11UndoManager9ActionSet12getTotalSizeEv(ptr noundef nonnull align 8 dereferenceable(40) %26)
  %28 = getelementptr inbounds %"class.juce::UndoManager", ptr %4, i32 0, i32 4
  %29 = load i32, ptr %28, align 8, !tbaa !26
  %30 = sub nsw i32 %29, %27
  store i32 %30, ptr %28, align 8, !tbaa !26
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  br label %12, !llvm.loop !27

31:                                               ; preds = %12
  br label %32

32:                                               ; preds = %31, %1
  ret void
}

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZNK4juce11UndoManager9ActionSet12getTotalSizeEv(ptr noundef nonnull align 8 dereferenceable(40)) #1 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #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 = { 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, !19, i64 124}
!10 = !{!"_ZTSN4juce11UndoManagerE", !11, i64 0, !20, i64 56, !20, i64 80, !23, i64 104, !19, i64 112, !19, i64 116, !19, i64 120, !19, i64 124, !25, i64 128, !25, i64 129}
!11 = !{!"_ZTSN4juce17ChangeBroadcasterE", !12, i64 8, !15, i64 32}
!12 = !{!"_ZTSN4juce17ChangeBroadcaster25ChangeBroadcasterCallbackE", !13, i64 0, !6, i64 16}
!13 = !{!"_ZTSN4juce12AsyncUpdaterE", !14, i64 8}
!14 = !{!"_ZTSN4juce25ReferenceCountedObjectPtrINS_12AsyncUpdater19AsyncUpdaterMessageEEE", !6, i64 0}
!15 = !{!"_ZTSN4juce12ListenerListINS_14ChangeListenerENS_5ArrayIPS1_NS_20DummyCriticalSectionELi0EEEEE", !16, i64 0}
!16 = !{!"_ZTSN4juce5ArrayIPNS_14ChangeListenerENS_20DummyCriticalSectionELi0EEE", !17, i64 0, !19, i64 16}
!17 = !{!"_ZTSN4juce19ArrayAllocationBaseIPNS_14ChangeListenerENS_20DummyCriticalSectionEEE", !18, i64 0, !19, i64 8}
!18 = !{!"_ZTSN4juce9HeapBlockIPNS_14ChangeListenerELb0EEE", !6, i64 0}
!19 = !{!"int", !7, i64 0}
!20 = !{!"_ZTSN4juce10OwnedArrayINS_11UndoManager9ActionSetENS_20DummyCriticalSectionEEE", !21, i64 0, !19, i64 16}
!21 = !{!"_ZTSN4juce19ArrayAllocationBaseIPNS_11UndoManager9ActionSetENS_20DummyCriticalSectionEEE", !22, i64 0, !19, i64 8}
!22 = !{!"_ZTSN4juce9HeapBlockIPNS_11UndoManager9ActionSetELb0EEE", !6, i64 0}
!23 = !{!"_ZTSN4juce6StringE", !24, i64 0}
!24 = !{!"_ZTSN4juce16CharPointer_UTF8E", !6, i64 0}
!25 = !{!"bool", !7, i64 0}
!26 = !{!10, !19, i64 112}
!27 = distinct !{!27, !28}
!28 = !{!"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 uwtable
declare dso_local void @_ZN4juce10OwnedArrayINS_11UndoManager9ActionSetENS_20DummyCriticalSectionEE5clearEb(ptr noundef nonnull align 8 dereferenceable(20), i1 noundef zeroext) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4juce11UndoManager29moveFutureTransactionsToStashEv(ptr noundef nonnull align 8 dereferenceable(130) %0) local_unnamed_addr #0 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 124
  %3 = load i32, ptr %2, align 4, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 56
  %5 = tail call noundef i32 @_ZNK4juce10OwnedArrayINS_11UndoManager9ActionSetENS_20DummyCriticalSectionEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %4) #3
  %6 = icmp slt i32 %3, %5
  br i1 %6, label %7, label %.loopexit

7:                                                ; preds = %1
  %8 = getelementptr inbounds i8, ptr %0, i64 80
  tail call void @_ZN4juce10OwnedArrayINS_11UndoManager9ActionSetENS_20DummyCriticalSectionEE5clearEb(ptr noundef nonnull align 8 dereferenceable(20) %8, i1 noundef zeroext true)
  %9 = load i32, ptr %2, align 4, !tbaa !5
  %10 = tail call noundef i32 @_ZNK4juce10OwnedArrayINS_11UndoManager9ActionSetENS_20DummyCriticalSectionEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %4) #3
  %11 = icmp slt i32 %9, %10
  br i1 %11, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %7
  %12 = getelementptr inbounds i8, ptr %0, i64 112
  br label %13

13:                                               ; preds = %.lr.ph, %13
  %14 = load i32, ptr %2, align 4, !tbaa !5
  %15 = tail call noundef ptr @_ZN4juce10OwnedArrayINS_11UndoManager9ActionSetENS_20DummyCriticalSectionEE15removeAndReturnEi(ptr noundef nonnull align 8 dereferenceable(20) %4, i32 noundef %14)
  %16 = tail call noundef ptr @_ZN4juce10OwnedArrayINS_11UndoManager9ActionSetENS_20DummyCriticalSectionEE3addEPS2_(ptr noundef nonnull align 8 dereferenceable(20) %8, ptr noundef %15) #3
  %17 = tail call noundef i32 @_ZNK4juce11UndoManager9ActionSet12getTotalSizeEv(ptr noundef nonnull align 8 dereferenceable(40) %15)
  %18 = load i32, ptr %12, align 8, !tbaa !25
  %19 = sub nsw i32 %18, %17
  store i32 %19, ptr %12, align 8, !tbaa !25
  %20 = load i32, ptr %2, align 4, !tbaa !5
  %21 = tail call noundef i32 @_ZNK4juce10OwnedArrayINS_11UndoManager9ActionSetENS_20DummyCriticalSectionEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %4) #3
  %22 = icmp slt i32 %20, %21
  br i1 %22, label %13, label %.loopexit, !llvm.loop !26

.loopexit:                                        ; preds = %13, %7, %1
  ret void
}

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZNK4juce11UndoManager9ActionSet12getTotalSizeEv(ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #0 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 = { 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, !18, i64 124}
!6 = !{!"_ZTSN4juce11UndoManagerE", !7, i64 0, !19, i64 56, !19, i64 80, !22, i64 104, !18, i64 112, !18, i64 116, !18, i64 120, !18, i64 124, !24, i64 128, !24, i64 129}
!7 = !{!"_ZTSN4juce17ChangeBroadcasterE", !8, i64 8, !14, i64 32}
!8 = !{!"_ZTSN4juce17ChangeBroadcaster25ChangeBroadcasterCallbackE", !9, i64 0, !11, i64 16}
!9 = !{!"_ZTSN4juce12AsyncUpdaterE", !10, i64 8}
!10 = !{!"_ZTSN4juce25ReferenceCountedObjectPtrINS_12AsyncUpdater19AsyncUpdaterMessageEEE", !11, i64 0}
!11 = !{!"any pointer", !12, i64 0}
!12 = !{!"omnipotent char", !13, i64 0}
!13 = !{!"Simple C++ TBAA"}
!14 = !{!"_ZTSN4juce12ListenerListINS_14ChangeListenerENS_5ArrayIPS1_NS_20DummyCriticalSectionELi0EEEEE", !15, i64 0}
!15 = !{!"_ZTSN4juce5ArrayIPNS_14ChangeListenerENS_20DummyCriticalSectionELi0EEE", !16, i64 0, !18, i64 16}
!16 = !{!"_ZTSN4juce19ArrayAllocationBaseIPNS_14ChangeListenerENS_20DummyCriticalSectionEEE", !17, i64 0, !18, i64 8}
!17 = !{!"_ZTSN4juce9HeapBlockIPNS_14ChangeListenerELb0EEE", !11, i64 0}
!18 = !{!"int", !12, i64 0}
!19 = !{!"_ZTSN4juce10OwnedArrayINS_11UndoManager9ActionSetENS_20DummyCriticalSectionEEE", !20, i64 0, !18, i64 16}
!20 = !{!"_ZTSN4juce19ArrayAllocationBaseIPNS_11UndoManager9ActionSetENS_20DummyCriticalSectionEEE", !21, i64 0, !18, i64 8}
!21 = !{!"_ZTSN4juce9HeapBlockIPNS_11UndoManager9ActionSetELb0EEE", !11, i64 0}
!22 = !{!"_ZTSN4juce6StringE", !23, i64 0}
!23 = !{!"_ZTSN4juce16CharPointer_UTF8E", !11, i64 0}
!24 = !{!"bool", !12, i64 0}
!25 = !{!6, !18, i64 112}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass