// File: /workspace/github_c_makefile_star2_O0/hoobaa[P]ficl/float.c
// Function: ficlVmParseFloatNumber
int ficlVmParseFloatNumber( ficlVm *vm, ficlString s)
{
    unsigned char c;
	unsigned char digit;
    char *trace;
    ficlUnsigned length;
    float power;
    float accum = 0.0f;
    float mant = 0.1f;
    ficlInteger exponent = 0;
    char flag = 0;
    FloatParseState estate = FPS_START;


    FICL_STACK_CHECK(vm->floatStack, 0, 1);

	
    /*
    ** floating point numbers only allowed in base 10 
    */
    if (vm->base != 10)
        return(0);


    trace = FICL_STRING_GET_POINTER(s);
    length = FICL_STRING_GET_LENGTH(s);

    /* Loop through the string's characters. */
    while ((length--) && ((c = *trace++) != 0))
    {
        switch (estate)
        {
            /* At start of the number so look for a sign. */
            case FPS_START:
            {
                estate = FPS_ININT;
                if (c == '-')
                {
                    flag |= NUMISNEG;
                    break;
                }
                if (c == '+')
                {
                    break;
                }
            } /* Note!  Drop through to FPS_ININT */
            /*
            **Converting integer part of number.
            ** Only allow digits, decimal and 'E'. 
            */
            case FPS_ININT:
            {
                if (c == '.')
                {
                    estate = FPS_INMANT;
                }
                else if ((c == 'e') || (c == 'E'))
                {
                    estate = FPS_STARTEXP;
                }
                else
                {
                    digit = (unsigned char)(c - '0');
                    if (digit > 9)
                        return(0);

                    accum = accum * 10 + digit;

                }
                break;
            }
            /*
            ** Processing the fraction part of number.
            ** Only allow digits and 'E' 
            */
            case FPS_INMANT:
            {
                if ((c == 'e') || (c == 'E'))
                {
                    estate = FPS_STARTEXP;
                }
                else
                {
                    digit = (unsigned char)(c - '0');
                    if (digit > 9)
                        return(0);

                    accum += digit * mant;
                    mant *= 0.1f;
                }
                break;
            }
            /* Start processing the exponent part of number. */
            /* Look for sign. */
            case FPS_STARTEXP:
            {
                estate = FPS_INEXP;

                if (c == '-')
                {
                    flag |= EXPISNEG;
                    break;
                }
                else if (c == '+')
                {
                    break;
                }
            }       /* Note!  Drop through to FPS_INEXP */
            /*
            ** Processing the exponent part of number.
            ** Only allow digits. 
            */
            case FPS_INEXP:
            {
                digit = (unsigned char)(c - '0');
                if (digit > 9)
                    return(0);

                exponent = exponent * 10 + digit;

                break;
            }
        }
    }

    /* If parser never made it to the exponent this is not a float. */
    if (estate < FPS_STARTEXP)
        return(0);

    /* Set the sign of the number. */
    if (flag & NUMISNEG)
        accum = -accum;

    /* If exponent is not 0 then adjust number by it. */
    if (exponent != 0)
    {
        /* Determine if exponent is negative. */
        if (flag & EXPISNEG)
        {
            exponent = -exponent;
        }
        /* power = 10^x */
        power = (float)pow(10.0, exponent);
        accum *= power;
    }

    ficlStackPushFloat(vm->floatStack, accum);
    if (vm->state == FICL_VM_STATE_COMPILE)
        ficlPrimitiveFLiteralImmediate(vm);

    return(1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rsi, -0x18(%rbp)
movq %rdx, -0x10(%rbp)
movq %rdi, -0x20(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x40(%rbp)
movss 0x112cc(%rip), %xmm0    # 0x151e0
movss %xmm0, -0x44(%rbp)
movq $0x0, -0x50(%rbp)
movb $0x0, -0x51(%rbp)
movl $0x0, -0x58(%rbp)
movq -0x20(%rbp), %rax
cmpq $0xa, 0x58(%rax)
je 0x3f43
movl $0x0, -0x4(%rbp)
jmp 0x41d8
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rcx
movq %rcx, %rax
addq $-0x1, %rax
movq %rax, -0x38(%rbp)
xorl %eax, %eax
cmpq $0x0, %rcx
movb %al, -0x59(%rbp)
je 0x3f8d
movq -0x30(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x30(%rbp)
movb (%rax), %al
movb %al, -0x21(%rbp)
movzbl %al, %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x59(%rbp)
movb -0x59(%rbp), %al
testb $0x1, %al
jne 0x3f99
jmp 0x412e
movl -0x58(%rbp), %eax
movq %rax, -0x68(%rbp)
subq $0x4, %rax
ja 0x4129
movq -0x68(%rbp), %rax
leaq 0x11243(%rip), %rcx     # 0x151f8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x1, -0x58(%rbp)
movzbl -0x21(%rbp), %eax
cmpl $0x2d, %eax
jne 0x3fdd
movsbl -0x51(%rbp), %eax
orl $0x1, %eax
movb %al, -0x51(%rbp)
jmp 0x4129
movzbl -0x21(%rbp), %eax
cmpl $0x2b, %eax
jne 0x3feb
jmp 0x4129
jmp 0x3fed
movzbl -0x21(%rbp), %eax
cmpl $0x2e, %eax
jne 0x3fff
movl $0x2, -0x58(%rbp)
jmp 0x405d
movzbl -0x21(%rbp), %eax
cmpl $0x65, %eax
je 0x4011
movzbl -0x21(%rbp), %eax
cmpl $0x45, %eax
jne 0x401a
movl $0x3, -0x58(%rbp)
jmp 0x405b
movzbl -0x21(%rbp), %eax
subl $0x30, %eax
movb %al, -0x22(%rbp)
movzbl -0x22(%rbp), %eax
cmpl $0x9, %eax
jle 0x4039
movl $0x0, -0x4(%rbp)
jmp 0x41d8
movss -0x40(%rbp), %xmm0
movzbl -0x22(%rbp), %eax
cvtsi2ss %eax, %xmm1
movss 0x11196(%rip), %xmm2    # 0x151e4
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, -0x40(%rbp)
jmp 0x405d
jmp 0x4129
movzbl -0x21(%rbp), %eax
cmpl $0x65, %eax
je 0x4074
movzbl -0x21(%rbp), %eax
cmpl $0x45, %eax
jne 0x407d
movl $0x3, -0x58(%rbp)
jmp 0x40cd
movzbl -0x21(%rbp), %eax
subl $0x30, %eax
movb %al, -0x22(%rbp)
movzbl -0x22(%rbp), %eax
cmpl $0x9, %eax
jle 0x409c
movl $0x0, -0x4(%rbp)
jmp 0x41d8
movzbl -0x22(%rbp), %eax
cvtsi2ss %eax, %xmm0
movss -0x44(%rbp), %xmm2
movss -0x40(%rbp), %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, -0x40(%rbp)
movss 0x1111d(%rip), %xmm0    # 0x151e0
mulss -0x44(%rbp), %xmm0
movss %xmm0, -0x44(%rbp)
jmp 0x4129
movl $0x4, -0x58(%rbp)
movzbl -0x21(%rbp), %eax
cmpl $0x2d, %eax
jne 0x40eb
movsbl -0x51(%rbp), %eax
orl $0x2, %eax
movb %al, -0x51(%rbp)
jmp 0x4129
movzbl -0x21(%rbp), %eax
cmpl $0x2b, %eax
jne 0x40f6
jmp 0x4129
jmp 0x40f8
jmp 0x40fa
movzbl -0x21(%rbp), %eax
subl $0x30, %eax
movb %al, -0x22(%rbp)
movzbl -0x22(%rbp), %eax
cmpl $0x9, %eax
jle 0x4119
movl $0x0, -0x4(%rbp)
jmp 0x41d8
imulq $0xa, -0x50(%rbp), %rax
movzbl -0x22(%rbp), %ecx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
jmp 0x3f53
cmpl $0x3, -0x58(%rbp)
jae 0x4140
movl $0x0, -0x4(%rbp)
jmp 0x41d8
movsbl -0x51(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x4163
movss -0x40(%rbp), %xmm0
movd %xmm0, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm0
movss %xmm0, -0x40(%rbp)
cmpq $0x0, -0x50(%rbp)
je 0x41ab
movsbl -0x51(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x4180
xorl %eax, %eax
subq -0x50(%rbp), %rax
movq %rax, -0x50(%rbp)
cvtsi2sdq -0x50(%rbp), %xmm1
movsd 0x11062(%rip), %xmm0    # 0x151f0
callq 0x30a0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x3c(%rbp)
movss -0x3c(%rbp), %xmm0
mulss -0x40(%rbp), %xmm0
movss %xmm0, -0x40(%rbp)
movq -0x20(%rbp), %rax
movq 0x70(%rax), %rdi
movss -0x40(%rbp), %xmm0
callq 0x4d60
movq -0x20(%rbp), %rax
cmpq $0x1, 0x50(%rax)
jne 0x41d1
movq -0x20(%rbp), %rdi
callq 0x41f0
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)