#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 */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stdout;
void print_total_size(size_t size) {
  fprintf(stdout, "\033[38;5;033m");
  if (size < 1024) {
    fprintf(stdout, "%lu%s bytes\n", size, "\e[0m");
  } else if (size < 1048576) {
    fprintf(stdout, "%.1f%s kilobytes\n", size / 1024.0, "\e[0m");
  } else if (size < 1073741824) {
    fprintf(stdout, "%.1f%s megabytes\n", size / (1024.0 * 1024), "\e[0m");
  } else if (size < 1099511627776) {
    fprintf(stdout, "%.1f%s gigabytes\n", size / (1024.0 * 1024 * 1024),
            "\e[0m");
  }
}


x86 assembly (clang, -O0):
<print_total_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
lea    0xf14(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
cmpq   $0x400,-0x8(%rbp)
jae    1168 <print_total_size+0x58>
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xef7(%rip),%rsi
lea    0xefd(%rip),%rcx
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    12a4 <print_total_size+0x194>
cmpq   $0x100000,-0x8(%rbp)
jae    11cc <print_total_size+0xbc>
mov    0x2e63(%rip),%rax
mov    (%rax),%edi
movaps 0xe9a(%rip),%xmm1
movq   -0x8(%rbp),%xmm0
punpckldq %xmm1,%xmm0
movapd 0xe99(%rip),%xmm1
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe62(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xea5(%rip),%rsi
lea    0xe99(%rip),%rdx
mov    $0x1,%al
call   1030 <fprintf@plt>
jmp    129f <print_total_size+0x18f>
cmpq   $0x40000000,-0x8(%rbp)
40
jae    1230 <print_total_size+0x120>
mov    0x2dff(%rip),%rax
mov    (%rax),%edi
movaps 0xe36(%rip),%xmm1
movq   -0x8(%rbp),%xmm0
punpckldq %xmm1,%xmm0
movapd 0xe35(%rip),%xmm1
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0xdf6(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xe53(%rip),%rsi
lea    0xe35(%rip),%rdx
mov    $0x1,%al
call   1030 <fprintf@plt>
jmp    129a <print_total_size+0x18a>
movabs $0x10000000000,%rax
cmp    %rax,-0x8(%rbp)
jae    1295 <print_total_size+0x185>
mov    0x2d95(%rip),%rax
mov    (%rax),%edi
movaps 0xdcc(%rip),%xmm1
movq   -0x8(%rbp),%xmm0
punpckldq %xmm1,%xmm0
movapd 0xdcb(%rip),%xmm1
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0xd84(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xdfb(%rip),%rsi
lea    0xdcb(%rip),%rdx
mov    $0x1,%al
call   1030 <fprintf@plt>
jmp    129a <print_total_size+0x18a>
jmp    129f <print_total_size+0x18f>
jmp    12a4 <print_total_size+0x194>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_total_size>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2ec2(%rip),%r14
mov    (%r14),%edi
lea    0xf10(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
cmp    $0x3ff,%rbx
ja     115a <print_total_size+0x4a>
mov    (%r14),%edi
lea    0xf02(%rip),%rsi
lea    0xf08(%rip),%rcx
mov    %rbx,%rdx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <fprintf@plt>
cmp    $0xfffff,%rbx
ja     1198 <print_total_size+0x88>
movq   %rbx,%xmm1
punpckldq 0xe90(%rip),%xmm1
subpd  0xe98(%rip),%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
addsd  %xmm1,%xmm0
mulsd  0xea4(%rip),%xmm0
mov    (%r14),%edi
lea    0xec0(%rip),%rsi
jmp    1212 <print_total_size+0x102>
cmp    $0x3fffffff,%rbx
ja     11d6 <print_total_size+0xc6>
movq   %rbx,%xmm1
punpckldq 0xe52(%rip),%xmm1
subpd  0xe5a(%rip),%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
addsd  %xmm1,%xmm0
mulsd  0xe5e(%rip),%xmm0
mov    (%r14),%edi
lea    0xe94(%rip),%rsi
jmp    1212 <print_total_size+0x102>
mov    %rbx,%rax
shr    $0x28,%rax
jne    1227 <print_total_size+0x117>
movq   %rbx,%xmm1
punpckldq 0xe14(%rip),%xmm1
subpd  0xe1c(%rip),%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
addsd  %xmm1,%xmm0
mulsd  0xe18(%rip),%xmm0
mov    (%r14),%edi
lea    0xe68(%rip),%rsi
lea    0xe38(%rip),%rdx
mov    $0x1,%al
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <fprintf@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [12 x i8] c"\1B[38;5;033m\00"
@.str.1 = [13 x i8] c"%lu%s bytes\0A\00"
@.str.2 = [5 x i8] c"\1B[0m\00"
@.str.3 = [18 x i8] c"%.1f%s kilobytes\0A\00"
@.str.4 = [18 x i8] c"%.1f%s megabytes\0A\00"
@.str.5 = [18 x i8] c"%.1f%s gigabytes\0A\00"
define void @print_total_size(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i32, i32* @stdout
%4 = call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%5 = load i64, i64* %2
%6 = icmp ult i64 %5, 1024
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i32, i32* @stdout
%9 = load i64, i64* %2
%10 = call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i64 %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %41
11: ; preds = %1
%12 = load i64, i64* %2
%13 = icmp ult i64 %12, 1048576
br i1 %13, label %14, label %20
14: ; preds = %11
%15 = load i32, i32* @stdout
%16 = load i64, i64* %2
%17 = uitofp i64 %16 to double
%18 = fdiv double %17, 1.024000e+03
%19 = call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), double %18, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %40
20: ; preds = %11
%21 = load i64, i64* %2
%22 = icmp ult i64 %21, 1073741824
br i1 %22, label %23, label %29
23: ; preds = %20
%24 = load i32, i32* @stdout
%25 = load i64, i64* %2
%26 = uitofp i64 %25 to double
%27 = fdiv double %26, 0x4130000000000000
%28 = call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), double %27, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %39
29: ; preds = %20
%30 = load i64, i64* %2
%31 = icmp ult i64 %30, 1099511627776
br i1 %31, label %32, label %38
32: ; preds = %29
%33 = load i32, i32* @stdout
%34 = load i64, i64* %2
%35 = uitofp i64 %34 to double
%36 = fdiv double %35, 0x41D0000000000000
%37 = call i32 (i32, i8*, ...) @fprintf(i32 %33, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), double %36, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %38
38: ; preds = %32, %29
br label %39
39: ; preds = %38, %23
br label %40
40: ; preds = %39, %14
br label %41
41: ; preds = %40, %7
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [12 x i8] c"\1B[38;5;033m\00"
@.str.1 = [13 x i8] c"%lu%s bytes\0A\00"
@.str.2 = [5 x i8] c"\1B[0m\00"
@.str.3 = [18 x i8] c"%.1f%s kilobytes\0A\00"
@.str.4 = [18 x i8] c"%.1f%s megabytes\0A\00"
@.str.5 = [18 x i8] c"%.1f%s gigabytes\0A\00"
define void @print_total_size(i64 %0) {
%2 = load i32, i32* @stdout
%3 = tail call i32 (i32, i8*, ...) @fprintf(i32 %2, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%4 = icmp ult i64 %0, 1024
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* @stdout
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i64 %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %29
8: ; preds = %1
%9 = icmp ult i64 %0, 1048576
br i1 %9, label %10, label %15
10: ; preds = %8
%11 = load i32, i32* @stdout
%12 = uitofp i64 %0 to double
%13 = fmul double %12, 0x3F50000000000000
%14 = tail call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), double %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %29
15: ; preds = %8
%16 = icmp ult i64 %0, 1073741824
br i1 %16, label %17, label %22
17: ; preds = %15
%18 = load i32, i32* @stdout
%19 = uitofp i64 %0 to double
%20 = fmul double %19, 0x3EB0000000000000
%21 = tail call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), double %20, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %29
22: ; preds = %15
%23 = icmp ult i64 %0, 1099511627776
br i1 %23, label %24, label %29
24: ; preds = %22
%25 = load i32, i32* @stdout
%26 = uitofp i64 %0 to double
%27 = fmul double %26, 0x3E10000000000000
%28 = tail call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), double %27, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %29
29: ; preds = %10, %22, %24, %17, %5
ret void
}