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

%"struct.juce::AudioProcessor::BusesLayout" = type { %"class.juce::Array.51", %"class.juce::Array.51" }
%"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 }

; 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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK4juce14AudioProcessor11getBusCountEb(ptr noundef nonnull align 8 dereferenceable(256), i1 noundef zeroext) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK4juce14AudioProcessor14getBusesLayoutEv(ptr dead_on_unwind noalias writable sret(%"struct.juce::AudioProcessor::BusesLayout") align 8 %0, ptr noundef nonnull align 8 dereferenceable(256) %1) #2 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i1, align 1
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  store ptr %0, ptr %3, align 8
  store ptr %1, ptr %4, align 8, !tbaa !5
  %12 = load ptr, ptr %4, align 8
  store i1 false, ptr %5, align 1
  call void @_ZN4juce14AudioProcessor11BusesLayoutC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %0) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %13 = call noundef i32 @_ZNK4juce14AudioProcessor11getBusCountEb(ptr noundef nonnull align 8 dereferenceable(256) %12, i1 noundef zeroext true) #4
  store i32 %13, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %14 = call noundef i32 @_ZNK4juce14AudioProcessor11getBusCountEb(ptr noundef nonnull align 8 dereferenceable(256) %12, i1 noundef zeroext false) #4
  store i32 %14, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 0, ptr %8, align 4, !tbaa !9
  br label %15

15:                                               ; preds = %26, %2
  %16 = load i32, ptr %8, align 4, !tbaa !9
  %17 = load i32, ptr %6, align 4, !tbaa !9
  %18 = icmp slt i32 %16, %17
  br i1 %18, label %20, label %19

19:                                               ; preds = %15
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %33

20:                                               ; preds = %15
  %21 = getelementptr inbounds %"struct.juce::AudioProcessor::BusesLayout", ptr %0, i32 0, i32 0
  %22 = load i32, ptr %8, align 4, !tbaa !9
  %23 = call noundef ptr @_ZNK4juce14AudioProcessor6getBusEbi(ptr noundef nonnull align 8 dereferenceable(256) %12, i1 noundef zeroext true, i32 noundef %22) #4
  %24 = call noundef nonnull align 8 dereferenceable(40) ptr @_ZNK4juce14AudioProcessor3Bus16getCurrentLayoutEv(ptr noundef nonnull align 8 dereferenceable(144) %23) #4
  invoke void @_ZN4juce5ArrayINS_15AudioChannelSetENS_20DummyCriticalSectionELi0EE3addERKS1_(ptr noundef nonnull align 8 dereferenceable(20) %21, ptr noundef nonnull align 8 dereferenceable(40) %24)
          to label %25 unwind label %29

25:                                               ; preds = %20
  br label %26

26:                                               ; preds = %25
  %27 = load i32, ptr %8, align 4, !tbaa !9
  %28 = add nsw i32 %27, 1
  store i32 %28, ptr %8, align 4, !tbaa !9
  br label %15, !llvm.loop !11

29:                                               ; preds = %20
  %30 = landingpad { ptr, i32 }
          cleanup
  %31 = extractvalue { ptr, i32 } %30, 0
  store ptr %31, ptr %9, align 8
  %32 = extractvalue { ptr, i32 } %30, 1
  store i32 %32, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %54

33:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  store i32 0, ptr %11, align 4, !tbaa !9
  br label %34

34:                                               ; preds = %45, %33
  %35 = load i32, ptr %11, align 4, !tbaa !9
  %36 = load i32, ptr %7, align 4, !tbaa !9
  %37 = icmp slt i32 %35, %36
  br i1 %37, label %39, label %38

38:                                               ; preds = %34
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  br label %52

39:                                               ; preds = %34
  %40 = getelementptr inbounds %"struct.juce::AudioProcessor::BusesLayout", ptr %0, i32 0, i32 1
  %41 = load i32, ptr %11, align 4, !tbaa !9
  %42 = call noundef ptr @_ZNK4juce14AudioProcessor6getBusEbi(ptr noundef nonnull align 8 dereferenceable(256) %12, i1 noundef zeroext false, i32 noundef %41) #4
  %43 = call noundef nonnull align 8 dereferenceable(40) ptr @_ZNK4juce14AudioProcessor3Bus16getCurrentLayoutEv(ptr noundef nonnull align 8 dereferenceable(144) %42) #4
  invoke void @_ZN4juce5ArrayINS_15AudioChannelSetENS_20DummyCriticalSectionELi0EE3addERKS1_(ptr noundef nonnull align 8 dereferenceable(20) %40, ptr noundef nonnull align 8 dereferenceable(40) %43)
          to label %44 unwind label %48

44:                                               ; preds = %39
  br label %45

45:                                               ; preds = %44
  %46 = load i32, ptr %11, align 4, !tbaa !9
  %47 = add nsw i32 %46, 1
  store i32 %47, ptr %11, align 4, !tbaa !9
  br label %34, !llvm.loop !13

48:                                               ; preds = %39
  %49 = landingpad { ptr, i32 }
          cleanup
  %50 = extractvalue { ptr, i32 } %49, 0
  store ptr %50, ptr %9, align 8
  %51 = extractvalue { ptr, i32 } %49, 1
  store i32 %51, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  br label %54

52:                                               ; preds = %38
  store i1 true, ptr %5, align 1
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  %53 = load i1, ptr %5, align 1
  br i1 %53, label %56, label %55

54:                                               ; preds = %48, %29
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @_ZN4juce14AudioProcessor11BusesLayoutD2Ev(ptr noundef nonnull align 8 dereferenceable(48) %0) #4
  br label %57

55:                                               ; preds = %52
  call void @_ZN4juce14AudioProcessor11BusesLayoutD2Ev(ptr noundef nonnull align 8 dereferenceable(48) %0) #4
  br label %56

