#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 FileSize(const double size, const char **uStr0, double *const uMult0) {
  double uMult, uTotal;
  const char *uStr;
  if (size > (999.5 * ((long)(1024 * 1024) * 1024L))) {
    uStr = "TiB";
    uMult = ((double)((long)(1024 * 1024) * 1024L) * 1024.0);
  } else if (size > (999.5 * (1024 * 1024))) {
    uStr = "GiB";
    uMult = ((long)(1024 * 1024) * 1024L);
  } else if (size > (999.5 * 1024)) {
    uStr = "MiB";
    uMult = (1024 * 1024);
  } else if (size > 999.5) {
    uStr = "kiB";
    uMult = 1024;
  } else {
    uStr = "B";
    uMult = 1;
  }
  if (uStr0 != NULL)
    *uStr0 = uStr;
  if (uMult0 != NULL)
    *uMult0 = uMult;
  uTotal = size / ((double)uMult);
  if (uTotal < 0.0)
    uTotal = 0.0;
  return (uTotal);
}


x86 assembly (clang, -O0):
<FileSize>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xee2(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1145 <FileSize+0x45>
lea    0xf19(%rip),%rax
mov    %rax,-0x30(%rbp)
movsd  0xf05(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1208 <FileSize+0x108>
movsd  -0x8(%rbp),%xmm0
movsd  0xeb6(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1179 <FileSize+0x79>
lea    0xee9(%rip),%rax
mov    %rax,-0x30(%rbp)
movsd  0xec9(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1203 <FileSize+0x103>
movsd  -0x8(%rbp),%xmm0
movsd  0xe8a(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11ad <FileSize+0xad>
lea    0xeb9(%rip),%rax
mov    %rax,-0x30(%rbp)
movsd  0xe8d(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    11fe <FileSize+0xfe>
movsd  -0x8(%rbp),%xmm0
movsd  0xe5e(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11e1 <FileSize+0xe1>
lea    0xe89(%rip),%rax
mov    %rax,-0x30(%rbp)
movsd  0xe51(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    11f9 <FileSize+0xf9>
lea    0xe66(%rip),%rax
mov    %rax,-0x30(%rbp)
movsd  0xe2c(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    11fe <FileSize+0xfe>
jmp    1203 <FileSize+0x103>
jmp    1208 <FileSize+0x108>
cmpq   $0x0,-0x10(%rbp)
je     121e <FileSize+0x11e>
mov    -0x30(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
cmpq   $0x0,-0x18(%rbp)
je     1236 <FileSize+0x136>
movsd  -0x20(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x8(%rbp),%xmm0
divsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    125b <FileSize+0x15b>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<FileSize>:
ucomisd 0xf00(%rip),%xmm0
jbe    1120 <FileSize+0x20>
lea    0xf37(%rip),%rax
movsd  0xee7(%rip),%xmm1
test   %rdi,%rdi
jne    1190 <FileSize+0x90>
jmp    1193 <FileSize+0x93>
ucomisd 0xef0(%rip),%xmm0
jbe    1140 <FileSize+0x40>
lea    0xf1b(%rip),%rax
movsd  0xed7(%rip),%xmm1
test   %rdi,%rdi
jne    1190 <FileSize+0x90>
jmp    1193 <FileSize+0x93>
ucomisd 0xee0(%rip),%xmm0
jbe    1160 <FileSize+0x60>
lea    0xeff(%rip),%rax
movsd  0xec7(%rip),%xmm1
test   %rdi,%rdi
jne    1190 <FileSize+0x90>
jmp    1193 <FileSize+0x93>
xor    %eax,%eax
ucomisd 0xec6(%rip),%xmm0
seta   %al
lea    0xec4(%rip),%rcx
movsd  (%rcx,%rax,8),%xmm1
lea    0xed4(%rip),%rcx
lea    0xec7(%rip),%rax
cmova  %rcx,%rax
test   %rdi,%rdi
je     1193 <FileSize+0x93>
mov    %rax,(%rdi)
test   %rsi,%rsi
je     119c <FileSize+0x9c>
movsd  %xmm1,(%rsi)
divsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
maxsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
@.str = [4 x i8] c"TiB\00"
@.str.1 = [4 x i8] c"GiB\00"
@.str.2 = [4 x i8] c"MiB\00"
@.str.3 = [4 x i8] c"kiB\00"
@.str.4 = [2 x i8] c"B\00"
define double @FileSize(double %0, i8** %1, double* %2) {
%4 = alloca double
%5 = alloca i8**
%6 = alloca double*
%7 = alloca double
%8 = alloca double
%9 = alloca i8*
store double %0, double* %4
store i8** %1, i8*** %5
store double* %2, double** %6
%10 = load double, double* %4
%11 = fcmp ogt double %10, 0x426F3C0000000000
br i1 %11, label %12, label %13
12: ; preds = %3
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %9
store double 0x4270000000000000, double* %7
br label %29
13: ; preds = %3
%14 = load double, double* %4
%15 = fcmp ogt double %14, 0x41CF3C0000000000
br i1 %15, label %16, label %17
16: ; preds = %13
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8** %9
store double 0x41D0000000000000, double* %7
br label %28
17: ; preds = %13
%18 = load double, double* %4
%19 = fcmp ogt double %18, 0x412F3C0000000000
br i1 %19, label %20, label %21
20: ; preds = %17
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8** %9
store double 0x4130000000000000, double* %7
br label %27
21: ; preds = %17
%22 = load double, double* %4
%23 = fcmp ogt double %22, 9.995000e+02
br i1 %23, label %24, label %25
24: ; preds = %21
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8** %9
store double 1.024000e+03, double* %7
br label %26
25: ; preds = %21
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8** %9
store double 1.000000e+00, double* %7
br label %26
26: ; preds = %25, %24
br label %27
27: ; preds = %26, %20
br label %28
28: ; preds = %27, %16
br label %29
29: ; preds = %28, %12
%30 = load i8**, i8*** %5
%31 = icmp ne i8** %30, null
br i1 %31, label %32, label %35
32: ; preds = %29
%33 = load i8*, i8** %9
%34 = load i8**, i8*** %5
store i8* %33, i8** %34
br label %35
35: ; preds = %32, %29
%36 = load double*, double** %6
%37 = icmp ne double* %36, null
br i1 %37, label %38, label %41
38: ; preds = %35
%39 = load double, double* %7
%40 = load double*, double** %6
store double %39, double* %40
br label %41
41: ; preds = %38, %35
%42 = load double, double* %4
%43 = load double, double* %7
%44 = fdiv double %42, %43
store double %44, double* %8
%45 = load double, double* %8
%46 = fcmp olt double %45, 0.000000e+00
br i1 %46, label %47, label %48
47: ; preds = %41
store double 0.000000e+00, double* %8
br label %48
48: ; preds = %47, %41
%49 = load double, double* %8
ret double %49
}

LLVM IR (-O2):
@.str = [4 x i8] c"TiB\00"
@.str.1 = [4 x i8] c"GiB\00"
@.str.2 = [4 x i8] c"MiB\00"
@.str.3 = [4 x i8] c"kiB\00"
@.str.4 = [2 x i8] c"B\00"
define double @FileSize(double %0, i8** writeonly %1, double* writeonly %2) {
%4 = fcmp ogt double %0, 0x426F3C0000000000
br i1 %4, label %13, label %5
5: ; preds = %3
%6 = fcmp ogt double %0, 0x41CF3C0000000000
br i1 %6, label %13, label %7
7: ; preds = %5
%8 = fcmp ogt double %0, 0x412F3C0000000000
br i1 %8, label %13, label %9
9: ; preds = %7
%10 = fcmp ogt double %0, 9.995000e+02
%11 = select i1 %10, double 1.024000e+03, double 1.000000e+00
%12 = select i1 %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0)
br label %13
13: ; preds = %9, %7, %5, %3
%14 = phi double [ 0x4270000000000000, %3 ], [ 0x41D0000000000000, %5 ], [ 0x4130000000000000, %7 ], [ %11, %9 ]
%15 = phi i8* [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), %3 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), %5 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), %7 ], [ %12, %9 ]
%16 = icmp eq i8** %1, null
br i1 %16, label %18, label %17
17: ; preds = %13
store i8* %15, i8** %1
br label %18
18: ; preds = %17, %13
%19 = icmp eq double* %2, null
br i1 %19, label %21, label %20
20: ; preds = %18
store double %14, double* %2
br label %21
21: ; preds = %20, %18
%22 = fdiv double %0, %14
%23 = fcmp olt double %22, 0.000000e+00
%24 = select i1 %23, double 0.000000e+00, double %22
ret double %24
}