; 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::String" = type { %"class.juce::CharPointer_UTF8" }
%"class.juce::CharPointer_UTF8" = type { ptr }

@_ZZN4juce11MidiMessage15getMidiNoteNameEibbiE14sharpNoteNames = external hidden constant [12 x ptr], align 16
@_ZZN4juce11MidiMessage15getMidiNoteNameEibbiE13flatNoteNames = external hidden constant [12 x ptr], align 16

declare i32 @__gxx_personality_v0(...)

declare void @_ZN4juce6StringC1EPKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) unnamed_addr #0

; Function Attrs: nounwind
declare void @_ZN4juce6StringD1Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN4juce18isPositiveAndBelowIiEEbT_S1_(i32 noundef, i32 noundef) #2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4juce11MidiMessage15getMidiNoteNameEibbi(ptr dead_on_unwind noalias writable sret(%"class.juce::String") align 8 %0, i32 noundef %1, i1 noundef zeroext %2, i1 noundef zeroext %3, i32 noundef %4) #3 align 2 personality ptr @__gxx_personality_v0 {
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i8, align 1
  %9 = alloca i8, align 1
  %10 = alloca i32, align 4
  %11 = alloca i1, align 1
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  store ptr %0, ptr %6, align 8
  store i32 %1, ptr %7, align 4, !tbaa !5
  %14 = zext i1 %2 to i8
  store i8 %14, ptr %8, align 1, !tbaa !9
  %15 = zext i1 %3 to i8
  store i8 %15, ptr %9, align 1, !tbaa !9
  store i32 %4, ptr %10, align 4, !tbaa !5
  %16 = load i32, ptr %7, align 4, !tbaa !5
  %17 = call noundef zeroext i1 @_ZN4juce18isPositiveAndBelowIiEEbT_S1_(i32 noundef %16, i32 noundef 128) #4
  br i1 %17, label %18, label %53

18:                                               ; preds = %5
  store i1 false, ptr %11, align 1
  %19 = load i8, ptr %8, align 1, !tbaa !9, !range !11, !noundef !12
  %20 = trunc i8 %19 to i1
  br i1 %20, label %21, label %27

21:                                               ; preds = %18
  %22 = load i32, ptr %7, align 4, !tbaa !5
  %23 = srem i32 %22, 12
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [12 x ptr], ptr @_ZZN4juce11MidiMessage15getMidiNoteNameEibbiE14sharpNoteNames, i64 0, i64 %24
  %26 = load ptr, ptr %25, align 8, !tbaa !13
  br label %33

27:                                               ; preds = %18
  %28 = load i32, ptr %7, align 4, !tbaa !5
  %29 = srem i32 %28, 12
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [12 x ptr], ptr @_ZZN4juce11MidiMessage15getMidiNoteNameEibbiE13flatNoteNames, i64 0, i64 %30
  %32 = load ptr, ptr %31, align 8, !tbaa !13
  br label %33

33:                                               ; preds = %27, %21
  %34 = phi ptr [ %26, %21 ], [ %32, %27 ]
  call void @_ZN4juce6StringC1EPKc(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef %34)
  %35 = load i8, ptr %9, align 1, !tbaa !9, !range !11, !noundef !12
  %36 = trunc i8 %35 to i1
  br i1 %36, label %37, label %49

37:                                               ; preds = %33
  %38 = load i32, ptr %7, align 4, !tbaa !5
  %39 = sdiv i32 %38, 12
  %40 = load i32, ptr %10, align 4, !tbaa !5
  %41 = sub nsw i32 %40, 5
  %42 = add nsw i32 %39, %41
  %43 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN4jucelsERNS_6StringEi(ptr noundef nonnull align 8 dereferenceable(8) %0, i32 noundef %42)
          to label %44 unwind label %45

44:                                               ; preds = %37
  br label %49

45:                                               ; preds = %37
  %46 = landingpad { ptr, i32 }
          cleanup
  %47 = extractvalue { ptr, i32 } %46, 0
  store ptr %47, ptr %12, align 8
  %48 = extractvalue { ptr, i32 } %46, 1
  store i32 %48, ptr %13, align 4
  call void @_ZN4juce6StringD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %0) #4
  br label %55

49:                                               ; preds = %44, %33
  store i1 true, ptr %11, align 1
  %50 = load i1, ptr %11, align 1
  br i1 %50, label %52, label %51

51:                                               ; preds = %49
  call void @_ZN4juce6StringD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %0) #4
  br label %52

52:                                               ; preds = %51, %49
  br label %54

53:                                               ; preds = %5
  call void @_ZN4juce6StringC1Ev(ptr noundef nonnull align 8 dereferenceable(8) %0) #4
  br label %54

54:                                               ; preds = %53, %52
  ret void

55:                                               ; preds = %45
  %56 = load ptr, ptr %12, align 8
  %57 = load i32, ptr %13, align 4
  %58 = insertvalue { ptr, i32 } poison, ptr %56, 0
  %59 = insertvalue { ptr, i32 } %58, i32 %57, 1
  resume { ptr, i32 } %59
}

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZN4jucelsERNS_6StringEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #0

; Function Attrs: nounwind
declare void @_ZN4juce6StringC1Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1

attributes #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 = { nounwind "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 = { 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 #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 = { 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 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}
!13 = !{!14, !14, i64 0}
!14 = !{!"any pointer", !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"

%"class.juce::String" = type { %"class.juce::CharPointer_UTF8" }
%"class.juce::CharPointer_UTF8" = type { ptr }

@_ZZN4juce11MidiMessage15getMidiNoteNameEibbiE14sharpNoteNames = external hidden local_unnamed_addr constant [12 x ptr], align 16
@_ZZN4juce11MidiMessage15getMidiNoteNameEibbiE13flatNoteNames = external hidden local_unnamed_addr constant [12 x ptr], align 16

declare i32 @__gxx_personality_v0(...)

declare void @_ZN4juce6StringC1EPKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) unnamed_addr #0

; Function Attrs: nounwind
declare void @_ZN4juce6StringD1Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN4juce18isPositiveAndBelowIiEEbT_S1_(i32 noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4juce11MidiMessage15getMidiNoteNameEibbi(ptr dead_on_unwind noalias writable sret(%"class.juce::String") align 8 %0, i32 noundef %1, i1 noundef zeroext %2, i1 noundef zeroext %3, i32 noundef %4) local_unnamed_addr #3 align 2 personality ptr @__gxx_personality_v0 {
  %6 = tail call noundef zeroext i1 @_ZN4juce18isPositiveAndBelowIiEEbT_S1_(i32 noundef %1, i32 noundef 128) #4
  br i1 %6, label %7, label %19

7:                                                ; preds = %5
  %8 = srem i32 %1, 12
  %9 = sdiv i32 %1, 12
  %10 = sext i32 %8 to i64
  %_ZZN4juce11MidiMessage15getMidiNoteNameEibbiE14sharpNoteNames._ZZN4juce11MidiMessage15getMidiNoteNameEibbiE13flatNoteNames = select i1 %2, ptr @_ZZN4juce11MidiMessage15getMidiNoteNameEibbiE14sharpNoteNames, ptr @_ZZN4juce11MidiMessage15getMidiNoteNameEibbiE13flatNoteNames
  %11 = getelementptr inbounds [12 x ptr], ptr %_ZZN4juce11MidiMessage15getMidiNoteNameEibbiE14sharpNoteNames._ZZN4juce11MidiMessage15getMidiNoteNameEibbiE13flatNoteNames, i64 0, i64 %10
  %12 = load ptr, ptr %11, align 8, !tbaa !5
  tail call void @_ZN4juce6StringC1EPKc(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef %12)
  br i1 %3, label %13, label %20

13:                                               ; preds = %7
  %14 = add nsw i32 %9, -5
  %15 = add i32 %14, %4
  %16 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN4jucelsERNS_6StringEi(ptr noundef nonnull align 8 dereferenceable(8) %0, i32 noundef %15)
          to label %20 unwind label %17

17:                                               ; preds = %13
  %18 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZN4juce6StringD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %0) #4
  resume { ptr, i32 } %18

19:                                               ; preds = %5
  tail call void @_ZN4juce6StringC1Ev(ptr noundef nonnull align 8 dereferenceable(8) %0) #4
  br label %20

20:                                               ; preds = %7, %13, %19
  ret void
}

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZN4jucelsERNS_6StringEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind
declare void @_ZN4juce6StringC1Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1

attributes #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 = { nounwind "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 = { 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 #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 = { 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"}


; Effective O3 passes: DivRemPairsPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InstCombinePass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass