// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq $0x0, 0x18(%rax)
movl -0x14(%rbp), %eax
movq -0x20(%rbp), %rcx
movl %eax, (%rcx)
cmpl $-0x1, %eax
jne 0x36ad
jmp 0x3673
callq 0x20a0
cmpl $0x0, (%rax)
je 0x3698
leaq 0xee1d(%rip), %rdi      # 0x124a1
movb $0x0, %al
callq 0xc460
callq 0x20a0
movl $0x0, (%rax)
jmp 0x36a6
leaq 0xee02(%rip), %rdi      # 0x124a1
movb $0x0, %al
callq 0xc6b0
jmp 0x36a8
jmp 0x3864
movq -0x20(%rbp), %rax
movl (%rax), %edi
movl $0x4, %esi
movl $0x800, %edx            # imm = 0x800
movb $0x0, %al
callq 0x2110
cmpl $-0x1, %eax
jne 0x3705
jmp 0x36cb
callq 0x20a0
cmpl $0x0, (%rax)
je 0x36f0
leaq 0xede0(%rip), %rdi      # 0x124bc
movb $0x0, %al
callq 0xc460
callq 0x20a0
movl $0x0, (%rax)
jmp 0x36fe
leaq 0xedc5(%rip), %rdi      # 0x124bc
movb $0x0, %al
callq 0xc6b0
jmp 0x3700
jmp 0x3819
movq -0x20(%rbp), %rax
movl (%rax), %edi
xorl %eax, %eax
movl %eax, %edx
movq %rdx, %rsi
callq 0x7870
movq -0x20(%rbp), %rcx
movq %rax, 0x10(%rcx)
cmpq $0x0, %rax
jne 0x3761
jmp 0x3727
callq 0x20a0
cmpl $0x0, (%rax)
je 0x374c
leaq 0xeda8(%rip), %rdi      # 0x124e0
movb $0x0, %al
callq 0xc460
callq 0x20a0
movl $0x0, (%rax)
jmp 0x375a
leaq 0xed8d(%rip), %rdi      # 0x124e0
movb $0x0, %al
callq 0xc6b0
jmp 0x375c
jmp 0x3819
movq -0x20(%rbp), %rax
movl (%rax), %edi
callq 0x7190
movq -0x20(%rbp), %rcx
movq %rax, 0x8(%rcx)
cmpq $0x0, %rax
jne 0x3797
jmp 0x377c
leaq 0xed7e(%rip), %rdi      # 0x12501
movb $0x0, %al
callq 0xc6b0
callq 0x20a0
movl $0x0, (%rax)
jmp 0x380c
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x20(%rbp), %rdx
leaq 0x236(%rip), %rsi       # 0x39e0
callq 0xdc90
movq -0x20(%rbp), %rcx
movq %rax, 0x20(%rcx)
cmpq $0x0, %rax
jne 0x37f6
jmp 0x37bf
callq 0x20a0
cmpl $0x0, (%rax)
je 0x37e4
leaq 0xed51(%rip), %rdi      # 0x12521
movb $0x0, %al
callq 0xc460
callq 0x20a0
movl $0x0, (%rax)
jmp 0x37f2
leaq 0xed36(%rip), %rdi      # 0x12521
movb $0x0, %al
callq 0xc6b0
jmp 0x37f4
jmp 0x37ff
movl $0x0, -0x4(%rbp)
jmp 0x386b
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x77e0
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x7eb0
movq -0x20(%rbp), %rax
movl (%rax), %edi
callq 0x21f0
cmpl $0x0, %eax
je 0x3862
jmp 0x382b
callq 0x20a0
cmpl $0x0, (%rax)
je 0x3850
leaq 0xf69e(%rip), %rdi      # 0x12eda
movb $0x0, %al
callq 0xc460
callq 0x20a0
movl $0x0, (%rax)
jmp 0x385e
leaq 0xf683(%rip), %rdi      # 0x12eda
movb $0x0, %al
callq 0xc6b0
jmp 0x3860
jmp 0x3862
jmp 0x3864
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)