void axis_to_quat(float *a, float phi, float *q) {
  vnormal(a);
  vcopy(a, q);
  double return_value_sin$1;
  return_value_sin$1 = sin((double)phi / 2.000000);
  vscale(q, (float)return_value_sin$1);
  double return_value_cos$2;
  return_value_cos$2 = cos((double)phi / 2.000000);
  q[(signed long int)3] = (float)return_value_cos$2;
}


x86 assembly (clang, -O0):
<axis_to_quat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1030 <vnormal@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1070 <vcopy@plt>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe70(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
movsd  -0x20(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
mov    $0x1,%al
call   1060 <vscale@plt>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe39(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1050 <cos@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,0xc(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<axis_to_quat>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
movss  %xmm0,(%rsp)
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <vnormal@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1070 <vcopy@plt>
movss  (%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xe7c(%rip),%xmm0
movsd  %xmm0,(%rsp)
call   1040 <sin@plt>
cvtsd2ss %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1060 <vscale@plt>
movsd  (%rsp),%xmm0
call   1050 <cos@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0xc(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @axis_to_quat(float* %0, float %1, float* %2) {
%4 = tail call i32 (float*, ...) bitcast (i32 (...)* @vnormal to i32 (float*, ...)*)(float* %0)
%5 = tail call i32 (float*, float*, ...) bitcast (i32 (...)* @vcopy to i32 (float*, float*, ...)*)(float* %0, float* %2)
%6 = fpext float %1 to double
%7 = fmul double %6, 5.000000e-01
%8 = tail call double @sin(double %7)
%9 = fptrunc double %8 to float
%10 = fpext float %9 to double
%11 = tail call i32 (float*, double, ...) bitcast (i32 (...)* @vscale to i32 (float*, double, ...)*)(float* %2, double %10)
%12 = tail call double @cos(double %7)
%13 = fptrunc double %12 to float
%14 = getelementptr inbounds float, float* %2, i64 3
store float %13, float* %14
ret void
}