// File: /workspace/github_c_makefile_star2_O1/Tarsnap[P]spiped/liball/../lib/dnsthread/dnsthread.c
// Function: dnsthread_spawn
DNSTHREAD
dnsthread_spawn(void)
{
	struct dnsthread_internal * T;
	int rc;

	/* Allocate a thread management structure. */
	if ((T = malloc(sizeof(struct dnsthread_internal))) == NULL)
		goto err0;

	/* Create and lock a mutex. */
	if ((rc = pthread_mutex_init(&T->mtx, NULL)) != 0) {
		warn0("pthread_mutex_init: %s", strerror(rc));
		goto err1;
	}
	if ((rc = pthread_mutex_lock(&T->mtx)) != 0) {
		warn0("pthread_mutex_lock: %s", strerror(rc));
		goto err2;
	}

	/* Create state-changed condition variable. */
	if ((rc = pthread_cond_init(&T->cv, NULL)) != 0) {
		warn0("pthread_cond_init: %s", strerror(rc));
		goto err3;
	}

	/* Create wakeup socketpair. */
	if (socketpair(AF_UNIX, SOCK_STREAM, 0, T->wakeupsock)) {
		warnp("socketpair");
		goto err4;
	}

	/* The thread starts out sleeping. */
	T->state = THREAD_SLEEPING;

	/* Create the thread. */
	if ((rc = pthread_create(&T->thr, NULL, workthread, T)) != 0) {
		warn0("pthread_create: %s", strerror(rc));
		goto err5;
	}

	/* Unlock the mutex. */
	if ((rc = pthread_mutex_unlock(&T->mtx)) != 0) {
		warn0("pthread_mutex_unlock: %s", strerror(rc));
		goto err0;
	}

	/* Success! */
	return (T);

err5:
	if (close(T->wakeupsock[1]))
		warnp("close");
	if (close(T->wakeupsock[0]))
		warnp("close");
err4:
	pthread_cond_destroy(&T->cv);
err3:
	pthread_mutex_unlock(&T->mtx);
err2:
	pthread_mutex_destroy(&T->mtx);
err1:
	free(T);
err0:
	/* Failure! */
	return (NULL);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl $0x98, %edi
callq 0x2240
testq %rax, %rax
je 0x5269
movq %rax, %rbx
leaq 0x8(%rax), %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x2370
testl %eax, %eax
je 0x50a1
movl %eax, %edi
callq 0x2360
leaq 0x267e(%rip), %rdi      # 0x7705
movq %rax, %rsi
xorl %eax, %eax
callq 0x4f23
callq 0x2080
movl $0x0, (%rax)
jmp 0x5261
movq %r14, %rdi
callq 0x2380
testl %eax, %eax
je 0x50d5
movl %eax, %edi
callq 0x2360
leaq 0x2661(%rip), %rdi      # 0x771c
movq %rax, %rsi
xorl %eax, %eax
callq 0x4f23
callq 0x2080
movl $0x0, (%rax)
jmp 0x5259
leaq 0x30(%rbx), %r15
movq %r15, %rdi
xorl %esi, %esi
callq 0x2220
testl %eax, %eax
je 0x510f
movl %eax, %edi
callq 0x2360
leaq 0x263e(%rip), %rdi      # 0x7733
movq %rax, %rsi
xorl %eax, %eax
callq 0x4f23
callq 0x2080
movl $0x0, (%rax)
jmp 0x5251
movq %rbx, %r12
addq $0x64, %r12
movl $0x1, %edi
movl $0x1, %esi
xorl %edx, %edx
movq %r12, %rcx
callq 0x2200
testl %eax, %eax
je 0x515a
callq 0x2080
cmpl $0x0, (%rax)
je 0x51ca
movq %rax, %r12
leaq 0x2603(%rip), %rdi      # 0x7749
xorl %eax, %eax
callq 0x4e04
movl $0x0, (%r12)
jmp 0x5249
movl $0x0, 0x60(%rbx)
leaq 0x11c(%rip), %rdx       # 0x5284
movq %rbx, %rdi
xorl %esi, %esi
movq %rbx, %rcx
callq 0x22c0
testl %eax, %eax
je 0x51da
movl %eax, %edi
callq 0x2360
leaq 0x25cd(%rip), %rdi      # 0x7754
movq %rax, %rsi
xorl %eax, %eax
callq 0x4f23
callq 0x2080
movq %rax, %r13
movl $0x0, (%rax)
movl 0x68(%rbx), %edi
callq 0x2180
testl %eax, %eax
je 0x521f
cmpl $0x0, (%r13)
je 0x5211
leaq 0x2312(%rip), %rdi      # 0x74cb
xorl %eax, %eax
callq 0x4e04
movl $0x0, (%r13)
jmp 0x521f
leaq 0x2578(%rip), %rdi      # 0x7749
xorl %eax, %eax
callq 0x4f23
jmp 0x5249
movq %r14, %rdi
callq 0x2230
testl %eax, %eax
je 0x526b
movl %eax, %edi
callq 0x2360
leaq 0x256f(%rip), %rdi      # 0x7767
xorl %ebx, %ebx
movq %rax, %rsi
xorl %eax, %eax
callq 0x4f23
callq 0x2080
movl $0x0, (%rax)
jmp 0x526b
leaq 0x22b3(%rip), %rdi      # 0x74cb
xorl %eax, %eax
callq 0x4f23
movl (%r12), %edi
callq 0x2180
testl %eax, %eax
je 0x5249
cmpl $0x0, (%r13)
je 0x5278
leaq 0x2291(%rip), %rdi      # 0x74cb
xorl %eax, %eax
callq 0x4e04
movl $0x0, (%r13)
movq %r15, %rdi
callq 0x22d0
movq %r14, %rdi
callq 0x2230
movq %r14, %rdi
callq 0x2130
movq %rbx, %rdi
callq 0x2040
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x224c(%rip), %rdi      # 0x74cb
jmp 0x51d1