// File: /workspace/github_c_makefile_star2_O2/heltilda[P]cicada/cmpile.c
// Function: readNum
ccInt readNum(char **charPtr, ccFloat *returnedNum, ccBool *ifFloat)
{
    ccInt intnum, intnumsread, doublenumsread, cc;
    int intcharsread, doublecharsread;
    ccFloat doublenum;
    char *newCharPtr, *numStart;
    
    while ((lettertype(*charPtr) == a_space) || (lettertype(*charPtr) == unprintable))  (*charPtr)++;
    numStart = *charPtr;
    
    for (cc = 0; cc < numBufferSize; cc++)  {       // super stupid -- sscanf() will copy the whole string up to \x00 into a file stream,
        char *oneChar = numStart + cc;              // so let's make sure it only copies the number we're reading
        if ((lettertype(oneChar) == a_space) || (lettertype(oneChar) == a_eol) || (lettertype(oneChar) == a_null) || (*oneChar == ','))  break;
        numBuffer[cc] = *oneChar;       }
    
    if (cc < numBufferSize)  {
        numBuffer[cc] = '\x00';
        numStart = numBuffer;       }
    
    doublenumsread = sscanf(numStart, readFloatFormatString, &doublenum, &doublecharsread);
    if (doublenumsread == 1)  {
        
        if (ifFloat != NULL)  {
            intnumsread = sscanf(numStart, readIntFormatString, &intnum, &intcharsread);
            *ifFloat = ((intnumsread != 1) || (intcharsread != doublecharsread) || (doublenum != (ccFloat) intnum));    }
        
        errno = 0;
        doublenum = strtod(numStart, &newCharPtr);      // reread to check for over/underflow
        *returnedNum = doublenum;
        *charPtr += doublecharsread;
        
        if (errno == ERANGE)  {
            if ((doublenum > 1) || (doublenum < -1))  return overflow_err;
            else  return underflow_err;     }
        
        return passed;      }
    
    return read_number_err;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movq (%rdi), %rax
leaq 0x16e7f(%rip), %rcx     # 0x21180
movzbl (%rax), %edx
cmpl $0x2, (%rcx,%rdx,4)
jae 0xa312
incq %rax
movq %rax, (%rbx)
jmp 0xa301
xorl %edx, %edx
leaq 0x19fa5(%rip), %r12     # 0x242c0
pushq $0x46
popq %rsi
cmpq $0x3e7, %rdx            # imm = 0x3E7
je 0xa351
movzbl (%rax,%rdx), %edi
movl (%rcx,%rdi,4), %r8d
cmpl $0x6, %r8d
ja 0xa33b
btl %r8d, %esi
jb 0xa34a
cmpb $0x2c, %dil
je 0xa34a
movb %dil, (%rdx,%r12)
incq %rdx
jmp 0xa31e
movb $0x0, (%rdx,%r12)
jmp 0xa354
movq %rax, %r12
movq 0x16e05(%rip), %rsi     # 0x21160
leaq 0x18(%rsp), %rdx
leaq 0xc(%rsp), %rcx
movq %r12, %rdi
xorl %eax, %eax
callq 0x8160
cmpl $0x1, %eax
jne 0xa408
testq %r15, %r15
je 0xa3c1
movq 0x16dec(%rip), %rsi     # 0x21170
leaq 0x14(%rsp), %rdx
leaq 0x10(%rsp), %rcx
movq %r12, %rdi
xorl %eax, %eax
callq 0x8160
movb $0x1, %cl
cmpl $0x1, %eax
jne 0xa3be
movl 0x10(%rsp), %eax
cmpl 0xc(%rsp), %eax
jne 0xa3be
cvtsi2sdl 0x14(%rsp), %xmm0
cmpneqsd 0x18(%rsp), %xmm0
movq %xmm0, %rcx
andl $0x1, %ecx
movb %cl, (%r15)
callq 0x8040
movq %rax, %r15
andl $0x0, (%rax)
leaq 0x20(%rsp), %rsi
movq %r12, %rdi
callq 0x80f0
movsd %xmm0, (%r14)
movslq 0xc(%rsp), %rax
addq %rax, (%rbx)
xorl %eax, %eax
cmpl $0x22, (%r15)
jne 0xa40b
andpd 0xec3a(%rip), %xmm0     # 0x19030
xorl %eax, %eax
ucomisd 0xec08(%rip), %xmm0     # 0x19008
setbe %al
addl $0x7, %eax
jmp 0xa40b
pushq $0x6
popq %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq