#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, double, double);
int cosine(double);
double floor(double);
int sine(double);
double lissajous13(double phase, double sharpness, double bias) {
  sharpness = clip(sharpness, -1, 1);
  bias = clip(bias, -0.5, 0.5);
  double x = phase - floor(phase + 0.5);
  return atan2((1 + sharpness) * sine(1.5 * x),
               (1 - sharpness) * cosine(0.5 * x + bias / 3.0)) *
             2.0 / M_PI +
         x + x;
}


x86 assembly (clang, -O0):
<lissajous13>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xebc(%rip),%xmm1
movsd  0xe9c(%rip),%xmm2
call   1040 <clip@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xe95(%rip),%xmm1
movsd  0xe6d(%rip),%xmm2
call   1040 <clip@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xe51(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
call   1070 <floor@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe3e(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe34(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
call   1060 <sine@plt>
movsd  -0x38(%rbp),%xmm0
cvtsi2sd %eax,%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x24(%rbp)
movsd  0xe06(%rip),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  0xde2(%rip),%xmm2
divsd  %xmm2,%xmm1
movsd  0xdce(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <cosine@plt>
movsd  -0x30(%rbp),%xmm0
mov    -0x24(%rbp),%edi
cvtsi2sd %eax,%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%esi
call   1050 <atan2@plt>
movsd  0xd98(%rip),%xmm1
mulsd  %xmm1,%xmm0
mov    0x2d75(%rip),%rax
divsd  (%rax),%xmm0
addsd  -0x20(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lissajous13>:
push   %rbx
sub    $0x30,%rsp
movsd  %xmm2,0x10(%rsp)
movaps %xmm1,%xmm3
movsd  %xmm0,0x8(%rsp)
movsd  0xe94(%rip),%xmm1
movsd  0xe94(%rip),%xmm2
movsd  %xmm2,0x18(%rsp)
movaps %xmm3,%xmm0
call   1040 <clip@plt>
movsd  %xmm0,0x20(%rsp)
movsd  0xe80(%rip),%xmm1
movsd  0xe80(%rip),%xmm2
movsd  0x10(%rsp),%xmm0
call   1040 <clip@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
addsd  0xe61(%rip),%xmm0
call   1070 <floor@plt>
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0x20(%rsp),%xmm0
addsd  0xe2e(%rip),%xmm0
movsd  %xmm0,0x28(%rsp)
movsd  0xe38(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1060 <sine@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0x28(%rsp),%xmm0
cvttsd2si %xmm0,%ebx
movsd  0x18(%rsp),%xmm0
subsd  0x20(%rsp),%xmm0
movsd  %xmm0,0x18(%rsp)
movsd  0x10(%rsp),%xmm1
divsd  0xe06(%rip),%xmm1
movsd  0xdee(%rip),%xmm0
mulsd  0x8(%rsp),%xmm0
addsd  %xmm1,%xmm0
call   1030 <cosine@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0x18(%rsp),%xmm0
cvttsd2si %xmm0,%esi
mov    %ebx,%edi
call   1050 <atan2@plt>
addsd  %xmm0,%xmm0
mov    0x2d8c(%rip),%rax
divsd  (%rax),%xmm0
movsd  0x8(%rsp),%xmm1
addsd  %xmm1,%xmm0
addsd  %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbx
ret

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

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