#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 */
typedef double off_t;
typedef int blksize_t;
typedef double blkcnt_t;

/* Variables and functions */
scalar_t__ isinf(double);
scalar_t__ isnan(double);
double _file_info_calc_sparseness(blksize_t blksize, blkcnt_t blocks,
                                  off_t size) {
  double sparseness = 0.0;
  if (size > 0) {
    sparseness = (double)(blksize / 8) * blocks / size;
    if (isnan(sparseness) || isinf(sparseness)) {
      sparseness = 0.0;
    }
  } else if (blocks) {
    sparseness = 1.0;
  }
  return sparseness;
}


x86 assembly (clang, -O0):
<_file_info_calc_sparseness>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    11a2 <_file_info_calc_sparseness+0x82>
mov    -0x4(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
mulsd  -0x10(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1030 <isnan@plt>
cmp    $0x0,%rax
jne    1195 <_file_info_calc_sparseness+0x75>
movsd  -0x20(%rbp),%xmm0
call   1040 <isinf@plt>
cmp    $0x0,%rax
je     119d <_file_info_calc_sparseness+0x7d>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    11d1 <_file_info_calc_sparseness+0xb1>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11bf <_file_info_calc_sparseness+0x9f>
jp     11bf <_file_info_calc_sparseness+0x9f>
jmp    11cc <_file_info_calc_sparseness+0xac>
movsd  0xe39(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    11d1 <_file_info_calc_sparseness+0xb1>
movsd  -0x20(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_file_info_calc_sparseness>:
push   %rax
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm1
jbe    1172 <_file_info_calc_sparseness+0x52>
lea    0x7(%rdi),%eax
test   %edi,%edi
cmovns %edi,%eax
sar    $0x3,%eax
xorps  %xmm2,%xmm2
cvtsi2sd %eax,%xmm2
mulsd  %xmm0,%xmm2
divsd  %xmm1,%xmm2
movsd  %xmm2,(%rsp)
movapd %xmm2,%xmm0
call   1030 <isnan@plt>
movsd  (%rsp),%xmm0
test   %rax,%rax
jne    116c <_file_info_calc_sparseness+0x4c>
call   1040 <isinf@plt>
movsd  (%rsp),%xmm2
test   %rax,%rax
je     1182 <_file_info_calc_sparseness+0x62>
xorpd  %xmm2,%xmm2
jmp    1182 <_file_info_calc_sparseness+0x62>
ucomisd %xmm2,%xmm0
jne    117a <_file_info_calc_sparseness+0x5a>
jnp    1182 <_file_info_calc_sparseness+0x62>
movsd  0xe7e(%rip),%xmm2
movapd %xmm2,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @_file_info_calc_sparseness(i32 %0, double %1, double %2) {
%4 = alloca i32
%5 = alloca double
%6 = alloca double
%7 = alloca double
store i32 %0, i32* %4
store double %1, double* %5
store double %2, double* %6
store double 0.000000e+00, double* %7
%8 = load double, double* %6
%9 = fcmp ogt double %8, 0.000000e+00
br i1 %9, label %10, label %27
10: ; preds = %3
%11 = load i32, i32* %4
%12 = sdiv i32 %11, 8
%13 = sitofp i32 %12 to double
%14 = load double, double* %5
%15 = fmul double %13, %14
%16 = load double, double* %6
%17 = fdiv double %15, %16
store double %17, double* %7
%18 = load double, double* %7
%19 = call i64 @isnan(double %18)
%20 = icmp ne i64 %19, 0
br i1 %20, label %25, label %21
21: ; preds = %10
%22 = load double, double* %7
%23 = call i64 @isinf(double %22)
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %26
25: ; preds = %21, %10
store double 0.000000e+00, double* %7
br label %26
26: ; preds = %25, %21
br label %32
27: ; preds = %3
%28 = load double, double* %5
%29 = fcmp une double %28, 0.000000e+00
br i1 %29, label %30, label %31
30: ; preds = %27
store double 1.000000e+00, double* %7
br label %31
31: ; preds = %30, %27
br label %32
32: ; preds = %31, %26
%33 = load double, double* %7
ret double %33
}

LLVM IR (-O2):
define double @_file_info_calc_sparseness(i32 %0, double %1, double %2) {
%4 = fcmp ogt double %2, 0.000000e+00
br i1 %4, label %5, label %16
5: ; preds = %3
%6 = sdiv i32 %0, 8
%7 = sitofp i32 %6 to double
%8 = fmul double %7, %1
%9 = fdiv double %8, %2
%10 = tail call i64 @isnan(double %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %5
%13 = tail call i64 @isinf(double %9)
%14 = icmp eq i64 %13, 0
br i1 %14, label %19, label %15
15: ; preds = %12, %5
br label %19
16: ; preds = %3
%17 = fcmp une double %1, 0.000000e+00
br i1 %17, label %18, label %19
18: ; preds = %16
br label %19
19: ; preds = %16, %18, %12, %15
%20 = phi double [ 0.000000e+00, %15 ], [ %9, %12 ], [ 1.000000e+00, %18 ], [ 0.000000e+00, %16 ]
ret double %20
}