; LLVM IR from modlfo/AudioEngine :: AudioEngine/JuceLibraryCode (juce_audio_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"

%"struct.juce::MPEZone" = type { i32, i32, i32, i32 }
%"class.juce::MPEZoneLayout" = type { %"class.juce::Array.51", %"class.juce::MidiRPNDetector", %"class.juce::ListenerList" }
%"class.juce::Array.51" = type { %"class.juce::ArrayAllocationBase.52", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase.52" = type <{ %"class.juce::HeapBlock.53", i32, [4 x i8] }>
%"class.juce::HeapBlock.53" = type { ptr }
%"class.juce::MidiRPNDetector" = type { [16 x %"struct.juce::MidiRPNDetector::ChannelState"] }
%"struct.juce::MidiRPNDetector::ChannelState" = type { i8, i8, i8, i8, i8 }
%"class.juce::ListenerList" = type { %"class.juce::Array.56" }
%"class.juce::Array.56" = type { %"class.juce::ArrayAllocationBase.57", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase.57" = type <{ %"class.juce::HeapBlock.58", i32, [4 x i8] }>
%"class.juce::HeapBlock.58" = 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: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK4juce7MPEZone12overlapsWithES0_(ptr noundef nonnull align 4 dereferenceable(16), i64, i64) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN4juce7MPEZone13truncateToFitES0_(ptr noundef nonnull align 4 dereferenceable(16), i64, i64) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4juce12ListenerListINS_13MPEZoneLayout8ListenerENS_5ArrayIPS2_NS_20DummyCriticalSectionELi0EEEE4callIRKS1_EEvMS2_FvT_ENS_11TypeHelpers13ParameterTypeISB_E4typeE(ptr noundef nonnull align 8 dereferenceable(24), i64, i64, ptr noundef nonnull align 8 dereferenceable(128)) #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN4juce13MPEZoneLayout7addZoneENS_7MPEZoneE(ptr noundef nonnull align 8 dereferenceable(128) %0, i64 %1, i64 %2) #3 align 2 {
  %4 = alloca %"struct.juce::MPEZone", align 4
  %5 = alloca ptr, align 8
  %6 = alloca i8, align 1
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca %"struct.juce::MPEZone", align 4
  %10 = alloca %"struct.juce::MPEZone", align 4
  %11 = alloca { i64, i64 }, align 8
  %12 = getelementptr inbounds { i64, i64 }, ptr %4, i32 0, i32 0
  store i64 %1, ptr %12, align 4
  %13 = getelementptr inbounds { i64, i64 }, ptr %4, i32 0, i32 1
  store i64 %2, ptr %13, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  %14 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #5
  store i8 1, ptr %6, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  %15 = getelementptr inbounds %"class.juce::MPEZoneLayout", ptr %14, i32 0, i32 0
  %16 = call noundef i32 @_ZNK4juce5ArrayINS_7MPEZoneENS_20DummyCriticalSectionELi0EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %15) #5
  store i32 %16, ptr %7, align 4, !tbaa !11
  br label %17

17:                                               ; preds = %43, %3
  %18 = load i32, ptr %7, align 4, !tbaa !11
  %19 = add nsw i32 %18, -1
  store i32 %19, ptr %7, align 4, !tbaa !11
  %20 = icmp sge i32 %19, 0
  br i1 %20, label %22, label %21

21:                                               ; preds = %17
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %44

22:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %23 = getelementptr inbounds %"class.juce::MPEZoneLayout", ptr %14, i32 0, i32 0
  %24 = load i32, ptr %7, align 4, !tbaa !11
  %25 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNK4juce5ArrayINS_7MPEZoneENS_20DummyCriticalSectionELi0EE12getReferenceEi(ptr noundef nonnull align 8 dereferenceable(20) %23, i32 noundef %24) #5
  store ptr %25, ptr %8, align 8, !tbaa !5
  %26 = load ptr, ptr %8, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %9, ptr align 4 %4, i64 16, i1 false), !tbaa.struct !13
  %27 = getelementptr inbounds { i64, i64 }, ptr %9, i32 0, i32 0
  %28 = load i64, ptr %27, align 4
  %29 = getelementptr inbounds { i64, i64 }, ptr %9, i32 0, i32 1
  %30 = load i64, ptr %29, align 4
  %31 = call noundef zeroext i1 @_ZNK4juce7MPEZone12overlapsWithES0_(ptr noundef nonnull align 4 dereferenceable(16) %26, i64 %28, i64 %30) #5
  br i1 %31, label %32, label %43

32:                                               ; preds = %22
  %33 = load ptr, ptr %8, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %10, ptr align 4 %4, i64 16, i1 false), !tbaa.struct !13
  %34 = getelementptr inbounds { i64, i64 }, ptr %10, i32 0, i32 0
  %35 = load i64, ptr %34, align 4
  %36 = getelementptr inbounds { i64, i64 }, ptr %10, i32 0, i32 1
  %37 = load i64, ptr %36, align 4
  %38 = call noundef zeroext i1 @_ZN4juce7MPEZone13truncateToFitES0_(ptr noundef nonnull align 4 dereferenceable(16) %33, i64 %35, i64 %37) #5
  br i1 %38, label %42, label %39

