#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 exp(double);
double fabs(double);
double fisDifferenceSigmoidMf(double x, double *params) {
  double a1 = params[0], c1 = params[1], a2 = params[2], c2 = params[3];
  double tmp1 = 1 / (1 + exp(-a1 * (x - c1)));
  double tmp2 = 1 / (1 + exp(-a2 * (x - c2)));
  return (fabs(tmp1 - tmp2));
}


x86 assembly (clang, -O0):
<fisDifferenceSigmoidMf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x18(%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  -0x8(%rbp),%xmm1
subsd  -0x20(%rbp),%xmm1
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
mov    %eax,%ecx
add    $0x1,%ecx
mov    $0x1,%eax
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x28(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  -0x8(%rbp),%xmm1
subsd  -0x30(%rbp),%xmm1
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
mov    %eax,%ecx
add    $0x1,%ecx
mov    $0x1,%eax
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm0
subsd  -0x40(%rbp),%xmm0
movaps 0xe0d(%rip),%xmm1
pand   %xmm1,%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fisDifferenceSigmoidMf>:
push   %rbx
sub    $0x30,%rsp
movapd %xmm0,%xmm2
movsd  (%rdi),%xmm1
movsd  0x10(%rdi),%xmm0
movaps %xmm0,0x20(%rsp)
movapd %xmm2,%xmm0
subsd  0x8(%rdi),%xmm0
xorpd  0xec8(%rip),%xmm1
mulsd  %xmm1,%xmm0
subsd  0x18(%rdi),%xmm2
movsd  %xmm2,0x8(%rsp)
call   1030 <exp@plt>
lea    0x1(%rax),%ecx
add    $0x2,%eax
xor    %ebx,%ebx
cmp    $0x3,%eax
cmovae %ebx,%ecx
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
movapd %xmm0,0x10(%rsp)
movapd 0x20(%rsp),%xmm0
xorpd  0xe8b(%rip),%xmm0
mulsd  0x8(%rsp),%xmm0
call   1030 <exp@plt>
lea    0x1(%rax),%ecx
add    $0x2,%eax
cmp    $0x3,%eax
cmovae %ebx,%ecx
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
movapd 0x10(%rsp),%xmm1
subsd  %xmm0,%xmm1
andpd  0xe6b(%rip),%xmm1
movapd %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @fisDifferenceSigmoidMf(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
%10 = alloca double
store double %0, double* %3
store double* %1, double** %4
%11 = load double*, double** %4
%12 = getelementptr inbounds double, double* %11, i64 0
%13 = load double, double* %12
store double %13, double* %5
%14 = load double*, double** %4
%15 = getelementptr inbounds double, double* %14, i64 1
%16 = load double, double* %15
store double %16, double* %6
%17 = load double*, double** %4
%18 = getelementptr inbounds double, double* %17, i64 2
%19 = load double, double* %18
store double %19, double* %7
%20 = load double*, double** %4
%21 = getelementptr inbounds double, double* %20, i64 3
%22 = load double, double* %21
store double %22, double* %8
%23 = load double, double* %5
%24 = fneg double %23
%25 = load double, double* %3
%26 = load double, double* %6
%27 = fsub double %25, %26
%28 = fmul double %24, %27
%29 = call i32 @exp(double %28)
%30 = add nsw i32 1, %29
%31 = sdiv i32 1, %30
%32 = sitofp i32 %31 to double
store double %32, double* %9
%33 = load double, double* %7
%34 = fneg double %33
%35 = load double, double* %3
%36 = load double, double* %8
%37 = fsub double %35, %36
%38 = fmul double %34, %37
%39 = call i32 @exp(double %38)
%40 = add nsw i32 1, %39
%41 = sdiv i32 1, %40
%42 = sitofp i32 %41 to double
store double %42, double* %10
%43 = load double, double* %9
%44 = load double, double* %10
%45 = fsub double %43, %44
%46 = call double @llvm.fabs.f64(double %45)
ret double %46
}

LLVM IR (-O2):
define double @fisDifferenceSigmoidMf(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 = getelementptr inbounds double, double* %1, i64 3
%9 = load double, double* %8
%10 = fneg double %3
%11 = fsub double %0, %5
%12 = fmul double %11, %10
%13 = tail call i32 @exp(double %12)
%14 = add nsw i32 %13, 1
%15 = add i32 %13, 2
%16 = icmp ult i32 %15, 3
%17 = select i1 %16, i32 %14, i32 0
%18 = sitofp i32 %17 to double
%19 = fneg double %7
%20 = fsub double %0, %9
%21 = fmul double %20, %19
%22 = tail call i32 @exp(double %21)
%23 = add nsw i32 %22, 1
%24 = add i32 %22, 2
%25 = icmp ult i32 %24, 3
%26 = select i1 %25, i32 %23, i32 0
%27 = sitofp i32 %26 to double
%28 = fsub double %18, %27
%29 = tail call double @llvm.fabs.f64(double %28)
ret double %29
}