// File: /workspace/github_c_makefile_star2_O0/jarun[P]nnn/src/nnn.c
// Function: coolsize
static char *coolsize(off_t size)
{
	const char * const U = "BKMGTPEZY";
	static char size_buf[12]; /* Buffer to hold human readable size */
	off_t rem = 0;
	size_t ret;
	int i = 0;

	while (size >= 1024) {
		rem = size & (0x3FF); /* 1024 - 1 = 0x3FF */
		size >>= 10;
		++i;
	}

	if (i == 1) {
		rem = (rem * 1000) >> 10;
		rem /= 10;
		size = get_size(size, &rem, 10);
	} else if (i == 2) {
		rem = (rem * 1000) >> 10;
		size = get_size(size, &rem, 100);
	} else if (i > 2) {
		rem = (rem * 10000) >> 10;
		size = get_size(size, &rem, 1000);
	}

	if (i > 0 && i < 6 && rem) {
		ret = xstrsncpy(size_buf, xitoa(size), 12);
		size_buf[ret - 1] = '.';

		char *frac = xitoa(rem);
		size_t toprint = i > 3 ? 3 : i;
		size_t len = xstrlen(frac);

		if (len < toprint) {
			size_buf[ret] = size_buf[ret + 1] = size_buf[ret + 2] = '0';
			xstrsncpy(size_buf + ret + (toprint - len), frac, len + 1);
		} else
			xstrsncpy(size_buf + ret, frac, toprint + 1);

		ret += toprint;
	} else {
		ret = xstrsncpy(size_buf, size ? xitoa(size) : "0", 12);
		--ret;
	}

	size_buf[ret] = U[i];
	size_buf[ret + 1] = '\0';

	return size_buf;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
leaq 0x484a(%rip), %rax      # 0x1c6fd
movq %rax, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movl $0x0, -0x24(%rbp)
cmpq $0x400, -0x8(%rbp)      # imm = 0x400
jl 0x17ef5
movq -0x8(%rbp), %rax
andq $0x3ff, %rax            # imm = 0x3FF
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
sarq $0xa, %rax
movq %rax, -0x8(%rbp)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x17ec6
cmpl $0x1, -0x24(%rbp)
jne 0x17f35
imulq $0x3e8, -0x18(%rbp), %rax # imm = 0x3E8
sarq $0xa, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movl $0xa, %ecx
cqto
idivq %rcx
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x18(%rbp), %rsi
movl $0xa, %edx
callq 0x18530
movq %rax, -0x8(%rbp)
jmp 0x17f93
cmpl $0x2, -0x24(%rbp)
jne 0x17f63
imulq $0x3e8, -0x18(%rbp), %rax # imm = 0x3E8
sarq $0xa, %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x18(%rbp), %rsi
movl $0x64, %edx
callq 0x18530
movq %rax, -0x8(%rbp)
jmp 0x17f91
cmpl $0x2, -0x24(%rbp)
jle 0x17f8f
imulq $0x2710, -0x18(%rbp), %rax # imm = 0x2710
sarq $0xa, %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x18(%rbp), %rsi
movl $0x3e8, %edx            # imm = 0x3E8
callq 0x18530
movq %rax, -0x8(%rbp)
jmp 0x17f91
jmp 0x17f93
cmpl $0x0, -0x24(%rbp)
jle 0x180af
cmpl $0x6, -0x24(%rbp)
jge 0x180af
cmpq $0x0, -0x18(%rbp)
je 0x180af
movq -0x8(%rbp), %rax
movl %eax, %edi
callq 0x5df0
movq %rax, %rsi
leaq 0x1369d(%rip), %rdi     # 0x2b664
movl $0xc, %edx
callq 0x6250
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rcx
subq $0x1, %rcx
leaq 0x13680(%rip), %rax     # 0x2b664
movb $0x2e, (%rax,%rcx)
movq -0x18(%rbp), %rax
movl %eax, %edi
callq 0x5df0
movq %rax, -0x30(%rbp)
cmpl $0x3, -0x24(%rbp)
jle 0x18007
movl $0x3, %eax
movl %eax, -0x44(%rbp)
jmp 0x1800d
movl -0x24(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
cltq
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rdi
callq 0x5cc0
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0x18085
movq -0x20(%rbp), %rcx
leaq 0x1362c(%rip), %rax     # 0x2b664
movb $0x30, 0x2(%rax,%rcx)
movq -0x20(%rbp), %rcx
leaq 0x1361c(%rip), %rax     # 0x2b664
movb $0x30, 0x1(%rax,%rcx)
movq -0x20(%rbp), %rcx
leaq 0x1360c(%rip), %rax     # 0x2b664
movb $0x30, (%rax,%rcx)
leaq 0x13601(%rip), %rdi     # 0x2b664
addq -0x20(%rbp), %rdi
movq -0x38(%rbp), %rax
subq -0x40(%rbp), %rax
addq %rax, %rdi
movq -0x30(%rbp), %rsi
movq -0x40(%rbp), %rdx
addq $0x1, %rdx
callq 0x6250
jmp 0x180a1
leaq 0x135d8(%rip), %rdi     # 0x2b664
addq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x38(%rbp), %rdx
addq $0x1, %rdx
callq 0x6250
movq -0x38(%rbp), %rax
addq -0x20(%rbp), %rax
movq %rax, -0x20(%rbp)
jmp 0x180f9
cmpq $0x0, -0x8(%rbp)
je 0x180c7
movq -0x8(%rbp), %rax
movl %eax, %edi
callq 0x5df0
movq %rax, -0x50(%rbp)
jmp 0x180d4
leaq 0x463b(%rip), %rax      # 0x1c709
movq %rax, -0x50(%rbp)
jmp 0x180d4
movq -0x50(%rbp), %rsi
leaq 0x13585(%rip), %rdi     # 0x2b664
movl $0xc, %edx
callq 0x6250
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x20(%rbp)
movslq -0x24(%rbp), %rcx
leaq 0x45f9(%rip), %rax      # 0x1c6fd
movb (%rax,%rcx), %dl
movq -0x20(%rbp), %rcx
leaq 0x13552(%rip), %rax     # 0x2b664
movb %dl, (%rax,%rcx)
movq -0x20(%rbp), %rcx
leaq 0x13544(%rip), %rax     # 0x2b664
movb $0x0, 0x1(%rax,%rcx)
leaq 0x13538(%rip), %rax     # 0x2b664
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)