; 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: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN4juce14AudioProcessor11BusesLayoutD2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN4juce14AudioProcessor15applyBusLayoutsERKNS0_11BusesLayoutE(ptr noundef nonnull align 8 dereferenceable(256), ptr noundef nonnull align 8 dereferenceable(48)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(40) ptr @_ZN4juce14AudioProcessor11BusesLayout13getChannelSetEbi(ptr noundef nonnull align 8 dereferenceable(48), i1 noundef zeroext, i32 noundef) #3 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN4juce14AudioProcessor21setChannelLayoutOfBusEbiRKNS_15AudioChannelSetE(ptr noundef nonnull align 8 dereferenceable(256) %0, i1 noundef zeroext %1, i32 noundef %2, ptr noundef nonnull align 8 dereferenceable(40) %3) #2 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca i1, align 1
  %6 = alloca ptr, align 8
  %7 = alloca i8, align 1
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca %"struct.juce::AudioProcessor::BusesLayout", align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  %15 = zext i1 %1 to i8
  store i8 %15, ptr %7, align 1, !tbaa !9
  store i32 %2, ptr %8, align 4, !tbaa !11
  store ptr %3, ptr %9, align 8, !tbaa !5
  %16 = load ptr, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %17 = load i8, ptr %7, align 1, !tbaa !9, !range !13, !noundef !14
  %18 = trunc i8 %17 to i1
  %19 = load i32, ptr %8, align 4, !tbaa !11
  %20 = call noundef ptr @_ZN4juce14AudioProcessor6getBusEbi(ptr noundef nonnull align 8 dereferenceable(256) %16, i1 noundef zeroext %18, i32 noundef %19) #5
  store ptr %20, ptr %10, align 8, !tbaa !5
  %21 = load ptr, ptr %10, align 8, !tbaa !5
  %22 = icmp ne ptr %21, null
  br i1 %22, label %23, label %42

23:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 48, ptr %11) #5
  %24 = load ptr, ptr %10, align 8, !tbaa !5
  %25 = load ptr, ptr %9, align 8, !tbaa !5
  call void @_ZNK4juce14AudioProcessor3Bus34getBusesLayoutForLayoutChangeOfBusERKNS_15AudioChannelSetE(ptr dead_on_unwind writable sret(%"struct.juce::AudioProcessor::BusesLayout") align 8 %11, ptr noundef nonnull align 8 dereferenceable(144) %24, ptr noundef nonnull align 8 dereferenceable(40) %25)
  %26 = load i8, ptr %7, align 1, !tbaa !9, !range !13, !noundef !14
  %27 = trunc i8 %26 to i1
  %28 = load i32, ptr %8, align 4, !tbaa !11
  %29 = invoke noundef nonnull align 8 dereferenceable(40) ptr @_ZN4juce14AudioProcessor11BusesLayout13getChannelSetEbi(ptr noundef nonnull align 8 dereferenceable(48) %11, i1 noundef zeroext %27, i32 noundef %28)
          to label %30 unwind label %36

30:                                               ; preds = %23
  %31 = load ptr, ptr %9, align 8, !tbaa !5
  %32 = call noundef zeroext i1 @_ZNK4juce15AudioChannelSeteqERKS0_(ptr noundef nonnull align 8 dereferenceable(40) %29, ptr noundef nonnull align 8 dereferenceable(40) %31) #5
  br i1 %32, label %33, label %40

33:                                               ; preds = %30
  %34 = invoke noundef zeroext i1 @_ZN4juce14AudioProcessor15applyBusLayoutsERKNS0_11BusesLayoutE(ptr noundef nonnull align 8 dereferenceable(256) %16, ptr noundef nonnull align 8 dereferenceable(48) %11)
          to label %35 unwind label %36

35:                                               ; preds = %33
  store i1 %34, ptr %5, align 1
  store i32 1, ptr %14, align 4
  br label %41

36:                                               ; preds = %33, %23
  %37 = landingpad { ptr, i32 }
          cleanup
  %38 = extractvalue { ptr, i32 } %37, 0
  store ptr %38, ptr %12, align 8
  %39 = extractvalue { ptr, i32 } %37, 1
  store i32 %39, ptr %13, align 4
  call void @_ZN4juce14AudioProcessor11BusesLayoutD2Ev(ptr noundef nonnull align 8 dereferenceable(48) %11) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br label %50

40:                                               ; preds = %30
  store i1 false, ptr %5, align 1
  store i32 1, ptr %14, align 4
  br label %41

41:                                               ; preds = %40, %35
  call void @_ZN4juce14AudioProcessor11BusesLayoutD2Ev(ptr noundef nonnull align 8 dereferenceable(48) %11) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr %11) #5
  br label %43

42:                                               ; preds = %4
  store i32 0, ptr %14, align 4
  br label %43

43:                                               ; preds = %42, %41
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  %44 = load i32, ptr %14, align 4
  switch i32 %44, label %55 [
    i32 0, label %45
    i32 1, label %48
  ]

