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

; 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::MidiBuffer" = type { %"class.juce::Array" }
%"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 }
%"struct.juce::MPEZone" = 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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4juce10MidiBuffer9addEventsERKS0_iii(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, i32 noundef, i32 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4juce16MidiRPNGenerator8generateEiiibb(ptr dead_on_unwind noalias writable sret(%"class.juce::MidiBuffer") align 8, i32 noundef, i32 noundef, i32 noundef, i1 noundef zeroext, i1 noundef zeroext) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK4juce7MPEZone18getNumNoteChannelsEv(ptr noundef nonnull align 4 dereferenceable(16)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK4juce7MPEZone19getFirstNoteChannelEv(ptr noundef nonnull align 4 dereferenceable(16)) #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4juce11MPEMessages7addZoneENS_7MPEZoneE(ptr dead_on_unwind noalias writable sret(%"class.juce::MidiBuffer") align 8 %0, i64 %1, i64 %2) #2 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca %"struct.juce::MPEZone", align 4
  %6 = alloca i1, align 1
  %7 = alloca %"class.juce::MidiBuffer", align 8
  %8 = alloca %"struct.juce::MPEZone", align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca %"class.juce::MidiBuffer", align 8
  %12 = alloca %"struct.juce::MPEZone", align 4
  store ptr %0, ptr %4, align 8
  %13 = getelementptr inbounds { i64, i64 }, ptr %5, i32 0, i32 0
  store i64 %1, ptr %13, align 4
  %14 = getelementptr inbounds { i64, i64 }, ptr %5, i32 0, i32 1
  store i64 %2, ptr %14, align 4
  store i1 false, ptr %6, align 1
  %15 = call noundef i32 @_ZNK4juce7MPEZone19getFirstNoteChannelEv(ptr noundef nonnull align 4 dereferenceable(16) %5) #4
  %16 = call noundef i32 @_ZNK4juce7MPEZone18getNumNoteChannelsEv(ptr noundef nonnull align 4 dereferenceable(16) %5) #4
  call void @_ZN4juce16MidiRPNGenerator8generateEiiibb(ptr dead_on_unwind writable sret(%"class.juce::MidiBuffer") align 8 %0, i32 noundef %15, i32 noundef 6, i32 noundef %16, i1 noundef zeroext false, i1 noundef zeroext false)
  call void @llvm.lifetime.start.p0(i64 24, ptr %7) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %8, ptr align 4 %5, i64 16, i1 false), !tbaa.struct !5
  %17 = getelementptr inbounds { i64, i64 }, ptr %8, i32 0, i32 0
  %18 = load i64, ptr %17, align 4
  %19 = getelementptr inbounds { i64, i64 }, ptr %8, i32 0, i32 1
  %20 = load i64, ptr %19, align 4
  invoke void @_ZN4juce11MPEMessages21perNotePitchbendRangeENS_7MPEZoneE(ptr dead_on_unwind writable sret(%"class.juce::MidiBuffer") align 8 %7, i64 %18, i64 %20)
          to label %21 unwind label %30

21:                                               ; preds = %3
  invoke void @_ZN4juce10MidiBuffer9addEventsERKS0_iii(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %7, i32 noundef 0, i32 noundef -1, i32 noundef 0)
          to label %22 unwind label %34

22:                                               ; preds = %21
  call void @_ZN4juce10MidiBufferD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 24, ptr %11) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %12, ptr align 4 %5, i64 16, i1 false), !tbaa.struct !5
  %23 = getelementptr inbounds { i64, i64 }, ptr %12, i32 0, i32 0
  %24 = load i64, ptr %23, align 4
  %25 = getelementptr inbounds { i64, i64 }, ptr %12, i32 0, i32 1
  %26 = load i64, ptr %25, align 4
  invoke void @_ZN4juce11MPEMessages20masterPitchbendRangeENS_7MPEZoneE(ptr dead_on_unwind writable sret(%"class.juce::MidiBuffer") align 8 %11, i64 %24, i64 %26)
          to label %27 unwind label %39

