#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*/ snprintf(char *, int, char *, long long const, char,
                            char const);
char *human_view(const long long size, const char postletter) {
  long long divider;
  char postfix;
  static char ret_buffer[255];
  if (size < 0) {
    return " -not avaible- ";
  }
  if (size > 10 * (long long)1024 * (long long)1024 * (long long)1024) {
    postfix = 'G';
    divider = 1024 * 1024 * 1024;
  } else {
    if (size > 10485760) {
      postfix = 'M';
      divider = 1024 * 1024;
    } else {
      if (size > 10240) {
        postfix = 'k';
        divider = 1024;
      } else {
        postfix = postletter;
        divider = 1;
      }
    }
  }
  snprintf(ret_buffer, 255, "%I64i %c%c", size / divider, postfix,
           postfix == postletter ? 0 : postletter);
  return ret_buffer;
}


x86 assembly (clang, -O0):
<human_view>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
cmpq   $0x0,-0x10(%rbp)
jge    113d <human_view+0x2d>
lea    0xecc(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1223 <human_view+0x113>
movabs $0x280000000,%rax
cmp    %rax,-0x10(%rbp)
jle    1162 <human_view+0x52>
movb   $0x47,-0x21(%rbp)
movq   $0x40000000,-0x20(%rbp)
40
jmp    11b8 <human_view+0xa8>
cmpq   $0xa00000,-0x10(%rbp)
jle    1181 <human_view+0x71>
movb   $0x4d,-0x21(%rbp)
movq   $0x100000,-0x20(%rbp)
jmp    11b3 <human_view+0xa3>
cmpq   $0x2800,-0x10(%rbp)
jle    11a0 <human_view+0x90>
movb   $0x6b,-0x21(%rbp)
movq   $0x400,-0x20(%rbp)
jmp    11ae <human_view+0x9e>
mov    -0x11(%rbp),%al
mov    %al,-0x21(%rbp)
movq   $0x1,-0x20(%rbp)
jmp    11b3 <human_view+0xa3>
jmp    11b8 <human_view+0xa8>
mov    -0x10(%rbp),%rax
cqto
idivq  -0x20(%rbp)
mov    %rax,-0x30(%rbp)
mov    -0x21(%rbp),%al
mov    %al,-0x22(%rbp)
movsbl -0x21(%rbp),%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
jne    11e6 <human_view+0xd6>
xor    %eax,%eax
mov    %eax,-0x34(%rbp)
jmp    11ed <human_view+0xdd>
movsbl -0x11(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x22(%rbp),%r8b
mov    -0x30(%rbp),%rcx
mov    -0x34(%rbp),%eax
lea    0x2e41(%rip),%rdi
mov    $0xff,%esi
lea    0xe05(%rip),%rdx
movsbl %r8b,%r8d
movsbl %al,%r9d
call   1030 <snprintf@plt>
lea    0x2e21(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<human_view>:
push   %rbx
test   %rdi,%rdi
js     1133 <human_view+0x23>
movabs $0x280000000,%rax
movzbl %sil,%ecx
cmp    %rax,%rdi
jbe    113c <human_view+0x2c>
mov    $0x47,%sil
mov    $0x40000000,%ebx
jmp    116c <human_view+0x5c>
lea    0xec6(%rip),%rbx
jmp    11b3 <human_view+0xa3>
cmp    $0xa00000,%rdi
jbe    114f <human_view+0x3f>
mov    $0x4d,%sil
mov    $0x100000,%ebx
jmp    116c <human_view+0x5c>
cmp    $0x2801,%rdi
mov    $0x400,%eax
mov    $0x1,%ebx
cmovae %rax,%rbx
mov    $0x6b,%esi
cmovb  %ecx,%esi
mov    %rdi,%rax
shr    $0x20,%rax
je     117f <human_view+0x6f>
mov    %rdi,%rax
xor    %edx,%edx
div    %rbx
jmp    1185 <human_view+0x75>
mov    %edi,%eax
xor    %edx,%edx
div    %ebx
xor    %edx,%edx
cmp    %cl,%sil
cmovne %ecx,%edx
movsbl %dl,%r9d
movsbl %sil,%r8d
lea    0x2ea4(%rip),%rbx
lea    0xe6d(%rip),%rdx
mov    %rbx,%rdi
mov    $0xff,%esi
mov    %rax,%rcx
call   1030 <snprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@human_view.ret_buffer = internal global [255 x i8] zeroinitializer
@.str = [16 x i8] c" -not avaible- \00"
@.str.1 = [11 x i8] c"%I64i %c%c\00"
define i8* @human_view(i64 %0, i8 signext %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8
%6 = alloca i64
%7 = alloca i8
store i64 %0, i64* %4
store i8 %1, i8* %5
%8 = load i64, i64* %4
%9 = icmp slt i64 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %2
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8** %3
br label %45
11: ; preds = %2
%12 = load i64, i64* %4
%13 = icmp sgt i64 %12, 10737418240
br i1 %13, label %14, label %15
14: ; preds = %11
store i8 71, i8* %7
store i64 1073741824, i64* %6
br label %27
15: ; preds = %11
%16 = load i64, i64* %4
%17 = icmp sgt i64 %16, 10485760
br i1 %17, label %18, label %19
18: ; preds = %15
store i8 77, i8* %7
store i64 1048576, i64* %6
br label %26
19: ; preds = %15
%20 = load i64, i64* %4
%21 = icmp sgt i64 %20, 10240
br i1 %21, label %22, label %23
22: ; preds = %19
store i8 107, i8* %7
store i64 1024, i64* %6
br label %25
23: ; preds = %19
%24 = load i8, i8* %5
store i8 %24, i8* %7
store i64 1, i64* %6
br label %25
25: ; preds = %23, %22
br label %26
26: ; preds = %25, %18
br label %27
27: ; preds = %26, %14
%28 = load i64, i64* %4
%29 = load i64, i64* %6
%30 = sdiv i64 %28, %29
%31 = load i8, i8* %7
%32 = load i8, i8* %7
%33 = sext i8 %32 to i32
%34 = load i8, i8* %5
%35 = sext i8 %34 to i32
%36 = icmp eq i32 %33, %35
br i1 %36, label %37, label %38
37: ; preds = %27
br label %41
38: ; preds = %27
%39 = load i8, i8* %5
%40 = sext i8 %39 to i32
br label %41
41: ; preds = %38, %37
%42 = phi i32 [ 0, %37 ], [ %40, %38 ]
%43 = trunc i32 %42 to i8
%44 = call i32 @snprintf(i8* getelementptr inbounds ([255 x i8], [255 x i8]* @human_view.ret_buffer, i64 0, i64 0), i32 255, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i64 %30, i8 signext %31, i8 signext %43)
store i8* getelementptr inbounds ([255 x i8], [255 x i8]* @human_view.ret_buffer, i64 0, i64 0), i8** %3
br label %45
45: ; preds = %41, %10
%46 = load i8*, i8** %3
ret i8* %46
}

LLVM IR (-O2):
@human_view.ret_buffer = internal global [255 x i8] zeroinitializer
@.str = [16 x i8] c" -not avaible- \00"
@.str.1 = [11 x i8] c"%I64i %c%c\00"
define i8* @human_view(i64 %0, i8 signext %1) {
%3 = icmp slt i64 %0, 0
br i1 %3, label %19, label %4
4: ; preds = %2
%5 = icmp ugt i64 %0, 10737418240
br i1 %5, label %12, label %6
6: ; preds = %4
%7 = icmp ugt i64 %0, 10485760
br i1 %7, label %12, label %8
8: ; preds = %6
%9 = icmp ugt i64 %0, 10240
%10 = select i1 %9, i64 1024, i64 1
%11 = select i1 %9, i8 107, i8 %1
br label %12
12: ; preds = %8, %6, %4
%13 = phi i64 [ 1073741824, %4 ], [ 1048576, %6 ], [ %10, %8 ]
%14 = phi i8 [ 71, %4 ], [ 77, %6 ], [ %11, %8 ]
%15 = udiv i64 %0, %13
%16 = icmp eq i8 %14, %1
%17 = select i1 %16, i8 0, i8 %1
%18 = tail call i32 @snprintf(i8* getelementptr inbounds ([255 x i8], [255 x i8]* @human_view.ret_buffer, i64 0, i64 0), i32 255, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i64 %15, i8 signext %14, i8 signext %17)
br label %19
19: ; preds = %2, %12
%20 = phi i8* [ getelementptr inbounds ([255 x i8], [255 x i8]* @human_view.ret_buffer, i64 0, i64 0), %12 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), %2 ]
ret i8* %20
}