// File: /workspace/github_c_makefile_star2_O1/dlbeer[P]dhara/tests/map.c
// Function: check_recurse
static int check_recurse(struct dhara_map *m,
			 dhara_page_t parent,
			 dhara_page_t page,
			 dhara_sector_t id_expect,
			 int depth)
{
	uint8_t meta[DHARA_META_SIZE];
	dhara_error_t err;
	const dhara_page_t h_offset = m->journal.head - m->journal.tail;
	const dhara_page_t p_offset = parent - m->journal.tail;
	const dhara_page_t offset = page - m->journal.tail;
	dhara_sector_t id;
	int count = 1;
	int i;

	if (page == DHARA_PAGE_NONE)
		return 0;

	/* Make sure this is a valid journal user page, and one which is
	 * older than the page pointing to it.
	 */
	assert(offset < p_offset);
	assert(offset < h_offset);
	assert((~page) & ((1 << m->journal.log2_ppc) - 1));

	/* Fetch metadata */
	if (dhara_journal_read_meta(&m->journal, page, meta, &err) < 0)
		dabort("mt_check", err);

	/* Check the first <depth> bits of the ID field */
	id = dhara_r32(meta);
	if (!depth) {
		id_expect = id;
	} else {
		assert(!((id ^ id_expect) >> (32 - depth)));
	}

	/* Check all alt-pointers */
	for (i = depth; i < 32; i++) {
		dhara_page_t child = dhara_r32(meta + (i << 2) + 4);

		count += check_recurse(m, page, child,
			id ^ (1 << (31 - i)), i + 1);
	}

	return count;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
cmpl $-0x1, %edx
je 0x3145
movl %r8d, %ebx
movl %ecx, %r15d
movl %edx, %r8d
movl 0x20(%rdi), %eax
movl %edx, %ecx
subl %eax, %ecx
subl %eax, %esi
cmpl %esi, %ecx
jae 0x315d
movl 0x24(%rdi), %edx
subl %eax, %edx
cmpl %edx, %ecx
jae 0x317c
movb 0x10(%rdi), %cl
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
shll %cl, %eax
orl %r8d, %eax
cmpl $-0x1, %eax
je 0x319b
leaq 0x10(%rsp), %rdx
leaq 0xc(%rsp), %rcx
movq %rdi, %rbp
movl %r8d, %r12d
movl %r8d, %esi
callq 0x2226
testl %eax, %eax
jns 0x30c9
movl 0xc(%rsp), %esi
leaq 0x1145(%rip), %rdi      # 0x4209
callq 0x38d9
movl 0x10(%rsp), %r8d
testl %ebx, %ebx
je 0x30e5
xorl %r8d, %r15d
movl %ebx, %ecx
negb %cl
shrl %cl, %r15d
testl %r15d, %r15d
jne 0x31ba
movl $0x1, %r15d
cmpl $0x1f, %ebx
jg 0x3148
movq %rbp, %rdi
movl %r12d, %ebp
movslq %ebx, %r13
leal (,%rbx,4), %r14d
addq $-0x20, %r13
movl %r8d, 0x8(%rsp)
movl $0x80000000, %eax       # imm = 0x80000000
movl %ebx, %ecx
shrl %cl, %eax
movslq %r14d, %r14
movl 0x14(%rsp,%r14), %edx
xorl %r8d, %eax
incl %ebx
movq %rdi, %r12
movl %ebp, %esi
movl %eax, %ecx
movl %ebx, %r8d
callq 0x3046
movq %r12, %rdi
movl 0x8(%rsp), %r8d
addl %eax, %r15d
addl $0x4, %r14d
incq %r13
jne 0x310a
jmp 0x3148
xorl %r15d, %r15d
movl %r15d, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xfff(%rip), %rdi       # 0x4163
leaq 0xfca(%rip), %rsi       # 0x4135
leaq 0x1003(%rip), %rcx      # 0x4175
movl $0x44, %edx
callq 0x1080
leaq 0x1049(%rip), %rdi      # 0x41cc
leaq 0xfab(%rip), %rsi       # 0x4135
leaq 0xfe4(%rip), %rcx       # 0x4175
movl $0x45, %edx
callq 0x1080
leaq 0x103c(%rip), %rdi      # 0x41de
leaq 0xf8c(%rip), %rsi       # 0x4135
leaq 0xfc5(%rip), %rcx       # 0x4175
movl $0x46, %edx
callq 0x1080
leaq 0x1051(%rip), %rdi      # 0x4212
leaq 0xf6d(%rip), %rsi       # 0x4135
leaq 0xfa6(%rip), %rcx       # 0x4175
movl $0x51, %edx
callq 0x1080
nopl (%rax)