; LLVM IR from software-mansion/react-native-audio-api :: packages/react-native-audio-api/common/cpp/audioapi/dsp (AudioUtils)

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef float @_ZN8audioapi3dsp17linearInterpolateEPKfmmf(ptr noundef %0, i64 noundef %1, i64 noundef %2, float noundef %3) #0 {
  %5 = alloca float, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca float, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i64 %1, ptr %7, align 8, !tbaa !9
  store i64 %2, ptr %8, align 8, !tbaa !9
  store float %3, ptr %9, align 4, !tbaa !11
  %10 = load i64, ptr %7, align 8, !tbaa !9
  %11 = load i64, ptr %8, align 8, !tbaa !9
  %12 = icmp eq i64 %10, %11
  br i1 %12, label %13, label %33

13:                                               ; preds = %4
  %14 = load i64, ptr %7, align 8, !tbaa !9
  %15 = icmp uge i64 %14, 1
  br i1 %15, label %16, label %33

16:                                               ; preds = %13
  %17 = load ptr, ptr %6, align 8, !tbaa !5
  %18 = load i64, ptr %7, align 8, !tbaa !9
  %19 = getelementptr inbounds float, ptr %17, i64 %18
  %20 = load float, ptr %19, align 4, !tbaa !11
  %21 = load float, ptr %9, align 4, !tbaa !11
  %22 = load ptr, ptr %6, align 8, !tbaa !5
  %23 = load i64, ptr %7, align 8, !tbaa !9
  %24 = getelementptr inbounds float, ptr %22, i64 %23
  %25 = load float, ptr %24, align 4, !tbaa !11
  %26 = load ptr, ptr %6, align 8, !tbaa !5
  %27 = load i64, ptr %7, align 8, !tbaa !9
  %28 = sub i64 %27, 1
  %29 = getelementptr inbounds float, ptr %26, i64 %28
  %30 = load float, ptr %29, align 4, !tbaa !11
  %31 = fsub float %25, %30
  %32 = call float @llvm.fmuladd.f32(float %21, float %31, float %20)
  store float %32, ptr %5, align 4
  br label %49

33:                                               ; preds = %13, %4
  %34 = load ptr, ptr %6, align 8, !tbaa !5
  %35 = load i64, ptr %7, align 8, !tbaa !9
  %36 = getelementptr inbounds float, ptr %34, i64 %35
  %37 = load float, ptr %36, align 4, !tbaa !11
  %38 = load float, ptr %9, align 4, !tbaa !11
  %39 = load ptr, ptr %6, align 8, !tbaa !5
  %40 = load i64, ptr %8, align 8, !tbaa !9
  %41 = getelementptr inbounds float, ptr %39, i64 %40
  %42 = load float, ptr %41, align 4, !tbaa !11
  %43 = load ptr, ptr %6, align 8, !tbaa !5
  %44 = load i64, ptr %7, align 8, !tbaa !9
  %45 = getelementptr inbounds float, ptr %43, i64 %44
  %46 = load float, ptr %45, align 4, !tbaa !11
  %47 = fsub float %42, %46
  %48 = call float @llvm.fmuladd.f32(float %38, float %47, float %37)
  store float %48, ptr %5, align 4
  br label %49

49:                                               ; preds = %33, %16
  %50 = load float, ptr %5, align 4
  ret float %50
}

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

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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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 = !{!"long", !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"

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local noundef float @_ZN8audioapi3dsp17linearInterpolateEPKfmmf(ptr nocapture noundef readonly %0, i64 noundef %1, i64 noundef %2, float noundef %3) local_unnamed_addr #0 {
  %5 = icmp eq i64 %1, %2
  %6 = icmp ne i64 %1, 0
  %or.cond = and i1 %6, %5
  %7 = getelementptr inbounds float, ptr %0, i64 %1
  %8 = load float, ptr %7, align 4, !tbaa !5
  br i1 %or.cond, label %9, label %13

9:                                                ; preds = %4
  %10 = getelementptr i8, ptr %7, i64 -4
  %11 = load float, ptr %10, align 4, !tbaa !5
  %12 = fsub float %8, %11
  br label %17

13:                                               ; preds = %4
  %14 = getelementptr inbounds float, ptr %0, i64 %2
  %15 = load float, ptr %14, align 4, !tbaa !5
  %16 = fsub float %15, %8
  br label %17

17:                                               ; preds = %13, %9
  %.sink = phi float [ %16, %13 ], [ %12, %9 ]
  %18 = tail call float @llvm.fmuladd.f32(float %3, float %.sink, float %8)
  ret float %18
}

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

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

!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"}


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