// File: /workspace/github_c_makefile_star2_O3/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, 0x18(%rsp)
movq %r8, %rbp
movq %rcx, %rbx
movq %rdx, 0x20(%rsp)
movq %rsi, 0x10(%rsp)
movq %rdi, %r12
leaq 0x1(%rdx), %rax
leaq 0x28(%rsp), %r15
movq %rax, (%r15)
movq 0x18(%rdi), %rdi
movq %r15, %rsi
callq 0xeeb4b
movzbl %al, %r13d
movq 0x18(%r12), %rdi
movq %r15, %rsi
callq 0xeebeb
movq %rax, %r14
movq %rbp, %rdi
callq 0xf6423
movq 0x18(%r12), %rdi
movq (%r15), %rsi
movq %r13, %rdx
movq %rbp, %rcx
xorl %r8d, %r8d
movl $0x1, %r9d
callq 0xefbd7
movq %rbp, %rdi
callq 0xf70f6
leaq 0x7f6ec(%rip), %rsi     # 0x12277b
movq %r12, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
movq (%r15), %rax
leaq (%rax,%r13), %rbp
addq %rax, %r13
incq %r13
movq %r13, (%r15)
leaq 0x8facd(%rip), %rsi     # 0x132b80
movq %r12, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0xe8617
xorl %eax, %eax
movq %r14, 0x8(%rsp)
leaq (%r14,%rbp), %r15
incq %r15
movq 0x20(%rsp), %rbp
addq %rbp, %rbx
cmpq %rbx, %r15
jg 0xa31a1
movq 0x18(%r12), %rdi
leaq 0x28(%rsp), %rsi
callq 0xeebeb
movq %rax, %rbx
leaq 0x89059(%rip), %rcx     # 0x12c151
cmpl $0xfff8, %ebx           # imm = 0xFFF8
jle 0xa3121
cmpl $0xfff9, %ebx           # imm = 0xFFF9
je 0xa313a
cmpl $0xfffd, %ebx           # imm = 0xFFFD
je 0xa3143
cmpl $0xfffe, %ebx           # imm = 0xFFFE
jne 0xa3153
leaq 0x9d29a(%rip), %rcx     # 0x1403b9
jmp 0xa3153
cmpl $0xffde, %ebx           # imm = 0xFFDE
je 0xa314c
cmpl $0xffdf, %ebx           # imm = 0xFFDF
jne 0xa3153
leaq 0x8fa72(%rip), %rcx     # 0x132baa
jmp 0xa3153
leaq 0x81e99(%rip), %rcx     # 0x124fda
jmp 0xa3153
leaq 0x89bb1(%rip), %rcx     # 0x12ccfb
jmp 0xa3153
leaq 0x8fa41(%rip), %rcx     # 0x132b94
leaq 0x8a6f2(%rip), %rsi     # 0x12d84c
movq %r12, %rdi
movl %ebx, %edx
xorl %eax, %eax
callq 0xe8617
addq $0x2, %r13
movq 0x8(%rsp), %r8
addq $-0x2, %r8
movl $0x0, (%rsp)
leaq 0x30(%rsp), %r9
movq %r12, %rdi
movq 0x10(%rsp), %rsi
movl %ebx, %edx
movq %r13, %rcx
callq 0xa31b0
subq %rbp, %r15
movq 0x18(%rsp), %rax
movq %r15, (%rax)
movl $0x1, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq