void reverse_matrix(double *matrix) {
  double swap;
  swap = matrix[1];
  matrix[1] = matrix[4];
  matrix[4] = swap;
  swap = matrix[2];
  matrix[2] = matrix[8];
  matrix[8] = swap;
  swap = matrix[6];
  matrix[6] = matrix[9];
  matrix[9] = swap;
  matrix[3] = -matrix[3];
  matrix[7] = -matrix[7];
  matrix[11] = -matrix[11];
}


x86 assembly (clang, -O0):
<reverse_matrix>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x20(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x10(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x20(%rax)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x40(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x10(%rax)
movsd  -0x10(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x40(%rax)
mov    -0x8(%rbp),%rax
movsd  0x30(%rax),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x48(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x30(%rax)
movsd  -0x10(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x48(%rax)
mov    -0x8(%rbp),%rax
movsd  0x18(%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x18(%rax)
mov    -0x8(%rbp),%rax
movsd  0x38(%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x38(%rax)
mov    -0x8(%rbp),%rax
movsd  0x58(%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x58(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<reverse_matrix>:
movsd  0x20(%rdi),%xmm0
movsd  0x8(%rdi),%xmm1
movsd  0x10(%rdi),%xmm2
movsd  %xmm0,0x8(%rdi)
movsd  %xmm1,0x20(%rdi)
movsd  0x40(%rdi),%xmm0
movsd  %xmm0,0x10(%rdi)
movsd  %xmm2,0x40(%rdi)
movsd  0x30(%rdi),%xmm0
movsd  0x48(%rdi),%xmm1
movsd  %xmm1,0x30(%rdi)
movsd  %xmm0,0x48(%rdi)
movsd  0x18(%rdi),%xmm0
movaps 0xeb8(%rip),%xmm1
xorps  %xmm1,%xmm0
movlps %xmm0,0x18(%rdi)
movsd  0x38(%rdi),%xmm0
xorps  %xmm1,%xmm0
movlps %xmm0,0x38(%rdi)
movsd  0x58(%rdi),%xmm0
xorps  %xmm1,%xmm0
movlps %xmm0,0x58(%rdi)
ret

LLVM IR (-O0):
define void @reverse_matrix(double* %0) {
%2 = alloca double*
%3 = alloca double
store double* %0, double** %2
%4 = load double*, double** %2
%5 = getelementptr inbounds double, double* %4, i64 1
%6 = load double, double* %5
store double %6, double* %3
%7 = load double*, double** %2
%8 = getelementptr inbounds double, double* %7, i64 4
%9 = load double, double* %8
%10 = load double*, double** %2
%11 = getelementptr inbounds double, double* %10, i64 1
store double %9, double* %11
%12 = load double, double* %3
%13 = load double*, double** %2
%14 = getelementptr inbounds double, double* %13, i64 4
store double %12, double* %14
%15 = load double*, double** %2
%16 = getelementptr inbounds double, double* %15, i64 2
%17 = load double, double* %16
store double %17, double* %3
%18 = load double*, double** %2
%19 = getelementptr inbounds double, double* %18, i64 8
%20 = load double, double* %19
%21 = load double*, double** %2
%22 = getelementptr inbounds double, double* %21, i64 2
store double %20, double* %22
%23 = load double, double* %3
%24 = load double*, double** %2
%25 = getelementptr inbounds double, double* %24, i64 8
store double %23, double* %25
%26 = load double*, double** %2
%27 = getelementptr inbounds double, double* %26, i64 6
%28 = load double, double* %27
store double %28, double* %3
%29 = load double*, double** %2
%30 = getelementptr inbounds double, double* %29, i64 9
%31 = load double, double* %30
%32 = load double*, double** %2
%33 = getelementptr inbounds double, double* %32, i64 6
store double %31, double* %33
%34 = load double, double* %3
%35 = load double*, double** %2
%36 = getelementptr inbounds double, double* %35, i64 9
store double %34, double* %36
%37 = load double*, double** %2
%38 = getelementptr inbounds double, double* %37, i64 3
%39 = load double, double* %38
%40 = fneg double %39
%41 = load double*, double** %2
%42 = getelementptr inbounds double, double* %41, i64 3
store double %40, double* %42
%43 = load double*, double** %2
%44 = getelementptr inbounds double, double* %43, i64 7
%45 = load double, double* %44
%46 = fneg double %45
%47 = load double*, double** %2
%48 = getelementptr inbounds double, double* %47, i64 7
store double %46, double* %48
%49 = load double*, double** %2
%50 = getelementptr inbounds double, double* %49, i64 11
%51 = load double, double* %50
%52 = fneg double %51
%53 = load double*, double** %2
%54 = getelementptr inbounds double, double* %53, i64 11
store double %52, double* %54
ret void
}

LLVM IR (-O2):
define void @reverse_matrix(double* nocapture %0) {
%2 = getelementptr inbounds double, double* %0, i64 1
%3 = load double, double* %2
%4 = getelementptr inbounds double, double* %0, i64 4
%5 = load double, double* %4
store double %5, double* %2
store double %3, double* %4
%6 = getelementptr inbounds double, double* %0, i64 2
%7 = load double, double* %6
%8 = getelementptr inbounds double, double* %0, i64 8
%9 = load double, double* %8
store double %9, double* %6
store double %7, double* %8
%10 = getelementptr inbounds double, double* %0, i64 6
%11 = load double, double* %10
%12 = getelementptr inbounds double, double* %0, i64 9
%13 = load double, double* %12
store double %13, double* %10
store double %11, double* %12
%14 = getelementptr inbounds double, double* %0, i64 3
%15 = load double, double* %14
%16 = fneg double %15
store double %16, double* %14
%17 = getelementptr inbounds double, double* %0, i64 7
%18 = load double, double* %17
%19 = fneg double %18
store double %19, double* %17
%20 = getelementptr inbounds double, double* %0, i64 11
%21 = load double, double* %20
%22 = fneg double %21
store double %22, double* %20
ret void
}