#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*/ strcpy(char *, char *);
void getSizeStr(double b, char *s, double *v) {
  char *bytestrs[] = {"bytes", "KBytes", "MBytes", "GBytes"};
  if (b > 1073741824) {
    strcpy(s, bytestrs[3]);
    *v = b / 1073741824;
  } else if (b > 1048576) {
    strcpy(s, bytestrs[2]);
    *v = b / 1048576;
  } else if (b > 1024) {
    strcpy(s, bytestrs[1]);
    *v = b / 1024;
  } else {
    strcpy(s, bytestrs[0]);
    *v = b;
  }
}


x86 assembly (clang, -O0):
<getSizeStr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    0x2cd4(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0x2cd1(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0x2cce(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0x2ccb(%rip),%rax
mov    %rax,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xea2(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1193 <getSizeStr+0x83>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1030 <strcpy@plt>
movsd  -0x8(%rbp),%xmm0
movsd  0xe7e(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    123b <getSizeStr+0x12b>
movsd  -0x8(%rbp),%xmm0
movsd  0xe68(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11d5 <getSizeStr+0xc5>
mov    -0x10(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1030 <strcpy@plt>
movsd  -0x8(%rbp),%xmm0
movsd  0xe44(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    1236 <getSizeStr+0x126>
movsd  -0x8(%rbp),%xmm0
movsd  0xe2e(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1217 <getSizeStr+0x107>
mov    -0x10(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   1030 <strcpy@plt>
movsd  -0x8(%rbp),%xmm0
movsd  0xe0a(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    1231 <getSizeStr+0x121>
mov    -0x10(%rbp),%rdi
mov    -0x40(%rbp),%rsi
call   1030 <strcpy@plt>
movsd  -0x8(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    1236 <getSizeStr+0x126>
jmp    123b <getSizeStr+0x12b>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getSizeStr>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
ucomisd 0xee0(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
jbe    1144 <getSizeStr+0x34>
lea    0xf15(%rip),%rsi
call   1030 <strcpy@plt>
movsd  0x8(%rsp),%xmm0
mulsd  0xee6(%rip),%xmm0
jmp    11a2 <getSizeStr+0x92>
ucomisd 0xebc(%rip),%xmm0
jbe    116a <getSizeStr+0x5a>
lea    0xee8(%rip),%rsi
call   1030 <strcpy@plt>
movsd  0x8(%rsp),%xmm0
mulsd  0xeb8(%rip),%xmm0
jmp    11a2 <getSizeStr+0x92>
ucomisd 0xe9e(%rip),%xmm0
jbe    1190 <getSizeStr+0x80>
lea    0xebb(%rip),%rsi
call   1030 <strcpy@plt>
movsd  0x8(%rsp),%xmm0
mulsd  0xe8a(%rip),%xmm0
jmp    11a2 <getSizeStr+0x92>
lea    0xe99(%rip),%rsi
call   1030 <strcpy@plt>
movsd  0x8(%rsp),%xmm0
movsd  %xmm0,(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"bytes\00"
@.str.1 = [7 x i8] c"KBytes\00"
@.str.2 = [7 x i8] c"MBytes\00"
@.str.3 = [7 x i8] c"GBytes\00"
@__const.getSizeStr.bytestrs = [4 x i8*] [i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i32 0, i32 0)]
define void @getSizeStr(double %0, i8* %1, double* %2) {
%4 = alloca double
%5 = alloca i8*
%6 = alloca double*
%7 = alloca [4 x i8*]
store double %0, double* %4
store i8* %1, i8** %5
store double* %2, double** %6
%8 = bitcast [4 x i8*]* %7 to i8*
%9 = load double, double* %4
%10 = fcmp ogt double %9, 0x41D0000000000000
br i1 %10, label %11, label %19
11: ; preds = %3
%12 = load i8*, i8** %5
%13 = getelementptr inbounds [4 x i8*], [4 x i8*]* %7, i64 0, i64 3
%14 = load i8*, i8** %13
%15 = call i32 @strcpy(i8* %12, i8* %14)
%16 = load double, double* %4
%17 = fdiv double %16, 0x41D0000000000000
%18 = load double*, double** %6
store double %17, double* %18
br label %50
19: ; preds = %3
%20 = load double, double* %4
%21 = fcmp ogt double %20, 0x4130000000000000
br i1 %21, label %22, label %30
22: ; preds = %19
%23 = load i8*, i8** %5
%24 = getelementptr inbounds [4 x i8*], [4 x i8*]* %7, i64 0, i64 2
%25 = load i8*, i8** %24
%26 = call i32 @strcpy(i8* %23, i8* %25)
%27 = load double, double* %4
%28 = fdiv double %27, 0x4130000000000000
%29 = load double*, double** %6
store double %28, double* %29
br label %49
30: ; preds = %19
%31 = load double, double* %4
%32 = fcmp ogt double %31, 1.024000e+03
br i1 %32, label %33, label %41
33: ; preds = %30
%34 = load i8*, i8** %5
%35 = getelementptr inbounds [4 x i8*], [4 x i8*]* %7, i64 0, i64 1
%36 = load i8*, i8** %35
%37 = call i32 @strcpy(i8* %34, i8* %36)
%38 = load double, double* %4
%39 = fdiv double %38, 1.024000e+03
%40 = load double*, double** %6
store double %39, double* %40
br label %48
41: ; preds = %30
%42 = load i8*, i8** %5
%43 = getelementptr inbounds [4 x i8*], [4 x i8*]* %7, i64 0, i64 0
%44 = load i8*, i8** %43
%45 = call i32 @strcpy(i8* %42, i8* %44)
%46 = load double, double* %4
%47 = load double*, double** %6
store double %46, double* %47
br label %48
48: ; preds = %41, %33
br label %49
49: ; preds = %48, %22
br label %50
50: ; preds = %49, %11
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"bytes\00"
@.str.1 = [7 x i8] c"KBytes\00"
@.str.2 = [7 x i8] c"MBytes\00"
@.str.3 = [7 x i8] c"GBytes\00"
define void @getSizeStr(double %0, i8* %1, double* nocapture writeonly %2) {
%4 = fcmp ogt double %0, 0x41D0000000000000
br i1 %4, label %5, label %8
5: ; preds = %3
%6 = tail call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%7 = fmul double %0, 0x3E10000000000000
br label %20
8: ; preds = %3
%9 = fcmp ogt double %0, 0x4130000000000000
br i1 %9, label %10, label %13
10: ; preds = %8
%11 = tail call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%12 = fmul double %0, 0x3EB0000000000000
br label %20
13: ; preds = %8
%14 = fcmp ogt double %0, 1.024000e+03
br i1 %14, label %15, label %18
15: ; preds = %13
%16 = tail call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%17 = fmul double %0, 0x3F50000000000000
br label %20
18: ; preds = %13
%19 = tail call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %20
20: ; preds = %10, %18, %15, %5
%21 = phi double [ %12, %10 ], [ %0, %18 ], [ %17, %15 ], [ %7, %5 ]
store double %21, double* %2
ret void
}