// File: /workspace/github_c_makefile_star2_O3/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 %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
xorl %eax, %eax
cmpl $0x0, 0x24(%rdi)
sete %al
leaq 0xc(%rsp), %r15
movl %eax, (%r15)
leaq 0x8(%rsp), %r14
movl $0x1, (%r14)
movl 0x38(%rdi), %edi
movl $0x1, %esi
movl $0x9, %edx
movq %r15, %rcx
movl $0x4, %r8d
callq 0x3200
movl 0x3c(%rbx), %edi
movl $0x1, %esi
movl $0x9, %edx
movq %r15, %rcx
movl $0x4, %r8d
callq 0x3200
movl 0x38(%rbx), %edi
movl $0x6, %esi
movl $0x1, %edx
movq %r14, %rcx
movl $0x4, %r8d
callq 0x3200
movl 0x3c(%rbx), %edi
movl $0x6, %esi
movl $0x1, %edx
movq %r14, %rcx
movl $0x4, %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 0x55(%rip), %r9         # 0x9d5f
callq 0xa8f4
movq %rax, 0x70(%rbx)
testq %rax, %rax
je 0x9d50
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 0x22(%rip), %r9         # 0x9d5f
callq 0xa8f4
movq %rax, %rcx
movq %rax, 0x78(%rbx)
xorl %eax, %eax
testq %rcx, %rcx
jne 0x9d55
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq