#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 fabs(double const);
double fmod(double, double);
double const pow(double, double);
double parab(double x, double n) {
  const double u = fmod(x, 6.28318530717958647693);
  const double temp0 = 3.0 - 2.0 * (u < 3.14159265358979323846);
  const double temp1 = fabs(pow(fabs(u / 1.57079632679489661923 - temp0), n));
  return (u < 3.14159265358979323846) ? 1.0 - temp1 : (temp1 - 1.0);
}


x86 assembly (clang, -O0):
<parab>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xed9(%rip),%xmm1
call   1030 <fmod@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  0xeaf(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
cvtsi2sd %eax,%xmm1
addsd  %xmm1,%xmm1
movsd  0xea2(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xe84(%rip),%xmm1
divsd  %xmm1,%xmm0
subsd  -0x20(%rbp),%xmm0
movaps 0xe9c(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  -0x10(%rbp),%xmm1
call   1040 <pow@plt>
movaps 0xe87(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe46(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    11dc <parab+0xbc>
movsd  0xe53(%rip),%xmm0
subsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    11f2 <parab+0xd2>
movsd  -0x28(%rbp),%xmm0
movsd  0xe37(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parab>:
sub    $0x18,%rsp
movsd  %xmm1,0x10(%rsp)
movsd  0xece(%rip),%xmm1
call   1030 <fmod@plt>
movsd  %xmm0,0x8(%rsp)
movapd %xmm0,%xmm1
cmpltsd 0xebe(%rip),%xmm1
movsd  0xebe(%rip),%xmm2
andpd  %xmm2,%xmm1
addsd  %xmm1,%xmm1
movsd  0xeb6(%rip),%xmm2
divsd  0xeb6(%rip),%xmm0
subsd  %xmm1,%xmm2
subsd  %xmm2,%xmm0
andpd  0xeb6(%rip),%xmm0
movsd  0x10(%rsp),%xmm1
call   1040 <pow@plt>
movsd  0xe7b(%rip),%xmm1
ucomisd 0x8(%rsp),%xmm1
andpd  0xe95(%rip),%xmm0
ja     11aa <parab+0x8a>
addsd  0xe83(%rip),%xmm0
add    $0x18,%rsp
ret
movsd  0xe5e(%rip),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @parab(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double %0, double* %3
store double %1, double* %4
%8 = load double, double* %3
%9 = call double @fmod(double %8, double 0x401921FB54442D18)
store double %9, double* %5
%10 = load double, double* %5
%11 = fcmp olt double %10, 0x400921FB54442D18
%12 = zext i1 %11 to i32
%13 = sitofp i32 %12 to double
%14 = call double @llvm.fmuladd.f64(double -2.000000e+00, double %13, double 3.000000e+00)
store double %14, double* %6
%15 = load double, double* %5
%16 = fdiv double %15, 0x3FF921FB54442D18
%17 = load double, double* %6
%18 = fsub double %16, %17
%19 = call double @llvm.fabs.f64(double %18)
%20 = load double, double* %4
%21 = call double @pow(double %19, double %20)
%22 = call double @llvm.fabs.f64(double %21)
store double %22, double* %7
%23 = load double, double* %5
%24 = fcmp olt double %23, 0x400921FB54442D18
br i1 %24, label %25, label %28
25: ; preds = %2
%26 = load double, double* %7
%27 = fsub double 1.000000e+00, %26
br label %31
28: ; preds = %2
%29 = load double, double* %7
%30 = fsub double %29, 1.000000e+00
br label %31
31: ; preds = %28, %25
%32 = phi double [ %27, %25 ], [ %30, %28 ]
ret double %32
}

LLVM IR (-O2):
define double @parab(double %0, double %1) {
%3 = tail call double @fmod(double %0, double 0x401921FB54442D18)
%4 = fcmp olt double %3, 0x400921FB54442D18
%5 = uitofp i1 %4 to double
%6 = tail call double @llvm.fmuladd.f64(double %5, double -2.000000e+00, double 3.000000e+00)
%7 = fdiv double %3, 0x3FF921FB54442D18
%8 = fsub double %7, %6
%9 = tail call double @llvm.fabs.f64(double %8)
%10 = tail call double @pow(double %9, double %1)
%11 = tail call double @llvm.fabs.f64(double %10)
%12 = fsub double 1.000000e+00, %11
%13 = fadd double %11, -1.000000e+00
%14 = select i1 %4, double %12, double %13
ret double %14
}