// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/insetpix.c
// Function: do_image_info
static void do_image_info(deark *c, lctx *d)
{
	i64 pos1;
	i64 pos;
	int saved_indent_level;

	de_dbg_indent_save(c, &saved_indent_level);
	pos1 = d->imginfo_pos;
	if(!pos1 || d->imginfo_len<32) goto done;

	de_dbg(c, "image information at %"I64_FMT, pos1);
	de_dbg_indent(c, 1);
	pos = pos1;

	d->hmode = de_getbyte_p(&pos);
	de_dbg(c, "hardware mode: %u", (UI)d->hmode);

	d->htype = de_getbyte_p(&pos);
	d->graphics_type = d->htype & 0x01;
	d->board_type = d->htype & 0xfe;
	de_dbg(c, "htype: 0x%02x", (UI)d->htype);
	de_dbg_indent(c, 1);
	de_dbg(c, "board type: %u (%s)", (UI)d->board_type,
		get_board_type_name(d->board_type));
	de_dbg(c, "graphics type: %u (%s)", (UI)d->graphics_type,
		d->graphics_type?"bitmap":"character");
	de_dbg_indent(c, -1);

	if(d->graphics_type==0) {
		pos = pos1 + 5;
		d->w_in_chars = (i64)de_getbyte_p(&pos);
		d->h_in_chars = (i64)de_getbyte_p(&pos);
		de_dbg(c, "dimensions: %u"DE_CHAR_TIMES"%u characters",
			(UI)d->w_in_chars, (UI)d->h_in_chars);
	}

	if(d->graphics_type==1) {
		pos = pos1 + 18;
		d->npwidth = de_getu16le_p(&pos);
		d->height = de_getu16le_p(&pos);
		de_dbg_dimensions(c, d->npwidth, d->height);

		d->gfore = (i64)de_getbyte_p(&pos);
		de_dbg(c, "foreground color bits: %d", (int)d->gfore);
		d->max_sample_value = de_pow2(d->gfore) -1;
	}

	pos = pos1 + 25;
	d->descriptor_combined = (u32)de_getu32be_p(&pos);
	d->pal_sample_descriptor[0] = (u8)(d->descriptor_combined>>24);
	d->pal_sample_descriptor[1] = (u8)((d->descriptor_combined>>16) & 0xff);
	d->pal_sample_descriptor[2] = (u8)((d->descriptor_combined>>8) & 0xff);
	d->pal_sample_descriptor[3] = (u8)(d->descriptor_combined & 0xff);
	de_dbg(c, "palette descriptor (IRGB): %u,%u,%u,%u",
		(UI)d->pal_sample_descriptor[0], (UI)d->pal_sample_descriptor[1],
		(UI)d->pal_sample_descriptor[2], (UI)d->pal_sample_descriptor[3]);

	pos++; // "pages"
	d->haspect = de_getbyte_p(&pos);
	d->vaspect = de_getbyte_p(&pos);
	de_dbg(c, "aspect ratio: %d"DE_CHAR_TIMES"%d", (int)d->haspect, (int)d->vaspect);

	d->have_image_info = 1;
done:
	de_dbg_indent_restore(c, saved_indent_level);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x24(%rbp), %rsi
callq 0x15b580
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0xb7c6b
movq -0x10(%rbp), %rax
cmpq $0x20, 0x18(%rax)
jge 0xb7c70
jmp 0xb805f
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq 0xfd79f(%rip), %rsi     # 0x1b541e
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x20(%rbp), %rsi
callq 0x165170
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, 0x4(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movzbl 0x4(%rax), %edx
leaq 0xfd76e(%rip), %rsi     # 0x1b5437
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x20(%rbp), %rsi
callq 0x165170
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, 0x5(%rax)
movq -0x10(%rbp), %rax
movzbl 0x5(%rax), %eax
andl $0x1, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, 0x6(%rax)
movq -0x10(%rbp), %rax
movzbl 0x5(%rax), %eax
andl $0xfe, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, 0x7(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movzbl 0x5(%rax), %edx
leaq 0xfd722(%rip), %rsi     # 0x1b5449
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movzbl 0x7(%rax), %eax
movl %eax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movzbl 0x7(%rax), %edi
callq 0xb8c80
movq -0x30(%rbp), %rdi
movl -0x28(%rbp), %edx
movq %rax, %rcx
leaq 0xfd6ea(%rip), %rsi     # 0x1b5457
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movzbl 0x6(%rax), %edx
movq -0x10(%rbp), %rax
movzbl 0x6(%rax), %esi
leaq 0xfd6f3(%rip), %rcx     # 0x1b5482
leaq 0xeb90e(%rip), %rax     # 0x1a36a4
cmpl $0x0, %esi
cmovneq %rax, %rcx
leaq 0xfd6c7(%rip), %rsi     # 0x1b546b
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
movq -0x10(%rbp), %rax
movzbl 0x6(%rax), %eax
cmpl $0x0, %eax
jne 0xb7e34
movq -0x18(%rbp), %rax
addq $0x5, %rax
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x20(%rbp), %rsi
callq 0x165170
movzbl %al, %eax
movl %eax, %ecx
movq -0x10(%rbp), %rax
movq %rcx, 0x70(%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x20(%rbp), %rsi
callq 0x165170
movzbl %al, %eax
movl %eax, %ecx
movq -0x10(%rbp), %rax
movq %rcx, 0x78(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rax
movl %eax, %edx
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rax
movl %eax, %ecx
leaq 0xfd65f(%rip), %rsi     # 0x1b548c
movb $0x0, %al
callq 0x15b0d0
movq -0x10(%rbp), %rax
movzbl 0x6(%rax), %eax
cmpl $0x1, %eax
jne 0xb7f04
movq -0x18(%rbp), %rax
addq $0x12, %rax
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x20(%rbp), %rsi
callq 0x1652c0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x58(%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x20(%rbp), %rsi
callq 0x1652c0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x68(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rdx
callq 0x15bba0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x20(%rbp), %rsi
callq 0x165170
movzbl %al, %eax
movl %eax, %ecx
movq -0x10(%rbp), %rax
movq %rcx, 0x80(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x80(%rax), %rax
movl %eax, %edx
leaq 0xfd5cf(%rip), %rsi     # 0x1b54aa
movb $0x0, %al
callq 0x15b0d0
movq -0x10(%rbp), %rax
movq 0x80(%rax), %rdi
callq 0x15ce50
movq %rax, %rcx
subq $0x1, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x88(%rax)
movq -0x18(%rbp), %rax
addq $0x19, %rax
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x20(%rbp), %rsi
callq 0x1654b0
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x94(%rax)
movq -0x10(%rbp), %rax
movl 0x94(%rax), %eax
shrl $0x18, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, 0x90(%rax)
movq -0x10(%rbp), %rax
movl 0x94(%rax), %eax
shrl $0x10, %eax
andl $0xff, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, 0x91(%rax)
movq -0x10(%rbp), %rax
movl 0x94(%rax), %eax
shrl $0x8, %eax
andl $0xff, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, 0x92(%rax)
movq -0x10(%rbp), %rax
movl 0x94(%rax), %eax
andl $0xff, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, 0x93(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movzbl 0x90(%rax), %edx
movq -0x10(%rbp), %rax
movzbl 0x91(%rax), %ecx
movq -0x10(%rbp), %rax
movzbl 0x92(%rax), %r8d
movq -0x10(%rbp), %rax
movzbl 0x93(%rax), %r9d
leaq 0xfd4ee(%rip), %rsi     # 0x1b54c4
movb $0x0, %al
callq 0x15b0d0
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x20(%rbp), %rsi
callq 0x165170
movzbl %al, %eax
movl %eax, %ecx
movq -0x10(%rbp), %rax
movq %rcx, 0x98(%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x20(%rbp), %rsi
callq 0x165170
movzbl %al, %eax
movl %eax, %ecx
movq -0x10(%rbp), %rax
movq %rcx, 0xa0(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x98(%rax), %rax
movl %eax, %edx
movq -0x10(%rbp), %rax
movq 0xa0(%rax), %rax
movl %eax, %ecx
leaq 0xfd49b(%rip), %rsi     # 0x1b54eb
movb $0x0, %al
callq 0x15b0d0
movq -0x10(%rbp), %rax
movb $0x1, 0x8(%rax)
movq -0x8(%rbp), %rdi
movl -0x24(%rbp), %esi
callq 0x15b5a0
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)