void rotate(x, y, z, ax, ay, az) double *x, *y, *z;
double ax, ay, az;
{
  double xp, yp, zp;
  xp = *x * cos(az) - *y * sin(az);
  yp = *x * sin(az) + *y * cos(az);
  *x = xp;
  *y = yp;
  yp = *y * cos(ax) - *z * sin(ax);
  zp = *y * sin(ax) + *z * cos(ax);
  *y = yp;
  *z = zp;
  zp = *z * cos(ay) - *x * sin(ay);
  xp = *z * sin(ay) + *x * cos(ay);
  *z = zp;
  *x = xp;
}


x86 assembly (clang, -O0):
<rotate>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movsd  %xmm0,-0x20(%rbp)
movsd  %xmm1,-0x28(%rbp)
movsd  %xmm2,-0x30(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  -0x30(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0xd0(%rbp)
ff
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
movsd  -0x30(%rbp),%xmm0
call   1030 <sin@plt>
movsd  -0xd8(%rbp),%xmm1
ff
movsd  -0xd0(%rbp),%xmm2
ff
movaps %xmm0,%xmm3
movsd  -0xc8(%rbp),%xmm0
ff
mulsd  %xmm3,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0x30(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0xb8(%rbp)
ff
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0x30(%rbp),%xmm0
call   1040 <cos@plt>
movsd  -0xc0(%rbp),%xmm1
ff
movsd  -0xb8(%rbp),%xmm2
ff
movaps %xmm0,%xmm3
movsd  -0xb0(%rbp),%xmm0
ff
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x40(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x20(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0xa0(%rbp)
ff
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x20(%rbp),%xmm0
call   1030 <sin@plt>
movsd  -0xa8(%rbp),%xmm1
ff
movsd  -0xa0(%rbp),%xmm2
ff
movaps %xmm0,%xmm3
movsd  -0x98(%rbp),%xmm0
ff
mulsd  %xmm3,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x20(%rbp),%xmm0
call   1040 <cos@plt>
movsd  -0x90(%rbp),%xmm1
ff
movsd  -0x88(%rbp),%xmm2
ff
movaps %xmm0,%xmm3
movsd  -0x80(%rbp),%xmm0
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x48(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0x70(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1030 <sin@plt>
movsd  -0x78(%rbp),%xmm1
movsd  -0x70(%rbp),%xmm2
movaps %xmm0,%xmm3
movsd  -0x68(%rbp),%xmm0
mulsd  %xmm3,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x58(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1040 <cos@plt>
movsd  -0x60(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm2
movaps %xmm0,%xmm3
movsd  -0x50(%rbp),%xmm0
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x48(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x38(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rotate>:
push   %r15
push   %r14
push   %rbx
sub    $0x40,%rsp
movsd  %xmm2,0x10(%rsp)
movsd  %xmm1,0x30(%rsp)
movsd  %xmm0,0x20(%rsp)
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
movsd  (%rdi),%xmm0
movsd  %xmm0,0x18(%rsp)
movaps %xmm2,%xmm0
call   1040 <cos@plt>
movsd  %xmm0,0x8(%rsp)
movsd  (%rbx),%xmm0
movsd  %xmm0,0x28(%rsp)
movsd  0x10(%rsp),%xmm0
call   1030 <sin@plt>
mulsd  0x28(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
mulsd  0x18(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  (%r15),%xmm0
movsd  %xmm0,0x28(%rsp)
movsd  0x10(%rsp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,0x18(%rsp)
movsd  (%rbx),%xmm0
movsd  %xmm0,0x38(%rsp)
movsd  0x10(%rsp),%xmm0
call   1040 <cos@plt>
mulsd  0x38(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
mulsd  0x28(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x18(%rsp)
movsd  0x8(%rsp),%xmm0
movsd  %xmm0,(%r15)
movsd  %xmm1,(%rbx)
movsd  0x20(%rsp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,0x10(%rsp)
movsd  (%r14),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x20(%rsp),%xmm0
call   1030 <sin@plt>
mulsd  0x8(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
mulsd  0x18(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
movsd  (%rbx),%xmm0
movsd  %xmm0,0x18(%rsp)
movsd  0x20(%rsp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,0x8(%rsp)
movsd  (%r14),%xmm0
movsd  %xmm0,0x28(%rsp)
movsd  0x20(%rsp),%xmm0
call   1040 <cos@plt>
mulsd  0x28(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
mulsd  0x18(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
movsd  %xmm0,(%rbx)
movsd  %xmm1,(%r14)
movsd  0x30(%rsp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,0x20(%rsp)
movsd  (%r15),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x30(%rsp),%xmm0
call   1030 <sin@plt>
mulsd  0x10(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
mulsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x20(%rsp)
movsd  (%r14),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x30(%rsp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,0x8(%rsp)
movsd  (%r15),%xmm0
movsd  %xmm0,0x18(%rsp)
movsd  0x30(%rsp),%xmm0
call   1040 <cos@plt>
mulsd  0x18(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
mulsd  0x10(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  0x20(%rsp),%xmm0
movsd  %xmm0,(%r14)
movsd  %xmm1,(%r15)
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @rotate(double* %0, double* %1, double* %2, double %3, double %4, double %5) {
%7 = alloca double*
%8 = alloca double*
%9 = alloca double*
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
store double* %0, double** %7
store double* %1, double** %8
store double* %2, double** %9
store double %3, double* %10
store double %4, double* %11
store double %5, double* %12
%16 = load double*, double** %7
%17 = load double, double* %16
%18 = load double, double* %12
%19 = call double @cos(double %18)
%20 = load double*, double** %8
%21 = load double, double* %20
%22 = load double, double* %12
%23 = call double @sin(double %22)
%24 = fmul double %21, %23
%25 = fneg double %24
%26 = call double @llvm.fmuladd.f64(double %17, double %19, double %25)
store double %26, double* %13
%27 = load double*, double** %7
%28 = load double, double* %27
%29 = load double, double* %12
%30 = call double @sin(double %29)
%31 = load double*, double** %8
%32 = load double, double* %31
%33 = load double, double* %12
%34 = call double @cos(double %33)
%35 = fmul double %32, %34
%36 = call double @llvm.fmuladd.f64(double %28, double %30, double %35)
store double %36, double* %14
%37 = load double, double* %13
%38 = load double*, double** %7
store double %37, double* %38
%39 = load double, double* %14
%40 = load double*, double** %8
store double %39, double* %40
%41 = load double*, double** %8
%42 = load double, double* %41
%43 = load double, double* %10
%44 = call double @cos(double %43)
%45 = load double*, double** %9
%46 = load double, double* %45
%47 = load double, double* %10
%48 = call double @sin(double %47)
%49 = fmul double %46, %48
%50 = fneg double %49
%51 = call double @llvm.fmuladd.f64(double %42, double %44, double %50)
store double %51, double* %14
%52 = load double*, double** %8
%53 = load double, double* %52
%54 = load double, double* %10
%55 = call double @sin(double %54)
%56 = load double*, double** %9
%57 = load double, double* %56
%58 = load double, double* %10
%59 = call double @cos(double %58)
%60 = fmul double %57, %59
%61 = call double @llvm.fmuladd.f64(double %53, double %55, double %60)
store double %61, double* %15
%62 = load double, double* %14
%63 = load double*, double** %8
store double %62, double* %63
%64 = load double, double* %15
%65 = load double*, double** %9
store double %64, double* %65
%66 = load double*, double** %9
%67 = load double, double* %66
%68 = load double, double* %11
%69 = call double @cos(double %68)
%70 = load double*, double** %7
%71 = load double, double* %70
%72 = load double, double* %11
%73 = call double @sin(double %72)
%74 = fmul double %71, %73
%75 = fneg double %74
%76 = call double @llvm.fmuladd.f64(double %67, double %69, double %75)
store double %76, double* %15
%77 = load double*, double** %9
%78 = load double, double* %77
%79 = load double, double* %11
%80 = call double @sin(double %79)
%81 = load double*, double** %7
%82 = load double, double* %81
%83 = load double, double* %11
%84 = call double @cos(double %83)
%85 = fmul double %82, %84
%86 = call double @llvm.fmuladd.f64(double %78, double %80, double %85)
store double %86, double* %13
%87 = load double, double* %15
%88 = load double*, double** %9
store double %87, double* %88
%89 = load double, double* %13
%90 = load double*, double** %7
store double %89, double* %90
ret void
}

LLVM IR (-O2):
define void @rotate(double* nocapture %0, double* nocapture %1, double* nocapture %2, double %3, double %4, double %5) {
%7 = load double, double* %0
%8 = tail call double @cos(double %5)
%9 = load double, double* %1
%10 = tail call double @sin(double %5)
%11 = fneg double %9
%12 = fmul double %10, %11
%13 = tail call double @llvm.fmuladd.f64(double %7, double %8, double %12)
%14 = load double, double* %0
%15 = tail call double @sin(double %5)
%16 = load double, double* %1
%17 = tail call double @cos(double %5)
%18 = fmul double %16, %17
%19 = tail call double @llvm.fmuladd.f64(double %14, double %15, double %18)
store double %13, double* %0
store double %19, double* %1
%20 = tail call double @cos(double %3)
%21 = load double, double* %2
%22 = tail call double @sin(double %3)
%23 = fneg double %21
%24 = fmul double %22, %23
%25 = tail call double @llvm.fmuladd.f64(double %19, double %20, double %24)
%26 = load double, double* %1
%27 = tail call double @sin(double %3)
%28 = load double, double* %2
%29 = tail call double @cos(double %3)
%30 = fmul double %28, %29
%31 = tail call double @llvm.fmuladd.f64(double %26, double %27, double %30)
store double %25, double* %1
store double %31, double* %2
%32 = tail call double @cos(double %4)
%33 = load double, double* %0
%34 = tail call double @sin(double %4)
%35 = fneg double %33
%36 = fmul double %34, %35
%37 = tail call double @llvm.fmuladd.f64(double %31, double %32, double %36)
%38 = load double, double* %2
%39 = tail call double @sin(double %4)
%40 = load double, double* %0
%41 = tail call double @cos(double %4)
%42 = fmul double %40, %41
%43 = tail call double @llvm.fmuladd.f64(double %38, double %39, double %42)
store double %37, double* %2
store double %43, double* %0
ret void
}