; 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::AudioChannelSet" = type { %"class.juce::BigInteger" }
%"class.juce::BigInteger" = type <{ %"class.juce::HeapBlock.50", [4 x i32], i64, i32, i8, [3 x i8] }>
%"class.juce::HeapBlock.50" = 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 @_ZN4juce15AudioChannelSetD2Ev(ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #1 align 2

declare void @_ZN4juce15AudioChannelSet8disabledEv(ptr dead_on_unwind writable sret(%"class.juce::AudioChannelSet") align 8) #2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZNK4juce14AudioProcessor3Bus23getMaxSupportedChannelsEi(ptr noundef nonnull align 8 dereferenceable(144) %0, i32 noundef %1) #3 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca %"class.juce::AudioChannelSet", align 8
  %9 = alloca i1, align 1
  %10 = alloca i1, align 1
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  %13 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  %14 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %14, ptr %6, align 4, !tbaa !9
  br label %15

15:                                               ; preds = %25, %2
  %16 = load i32, ptr %6, align 4, !tbaa !9
  %17 = icmp sgt i32 %16, 0
  br i1 %17, label %19, label %18

18:                                               ; preds = %15
  store i32 2, ptr %7, align 4
  br label %28

19:                                               ; preds = %15
  %20 = load i32, ptr %6, align 4, !tbaa !9
  %21 = call noundef zeroext i1 @_ZNK4juce14AudioProcessor3Bus27isNumberOfChannelsSupportedEi(ptr noundef nonnull align 8 dereferenceable(144) %13, i32 noundef %20)
  br i1 %21, label %22, label %24

22:                                               ; preds = %19
  %23 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %23, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %28

24:                                               ; preds = %19
  br label %25

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

28:                                               ; preds = %22, %18
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  %29 = load i32, ptr %7, align 4
  switch i32 %29, label %62 [
    i32 2, label %30
    i32 1, label %55
  ]

30:                                               ; preds = %28
  %31 = call noundef zeroext i1 @_ZNK4juce14AudioProcessor3Bus6isMainEv(ptr noundef nonnull align 8 dereferenceable(144) %13)
  store i1 false, ptr %9, align 1
  store i1 false, ptr %10, align 1
  br i1 %31, label %32, label %35

32:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 40, ptr %8) #5
  store i1 true, ptr %9, align 1
  call void @_ZN4juce15AudioChannelSet8disabledEv(ptr dead_on_unwind writable sret(%"class.juce::AudioChannelSet") align 8 %8)
  store i1 true, ptr %10, align 1
  %33 = invoke noundef zeroext i1 @_ZNK4juce14AudioProcessor3Bus17isLayoutSupportedERKNS_15AudioChannelSetEPNS0_11BusesLayoutE(ptr noundef nonnull align 8 dereferenceable(144) %13, ptr noundef nonnull align 8 dereferenceable(40) %8, ptr noundef null)
          to label %34 unwind label %45

34:                                               ; preds = %32
  br label %35

35:                                               ; preds = %34, %30
  %36 = phi i1 [ false, %30 ], [ %33, %34 ]
  %37 = zext i1 %36 to i64
  %38 = select i1 %36, i32 0, i32 -1
  store i32 %38, ptr %3, align 4
  %39 = load i1, ptr %10, align 1
  br i1 %39, label %40, label %41

40:                                               ; preds = %35
  call void @_ZN4juce15AudioChannelSetD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %8) #5
  br label %41

41:                                               ; preds = %40, %35
  %42 = load i1, ptr %9, align 1
  br i1 %42, label %43, label %44

43:                                               ; preds = %41
  call void @llvm.lifetime.end.p0(i64 40, ptr %8) #5
  br label %44

44:                                               ; preds = %43, %41
  br label %55

45:                                               ; preds = %32
  %46 = landingpad { ptr, i32 }
          cleanup
  %47 = extractvalue { ptr, i32 } %46, 0
  store ptr %47, ptr %11, align 8
  %48 = extractvalue { ptr, i32 } %46, 1
  store i32 %48, ptr %12, align 4
  %49 = load i1, ptr %10, align 1
  br i1 %49, label %50, label %51

