#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 polar2xyz(double range, double above, double about, double *x, double *y,
               double *z) {
  about -= 90;
  *x = range * cos(above * 0.0174532925) * cos(about * 0.0174532925);
  *y = range * cos(above * 0.0174532925) * sin(about * 0.0174532925);
  *z = range * sin(above * 0.0174532925);
}


x86 assembly (clang, -O0):
<polar2xyz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
mov    %rdi,-0x20(%rbp)
mov    %rsi,-0x28(%rbp)
mov    %rdx,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xeb8(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xe95(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xe72(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xe42(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xe1f(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xdef(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<polar2xyz>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
movsd  %xmm0,0x10(%rsp)
addsd  0xec0(%rip),%xmm2
movsd  %xmm2,0x8(%rsp)
mulsd  0xeba(%rip),%xmm1
movsd  %xmm1,0x18(%rsp)
movapd %xmm1,%xmm0
call   1040 <cos@plt>
mulsd  0x10(%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x8(%rsp),%xmm0
mulsd  0xe92(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
call   1040 <cos@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,(%rbx)
movsd  0x18(%rsp),%xmm0
call   1040 <cos@plt>
mulsd  0x10(%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,(%r15)
movsd  0x18(%rsp),%xmm0
call   1030 <sin@plt>
mulsd  0x10(%rsp),%xmm0
movsd  %xmm0,(%r14)
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @polar2xyz(double %0, double %1, double %2, double* nocapture writeonly %3, double* nocapture writeonly %4, double* nocapture writeonly %5) {
%7 = fadd double %2, -9.000000e+01
%8 = fmul double %1, 0x3F91DF46A1FAE711
%9 = tail call double @cos(double %8)
%10 = fmul double %9, %0
%11 = fmul double %7, 0x3F91DF46A1FAE711
%12 = tail call double @cos(double %11)
%13 = fmul double %10, %12
store double %13, double* %3
%14 = tail call double @cos(double %8)
%15 = fmul double %14, %0
%16 = tail call double @sin(double %11)
%17 = fmul double %15, %16
store double %17, double* %4
%18 = tail call double @sin(double %8)
%19 = fmul double %18, %0
store double %19, double* %5
ret void
}