#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 */
long double log10(double);
long double computeI(unsigned int greater, unsigned int less,
                     unsigned int total) {
  if (greater == 0 || less == 0)
    return 0.0;
  else {
    long double doubleGreaterRatio = (long double)greater / total,
                doubleLessRatio = (long double)less / total;
    return (long double)-(
        doubleGreaterRatio * (long double)log10(doubleGreaterRatio) /
            log10(2.0) +
        doubleLessRatio * (long double)log10(doubleLessRatio) / log10(2.0));
  }
}


x86 assembly (clang, -O0):
<computeI>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
mov    %edi,-0x14(%rbp)
mov    %esi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1138 <computeI+0x28>
cmpl   $0x0,-0x18(%rbp)
jne    1142 <computeI+0x32>
fldz
fstpt  -0x10(%rbp)
jmp    1201 <computeI+0xf1>
mov    -0x14(%rbp),%eax
mov    %rax,-0x48(%rbp)
fildll -0x48(%rbp)
mov    -0x1c(%rbp),%eax
mov    %rax,-0x50(%rbp)
fildll -0x50(%rbp)
fdivrp %st,%st(1)
fstpt  -0x30(%rbp)
mov    -0x18(%rbp),%eax
mov    %rax,-0x60(%rbp)
fildll -0x60(%rbp)
mov    -0x1c(%rbp),%eax
mov    %rax,-0x58(%rbp)
fildll -0x58(%rbp)
fdivrp %st,%st(1)
fstpt  -0x40(%rbp)
fldt   -0x30(%rbp)
fld    %st(0)
fstpt  -0xb8(%rbp)
fstpl  -0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
call   1030 <log10@plt>
fldt   -0xb8(%rbp)
fmulp  %st,%st(1)
fstpt  -0xac(%rbp)
movsd  0xe5e(%rip),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
call   1030 <log10@plt>
fldt   -0xac(%rbp)
fdivp  %st,%st(1)
fstpt  -0x7c(%rbp)
fldt   -0x40(%rbp)
fld    %st(0)
fstpt  -0x94(%rbp)
fstpl  -0x70(%rbp)
movsd  -0x70(%rbp),%xmm0
call   1030 <log10@plt>
movsd  -0xa0(%rbp),%xmm0
ff
fldt   -0x94(%rbp)
fmulp  %st,%st(1)
fstpt  -0x88(%rbp)
call   1030 <log10@plt>
fldt   -0x88(%rbp)
fldt   -0x7c(%rbp)
fxch   %st(1)
fdivp  %st,%st(2)
faddp  %st,%st(1)
fchs
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<computeI>:
fldz
test   %edi,%edi
je     11c3 <computeI+0xb3>
test   %esi,%esi
je     11c3 <computeI+0xb3>
sub    $0x48,%rsp
fstp   %st(0)
mov    %edi,%eax
mov    %rax,0x40(%rsp)
fildll 0x40(%rsp)
mov    %edx,%eax
mov    %rax,0x38(%rsp)
fildll 0x38(%rsp)
fdivr  %st,%st(1)
fld    %st(1)
fstpt  0x8(%rsp)
mov    %esi,%eax
mov    %rax,0x30(%rsp)
fildll 0x30(%rsp)
fdivp  %st,%st(1)
fstpt  0x14(%rsp)
fstpl  0x28(%rsp)
movsd  0x28(%rsp),%xmm0
call   1030 <log10@plt>
fldt   0x8(%rsp)
fmulp  %st,%st(1)
fstpt  0x8(%rsp)
movsd  0xe88(%rip),%xmm0
call   1030 <log10@plt>
fldt   0x8(%rsp)
fdivp  %st,%st(1)
fstpt  0x8(%rsp)
fldt   0x14(%rsp)
fstpl  0x20(%rsp)
movsd  0x20(%rsp),%xmm0
call   1030 <log10@plt>
fldt   0x14(%rsp)
fmulp  %st,%st(1)
fstpt  0x14(%rsp)
movsd  0xe54(%rip),%xmm0
call   1030 <log10@plt>
fldt   0x14(%rsp)
fdivp  %st,%st(1)
fldt   0x8(%rsp)
faddp  %st,%st(1)
fchs
add    $0x48,%rsp
ret

