// File: /workspace/github_c_makefile_star2_O1/jonof[P]jftekwar/libsmacker/smacker.c
// Function: smk_close
void smk_close(smk s)
{
	unsigned long u;

	if (s == NULL) {
		fputs("libsmacker::smk_close() - ERROR: smk is NULL\n", stderr);
		return;
	}

	/* free video sub-components */
	for (u = 0; u < 4; u ++) {
		if (s->video.tree[u].tree) free(s->video.tree[u].tree);
	}

	smk_free(s->video.frame);

	/* free audio sub-components */
	for (u = 0; u < 7; u++) {
		if (s->audio[u].buffer)
			smk_free(s->audio[u].buffer);
	}

	smk_free(s->keyframe);
	smk_free(s->frame_type);

	if (s->mode == SMK_MODE_DISK) {
		/* disk-mode */
		if (s->source.file.fp)
			fclose(s->source.file.fp);

		smk_free(s->source.file.chunk_offset);
	} else {
		/* mem-mode */
		if (s->source.chunk_data != NULL) {
			for (u = 0; u < (s->f + s->ring_frame); u++)
				smk_free(s->source.chunk_data[u]);

			smk_free(s->source.chunk_data);
		}
	}

	smk_free(s->chunk_size);
	smk_free(s);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
testq %rdi, %rdi
je 0x2f063
movq %rdi, %rbx
movl $0x90, %r14d
movq (%rbx,%r14), %rdi
testq %rdi, %rdi
je 0x2ef10
callq 0x8270
addq $0x18, %r14
cmpq $0xf0, %r14
jne 0x2ef02
movq 0x3f0(%rbx), %rdi
testq %rdi, %rdi
je 0x2f08d
callq 0x8270
movq $0x0, 0x3f0(%rbx)
movl $0x418, %r14d           # imm = 0x418
movq (%rbx,%r14), %rdi
testq %rdi, %rdi
je 0x2ef59
callq 0x8270
movq $0x0, (%rbx,%r14)
addq $0x30, %r14
cmpq $0x568, %r14            # imm = 0x568
jne 0x2ef43
movq 0x40(%rbx), %rdi
testq %rdi, %rdi
je 0x2f0ac
callq 0x8270
movq $0x0, 0x40(%rbx)
movq 0x48(%rbx), %rdi
testq %rdi, %rdi
je 0x2f0cb
callq 0x8270
movq $0x0, 0x48(%rbx)
cmpb $0x0, (%rbx)
movq 0x28(%rbx), %rdi
je 0x2f015
testq %rdi, %rdi
je 0x2f03c
leaq 0x28(%rbx), %r14
movzbl 0x18(%rbx), %eax
addq 0x10(%rbx), %rax
je 0x2efee
xorl %r15d, %r15d
movq (%r14), %rax
movq (%rax,%r15,8), %rdi
testq %rdi, %rdi
je 0x2f06e
callq 0x8270
movq 0x28(%rbx), %rax
movq $0x0, (%rax,%r15,8)
incq %r15
movzbl 0x18(%rbx), %eax
addq 0x10(%rbx), %rax
cmpq %rax, %r15
jb 0x2efbd
movq (%r14), %rdi
testq %rdi, %rdi
jne 0x2f030
leaq 0x712dd(%rip), %rdi     # 0xa02da
leaq 0x7125f(%rip), %rsi     # 0xa0263
leaq 0x7126d(%rip), %rcx     # 0xa0278
movl $0x3cf, %edx            # imm = 0x3CF
callq 0x8240
testq %rdi, %rdi
je 0x2f01f
callq 0x8640
movq 0x30(%rbx), %rdi
testq %rdi, %rdi
je 0x2f109
leaq 0x30(%rbx), %r14
callq 0x8270
movq $0x0, (%r14)
movq 0x38(%rbx), %rdi
testq %rdi, %rdi
je 0x2f0ea
callq 0x8270
movq $0x0, 0x38(%rbx)
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x8270
callq 0x99cc
popq %rbx
popq %r14
popq %r15
retq
leaq 0x7124d(%rip), %rdi     # 0xa02c2
leaq 0x711e7(%rip), %rsi     # 0xa0263
leaq 0x711f5(%rip), %rcx     # 0xa0278
movl $0x3cd, %edx            # imm = 0x3CD
callq 0x8240
leaq 0x711c0(%rip), %rdi     # 0xa0254
leaq 0x711c8(%rip), %rsi     # 0xa0263
leaq 0x711d6(%rip), %rcx     # 0xa0278
movl $0x3b8, %edx            # imm = 0x3B8
callq 0x8240
leaq 0x711d9(%rip), %rdi     # 0xa028c
leaq 0x711a9(%rip), %rsi     # 0xa0263
leaq 0x711b7(%rip), %rcx     # 0xa0278
movl $0x3c0, %edx            # imm = 0x3C0
callq 0x8240
leaq 0x711c6(%rip), %rdi     # 0xa0298
leaq 0x7118a(%rip), %rsi     # 0xa0263
leaq 0x71198(%rip), %rcx     # 0xa0278
movl $0x3c1, %edx            # imm = 0x3C1
callq 0x8240
leaq 0x711fe(%rip), %rdi     # 0xa02ef
leaq 0x7116b(%rip), %rsi     # 0xa0263
leaq 0x71179(%rip), %rcx     # 0xa0278
movl $0x3d3, %edx            # imm = 0x3D3
callq 0x8240
leaq 0x71196(%rip), %rdi     # 0xa02a6
leaq 0x7114c(%rip), %rsi     # 0xa0263
leaq 0x7115a(%rip), %rcx     # 0xa0278
movl $0x3c8, %edx            # imm = 0x3C8
callq 0x8240