// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/mmm.c
// Function: do_mmm_CURS
static void do_mmm_CURS(deark *c, struct mmm_ctx *d, struct de_iffctx *ictx, i64 pos1, i64 len)
{
	i64 pos = pos1;
	de_bitmap *img_fg = NULL;
	de_bitmap *img_mask = NULL;
	de_finfo *fi = NULL;

	mmm_read_rsrcid_p(c, d, ictx, &pos, NULL);
	mmm_read_name_p(c, d, ictx, &pos, NULL);
	if(pos1+len-pos < 68) goto done;

	fi = de_finfo_create(c);

	img_fg = de_bitmap_create(c, 16, 16, 2);
	img_mask = de_bitmap_create(c, 16, 16, 1);

	de_dbg(c, "foreground at %"I64_FMT, pos);
	de_convert_image_bilevel(c->infile, pos, 2, img_fg, DE_CVTF_WHITEISZERO);
	pos += 32;
	de_dbg(c, "mask at %"I64_FMT, pos);
	de_convert_image_bilevel(c->infile, pos, 2, img_mask, 0);
	pos += 32;
	de_bitmap_apply_mask(img_fg, img_mask, 0);

	fi->hotspot_y = (int)de_geti16be_p(&pos);
	fi->hotspot_x = (int)de_geti16be_p(&pos);
	fi->has_hotspot = 1;
	de_dbg(c, "hotspot: (%d,%d)", fi->hotspot_x, fi->hotspot_y);

	if(!c->filenames_from_file) ucstring_empty(d->tmp_namestr);
	if(ucstring_isnonempty(d->tmp_namestr)) {
		ucstring_append_char(d->tmp_namestr, '.');
	}
	ucstring_append_sz(d->tmp_namestr, "CURS", DE_ENCODING_LATIN1);
	de_finfo_set_name_from_ucstring(c, fi, d->tmp_namestr, 0);
	de_bitmap_write_to_file_finfo(img_fg, fi, DE_CREATEFLAG_OPT_IMAGE);

done:
	de_bitmap_destroy(img_fg);
	de_bitmap_destroy(img_mask);
	de_finfo_destroy(c, fi);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
leaq -0x30(%rbp), %rcx
xorl %eax, %eax
movl %eax, %r8d
callq 0xdf600
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
leaq -0x30(%rbp), %rcx
xorl %eax, %eax
movl %eax, %r8d
callq 0xdf680
movq -0x20(%rbp), %rax
addq -0x28(%rbp), %rax
subq -0x30(%rbp), %rax
cmpq $0x44, %rax
jge 0xdf3c7
jmp 0xdf580
movq -0x8(%rbp), %rdi
callq 0x15d230
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rdi
movl $0x10, %edx
movl $0x2, %ecx
movq %rdx, %rsi
callq 0x16b750
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movl $0x10, %edx
movl $0x1, %ecx
movq %rdx, %rsi
callq 0x16b750
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rdx
leaq 0xdb5d8(%rip), %rsi     # 0x1ba9ef
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x30(%rbp), %rsi
movq -0x38(%rbp), %rcx
movl $0x2, %edx
movl $0x1, %r8d
callq 0x16bee0
movq -0x30(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rdx
leaq 0xe6d6e(%rip), %rsi     # 0x1c61c7
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x30(%rbp), %rsi
movq -0x40(%rbp), %rcx
movl $0x2, %edx
xorl %r8d, %r8d
callq 0x16bee0
movq -0x30(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x30(%rbp)
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rsi
xorl %edx, %edx
callq 0x16cf60
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x30(%rbp), %rsi
callq 0x1653b0
movl %eax, %ecx
movq -0x48(%rbp), %rax
movl %ecx, 0x9c(%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x30(%rbp), %rsi
callq 0x1653b0
movl %eax, %ecx
movq -0x48(%rbp), %rax
movl %ecx, 0x98(%rax)
movq -0x48(%rbp), %rax
movb $0x1, 0xe(%rax)
movq -0x8(%rbp), %rdi
movq -0x48(%rbp), %rax
movl 0x98(%rax), %edx
movq -0x48(%rbp), %rax
movl 0x9c(%rax), %ecx
leaq 0xdb508(%rip), %rsi     # 0x1baa01
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
cmpb $0x0, 0xd0(%rax)
jne 0xdf51a
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x171210
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x1717f0
cmpl $0x0, %eax
je 0xdf53e
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
movl $0x2e, %esi
callq 0x1714c0
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
leaq 0xdce60(%rip), %rsi     # 0x1bc3ad
movl $0x5, %edx
callq 0x1715e0
movq -0x8(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdx
xorl %ecx, %ecx
callq 0x15d2c0
movq -0x38(%rbp), %rdi
movq -0x48(%rbp), %rsi
movl $0x2, %edx
callq 0x16afa0
movq -0x38(%rbp), %rdi
callq 0x16af60
movq -0x40(%rbp), %rdi
callq 0x16af60
movq -0x8(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x15d260
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)