// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/pcf.c
// Function: do_read_table_entry
static int do_read_table_entry(deark *c, lctx *d, struct table_entry *te, i64 pos1)
{
	int retval = 0;
	i64 pos = pos1;

	if(pos1+16 > c->infile->len) goto done;

	te->type = (unsigned int)de_getu32le_p(&pos);
	lookup_table_entry_type_info(c, d, te);
	de_dbg(c, "type: 0x%08x (%s)", te->type, te->type_name);

	read_format_field(c, d, te, pos, &te->fmt);
	pos += 4;

	te->size = de_getu32le_p(&pos);
	te->offset = de_getu32le_p(&pos);
	de_dbg(c, "offset: %"I64_FMT", size: %"I64_FMT, te->offset, te->size);
	if(te->offset+te->size > c->infile->len) {
		if(te->type==0x100) {
			// A truncated BDF accelerators table is too common to warn about,
			// and doesn't concern us.
			de_dbg(c, "[table goes beyond end of file]");
		}
		else {
			de_warn(c, "Table entry goes beyond end of file (type=%s, at %"I64_FMT
				", size=%"I64_FMT")", te->type_name, te->offset, te->size);
		}
	}
	if(te->offset > c->infile->len) {
		goto done;
	}

	retval = 1;

done:
	return retval;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rax
addq $0x10, %rax
movq -0x8(%rbp), %rcx
movq 0x18(%rcx), %rcx
cmpq 0x18(%rcx), %rax
jle 0x11b412
jmp 0x11b567
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x30(%rbp), %rsi
callq 0x165580
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x20(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x11b9b0
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movl 0x20(%rax), %edx
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rcx
leaq 0x9e071(%rip), %rsi     # 0x1b94c8
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x30(%rbp), %rcx
movq -0x18(%rbp), %r8
callq 0x11bb40
movq -0x30(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x30(%rbp), %rsi
callq 0x165580
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x30(%rbp), %rsi
callq 0x165580
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rdx
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rcx
leaq 0xa9e8b(%rip), %rsi     # 0x1c5361
movb $0x0, %al
callq 0x15b0d0
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rax
movq -0x18(%rbp), %rcx
addq 0x28(%rcx), %rax
movq -0x8(%rbp), %rcx
movq 0x18(%rcx), %rcx
cmpq 0x18(%rcx), %rax
jle 0x11b548
movq -0x18(%rbp), %rax
cmpl $0x100, 0x20(%rax)      # imm = 0x100
jne 0x11b51c
movq -0x8(%rbp), %rdi
leaq 0xa9e65(%rip), %rsi     # 0x1c5378
movb $0x0, %al
callq 0x15b0d0
jmp 0x11b546
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rdx
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rcx
movq -0x18(%rbp), %rax
movq 0x28(%rax), %r8
leaq 0xa9e59(%rip), %rsi     # 0x1c5398
movb $0x0, %al
callq 0x15bc10
jmp 0x11b548
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x18(%rcx), %rcx
cmpq 0x18(%rcx), %rax
jle 0x11b560
jmp 0x11b567
movl $0x1, -0x24(%rbp)
movl -0x24(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq