// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_init_decoders
int plm_init_decoders(plm_t *self) {
	if (self->has_decoders) {
		return TRUE;
	}

	if (!plm_demux_has_headers(self->demux)) {
		return FALSE;
	}

	if (plm_demux_get_num_video_streams(self->demux) > 0) {
		if (self->video_enabled) {
			self->video_packet_type = PLM_DEMUX_PACKET_VIDEO_1;
		}
		if (!self->video_decoder) {
			self->video_buffer = plm_buffer_create_with_capacity(PLM_BUFFER_DEFAULT_SIZE);
			plm_buffer_set_load_callback(self->video_buffer, plm_read_video_packet, self);
			self->video_decoder = plm_video_create_with_buffer(self->video_buffer, TRUE);
		}
	}

	if (plm_demux_get_num_audio_streams(self->demux) > 0) {
		if (self->audio_enabled) {
			self->audio_packet_type = PLM_DEMUX_PACKET_AUDIO_1 + self->audio_stream_index;
		}
		if (!self->audio_decoder) {
			self->audio_buffer = plm_buffer_create_with_capacity(PLM_BUFFER_DEFAULT_SIZE);
			plm_buffer_set_load_callback(self->audio_buffer, plm_read_audio_packet, self);
			self->audio_decoder = plm_audio_create_with_buffer(self->audio_buffer, TRUE);
		}
	}

	self->has_decoders = TRUE;
	return TRUE;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl $0x1, %ebx
cmpl $0x0, 0x18(%rdi)
jne 0x279d
movq %rdi, %r14
movq (%rdi), %rdi
callq 0x27a8
testl %eax, %eax
je 0x279b
movq (%r14), %r15
movq %r15, %rdi
callq 0x27a8
testl %eax, %eax
je 0x2697
cmpl $0x0, 0x4c(%r15)
jle 0x2697
cmpl $0x0, 0x1c(%r14)
je 0x2630
movl $0xe0, 0x20(%r14)
cmpq $0x0, 0x30(%r14)
jne 0x2697
movl $0x1, %edi
movl $0x68, %esi
callq 0x2110
movq %rax, %r15
movq $0x20000, 0x8(%rax)     # imm = 0x20000
movl $0x1, %ebp
movl %ebp, 0x28(%rax)
movl $0x20000, %edi          # imm = 0x20000
callq 0x2210
movq %rax, 0x58(%r15)
movl $0x2, 0x60(%r15)
movl %ebp, 0x20(%r15)
movq %r15, 0x28(%r14)
leaq 0x33e(%rip), %rax       # 0x29bc
movq %rax, 0x38(%r15)
movq %r14, 0x50(%r15)
movq %r15, %rdi
movl $0x1, %esi
callq 0x29c7
movq %rax, 0x30(%r14)
movq (%r14), %r15
movq %r15, %rdi
callq 0x27a8
testl %eax, %eax
je 0x2791
cmpl $0x0, 0x48(%r15)
jle 0x2791
cmpl $0x0, 0x38(%r14)
je 0x26c9
movl $0xc0, %eax
addl 0x3c(%r14), %eax
movl %eax, 0x40(%r14)
cmpq $0x0, 0x58(%r14)
jne 0x2791
movl $0x1, %edi
movl $0x68, %esi
callq 0x2110
movq %rax, %r12
movq $0x20000, 0x8(%rax)     # imm = 0x20000
movl $0x1, %ebp
movl %ebp, 0x28(%rax)
movl $0x20000, %edi          # imm = 0x20000
callq 0x2210
movq %rax, 0x58(%r12)
movl $0x2, 0x60(%r12)
movl %ebp, 0x20(%r12)
movq %r12, 0x50(%r14)
leaq 0x313(%rip), %rax       # 0x2a31
movq %rax, 0x38(%r12)
movq %r14, 0x50(%r12)
movl $0x1, %edi
movl $0x5d10, %esi           # imm = 0x5D10
callq 0x2110
movq %rax, %r15
movl $0x480, 0x888(%rax)     # imm = 0x480
movq %r12, 0x30(%rax)
movl %ebp, 0x38(%rax)
movl $0x3, 0xc(%rax)
leaq 0x2c90(%rax), %rdi
leaq 0x7490(%rip), %r12      # 0x9bf0
movl $0x800, %edx            # imm = 0x800
movq %r12, %rsi
callq 0x2140
leaq 0x3490(%r15), %rdi
movl $0x800, %edx            # imm = 0x800
movq %r12, %rsi
callq 0x2140
movq %r15, %rdi
callq 0x708b
movl %eax, 0x28(%r15)
movq %r15, 0x58(%r14)
movl $0x1, 0x18(%r14)
jmp 0x279d
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq