// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/rm.c
// Function: do_chunk_MDPR
static void do_chunk_MDPR(deark *c, lctx *d, struct chunkinfo *ci)
{
	i64 pos = ci->dpos;
	de_ucstring *s = NULL;
	i64 slen;
	i64 n;

	read_chunk_version_p(c, d, ci, &pos);
	if(ci->version != 0) goto done;

	n = de_getu16be_p(&pos);
	de_dbg(c, "stream number: %d", (int)n);

	pos += 7*4; // TODO: other fields

	slen = (i64)de_getbyte_p(&pos);
	s = ucstring_create(c);
	dbuf_read_to_ucstring(c->infile, pos, slen, s, 0, DE_ENCODING_ASCII);
	de_dbg(c, "stream name: \"%s\"", ucstring_getpsz_d(s));
	pos += slen;

	slen = (i64)de_getbyte_p(&pos);
	ucstring_empty(s);
	dbuf_read_to_ucstring(c->infile, pos, slen, s, 0, DE_ENCODING_ASCII);
	de_dbg(c, "mime type: \"%s\"", ucstring_getpsz_d(s));
	pos += slen;

	if(pos+4 > ci->dpos + ci->dlen) goto done;
	n = de_getu32be_p(&pos);
	if(n == 0) goto done;
	de_dbg(c, "type specific data at %"I64_FMT", len=%"I64_FMT, pos, n);
	if(pos+n > ci->dpos + ci->dlen) goto done;
	de_dbg_indent(c, 1);
	de_dbg_hexdump(c, c->infile, pos, n, 256, NULL, 0x1);
	de_dbg_indent(c, -1);

done:
	;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
leaq -0x20(%rbp), %rcx
callq 0x154900
movq -0x18(%rbp), %rax
cmpl $0x0, 0x48(%rax)
je 0x1545ec
jmp 0x1547d6
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x20(%rbp), %rsi
callq 0x165210
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rax
movl %eax, %edx
leaq 0x4a2d7(%rip), %rsi     # 0x19e8e9
movb $0x0, %al
callq 0x15b0d0
movq -0x20(%rbp), %rax
addq $0x1c, %rax
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x20(%rbp), %rsi
callq 0x165170
movzbl %al, %eax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1711d0
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x20(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq -0x28(%rbp), %rcx
xorl %r8d, %r8d
movl $0x1, %r9d
callq 0x1669f0
movq -0x8(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x28(%rbp), %rdi
callq 0x172650
movq -0x48(%rbp), %rdi
movq %rax, %rdx
leaq 0x7cd36(%rip), %rsi     # 0x1d13c1
movb $0x0, %al
callq 0x15b0d0
movq -0x30(%rbp), %rax
addq -0x20(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x20(%rbp), %rsi
callq 0x165170
movzbl %al, %eax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rdi
callq 0x171210
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x20(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq -0x28(%rbp), %rcx
xorl %r8d, %r8d
movl $0x1, %r9d
callq 0x1669f0
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x28(%rbp), %rdi
callq 0x172650
movq -0x40(%rbp), %rdi
movq %rax, %rdx
leaq 0x5f02e(%rip), %rsi     # 0x1b372e
movb $0x0, %al
callq 0x15b0d0
movq -0x30(%rbp), %rax
addq -0x20(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
addq $0x4, %rax
movq -0x18(%rbp), %rcx
movq 0x38(%rcx), %rcx
movq -0x18(%rbp), %rdx
addq 0x40(%rdx), %rcx
cmpq %rcx, %rax
jle 0x154735
jmp 0x1547d6
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x20(%rbp), %rsi
callq 0x1654b0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x154756
jmp 0x1547d6
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rdx
movq -0x38(%rbp), %rcx
leaq 0x7cc6a(%rip), %rsi     # 0x1d13d3
movb $0x0, %al
callq 0x15b0d0
movq -0x20(%rbp), %rax
addq -0x38(%rbp), %rax
movq -0x18(%rbp), %rcx
movq 0x38(%rcx), %rcx
movq -0x18(%rbp), %rdx
addq 0x40(%rdx), %rcx
cmpq %rcx, %rax
jle 0x15478f
jmp 0x1547d6
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rsi
movq -0x20(%rbp), %rdx
movq -0x38(%rbp), %rcx
movl $0x100, %r8d            # imm = 0x100
xorl %eax, %eax
movl %eax, %r9d
movl $0x1, (%rsp)
callq 0x15b840
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)