// File: /workspace/github_c_makefile_star2_O0/Tarsnap[P]spiped/liball/../lib/proto/proto_conn.c
// Function: proto_conn_create
void *
proto_conn_create(int s, struct sock_addr ** sas,
    const struct sock_addr * sa_b, int decr, int nopfs,
    int requirepfs, int nokeepalive, const struct proto_secret * K,
    double timeo, int (* callback_dead)(void *, int), void * cookie)
{
	struct conn_state * C;

	/* Bake a cookie for this connection. */
	if ((C = malloc(sizeof(struct conn_state))) == NULL)
		goto err0;
	C->callback_dead = callback_dead;
	C->cookie = cookie;
	C->sas = sas;
	C->decr = decr;
	C->nopfs = nopfs;
	C->requirepfs = requirepfs;
	C->nokeepalive = nokeepalive;
	C->K = K;
	C->timeo = timeo;
	C->s = s;
	C->t = -1;
	C->connect_cookie = NULL;
	C->connect_timeout_cookie = NULL;
	C->handshake_cookie = NULL;
	C->handshake_timeout_cookie = NULL;
	C->k_f = C->k_r = NULL;
	C->pipe_f = C->pipe_r = NULL;
	C->stat_f = C->stat_r = 1;

	/* Start the connect timer. */
	if ((C->connect_timeout_cookie = events_timer_register_double(
	    callback_connect_timeout, C, C->timeo)) == NULL)
		goto err1;

	/* Connect to target. */
	if ((C->connect_cookie =
	    network_connect_bind(C->sas, sa_b, callback_connect_done, C))
	    == NULL)
		goto err2;

	/* If we're decrypting, start the handshake. */
	if (C->decr) {
		if (starthandshake(C, C->s, C->decr))
			goto err3;
	}

	/* Success! */
	return (C);

err3:
	network_connect_cancel(C->connect_cookie);
err2:
	events_timer_cancel(C->connect_timeout_cookie);
err1:
	free(C);
err0:
	/* Failure! */
	return (NULL);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq 0x28(%rbp), %rax
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movl 0x10(%rbp), %eax
movl %edi, -0xc(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movl %r8d, -0x28(%rbp)
movl %r9d, -0x2c(%rbp)
movsd %xmm0, -0x38(%rbp)
movl $0x88, %edi
callq 0x31b0
movq %rax, -0x40(%rbp)
cmpq $0x0, %rax
jne 0xcd6b
jmp 0xcf0d
movq 0x20(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, (%rax)
movq 0x28(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x10(%rax)
movl -0x24(%rbp), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x18(%rax)
movl -0x28(%rbp), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x1c(%rax)
movl -0x2c(%rbp), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x20(%rax)
movl 0x10(%rbp), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x24(%rax)
movq 0x18(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x28(%rax)
movsd -0x38(%rbp), %xmm0
movq -0x40(%rbp), %rax
movsd %xmm0, 0x30(%rax)
movl -0xc(%rbp), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x38(%rax)
movq -0x40(%rbp), %rax
movl $0xffffffff, 0x3c(%rax) # imm = 0xFFFFFFFF
movq -0x40(%rbp), %rax
movq $0x0, 0x40(%rax)
movq -0x40(%rbp), %rax
movq $0x0, 0x48(%rax)
movq -0x40(%rbp), %rax
movq $0x0, 0x50(%rax)
movq -0x40(%rbp), %rax
movq $0x0, 0x58(%rax)
movq -0x40(%rbp), %rax
movq $0x0, 0x68(%rax)
movq -0x40(%rbp), %rax
movq $0x0, 0x60(%rax)
movq -0x40(%rbp), %rax
movq $0x0, 0x78(%rax)
movq -0x40(%rbp), %rax
movq $0x0, 0x70(%rax)
movq -0x40(%rbp), %rax
movl $0x1, 0x84(%rax)
movq -0x40(%rbp), %rax
movl $0x1, 0x80(%rax)
movq -0x40(%rbp), %rsi
movq -0x40(%rbp), %rax
movsd 0x30(%rax), %xmm0
leaq 0xab(%rip), %rdi        # 0xcf20
callq 0x76d0
movq -0x40(%rbp), %rcx
movq %rax, 0x48(%rcx)
cmpq $0x0, %rax
jne 0xce8a
jmp 0xcf04
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x20(%rbp), %rsi
movq -0x40(%rbp), %rcx
leaq 0xbf(%rip), %rdx        # 0xcf60
callq 0x1bf90
movq -0x40(%rbp), %rcx
movq %rax, 0x40(%rcx)
cmpq $0x0, %rax
jne 0xceb6
jmp 0xcef7
movq -0x40(%rbp), %rax
cmpl $0x0, 0x18(%rax)
je 0xcee0
movq -0x40(%rbp), %rdi
movq -0x40(%rbp), %rax
movl 0x38(%rax), %esi
movq -0x40(%rbp), %rax
movl 0x18(%rax), %edx
callq 0xd060
cmpl $0x0, %eax
je 0xcede
jmp 0xceea
jmp 0xcee0
movq -0x40(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xcf15
movq -0x40(%rbp), %rax
movq 0x40(%rax), %rdi
callq 0x1c010
movq -0x40(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0x7730
movq -0x40(%rbp), %rdi
callq 0x32b0
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nop