void rotate(double **a, long i, long j, long k, long l, double *g, double *h,
            double s, double tau) {
  *g = a[i][j];
  *h = a[k][l];
  a[i][j] = *g - s * (*h + *g * tau);
  a[k][l] = *h + s * (*g - *h * tau);
}


x86 assembly (clang, -O0):
<rotate>:
push   %rbp
mov    %rsp,%rbp
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movsd  %xmm0,-0x38(%rbp)
movsd  %xmm1,-0x40(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x30(%rbp),%rax
movsd  (%rax),%xmm1
movsd  -0x38(%rbp),%xmm0
mov    0x10(%rbp),%rax
movsd  (%rax),%xmm3
mov    -0x30(%rbp),%rax
movsd  (%rax),%xmm2
movsd  -0x40(%rbp),%xmm4
mulsd  %xmm4,%xmm2
addsd  %xmm3,%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    0x10(%rbp),%rax
movsd  (%rax),%xmm1
movsd  -0x38(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movsd  (%rax),%xmm3
mov    0x10(%rbp),%rax
movsd  (%rax),%xmm2
movsd  -0x40(%rbp),%xmm4
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
mulsd  %xmm4,%xmm2
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x28(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rotate>:
mov    0x8(%rsp),%rax
mov    (%rdi,%rsi,8),%rsi
movsd  (%rsi,%rdx,8),%xmm2
movsd  %xmm2,(%r9)
mov    (%rdi,%rcx,8),%rcx
movsd  (%rcx,%r8,8),%xmm2
movsd  %xmm2,(%rax)
movsd  (%r9),%xmm3
movapd %xmm3,%xmm4
mulsd  %xmm1,%xmm4
addsd  %xmm2,%xmm4
mulsd  %xmm0,%xmm4
subsd  %xmm4,%xmm3
movsd  %xmm3,(%rsi,%rdx,8)
movsd  (%rax),%xmm2
movsd  (%r9),%xmm3
mulsd  %xmm2,%xmm1
subsd  %xmm1,%xmm3
mulsd  %xmm0,%xmm3
addsd  %xmm2,%xmm3
movsd  %xmm3,(%rcx,%r8,8)
ret

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

LLVM IR (-O2):
define void @rotate(double** nocapture %0, i64 %1, i64 %2, i64 %3, i64 %4, double* nocapture %5, double* nocapture %6, double %7, double %8) {
%10 = getelementptr inbounds double*, double** %0, i64 %1
%11 = load double*, double** %10
%12 = getelementptr inbounds double, double* %11, i64 %2
%13 = load double, double* %12
store double %13, double* %5
%14 = getelementptr inbounds double*, double** %0, i64 %3
%15 = load double*, double** %14
%16 = getelementptr inbounds double, double* %15, i64 %4
%17 = load double, double* %16
store double %17, double* %6
%18 = load double, double* %5
%19 = tail call double @llvm.fmuladd.f64(double %18, double %8, double %17)
%20 = fneg double %7
%21 = tail call double @llvm.fmuladd.f64(double %20, double %19, double %18)
store double %21, double* %12
%22 = load double, double* %6
%23 = load double, double* %5
%24 = fneg double %22
%25 = tail call double @llvm.fmuladd.f64(double %24, double %8, double %23)
%26 = tail call double @llvm.fmuladd.f64(double %7, double %25, double %22)
store double %26, double* %16
ret void
}