// File: /workspace/github_c_makefile_star2_O2/heltilda[P]cicada/ciclib.c
// Function: cclib_print_string
void cclib_print_string()
{
    window *precisionWindow, *fieldWidthWindow, *stringWindow, *charWindow;
    member *charMember;
    view windowView;
    char *stringPositionMarker;
    ccInt dataSize, sizeofStrings, counter, numArgs, stringWindowPosition = 1, rtrn;
    linkedlist tempPrintLL;
    
    numArgs = numBIF_args();
    if (numArgs < 1)  {  setError(wrong_argument_count_err, pcCodePtr-1);  return;  }
    
    
        // read in the (optional) field width and floating-point precision arguments; otherwise use default values
    
    fieldWidth = 0;
    maxDigits = maxPrintableDigits;
    
    fieldWidthWindow = getBIFmember(1);
    if (fieldWidthWindow == NULL)  {  setError(void_member_err, pcCodePtr-1);  return;  }
    
    if (fieldWidthWindow->variable_ptr->type <= double_type)  {
        stringWindowPosition++;
        if (numArgs < 2)  {  setError(wrong_argument_count_err, pcCodePtr-1);  return;  }
        fieldWidth = (ccInt) getBIFnumArg(1, 0., (ccFloat) maxFieldWidth);
        
        precisionWindow = getBIFmember(2);
        if (precisionWindow == NULL)  {  setError(void_member_err, pcCodePtr-1);  return;  }
        
        if (precisionWindow->variable_ptr->type <= double_type)  {
            stringWindowPosition++;
            if (numArgs < 3)  {  setError(wrong_argument_count_err, pcCodePtr-1);  return;  }
            maxDigits = (ccInt) getBIFnumArg(2, 0., (ccFloat) maxPrintableDigits);
    }   }
    
    stringWindow = getBIFmember(stringWindowPosition);
    if (stringWindow == NULL)  {  setError(void_member_err, pcCodePtr-1);  return;  }
    if (stringWindow->variable_ptr->type != string_type)  {  setError(string_expected_err, pcCodePtr-1);  return;  }
    
    
        // compute the byte size of the final string without printing it yet
    
    dataSize = 0;  sizeofStrings = 0;
    for (counter = stringWindowPosition+1; counter <= numArgs; counter++)  {
        windowView.windowPtr = getBIFmember(counter);
        if (windowView.windowPtr != NULL)  {
            windowView.offset = windowView.windowPtr->offset;
            windowView.width = windowView.windowPtr->width;
            sizeViewString(&windowView, &dataSize, (void *) &sizeofStrings);
    }   }
    
    
        // allocate contiguous memory in the destination string
    
    rtrn = newLinkedList(&tempPrintLL, dataSize+sizeofStrings, sizeof(char), 0, ccFalse);
    if (rtrn == passed)  rtrn = defragmentLinkedList(&tempPrintLL);
    if (rtrn != passed)  {  setError(out_of_memory_err, pcCodePtr-1);  return;  }
    
    
        // print the string
    
    if (dataSize+sizeofStrings > 0)  {
        stringPositionMarker = (char *) element(&tempPrintLL, 1);
        for (counter = stringWindowPosition+1; counter <= numArgs; counter++)  {
            windowView.windowPtr = getBIFmember(counter);
            if (windowView.windowPtr != NULL)  {
                windowView.offset = windowView.windowPtr->offset;
                windowView.width = windowView.windowPtr->width;
                printViewString(&windowView, (void *) &stringPositionMarker, (void *) &sizeofStrings);
                if (warningCode != passed)  errIndex--;
                if (errCode != passed)  {  deleteLinkedList(&tempPrintLL);  return;  }
    }   }   }
    
    
        // rewire the output string to point to the linked list we just created
    
    charMember = LL_member(stringWindow->variable_ptr, stringWindow->offset+1);
    charWindow = charMember->memberWindow;
    resizeMember(charMember, 1, tempPrintLL.elementNum);
    if (errCode != passed)  return;
    
    copyElements(&tempPrintLL, 1, &(charWindow->variable_ptr->mem.data), charWindow->offset+1, tempPrintLL.elementNum);
    deleteLinkedList(&tempPrintLL);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
callq 0x170b2
testl %eax, %eax
jle 0x16078
movl %eax, %ebx
leaq 0xe734(%rip), %r15      # 0x24760
andl $0x0, 0x1fc(%r15)
leaq 0x3019(%rip), %rax      # 0x19054
movl (%rax), %ebp
movl %ebp, 0x1f8(%r15)
pushq $0x1
popq %r14
movl %r14d, %edi
callq 0x170f5
testq %rax, %rax
je 0x16166
movq 0x10(%rax), %rax
cmpl $0x3, 0xc0(%rax)
jg 0x160f9
cmpl $0x1, %ebx
jne 0x16091
movq 0xb8(%r15), %rsi
jmp 0x16086
leaq 0xe6e1(%rip), %rax      # 0x24760
movq 0xb8(%rax), %rsi
addq $-0x4, %rsi
pushq $0x2d
jmp 0x16173
leaq 0x2fc0(%rip), %rax      # 0x19058
cvtsi2sdl (%rax), %xmm1
pushq $0x1
popq %rdi
xorpd %xmm0, %xmm0
callq 0x1715f
cvttsd2si %xmm0, %eax
movl %eax, 0x1fc(%r15)
pushq $0x2
popq %r14
movl %r14d, %edi
callq 0x170f5
testq %rax, %rax
je 0x16166
movq 0x10(%rax), %rax
cmpl $0x3, 0xc0(%rax)
jg 0x160f9
cmpl $0x2, %ebx
jbe 0x1606f
cvtsi2sd %ebp, %xmm1
pushq $0x2
popq %rdi
xorpd %xmm0, %xmm0
callq 0x1715f
cvttsd2si %xmm0, %eax
movl %eax, 0x1f8(%r15)
pushq $0x3
popq %r14
movl %r14d, %edi
callq 0x170f5
testq %rax, %rax
je 0x16166
movq 0x10(%rax), %rcx
cmpl $0x4, 0xc0(%rcx)
jne 0x16187
movq %rax, 0x10(%rsp)
leaq 0xc(%rsp), %r15
andl $0x0, (%r15)
leaq 0x8(%rsp), %r12
andl $0x0, (%r12)
incl %r14d
leaq 0x18(%rsp), %r13
movl %r14d, %ebp
cmpl %ebx, %ebp
jg 0x16196
movl %ebp, %edi
callq 0x170f5
movq %rax, 0x18(%rsp)
testq %rax, %rax
je 0x16162
movq 0x18(%rax), %rax
movq %rax, 0x20(%rsp)
movq %r13, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0xd4c6
incl %ebp
jmp 0x16136
movq 0xb8(%r15), %rsi
addq $-0x4, %rsi
pushq $0x1a
popq %rdi
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xc7c2
movq 0xb8(%r15), %rsi
addq $-0x4, %rsi
pushq $0x25
jmp 0x16173
movl 0x8(%rsp), %esi
addl 0xc(%rsp), %esi
leaq 0x30(%rsp), %rdi
pushq $0x1
popq %rdx
xorpd %xmm0, %xmm0
xorl %ecx, %ecx
callq 0x83d5
testl %eax, %eax
jne 0x161c3
leaq 0x30(%rsp), %rdi
callq 0x8b50
testl %eax, %eax
je 0x161ec
leaq 0xe596(%rip), %rax      # 0x24760
movq 0xb8(%rax), %rsi
addq $-0x4, %rsi
pushq $0x1
popq %rdi
callq 0xc7c2
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl 0x8(%rsp), %eax
addl 0xc(%rsp), %eax
jle 0x1625e
leaq 0x30(%rsp), %rdi
pushq $0x1
popq %rsi
callq 0x9088
leaq 0x50(%rsp), %r15
movq %rax, (%r15)
leaq 0x18(%rsp), %r12
leaq 0x8(%rsp), %r13
cmpl %ebx, %r14d
jg 0x1625e
movl %r14d, %edi
callq 0x170f5
movq %rax, 0x18(%rsp)
testq %rax, %rax
je 0x16259
movq 0x18(%rax), %rax
movq %rax, 0x20(%rsp)
movq %r12, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0xd29f
leaq 0xe516(%rip), %rax      # 0x24760
cmpl $0x0, 0x20(%rax)
je 0x16253
decl 0x1c(%rax)
cmpl $0x0, 0x18(%rax)
jne 0x162bd
incl %r14d
jmp 0x16215
movq 0x10(%rsp), %rax
movq 0x10(%rax), %rdi
addq $0x10, %rdi
movl 0x18(%rax), %esi
incl %esi
callq 0x9088
movq (%rax), %rbx
movl 0x30(%rsp), %edx
pushq $0x1
popq %rsi
movq %rax, %rdi
callq 0x11183
leaq 0xe4d2(%rip), %rax      # 0x24760
cmpl $0x0, 0x18(%rax)
jne 0x161dd
movq 0x10(%rbx), %rdx
addq $0x10, %rdx
movl 0x18(%rbx), %ecx
incl %ecx
leaq 0x30(%rsp), %rbx
movl (%rbx), %r8d
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x87c7
movq %rbx, %rdi
jmp 0x162c2
leaq 0x30(%rsp), %rdi
callq 0x846b
jmp 0x161dd