#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 cosf(float);
float sinf(float);
void par_shapes__hemisphere(float const *uv, float *xyz, void *userdata) {
  float phi = uv[0] * (3.14159265359);
  float theta = uv[1] * (3.14159265359);
  xyz[0] = cosf(theta) * sinf(phi);
  xyz[1] = sinf(theta) * sinf(phi);
  xyz[2] = cosf(phi);
}


x86 assembly (clang, -O0):
<par_shapes__hemisphere>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xeb8(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe96(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x20(%rbp),%xmm0
call   1040 <cosf@plt>
movss  %xmm0,-0x28(%rbp)
movss  -0x1c(%rbp),%xmm0
call   1030 <sinf@plt>
movaps %xmm0,%xmm1
movss  -0x28(%rbp),%xmm0
mulss  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x20(%rbp),%xmm0
call   1030 <sinf@plt>
movss  %xmm0,-0x24(%rbp)
movss  -0x1c(%rbp),%xmm0
call   1030 <sinf@plt>
movaps %xmm0,%xmm1
movss  -0x24(%rbp),%xmm0
mulss  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,0x4(%rax)
movss  -0x1c(%rbp),%xmm0
call   1040 <cosf@plt>
mov    -0x10(%rbp),%rax
movss  %xmm0,0x8(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<par_shapes__hemisphere>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
movss  (%rdi),%xmm0
movss  0x4(%rdi),%xmm1
cvtss2sd %xmm0,%xmm0
movsd  0xec3(%rip),%xmm2
mulsd  %xmm2,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x8(%rsp)
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
mulsd  %xmm2,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x4(%rsp)
call   1040 <cosf@plt>
movss  %xmm0,0xc(%rsp)
movss  0x8(%rsp),%xmm0
call   1030 <sinf@plt>
mulss  0xc(%rsp),%xmm0
movss  %xmm0,(%rbx)
movss  0x4(%rsp),%xmm0
call   1030 <sinf@plt>
movss  %xmm0,0x4(%rsp)
movss  0x8(%rsp),%xmm0
call   1030 <sinf@plt>
mulss  0x4(%rsp),%xmm0
movss  %xmm0,0x4(%rbx)
movss  0x8(%rsp),%xmm0
call   1040 <cosf@plt>
movss  %xmm0,0x8(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @par_shapes__hemisphere(float* %0, float* %1, i8* %2) {
%4 = alloca float*
%5 = alloca float*
%6 = alloca i8*
%7 = alloca float
%8 = alloca float
store float* %0, float** %4
store float* %1, float** %5
store i8* %2, i8** %6
%9 = load float*, float** %4
%10 = getelementptr inbounds float, float* %9, i64 0
%11 = load float, float* %10
%12 = fpext float %11 to double
%13 = fmul double %12, 0x400921FB54442EEA
%14 = fptrunc double %13 to float
store float %14, float* %7
%15 = load float*, float** %4
%16 = getelementptr inbounds float, float* %15, i64 1
%17 = load float, float* %16
%18 = fpext float %17 to double
%19 = fmul double %18, 0x400921FB54442EEA
%20 = fptrunc double %19 to float
store float %20, float* %8
%21 = load float, float* %8
%22 = call float @cosf(float %21)
%23 = load float, float* %7
%24 = call float @sinf(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* %8
%29 = call float @sinf(float %28)
%30 = load float, float* %7
%31 = call float @sinf(float %30)
%32 = fmul float %29, %31
%33 = load float*, float** %5
%34 = getelementptr inbounds float, float* %33, i64 1
store float %32, float* %34
%35 = load float, float* %7
%36 = call float @cosf(float %35)
%37 = load float*, float** %5
%38 = getelementptr inbounds float, float* %37, i64 2
store float %36, float* %38
ret void
}

LLVM IR (-O2):
define void @par_shapes__hemisphere(float* nocapture %0, float* nocapture writeonly %1, i8* nocapture readnone %2) {
%4 = load float, float* %0
%5 = fpext float %4 to double
%6 = fmul double %5, 0x400921FB54442EEA
%7 = fptrunc double %6 to float
%8 = getelementptr inbounds float, float* %0, i64 1
%9 = load float, float* %8
%10 = fpext float %9 to double
%11 = fmul double %10, 0x400921FB54442EEA
%12 = fptrunc double %11 to float
%13 = tail call float @cosf(float %12)
%14 = tail call float @sinf(float %7)
%15 = fmul float %13, %14
store float %15, float* %1
%16 = tail call float @sinf(float %12)
%17 = tail call float @sinf(float %7)
%18 = fmul float %16, %17
%19 = getelementptr inbounds float, float* %1, i64 1
store float %18, float* %19
%20 = tail call float @cosf(float %7)
%21 = getelementptr inbounds float, float* %1, i64 2
store float %20, float* %21
ret void
}