#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 */
typedef scalar_t__ uint64_t;

/* Variables and functions */
float get_size_order(uint64_t size, char **str) {
  float q = (float)size;
  *str = "B";
  if (q > 1024.) {
    q /= 1024.;
    *str = "KB";
    if (q > 1024.) {
      q /= 1024.;
      *str = "MB";
      if (q > 1024.) {
        q /= 1024.;
        *str = "GB";
        if (q > 1024.) {
          q /= 1024.;
          *str = "TB";
        }
      }
    }
  }
  return q;
}


x86 assembly (clang, -O0):
<get_size_order>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cvtsi2ssq -0x8(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
lea    0xeed(%rip),%rcx
mov    %rcx,(%rax)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xeca(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1250 <get_size_order+0x150>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xeaf(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
lea    0xe9f(%rip),%rcx
mov    %rcx,(%rax)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe83(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    124b <get_size_order+0x14b>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe68(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
lea    0xe5b(%rip),%rcx
mov    %rcx,(%rax)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe3c(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1246 <get_size_order+0x146>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe21(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
lea    0xe17(%rip),%rcx
mov    %rcx,(%rax)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdf5(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1241 <get_size_order+0x141>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdda(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
lea    0xdd3(%rip),%rcx
mov    %rcx,(%rax)
jmp    1246 <get_size_order+0x146>
jmp    124b <get_size_order+0x14b>
jmp    1250 <get_size_order+0x150>
movss  -0x14(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_size_order>:
cvtsi2ss %rdi,%xmm0
lea    0xf03(%rip),%rax
mov    %rax,(%rsi)
cmp    $0x401,%rdi
jl     117b <get_size_order+0x7b>
mulss  0xee0(%rip),%xmm0
lea    0xee1(%rip),%rax
mov    %rax,(%rsi)
ucomiss 0xed3(%rip),%xmm0
jbe    117b <get_size_order+0x7b>
mulss  0xec5(%rip),%xmm0
lea    0xec9(%rip),%rax
mov    %rax,(%rsi)
ucomiss 0xeb8(%rip),%xmm0
jbe    117b <get_size_order+0x7b>
mulss  0xeaa(%rip),%xmm0
lea    0xeb1(%rip),%rax
mov    %rax,(%rsi)
ucomiss 0xe9d(%rip),%xmm0
jbe    117b <get_size_order+0x7b>
mulss  0xe8f(%rip),%xmm0
lea    0xe99(%rip),%rax
mov    %rax,(%rsi)
ret

LLVM IR (-O0):
@.str = [2 x i8] c"B\00"
@.str.1 = [3 x i8] c"KB\00"
@.str.2 = [3 x i8] c"MB\00"
@.str.3 = [3 x i8] c"GB\00"
@.str.4 = [3 x i8] c"TB\00"
define float @get_size_order(i64 %0, i8** %1) {
%3 = alloca i64
%4 = alloca i8**
%5 = alloca float
store i64 %0, i64* %3
store i8** %1, i8*** %4
%6 = load i64, i64* %3
%7 = sitofp i64 %6 to float
store float %7, float* %5
%8 = load i8**, i8*** %4
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %8
%9 = load float, float* %5
%10 = fpext float %9 to double
%11 = fcmp ogt double %10, 1.024000e+03
br i1 %11, label %12, label %48
12: ; preds = %2
%13 = load float, float* %5
%14 = fpext float %13 to double
%15 = fdiv double %14, 1.024000e+03
%16 = fptrunc double %15 to float
store float %16, float* %5
%17 = load i8**, i8*** %4
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %17
%18 = load float, float* %5
%19 = fpext float %18 to double
%20 = fcmp ogt double %19, 1.024000e+03
br i1 %20, label %21, label %47
21: ; preds = %12
%22 = load float, float* %5
%23 = fpext float %22 to double
%24 = fdiv double %23, 1.024000e+03
%25 = fptrunc double %24 to float
store float %25, float* %5
%26 = load i8**, i8*** %4
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8** %26
%27 = load float, float* %5
%28 = fpext float %27 to double
%29 = fcmp ogt double %28, 1.024000e+03
br i1 %29, label %30, label %46
30: ; preds = %21
%31 = load float, float* %5
%32 = fpext float %31 to double
%33 = fdiv double %32, 1.024000e+03
%34 = fptrunc double %33 to float
store float %34, float* %5
%35 = load i8**, i8*** %4
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8** %35
%36 = load float, float* %5
%37 = fpext float %36 to double
%38 = fcmp ogt double %37, 1.024000e+03
br i1 %38, label %39, label %45
39: ; preds = %30
%40 = load float, float* %5
%41 = fpext float %40 to double
%42 = fdiv double %41, 1.024000e+03
%43 = fptrunc double %42 to float
store float %43, float* %5
%44 = load i8**, i8*** %4
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8** %44
br label %45
45: ; preds = %39, %30
br label %46
46: ; preds = %45, %21
br label %47
47: ; preds = %46, %12
br label %48
48: ; preds = %47, %2
%49 = load float, float* %5
ret float %49
}

LLVM IR (-O2):
@.str = [2 x i8] c"B\00"
@.str.1 = [3 x i8] c"KB\00"
@.str.2 = [3 x i8] c"MB\00"
@.str.3 = [3 x i8] c"GB\00"
@.str.4 = [3 x i8] c"TB\00"
define float @get_size_order(i64 %0, i8** nocapture writeonly %1) {
%3 = sitofp i64 %0 to float
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %1
%4 = icmp sgt i64 %0, 1024
br i1 %4, label %5, label %16
5: ; preds = %2
%6 = fmul float %3, 0x3F50000000000000
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %1
%7 = fcmp ogt float %6, 1.024000e+03
br i1 %7, label %8, label %16
8: ; preds = %5
%9 = fmul float %6, 0x3F50000000000000
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8** %1
%10 = fcmp ogt float %9, 1.024000e+03
br i1 %10, label %11, label %16
11: ; preds = %8
%12 = fmul float %9, 0x3F50000000000000
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8** %1
%13 = fcmp ogt float %12, 1.024000e+03
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = fmul float %12, 0x3F50000000000000
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8** %1
br label %16
16: ; preds = %5, %11, %14, %8, %2
%17 = phi float [ %15, %14 ], [ %12, %11 ], [ %9, %8 ], [ %6, %5 ], [ %3, %2 ]
ret float %17
}