// File: /workspace/github_c_makefile_star2_O1/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
movzbl (%rax), %edx
leaq 0x17a51(%rip), %rcx     # 0x22180
cmpl $0x1, (%rcx,%rdx,4)
ja 0xa74a
incq %rax
movq %rax, (%rbx)
movzbl (%rax), %edx
incq %rax
cmpl $0x2, (%rcx,%rdx,4)
jb 0xa738
decq %rax
xorl %edx, %edx
leaq 0x1ab6d(%rip), %r12     # 0x252c0
movl $0x46, %esi
movzbl (%rax,%rdx), %edi
movl (%rcx,%rdi,4), %r8d
cmpl $0x6, %r8d
ja 0xa76c
btl %r8d, %esi
jb 0xa787
cmpb $0x2c, %dil
je 0xa787
movb %dil, (%rdx,%r12)
incq %rdx
cmpq $0x3e7, %rdx            # imm = 0x3E7
jne 0xa758
movq %rax, %r12
jmp 0xa78c
movb $0x0, (%rdx,%r12)
movq 0x179cd(%rip), %rsi     # 0x22160
leaq 0x18(%rsp), %rdx
leaq 0xc(%rsp), %rcx
movq %r12, %rdi
xorl %eax, %eax
callq 0x8160
movl %eax, %ecx
movl $0x6, %eax
cmpl $0x1, %ecx
jne 0xa84e
testq %r15, %r15
je 0xa800
movq 0x179ad(%rip), %rsi     # 0x22170
leaq 0x14(%rsp), %rdx
leaq 0x10(%rsp), %rcx
movq %r12, %rdi
xorl %eax, %eax
callq 0x8160
movb $0x1, %cl
cmpl $0x1, %eax
jne 0xa7fd
movl 0x10(%rsp), %eax
cmpl 0xc(%rsp), %eax
jne 0xa7fd
cvtsi2sdl 0x14(%rsp), %xmm0
cmpneqsd 0x18(%rsp), %xmm0
movq %xmm0, %rcx
andl $0x1, %ecx
movb %cl, (%r15)
callq 0x8040
movq %rax, %r15
movl $0x0, (%rax)
leaq 0x20(%rsp), %rsi
movq %r12, %rdi
callq 0x80f0
movsd %xmm0, 0x18(%rsp)
movsd %xmm0, (%r14)
movslq 0xc(%rsp), %rax
addq %rax, (%rbx)
xorl %eax, %eax
cmpl $0x22, (%r15)
jne 0xa84e
andpd 0x107f2(%rip), %xmm0    # 0x1b030
xorl %eax, %eax
ucomisd 0x107c0(%rip), %xmm0    # 0x1b008
setbe %al
addl $0x7, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq