// File: /workspace/github_c_makefile_star2_O1/Tarsnap[P]kivaloo/perf/dispatch.c
// Function: callback_accept
static int
callback_accept(void * cookie, int s)
{
	struct dispatch_state * D = cookie;

	/* We are no longer waiting for a connection to arrive. */
	D->accept_cookie = NULL;

	/* We have a socket. */
	if ((D->s = s) == -1) {
		warnp("Error accepting connection");
		goto err0;
	}

	/* Make the accepted connection non-blocking. */
	if (fcntl(D->s, F_SETFL, O_NONBLOCK) == -1) {
		warnp("Cannot make connection non-blocking");
		goto err1;
	}

	/* Create a buffered writer for the connection. */
	if ((D->writeq = netbuf_write_init(D->s, NULL, NULL)) == NULL) {
		warnp("Cannot create packet write queue");
		goto err1;
	}

	/* Create a buffered reader for the connection. */
	if ((D->readq = netbuf_read_init(D->s)) == NULL) {
		warn0("Cannot create packet read queue");
		goto err2;
	}

	/* Wait for a request to arrive. */
	if ((D->read_cookie = wire_readpacket_wait(D->readq,
	    callback_gotrequests, D)) == NULL) {
		warnp("Error reading request from connection");
		goto err3;
	}

	/* Success! */
	return (0);

err3:
	netbuf_read_free(D->readq);
err2:
	netbuf_write_free(D->writeq);
err1:
	if (close(D->s))
		warnp("close");
err0:
	/* Failure! */
	return (-1);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq $0x0, 0x18(%rdi)
movl %esi, (%rdi)
cmpl $-0x1, %esi
je 0x3526
movq %rdi, %rbx
movl %esi, %edi
movl $0x4, %esi
movl $0x800, %edx            # imm = 0x800
xorl %eax, %eax
callq 0x2100
cmpl $-0x1, %eax
je 0x3549
movl (%rbx), %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x5ec0
movq %rax, 0x10(%rbx)
testq %rax, %rax
je 0x355f
movl (%rbx), %edi
callq 0x5b2c
movq %rax, 0x8(%rbx)
testq %rax, %rax
je 0x359b
leaq 0x254(%rip), %rsi       # 0x3735
movq %rax, %rdi
movq %rbx, %rdx
callq 0x9fad
movq %rax, 0x20(%rbx)
xorl %ebp, %ebp
testq %rax, %rax
jne 0x3630
callq 0x20a0
cmpl $0x0, (%rax)
je 0x35cf
movq %rax, %r14
leaq 0x8eb6(%rip), %rdi      # 0xc3c9
xorl %eax, %eax
callq 0x8ecc
movl $0x0, (%r14)
jmp 0x35dd
callq 0x20a0
cmpl $0x0, (%rax)
je 0x3583
movq %rax, %rbx
leaq 0x8e0f(%rip), %rdi      # 0xc349
xorl %eax, %eax
callq 0x8ecc
movl $0x0, (%rbx)
jmp 0x3591
callq 0x20a0
cmpl $0x0, (%rax)
je 0x35b6
movq %rax, %r14
leaq 0x8e07(%rip), %rdi      # 0xc364
jmp 0x3573
callq 0x20a0
cmpl $0x0, (%rax)
je 0x35bf
movq %rax, %r14
leaq 0x8e15(%rip), %rdi      # 0xc388
xorl %eax, %eax
callq 0x8ecc
movl $0x0, (%r14)
jmp 0x35ef
leaq 0x8dbf(%rip), %rdi      # 0xc349
xorl %eax, %eax
callq 0x8feb
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x3630
leaq 0x8e07(%rip), %rdi      # 0xc3a9
xorl %eax, %eax
callq 0x8feb
callq 0x20a0
movl $0x0, (%rax)
jmp 0x35e6
leaq 0x8da7(%rip), %rdi      # 0xc364
jmp 0x35c6
leaq 0x8dc2(%rip), %rdi      # 0xc388
xorl %eax, %eax
callq 0x8feb
jmp 0x35ef
leaq 0x8df3(%rip), %rdi      # 0xc3c9
xorl %eax, %eax
callq 0x8feb
movq 0x8(%rbx), %rdi
callq 0x5e54
movq 0x10(%rbx), %rdi
callq 0x623f
movl (%rbx), %edi
callq 0x21d0
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %eax, %eax
je 0x3630
callq 0x20a0
cmpl $0x0, (%rax)
je 0x3622
movq %rax, %rbx
leaq 0x9797(%rip), %rdi      # 0xcdaa
xorl %eax, %eax
callq 0x8ecc
movl $0x0, (%rbx)
jmp 0x3630
leaq 0x9781(%rip), %rdi      # 0xcdaa
xorl %eax, %eax
callq 0x8feb
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq