#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 */
scalar_t__ cos(float const);
scalar_t__ sin(float const);
void VecSphericalToCarthesian3fv(float v[3], const float a[3]) {
  v[0] = (float)a[0] * (float)sin(a[2]) * (float)sin(a[1]);
  v[1] = (float)a[0] * (float)sin(a[2]) * (float)cos(a[1]);
  v[2] = (float)a[0] * (float)cos(a[2]);
}


x86 assembly (clang, -O0):
<VecSphericalToCarthesian3fv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x24(%rbp)
mov    -0x10(%rbp),%rax
movss  0x8(%rax),%xmm0
call   1030 <sin@plt>
movss  -0x24(%rbp),%xmm0
cvtsi2ss %rax,%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm0
call   1030 <sin@plt>
movss  -0x20(%rbp),%xmm0
cvtsi2ss %rax,%xmm1
mulss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movss  0x8(%rax),%xmm0
call   1030 <sin@plt>
movss  -0x1c(%rbp),%xmm0
cvtsi2ss %rax,%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm0
call   1040 <cos@plt>
movss  -0x18(%rbp),%xmm0
cvtsi2ss %rax,%xmm1
mulss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x4(%rax)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movss  0x8(%rax),%xmm0
call   1040 <cos@plt>
movss  -0x14(%rbp),%xmm0
cvtsi2ss %rax,%xmm1
mulss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x8(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<VecSphericalToCarthesian3fv>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
movss  (%rsi),%xmm0
movss  %xmm0,0x4(%rsp)
movss  0x8(%rsi),%xmm0
call   1030 <sin@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
mulss  0x4(%rsp),%xmm0
movss  %xmm0,0x4(%rsp)
movss  0x4(%rbx),%xmm0
call   1030 <sin@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
mulss  0x4(%rsp),%xmm0
movss  %xmm0,(%r14)
movss  (%rbx),%xmm0
movss  %xmm0,0x4(%rsp)
movss  0x8(%rbx),%xmm0
call   1030 <sin@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
mulss  0x4(%rsp),%xmm0
movss  %xmm0,0x4(%rsp)
movss  0x4(%rbx),%xmm0
call   1040 <cos@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
mulss  0x4(%rsp),%xmm0
movss  %xmm0,0x4(%r14)
movss  (%rbx),%xmm0
movss  %xmm0,0x4(%rsp)
movss  0x8(%rbx),%xmm0
call   1040 <cos@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
mulss  0x4(%rsp),%xmm0
movss  %xmm0,0x8(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @VecSphericalToCarthesian3fv(float* %0, float* %1) {
%3 = alloca float*
%4 = alloca float*
store float* %0, float** %3
store float* %1, float** %4
%5 = load float*, float** %4
%6 = getelementptr inbounds float, float* %5, i64 0
%7 = load float, float* %6
%8 = load float*, float** %4
%9 = getelementptr inbounds float, float* %8, i64 2
%10 = load float, float* %9
%11 = call i64 @sin(float %10)
%12 = sitofp i64 %11 to float
%13 = fmul float %7, %12
%14 = load float*, float** %4
%15 = getelementptr inbounds float, float* %14, i64 1
%16 = load float, float* %15
%17 = call i64 @sin(float %16)
%18 = sitofp i64 %17 to float
%19 = fmul float %13, %18
%20 = load float*, float** %3
%21 = getelementptr inbounds float, float* %20, i64 0
store float %19, float* %21
%22 = load float*, float** %4
%23 = getelementptr inbounds float, float* %22, i64 0
%24 = load float, float* %23
%25 = load float*, float** %4
%26 = getelementptr inbounds float, float* %25, i64 2
%27 = load float, float* %26
%28 = call i64 @sin(float %27)
%29 = sitofp i64 %28 to float
%30 = fmul float %24, %29
%31 = load float*, float** %4
%32 = getelementptr inbounds float, float* %31, i64 1
%33 = load float, float* %32
%34 = call i64 @cos(float %33)
%35 = sitofp i64 %34 to float
%36 = fmul float %30, %35
%37 = load float*, float** %3
%38 = getelementptr inbounds float, float* %37, i64 1
store float %36, float* %38
%39 = load float*, float** %4
%40 = getelementptr inbounds float, float* %39, i64 0
%41 = load float, float* %40
%42 = load float*, float** %4
%43 = getelementptr inbounds float, float* %42, i64 2
%44 = load float, float* %43
%45 = call i64 @cos(float %44)
%46 = sitofp i64 %45 to float
%47 = fmul float %41, %46
%48 = load float*, float** %3
%49 = getelementptr inbounds float, float* %48, i64 2
store float %47, float* %49
ret void
}

LLVM IR (-O2):
define void @VecSphericalToCarthesian3fv(float* nocapture writeonly %0, float* nocapture %1) {
%3 = load float, float* %1
%4 = getelementptr inbounds float, float* %1, i64 2
%5 = load float, float* %4
%6 = tail call i64 @sin(float %5)
%7 = sitofp i64 %6 to float
%8 = fmul float %3, %7
%9 = getelementptr inbounds float, float* %1, i64 1
%10 = load float, float* %9
%11 = tail call i64 @sin(float %10)
%12 = sitofp i64 %11 to float
%13 = fmul float %8, %12
store float %13, float* %0
%14 = load float, float* %1
%15 = load float, float* %4
%16 = tail call i64 @sin(float %15)
%17 = sitofp i64 %16 to float
%18 = fmul float %14, %17
%19 = load float, float* %9
%20 = tail call i64 @cos(float %19)
%21 = sitofp i64 %20 to float
%22 = fmul float %18, %21
%23 = getelementptr inbounds float, float* %0, i64 1
store float %22, float* %23
%24 = load float, float* %1
%25 = load float, float* %4
%26 = tail call i64 @cos(float %25)
%27 = sitofp i64 %26 to float
%28 = fmul float %24, %27
%29 = getelementptr inbounds float, float* %0, i64 2
store float %28, float* %29
ret void
}