void glmGenerateNormalizedInverseQuaterniond(double result[4],
                                             const double q[4]) {
  result[0] = q[0];
  result[1] = -q[1];
  result[2] = -q[2];
  result[3] = -q[3];
}


x86 assembly (clang, -O0):
<glmGenerateNormalizedInverseQuaterniond>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x10(%rax)
mov    -0x10(%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)
pop    %rbp
ret

x86 assembly (clang, -O2):
<glmGenerateNormalizedInverseQuaterniond>:
movsd  (%rsi),%xmm0
movsd  %xmm0,(%rdi)
movsd  0x8(%rsi),%xmm0
movaps 0xeec(%rip),%xmm1
xorps  %xmm1,%xmm0
movlps %xmm0,0x8(%rdi)
movsd  0x10(%rsi),%xmm0
xorps  %xmm1,%xmm0
movlps %xmm0,0x10(%rdi)
movsd  0x18(%rsi),%xmm0
xorps  %xmm1,%xmm0
movlps %xmm0,0x18(%rdi)
ret

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

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