// File: /workspace/github_c_makefile_star2_O2/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 0x4d45
movq %rax, %rbx
leaq 0x8(%rax), %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x2370
testl %eax, %eax
je 0x4b9e
movl %eax, %edi
callq 0x2360
leaq 0x1b20(%rip), %rdi      # 0x66a7
movq %rax, %rsi
xorl %eax, %eax
callq 0x49c4
callq 0x2080
andl $0x0, (%rax)
jmp 0x4d3d
movq %r14, %rdi
callq 0x2380
testl %eax, %eax
je 0x4bcf
movl %eax, %edi
callq 0x2360
leaq 0x1b06(%rip), %rdi      # 0x66be
movq %rax, %rsi
xorl %eax, %eax
callq 0x49c4
callq 0x2080
andl $0x0, (%rax)
jmp 0x4d35
leaq 0x30(%rbx), %r15
movq %r15, %rdi
xorl %esi, %esi
callq 0x2220
testl %eax, %eax
je 0x4c06
movl %eax, %edi
callq 0x2360
leaq 0x1ae6(%rip), %rdi      # 0x66d5
movq %rax, %rsi
xorl %eax, %eax
callq 0x49c4
callq 0x2080
andl $0x0, (%rax)
jmp 0x4d2d
movq %rbx, %r12
addq $0x64, %r12
pushq $0x1
popq %rdi
movl %edi, %esi
xorl %edx, %edx
movq %r12, %rcx
callq 0x2200
testl %eax, %eax
je 0x4c49
callq 0x2080
cmpl $0x0, (%rax)
je 0x4cb0
movq %rax, %r12
leaq 0x1ab3(%rip), %rdi      # 0x66eb
xorl %eax, %eax
callq 0x4835
andl $0x0, (%r12)
jmp 0x4d25
andl $0x0, 0x60(%rbx)
leaq 0x10c(%rip), %rdx       # 0x4d60
movq %rbx, %rdi
xorl %esi, %esi
movq %rbx, %rcx
callq 0x22c0
testl %eax, %eax
je 0x4cc0
movl %eax, %edi
callq 0x2360
leaq 0x1a83(%rip), %rdi      # 0x66f6
movq %rax, %rsi
xorl %eax, %eax
callq 0x49c4
callq 0x2080
movq %rax, %r13
andl $0x0, (%rax)
movl 0x68(%rbx), %edi
callq 0x2180
testl %eax, %eax
je 0x4cfe
cmpl $0x0, (%r13)
je 0x4cf0
leaq 0x1839(%rip), %rdi      # 0x64db
xorl %eax, %eax
callq 0x4835
andl $0x0, (%r13)
jmp 0x4cfe
leaq 0x1a34(%rip), %rdi      # 0x66eb
xorl %eax, %eax
callq 0x49c4
jmp 0x4d25
movq %r14, %rdi
callq 0x2230
testl %eax, %eax
je 0x4d47
movl %eax, %edi
callq 0x2360
leaq 0x1a2f(%rip), %rdi      # 0x6709
xorl %ebx, %ebx
movq %rax, %rsi
xorl %eax, %eax
callq 0x49c4
callq 0x2080
andl $0x0, (%rax)
jmp 0x4d47
leaq 0x17e4(%rip), %rdi      # 0x64db
xorl %eax, %eax
callq 0x49c4
movl (%r12), %edi
callq 0x2180
testl %eax, %eax
je 0x4d25
cmpl $0x0, (%r13)
je 0x4d54
leaq 0x17c2(%rip), %rdi      # 0x64db
xorl %eax, %eax
callq 0x4835
andl $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 0x1780(%rip), %rdi      # 0x64db
jmp 0x4cb7