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

; 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::AudioProcessorGraph" = type <{ %"class.juce::AudioProcessor", %"class.juce::AsyncUpdater", %"class.juce::ReferenceCountedArray", %"class.juce::OwnedArray.12", i32, [4 x i8], %"class.juce::OwnedArray.17", %"class.juce::Array.22", %"class.juce::ScopedPointer", ptr, %"class.juce::MidiBuffer", i8, [7 x i8] }>
%"class.juce::AudioProcessor" = type { ptr, i32, ptr, %"class.juce::Array", %"class.juce::Component::SafePointer", double, i32, i32, i8, i8, i32, %"class.juce::CriticalSection", %"class.juce::CriticalSection", %"class.juce::OwnedArray", %"class.juce::OwnedArray", %"class.juce::String", %"class.juce::String", i32, i32, %"class.juce::OwnedArray.3" }
%"class.juce::Array" = type { %"class.juce::ArrayAllocationBase", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase" = type <{ %"class.juce::HeapBlock", i32, [4 x i8] }>
%"class.juce::HeapBlock" = type { ptr }
%"class.juce::Component::SafePointer" = type { %"class.juce::WeakReference" }
%"class.juce::WeakReference" = type { %"class.juce::ReferenceCountedObjectPtr" }
%"class.juce::ReferenceCountedObjectPtr" = 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" = type { %"class.juce::ArrayAllocationBase.0", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase.0" = type <{ %"class.juce::HeapBlock.1", i32, [4 x i8] }>
%"class.juce::HeapBlock.1" = type { ptr }
%"class.juce::String" = type { %"class.juce::CharPointer_UTF8" }
%"class.juce::CharPointer_UTF8" = type { ptr }
%"class.juce::OwnedArray.3" = type { %"class.juce::ArrayAllocationBase.4", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase.4" = type <{ %"class.juce::HeapBlock.5", i32, [4 x i8] }>
%"class.juce::HeapBlock.5" = type { ptr }
%"class.juce::AsyncUpdater" = type { ptr, %"class.juce::ReferenceCountedObjectPtr.8" }
%"class.juce::ReferenceCountedObjectPtr.8" = type { ptr }
%"class.juce::ReferenceCountedArray" = type { %"class.juce::ArrayAllocationBase.9", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase.9" = type <{ %"class.juce::HeapBlock.10", i32, [4 x i8] }>
%"class.juce::HeapBlock.10" = type { ptr }
%"class.juce::OwnedArray.12" = type { %"class.juce::ArrayAllocationBase.13", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase.13" = type <{ %"class.juce::HeapBlock.14", i32, [4 x i8] }>
%"class.juce::HeapBlock.14" = type { ptr }
%"class.juce::OwnedArray.17" = type { %"class.juce::ArrayAllocationBase.18", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase.18" = type <{ %"class.juce::HeapBlock.19", i32, [4 x i8] }>
%"class.juce::HeapBlock.19" = type { ptr }
%"class.juce::Array.22" = type { %"class.juce::ArrayAllocationBase.23", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase.23" = type <{ %"class.juce::HeapBlock.24", i32, [4 x i8] }>
%"class.juce::HeapBlock.24" = type { ptr }
%"class.juce::ScopedPointer" = type { ptr }
%"class.juce::MidiBuffer" = type { %"class.juce::Array.27" }
%"class.juce::Array.27" = type { %"class.juce::ArrayAllocationBase.28", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase.28" = type <{ %"class.juce::HeapBlock.29", i32, [4 x i8] }>
%"class.juce::HeapBlock.29" = type { ptr }
%"struct.juce::AudioProcessorGraph::Connection" = type { i32, i32, i32, i32 }

; 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 i32 @_ZNK4juce10OwnedArrayINS_19AudioProcessorGraph10ConnectionENS_20DummyCriticalSectionEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20)) #1 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK4juce19AudioProcessorGraph11isAnInputToEjji(ptr noundef nonnull align 8 dereferenceable(417) %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) #2 align 2 {
  %5 = alloca i1, align 1
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i32 %1, ptr %7, align 4, !tbaa !9
  store i32 %2, ptr %8, align 4, !tbaa !9
  store i32 %3, ptr %9, align 4, !tbaa !9
  %13 = load ptr, ptr %6, align 8
  %14 = load i32, ptr %9, align 4, !tbaa !9
  %15 = icmp sgt i32 %14, 0
  br i1 %15, label %16, label %55

16:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  %17 = getelementptr inbounds %"class.juce::AudioProcessorGraph", ptr %13, i32 0, i32 3
  %18 = call noundef i32 @_ZNK4juce10OwnedArrayINS_19AudioProcessorGraph10ConnectionENS_20DummyCriticalSectionEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %17) #3
  store i32 %18, ptr %10, align 4, !tbaa !9
  br label %19

19:                                               ; preds = %51, %16
  %20 = load i32, ptr %10, align 4, !tbaa !9
  %21 = add nsw i32 %20, -1
  store i32 %21, ptr %10, align 4, !tbaa !9
  %22 = icmp sge i32 %21, 0
  br i1 %22, label %24, label %23

23:                                               ; preds = %19
  store i32 2, ptr %11, align 4
  br label %52

24:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  %25 = getelementptr inbounds %"class.juce::AudioProcessorGraph", ptr %13, i32 0, i32 3
  %26 = load i32, ptr %10, align 4, !tbaa !9
  %27 = call noundef ptr @_ZNK4juce10OwnedArrayINS_19AudioProcessorGraph10ConnectionENS_20DummyCriticalSectionEE12getUncheckedEi(ptr noundef nonnull align 8 dereferenceable(20) %25, i32 noundef %26) #3
  store ptr %27, ptr %12, align 8, !tbaa !5
  %28 = load ptr, ptr %12, align 8, !tbaa !5
  %29 = getelementptr inbounds %"struct.juce::AudioProcessorGraph::Connection", ptr %28, i32 0, i32 2
  %30 = load i32, ptr %29, align 4, !tbaa !11
  %31 = load i32, ptr %8, align 4, !tbaa !9
  %32 = icmp eq i32 %30, %31
  br i1 %32, label %33, label %48

33:                                               ; preds = %24
  %34 = load ptr, ptr %12, align 8, !tbaa !5
  %35 = getelementptr inbounds %"struct.juce::AudioProcessorGraph::Connection", ptr %34, i32 0, i32 0
  %36 = load i32, ptr %35, align 4, !tbaa !13
  %37 = load i32, ptr %7, align 4, !tbaa !9
  %38 = icmp eq i32 %36, %37
  br i1 %38, label %47, label %39

39:                                               ; preds = %33
  %40 = load i32, ptr %7, align 4, !tbaa !9
  %41 = load ptr, ptr %12, align 8, !tbaa !5
  %42 = getelementptr inbounds %"struct.juce::AudioProcessorGraph::Connection", ptr %41, i32 0, i32 0
  %43 = load i32, ptr %42, align 4, !tbaa !13
  %44 = load i32, ptr %9, align 4, !tbaa !9
  %45 = sub nsw i32 %44, 1
  %46 = call noundef zeroext i1 @_ZNK4juce19AudioProcessorGraph11isAnInputToEjji(ptr noundef nonnull align 8 dereferenceable(417) %13, i32 noundef %40, i32 noundef %43, i32 noundef %45)
  br i1 %46, label %47, label %48

47:                                               ; preds = %39, %33
  store i1 true, ptr %5, align 1
  store i32 1, ptr %11, align 4
  br label %49

48:                                               ; preds = %39, %24
  store i32 0, ptr %11, align 4
  br label %49

49:                                               ; preds = %48, %47
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  %50 = load i32, ptr %11, align 4
  switch i32 %50, label %52 [
    i32 0, label %51
  ]

51:                                               ; preds = %49
  br label %19, !llvm.loop !14

52:                                               ; preds = %49, %23
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  %53 = load i32, ptr %11, align 4
  switch i32 %53, label %58 [
    i32 2, label %54
    i32 1, label %56
  ]

54:                                               ; preds = %52
  br label %55

55:                                               ; preds = %54, %4
  store i1 false, ptr %5, align 1
  br label %56

56:                                               ; preds = %55, %52
  %57 = load i1, ptr %5, align 1
  ret i1 %57

58:                                               ; preds = %52
  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 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 8}
!12 = !{!"_ZTSN4juce19AudioProcessorGraph10ConnectionE", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12}
!13 = !{!12, !10, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"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 i32 @_ZNK4juce10OwnedArrayINS_19AudioProcessorGraph10ConnectionENS_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_19AudioProcessorGraph10ConnectionENS_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 zeroext i1 @_ZNK4juce19AudioProcessorGraph11isAnInputToEjji(ptr noundef nonnull align 8 dereferenceable(417) %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) local_unnamed_addr #1 align 2 {
  %5 = icmp sgt i32 %3, 0
  br i1 %5, label %6, label %.thread

6:                                                ; preds = %4
  %7 = getelementptr inbounds i8, ptr %0, i64 296
  %8 = tail call noundef i32 @_ZNK4juce10OwnedArrayINS_19AudioProcessorGraph10ConnectionENS_20DummyCriticalSectionEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %7) #2
  %9 = icmp sgt i32 %8, 0
  br i1 %9, label %.lr.ph, label %.thread

.lr.ph:                                           ; preds = %6
  %10 = add nsw i32 %3, -1
  br label %11

11:                                               ; preds = %.lr.ph, %.critedge
  %.in = phi i32 [ %8, %.lr.ph ], [ %12, %.critedge ]
  %12 = add nsw i32 %.in, -1
  %13 = tail call noundef ptr @_ZNK4juce10OwnedArrayINS_19AudioProcessorGraph10ConnectionENS_20DummyCriticalSectionEE12getUncheckedEi(ptr noundef nonnull align 8 dereferenceable(20) %7, i32 noundef %12) #2
  %14 = getelementptr inbounds i8, ptr %13, i64 8
  %15 = load i32, ptr %14, align 4, !tbaa !5
  %16 = icmp eq i32 %15, %2
  br i1 %16, label %17, label %.critedge

17:                                               ; preds = %11
  %18 = load i32, ptr %13, align 4, !tbaa !10
  %19 = icmp eq i32 %18, %1
  br i1 %19, label %.thread, label %20, !llvm.loop !11

20:                                               ; preds = %17
  %21 = tail call noundef zeroext i1 @_ZNK4juce19AudioProcessorGraph11isAnInputToEjji(ptr noundef nonnull align 8 dereferenceable(417) %0, i32 noundef %1, i32 noundef %18, i32 noundef %10)
  br i1 %21, label %.thread, label %.critedge, !llvm.loop !11

.critedge:                                        ; preds = %20, %11
  %22 = icmp ugt i32 %.in, 1
  br i1 %22, label %11, label %.thread

.thread:                                          ; preds = %17, %20, %.critedge, %6, %4
  %.3 = phi i1 [ false, %4 ], [ false, %6 ], [ true, %17 ], [ true, %20 ], [ false, %.critedge ]
  ret i1 %.3
}

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, !7, i64 8}
!6 = !{!"_ZTSN4juce19AudioProcessorGraph10ConnectionE", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!6, !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


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