#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);
double Chi(double x, double c) {
  double t;
  if (fabs(x) > c)
    return (1.0);
  else {
    t = x / c;
    return (3.0 * t * t - 3.0 * t * t * t * t + t * t * t * t * t * t);
  }
}


x86 assembly (clang, -O0):
<Chi>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movaps 0xee6(%rip),%xmm1
pand   %xmm1,%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    113b <Chi+0x3b>
movsd  0xee7(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11c2 <Chi+0xc2>
movsd  -0x10(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xebe(%rip),%xmm1
mulsd  -0x20(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  0xeac(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<Chi>:
movapd 0xef8(%rip),%xmm2
andpd  %xmm0,%xmm2
ucomisd %xmm1,%xmm2
jbe    111b <Chi+0x1b>
movsd  0xefe(%rip),%xmm0
ret
divsd  %xmm1,%xmm0
movsd  0xee9(%rip),%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm0,%xmm2
movapd %xmm0,%xmm1
mulsd  %xmm2,%xmm1
mulsd  %xmm0,%xmm1
subsd  %xmm1,%xmm2
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
addsd  %xmm2,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @Chi(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
%7 = load double, double* %4
%8 = call double @llvm.fabs.f64(double %7)
%9 = load double, double* %5
%10 = fcmp ogt double %8, %9
br i1 %10, label %11, label %12
11: ; preds = %2
store double 1.000000e+00, double* %3
br label %40
12: ; preds = %2
%13 = load double, double* %4
%14 = load double, double* %5
%15 = fdiv double %13, %14
store double %15, double* %6
%16 = load double, double* %6
%17 = fmul double 3.000000e+00, %16
%18 = load double, double* %6
%19 = load double, double* %6
%20 = fmul double 3.000000e+00, %19
%21 = load double, double* %6
%22 = fmul double %20, %21
%23 = load double, double* %6
%24 = fmul double %22, %23
%25 = load double, double* %6
%26 = fmul double %24, %25
%27 = fneg double %26
%28 = call double @llvm.fmuladd.f64(double %17, double %18, double %27)
%29 = load double, double* %6
%30 = load double, double* %6
%31 = fmul double %29, %30
%32 = load double, double* %6
%33 = fmul double %31, %32
%34 = load double, double* %6
%35 = fmul double %33, %34
%36 = load double, double* %6
%37 = fmul double %35, %36
%38 = load double, double* %6
%39 = call double @llvm.fmuladd.f64(double %37, double %38, double %28)
store double %39, double* %3
br label %40
40: ; preds = %12, %11
%41 = load double, double* %3
ret double %41
}

LLVM IR (-O2):
define double @Chi(double %0, double %1) {
%3 = tail call double @llvm.fabs.f64(double %0)
%4 = fcmp ogt double %3, %1
br i1 %4, label %18, label %5
5: ; preds = %2
%6 = fdiv double %0, %1
%7 = fmul double %6, 3.000000e+00
%8 = fneg double %7
%9 = fmul double %6, %8
%10 = fmul double %6, %9
%11 = fmul double %6, %10
%12 = tail call double @llvm.fmuladd.f64(double %7, double %6, double %11)
%13 = fmul double %6, %6
%14 = fmul double %6, %13
%15 = fmul double %6, %14
%16 = fmul double %6, %15
%17 = tail call double @llvm.fmuladd.f64(double %16, double %6, double %12)
br label %18
18: ; preds = %2, %5
%19 = phi double [ %17, %5 ], [ 1.000000e+00, %2 ]
ret double %19
}