// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/os2ea.c
// Function: eadata_do_attribute
static int eadata_do_attribute(deark *c, struct eadata_ctx *d, i64 pos1, i64 maxlen,
	de_ucstring *tmps, i64 *pbytes_consumed)
{
	i64 namelen;
	i64 attr_dpos;
	i64 attr_dlen;
	i64 tmpbc;
	UI attr_dtype;
	i64 pos = pos1;
	int retval = 0;

	pos++; // fEA
	namelen = (i64)de_getbyte_p(&pos);

	attr_dlen = (i64)de_getu16le_p(&pos);
	ucstring_empty(tmps);
	dbuf_read_to_ucstring(c->infile, pos, namelen, tmps, 0, DE_ENCODING_ASCII);
	de_dbg(c, "name: \"%s\"", ucstring_getpsz_d(tmps));
	pos += namelen + 1;
	attr_dpos = pos;
	de_dbg(c, "outer data len: %"I64_FMT, attr_dlen);
	if(attr_dpos + attr_dlen > pos1+maxlen) goto done;

	attr_dtype = (UI)de_getu16le_p(&pos);
	de_dbg(c, "data type: 0x%04x (%s)", attr_dtype, eadata_get_data_type_name(attr_dtype));

	tmpbc = 0;
	eadata_do_attribute_lowlevel(c, d, attr_dtype, attr_dpos+2, attr_dlen-2, &tmpbc, 0);

	pos = attr_dpos + attr_dlen;
	*pbytes_consumed = pos - pos1;
	retval = 1;
done:
	return retval;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r9, 0x20(%rsp)
movq %r8, %rbp
movq %rcx, %rbx
movq %rdx, 0x28(%rsp)
movq %rsi, 0x18(%rsp)
movq %rdi, %r12
leaq 0x1(%rdx), %rax
leaq 0x8(%rsp), %r15
movq %rax, (%r15)
movq 0x18(%rdi), %rdi
movq %r15, %rsi
callq 0xef14d
movzbl %al, %r13d
movq 0x18(%r12), %rdi
movq %r15, %rsi
callq 0xef1ed
movq %rax, %r14
movq %rbp, %rdi
callq 0xf6883
movq 0x18(%r12), %rdi
movq (%r15), %rsi
movq %r13, %rdx
movq %rbp, %rcx
xorl %r8d, %r8d
movl $0x1, %r9d
callq 0xf01b0
movq %rbp, %rdi
callq 0xf7557
leaq 0x7ec2b(%rip), %rsi     # 0x122573
movq %r12, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
movq (%r15), %rax
leaq (%rax,%r13), %rbp
addq %rax, %r13
incq %r13
movq %r13, (%r15)
leaq 0x8ee7c(%rip), %rsi     # 0x1327e8
movq %r12, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0xe9226
xorl %eax, %eax
movq %r14, 0x10(%rsp)
leaq (%r14,%rbp), %r15
incq %r15
movq 0x28(%rsp), %rbp
addq %rbp, %rbx
cmpq %rbx, %r15
jg 0xa3a66
movq 0x18(%r12), %rdi
leaq 0x8(%rsp), %rsi
callq 0xef1ed
movq %rax, %rbx
leaq 0x884b8(%rip), %rcx     # 0x12be69
cmpl $0xfff8, %ebx           # imm = 0xFFF8
jle 0xa39da
cmpl $0xfff9, %ebx           # imm = 0xFFF9
je 0xa39f3
cmpl $0xfffd, %ebx           # imm = 0xFFFD
je 0xa39fc
cmpl $0xfffe, %ebx           # imm = 0xFFFE
jne 0xa3a0c
leaq 0x9c5e1(%rip), %rcx     # 0x13ffb9
jmp 0xa3a0c
cmpl $0xffde, %ebx           # imm = 0xFFDE
je 0xa3a05
cmpl $0xffdf, %ebx           # imm = 0xFFDF
jne 0xa3a0c
leaq 0x8ee21(%rip), %rcx     # 0x132812
jmp 0xa3a0c
leaq 0x813b0(%rip), %rcx     # 0x124daa
jmp 0xa3a0c
leaq 0x89010(%rip), %rcx     # 0x12ca13
jmp 0xa3a0c
leaq 0x8edf0(%rip), %rcx     # 0x1327fc
leaq 0x89b51(%rip), %rsi     # 0x12d564
movq %r12, %rdi
movl %ebx, %edx
xorl %eax, %eax
callq 0xe9226
leaq 0x30(%rsp), %r9
movq $0x0, (%r9)
addq $0x2, %r13
movq 0x10(%rsp), %r8
addq $-0x2, %r8
movl $0x0, (%rsp)
movq %r12, %rdi
movq 0x18(%rsp), %rsi
movl %ebx, %edx
movq %r13, %rcx
callq 0xa3a75
movq %r15, 0x8(%rsp)
subq %rbp, %r15
movq 0x20(%rsp), %rax
movq %r15, (%rax)
movl $0x1, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq