#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 exp(double);
double derive_log(double x) {
  if (x > 84.0 || x < -84.0)
    return 0.0;
  return 2.0 / ((1.0 + exp(-x)) * (1.0 + exp(x)));
}


x86 assembly (clang, -O0):
<derive_log>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xed6(%rip),%xmm1
ucomisd %xmm1,%xmm0
ja     1147 <derive_log+0x37>
movsd  0xecc(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1154 <derive_log+0x44>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11bc <derive_log+0xac>
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  0xe98(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <exp@plt>
movsd  -0x18(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  0xe75(%rip),%xmm0
addsd  %xmm2,%xmm0
mulsd  %xmm0,%xmm1
movsd  0xe5d(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<derive_log>:
sub    $0x28,%rsp
movapd %xmm0,%xmm2
ucomisd 0xee0(%rip),%xmm0
xorpd  %xmm0,%xmm0
ja     1182 <derive_log+0x72>
movsd  0xeda(%rip),%xmm1
ucomisd %xmm2,%xmm1
ja     1182 <derive_log+0x72>
movapd 0xee4(%rip),%xmm0
xorpd  %xmm2,%xmm0
movapd %xmm2,0x10(%rsp)
call   1030 <exp@plt>
addsd  0xebd(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
movapd 0x10(%rsp),%xmm0
call   1030 <exp@plt>
movapd %xmm0,%xmm1
addsd  0xea0(%rip),%xmm1
mulsd  0x8(%rsp),%xmm1
movsd  0xe9a(%rip),%xmm0
divsd  %xmm1,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define double @derive_log(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = fcmp ogt double %4, 8.400000e+01
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = load double, double* %3
%8 = fcmp olt double %7, -8.400000e+01
br i1 %8, label %9, label %10
9: ; preds = %6, %1
store double 0.000000e+00, double* %2
br label %20
10: ; preds = %6
%11 = load double, double* %3
%12 = fneg double %11
%13 = call double @exp(double %12)
%14 = fadd double 1.000000e+00, %13
%15 = load double, double* %3
%16 = call double @exp(double %15)
%17 = fadd double 1.000000e+00, %16
%18 = fmul double %14, %17
%19 = fdiv double 2.000000e+00, %18
store double %19, double* %2
br label %20
20: ; preds = %10, %9
%21 = load double, double* %2
ret double %21
}

LLVM IR (-O2):
define double @derive_log(double %0) {
%2 = fcmp ogt double %0, 8.400000e+01
%3 = fcmp olt double %0, -8.400000e+01
%4 = or i1 %2, %3
br i1 %4, label %13, label %5
5: ; preds = %1
%6 = fneg double %0
%7 = tail call double @exp(double %6)
%8 = fadd double %7, 1.000000e+00
%9 = tail call double @exp(double %0)
%10 = fadd double %9, 1.000000e+00
%11 = fmul double %8, %10
%12 = fdiv double 2.000000e+00, %11
br label %13
13: ; preds = %1, %5
%14 = phi double [ %12, %5 ], [ 0.000000e+00, %1 ]
ret double %14
}