// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/dsstore.c
// Function: do_one_node
static void do_one_node(deark *c, lctx *d, u32 blk_id)
{
	i64 node_offs, node_size;
	unsigned int mode;
	i64 count;
	i64 pos;
	i64 k;
	int saved_indent_level;

	de_dbg_indent_save(c, &saved_indent_level);

	d->depth++;
	if(d->depth > DSSTORE_MAX_DEPTH) goto done;
	if(blk_id >= d->blkcount) goto done;
	if(d->block_addr_table[blk_id].decoded) goto done;
	d->block_addr_table[blk_id].decoded = 1;

	if(!block_id_to_offset_and_size(c, d, blk_id, &node_offs,
		&node_size))
	{
		goto done;
	}

	de_dbg(c, "node: id=%u, offs=%d, len=%d", (unsigned int)blk_id,
		(int)node_offs, (int)node_size);
	de_dbg_indent(c, 1);
	pos = node_offs;
	mode = (unsigned int)de_getu32be_p(&pos);
	de_dbg(c, "mode: %u", mode);
	count = de_getu32be_p(&pos);
	de_dbg(c, "count: %d", (int)count);

	{
		// If 'mode' is 0, there are 'count' records here.
		i64 bytes_consumed = 0;

		if(mode!=0) {
			u32 next_blk_id;
			next_blk_id = (u32)de_getu32be_p(&pos);
			de_dbg(c, "next block id: %u", (unsigned int)next_blk_id);
			do_one_node(c, d, next_blk_id);
		}

		for(k=0; k<count; k++) {
			de_dbg(c, "record[%d] at %d (for node@%d)", (int)k, (int)pos, (int)node_offs);
			de_dbg_indent(c, 1);
			if(!do_record(c, d, pos, &bytes_consumed)) break;
			de_dbg_indent(c, -1);
			pos += bytes_consumed;
		}
	}

done:
	de_dbg_indent_restore(c, saved_indent_level);
	d->depth--;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x34(%rsp), %rsi
callq 0xe958c
movl 0x30(%rbx), %eax
leal 0x1(%rax), %ecx
movl %ecx, 0x30(%rbx)
cmpl $0xf, %eax
jg 0x59d96
movl %ebp, %eax
cmpq %rax, 0x20(%rbx)
jle 0x59d96
movq 0x28(%rbx), %rcx
cmpb $0x0, 0x4(%rcx,%rax,8)
je 0x59db7
movl 0x34(%rsp), %esi
movq %r14, %rdi
callq 0xe9595
decl 0x30(%rbx)
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb $0x1, 0x4(%rcx,%rax,8)
movl (%rcx,%rax,8), %r15d
movl %r15d, %edi
andl $0x1f, %edi
callq 0xea7f2
andl $-0x20, %r15d
orq $0x4, %r15
leaq 0xc7efb(%rip), %rsi     # 0x121cd5
movq %r14, %rdi
movl %ebp, %edx
movq %r15, %rbp
movl %ebp, %ecx
movl %eax, %r8d
xorl %eax, %eax
callq 0xe9226
movq %r14, %rdi
movl $0x1, %esi
callq 0xe9585
leaq 0x20(%rsp), %r12
movq %r15, (%r12)
movq 0x18(%r14), %rdi
movq %r12, %rsi
callq 0xef34e
movq %rax, %r13
leaq 0xcfa62(%rip), %rsi     # 0x12987c
movq %r14, %rdi
movl %r13d, %edx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%r14), %rdi
movq %r12, %rsi
callq 0xef34e
leaq 0xb8d86(%rip), %rsi     # 0x112bc0
movq %r14, %rdi
movq %rax, 0x38(%rsp)
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
testl %r13d, %r13d
je 0x59e83
movq 0x18(%r14), %rdi
leaq 0x20(%rsp), %rsi
callq 0xef34e
movq %rax, %r12
leaq 0xc7e8a(%rip), %rsi     # 0x121cf2
movq %r14, %rdi
movl %r12d, %edx
xorl %eax, %eax
callq 0xe9226
movq %r14, %rdi
movq %rbx, %rsi
movl %r12d, %edx
callq 0x59d52
cmpq $0x0, 0x38(%rsp)
jle 0x59d96
xorl %r13d, %r13d
movq %rbp, 0x28(%rsp)
movl 0x20(%rsp), %ecx
movq %r14, %rdi
leaq 0xc7e5f(%rip), %rsi     # 0x121d04
movl %r13d, %edx
movl %ebp, %r8d
xorl %eax, %eax
callq 0xe9226
movq %r14, %rdi
movl $0x1, %esi
callq 0xe9585
movq 0x20(%rsp), %r15
movq %r15, 0x8(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0xa0(%rsp)
movaps %xmm0, 0x90(%rsp)
movaps %xmm0, 0x80(%rsp)
movaps %xmm0, 0x70(%rsp)
movaps %xmm0, 0x60(%rsp)
movaps %xmm0, 0x50(%rsp)
movaps %xmm0, 0x40(%rsp)
movq $0x0, 0xb0(%rsp)
movq 0x18(%r14), %rdi
leaq 0x8(%rsp), %rsi
callq 0xef34e
movq %rax, %r12
movb $0x1, %al
movl %eax, 0x1c(%rsp)
cmpq $0x800, %r12            # imm = 0x800
jg 0x5a278
movq %r14, %rdi
callq 0xf6870
movq %rax, 0x50(%rsp)
movq 0x18(%r14), %rdi
movq 0x8(%rsp), %rsi
addq %r12, %r12
movq %r12, %rdx
movq %rax, %rcx
xorl %r8d, %r8d
movl $0x4, %r9d
callq 0xf01b0
movq 0x50(%rsp), %rdi
callq 0xf7557
movq %r14, %rdi
leaq 0xe1a6b(%rip), %rsi     # 0x13b9d4
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
addq 0x8(%rsp), %r12
movq %r12, 0x8(%rsp)
movq 0x18(%r14), %rdi
movq %r12, %rsi
leaq 0x58(%rsp), %rdx
movl $0x4, %ecx
xorl %r8d, %r8d
callq 0xf1d74
movq %r14, %rdi
leaq 0xc7d83(%rip), %rsi     # 0x121d23
leaq 0x68(%rsp), %rdx
xorl %eax, %eax
callq 0xe9226
movq 0x8(%rsp), %rsi
addq $0x4, %rsi
movq %rsi, 0x8(%rsp)
movq 0x18(%r14), %rdi
leaq 0x88(%rsp), %rdx
movl $0x4, %ecx
xorl %r8d, %r8d
callq 0xf1d74
movq %r14, %rdi
leaq 0xc7d58(%rip), %rsi     # 0x121d35
leaq 0x98(%rsp), %rdx
xorl %eax, %eax
callq 0xe9226
movq 0x8(%rsp), %rax
leaq 0x4(%rax), %rsi
movq %rsi, 0x8(%rsp)
movq %rsi, 0x40(%rsp)
movl 0x8c(%rsp), %ecx
cmpl $0x6c6f6e66, %ecx       # imm = 0x6C6F6E66
jg 0x5a045
cmpl $0x636f6d6f, %ecx       # imm = 0x636F6D6F
jg 0x5a087
cmpl $0x626c6f62, %ecx       # imm = 0x626C6F62
je 0x5a19d
cmpl $0x626f6f6c, %ecx       # imm = 0x626F6F6C
jne 0x5a2c5
movq $0x1, 0x48(%rsp)
movq 0x18(%r14), %rdi
movl $0x1, %edx
jmp 0x5a243
cmpl $0x74797064, %ecx       # imm = 0x74797064
jg 0x5a10d
cmpl $0x6c6f6e67, %ecx       # imm = 0x6C6F6E67
je 0x5a21d
cmpl $0x73686f72, %ecx       # imm = 0x73686F72
jne 0x5a2c5
movq $0x4, 0x48(%rsp)
addq $0x6, %rax
movq 0x18(%r14), %rdi
movq %rax, %rsi
movl $0x2, %edx
jmp 0x5a243
cmpl $0x636f6d70, %ecx       # imm = 0x636F6D70
je 0x5a231
cmpl $0x64757463, %ecx       # imm = 0x64757463
jne 0x5a2c5
movq $0x8, 0x48(%rsp)
movq 0x18(%r14), %rdi
callq 0xef66e
movq %rax, %r12
movq %rax, %rdi
shrq $0x10, %rdi
leaq 0xc0(%rsp), %rsi
callq 0xeae04
movb $0x1, 0xc1(%rsp)
movl $0x40, %edx
leaq 0xc0(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
xorl %ecx, %ecx
callq 0xeb4f8
movq %r14, %rdi
leaq 0xc7cc4(%rip), %rsi     # 0x121dba
movq %r12, %rdx
leaq 0xd0(%rsp), %rcx
xorl %eax, %eax
callq 0xe9226
jmp 0x5a261
cmpl $0x74797065, %ecx       # imm = 0x74797065
je 0x5a2ba
cmpl $0x75737472, %ecx       # imm = 0x75737472
jne 0x5a2c5
movq 0x18(%r14), %rdi
callq 0xef32a
movq %rax, %rbp
addq $0x4, %rax
movq %rax, 0x48(%rsp)
movq %r14, %rdi
callq 0xf6870
movq %rax, %r12
movq 0x18(%r14), %rdi
movq 0x40(%rsp), %rsi
addq $0x4, %rsi
addq %rbp, %rbp
movl $0x4, (%rsp)
movl $0x3e8, %ecx            # imm = 0x3E8
movq %rbp, %rdx
movq 0x28(%rsp), %rbp
movq %rax, %r8
xorl %r9d, %r9d
callq 0xf0203
movq %r12, %rdi
callq 0xf7557
movq %r14, %rdi
leaq 0xb85d5(%rip), %rsi     # 0x11275b
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
movq %r12, %rdi
callq 0xf6bb0
jmp 0x5a261
movq 0x18(%r14), %rdi
callq 0xef32a
movq %rax, %rbp
movq %r14, %rdi
leaq 0xc7bde(%rip), %rsi     # 0x121d91
movl %ebp, %edx
xorl %eax, %eax
callq 0xe9226
leaq 0x4(%rbp), %rax
movq %rax, 0x48(%rsp)
movq 0x40(%rsp), %r12
addq $0x4, %r12
cmpq $0x8, %rbp
jl 0x5a1f4
movq 0x18(%r14), %rdi
movl $0x8, %ecx
movq %r12, %rsi
leaq 0xbca15(%rip), %rdx     # 0x116bfc
callq 0xf025e
testl %eax, %eax
je 0x5a2e0
movq 0x18(%r14), %rsi
movl $0x1, (%rsp)
movl $0x100, %r8d            # imm = 0x100
movq %r14, %rdi
movq %r12, %rdx
movq %rbp, %rcx
xorl %r9d, %r9d
callq 0xe975a
movq 0x28(%rsp), %rbp
jmp 0x5a261
movq $0x4, 0x48(%rsp)
movq 0x18(%r14), %rdi
movl $0x4, %edx
jmp 0x5a243
movq $0x8, 0x48(%rsp)
movq 0x18(%r14), %rdi
movl $0x8, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0xef6f2
movq %r14, %rdi
leaq 0xb8520(%rip), %rsi     # 0x112777
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
movq 0x48(%rsp), %rax
testq %rax, %rax
jle 0x5a278
addq %rax, 0x8(%rsp)
movl $0x0, 0x1c(%rsp)
movq 0x8(%rsp), %r12
movq 0x50(%rsp), %rdi
callq 0xf6bb0
cmpb $0x0, 0x1c(%rsp)
jne 0x59d96
subq %r15, %r12
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
addq %r12, 0x20(%rsp)
incq %r13
cmpq %r13, 0x38(%rsp)
jne 0x59e97
jmp 0x59d96
movq $0x4, 0x48(%rsp)
jmp 0x5a261
movq %r14, %rdi
leaq 0xc7a76(%rip), %rsi     # 0x121d45
leaq 0x90(%rsp), %rdx
xorl %eax, %eax
callq 0xe9b27
jmp 0x5a278
movq %r14, %rdi
leaq 0xc7ab4(%rip), %rsi     # 0x121d9e
movl %r12d, %edx
xorl %eax, %eax
callq 0xe9226
movq %r14, %rdi
movl $0x1, %esi
callq 0xe9585
movq %r14, %rdi
callq 0xf6870
movq %rax, 0x10(%rsp)
cmpb $0x0, 0xd0(%r14)
je 0x5a33d
movq 0x50(%rsp), %rsi
movq 0x10(%rsp), %rdi
callq 0xf6969
movq 0x10(%rsp), %rdi
leaq 0xe1283(%rip), %rsi     # 0x13b5b6
movl $0x5, %edx
callq 0xf6a40
movq 0x10(%rsp), %rdi
movl $0x5, %esi
leaq 0xc7a63(%rip), %rdx     # 0x121db1
leaq 0x60(%rsp), %rcx
xorl %eax, %eax
callq 0xf6ab0
movq %r14, %rdi
callq 0xea9a9
movq %rax, 0xb8(%rsp)
movq %r14, %rdi
movq %rax, %rsi
movq 0x10(%rsp), %rdx
xorl %ecx, %ecx
callq 0xea9e4
movq 0x18(%r14), %rsi
movq %r14, %rdi
movq %r12, %rdx
movq %rbp, %rcx
movq 0xb8(%rsp), %r12
movq %r12, %r8
xorl %r9d, %r9d
callq 0xf8390
movq 0x10(%rsp), %rdi
callq 0xf6bb0
movq %r14, %rdi
movq %r12, %rsi
callq 0xea9b3
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
jmp 0x5a216
nop