// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq $0x0, 0x30(%rax)
cmpl $-0x1, -0x14(%rbp)
jne 0x3185
jmp 0x314b
callq 0x20a0
cmpl $0x0, (%rax)
je 0x3170
leaq 0x70ba(%rip), %rdi      # 0xa216
movb $0x0, %al
callq 0x7ba0
callq 0x20a0
movl $0x0, (%rax)
jmp 0x317e
leaq 0x709f(%rip), %rdi      # 0xa216
movb $0x0, %al
callq 0x7df0
jmp 0x3180
jmp 0x332a
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x20(%rax)
movl $0x2028, %edi           # imm = 0x2028
callq 0x2220
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
jne 0x31c9
jmp 0x31ab
leaq 0x7034(%rip), %rdi      # 0xa1e6
movb $0x0, %al
callq 0x7df0
callq 0x20a0
movl $0x0, (%rax)
jmp 0x32d2
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x10(%rax)
movl -0x14(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0x28(%rbp), %rax
movl 0x18(%rax), %edi
movq -0x28(%rbp), %rsi
addq $0x1c, %rsi
movq -0x28(%rbp), %r9
movl $0x2000, %edx           # imm = 0x2000
movl $0x1, %ecx
leaq 0x13d(%rip), %r8        # 0x3340
callq 0x5640
movq -0x28(%rbp), %rcx
movq %rax, 0x2020(%rcx)
cmpq $0x0, %rax
jne 0x3252
jmp 0x321b
callq 0x20a0
cmpl $0x0, (%rax)
je 0x3240
leaq 0x6ff9(%rip), %rdi      # 0xa225
movb $0x0, %al
callq 0x7ba0
callq 0x20a0
movl $0x0, (%rax)
jmp 0x324e
leaq 0x6fde(%rip), %rdi      # 0xa225
movb $0x0, %al
callq 0x7df0
jmp 0x3250
jmp 0x32c9
jmp 0x3254
movq -0x20(%rbp), %rax
movq 0x38(%rax), %rax
movq -0x28(%rbp), %rcx
movq %rax, (%rcx)
cmpq $0x0, %rax
je 0x3279
movq -0x28(%rbp), %rcx
movq -0x20(%rbp), %rax
movq 0x38(%rax), %rax
movq %rcx, 0x8(%rax)
movq -0x28(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x38(%rax)
movq -0x20(%rbp), %rcx
addq $0x38, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rdi
callq 0x2f70
cmpl $0x0, %eax
je 0x32c0
jmp 0x32a5
leaq 0x6f48(%rip), %rdi      # 0xa1f4
movb $0x0, %al
callq 0x7df0
callq 0x20a0
movl $0x0, (%rax)
jmp 0x332a
movl $0x0, -0x4(%rbp)
jmp 0x3331
movq -0x28(%rbp), %rdi
callq 0x2040
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rcx
subq $0x1, %rcx
movq %rcx, 0x20(%rax)
movl -0x14(%rbp), %edi
callq 0x21b0
cmpl $0x0, %eax
je 0x3328
jmp 0x32f1
callq 0x20a0
cmpl $0x0, (%rax)
je 0x3316
leaq 0x6dab(%rip), %rdi      # 0xa0ad
movb $0x0, %al
callq 0x7ba0
callq 0x20a0
movl $0x0, (%rax)
jmp 0x3324
leaq 0x6d90(%rip), %rdi      # 0xa0ad
movb $0x0, %al
callq 0x7df0
jmp 0x3326
jmp 0x3328
jmp 0x332a
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)