LLVM IR (-O0):
define x86_fp80 @computeI(i32 %0, i32 %1, i32 %2) {
%4 = alloca x86_fp80
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca x86_fp80
%9 = alloca x86_fp80
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%10 = load i32, i32* %5
%11 = icmp eq i32 %10, 0
br i1 %11, label %15, label %12
12: ; preds = %3
%13 = load i32, i32* %6
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %12, %3
store x86_fp80 0xK00000000000000000000, x86_fp80* %4
br label %43
16: ; preds = %12
%17 = load i32, i32* %5
%18 = uitofp i32 %17 to x86_fp80
%19 = load i32, i32* %7
%20 = uitofp i32 %19 to x86_fp80
%21 = fdiv x86_fp80 %18, %20
store x86_fp80 %21, x86_fp80* %8
%22 = load i32, i32* %6
%23 = uitofp i32 %22 to x86_fp80
%24 = load i32, i32* %7
%25 = uitofp i32 %24 to x86_fp80
%26 = fdiv x86_fp80 %23, %25
store x86_fp80 %26, x86_fp80* %9
%27 = load x86_fp80, x86_fp80* %8
%28 = load x86_fp80, x86_fp80* %8
%29 = fptrunc x86_fp80 %28 to double
%30 = call x86_fp80 @log10(double %29)
%31 = fmul x86_fp80 %27, %30
%32 = call x86_fp80 @log10(double 2.000000e+00)
%33 = fdiv x86_fp80 %31, %32
%34 = load x86_fp80, x86_fp80* %9
%35 = load x86_fp80, x86_fp80* %9
%36 = fptrunc x86_fp80 %35 to double
%37 = call x86_fp80 @log10(double %36)
%38 = fmul x86_fp80 %34, %37
%39 = call x86_fp80 @log10(double 2.000000e+00)
%40 = fdiv x86_fp80 %38, %39
%41 = fadd x86_fp80 %33, %40
%42 = fneg x86_fp80 %41
store x86_fp80 %42, x86_fp80* %4
br label %43
43: ; preds = %16, %15
%44 = load x86_fp80, x86_fp80* %4
ret x86_fp80 %44
}

LLVM IR (-O2):
define x86_fp80 @computeI(i32 %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %0, 0
%5 = icmp eq i32 %1, 0
%6 = or i1 %4, %5
br i1 %6, label %25, label %7
7: ; preds = %3
%8 = uitofp i32 %0 to x86_fp80
%9 = uitofp i32 %2 to x86_fp80
%10 = fdiv x86_fp80 %8, %9
%11 = uitofp i32 %1 to x86_fp80
%12 = fdiv x86_fp80 %11, %9
%13 = fptrunc x86_fp80 %10 to double
%14 = tail call x86_fp80 @log10(double %13)
%15 = fmul x86_fp80 %10, %14
%16 = tail call x86_fp80 @log10(double 2.000000e+00)
%17 = fdiv x86_fp80 %15, %16
%18 = fptrunc x86_fp80 %12 to double
%19 = tail call x86_fp80 @log10(double %18)
%20 = fmul x86_fp80 %12, %19
%21 = tail call x86_fp80 @log10(double 2.000000e+00)
%22 = fdiv x86_fp80 %20, %21
%23 = fadd x86_fp80 %17, %22
%24 = fneg x86_fp80 %23
br label %25
25: ; preds = %3, %7
%26 = phi x86_fp80 [ %24, %7 ], [ 0xK00000000000000000000, %3 ]
ret x86_fp80 %26
}