// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/bmff.c
// Function: do_box_rreq
static void do_box_rreq(deark *c, lctx *d, struct de_boxesctx *bctx)
{
	i64 pos = bctx->curbox->payload_pos;
	i64 endpos = pos + bctx->curbox->payload_len;
	UI ml;
	i64 nsf, nvf;
	u64 msk;
	i64 i;

	if(pos>=endpos) goto done;
	ml = (UI)dbuf_getbyte_p(bctx->f, &pos);
	de_dbg(c, "ml: %u byte(s)", ml);
	if(ml<1 || ml>8) goto done;

	msk = (u64)dbuf_getint_ext(bctx->f, pos, ml, 0, 0);
	pos += (i64)ml;
	de_dbg(c, "fuam: 0x%"U64_FMTx, msk);

	msk = (u64)dbuf_getint_ext(bctx->f, pos, ml, 0, 0);
	pos += (i64)ml;
	de_dbg(c, "dcm: 0x%"U64_FMTx, msk);

	nsf = dbuf_getu16be_p(bctx->f, &pos);
	de_dbg(c, "nsf: %d", (int)nsf);

	for(i=0; i<nsf; i++) {
		UI sf;

		if(pos>=endpos) goto done;
		sf = (UI)dbuf_getu16be_p(bctx->f, &pos);
		de_dbg(c, "standard feature[%d]: %u (%s)", (int)i, sf, get_rreq_sf_name(sf));

		msk = (u64)dbuf_getint_ext(bctx->f, pos, ml, 0, 0);
		pos += (i64)ml;
		de_dbg_indent(c, 1);
		de_dbg(c, "mask: 0x%"U64_FMTx, msk);
		de_dbg_indent(c, -1);
	}

	if(pos>=endpos) goto done;
	nvf = dbuf_getu16be_p(bctx->f, &pos);
	de_dbg(c, "num. vendor features: %d", (int)nvf);

	for(i=0; i<nvf; i++) {
		u8 ubuf[16];
		char uuid_string[50];

		if(pos>=endpos) goto done;
		dbuf_read(bctx->f, ubuf, pos, 16);
		fmtutil_render_uuid(c, ubuf, uuid_string, sizeof(uuid_string));
		de_dbg(c, "vendor feature[%d]: {%s}", (int)i, uuid_string);
		pos += 16;

		msk = (u64)dbuf_getint_ext(bctx->f, pos, ml, 0, 0);
		pos += (i64)ml;
		de_dbg_indent(c, 1);
		de_dbg(c, "mask: 0x%"U64_FMTx, msk);
		de_dbg_indent(c, -1);
	}

done:
	;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq 0x28(%rdx), %rax
movq 0x38(%rax), %r15
movq %r15, 0x8(%rsp)
movq 0x40(%rax), %rax
movq %rax, 0x10(%rsp)
testq %rax, %rax
jle 0x2d499
movq %rdx, %rbx
movq %rdi, %r14
movq 0x10(%rdx), %rdi
leaq 0x8(%rsp), %rsi
callq 0xef14d
movzbl %al, %r12d
leaq 0xe8f76(%rip), %rsi     # 0x116173
movq %r14, %rdi
movl %r12d, %edx
xorl %eax, %eax
callq 0xe9226
movq %r12, 0x18(%rsp)
leal -0x9(%r12), %eax
cmpb $-0x8, %al
jb 0x2d499
addq %r15, 0x10(%rsp)
movq 0x10(%rbx), %rdi
leaq 0x8(%rsp), %r12
movq (%r12), %rsi
movq 0x18(%rsp), %r15
movl %r15d, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0xef6f2
movl %r15d, %r13d
addq %r13, (%r12)
leaq 0xe8f34(%rip), %rsi     # 0x116182
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
movq 0x10(%rbx), %rdi
movq (%r12), %rsi
movl %r15d, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0xef6f2
movq %r13, 0x20(%rsp)
addq %r13, (%r12)
leaq 0xe8f0e(%rip), %rsi     # 0x11618e
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
movq 0x10(%rbx), %rdi
movq %r12, %rsi
callq 0xef193
movq %rax, %r15
leaq 0xe8ef6(%rip), %rsi     # 0x116199
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0xe9226
movq %r15, 0x28(%rsp)
testq %r15, %r15
jle 0x2d39b
leaq 0xe9053(%rip), %r12     # 0x116318
xorl %ebp, %ebp
movq 0x8(%rsp), %r15
cmpq 0x10(%rsp), %r15
jge 0x2d499
movq 0x10(%rbx), %rdi
leaq 0x8(%rsp), %rsi
callq 0xef193
leaq 0xe9038(%rip), %rcx     # 0x116324
xorl %edx, %edx
movzbl (%rdx,%r12), %esi
cmpl %eax, %esi
je 0x2d30d
incq %rdx
addq $0x4, %rcx
cmpq $0xb, %rdx
jne 0x2d2ee
leaq 0xfeb5e(%rip), %r8      # 0x12be69
jmp 0x2d31a
movslq (%rcx), %r8
leaq 0xe900d(%rip), %rcx     # 0x116324
addq %rcx, %r8
movq %r14, %rdi
leaq 0xe8e7d(%rip), %rsi     # 0x1161a1
movl %ebp, %edx
movl %eax, %ecx
xorl %eax, %eax
callq 0xe9226
movq 0x10(%rbx), %rdi
movq 0x8(%rsp), %rsi
movq 0x18(%rsp), %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0xef6f2
movq %rax, %r13
movq 0x20(%rsp), %rax
addq %rax, 0x8(%rsp)
movq %r14, %rdi
movl $0x1, %esi
callq 0xe9585
movq %r14, %rdi
leaq 0xe8e54(%rip), %rsi     # 0x1161bf
movq %r13, %rdx
xorl %eax, %eax
callq 0xe9226
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
cmpq 0x10(%rsp), %r15
jge 0x2d499
incq %rbp
cmpq 0x28(%rsp), %rbp
jne 0x2d2c7
movq 0x10(%rsp), %rax
cmpq %rax, 0x8(%rsp)
jge 0x2d499
movq 0x10(%rbx), %rdi
leaq 0x8(%rsp), %rsi
callq 0xef193
movq %rax, %r12
leaq 0xe8e08(%rip), %rsi     # 0x1161cb
movq %r14, %rdi
movl %r12d, %edx
xorl %eax, %eax
callq 0xe9226
testq %r12, %r12
jle 0x2d499
leaq 0x30(%rsp), %r15
xorl %r13d, %r13d
movq 0x8(%rsp), %rdx
cmpq 0x10(%rsp), %rdx
jge 0x2d499
movq 0x10(%rbx), %rdi
movl $0x10, %ecx
movq %r15, %rsi
callq 0xeeee8
movl $0x32, %ecx
movq %r14, %rdi
movq %r15, %rsi
leaq 0x40(%rsp), %rbp
movq %rbp, %rdx
callq 0xf8559
movq %r14, %rdi
leaq 0xe8dc0(%rip), %rsi     # 0x1161e4
movl %r13d, %edx
movq %rbp, %rcx
xorl %eax, %eax
callq 0xe9226
movq 0x8(%rsp), %rsi
addq $0x10, %rsi
movq %rsi, 0x8(%rsp)
movq 0x10(%rbx), %rdi
movq 0x18(%rsp), %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0xef6f2
movq %rax, %rbp
movq 0x20(%rsp), %rax
addq %rax, 0x8(%rsp)
movq %r14, %rdi
movl $0x1, %esi
callq 0xe9585
movq %r14, %rdi
leaq 0xe8d49(%rip), %rsi     # 0x1161bf
movq %rbp, %rdx
xorl %eax, %eax
callq 0xe9226
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
incq %r13
cmpq %r13, %r12
jne 0x2d3e1
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq