#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*/ sprintf(char *, char *, ...);
char *display_size_not_aligned(long long unsigned int number, char *buffer) {
  double tmp = number;
  char suffix[64];
  sprintf(suffix, "%s", " B ");
  ;
  if (tmp >= 1024) {
    tmp = tmp / 1024;
    sprintf(suffix, "%s", " K");
    ;
  }
  if (tmp >= 1024) {
    tmp = tmp / 1024;
    sprintf(suffix, "%s", " M");
    ;
  }
  if (tmp >= 1024) {
    tmp = tmp / 1024;
    sprintf(suffix, "%s", " G");
    ;
  }
  if (tmp >= 1024) {
    tmp = tmp / 1024;
    sprintf(suffix, "%s", " T");
    ;
  }
  if (tmp >= 1024) {
    tmp = tmp / 1024;
    sprintf(suffix, "%s", " P");
    ;
  }
  sprintf(buffer, "%.2f%s", tmp, suffix);
  return buffer;
}


x86 assembly (clang, -O0):
<display_size_not_aligned>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movaps 0xee9(%rip),%xmm1
movq   -0x8(%rbp),%xmm0
punpckldq %xmm1,%xmm0
movapd 0xee8(%rip),%xmm1
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
lea    -0x60(%rbp),%rdi
lea    0xef0(%rip),%rsi
lea    0xed2(%rip),%rdx
mov    $0x0,%al
call   1030 <sprintf@plt>
movsd  -0x18(%rbp),%xmm0
movsd  0xe8e(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     11ab <display_size_not_aligned+0x9b>
movsd  -0x18(%rbp),%xmm0
movsd  0xe77(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
lea    -0x60(%rbp),%rdi
lea    0xeaa(%rip),%rsi
lea    0xe90(%rip),%rdx
mov    $0x0,%al
call   1030 <sprintf@plt>
movsd  -0x18(%rbp),%xmm0
movsd  0xe48(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     11f1 <display_size_not_aligned+0xe1>
movsd  -0x18(%rbp),%xmm0
movsd  0xe31(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
lea    -0x60(%rbp),%rdi
lea    0xe64(%rip),%rsi
lea    0xe4d(%rip),%rdx
mov    $0x0,%al
call   1030 <sprintf@plt>
movsd  -0x18(%rbp),%xmm0
movsd  0xe02(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1237 <display_size_not_aligned+0x127>
movsd  -0x18(%rbp),%xmm0
movsd  0xdeb(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
lea    -0x60(%rbp),%rdi
lea    0xe1e(%rip),%rsi
lea    0xe0a(%rip),%rdx
mov    $0x0,%al
call   1030 <sprintf@plt>
movsd  -0x18(%rbp),%xmm0
movsd  0xdbc(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     127d <display_size_not_aligned+0x16d>
movsd  -0x18(%rbp),%xmm0
movsd  0xda5(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
lea    -0x60(%rbp),%rdi
lea    0xdd8(%rip),%rsi
lea    0xdc7(%rip),%rdx
mov    $0x0,%al
call   1030 <sprintf@plt>
movsd  -0x18(%rbp),%xmm0
movsd  0xd76(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     12c3 <display_size_not_aligned+0x1b3>
movsd  -0x18(%rbp),%xmm0
movsd  0xd5f(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
lea    -0x60(%rbp),%rdi
lea    0xd92(%rip),%rsi
lea    0xd84(%rip),%rdx
mov    $0x0,%al
call   1030 <sprintf@plt>
mov    -0x10(%rbp),%rdi
movsd  -0x18(%rbp),%xmm0
lea    -0x60(%rbp),%rdx
lea    0xd6c(%rip),%rsi
mov    $0x1,%al
call   1030 <sprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display_size_not_aligned>:
push   %rbx
sub    $0x40,%rsp
mov    %rsi,%rbx
movq   %rdi,%xmm1
punpckldq 0xedb(%rip),%xmm1
subpd  0xee3(%rip),%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
addsd  %xmm1,%xmm0
movl   $0x204220,(%rsp)
cmp    $0x400,%rdi
jae    11a9 <display_size_not_aligned+0x99>
ucomisd 0xed7(%rip),%xmm0
jae    11c6 <display_size_not_aligned+0xb6>
ucomisd 0xecd(%rip),%xmm0
jae    11e7 <display_size_not_aligned+0xd7>
ucomisd 0xebf(%rip),%xmm0
jae    1208 <display_size_not_aligned+0xf8>
ucomisd 0xeb1(%rip),%xmm0
jb     118c <display_size_not_aligned+0x7c>
mulsd  0xe9f(%rip),%xmm0
movb   $0x0,0x2(%rsp)
movw   $0x5020,(%rsp)
lea    0xeac(%rip),%rsi
mov    %rsp,%rdx
mov    %rbx,%rdi
mov    $0x1,%al
call   1030 <sprintf@plt>
mov    %rbx,%rax
add    $0x40,%rsp
pop    %rbx
ret
mulsd  0xe6f(%rip),%xmm0
movb   $0x0,0x2(%rsp)
movw   $0x4b20,(%rsp)
ucomisd 0xe64(%rip),%xmm0
jb     1153 <display_size_not_aligned+0x43>
mulsd  0xe52(%rip),%xmm0
movb   $0x0,0x2(%rsp)
movw   $0x4d20,(%rsp)
ucomisd 0xe47(%rip),%xmm0
jb     1161 <display_size_not_aligned+0x51>
mulsd  0xe31(%rip),%xmm0
movb   $0x0,0x2(%rsp)
movw   $0x4720,(%rsp)
ucomisd 0xe26(%rip),%xmm0
jb     116f <display_size_not_aligned+0x5f>
mulsd  0xe10(%rip),%xmm0
movb   $0x0,0x2(%rsp)
movw   $0x5420,(%rsp)
ucomisd 0xe05(%rip),%xmm0
jae    1179 <display_size_not_aligned+0x69>
jmp    118c <display_size_not_aligned+0x7c>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [4 x i8] c" B \00"
@.str.2 = [3 x i8] c" K\00"
@.str.3 = [3 x i8] c" M\00"
@.str.4 = [3 x i8] c" G\00"
@.str.5 = [3 x i8] c" T\00"
@.str.6 = [3 x i8] c" P\00"
@.str.7 = [7 x i8] c"%.2f%s\00"
define i8* @display_size_not_aligned(i64 %0, i8* %1) {
%3 = alloca i64
%4 = alloca i8*
%5 = alloca double
%6 = alloca [64 x i8]
store i64 %0, i64* %3
store i8* %1, i8** %4
%7 = load i64, i64* %3
%8 = uitofp i64 %7 to double
store double %8, double* %5
%9 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%10 = call i32 (i8*, i8*, ...) @sprintf(i8* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%11 = load double, double* %5
%12 = fcmp oge double %11, 1.024000e+03
br i1 %12, label %13, label %18
13: ; preds = %2
%14 = load double, double* %5
%15 = fdiv double %14, 1.024000e+03
store double %15, double* %5
%16 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%17 = call i32 (i8*, i8*, ...) @sprintf(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %18
18: ; preds = %13, %2
%19 = load double, double* %5
%20 = fcmp oge double %19, 1.024000e+03
br i1 %20, label %21, label %26
21: ; preds = %18
%22 = load double, double* %5
%23 = fdiv double %22, 1.024000e+03
store double %23, double* %5
%24 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%25 = call i32 (i8*, i8*, ...) @sprintf(i8* %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %26
26: ; preds = %21, %18
%27 = load double, double* %5
%28 = fcmp oge double %27, 1.024000e+03
br i1 %28, label %29, label %34
29: ; preds = %26
%30 = load double, double* %5
%31 = fdiv double %30, 1.024000e+03
store double %31, double* %5
%32 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%33 = call i32 (i8*, i8*, ...) @sprintf(i8* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %34
34: ; preds = %29, %26
%35 = load double, double* %5
%36 = fcmp oge double %35, 1.024000e+03
br i1 %36, label %37, label %42
37: ; preds = %34
%38 = load double, double* %5
%39 = fdiv double %38, 1.024000e+03
store double %39, double* %5
%40 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%41 = call i32 (i8*, i8*, ...) @sprintf(i8* %40, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %42
42: ; preds = %37, %34
%43 = load double, double* %5
%44 = fcmp oge double %43, 1.024000e+03
br i1 %44, label %45, label %50
45: ; preds = %42
%46 = load double, double* %5
%47 = fdiv double %46, 1.024000e+03
store double %47, double* %5
%48 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%49 = call i32 (i8*, i8*, ...) @sprintf(i8* %48, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
br label %50
50: ; preds = %45, %42
%51 = load i8*, i8** %4
%52 = load double, double* %5
%53 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%54 = call i32 (i8*, i8*, ...) @sprintf(i8* %51, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), double %52, i8* %53)
%55 = load i8*, i8** %4
ret i8* %55
}

LLVM IR (-O2):
@.str.2 = [3 x i8] c" K\00"
@.str.3 = [3 x i8] c" M\00"
@.str.4 = [3 x i8] c" G\00"
@.str.5 = [3 x i8] c" T\00"
@.str.6 = [3 x i8] c" P\00"
@.str.7 = [7 x i8] c"%.2f%s\00"
define i8* @display_size_not_aligned(i64 %0, i8* returned writeonly %1) {
%3 = alloca [64 x i8]
%4 = uitofp i64 %0 to double
%5 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%6 = bitcast [64 x i8]* %3 to i32*
store i32 2114080, i32* %6
%7 = icmp ugt i64 %0, 1023
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = fmul double %4, 0x3F50000000000000
br label %10
10: ; preds = %8, %2
%11 = phi double [ %9, %8 ], [ %4, %2 ]
%12 = fcmp ult double %11, 1.024000e+03
br i1 %12, label %15, label %13
13: ; preds = %10
%14 = fmul double %11, 0x3F50000000000000
br label %15
15: ; preds = %13, %10
%16 = phi double [ %14, %13 ], [ %11, %10 ]
%17 = fcmp ult double %16, 1.024000e+03
br i1 %17, label %20, label %18
18: ; preds = %15
%19 = fmul double %16, 0x3F50000000000000
br label %20
20: ; preds = %18, %15
%21 = phi double [ %19, %18 ], [ %16, %15 ]
%22 = fcmp ult double %21, 1.024000e+03
br i1 %22, label %25, label %23
23: ; preds = %20
%24 = fmul double %21, 0x3F50000000000000
br label %25
25: ; preds = %23, %20
%26 = phi double [ %24, %23 ], [ %21, %20 ]
%27 = fcmp ult double %26, 1.024000e+03
br i1 %27, label %30, label %28
28: ; preds = %25
%29 = fmul double %26, 0x3F50000000000000
br label %30
30: ; preds = %28, %25
%31 = phi double [ %29, %28 ], [ %26, %25 ]
%32 = call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), double %31, i8* %5)
ret i8* %1
}