#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 */
double M_PI;
double atan2(int, int);
double clip(double, int, int);
int cosine(int);
int sine(double);
double lissajous12(double phase, double sharpness, double bias) {
  sharpness = clip(sharpness, -1, 1);
  bias = clip(bias, (1e-10) - 1, 1 - (1e-10));
  return atan2((1 + sharpness) * sine(phase),
               (1 - sharpness) * cosine(2 * phase + 0.5 * bias)) *
         4.0 / (3.0 * M_PI);
}


x86 assembly (clang, -O0):
<lissajous12>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    $0xffffffff,%edi
mov    $0x1,%esi
call   1040 <clip@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x18(%rbp),%xmm0
xor    %esi,%esi
mov    %esi,%edi
call   1040 <clip@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  0xe8d(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1060 <sine@plt>
movsd  -0x30(%rbp),%xmm0
cvtsi2sd %eax,%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x1c(%rbp)
movsd  0xe5d(%rip),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xe3e(%rip),%xmm1
mulsd  -0x18(%rbp),%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <cosine@plt>
movsd  -0x28(%rbp),%xmm0
mov    -0x1c(%rbp),%edi
cvtsi2sd %eax,%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%esi
call   1050 <atan2@plt>
movsd  0xdff(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xdeb(%rip),%xmm1
mov    0x2dcc(%rip),%rax
mulsd  (%rax),%xmm1
divsd  %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lissajous12>:
push   %rbx
sub    $0x30,%rsp
movsd  %xmm2,0x8(%rsp)
movsd  %xmm0,0x18(%rsp)
movaps %xmm1,%xmm0
mov    $0xffffffff,%edi
mov    $0x1,%esi
call   1040 <clip@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
xor    %edi,%edi
xor    %esi,%esi
call   1040 <clip@plt>
movsd  %xmm0,0x28(%rsp)
movsd  0xe7a(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x20(%rsp)
movsd  0x18(%rsp),%xmm0
call   1060 <sine@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0x20(%rsp),%xmm0
cvttsd2si %xmm0,%ebx
movsd  0x8(%rsp),%xmm0
subsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x28(%rsp),%xmm1
mulsd  0xe30(%rip),%xmm1
movsd  0x18(%rsp),%xmm0
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <cosine@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0x8(%rsp),%xmm0
cvttsd2si %xmm0,%esi
mov    %ebx,%edi
call   1050 <atan2@plt>
mulsd  0xe01(%rip),%xmm0
mov    0x2dd2(%rip),%rax
movsd  (%rax),%xmm1
mulsd  0xdf6(%rip),%xmm1
divsd  %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define double @lissajous12(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %5
%8 = call double @clip(double %7, i32 -1, i32 1)
store double %8, double* %5
%9 = load double, double* %6
%10 = call double @clip(double %9, i32 0, i32 0)
store double %10, double* %6
%11 = load double, double* %5
%12 = fadd double 1.000000e+00, %11
%13 = load double, double* %4
%14 = call i32 @sine(double %13)
%15 = sitofp i32 %14 to double
%16 = fmul double %12, %15
%17 = fptosi double %16 to i32
%18 = load double, double* %5
%19 = fsub double 1.000000e+00, %18
%20 = load double, double* %4
%21 = load double, double* %6
%22 = fmul double 5.000000e-01, %21
%23 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %20, double %22)
%24 = fptosi double %23 to i32
%25 = call i32 @cosine(i32 %24)
%26 = sitofp i32 %25 to double
%27 = fmul double %19, %26
%28 = fptosi double %27 to i32
%29 = call double @atan2(i32 %17, i32 %28)
%30 = fmul double %29, 4.000000e+00
%31 = load double, double* @M_PI
%32 = fmul double 3.000000e+00, %31
%33 = fdiv double %30, %32
ret double %33
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define double @lissajous12(double %0, double %1, double %2) {
%4 = tail call double @clip(double %1, i32 -1, i32 1)
%5 = tail call double @clip(double %2, i32 0, i32 0)
%6 = fadd double %4, 1.000000e+00
%7 = tail call i32 @sine(double %0)
%8 = sitofp i32 %7 to double
%9 = fmul double %6, %8
%10 = fptosi double %9 to i32
%11 = fsub double 1.000000e+00, %4
%12 = fmul double %5, 5.000000e-01
%13 = tail call double @llvm.fmuladd.f64(double %0, double 2.000000e+00, double %12)
%14 = fptosi double %13 to i32
%15 = tail call i32 @cosine(i32 %14)
%16 = sitofp i32 %15 to double
%17 = fmul double %11, %16
%18 = fptosi double %17 to i32
%19 = tail call double @atan2(i32 %10, i32 %18)
%20 = fmul double %19, 4.000000e+00
%21 = load double, double* @M_PI
%22 = fmul double %21, 3.000000e+00
%23 = fdiv double %20, %22
ret double %23
}