// File: /workspace/github_c_makefile_star2_O3/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 $0x68, %rsp
movq 0x28(%rdx), %rax
movq 0x38(%rax), %r15
movq %r15, (%rsp)
movq 0x40(%rax), %rax
movq %rax, 0x8(%rsp)
testq %rax, %rax
jle 0x2d39d
movq %rdx, %rbx
movq %rdi, %r14
movq 0x10(%rdx), %rdi
movq %rsp, %rsi
callq 0xeeb4b
movzbl %al, %r12d
leaq 0xe9102(%rip), %rsi     # 0x116223
movq %r14, %rdi
movl %r12d, %edx
xorl %eax, %eax
callq 0xe8617
movq %r12, 0x10(%rsp)
leal -0x9(%r12), %eax
cmpb $-0x8, %al
jb 0x2d39d
addq %r15, 0x8(%rsp)
movq 0x10(%rbx), %rdi
movq %rsp, %r12
movq (%r12), %rsi
movq 0x10(%rsp), %r15
movl %r15d, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0xef0f6
movl %r15d, %r13d
addq %r13, (%r12)
leaq 0xe90c2(%rip), %rsi     # 0x116232
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
movq 0x10(%rbx), %rdi
movq (%r12), %rsi
movl %r15d, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0xef0f6
movq %r13, 0x18(%rsp)
addq %r13, (%r12)
leaq 0xe909c(%rip), %rsi     # 0x11623e
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
movq 0x10(%rbx), %rdi
movq %r12, %rsi
callq 0xeeb91
movq %rax, %r12
leaq 0xe9084(%rip), %rsi     # 0x116249
movq %r14, %rdi
movl %r12d, %edx
xorl %eax, %eax
callq 0xe8617
testq %r12, %r12
jle 0x2d2a6
leaq 0xe91e6(%rip), %r15     # 0x1163c8
xorl %ebp, %ebp
movq 0x8(%rsp), %rax
cmpq %rax, (%rsp)
jge 0x2d39d
movq 0x10(%rbx), %rdi
movq %rsp, %rsi
callq 0xeeb91
leaq 0xe91ce(%rip), %rcx     # 0x1163d4
xorl %edx, %edx
movzbl (%rdx,%r15), %esi
cmpl %eax, %esi
je 0x2d227
incq %rdx
addq $0x4, %rcx
cmpq $0xb, %rdx
jne 0x2d208
leaq 0xfef2c(%rip), %r8      # 0x12c151
jmp 0x2d234
movslq (%rcx), %r8
leaq 0xe91a3(%rip), %rcx     # 0x1163d4
addq %rcx, %r8
movq %r14, %rdi
leaq 0xe9013(%rip), %rsi     # 0x116251
movl %ebp, %edx
movl %eax, %ecx
xorl %eax, %eax
callq 0xe8617
movq 0x10(%rbx), %rdi
movq (%rsp), %rsi
movq 0x10(%rsp), %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0xef0f6
movq %rax, %r13
movq 0x18(%rsp), %rax
addq %rax, (%rsp)
movq %r14, %rdi
movl $0x1, %esi
callq 0xe8a15
movq %r14, %rdi
leaq 0xe8fec(%rip), %rsi     # 0x11626f
movq %r13, %rdx
xorl %eax, %eax
callq 0xe8617
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
incq %rbp
cmpq %r12, %rbp
jne 0x2d1e4
movq 0x8(%rsp), %rax
cmpq %rax, (%rsp)
jge 0x2d39d
movq 0x10(%rbx), %rdi
movq %rsp, %rsi
callq 0xeeb91
movq %rax, %r12
leaq 0xe8fb0(%rip), %rsi     # 0x11627b
movq %r14, %rdi
movl %r12d, %edx
xorl %eax, %eax
callq 0xe8617
testq %r12, %r12
jle 0x2d39d
leaq 0x20(%rsp), %r15
xorl %r13d, %r13d
movq (%rsp), %rdx
cmpq 0x8(%rsp), %rdx
jge 0x2d39d
movq 0x10(%rbx), %rdi
movl $0x10, %ecx
movq %r15, %rsi
callq 0xee8d4
movl $0x32, %ecx
movq %r14, %rdi
movq %r15, %rsi
leaq 0x30(%rsp), %rbp
movq %rbp, %rdx
callq 0xf808d
movq %r14, %rdi
leaq 0xe8f69(%rip), %rsi     # 0x116294
movl %r13d, %edx
movq %rbp, %rcx
xorl %eax, %eax
callq 0xe8617
movq (%rsp), %rsi
addq $0x10, %rsi
movq %rsi, (%rsp)
movq 0x10(%rbx), %rdi
movq 0x10(%rsp), %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0xef0f6
movq %rax, %rbp
movq 0x18(%rsp), %rax
addq %rax, (%rsp)
movq %r14, %rdi
movl $0x1, %esi
callq 0xe8a15
movq %r14, %rdi
leaq 0xe8ef5(%rip), %rsi     # 0x11626f
movq %rbp, %rdx
xorl %eax, %eax
callq 0xe8617
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
incq %r13
cmpq %r13, %r12
jne 0x2d2e9
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq