// File: /workspace/github_c_makefile_star2_O2/heltilda[P]cicada/ciclib.c
// Function: cclib_bytecode
void cclib_bytecode()
{
    window *hostWindow;
    linkedlist *codeRefsList = NULL;
    ccInt memberNumber, loopCode, *holdPC, numArgs = numBIF_args(), rtrn;
    
    if ((numArgs < 1) || (numArgs > 2))
        {  setError(wrong_argument_count_err, pcCodePtr-1);  return;  }
    
    
        // load the variable containing the member or variable code (arg 1)
    
    hostWindow = getBIFmember(1);
    if (hostWindow == NULL)  {  setError(void_member_err, pcCodePtr-1);  return;  }
    if (hostWindow->variable_ptr->type != composite_type)  {  setError(not_composite_err, pcCodePtr-1);  return;  }
    
    
        // if it's something about a member we want to know, then we have to provide the member number (arg 2)
    
    if (numArgs == 1)
        codeRefsList = (linkedlist *) &(hostWindow->variable_ptr->codeList);
    
    else  {
        memberNumber = (ccInt) getBIFnumArg(2, 1., (ccFloat) hostWindow->variable_ptr->mem.members.elementNum);
        if (errCode == passed)  {
            codeRefsList = (linkedlist *) &(LL_member(hostWindow->variable_ptr, memberNumber)->codeList);
    }   }
    
    if (errCode != passed)  return;
    
    
        // get each code sequentially into the string (if there is more than one then they will be separated by 0s)
    
    rtrn = resizeLinkedList(&stringRegister, 0, ccFalse);
    if (rtrn != passed)  {  setError(rtrn, pcCodePtr-1);  return;  }
    
    for (loopCode = 1; loopCode <= codeRefsList->elementNum; loopCode++)  {
        
        code_ref *soughtCodeRef = (code_ref *) element(codeRefsList, loopCode);
        ccInt oldTop = stringRegister.elementNum;
        
        
            // copy the bytecode into a string (this includes the final 0)
        
        holdPC = pcCodePtr;
        pcCodePtr = soughtCodeRef->code_ptr;
        runSkipMode(0);    // should always work (code's already been checked); just in case, check errCode (index would be off, though)
        if (errCode != passed)  {  pcCodePtr = holdPC;  return;  }
        pcCodePtr++;
        
        rtrn = addElements(&stringRegister, (ccInt) (pcCodePtr-soughtCodeRef->code_ptr)*sizeof(ccInt), ccFalse);
        pcCodePtr = holdPC;
        if (rtrn != passed)  {  setError(rtrn, pcCodePtr-1);  return;  }
        
        setElements(&stringRegister, oldTop+1, oldTop+stringRegister.elementNum, (void *) soughtCodeRef->code_ptr);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
callq 0x170b2
movl %eax, %r12d
leal -0x3(%r12), %eax
cmpl $-0x3, %eax
ja 0x16e5c
leaq 0xd913(%rip), %rax      # 0x24760
movq 0xb8(%rax), %rsi
addq $-0x4, %rsi
pushq $0x2d
jmp 0x16eb5
pushq $0x1
popq %rbx
movl %ebx, %edi
callq 0x170f5
testq %rax, %rax
je 0x16e8b
movq %rax, %r15
movq 0x10(%rax), %r13
cmpl $0x5, 0xc0(%r13)
jne 0x16ea1
cmpl $0x1, %r12d
jne 0x16ec9
addq $0xd0, %r13
jmp 0x16f04
leaq 0xd8ce(%rip), %rax      # 0x24760
movq 0xb8(%rax), %rsi
addq $-0x4, %rsi
pushq $0x1a
jmp 0x16eb5
leaq 0xd8b8(%rip), %rax      # 0x24760
movq 0xb8(%rax), %rsi
addq $-0x4, %rsi
pushq $0x24
popq %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xc7c2
cvtsi2sdl 0x10(%r13), %xmm1
pushq $0x2
popq %rdi
movsd 0x212e(%rip), %xmm0     # 0x19008
callq 0x1715f
leaq 0xd87a(%rip), %rax      # 0x24760
cmpl $0x0, 0x18(%rax)
jne 0x16f12
cvttsd2si %xmm0, %esi
movq 0x10(%r15), %rdi
addq $0x10, %rdi
callq 0x9088
movq %rax, %r13
addq $0x20, %r13
leaq 0xd855(%rip), %r14      # 0x24760
cmpl $0x0, 0x18(%r14)
je 0x16f21
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x78(%r14), %r15
movq %r15, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x8b23
testl %eax, %eax
je 0x16f47
movq 0xb8(%r14), %rsi
addq $-0x4, %rsi
movl %eax, %edi
jmp 0x16eb6
movq %r13, (%rsp)
cmpl (%r13), %ebx
jg 0x16f12
movq %r13, %rdi
movl %ebx, %esi
callq 0x9088
movq %rax, %r13
movl 0x78(%r14), %r12d
movq 0xb8(%r14), %rbp
movq 0x10(%rax), %rax
movq %rax, 0xb8(%r14)
xorl %edi, %edi
callq 0x139ae
cmpl $0x0, 0x18(%r14)
jne 0x16fd3
movq 0xb8(%r14), %rsi
addq $0x4, %rsi
movq %rsi, 0xb8(%r14)
subl 0x10(%r13), %esi
andl $-0x4, %esi
movq %r15, %rdi
xorl %edx, %edx
callq 0x8b0f
movq %rbp, 0xb8(%r14)
testl %eax, %eax
jne 0x16fdf
leal 0x1(%r12), %esi
addl 0x78(%r14), %r12d
movq 0x10(%r13), %rcx
movq %r15, %rdi
movl %r12d, %edx
callq 0x8eaa
incl %ebx
movq (%rsp), %r13
jmp 0x16f4b
movq %rbp, 0xb8(%r14)
jmp 0x16f12
addq $-0x4, %rbp
movl %eax, %edi
movq %rbp, %rsi
jmp 0x16eb6