// File: /workspace/github_c_makefile_star2_O1/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 0x1926a
testl %eax, %eax
jle 0x17f11
movl %eax, %r15d
movl $0x1, %edi
callq 0x19452
leaq 0xda1c(%rip), %r13      # 0x25760
cmpl $0x0, 0x18(%r13)
jne 0x17f02
movq %rax, %r14
movq 0x10(%rax), %r12
movslq 0x1c(%rax), %rbx
leaq 0x1(%rbx), %rdi
callq 0x81d0
testq %rax, %rax
je 0x17f3b
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 0x8fee
movslq 0x1c(%r14), %rax
movb $0x0, (%rbp,%rax)
movslq 0x1c(%r14), %rax
addq %rbp, %rax
movq %rax, 0x10(%rsp)
leaq 0xa3db(%rip), %r12      # 0x22180
movq %rbp, 0x28(%rsp)
movzbl (%rbp), %edx
movl (%r12,%rdx,4), %esi
addl $-0x6, %esi
leaq 0x1(%rbp), %rdx
cmpl $-0x4, %esi
ja 0x17dc6
cmpq %rax, %rbp
movq %rdx, %rbp
jb 0x17daa
decq %rdx
movq %rdx, 0x8(%rsp)
cmpl $0x1, %r15d
je 0x17e39
negl %r15d
movl $0x2, %ebp
leaq 0x10(%rsp), %rbx
movl %ebp, %edi
callq 0x192b4
movq %rax, 0x30(%rsp)
testq %rax, %rax
je 0x17e28
movl 0x18(%rax), %ecx
movl %ecx, 0x38(%rsp)
movl 0x1c(%rax), %eax
movl %eax, 0x3c(%rsp)
leaq 0x30(%rsp), %rdi
leaq 0x8(%rsp), %rsi
movq %rbx, %rdx
callq 0xe112
cmpl $0x0, 0x20(%r13)
je 0x17e1d
decl 0x1c(%r13)
cmpl $0x0, 0x18(%r13)
jne 0x17f4d
leal (%r15,%rbp), %eax
incl %eax
movl %ebp, %ecx
incl %ecx
movl %ecx, %ebp
cmpl $0x1, %eax
jne 0x17de1
movq 0x8(%rsp), %rax
movzbl (%rax), %eax
movl (%r12,%rax,4), %eax
addl $-0x6, %eax
cmpl $-0x4, %eax
ja 0x17e7a
movq 0x8(%rsp), %rax
movq 0x10(%rsp), %rcx
incq %rax
leaq -0x1(%rax), %rdx
cmpq %rcx, %rdx
jae 0x17e7a
movq %rax, 0x8(%rsp)
movzbl (%rax), %edx
movl (%r12,%rdx,4), %edx
addl $-0x6, %edx
incq %rax
cmpl $-0x3, %edx
jb 0x17e5a
movq 0x8(%rsp), %rax
movslq 0x1c(%r14), %rcx
movq 0x28(%rsp), %rbx
movq %rbx, %rdx
addq %rcx, %rdx
cmpq %rdx, %rax
je 0x17ec6
cmpl $0x0, 0x20(%r13)
jne 0x17ec6
movq %rax, 0x18(%rsp)
movq 0x10(%rsp), %rcx
cmpq %rcx, %rax
jb 0x17eb1
decq %rcx
movq %rcx, 0x18(%rsp)
movq 0xb8(%r13), %rsi
addq $-0x4, %rsi
movl $0x5, %edi
callq 0xd275
cmpl $0x0, 0x20(%r13)
je 0x17efa
cmpb $0x0, 0x2a9(%r13)
je 0x17efa
movl 0x18(%rsp), %ecx
subl %ebx, %ecx
xorl %edi, %edi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movq %rbx, %rdx
movl $0x1, %r8d
callq 0x1a232
movl $0x0, 0x20(%r13)
movq %rbx, %rdi
callq 0x81c0
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xd848(%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 0xd1a9
movq 0xb8(%r13), %rsi
addq $-0x4, %rsi
movl $0x1, %edi
jmp 0x17f28
movq 0x28(%rsp), %rdi
jmp 0x17efd