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

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

@_ZZNK4juce21MidiKeyboardComponent14getKeyPositionEifRiS1_E7notePos = external hidden constant [12 x float], align 16

; 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
define dso_local void @_ZNK4juce21MidiKeyboardComponent14getKeyPositionEifRiS1_(ptr noundef nonnull align 8 dereferenceable(560) %0, i32 noundef %1, float noundef %2, ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %4) unnamed_addr #1 align 2 {
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca float, align 4
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i32 %1, ptr %7, align 4, !tbaa !9
  store float %2, ptr %8, align 4, !tbaa !11
  store ptr %3, ptr %9, align 8, !tbaa !5
  store ptr %4, ptr %10, align 8, !tbaa !5
  %13 = load ptr, ptr %6, align 8
  br label %14

14:                                               ; preds = %5
  br label %15

15:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %16 = load i32, ptr %7, align 4, !tbaa !9
  %17 = sdiv i32 %16, 12
  store i32 %17, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  %18 = load i32, ptr %7, align 4, !tbaa !9
  %19 = srem i32 %18, 12
  store i32 %19, ptr %12, align 4, !tbaa !9
  %20 = load i32, ptr %11, align 4, !tbaa !9
  %21 = sitofp i32 %20 to float
  %22 = fmul float %21, 7.000000e+00
  %23 = load float, ptr %8, align 4, !tbaa !11
  %24 = load i32, ptr %12, align 4, !tbaa !9
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [12 x float], ptr @_ZZNK4juce21MidiKeyboardComponent14getKeyPositionEifRiS1_E7notePos, i64 0, i64 %25
  %27 = load float, ptr %26, align 4, !tbaa !11
  %28 = load float, ptr %8, align 4, !tbaa !11
  %29 = fmul float %27, %28
  %30 = call float @llvm.fmuladd.f32(float %22, float %23, float %29)
  %31 = call noundef i32 @_ZN4juce10roundToIntIfEEiT_(float noundef %30) #4
  %32 = load ptr, ptr %9, align 8, !tbaa !5
  store i32 %31, ptr %32, align 4, !tbaa !9
  %33 = load i32, ptr %12, align 4, !tbaa !9
  %34 = call noundef zeroext i1 @_ZN4juce11MidiMessage15isMidiNoteBlackEi(i32 noundef %33) #4
  br i1 %34, label %35, label %38

35:                                               ; preds = %15
  %36 = load float, ptr %8, align 4, !tbaa !11
  %37 = fmul float 0x3FE6666660000000, %36
  br label %40

38:                                               ; preds = %15
  %39 = load float, ptr %8, align 4, !tbaa !11
  br label %40

40:                                               ; preds = %38, %35
  %41 = phi float [ %37, %35 ], [ %39, %38 ]
  %42 = call noundef i32 @_ZN4juce10roundToIntIfEEiT_(float noundef %41) #4
  %43 = load ptr, ptr %10, align 8, !tbaa !5
  store i32 %42, ptr %43, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN4juce10roundToIntIfEEiT_(float noundef) #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #2

; Function Attrs: nounwind
declare noundef zeroext i1 @_ZN4juce11MidiMessage15isMidiNoteBlackEi(i32 noundef) #3

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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { 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 #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 = !{!"float", !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"

@_ZZNK4juce21MidiKeyboardComponent14getKeyPositionEifRiS1_E7notePos = external hidden local_unnamed_addr constant [12 x float], align 16

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZNK4juce21MidiKeyboardComponent14getKeyPositionEifRiS1_(ptr nocapture noundef nonnull readnone align 8 dereferenceable(560) %0, i32 noundef %1, float noundef %2, ptr nocapture noundef nonnull writeonly align 4 dereferenceable(4) %3, ptr nocapture noundef nonnull writeonly align 4 dereferenceable(4) %4) unnamed_addr #0 align 2 {
  %6 = sdiv i32 %1, 12
  %7 = srem i32 %1, 12
  %8 = sitofp i32 %6 to float
  %9 = fmul float %8, 7.000000e+00
  %10 = sext i32 %7 to i64
  %11 = getelementptr inbounds [12 x float], ptr @_ZZNK4juce21MidiKeyboardComponent14getKeyPositionEifRiS1_E7notePos, i64 0, i64 %10
  %12 = load float, ptr %11, align 4, !tbaa !5
  %13 = fmul float %12, %2
  %14 = tail call float @llvm.fmuladd.f32(float %9, float %2, float %13)
  %15 = tail call noundef i32 @_ZN4juce10roundToIntIfEEiT_(float noundef %14) #3
  store i32 %15, ptr %3, align 4, !tbaa !9
  %16 = tail call noundef zeroext i1 @_ZN4juce11MidiMessage15isMidiNoteBlackEi(i32 noundef %7) #3
  %17 = fmul float %2, 0x3FE6666660000000
  %18 = select i1 %16, float %17, float %2
  %19 = tail call noundef i32 @_ZN4juce10roundToIntIfEEiT_(float noundef %18) #3
  store i32 %19, ptr %4, align 4, !tbaa !9
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN4juce10roundToIntIfEEiT_(float noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #1

; Function Attrs: nounwind
declare noundef zeroext i1 @_ZN4juce11MidiMessage15isMidiNoteBlackEi(i32 noundef) local_unnamed_addr #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 nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { 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 #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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}


; Effective O3 passes: GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass