#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 AxisAngToQuaternion(double omg[3], double theta, double q[4]) {
  q[0] = cos(theta / 2.0);
  q[1] = omg[0] * sin(theta / 2.0);
  q[2] = omg[1] * sin(theta / 2.0);
  q[3] = omg[2] * sin(theta / 2.0);
  return;
}


x86 assembly (clang, -O0):
<AxisAngToQuaternion>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xebe(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1040 <cos@plt>
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xe93(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xe5a(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x10(%rax)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xe21(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x18(%rax)
add    $0x30,%rsp
pop    %rbp
ret

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

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

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