// File: /workspace/github_c_makefile_star2_O2/wahern[P]cqueues/src/cqueues.c
// Function: cqueue_destroy
static void cqueue_destroy(lua_State *L, struct cqueue *Q, struct callinfo *I) {
	struct cstack *cstack = Q->cstack;
	struct thread *thread;
	struct fileno *fileno;
	void *next;

	cstack_del(Q);

	Q->thread.current = NULL;

	while ((thread = LIST_FIRST(&Q->thread.pending))) {
		thread_del(L, Q, I, thread);
	}

	while ((thread = LIST_FIRST(&Q->thread.polling))) {
		thread_del(L, Q, I, thread);
	}

	for (fileno = LLRB_MIN(table, &Q->fileno.table); fileno; fileno = next) {
		next = LLRB_NEXT(table, &Q->fileno.table, fileno);
		fileno_del(Q, fileno, 0);
	}

	kpoll_destroy(&Q->kp, &cstack_onclosefd, cstack);

	pool_destroy(&Q->pool.event);
	pool_destroy(&Q->pool.fileno);
	pool_destroy(&Q->pool.wakecb);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %r15
movq 0x230(%rsi), %rax
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0x14310
movq 0x238(%r12), %rax
movq 0x240(%r12), %rcx
testq %rax, %rax
je 0x14304
movq %rcx, 0x240(%rax)
movq %rax, (%rcx)
andq $0x0, 0x230(%r12)
andq $0x0, 0x218(%r12)
movq 0x210(%r12), %rcx
testq %rcx, %rcx
je 0x14344
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x136d6
jmp 0x14319
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x136d6
movq 0x208(%r12), %rcx
testq %rcx, %rcx
jne 0x14336
leaq 0x1a0(%r12), %rbx
movq 0x1a0(%r12), %rdi
callq 0x1464c
movq %rax, %r14
movq %r12, 0x18(%rsp)
testq %r14, %r14
je 0x14608
movq 0x18(%r14), %rdi
testq %rdi, %rdi
je 0x14387
callq 0x1464c
jmp 0x143af
movq 0x20(%r14), %rax
testq %rax, %rax
je 0x143ad
cmpq %r14, 0x10(%rax)
je 0x143af
movq %r14, %rcx
movq 0x20(%rcx), %rax
testq %rax, %rax
je 0x143ad
cmpq 0x18(%rax), %rcx
movq %rax, %rcx
je 0x14399
jmp 0x143af
xorl %eax, %eax
movq %rax, 0x20(%rsp)
movq 0x8(%r14), %rcx
testq %rcx, %rcx
je 0x143d8
andq $0x0, 0x30(%rcx)
movq 0x38(%rcx), %rax
movq 0x40(%rcx), %rcx
testq %rax, %rax
je 0x143d3
movq %rcx, 0x40(%rax)
movq %rax, (%rcx)
jmp 0x143b4
movq %r14, 0x8(%rsp)
xorl %r14d, %r14d
movq %rbx, %r13
movq (%r13), %rbp
testq %rbp, %rbp
je 0x145c1
movq 0x10(%rbp), %rcx
movq 0x20(%rbp), %r14
movq 0x8(%rsp), %rax
movl (%rax), %eax
subl (%rbp), %eax
js 0x14437
testq %rcx, %rcx
je 0x14425
cmpb $0x1, 0x28(%rcx)
jne 0x14425
movq %r13, %rdi
callq 0x13e17
movq (%r13), %rbp
movq 0x8(%rsp), %rax
movl (%rax), %eax
subl (%rbp), %eax
movq 0x18(%rbp), %rcx
testl %eax, %eax
je 0x14469
testq %rcx, %rcx
jne 0x14472
jmp 0x144c9
testq %rcx, %rcx
je 0x1445d
cmpb $0x0, 0x28(%rcx)
jne 0x1445d
movq 0x10(%rcx), %rax
testq %rax, %rax
je 0x14451
cmpb $0x0, 0x28(%rax)
jne 0x1445d
movq %r13, %rdi
callq 0x1467f
movq (%r13), %rbp
addq $0x10, %rbp
movq %rbp, %r13
jmp 0x143e3
testq %rcx, %rcx
je 0x1458f
cmpb $0x0, 0x28(%rcx)
jne 0x144c5
movq 0x10(%rcx), %rcx
testq %rcx, %rcx
je 0x14487
cmpb $0x0, 0x28(%rcx)
jne 0x144c5
movq %rbp, %rdi
callq 0x13e4d
movq (%r13), %rbp
movq 0x10(%rbp), %rax
movq 0x10(%rax), %rax
testq %rax, %rax
je 0x144bb
cmpb $0x1, 0x28(%rax)
jne 0x144bb
movq %r13, %rdi
callq 0x13e17
movq (%r13), %rdi
callq 0x13e4d
movq (%r13), %rbp
movq 0x8(%rsp), %rax
movl (%rax), %eax
subl (%rbp), %eax
testl %eax, %eax
je 0x144d5
addq $0x18, %rbp
movq %rbp, %r13
jmp 0x143e3
addq $0x18, %rbp
movq %rbp, %r14
movq (%r14), %r12
movq 0x10(%r12), %rax
testq %rax, %rax
je 0x14512
cmpb $0x0, 0x28(%rax)
jne 0x14509
movq 0x10(%rax), %rax
testq %rax, %rax
je 0x144fe
cmpb $0x0, 0x28(%rax)
jne 0x14509
movq %r14, %rdi
callq 0x1467f
movq (%r14), %r12
addq $0x10, %r12
movq %r12, %r14
jmp 0x144dc
movq 0x20(%r12), %rax
andq $0x0, (%r14)
cmpq %rbp, %r14
je 0x14549
movq 0x20(%rax), %r15
movq %rbx, %r14
cmpq (%rbx), %rax
je 0x1453c
cmpq 0x10(%r15), %rax
je 0x14538
leaq 0x18(%r15), %r14
jmp 0x1453c
leaq 0x10(%r15), %r14
movq %r14, %rdi
callq 0x13d65
movq %r15, %rax
jmp 0x1451b
movq (%r13), %rax
movb 0x28(%rax), %cl
movb %cl, 0x28(%r12)
movq 0x20(%rax), %rax
movq %rax, 0x20(%r12)
movq (%r13), %rax
movq 0x18(%rax), %rax
movq %rax, 0x18(%r12)
testq %rax, %rax
je 0x14574
movq %r12, 0x20(%rax)
movq (%r13), %rax
movq 0x10(%rax), %rax
movq %rax, 0x10(%r12)
testq %rax, %rax
je 0x1458a
movq %r12, 0x20(%rax)
movq %r12, %r14
jmp 0x14592
xorl %r12d, %r12d
movq %r12, (%r13)
movq 0x18(%rsp), %r12
jmp 0x145c1
movq 0x20(%r14), %r15
movq %rbx, %rdi
cmpq %rax, %r14
je 0x145b9
cmpq 0x10(%r15), %r14
je 0x145b5
leaq 0x18(%r15), %rdi
jmp 0x145b9
leaq 0x10(%r15), %rdi
callq 0x13d65
movq %r15, %r14
movq (%rbx), %rax
testq %r14, %r14
jne 0x1459d
testq %rax, %rax
je 0x145d2
movb $0x0, 0x28(%rax)
movq 0x8(%rsp), %rdx
movq 0x30(%rdx), %rax
movq 0x38(%rdx), %rcx
testq %rax, %rax
je 0x145e8
movq %rcx, 0x38(%rax)
movq %rax, (%rcx)
movq 0x1e8(%r12), %rax
movq %rax, (%rdx)
movq %rdx, 0x1e8(%r12)
movq 0x20(%rsp), %r14
jmp 0x1436e
movq %r12, %rdi
movq 0x10(%rsp), %rsi
callq 0x1412c
leaq 0x1c0(%r12), %r14
leaq 0x1f0(%r12), %rdi
callq 0x1465e
addq $0x1d8, %r12            # imm = 0x1D8
movq %r12, %rdi
callq 0x1465e
movq %r14, %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1465e