#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 cosf(float);
int sinf(float);
void par_shapes__klein(float const *uv, float *xyz, void *userdata) {
  float u = uv[0] * (3.14159265359);
  float v = uv[1] * 2 * (3.14159265359);
  u = u * 2;
  if (u < (3.14159265359)) {
    xyz[0] = 3 * cosf(u) * (1 + sinf(u)) +
             (2 * (1 - cosf(u) / 2)) * cosf(u) * cosf(v);
    xyz[2] = -8 * sinf(u) - 2 * (1 - cosf(u) / 2) * sinf(u) * cosf(v);
  } else {
    xyz[0] = 3 * cosf(u) * (1 + sinf(u)) +
             (2 * (1 - cosf(u) / 2)) * cosf(v + (3.14159265359));
    xyz[2] = -8 * sinf(u);
  }
  xyz[1] = -2 * (1 - cosf(u) / 2) * sinf(v);
}


x86 assembly (clang, -O0):
<par_shapes__klein>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%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  0xea7(%rip),%xmm0
mulss  0x4(%rax),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe8e(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  0xe81(%rip),%xmm0
mulss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe5e(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    129f <par_shapes__klein+0x17f>
movss  -0x1c(%rbp),%xmm0
call   1040 <cosf@plt>
imul   $0x3,%eax,%eax
mov    %eax,-0x3c(%rbp)
movss  -0x1c(%rbp),%xmm0
call   1030 <sinf@plt>
mov    %eax,%ecx
mov    -0x3c(%rbp),%eax
add    $0x1,%ecx
imul   %ecx,%eax
mov    %eax,-0x30(%rbp)
movss  -0x1c(%rbp),%xmm0
call   1040 <cosf@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    $0x1,%eax
sub    %ecx,%eax
shl    $0x1,%eax
mov    %eax,-0x38(%rbp)
movss  -0x1c(%rbp),%xmm0
call   1040 <cosf@plt>
mov    %eax,%ecx
mov    -0x38(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x34(%rbp)
movss  -0x20(%rbp),%xmm0
call   1040 <cosf@plt>
mov    -0x34(%rbp),%ecx
mov    %eax,%edx
mov    -0x30(%rbp),%eax
imul   %edx,%ecx
add    %ecx,%eax
cvtsi2ss %eax,%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x1c(%rbp),%xmm0
call   1030 <sinf@plt>
imul   $0xfffffff8,%eax,%eax
mov    %eax,-0x24(%rbp)
movss  -0x1c(%rbp),%xmm0
call   1040 <cosf@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    $0x1,%eax
sub    %ecx,%eax
shl    $0x1,%eax
mov    %eax,-0x2c(%rbp)
movss  -0x1c(%rbp),%xmm0
call   1030 <sinf@plt>
mov    %eax,%ecx
mov    -0x2c(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x28(%rbp)
movss  -0x20(%rbp),%xmm0
call   1040 <cosf@plt>
mov    -0x28(%rbp),%ecx
mov    %eax,%edx
mov    -0x24(%rbp),%eax
imul   %edx,%ecx
sub    %ecx,%eax
cvtsi2ss %eax,%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,0x8(%rax)
jmp    133c <par_shapes__klein+0x21c>
movss  -0x1c(%rbp),%xmm0
call   1040 <cosf@plt>
imul   $0x3,%eax,%eax
mov    %eax,-0x48(%rbp)
movss  -0x1c(%rbp),%xmm0
call   1030 <sinf@plt>
mov    %eax,%ecx
mov    -0x48(%rbp),%eax
add    $0x1,%ecx
imul   %ecx,%eax
mov    %eax,-0x40(%rbp)
movss  -0x1c(%rbp),%xmm0
call   1040 <cosf@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    $0x1,%eax
sub    %ecx,%eax
shl    $0x1,%eax
mov    %eax,-0x44(%rbp)
movss  -0x20(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd07(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1040 <cosf@plt>
mov    -0x44(%rbp),%ecx
mov    %eax,%edx
mov    -0x40(%rbp),%eax
imul   %edx,%ecx
add    %ecx,%eax
cvtsi2ss %eax,%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x1c(%rbp),%xmm0
call   1030 <sinf@plt>
imul   $0xfffffff8,%eax,%eax
cvtsi2ss %eax,%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,0x8(%rax)
movss  -0x1c(%rbp),%xmm0
call   1040 <cosf@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    $0x1,%eax
sub    %ecx,%eax
imul   $0xfffffffe,%eax,%eax
mov    %eax,-0x4c(%rbp)
movss  -0x20(%rbp),%xmm0
call   1030 <sinf@plt>
mov    %eax,%ecx
mov    -0x4c(%rbp),%eax
imul   %ecx,%eax
cvtsi2ss %eax,%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,0x4(%rax)
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<par_shapes__klein>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
movss  (%rdi),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xec3(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm2
movss  0x4(%rdi),%xmm0
addss  %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0xc(%rsp)
addss  %xmm2,%xmm2
movss  %xmm2,0x8(%rsp)
xorps  %xmm0,%xmm0
cvtss2sd %xmm2,%xmm0
movsd  %xmm0,0x10(%rsp)
movaps %xmm2,%xmm0
call   1040 <cosf@plt>
mov    %eax,%ebp
movss  0x8(%rsp),%xmm0
call   1030 <sinf@plt>
mov    %eax,%ebx
add    $0x1,%ebx
imul   %ebp,%ebx
movss  0x8(%rsp),%xmm0
call   1040 <cosf@plt>
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
and    $0xfffffffe,%ecx
mov    $0x2,%ebp
sub    %ecx,%ebp
movsd  0xe48(%rip),%xmm0
ucomisd 0x10(%rsp),%xmm0
lea    (%rbx,%rbx,2),%ebx
jbe    123d <par_shapes__klein+0x11d>
movss  0x8(%rsp),%xmm0
call   1040 <cosf@plt>
mov    %eax,%r15d
movss  0xc(%rsp),%xmm0
call   1040 <cosf@plt>
imul   %r15d,%eax
imul   %ebp,%eax
add    %ebx,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,(%r14)
movss  0x8(%rsp),%xmm0
call   1030 <sinf@plt>
mov    %eax,%ebp
shl    $0x3,%ebp
movss  0x8(%rsp),%xmm0
call   1040 <cosf@plt>
mov    %eax,%ebx
shr    $0x1f,%ebx
add    %eax,%ebx
and    $0xfffffffe,%ebx
add    $0xfffffffe,%ebx
movss  0x8(%rsp),%xmm0
call   1030 <sinf@plt>
mov    %eax,%r15d
movss  0xc(%rsp),%xmm0
call   1040 <cosf@plt>
imul   %r15d,%eax
imul   %ebx,%eax
sub    %ebp,%eax
jmp    1279 <par_shapes__klein+0x159>
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
addsd  0xdb1(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
call   1040 <cosf@plt>
imul   %eax,%ebp
add    %ebx,%ebp
xorps  %xmm0,%xmm0
cvtsi2ss %ebp,%xmm0
movss  %xmm0,(%r14)
movss  0x8(%rsp),%xmm0
call   1030 <sinf@plt>
shl    $0x3,%eax
neg    %eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,0x8(%r14)
movss  0x8(%rsp),%xmm0
call   1040 <cosf@plt>
mov    %eax,%ebx
shr    $0x1f,%ebx
add    %eax,%ebx
shr    %ebx
add    $0xffffffff,%ebx
movss  0xc(%rsp),%xmm0
call   1030 <sinf@plt>
imul   %ebx,%eax
add    %eax,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,0x4(%r14)
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @par_shapes__klein(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 = 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* %8
%22 = load float, float* %7
%23 = fmul float %22, 2.000000e+00
store float %23, float* %7
%24 = load float, float* %7
%25 = fpext float %24 to double
%26 = fcmp olt double %25, 0x400921FB54442EEA
br i1 %26, label %27, label %68
27: ; preds = %3
%28 = load float, float* %7
%29 = call i32 @cosf(float %28)
%30 = mul nsw i32 3, %29
%31 = load float, float* %7
%32 = call i32 @sinf(float %31)
%33 = add nsw i32 1, %32
%34 = mul nsw i32 %30, %33
%35 = load float, float* %7
%36 = call i32 @cosf(float %35)
%37 = sdiv i32 %36, 2
%38 = sub nsw i32 1, %37
%39 = mul nsw i32 2, %38
%40 = load float, float* %7
%41 = call i32 @cosf(float %40)
%42 = mul nsw i32 %39, %41
%43 = load float, float* %8
%44 = call i32 @cosf(float %43)
%45 = mul nsw i32 %42, %44
%46 = add nsw i32 %34, %45
%47 = sitofp i32 %46 to float
%48 = load float*, float** %5
%49 = getelementptr inbounds float, float* %48, i64 0
store float %47, float* %49
%50 = load float, float* %7
%51 = call i32 @sinf(float %50)
%52 = mul nsw i32 -8, %51
%53 = load float, float* %7
%54 = call i32 @cosf(float %53)
%55 = sdiv i32 %54, 2
%56 = sub nsw i32 1, %55
%57 = mul nsw i32 2, %56
%58 = load float, float* %7
%59 = call i32 @sinf(float %58)
%60 = mul nsw i32 %57, %59
%61 = load float, float* %8
%62 = call i32 @cosf(float %61)
%63 = mul nsw i32 %60, %62
%64 = sub nsw i32 %52, %63
%65 = sitofp i32 %64 to float
%66 = load float*, float** %5
%67 = getelementptr inbounds float, float* %66, i64 2
store float %65, float* %67
br label %97
68: ; preds = %3
%69 = load float, float* %7
%70 = call i32 @cosf(float %69)
%71 = mul nsw i32 3, %70
%72 = load float, float* %7
%73 = call i32 @sinf(float %72)
%74 = add nsw i32 1, %73
%75 = mul nsw i32 %71, %74
%76 = load float, float* %7
%77 = call i32 @cosf(float %76)
%78 = sdiv i32 %77, 2
%79 = sub nsw i32 1, %78
%80 = mul nsw i32 2, %79
%81 = load float, float* %8
%82 = fpext float %81 to double
%83 = fadd double %82, 0x400921FB54442EEA
%84 = fptrunc double %83 to float
%85 = call i32 @cosf(float %84)
%86 = mul nsw i32 %80, %85
%87 = add nsw i32 %75, %86
%88 = sitofp i32 %87 to float
%89 = load float*, float** %5
%90 = getelementptr inbounds float, float* %89, i64 0
store float %88, float* %90
%91 = load float, float* %7
%92 = call i32 @sinf(float %91)
%93 = mul nsw i32 -8, %92
%94 = sitofp i32 %93 to float
%95 = load float*, float** %5
%96 = getelementptr inbounds float, float* %95, i64 2
store float %94, float* %96
br label %97
97: ; preds = %68, %27
%98 = load float, float* %7
%99 = call i32 @cosf(float %98)
%100 = sdiv i32 %99, 2
%101 = sub nsw i32 1, %100
%102 = mul nsw i32 -2, %101
%103 = load float, float* %8
%104 = call i32 @sinf(float %103)
%105 = mul nsw i32 %102, %104
%106 = sitofp i32 %105 to float
%107 = load float*, float** %5
%108 = getelementptr inbounds float, float* %107, i64 1
store float %106, float* %108
ret void
}

LLVM IR (-O2):
define void @par_shapes__klein(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 = fmul float %9, 2.000000e+00
%11 = fpext float %10 to double
%12 = fmul double %11, 0x400921FB54442EEA
%13 = fptrunc double %12 to float
%14 = fmul float %7, 2.000000e+00
%15 = fpext float %14 to double
%16 = fcmp olt double %15, 0x400921FB54442EEA
%17 = tail call i32 @cosf(float %14)
%18 = mul nsw i32 %17, 3
%19 = tail call i32 @sinf(float %14)
%20 = add nsw i32 %19, 1
%21 = mul nsw i32 %18, %20
%22 = tail call i32 @cosf(float %14)
%23 = sdiv i32 %22, -2
%24 = shl i32 %23, 1
%25 = add i32 %24, 2
br i1 %16, label %26, label %44
26: ; preds = %3
%27 = tail call i32 @cosf(float %14)
%28 = tail call i32 @cosf(float %13)
%29 = mul i32 %28, %27
%30 = mul i32 %29, %25
%31 = add nsw i32 %30, %21
%32 = sitofp i32 %31 to float
store float %32, float* %1
%33 = tail call i32 @sinf(float %14)
%34 = mul nsw i32 %33, -8
%35 = tail call i32 @cosf(float %14)
%36 = sdiv i32 %35, 2
%37 = shl nsw i32 %36, 1
%38 = add i32 %37, -2
%39 = tail call i32 @sinf(float %14)
%40 = tail call i32 @cosf(float %13)
%41 = mul i32 %40, %39
%42 = mul i32 %41, %38
%43 = add i32 %42, %34
br label %54
44: ; preds = %3
%45 = fpext float %13 to double
%46 = fadd double %45, 0x400921FB54442EEA
%47 = fptrunc double %46 to float
%48 = tail call i32 @cosf(float %47)
%49 = mul nsw i32 %25, %48
%50 = add nsw i32 %49, %21
%51 = sitofp i32 %50 to float
store float %51, float* %1
%52 = tail call i32 @sinf(float %14)
%53 = mul nsw i32 %52, -8
br label %54
54: ; preds = %44, %26
%55 = phi i32 [ %43, %26 ], [ %53, %44 ]
%56 = sitofp i32 %55 to float
%57 = getelementptr inbounds float, float* %1, i64 2
store float %56, float* %57
%58 = tail call i32 @cosf(float %14)
%59 = sdiv i32 %58, -2
%60 = xor i32 %59, -1
%61 = shl i32 %60, 1
%62 = tail call i32 @sinf(float %13)
%63 = mul nsw i32 %61, %62
%64 = sitofp i32 %63 to float
%65 = getelementptr inbounds float, float* %1, i64 1
store float %64, float* %65
ret void
}