// File: /workspace/github_c_makefile_star2_O3/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 0x19689(%rip), %rdx     # 0x11279e
movl $0x3, %ecx
movq %rsi, %rdi
xorl %esi, %esi
callq 0xefc85
xorl %ecx, %ecx
testl %eax, %eax
sete %cl
movl %ecx, 0x4(%rbx)
jne 0xf91c6
leaq 0x51651(%rip), %rsi     # 0x14a78c
movq %r14, %rdi
xorl %edx, %edx
xorl %eax, %eax
callq 0xe8617
movq %r14, %rdi
movl $0x1, %esi
callq 0xe8a15
leaq 0x8(%rsp), %r12
xorps %xmm0, %xmm0
movups %xmm0, 0x58(%r12)
movups %xmm0, 0x48(%r12)
movups %xmm0, 0x38(%r12)
movups %xmm0, 0x28(%r12)
movups %xmm0, 0x18(%r12)
movups %xmm0, 0x8(%r12)
movq $0x0, 0x68(%r12)
leaq 0x37d6c(%rip), %rax     # 0x130efc
movq %rax, (%r12)
movq 0x18(%r15), %r9
leaq 0x19637(%rip), %rsi     # 0x1127d6
movq %r14, %rdi
movq %r12, %rdx
movq %r15, %rcx
xorl %r8d, %r8d
callq 0xe9aa3
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
movq 0x58(%r12), %rax
addq %rax, 0x8(%rbx)
movq 0x18(%r15), %r12
addq $-0x80, %r12
leaq 0x515c8(%rip), %rdx     # 0x14a79d
movl $0x3, %ecx
movq %r15, %rdi
movq %r12, %rsi
callq 0xefc85
testl %eax, %eax
je 0xf91f3
cmpl $0x0, (%rbx)
jne 0xf91f9
jmp 0xf9278
movl $0x1, (%rbx)
leaq 0x515a1(%rip), %rsi     # 0x14a7a1
movq %r14, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0xe8617
movq %r14, %rdi
movl $0x1, %esi
callq 0xe8a15
xorps %xmm0, %xmm0
leaq 0x8(%rsp), %rdx
movups %xmm0, 0x58(%rdx)
movups %xmm0, 0x48(%rdx)
movups %xmm0, 0x38(%rdx)
movups %xmm0, 0x28(%rdx)
movups %xmm0, 0x18(%rdx)
movups %xmm0, 0x8(%rdx)
movq $0x0, 0x68(%rdx)
leaq 0x3a1ec(%rip), %rax     # 0x133435
movq %rax, (%rdx)
leaq 0x19583(%rip), %rsi     # 0x1127d6
movl $0x80, %r9d
movq %r14, %rdi
movq %r15, %rcx
movq %r12, %r8
callq 0xe9aa3
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
movq %r12, 0x10(%rbx)
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq