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

; 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::MidiMessageSequence" = type { %"class.juce::OwnedArray.35" }
%"class.juce::OwnedArray.35" = type { %"class.juce::ArrayAllocationBase.36", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase.36" = type <{ %"class.juce::HeapBlock.37", i32, [4 x i8] }>
%"class.juce::HeapBlock.37" = type { ptr }
%"class.juce::MidiMessage" = type <{ %"union.juce::MidiMessage::PackedData", double, i32, [4 x i8] }>
%"union.juce::MidiMessage::PackedData" = type { ptr }
%"struct.juce::MidiFileHelpers::Sorter" = type { i8 }
%"class.juce::MidiFile" = type <{ %"class.juce::OwnedArray.30", i16, [6 x i8] }>
%"class.juce::OwnedArray.30" = type { %"class.juce::ArrayAllocationBase.31", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase.31" = type <{ %"class.juce::HeapBlock.32", i32, [4 x i8] }>
%"class.juce::HeapBlock.32" = type { ptr }

; 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: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK4juce11MidiMessage10getRawDataEv(ptr noundef nonnull align 8 dereferenceable(20)) #1 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4juce8MidiFile13readNextTrackEPKhi(ptr noundef nonnull align 8 dereferenceable(26) %0, ptr noundef %1, i32 noundef %2) #2 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca double, align 8
  %8 = alloca i8, align 1
  %9 = alloca %"class.juce::MidiMessageSequence", align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca %"class.juce::MidiMessage", align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i8, align 1
  %18 = alloca %"struct.juce::MidiFileHelpers::Sorter", align 1
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i32 %2, ptr %6, align 4, !tbaa !9
  %19 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  store double 0.000000e+00, ptr %7, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #4
  store i8 0, ptr %8, align 1, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 24, ptr %9) #4
  call void @_ZN4juce19MidiMessageSequenceC1Ev(ptr noundef nonnull align 8 dereferenceable(24) %9)
  br label %20

20:                                               ; preds = %74, %3
  %21 = load i32, ptr %6, align 4, !tbaa !9
  %22 = icmp sgt i32 %21, 0
  br i1 %22, label %23, label %76

23:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = call noundef i32 @_ZN4juce11MidiMessage21readVariableLengthValEPKhRi(ptr noundef %24, ptr noundef nonnull align 4 dereferenceable(4) %10) #4
  store i32 %25, ptr %11, align 4, !tbaa !9
  %26 = load i32, ptr %10, align 4, !tbaa !9
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  %28 = sext i32 %26 to i64
  %29 = getelementptr inbounds i8, ptr %27, i64 %28
  store ptr %29, ptr %5, align 8, !tbaa !5
  %30 = load i32, ptr %10, align 4, !tbaa !9
  %31 = load i32, ptr %6, align 4, !tbaa !9
  %32 = sub nsw i32 %31, %30
  store i32 %32, ptr %6, align 4, !tbaa !9
  %33 = load i32, ptr %11, align 4, !tbaa !9
  %34 = sitofp i32 %33 to double
  %35 = load double, ptr %7, align 8, !tbaa !11
  %36 = fadd double %35, %34
  store double %36, ptr %7, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  store i32 0, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 24, ptr %13) #4
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = load i32, ptr %6, align 4, !tbaa !9
  %39 = load i8, ptr %8, align 1, !tbaa !13
  %40 = load double, ptr %7, align 8, !tbaa !11
  invoke void @_ZN4juce11MidiMessageC1EPKviRihdb(ptr noundef nonnull align 8 dereferenceable(20) %13, ptr noundef %37, i32 noundef %38, ptr noundef nonnull align 4 dereferenceable(4) %12, i8 noundef zeroext %39, double noundef %40, i1 noundef zeroext true)
          to label %41 unwind label %45

41:                                               ; preds = %23
  %42 = load i32, ptr %12, align 4, !tbaa !9
  %43 = icmp sle i32 %42, 0
  br i1 %43, label %44, label %49

44:                                               ; preds = %41
  store i32 3, ptr %16, align 4
  br label %72

45:                                               ; preds = %23
  %46 = landingpad { ptr, i32 }
          cleanup
  %47 = extractvalue { ptr, i32 } %46, 0
  store ptr %47, ptr %14, align 8
  %48 = extractvalue { ptr, i32 } %46, 1
  store i32 %48, ptr %15, align 4
  br label %75

