// File: /workspace/github_c_makefile_star2_O3/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 0x5271
movq %rax, %rbx
leaq 0x8(%rax), %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x2370
testl %eax, %eax
je 0x50a9
movl %eax, %edi
callq 0x2360
leaq 0x2686(%rip), %rdi      # 0x7715
movq %rax, %rsi
xorl %eax, %eax
callq 0x4f2b
callq 0x2080
movl $0x0, (%rax)
jmp 0x5269
movq %r14, %rdi
callq 0x2380
testl %eax, %eax
je 0x50dd
movl %eax, %edi
callq 0x2360
leaq 0x2669(%rip), %rdi      # 0x772c
movq %rax, %rsi
xorl %eax, %eax
callq 0x4f2b
callq 0x2080
movl $0x0, (%rax)
jmp 0x5261
leaq 0x30(%rbx), %r15
movq %r15, %rdi
xorl %esi, %esi
callq 0x2220
testl %eax, %eax
je 0x5117
movl %eax, %edi
callq 0x2360
leaq 0x2646(%rip), %rdi      # 0x7743
movq %rax, %rsi
xorl %eax, %eax
callq 0x4f2b
callq 0x2080
movl $0x0, (%rax)
jmp 0x5259
movq %rbx, %r12
addq $0x64, %r12
movl $0x1, %edi
movl $0x1, %esi
xorl %edx, %edx
movq %r12, %rcx
callq 0x2200
testl %eax, %eax
je 0x5162
callq 0x2080
cmpl $0x0, (%rax)
je 0x51d2
movq %rax, %r12
leaq 0x260b(%rip), %rdi      # 0x7759
xorl %eax, %eax
callq 0x4e0c
movl $0x0, (%r12)
jmp 0x5251
movl $0x0, 0x60(%rbx)
leaq 0x11c(%rip), %rdx       # 0x528c
movq %rbx, %rdi
xorl %esi, %esi
movq %rbx, %rcx
callq 0x22c0
testl %eax, %eax
je 0x51e2
movl %eax, %edi
callq 0x2360
leaq 0x25d5(%rip), %rdi      # 0x7764
movq %rax, %rsi
xorl %eax, %eax
callq 0x4f2b
callq 0x2080
movq %rax, %r13
movl $0x0, (%rax)
movl 0x68(%rbx), %edi
callq 0x2180
testl %eax, %eax
je 0x5227
cmpl $0x0, (%r13)
je 0x5219
leaq 0x231a(%rip), %rdi      # 0x74db
xorl %eax, %eax
callq 0x4e0c
movl $0x0, (%r13)
jmp 0x5227
leaq 0x2580(%rip), %rdi      # 0x7759
xorl %eax, %eax
callq 0x4f2b
jmp 0x5251
movq %r14, %rdi
callq 0x2230
testl %eax, %eax
je 0x5273
movl %eax, %edi
callq 0x2360
leaq 0x2577(%rip), %rdi      # 0x7777
xorl %ebx, %ebx
movq %rax, %rsi
xorl %eax, %eax
callq 0x4f2b
callq 0x2080
movl $0x0, (%rax)
jmp 0x5273
leaq 0x22bb(%rip), %rdi      # 0x74db
xorl %eax, %eax
callq 0x4f2b
movl (%r12), %edi
callq 0x2180
testl %eax, %eax
je 0x5251
cmpl $0x0, (%r13)
je 0x5280
leaq 0x2299(%rip), %rdi      # 0x74db
xorl %eax, %eax
callq 0x4e0c
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 0x2254(%rip), %rdi      # 0x74db
jmp 0x51d9