// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/lib/bPlusTree.c
// Function: rFind
static boolean rFind(struct bptFile *bpt, bits64 blockStart, void *key, void *val)
/* Find value corresponding to key.  If found copy value to memory pointed to by val and return 
 * true. Otherwise return false. */
{
/* 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);

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

if (isLeaf)
    {
    for (i=0; i<childCount; ++i)
        {
	udcMustRead(bpt->udc, keyBuf, bpt->keySize);
	udcMustRead(bpt->udc, val, bpt->valSize);
	if (memcmp(key, keyBuf, bpt->keySize) == 0)
	    return TRUE;
	}
    return FALSE;
    }
else
    {
    /* Read and discard first key. */
    udcMustRead(bpt->udc, keyBuf, bpt->keySize);

    /* Scan info for first file offset. */
    bits64 fileOffset = udcReadBits64(bpt->udc, isSwapped);

    /* Loop through remainder. */
    for (i=1; i<childCount; ++i)
	{
	udcMustRead(bpt->udc, keyBuf, bpt->keySize);
	if (memcmp(key, keyBuf, bpt->keySize) < 0)
	    break;
	fileOffset = udcReadBits64(bpt->udc, isSwapped);
	}
    return rFind(bpt, fileOffset, key, val);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, -0x48(%rbp)
movq %rdx, %r14
movq %rdi, %r15
movq 0x10(%rdi), %rdi
callq 0x41ab5
movq 0x10(%r15), %rdi
leaq -0x29(%rbp), %rsi
movl $0x1, %edx
callq 0x3fef4
movq 0x10(%r15), %rdi
leaq -0x2a(%rbp), %rsi
movl $0x1, %edx
callq 0x3fef4
movl 0x30(%r15), %ebx
movq 0x10(%r15), %rdi
movl %ebx, %esi
callq 0x41783
movl %eax, %r12d
movq %rsp, %rcx
movl 0x1c(%r15), %eax
movq %rsp, %r13
addq $0xf, %rax
andq $-0x10, %rax
subq %rax, %r13
movq %r13, %rsp
leaq -0x29(%rbp), %rax
cmpb $0x0, (%rax)
je 0x43b98
xorl %ebx, %ebx
testw %r12w, %r12w
je 0x43c41
movq %rcx, -0x38(%rbp)
movq 0x10(%r15), %rdi
movl 0x1c(%r15), %edx
movq %r13, %rsi
callq 0x3fef4
movq 0x10(%r15), %rdi
movl 0x20(%r15), %edx
movq -0x48(%rbp), %rsi
callq 0x3fef4
movl 0x1c(%r15), %edx
movq %r14, %rdi
movq %r13, %rsi
callq 0x6710
testl %eax, %eax
je 0x43c38
decw %r12w
jne 0x43b55
jmp 0x43c3d
movq %rcx, -0x38(%rbp)
movq 0x10(%r15), %rdi
movl 0x1c(%r15), %edx
movq %r13, %rsi
callq 0x3fef4
movq 0x10(%r15), %rdi
movl %ebx, -0x3c(%rbp)
movl %ebx, %esi
callq 0x4171e
movq %rax, %rbx
cmpw $0x2, %r12w
jb 0x43c22
movq 0x10(%r15), %rdi
movl 0x1c(%r15), %edx
movq %r13, %rsi
callq 0x3fef4
movl 0x1c(%r15), %edx
movq %r14, %rdi
movq %r13, %rsi
callq 0x62e0
testl %eax, %eax
js 0x43c22
decl %r12d
movq 0x10(%r15), %rdi
movl -0x3c(%rbp), %esi
callq 0x4171e
movq %rax, %rbx
decw %r12w
je 0x43c22
movq 0x10(%r15), %rdi
movl 0x1c(%r15), %edx
movq %r13, %rsi
callq 0x3fef4
movl 0x1c(%r15), %edx
movq %r14, %rdi
movq %r13, %rsi
callq 0x62e0
testl %eax, %eax
jns 0x43bea
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
movq -0x48(%rbp), %rcx
callq 0x43aca
movl %eax, %ebx
jmp 0x43c3d
movl $0x1, %ebx
movq -0x38(%rbp), %rcx
movq %rcx, %rsp
movl %ebx, %eax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)