39:                                               ; preds = %32
  %40 = getelementptr inbounds %"class.juce::MPEZoneLayout", ptr %14, i32 0, i32 0
  %41 = load i32, ptr %7, align 4, !tbaa !11
  call void @_ZN4juce5ArrayINS_7MPEZoneENS_20DummyCriticalSectionELi0EE11removeRangeEii(ptr noundef nonnull align 8 dereferenceable(20) %40, i32 noundef %41, i32 noundef 1)
  br label %42

42:                                               ; preds = %39, %32
  store i8 0, ptr %6, align 1, !tbaa !9
  br label %43

43:                                               ; preds = %42, %22
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  br label %17, !llvm.loop !14

44:                                               ; preds = %21
  %45 = getelementptr inbounds %"class.juce::MPEZoneLayout", ptr %14, i32 0, i32 0
  call void @_ZN4juce5ArrayINS_7MPEZoneENS_20DummyCriticalSectionELi0EE3addERKS1_(ptr noundef nonnull align 8 dereferenceable(20) %45, ptr noundef nonnull align 4 dereferenceable(16) %4)
  %46 = getelementptr inbounds %"class.juce::MPEZoneLayout", ptr %14, i32 0, i32 2
  store { i64, i64 } { i64 17, i64 0 }, ptr %11, align 8, !tbaa !16
  %47 = getelementptr inbounds { i64, i64 }, ptr %11, i32 0, i32 0
  %48 = load i64, ptr %47, align 8
  %49 = getelementptr inbounds { i64, i64 }, ptr %11, i32 0, i32 1
  %50 = load i64, ptr %49, align 8
  call void @_ZN4juce12ListenerListINS_13MPEZoneLayout8ListenerENS_5ArrayIPS2_NS_20DummyCriticalSectionELi0EEEE4callIRKS1_EEvMS2_FvT_ENS_11TypeHelpers13ParameterTypeISB_E4typeE(ptr noundef nonnull align 8 dereferenceable(24) %46, i64 %48, i64 %50, ptr noundef nonnull align 8 dereferenceable(128) %14)
  %51 = load i8, ptr %6, align 1, !tbaa !9, !range !17, !noundef !18
  %52 = trunc i8 %51 to i1
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #5
  ret i1 %52
}

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4juce5ArrayINS_7MPEZoneENS_20DummyCriticalSectionELi0EE3addERKS1_(ptr noundef nonnull align 8 dereferenceable(20), ptr noundef nonnull align 4 dereferenceable(16)) #3 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #5 = { 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 = !{!"int", !7, i64 0}
!13 = !{i64 0, i64 4, !11, i64 4, i64 4, !11, i64 8, i64 4, !11, i64 12, i64 4, !11}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!7, !7, i64 0}
!17 = !{i8 0, i8 2}
!18 = !{}


; 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"

