unsigned long long foo2(unsigned long long addr, double a0, double a1,
                        double a2, double a3, double a4, double a5, double a6,
                        double a7) {
  register double b0 asm("xmm0");
  register double b1 asm("xmm1");
  register double b2 asm("xmm2");
  register double b3 asm("xmm3");
  register double b4 asm("xmm4");
  register double b5 asm("xmm5");
  register double b6 asm("xmm6");
  register double b7 asm("xmm7");
  register unsigned long long result asm("rax");
  b0 = a0;
  b1 = a1;
  b2 = a2;
  b3 = a3;
  b4 = a4;
  b5 = a5;
  b6 = a6;
  b7 = a7;
  asm("call *%1"
      : "=r"(result)
      : "r"(addr), "x"(b0), "x"(b1), "x"(b2), "x"(b3), "x"(b4), "x"(b5),
        "x"(b6), "x"(b7));
  return result;
}


x86 assembly (clang, -O0):
<foo2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  %xmm3,-0x28(%rbp)
movsd  %xmm4,-0x30(%rbp)
movsd  %xmm5,-0x38(%rbp)
movsd  %xmm6,-0x40(%rbp)
movsd  %xmm7,-0x48(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x8(%rbp),%rax
movsd  -0x50(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm1
movsd  -0x60(%rbp),%xmm2
movsd  -0x68(%rbp),%xmm3
movsd  -0x70(%rbp),%xmm4
movsd  -0x78(%rbp),%xmm5
movsd  -0x80(%rbp),%xmm6
movsd  -0x88(%rbp),%xmm7
ff
call   *%rax
mov    %rax,-0x90(%rbp)
mov    -0x90(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo2>:
call   *%rdi
ret

LLVM IR (-O0):
define i64 @foo2(i64 %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, double %8) {
%10 = alloca i64
%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
%25 = alloca double
%26 = alloca double
%27 = alloca i64
store i64 %0, i64* %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
%28 = load double, double* %11
store double %28, double* %19
%29 = load double, double* %12
store double %29, double* %20
%30 = load double, double* %13
store double %30, double* %21
%31 = load double, double* %14
store double %31, double* %22
%32 = load double, double* %15
store double %32, double* %23
%33 = load double, double* %16
store double %33, double* %24
%34 = load double, double* %17
store double %34, double* %25
%35 = load double, double* %18
store double %35, double* %26
%36 = load i64, i64* %10
%37 = load double, double* %19
%38 = load double, double* %20
%39 = load double, double* %21
%40 = load double, double* %22
%41 = load double, double* %23
%42 = load double, double* %24
%43 = load double, double* %25
%44 = load double, double* %26
%45 = call i64 asm "call *$1", "={rax},r,{xmm0},{xmm1},{xmm2},{xmm3},{xmm4},{xmm5},{xmm6},{xmm7},~{dirflag},~{fpsr},~{flags}"(i64 %36, double %37, double %38, double %39, double %40, double %41, double %42, double %43, double %44)
store i64 %45, i64* %27
%46 = load i64, i64* %27
ret i64 %46
}

LLVM IR (-O2):
define i64 @foo2(i64 %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, double %8) {
%10 = tail call i64 asm "call *$1", "={rax},r,{xmm0},{xmm1},{xmm2},{xmm3},{xmm4},{xmm5},{xmm6},{xmm7},~{dirflag},~{fpsr},~{flags}"(i64 %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, double %8)
ret i64 %10
}