// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/mp3.c
// Function: de_run_mpegaudio
static void de_run_mpegaudio(deark *c, de_module_params *mparams)
{
	mp3ctx *d = NULL;
	i64 pos;
	i64 endpos;
	i64 ape_tag_len;
	struct de_id3info id3i;

	d = de_malloc(c, sizeof(mp3ctx));

	fmtutil_handle_id3(c, c->infile, &id3i, 0);
	d->has_id3v2 = id3i.has_id3v2;
	pos = id3i.main_start;
	endpos = id3i.main_end;

	if(!id3i.has_id3v2) {
		if(!dbuf_memcmp(c->infile, endpos-10, "3DI", 3)) {
			de_warn(c, "Possible ID3v2 tag found at end of file (footer at %"I64_FMT"). "
				"This is not supported.", endpos-10);
		}
	}

	do_ape_tag_if_exists(c, endpos, &ape_tag_len);
	endpos -= ape_tag_len;

	do_mp3_data(c, d, pos, endpos-pos);

	de_free(c, d);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
movl $0x34, %esi
callq 0xe969b
movq %rax, %r14
movq 0x18(%rbx), %rsi
leaq 0x30(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rdx
xorl %ecx, %ecx
callq 0xf95fe
movl 0x4(%r15), %eax
movl %eax, (%r14)
movq 0x8(%r15), %rbp
movq 0x10(%r15), %r13
testl %eax, %eax
jne 0x99023
movq 0x18(%rbx), %rdi
leaq -0xa(%r13), %r15
leaq 0x978f9(%rip), %rdx     # 0x1308f7
movl $0x3, %ecx
movq %r15, %rsi
callq 0xf025e
testl %eax, %eax
jne 0x99023
leaq 0x978e5(%rip), %rsi     # 0x1308fb
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0xe9b27
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0xe958c
leaq -0x20(%r13), %rsi
movq 0x18(%rbx), %rdi
leaq 0x977d2(%rip), %rdx     # 0x130811
movl $0x8, %ecx
callq 0xf025e
xorl %r12d, %r12d
movl $0x0, %r15d
testl %eax, %eax
jne 0x990be
leaq 0x978ee(%rip), %rsi     # 0x13094b
xorl %r12d, %r12d
movq %rbx, %rdi
movq %r13, %rdx
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
movl $0x70, %esi
movq %rbx, %rdi
callq 0xe969b
movq %rax, %r15
movq 0x18(%rbx), %rcx
leaq 0x97701(%rip), %rsi     # 0x130796
movq %rbx, %rdi
movq %rax, %rdx
xorl %r8d, %r8d
movq %r13, %r9
callq 0xea5fa
testb $0x1, 0x40(%r15)
je 0x990be
movq 0x58(%r15), %r12
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
movq %rbx, %rdi
movq %r15, %rsi
callq 0xe9752
movl 0x10(%rsp), %esi
movq %rbx, %rdi
callq 0xe9595
addq %rbp, %r12
subq %r12, %r13
leaq 0x97886(%rip), %rsi     # 0x130968
movq %rbx, %rdi
movq %rbp, %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
leaq 0xc(%rsp), %rsi
movq %rbx, %rdi
callq 0xe958c
movq 0x18(%rbx), %rdi
movq %rbp, %rsi
callq 0xef32a
movq %rax, %r15
cmpl $0xffdfffff, %r15d      # imm = 0xFFDFFFFF
ja 0x9921a
leaq 0x97856(%rip), %rsi     # 0x130985
movq %rbx, %rdi
movq %rbp, (%rsp)
movq %rbp, %rdx
xorl %eax, %eax
callq 0xe9ef5
cmpl $0x0, 0x30(%r14)
jne 0x99164
cmpl $0x1, 0x24(%rbx)
jne 0x99164
cmpl $0x0, (%r14)
je 0x99164
leaq 0x97873(%rip), %rsi     # 0x1309cd
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9b27
movl $0x10000, %r12d         # imm = 0x10000
cmpq %r12, %r13
cmovlq %r13, %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0xe969b
movq %rax, %rbp
movq 0x18(%rbx), %rdi
movq %rax, %rsi
movq (%rsp), %rdx
movq %r12, %rcx
callq 0xeeee8
cmpq $0x2, %r13
jl 0x991ba
decq %r12
xorl %r13d, %r13d
cmpb $-0x1, (%rbp,%r13)
jne 0x991b2
cmpb $-0x21, 0x1(%rbp,%r13)
ja 0x99558
incq %r13
cmpq %r13, %r12
jne 0x9919e
xorl %r13d, %r13d
movb $0x1, %r12b
movq %rbx, %rdi
movq %rbp, %rsi
callq 0xe9752
testb %r12b, %r12b
je 0x991e7
leaq 0x97846(%rip), %rsi     # 0x130a1d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9df7
movq (%rsp), %rbp
jmp 0x99211
movq (%rsp), %rbp
addq %r13, %rbp
leaq 0x97847(%rip), %rsi     # 0x130a3c
movq %rbx, %rdi
movq %rbp, %rdx
xorl %eax, %eax
callq 0xe9ef5
movq 0x18(%rbx), %rdi
movq %rbp, %rsi
callq 0xef32a
movq %rax, %r15
testb %r12b, %r12b
jne 0x99525
leaq 0x97849(%rip), %rsi     # 0x130a6a
movq %rbx, %rdi
movq %rbp, %rdx
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
leaq 0x97835(%rip), %rsi     # 0x130a77
movq %rbx, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
movl %r15d, %edx
shrl $0x13, %edx
andl $0x3, %edx
movl %edx, 0x4(%r14)
leaq 0x97ab0(%rip), %rax     # 0x130d20
movslq (%rax,%rdx,4), %rcx
addq %rax, %rcx
leaq 0x9780e(%rip), %rsi     # 0x130a8c
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movl %r15d, %edx
shrl $0x11, %edx
andl $0x3, %edx
movl %edx, 0x8(%r14)
leaq 0x97aa4(%rip), %rax     # 0x130d40
movslq (%rax,%rdx,4), %rcx
addq %rax, %rcx
leaq 0x977fc(%rip), %rsi     # 0x130aa6
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
cmpl $0x0, 0x30(%r14)
jne 0x992de
movl 0x8(%r14), %eax
decl %eax
cmpl $0x2, %eax
ja 0x992de
movl %eax, %eax
leaq 0x97a81(%rip), %rcx     # 0x130d50
movslq (%rcx,%rax,4), %rsi
addq %rcx, %rsi
movq %rbx, %rdi
callq 0xeb6d6
movl %r15d, %edx
shrl $0x10, %edx
andl $0x1, %edx
movl %edx, 0xc(%r14)
leaq 0x977e7(%rip), %rsi     # 0x130ad9
xorl %r12d, %r12d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movl %r15d, %ebp
shrl $0xc, %ebp
andl $0xf, %ebp
movl %ebp, 0x10(%r14)
movl 0x4(%r14), %ecx
movl 0x8(%r14), %eax
cmpl $0x3, %ecx
jne 0x9932c
decl %eax
cmpl $0x3, %eax
jae 0x9935f
movl %eax, %eax
movl $0x2, %ecx
subq %rax, %rcx
jmp 0x9934a
testl $0xfffffffd, %ecx       # imm = 0xFFFFFFFD
jne 0x9935f
movl $0x3, %ecx
cmpl $0x3, %eax
je 0x9934a
decl %eax
movl $0x4, %ecx
cmpl $0x2, %eax
jae 0x9935f
shlq $0x5, %rcx
leaq 0x978eb(%rip), %rax     # 0x130c40
addq %rcx, %rax
movl %ebp, %ecx
movzwl (%rax,%rcx,2), %r12d
testl %r12d, %r12d
je 0x99381
leaq 0x97858(%rip), %rdx     # 0x130bc3
leaq 0x10(%rsp), %rdi
movl $0x20, %esi
movl %r12d, %ecx
xorl %eax, %eax
callq 0xe8d67
jmp 0x99397
leaq 0x92ae1(%rip), %rsi     # 0x12be69
leaq 0x10(%rsp), %rdi
movl $0x20, %edx
callq 0xe8ded
leaq 0x97747(%rip), %rsi     # 0x130ae5
xorl %r12d, %r12d
leaq 0x10(%rsp), %rcx
movq %rbx, %rdi
movl %ebp, %edx
xorl %eax, %eax
callq 0xe9226
movl %r15d, %ebp
shrl $0xa, %ebp
andl $0x3, %ebp
movl %ebp, 0x14(%r14)
movl 0x8(%r14), %eax
addl $-0x4, %eax
cmpl $-0x3, %eax
jb 0x99402
movl 0x4(%r14), %eax
testl %eax, %eax
je 0x993e8
xorl %r12d, %r12d
cmpl $0x3, %eax
je 0x993ee
cmpl $0x2, %eax
jne 0x99402
movl $0x1, %r12d
jmp 0x993ee
movl $0x2, %r12d
shll $0x4, %r12d
leaq 0x978e7(%rip), %rax     # 0x130ce0
addq %r12, %rax
movl %ebp, %ecx
movl (%rax,%rcx,4), %r12d
testl %r12d, %r12d
je 0x99424
leaq 0x977bd(%rip), %rdx     # 0x130bcb
leaq 0x10(%rsp), %rdi
movl $0x20, %esi
movl %r12d, %ecx
xorl %eax, %eax
callq 0xe8d67
jmp 0x9943a
leaq 0x92a3e(%rip), %rsi     # 0x12be69
leaq 0x10(%rsp), %rdi
movl $0x20, %edx
callq 0xe8ded
leaq 0x976b8(%rip), %rsi     # 0x130af9
leaq 0x10(%rsp), %rcx
movq %rbx, %rdi
movl %ebp, %edx
xorl %eax, %eax
callq 0xe9226
movl %r15d, %edx
shrl $0x9, %edx
andl $0x1, %edx
movl %edx, 0x18(%r14)
leaq 0x976b7(%rip), %rsi     # 0x130b1d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movl %r15d, %edx
shrl $0x6, %edx
andl $0x3, %edx
movl %edx, 0x1c(%r14)
leaq 0x978ac(%rip), %rax     # 0x130d30
movslq (%rax,%rdx,4), %rcx
addq %rax, %rcx
leaq 0x9769b(%rip), %rsi     # 0x130b2d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
cmpl $0x1, 0x1c(%r14)
jne 0x994c1
movl %r15d, %edx
shrl $0x4, %edx
andl $0x3, %edx
movl %edx, 0x20(%r14)
leaq 0x9768c(%rip), %rsi     # 0x130b43
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movl %r15d, %eax
shrl $0x3, %eax
andl $0x1, %eax
movl %eax, 0x24(%r14)
movl 0x18(%r14), %edx
leaq 0x9767d(%rip), %rsi     # 0x130b56
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movl %r15d, %eax
shrl $0x2, %eax
andl $0x1, %eax
movl %eax, 0x28(%r14)
movl 0x18(%r14), %edx
leaq 0x9766e(%rip), %rsi     # 0x130b69
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
andl $0x3, %r15d
movl %r15d, 0x2c(%r14)
leaq 0x9766d(%rip), %rsi     # 0x130b81
movq %rbx, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0xe9226
incl 0x30(%r14)
movl 0xc(%rsp), %esi
movq %rbx, %rdi
callq 0xe9595
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
movq %rbx, %rdi
movq %r14, %rsi
callq 0xe9752
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r12d, %r12d
jmp 0x991c0