27:                                               ; preds = %22
  invoke void @_ZN4juce10MidiBuffer9addEventsERKS0_iii(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %11, i32 noundef 0, i32 noundef -1, i32 noundef 0)
          to label %28 unwind label %43

28:                                               ; preds = %27
  call void @_ZN4juce10MidiBufferD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %11) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %11) #4
  store i1 true, ptr %6, align 1
  %29 = load i1, ptr %6, align 1
  br i1 %29, label %49, label %48

30:                                               ; preds = %3
  %31 = landingpad { ptr, i32 }
          cleanup
  %32 = extractvalue { ptr, i32 } %31, 0
  store ptr %32, ptr %9, align 8
  %33 = extractvalue { ptr, i32 } %31, 1
  store i32 %33, ptr %10, align 4
  br label %38

34:                                               ; preds = %21
  %35 = landingpad { ptr, i32 }
          cleanup
  %36 = extractvalue { ptr, i32 } %35, 0
  store ptr %36, ptr %9, align 8
  %37 = extractvalue { ptr, i32 } %35, 1
  store i32 %37, ptr %10, align 4
  call void @_ZN4juce10MidiBufferD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #4
  br label %38

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

39:                                               ; preds = %22
  %40 = landingpad { ptr, i32 }
          cleanup
  %41 = extractvalue { ptr, i32 } %40, 0
  store ptr %41, ptr %9, align 8
  %42 = extractvalue { ptr, i32 } %40, 1
  store i32 %42, ptr %10, align 4
  br label %47

43:                                               ; preds = %27
  %44 = landingpad { ptr, i32 }
          cleanup
  %45 = extractvalue { ptr, i32 } %44, 0
  store ptr %45, ptr %9, align 8
  %46 = extractvalue { ptr, i32 } %44, 1
  store i32 %46, ptr %10, align 4
  call void @_ZN4juce10MidiBufferD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %11) #4
  br label %47

47:                                               ; preds = %43, %39
  call void @llvm.lifetime.end.p0(i64 24, ptr %11) #4
  br label %50

48:                                               ; preds = %28
  call void @_ZN4juce10MidiBufferD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  br label %49

49:                                               ; preds = %48, %28
  ret void

50:                                               ; preds = %47, %38
  call void @_ZN4juce10MidiBufferD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  br label %51

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4juce11MPEMessages21perNotePitchbendRangeENS_7MPEZoneE(ptr dead_on_unwind noalias writable sret(%"class.juce::MidiBuffer") align 8, i64, i64) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4juce11MPEMessages20masterPitchbendRangeENS_7MPEZoneE(ptr dead_on_unwind noalias writable sret(%"class.juce::MidiBuffer") align 8, i64, i64) #2 align 2

declare void @_ZN4juce10MidiBufferD1Ev(ptr)

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 }

!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 = !{i64 0, i64 4, !6, i64 4, i64 4, !6, i64 8, i64 4, !6, i64 12, i64 4, !6}
!6 = !{!7, !7, i64 0}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}


