// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/dsstore.c
// Function: do_info_block
static void do_info_block(deark *c, lctx *d)
{
	i64 pos = d->infoblk_offs;
	i64 dircount;
	i64 blk_addr_array_start;
	i64 blk_addr_array_size_padded;
	i64 k;
	int saved_indent_level;

	de_dbg_indent_save(c, &saved_indent_level);
	de_dbg(c, "info block at %"I64_FMT, d->infoblk_offs);
	de_dbg_indent(c, 1);
	d->blkcount = de_getu32be_p(&pos);
	de_dbg(c, "block count: %u", (unsigned int)d->blkcount);
	if(d->blkcount>1000000) goto done;
	pos += 4; // unknown

	blk_addr_array_start = pos;
	blk_addr_array_size_padded = de_pad_to_n(d->blkcount*4, 1024);

	de_dbg(c, "block address table at %d", (int)pos);
	d->block_addr_table = de_mallocarray(c, d->blkcount, sizeof(struct addr_table_entry));
	de_dbg_indent(c, 1);
	for(k=0; k<d->blkcount; k++) {
		d->block_addr_table[k].addr_code = (u32)de_getu32be_p(&pos);
		if(d->block_addr_table[k].addr_code!=0) {
			de_dbg(c, "addr[%d] = 0x%08x", (int)k,
				(unsigned int)d->block_addr_table[k].addr_code);
		}
	}
	de_dbg_indent(c, -1);

	pos = blk_addr_array_start + blk_addr_array_size_padded;
	dircount = de_getu32be_p(&pos);
	de_dbg(c, "dir count: %u", (unsigned int)dircount);
	if(dircount>1000000) goto done;
	for(k=0; k<dircount; k++) {
		i64 bytes_consumed;

		de_dbg(c, "dir entry[%d] at %"I64_FMT, (int)k, pos);
		de_dbg_indent(c, 1);
		do_dir_entry(c, d, pos, &bytes_consumed);
		pos += bytes_consumed;
		de_dbg_indent(c, -1);
	}

done:
	de_dbg_indent_restore(c, saved_indent_level);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x3c(%rbp), %rsi
callq 0x15b580
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
leaq 0x12e012(%rip), %rsi    # 0x1ad88c
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x18(%rbp), %rsi
callq 0x1654b0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movl %eax, %edx
leaq 0x12dfde(%rip), %rsi    # 0x1ad89e
movb $0x0, %al
callq 0x15b0d0
movq -0x10(%rbp), %rax
cmpq $0xf4240, 0x20(%rax)    # imm = 0xF4240
jle 0x7f8da
jmp 0x7fa9e
movq -0x18(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
shlq $0x2, %rdi
movl $0x400, %esi            # imm = 0x400
callq 0x15ce90
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movl %eax, %edx
leaq 0x12df95(%rip), %rsi    # 0x1ad8ae
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rsi
movl $0x8, %edx
callq 0x15c450
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq $0x0, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x20(%rcx), %rax
jge 0x7f9d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x18(%rbp), %rsi
callq 0x1654b0
movl %eax, %edx
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x38(%rbp), %rcx
movl %edx, (%rax,%rcx,8)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x38(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,8)
je 0x7f9c0
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rax
movl %eax, %edx
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x38(%rbp), %rcx
movl (%rax,%rcx,8), %ecx
leaq 0x12df0f(%rip), %rsi    # 0x1ad8c8
movb $0x0, %al
callq 0x15b0d0
jmp 0x7f9c2
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x7f957
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
movq -0x28(%rbp), %rax
addq -0x30(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x18(%rbp), %rsi
callq 0x1654b0
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rax
movl %eax, %edx
leaq 0x12deca(%rip), %rsi    # 0x1ad8da
movb $0x0, %al
callq 0x15b0d0
cmpq $0xf4240, -0x20(%rbp)   # imm = 0xF4240
jle 0x7fa23
jmp 0x7fa9e
movq $0x0, -0x38(%rbp)
movq -0x38(%rbp), %rax
cmpq -0x20(%rbp), %rax
jge 0x7fa9c
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rax
movl %eax, %edx
movq -0x18(%rbp), %rcx
leaq 0x12de9e(%rip), %rsi    # 0x1ad8e8
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
leaq -0x48(%rbp), %rcx
callq 0x7fe30
movq -0x48(%rbp), %rax
addq -0x18(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x7fa2b
jmp 0x7fa9e
movq -0x8(%rbp), %rdi
movl -0x3c(%rbp), %esi
callq 0x15b5a0
addq $0x50, %rsp
popq %rbp
retq