int quatInversef(float *q, float *qout) {
  int i;
  qout[0] = q[0];
  for (i = 1; i < 4; ++i) {
    qout[i] = -1.0 * q[i] + 0.0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<quatInversef>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
movl   $0x1,-0x14(%rbp)
cmpl   $0x4,-0x14(%rbp)
jge    1164 <quatInversef+0x64>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1123 <quatInversef+0x23>
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<quatInversef>:
movss  (%rdi),%xmm0
movss  %xmm0,(%rsi)
movss  0x4(%rdi),%xmm0
cvtss2sd %xmm0,%xmm0
xorpd  %xmm1,%xmm1
subsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
xorpd  %xmm1,%xmm1
movss  %xmm0,0x4(%rsi)
movss  0x8(%rdi),%xmm0
cvtss2sd %xmm0,%xmm0
xorpd  %xmm2,%xmm2
subsd  %xmm0,%xmm2
xorps  %xmm0,%xmm0
cvtsd2ss %xmm2,%xmm0
movss  %xmm0,0x8(%rsi)
movss  0xc(%rdi),%xmm0
cvtss2sd %xmm0,%xmm0
subsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
movss  %xmm0,0xc(%rsi)
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @quatInversef(float* %0, float* %1) {
%3 = alloca float*
%4 = alloca float*
%5 = alloca i32
store float* %0, float** %3
store float* %1, float** %4
%6 = load float*, float** %3
%7 = getelementptr inbounds float, float* %6, i64 0
%8 = load float, float* %7
%9 = load float*, float** %4
%10 = getelementptr inbounds float, float* %9, i64 0
store float %8, float* %10
store i32 1, i32* %5
br label %11
11: ; preds = %27, %2
%12 = load i32, i32* %5
%13 = icmp slt i32 %12, 4
br i1 %13, label %14, label %30
14: ; preds = %11
%15 = load float*, float** %3
%16 = load i32, i32* %5
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds float, float* %15, i64 %17
%19 = load float, float* %18
%20 = fpext float %19 to double
%21 = call double @llvm.fmuladd.f64(double -1.000000e+00, double %20, double 0.000000e+00)
%22 = fptrunc double %21 to float
%23 = load float*, float** %4
%24 = load i32, i32* %5
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds float, float* %23, i64 %25
store float %22, float* %26
br label %27
27: ; preds = %14
%28 = load i32, i32* %5
%29 = add nsw i32 %28, 1
store i32 %29, i32* %5
br label %11
30: ; preds = %11
ret i32 1
}

LLVM IR (-O2):
define i32 @quatInversef(float* nocapture %0, float* nocapture writeonly %1) {
%3 = load float, float* %0
store float %3, float* %1
%4 = getelementptr inbounds float, float* %0, i64 1
%5 = load float, float* %4
%6 = fpext float %5 to double
%7 = tail call double @llvm.fmuladd.f64(double %6, double -1.000000e+00, double 0.000000e+00)
%8 = fptrunc double %7 to float
%9 = getelementptr inbounds float, float* %1, i64 1
store float %8, float* %9
%10 = getelementptr inbounds float, float* %0, i64 2
%11 = load float, float* %10
%12 = fpext float %11 to double
%13 = tail call double @llvm.fmuladd.f64(double %12, double -1.000000e+00, double 0.000000e+00)
%14 = fptrunc double %13 to float
%15 = getelementptr inbounds float, float* %1, i64 2
store float %14, float* %15
%16 = getelementptr inbounds float, float* %0, i64 3
%17 = load float, float* %16
%18 = fpext float %17 to double
%19 = tail call double @llvm.fmuladd.f64(double %18, double -1.000000e+00, double 0.000000e+00)
%20 = fptrunc double %19 to float
%21 = getelementptr inbounds float, float* %1, i64 3
store float %20, float* %21
ret i32 1
}