#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);
void glmQuaternionFromAxisAndAngledRad(double q[4], const double axis[3],
                                       double angle) {
  double 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):
<glmQuaternionFromAxisAndAngledRad>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xebe(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xea3(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1040 <cos@plt>
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mulsd  -0x20(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mulsd  -0x20(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x10(%rax)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
mulsd  -0x20(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x18(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<glmQuaternionFromAxisAndAngledRad>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
mulsd  0xecb(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
call   1030 <sin@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,(%rbx)
movsd  (%r14),%xmm0
movsd  0x10(%rsp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rbx)
movsd  0x8(%r14),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rbx)
mulsd  0x10(%r14),%xmm1
movsd  %xmm1,0x18(%rbx)
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

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

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