#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 floor(double);
double s_decept(double y, double A, double B, double C) {
  double tmp1 = floor(y - A + B) * (1.0 - C + (A - B) / B) / (A - B);
  double tmp2 =
      floor(A + B - y) * (1.0 - C + (1.0 - A - B) / B) / (1.0 - A - B);
  double result = 1.0 + (fabs(y - A) - B) * (tmp1 + tmp2 + 1.0 / B);
  if (result > 1)
    result = 1;
  if (result < 0)
    result = 0;
  return result;
}


x86 assembly (clang, -O0):
<s_decept>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
call   1030 <floor@plt>
movsd  0xeb8(%rip),%xmm1
subsd  -0x20(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm2
subsd  -0x18(%rbp),%xmm2
divsd  -0x18(%rbp),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  -0x10(%rbp),%xmm1
subsd  -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
subsd  -0x8(%rbp),%xmm0
call   1030 <floor@plt>
movsd  0xe6d(%rip),%xmm1
subsd  -0x20(%rbp),%xmm1
movsd  0xe60(%rip),%xmm2
subsd  -0x10(%rbp),%xmm2
subsd  -0x18(%rbp),%xmm2
divsd  -0x18(%rbp),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe41(%rip),%xmm1
subsd  -0x10(%rbp),%xmm1
subsd  -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movaps 0xe2d(%rip),%xmm1
pand   %xmm1,%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
addsd  -0x30(%rbp),%xmm1
movsd  0xe02(%rip),%xmm2
divsd  -0x18(%rbp),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xded(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  0xdd7(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1240 <s_decept+0x130>
movsd  0xdc5(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x38(%rbp),%xmm0
jbe    1256 <s_decept+0x146>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<s_decept>:
sub    $0x68,%rsp
movsd  %xmm3,0x10(%rsp)
movapd %xmm2,0x30(%rsp)
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,0x28(%rsp)
subsd  %xmm1,%xmm0
movapd %xmm0,0x50(%rsp)
addsd  %xmm2,%xmm0
call   1030 <floor@plt>
movsd  0xeb9(%rip),%xmm4
subsd  0x10(%rsp),%xmm4
movsd  %xmm4,0x20(%rsp)
movsd  0x8(%rsp),%xmm3
movapd %xmm3,%xmm2
movapd 0x30(%rsp),%xmm1
subsd  %xmm1,%xmm2
movapd %xmm2,0x10(%rsp)
divsd  %xmm1,%xmm2
addsd  %xmm4,%xmm2
mulsd  %xmm0,%xmm2
movapd %xmm2,0x40(%rsp)
movapd %xmm3,%xmm0
addsd  %xmm1,%xmm0
subsd  0x28(%rsp),%xmm0
call   1030 <floor@plt>
movsd  0xe66(%rip),%xmm4
movapd %xmm4,%xmm1
subsd  0x8(%rsp),%xmm1
movapd 0x30(%rsp),%xmm5
subsd  %xmm5,%xmm1
movapd %xmm1,%xmm2
divsd  %xmm5,%xmm2
addsd  0x20(%rsp),%xmm2
mulsd  %xmm0,%xmm2
divsd  %xmm1,%xmm2
movapd 0x50(%rsp),%xmm0
andpd  0xe3e(%rip),%xmm0
subsd  %xmm5,%xmm0
movapd %xmm0,%xmm3
movapd 0xe3e(%rip),%xmm0
unpcklpd 0x40(%rsp),%xmm0
unpcklpd 0x10(%rsp),%xmm5
divpd  %xmm5,%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
addsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mulsd  %xmm3,%xmm1
movapd %xmm4,%xmm0
addsd  %xmm4,%xmm1
minsd  %xmm1,%xmm0
movapd %xmm0,%xmm1
xorpd  %xmm0,%xmm0
maxsd  %xmm1,%xmm0
add    $0x68,%rsp
ret

LLVM IR (-O0):
define double @s_decept(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%12 = load double, double* %5
%13 = load double, double* %6
%14 = fsub double %12, %13
%15 = load double, double* %7
%16 = fadd double %14, %15
%17 = call double @llvm.floor.f64(double %16)
%18 = load double, double* %8
%19 = fsub double 1.000000e+00, %18
%20 = load double, double* %6
%21 = load double, double* %7
%22 = fsub double %20, %21
%23 = load double, double* %7
%24 = fdiv double %22, %23
%25 = fadd double %19, %24
%26 = fmul double %17, %25
%27 = load double, double* %6
%28 = load double, double* %7
%29 = fsub double %27, %28
%30 = fdiv double %26, %29
store double %30, double* %9
%31 = load double, double* %6
%32 = load double, double* %7
%33 = fadd double %31, %32
%34 = load double, double* %5
%35 = fsub double %33, %34
%36 = call double @llvm.floor.f64(double %35)
%37 = load double, double* %8
%38 = fsub double 1.000000e+00, %37
%39 = load double, double* %6
%40 = fsub double 1.000000e+00, %39
%41 = load double, double* %7
%42 = fsub double %40, %41
%43 = load double, double* %7
%44 = fdiv double %42, %43
%45 = fadd double %38, %44
%46 = fmul double %36, %45
%47 = load double, double* %6
%48 = fsub double 1.000000e+00, %47
%49 = load double, double* %7
%50 = fsub double %48, %49
%51 = fdiv double %46, %50
store double %51, double* %10
%52 = load double, double* %5
%53 = load double, double* %6
%54 = fsub double %52, %53
%55 = call double @llvm.fabs.f64(double %54)
%56 = load double, double* %7
%57 = fsub double %55, %56
%58 = load double, double* %9
%59 = load double, double* %10
%60 = fadd double %58, %59
%61 = load double, double* %7
%62 = fdiv double 1.000000e+00, %61
%63 = fadd double %60, %62
%64 = call double @llvm.fmuladd.f64(double %57, double %63, double 1.000000e+00)
store double %64, double* %11
%65 = load double, double* %11
%66 = fcmp ogt double %65, 1.000000e+00
br i1 %66, label %67, label %68
67: ; preds = %4
store double 1.000000e+00, double* %11
br label %68
68: ; preds = %67, %4
%69 = load double, double* %11
%70 = fcmp olt double %69, 0.000000e+00
br i1 %70, label %71, label %72
71: ; preds = %68
store double 0.000000e+00, double* %11
br label %72
72: ; preds = %71, %68
%73 = load double, double* %11
ret double %73
}

LLVM IR (-O2):
define double @s_decept(double %0, double %1, double %2, double %3) {
%5 = fsub double %0, %1
%6 = fadd double %5, %2
%7 = tail call double @llvm.floor.f64(double %6)
%8 = fsub double 1.000000e+00, %3
%9 = fsub double %1, %2
%10 = fdiv double %9, %2
%11 = fadd double %8, %10
%12 = fmul double %7, %11
%13 = fadd double %1, %2
%14 = fsub double %13, %0
%15 = tail call double @llvm.floor.f64(double %14)
%16 = fsub double 1.000000e+00, %1
%17 = fsub double %16, %2
%18 = fdiv double %17, %2
%19 = fadd double %8, %18
%20 = fmul double %15, %19
%21 = fdiv double %20, %17
%22 = tail call double @llvm.fabs.f64(double %5)
%23 = fsub double %22, %2
%24 = insertelement <2 x double> <double 1.000000e+00, double poison>, double %12, i64 1
%25 = insertelement <2 x double> poison, double %2, i64 0
%26 = insertelement <2 x double> %25, double %9, i64 1
%27 = fdiv <2 x double> %24, %26
%28 = extractelement <2 x double> %27, i64 1
%29 = fadd double %28, %21
%30 = extractelement <2 x double> %27, i64 0
%31 = fadd double %30, %29
%32 = tail call double @llvm.fmuladd.f64(double %23, double %31, double 1.000000e+00)
%33 = fcmp ogt double %32, 1.000000e+00
%34 = select i1 %33, double 1.000000e+00, double %32
%35 = fcmp olt double %34, 0.000000e+00
%36 = select i1 %35, double 0.000000e+00, double %34
ret double %36
}