#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 *, long);
void printSize(long int size) {
  if (size < 1024) {
    printf("\r%4d bytes transfered.", size);
  } else if (size >= 1024 && size < 1048576) {
    printf("\r%4d Kbytes transfered.", size / 1024);
  } else if (size >= 1048576) {
    printf("\r%4d MBytes transfered.", size / 1048576);
  }
}


x86 assembly (clang, -O0):
<printSize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x400,-0x8(%rbp)
jge    113f <printSize+0x2f>
mov    -0x8(%rbp),%rsi
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
jmp    11b2 <printSize+0xa2>
cmpq   $0x400,-0x8(%rbp)
jl     117d <printSize+0x6d>
cmpq   $0x100000,-0x8(%rbp)
jge    117d <printSize+0x6d>
mov    -0x8(%rbp),%rax
mov    $0x400,%ecx
cqto
idiv   %rcx
mov    %rax,%rsi
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
jmp    11ad <printSize+0x9d>
cmpq   $0x100000,-0x8(%rbp)
jl     11a8 <printSize+0x98>
mov    -0x8(%rbp),%rax
mov    $0x100000,%ecx
cqto
idiv   %rcx
mov    %rax,%rsi
lea    0xe8c(%rip),%rdi
call   1030 <printf@plt>
jmp    11ad <printSize+0x9d>
jmp    11b2 <printSize+0xa2>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printSize>:
mov    %rdi,%rsi
cmp    $0x3ff,%rdi
jg     1128 <printSize+0x18>
lea    0xedd(%rip),%rdi
jmp    1030 <printf@plt>
cmp    $0xfffff,%rsi
ja     1141 <printSize+0x31>
shr    $0xa,%rsi
lea    0xedb(%rip),%rdi
jmp    1030 <printf@plt>
shr    $0x14,%rsi
lea    0xee3(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"\0D%4d bytes transfered.\00"
@.str.1 = [24 x i8] c"\0D%4d Kbytes transfered.\00"
@.str.2 = [24 x i8] c"\0D%4d MBytes transfered.\00"
define void @printSize(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = icmp slt i64 %3, 1024
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i64, i64* %2
%7 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i64 %6)
br label %27
8: ; preds = %1
%9 = load i64, i64* %2
%10 = icmp sge i64 %9, 1024
br i1 %10, label %11, label %18
11: ; preds = %8
%12 = load i64, i64* %2
%13 = icmp slt i64 %12, 1048576
br i1 %13, label %14, label %18
14: ; preds = %11
%15 = load i64, i64* %2
%16 = sdiv i64 %15, 1024
%17 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i64 %16)
br label %26
18: ; preds = %11, %8
%19 = load i64, i64* %2
%20 = icmp sge i64 %19, 1048576
br i1 %20, label %21, label %25
21: ; preds = %18
%22 = load i64, i64* %2
%23 = sdiv i64 %22, 1048576
%24 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i64 %23)
br label %25
25: ; preds = %21, %18
br label %26
26: ; preds = %25, %14
br label %27
27: ; preds = %26, %5
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"\0D%4d bytes transfered.\00"
@.str.1 = [24 x i8] c"\0D%4d Kbytes transfered.\00"
@.str.2 = [24 x i8] c"\0D%4d MBytes transfered.\00"
define void @printSize(i64 %0) {
%2 = icmp slt i64 %0, 1024
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i64 %0)
br label %13
5: ; preds = %1
%6 = icmp ult i64 %0, 1048576
br i1 %6, label %7, label %10
7: ; preds = %5
%8 = lshr i64 %0, 10
%9 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i64 %8)
br label %13
10: ; preds = %5
%11 = lshr i64 %0, 20
%12 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i64 %11)
br label %13
13: ; preds = %7, %10, %3
ret void
}