// File: /workspace/github_c_makefile_star2_O3/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 0x17a03(%rip), %rcx     # 0x22180
cmpl $0x1, (%rcx,%rdx,4)
ja 0xa798
incq %rax
movq %rax, (%rbx)
movzbl (%rax), %edx
incq %rax
cmpl $0x2, (%rcx,%rdx,4)
jb 0xa786
decq %rax
xorl %edx, %edx
leaq 0x1ab1f(%rip), %r12     # 0x252c0
movl $0x46, %esi
movzbl (%rax,%rdx), %edi
movl (%rcx,%rdi,4), %r8d
cmpl $0x6, %r8d
ja 0xa7ba
btl %r8d, %esi
jb 0xa7d5
cmpb $0x2c, %dil
je 0xa7d5
movb %dil, (%rdx,%r12)
incq %rdx
cmpq $0x3e7, %rdx            # imm = 0x3E7
jne 0xa7a6
movq %rax, %r12
jmp 0xa7da
movb $0x0, (%rdx,%r12)
movq 0x1797f(%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 0xa896
testq %r15, %r15
je 0xa84e
movq 0x1795f(%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 0xa84b
movl 0x10(%rsp), %eax
cmpl 0xc(%rsp), %eax
jne 0xa84b
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, (%r14)
movslq 0xc(%rsp), %rax
addq %rax, (%rbx)
xorl %eax, %eax
cmpl $0x22, (%r15)
jne 0xa896
andpd 0x107ea(%rip), %xmm0    # 0x1b070
xorl %eax, %eax
ucomisd 0x10778(%rip), %xmm0    # 0x1b008
setbe %al
addl $0x7, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq