// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/src/fmtutil.c
// Function: fmtutil_handle_id3
void fmtutil_handle_id3(deark *c, dbuf *f, struct de_id3info *id3i,
	unsigned int flags)
{
	i64 id3v1pos = 0;
	int look_for_id3v1;

	de_zeromem(id3i, sizeof(struct de_id3info));
	id3i->main_start = 0;
	id3i->main_end = f->len;

	id3i->has_id3v2 = !dbuf_memcmp(f, 0, "ID3", 3);
	if(id3i->has_id3v2) {
		de_module_params id3v2mparams;

		de_dbg(c, "ID3v2 data at %d", 0);
		de_dbg_indent(c, 1);
		de_zeromem(&id3v2mparams, sizeof(de_module_params));
		id3v2mparams.in_params.codes = "I";
		de_run_module_by_id_on_slice(c, "id3", &id3v2mparams, f, 0, f->len);
		de_dbg_indent(c, -1);
		id3i->main_start += id3v2mparams.out_params.int64_1;
	}

	look_for_id3v1 = 1;
	if(look_for_id3v1) {
		id3v1pos = f->len-128;
		if(!dbuf_memcmp(f, id3v1pos, "TAG", 3)) {
			id3i->has_id3v1 = 1;
		}
	}

	if(id3i->has_id3v1) {
		de_module_params id3v1mparams;

		de_dbg(c, "ID3v1 data at %"I64_FMT, id3v1pos);
		de_dbg_indent(c, 1);
		de_zeromem(&id3v1mparams, sizeof(de_module_params));
		id3v1mparams.in_params.codes = "1";
		de_run_module_by_id_on_slice(c, "id3", &id3v1mparams, f, id3v1pos, 128);
		de_dbg_indent(c, -1);
		id3i->main_end = id3v1pos;
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
xorps %xmm0, %xmm0
movups %xmm0, (%rdx)
movq $0x0, 0x10(%rdx)
movq 0x18(%rsi), %rax
movq %rax, 0x10(%rdx)
leaq 0x1915f(%rip), %rdx     # 0x11278e
movl $0x3, %ecx
movq %rsi, %rdi
xorl %esi, %esi
callq 0xf025e
xorl %ecx, %ecx
testl %eax, %eax
sete %cl
movl %ecx, 0x4(%rbx)
jne 0xf96da
leaq 0x50b87(%rip), %rsi     # 0x14a1dc
movq %r14, %rdi
xorl %edx, %edx
xorl %eax, %eax
callq 0xe9226
movq %r14, %rdi
movl $0x1, %esi
callq 0xe9585
movq %rsp, %r12
xorps %xmm0, %xmm0
movaps %xmm0, (%r12)
movaps %xmm0, 0x60(%r12)
movaps %xmm0, 0x50(%r12)
movaps %xmm0, 0x40(%r12)
movaps %xmm0, 0x30(%r12)
movaps %xmm0, 0x20(%r12)
movaps %xmm0, 0x10(%r12)
leaq 0x3751d(%rip), %rax     # 0x130bc1
movq %rax, (%r12)
movq 0x18(%r15), %r9
leaq 0x19113(%rip), %rsi     # 0x1127c6
movq %r14, %rdi
movq %r12, %rdx
movq %r15, %rcx
xorl %r8d, %r8d
callq 0xea5fa
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
movq 0x58(%r12), %rax
addq %rax, 0x8(%rbx)
movq 0x18(%r15), %r12
addq $-0x80, %r12
leaq 0x50b04(%rip), %rdx     # 0x14a1ed
movl $0x3, %ecx
movq %r15, %rdi
movq %r12, %rsi
callq 0xf025e
testl %eax, %eax
jne 0xf9703
movl $0x1, (%rbx)
cmpl $0x0, (%rbx)
je 0xf9780
leaq 0x50ae2(%rip), %rsi     # 0x14a1f1
movq %r14, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0xe9226
movq %r14, %rdi
movl $0x1, %esi
callq 0xe9585
xorps %xmm0, %xmm0
movq %rsp, %rdx
movaps %xmm0, (%rdx)
movaps %xmm0, 0x60(%rdx)
movaps %xmm0, 0x50(%rdx)
movaps %xmm0, 0x40(%rdx)
movaps %xmm0, 0x30(%rdx)
movaps %xmm0, 0x20(%rdx)
movaps %xmm0, 0x10(%rdx)
leaq 0x398ec(%rip), %rax     # 0x13303d
movq %rax, (%rdx)
leaq 0x1906b(%rip), %rsi     # 0x1127c6
movl $0x80, %r9d
movq %r14, %rdi
movq %r15, %rcx
movq %r12, %r8
callq 0xea5fa
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
movq %r12, 0x10(%rbx)
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq