// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x40, %rsp
movq $0x0, -0x10(%rbp)
callq 0x1fa40
movl %eax, -0x24(%rbp)
cmpl $0x1, -0x24(%rbp)
jl 0x1f684
cmpl $0x2, -0x24(%rbp)
jle 0x1f6a5
leaq 0xd0c5(%rip), %rax      # 0x2c750
movq 0xb8(%rax), %rsi
addq $-0x4, %rsi
movl $0x2d, %edi
callq 0xf740
jmp 0x1f913
movl $0x1, %edi
callq 0x1fab0
movq %rax, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0x1f6db
leaq 0xd08f(%rip), %rax      # 0x2c750
movq 0xb8(%rax), %rsi
addq $-0x4, %rsi
movl $0x1a, %edi
callq 0xf740
jmp 0x1f913
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
cmpl $0x5, 0xc0(%rax)
je 0x1f70d
leaq 0xd05d(%rip), %rax      # 0x2c750
movq 0xb8(%rax), %rsi
addq $-0x4, %rsi
movl $0x24, %edi
callq 0xf740
jmp 0x1f913
cmpl $0x1, -0x24(%rbp)
jne 0x1f727
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
addq $0xd0, %rax
movq %rax, -0x10(%rbp)
jmp 0x1f778
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
cvtsi2sdl 0x10(%rax), %xmm1
movl $0x2, %edi
movsd 0x28c7(%rip), %xmm0     # 0x22008
callq 0x1fb80
cvttsd2si %xmm0, %eax
movl %eax, -0x14(%rbp)
leaq 0xcffc(%rip), %rax      # 0x2c750
cmpl $0x0, 0x18(%rax)
jne 0x1f776
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
addq $0x10, %rdi
movl -0x14(%rbp), %esi
callq 0x9700
addq $0x20, %rax
movq %rax, -0x10(%rbp)
jmp 0x1f778
leaq 0xcfd1(%rip), %rax      # 0x2c750
cmpl $0x0, 0x18(%rax)
je 0x1f78a
jmp 0x1f913
leaq 0xcfbf(%rip), %rdi      # 0x2c750
addq $0x78, %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x8ee0
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x28(%rbp)
je 0x1f7c6
movl -0x28(%rbp), %edi
leaq 0xcf9f(%rip), %rax      # 0x2c750
movq 0xb8(%rax), %rsi
addq $-0x4, %rsi
callq 0xf740
jmp 0x1f913
movl $0x1, -0x18(%rbp)
movl -0x18(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl (%rcx), %eax
jg 0x1f913
movq -0x10(%rbp), %rdi
movl -0x18(%rbp), %esi
callq 0x9700
movq %rax, -0x30(%rbp)
leaq 0xcf5d(%rip), %rax      # 0x2c750
movl 0x78(%rax), %eax
movl %eax, -0x34(%rbp)
leaq 0xcf50(%rip), %rax      # 0x2c750
movq 0xb8(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rcx
leaq 0xcf36(%rip), %rax      # 0x2c750
movq %rcx, 0xb8(%rax)
xorl %edi, %edi
callq 0x1a6b0
leaq 0xcf21(%rip), %rax      # 0x2c750
cmpl $0x0, 0x18(%rax)
je 0x1f84c
movq -0x20(%rbp), %rcx
leaq 0xcf10(%rip), %rax      # 0x2c750
movq %rcx, 0xb8(%rax)
jmp 0x1f913
leaq 0xcefd(%rip), %rax      # 0x2c750
movq 0xb8(%rax), %rcx
addq $0x4, %rcx
leaq 0xceeb(%rip), %rax      # 0x2c750
movq %rcx, 0xb8(%rax)
leaq 0xcedd(%rip), %rax      # 0x2c750
movq 0xb8(%rax), %rax
movq -0x30(%rbp), %rcx
movq 0x10(%rcx), %rcx
subq %rcx, %rax
sarq $0x2, %rax
cltq
shlq $0x2, %rax
movl %eax, %esi
leaq 0xceb8(%rip), %rdi      # 0x2c750
addq $0x78, %rdi
xorl %edx, %edx
callq 0x8e70
movl %eax, -0x28(%rbp)
movq -0x20(%rbp), %rcx
leaq 0xce9f(%rip), %rax      # 0x2c750
movq %rcx, 0xb8(%rax)
cmpl $0x0, -0x28(%rbp)
je 0x1f8da
movl -0x28(%rbp), %edi
leaq 0xce88(%rip), %rax      # 0x2c750
movq 0xb8(%rax), %rsi
addq $-0x4, %rsi
callq 0xf740
jmp 0x1f913
movl -0x34(%rbp), %esi
addl $0x1, %esi
movl -0x34(%rbp), %edx
leaq 0xce66(%rip), %rax      # 0x2c750
addl 0x78(%rax), %edx
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rcx
leaq 0xce54(%rip), %rdi      # 0x2c750
addq $0x78, %rdi
callq 0x93d0
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x1f7cd
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)