#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 /*<<< orphan*/ fisError(char *);
int pow(double, double);
double fisGeneralizedBellMf(double x, double *params) {
  double a = params[0], b = params[1], c = params[2];
  double tmp;
  if (a == 0)
    fisError("Illegal parameters in fisGeneralizedBellMf() --> a = 0");
  tmp = pow((x - c) / a, 2.0);
  if (tmp == 0 && b == 0)
    return (0.5);
  else if (tmp == 0 && b < 0)
    return (0.0);
  else
    return (1 / (1 + pow(tmp, b)));
}


x86 assembly (clang, -O0):
<fisGeneralizedBellMf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%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)
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    117e <fisGeneralizedBellMf+0x5e>
jp     117e <fisGeneralizedBellMf+0x5e>
lea    0xe97(%rip),%rdi
call   1030 <fisError@plt>
movsd  -0x10(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
divsd  -0x20(%rbp),%xmm0
movsd  0xe6b(%rip),%xmm1
call   1040 <pow@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11e5 <fisGeneralizedBellMf+0xc5>
jp     11e5 <fisGeneralizedBellMf+0xc5>
movsd  -0x28(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11e5 <fisGeneralizedBellMf+0xc5>
jp     11e5 <fisGeneralizedBellMf+0xc5>
movsd  0xe2d(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    123d <fisGeneralizedBellMf+0x11d>
movsd  -0x38(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1218 <fisGeneralizedBellMf+0xf8>
jp     1218 <fisGeneralizedBellMf+0xf8>
xorps  %xmm0,%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    1218 <fisGeneralizedBellMf+0xf8>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    123d <fisGeneralizedBellMf+0x11d>
movsd  -0x38(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
call   1040 <pow@plt>
mov    %eax,%ecx
add    $0x1,%ecx
mov    $0x1,%eax
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fisGeneralizedBellMf>:
sub    $0x28,%rsp
movapd %xmm0,%xmm2
movsd  (%rdi),%xmm1
movsd  0x8(%rdi),%xmm0
movsd  %xmm0,0x20(%rsp)
movsd  0x10(%rdi),%xmm3
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jne    1178 <fisGeneralizedBellMf+0x58>
jp     1178 <fisGeneralizedBellMf+0x58>
lea    0xec1(%rip),%rdi
movsd  %xmm2,0x18(%rsp)
movsd  %xmm1,0x10(%rsp)
movsd  %xmm3,0x8(%rsp)
call   1030 <fisError@plt>
movsd  0x8(%rsp),%xmm3
movsd  0x10(%rsp),%xmm1
movsd  0x18(%rsp),%xmm2
subsd  %xmm3,%xmm2
divsd  %xmm1,%xmm2
movsd  0xe78(%rip),%xmm1
movapd %xmm2,%xmm0
call   1040 <pow@plt>
test   %eax,%eax
movsd  0x20(%rsp),%xmm1
jne    11b4 <fisGeneralizedBellMf+0x94>
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jne    11b4 <fisGeneralizedBellMf+0x94>
jp     11b4 <fisGeneralizedBellMf+0x94>
movsd  0xe59(%rip),%xmm0
add    $0x28,%rsp
ret
test   %eax,%eax
jne    11cb <fisGeneralizedBellMf+0xab>
xorpd  %xmm0,%xmm0
xorpd  %xmm2,%xmm2
ucomisd %xmm1,%xmm2
jbe    11cb <fisGeneralizedBellMf+0xab>
add    $0x28,%rsp
ret
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
call   1040 <pow@plt>
lea    0x1(%rax),%ecx
add    $0x2,%eax
xor    %edx,%edx
cmp    $0x3,%eax
cmovb  %ecx,%edx
xorps  %xmm0,%xmm0
cvtsi2sd %edx,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
@.str = [55 x i8] c"Illegal parameters in fisGeneralizedBellMf() --> a = 0\00"
define double @fisGeneralizedBellMf(double %0, double* %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double*
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
store double %0, double* %4
store double* %1, double** %5
%10 = load double*, double** %5
%11 = getelementptr inbounds double, double* %10, i64 0
%12 = load double, double* %11
store double %12, double* %6
%13 = load double*, double** %5
%14 = getelementptr inbounds double, double* %13, i64 1
%15 = load double, double* %14
store double %15, double* %7
%16 = load double*, double** %5
%17 = getelementptr inbounds double, double* %16, i64 2
%18 = load double, double* %17
store double %18, double* %8
%19 = load double, double* %6
%20 = fcmp oeq double %19, 0.000000e+00
br i1 %20, label %21, label %23
21: ; preds = %2
%22 = call i32 @fisError(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
br label %23
23: ; preds = %21, %2
%24 = load double, double* %4
%25 = load double, double* %8
%26 = fsub double %24, %25
%27 = load double, double* %6
%28 = fdiv double %26, %27
%29 = call i32 @pow(double %28, double 2.000000e+00)
%30 = sitofp i32 %29 to double
store double %30, double* %9
%31 = load double, double* %9
%32 = fcmp oeq double %31, 0.000000e+00
br i1 %32, label %33, label %37
33: ; preds = %23
%34 = load double, double* %7
%35 = fcmp oeq double %34, 0.000000e+00
br i1 %35, label %36, label %37
36: ; preds = %33
store double 5.000000e-01, double* %3
br label %51
37: ; preds = %33, %23
%38 = load double, double* %9
%39 = fcmp oeq double %38, 0.000000e+00
br i1 %39, label %40, label %44
40: ; preds = %37
%41 = load double, double* %7
%42 = fcmp olt double %41, 0.000000e+00
br i1 %42, label %43, label %44
43: ; preds = %40
store double 0.000000e+00, double* %3
br label %51
44: ; preds = %40, %37
%45 = load double, double* %9
%46 = load double, double* %7
%47 = call i32 @pow(double %45, double %46)
%48 = add nsw i32 1, %47
%49 = sdiv i32 1, %48
%50 = sitofp i32 %49 to double
store double %50, double* %3
br label %51
51: ; preds = %44, %43, %36
%52 = load double, double* %3
ret double %52
}

LLVM IR (-O2):
@.str = [55 x i8] c"Illegal parameters in fisGeneralizedBellMf() --> a = 0\00"
define double @fisGeneralizedBellMf(double %0, double* nocapture %1) {
%3 = load double, double* %1
%4 = getelementptr inbounds double, double* %1, i64 1
%5 = load double, double* %4
%6 = getelementptr inbounds double, double* %1, i64 2
%7 = load double, double* %6
%8 = fcmp oeq double %3, 0.000000e+00
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = tail call i32 @fisError(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %2
%12 = fsub double %0, %7
%13 = fdiv double %12, %3
%14 = tail call i32 @pow(double %13, double 2.000000e+00)
%15 = sitofp i32 %14 to double
%16 = icmp eq i32 %14, 0
%17 = fcmp oeq double %5, 0.000000e+00
%18 = select i1 %16, i1 %17, i1 false
br i1 %18, label %29, label %19
19: ; preds = %11
%20 = fcmp olt double %5, 0.000000e+00
%21 = select i1 %16, i1 %20, i1 false
br i1 %21, label %29, label %22
22: ; preds = %19
%23 = tail call i32 @pow(double %15, double %5)
%24 = add nsw i32 %23, 1
%25 = add i32 %23, 2
%26 = icmp ult i32 %25, 3
%27 = select i1 %26, i32 %24, i32 0
%28 = sitofp i32 %27 to double
br label %29
29: ; preds = %19, %11, %22
%30 = phi double [ %28, %22 ], [ 5.000000e-01, %11 ], [ 0.000000e+00, %19 ]
ret double %30
}