// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]spiped/liball/../lib/proto/proto_conn.c
// Function: launchpipes
static int
launchpipes(struct conn_state * C)
{
	int on = C->nokeepalive ? 0 : 1;
	int one = 1;

	/*
	 * Attempt to turn keepalives on or off as requested.  We ignore
	 * failures here since the sockets might not be of a type for which
	 * SO_KEEPALIVE is valid -- it is a socket level option, but protocol
	 * specific.  In particular, it has no sensible meaning for UNIX
	 * sockets.
	 */
	(void)setsockopt(C->s, SOL_SOCKET, SO_KEEPALIVE, &on, sizeof(on));
	(void)setsockopt(C->t, SOL_SOCKET, SO_KEEPALIVE, &on, sizeof(on));

	/*-
	 * Attempt to turn off nagling on both sockets.  If the TCP stack has
	 * enough window space that it is always able to send packets, then on
	 * the encrypted end this will result in every 1060-byte spiped packet
	 * getting its own TCP segment, including 40 bytes of TCP/IP headers;
	 * this is fine.  On the unencrypted end, we might send a single byte
	 * of data with 40 bytes of TCP/IP headers; this is not so good.
	 *
	 * However, a write over the unencrypted connection will only happen
	 * after an spiped packet has been read from the encrypted connection,
	 * so the worst case is 80 bytes of TCP/IP headers per 1061 bytes of
	 * TCP/IP payload (this may still be only a single byte of spiped
	 * payload, but that is not relevant to the question of overhead from
	 * small TCP/IP segments); and while the two sockets might not be on
	 * the same network, if they are on different networks it is almost
	 * guaranteed that the network over which the encrypted connection is
	 * passing would be a wider-area network which is both less secure and
	 * more expensive.  Consequently, the maximum TCP/IP overhead ratio of
	 * 80/1061 is almost certain to hold even with weighted byte costs.
	 *
	 * We ignore errors since (as with keep-alives) we may be dealing with
	 * a non-TCP socket; and also because while POSIX requires TCP_NODELAY
	 * to be defined, it is not required to be implemented as a socket
	 * option.
	 */
	(void)setsockopt(C->s, IPPROTO_TCP, TCP_NODELAY, &one, sizeof(one));
	(void)setsockopt(C->t, IPPROTO_TCP, TCP_NODELAY, &one, sizeof(one));

	/* Create two pipes. */
	if ((C->pipe_f = proto_pipe(C->s, C->t, C->decr, C->k_f,
	    &C->stat_f, callback_pipestatus, C)) == NULL)
		goto err0;
	if ((C->pipe_r = proto_pipe(C->t, C->s, !C->decr, C->k_r,
	    &C->stat_r, callback_pipestatus, C)) == NULL)
		goto err0;

	/* Success! */
	return (0);

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
xorl %eax, %eax
cmpl $0x0, 0x24(%rdi)
sete %al
leaq 0x14(%rsp), %r12
movl %eax, (%r12)
leaq 0x10(%rsp), %r14
movl $0x1, (%r14)
movl 0x38(%rdi), %edi
pushq $0x1
popq %rbp
pushq $0x9
popq %r13
pushq $0x4
popq %r15
movl %ebp, %esi
movl %r13d, %edx
movq %r12, %rcx
movl %r15d, %r8d
callq 0x3200
movl 0x3c(%rbx), %edi
movl %ebp, %esi
movl %r13d, %edx
movq %r12, %rcx
movl %r15d, %r8d
callq 0x3200
movl 0x38(%rbx), %edi
pushq $0x6
popq %r12
movl %r12d, %esi
movl %ebp, %edx
movq %r14, %rcx
movl %r15d, %r8d
callq 0x3200
movl 0x3c(%rbx), %edi
movl %r12d, %esi
movl %ebp, %edx
movq %r14, %rcx
movl %r15d, %r8d
callq 0x3200
movl 0x18(%rbx), %edx
movl 0x38(%rbx), %edi
movl 0x3c(%rbx), %esi
movq 0x60(%rbx), %rcx
leaq 0x80(%rbx), %r8
movq %rbx, (%rsp)
leaq 0x58(%rip), %r9         # 0x93b3
callq 0x9e84
movq %rax, 0x70(%rbx)
testq %rax, %rax
je 0x93a1
movl 0x38(%rbx), %esi
xorl %edx, %edx
cmpl $0x0, 0x18(%rbx)
movl 0x3c(%rbx), %edi
sete %dl
movq 0x68(%rbx), %rcx
leaq 0x84(%rbx), %r8
movq %rbx, (%rsp)
leaq 0x25(%rip), %r9         # 0x93b3
callq 0x9e84
movq %rax, %rcx
movq %rax, 0x78(%rbx)
xorl %eax, %eax
testq %rcx, %rcx
jne 0x93a4
pushq $-0x1
popq %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq