// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/asf.c
// Function: do_metadata_entry
static int do_metadata_entry(deark *c, lctx *d, struct handler_params *hp,
	i64 pos1, i64 len, i64 *bytes_consumed)
{
	i64 pos = pos1;
	struct de_stringreaderdata *name_srd = NULL;
	i64 namelen;
	i64 namelen_to_keep;
	unsigned int val_data_type;
	i64 val_len;
	i64 stream_number;
	int retval = 0;
	int saved_indent_level;

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

	if(len<14) goto done;

	if(hp->uui->short_id==SID_METADATALIB) {
		i64 lang_list_idx;
		lang_list_idx = de_getu16le(pos);
		de_dbg(c, "language list index: %d", (int)lang_list_idx);
	}
	pos += 2; // Lang list index, or reserved

	stream_number = de_getu16le_p(&pos);
	de_dbg(c, "stream number: %d", (int)stream_number);

	namelen = de_getu16le_p(&pos); // # of bytes, including the expected 0x00 0x00 terminator

	val_data_type = (unsigned int)de_getu16le_p(&pos);
	de_dbg(c, "value data type: %u (%s)", val_data_type,
		get_metadata_dtype_name(val_data_type));

	val_len = de_getu32le_p(&pos);

	namelen_to_keep = namelen-2;
	if(namelen_to_keep<0) namelen_to_keep=0;
	if(namelen_to_keep>256) namelen_to_keep=256;
	name_srd = dbuf_read_string(c->infile, pos, namelen_to_keep, namelen_to_keep,
		DE_CONVFLAG_WANT_UTF8, DE_ENCODING_UTF16LE);
	de_dbg(c, "name: \"%s\"", ucstring_getpsz_d(name_srd->str));
	pos += namelen;

	do_metadata_item(c, d, pos, val_len, val_data_type, name_srd, hp->uui->short_id);

	pos += val_len;

	*bytes_consumed = pos-pos1;
	retval = 1;
done:
	de_dbg_indent_restore(c, saved_indent_level);
	de_destroy_stringreaderdata(c, name_srd);
	return retval;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
movl $0x0, -0x6c(%rbp)
movq -0x30(%rbp), %rax
movq $0x0, (%rax)
movq -0x8(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x15b580
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq 0x1799a9(%rip), %rsi    # 0x19e8ba
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
cmpq $0xe, -0x28(%rbp)
jge 0x24f32
jmp 0x250f8
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
cmpl $0x134, (%rax)          # imm = 0x134
jne 0x24f6f
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x38(%rbp), %rsi
callq 0x165280
movq %rax, -0x78(%rbp)
movq -0x8(%rbp), %rdi
movq -0x78(%rbp), %rax
movl %eax, %edx
leaq 0x179969(%rip), %rsi    # 0x19e8d1
movb $0x0, %al
callq 0x15b0d0
movq -0x38(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x38(%rbp), %rsi
callq 0x1652c0
movq %rax, -0x68(%rbp)
movq -0x8(%rbp), %rdi
movq -0x68(%rbp), %rax
movl %eax, %edx
leaq 0x179948(%rip), %rsi    # 0x19e8e9
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x38(%rbp), %rsi
callq 0x1652c0
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x38(%rbp), %rsi
callq 0x1652c0
movl %eax, -0x54(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x88(%rbp)
movl -0x54(%rbp), %eax
movl %eax, -0x7c(%rbp)
movl -0x54(%rbp), %edi
callq 0x25120
movq -0x88(%rbp), %rdi
movl -0x7c(%rbp), %edx
movq %rax, %rcx
leaq 0x1797e9(%rip), %rsi    # 0x19e7e7
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x38(%rbp), %rsi
callq 0x165580
movq %rax, -0x60(%rbp)
movq -0x48(%rbp), %rax
subq $0x2, %rax
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
jge 0x25035
movq $0x0, -0x50(%rbp)
cmpq $0x100, -0x50(%rbp)     # imm = 0x100
jle 0x25047
movq $0x100, -0x50(%rbp)     # imm = 0x100
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x38(%rbp), %rsi
movq -0x50(%rbp), %rdx
movq -0x50(%rbp), %rcx
movl $0x10, %r8d
movl $0x3, %r9d
callq 0x1664c0
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x40(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x172650
movq -0x90(%rbp), %rdi
movq %rax, %rdx
leaq 0x189137(%rip), %rsi    # 0x1ae1d0
movb $0x0, %al
callq 0x15b0d0
movq -0x48(%rbp), %rax
addq -0x38(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x38(%rbp), %rdx
movq -0x60(%rbp), %rcx
movl -0x54(%rbp), %r8d
movq -0x40(%rbp), %r9
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movl (%rax), %eax
movl %eax, (%rsp)
callq 0x25160
movq -0x60(%rbp), %rax
addq -0x38(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rcx
subq -0x20(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
movl $0x1, -0x6c(%rbp)
movq -0x8(%rbp), %rdi
movl -0x70(%rbp), %esi
callq 0x15b5a0
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x166830
movl -0x6c(%rbp), %eax
addq $0xa0, %rsp
popq %rbp
retq
nopl (%rax)