// File: /workspace/github_c_makefile_star2_O3/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 0x24(%rsp), %rsi
callq 0xe8a1c
movl 0x30(%rbx), %eax
leal 0x1(%rax), %ecx
movl %ecx, 0x30(%rbx)
cmpl $0xf, %eax
jg 0x5a186
movl %ebp, %eax
cmpq %rax, 0x20(%rbx)
jle 0x5a186
movq 0x28(%rbx), %rcx
cmpb $0x0, 0x4(%rcx,%rax,8)
jne 0x5a186
movb $0x1, 0x4(%rcx,%rax,8)
movl (%rcx,%rax,8), %r15d
movl %r15d, %edi
andl $0x1f, %edi
callq 0xe9c9b
andl $-0x20, %r15d
orq $0x4, %r15
leaq 0xc8238(%rip), %rsi     # 0x121de5
movq %r14, %rdi
movl %ebp, %edx
movl %r15d, %ecx
movl %eax, %r8d
xorl %eax, %eax
callq 0xe8617
movq %r14, %rdi
movl $0x1, %esi
callq 0xe8a15
leaq 0x18(%rsp), %r12
movq %r15, 0xb8(%rsp)
movq %r15, (%r12)
movq 0x18(%r14), %rdi
movq %r12, %rsi
callq 0xeed31
movq %rax, %r13
leaq 0xcfef9(%rip), %rsi     # 0x129aec
movq %r14, %rdi
movl %r13d, %edx
xorl %eax, %eax
callq 0xe8617
movq 0x18(%r14), %rdi
movq %r12, %rsi
callq 0xeed31
leaq 0xb8fbd(%rip), %rsi     # 0x112bd0
movq %r14, %rdi
movq %rax, 0x28(%rsp)
movl %eax, %edx
xorl %eax, %eax
callq 0xe8617
testl %r13d, %r13d
je 0x59c5c
movq 0x18(%r14), %rdi
leaq 0x18(%rsp), %rsi
callq 0xeed31
movq %rax, %r12
leaq 0xc81c1(%rip), %rsi     # 0x121e02
movq %r14, %rdi
movl %r12d, %edx
xorl %eax, %eax
callq 0xe8617
movq %r14, %rdi
movq %rbx, %rsi
movl %r12d, %edx
callq 0x59b3a
cmpq $0x0, 0x28(%rsp)
jle 0x5a186
movq 0x18(%rsp), %r12
xorl %ebp, %ebp
movq %r14, %rdi
leaq 0xc819b(%rip), %rsi     # 0x121e14
movl %ebp, %edx
movl %r12d, %ecx
movq 0xb8(%rsp), %r8
xorl %eax, %eax
callq 0xe8617
movq %r14, %rdi
movl $0x1, %esi
callq 0xe8a15
movq 0x18(%rsp), %r15
movq %r15, 0x8(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x90(%rsp)
movaps %xmm0, 0x80(%rsp)
movaps %xmm0, 0x70(%rsp)
movaps %xmm0, 0x60(%rsp)
movaps %xmm0, 0x50(%rsp)
movaps %xmm0, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movq $0x0, 0xa0(%rsp)
movq 0x18(%r14), %rdi
leaq 0x8(%rsp), %rsi
callq 0xeed31
cmpq $0x800, %rax            # imm = 0x800
jg 0x5a17c
movq %rax, %r12
movq %r14, %rdi
callq 0xf6410
movq %rax, %r13
movq %rax, 0x40(%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 0xefbd7
movq %r13, %rdi
callq 0xf70f6
movq %r14, %rdi
leaq 0xe2013(%rip), %rsi     # 0x13bd4e
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
addq 0x8(%rsp), %r12
movq %r12, 0x8(%rsp)
movq 0x18(%r14), %rdi
movq %r12, %rsi
leaq 0x48(%rsp), %rdx
movl $0x4, %ecx
xorl %r8d, %r8d
callq 0xf1762
movq %r14, %rdi
leaq 0xc80c1(%rip), %rsi     # 0x121e33
leaq 0x58(%rsp), %rdx
xorl %eax, %eax
callq 0xe8617
movq 0x8(%rsp), %rsi
addq $0x4, %rsi
movq %rsi, 0x8(%rsp)
movq 0x18(%r14), %rdi
leaq 0x78(%rsp), %rdx
movl $0x4, %ecx
xorl %r8d, %r8d
callq 0xf1762
movq %r14, %rdi
leaq 0xc8099(%rip), %rsi     # 0x121e45
leaq 0x88(%rsp), %rdx
xorl %eax, %eax
callq 0xe8617
movq 0x8(%rsp), %rax
leaq 0x4(%rax), %rsi
movq %rsi, 0x8(%rsp)
movq %rsi, 0x30(%rsp)
movl 0x7c(%rsp), %ecx
cmpl $0x6c6f6e66, %ecx       # imm = 0x6C6F6E66
jg 0x59e11
cmpl $0x636f6d6f, %ecx       # imm = 0x636F6D6F
jg 0x59e53
cmpl $0x626c6f62, %ecx       # imm = 0x626C6F62
je 0x59f60
cmpl $0x626f6f6c, %ecx       # imm = 0x626F6F6C
jne 0x5a163
movq $0x1, 0x38(%rsp)
movq 0x18(%r14), %rdi
movl $0x1, %edx
jmp 0x5a002
cmpl $0x74797064, %ecx       # imm = 0x74797064
jg 0x59ed5
cmpl $0x6c6f6e67, %ecx       # imm = 0x6C6F6E67
je 0x59fdc
cmpl $0x73686f72, %ecx       # imm = 0x73686F72
jne 0x5a163
movq $0x4, 0x38(%rsp)
addq $0x6, %rax
movq 0x18(%r14), %rdi
movq %rax, %rsi
movl $0x2, %edx
jmp 0x5a002
cmpl $0x636f6d70, %ecx       # imm = 0x636F6D70
je 0x59ff0
cmpl $0x64757463, %ecx       # imm = 0x64757463
jne 0x5a163
movq $0x8, 0x38(%rsp)
movq 0x18(%r14), %rdi
callq 0xef072
movq %rax, %r12
movq %rax, %rdi
shrq $0x10, %rdi
leaq 0xc0(%rsp), %r13
movq %r13, %rsi
callq 0xea8ff
movb $0x1, 0xc1(%rsp)
movl $0x40, %edx
movq %r13, %rdi
leaq 0xd0(%rsp), %r13
movq %r13, %rsi
xorl %ecx, %ecx
callq 0xeaf46
movq %r14, %rdi
leaq 0xc8007(%rip), %rsi     # 0x121eca
movq %r12, %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0xe8617
jmp 0x5a020
cmpl $0x74797065, %ecx       # imm = 0x74797065
je 0x5a06f
cmpl $0x75737472, %ecx       # imm = 0x75737472
jne 0x5a163
movq 0x18(%r14), %rdi
callq 0xeed0d
movq %rax, %r13
addq $0x4, %rax
movq %rax, 0x38(%rsp)
movq %r14, %rdi
callq 0xf6410
movq %rax, %r12
movq 0x18(%r14), %rdi
movq 0x30(%rsp), %rsi
addq $0x4, %rsi
addq %r13, %r13
movl $0x4, (%rsp)
movl $0x3e8, %ecx            # imm = 0x3E8
movq %r13, %rdx
movq %rax, %r8
xorl %r9d, %r9d
callq 0xefc2a
movq %r12, %rdi
callq 0xf70f6
movq %r14, %rdi
leaq 0xb8822(%rip), %rsi     # 0x11276b
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
movq %r12, %rdi
callq 0xf6753
jmp 0x5a020
movq 0x18(%r14), %rdi
callq 0xeed0d
movq %rax, %r13
movq %r14, %rdi
leaq 0xc7f2b(%rip), %rsi     # 0x121ea1
movl %r13d, %edx
xorl %eax, %eax
callq 0xe8617
leaq 0x4(%r13), %rax
movq %rax, 0x38(%rsp)
movq 0x30(%rsp), %r12
addq $0x4, %r12
cmpq $0x8, %r13
jl 0x59fb8
movq 0x18(%r14), %rdi
movl $0x8, %ecx
movq %r12, %rsi
leaq 0xbcd01(%rip), %rdx     # 0x116cac
callq 0xefc85
testl %eax, %eax
je 0x5a080
movq 0x18(%r14), %rsi
movl $0x1, (%rsp)
movl $0x100, %r8d            # imm = 0x100
movq %r14, %rdi
movq %r12, %rdx
movq %r13, %rcx
xorl %r9d, %r9d
callq 0xe8bea
jmp 0x5a020
movq $0x4, 0x38(%rsp)
movq 0x18(%r14), %rdi
movl $0x4, %edx
jmp 0x5a002
movq $0x8, 0x38(%rsp)
movq 0x18(%r14), %rdi
movl $0x8, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0xef0f6
movq %r14, %rdi
leaq 0xb8771(%rip), %rsi     # 0x112787
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
movq 0x38(%rsp), %r12
testq %r12, %r12
jle 0x5a17c
addq 0x8(%rsp), %r12
movq %r12, 0x8(%rsp)
movq 0x40(%rsp), %rdi
callq 0xf6753
subq %r15, %r12
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
addq 0x18(%rsp), %r12
movq %r12, 0x18(%rsp)
incq %rbp
cmpq %rbp, 0x28(%rsp)
jne 0x59c6f
jmp 0x5a186
movq $0x4, 0x38(%rsp)
movl $0x4, %r12d
jmp 0x5a02e
movq %r14, %rdi
leaq 0xc7e24(%rip), %rsi     # 0x121eae
movl %r12d, %edx
xorl %eax, %eax
callq 0xe8617
movq %r14, %rdi
movl $0x1, %esi
callq 0xe8a15
movq %r14, %rdi
callq 0xf6410
movq %rax, 0x10(%rsp)
cmpb $0x0, 0xd0(%r14)
je 0x5a0dd
movq 0x40(%rsp), %rsi
movq 0x10(%rsp), %rdi
callq 0xf6509
movq 0x10(%rsp), %rdi
leaq 0xe189b(%rip), %rsi     # 0x13b96e
movl $0x5, %edx
callq 0xf65e3
movq 0x10(%rsp), %rdi
movl $0x5, %esi
leaq 0xc7dd3(%rip), %rdx     # 0x121ec1
leaq 0x50(%rsp), %rcx
xorl %eax, %eax
callq 0xf6653
movq %r14, %rdi
callq 0xea504
movq %rax, 0xb0(%rsp)
movq %r14, %rdi
movq %rax, %rsi
movq 0x10(%rsp), %rdx
xorl %ecx, %ecx
callq 0xea53f
movq 0x18(%r14), %rsi
movq %r14, %rdi
movq %r12, %rdx
movq %r13, %rcx
movq 0xb0(%rsp), %r12
movq %r12, %r8
xorl %r9d, %r9d
callq 0xf7ec0
movq 0x10(%rsp), %rdi
callq 0xf6753
movq %r14, %rdi
movq %r12, %rsi
callq 0xea50e
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
jmp 0x5a020
leaq 0xc7ceb(%rip), %rsi     # 0x121e55
movq %r14, %rdi
leaq 0x80(%rsp), %rdx
xorl %eax, %eax
callq 0xe8faa
movq 0x40(%rsp), %rdi
callq 0xf6753
movl 0x24(%rsp), %esi
movq %r14, %rdi
callq 0xe8a25
decl 0x30(%rbx)
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop