// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/iff.c
// Function: do_RGFX_RGHD
static void do_RGFX_RGHD(deark *c, struct rgfx_ctx *d, struct de_iffctx *ictx)
{
	i64 pos = ictx->chunkctx->dpos;
	const char *name;

	if(ictx->chunkctx->dlen<52) goto done;
	pos += 8;
	d->width = dbuf_getu32be_p(ictx->f, &pos);
	d->height = dbuf_getu32be_p(ictx->f, &pos);
	de_dbg_dimensions(c, d->width, d->height);
	pos += 8;
	d->depth = dbuf_getu32be_p(ictx->f, &pos);
	de_dbg(c, "depth: %u", (UI)d->depth);
	d->pixelbits = dbuf_getu32be_p(ictx->f, &pos);
	de_dbg(c, "PixelBits: %u", (UI)d->pixelbits);
	d->rowspan = dbuf_getu32be_p(ictx->f, &pos);
	de_dbg(c, "bytes/line: %u", (UI)d->rowspan);
	d->rgfx_cmpr_meth = (u32)dbuf_getu32be_p(ictx->f, &pos);
	switch(d->rgfx_cmpr_meth) {
	case 0: name="uncompressed"; break;
	case 1: name="XPK"; break;
	case 2: name="ZIP"; break;
	default: name = "?";
	}
	de_dbg(c, "cmpr method: %u (%s)", (UI)d->rgfx_cmpr_meth, name);
	pos += 8; // TODO: aspect
	d->bitmaptype = (UI)dbuf_getu32be_p(ictx->f, &pos);
	de_dbg(c, "BitMapType: 0x%08x", d->bitmaptype);

	d->found_RGHD = 1;
done:
	;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq 0x128(%rax), %rax
movq 0x40(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq 0x128(%rax), %rax
cmpq $0x34, 0x48(%rax)
jge 0xaeaee
jmp 0xaeccf
movq -0x20(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x20(%rbp), %rsi
movq %rsi, -0x38(%rbp)
callq 0x1654b0
movq -0x38(%rbp), %rsi
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x1654b0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
movq 0x18(%rax), %rdx
callq 0x15bba0
movq -0x38(%rbp), %rsi
movq -0x20(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x1654b0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x28(%rax), %edx
leaq 0x100f05(%rip), %rsi    # 0x1afa8a
xorl %eax, %eax
movb %al, -0x39(%rbp)
callq 0x15b0d0
movq -0x38(%rbp), %rsi
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x1654b0
movq %rax, %rdx
movb -0x39(%rbp), %al
movq -0x10(%rbp), %rcx
movq %rdx, 0x30(%rcx)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rcx
movl 0x30(%rcx), %edx
leaq 0x1055a3(%rip), %rsi    # 0x1b4163
callq 0x15b0d0
movq -0x38(%rbp), %rsi
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x1654b0
movq %rax, %rdx
movb -0x39(%rbp), %al
movq -0x10(%rbp), %rcx
movq %rdx, 0x38(%rcx)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rcx
movl 0x38(%rcx), %edx
leaq 0x10557b(%rip), %rsi    # 0x1b4171
callq 0x15b0d0
movq -0x38(%rbp), %rsi
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x1654b0
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x2c(%rbp)
testl %eax, %eax
je 0xaec39
jmp 0xaec25
movl -0x2c(%rbp), %eax
subl $0x1, %eax
je 0xaec46
jmp 0xaec2f
movl -0x2c(%rbp), %eax
subl $0x2, %eax
je 0xaec53
jmp 0xaec60
leaq 0x1271f8(%rip), %rax    # 0x1d5e38
movq %rax, -0x28(%rbp)
jmp 0xaec6b
leaq 0x105410(%rip), %rax    # 0x1b405d
movq %rax, -0x28(%rbp)
jmp 0xaec6b
leaq 0x102e72(%rip), %rax    # 0x1b1acc
movq %rax, -0x28(%rbp)
jmp 0xaec6b
leaq 0x108fc6(%rip), %rax    # 0x1b7c2d
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x8(%rax), %edx
movq -0x28(%rbp), %rcx
leaq 0x1054ff(%rip), %rsi    # 0x1b4180
movb $0x0, %al
callq 0x15b0d0
movq -0x20(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x20(%rbp), %rsi
callq 0x1654b0
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x20(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x20(%rax), %edx
leaq 0x1054d5(%rip), %rsi    # 0x1b4195
movb $0x0, %al
callq 0x15b0d0
movq -0x10(%rbp), %rax
movb $0x1, 0x2(%rax)
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)