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


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

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

LLVM IR (-O0):
define void @par_shapes__torus(float* %0, float* %1, i8* %2) {
%4 = alloca float*
%5 = alloca float*
%6 = alloca i8*
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
store float* %0, float** %4
store float* %1, float** %5
store i8* %2, i8** %6
store float 1.000000e+00, float* %7
%12 = load i8*, i8** %6
%13 = bitcast i8* %12 to float*
%14 = load float, float* %13
store float %14, float* %8
%15 = load float*, float** %4
%16 = getelementptr inbounds float, float* %15, i64 0
%17 = load float, float* %16
%18 = fmul float %17, 2.000000e+00
%19 = fpext float %18 to double
%20 = fmul double %19, 0x400921FB54442EEA
%21 = fptrunc double %20 to float
store float %21, float* %9
%22 = load float*, float** %4
%23 = getelementptr inbounds float, float* %22, i64 1
%24 = load float, float* %23
%25 = fmul float %24, 2.000000e+00
%26 = fpext float %25 to double
%27 = fmul double %26, 0x400921FB54442EEA
%28 = fptrunc double %27 to float
store float %28, float* %10
%29 = load float, float* %7
%30 = load float, float* %8
%31 = load float, float* %10
%32 = call float @cosf(float %31)
%33 = call float @llvm.fmuladd.f32(float %30, float %32, float %29)
store float %33, float* %11
%34 = load float, float* %9
%35 = call float @cosf(float %34)
%36 = load float, float* %11
%37 = fmul float %35, %36
%38 = load float*, float** %5
%39 = getelementptr inbounds float, float* %38, i64 0
store float %37, float* %39
%40 = load float, float* %9
%41 = call float @sinf(float %40)
%42 = load float, float* %11
%43 = fmul float %41, %42
%44 = load float*, float** %5
%45 = getelementptr inbounds float, float* %44, i64 1
store float %43, float* %45
%46 = load float, float* %10
%47 = call float @sinf(float %46)
%48 = load float, float* %8
%49 = fmul float %47, %48
%50 = load float*, float** %5
%51 = getelementptr inbounds float, float* %50, i64 2
store float %49, float* %51
ret void
}

LLVM IR (-O2):
define void @par_shapes__torus(float* nocapture %0, float* nocapture writeonly %1, i8* nocapture %2) {
%4 = bitcast i8* %2 to float*
%5 = load float, float* %4
%6 = load float, float* %0
%7 = fmul float %6, 2.000000e+00
%8 = fpext float %7 to double
%9 = fmul double %8, 0x400921FB54442EEA
%10 = fptrunc double %9 to float
%11 = getelementptr inbounds float, float* %0, i64 1
%12 = load float, float* %11
%13 = fmul float %12, 2.000000e+00
%14 = fpext float %13 to double
%15 = fmul double %14, 0x400921FB54442EEA
%16 = fptrunc double %15 to float
%17 = tail call float @cosf(float %16)
%18 = tail call float @llvm.fmuladd.f32(float %5, float %17, float 1.000000e+00)
%19 = tail call float @cosf(float %10)
%20 = fmul float %19, %18
store float %20, float* %1
%21 = tail call float @sinf(float %10)
%22 = fmul float %18, %21
%23 = getelementptr inbounds float, float* %1, i64 1
store float %22, float* %23
%24 = tail call float @sinf(float %16)
%25 = fmul float %5, %24
%26 = getelementptr inbounds float, float* %1, i64 2
store float %25, float* %26
ret void
}