#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 rsQuat_make(float *q, float a, float x, float y, float z) {
  if (a < 0.000001f && a > -0.000001f) {
    q[0] = 0.0f;
    q[1] = 0.0f;
    q[2] = 0.0f;
    q[3] = 1.0f;
  } else {
    float sintheta;
    a *= 0.5f;
    sintheta = sin(a);
    q[0] = sintheta * x;
    q[1] = sintheta * y;
    q[2] = sintheta * z;
    q[3] = cos(a);
  }
}


x86 assembly (clang, -O0):
<rsQuat_make>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movss  %xmm1,-0x10(%rbp)
movss  %xmm2,-0x14(%rbp)
movss  %xmm3,-0x18(%rbp)
movss  0xeb8(%rip),%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    11a1 <rsQuat_make+0x81>
movss  -0xc(%rbp),%xmm0
movss  0xea5(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    11a1 <rsQuat_make+0x81>
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0x4(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
movss  0xe75(%rip),%xmm0
movss  %xmm0,0xc(%rax)
jmp    120d <rsQuat_make+0xed>
movss  0xe5f(%rip),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
call   1030 <sin@plt>
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
mulss  -0x10(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x1c(%rbp),%xmm0
mulss  -0x14(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x4(%rax)
movss  -0x1c(%rbp),%xmm0
mulss  -0x18(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x8(%rax)
movss  -0xc(%rbp),%xmm0
call   1040 <cos@plt>
mov    -0x8(%rbp),%rax
movss  %xmm0,0xc(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rsQuat_make>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
movss  0xed0(%rip),%xmm4
ucomiss %xmm0,%xmm4
jbe    1156 <rsQuat_make+0x36>
ucomiss 0xec8(%rip),%xmm0
jbe    1156 <rsQuat_make+0x36>
movq   $0x0,(%rbx)
movl   $0x0,0x8(%rbx)
movss  0xeb8(%rip),%xmm0
jmp    11b0 <rsQuat_make+0x90>
mulss  0xeaa(%rip),%xmm0
movss  %xmm0,0xc(%rsp)
movss  %xmm3,0x8(%rsp)
movss  %xmm2,0x4(%rsp)
movss  %xmm1,(%rsp)
call   1030 <sin@plt>
movss  (%rsp),%xmm1
mulss  %xmm0,%xmm1
movss  %xmm1,(%rbx)
movss  0x4(%rsp),%xmm1
mulss  %xmm0,%xmm1
movss  %xmm1,0x4(%rbx)
movss  0x8(%rsp),%xmm1
mulss  %xmm0,%xmm1
movss  %xmm1,0x8(%rbx)
movss  0xc(%rsp),%xmm0
call   1040 <cos@plt>
movss  %xmm0,0xc(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @rsQuat_make(float* %0, float %1, float %2, float %3, float %4) {
%6 = alloca float*
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
store float* %0, float** %6
store float %1, float* %7
store float %2, float* %8
store float %3, float* %9
store float %4, float* %10
%12 = load float, float* %7
%13 = fcmp olt float %12, 0x3EB0C6F7A0000000
br i1 %13, label %14, label %26
14: ; preds = %5
%15 = load float, float* %7
%16 = fcmp ogt float %15, 0xBEB0C6F7A0000000
br i1 %16, label %17, label %26
17: ; preds = %14
%18 = load float*, float** %6
%19 = getelementptr inbounds float, float* %18, i64 0
store float 0.000000e+00, float* %19
%20 = load float*, float** %6
%21 = getelementptr inbounds float, float* %20, i64 1
store float 0.000000e+00, float* %21
%22 = load float*, float** %6
%23 = getelementptr inbounds float, float* %22, i64 2
store float 0.000000e+00, float* %23
%24 = load float*, float** %6
%25 = getelementptr inbounds float, float* %24, i64 3
store float 1.000000e+00, float* %25
br label %50
26: ; preds = %14, %5
%27 = load float, float* %7
%28 = fmul float %27, 5.000000e-01
store float %28, float* %7
%29 = load float, float* %7
%30 = call float @sin(float %29)
store float %30, float* %11
%31 = load float, float* %11
%32 = load float, float* %8
%33 = fmul float %31, %32
%34 = load float*, float** %6
%35 = getelementptr inbounds float, float* %34, i64 0
store float %33, float* %35
%36 = load float, float* %11
%37 = load float, float* %9
%38 = fmul float %36, %37
%39 = load float*, float** %6
%40 = getelementptr inbounds float, float* %39, i64 1
store float %38, float* %40
%41 = load float, float* %11
%42 = load float, float* %10
%43 = fmul float %41, %42
%44 = load float*, float** %6
%45 = getelementptr inbounds float, float* %44, i64 2
store float %43, float* %45
%46 = load float, float* %7
%47 = call float @cos(float %46)
%48 = load float*, float** %6
%49 = getelementptr inbounds float, float* %48, i64 3
store float %47, float* %49
br label %50
50: ; preds = %26, %17
ret void
}

LLVM IR (-O2):
define void @rsQuat_make(float* nocapture writeonly %0, float %1, float %2, float %3, float %4) {
%6 = fcmp olt float %1, 0x3EB0C6F7A0000000
%7 = fcmp ogt float %1, 0xBEB0C6F7A0000000
%8 = and i1 %6, %7
br i1 %8, label %9, label %12
9: ; preds = %5
store float 0.000000e+00, float* %0
%10 = getelementptr inbounds float, float* %0, i64 1
store float 0.000000e+00, float* %10
%11 = getelementptr inbounds float, float* %0, i64 2
store float 0.000000e+00, float* %11
br label %21
12: ; preds = %5
%13 = fmul float %1, 5.000000e-01
%14 = tail call float @sin(float %13)
%15 = fmul float %14, %2
store float %15, float* %0
%16 = fmul float %14, %3
%17 = getelementptr inbounds float, float* %0, i64 1
store float %16, float* %17
%18 = fmul float %14, %4
%19 = getelementptr inbounds float, float* %0, i64 2
store float %18, float* %19
%20 = tail call float @cos(float %13)
br label %21
21: ; preds = %12, %9
%22 = phi float [ 1.000000e+00, %9 ], [ %20, %12 ]
%23 = getelementptr inbounds float, float* %0, i64 3
store float %22, float* %23
ret void
}