#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 log(float);
float Biased(int N, int E, float ExpE) {
  float Rate;
  if (ExpE <= 1E-6) {
    return (float)((E == 0 ? 0.0 : 1E6));
  } else if (ExpE >= N - 1E-6) {
    return (float)((E == N ? 0.0 : 1E6));
  }
  Rate = (float)(ExpE / N);
  return -E * ((Rate) <= 0 ? 0.0 : log((float)Rate) / 0.69314718055994530942) -
         (N - E) * ((1 - Rate) <= 0
                        ? 0.0
                        : log((float)1 - Rate) / 0.69314718055994530942);
}


x86 assembly (clang, -O0):
<Biased>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xecc(%rip),%xmm0
ucomisd %xmm1,%xmm0
jb     117c <Biased+0x6c>
mov    -0xc(%rbp),%eax
xorps  %xmm0,%xmm0
movsd  0xec4(%rip),%xmm1
movsd  %xmm1,-0x28(%rbp)
cmp    $0x0,%eax
movsd  %xmm0,-0x20(%rbp)
je     1169 <Biased+0x59>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    12dd <Biased+0x1cd>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
cvtsi2sdl -0x8(%rbp),%xmm1
movsd  0xe6e(%rip),%xmm2
subsd  %xmm2,%xmm1
ucomisd %xmm1,%xmm0
jb     11e0 <Biased+0xd0>
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
xorps  %xmm0,%xmm0
movsd  0xe5f(%rip),%xmm1
movsd  %xmm1,-0x38(%rbp)
cmp    %ecx,%eax
movsd  %xmm0,-0x30(%rbp)
je     11cd <Biased+0xbd>
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    12dd <Biased+0x1cd>
jmp    11e5 <Biased+0xd5>
movss  -0x10(%rbp),%xmm0
cvtsi2ssl -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
xor    %eax,%eax
sub    -0xc(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x40(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x14(%rbp),%xmm0
jb     1220 <Biased+0x110>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    123b <Biased+0x12b>
movss  -0x14(%rbp),%xmm0
call   1030 <log@plt>
movsd  0xdd6(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x50(%rbp)
movss  0xdbc(%rip),%xmm1
subss  -0x14(%rbp),%xmm1
xorps  %xmm0,%xmm0
ucomiss %xmm1,%xmm0
jb     127a <Biased+0x16a>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x60(%rbp)
jmp    129d <Biased+0x18d>
movss  0xd96(%rip),%xmm0
subss  -0x14(%rbp),%xmm0
call   1030 <log@plt>
movsd  0xd74(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x58(%rbp),%xmm2
movsd  -0x40(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
movsd  -0x60(%rbp),%xmm3
mulsd  %xmm3,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Biased>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
movaps %xmm0,%xmm2
mov    %esi,%ebx
cvtss2sd %xmm0,%xmm0
movsd  0xed7(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    11f6 <Biased+0xe6>
mov    %edi,%ebp
xorps  %xmm1,%xmm1
cvtsi2sd %edi,%xmm1
addsd  0xecc(%rip),%xmm1
ucomisd %xmm1,%xmm0
jae    1216 <Biased+0x106>
xorps  %xmm0,%xmm0
cvtsi2ss %ebp,%xmm0
divss  %xmm0,%xmm2
mov    %ebx,%r14d
neg    %r14d
xorpd  %xmm3,%xmm3
xorps  %xmm6,%xmm6
ucomiss %xmm2,%xmm6
xorpd  %xmm4,%xmm4
jae    1195 <Biased+0x85>
movaps %xmm2,%xmm0
movss  %xmm2,0x8(%rsp)
call   1030 <log@plt>
xorps  %xmm6,%xmm6
xorpd  %xmm3,%xmm3
movss  0x8(%rsp),%xmm2
movaps %xmm0,%xmm4
divsd  0xe83(%rip),%xmm4
xorps  %xmm1,%xmm1
cvtsi2sd %r14d,%xmm1
sub    %ebx,%ebp
cvtsi2sd %ebp,%xmm5
movss  0xe75(%rip),%xmm0
subss  %xmm2,%xmm0
ucomiss %xmm0,%xmm6
jae    11e8 <Biased+0xd8>
movsd  %xmm1,0x8(%rsp)
movsd  %xmm4,0x18(%rsp)
movsd  %xmm5,0x10(%rsp)
call   1030 <log@plt>
movsd  0x10(%rsp),%xmm5
movsd  0x18(%rsp),%xmm4
movsd  0x8(%rsp),%xmm1
movaps %xmm0,%xmm3
divsd  0xe30(%rip),%xmm3
mulsd  %xmm3,%xmm5
mulsd  %xmm4,%xmm1
subsd  %xmm5,%xmm1
jmp    1206 <Biased+0xf6>
xorpd  %xmm1,%xmm1
test   %ebx,%ebx
je     1206 <Biased+0xf6>
movsd  0xe02(%rip),%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
xorpd  %xmm1,%xmm1
cmp    %ebx,%ebp
je     1206 <Biased+0xf6>
jmp    11fe <Biased+0xee>

LLVM IR (-O0):
define float @Biased(i32 %0, i32 %1, float %2) {
%4 = alloca float
%5 = alloca i32
%6 = alloca i32
%7 = alloca float
%8 = alloca float
store i32 %0, i32* %5
store i32 %1, i32* %6
store float %2, float* %7
%9 = load float, float* %7
%10 = fpext float %9 to double
%11 = fcmp ole double %10, 0x3EB0C6F7A0B5ED8D
br i1 %11, label %12, label %18
12: ; preds = %3
%13 = load i32, i32* %6
%14 = icmp eq i32 %13, 0
%15 = zext i1 %14 to i64
%16 = select i1 %14, double 0.000000e+00, double 1.000000e+06
%17 = fptrunc double %16 to float
store float %17, float* %4
br label %69
18: ; preds = %3
%19 = load float, float* %7
%20 = fpext float %19 to double
%21 = load i32, i32* %5
%22 = sitofp i32 %21 to double
%23 = fsub double %22, 0x3EB0C6F7A0B5ED8D
%24 = fcmp oge double %20, %23
br i1 %24, label %25, label %32
25: ; preds = %18
%26 = load i32, i32* %6
%27 = load i32, i32* %5
%28 = icmp eq i32 %26, %27
%29 = zext i1 %28 to i64
%30 = select i1 %28, double 0.000000e+00, double 1.000000e+06
%31 = fptrunc double %30 to float
store float %31, float* %4
br label %69
32: ; preds = %18
br label %33
33: ; preds = %32
%34 = load float, float* %7
%35 = load i32, i32* %5
%36 = sitofp i32 %35 to float
%37 = fdiv float %34, %36
store float %37, float* %8
%38 = load i32, i32* %6
%39 = sub nsw i32 0, %38
%40 = sitofp i32 %39 to double
%41 = load float, float* %8
%42 = fcmp ole float %41, 0.000000e+00
br i1 %42, label %43, label %44
43: ; preds = %33
br label %48
44: ; preds = %33
%45 = load float, float* %8
%46 = call double @log(float %45)
%47 = fdiv double %46, 0x3FE62E42FEFA39EF
br label %48
48: ; preds = %44, %43
%49 = phi double [ 0.000000e+00, %43 ], [ %47, %44 ]
%50 = load i32, i32* %5
%51 = load i32, i32* %6
%52 = sub nsw i32 %50, %51
%53 = sitofp i32 %52 to double
%54 = load float, float* %8
%55 = fsub float 1.000000e+00, %54
%56 = fcmp ole float %55, 0.000000e+00
br i1 %56, label %57, label %58
57: ; preds = %48
br label %63
58: ; preds = %48
%59 = load float, float* %8
%60 = fsub float 1.000000e+00, %59
%61 = call double @log(float %60)
%62 = fdiv double %61, 0x3FE62E42FEFA39EF
br label %63
63: ; preds = %58, %57
%64 = phi double [ 0.000000e+00, %57 ], [ %62, %58 ]
%65 = fmul double %53, %64
%66 = fneg double %65
%67 = call double @llvm.fmuladd.f64(double %40, double %49, double %66)
%68 = fptrunc double %67 to float
store float %68, float* %4
br label %69
69: ; preds = %63, %25, %12
%70 = load float, float* %4
ret float %70
}

LLVM IR (-O2):
define float @Biased(i32 %0, i32 %1, float %2) {
%4 = fpext float %2 to double
%5 = fcmp ugt double %4, 0x3EB0C6F7A0B5ED8D
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = icmp eq i32 %1, 0
%8 = select i1 %7, double 0.000000e+00, double 1.000000e+06
br label %39
9: ; preds = %3
%10 = sitofp i32 %0 to double
%11 = fadd double %10, 0xBEB0C6F7A0B5ED8D
%12 = fcmp ugt double %11, %4
br i1 %12, label %16, label %13
13: ; preds = %9
%14 = icmp eq i32 %0, %1
%15 = select i1 %14, double 0.000000e+00, double 1.000000e+06
br label %39
16: ; preds = %9
%17 = sitofp i32 %0 to float
%18 = fdiv float %2, %17
%19 = sub nsw i32 0, %1
%20 = sitofp i32 %19 to double
%21 = fcmp ugt float %18, 0.000000e+00
br i1 %21, label %22, label %25
22: ; preds = %16
%23 = tail call double @log(float %18)
%24 = fdiv double %23, 0x3FE62E42FEFA39EF
br label %25
25: ; preds = %16, %22
%26 = phi double [ %24, %22 ], [ 0.000000e+00, %16 ]
%27 = sub nsw i32 %0, %1
%28 = sitofp i32 %27 to double
%29 = fsub float 1.000000e+00, %18
%30 = fcmp ugt float %29, 0.000000e+00
br i1 %30, label %31, label %34
31: ; preds = %25
%32 = tail call double @log(float %29)
%33 = fdiv double %32, 0x3FE62E42FEFA39EF
br label %34
34: ; preds = %25, %31
%35 = phi double [ %33, %31 ], [ 0.000000e+00, %25 ]
%36 = fneg double %35
%37 = fmul double %28, %36
%38 = tail call double @llvm.fmuladd.f64(double %20, double %26, double %37)
br label %39
39: ; preds = %34, %13, %6
%40 = phi double [ %8, %6 ], [ %15, %13 ], [ %38, %34 ]
%41 = fptrunc double %40 to float
ret float %41
}