; 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::MidiBuffer" = type { %"class.juce::Array" }
%"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 }
%"struct.juce::MPEZone" = type { i32, i32, i32, i32 }

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4juce10MidiBuffer9addEventsERKS0_iii(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4juce16MidiRPNGenerator8generateEiiibb(ptr dead_on_unwind noalias writable sret(%"class.juce::MidiBuffer") align 8, i32 noundef, i32 noundef, i32 noundef, i1 noundef zeroext, i1 noundef zeroext) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK4juce7MPEZone18getNumNoteChannelsEv(ptr noundef nonnull align 4 dereferenceable(16)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK4juce7MPEZone19getFirstNoteChannelEv(ptr noundef nonnull align 4 dereferenceable(16)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4juce11MPEMessages7addZoneENS_7MPEZoneE(ptr dead_on_unwind noalias writable sret(%"class.juce::MidiBuffer") align 8 %0, i64 %1, i64 %2) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca %"struct.juce::MPEZone", align 8
  %5 = alloca %"class.juce::MidiBuffer", align 8
  %6 = alloca %"class.juce::MidiBuffer", align 8
  store i64 %1, ptr %4, align 8
  %7 = getelementptr inbounds i8, ptr %4, i64 8
  store i64 %2, ptr %7, align 8
  %8 = call noundef i32 @_ZNK4juce7MPEZone19getFirstNoteChannelEv(ptr noundef nonnull align 4 dereferenceable(16) %4) #3
  %9 = call noundef i32 @_ZNK4juce7MPEZone18getNumNoteChannelsEv(ptr noundef nonnull align 4 dereferenceable(16) %4) #3
  call void @_ZN4juce16MidiRPNGenerator8generateEiiibb(ptr dead_on_unwind writable sret(%"class.juce::MidiBuffer") align 8 %0, i32 noundef %8, i32 noundef 6, i32 noundef %9, i1 noundef zeroext false, i1 noundef zeroext false)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #3
  %.sroa.01.0.copyload = load i64, ptr %4, align 8
  %.sroa.22.0.copyload = load i64, ptr %7, align 8
  invoke void @_ZN4juce11MPEMessages21perNotePitchbendRangeENS_7MPEZoneE(ptr dead_on_unwind nonnull writable sret(%"class.juce::MidiBuffer") align 8 %5, i64 %.sroa.01.0.copyload, i64 %.sroa.22.0.copyload)
          to label %10 unwind label %14

10:                                               ; preds = %3
  invoke void @_ZN4juce10MidiBuffer9addEventsERKS0_iii(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %5, i32 noundef 0, i32 noundef -1, i32 noundef 0)
          to label %11 unwind label %16

11:                                               ; preds = %10
  call void @_ZN4juce10MidiBufferD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #3
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #3
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #3
  %.sroa.0.0.copyload = load i64, ptr %4, align 8
  %.sroa.2.0.copyload = load i64, ptr %7, align 8
  invoke void @_ZN4juce11MPEMessages20masterPitchbendRangeENS_7MPEZoneE(ptr dead_on_unwind nonnull writable sret(%"class.juce::MidiBuffer") align 8 %6, i64 %.sroa.0.0.copyload, i64 %.sroa.2.0.copyload)
          to label %12 unwind label %19

12:                                               ; preds = %11
  invoke void @_ZN4juce10MidiBuffer9addEventsERKS0_iii(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %6, i32 noundef 0, i32 noundef -1, i32 noundef 0)
          to label %13 unwind label %21

13:                                               ; preds = %12
  call void @_ZN4juce10MidiBufferD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #3
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #3
  ret void

14:                                               ; preds = %3
  %15 = landingpad { ptr, i32 }
          cleanup
  br label %18

16:                                               ; preds = %10
  %17 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN4juce10MidiBufferD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #3
  br label %18

18:                                               ; preds = %16, %14
  %.pn = phi { ptr, i32 } [ %17, %16 ], [ %15, %14 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #3
  br label %24

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

21:                                               ; preds = %12
  %22 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN4juce10MidiBufferD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #3
  br label %23

23:                                               ; preds = %21, %19
  %.pn8 = phi { ptr, i32 } [ %22, %21 ], [ %20, %19 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #3
  br label %24

24:                                               ; preds = %23, %18
  %.pn8.pn = phi { ptr, i32 } [ %.pn8, %23 ], [ %.pn, %18 ]
  call void @_ZN4juce10MidiBufferD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #3
  resume { ptr, i32 } %.pn8.pn
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4juce11MPEMessages21perNotePitchbendRangeENS_7MPEZoneE(ptr dead_on_unwind noalias writable sret(%"class.juce::MidiBuffer") align 8, i64, i64) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4juce11MPEMessages20masterPitchbendRangeENS_7MPEZoneE(ptr dead_on_unwind noalias writable sret(%"class.juce::MidiBuffer") align 8, i64, i64) local_unnamed_addr #1 align 2

declare void @_ZN4juce10MidiBufferD1Ev(ptr) local_unnamed_addr

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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)"}


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