%"struct.juce::MPEZone" = type { i32, i32, i32, i32 }

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK4juce7MPEZone12overlapsWithES0_(ptr noundef nonnull align 4 dereferenceable(16), i64, i64) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN4juce7MPEZone13truncateToFitES0_(ptr noundef nonnull align 4 dereferenceable(16), i64, i64) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4juce12ListenerListINS_13MPEZoneLayout8ListenerENS_5ArrayIPS2_NS_20DummyCriticalSectionELi0EEEE4callIRKS1_EEvMS2_FvT_ENS_11TypeHelpers13ParameterTypeISB_E4typeE(ptr noundef nonnull align 8 dereferenceable(24), i64, i64, ptr noundef nonnull align 8 dereferenceable(128)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN4juce13MPEZoneLayout7addZoneENS_7MPEZoneE(ptr noundef nonnull align 8 dereferenceable(128) %0, i64 %1, i64 %2) local_unnamed_addr #1 align 2 {
  %4 = alloca %"struct.juce::MPEZone", align 8
  store i64 %1, ptr %4, align 8
  %5 = getelementptr inbounds i8, ptr %4, i64 8
  store i64 %2, ptr %5, align 8
  %6 = tail call noundef i32 @_ZNK4juce5ArrayINS_7MPEZoneENS_20DummyCriticalSectionELi0EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %0) #3
  %7 = icmp sgt i32 %6, 0
  br i1 %7, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %15, %3
  %.0.lcssa = phi i1 [ true, %3 ], [ %.1, %15 ]
  call void @_ZN4juce5ArrayINS_7MPEZoneENS_20DummyCriticalSectionELi0EE3addERKS1_(ptr noundef nonnull align 8 dereferenceable(20) %0, ptr noundef nonnull align 4 dereferenceable(16) %4)
  %8 = getelementptr inbounds i8, ptr %0, i64 104
  call void @_ZN4juce12ListenerListINS_13MPEZoneLayout8ListenerENS_5ArrayIPS2_NS_20DummyCriticalSectionELi0EEEE4callIRKS1_EEvMS2_FvT_ENS_11TypeHelpers13ParameterTypeISB_E4typeE(ptr noundef nonnull align 8 dereferenceable(24) %8, i64 17, i64 0, ptr noundef nonnull align 8 dereferenceable(128) %0)
  ret i1 %.0.lcssa

.lr.ph:                                           ; preds = %3, %15
  %.in = phi i32 [ %9, %15 ], [ %6, %3 ]
  %.012 = phi i1 [ %.1, %15 ], [ true, %3 ]
  %9 = add nsw i32 %.in, -1
  %10 = tail call noundef nonnull align 4 dereferenceable(16) ptr @_ZNK4juce5ArrayINS_7MPEZoneENS_20DummyCriticalSectionELi0EE12getReferenceEi(ptr noundef nonnull align 8 dereferenceable(20) %0, i32 noundef %9) #3
  %11 = tail call noundef zeroext i1 @_ZNK4juce7MPEZone12overlapsWithES0_(ptr noundef nonnull align 4 dereferenceable(16) %10, i64 %1, i64 %2) #3
  br i1 %11, label %12, label %15

12:                                               ; preds = %.lr.ph
  %13 = tail call noundef zeroext i1 @_ZN4juce7MPEZone13truncateToFitES0_(ptr noundef nonnull align 4 dereferenceable(16) %10, i64 %1, i64 %2) #3
  br i1 %13, label %15, label %14

14:                                               ; preds = %12
  tail call void @_ZN4juce5ArrayINS_7MPEZoneENS_20DummyCriticalSectionELi0EE11removeRangeEii(ptr noundef nonnull align 8 dereferenceable(20) %0, i32 noundef %9, i32 noundef 1)
  br label %15

15:                                               ; preds = %12, %14, %.lr.ph
  %.1 = phi i1 [ %.012, %.lr.ph ], [ false, %14 ], [ false, %12 ]
  %16 = icmp ugt i32 %.in, 1
  br i1 %16, label %.lr.ph, label %._crit_edge, !llvm.loop !5
}

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4juce5ArrayINS_7MPEZoneENS_20DummyCriticalSectionELi0EE3addERKS1_(ptr noundef nonnull align 8 dereferenceable(20), ptr noundef nonnull align 4 dereferenceable(16)) local_unnamed_addr #1 align 2

attributes #0 = { 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 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 = { 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}


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