#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
double cos(double);
double sin(double);
int /*<<< orphan*/ vcopy(float const *, float *);
int /*<<< orphan*/ vnormal(float *);
int /*<<< orphan*/ vscale(float *, float);
void axis_to_quat(float *a, float phi, float *q) {
  double tmp;
  double tmp___0;
  {
    vnormal((float *)a);
    vcopy((float const *)a, (float *)q);
    tmp = sin((double)phi / 2.0);
    vscale((float *)q, (float)tmp);
    tmp___0 = cos((double)phi / 2.0);
    *(q + 3) = (float)tmp___0;
    return;
  }
}


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
call   1030 <vnormal@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1070 <vcopy@plt>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe74(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
movsd  -0x20(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
call   1060 <vscale@plt>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe43(%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
call   1030 <vnormal@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1070 <vcopy@plt>
movss  (%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xe80(%rip),%xmm0
movsd  %xmm0,(%rsp)
call   1040 <sin@plt>
cvtsd2ss %xmm0,%xmm0
mov    %r14,%rdi
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 @vnormal(float* %9)
%11 = load float*, float** %4
%12 = load float*, float** %6
%13 = call i32 @vcopy(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 = call i32 @vscale(float* %18, float %20)
%22 = load float, float* %5
%23 = fpext float %22 to double
%24 = fdiv double %23, 2.000000e+00
%25 = call double @cos(double %24)
store double %25, double* %8
%26 = load double, double* %8
%27 = fptrunc double %26 to float
%28 = load float*, float** %6
%29 = getelementptr inbounds float, float* %28, i64 3
store float %27, float* %29
ret void
}

LLVM IR (-O2):
define void @axis_to_quat(float* %0, float %1, float* %2) {
%4 = tail call i32 @vnormal(float* %0)
%5 = tail call i32 @vcopy(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 = tail call i32 @vscale(float* %2, float %9)
%11 = tail call double @cos(double %7)
%12 = fptrunc double %11 to float
%13 = getelementptr inbounds float, float* %2, i64 3
store float %12, float* %13
ret void
}