void glmColorFromVectorf(float color[3], const float vector[3]) {
  color[0] = (vector[0] + 1) / 2.0;
  color[1] = (vector[1] + 1) / 2.0;
  color[2] = (vector[2] + 1) / 2.0;
}


x86 assembly (clang, -O0):
<glmColorFromVectorf>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movss  0xef0(%rip),%xmm0
addss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xed8(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movss  0xec4(%rip),%xmm0
addss  0x4(%rax),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xeab(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x4(%rax)
mov    -0x10(%rbp),%rax
movss  0xe96(%rip),%xmm0
addss  0x8(%rax),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe7d(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x8(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<glmColorFromVectorf>:
movss  0xef8(%rip),%xmm0
movss  (%rsi),%xmm1
addss  %xmm0,%xmm1
movss  0xeec(%rip),%xmm2
mulss  %xmm2,%xmm1
movss  %xmm1,(%rdi)
movss  0x4(%rsi),%xmm1
addss  %xmm0,%xmm1
mulss  %xmm2,%xmm1
movss  %xmm1,0x4(%rdi)
addss  0x8(%rsi),%xmm0
mulss  %xmm2,%xmm0
movss  %xmm0,0x8(%rdi)
ret

LLVM IR (-O0):
define void @glmColorFromVectorf(float* %0, float* %1) {
%3 = alloca float*
%4 = alloca float*
store float* %0, float** %3
store float* %1, float** %4
%5 = load float*, float** %4
%6 = getelementptr inbounds float, float* %5, i64 0
%7 = load float, float* %6
%8 = fadd float %7, 1.000000e+00
%9 = fpext float %8 to double
%10 = fdiv double %9, 2.000000e+00
%11 = fptrunc double %10 to float
%12 = load float*, float** %3
%13 = getelementptr inbounds float, float* %12, i64 0
store float %11, float* %13
%14 = load float*, float** %4
%15 = getelementptr inbounds float, float* %14, i64 1
%16 = load float, float* %15
%17 = fadd float %16, 1.000000e+00
%18 = fpext float %17 to double
%19 = fdiv double %18, 2.000000e+00
%20 = fptrunc double %19 to float
%21 = load float*, float** %3
%22 = getelementptr inbounds float, float* %21, i64 1
store float %20, float* %22
%23 = load float*, float** %4
%24 = getelementptr inbounds float, float* %23, i64 2
%25 = load float, float* %24
%26 = fadd float %25, 1.000000e+00
%27 = fpext float %26 to double
%28 = fdiv double %27, 2.000000e+00
%29 = fptrunc double %28 to float
%30 = load float*, float** %3
%31 = getelementptr inbounds float, float* %30, i64 2
store float %29, float* %31
ret void
}

LLVM IR (-O2):
define void @glmColorFromVectorf(float* nocapture writeonly %0, float* nocapture %1) {
%3 = load float, float* %1
%4 = fadd float %3, 1.000000e+00
%5 = fmul float %4, 5.000000e-01
store float %5, float* %0
%6 = getelementptr inbounds float, float* %1, i64 1
%7 = load float, float* %6
%8 = fadd float %7, 1.000000e+00
%9 = fmul float %8, 5.000000e-01
%10 = getelementptr inbounds float, float* %0, i64 1
store float %9, float* %10
%11 = getelementptr inbounds float, float* %1, i64 2
%12 = load float, float* %11
%13 = fadd float %12, 1.000000e+00
%14 = fmul float %13, 5.000000e-01
%15 = getelementptr inbounds float, float* %0, i64 2
store float %14, float* %15
ret void
}