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

%"struct.juce::MidiRPNMessage" = type { i32, i32, i32, i8, i8 }
%"class.juce::MPEZoneLayout" = type { %"class.juce::Array.51", %"class.juce::MidiRPNDetector", %"class.juce::ListenerList" }
%"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::MidiRPNDetector" = type { [16 x %"struct.juce::MidiRPNDetector::ChannelState"] }
%"struct.juce::MidiRPNDetector::ChannelState" = type { i8, i8, i8, i8, i8 }
%"class.juce::ListenerList" = type { %"class.juce::Array.56" }
%"class.juce::Array.56" = type { %"class.juce::ArrayAllocationBase.57", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase.57" = type <{ %"class.juce::HeapBlock.58", i32, [4 x i8] }>
%"class.juce::HeapBlock.58" = 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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4juce7MPEZone24setPerNotePitchbendRangeEi(ptr noundef nonnull align 4 dereferenceable(16), i32 noundef) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4juce7MPEZone23setMasterPitchbendRangeEi(ptr noundef nonnull align 4 dereferenceable(16), i32 noundef) #1 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4juce13MPEZoneLayout31processPitchbendRangeRpnMessageENS_14MidiRPNMessageE(ptr noundef nonnull align 8 dereferenceable(128) %0, i64 %1, i64 %2) #2 align 2 {
  %4 = alloca %"struct.juce::MidiRPNMessage", align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca { i64, i64 }, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca { i64, i64 }, align 8
  %11 = getelementptr inbounds { i64, i64 }, ptr %4, i32 0, i32 0
  store i64 %1, ptr %11, align 4
  %12 = getelementptr inbounds { i64, i64 }, ptr %4, i32 0, i32 1
  store i64 %2, ptr %12, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  %13 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %14 = getelementptr inbounds %"struct.juce::MidiRPNMessage", ptr %4, i32 0, i32 0
  %15 = load i32, ptr %14, align 4, !tbaa !9
  %16 = call noundef ptr @_ZNK4juce13MPEZoneLayout25getZoneByFirstNoteChannelEi(ptr noundef nonnull align 8 dereferenceable(128) %13, i32 noundef %15) #3
  store ptr %16, ptr %6, align 8, !tbaa !5
  %17 = load ptr, ptr %6, align 8, !tbaa !5
  %18 = icmp ne ptr %17, null
  br i1 %18, label %19, label %35

19:                                               ; preds = %3
  %20 = load ptr, ptr %6, align 8, !tbaa !5
  %21 = call noundef i32 @_ZNK4juce7MPEZone24getPerNotePitchbendRangeEv(ptr noundef nonnull align 4 dereferenceable(16) %20) #3
  %22 = getelementptr inbounds %"struct.juce::MidiRPNMessage", ptr %4, i32 0, i32 2
  %23 = load i32, ptr %22, align 4, !tbaa !13
  %24 = icmp ne i32 %21, %23
  br i1 %24, label %25, label %34

25:                                               ; preds = %19
  %26 = load ptr, ptr %6, align 8, !tbaa !5
  %27 = getelementptr inbounds %"struct.juce::MidiRPNMessage", ptr %4, i32 0, i32 2
  %28 = load i32, ptr %27, align 4, !tbaa !13
  call void @_ZN4juce7MPEZone24setPerNotePitchbendRangeEi(ptr noundef nonnull align 4 dereferenceable(16) %26, i32 noundef %28) #3
  %29 = getelementptr inbounds %"class.juce::MPEZoneLayout", ptr %13, i32 0, i32 2
  store { i64, i64 } { i64 17, i64 0 }, ptr %7, align 8, !tbaa !14
  %30 = getelementptr inbounds { i64, i64 }, ptr %7, i32 0, i32 0
  %31 = load i64, ptr %30, align 8
  %32 = getelementptr inbounds { i64, i64 }, ptr %7, i32 0, i32 1
  %33 = load i64, ptr %32, align 8
  call void @_ZN4juce12ListenerListINS_13MPEZoneLayout8ListenerENS_5ArrayIPS2_NS_20DummyCriticalSectionELi0EEEE4callIRKS1_EEvMS2_FvT_ENS_11TypeHelpers13ParameterTypeISB_E4typeE(ptr noundef nonnull align 8 dereferenceable(24) %29, i64 %31, i64 %33, ptr noundef nonnull align 8 dereferenceable(128) %13)
  store i32 1, ptr %8, align 4
  br label %36

34:                                               ; preds = %19
  br label %35

35:                                               ; preds = %34, %3
  store i32 0, ptr %8, align 4
  br label %36

36:                                               ; preds = %35, %25
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  %37 = load i32, ptr %8, align 4
  switch i32 %37, label %64 [
    i32 0, label %38
    i32 1, label %63
  ]

38:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %39 = getelementptr inbounds %"struct.juce::MidiRPNMessage", ptr %4, i32 0, i32 0
  %40 = load i32, ptr %39, align 4, !tbaa !9
  %41 = call noundef ptr @_ZNK4juce13MPEZoneLayout22getZoneByMasterChannelEi(ptr noundef nonnull align 8 dereferenceable(128) %13, i32 noundef %40) #3
  store ptr %41, ptr %9, align 8, !tbaa !5
  %42 = load ptr, ptr %9, align 8, !tbaa !5
  %43 = icmp ne ptr %42, null
  br i1 %43, label %44, label %60

44:                                               ; preds = %38
  %45 = load ptr, ptr %9, align 8, !tbaa !5
  %46 = call noundef i32 @_ZNK4juce7MPEZone23getMasterPitchbendRangeEv(ptr noundef nonnull align 4 dereferenceable(16) %45) #3
  %47 = getelementptr inbounds %"struct.juce::MidiRPNMessage", ptr %4, i32 0, i32 2
  %48 = load i32, ptr %47, align 4, !tbaa !13
  %49 = icmp ne i32 %46, %48
  br i1 %49, label %50, label %59

50:                                               ; preds = %44
  %51 = load ptr, ptr %9, align 8, !tbaa !5
  %52 = getelementptr inbounds %"struct.juce::MidiRPNMessage", ptr %4, i32 0, i32 2
  %53 = load i32, ptr %52, align 4, !tbaa !13
  call void @_ZN4juce7MPEZone23setMasterPitchbendRangeEi(ptr noundef nonnull align 4 dereferenceable(16) %51, i32 noundef %53) #3
  %54 = getelementptr inbounds %"class.juce::MPEZoneLayout", ptr %13, i32 0, i32 2
  store { i64, i64 } { i64 17, i64 0 }, ptr %10, align 8, !tbaa !14
  %55 = getelementptr inbounds { i64, i64 }, ptr %10, i32 0, i32 0
  %56 = load i64, ptr %55, align 8
  %57 = getelementptr inbounds { i64, i64 }, ptr %10, i32 0, i32 1
  %58 = load i64, ptr %57, align 8
  call void @_ZN4juce12ListenerListINS_13MPEZoneLayout8ListenerENS_5ArrayIPS2_NS_20DummyCriticalSectionELi0EEEE4callIRKS1_EEvMS2_FvT_ENS_11TypeHelpers13ParameterTypeISB_E4typeE(ptr noundef nonnull align 8 dereferenceable(24) %54, i64 %56, i64 %58, ptr noundef nonnull align 8 dereferenceable(128) %13)
  store i32 1, ptr %8, align 4
  br label %61

59:                                               ; preds = %44
  br label %60

60:                                               ; preds = %59, %38
  store i32 0, ptr %8, align 4
  br label %61

61:                                               ; preds = %60, %50
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  %62 = load i32, ptr %8, align 4
  switch i32 %62, label %64 [
    i32 0, label %63
    i32 1, label %63
  ]

63:                                               ; preds = %61, %61, %36
  ret void

64:                                               ; preds = %61, %36
  unreachable
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK4juce13MPEZoneLayout25getZoneByFirstNoteChannelEi(ptr noundef nonnull align 8 dereferenceable(128), i32 noundef) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK4juce13MPEZoneLayout22getZoneByMasterChannelEi(ptr noundef nonnull align 8 dereferenceable(128), i32 noundef) #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 = { 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, !11, i64 0}
!10 = !{!"_ZTSN4juce14MidiRPNMessageE", !11, i64 0, !11, i64 4, !11, i64 8, !12, i64 12, !12, i64 13}
!11 = !{!"int", !7, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{!10, !11, i64 8}
!14 = !{!7, !7, i64 0}


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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4juce13MPEZoneLayout31processPitchbendRangeRpnMessageENS_14MidiRPNMessageE(ptr noundef nonnull align 8 dereferenceable(128) %0, i64 %1, i64 %2) local_unnamed_addr #1 align 2 {
  %.sroa.09.0.extract.trunc = trunc i64 %1 to i32
  %.sroa.311.8.extract.trunc = trunc i64 %2 to i32
  %4 = tail call noundef ptr @_ZNK4juce13MPEZoneLayout25getZoneByFirstNoteChannelEi(ptr noundef nonnull align 8 dereferenceable(128) %0, i32 noundef %.sroa.09.0.extract.trunc) #2
  %.not = icmp eq ptr %4, null
  br i1 %.not, label %8, label %5

5:                                                ; preds = %3
  %6 = tail call noundef i32 @_ZNK4juce7MPEZone24getPerNotePitchbendRangeEv(ptr noundef nonnull align 4 dereferenceable(16) %4) #2
  %.not17 = icmp eq i32 %6, %.sroa.311.8.extract.trunc
  br i1 %.not17, label %8, label %7

7:                                                ; preds = %5
  tail call void @_ZN4juce7MPEZone24setPerNotePitchbendRangeEi(ptr noundef nonnull align 4 dereferenceable(16) %4, i32 noundef %.sroa.311.8.extract.trunc) #2
  br label %.sink.split

8:                                                ; preds = %5, %3
  %9 = tail call noundef ptr @_ZNK4juce13MPEZoneLayout22getZoneByMasterChannelEi(ptr noundef nonnull align 8 dereferenceable(128) %0, i32 noundef %.sroa.09.0.extract.trunc) #2
  %.not18 = icmp eq ptr %9, null
  br i1 %.not18, label %14, label %10

10:                                               ; preds = %8
  %11 = tail call noundef i32 @_ZNK4juce7MPEZone23getMasterPitchbendRangeEv(ptr noundef nonnull align 4 dereferenceable(16) %9) #2
  %.not19 = icmp eq i32 %11, %.sroa.311.8.extract.trunc
  br i1 %.not19, label %14, label %12

12:                                               ; preds = %10
  tail call void @_ZN4juce7MPEZone23setMasterPitchbendRangeEi(ptr noundef nonnull align 4 dereferenceable(16) %9, i32 noundef %.sroa.311.8.extract.trunc) #2
  br label %.sink.split

.sink.split:                                      ; preds = %12, %7
  %13 = getelementptr inbounds i8, ptr %0, i64 104
  tail call void @_ZN4juce12ListenerListINS_13MPEZoneLayout8ListenerENS_5ArrayIPS2_NS_20DummyCriticalSectionELi0EEEE4callIRKS1_EEvMS2_FvT_ENS_11TypeHelpers13ParameterTypeISB_E4typeE(ptr noundef nonnull align 8 dereferenceable(24) %13, i64 17, i64 0, ptr noundef nonnull align 8 dereferenceable(128) %0)
  br label %14

14:                                               ; preds = %.sink.split, %10, %8
  ret void
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK4juce13MPEZoneLayout22getZoneByMasterChannelEi(ptr noundef nonnull align 8 dereferenceable(128), i32 noundef) 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 = { 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,JumpThreadingPass,SROAPass,SimplifyCFGPass,TailCallElimPass