// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/rsc.c
// Function: do_object
static int do_object(deark *c, lctx *d, i64 obj_index, i64 pos)
{
	i64 obj_type_orig;
	u8 obj_type;
	i64 next_sibling, first_child, last_child;
	i64 ob_spec;
	i64 width, height;

	de_dbg(c, "OBJECT #%d at %d", (int)obj_index, (int)pos);
	de_dbg_indent(c, 1);

	next_sibling = gem_getu16m1(d, pos);
	first_child = gem_getu16m1(d, pos+2);
	last_child = gem_getu16m1(d, pos+4);
	de_dbg(c, "next sibling: %d, first child: %d, last child: %d",
		(int)next_sibling, (int)first_child, (int)last_child);

	obj_type_orig = gem_getu16(d, pos+6);
	obj_type = (u8)(obj_type_orig&0xff);

	de_dbg(c, "type: 0x%04x (%u; %s)", (unsigned int)obj_type_orig,
		(unsigned int)obj_type, get_obj_type_name(obj_type));

	ob_spec = gem_getu32(d, pos+12);
	de_dbg(c, "ob_spec: %u (0x%08x)", (unsigned int)ob_spec, (unsigned int)ob_spec);

	// Note: This does not seem to read the width and height fields correctly.
	// Don't know what I'm doing wrong.
	// (Fortunately, we don't necessarily need them.)
	width = gem_getu16(d, pos+20);
	height = gem_getu16(d, pos+22);
	de_dbg_dimensions(c, width, height);

	de_dbg_indent(c, -1);
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movl %eax, %edx
movq -0x20(%rbp), %rax
movl %eax, %ecx
leaq 0xa2db8(%rip), %rsi     # 0x1c6787
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x123b30
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
addq $0x2, %rsi
callq 0x123b30
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
addq $0x4, %rsi
callq 0x123b30
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rax
movl %eax, %edx
movq -0x40(%rbp), %rax
movl %eax, %ecx
movq -0x48(%rbp), %rax
movl %eax, %r8d
leaq 0xa2d5b(%rip), %rsi     # 0x1c6798
movb $0x0, %al
callq 0x15b0d0
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
addq $0x6, %rsi
callq 0x123250
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
andq $0xff, %rax
movb %al, -0x29(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x28(%rbp), %rax
movl %eax, -0x68(%rbp)
movzbl -0x29(%rbp), %eax
movl %eax, -0x64(%rbp)
movzbl -0x29(%rbp), %edi
callq 0x123b70
movq -0x70(%rbp), %rdi
movl -0x68(%rbp), %edx
movl -0x64(%rbp), %ecx
movq %rax, %r8
leaq 0xa2d31(%rip), %rsi     # 0x1c67ca
movb $0x0, %al
callq 0x15b0d0
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
addq $0xc, %rsi
callq 0x123920
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rdi
movq -0x50(%rbp), %rax
movl %eax, %edx
movq -0x50(%rbp), %rax
movl %eax, %ecx
leaq 0xa2d14(%rip), %rsi     # 0x1c67e0
movb $0x0, %al
callq 0x15b0d0
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
addq $0x14, %rsi
callq 0x123250
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
addq $0x16, %rsi
callq 0x123250
movq %rax, -0x60(%rbp)
movq -0x8(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq -0x60(%rbp), %rdx
callq 0x15bba0
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
movl $0x1, %eax
addq $0x70, %rsp
popq %rbp
retq
nopw (%rax,%rax)