// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x18(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x19140
movq -0x18(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
leaq 0x29421(%rip), %rdx     # 0x19e85e
movl $0x3, %ecx
callq 0x166ab0
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x18(%rbp), %rax
cmpl $0x0, 0x4(%rax)
je 0x1754f2
movq -0x8(%rbp), %rdi
leaq 0x60dc8(%rip), %rsi     # 0x1d623c
xorl %edx, %edx
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
leaq -0xa0(%rbp), %rdi
xorl %esi, %esi
movl $0x70, %edx
callq 0x19140
leaq 0x475f6(%rip), %rax     # 0x1bca9b
movq %rax, -0xa0(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rcx
movq -0x10(%rbp), %rax
movq 0x18(%rax), %r9
leaq 0x293d3(%rip), %rsi     # 0x19e896
leaq -0xa0(%rbp), %rdx
xorl %eax, %eax
movl %eax, %r8d
callq 0x15c9f0
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
movq -0x48(%rbp), %rcx
movq -0x18(%rbp), %rax
addq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movl $0x1, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
je 0x17553b
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
subq $0x80, %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rsi
leaq 0x60d2d(%rip), %rdx     # 0x1d624d
movl $0x3, %ecx
callq 0x166ab0
cmpl $0x0, %eax
jne 0x175539
movq -0x18(%rbp), %rax
movl $0x1, (%rax)
jmp 0x17553b
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x1755cc
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rdx
leaq 0x60cfa(%rip), %rsi     # 0x1d6251
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
leaq -0x110(%rbp), %rdi
xorl %esi, %esi
movl $0x70, %edx
callq 0x19140
leaq 0x498f6(%rip), %rax     # 0x1bee7c
movq %rax, -0x110(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rcx
movq -0x28(%rbp), %r8
leaq 0x292f6(%rip), %rsi     # 0x19e896
leaq -0x110(%rbp), %rdx
movl $0x80, %r9d
callq 0x15c9f0
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
movq -0x28(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
nopw %cs:(%rax,%rax)