#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 sin(float);
void glmQuaternionFromAxisAndAnglefRad(float q[4], const float axis[3],
                                       float angle) {
  float 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):
<glmQuaternionFromAxisAndAnglefRad>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xeba(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1030 <sin@plt>
movss  %xmm0,-0x18(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe97(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1040 <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):
<glmQuaternionFromAxisAndAnglefRad>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mulss  0xece(%rip),%xmm0
movss  %xmm0,(%rsp)
call   1030 <sin@plt>
movss  %xmm0,0x4(%rsp)
movss  (%rsp),%xmm0
call   1040 <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 @glmQuaternionFromAxisAndAnglefRad(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 = fpext float %8 to double
%10 = fdiv double %9, 2.000000e+00
%11 = fptrunc double %10 to float
%12 = call float @sin(float %11)
store float %12, float* %7
%13 = load float, float* %6
%14 = fpext float %13 to double
%15 = fdiv double %14, 2.000000e+00
%16 = fptrunc double %15 to float
%17 = call float @cos(float %16)
%18 = load float*, float** %4
%19 = getelementptr inbounds float, float* %18, i64 0
store float %17, float* %19
%20 = load float*, float** %5
%21 = getelementptr inbounds float, float* %20, i64 0
%22 = load float, float* %21
%23 = load float, float* %7
%24 = fmul float %22, %23
%25 = load float*, float** %4
%26 = getelementptr inbounds float, float* %25, i64 1
store float %24, float* %26
%27 = load float*, float** %5
%28 = getelementptr inbounds float, float* %27, i64 1
%29 = load float, float* %28
%30 = load float, float* %7
%31 = fmul float %29, %30
%32 = load float*, float** %4
%33 = getelementptr inbounds float, float* %32, i64 2
store float %31, float* %33
%34 = load float*, float** %5
%35 = getelementptr inbounds float, float* %34, i64 2
%36 = load float, float* %35
%37 = load float, float* %7
%38 = fmul float %36, %37
%39 = load float*, float** %4
%40 = getelementptr inbounds float, float* %39, i64 3
store float %38, float* %40
ret void
}

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