// File: /workspace/github_c_makefile_star2_O0/icebert[P]pblat/lib/bPlusTree.c
// Function: rFindMulti
static void rFindMulti(struct bptFile *bpt, bits64 blockStart, void *key, struct slRef **pList)
/* Find values corresponding to key and add them to pList.  You'll need to 
 * Do a slRefFreeListAndVals() on the list when done. */
{
/* Seek to start of block. */
udcSeek(bpt->udc, blockStart);

/* Read block header. */
UBYTE isLeaf;
UBYTE reserved;
bits16 i, childCount;
udcMustReadOne(bpt->udc, isLeaf);
udcMustReadOne(bpt->udc, reserved);
boolean isSwapped = bpt->isSwapped;
childCount = udcReadBits16(bpt->udc, isSwapped);

int keySize = bpt->keySize;
UBYTE keyBuf[keySize];   /* Place to put a key, buffered on stack. */
UBYTE valBuf[bpt->valSize];   /* Place to put a value, buffered on stack. */

if (isLeaf)
    {
    for (i=0; i<childCount; ++i)
        {
	udcMustRead(bpt->udc, keyBuf, keySize);
	udcMustRead(bpt->udc, valBuf, bpt->valSize);
	if (memcmp(key, keyBuf, keySize) == 0)
	    {
	    void *val = cloneMem(valBuf, bpt->valSize);
	    refAdd(pList, val);
	    }
	}
    }
else
    {
    /* Read first key and first file offset. */
    udcMustRead(bpt->udc, keyBuf, keySize);
    bits64 lastFileOffset = udcReadBits64(bpt->udc, isSwapped);
    bits64 fileOffset = lastFileOffset;
    int lastCmp = memcmp(key, keyBuf, keySize);

    /* Loop through remainder. */
    for (i=1; i<childCount; ++i)
	{
	udcMustRead(bpt->udc, keyBuf, keySize);
	fileOffset = udcReadBits64(bpt->udc, isSwapped);
	int cmp = memcmp(key, keyBuf, keySize);
	if (lastCmp >= 0 && cmp <= 0)
	    {
	    bits64 curPos = udcTell(bpt->udc);
	    rFindMulti(bpt, lastFileOffset, key, pList);
	    udcSeek(bpt->udc, curPos);
	    }
	if (cmp < 0)
	    return;
	lastCmp = cmp;
	lastFileOffset = fileOffset;
	}
    /* If made it all the way to end, do last one too. */
    rFindMulti(bpt, fileOffset, key, pList);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x10(%rbp), %rsi
callq 0x5ea30
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
leaq -0x21(%rbp), %rsi
movl $0x1, %edx
movq %rdx, -0x90(%rbp)
callq 0x5c730
movq -0x90(%rbp), %rdx
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
leaq -0x22(%rbp), %rsi
callq 0x5c730
movq -0x8(%rbp), %rax
movl 0x30(%rax), %eax
movl %eax, -0x2c(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movl -0x2c(%rbp), %esi
callq 0x5e5f0
movw %ax, -0x26(%rbp)
movq -0x8(%rbp), %rax
movl 0x1c(%rax), %eax
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %eax
movq %rsp, %rcx
movq %rcx, -0x38(%rbp)
movq %rax, %rdx
addq $0xf, %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x88(%rbp)
movq %rcx, %rsp
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rax
movl 0x20(%rax), %eax
movq %rax, %rdx
addq $0xf, %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x80(%rbp)
movq %rcx, %rsp
movq %rax, -0x48(%rbp)
cmpb $0x0, -0x21(%rbp)
je 0x6218b
movw $0x0, -0x24(%rbp)
movzwl -0x24(%rbp), %eax
movzwl -0x26(%rbp), %ecx
cmpl %ecx, %eax
jge 0x62186
movq -0x88(%rbp), %rsi
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movslq -0x30(%rbp), %rdx
callq 0x5c730
movq -0x80(%rbp), %rsi
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x8(%rbp), %rax
movl 0x20(%rax), %eax
movl %eax, %edx
callq 0x5c730
movq -0x88(%rbp), %rsi
movq -0x18(%rbp), %rdi
movslq -0x30(%rbp), %rdx
callq 0x62d0
cmpl $0x0, %eax
jne 0x62173
movq -0x80(%rbp), %rdi
movq -0x8(%rbp), %rax
movl 0x20(%rax), %eax
movl %eax, %esi
callq 0x2a360
movq %rax, -0x50(%rbp)
movq -0x20(%rbp), %rdi
movq -0x50(%rbp), %rsi
callq 0x2c290
jmp 0x62175
movw -0x24(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x24(%rbp)
jmp 0x620f5
jmp 0x622b5
movq -0x88(%rbp), %rsi
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movslq -0x30(%rbp), %rdx
callq 0x5c730
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movl -0x2c(%rbp), %esi
callq 0x5e570
movq -0x88(%rbp), %rsi
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x18(%rbp), %rdi
movslq -0x30(%rbp), %rdx
callq 0x62d0
movl %eax, -0x64(%rbp)
movw $0x1, -0x24(%rbp)
movzwl -0x24(%rbp), %eax
movzwl -0x26(%rbp), %ecx
cmpl %ecx, %eax
jge 0x622a0
movq -0x88(%rbp), %rsi
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movslq -0x30(%rbp), %rdx
callq 0x5c730
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movl -0x2c(%rbp), %esi
callq 0x5e570
movq -0x88(%rbp), %rsi
movq %rax, -0x60(%rbp)
movq -0x18(%rbp), %rdi
movslq -0x30(%rbp), %rdx
callq 0x62d0
movl %eax, -0x68(%rbp)
cmpl $0x0, -0x64(%rbp)
jl 0x62272
cmpl $0x0, -0x68(%rbp)
jg 0x62272
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x5eaa0
movq %rax, -0x70(%rbp)
movq -0x8(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
callq 0x62010
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x70(%rbp), %rsi
callq 0x5ea30
cmpl $0x0, -0x68(%rbp)
jge 0x62281
movl $0x1, -0x74(%rbp)
jmp 0x622bc
movl -0x68(%rbp), %eax
movl %eax, -0x64(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x58(%rbp)
movw -0x24(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x24(%rbp)
jmp 0x621dc
movq -0x8(%rbp), %rdi
movq -0x60(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
callq 0x62010
movl $0x0, -0x74(%rbp)
movq -0x38(%rbp), %rax
movq %rax, %rsp
movq %rbp, %rsp
popq %rbp
retq
nopl (%rax,%rax)