// File: /workspace/github_c_makefile_star2_O0/heltilda[P]cicada/intrpt.c
// Function: doCopyCompare
void doCopyCompare(view *sourceView, view *destView,
        void(*ccComposite)(view *, view *),
        void(*ccData)(linkedlist *, ccInt, linkedlist *, ccInt, ccInt),
        void(*ccString)(window *, member *),
        void(**ccJumpTable)(void *, void *))
{
    variable *sourceVar = sourceView->windowPtr->variable_ptr, *destVar = destView->windowPtr->variable_ptr;
    member *loopSourceMember, *loopDestMember;
    ccInt sourceType = sourceVar->type, destType = destVar->type;
    ccInt sourceMemberNumber, destMemberNumber, indexCounter;
    ccInt sourceOffset, destOffset, sourceWidth, destWidth;
    
    
        // explore composite variables by individually stepping into their members
    
    if (sourceView->width != destView->width)  {  setError(type_mismatch_err, pcCodePtr-1);  return;  }
    
    if (sourceType >= composite_type)  {
        if (destType < composite_type)  setError(type_mismatch_err, pcCodePtr-1);
        if (errCode != passed)  return;
        
        sourceMemberNumber = 0;
        destMemberNumber = 0;
        findNextVisibleMember(sourceVar, &loopSourceMember, &sourceMemberNumber);
        findNextVisibleMember(destVar, &loopDestMember, &destMemberNumber);
        sourceOffset = destOffset = 0;
        
        while (sourceMemberNumber <= sourceVar->mem.members.elementNum)     {
            
            view nextSourceView = *sourceView, nextDestView = *destView;
            
            if (destMemberNumber > destVar->mem.members.elementNum)  setError(type_mismatch_err, pcCodePtr-1);
            if (errCode != passed)  return;
            
            if ((sourceType == destType) && (sourceVar->eventualType == destVar->eventualType))  {
                sourceWidth = loopSourceMember->indices;
                destWidth = loopDestMember->indices;        }
            else  {
                sourceWidth = destWidth = 1;
                if ((loopSourceMember->indices == 0) || (loopDestMember->indices == 0))  {
                    sourceWidth = destWidth = 0;
                    if (loopSourceMember->indices != loopDestMember->indices)  {
                        setError(type_mismatch_err, pcCodePtr-1);
                        return;
            }   }   }
            
            if (isBusy(loopSourceMember, busy_source_copy_flag))  {  setError(self_reference_err, pcCodePtr-1);  return;  }
            if (isBusy(loopDestMember, busy_dest_copy_flag))  {  setError(self_reference_err, pcCodePtr-1);  return;  }
            setBusy(loopSourceMember, busy_source_copy_flag);
            setBusy(loopDestMember, busy_dest_copy_flag);
            
            stepView(&nextSourceView, loopSourceMember, sourceOffset, sourceWidth);
            stepView(&nextDestView, loopDestMember, destOffset, destWidth);
            
            if (errCode == passed)
                ccComposite(&nextSourceView, &nextDestView);
            
            clearBusy(loopSourceMember, busy_source_copy_flag);
            clearBusy(loopDestMember, busy_dest_copy_flag);
            
            if (errCode != passed)  {
                if ((nextSourceView.windowPtr == NULL) && (nextDestView.windowPtr == NULL))  errCode = passed;
                else  return;     }
            
            if (sourceOffset+sourceWidth >= loopSourceMember->indices)  {
                findNextVisibleMember(sourceVar, &loopSourceMember, &sourceMemberNumber);
                sourceOffset = 0;        }
            else  sourceOffset += sourceWidth;
            
            if (destOffset+destWidth >= loopDestMember->indices)  {
                findNextVisibleMember(destVar, &loopDestMember, &destMemberNumber);
                destOffset = 0;          }
            else  destOffset += destWidth;      }
        
        if (destMemberNumber <= destVar->mem.members.elementNum)  setError(type_mismatch_err, pcCodePtr-1);    }
    
    
        // if it's a primitive variable then we handle that here
    
    else    {
    
            // the easiest option is to copy/compare the entire array (if it is one) at once, using linked list routines
        
        if ((sourceType == destType) && (sourceType != string_type))    {
            
            ccData(&(sourceVar->mem.data), sourceView->offset + 1, &(destVar->mem.data), destView->offset + 1, sourceView->width);   }
        
        else if (destType >= composite_type)  setError(type_mismatch_err, pcCodePtr-1);
        
        else   {
        
                // strings are special and we have to copy/compare each one individually
            
            if (sourceType == string_type)  {
                if (destType != string_type)  setError(type_mismatch_err, pcCodePtr-1);
                else for (indexCounter = 1; indexCounter <= sourceView->width; indexCounter++)  {
                    ccString(LL_member(sourceVar, sourceView->offset + indexCounter)->memberWindow,
                            LL_member(destVar, destView->offset + indexCounter));
            }   }
            
            
                // finally, if we have mismatched but compatible types (think composite variables having ints versus doubles),
                // then we have to step through them member by member
            
            else   {
                if (destType == string_type)  setError(type_mismatch_err, pcCodePtr-1);
                else {
                    void(*ccFunction)(void *, void *) = ccJumpTable[5*sourceVar->type + destVar->type];
                    linkedlist *sourceLL = &(sourceVar->mem.data), *destLL = &(destVar->mem.data);
                    sublistHeader *sourceLLsublist = sourceLL->memory, *destLLsublist = destLL->memory;
                    ccInt sourceSublistLocalIndex = 0, destSublistLocalIndex = 0;
                    
                    if (sourceView->width > 0)  {       // skipElements() will crash if sourceLL or destLL has 0 elements
                        ccFunction( skipElements(sourceLL, &sourceLLsublist, &sourceSublistLocalIndex, sourceView->offset),
                                    skipElements(destLL, &destLLsublist, &destSublistLocalIndex, destView->offset));
                        if (errCode == passed)  {
                        for (indexCounter = 2; indexCounter <= sourceView->width; indexCounter++)  {
                            ccFunction( skipElements(sourceLL, &sourceLLsublist, &sourceSublistLocalIndex, 1),
                                        skipElements(destLL, &destLLsublist, &destSublistLocalIndex, 1)  );
                            if (errCode != passed)  break;
        }   }   }   }   }}
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rax
movl 0xc0(%rax), %eax
movl %eax, -0x54(%rbp)
movq -0x40(%rbp), %rax
movl 0xc0(%rax), %eax
movl %eax, -0x58(%rbp)
movq -0x8(%rbp), %rax
movl 0xc(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0xc(%rcx), %eax
je 0xee4c
leaq 0x1d91e(%rip), %rax     # 0x2c750
movq 0xb8(%rax), %rsi
addq $-0x4, %rsi
movl $0x11, %edi
callq 0xf740
jmp 0xf498
cmpl $0x5, -0x54(%rbp)
jl 0xf1ac
cmpl $0x5, -0x58(%rbp)
jge 0xee78
leaq 0x1d8ed(%rip), %rax     # 0x2c750
movq 0xb8(%rax), %rsi
addq $-0x4, %rsi
movl $0x11, %edi
callq 0xf740
leaq 0x1d8d1(%rip), %rax     # 0x2c750
cmpl $0x0, 0x18(%rax)
je 0xee8a
jmp 0xf498
movl $0x0, -0x5c(%rbp)
movl $0x0, -0x60(%rbp)
movq -0x38(%rbp), %rdi
leaq -0x48(%rbp), %rsi
leaq -0x5c(%rbp), %rdx
callq 0xfed0
movq -0x40(%rbp), %rdi
leaq -0x50(%rbp), %rsi
leaq -0x60(%rbp), %rdx
callq 0xfed0
movl $0x0, -0x6c(%rbp)
movl $0x0, -0x68(%rbp)
movl -0x5c(%rbp), %eax
movq -0x38(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jg 0xf17f
movq -0x8(%rbp), %rax
movq (%rax), %rcx
movq %rcx, -0x90(%rbp)
movq 0x8(%rax), %rcx
movq %rcx, -0x88(%rbp)
movq 0x10(%rax), %rax
movq %rax, -0x80(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rcx
movq %rcx, -0xa8(%rbp)
movq 0x8(%rax), %rcx
movq %rcx, -0xa0(%rbp)
movq 0x10(%rax), %rax
movq %rax, -0x98(%rbp)
movl -0x60(%rbp), %eax
movq -0x40(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jle 0xef45
leaq 0x1d820(%rip), %rax     # 0x2c750
movq 0xb8(%rax), %rsi
addq $-0x4, %rsi
movl $0x11, %edi
callq 0xf740
leaq 0x1d804(%rip), %rax     # 0x2c750
cmpl $0x0, 0x18(%rax)
je 0xef57
jmp 0xf498
movl -0x54(%rbp), %eax
cmpl -0x58(%rbp), %eax
jne 0xef8b
movq -0x38(%rbp), %rax
movl 0xc4(%rax), %eax
movq -0x40(%rbp), %rcx
cmpl 0xc4(%rcx), %eax
jne 0xef8b
movq -0x48(%rbp), %rax
movl 0xc(%rax), %eax
movl %eax, -0x70(%rbp)
movq -0x50(%rbp), %rax
movl 0xc(%rax), %eax
movl %eax, -0x74(%rbp)
jmp 0xeff0
movl $0x1, -0x74(%rbp)
movl $0x1, -0x70(%rbp)
movq -0x48(%rbp), %rax
cmpl $0x0, 0xc(%rax)
je 0xefad
movq -0x50(%rbp), %rax
cmpl $0x0, 0xc(%rax)
jne 0xefee
movl $0x0, -0x74(%rbp)
movl $0x0, -0x70(%rbp)
movq -0x48(%rbp), %rax
movl 0xc(%rax), %eax
movq -0x50(%rbp), %rcx
cmpl 0xc(%rcx), %eax
je 0xefec
leaq 0x1d77e(%rip), %rax     # 0x2c750
movq 0xb8(%rax), %rsi
addq $-0x4, %rsi
movl $0x11, %edi
callq 0xf740
jmp 0xf498
jmp 0xefee
jmp 0xeff0
movq -0x48(%rbp), %rax
movl 0x44(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0xf020
leaq 0x1d74a(%rip), %rax     # 0x2c750
movq 0xb8(%rax), %rsi
addq $-0x4, %rsi
movl $0x2f, %edi
callq 0xf740
jmp 0xf498
movq -0x50(%rbp), %rax
movl 0x44(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0xf050
leaq 0x1d71a(%rip), %rax     # 0x2c750
movq 0xb8(%rax), %rsi
addq $-0x4, %rsi
movl $0x2f, %edi
callq 0xf740
jmp 0xf498
movq -0x48(%rbp), %rax
movl 0x44(%rax), %ecx
orl $0x2, %ecx
movq -0x48(%rbp), %rax
movl %ecx, 0x44(%rax)
movq -0x50(%rbp), %rax
movl 0x44(%rax), %ecx
orl $0x4, %ecx
movq -0x50(%rbp), %rax
movl %ecx, 0x44(%rax)
movq -0x48(%rbp), %rsi
movl -0x68(%rbp), %edx
movl -0x70(%rbp), %ecx
leaq -0x90(%rbp), %rdi
callq 0xff50
movq -0x50(%rbp), %rsi
movl -0x6c(%rbp), %edx
movl -0x74(%rbp), %ecx
leaq -0xa8(%rbp), %rdi
callq 0xff50
leaq 0x1d6ab(%rip), %rax     # 0x2c750
cmpl $0x0, 0x18(%rax)
jne 0xf0bc
leaq -0x90(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq *-0x18(%rbp)
movq -0x48(%rbp), %rax
movl 0x44(%rax), %ecx
andl $-0x3, %ecx
movq -0x48(%rbp), %rax
movl %ecx, 0x44(%rax)
movq -0x50(%rbp), %rax
movl 0x44(%rax), %ecx
andl $-0x5, %ecx
movq -0x50(%rbp), %rax
movl %ecx, 0x44(%rax)
leaq 0x1d66b(%rip), %rax     # 0x2c750
cmpl $0x0, 0x18(%rax)
je 0xf116
cmpq $0x0, -0x90(%rbp)
jne 0xf10f
cmpq $0x0, -0xa8(%rbp)
jne 0xf10f
leaq 0x1d64a(%rip), %rax     # 0x2c750
movl $0x0, 0x18(%rax)
jmp 0xf114
jmp 0xf498
jmp 0xf116
movl -0x68(%rbp), %eax
addl -0x70(%rbp), %eax
movq -0x48(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jl 0xf13f
movq -0x38(%rbp), %rdi
leaq -0x48(%rbp), %rsi
leaq -0x5c(%rbp), %rdx
callq 0xfed0
movl $0x0, -0x68(%rbp)
jmp 0xf148
movl -0x70(%rbp), %eax
addl -0x68(%rbp), %eax
movl %eax, -0x68(%rbp)
movl -0x6c(%rbp), %eax
addl -0x74(%rbp), %eax
movq -0x50(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jl 0xf171
movq -0x40(%rbp), %rdi
leaq -0x50(%rbp), %rsi
leaq -0x60(%rbp), %rdx
callq 0xfed0
movl $0x0, -0x6c(%rbp)
jmp 0xf17a
movl -0x74(%rbp), %eax
addl -0x6c(%rbp), %eax
movl %eax, -0x6c(%rbp)
jmp 0xeec8
movl -0x60(%rbp), %eax
movq -0x40(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jg 0xf1a7
leaq 0x1d5be(%rip), %rax     # 0x2c750
movq 0xb8(%rax), %rsi
addq $-0x4, %rsi
movl $0x11, %edi
callq 0xf740
jmp 0xf498
movl -0x54(%rbp), %eax
cmpl -0x58(%rbp), %eax
jne 0xf1f1
cmpl $0x4, -0x54(%rbp)
je 0xf1f1
movq -0x20(%rbp), %rax
movq -0x38(%rbp), %rdi
addq $0x10, %rdi
movq -0x8(%rbp), %rcx
movl 0x8(%rcx), %esi
addl $0x1, %esi
movq -0x40(%rbp), %rdx
addq $0x10, %rdx
movq -0x10(%rbp), %rcx
movl 0x8(%rcx), %ecx
addl $0x1, %ecx
movq -0x8(%rbp), %r8
movl 0xc(%r8), %r8d
callq *%rax
jmp 0xf496
cmpl $0x5, -0x58(%rbp)
jl 0xf218
leaq 0x1d552(%rip), %rax     # 0x2c750
movq 0xb8(%rax), %rsi
addq $-0x4, %rsi
movl $0x11, %edi
callq 0xf740
jmp 0xf494
cmpl $0x4, -0x54(%rbp)
jne 0xf2c1
cmpl $0x4, -0x58(%rbp)
je 0xf246
leaq 0x1d521(%rip), %rax     # 0x2c750
movq 0xb8(%rax), %rsi
addq $-0x4, %rsi
movl $0x11, %edi
callq 0xf740
jmp 0xf2bc
movl $0x1, -0x64(%rbp)
movl -0x64(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jg 0xf2ba
movq -0x28(%rbp), %rax
movq %rax, -0xe0(%rbp)
movq -0x38(%rbp), %rdi
addq $0x10, %rdi
movq -0x8(%rbp), %rax
movl 0x8(%rax), %esi
addl -0x64(%rbp), %esi
callq 0x9700
movq (%rax), %rax
movq %rax, -0xe8(%rbp)
movq -0x40(%rbp), %rdi
addq $0x10, %rdi
movq -0x10(%rbp), %rax
movl 0x8(%rax), %esi
addl -0x64(%rbp), %esi
callq 0x9700
movq -0xe8(%rbp), %rdi
movq %rax, %rsi
movq -0xe0(%rbp), %rax
callq *%rax
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0xf24d
jmp 0xf2bc
jmp 0xf492
cmpl $0x4, -0x58(%rbp)
jne 0xf2e8
leaq 0x1d482(%rip), %rax     # 0x2c750
movq 0xb8(%rax), %rsi
addq $-0x4, %rsi
movl $0x11, %edi
callq 0xf740
jmp 0xf490
movq -0x30(%rbp), %rax
movq -0x38(%rbp), %rcx
imull $0x5, 0xc0(%rcx), %ecx
movq -0x40(%rbp), %rdx
addl 0xc0(%rdx), %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xb0(%rbp)
movq -0x38(%rbp), %rax
addq $0x10, %rax
movq %rax, -0xb8(%rbp)
movq -0x40(%rbp), %rax
addq $0x10, %rax
movq %rax, -0xc0(%rbp)
movq -0xb8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0xc8(%rbp)
movq -0xc0(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0xd0(%rbp)
movl $0x0, -0xd4(%rbp)
movl $0x0, -0xd8(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x0, 0xc(%rax)
jle 0xf48e
movq -0xb0(%rbp), %rax
movq %rax, -0xf0(%rbp)
movq -0xb8(%rbp), %rdi
movq -0x8(%rbp), %rax
movl 0x8(%rax), %ecx
leaq -0xc8(%rbp), %rsi
leaq -0xd4(%rbp), %rdx
callq 0x9750
movq %rax, -0xf8(%rbp)
movq -0xc0(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x8(%rax), %ecx
leaq -0xd0(%rbp), %rsi
leaq -0xd8(%rbp), %rdx
callq 0x9750
movq -0xf8(%rbp), %rdi
movq %rax, %rsi
movq -0xf0(%rbp), %rax
callq *%rax
leaq 0x1d36c(%rip), %rax     # 0x2c750
cmpl $0x0, 0x18(%rax)
jne 0xf48c
movl $0x2, -0x64(%rbp)
movl -0x64(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jg 0xf48a
movq -0xb0(%rbp), %rax
movq %rax, -0x100(%rbp)
movq -0xb8(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
leaq -0xd4(%rbp), %rdx
movl $0x1, %ecx
callq 0x9750
movq %rax, -0x108(%rbp)
movq -0xc0(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
leaq -0xd8(%rbp), %rdx
movl $0x1, %ecx
callq 0x9750
movq -0x108(%rbp), %rdi
movq %rax, %rsi
movq -0x100(%rbp), %rax
callq *%rax
leaq 0x1d2de(%rip), %rax     # 0x2c750
cmpl $0x0, 0x18(%rax)
je 0xf47a
jmp 0xf48a
jmp 0xf47c
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0xf3f5
jmp 0xf48c
jmp 0xf48e
jmp 0xf490
jmp 0xf492
jmp 0xf494
jmp 0xf496
jmp 0xf498
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
nopw %cs:(%rax,%rax)