#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 */
int sqrt(int);
void st2rvec(float s, float t, float *xp, float *yp, float *zp) {
  double rx, ry, rz;
  double tmp1, tmp2;
  tmp1 = s * (1 - s) + t * (1 - t);
  tmp2 = 2 * sqrt(4 * tmp1 - 1);
  rx = tmp2 * (2 * s - 1);
  ry = tmp2 * (2 * t - 1);
  rz = 8 * tmp1 - 3;
  *xp = (float)rx;
  *yp = (float)ry;
  *zp = (float)rz;
}


x86 assembly (clang, -O0):
<st2rvec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%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
movss  0xee9(%rip),%xmm2
subss  -0x4(%rbp),%xmm2
movss  -0x8(%rbp),%xmm1
movss  0xed7(%rip),%xmm3
subss  -0x8(%rbp),%xmm3
mulss  %xmm3,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  0xe9c(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe98(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sqrt@plt>
shl    $0x1,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
movss  -0x4(%rbp),%xmm1
addss  %xmm1,%xmm1
movss  0xe71(%rip),%xmm2
addss  %xmm2,%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x48(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
addss  %xmm1,%xmm1
movss  0xe4a(%rip),%xmm2
addss  %xmm2,%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  0xe0c(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe08(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x28(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
movsd  -0x30(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
movsd  -0x38(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x20(%rbp),%rax
movss  %xmm0,(%rax)
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<st2rvec>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
movss  %xmm1,0x4(%rsp)
movss  %xmm0,(%rsp)
movss  0xecb(%rip),%xmm3
movaps %xmm3,%xmm2
subss  %xmm0,%xmm2
subss  %xmm1,%xmm3
mulss  %xmm1,%xmm3
mulss  %xmm0,%xmm2
addss  %xmm3,%xmm2
xorps  %xmm1,%xmm1
cvtss2sd %xmm2,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0xea7(%rip),%xmm0
mulsd  %xmm1,%xmm0
addsd  0xea3(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sqrt@plt>
add    %eax,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movss  (%rsp),%xmm2
addss  %xmm2,%xmm2
movss  0xe74(%rip),%xmm1
addss  %xmm1,%xmm2
cvtss2sd %xmm2,%xmm2
mulsd  %xmm0,%xmm2
movss  0x4(%rsp),%xmm3
addss  %xmm3,%xmm3
addss  %xmm1,%xmm3
xorps  %xmm1,%xmm1
cvtss2sd %xmm3,%xmm1
movsd  0x8(%rsp),%xmm3
mulsd  0xe59(%rip),%xmm3
addsd  0xe59(%rip),%xmm3
cvtsd2ss %xmm2,%xmm2
mulsd  %xmm0,%xmm1
movss  %xmm2,(%rbx)
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
movss  %xmm0,(%r15)
xorps  %xmm0,%xmm0
cvtsd2ss %xmm3,%xmm0
movss  %xmm0,(%r14)
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @st2rvec(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*
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
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
%16 = load float, float* %6
%17 = load float, float* %6
%18 = fsub float 1.000000e+00, %17
%19 = load float, float* %7
%20 = load float, float* %7
%21 = fsub float 1.000000e+00, %20
%22 = fmul float %19, %21
%23 = call float @llvm.fmuladd.f32(float %16, float %18, float %22)
%24 = fpext float %23 to double
store double %24, double* %14
%25 = load double, double* %14
%26 = call double @llvm.fmuladd.f64(double 4.000000e+00, double %25, double -1.000000e+00)
%27 = fptosi double %26 to i32
%28 = call i32 @sqrt(i32 %27)
%29 = mul nsw i32 2, %28
%30 = sitofp i32 %29 to double
store double %30, double* %15
%31 = load double, double* %15
%32 = load float, float* %6
%33 = call float @llvm.fmuladd.f32(float 2.000000e+00, float %32, float -1.000000e+00)
%34 = fpext float %33 to double
%35 = fmul double %31, %34
store double %35, double* %11
%36 = load double, double* %15
%37 = load float, float* %7
%38 = call float @llvm.fmuladd.f32(float 2.000000e+00, float %37, float -1.000000e+00)
%39 = fpext float %38 to double
%40 = fmul double %36, %39
store double %40, double* %12
%41 = load double, double* %14
%42 = call double @llvm.fmuladd.f64(double 8.000000e+00, double %41, double -3.000000e+00)
store double %42, double* %13
%43 = load double, double* %11
%44 = fptrunc double %43 to float
%45 = load float*, float** %8
store float %44, float* %45
%46 = load double, double* %12
%47 = fptrunc double %46 to float
%48 = load float*, float** %9
store float %47, float* %48
%49 = load double, double* %13
%50 = fptrunc double %49 to float
%51 = load float*, float** %10
store float %50, float* %51
ret void
}

LLVM IR (-O2):
define void @st2rvec(float %0, float %1, float* nocapture writeonly %2, float* nocapture writeonly %3, float* nocapture writeonly %4) {
%6 = fsub float 1.000000e+00, %0
%7 = fsub float 1.000000e+00, %1
%8 = fmul float %7, %1
%9 = tail call float @llvm.fmuladd.f32(float %0, float %6, float %8)
%10 = fpext float %9 to double
%11 = tail call double @llvm.fmuladd.f64(double %10, double 4.000000e+00, double -1.000000e+00)
%12 = fptosi double %11 to i32
%13 = tail call i32 @sqrt(i32 %12)
%14 = shl nsw i32 %13, 1
%15 = sitofp i32 %14 to double
%16 = tail call float @llvm.fmuladd.f32(float %0, float 2.000000e+00, float -1.000000e+00)
%17 = fpext float %16 to double
%18 = fmul double %17, %15
%19 = tail call float @llvm.fmuladd.f32(float %1, float 2.000000e+00, float -1.000000e+00)
%20 = fpext float %19 to double
%21 = fmul double %20, %15
%22 = tail call double @llvm.fmuladd.f64(double %10, double 8.000000e+00, double -3.000000e+00)
%23 = fptrunc double %18 to float
store float %23, float* %2
%24 = fptrunc double %21 to float
store float %24, float* %3
%25 = fptrunc double %22 to float
store float %25, float* %4
ret void
}