50:                                               ; preds = %45
  call void @_ZN4juce15AudioChannelSetD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %8) #5
  br label %51

51:                                               ; preds = %50, %45
  %52 = load i1, ptr %9, align 1
  br i1 %52, label %53, label %54

53:                                               ; preds = %51
  call void @llvm.lifetime.end.p0(i64 40, ptr %8) #5
  br label %54

54:                                               ; preds = %53, %51
  br label %57

55:                                               ; preds = %44, %28
  %56 = load i32, ptr %3, align 4
  ret i32 %56

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

62:                                               ; preds = %28
  unreachable
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK4juce14AudioProcessor3Bus6isMainEv(ptr noundef nonnull align 8 dereferenceable(144)) #4 align 2

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 = { "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 = { 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 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"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"

%"class.juce::AudioChannelSet" = type { %"class.juce::BigInteger" }
%"class.juce::BigInteger" = type <{ %"class.juce::HeapBlock.50", [4 x i32], i64, i32, i8, [3 x i8] }>
%"class.juce::HeapBlock.50" = 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 @_ZN4juce15AudioChannelSetD2Ev(ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #1 align 2

declare void @_ZN4juce15AudioChannelSet8disabledEv(ptr dead_on_unwind writable sret(%"class.juce::AudioChannelSet") align 8) local_unnamed_addr #2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZNK4juce14AudioProcessor3Bus23getMaxSupportedChannelsEi(ptr noundef nonnull align 8 dereferenceable(144) %0, i32 noundef %1) local_unnamed_addr #3 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.juce::AudioChannelSet", align 8
  %4 = icmp sgt i32 %1, 0
  br i1 %4, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %2, %6
  %.01323 = phi i32 [ %7, %6 ], [ %1, %2 ]
  %5 = tail call noundef zeroext i1 @_ZNK4juce14AudioProcessor3Bus27isNumberOfChannelsSupportedEi(ptr noundef nonnull align 8 dereferenceable(144) %0, i32 noundef %.01323)
  br i1 %5, label %.critedge, label %6

6:                                                ; preds = %.lr.ph
  %7 = add nsw i32 %.01323, -1
  %8 = icmp sgt i32 %.01323, 1
  br i1 %8, label %.lr.ph, label %._crit_edge, !llvm.loop !5

._crit_edge:                                      ; preds = %6, %2
  %9 = tail call noundef zeroext i1 @_ZNK4juce14AudioProcessor3Bus6isMainEv(ptr noundef nonnull align 8 dereferenceable(144) %0)
  br i1 %9, label %10, label %.critedge

10:                                               ; preds = %._crit_edge
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %3) #5
  call void @_ZN4juce15AudioChannelSet8disabledEv(ptr dead_on_unwind nonnull writable sret(%"class.juce::AudioChannelSet") align 8 %3)
  %11 = invoke noundef zeroext i1 @_ZNK4juce14AudioProcessor3Bus17isLayoutSupportedERKNS_15AudioChannelSetEPNS0_11BusesLayoutE(ptr noundef nonnull align 8 dereferenceable(144) %0, ptr noundef nonnull align 8 dereferenceable(40) %3, ptr noundef null)
          to label %12 unwind label %14

12:                                               ; preds = %10
  %not.21 = xor i1 %11, true
  %13 = sext i1 %not.21 to i32
  call void @_ZN4juce15AudioChannelSetD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %3) #5
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %3) #5
  br label %.critedge

14:                                               ; preds = %10
  %15 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN4juce15AudioChannelSetD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %3) #5
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %3) #5
  resume { ptr, i32 } %15

.critedge:                                        ; preds = %.lr.ph, %._crit_edge, %12
  %.1 = phi i32 [ %13, %12 ], [ -1, %._crit_edge ], [ %.01323, %.lr.ph ]
  ret i32 %.1
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK4juce14AudioProcessor3Bus6isMainEv(ptr noundef nonnull align 8 dereferenceable(144)) local_unnamed_addr #4 align 2

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


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