double grmhd_disp_f(double v, double C1, double C2, double C3, double C4,
                    double bei, double vi, double b0, double bi) {
  double a = v - vi;
  double B = b0 * v - bi;
  double n = v + bei;
  double f1 = C1 * a * a * a * a;
  double f2 = C2 - n * n;
  double f3 = -C3 * a * a + C4 * B * B;
  return f1 + f2 * f3;
}


x86 assembly (clang, -O0):
<grmhd_disp_f>:
push   %rbp
mov    %rsp,%rbp
movsd  0x10(%rbp),%xmm8
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  %xmm5,-0x30(%rbp)
movsd  %xmm6,-0x38(%rbp)
movsd  %xmm7,-0x40(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm2
movsd  0x10(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x8(%rbp),%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x18(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm1
mulsd  -0x50(%rbp),%xmm1
mulsd  -0x50(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x60(%rbp),%xmm1
movsd  -0x68(%rbp),%xmm0
movsd  -0x70(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<grmhd_disp_f>:
mulsd  %xmm0,%xmm7
addsd  %xmm0,%xmm5
subsd  %xmm6,%xmm0
subsd  0x8(%rsp),%xmm7
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm5,%xmm5
subsd  %xmm5,%xmm2
mulsd  %xmm0,%xmm3
mulsd  %xmm7,%xmm4
mulsd  %xmm7,%xmm4
mulsd  %xmm0,%xmm3
subsd  %xmm3,%xmm4
mulsd  %xmm2,%xmm4
addsd  %xmm1,%xmm4
movapd %xmm4,%xmm0
ret

LLVM IR (-O0):
define double @grmhd_disp_f(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, double %8) {
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca double
%23 = alloca double
%24 = alloca double
store double %0, double* %10
store double %1, double* %11
store double %2, double* %12
store double %3, double* %13
store double %4, double* %14
store double %5, double* %15
store double %6, double* %16
store double %7, double* %17
store double %8, double* %18
%25 = load double, double* %10
%26 = load double, double* %16
%27 = fsub double %25, %26
store double %27, double* %19
%28 = load double, double* %17
%29 = load double, double* %10
%30 = load double, double* %18
%31 = fneg double %30
%32 = call double @llvm.fmuladd.f64(double %28, double %29, double %31)
store double %32, double* %20
%33 = load double, double* %10
%34 = load double, double* %15
%35 = fadd double %33, %34
store double %35, double* %21
%36 = load double, double* %11
%37 = load double, double* %19
%38 = fmul double %36, %37
%39 = load double, double* %19
%40 = fmul double %38, %39
%41 = load double, double* %19
%42 = fmul double %40, %41
%43 = load double, double* %19
%44 = fmul double %42, %43
store double %44, double* %22
%45 = load double, double* %12
%46 = load double, double* %21
%47 = load double, double* %21
%48 = fneg double %46
%49 = call double @llvm.fmuladd.f64(double %48, double %47, double %45)
store double %49, double* %23
%50 = load double, double* %13
%51 = fneg double %50
%52 = load double, double* %19
%53 = fmul double %51, %52
%54 = load double, double* %19
%55 = load double, double* %14
%56 = load double, double* %20
%57 = fmul double %55, %56
%58 = load double, double* %20
%59 = fmul double %57, %58
%60 = call double @llvm.fmuladd.f64(double %53, double %54, double %59)
store double %60, double* %24
%61 = load double, double* %22
%62 = load double, double* %23
%63 = load double, double* %24
%64 = call double @llvm.fmuladd.f64(double %62, double %63, double %61)
ret double %64
}

LLVM IR (-O2):
define double @grmhd_disp_f(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, double %8) {
%10 = fsub double %0, %6
%11 = fneg double %8
%12 = tail call double @llvm.fmuladd.f64(double %7, double %0, double %11)
%13 = fadd double %0, %5
%14 = fmul double %10, %1
%15 = fmul double %10, %14
%16 = fmul double %10, %15
%17 = fmul double %10, %16
%18 = fneg double %13
%19 = tail call double @llvm.fmuladd.f64(double %18, double %13, double %2)
%20 = fneg double %3
%21 = fmul double %10, %20
%22 = fmul double %12, %4
%23 = fmul double %12, %22
%24 = tail call double @llvm.fmuladd.f64(double %21, double %10, double %23)
%25 = tail call double @llvm.fmuladd.f64(double %19, double %24, double %17)
ret double %25
}