; 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 }
%"class.juce::AudioProcessor::Bus" = type { ptr, %"class.juce::String", %"class.juce::AudioChannelSet", %"class.juce::AudioChannelSet", %"class.juce::AudioChannelSet", i8, i32 }
%"class.juce::String" = type { %"class.juce::CharPointer_UTF8" }
%"class.juce::CharPointer_UTF8" = type { ptr }
%"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: 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
declare dso_local noundef zeroext i1 @_ZN4juce14AudioProcessor14setBusesLayoutERKNS0_11BusesLayoutE(ptr noundef nonnull align 8 dereferenceable(256), ptr noundef nonnull align 8 dereferenceable(48)) #2 align 2

; 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: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN4juce14AudioProcessor6getBusEbi(ptr noundef nonnull align 8 dereferenceable(256), i1 noundef zeroext, i32 noundef) #1 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 uwtable
define dso_local noundef zeroext i1 @_ZN4juce14AudioProcessor14enableAllBusesEv(ptr noundef nonnull align 8 dereferenceable(256) %0) #2 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca %"struct.juce::AudioProcessor::BusesLayout", align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %10 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 48, ptr %3) #4
  call void @_ZN4juce14AudioProcessor11BusesLayoutC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %3) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  %11 = call noundef i32 @_ZNK4juce14AudioProcessor11getBusCountEb(ptr noundef nonnull align 8 dereferenceable(256) %10, i1 noundef zeroext true) #4
  store i32 %11, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  %12 = call noundef i32 @_ZNK4juce14AudioProcessor11getBusCountEb(ptr noundef nonnull align 8 dereferenceable(256) %10, i1 noundef zeroext false) #4
  store i32 %12, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 0, ptr %6, align 4, !tbaa !9
  br label %13

13:                                               ; preds = %24, %1
  %14 = load i32, ptr %6, align 4, !tbaa !9
  %15 = load i32, ptr %4, align 4, !tbaa !9
  %16 = icmp slt i32 %14, %15
  br i1 %16, label %18, label %17

17:                                               ; preds = %13
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %31

18:                                               ; preds = %13
  %19 = getelementptr inbounds %"struct.juce::AudioProcessor::BusesLayout", ptr %3, i32 0, i32 0
  %20 = load i32, ptr %6, align 4, !tbaa !9
  %21 = call noundef ptr @_ZN4juce14AudioProcessor6getBusEbi(ptr noundef nonnull align 8 dereferenceable(256) %10, i1 noundef zeroext true, i32 noundef %20) #4
  %22 = getelementptr inbounds %"class.juce::AudioProcessor::Bus", ptr %21, i32 0, i32 4
  invoke void @_ZN4juce5ArrayINS_15AudioChannelSetENS_20DummyCriticalSectionELi0EE3addERKS1_(ptr noundef nonnull align 8 dereferenceable(20) %19, ptr noundef nonnull align 8 dereferenceable(40) %22)
          to label %23 unwind label %27

23:                                               ; preds = %18
  br label %24

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

27:                                               ; preds = %18
  %28 = landingpad { ptr, i32 }
          cleanup
  %29 = extractvalue { ptr, i32 } %28, 0
  store ptr %29, ptr %7, align 8
  %30 = extractvalue { ptr, i32 } %28, 1
  store i32 %30, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %57

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

32:                                               ; preds = %43, %31
  %33 = load i32, ptr %9, align 4, !tbaa !9
  %34 = load i32, ptr %5, align 4, !tbaa !9
  %35 = icmp slt i32 %33, %34
  br i1 %35, label %37, label %36

36:                                               ; preds = %32
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %50

37:                                               ; preds = %32
  %38 = getelementptr inbounds %"struct.juce::AudioProcessor::BusesLayout", ptr %3, i32 0, i32 1
  %39 = load i32, ptr %9, align 4, !tbaa !9
  %40 = call noundef ptr @_ZN4juce14AudioProcessor6getBusEbi(ptr noundef nonnull align 8 dereferenceable(256) %10, i1 noundef zeroext false, i32 noundef %39) #4
  %41 = getelementptr inbounds %"class.juce::AudioProcessor::Bus", ptr %40, i32 0, i32 4
  invoke void @_ZN4juce5ArrayINS_15AudioChannelSetENS_20DummyCriticalSectionELi0EE3addERKS1_(ptr noundef nonnull align 8 dereferenceable(20) %38, ptr noundef nonnull align 8 dereferenceable(40) %41)
          to label %42 unwind label %46

42:                                               ; preds = %37
  br label %43

43:                                               ; preds = %42
  %44 = load i32, ptr %9, align 4, !tbaa !9
  %45 = add nsw i32 %44, 1
  store i32 %45, ptr %9, align 4, !tbaa !9
  br label %32, !llvm.loop !13

46:                                               ; preds = %37
  %47 = landingpad { ptr, i32 }
          cleanup
  %48 = extractvalue { ptr, i32 } %47, 0
  store ptr %48, ptr %7, align 8
  %49 = extractvalue { ptr, i32 } %47, 1
  store i32 %49, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %57

50:                                               ; preds = %36
  %51 = invoke noundef zeroext i1 @_ZN4juce14AudioProcessor14setBusesLayoutERKNS0_11BusesLayoutE(ptr noundef nonnull align 8 dereferenceable(256) %10, ptr noundef nonnull align 8 dereferenceable(48) %3)
          to label %52 unwind label %53

52:                                               ; preds = %50
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @_ZN4juce14AudioProcessor11BusesLayoutD2Ev(ptr noundef nonnull align 8 dereferenceable(48) %3) #4
  call void @llvm.lifetime.end.p0(i64 48, ptr %3) #4
  ret i1 %51

53:                                               ; preds = %50
  %54 = landingpad { ptr, i32 }
          cleanup
  %55 = extractvalue { ptr, i32 } %54, 0
  store ptr %55, ptr %7, align 8
  %56 = extractvalue { ptr, i32 } %54, 1
  store i32 %56, ptr %8, align 4
  br label %57

57:                                               ; preds = %53, %46, %27
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @_ZN4juce14AudioProcessor11BusesLayoutD2Ev(ptr noundef nonnull align 8 dereferenceable(48) %3) #4
  call void @llvm.lifetime.end.p0(i64 48, ptr %3) #4
  br label %58

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

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 }

; 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: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK4juce14AudioProcessor11getBusCountEb(ptr noundef nonnull align 8 dereferenceable(256), i1 noundef zeroext) local_unnamed_addr #1 align 2

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

; 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: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN4juce14AudioProcessor6getBusEbi(ptr noundef nonnull align 8 dereferenceable(256), i1 noundef zeroext, i32 noundef) local_unnamed_addr #1 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)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN4juce14AudioProcessor14enableAllBusesEv(ptr noundef nonnull align 8 dereferenceable(256) %0) local_unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"struct.juce::AudioProcessor::BusesLayout", align 8
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %2) #4
  call void @_ZN4juce14AudioProcessor11BusesLayoutC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %2) #4
  %3 = call noundef i32 @_ZNK4juce14AudioProcessor11getBusCountEb(ptr noundef nonnull align 8 dereferenceable(256) %0, i1 noundef zeroext true) #4
  %4 = call noundef i32 @_ZNK4juce14AudioProcessor11getBusCountEb(ptr noundef nonnull align 8 dereferenceable(256) %0, i1 noundef zeroext false) #4
  %5 = icmp sgt i32 %3, 0
  br i1 %5, label %.lr.ph, label %.preheader

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

.lr.ph16:                                         ; preds = %.preheader
  %7 = getelementptr inbounds i8, ptr %2, i64 24
  br label %15

.lr.ph:                                           ; preds = %1, %10
  %.01214 = phi i32 [ %11, %10 ], [ 0, %1 ]
  %8 = call noundef ptr @_ZN4juce14AudioProcessor6getBusEbi(ptr noundef nonnull align 8 dereferenceable(256) %0, i1 noundef zeroext true, i32 noundef %.01214) #4
  %9 = getelementptr inbounds i8, ptr %8, i64 96
  invoke void @_ZN4juce5ArrayINS_15AudioChannelSetENS_20DummyCriticalSectionELi0EE3addERKS1_(ptr noundef nonnull align 8 dereferenceable(20) %2, ptr noundef nonnull align 8 dereferenceable(40) %9)
          to label %10 unwind label %12

10:                                               ; preds = %.lr.ph
  %11 = add nuw nsw i32 %.01214, 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 %25

._crit_edge:                                      ; preds = %18, %.preheader
  %14 = invoke noundef zeroext i1 @_ZN4juce14AudioProcessor14setBusesLayoutERKNS0_11BusesLayoutE(ptr noundef nonnull align 8 dereferenceable(256) %0, ptr noundef nonnull align 8 dereferenceable(48) %2)
          to label %22 unwind label %23

15:                                               ; preds = %.lr.ph16, %18
  %.015 = phi i32 [ 0, %.lr.ph16 ], [ %19, %18 ]
  %16 = call noundef ptr @_ZN4juce14AudioProcessor6getBusEbi(ptr noundef nonnull align 8 dereferenceable(256) %0, i1 noundef zeroext false, i32 noundef %.015) #4
  %17 = getelementptr inbounds i8, ptr %16, i64 96
  invoke void @_ZN4juce5ArrayINS_15AudioChannelSetENS_20DummyCriticalSectionELi0EE3addERKS1_(ptr noundef nonnull align 8 dereferenceable(20) %7, ptr noundef nonnull align 8 dereferenceable(40) %17)
          to label %18 unwind label %20

18:                                               ; preds = %15
  %19 = add nuw nsw i32 %.015, 1
  %exitcond17.not = icmp eq i32 %19, %4
  br i1 %exitcond17.not, label %._crit_edge, label %15, !llvm.loop !7

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

22:                                               ; preds = %._crit_edge
  call void @_ZN4juce14AudioProcessor11BusesLayoutD2Ev(ptr noundef nonnull align 8 dereferenceable(48) %2) #4
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %2) #4
  ret i1 %14

23:                                               ; preds = %._crit_edge
  %24 = landingpad { ptr, i32 }
          cleanup
  br label %25

25:                                               ; preds = %23, %20, %12
  %.pn = phi { ptr, i32 } [ %13, %12 ], [ %21, %20 ], [ %24, %23 ]
  call void @_ZN4juce14AudioProcessor11BusesLayoutD2Ev(ptr noundef nonnull align 8 dereferenceable(48) %2) #4
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %2) #4
  resume { ptr, i32 } %.pn
}

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


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