// File: /workspace/github_c_makefile_star2_O1/heltilda[P]cicada/cmpile.c
// Function: readTextString
ccInt readTextString(char **scanPtr, char *closingString, ccInt **stringBuffer, ccInt *stringSizeInInts, ccBool isChar)
{
    ccInt chars_num = 0, numPriorSlashes;
    char *startPtr = *scanPtr, *endPtr, *charPtr;
    
    
        // First, count the number of characters in the string.
    
    endPtr = startPtr-1;
    do  {
        endPtr = strstr(endPtr+1, closingString);
        if (endPtr == NULL)  {
            errPosition = 1;
            return string_read_err;     }
        
        numPriorSlashes = 0;
        charPtr = endPtr-1;
        while (*charPtr == '\\')  {  numPriorSlashes++;  charPtr--;  }
    }  while (numPriorSlashes % 2 == 1);
    
    while (*scanPtr < endPtr)   {
        if (**scanPtr == '\\')  {      // deal with special characters
            nextChar(scanPtr);
            if ((lettertype(*scanPtr) == a_number) ||
                        ((**scanPtr >= 'A') && (**scanPtr <= 'F')) || ((**scanPtr >= 'a') && (**scanPtr <= 'f')))   {
                nextChar(scanPtr);
                nextChar(scanPtr);    }
            else if ((**scanPtr == '\\') || (**scanPtr == 'r') || (**scanPtr == 'n') || (**scanPtr == 't')
                                            || (**scanPtr == closingString[0]))
                nextChar(scanPtr);
            else    {
                errPosition = (ccInt) (*scanPtr-startPtr) + 1;
                return string_read_err;   }    }
        else    {
            nextChar(scanPtr);    }
        chars_num++;    }
    
    if ((isChar) && (chars_num != 1))  return char_read_err;
    
    
        // get a buffer to store the string in
    
    *stringSizeInInts = ceil(1.*chars_num/sizeof(ccInt));    // align along a ccInt boundary
    if (!isChar)  (*stringSizeInInts)++;
    *stringBuffer = (ccInt *) malloc((size_t) (*stringSizeInInts)*sizeof(ccInt));
    if (*stringBuffer == NULL)   {
        errPosition = (ccInt) (*scanPtr-startPtr) + 1;
        return out_of_memory_err;     }
    
    if (!isChar)  **stringBuffer = chars_num;
    (*stringBuffer)[(*stringSizeInInts)-1] = 0;         // in case the final int isn't completely overwritten
    
    charPtr = ((char *) *stringBuffer);
    if (!isChar)  charPtr += sizeof(ccInt);
    *scanPtr = startPtr;
    
    
        // Now re-read the string, this time storing the characters in the buffer as we go.
    
    while (*scanPtr < endPtr)   {
        if (**scanPtr == '\\')  {
            nextChar(scanPtr);
            
                // general special character:  \xy where x, y are hexadecimal
            
            if ((lettertype(*scanPtr) == a_number) ||
                        ((**scanPtr >= 'A') && (**scanPtr <= 'F')) || ((**scanPtr >= 'a') && (**scanPtr <= 'f')))   {
                
                if (lettertype(*scanPtr) == a_number)  *charPtr = **scanPtr - '0';
                else if ((**scanPtr >= 'A') && (**scanPtr <= 'F'))  *charPtr = **scanPtr - 'A' + 10;
                else if ((**scanPtr >= 'a') && (**scanPtr <= 'f'))  *charPtr = **scanPtr - 'a' + 10;
                else  {
                    errPosition = (ccInt) (*scanPtr - startPtr) + 1;
                    free((void *) *stringBuffer);
                    return string_read_err;         }
                
                *charPtr *= 16;
                nextChar(scanPtr);
                
                if (lettertype(*scanPtr) == a_number)  *charPtr += **scanPtr - '0';
                else if ((**scanPtr >= 'A') && (**scanPtr <= 'F'))  *charPtr += **scanPtr - 'A' + 10;
                else if ((**scanPtr >= 'a') && (**scanPtr <= 'f'))  *charPtr += **scanPtr - 'a' + 10;
                else  {
                    errPosition = (ccInt) (*scanPtr - startPtr) + 1;
                    free((void *) *stringBuffer);
                    return string_read_err;     }     }
            
            else if (**scanPtr == '\\')     // backslash
                    *charPtr = '\\';
            else if (**scanPtr == 'n')      // end-of-line
                    *charPtr = '\n';
            else if (**scanPtr == 'r')      // carriage return
                    *charPtr = '\r';
            else if (**scanPtr == 't')      // tab
                    *charPtr = '\t';
            else if (**scanPtr == closingString[0])      // quote
                    *charPtr = closingString[0];        }
        
        else    {
            *charPtr = **scanPtr;    }       // if it's a normal character, just copy it over
        
        nextChar(scanPtr);
        charPtr++;    }
    
    
        // characters are just stored as ints -- do the conversion
    
    if (isChar)  (*stringBuffer)[0] = (ccInt) *(charPtr-1);
    
    return passed;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r8d, 0x4(%rsp)
movq %rcx, %rbx
movq %rdx, %r13
movq %rsi, %r15
movq %rdi, %r14
movq (%rdi), %rbp
leaq -0x1(%rbp), %r12
incq %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x80a0
testq %rax, %rax
je 0xbb9d
movq %rax, %r12
xorl %eax, %eax
cmpb $0x5c, -0x1(%r12,%rax)
leaq -0x1(%rax), %rax
je 0xba84
testb $0x1, %al
je 0xba68
movq %rbp, 0x10(%rsp)
movq (%r14), %rsi
xorl %ebp, %ebp
cmpq %r12, %rsi
jae 0xbbb1
xorl %ebp, %ebp
leaq 0x166d0(%rip), %rax     # 0x22180
movabsq $0x3f0000003f, %rcx     # imm = 0x3F0000003F
movabsq $0xa200008000000, %rdx  # imm = 0xA200008000000
movzbl (%rsi), %r8d
movl (%rax,%r8,4), %edi
cmpl $0x5c, %r8d
jne 0xbb44
cmpl $0x6, %edi
je 0xbae9
incq %rsi
movq %rsi, (%r14)
movzbl (%rsi), %edi
incq %rsi
cmpl $0x0, (%rax,%rdi,4)
je 0xbada
movq (%r14), %rsi
movzbl (%rsi), %r8d
movl (%rax,%r8,4), %edi
cmpl $0x4, %edi
je 0xbb12
leal -0x41(%r8), %r9d
cmpl $0x33, %r9d
ja 0xbb8a
btq %r9, %rcx
jae 0xbb6b
cmpl $0x6, %edi
je 0xbb24
incq %rsi
movq %rsi, (%r14)
movzbl (%rsi), %edi
incq %rsi
cmpl $0x0, (%rax,%rdi,4)
je 0xbb15
movq (%r14), %rsi
movzbl (%rsi), %edi
cmpl $0x6, (%rax,%rdi,4)
je 0xbb5b
incq %rsi
movq %rsi, (%r14)
movzbl (%rsi), %edi
incq %rsi
cmpl $0x0, (%rax,%rdi,4)
je 0xbb33
jmp 0xbb5b
cmpl $0x6, %edi
je 0xbb5b
incq %rsi
movq %rsi, (%r14)
movzbl (%rsi), %edi
incq %rsi
cmpl $0x0, (%rax,%rdi,4)
je 0xbb4c
incl %ebp
movq (%r14), %rsi
cmpq %r12, %rsi
jb 0xbac4
jmp 0xbbb1
btq %r9, %rdx
jae 0xbb8a
cmpl $0x6, %edi
je 0xbb5b
incq %rsi
movq %rsi, (%r14)
movzbl (%rsi), %edi
incq %rsi
cmpl $0x0, (%rax,%rdi,4)
je 0xbb79
jmp 0xbb5b
cmpb (%r15), %r8b
je 0xbb71
subl 0x10(%rsp), %esi
incl %esi
movl %esi, 0x1970d(%rip)     # 0x252a8
jmp 0xbba7
movl $0x1, 0x19701(%rip)     # 0x252a8
movl $0x5, %edx
jmp 0xbdb2
movq %r13, 0x8(%rsp)
movl 0x4(%rsp), %r13d
testb %r13b, %r13b
setne %al
cmpl $0x1, %ebp
setne %cl
movl $0x5, %edx
testb %cl, %al
jne 0xbdb2
cvtsi2sd %ebp, %xmm0
mulsd 0xf438(%rip), %xmm0     # 0x1b018
callq 0x8070
cvttsd2si %xmm0, %eax
cmpb $0x1, %r13b
adcl $0x0, %eax
movl %eax, (%rbx)
movslq %eax, %rbx
leaq (,%rbx,4), %rdi
callq 0x81d0
movq 0x8(%rsp), %rcx
movq %rax, (%rcx)
testq %rax, %rax
je 0xbc18
testb %r13b, %r13b
je 0xbc31
xorl %ecx, %ecx
jmp 0xbc38
movl (%r14), %eax
subl 0x10(%rsp), %eax
incl %eax
movl %eax, 0x19681(%rip)     # 0x252a8
movl $0x1, %edx
jmp 0xbdb2
movl %ebp, (%rax)
movl $0x4, %ecx
movl $0x0, -0x4(%rax,%rbx,4)
addq %rcx, %rax
movq 0x10(%rsp), %rbx
movq %rbx, (%r14)
cmpq %r12, %rbx
jae 0xbd9b
leaq 0x16525(%rip), %rcx     # 0x22180
leaq 0xf3de(%rip), %rdx      # 0x1b040
movq %rbx, %rdi
movzbl (%rdi), %esi
cmpq $0x5c, %rsi
jne 0xbd53
cmpl $0x6, (%rcx,%rsi,4)
je 0xbc8a
incq %rdi
movq %rdi, (%r14)
movzbl (%rdi), %esi
incq %rdi
cmpl $0x0, (%rcx,%rsi,4)
je 0xbc7b
movq (%r14), %rdi
movb (%rdi), %sil
movzbl %sil, %r10d
movl (%rcx,%r10,4), %r9d
movb $-0x30, %r8b
cmpl $0x4, %r9d
je 0xbcef
leal -0x5c(%r10), %r11d
cmpl $0x18, %r11d
ja 0xbcbd
movslq (%rdx,%r11,4), %r10
addq %rdx, %r10
jmpq *%r10
movb $0xa, %sil
jmp 0xbd53
addl $-0x41, %r10d
cmpl $0x6, %r10d
jae 0xbd85
cmpl $0x4, %r9d
je 0xbcef
leal -0x41(%rsi), %r9d
movb $-0x37, %r8b
cmpb $0x6, %r9b
jb 0xbcef
leal -0x61(%rsi), %r9d
movb $-0x57, %r8b
cmpb $0x6, %r9b
jae 0xbdc3
addb %r8b, %sil
shlb $0x4, %sil
movb %sil, (%rax)
movzbl (%rdi), %r8d
cmpl $0x6, (%rcx,%r8,4)
je 0xbd18
incq %rdi
movq %rdi, (%r14)
movzbl (%rdi), %r8d
incq %rdi
cmpl $0x0, (%rcx,%r8,4)
je 0xbd07
movq (%r14), %rdi
movzbl (%rdi), %r8d
cmpl $0x4, (%rcx,%r8,4)
jne 0xbd2f
addb %r8b, %sil
addb $-0x30, %sil
jmp 0xbd53
leal -0x41(%r8), %r9d
cmpb $0x5, %r9b
ja 0xbd42
addb %r8b, %sil
addb $-0x37, %sil
jmp 0xbd53
leal -0x61(%r8), %r9d
cmpb $0x5, %r9b
ja 0xbdc3
addb %r8b, %sil
addb $-0x57, %sil
movb %sil, (%rax)
movq (%r14), %rsi
movzbl (%rsi), %edi
cmpl $0x6, (%rcx,%rdi,4)
je 0xbd74
incq %rsi
movq %rsi, (%r14)
movzbl (%rsi), %edi
incq %rsi
cmpl $0x0, (%rcx,%rdi,4)
je 0xbd65
incq %rax
movq (%r14), %rdi
cmpq %r12, %rdi
jb 0xbc65
jmp 0xbd9b
movb (%r15), %dil
cmpb %dil, %sil
movl %edi, %esi
je 0xbd53
jmp 0xbd56
movb $0x9, %sil
jmp 0xbd53
movb $0xd, %sil
jmp 0xbd53
xorl %edx, %edx
cmpb $0x0, 0x4(%rsp)
je 0xbdb2
movsbl -0x1(%rax), %eax
movq 0x8(%rsp), %rcx
movq (%rcx), %rcx
movl %eax, (%rcx)
movl %edx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
subl %ebx, %edi
incl %edi
movl %edi, 0x194db(%rip)     # 0x252a8
movq 0x8(%rsp), %rax
movq (%rax), %rdi
callq 0x81c0
jmp 0xbba7