#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 M_PI;
float cos(float);
float sin(float);
void vector_from_polar(float x[3], float radius, float incline, float azimuth) {
  float ri = ((incline) / 180 * M_PI), ra = ((azimuth) / 180 * M_PI);
  x[0] = radius * cos(ri) * cos(ra);
  x[1] = radius * cos(ri) * sin(ra);
  x[2] = radius * sin(ri);
}


x86 assembly (clang, -O0):
<vector_from_polar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movss  %xmm1,-0x10(%rbp)
movss  %xmm2,-0x14(%rbp)
movss  -0x10(%rbp),%xmm0
movss  0xeb8(%rip),%xmm1
divss  %xmm1,%xmm0
mov    0x2e95(%rip),%rax
mulss  (%rax),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x14(%rbp),%xmm0
movss  0xe97(%rip),%xmm1
divss  %xmm1,%xmm0
mov    0x2e74(%rip),%rax
mulss  (%rax),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x18(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movss  -0x30(%rbp),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x1c(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movss  -0x2c(%rbp),%xmm0
mulss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x18(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movss  -0x28(%rbp),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x1c(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movss  -0x24(%rbp),%xmm0
mulss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x4(%rax)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x18(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movss  -0x20(%rbp),%xmm0
mulss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x8(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vector_from_polar>:
push   %rbx
sub    $0x10,%rsp
movss  %xmm0,0x4(%rsp)
mov    %rdi,%rbx
movss  0xeca(%rip),%xmm0
divss  %xmm0,%xmm1
mov    0x2ea7(%rip),%rax
movss  (%rax),%xmm3
mulss  %xmm3,%xmm1
movss  %xmm1,0xc(%rsp)
divss  %xmm0,%xmm2
mulss  %xmm2,%xmm3
movss  %xmm3,0x8(%rsp)
movaps %xmm1,%xmm0
call   1040 <cos@plt>
mulss  0x4(%rsp),%xmm0
movss  %xmm0,(%rsp)
movss  0x8(%rsp),%xmm0
call   1040 <cos@plt>
mulss  (%rsp),%xmm0
movss  %xmm0,(%rbx)
movss  0xc(%rsp),%xmm0
call   1040 <cos@plt>
mulss  0x4(%rsp),%xmm0
movss  %xmm0,(%rsp)
movss  0x8(%rsp),%xmm0
call   1030 <sin@plt>
mulss  (%rsp),%xmm0
movss  %xmm0,0x4(%rbx)
movss  0xc(%rsp),%xmm0
call   1030 <sin@plt>
mulss  0x4(%rsp),%xmm0
movss  %xmm0,0x8(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@M_PI = global float 0.000000e+00
define void @vector_from_polar(float* nocapture writeonly %0, float %1, float %2, float %3) {
%5 = fdiv float %2, 1.800000e+02
%6 = load float, float* @M_PI
%7 = fmul float %5, %6
%8 = fdiv float %3, 1.800000e+02
%9 = fmul float %8, %6
%10 = tail call float @cos(float %7)
%11 = fmul float %10, %1
%12 = tail call float @cos(float %9)
%13 = fmul float %11, %12
store float %13, float* %0
%14 = tail call float @cos(float %7)
%15 = fmul float %14, %1
%16 = tail call float @sin(float %9)
%17 = fmul float %15, %16
%18 = getelementptr inbounds float, float* %0, i64 1
store float %17, float* %18
%19 = tail call float @sin(float %7)
%20 = fmul float %19, %1
%21 = getelementptr inbounds float, float* %0, i64 2
store float %20, float* %21
ret void
}