// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/bmff.c
// Function: de_run_bmff
static void de_run_bmff(deark *c, de_module_params *mparams)
{
	lctx *d = NULL;
	struct de_boxesctx *bctx = NULL;
	int skip_autodetect = 0;
	const char *s;

	d = de_malloc(c, sizeof(lctx));
	bctx = de_malloc(c, sizeof(struct de_boxesctx));

	if(de_havemodcode(c, mparams, 'T')) {
		d->is_jumbf = 1;
		skip_autodetect = 1;
	}
	if(de_havemodcode(c, mparams, 'X')) {
		d->is_jpx = 1;
		d->is_jp2_jpx_jpm = 1;
		skip_autodetect = 1;
	}
	if(de_havemodcode(c, mparams, 'B')) {
		d->is_bmff = 1;
		skip_autodetect = 1;
	}

	if(!skip_autodetect) {
		u32 first_boxtype;
		// Try to detect old QuickTime files that don't have an ftyp box.
		first_boxtype = (u32)de_getu32be(4);
		if(first_boxtype==BOX_mdat || first_boxtype==BOX_moov ||
			first_boxtype==BOX_free || first_boxtype==BOX_wide ||
			first_boxtype==BOX_skip || first_boxtype==BOX_pnot)
		{
			d->is_bmff = 1;
		}
	}

	s = de_get_ext_option(c, "bmff:maxentries");
	if(s) {
		d->max_entries_to_print = de_atoi64(s);
	}
	else {
		d->max_entries_to_print = 32;
	}
	if(d->max_entries_to_print<0) {
		d->max_entries_to_print = 0;
	}

	bctx->userdata = (void*)d;
	bctx->f = c->infile;
	bctx->identify_box_fn = my_box_identify_fn;
	bctx->handle_box_fn = my_box_handler;

	fmtutil_read_boxes_format(c, bctx);

	de_free(c, bctx);
	de_free(c, d);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movq -0x8(%rbp), %rdi
movl $0x30, %esi
callq 0x15b780
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movl $0x30, %esi
callq 0x15b780
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl $0x54, %edx
callq 0x15d1d0
cmpl $0x0, %eax
je 0x36271
movq -0x18(%rbp), %rax
movb $0x1, 0xa(%rax)
movl $0x1, -0x24(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl $0x58, %edx
callq 0x15d1d0
cmpl $0x0, %eax
je 0x3629f
movq -0x18(%rbp), %rax
movb $0x1, 0x6(%rax)
movq -0x18(%rbp), %rax
movb $0x1, 0x5(%rax)
movl $0x1, -0x24(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl $0x42, %edx
callq 0x15d1d0
cmpl $0x0, %eax
je 0x362c5
movq -0x18(%rbp), %rax
movb $0x1, 0x4(%rax)
movl $0x1, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jne 0x36320
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x4, %esi
callq 0x165470
movl %eax, -0x34(%rbp)
cmpl $0x6d646174, -0x34(%rbp) # imm = 0x6D646174
je 0x36316
cmpl $0x6d6f6f76, -0x34(%rbp) # imm = 0x6D6F6F76
je 0x36316
cmpl $0x66726565, -0x34(%rbp) # imm = 0x66726565
je 0x36316
cmpl $0x77696465, -0x34(%rbp) # imm = 0x77696465
je 0x36316
cmpl $0x736b6970, -0x34(%rbp) # imm = 0x736B6970
je 0x36316
cmpl $0x706e6f74, -0x34(%rbp) # imm = 0x706E6F74
jne 0x3631e
movq -0x18(%rbp), %rax
movb $0x1, 0x4(%rax)
jmp 0x36320
movq -0x8(%rbp), %rdi
leaq 0x16aef6(%rip), %rsi    # 0x1a1221
callq 0x15cb30
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x36351
movq -0x30(%rbp), %rdi
callq 0x15ccc0
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x3635d
movq -0x18(%rbp), %rax
movq $0x20, 0x10(%rax)
movq -0x18(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jge 0x36374
movq -0x18(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
leaq 0x1f6(%rip), %rcx       # 0x36590
movq %rcx, 0x18(%rax)
movq -0x20(%rbp), %rax
leaq 0x307(%rip), %rcx       # 0x366b0
movq %rcx, 0x20(%rax)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x174300
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x15b820
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x15b820
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)