// File: /workspace/github_c_makefile_star2_O3/Tarsnap[P]kivaloo/liball/../libcperciva/util/humansize.c
// Function: humansize_parse
int
humansize_parse(const char * s, uint64_t * size)
{
	int state = 0;
	uint64_t multiplier = 1;

	do {
		switch (state) {
		case -1:
			/* Error state. */
			break;
		case 0:
			/* Initial state. */
			*size = 0;

			/* We must start with at least one digit. */
			if ((*s < '0') || (*s > '9')) {
				state = -1;
				break;
			}

			/* FALLTHROUGH */
		case 1:
			/* We're now processing digits. */
			state = 1;

			/* Digit-parsing state. */
			if (('0' <= *s) && (*s <= '9')) {
				if (*size > UINT64_MAX / 10)
					state = -1;
				else
					*size *= 10;
				if (*size > UINT64_MAX - (uint64_t)(*s - '0'))
					state = -1;
				else
					*size += (uint64_t)(*s - '0');
				break;
			}

			/* FALLTHROUGH */
		case 2:
			/* We move into state 3 after an optional ' '. */
			state = 3;
			if (*s == ' ')
				break;

			/* FALLTHROUGH */
		case 3:
			/* We may have one SI prefix. */
			switch (*s) {
			case 'E':
				multiplier *= 1000;
				/* FALLTHROUGH */
			case 'P':
				multiplier *= 1000;
				/* FALLTHROUGH */
			case 'T':
				multiplier *= 1000;
				/* FALLTHROUGH */
			case 'G':
				multiplier *= 1000;
				/* FALLTHROUGH */
			case 'M':
				multiplier *= 1000;
				/* FALLTHROUGH */
			case 'k':
				multiplier *= 1000;
				break;
			}

			/* We move into state 4 after the optional prefix. */
			state = 4;
			if (multiplier != 1)
				break;

			/* FALLTHROUGH */
		case 4:
			/* We move into state 5 after an optional 'B'. */
			state = 5;
			if (*s == 'B')
				break;

			/* FALLTHROUGH */
		case 5:
			/* We have trailing garbage. */
			state = -1;
			break;
		}

		/* Move on to the next character. */
		s++;
	} while ((state != -1) && (*s != '\0'));

	/* Multiply by multiplier. */
	if (*size > UINT64_MAX / multiplier)
		state = -1;
	else
		*size *= multiplier;

	/* Anything other than state -1 is success. */
	return ((state == -1) ? -1 : 0);
}

// Assembly:
movl $0x1, %ecx
xorl %r10d, %r10d
leaq 0x79e1(%rip), %rax      # 0x16180
movabsq $0x199999999999999a, %rdx # imm = 0x199999999999999A
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
movl %r10d, %r9d
movslq (%rax,%r9,4), %r9
addq %rax, %r9
jmpq *%r9
movq $0x0, (%rsi)
movb (%rdi), %r9b
leal -0x3a(%r9), %r10d
cmpb $-0xa, %r10b
jae 0xe7dd
jmp 0xe8fd
movb (%rdi), %r9b
jmp 0xe83b
movb (%rdi), %r9b
leal -0x30(%r9), %r10d
cmpb $0x9, %r10b
ja 0xe82b
movq (%rsi), %r10
cmpq %rdx, %r10
jae 0xe8e2
addq %r10, %r10
leaq (%r10,%r10,4), %r9
movq %r9, (%rsi)
movsbq (%rdi), %r10
movl $0x2f, %r11d
subq %r10, %r11
cmpq %r11, %r9
ja 0xe8fd
addq %r10, %r9
addq $-0x30, %r9
movq %r9, (%rsi)
movl $0x1, %r10d
jmp 0xe8c6
movb (%rdi), %r9b
movl $0x3, %r10d
cmpb $0x20, %r9b
je 0xe8c6
movzbl %r9b, %r10d
cmpl $0x4f, %r10d
jg 0xe870
cmpl $0x45, %r10d
je 0xe896
cmpl $0x47, %r10d
je 0xe8ab
cmpl $0x4d, %r10d
je 0xe8b2
jmp 0xe882
movb (%rdi), %r9b
movq %rcx, %r11
movl $0x5, %r10d
movq %r11, %rcx
cmpb $0x42, %r9b
je 0xe8c6
jmp 0xe8d8
cmpl $0x50, %r10d
je 0xe89d
cmpl $0x54, %r10d
je 0xe8a4
cmpl $0x6b, %r10d
je 0xe8b9
movl $0x4, %r10d
movl $0x1, %r11d
cmpq $0x1, %rcx
je 0xe85f
jmp 0xe8c6
imulq $0x3e8, %rcx, %rcx      # imm = 0x3E8
imulq $0x3e8, %rcx, %rcx      # imm = 0x3E8
imulq $0x3e8, %rcx, %rcx      # imm = 0x3E8
imulq $0x3e8, %rcx, %rcx      # imm = 0x3E8
imulq $0x3e8, %rcx, %rcx      # imm = 0x3E8
imulq $0x3e8, %rcx, %rcx      # imm = 0x3E8
movl $0x4, %r10d
cmpb $0x0, 0x1(%rdi)
leaq 0x1(%rdi), %rdi
jne 0xe7af
xorl %edi, %edi
jmp 0xe902
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movq %r11, %rcx
jmp 0xe902
movzbl %r9b, %eax
movl $0x2f, %edx
subq %rax, %rdx
cmpq %rdx, %r10
ja 0xe8fd
addq %r10, %rax
addq $-0x30, %rax
movq %rax, (%rsi)
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movq (%rsi), %r9
movq %rcx, %rax
mulq %r9
jo 0xe917
imulq %rcx, %r9
movq %r9, (%rsi)
movl %edi, %r8d
movl %r8d, %eax
retq
nop