LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_demux_probe
int plm_demux_probe(plm_demux_t *self, size_t probesize) {
	int previous_pos = plm_buffer_tell(self->buffer);

	int video_stream = FALSE;
	int audio_streams[4] = {FALSE, FALSE, FALSE, FALSE};
	do {
		self->start_code = plm_buffer_next_start_code(self->buffer);
		if (self->start_code == PLM_DEMUX_PACKET_VIDEO_1) {
			video_stream = TRUE;
		}
		else if (
			self->start_code >= PLM_DEMUX_PACKET_AUDIO_1 && 
			self->start_code <= PLM_DEMUX_PACKET_AUDIO_4
		) {
			audio_streams[self->start_code - PLM_DEMUX_PACKET_AUDIO_1] = TRUE;
		}
	} while (
		self->start_code != -1 && 
		plm_buffer_tell(self->buffer) - previous_pos < probesize
	);

	self->num_video_streams = video_stream ? 1 : 0;
	self->num_audio_streams = 0;
	for (int i = 0; i < 4; i++) {
		if (audio_streams[i]) {
			self->num_audio_streams++;
		}
	}

	plm_demux_buffer_seek(self, previous_pos);
	return (self->num_video_streams || self->num_audio_streams);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r15
movq %rdi, %rbx
movq (%rdi), %r14
movq 0x48(%r14), %rax
testq %rax, %rax
je 0x2c8b
movq 0x50(%r14), %rsi
movq %r14, %rdi
callq *%rax
movq (%r14), %rcx
shrq $0x3, %rcx
addq %rax, %rcx
subq 0x10(%r14), %rcx
jmp 0x2c92
movq (%r14), %rcx
shrq $0x3, %rcx
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movslq %ecx, %r14
xorl %r12d, %r12d
movq (%rbx), %rdi
callq 0x4320
movl %eax, 0x38(%rbx)
movl $0x1, %ebp
cmpl $0xe0, %eax
je 0x2cdc
movl %eax, %ecx
andl $-0x4, %ecx
cmpl $0xc0, %ecx
jne 0x2cd4
addl $0xffffff40, %eax       # imm = 0xFFFFFF40
movl $0x1, (%rsp,%rax,4)
movl %r12d, %ebp
jmp 0x2cdc
movl %r12d, %ebp
cmpl $-0x1, %eax
je 0x2d18
movq (%rbx), %r12
movq 0x48(%r12), %rax
testq %rax, %rax
je 0x2d05
movq 0x50(%r12), %rsi
movq %r12, %rdi
callq *%rax
movq (%r12), %rcx
shrq $0x3, %rcx
addq %rax, %rcx
subq 0x10(%r12), %rcx
jmp 0x2d0d
movq (%r12), %rcx
shrq $0x3, %rcx
subq %r14, %rcx
movl %ebp, %r12d
cmpq %r15, %rcx
jb 0x2c9f
xorl %eax, %eax
testl %ebp, %ebp
setne %al
movl %eax, 0x4c(%rbx)
movl $0x0, 0x48(%rbx)
xorl %eax, %eax
xorl %ecx, %ecx
cmpl $0x0, (%rsp,%rcx,4)
je 0x2d38
incl %eax
movl %eax, 0x48(%rbx)
incq %rcx
cmpq $0x4, %rcx
jne 0x2d2d
movq (%rbx), %rdi
movq %r14, %rsi
callq 0x4120
xorl %eax, %eax
movq %rax, 0x60(%rbx)
movq %rax, 0x80(%rbx)
movl $0xffffffff, 0x38(%rbx) # imm = 0xFFFFFFFF
movl $0x1, %eax
cmpl $0x0, 0x4c(%rbx)
jne 0x2d74
xorl %eax, %eax
cmpl $0x0, 0x48(%rbx)
setne %al
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_set_audio_enabled
void plm_set_audio_enabled(plm_t *self, int enabled) {
	self->audio_enabled = enabled;

	if (!enabled) {
		self->audio_packet_type = 0;
		return;
	}

	self->audio_packet_type = (plm_init_decoders(self) && self->audio_decoder)
		? PLM_DEMUX_PACKET_AUDIO_1 + self->audio_stream_index
		: 0;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl %esi, 0x38(%rdi)
xorl %ebp, %ebp
testl %esi, %esi
je 0x2dab
movq %rbx, %rdi
callq 0x25e1
testl %eax, %eax
je 0x2dab
cmpq $0x0, 0x58(%rbx)
je 0x2dab
movl $0xc0, %ebp
addl 0x3c(%rbx), %ebp
movl %ebp, 0x40(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_set_video_enabled
void plm_set_video_enabled(plm_t *self, int enabled) {
	self->video_enabled = enabled;

	if (!enabled) {
		self->video_packet_type = 0;
		return;
	}

	self->video_packet_type = (plm_init_decoders(self) && self->video_decoder)
		? PLM_DEMUX_PACKET_VIDEO_1
		: 0;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl %esi, 0x1c(%rdi)
xorl %ebp, %ebp
testl %esi, %esi
je 0x2df4
movq %rbx, %rdi
callq 0x25e1
testl %eax, %eax
je 0x2df4
xorl %eax, %eax
cmpq $0x0, 0x30(%rbx)
movl $0xe0, %ebp
cmovel %eax, %ebp
movl %ebp, 0x20(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_rewind
void plm_rewind(plm_t *self) {
	if (self->video_decoder) {
		plm_video_rewind(self->video_decoder);
	}

	if (self->audio_decoder) {
		plm_audio_rewind(self->audio_decoder);
	}

	plm_demux_rewind(self->demux);
	self->time = 0;
	self->has_ended = FALSE;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x30(%rdi), %r14
testq %r14, %r14
je 0x3172
movq 0xa0(%r14), %rdi
xorl %r15d, %r15d
xorl %esi, %esi
callq 0x4120
movq $0x0, 0x10(%r14)
movl %r15d, 0x18(%r14)
movl %r15d, 0x2f8(%r14)
movl $0xffffffff, 0x40(%r14) # imm = 0xFFFFFFFF
movq 0x58(%rbx), %r14
testq %r14, %r14
je 0x3198
movq 0x30(%r14), %rdi
xorl %r15d, %r15d
xorl %esi, %esi
callq 0x4120
movq $0x0, (%r14)
movl %r15d, 0x8(%r14)
movl %r15d, 0x28(%r14)
movq (%rbx), %r14
movq (%r14), %rdi
xorl %r15d, %r15d
xorl %esi, %esi
callq 0x4120
movq %r15, 0x60(%r14)
movq %r15, 0x80(%r14)
movl $0xffffffff, 0x38(%r14) # imm = 0xFFFFFFFF
movq %r15, 0x8(%rbx)
movl $0x0, 0x10(%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_video_rewind
void plm_video_rewind(plm_video_t *self) {
	plm_buffer_rewind(self->buffer);
	self->time = 0;
	self->frames_decoded = 0;
	self->has_reference_frame = FALSE;
	self->start_code = -1;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0xa0(%rdi), %rdi
xorl %r14d, %r14d
xorl %esi, %esi
callq 0x4120
movq $0x0, 0x10(%rbx)
movl %r14d, 0x18(%rbx)
movl %r14d, 0x2f8(%rbx)
movl $0xffffffff, 0x40(%rbx) # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_audio_rewind
void plm_audio_rewind(plm_audio_t *self) {
	plm_buffer_rewind(self->buffer);
	self->time = 0;
	self->samples_decoded = 0;
	self->next_frame_data_size = 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x30(%rdi), %rdi
xorl %r14d, %r14d
xorl %esi, %esi
callq 0x4120
movq $0x0, (%rbx)
movl %r14d, 0x8(%rbx)
movl %r14d, 0x28(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_demux_rewind
void plm_demux_rewind(plm_demux_t *self) {
	plm_buffer_rewind(self->buffer);
	self->current_packet.length = 0;
	self->next_packet.length = 0;
	self->start_code = -1;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %rdi
xorl %r14d, %r14d
xorl %esi, %esi
callq 0x4120
movq %r14, 0x60(%rbx)
movq %r14, 0x80(%rbx)
movl $0xffffffff, 0x38(%rbx) # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_audio_decode
plm_samples_t *plm_audio_decode(plm_audio_t *self) {
	// Do we have at least enough information to decode the frame header?
	if (!self->next_frame_data_size) {
		if (!plm_buffer_has(self->buffer, 48)) {
			return NULL;
		}
		self->next_frame_data_size = plm_audio_decode_header(self);
	}

	if (
		self->next_frame_data_size == 0 ||
		!plm_buffer_has(self->buffer, self->next_frame_data_size << 3)
	) {
		return NULL;
	}

	plm_audio_decode_frame(self);
	self->next_frame_data_size = 0;
	
	self->samples.time = self->time;

	self->samples_decoded += PLM_AUDIO_SAMPLES_PER_FRAME;
	self->time = (double)self->samples_decoded / 
		(double)PLM_AUDIO_SAMPLE_RATE[self->samplerate_index];
	
	return &self->samples;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl 0x28(%rdi), %eax
testl %eax, %eax
je 0x358f
movq 0x30(%rbx), %rdi
shll $0x3, %eax
movslq %eax, %rsi
callq 0x41a8
testl %eax, %eax
je 0x35b4
movq %rbx, %rdi
callq 0x7298
movl $0x0, 0x28(%rbx)
movsd (%rbx), %xmm0
leaq 0x880(%rbx), %rax
movsd %xmm0, 0x880(%rbx)
movl $0x480, %ecx            # imm = 0x480
addl 0x8(%rbx), %ecx
xorps %xmm0, %xmm0
cvtsi2sd %ecx, %xmm0
movl %ecx, 0x8(%rbx)
movslq 0xc(%rbx), %rcx
leaq 0x5ca3(%rip), %rdx      # 0x9220
movzwl (%rdx,%rcx,2), %ecx
cvtsi2sd %ecx, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, (%rbx)
jmp 0x35b6
movq 0x30(%rbx), %rdi
movl $0x30, %esi
callq 0x41a8
testl %eax, %eax
je 0x35b4
movq %rbx, %rdi
callq 0x708b
movl %eax, 0x28(%rbx)
testl %eax, %eax
jne 0x352b
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_decode_video
plm_frame_t *plm_decode_video(plm_t *self) {
	if (!plm_init_decoders(self)) {
		return NULL;
	}

	if (!self->video_packet_type) {
		return NULL;
	}

	plm_frame_t *frame = plm_video_decode(self->video_decoder);
	if (frame) {
		self->time = frame->time;
	}
	else if (plm_demux_has_ended(self->demux)) {
		plm_handle_end(self);
	}
	return frame;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x25e1
testl %eax, %eax
je 0x3620
cmpl $0x0, 0x20(%rbx)
je 0x3620
movq 0x30(%rbx), %rdi
callq 0x33e3
testq %rax, %rax
je 0x35fd
movsd (%rax), %xmm0
movsd %xmm0, 0x8(%rbx)
jmp 0x3622
movq (%rbx), %rax
movq (%rax), %rax
cmpl $0x0, 0x24(%rax)
je 0x3620
cmpl $0x0, 0x14(%rbx)
je 0x3619
movq %rbx, %rdi
callq 0x3135
jmp 0x3620
movl $0x1, 0x10(%rbx)
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_decode_audio
plm_samples_t *plm_decode_audio(plm_t *self) {
	if (!plm_init_decoders(self)) {
		return NULL;
	}

	if (!self->audio_packet_type) {
		return NULL;
	}

	plm_samples_t *samples = plm_audio_decode(self->audio_decoder);
	if (samples) {
		self->time = samples->time;
	}
	else if (plm_demux_has_ended(self->demux)) {
		plm_handle_end(self);
	}
	return samples;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x25e1
testl %eax, %eax
je 0x3673
cmpl $0x0, 0x40(%rbx)
je 0x3673
movq 0x58(%rbx), %rdi
callq 0x3520
testq %rax, %rax
je 0x3650
movsd (%rax), %xmm0
movsd %xmm0, 0x8(%rbx)
jmp 0x3675
movq (%rbx), %rax
movq (%rax), %rax
cmpl $0x0, 0x24(%rax)
je 0x3673
cmpl $0x0, 0x14(%rbx)
je 0x366c
movq %rbx, %rdi
callq 0x3135
jmp 0x3673
movl $0x1, 0x10(%rbx)
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_read_packets
void plm_read_packets(plm_t *self, int requested_type) {
	plm_packet_t *packet;
	while ((packet = plm_demux_decode(self->demux))) {
		if (packet->type == self->video_packet_type) {
			plm_buffer_write(self->video_buffer, packet->data, packet->length);
		}
		else if (packet->type == self->audio_packet_type) {
			plm_buffer_write(self->audio_buffer, packet->data, packet->length);
		}

		if (packet->type == requested_type) {
			return;
		}
	}

	if (plm_demux_has_ended(self->demux)) {
		if (self->video_buffer) {
			plm_buffer_signal_end(self->video_buffer);
		}
		if (self->audio_buffer) {
			plm_buffer_signal_end(self->audio_buffer);
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %ebp
movq %rdi, %rbx
leaq 0x50(%rdi), %r15
leaq 0x28(%rdi), %r12
movq (%rbx), %rdi
callq 0x36fb
testq %rax, %rax
je 0x36c5
movq %rax, %r14
movl (%rax), %ecx
movq %r12, %rax
cmpl 0x20(%rbx), %ecx
je 0x36ae
movq %r15, %rax
cmpl 0x40(%rbx), %ecx
jne 0x36be
movq (%rax), %rdi
movq 0x10(%r14), %rdx
movq 0x18(%r14), %rsi
callq 0x37af
cmpl %ebp, (%r14)
jne 0x368c
jmp 0x36f2
movq (%rbx), %rax
movq (%rax), %rax
cmpl $0x0, 0x24(%rax)
je 0x36f2
movq (%r12), %rax
testq %rax, %rax
je 0x36e2
movq 0x10(%rax), %rcx
movq %rcx, 0x18(%rax)
movq (%r15), %rax
testq %rax, %rax
je 0x36f2
movq 0x10(%rax), %rcx
movq %rcx, 0x18(%rax)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_demux_decode
plm_packet_t *plm_demux_decode(plm_demux_t *self) {
	if (!plm_demux_has_headers(self)) {
		return NULL;
	}

	if (self->current_packet.length) {
		size_t bits_till_next_packet = self->current_packet.length << 3;
		if (!plm_buffer_has(self->buffer, bits_till_next_packet)) {
			return NULL;
		}
		plm_buffer_skip(self->buffer, bits_till_next_packet);
		self->current_packet.length = 0;
	}

	// Pending packet waiting for data?
	if (self->next_packet.length) {
		return plm_demux_get_packet(self);
	}

	// Pending packet waiting for header?
	if (self->start_code != -1) {
		return plm_demux_decode_packet(self, self->start_code);
	}

	do {
		self->start_code = plm_buffer_next_start_code(self->buffer);
		if (
			self->start_code == PLM_DEMUX_PACKET_VIDEO_1 || 
			self->start_code == PLM_DEMUX_PACKET_PRIVATE || (
				self->start_code >= PLM_DEMUX_PACKET_AUDIO_1 && 
				self->start_code <= PLM_DEMUX_PACKET_AUDIO_4
			)
		) {
			return plm_demux_decode_packet(self, self->start_code);
		}
	} while (self->start_code != -1);

	return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
callq 0x27a8
testl %eax, %eax
je 0x37a7
movq 0x60(%rbx), %r14
testq %r14, %r14
je 0x3749
shlq $0x3, %r14
movq (%rbx), %rdi
movq %r14, %rsi
callq 0x41a8
testl %eax, %eax
je 0x37a7
movq (%rbx), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x41a8
testl %eax, %eax
je 0x3741
addq %r14, (%r15)
movq $0x0, 0x60(%rbx)
cmpq $0x0, 0x80(%rbx)
je 0x3760
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x468f
movl 0x38(%rbx), %esi
cmpl $-0x1, %esi
je 0x377f
movq %rbx, %rdi
jmp 0x379d
movl %eax, %ecx
andl $-0x4, %ecx
cmpl $0xc0, %ecx
je 0x3798
cmpl $-0x1, %eax
je 0x37a7
movq (%rbx), %rdi
callq 0x4320
movl %eax, 0x38(%rbx)
cmpl $0xbd, %eax
je 0x3798
cmpl $0xe0, %eax
jne 0x376d
movq %rbx, %rdi
movl %eax, %esi
popq %rbx
popq %r14
popq %r15
jmp 0x4559
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_buffer_write
size_t plm_buffer_write(plm_buffer_t *self, uint8_t *bytes, size_t length) {
	if (self->mode == PLM_BUFFER_MODE_FIXED_MEM) {
		return 0;
	}

	if (self->discard_read_bytes) {
		// This should be a ring buffer, but instead it just shifts all unread 
		// data to the beginning of the buffer and appends new data at the end. 
		// Seems to be good enough.

		plm_buffer_discard_read_bytes(self);
		if (self->mode == PLM_BUFFER_MODE_RING) {
			self->total_size = 0;
		}
	}

	// Do we have to resize to fit the new data?
	size_t bytes_available = self->capacity - self->length;
	if (bytes_available < length) {
		size_t new_size = self->capacity;
		do {
			new_size *= 2;
		} while (new_size - self->length < length);
		self->bytes = (uint8_t *)PLM_REALLOC(self->bytes, new_size);
		self->capacity = new_size;
	}

	memcpy(self->bytes + self->length, bytes, length);
	self->length += length;
	self->has_ended = FALSE;
	return length;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
cmpl $0x1, 0x60(%rdi)
jne 0x37c1
xorl %ebx, %ebx
jmp 0x3840
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
cmpl $0x0, 0x20(%rdi)
je 0x37e7
movq %r14, %rdi
callq 0x40c8
cmpl $0x2, 0x60(%r14)
jne 0x37e7
movq $0x0, 0x18(%r14)
movq 0x8(%r14), %r12
movq 0x10(%r14), %rdi
movq %r12, %rax
subq %rdi, %rax
cmpq %rbx, %rax
jae 0x3822
addq %r12, %r12
movq %r12, %rax
subq %rdi, %rax
cmpq %rbx, %rax
jb 0x37fa
movq 0x58(%r14), %rdi
movq %r12, %rsi
callq 0x2260
movq %rax, 0x58(%r14)
movq %r12, 0x8(%r14)
movq 0x10(%r14), %rdi
jmp 0x3826
movq 0x58(%r14), %rax
addq %rax, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x2140
addq %rbx, 0x10(%r14)
movl $0x0, 0x24(%r14)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_demux_get_start_time
double plm_demux_get_start_time(plm_demux_t *self, int type) {
	if (self->start_time != PLM_PACKET_INVALID_TS) {
		return self->start_time;
	}

	int previous_pos = plm_buffer_tell(self->buffer);
	int previous_start_code = self->start_code;
	
	// Find first video PTS
	plm_demux_rewind(self);
	do {
		plm_packet_t *packet = plm_demux_decode(self);
		if (!packet) {
			break;
		}
		if (packet->type == type) {
			self->start_time = packet->pts;
		}
	} while (self->start_time == PLM_PACKET_INVALID_TS);

	plm_demux_buffer_seek(self, previous_pos);
	self->start_code = previous_start_code;
	return self->start_time;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movsd 0x28(%rdi), %xmm0
ucomisd 0x5841(%rip), %xmm0     # 0x9230
jne 0x3aa1
jp 0x3aa1
movl %esi, %ebp
movq %rdi, %rbx
movq (%rdi), %r14
movq 0x48(%r14), %rax
testq %rax, %rax
je 0x3a28
movq 0x50(%r14), %rsi
movq %r14, %rdi
callq *%rax
movq (%r14), %r15
shrq $0x3, %r15
addq %rax, %r15
subq 0x10(%r14), %r15
movq (%rbx), %r14
jmp 0x3a2f
movq (%r14), %r15
shrq $0x3, %r15
movl 0x38(%rbx), %r12d
xorl %r13d, %r13d
movq %r14, %rdi
xorl %esi, %esi
callq 0x4120
movq %r13, 0x60(%rbx)
movq %r13, 0x80(%rbx)
movl $0xffffffff, 0x38(%rbx) # imm = 0xFFFFFFFF
movq %rbx, %rdi
callq 0x36fb
testq %rax, %rax
je 0x3a80
cmpl %ebp, (%rax)
jne 0x3a6f
movsd 0x8(%rax), %xmm0
movsd %xmm0, 0x28(%rbx)
jmp 0x3a74
movsd 0x28(%rbx), %xmm0
ucomisd 0x57b4(%rip), %xmm0     # 0x9230
jne 0x3a80
jnp 0x3a52
movslq %r15d, %rsi
movq (%rbx), %rdi
callq 0x4120
xorl %eax, %eax
movq %rax, 0x60(%rbx)
movq %rax, 0x80(%rbx)
movl %r12d, 0x38(%rbx)
movsd 0x28(%rbx), %xmm0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_seek
int plm_seek(plm_t *self, double time, int seek_exact) {
	plm_frame_t *frame = plm_seek_frame(self, time, seek_exact);
	
	if (!frame) {
		return FALSE;
	}

	if (self->video_decode_callback) {
		self->video_decode_callback(self, frame, self->video_decode_callback_user_data);	
	}

	// If audio is not enabled we are done here.
	if (!self->audio_packet_type) {
		return TRUE;
	}

	// Sync up Audio. This demuxes more packets until the first audio packet
	// with a PTS greater than the current time is found. plm_decode() is then
	// called to decode enough audio data to satisfy the audio_lead_time.

	double start_time = plm_demux_get_start_time(self->demux, self->video_packet_type);
	plm_audio_rewind(self->audio_decoder);

	plm_packet_t *packet = NULL;
	while ((packet = plm_demux_decode(self->demux))) {
		if (packet->type == self->video_packet_type) {
			plm_buffer_write(self->video_buffer, packet->data, packet->length);
		}
		else if (
			packet->type == self->audio_packet_type &&
			packet->pts - start_time > self->time
		) {
			plm_audio_set_time(self->audio_decoder, packet->pts - start_time);
			plm_buffer_write(self->audio_buffer, packet->data, packet->length);
			plm_decode(self, 0);
			break;
		}
	}	
	
	return TRUE;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x3858
testq %rax, %rax
je 0x3f38
movq 0x60(%rbx), %rcx
testq %rcx, %rcx
je 0x3e76
movq 0x68(%rbx), %rdx
movq %rbx, %rdi
movq %rax, %rsi
callq *%rcx
movl $0x1, %ebp
cmpl $0x0, 0x40(%rbx)
je 0x3f3a
movq (%rbx), %rdi
movl 0x20(%rbx), %esi
callq 0x39d7
movsd %xmm0, (%rsp)
movq 0x58(%rbx), %r14
movq 0x30(%r14), %rdi
xorl %r15d, %r15d
xorl %esi, %esi
callq 0x4120
movq $0x0, (%r14)
movl %r15d, 0x8(%r14)
movl %r15d, 0x28(%r14)
movq (%rbx), %rdi
callq 0x36fb
testq %rax, %rax
je 0x3f3a
movl (%rax), %ecx
cmpl 0x20(%rbx), %ecx
jne 0x3edd
movq 0x28(%rbx), %rdi
movq 0x10(%rax), %rdx
movq 0x18(%rax), %rsi
callq 0x37af
jmp 0x3eb6
cmpl 0x40(%rbx), %ecx
jne 0x3eb6
movsd 0x8(%rax), %xmm0
subsd (%rsp), %xmm0
ucomisd 0x8(%rbx), %xmm0
jbe 0x3eb6
movq 0x58(%rbx), %rcx
movslq 0xc(%rcx), %rdx
leaq 0x531e(%rip), %rsi      # 0x9220
movzwl (%rsi,%rdx,2), %edx
cvtsi2sd %edx, %xmm1
mulsd %xmm0, %xmm1
cvttsd2si %xmm1, %edx
movl %edx, 0x8(%rcx)
movsd %xmm0, (%rcx)
movq 0x50(%rbx), %rdi
movq 0x10(%rax), %rdx
movq 0x18(%rax), %rsi
callq 0x37af
xorpd %xmm0, %xmm0
movq %rbx, %rdi
callq 0x327e
jmp 0x3f3a
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_buffer_load_file_callback
void plm_buffer_load_file_callback(plm_buffer_t *self, void *user) {
	PLM_UNUSED(user);
	
	if (self->discard_read_bytes) {
		plm_buffer_discard_read_bytes(self);
	}

	size_t bytes_available = self->capacity - self->length;
	size_t bytes_read = fread(self->bytes + self->length, 1, bytes_available, self->fh);
	self->length += bytes_read;

	if (bytes_read == 0) {
		self->has_ended = TRUE;
	}
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
cmpl $0x0, 0x20(%rdi)
je 0x3f7c
movq %rbx, %rdi
callq 0x40c8
movq 0x8(%rbx), %rdx
movq 0x10(%rbx), %rdi
subq %rdi, %rdx
addq 0x58(%rbx), %rdi
movq 0x30(%rbx), %rcx
movl $0x1, %esi
callq 0x2220
addq %rax, 0x10(%rbx)
testq %rax, %rax
jne 0x3fa9
movl $0x1, 0x24(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_buffer_create_with_callbacks
plm_buffer_t *plm_buffer_create_with_callbacks(
	plm_buffer_load_callback load_callback,
	plm_buffer_seek_callback seek_callback,
	plm_buffer_tell_callback tell_callback,
	size_t length,
	void *user
) {
	plm_buffer_t *self = plm_buffer_create_with_capacity(PLM_BUFFER_DEFAULT_SIZE);
	self->mode = PLM_BUFFER_MODE_FILE;
	self->total_size = length;
	self->load_callback = load_callback;
	self->seek_callback = seek_callback;
	self->tell_callback = tell_callback;
	self->load_callback_user_data = user;
	return self;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, (%rsp)
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r13
movl $0x1, %edi
movl $0x68, %esi
callq 0x2110
movq %rax, %rbp
movq $0x20000, 0x8(%rax)     # imm = 0x20000
movl $0x1, %ebx
movl %ebx, 0x28(%rax)
movl $0x20000, %edi          # imm = 0x20000
callq 0x2210
movq %rax, 0x58(%rbp)
movl %ebx, 0x20(%rbp)
movq %r14, 0x18(%rbp)
movq %r13, 0x38(%rbp)
movq %r12, 0x40(%rbp)
movq %r15, 0x48(%rbp)
movq (%rsp), %rax
movq %rax, 0x50(%rbp)
movq %rbp, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_buffer_create_for_appending
plm_buffer_t *plm_buffer_create_for_appending(size_t initial_capacity) {
	plm_buffer_t *self = plm_buffer_create_with_capacity(initial_capacity);
	self->mode = PLM_BUFFER_MODE_APPEND;
	self->discard_read_bytes = FALSE;
	return self;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x1, %edi
movl $0x68, %esi
callq 0x2110
movq %rax, %r14
movq %rbx, 0x8(%rax)
movl $0x1, 0x28(%rax)
movq %rbx, %rdi
callq 0x2210
movq %rax, 0x58(%r14)
movl $0x3, 0x60(%r14)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_buffer_destroy
void plm_buffer_destroy(plm_buffer_t *self) {
#ifndef PLM_NO_STDIO
	if (self->fh && self->close_when_done) {
		fclose(self->fh);
	}
#endif
	if (self->free_when_done) {
		PLM_FREE(self->bytes);
	}
	PLM_FREE(self);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x30(%rdi), %rdi
testq %rdi, %rdi
je 0x4092
cmpl $0x0, 0x2c(%rbx)
je 0x4092
callq 0x2170
cmpl $0x0, 0x28(%rbx)
je 0x40a1
movq 0x58(%rbx), %rdi
callq 0x21c0
movq %rbx, %rdi
popq %rbx
jmp 0x21c0
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_buffer_discard_read_bytes
void plm_buffer_discard_read_bytes(plm_buffer_t *self) {
	size_t byte_pos = self->bit_index >> 3;
	if (byte_pos == self->length) {
		self->bit_index = 0;
		self->length = 0;
	}
	else if (byte_pos > 0) {
		memmove(self->bytes, self->bytes + byte_pos, self->length - byte_pos);
		self->bit_index -= byte_pos << 3;
		self->length -= byte_pos;
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %r15
movq 0x10(%rdi), %rdx
movq %r15, %r14
shrq $0x3, %r14
subq %r14, %rdx
jne 0x40ee
movq $0x0, (%rbx)
xorl %eax, %eax
jmp 0x410f
cmpq $0x8, %r15
jb 0x4113
movq 0x58(%rbx), %rdi
leaq (%rdi,%r14), %rsi
callq 0x2250
andq $-0x8, %r15
subq %r15, (%rbx)
movq 0x10(%rbx), %rax
subq %r14, %rax
movq %rax, 0x10(%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_buffer_seek
void plm_buffer_seek(plm_buffer_t *self, size_t pos) {
	self->has_ended = FALSE;

	if (self->seek_callback) {
		self->seek_callback(self, pos, self->load_callback_user_data);
		self->bit_index = 0;
		self->length = 0;
	}
	else if (self->mode == PLM_BUFFER_MODE_RING) {
		if (pos != 0) {
			// Seeking to non-0 is forbidden for dynamic-mem buffers
			return; 
		}
		self->bit_index = 0;
		self->length = 0;
		self->total_size = 0;
	}
	else if (pos < self->length) {
		self->bit_index = pos << 3;
	}
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl $0x0, 0x24(%rdi)
movq 0x40(%rdi), %rax
testq %rax, %rax
je 0x4148
movq 0x50(%rbx), %rdx
movq %rbx, %rdi
callq *%rax
xorl %eax, %eax
movq %rax, (%rbx)
movq %rax, 0x10(%rbx)
popq %rbx
retq
cmpl $0x2, 0x60(%rbx)
jne 0x4163
testq %rsi, %rsi
jne 0x4146
movq $0x0, (%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
jmp 0x4146
cmpq %rsi, 0x10(%rbx)
jbe 0x4146
shlq $0x3, %rsi
movq %rsi, (%rbx)
jmp 0x4146
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_buffer_has
int plm_buffer_has(plm_buffer_t *self, size_t count) {
	if (((self->length << 3) - self->bit_index) >= count) {
		return TRUE;
	}

	if (self->load_callback) {
		self->load_callback(self, self->load_callback_user_data);
		
		if (((self->length << 3) - self->bit_index) >= count) {
			return TRUE;
		}
	}	
	
	if (self->total_size != 0 && self->length == self->total_size) {
		self->has_ended = TRUE;
	}
	return FALSE;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq 0x10(%rdi), %rax
leaq (,%rax,8), %rcx
subq (%rdi), %rcx
movl $0x1, %ebp
cmpq %rsi, %rcx
jae 0x420e
movq %rdi, %rbx
movq 0x38(%rdi), %rcx
testq %rcx, %rcx
je 0x41f1
movq %rsi, %r14
movq 0x50(%rbx), %rsi
movq %rbx, %rdi
callq *%rcx
movq 0x10(%rbx), %rax
leaq (,%rax,8), %rcx
subq (%rbx), %rcx
cmpq %r14, %rcx
jae 0x420e
movq 0x18(%rbx), %rcx
testq %rcx, %rcx
sete %dl
cmpq %rcx, %rax
setne %al
xorl %ebp, %ebp
orb %dl, %al
jne 0x420e
movl $0x1, 0x24(%rbx)
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_buffer_read
int plm_buffer_read(plm_buffer_t *self, int count) {
	if (!plm_buffer_has(self, count)) {
		return 0;
	}

	int value = 0;
	while (count) {
		int current_byte = self->bytes[self->bit_index >> 3];

		int remaining = 8 - (self->bit_index & 7); // Remaining bits in byte
		int read = remaining < count ? remaining : count; // Bits in self run
		int shift = remaining - read;
		int mask = (0xff >> (8 - read));

		value = (value << read) | ((current_byte & (mask << shift)) >> shift);

		self->bit_index += read;
		count -= read;
	}

	return value;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
movslq %esi, %r15
movq %r15, %rsi
callq 0x41a8
testl %eax, %eax
sete %cl
testl %r15d, %r15d
sete %dl
xorl %eax, %eax
orb %cl, %dl
jne 0x4294
movq (%r14), %rdi
movq 0x58(%r14), %r8
xorl %eax, %eax
movq %rdi, %r9
shrq $0x3, %r9
movl %edi, %ecx
andl $0x7, %ecx
movl $0x8, %edx
subl %ecx, %edx
cmpl %ebx, %edx
movl %ebx, %esi
cmovll %edx, %esi
subl %esi, %edx
movb $0x8, %cl
subb %sil, %cl
movl $0xff, %r10d
shrl %cl, %r10d
movl %esi, %ecx
shll %cl, %eax
movl %edx, %ecx
shll %cl, %r10d
movzbl (%r8,%r9), %ecx
andl %ecx, %r10d
movl %edx, %ecx
shrl %cl, %r10d
orl %r10d, %eax
movslq %esi, %rcx
addq %rcx, %rdi
movq %rdi, (%r14)
subl %ecx, %ebx
jne 0x4244
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_buffer_skip_bytes
int plm_buffer_skip_bytes(plm_buffer_t *self, uint8_t v) {
	plm_buffer_align(self);
	int skipped = 0;
	while (plm_buffer_has(self, 8) && self->bytes[self->bit_index >> 3] == v) {
		self->bit_index += 8;
		skipped++;
	}
	return skipped;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
movq (%rdi), %rax
addq $0x7, %rax
andq $-0x8, %rax
movq %rax, (%rdi)
movl $0x8, %esi
callq 0x41a8
xorl %ebp, %ebp
testl %eax, %eax
je 0x4319
movq (%r14), %rax
movq 0x58(%r14), %rcx
movq %rax, %rdx
shrq $0x3, %rdx
cmpb %bl, (%rcx,%rdx)
jne 0x4319
addq $0x8, %rax
movq %rax, (%r14)
incl %ebp
movl $0x8, %esi
movq %r14, %rdi
callq 0x41a8
jmp 0x42ea
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_buffer_next_start_code
int plm_buffer_next_start_code(plm_buffer_t *self) {
	plm_buffer_align(self);

	while (plm_buffer_has(self, (5 << 3))) {
		size_t byte_index = (self->bit_index) >> 3;
		if (
			self->bytes[byte_index] == 0x00 &&
			self->bytes[byte_index + 1] == 0x00 &&
			self->bytes[byte_index + 2] == 0x01
		) {
			self->bit_index = (byte_index + 4) << 3;
			return self->bytes[byte_index + 3];
		}
		self->bit_index += 8;
	}
	return -1;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %rax
addq $0x7, %rax
andq $-0x8, %rax
movq %rax, (%rdi)
movl $0x28, %esi
callq 0x41a8
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %eax, %eax
je 0x438f
movq (%rbx), %rax
movq 0x58(%rbx), %rcx
movq %rax, %rdx
shrq $0x3, %rdx
cmpb $0x0, (%rcx,%rdx)
jne 0x4369
cmpb $0x0, 0x1(%rcx,%rdx)
jne 0x4369
cmpb $0x1, 0x2(%rcx,%rdx)
je 0x437f
addq $0x8, %rax
movq %rax, (%rbx)
movl $0x28, %esi
movq %rbx, %rdi
callq 0x41a8
jmp 0x4343
andq $-0x8, %rax
addq $0x20, %rax
movq %rax, (%rbx)
movzbl 0x3(%rcx,%rdx), %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_buffer_find_start_code
int plm_buffer_find_start_code(plm_buffer_t *self, int code) {
	int current = 0;
	while (TRUE) {
		current = plm_buffer_next_start_code(self);
		if (current == code || current == -1) {
			return current;
		}
	}
	return -1;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
movq %r14, %rdi
callq 0x4320
cmpl %ebx, %eax
je 0x43b2
cmpl $-0x1, %eax
jne 0x43a1
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_buffer_has_start_code
int plm_buffer_has_start_code(plm_buffer_t *self, int code) {
	size_t previous_bit_index = self->bit_index;
	int previous_discard_read_bytes = self->discard_read_bytes;
	
	self->discard_read_bytes = FALSE;
	int current = plm_buffer_find_start_code(self, code);

	self->bit_index = previous_bit_index;
	self->discard_read_bytes = previous_discard_read_bytes;
	return current;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
movq (%rdi), %r14
movl 0x20(%rdi), %r15d
movl $0x0, 0x20(%rdi)
movq %rbx, %rdi
callq 0x4320
cmpl %ebp, %eax
je 0x43e5
cmpl $-0x1, %eax
jne 0x43d4
movq %r14, (%rbx)
movl %r15d, 0x20(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_buffer_peek_non_zero
int plm_buffer_peek_non_zero(plm_buffer_t *self, int bit_count) {
	if (!plm_buffer_has(self, bit_count)) {
		return FALSE;
	}

	int val = plm_buffer_read(self, bit_count);
	self->bit_index -= bit_count;
	return val != 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movslq %esi, %r14
movq %r14, %rsi
callq 0x41a8
testl %eax, %eax
je 0x4426
movq %rbx, %rdi
movl %r14d, %esi
callq 0x4215
subq %r14, (%rbx)
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
setne %al
jmp 0x4428
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_buffer_read_vlc
int16_t plm_buffer_read_vlc(plm_buffer_t *self, const plm_vlc_t *table) {
	plm_vlc_t state = {0, 0};
	do {
		state = table[state.index + plm_buffer_read(self, 1)];
	} while (state.index > 0);
	return state.value;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
xorl %eax, %eax
movzwl %ax, %ebp
movq %r14, %rdi
movl $0x1, %esi
callq 0x4215
addl %ebp, %eax
movslq %eax, %rcx
movzwl (%rbx,%rcx,4), %eax
testw %ax, %ax
jg 0x443c
movzwl 0x2(%rbx,%rcx,4), %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_demux_decode_time
double plm_demux_decode_time(plm_demux_t *self) {
	int64_t clock = plm_buffer_read(self->buffer, 3) << 30;
	plm_buffer_skip(self->buffer, 1);
	clock |= plm_buffer_read(self->buffer, 15) << 15;
	plm_buffer_skip(self->buffer, 1);
	clock |= plm_buffer_read(self->buffer, 15);
	plm_buffer_skip(self->buffer, 1);
	return (double)clock / 90000.0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movq (%rdi), %rdi
movl $0x3, %esi
callq 0x4215
movl %eax, %ebx
movq (%r14), %r15
movl $0x1, %esi
movq %r15, %rdi
callq 0x41a8
testl %eax, %eax
je 0x44c8
incq (%r15)
movq (%r14), %rdi
movl $0xf, %esi
callq 0x4215
movl %eax, %ebp
movq (%r14), %r15
movl $0x1, %esi
movq %r15, %rdi
callq 0x41a8
testl %eax, %eax
je 0x44ee
incq (%r15)
movq (%r14), %rdi
movl $0xf, %esi
callq 0x4215
movl %eax, %r15d
movq (%r14), %r14
movl $0x1, %esi
movq %r14, %rdi
callq 0x41a8
testl %eax, %eax
je 0x4515
incq (%r14)
shll $0x1e, %ebx
shll $0xf, %ebp
orl %ebx, %ebp
orl %r15d, %ebp
cvtsi2sd %ebp, %xmm0
divsd 0x4d14(%rip), %xmm0     # 0x9240
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_demux_buffer_seek
void plm_demux_buffer_seek(plm_demux_t *self, size_t pos) {
	plm_buffer_seek(self->buffer, pos);
	self->current_packet.length = 0;
	self->next_packet.length = 0;
	self->start_code = -1;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rdi
callq 0x4120
xorl %eax, %eax
movq %rax, 0x60(%rbx)
movq %rax, 0x80(%rbx)
movl $0xffffffff, 0x38(%rbx) # imm = 0xFFFFFFFF
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_demux_decode_packet
plm_packet_t *plm_demux_decode_packet(plm_demux_t *self, int type) {
	if (!plm_buffer_has(self->buffer, 16 << 3)) {
		return NULL;
	}

	self->start_code = -1;

	self->next_packet.type = type;
	self->next_packet.length = plm_buffer_read(self->buffer, 16);
	self->next_packet.length -= plm_buffer_skip_bytes(self->buffer, 0xff); // stuffing

	// skip P-STD
	if (plm_buffer_read(self->buffer, 2) == 0x01) {
		plm_buffer_skip(self->buffer, 16);
		self->next_packet.length -= 2;
	}

	int pts_dts_marker = plm_buffer_read(self->buffer, 2);
	if (pts_dts_marker == 0x03) {
		self->next_packet.pts = plm_demux_decode_time(self);
		self->last_decoded_pts = self->next_packet.pts;
		plm_buffer_skip(self->buffer, 40); // skip dts
		self->next_packet.length -= 10;
	}
	else if (pts_dts_marker == 0x02) {
		self->next_packet.pts = plm_demux_decode_time(self);
		self->last_decoded_pts = self->next_packet.pts;
		self->next_packet.length -= 5;
	}
	else if (pts_dts_marker == 0x00) {
		self->next_packet.pts = PLM_PACKET_INVALID_TS;
		plm_buffer_skip(self->buffer, 4);
		self->next_packet.length -= 1;
	}
	else {
		return NULL; // invalid
	}
	
	return plm_demux_get_packet(self);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebp
movq %rdi, %rbx
movq (%rdi), %rdi
movl $0x80, %esi
callq 0x41a8
testl %eax, %eax
je 0x462d
movl $0xffffffff, 0x38(%rbx) # imm = 0xFFFFFFFF
movl %ebp, 0x70(%rbx)
movq (%rbx), %rdi
movl $0x10, %esi
callq 0x4215
cltq
movq %rax, 0x80(%rbx)
movq (%rbx), %rdi
movl $0xff, %esi
callq 0x42c7
cltq
subq %rax, 0x80(%rbx)
movq (%rbx), %rdi
movl $0x2, %esi
callq 0x4215
cmpl $0x1, %eax
jne 0x45df
movq (%rbx), %r14
movl $0x10, %esi
movq %r14, %rdi
callq 0x41a8
testl %eax, %eax
je 0x45d7
addq $0x10, (%r14)
addq $-0x2, 0x80(%rbx)
movq (%rbx), %rdi
movl $0x2, %esi
callq 0x4215
testl %eax, %eax
je 0x464f
cmpl $0x2, %eax
je 0x4634
cmpl $0x3, %eax
jne 0x462d
movq %rbx, %rdi
callq 0x4498
movsd %xmm0, 0x78(%rbx)
movsd %xmm0, 0x20(%rbx)
movq (%rbx), %r14
movl $0x28, %esi
movq %r14, %rdi
callq 0x41a8
movq $-0xa, %rcx
testl %eax, %eax
je 0x467c
addq $0x28, (%r14)
jmp 0x467c
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
movq %rbx, %rdi
callq 0x4498
movsd %xmm0, 0x78(%rbx)
movsd %xmm0, 0x20(%rbx)
movq $-0x5, %rcx
jmp 0x467c
movabsq $-0x4010000000000000, %rax # imm = 0xBFF0000000000000
movq %rax, 0x78(%rbx)
movq (%rbx), %r14
movl $0x4, %esi
movq %r14, %rdi
callq 0x41a8
movq $-0x1, %rcx
testl %eax, %eax
je 0x467c
addq $0x4, (%r14)
addq %rcx, 0x80(%rbx)
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x468f
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_demux_get_packet
plm_packet_t *plm_demux_get_packet(plm_demux_t *self) {
	if (!plm_buffer_has(self->buffer, self->next_packet.length << 3)) {
		return NULL;
	}

	self->current_packet.data = self->buffer->bytes + (self->buffer->bit_index >> 3);
	self->current_packet.length = self->next_packet.length;
	self->current_packet.type = self->next_packet.type;
	self->current_packet.pts = self->next_packet.pts;

	self->next_packet.length = 0;
	return &self->current_packet;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rdi
movq 0x80(%rbx), %rsi
shlq $0x3, %rsi
callq 0x41a8
testl %eax, %eax
je 0x46e8
movq (%rbx), %rax
movq (%rax), %rcx
shrq $0x3, %rcx
addq 0x58(%rax), %rcx
leaq 0x50(%rbx), %rax
movq %rcx, 0x68(%rbx)
movq 0x80(%rbx), %rcx
movq %rcx, 0x60(%rbx)
movl 0x70(%rbx), %ecx
movl %ecx, 0x50(%rbx)
movsd 0x78(%rbx), %xmm0
movsd %xmm0, 0x58(%rbx)
movq $0x0, 0x80(%rbx)
jmp 0x46ea
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_video_decode_slice
void plm_video_decode_slice(plm_video_t *self, int slice) {
	self->slice_begin = TRUE;
	self->macroblock_address = (slice - 1) * self->mb_width - 1;

	// Reset motion vectors and DC predictors
	self->motion_backward.h = self->motion_forward.h = 0;
	self->motion_backward.v = self->motion_forward.v = 0;
	self->dc_predictor[0] = 128;
	self->dc_predictor[1] = 128;
	self->dc_predictor[2] = 128;

	self->quantizer_scale = plm_buffer_read(self->buffer, 5);

	// Skip extra
	while (plm_buffer_read(self->buffer, 1)) {
		plm_buffer_skip(self->buffer, 8);
	}

	do {
		plm_video_decode_macroblock(self);
	} while (
		self->macroblock_address < self->mb_size - 1 &&
		plm_buffer_peek_non_zero(self->buffer, 23)
	);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x1, 0x78(%rdi)
decl %esi
imull 0x24(%rdi), %esi
decl %esi
movl %esi, 0x7c(%rdi)
xorl %eax, %eax
movq %rax, 0x54(%rdi)
movq %rax, 0x68(%rdi)
movabsq $0x8000000080, %rax     # imm = 0x8000000080
movq %rax, 0x90(%rdi)
movl $0x80, 0x98(%rdi)
movq 0xa0(%rdi), %rdi
movl $0x5, %esi
callq 0x4215
movl %eax, 0x74(%rbx)
movq 0xa0(%rbx), %rdi
movl $0x1, %esi
callq 0x4215
testl %eax, %eax
je 0x4da4
movq 0xa0(%rbx), %r14
movl $0x8, %esi
movq %r14, %rdi
callq 0x41a8
testl %eax, %eax
je 0x4d5c
addq $0x8, (%r14)
jmp 0x4d5c
movq 0xa0(%rbx), %rdi
movl $0x17, %esi
callq 0x43f7
testl %eax, %eax
je 0x4db6
movq %rbx, %rdi
callq 0x4dbe
movl 0x2c(%rbx), %eax
decl %eax
cmpl %eax, 0x7c(%rbx)
jl 0x4d8f
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_video_predict_macroblock
void plm_video_predict_macroblock(plm_video_t *self) {
	int fw_h = self->motion_forward.h;
	int fw_v = self->motion_forward.v;

	if (self->motion_forward.full_px) {
		fw_h <<= 1;
		fw_v <<= 1;
	}

	if (self->picture_type == PLM_VIDEO_PICTURE_TYPE_B) {
		int bw_h = self->motion_backward.h;
		int bw_v = self->motion_backward.v;

		if (self->motion_backward.full_px) {
			bw_h <<= 1;
			bw_v <<= 1;
		}

		if (self->motion_forward.is_set) {
			plm_video_copy_macroblock(self, &self->frame_forward, fw_h, fw_v);
			if (self->motion_backward.is_set) {
				plm_video_interpolate_macroblock(self, &self->frame_backward, bw_h, bw_v);
			}
		}
		else {
			plm_video_copy_macroblock(self, &self->frame_backward, bw_h, bw_v);
		}
	}
	else {
		plm_video_copy_macroblock(self, &self->frame_forward, fw_h, fw_v);
	}
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movl 0x54(%rdi), %edx
movl 0x58(%rdi), %eax
cmpl $0x0, 0x48(%rdi)
setne %cl
shll %cl, %edx
shll %cl, %eax
cmpl $0x3, 0x44(%rdi)
jne 0x50bf
movl 0x68(%rbx), %r14d
movl 0x6c(%rbx), %ebp
cmpl $0x0, 0x5c(%rbx)
setne %cl
shll %cl, %r14d
shll %cl, %ebp
cmpl $0x0, 0x4c(%rbx)
je 0x50cd
leaq 0xf0(%rbx), %rsi
movq %rbx, %rdi
movl %eax, %ecx
callq 0x5698
cmpl $0x0, 0x60(%rbx)
je 0x50e5
leaq 0x130(%rbx), %rsi
movq %rbx, %rdi
movl %r14d, %edx
movl %ebp, %ecx
popq %rbx
popq %r14
popq %rbp
jmp 0x573d
leaq 0xf0(%rbx), %rsi
movq %rbx, %rdi
movl %eax, %ecx
jmp 0x50dc
leaq 0x130(%rbx), %rsi
movq %rbx, %rdi
movl %r14d, %edx
movl %ebp, %ecx
popq %rbx
popq %r14
popq %rbp
jmp 0x5698
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_video_decode_motion_vectors
void plm_video_decode_motion_vectors(plm_video_t *self) {

	// Forward
	if (self->motion_forward.is_set) {
		int r_size = self->motion_forward.r_size;
		self->motion_forward.h = plm_video_decode_motion_vector(self, r_size, self->motion_forward.h);
		self->motion_forward.v = plm_video_decode_motion_vector(self, r_size, self->motion_forward.v);
	}
	else if (self->picture_type == PLM_VIDEO_PICTURE_TYPE_PREDICTIVE) {
		// No motion information in P-picture, reset vectors
		self->motion_forward.h = 0;
		self->motion_forward.v = 0;
	}

	if (self->motion_backward.is_set) {
		int r_size = self->motion_backward.r_size;
		self->motion_backward.h = plm_video_decode_motion_vector(self, r_size, self->motion_backward.h);
		self->motion_backward.v = plm_video_decode_motion_vector(self, r_size, self->motion_backward.v);
	}
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpl $0x0, 0x4c(%rdi)
je 0x511b
movl 0x50(%rbx), %ebp
movl 0x54(%rbx), %edx
movq %rbx, %rdi
movl %ebp, %esi
callq 0x55d6
movl %eax, 0x54(%rbx)
movl 0x58(%rbx), %edx
movq %rbx, %rdi
movl %ebp, %esi
callq 0x55d6
movl %eax, 0x58(%rbx)
jmp 0x5129
cmpl $0x2, 0x44(%rbx)
jne 0x5129
movq $0x0, 0x54(%rbx)
cmpl $0x0, 0x60(%rbx)
je 0x5152
movl 0x64(%rbx), %ebp
movl 0x68(%rbx), %edx
movq %rbx, %rdi
movl %ebp, %esi
callq 0x55d6
movl %eax, 0x68(%rbx)
movl 0x6c(%rbx), %edx
movq %rbx, %rdi
movl %ebp, %esi
callq 0x55d6
movl %eax, 0x6c(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_video_decode_motion_vector
int plm_video_decode_motion_vector(plm_video_t *self, int r_size, int motion) {
	int fscale = 1 << r_size;
	int m_code = plm_buffer_read_vlc(self->buffer, PLM_VIDEO_MOTION);
	int r = 0;
	int d;

	if ((m_code != 0) && (fscale != 1)) {
		r = plm_buffer_read(self->buffer, r_size);
		d = ((abs(m_code) - 1) << r_size) + r + 1;
		if (m_code < 0) {
			d = -d;
		}
	}
	else {
		d = m_code;
	}

	motion += d;
	if (motion > (fscale << 4) - 1) {
		motion -= fscale << 5;
	}
	else if (motion < (int)((unsigned)(-fscale) << 4)) {
		motion += fscale << 5;
	}

	return motion;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %r14d
movl %esi, %ebx
movq %rdi, %r15
movq 0xa0(%rdi), %r12
xorl %eax, %eax
leaq 0x4127(%rip), %r13      # 0x9720
movzwl %ax, %ebp
movq %r12, %rdi
movl $0x1, %esi
callq 0x4215
addl %ebp, %eax
movslq %eax, %rcx
movzwl (%r13,%rcx,4), %eax
testw %ax, %ax
jg 0x55f9
movzwl 0x2(%r13,%rcx,4), %r12d
movswl %r12w, %ebp
testl %ebx, %ebx
je 0x5658
testw %r12w, %r12w
je 0x5658
movq 0xa0(%r15), %rdi
movl %ebx, %esi
callq 0x4215
movl %ebp, %edx
negl %edx
cmovsl %ebp, %edx
decl %edx
movl %ebx, %ecx
shll %cl, %edx
leal (%rax,%rdx), %ebp
addl %edx, %eax
incl %eax
testw %r12w, %r12w
notl %ebp
cmovnsl %eax, %ebp
addl %r14d, %ebp
movl $0x10, %eax
movl %ebx, %ecx
shll %cl, %eax
cmpl %eax, %ebp
jge 0x567c
movl $0xfffffff0, %eax       # imm = 0xFFFFFFF0
movl %ebx, %ecx
shll %cl, %eax
cmpl %eax, %ebp
jge 0x5687
movl $0x20, %eax
jmp 0x5681
movl $0xffffffe0, %eax       # imm = 0xFFFFFFE0
movl %ebx, %ecx
shll %cl, %eax
addl %eax, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_audio_find_frame_sync
int plm_audio_find_frame_sync(plm_audio_t *self) {
	size_t i;
	for (i = self->buffer->bit_index >> 3; i < self->buffer->length-1; i++) {
		if (
			self->buffer->bytes[i] == 0xFF &&
			(self->buffer->bytes[i+1] & 0xFE) == 0xFC
		) {
			self->buffer->bit_index = ((i+1) << 3) + 3;
			return TRUE;
		}
	}
	self->buffer->bit_index = (i + 1) << 3;
	return FALSE;
}

// Assembly:
movq 0x30(%rdi), %rcx
movq (%rcx), %rax
movq 0x10(%rcx), %rsi
shrq $0x3, %rax
leaq -0x1(%rsi), %rdi
cmpq %rdi, %rax
jae 0x7990
movq 0x58(%rcx), %r8
leaq 0xb(,%rax,8), %rdx
incq %rax
cmpb $-0x1, -0x1(%r8,%rax)
jne 0x7981
movb (%r8,%rax), %r9b
andb $-0x2, %r9b
cmpb $-0x4, %r9b
je 0x799e
addq $0x8, %rdx
incq %rax
cmpq %rax, %rsi
jne 0x796b
movq %rdi, %rax
leaq 0x8(,%rax,8), %rdx
xorl %eax, %eax
movq %rdx, (%rcx)
retq
movl $0x1, %eax
jmp 0x799a
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/pl_mpeg_player_sdl.c
// Function: app_destroy
void app_destroy(app_t *self) {
	plm_destroy(self->plm);

	if (self->audio_device) {
		SDL_CloseAudioDevice(self->audio_device);
	}

	if (self->texture) {
		SDL_DestroyTexture(self->texture);
	}

	if (self->renderer) {
		SDL_DestroyRenderer(self->renderer);
	}

	if (self->window) {
		SDL_DestroyWindow(self->window);
	}

	SDL_Quit();
	
	free(self);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rdi
callq 0x2ab1
movl 0x40(%rbx), %edi
testl %edi, %edi
je 0x8a39
callq 0x20c0
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x8a47
callq 0x2120
movq 0x20(%rbx), %rdi
testq %rdi, %rdi
je 0x8a55
callq 0x20b0
movq 0x18(%rbx), %rdi
testq %rdi, %rdi
je 0x8a63
callq 0x2040
callq 0x2070
movq %rbx, %rdi
popq %rbx
jmp 0x21c0
// File: /workspace/github_c_makefile_star2_O3/phoboslab[P]pl_mpeg/pl_mpeg_player_sdl.c
// Function: main
int main(int argc, char *argv[]) {
	if (argc < 2) {
		SDL_Log("Usage: pl_mpeg_player_sdl <file.mpg>");
		exit(1);
	}

	SDL_SetMainReady();
	
	app_t *app = app_create(argv[1]);
	while (!app->wants_to_quit) {
		app_update(app);
	}
	app_destroy(app);
	
	return EXIT_SUCCESS;
}

// Assembly:
pushq %rbx
cmpl $0x1, %edi
jle 0x8c51
movq %rsi, %rbx
callq 0x2100
movq 0x8(%rbx), %rdi
callq 0x8729
movq %rax, %rbx
cmpl $0x0, 0x10(%rax)
jne 0x8c45
movq %rbx, %rdi
callq 0x8a71
cmpl $0x0, 0x10(%rbx)
je 0x8c37
movq %rbx, %rdi
callq 0x8a21
xorl %eax, %eax
popq %rbx
retq
leaq 0x1b57(%rip), %rdi      # 0xa7af
xorl %eax, %eax
callq 0x2200
movl $0x1, %edi
callq 0x21d0
// File: /workspace/github_c_makefile_star2_O3/antonblanchard[P]will-it-scale/tests/context_switch1.c
// Function: testcase
void testcase(unsigned long long *iterations, unsigned long nr)
{
	struct args *a;
	char c;
	int ret;
	a = malloc(sizeof(struct args));
	assert(pipe(a->fd1) == 0);
	assert(pipe(a->fd2) == 0);

	new_task(child, a);

	while (1) {
		do {
			ret = write(a->fd1[WRITE], &c, 1);
		} while (ret != 1 && errno == EINTR);
		assert(ret == 1);

		do {
			ret = read(a->fd2[READ], &c, 1);
		} while (ret != 1 && errno == EINTR);
		assert(ret == 1);
			
		(*iterations) += 2;
	}

	free(a);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x10, %edi
callq 0x11d0
movq %rax, %r14
movq %rax, %rdi
callq 0x1160
testl %eax, %eax
jne 0x1d91
leaq 0x8(%r14), %r15
movq %r15, %rdi
callq 0x1160
testl %eax, %eax
jne 0x1db0
leaq 0xd2(%rip), %rdi        # 0x1e0d
movq %r14, %rsi
callq 0x13ce
leaq 0x7(%rsp), %r12
movl 0x4(%r14), %edi
movl $0x1, %edx
movq %r12, %rsi
callq 0x10d0
cmpl $0x1, %eax
jne 0x1d7f
movl (%r15), %edi
movl $0x1, %edx
movq %r12, %rsi
callq 0x1170
cmpl $0x1, %eax
je 0x1d8b
callq 0x1070
cmpl $0x4, (%rax)
je 0x1d5e
jmp 0x1dcf
callq 0x1070
cmpl $0x4, (%rax)
je 0x1d48
jmp 0x1dee
addq $0x2, (%rbx)
jmp 0x1d48
leaq 0x509(%rip), %rdi       # 0x22a1
leaq 0x514(%rip), %rsi       # 0x22b3
leaq 0x525(%rip), %rcx       # 0x22cb
movl $0x2d, %edx
callq 0x1130
leaq 0x547(%rip), %rdi       # 0x22fe
leaq 0x4f5(%rip), %rsi       # 0x22b3
leaq 0x506(%rip), %rcx       # 0x22cb
movl $0x2e, %edx
callq 0x1130
leaq 0x53a(%rip), %rdi       # 0x2310
leaq 0x4d6(%rip), %rsi       # 0x22b3
leaq 0x4e7(%rip), %rcx       # 0x22cb
movl $0x3b, %edx
callq 0x1130
leaq 0x51b(%rip), %rdi       # 0x2310
leaq 0x4b7(%rip), %rsi       # 0x22b3
leaq 0x4c8(%rip), %rcx       # 0x22cb
movl $0x36, %edx
callq 0x1130