// File: /workspace/github_c_makefile_star2_O0/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:
subq $0xd8, %rsp
movq %rdi, 0xc8(%rsp)
movl %esi, 0xc4(%rsp)
movl %edx, 0xc0(%rsp)
movl %ecx, 0xbc(%rsp)
movl %r8d, 0xb8(%rsp)
movq 0xc8(%rsp), %rax
movl 0x24(%rax), %eax
movq 0xc8(%rsp), %rcx
subl 0x20(%rcx), %eax
movl %eax, 0x28(%rsp)
movl 0xc4(%rsp), %eax
movq 0xc8(%rsp), %rcx
subl 0x20(%rcx), %eax
movl %eax, 0x24(%rsp)
movl 0xc0(%rsp), %eax
movq 0xc8(%rsp), %rcx
subl 0x20(%rcx), %eax
movl %eax, 0x20(%rsp)
movl $0x1, 0x18(%rsp)
cmpl $-0x1, 0xc0(%rsp)
jne 0x4af4
movl $0x0, 0xd4(%rsp)
jmp 0x4cbc
movl 0x20(%rsp), %eax
cmpl 0x24(%rsp), %eax
jae 0x4b00
jmp 0x4b1f
leaq 0x16d0(%rip), %rdi      # 0x61d7
leaq 0x169b(%rip), %rsi      # 0x61a9
movl $0x44, %edx
leaq 0x16cf(%rip), %rcx      # 0x61e9
callq 0x1060
movl 0x20(%rsp), %eax
cmpl 0x28(%rsp), %eax
jae 0x4b2b
jmp 0x4b4a
leaq 0x170e(%rip), %rdi      # 0x6240
leaq 0x1670(%rip), %rsi      # 0x61a9
movl $0x45, %edx
leaq 0x16a4(%rip), %rcx      # 0x61e9
callq 0x1060
movl 0xc0(%rsp), %eax
xorl $-0x1, %eax
movq 0xc8(%rsp), %rcx
movzbl 0x10(%rcx), %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
subl $0x1, %ecx
andl %ecx, %eax
cmpl $0x0, %eax
je 0x4b75
jmp 0x4b94
leaq 0x16d6(%rip), %rdi      # 0x6252
leaq 0x1626(%rip), %rsi      # 0x61a9
movl $0x46, %edx
leaq 0x165a(%rip), %rcx      # 0x61e9
callq 0x1060
movq 0xc8(%rsp), %rdi
movl 0xc0(%rsp), %esi
leaq 0x30(%rsp), %rdx
leaq 0x2c(%rsp), %rcx
callq 0x2fe0
cmpl $0x0, %eax
jge 0x4bc7
movl 0x2c(%rsp), %esi
leaq 0x16bb(%rip), %rdi      # 0x627d
callq 0x5930
leaq 0x30(%rsp), %rdi
callq 0x4ce0
movl %eax, 0x1c(%rsp)
cmpl $0x0, 0xb8(%rsp)
jne 0x4bec
movl 0x1c(%rsp), %eax
movl %eax, 0xbc(%rsp)
jmp 0x4c2d
movl 0x1c(%rsp), %eax
xorl 0xbc(%rsp), %eax
movl $0x20, %ecx
subl 0xb8(%rsp), %ecx
shrl %cl, %eax
cmpl $0x0, %eax
jne 0x4c0c
jmp 0x4c2b
leaq 0x1673(%rip), %rdi      # 0x6286
leaq 0x158f(%rip), %rsi      # 0x61a9
movl $0x51, %edx
leaq 0x15c3(%rip), %rcx      # 0x61e9
callq 0x1060
jmp 0x4c2d
movl 0xb8(%rsp), %eax
movl %eax, 0x14(%rsp)
cmpl $0x20, 0x14(%rsp)
jge 0x4cb1
leaq 0x30(%rsp), %rdi
movl 0x14(%rsp), %eax
shll $0x2, %eax
cltq
addq %rax, %rdi
addq $0x4, %rdi
callq 0x4ce0
movl %eax, 0x10(%rsp)
movq 0xc8(%rsp), %rdi
movl 0xc0(%rsp), %esi
movl 0x10(%rsp), %edx
movl 0x1c(%rsp), %eax
movl %eax, 0xc(%rsp)
movl $0x1f, %ecx
subl 0x14(%rsp), %ecx
movl $0x1, %eax
shll %cl, %eax
movl 0xc(%rsp), %ecx
xorl %eax, %ecx
movl 0x14(%rsp), %r8d
addl $0x1, %r8d
callq 0x4a60
addl 0x18(%rsp), %eax
movl %eax, 0x18(%rsp)
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0x4c38
movl 0x18(%rsp), %eax
movl %eax, 0xd4(%rsp)
movl 0xd4(%rsp), %eax
addq $0xd8, %rsp
retq
nopl (%rax,%rax)