#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 zs_to_Ec(double zs, long entries) {
  double e, z;
  if (entries < 5)
    return 0.0;
  z = (zs - 50.0) / 10.0;
  if (z > 400.0)
    return 1.0;
  e = exp(-1.28254983016186409554 * z - 0.57721566490153286060);
  return (double)entries * (e > .01 ? exp(-e) : 1.0 - e);
}


x86 assembly (clang, -O0):
<zs_to_Ec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
cmpq   $0x5,-0x18(%rbp)
jge    1139 <zs_to_Ec+0x29>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    121d <zs_to_Ec+0x10d>
movsd  -0x10(%rbp),%xmm0
movsd  0xeca(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xeb6(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xe98(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1184 <zs_to_Ec+0x74>
movsd  0xeb6(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    121d <zs_to_Ec+0x10d>
movsd  -0x28(%rbp),%xmm0
movsd  0xe8f(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe8b(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1030 <exp@plt>
movsd  %xmm0,-0x20(%rbp)
cvtsi2sdq -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xe55(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11f8 <zs_to_Ec+0xe8>
movsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1030 <exp@plt>
movsd  %xmm0,-0x38(%rbp)
jmp    120a <zs_to_Ec+0xfa>
movsd  0xe30(%rip),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zs_to_Ec>:
push   %rbx
sub    $0x10,%rsp
movapd %xmm0,%xmm1
xorpd  %xmm0,%xmm0
cmp    $0x5,%rdi
jl     11a9 <zs_to_Ec+0x99>
addsd  0xed1(%rip),%xmm1
divsd  0xed1(%rip),%xmm1
ucomisd 0xed9(%rip),%xmm1
jbe    114b <zs_to_Ec+0x3b>
movsd  0xec7(%rip),%xmm0
jmp    11a9 <zs_to_Ec+0x99>
mov    %rdi,%rbx
mulsd  0xeca(%rip),%xmm1
addsd  0xeca(%rip),%xmm1
movapd %xmm1,%xmm0
call   1030 <exp@plt>
cvtsi2sd %rbx,%xmm2
movapd %xmm0,%xmm1
ucomisd 0xeb8(%rip),%xmm0
jbe    1199 <zs_to_Ec+0x89>
xorpd  0xebe(%rip),%xmm1
movapd %xmm1,%xmm0
movsd  %xmm2,0x8(%rsp)
call   1030 <exp@plt>
movsd  0x8(%rsp),%xmm2
jmp    11a5 <zs_to_Ec+0x95>
movsd  0xe6f(%rip),%xmm0
subsd  %xmm1,%xmm0
mulsd  %xmm2,%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @zs_to_Ec(double %0, i64 %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca i64
%6 = alloca double
%7 = alloca double
store double %0, double* %4
store i64 %1, i64* %5
%8 = load i64, i64* %5
%9 = icmp slt i64 %8, 5
br i1 %9, label %10, label %11
10: ; preds = %2
store double 0.000000e+00, double* %3
br label %36
11: ; preds = %2
%12 = load double, double* %4
%13 = fsub double %12, 5.000000e+01
%14 = fdiv double %13, 1.000000e+01
store double %14, double* %7
%15 = load double, double* %7
%16 = fcmp ogt double %15, 4.000000e+02
br i1 %16, label %17, label %18
17: ; preds = %11
store double 1.000000e+00, double* %3
br label %36
18: ; preds = %11
%19 = load double, double* %7
%20 = call double @llvm.fmuladd.f64(double 0xBFF48552F88091A8, double %19, double 0xBFE2788CFC6FB619)
%21 = call double @exp(double %20)
store double %21, double* %6
%22 = load i64, i64* %5
%23 = sitofp i64 %22 to double
%24 = load double, double* %6
%25 = fcmp ogt double %24, 1.000000e-02
br i1 %25, label %26, label %30
26: ; preds = %18
%27 = load double, double* %6
%28 = fneg double %27
%29 = call double @exp(double %28)
br label %33
30: ; preds = %18
%31 = load double, double* %6
%32 = fsub double 1.000000e+00, %31
br label %33
33: ; preds = %30, %26
%34 = phi double [ %29, %26 ], [ %32, %30 ]
%35 = fmul double %23, %34
store double %35, double* %3
br label %36
36: ; preds = %33, %17, %10
%37 = load double, double* %3
ret double %37
}

LLVM IR (-O2):
define double @zs_to_Ec(double %0, i64 %1) {
%3 = icmp slt i64 %1, 5
br i1 %3, label %21, label %4
4: ; preds = %2
%5 = fadd double %0, -5.000000e+01
%6 = fdiv double %5, 1.000000e+01
%7 = fcmp ogt double %6, 4.000000e+02
br i1 %7, label %21, label %8
8: ; preds = %4
%9 = tail call double @llvm.fmuladd.f64(double %6, double 0xBFF48552F88091A8, double 0xBFE2788CFC6FB619)
%10 = tail call double @exp(double %9)
%11 = sitofp i64 %1 to double
%12 = fcmp ogt double %10, 1.000000e-02
br i1 %12, label %13, label %16
13: ; preds = %8
%14 = fneg double %10
%15 = tail call double @exp(double %14)
br label %18
16: ; preds = %8
%17 = fsub double 1.000000e+00, %10
br label %18
18: ; preds = %16, %13
%19 = phi double [ %15, %13 ], [ %17, %16 ]
%20 = fmul double %19, %11
br label %21
21: ; preds = %4, %2, %18
%22 = phi double [ %20, %18 ], [ 0.000000e+00, %2 ], [ 1.000000e+00, %4 ]
ret double %22
}