// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/asf.c
// Function: do_codec_entry
static int do_codec_entry(deark *c, lctx *d, i64 pos1, i64 len, i64 *bytes_consumed)
{
	de_ucstring *name = NULL;
	de_ucstring *descr = NULL;
	unsigned int type;
	i64 namelen, descrlen, infolen;
	i64 pos = pos1;
	int retval = 0;
	int saved_indent_level;

	*bytes_consumed = 0;
	de_dbg_indent_save(c, &saved_indent_level);
	de_dbg(c, "codec entry at %"I64_FMT, pos1);
	de_dbg_indent(c, 1);

	if(len<8) goto done;
	type = (unsigned int)de_getu16le_p(&pos);
	de_dbg(c, "type: %u (%s)", type, get_codec_type_name(type));

	namelen = de_getu16le_p(&pos);
	name = ucstring_create(c);
	dbuf_read_to_ucstring_n(c->infile, pos, namelen*2, DE_DBG_MAX_STRLEN*2, name,
		0, DE_ENCODING_UTF16LE);
	ucstring_truncate_at_NUL(name);
	de_dbg(c, "name: \"%s\"", ucstring_getpsz(name));
	pos += namelen*2;

	descrlen = de_getu16le_p(&pos);
	descr = ucstring_create(c);
	dbuf_read_to_ucstring_n(c->infile, pos, descrlen*2, DE_DBG_MAX_STRLEN*2, descr,
		0, DE_ENCODING_UTF16LE);
	ucstring_truncate_at_NUL(descr);
	de_dbg(c, "description: \"%s\"", ucstring_getpsz(descr));
	pos += descrlen*2;

	infolen = de_getu16le_p(&pos);
	if(infolen>0) {
		de_dbg(c, "[%d bytes of codec information at %"I64_FMT"]", (int)infolen, pos);
		de_dbg_indent(c, 1);
		de_dbg_hexdump(c, c->infile, pos, infolen, 256, NULL, 0x1);
		de_dbg_indent(c, -1);
	}
	pos += infolen;

	*bytes_consumed = pos-pos1;
	retval = 1;
done:
	de_dbg_indent_restore(c, saved_indent_level);
	ucstring_destroy(name);
	ucstring_destroy(descr);
	return retval;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x60(%rbp)
movl $0x0, -0x64(%rbp)
movq -0x28(%rbp), %rax
movq $0x0, (%rax)
movq -0x8(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x15b580
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq 0x179ce2(%rip), %rsi    # 0x19e6f7
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
cmpq $0x8, -0x20(%rbp)
jge 0x24a36
jmp 0x24c35
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x60(%rbp), %rsi
callq 0x1652c0
movl %eax, -0x3c(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x88(%rbp)
movl -0x3c(%rbp), %eax
movl %eax, -0x7c(%rbp)
movl -0x3c(%rbp), %edi
callq 0x24c60
movq -0x88(%rbp), %rdi
movl -0x7c(%rbp), %edx
movq %rax, %rcx
leaq 0x179d7b(%rip), %rsi    # 0x19e7f2
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x60(%rbp), %rsi
callq 0x1652c0
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1711d0
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x60(%rbp), %rsi
movq -0x48(%rbp), %rdx
shlq %rdx
movq -0x30(%rbp), %r8
movl $0x3e8, %ecx            # imm = 0x3E8
xorl %r9d, %r9d
movl $0x3, (%rsp)
callq 0x166a40
movq -0x30(%rbp), %rdi
callq 0x1712b0
movq -0x8(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x30(%rbp), %rdi
callq 0x172500
movq -0x78(%rbp), %rdi
movq %rax, %rdx
leaq 0x1896dd(%rip), %rsi    # 0x1ae1d0
movb $0x0, %al
callq 0x15b0d0
movq -0x48(%rbp), %rax
shlq %rax
addq -0x60(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x60(%rbp), %rsi
callq 0x1652c0
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1711d0
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x60(%rbp), %rsi
movq -0x50(%rbp), %rdx
shlq %rdx
movq -0x38(%rbp), %r8
movl $0x3e8, %ecx            # imm = 0x3E8
xorl %r9d, %r9d
movl $0x3, (%rsp)
callq 0x166a40
movq -0x38(%rbp), %rdi
callq 0x1712b0
movq -0x8(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x38(%rbp), %rdi
callq 0x172500
movq -0x70(%rbp), %rdi
movq %rax, %rdx
leaq 0x18eb9e(%rip), %rsi    # 0x1b371c
movb $0x0, %al
callq 0x15b0d0
movq -0x50(%rbp), %rax
shlq %rax
addq -0x60(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x60(%rbp), %rsi
callq 0x1652c0
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x58(%rbp)
jle 0x24c13
movq -0x8(%rbp), %rdi
movq -0x58(%rbp), %rax
movl %eax, %edx
movq -0x60(%rbp), %rcx
leaq 0x179b45(%rip), %rsi    # 0x19e70a
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rsi
movq -0x60(%rbp), %rdx
movq -0x58(%rbp), %rcx
movl $0x100, %r8d            # imm = 0x100
xorl %eax, %eax
movl %eax, %r9d
movl $0x1, (%rsp)
callq 0x15b840
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
movq -0x58(%rbp), %rax
addq -0x60(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rcx
subq -0x18(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movl $0x1, -0x64(%rbp)
movq -0x8(%rbp), %rdi
movl -0x68(%rbp), %esi
callq 0x15b5a0
movq -0x30(%rbp), %rdi
callq 0x171750
movq -0x38(%rbp), %rdi
callq 0x171750
movl -0x64(%rbp), %eax
addq $0x90, %rsp
popq %rbp
retq
nop