// File: /workspace/github_c_makefile_star2_O1/Tarsnap[P]spiped/tests/nc-server/simple_server.c
// Function: callback_gotconn
static int
callback_gotconn(void * cookie, int s)
{
	struct accept_state * A = cookie;
	struct conn_list_node * node_new;

	/* This accept is no longer in progress. */
	A->accept_cookie = NULL;

	/* If we got a -1 descriptor, something went seriously wrong. */
	if (s == -1) {
		warnp("network_accept");
		goto err0;
	}

	/* We have gained a connection. */
	A->nconn += 1;

	/* Create new conn_list_node. */
	if ((node_new = malloc(sizeof(struct conn_list_node))) == NULL) {
		warn0("Out of memory");
		goto err1;
	}
	node_new->A = A;
	node_new->sock_read = s;

	/* Schedule reading from this connection. */
	if ((node_new->network_read_cookie = network_read(node_new->sock_read,
	    node_new->buf, BUFLEN, 1, callback_read, node_new)) == NULL) {
		warnp("network_read");
		goto err2;
	}

	/* Insert node_new to the beginning of the conn_cookies list. */
	LIST_INSERT_HEAD(&A->conn_cookies, node_new, entries);

	/* Accept another connection if we can. */
	if (doaccept(A)) {
		warn0("doaccept");
		goto err0;
	}

	/* Success! */
	return (0);

err2:
	free(node_new);
err1:
	A->nconn -= 1;
	if (close(s))
		warnp("close");
err0:
	/* Failure! */
	return (-1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq $0x0, 0x30(%rdi)
cmpl $-0x1, %esi
je 0x2d0c
movl %esi, %ebp
movq %rdi, %rbx
incq 0x20(%rdi)
movl $0x2028, %edi           # imm = 0x2028
callq 0x21f0
testq %rax, %rax
je 0x2d2f
movq %rax, %r14
movq %rbx, 0x10(%rax)
movl %ebp, 0x18(%rax)
movq %rax, %rsi
addq $0x1c, %rsi
leaq 0x14f(%rip), %r8        # 0x2df0
movl $0x2000, %edx           # imm = 0x2000
movl $0x1, %ecx
movl %ebp, %edi
movq %rax, %r9
callq 0x44e8
movq %rax, 0x2020(%r14)
testq %rax, %rax
je 0x2d4a
leaq 0x38(%rbx), %rax
movq 0x38(%rbx), %rcx
movq %rcx, (%r14)
testq %rcx, %rcx
je 0x2cd9
movq %r14, 0x8(%rcx)
movq %r14, 0x38(%rbx)
movq %rax, 0x8(%r14)
movq %rbx, %rdi
callq 0x2bd9
testl %eax, %eax
je 0x2d83
leaq 0x447e(%rip), %rdi      # 0x7176
xorl %eax, %eax
callq 0x5df7
callq 0x2090
movl $0x0, (%rax)
jmp 0x2d7c
callq 0x2090
cmpl $0x0, (%rax)
je 0x2d6e
movq %rax, %rbx
leaq 0x4478(%rip), %rdi      # 0x7198
xorl %eax, %eax
callq 0x5cd8
movl $0x0, (%rbx)
jmp 0x2d7c
leaq 0x4432(%rip), %rdi      # 0x7168
xorl %eax, %eax
callq 0x5df7
callq 0x2090
movl $0x0, (%rax)
jmp 0x2d9d
callq 0x2090
cmpl $0x0, (%rax)
je 0x2d87
movq %rax, %r15
leaq 0x4449(%rip), %rdi      # 0x71a7
xorl %eax, %eax
callq 0x5cd8
movl $0x0, (%r15)
jmp 0x2d95
leaq 0x4423(%rip), %rdi      # 0x7198
xorl %eax, %eax
callq 0x5df7
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x2de3
xorl %ebx, %ebx
jmp 0x2de3
leaq 0x4419(%rip), %rdi      # 0x71a7
xorl %eax, %eax
callq 0x5df7
movq %r14, %rdi
callq 0x2040
decq 0x20(%rbx)
movl %ebp, %edi
callq 0x2180
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testl %eax, %eax
je 0x2de3
callq 0x2090
cmpl $0x0, (%rax)
je 0x2dd5
movq %rax, %r14
leaq 0x42e8(%rip), %rdi      # 0x70ad
xorl %eax, %eax
callq 0x5cd8
movl $0x0, (%r14)
jmp 0x2de3
leaq 0x42d1(%rip), %rdi      # 0x70ad
xorl %eax, %eax
callq 0x5df7
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq