// File: /workspace/github_c_makefile_star2_O0/tvlabs[P]edge264/edge264.c
// Function: edge264_flush
void edge264_flush(Edge264Decoder *dec) {
	if (dec == NULL)
		return;
	if (dec->n_threads)
		pthread_mutex_lock(&dec->lock);
	// FIXME interrupt all threads
	dec->currPic = dec->prevPic = -1;
	dec->reference_flags = dec->long_term_flags = dec->output_flags = dec->second_views = 0;
	for (unsigned b = dec->busy_tasks; b; b &= b - 1) {
		Edge264Task *t = dec->tasks + __builtin_ctz(b);
		if (t->free_cb)
			t->free_cb(t->free_arg, 0);
	}
	dec->busy_tasks = dec->pending_tasks = dec->ready_tasks = 0;
	dec->task_dependencies_v[0] = dec->task_dependencies_v[1] = dec->task_dependencies_v[2] = dec->task_dependencies_v[3] = (i32x4){};
	dec->taskPics_v = set8(-1);
	if (dec->n_threads)
		pthread_mutex_unlock(&dec->lock);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x1c308
jmp 0x1c539
movq -0x30(%rbp), %rax
cmpb $0x0, 0x20(%rax)
je 0x1c322
movq -0x30(%rbp), %rdi
addq $0x1580, %rdi           # imm = 0x1580
callq 0x7160
movq -0x30(%rbp), %rax
movb $-0x1, 0x25(%rax)
movq -0x30(%rbp), %rax
movb $-0x1, 0x24(%rax)
movq -0x30(%rbp), %rax
movl $0x0, 0x68(%rax)
movq -0x30(%rbp), %rax
movl $0x0, 0x54(%rax)
movq -0x30(%rbp), %rax
movl $0x0, 0x50(%rax)
movq -0x30(%rbp), %rax
movl $0x0, 0x4c(%rax)
movq -0x30(%rbp), %rax
movzwl 0x1638(%rax), %eax
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
je 0x1c3cc
movq -0x30(%rbp), %rax
addq $0x1790, %rax           # imm = 0x1790
movl -0x34(%rbp), %ecx
tzcntl %ecx, %ecx
movslq %ecx, %rcx
imulq $0x650, %rcx, %rcx      # imm = 0x650
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq $0x0, 0x160(%rax)
je 0x1c3bc
movq -0x40(%rbp), %rax
movq 0x160(%rax), %rax
movq -0x40(%rbp), %rcx
movq 0x168(%rcx), %rdi
xorl %esi, %esi
callq *%rax
jmp 0x1c3be
movl -0x34(%rbp), %eax
subl $0x1, %eax
andl -0x34(%rbp), %eax
movl %eax, -0x34(%rbp)
jmp 0x1c36c
movq -0x30(%rbp), %rax
movw $0x0, 0x163c(%rax)
movq -0x30(%rbp), %rax
movw $0x0, 0x163a(%rax)
movq -0x30(%rbp), %rax
movw $0x0, 0x1638(%rax)
vpxor %xmm0, %xmm0, %xmm0
vmovdqa %xmm0, -0x50(%rbp)
vmovdqa -0x50(%rbp), %xmm0
movq -0x30(%rbp), %rax
vmovdqa %xmm0, 0x1770(%rax)
movq -0x30(%rbp), %rax
vmovdqa %xmm0, 0x1760(%rax)
movq -0x30(%rbp), %rax
vmovdqa %xmm0, 0x1750(%rax)
movq -0x30(%rbp), %rax
vmovdqa %xmm0, 0x1740(%rax)
movb $-0x1, -0x21(%rbp)
movb -0x21(%rbp), %al
movb %al, -0x51(%rbp)
movb %al, -0x1(%rbp)
movb %al, -0x2(%rbp)
movb %al, -0x3(%rbp)
movb %al, -0x4(%rbp)
movb %al, -0x5(%rbp)
movb %al, -0x6(%rbp)
movb %al, -0x7(%rbp)
movb %al, -0x8(%rbp)
movb %al, -0x9(%rbp)
movb %al, -0xa(%rbp)
movb %al, -0xb(%rbp)
movb %al, -0xc(%rbp)
movb %al, -0xd(%rbp)
movb %al, -0xe(%rbp)
movb %al, -0xf(%rbp)
movb %al, -0x10(%rbp)
movzbl -0x10(%rbp), %eax
vmovd %eax, %xmm0
movzbl -0xf(%rbp), %eax
vpinsrb $0x1, %eax, %xmm0, %xmm0
movzbl -0xe(%rbp), %eax
vpinsrb $0x2, %eax, %xmm0, %xmm0
movzbl -0xd(%rbp), %eax
vpinsrb $0x3, %eax, %xmm0, %xmm0
movzbl -0xc(%rbp), %eax
vpinsrb $0x4, %eax, %xmm0, %xmm0
movzbl -0xb(%rbp), %eax
vpinsrb $0x5, %eax, %xmm0, %xmm0
movzbl -0xa(%rbp), %eax
vpinsrb $0x6, %eax, %xmm0, %xmm0
movzbl -0x9(%rbp), %eax
vpinsrb $0x7, %eax, %xmm0, %xmm0
movzbl -0x8(%rbp), %eax
vpinsrb $0x8, %eax, %xmm0, %xmm0
movzbl -0x7(%rbp), %eax
vpinsrb $0x9, %eax, %xmm0, %xmm0
movzbl -0x6(%rbp), %eax
vpinsrb $0xa, %eax, %xmm0, %xmm0
movzbl -0x5(%rbp), %eax
vpinsrb $0xb, %eax, %xmm0, %xmm0
movzbl -0x4(%rbp), %eax
vpinsrb $0xc, %eax, %xmm0, %xmm0
movzbl -0x3(%rbp), %eax
vpinsrb $0xd, %eax, %xmm0, %xmm0
movzbl -0x2(%rbp), %eax
vpinsrb $0xe, %eax, %xmm0, %xmm0
movzbl -0x1(%rbp), %eax
vpinsrb $0xf, %eax, %xmm0, %xmm0
vmovdqa %xmm0, -0x20(%rbp)
vmovdqa -0x20(%rbp), %xmm0
movq -0x30(%rbp), %rax
vmovdqa %xmm0, 0x1780(%rax)
movq -0x30(%rbp), %rax
cmpb $0x0, 0x20(%rax)
je 0x1c539
movq -0x30(%rbp), %rdi
addq $0x1580, %rdi           # imm = 0x1580
callq 0x70e0
addq $0x60, %rsp
popq %rbp
retq
nop