// File: /workspace/github_c_makefile_star2_O3/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 0x30343
movq %rdi, %rbx
movl $0x90, %r14d
movq (%rbx,%r14), %rdi
testq %rdi, %rdi
je 0x301f8
callq 0x8270
addq $0x18, %r14
cmpq $0xf0, %r14
jne 0x301ea
movq 0x3f0(%rbx), %rdi
testq %rdi, %rdi
je 0x3036d
callq 0x8270
movq $0x0, 0x3f0(%rbx)
movl $0x418, %r14d           # imm = 0x418
movq (%rbx,%r14), %rdi
testq %rdi, %rdi
je 0x30241
callq 0x8270
movq $0x0, (%rbx,%r14)
addq $0x30, %r14
cmpq $0x568, %r14            # imm = 0x568
jne 0x3022b
movq 0x40(%rbx), %rdi
testq %rdi, %rdi
je 0x3038c
callq 0x8270
movq $0x0, 0x40(%rbx)
movq 0x48(%rbx), %rdi
testq %rdi, %rdi
je 0x303ab
callq 0x8270
movq $0x0, 0x48(%rbx)
cmpb $0x0, (%rbx)
movq 0x28(%rbx), %rdi
je 0x302fd
testq %rdi, %rdi
je 0x30324
leaq 0x28(%rbx), %r14
movzbl 0x18(%rbx), %eax
addq 0x10(%rbx), %rax
je 0x30318
xorl %r15d, %r15d
movq (%r14), %rax
movq (%rax,%r15,8), %rdi
testq %rdi, %rdi
je 0x3034e
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 0x302a5
movq (%r14), %rdi
testq %rdi, %rdi
jne 0x30318
leaq 0x731a5(%rip), %rdi     # 0xa348a
leaq 0x73127(%rip), %rsi     # 0xa3413
leaq 0x73135(%rip), %rcx     # 0xa3428
movl $0x3cf, %edx            # imm = 0x3CF
callq 0x8240
testq %rdi, %rdi
je 0x30307
callq 0x8640
movq 0x30(%rbx), %rdi
testq %rdi, %rdi
je 0x303e9
leaq 0x30(%rbx), %r14
callq 0x8270
movq $0x0, (%r14)
movq 0x38(%rbx), %rdi
testq %rdi, %rdi
je 0x303ca
callq 0x8270
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x8270
callq 0x9a08
popq %rbx
popq %r14
popq %r15
retq
leaq 0x7311d(%rip), %rdi     # 0xa3472
leaq 0x730b7(%rip), %rsi     # 0xa3413
leaq 0x730c5(%rip), %rcx     # 0xa3428
movl $0x3cd, %edx            # imm = 0x3CD
callq 0x8240
leaq 0x73090(%rip), %rdi     # 0xa3404
leaq 0x73098(%rip), %rsi     # 0xa3413
leaq 0x730a6(%rip), %rcx     # 0xa3428
movl $0x3b8, %edx            # imm = 0x3B8
callq 0x8240
leaq 0x730a9(%rip), %rdi     # 0xa343c
leaq 0x73079(%rip), %rsi     # 0xa3413
leaq 0x73087(%rip), %rcx     # 0xa3428
movl $0x3c0, %edx            # imm = 0x3C0
callq 0x8240
leaq 0x73096(%rip), %rdi     # 0xa3448
leaq 0x7305a(%rip), %rsi     # 0xa3413
leaq 0x73068(%rip), %rcx     # 0xa3428
movl $0x3c1, %edx            # imm = 0x3C1
callq 0x8240
leaq 0x730ce(%rip), %rdi     # 0xa349f
leaq 0x7303b(%rip), %rsi     # 0xa3413
leaq 0x73049(%rip), %rcx     # 0xa3428
movl $0x3d3, %edx            # imm = 0x3D3
callq 0x8240
leaq 0x73066(%rip), %rdi     # 0xa3456
leaq 0x7301c(%rip), %rsi     # 0xa3413
leaq 0x7302a(%rip), %rcx     # 0xa3428
movl $0x3c8, %edx            # imm = 0x3C8
callq 0x8240