#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 math_degrees_to_radians(float);
float sin(float);
void math_unit_vector(float yaw, float pitch, float *x, float *y, float *z) {
  yaw = math_degrees_to_radians(yaw);
  pitch = math_degrees_to_radians(pitch);
  *x = -cos(pitch) * sin(yaw);
  *y = -sin(pitch);
  *z = cos(pitch) * cos(yaw);
}


x86 assembly (clang, -O0):
<math_unit_vector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movss  -0x4(%rbp),%xmm0
call   1050 <math_degrees_to_radians@plt>
movss  %xmm0,-0x4(%rbp)
movss  -0x8(%rbp),%xmm0
call   1050 <math_degrees_to_radians@plt>
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
call   1040 <cos@plt>
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movss  -0x28(%rbp),%xmm0
mulss  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x8(%rbp),%xmm0
call   1030 <sin@plt>
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x8(%rbp),%xmm0
call   1040 <cos@plt>
movss  %xmm0,-0x24(%rbp)
movss  -0x4(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movss  -0x24(%rbp),%xmm0
mulss  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movss  %xmm0,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<math_unit_vector>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
movss  %xmm1,0x8(%rsp)
call   1050 <math_degrees_to_radians@plt>
movss  %xmm0,0xc(%rsp)
movss  0x8(%rsp),%xmm0
call   1050 <math_degrees_to_radians@plt>
movss  %xmm0,0x8(%rsp)
call   1040 <cos@plt>
xorps  0xe90(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movss  0xc(%rsp),%xmm0
call   1030 <sin@plt>
mulss  0x10(%rsp),%xmm0
movss  %xmm0,(%rbx)
movss  0x8(%rsp),%xmm0
call   1030 <sin@plt>
xorps  0xe64(%rip),%xmm0
movss  %xmm0,(%r15)
movss  0x8(%rsp),%xmm0
call   1040 <cos@plt>
movss  %xmm0,0x8(%rsp)
movss  0xc(%rsp),%xmm0
call   1040 <cos@plt>
mulss  0x8(%rsp),%xmm0
movss  %xmm0,(%r14)
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @math_unit_vector(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*
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
%11 = load float, float* %6
%12 = call float @math_degrees_to_radians(float %11)
store float %12, float* %6
%13 = load float, float* %7
%14 = call float @math_degrees_to_radians(float %13)
store float %14, float* %7
%15 = load float, float* %7
%16 = call float @cos(float %15)
%17 = fneg float %16
%18 = load float, float* %6
%19 = call float @sin(float %18)
%20 = fmul float %17, %19
%21 = load float*, float** %8
store float %20, float* %21
%22 = load float, float* %7
%23 = call float @sin(float %22)
%24 = fneg float %23
%25 = load float*, float** %9
store float %24, float* %25
%26 = load float, float* %7
%27 = call float @cos(float %26)
%28 = load float, float* %6
%29 = call float @cos(float %28)
%30 = fmul float %27, %29
%31 = load float*, float** %10
store float %30, float* %31
ret void
}

LLVM IR (-O2):
define void @math_unit_vector(float %0, float %1, float* nocapture writeonly %2, float* nocapture writeonly %3, float* nocapture writeonly %4) {
%6 = tail call float @math_degrees_to_radians(float %0)
%7 = tail call float @math_degrees_to_radians(float %1)
%8 = tail call float @cos(float %7)
%9 = fneg float %8
%10 = tail call float @sin(float %6)
%11 = fmul float %10, %9
store float %11, float* %2
%12 = tail call float @sin(float %7)
%13 = fneg float %12
store float %13, float* %3
%14 = tail call float @cos(float %7)
%15 = tail call float @cos(float %6)
%16 = fmul float %14, %15
store float %16, float* %4
ret void
}