45:                                               ; preds = %43
  br label %46

46:                                               ; preds = %45
  br label %47

47:                                               ; preds = %46
  store i1 false, ptr %5, align 1
  br label %48

48:                                               ; preds = %47, %43
  %49 = load i1, ptr %5, align 1
  ret i1 %49

50:                                               ; preds = %36
  %51 = load ptr, ptr %12, align 8
  %52 = load i32, ptr %13, align 4
  %53 = insertvalue { ptr, i32 } poison, ptr %51, 0
  %54 = insertvalue { ptr, i32 } %53, i32 %52, 1
  resume { ptr, i32 } %54

55:                                               ; preds = %43
  unreachable
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK4juce14AudioProcessor3Bus34getBusesLayoutForLayoutChangeOfBusERKNS_15AudioChannelSetE(ptr dead_on_unwind noalias writable sret(%"struct.juce::AudioProcessor::BusesLayout") align 8, ptr noundef nonnull align 8 dereferenceable(144), ptr noundef nonnull align 8 dereferenceable(40)) #2 align 2

; Function Attrs: nounwind
declare noundef zeroext i1 @_ZNK4juce15AudioChannelSeteqERKS0_(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(40)) #4

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 = { 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 "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 = !{i8 0, i8 2}
!14 = !{}


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

; 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

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(40) ptr @_ZN4juce14AudioProcessor11BusesLayout13getChannelSetEbi(ptr noundef nonnull align 8 dereferenceable(48), i1 noundef zeroext, i32 noundef) local_unnamed_addr #3 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN4juce14AudioProcessor21setChannelLayoutOfBusEbiRKNS_15AudioChannelSetE(ptr noundef nonnull align 8 dereferenceable(256) %0, i1 noundef zeroext %1, i32 noundef %2, ptr noundef nonnull align 8 dereferenceable(40) %3) local_unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca %"struct.juce::AudioProcessor::BusesLayout", align 8
  %6 = tail call noundef ptr @_ZN4juce14AudioProcessor6getBusEbi(ptr noundef nonnull align 8 dereferenceable(256) %0, i1 noundef zeroext %1, i32 noundef %2) #5
  %.not.not = icmp ne ptr %6, null
  br i1 %.not.not, label %7, label %15

7:                                                ; preds = %4
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %5) #5
  call void @_ZNK4juce14AudioProcessor3Bus34getBusesLayoutForLayoutChangeOfBusERKNS_15AudioChannelSetE(ptr dead_on_unwind nonnull writable sret(%"struct.juce::AudioProcessor::BusesLayout") align 8 %5, ptr noundef nonnull align 8 dereferenceable(144) %6, ptr noundef nonnull align 8 dereferenceable(40) %3)
  %8 = call noundef nonnull align 8 dereferenceable(40) ptr @_ZN4juce14AudioProcessor11BusesLayout13getChannelSetEbi(ptr noundef nonnull align 8 dereferenceable(48) %5, i1 noundef zeroext %1, i32 noundef %2)
  %9 = call noundef zeroext i1 @_ZNK4juce15AudioChannelSeteqERKS0_(ptr noundef nonnull align 8 dereferenceable(40) %8, ptr noundef nonnull align 8 dereferenceable(40) %3) #5
  br i1 %9, label %10, label %14

10:                                               ; preds = %7
  %11 = invoke noundef zeroext i1 @_ZN4juce14AudioProcessor15applyBusLayoutsERKNS0_11BusesLayoutE(ptr noundef nonnull align 8 dereferenceable(256) %0, ptr noundef nonnull align 8 dereferenceable(48) %5)
          to label %14 unwind label %12

12:                                               ; preds = %10
  %13 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN4juce14AudioProcessor11BusesLayoutD2Ev(ptr noundef nonnull align 8 dereferenceable(48) %5) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %5) #5
  resume { ptr, i32 } %13

14:                                               ; preds = %7, %10
  %.012 = phi i1 [ %11, %10 ], [ false, %7 ]
  call void @_ZN4juce14AudioProcessor11BusesLayoutD2Ev(ptr noundef nonnull align 8 dereferenceable(48) %5) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %5) #5
  br label %15

15:                                               ; preds = %4, %14
  %.113 = phi i1 [ %.012, %14 ], [ undef, %4 ]
  %spec.select = and i1 %.not.not, %.113
  ret i1 %spec.select
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK4juce14AudioProcessor3Bus34getBusesLayoutForLayoutChangeOfBusERKNS_15AudioChannelSetE(ptr dead_on_unwind noalias writable sret(%"struct.juce::AudioProcessor::BusesLayout") align 8, ptr noundef nonnull align 8 dereferenceable(144), ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #2 align 2

; Function Attrs: nounwind
declare noundef zeroext i1 @_ZNK4juce15AudioChannelSeteqERKS0_(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #4

attributes #0 = { mustprogress 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 = { 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 "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)"}


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