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

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