// File: /workspace/github_c_makefile_star2_O2/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
andq $0x0, 0x10(%rdx)
xorps %xmm0, %xmm0
movups %xmm0, (%rdx)
movq 0x18(%rsi), %rax
movq %rax, 0x10(%rdx)
leaq 0x17fb6(%rip), %rdx     # 0x10577e
pushq $0x3
popq %rcx
movq %rsi, %rdi
xorl %esi, %esi
callq 0xe4d48
xorl %ecx, %ecx
testl %eax, %eax
sete %cl
movl %ecx, 0x4(%rbx)
jne 0xed870
leaq 0x4fad0(%rip), %rsi     # 0x13d2bc
movq %r14, %rdi
xorl %edx, %edx
xorl %eax, %eax
callq 0xde896
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0xdeba7
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)
andq $0x0, 0x68(%r12)
movups %xmm0, 0x8(%r12)
leaq 0x363dd(%rip), %rax     # 0x123c19
movq %rax, (%r12)
movq 0x18(%r15), %r9
leaq 0x17f6b(%rip), %rsi     # 0x1057b6
movq %r14, %rdi
movq %r12, %rdx
movq %r15, %rcx
xorl %r8d, %r8d
callq 0xdf9b8
pushq $-0x1
popq %rsi
movq %r14, %rdi
callq 0xdeba7
movq 0x58(%r12), %rax
addq %rax, 0x8(%rbx)
movq 0x18(%r15), %r12
addq $-0x80, %r12
leaq 0x4fa4e(%rip), %rdx     # 0x13d2cd
pushq $0x3
popq %rcx
movq %r15, %rdi
movq %r12, %rsi
callq 0xe4d48
testl %eax, %eax
je 0xed898
cmpl $0x0, (%rbx)
jne 0xed89e
jmp 0xed916
movl $0x1, (%rbx)
leaq 0x4fa2c(%rip), %rsi     # 0x13d2d1
movq %r14, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0xde896
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0xdeba7
xorps %xmm0, %xmm0
leaq 0x8(%rsp), %rdx
movups %xmm0, 0x58(%rdx)
movups %xmm0, 0x48(%rdx)
movups %xmm0, 0x38(%rdx)
movups %xmm0, 0x28(%rdx)
andq $0x0, 0x68(%rdx)
movups %xmm0, 0x18(%rdx)
movups %xmm0, 0x8(%rdx)
leaq 0x38874(%rip), %rax     # 0x12615d
movq %rax, (%rdx)
leaq 0x17ec3(%rip), %rsi     # 0x1057b6
movl $0x80, %r9d
movq %r14, %rdi
movq %r15, %rcx
movq %r12, %r8
callq 0xdf9b8
pushq $-0x1
popq %rsi
movq %r14, %rdi
callq 0xdeba7
movq %r12, 0x10(%rbx)
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq