#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 */
float cos(float);
float glmRadf(float);
float sin(float);
void glmQuaternionFromAxisAndAnglefDeg(float q[4], const float axis[3],
                                       float angle) {
  float sine;
  angle = glmRadf(angle);
  sine = sin(angle / 2.0);
  q[0] = cos(angle / 2.0);
  q[1] = axis[0] * sine;
  q[2] = axis[1] * sine;
  q[3] = axis[2] * sine;
}


x86 assembly (clang, -O0):
<glmQuaternionFromAxisAndAnglefDeg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
call   1030 <glmRadf@plt>
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe9b(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1040 <sin@plt>
movss  %xmm0,-0x18(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe78(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1050 <cos@plt>
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
mulss  -0x18(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x4(%rax)
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm0
mulss  -0x18(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x8(%rax)
mov    -0x10(%rbp),%rax
movss  0x8(%rax),%xmm0
mulss  -0x18(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0xc(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<glmQuaternionFromAxisAndAnglefDeg>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <glmRadf@plt>
mulss  0xeb9(%rip),%xmm0
movss  %xmm0,(%rsp)
call   1040 <sin@plt>
movss  %xmm0,0x4(%rsp)
movss  (%rsp),%xmm0
call   1050 <cos@plt>
movss  %xmm0,(%rbx)
movss  (%r14),%xmm0
movss  0x4(%rsp),%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,0x4(%rbx)
movss  0x4(%r14),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,0x8(%rbx)
mulss  0x8(%r14),%xmm1
movss  %xmm1,0xc(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @glmQuaternionFromAxisAndAnglefDeg(float* %0, float* %1, float %2) {
%4 = alloca float*
%5 = alloca float*
%6 = alloca float
%7 = alloca float
store float* %0, float** %4
store float* %1, float** %5
store float %2, float* %6
%8 = load float, float* %6
%9 = call float @glmRadf(float %8)
store float %9, float* %6
%10 = load float, float* %6
%11 = fpext float %10 to double
%12 = fdiv double %11, 2.000000e+00
%13 = fptrunc double %12 to float
%14 = call float @sin(float %13)
store float %14, float* %7
%15 = load float, float* %6
%16 = fpext float %15 to double
%17 = fdiv double %16, 2.000000e+00
%18 = fptrunc double %17 to float
%19 = call float @cos(float %18)
%20 = load float*, float** %4
%21 = getelementptr inbounds float, float* %20, i64 0
store float %19, float* %21
%22 = load float*, float** %5
%23 = getelementptr inbounds float, float* %22, i64 0
%24 = load float, float* %23
%25 = load float, float* %7
%26 = fmul float %24, %25
%27 = load float*, float** %4
%28 = getelementptr inbounds float, float* %27, i64 1
store float %26, float* %28
%29 = load float*, float** %5
%30 = getelementptr inbounds float, float* %29, i64 1
%31 = load float, float* %30
%32 = load float, float* %7
%33 = fmul float %31, %32
%34 = load float*, float** %4
%35 = getelementptr inbounds float, float* %34, i64 2
store float %33, float* %35
%36 = load float*, float** %5
%37 = getelementptr inbounds float, float* %36, i64 2
%38 = load float, float* %37
%39 = load float, float* %7
%40 = fmul float %38, %39
%41 = load float*, float** %4
%42 = getelementptr inbounds float, float* %41, i64 3
store float %40, float* %42
ret void
}

LLVM IR (-O2):
define void @glmQuaternionFromAxisAndAnglefDeg(float* nocapture writeonly %0, float* nocapture %1, float %2) {
%4 = tail call float @glmRadf(float %2)
%5 = fmul float %4, 5.000000e-01
%6 = tail call float @sin(float %5)
%7 = tail call float @cos(float %5)
store float %7, float* %0
%8 = load float, float* %1
%9 = fmul float %6, %8
%10 = getelementptr inbounds float, float* %0, i64 1
store float %9, float* %10
%11 = getelementptr inbounds float, float* %1, i64 1
%12 = load float, float* %11
%13 = fmul float %6, %12
%14 = getelementptr inbounds float, float* %0, i64 2
store float %13, float* %14
%15 = getelementptr inbounds float, float* %1, i64 2
%16 = load float, float* %15
%17 = fmul float %6, %16
%18 = getelementptr inbounds float, float* %0, i64 3
store float %17, float* %18
ret void
}