// File: /workspace/github_c_makefile_star2_O2/wahern[P]cqueues/src/thread.c
// Function: ct_release
static void ct_release(struct cthread *ct) {
	_Bool destroy;
	struct cthread_lib *ent, *nxt;

	pthread_mutex_lock(&ct->mutex);
	destroy = !--ct->refs;
	pthread_mutex_unlock(&ct->mutex);

	if (!destroy)
		return;

	hdl_destroy(&ct->handle);

	pthread_attr_destroy(&ct->attr);
	pthread_cond_destroy(&ct->cond);
	pthread_mutex_destroy(&ct->mutex);

	cqs_closefd(&ct->pipe[0]);
	cqs_closefd(&ct->pipe[1]);

	for (ent = LLRB_MIN(libs, &ct->libs); ent; ent = nxt) {
		nxt = LLRB_NEXT(libs, &ct->libs, ent);
		LLRB_REMOVE(libs, &ct->libs, ent);
		dlclose(ent->ref);
		free(ent);
	}

	cqs_closefd(&ct->tmp.fd[0]);
	cqs_closefd(&ct->tmp.fd[1]);

	free(ct->tmp.arg);

	free(ct->msg);
	free(ct);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r15
leaq 0x20(%rdi), %r14
movq %r14, %rdi
callq 0x10450
decl (%r15)
setne %bl
movq %r14, %rdi
callq 0xfa00
testb %bl, %bl
je 0x1b269
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x180(%r15), %rdi
callq 0xff80
leaq 0x78(%r15), %rdi
callq 0x10770
leaq 0x48(%r15), %rdi
callq 0x10a90
movq %r14, %rdi
callq 0xff80
leaq 0x1a8(%r15), %rdi
callq 0x1b58a
leaq 0x1ac(%r15), %rdi
callq 0x1b58a
leaq 0x1b0(%r15), %rbx
movq 0x1b0(%r15), %rdi
callq 0x1b59f
movq %r15, 0x8(%rsp)
testq %rax, %rax
je 0x1b547
movq 0x30(%rax), %rdi
testq %rdi, %rdi
movq %rax, (%rsp)
je 0x1b2df
callq 0x1b59f
movq %rax, %rcx
jmp 0x1b308
movq 0x38(%rax), %rcx
testq %rcx, %rcx
je 0x1b306
cmpq %rax, 0x28(%rcx)
je 0x1b308
movq (%rsp), %rax
movq 0x38(%rax), %rcx
testq %rcx, %rcx
je 0x1b306
cmpq 0x30(%rcx), %rax
movq %rcx, %rax
je 0x1b2f2
jmp 0x1b308
xorl %ecx, %ecx
movq %rcx, 0x10(%rsp)
xorl %ebp, %ebp
movq %rbx, %r12
movq (%rsp), %r14
movq (%r12), %r13
testq %r13, %r13
je 0x1b4ec
movq 0x28(%r13), %rcx
movq 0x38(%r13), %rbp
movq 0x8(%r14), %rax
cmpq 0x8(%r13), %rax
setg %al
jge 0x1b367
testq %rcx, %rcx
je 0x1b35e
cmpb $0x0, 0x40(%rcx)
jne 0x1b35e
movq 0x28(%rcx), %rax
testq %rax, %rax
je 0x1b352
cmpb $0x0, 0x40(%rax)
jne 0x1b35e
movq %r12, %rdi
callq 0x1b5b1
movq (%r12), %r13
addq $0x28, %r13
movq %r13, %r12
jmp 0x1b316
testq %rcx, %rcx
je 0x1b395
cmpb $0x1, 0x40(%rcx)
jne 0x1b395
movq %r12, %rdi
callq 0x1b5ef
movq (%r12), %r13
movq (%rsp), %rax
movq 0x8(%rax), %rax
pushq $-0x1
popq %rcx
movl %ecx, %r15d
cmpq 0x8(%r13), %rax
setg %al
jl 0x1b3af
testb %al, %al
je 0x1b3a1
pushq $0x1
popq %rax
movl %eax, %r15d
jmp 0x1b3af
xorl %r15d, %r15d
cmpq $0x0, 0x30(%r13)
je 0x1b4e8
movq 0x30(%r13), %rax
testq %rax, %rax
je 0x1b41e
cmpb $0x0, 0x40(%rax)
jne 0x1b41e
movq 0x28(%rax), %rax
testq %rax, %rax
je 0x1b3cd
cmpb $0x0, 0x40(%rax)
jne 0x1b41e
movq %r13, %rdi
callq 0x1b6a1
movq (%r12), %r13
movq 0x28(%r13), %rax
movq 0x28(%rax), %rax
testq %rax, %rax
je 0x1b407
cmpb $0x1, 0x40(%rax)
movq (%rsp), %r14
jne 0x1b40b
movq %r12, %rdi
callq 0x1b5ef
movq (%r12), %rdi
callq 0x1b6a1
movq (%r12), %r13
jmp 0x1b40b
movq (%rsp), %r14
movq 0x8(%r14), %rax
xorl %r15d, %r15d
cmpq 0x8(%r13), %rax
setg %al
jl 0x1b423
movb %al, %r15b
testl %r15d, %r15d
je 0x1b433
movq (%rsp), %r14
addq $0x30, %r13
movq %r13, %r12
jmp 0x1b316
addq $0x30, %r13
movq %r13, %rbp
movq (%rbp), %r15
movq 0x28(%r15), %rax
testq %rax, %rax
je 0x1b471
cmpb $0x0, 0x40(%rax)
jne 0x1b468
movq 0x28(%rax), %rax
testq %rax, %rax
je 0x1b45c
cmpb $0x0, 0x40(%rax)
jne 0x1b468
movq %rbp, %rdi
callq 0x1b5b1
movq (%rbp), %r15
addq $0x28, %r15
movq %r15, %rbp
jmp 0x1b43a
movq 0x38(%r15), %rax
andq $0x0, (%rbp)
cmpq %r13, %rbp
je 0x1b4a8
movq 0x38(%rax), %r14
movq %rbx, %rbp
cmpq (%rbx), %rax
je 0x1b49b
cmpq 0x28(%r14), %rax
je 0x1b497
leaq 0x30(%r14), %rbp
jmp 0x1b49b
leaq 0x28(%r14), %rbp
movq %rbp, %rdi
callq 0x1b625
movq %r14, %rax
jmp 0x1b47a
movq (%r12), %rax
movb 0x40(%rax), %cl
movb %cl, 0x40(%r15)
movq 0x38(%rax), %rax
movq %rax, 0x38(%r15)
movq (%r12), %rax
movq 0x30(%rax), %rax
movq %rax, 0x30(%r15)
testq %rax, %rax
je 0x1b4d0
movq %r15, 0x38(%rax)
movq (%r12), %rax
movq 0x28(%rax), %rax
movq %rax, 0x28(%r15)
testq %rax, %rax
je 0x1b4e5
movq %r15, 0x38(%rax)
movq %r15, %rbp
movq %r15, (%r12)
movq 0x8(%rsp), %r15
movq (%rbx), %rax
testq %rbp, %rbp
je 0x1b51f
movq 0x38(%rbp), %r14
movq %rbx, %rdi
cmpq %rax, %rbp
je 0x1b515
cmpq 0x28(%r14), %rbp
je 0x1b511
leaq 0x30(%r14), %rdi
jmp 0x1b515
leaq 0x28(%r14), %rdi
callq 0x1b625
movq %r14, %rbp
jmp 0x1b4f1
testq %rax, %rax
je 0x1b528
movb $0x0, 0x40(%rax)
movq (%rsp), %r14
movq 0x20(%r14), %rdi
callq 0xfa90
movq %r14, %rdi
callq 0xffc0
movq 0x10(%rsp), %rax
jmp 0x1b2bf
leaq 0x1c4(%r15), %rdi
callq 0x1b58a
leaq 0x1c8(%r15), %rdi
callq 0x1b58a
movq 0x1b8(%r15), %rdi
callq 0xffc0
movq 0x10(%r15), %rdi
callq 0xffc0
movq %r15, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xffc0