// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/id3.c
// Function: decode_flacpicture
static void decode_flacpicture(deark *c, id3v2ctx *d, dbuf *f,
	i64 pos1, i64 len)
{
	u32 picture_type;
	i64 pos = pos1;
	i64 pic_data_len;
	i64 stringlen;
	de_ucstring *mimetype = NULL;
	de_ucstring *description = NULL;
	const struct apic_type_info *ptinfo = NULL;

	picture_type = (u32)dbuf_getu32be_p(f, &pos);
	if(picture_type<=0xff) {
		ptinfo = get_apic_type_info((u8)picture_type);
	}
	de_dbg(c, "picture type: 0x%04x (%s)", (unsigned int)picture_type,
		ptinfo?ptinfo->name:"?");

	stringlen = dbuf_getu32be_p(f, &pos);
	mimetype = ucstring_create(c);
	dbuf_read_to_ucstring_n(f, pos, stringlen, 256, mimetype, 0, DE_ENCODING_UTF8);
	de_dbg(c, "mime type: \"%s\"", ucstring_getpsz_d(mimetype));
	pos += stringlen;

	stringlen = dbuf_getu32be_p(f, &pos);
	description = ucstring_create(c);
	dbuf_read_to_ucstring_n(f, pos, stringlen, 512, description, 0, DE_ENCODING_UTF8);
	de_dbg(c, "description: \"%s\"", ucstring_getpsz_d(description));
	pos += stringlen;

	pos += 4; // width
	pos += 4; // height
	pos += 4; // bits/pixel
	pos += 4; // # palette entries
	pic_data_len = dbuf_getu32be_p(f, &pos);
	de_dbg(c, "picture size: %u", (unsigned int)pic_data_len);
	if(pos+pic_data_len > pos1+len) goto done;
	extract_pic_apic(c, d, f, pos, pic_data_len, ptinfo);

done:
	ucstring_destroy(mimetype);
	ucstring_destroy(description);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %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, -0x38(%rbp)
movq $0x0, -0x50(%rbp)
movq $0x0, -0x58(%rbp)
movq $0x0, -0x60(%rbp)
movq -0x18(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x1654b0
movl %eax, -0x2c(%rbp)
cmpl $0xff, -0x2c(%rbp)
ja 0xabbe7
movl -0x2c(%rbp), %eax
movzbl %al, %edi
callq 0xab710
movq %rax, -0x60(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x70(%rbp)
movl -0x2c(%rbp), %eax
movl %eax, -0x64(%rbp)
cmpq $0x0, -0x60(%rbp)
je 0xabc0a
movq -0x60(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x78(%rbp)
jmp 0xabc17
leaq 0x10c01c(%rip), %rax    # 0x1b7c2d
movq %rax, -0x78(%rbp)
jmp 0xabc17
movl -0x64(%rbp), %edx
movq -0x70(%rbp), %rdi
movq -0x78(%rbp), %rcx
leaq 0x108152(%rip), %rsi    # 0x1b3d7b
movb $0x0, %al
callq 0x15b0d0
movq -0x18(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x1654b0
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1711d0
movq %rax, -0x50(%rbp)
movq -0x18(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq -0x50(%rbp), %r8
movl $0x100, %ecx            # imm = 0x100
xorl %r9d, %r9d
movl $0x2, (%rsp)
callq 0x166a40
movq -0x8(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x50(%rbp), %rdi
callq 0x172650
movq -0x88(%rbp), %rdi
movq %rax, %rdx
leaq 0x107a97(%rip), %rsi    # 0x1b372e
movb $0x0, %al
callq 0x15b0d0
movq -0x48(%rbp), %rax
addq -0x38(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x1654b0
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1711d0
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq -0x58(%rbp), %r8
movl $0x200, %ecx            # imm = 0x200
xorl %r9d, %r9d
movl $0x2, (%rsp)
callq 0x166a40
movq -0x8(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x58(%rbp), %rdi
callq 0x172650
movq -0x80(%rbp), %rdi
movq %rax, %rdx
leaq 0x107a11(%rip), %rsi    # 0x1b371c
movb $0x0, %al
callq 0x15b0d0
movq -0x48(%rbp), %rax
addq -0x38(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x1654b0
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rax
movl %eax, %edx
leaq 0x107ffa(%rip), %rsi    # 0x1b3d6a
movb $0x0, %al
callq 0x15b0d0
movq -0x38(%rbp), %rax
addq -0x40(%rbp), %rax
movq -0x20(%rbp), %rcx
addq -0x28(%rbp), %rcx
cmpq %rcx, %rax
jle 0xabd8e
jmp 0xabdab
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x38(%rbp), %rcx
movq -0x40(%rbp), %r8
movq -0x60(%rbp), %r9
callq 0xab780
movq -0x50(%rbp), %rdi
callq 0x171750
movq -0x58(%rbp), %rdi
callq 0x171750
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)