// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/sunras.c
// Function: read_header
static void read_header(deark *c, lctx *d, i64 pos)
{
	de_dbg(c, "header at %"I64_FMT, pos);
	de_dbg_indent(c, 1);

	d->npwidth = de_getu32be(pos+4);
	d->height = de_getu32be(pos+8);
	de_dbg_dimensions(c, d->npwidth, d->height);

	d->depth = (UI)de_getu32be(pos+12);
	de_dbg(c, "depth: %u", d->depth);

	d->imglen = de_getu32be(pos+16);
	d->imgtype = (UI)de_getu32be(pos+20);
	de_dbg(c, "image type=%u (%s), len=%"I64_FMT, d->imgtype,
		get_image_type_name(d->imgtype), d->imglen);
	if(d->imgtype==RT_BYTE_ENCODED) {
		d->is_compressed = 1;
	}
	if(d->imgtype==RT_FORMAT_RGB) {
		d->is_rgb_order = 1;
	}

	d->maptype = (UI)de_getu32be(pos+24);
	d->maplen = de_getu32be(pos+28);
	de_dbg(c, "map type=%u (%s), len=%"I64_FMT, d->maptype,
		get_map_type_name(d->maptype), d->maplen);

	de_dbg_indent(c, -1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq 0x871d0(%rip), %rsi     # 0x1aed63
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
addq $0x4, %rsi
callq 0x165470
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
addq $0x8, %rsi
callq 0x165470
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdx
callq 0x15bba0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
addq $0xc, %rsi
callq 0x165470
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x18(%rax), %edx
leaq 0x87e5b(%rip), %rsi     # 0x1afa8a
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
addq $0x10, %rsi
callq 0x165470
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x38(%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
addq $0x14, %rsi
callq 0x165470
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x1c(%rax)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movl 0x1c(%rax), %eax
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movl 0x1c(%rax), %edi
callq 0x128240
movq -0x28(%rbp), %rdi
movl -0x1c(%rbp), %edx
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq 0x38(%rax), %r8
leaq 0x9f436(%rip), %rsi     # 0x1c70e1
movb $0x0, %al
callq 0x15b0d0
movq -0x10(%rbp), %rax
cmpl $0x2, 0x1c(%rax)
jne 0x127cc4
movq -0x10(%rbp), %rax
movb $0x1, 0x20(%rax)
movq -0x10(%rbp), %rax
cmpl $0x3, 0x1c(%rax)
jne 0x127cd6
movq -0x10(%rbp), %rax
movb $0x1, 0x21(%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
addq $0x18, %rsi
callq 0x165470
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x40(%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
addq $0x1c, %rsi
callq 0x165470
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x48(%rax)
movq -0x8(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movl 0x40(%rax), %eax
movl %eax, -0x2c(%rbp)
movq -0x10(%rbp), %rax
movl 0x40(%rax), %edi
callq 0x128300
movq -0x38(%rbp), %rdi
movl -0x2c(%rbp), %edx
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq 0x48(%rax), %r8
leaq 0x9f3b2(%rip), %rsi     # 0x1c70fd
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)