#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 cosf(float);
float sinf(float);
void quaternion_aroundAxis(float out[4], const float axis[3], float angle) {
  const float s = sinf(angle / 2.0f);
  out[0] = s * axis[0];
  out[1] = s * axis[1];
  out[2] = s * axis[2];
  out[3] = cosf(angle / 2.0f);
}


x86 assembly (clang, -O0):
<quaternion_aroundAxis>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
movss  0xebe(%rip),%xmm1
divss  %xmm1,%xmm0
call   1030 <sinf@plt>
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mulss  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x18(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mulss  0x4(%rax),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x4(%rax)
movss  -0x18(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mulss  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x8(%rax)
movss  -0x14(%rbp),%xmm0
movss  0xe60(%rip),%xmm1
divss  %xmm1,%xmm0
call   1040 <cosf@plt>
mov    -0x8(%rbp),%rax
movss  %xmm0,0xc(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quaternion_aroundAxis>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mulss  0xece(%rip),%xmm0
movss  %xmm0,0x4(%rsp)
call   1030 <sinf@plt>
movss  (%r14),%xmm1
mulss  %xmm0,%xmm1
movss  %xmm1,(%rbx)
movss  0x4(%r14),%xmm1
mulss  %xmm0,%xmm1
movss  %xmm1,0x4(%rbx)
mulss  0x8(%r14),%xmm0
movss  %xmm0,0x8(%rbx)
movss  0x4(%rsp),%xmm0
call   1040 <cosf@plt>
movss  %xmm0,0xc(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

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