#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 */
int pow(double, double);
double fisZMf(double x, double *params) {
  double a = params[0], b = params[1];
  double out;
  if (a >= b)
    return (x <= (a + b) / 2);
  if (x <= a)
    out = 1;
  else if (x <= (a + b) / 2)
    out = 1 - 2 * pow((x - a) / (b - a), 2.0);
  else if (x <= b)
    out = 2 * pow((b - x) / (b - a), 2.0);
  else
    out = 0;
  return (out);
}


x86 assembly (clang, -O0):
<fisZMf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
ucomisd -0x28(%rbp),%xmm0
jb     1181 <fisZMf+0x71>
movsd  -0x10(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  0xe9d(%rip),%xmm2
divsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
setae  %al
and    $0x1,%al
movzbl %al,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1271 <fisZMf+0x161>
movsd  -0x10(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     11a7 <fisZMf+0x97>
movsd  0xe6b(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    1267 <fisZMf+0x157>
movsd  -0x10(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  0xe42(%rip),%xmm2
divsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jb     120b <fisZMf+0xfb>
movsd  -0x10(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
subsd  -0x20(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  0xe14(%rip),%xmm1
call   1030 <pow@plt>
mov    %eax,%ecx
shl    $0x1,%ecx
mov    $0x1,%eax
sub    %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    1262 <fisZMf+0x152>
movsd  -0x10(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1255 <fisZMf+0x145>
movsd  -0x28(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
subsd  -0x20(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  0xdc1(%rip),%xmm1
call   1030 <pow@plt>
shl    $0x1,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    125d <fisZMf+0x14d>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    1262 <fisZMf+0x152>
jmp    1267 <fisZMf+0x157>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fisZMf>:
push   %rax
movsd  (%rdi),%xmm3
movsd  0x8(%rdi),%xmm4
ucomisd %xmm4,%xmm3
jae    1172 <fisZMf+0x62>
ucomisd %xmm0,%xmm3
jae    1191 <fisZMf+0x81>
movapd %xmm3,%xmm1
addsd  %xmm4,%xmm1
mulsd  0xeca(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    119b <fisZMf+0x8b>
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm4
jb     11c4 <fisZMf+0xb4>
movapd %xmm4,%xmm2
subsd  %xmm0,%xmm2
subsd  %xmm3,%xmm4
divsd  %xmm4,%xmm2
movsd  0xeb2(%rip),%xmm1
movapd %xmm2,%xmm0
call   1030 <pow@plt>
add    %eax,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
jmp    11c4 <fisZMf+0xb4>
addsd  %xmm4,%xmm3
mulsd  0xe82(%rip),%xmm3
cmplesd %xmm3,%xmm0
movsd  0xe7d(%rip),%xmm1
andpd  %xmm0,%xmm1
jmp    11c4 <fisZMf+0xb4>
movsd  0xe6f(%rip),%xmm1
jmp    11c4 <fisZMf+0xb4>
subsd  %xmm3,%xmm0
subsd  %xmm3,%xmm4
divsd  %xmm4,%xmm0
movsd  0xe61(%rip),%xmm1
call   1030 <pow@plt>
add    %eax,%eax
mov    $0x1,%ecx
sub    %eax,%ecx
xorps  %xmm1,%xmm1
cvtsi2sd %ecx,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

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

LLVM IR (-O2):
define double @fisZMf(double %0, double* nocapture %1) {
%3 = load double, double* %1
%4 = getelementptr inbounds double, double* %1, i64 1
%5 = load double, double* %4
%6 = fcmp ult double %3, %5
br i1 %6, label %12, label %7
7: ; preds = %2
%8 = fadd double %3, %5
%9 = fmul double %8, 5.000000e-01
%10 = fcmp oge double %9, %0
%11 = uitofp i1 %10 to double
br label %35
12: ; preds = %2
%13 = fcmp ult double %3, %0
br i1 %13, label %14, label %35
14: ; preds = %12
%15 = fadd double %3, %5
%16 = fmul double %15, 5.000000e-01
%17 = fcmp ult double %16, %0
br i1 %17, label %26, label %18
18: ; preds = %14
%19 = fsub double %0, %3
%20 = fsub double %5, %3
%21 = fdiv double %19, %20
%22 = tail call i32 @pow(double %21, double 2.000000e+00)
%23 = mul i32 %22, -2
%24 = or i32 %23, 1
%25 = sitofp i32 %24 to double
br label %35
26: ; preds = %14
%27 = fcmp ult double %5, %0
br i1 %27, label %35, label %28
28: ; preds = %26
%29 = fsub double %5, %0
%30 = fsub double %5, %3
%31 = fdiv double %29, %30
%32 = tail call i32 @pow(double %31, double 2.000000e+00)
%33 = shl nsw i32 %32, 1
%34 = sitofp i32 %33 to double
br label %35
35: ; preds = %28, %18, %12, %26, %7
%36 = phi double [ %11, %7 ], [ %25, %18 ], [ %34, %28 ], [ 1.000000e+00, %12 ], [ 0.000000e+00, %26 ]
ret double %36
}