// File: /workspace/github_c_makefile_star2_O0/Tarsnap[P]kivaloo/mux/dispatch.c
// Function: dropconn
static int
dropconn(struct sock_active * S)
{
	struct dispatch_state * dstate = S->dstate;

	/* Sanity check. */
	assert(S->read_cookie == NULL);
	assert(S->nrequests == 0);

	/* Detach from the dispatcher. */
	if (S->prev == NULL)
		dstate->sock_active = S->next;
	else
		S->prev->next = S->next;
	if (S->next != NULL)
		S->next->prev = S->prev;
	if (dstate->nsock_active-- == dstate->nsock_active_max) {
		if (accept_start(dstate))
			goto err2;
	}

	/* Free the buffered reader. */
	netbuf_read_free(S->readq);

	/* Free the buffered writer. */
	netbuf_write_free(S->writeq);

	/* Close the socket. */
	while (close(S->s)) {
		if (errno == EINTR)
			continue;
		warnp("close");
		goto err1;
	}

	/* Free the connection state. */
	free(S);

	/* Success! */
	return (0);

err2:
	netbuf_read_free(S->readq);
	netbuf_write_free(S->writeq);
	if (close(S->s))
		warnp("close");
err1:
	free(S);

	/* Failure! */
	return (-1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x30(%rax)
jne 0x3f94
jmp 0x3fb3
leaq 0xc59f(%rip), %rdi      # 0x1053a
leaq 0xc484(%rip), %rsi      # 0x10426
movl $0x195, %edx            # imm = 0x195
leaq 0xc645(%rip), %rcx      # 0x105f3
callq 0x21c0
movq -0x10(%rbp), %rax
cmpq $0x0, 0x38(%rax)
jne 0x3fc0
jmp 0x3fdf
leaq 0xc64f(%rip), %rdi      # 0x10616
leaq 0xc458(%rip), %rsi      # 0x10426
movl $0x196, %edx            # imm = 0x196
leaq 0xc619(%rip), %rcx      # 0x105f3
callq 0x21c0
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x3ffc
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x4010
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x402f
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rcx
movq 0x18(%rcx), %rax
movq %rax, %rdx
addq $-0x1, %rdx
movq %rdx, 0x18(%rcx)
movq -0x18(%rbp), %rcx
cmpq 0x20(%rcx), %rax
jne 0x4061
movq -0x18(%rbp), %rdi
callq 0x3720
cmpl $0x0, %eax
je 0x405f
jmp 0x40e3
jmp 0x4061
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x7000
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x76d0
movq -0x10(%rbp), %rax
movl 0x18(%rax), %edi
callq 0x21e0
cmpl $0x0, %eax
je 0x40d1
callq 0x20a0
cmpl $0x4, (%rax)
jne 0x4098
jmp 0x407b
jmp 0x409a
callq 0x20a0
cmpl $0x0, (%rax)
je 0x40bf
leaq 0xcd41(%rip), %rdi      # 0x10dec
movb $0x0, %al
callq 0xbc80
callq 0x20a0
movl $0x0, (%rax)
jmp 0x40cd
leaq 0xcd26(%rip), %rdi      # 0x10dec
movb $0x0, %al
callq 0xbed0
jmp 0x40cf
jmp 0x4149
movq -0x10(%rbp), %rdi
callq 0x2040
movl $0x0, -0x4(%rbp)
jmp 0x4159
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x7000
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x76d0
movq -0x10(%rbp), %rax
movl 0x18(%rax), %edi
callq 0x21e0
cmpl $0x0, %eax
je 0x4147
jmp 0x4110
callq 0x20a0
cmpl $0x0, (%rax)
je 0x4135
leaq 0xcccb(%rip), %rdi      # 0x10dec
movb $0x0, %al
callq 0xbc80
callq 0x20a0
movl $0x0, (%rax)
jmp 0x4143
leaq 0xccb0(%rip), %rdi      # 0x10dec
movb $0x0, %al
callq 0xbed0
jmp 0x4145
jmp 0x4147
jmp 0x4149
movq -0x10(%rbp), %rdi
callq 0x2040
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)