// File: /workspace/github_c_makefile_star2_O3/heltilda[P]cicada/ciclib.c
// Function: cclib_read_string
void cclib_read_string()
{
    view windowView;
    window *stringWindow;
    linkedlist *theString;
    ccInt counter, numArgs, oneLetterType;
    char *stringPositionMarker, *holdString, *stringOverflow[2];
    
    numArgs = numBIF_args();
    if (numArgs < 1)  {  setError(wrong_argument_count_err, pcCodePtr-1);  return;  }
    
    
        // read in the source string:  argument 1
    
    stringWindow = getBIFstringArg(1);
    if (errCode != passed)  return;
    theString = &(stringWindow->variable_ptr->mem.data);   
    
    
        // make a copy of the source string, just in case the copy process would overwrite the source string
    
    holdString = (char *) malloc(stringWindow->width+1);
    if (holdString == NULL)  {  setError(out_of_memory_err, pcCodePtr-1);  return;  }
    getElements(theString, stringWindow->offset+1, stringWindow->offset+stringWindow->width, (void *) holdString);
    holdString[stringWindow->width] = 0;
    stringOverflow[0] = holdString+stringWindow->width;     // the end of the string
    
    
        // get past any weird characters at the beginning
    
    stringPositionMarker = holdString;
    oneLetterType = lettertype(stringPositionMarker);
    while ((oneLetterType != a_symbol) && (oneLetterType != a_number) && (oneLetterType != a_letter)
                    && (stringPositionMarker < stringOverflow[0]))  {
        stringPositionMarker++;
        oneLetterType = lettertype(stringPositionMarker);     }
    
    
        // Read the string into the subsequent argument variables.  String variables are read up through the next space.
    
    for (counter = 2; counter <= numArgs; counter++)   {
        windowView.windowPtr = getBIFmember(counter);
        if (windowView.windowPtr != NULL)  {
            windowView.offset = windowView.windowPtr->offset;
            windowView.width = windowView.windowPtr->width;
            readViewString(&windowView, (void *) &stringPositionMarker, stringOverflow);
            if (warningCode != passed)  errIndex--;
            if (errCode != passed)  {  free((void *) holdString);  return;  }
    }   }
    
    
        // Finally, check to see if there seem to be any left-over useful fields in the string -- if so, set a warning.
    
    oneLetterType = lettertype(stringPositionMarker);
    while ((oneLetterType != a_symbol) && (oneLetterType != a_number)
                    && (oneLetterType != a_letter) && (stringPositionMarker < stringOverflow[0]))  {
        stringPositionMarker++;
        oneLetterType = lettertype(stringPositionMarker);         }
    
    if ((stringPositionMarker != holdString+stringWindow->width) && (warningCode == passed))  {
        stringOverflow[1] = stringPositionMarker;
        if (stringOverflow[1] >= stringOverflow[0])  stringOverflow[1] = stringOverflow[0]-1;
        setWarning(string_read_err, pcCodePtr-1);       }
    
    if ((warningCode != passed) && (doPrintError))  {
        printError(NULL, -1, holdString, (ccInt) (stringOverflow[1]-holdString), ccTrue);
        warningCode = passed;       }
    
    free((void *) holdString);      // clean up
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
callq 0x19254
testl %eax, %eax
jle 0x17ef1
movl %eax, %r15d
movl $0x1, %edi
callq 0x1943c
leaq 0xda43(%rip), %r13      # 0x25760
cmpl $0x0, 0x18(%r13)
jne 0x17ee2
movq %rax, %r14
movq 0x10(%rax), %r12
movslq 0x1c(%rax), %rbx
leaq 0x1(%rbx), %rdi
callq 0x81d0
testq %rax, %rax
je 0x17f1b
movq %rax, %rbp
addq $0x10, %r12
movl 0x18(%r14), %eax
leal 0x1(%rax), %esi
addl %eax, %ebx
movq %r12, %rdi
movl %ebx, %edx
movq %rbp, %rcx
callq 0x90a5
movslq 0x1c(%r14), %rax
leaq (%rax,%rbp), %rdx
movb $0x0, (%rbp,%rax)
movq %rdx, 0x10(%rsp)
leaq 0xa405(%rip), %r12      # 0x22180
movq %rbp, %rsi
movzbl (%rsi), %eax
movl (%r12,%rax,4), %ecx
addl $-0x6, %ecx
leaq 0x1(%rsi), %rax
cmpl $-0x4, %ecx
ja 0x17d99
cmpq %rdx, %rsi
movq %rax, %rsi
jb 0x17d7e
decq %rax
movq %rax, 0x8(%rsp)
cmpl $0x1, %r15d
je 0x17e20
movq %rbp, 0x28(%rsp)
negl %r15d
movl $0x2, %ebp
leaq 0x10(%rsp), %rbx
movl %ebp, %edi
callq 0x1929e
movq %rax, 0x30(%rsp)
testq %rax, %rax
je 0x17dfb
movq 0x18(%rax), %rax
movq %rax, 0x38(%rsp)
leaq 0x30(%rsp), %rdi
leaq 0x8(%rsp), %rsi
movq %rbx, %rdx
callq 0xdefd
cmpl $0x0, 0x20(%r13)
je 0x17df0
decl 0x1c(%r13)
cmpl $0x0, 0x18(%r13)
jne 0x17f2d
leal (%r15,%rbp), %eax
incl %eax
movl %ebp, %ecx
incl %ecx
movl %ecx, %ebp
cmpl $0x1, %eax
jne 0x17db9
movq 0x8(%rsp), %rax
movzbl (%rax), %ecx
movl (%r12,%rcx,4), %ecx
addl $-0x6, %ecx
movq 0x28(%rsp), %rbp
cmpl $-0x4, %ecx
ja 0x17e56
movq 0x10(%rsp), %rdx
incq %rax
movq %rax, %rcx
leaq -0x1(%rcx), %rax
cmpq %rdx, %rax
jae 0x17e56
movq %rcx, 0x8(%rsp)
movzbl (%rcx), %eax
movl (%r12,%rax,4), %eax
addl $-0x6, %eax
incq %rcx
cmpl $-0x3, %eax
jb 0x17e30
decq %rcx
movq %rcx, %rax
movslq 0x1c(%r14), %rcx
movq %rbp, %rdx
addq %rcx, %rdx
cmpq %rdx, %rax
setne %dl
movl 0x20(%r13), %ecx
testl %ecx, %ecx
sete %sil
andb %dl, %sil
cmpb $0x1, %sil
jne 0x17ea9
movq %rax, 0x18(%rsp)
movq 0x10(%rsp), %rcx
cmpq %rcx, %rax
jb 0x17e90
decq %rcx
movq %rcx, 0x18(%rsp)
movq 0xb8(%r13), %rsi
addq $-0x4, %rsi
movl $0x5, %edi
callq 0xd06f
movl 0x20(%r13), %ecx
testl %ecx, %ecx
je 0x17eda
cmpb $0x0, 0x2a9(%r13)
je 0x17eda
movl 0x18(%rsp), %ecx
subl %ebp, %ecx
xorl %edi, %edi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movq %rbp, %rdx
movl $0x1, %r8d
callq 0x1a237
movl $0x0, 0x20(%r13)
movq %rbp, %rdi
callq 0x81c0
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xd868(%rip), %rax      # 0x25760
movq 0xb8(%rax), %rsi
addq $-0x4, %rsi
movl $0x2d, %edi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xcfa3
movq 0xb8(%r13), %rsi
addq $-0x4, %rsi
movl $0x1, %edi
jmp 0x17f08
movq 0x28(%rsp), %rdi
jmp 0x17edd