49:                                               ; preds = %41
  %50 = load i32, ptr %12, align 4, !tbaa !9
  %51 = load i32, ptr %6, align 4, !tbaa !9
  %52 = sub nsw i32 %51, %50
  store i32 %52, ptr %6, align 4, !tbaa !9
  %53 = load i32, ptr %12, align 4, !tbaa !9
  %54 = load ptr, ptr %5, align 8, !tbaa !5
  %55 = sext i32 %53 to i64
  %56 = getelementptr inbounds i8, ptr %54, i64 %55
  store ptr %56, ptr %5, align 8, !tbaa !5
  %57 = invoke noundef ptr @_ZN4juce19MidiMessageSequence8addEventERKNS_11MidiMessageEd(ptr noundef nonnull align 8 dereferenceable(24) %9, ptr noundef nonnull align 8 dereferenceable(20) %13, double noundef 0.000000e+00)
          to label %58 unwind label %67

58:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 1, ptr %17) #4
  %59 = call noundef ptr @_ZNK4juce11MidiMessage10getRawDataEv(ptr noundef nonnull align 8 dereferenceable(20) %13) #4
  %60 = load i8, ptr %59, align 1, !tbaa !13
  store i8 %60, ptr %17, align 1, !tbaa !13
  %61 = load i8, ptr %17, align 1, !tbaa !13
  %62 = zext i8 %61 to i32
  %63 = and i32 %62, 240
  %64 = icmp ne i32 %63, 240
  br i1 %64, label %65, label %71

65:                                               ; preds = %58
  %66 = load i8, ptr %17, align 1, !tbaa !13
  store i8 %66, ptr %8, align 1, !tbaa !13
  br label %71

67:                                               ; preds = %49
  %68 = landingpad { ptr, i32 }
          cleanup
  %69 = extractvalue { ptr, i32 } %68, 0
  store ptr %69, ptr %14, align 8
  %70 = extractvalue { ptr, i32 } %68, 1
  store i32 %70, ptr %15, align 4
  call void @_ZN4juce11MidiMessageD1Ev(ptr noundef nonnull align 8 dereferenceable(20) %13) #4
  br label %75

71:                                               ; preds = %65, %58
  call void @llvm.lifetime.end.p0(i64 1, ptr %17) #4
  store i32 0, ptr %16, align 4
  br label %72

72:                                               ; preds = %71, %44
  call void @_ZN4juce11MidiMessageD1Ev(ptr noundef nonnull align 8 dereferenceable(20) %13) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  %73 = load i32, ptr %16, align 4
  switch i32 %73, label %91 [
    i32 0, label %74
    i32 3, label %76
  ]

74:                                               ; preds = %72
  br label %20, !llvm.loop !14

75:                                               ; preds = %67, %45
  call void @llvm.lifetime.end.p0(i64 24, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %85

76:                                               ; preds = %72, %20
  call void @llvm.lifetime.start.p0(i64 1, ptr %18) #4
  %77 = getelementptr inbounds %"class.juce::MidiMessageSequence", ptr %9, i32 0, i32 0
  call void @_ZNK4juce10OwnedArrayINS_19MidiMessageSequence15MidiEventHolderENS_20DummyCriticalSectionEE4sortINS_15MidiFileHelpers6SorterEEEvRT_b(ptr noundef nonnull align 8 dereferenceable(20) %77, ptr noundef nonnull align 1 dereferenceable(1) %18, i1 noundef zeroext true) #4
  invoke void @_ZN4juce8MidiFile8addTrackERKNS_19MidiMessageSequenceE(ptr noundef nonnull align 8 dereferenceable(26) %19, ptr noundef nonnull align 8 dereferenceable(24) %9)
          to label %78 unwind label %81

78:                                               ; preds = %76
  %79 = getelementptr inbounds %"class.juce::MidiFile", ptr %19, i32 0, i32 0
  %80 = call noundef ptr @_ZNK4juce10OwnedArrayINS_19MidiMessageSequenceENS_20DummyCriticalSectionEE7getLastEv(ptr noundef nonnull align 8 dereferenceable(20) %79) #4
  call void @_ZN4juce19MidiMessageSequence18updateMatchedPairsEv(ptr noundef nonnull align 8 dereferenceable(24) %80) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %18) #4
  call void @_ZN4juce19MidiMessageSequenceD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %9) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  ret void

81:                                               ; preds = %76
  %82 = landingpad { ptr, i32 }
          cleanup
  %83 = extractvalue { ptr, i32 } %82, 0
  store ptr %83, ptr %14, align 8
  %84 = extractvalue { ptr, i32 } %82, 1
  store i32 %84, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %18) #4
  br label %85

85:                                               ; preds = %81, %75
  call void @_ZN4juce19MidiMessageSequenceD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %9) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  br label %86

86:                                               ; preds = %85
  %87 = load ptr, ptr %14, align 8
  %88 = load i32, ptr %15, align 4
  %89 = insertvalue { ptr, i32 } poison, ptr %87, 0
  %90 = insertvalue { ptr, i32 } %89, i32 %88, 1
  resume { ptr, i32 } %90

91:                                               ; preds = %72
  unreachable
}

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN4juce19MidiMessageSequence8addEventERKNS_11MidiMessageEd(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(20), double noundef) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNK4juce10OwnedArrayINS_19MidiMessageSequence15MidiEventHolderENS_20DummyCriticalSectionEE4sortINS_15MidiFileHelpers6SorterEEEvRT_b(ptr noundef nonnull align 8 dereferenceable(20), ptr noundef nonnull align 1 dereferenceable(1), i1 noundef zeroext) #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK4juce10OwnedArrayINS_19MidiMessageSequenceENS_20DummyCriticalSectionEE7getLastEv(ptr noundef nonnull align 8 dereferenceable(20)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4juce19MidiMessageSequence18updateMatchedPairsEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

declare void @_ZN4juce11MidiMessageC1EPKviRihdb(ptr, ptr, i32, ptr, i8, double, i1)

declare void @_ZN4juce11MidiMessageD1Ev(ptr)

declare void @_ZN4juce19MidiMessageSequenceC1Ev(ptr)

