// File: /workspace/github_c_makefile_star2_O0/Tarsnap[P]spiped/liball/../lib/proto/proto_conn.c
// Function: proto_conn_drop
int
proto_conn_drop(void * conn_cookie, int reason)
{
	struct conn_state * C = conn_cookie;
	int rc;

	/* Close the incoming connection. */
	if (close(C->s))
		warnp("close");

	/* Close the outgoing connection if it is open. */
	if ((C->t != -1) && close(C->t))
		warnp("close");

	/* Stop connecting if a connection is in progress. */
	if (C->connect_cookie != NULL)
		network_connect_cancel(C->connect_cookie);

	/* Free the target addresses if we haven't already done so. */
	sock_addr_freelist(C->sas);

	/* Stop handshaking if a handshake is in progress. */
	if (C->handshake_cookie != NULL)
		proto_handshake_cancel(C->handshake_cookie);

	/* Kill timeouts if they are pending. */
	if (C->connect_timeout_cookie != NULL)
		events_timer_cancel(C->connect_timeout_cookie);
	if (C->handshake_timeout_cookie != NULL)
		events_timer_cancel(C->handshake_timeout_cookie);

	/* Free protocol keys. */
	proto_crypt_free(C->k_f);
	proto_crypt_free(C->k_r);

	/* Shut down pipes. */
	if (C->pipe_f != NULL)
		proto_pipe_cancel(C->pipe_f);
	if (C->pipe_r != NULL)
		proto_pipe_cancel(C->pipe_r);

	/* Notify the upstream that we've dropped a connection. */
	rc = (C->callback_dead)(C->cookie, reason);

	/* Free the connection cookie. */
	free(C);

	/* Return success/fail status. */
	return (rc);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movl 0x38(%rax), %edi
callq 0x30d0
cmpl $0x0, %eax
je 0xcbe1
jmp 0xcbaa
callq 0x3470
cmpl $0x0, (%rax)
je 0xcbcf
leaq 0x12e62(%rip), %rdi     # 0x1fa1d
movb $0x0, %al
callq 0xbb00
callq 0x3470
movl $0x0, (%rax)
jmp 0xcbdd
leaq 0x12e47(%rip), %rdi     # 0x1fa1d
movb $0x0, %al
callq 0xbd50
jmp 0xcbdf
jmp 0xcbe1
movq -0x18(%rbp), %rax
cmpl $-0x1, 0x3c(%rax)
je 0xcc35
movq -0x18(%rbp), %rax
movl 0x3c(%rax), %edi
callq 0x30d0
cmpl $0x0, %eax
je 0xcc35
jmp 0xcbfe
callq 0x3470
cmpl $0x0, (%rax)
je 0xcc23
leaq 0x12e0e(%rip), %rdi     # 0x1fa1d
movb $0x0, %al
callq 0xbb00
callq 0x3470
movl $0x0, (%rax)
jmp 0xcc31
leaq 0x12df3(%rip), %rdi     # 0x1fa1d
movb $0x0, %al
callq 0xbd50
jmp 0xcc33
jmp 0xcc35
movq -0x18(%rbp), %rax
cmpq $0x0, 0x40(%rax)
je 0xcc4d
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rdi
callq 0x1c010
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0xaad0
movq -0x18(%rbp), %rax
cmpq $0x0, 0x50(%rax)
je 0xcc72
movq -0x18(%rbp), %rax
movq 0x50(%rax), %rdi
callq 0xe3c0
movq -0x18(%rbp), %rax
cmpq $0x0, 0x48(%rax)
je 0xcc8a
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0x7730
movq -0x18(%rbp), %rax
cmpq $0x0, 0x58(%rax)
je 0xcca2
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rdi
callq 0x7730
movq -0x18(%rbp), %rax
movq 0x60(%rax), %rdi
callq 0xdd10
movq -0x18(%rbp), %rax
movq 0x68(%rax), %rdi
callq 0xdd10
movq -0x18(%rbp), %rax
cmpq $0x0, 0x70(%rax)
je 0xccd4
movq -0x18(%rbp), %rax
movq 0x70(%rax), %rdi
callq 0xec60
movq -0x18(%rbp), %rax
cmpq $0x0, 0x78(%rax)
je 0xccec
movq -0x18(%rbp), %rax
movq 0x78(%rax), %rdi
callq 0xec60
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq -0x18(%rbp), %rcx
movq 0x8(%rcx), %rdi
movl -0xc(%rbp), %esi
callq *%rax
movl %eax, -0x1c(%rbp)
movq -0x18(%rbp), %rdi
callq 0x32b0
movl -0x1c(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)