// File: /workspace/github_c_makefile_star2_O3/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 0x30a3
movl %ecx, %r15d
movl %edx, %r9d
movl 0x20(%rdi), %eax
movl %edx, %ecx
subl %eax, %ecx
subl %eax, %esi
cmpl %esi, %ecx
jae 0x30bb
movl 0x24(%rdi), %edx
subl %eax, %edx
cmpl %edx, %ecx
jae 0x30da
movb 0x10(%rdi), %cl
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
shll %cl, %eax
orl %r9d, %eax
cmpl $-0x1, %eax
je 0x30f9
movl %r8d, %ebx
leaq 0x10(%rsp), %rdx
leaq 0xc(%rsp), %rcx
movq %rdi, %r14
movl %r9d, %r13d
movl %r9d, %esi
callq 0x2175
testl %eax, %eax
jns 0x3022
movl 0xc(%rsp), %esi
leaq 0x11ec(%rip), %rdi      # 0x4209
callq 0x3815
movl 0x10(%rsp), %edi
testl %ebx, %ebx
movq %r14, %r12
movl %r13d, %ebp
je 0x3054
xorl %edi, %r15d
movl %ebx, %ecx
negb %cl
shrl %cl, %r15d
testl %r15d, %r15d
jne 0x3118
movl $0x1, %r15d
cmpl $0x1f, %ebx
movq %r14, %r12
movl %r13d, %ebp
jg 0x30a6
movslq %ebx, %r13
leal (,%rbx,4), %r14d
addq $-0x20, %r13
movl $0x1, %r15d
movl %edi, 0x8(%rsp)
movl $0x80000000, %eax       # imm = 0x80000000
movl %ebx, %ecx
shrl %cl, %eax
movslq %r14d, %r14
movl 0x14(%rsp,%r14), %edx
xorl %edi, %eax
incl %ebx
movq %r12, %rdi
movl %ebp, %esi
movl %eax, %ecx
movl %ebx, %r8d
callq 0x2f9f
movl 0x8(%rsp), %edi
addl %eax, %r15d
addl $0x4, %r14d
incq %r13
jne 0x306d
jmp 0x30a6
xorl %r15d, %r15d
movl %r15d, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x10a1(%rip), %rdi      # 0x4163
leaq 0x106c(%rip), %rsi      # 0x4135
leaq 0x10a5(%rip), %rcx      # 0x4175
movl $0x44, %edx
callq 0x1080
leaq 0x10eb(%rip), %rdi      # 0x41cc
leaq 0x104d(%rip), %rsi      # 0x4135
leaq 0x1086(%rip), %rcx      # 0x4175
movl $0x45, %edx
callq 0x1080
leaq 0x10de(%rip), %rdi      # 0x41de
leaq 0x102e(%rip), %rsi      # 0x4135
leaq 0x1067(%rip), %rcx      # 0x4175
movl $0x46, %edx
callq 0x1080
leaq 0x10f3(%rip), %rdi      # 0x4212
leaq 0x100f(%rip), %rsi      # 0x4135
leaq 0x1048(%rip), %rcx      # 0x4175
movl $0x51, %edx
callq 0x1080
nop