declare void @_ZN4juce19MidiMessageSequenceD1Ev(ptr)

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 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"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::MidiMessageSequence" = type { %"class.juce::OwnedArray.35" }
%"class.juce::OwnedArray.35" = type { %"class.juce::ArrayAllocationBase.36", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase.36" = type <{ %"class.juce::HeapBlock.37", i32, [4 x i8] }>
%"class.juce::HeapBlock.37" = type { ptr }
%"class.juce::MidiMessage" = type <{ %"union.juce::MidiMessage::PackedData", double, i32, [4 x i8] }>
%"union.juce::MidiMessage::PackedData" = type { ptr }
%"struct.juce::MidiFileHelpers::Sorter" = type { i8 }

; 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 nounwind uwtable
declare dso_local noundef ptr @_ZNK4juce11MidiMessage10getRawDataEv(ptr noundef nonnull align 8 dereferenceable(20)) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4juce8MidiFile13readNextTrackEPKhi(ptr noundef nonnull align 8 dereferenceable(26) %0, ptr noundef %1, i32 noundef %2) local_unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca %"class.juce::MidiMessageSequence", align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca %"class.juce::MidiMessage", align 8
  %8 = alloca %"struct.juce::MidiFileHelpers::Sorter", align 1
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #4
  call void @_ZN4juce19MidiMessageSequenceC1Ev(ptr noundef nonnull align 8 dereferenceable(24) %4)
  %9 = icmp sgt i32 %2, 0
  br i1 %9, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %3, %26
  %.039 = phi ptr [ %28, %26 ], [ %1, %3 ]
  %.02238 = phi i32 [ %29, %26 ], [ %2, %3 ]
  %.02437 = phi i8 [ %spec.select, %26 ], [ 0, %3 ]
  %.02636 = phi double [ %16, %26 ], [ 0.000000e+00, %3 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #4
  %10 = call noundef i32 @_ZN4juce11MidiMessage21readVariableLengthValEPKhRi(ptr noundef %.039, ptr noundef nonnull align 4 dereferenceable(4) %5) #4
  %11 = load i32, ptr %5, align 4, !tbaa !5
  %12 = sext i32 %11 to i64
  %13 = getelementptr inbounds i8, ptr %.039, i64 %12
  %14 = sub nsw i32 %.02238, %11
  %15 = sitofp i32 %10 to double
  %16 = fadd double %.02636, %15
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #4
  store i32 0, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #4
  invoke void @_ZN4juce11MidiMessageC1EPKviRihdb(ptr noundef nonnull align 8 dereferenceable(20) %7, ptr noundef %13, i32 noundef %14, ptr noundef nonnull align 4 dereferenceable(4) %6, i8 noundef zeroext %.02437, double noundef %16, i1 noundef zeroext true)
          to label %17 unwind label %20

17:                                               ; preds = %.lr.ph
  %18 = load i32, ptr %6, align 4, !tbaa !5
  %19 = icmp slt i32 %18, 1
  br i1 %19, label %.thread, label %22

.thread:                                          ; preds = %17
  call void @_ZN4juce11MidiMessageD1Ev(ptr noundef nonnull align 8 dereferenceable(20) %7) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #4
  br label %.loopexit

20:                                               ; preds = %.lr.ph
  %21 = landingpad { ptr, i32 }
          cleanup
  br label %33

22:                                               ; preds = %17
  %23 = invoke noundef ptr @_ZN4juce19MidiMessageSequence8addEventERKNS_11MidiMessageEd(ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 8 dereferenceable(20) %7, double noundef 0.000000e+00)
          to label %26 unwind label %24

24:                                               ; preds = %22
  %25 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN4juce11MidiMessageD1Ev(ptr noundef nonnull align 8 dereferenceable(20) %7) #4
  br label %33

26:                                               ; preds = %22
  %27 = zext nneg i32 %18 to i64
  %28 = getelementptr inbounds i8, ptr %13, i64 %27
  %29 = sub nsw i32 %14, %18
  %30 = call noundef ptr @_ZNK4juce11MidiMessage10getRawDataEv(ptr noundef nonnull align 8 dereferenceable(20) %7) #4
  %31 = load i8, ptr %30, align 1, !tbaa !9
  %.not = icmp ugt i8 %31, -17
  %spec.select = select i1 %.not, i8 %.02437, i8 %31
  call void @_ZN4juce11MidiMessageD1Ev(ptr noundef nonnull align 8 dereferenceable(20) %7) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #4
  %32 = icmp sgt i32 %29, 0
  br i1 %32, label %.lr.ph, label %.loopexit

33:                                               ; preds = %24, %20
  %.pn = phi { ptr, i32 } [ %25, %24 ], [ %21, %20 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #4
  br label %38

.loopexit:                                        ; preds = %26, %3, %.thread
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %8) #4
  call void @_ZNK4juce10OwnedArrayINS_19MidiMessageSequence15MidiEventHolderENS_20DummyCriticalSectionEE4sortINS_15MidiFileHelpers6SorterEEEvRT_b(ptr noundef nonnull align 8 dereferenceable(20) %4, ptr noundef nonnull align 1 dereferenceable(1) %8, i1 noundef zeroext true) #4
  invoke void @_ZN4juce8MidiFile8addTrackERKNS_19MidiMessageSequenceE(ptr noundef nonnull align 8 dereferenceable(26) %0, ptr noundef nonnull align 8 dereferenceable(24) %4)
          to label %34 unwind label %36

34:                                               ; preds = %.loopexit
  %35 = call noundef ptr @_ZNK4juce10OwnedArrayINS_19MidiMessageSequenceENS_20DummyCriticalSectionEE7getLastEv(ptr noundef nonnull align 8 dereferenceable(20) %0) #4
  call void @_ZN4juce19MidiMessageSequence18updateMatchedPairsEv(ptr noundef nonnull align 8 dereferenceable(24) %35) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %8) #4
  call void @_ZN4juce19MidiMessageSequenceD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #4
  ret void

36:                                               ; preds = %.loopexit
  %37 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %8) #4
  br label %38

38:                                               ; preds = %36, %33
  %.pn29 = phi { ptr, i32 } [ %37, %36 ], [ %.pn, %33 ]
  call void @_ZN4juce19MidiMessageSequenceD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #4
  resume { ptr, i32 } %.pn29
}

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN4juce19MidiMessageSequence8addEventERKNS_11MidiMessageEd(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(20), double noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNK4juce10OwnedArrayINS_19MidiMessageSequence15MidiEventHolderENS_20DummyCriticalSectionEE4sortINS_15MidiFileHelpers6SorterEEEvRT_b(ptr noundef nonnull align 8 dereferenceable(20), ptr noundef nonnull align 1 dereferenceable(1), i1 noundef zeroext) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK4juce10OwnedArrayINS_19MidiMessageSequenceENS_20DummyCriticalSectionEE7getLastEv(ptr noundef nonnull align 8 dereferenceable(20)) local_unnamed_addr #3 align 2

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

declare void @_ZN4juce11MidiMessageC1EPKviRihdb(ptr, ptr, i32, ptr, i8, double, i1) local_unnamed_addr

declare void @_ZN4juce11MidiMessageD1Ev(ptr) local_unnamed_addr

declare void @_ZN4juce19MidiMessageSequenceC1Ev(ptr) local_unnamed_addr

declare void @_ZN4juce19MidiMessageSequenceD1Ev(ptr) local_unnamed_addr

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


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