// File: /workspace/github_c_makefile_star2_O0/heltilda[P]cicada/lnklst.c
// Function: compareElements
ccBool compareElements(linkedlist *sourceList, ccInt sourceBegin, linkedlist * destList, ccInt destBegin, ccInt numberToCompare)
{
    ccInt firstCompared, lastCompared, elementSize, sourceBottom, destBottom, rtrn;
    sublistHeader *currentSourceSublist, *currentDestSublist;
    
    
        // make sure params were passed correctly
    
    if ((sourceList->memory == NULL) || (destList->memory == NULL))  return init_err;
    if (sourceList->elementSize != destList->elementSize)  return mismatched_indices_err;
    if (numberToCompare == 0)  return ccTrue;
    if ((!elementExists(sourceList, sourceBegin)) || (!elementExists(destList, destBegin)))
        return out_of_range_err;
    if ((!elementExists(sourceList, sourceBegin+numberToCompare-1)) || (!elementExists(destList, destBegin+numberToCompare-1)))
        return out_of_range_err;
    
    elementSize = sourceList->elementSize;
    
    currentSourceSublist = findSublist(sourceList, sourceBegin, &sourceBottom);
    currentDestSublist = findSublist(destList, destBegin, &destBottom);
    
    firstCompared = 1;
    lastCompared = numberToCompare-1;
    
    
        // Now, by chunks (size of each sublist), do straight comparisons of memory.
    
    while (lastCompared < numberToCompare)
    {
        if (currentSourceSublist->numElements + sourceBottom < sourceBegin+firstCompared)   {
            sourceBottom += currentSourceSublist->numElements;
            currentSourceSublist = currentSourceSublist->nextSublist;    }
        
        if (currentDestSublist->numElements + destBottom < destBegin+firstCompared)    {
            destBottom += currentDestSublist->numElements;
            currentDestSublist = currentDestSublist->nextSublist;    }
        
        lastCompared = numberToCompare;
        if (sourceBottom+currentSourceSublist->numElements < sourceBegin+lastCompared)
            lastCompared = sourceBottom + currentSourceSublist->numElements - sourceBegin;
        if (destBottom+currentDestSublist->numElements < destBegin+lastCompared)
            lastCompared = destBottom + currentDestSublist->numElements - destBegin;
        
        rtrn = memcmp((void *) ((char *) currentSourceSublist + (firstCompared+sourceBegin-sourceBottom-1)*elementSize + sublistHeaderSize),
                        (void *) ((char *) currentDestSublist + (firstCompared+destBegin-destBottom-1)*elementSize + sublistHeaderSize),
                        (size_t) (lastCompared-firstCompared+1)*elementSize);
        if (rtrn != 0)  return ccFalse;
        
        firstCompared = lastCompared+1;
    }
    
    return ccTrue;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movl %r8d, -0x28(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x90b0
movq -0x20(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x90b9
movb $0x3, -0x1(%rbp)
jmp 0x92a5
movq -0x10(%rbp), %rax
movl 0x10(%rax), %eax
movq -0x20(%rbp), %rcx
cmpl 0x10(%rcx), %eax
je 0x90d2
movb $0x4, -0x1(%rbp)
jmp 0x92a5
cmpl $0x0, -0x28(%rbp)
jne 0x90e1
movb $0x1, -0x1(%rbp)
jmp 0x92a5
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x8830
cmpl $0x0, %eax
je 0x9103
movq -0x20(%rbp), %rdi
movl -0x24(%rbp), %esi
callq 0x8830
cmpl $0x0, %eax
jne 0x910c
movb $0x2, -0x1(%rbp)
jmp 0x92a5
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
addl -0x28(%rbp), %esi
subl $0x1, %esi
callq 0x8830
cmpl $0x0, %eax
je 0x913a
movq -0x20(%rbp), %rdi
movl -0x24(%rbp), %esi
addl -0x28(%rbp), %esi
subl $0x1, %esi
callq 0x8830
cmpl $0x0, %eax
jne 0x9143
movb $0x2, -0x1(%rbp)
jmp 0x92a5
movq -0x10(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x34(%rbp)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
leaq -0x38(%rbp), %rdx
callq 0x83f0
movq %rax, -0x48(%rbp)
movq -0x20(%rbp), %rdi
movl -0x24(%rbp), %esi
leaq -0x3c(%rbp), %rdx
callq 0x83f0
movq %rax, -0x50(%rbp)
movl $0x1, -0x2c(%rbp)
movl -0x28(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x28(%rbp), %eax
jge 0x92a1
movq -0x48(%rbp), %rax
movl (%rax), %eax
addl -0x38(%rbp), %eax
movl -0x14(%rbp), %ecx
addl -0x2c(%rbp), %ecx
cmpl %ecx, %eax
jge 0x91bc
movq -0x48(%rbp), %rax
movl (%rax), %eax
addl -0x38(%rbp), %eax
movl %eax, -0x38(%rbp)
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x50(%rbp), %rax
movl (%rax), %eax
addl -0x3c(%rbp), %eax
movl -0x24(%rbp), %ecx
addl -0x2c(%rbp), %ecx
cmpl %ecx, %eax
jge 0x91e7
movq -0x50(%rbp), %rax
movl (%rax), %eax
addl -0x3c(%rbp), %eax
movl %eax, -0x3c(%rbp)
movq -0x50(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x50(%rbp)
movl -0x28(%rbp), %eax
movl %eax, -0x30(%rbp)
movl -0x38(%rbp), %eax
movq -0x48(%rbp), %rcx
addl (%rcx), %eax
movl -0x14(%rbp), %ecx
addl -0x30(%rbp), %ecx
cmpl %ecx, %eax
jge 0x920f
movl -0x38(%rbp), %eax
movq -0x48(%rbp), %rcx
addl (%rcx), %eax
subl -0x14(%rbp), %eax
movl %eax, -0x30(%rbp)
movl -0x3c(%rbp), %eax
movq -0x50(%rbp), %rcx
addl (%rcx), %eax
movl -0x24(%rbp), %ecx
addl -0x30(%rbp), %ecx
cmpl %ecx, %eax
jge 0x9231
movl -0x3c(%rbp), %eax
movq -0x50(%rbp), %rcx
addl (%rcx), %eax
subl -0x24(%rbp), %eax
movl %eax, -0x30(%rbp)
movq -0x48(%rbp), %rdi
movl -0x2c(%rbp), %eax
addl -0x14(%rbp), %eax
subl -0x38(%rbp), %eax
subl $0x1, %eax
imull -0x34(%rbp), %eax
cltq
addq %rax, %rdi
addq $0x18, %rdi
movq -0x50(%rbp), %rsi
movl -0x2c(%rbp), %eax
addl -0x24(%rbp), %eax
subl -0x3c(%rbp), %eax
subl $0x1, %eax
imull -0x34(%rbp), %eax
cltq
addq %rax, %rsi
addq $0x18, %rsi
movl -0x30(%rbp), %eax
subl -0x2c(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdx
movslq -0x34(%rbp), %rax
imulq %rax, %rdx
callq 0x80c0
movl %eax, -0x40(%rbp)
cmpl $0x0, -0x40(%rbp)
je 0x9293
movb $0x0, -0x1(%rbp)
jmp 0x92a5
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x9185
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
addq $0x50, %rsp
popq %rbp
retq
nop