// File: /workspace/github_c_makefile_star2_O0/hoobaa[P]ficl/vm.c
// Function: ficlVmParseNumber
int ficlVmParseNumber(ficlVm *vm, ficlString s)
{
    ficlInteger accumulator  = 0;
    char isNegative      = 0;
	char isDouble      = 0;
    unsigned base   = vm->base;
    char *trace        = FICL_STRING_GET_POINTER(s);
    ficlUnsigned8 length = (ficlUnsigned8)FICL_STRING_GET_LENGTH(s);
    unsigned c;
    unsigned digit;

    if (length > 1)
    {
        switch (*trace)
        {
        case '-':
            trace++;
            length--;
            isNegative = 1;
            break;
        case '+':
            trace++;
            length--;
            isNegative = 0;
            break;
        default:
            break;
        }
    }

    if ((length > 0) && (trace[length - 1] == '.')) /* detect & remove trailing decimal */
    {
        isDouble = 1;
        length--;
    }

    if (length == 0)        /* detect "+", "-", ".", "+." etc */
        return 0; /* false */

    while ((length--) && ((c = *trace++) != '\0'))
    {
        if (!isalnum(c))
            return 0; /* false */

        digit = c - '0';

        if (digit > 9)
            digit = tolower(c) - 'a' + 10;

        if (digit >= base)
            return 0; /* false */

        accumulator = accumulator * base + digit;
    }

	if (isDouble)		/* simple (required) DOUBLE support */
		ficlStackPushInteger(vm->dataStack, 0);

    if (isNegative)
        accumulator = -accumulator;

    ficlStackPushInteger(vm->dataStack, accumulator);
    if (vm->state == FICL_VM_STATE_COMPILE)
        ficlPrimitiveLiteralIm(vm);

    return 1; /* true */
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rsi, -0x18(%rbp)
movq %rdx, -0x10(%rbp)
movq %rdi, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movb $0x0, -0x29(%rbp)
movb $0x0, -0x2a(%rbp)
movq -0x20(%rbp), %rax
movq 0x58(%rax), %rax
movl %eax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rax
movb %al, -0x39(%rbp)
movzbl -0x39(%rbp), %eax
cmpl $0x1, %eax
jle 0x9b2a
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
movl %eax, -0x48(%rbp)
subl $0x2b, %eax
je 0x9b0c
jmp 0x9ae8
movl -0x48(%rbp), %eax
subl $0x2d, %eax
jne 0x9b26
jmp 0x9af2
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
movb -0x39(%rbp), %al
addb $-0x1, %al
movb %al, -0x39(%rbp)
movb $0x1, -0x29(%rbp)
jmp 0x9b28
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
movb -0x39(%rbp), %al
addb $-0x1, %al
movb %al, -0x39(%rbp)
movb $0x0, -0x29(%rbp)
jmp 0x9b28
jmp 0x9b28
jmp 0x9b2a
movzbl -0x39(%rbp), %eax
cmpl $0x0, %eax
jle 0x9b56
movq -0x38(%rbp), %rax
movzbl -0x39(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x2e, %eax
jne 0x9b56
movb $0x1, -0x2a(%rbp)
movb -0x39(%rbp), %al
addb $-0x1, %al
movb %al, -0x39(%rbp)
movzbl -0x39(%rbp), %eax
cmpl $0x0, %eax
jne 0x9b6b
movl $0x0, -0x4(%rbp)
jmp 0x9c6e
jmp 0x9b6d
movb -0x39(%rbp), %al
movb %al, %cl
addb $-0x1, %cl
movb %cl, -0x39(%rbp)
movzbl %al, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x49(%rbp)
je 0x9ba3
movq -0x38(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x38(%rbp)
movsbl (%rax), %eax
movl %eax, -0x40(%rbp)
cmpl $0x0, %eax
setne %al
movb %al, -0x49(%rbp)
movb -0x49(%rbp), %al
testb $0x1, %al
jne 0x9bac
jmp 0x9c1b
callq 0x3310
movq (%rax), %rax
movslq -0x40(%rbp), %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x8, %eax
cmpl $0x0, %eax
jne 0x9bd0
movl $0x0, -0x4(%rbp)
jmp 0x9c6e
movl -0x40(%rbp), %eax
subl $0x30, %eax
movl %eax, -0x44(%rbp)
cmpl $0x9, -0x44(%rbp)
jbe 0x9bf0
movl -0x40(%rbp), %edi
callq 0x3200
subl $0x61, %eax
addl $0xa, %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x30(%rbp), %eax
jb 0x9c01
movl $0x0, -0x4(%rbp)
jmp 0x9c6e
movq -0x28(%rbp), %rax
movl -0x30(%rbp), %ecx
imulq %rcx, %rax
movl -0x44(%rbp), %ecx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
jmp 0x9b6d
cmpb $0x0, -0x2a(%rbp)
je 0x9c32
movq -0x20(%rbp), %rax
movq 0x60(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x4c90
cmpb $0x0, -0x29(%rbp)
je 0x9c42
xorl %eax, %eax
subq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq 0x60(%rax), %rdi
movq -0x28(%rbp), %rsi
callq 0x4c90
movq -0x20(%rbp), %rax
cmpq $0x1, 0x50(%rax)
jne 0x9c67
movq -0x20(%rbp), %rdi
callq 0x9ea0
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)