// File: /workspace/github_c_makefile_star2_O1/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 0x2889
movq %rdi, %r14
movq (%rdi), %rdi
callq 0x2894
testl %eax, %eax
je 0x2887
movq (%r14), %r15
movq %r15, %rdi
callq 0x2894
testl %eax, %eax
je 0x2757
cmpl $0x0, 0x4c(%r15)
jle 0x2757
cmpl $0x0, 0x1c(%r14)
je 0x26d3
movl $0xe0, 0x20(%r14)
cmpq $0x0, 0x30(%r14)
jne 0x2757
movl $0x68, %edi
callq 0x2200
movq %rax, %r15
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x40(%rax)
movups %xmm0, 0x50(%rax)
movq $0x0, 0x60(%rax)
movq $0x20000, 0x8(%rax)     # imm = 0x20000
movl $0x1, %ebp
movl %ebp, 0x28(%rax)
movl $0x20000, %edi          # imm = 0x20000
callq 0x2200
movq %rax, 0x58(%r15)
movl $0x2, 0x60(%r15)
movl %ebp, 0x20(%r15)
movq %r15, 0x28(%r14)
leaq 0x387(%rip), %rax       # 0x2ac5
movq %rax, 0x38(%r15)
movq %r14, 0x50(%r15)
movq %r15, %rdi
movl $0x1, %esi
callq 0x2ad0
movq %rax, 0x30(%r14)
movq (%r14), %r15
movq %r15, %rdi
callq 0x2894
testl %eax, %eax
je 0x287d
cmpl $0x0, 0x48(%r15)
jle 0x287d
cmpl $0x0, 0x38(%r14)
je 0x2789
movl $0xc0, %eax
addl 0x3c(%r14), %eax
movl %eax, 0x40(%r14)
cmpq $0x0, 0x58(%r14)
jne 0x287d
movl $0x68, %edi
callq 0x2200
movq %rax, %r15
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x40(%rax)
movups %xmm0, 0x50(%rax)
movq $0x0, 0x60(%rax)
movq $0x20000, 0x8(%rax)     # imm = 0x20000
movl $0x1, %ebp
movl %ebp, 0x28(%rax)
movl $0x20000, %edi          # imm = 0x20000
callq 0x2200
movq %rax, 0x58(%r15)
movl $0x2, 0x60(%r15)
movl %ebp, 0x20(%r15)
movq %r15, 0x50(%r14)
leaq 0x34c(%rip), %rax       # 0x2b44
movq %rax, 0x38(%r15)
movq %r14, 0x50(%r15)
movl $0x5d10, %edi           # imm = 0x5D10
callq 0x2200
movq %rax, %r12
movl $0x5d10, %edx           # imm = 0x5D10
movq %rax, %rdi
xorl %esi, %esi
callq 0x20e0
movl $0x480, 0x888(%r12) # imm = 0x480
movq %r15, 0x30(%r12)
movl %ebp, 0x38(%r12)
movl $0x3, 0xc(%r12)
leaq 0x2c90(%r12), %rdi
leaq 0x71a6(%rip), %r15      # 0x99f0
movl $0x800, %edx            # imm = 0x800
movq %r15, %rsi
callq 0x2130
leaq 0x3490(%r12), %rdi
movl $0x800, %edx            # imm = 0x800
movq %r15, %rsi
callq 0x2130
movq %r12, %rdi
callq 0x70e8
movl %eax, 0x28(%r12)
movq %r12, 0x58(%r14)
movl $0x1, 0x18(%r14)
jmp 0x2889
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq