#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*/ printf(char *, double);
void print_size(double size) {
  if (size < 1024) {
    printf("%.1lf bytes", size);
  } else if (size < 1024 * 1024) {
    printf("%.1lf kB", size / 1024.0);
  } else if (size < 1024 * 1024 * 1024) {
    printf("%.1lf MB", size / (1024.0 * 1024.0));
  } else {
    printf("%.1lf GB", size / (1024.0 * 1024.0 * 1024.0));
  }
}


x86 assembly (clang, -O0):
<print_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xedb(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    1146 <print_size+0x36>
movsd  -0x8(%rbp),%xmm0
lea    0xedc(%rip),%rdi
call   1030 <printf@plt>
jmp    11d7 <print_size+0xc7>
movsd  0xeba(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    117b <print_size+0x6b>
movsd  -0x8(%rbp),%xmm0
movsd  0xe9a(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
jmp    11d2 <print_size+0xc2>
movsd  0xe8d(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    11b0 <print_size+0xa0>
movsd  -0x8(%rbp),%xmm0
movsd  0xe6d(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xe87(%rip),%rdi
call   1030 <printf@plt>
jmp    11cd <print_size+0xbd>
movsd  -0x8(%rbp),%xmm0
movsd  0xe53(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xe6e(%rip),%rdi
call   1030 <printf@plt>
jmp    11d2 <print_size+0xc2>
jmp    11d7 <print_size+0xc7>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_size>:
movsd  0xee8(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    112a <print_size+0x1a>
lea    0xf0b(%rip),%rdi
jmp    1030 <printf@plt>
movsd  0xed6(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    114c <print_size+0x3c>
mulsd  0xee8(%rip),%xmm0
lea    0xef5(%rip),%rdi
jmp    1030 <printf@plt>
movsd  0xebc(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    116e <print_size+0x5e>
mulsd  0xebe(%rip),%xmm0
lea    0xedc(%rip),%rdi
jmp    1030 <printf@plt>
mulsd  0xea2(%rip),%xmm0
lea    0xed1(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"%.1lf bytes\00"
@.str.1 = [9 x i8] c"%.1lf kB\00"
@.str.2 = [9 x i8] c"%.1lf MB\00"
@.str.3 = [9 x i8] c"%.1lf GB\00"
define void @print_size(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fcmp olt double %3, 1.024000e+03
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load double, double* %2
%7 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), double %6)
br label %28
8: ; preds = %1
%9 = load double, double* %2
%10 = fcmp olt double %9, 0x4130000000000000
br i1 %10, label %11, label %15
11: ; preds = %8
%12 = load double, double* %2
%13 = fdiv double %12, 1.024000e+03
%14 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), double %13)
br label %27
15: ; preds = %8
%16 = load double, double* %2
%17 = fcmp olt double %16, 0x41D0000000000000
br i1 %17, label %18, label %22
18: ; preds = %15
%19 = load double, double* %2
%20 = fdiv double %19, 0x4130000000000000
%21 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), double %20)
br label %26
22: ; preds = %15
%23 = load double, double* %2
%24 = fdiv double %23, 0x41D0000000000000
%25 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), double %24)
br label %26
26: ; preds = %22, %18
br label %27
27: ; preds = %26, %11
br label %28
28: ; preds = %27, %5
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"%.1lf bytes\00"
@.str.1 = [9 x i8] c"%.1lf kB\00"
@.str.2 = [9 x i8] c"%.1lf MB\00"
@.str.3 = [9 x i8] c"%.1lf GB\00"
define void @print_size(double %0) {
%2 = fcmp olt double %0, 1.024000e+03
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), double %0)
br label %18
5: ; preds = %1
%6 = fcmp olt double %0, 0x4130000000000000
br i1 %6, label %7, label %10
7: ; preds = %5
%8 = fmul double %0, 0x3F50000000000000
%9 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), double %8)
br label %18
10: ; preds = %5
%11 = fcmp olt double %0, 0x41D0000000000000
br i1 %11, label %12, label %15
12: ; preds = %10
%13 = fmul double %0, 0x3EB0000000000000
%14 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), double %13)
br label %18
15: ; preds = %10
%16 = fmul double %0, 0x3E10000000000000
%17 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), double %16)
br label %18
18: ; preds = %7, %15, %12, %3
ret void
}