56:                                               ; preds = %55, %52
  ret void

57:                                               ; preds = %54
  %58 = load ptr, ptr %9, align 8
  %59 = load i32, ptr %10, align 4
  %60 = insertvalue { ptr, i32 } poison, ptr %58, 0
  %61 = insertvalue { ptr, i32 } %60, i32 %59, 1
  resume { ptr, i32 } %61
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN4juce14AudioProcessor11BusesLayoutD2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN4juce14AudioProcessor11BusesLayoutC2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #3 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK4juce14AudioProcessor6getBusEbi(ptr noundef nonnull align 8 dereferenceable(256), i1 noundef zeroext, i32 noundef) #1 align 2

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { 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 #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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}


; 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::AudioProcessor::BusesLayout" = type { %"class.juce::Array.51", %"class.juce::Array.51" }
%"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 }

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK4juce14AudioProcessor11getBusCountEb(ptr noundef nonnull align 8 dereferenceable(256), i1 noundef zeroext) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK4juce14AudioProcessor14getBusesLayoutEv(ptr dead_on_unwind noalias nonnull writable sret(%"struct.juce::AudioProcessor::BusesLayout") align 8 %0, ptr noundef nonnull align 8 dereferenceable(256) %1) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  tail call void @_ZN4juce14AudioProcessor11BusesLayoutC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %0) #3
  %3 = tail call noundef i32 @_ZNK4juce14AudioProcessor11getBusCountEb(ptr noundef nonnull align 8 dereferenceable(256) %1, i1 noundef zeroext true) #3
  %4 = tail call noundef i32 @_ZNK4juce14AudioProcessor11getBusCountEb(ptr noundef nonnull align 8 dereferenceable(256) %1, i1 noundef zeroext false) #3
  %5 = icmp sgt i32 %3, 0
  br i1 %5, label %.lr.ph, label %.preheader

.preheader:                                       ; preds = %10, %2
  %6 = icmp sgt i32 %4, 0
  br i1 %6, label %.lr.ph17, label %._crit_edge

.lr.ph17:                                         ; preds = %.preheader
  %7 = getelementptr inbounds i8, ptr %0, i64 24
  br label %14

.lr.ph:                                           ; preds = %2, %10
  %.01315 = phi i32 [ %11, %10 ], [ 0, %2 ]
  %8 = tail call noundef ptr @_ZNK4juce14AudioProcessor6getBusEbi(ptr noundef nonnull align 8 dereferenceable(256) %1, i1 noundef zeroext true, i32 noundef %.01315) #3
  %9 = tail call noundef nonnull align 8 dereferenceable(40) ptr @_ZNK4juce14AudioProcessor3Bus16getCurrentLayoutEv(ptr noundef nonnull align 8 dereferenceable(144) %8) #3
  invoke void @_ZN4juce5ArrayINS_15AudioChannelSetENS_20DummyCriticalSectionELi0EE3addERKS1_(ptr noundef nonnull align 8 dereferenceable(20) %0, ptr noundef nonnull align 8 dereferenceable(40) %9)
          to label %10 unwind label %12

10:                                               ; preds = %.lr.ph
  %11 = add nuw nsw i32 %.01315, 1
  %exitcond.not = icmp eq i32 %11, %3
  br i1 %exitcond.not, label %.preheader, label %.lr.ph, !llvm.loop !5

12:                                               ; preds = %.lr.ph
  %13 = landingpad { ptr, i32 }
          cleanup
  br label %21

14:                                               ; preds = %.lr.ph17, %17
  %.016 = phi i32 [ 0, %.lr.ph17 ], [ %18, %17 ]
  %15 = tail call noundef ptr @_ZNK4juce14AudioProcessor6getBusEbi(ptr noundef nonnull align 8 dereferenceable(256) %1, i1 noundef zeroext false, i32 noundef %.016) #3
  %16 = tail call noundef nonnull align 8 dereferenceable(40) ptr @_ZNK4juce14AudioProcessor3Bus16getCurrentLayoutEv(ptr noundef nonnull align 8 dereferenceable(144) %15) #3
  invoke void @_ZN4juce5ArrayINS_15AudioChannelSetENS_20DummyCriticalSectionELi0EE3addERKS1_(ptr noundef nonnull align 8 dereferenceable(20) %7, ptr noundef nonnull align 8 dereferenceable(40) %16)
          to label %17 unwind label %19

17:                                               ; preds = %14
  %18 = add nuw nsw i32 %.016, 1
  %exitcond18.not = icmp eq i32 %18, %4
  br i1 %exitcond18.not, label %._crit_edge, label %14, !llvm.loop !7

19:                                               ; preds = %14
  %20 = landingpad { ptr, i32 }
          cleanup
  br label %21

21:                                               ; preds = %19, %12
  %.pn = phi { ptr, i32 } [ %13, %12 ], [ %20, %19 ]
  tail call void @_ZN4juce14AudioProcessor11BusesLayoutD2Ev(ptr noundef nonnull align 8 dereferenceable(48) %0) #3
  resume { ptr, i32 } %.pn

._crit_edge:                                      ; preds = %17, %.preheader
  ret void
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN4juce14AudioProcessor11BusesLayoutD2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN4juce14AudioProcessor11BusesLayoutC2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #2 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK4juce14AudioProcessor6getBusEbi(ptr noundef nonnull align 8 dereferenceable(256), i1 noundef zeroext, i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(40) ptr @_ZNK4juce14AudioProcessor3Bus16getCurrentLayoutEv(ptr noundef nonnull align 8 dereferenceable(144)) local_unnamed_addr #0 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"}
!7 = distinct !{!7, !6}


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