// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl 0x24(%rax), %edx
movl $0x1, %eax
xorl %ecx, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movl %eax, -0x14(%rbp)
movl $0x1, -0x18(%rbp)
movq -0x10(%rbp), %rax
movl 0x38(%rax), %edi
movl $0x1, %esi
movl $0x9, %edx
leaq -0x14(%rbp), %rcx
movl $0x4, %r8d
callq 0x3210
movq -0x10(%rbp), %rax
movl 0x3c(%rax), %edi
movl $0x1, %esi
movl $0x9, %edx
leaq -0x14(%rbp), %rcx
movl $0x4, %r8d
callq 0x3210
movq -0x10(%rbp), %rax
movl 0x38(%rax), %edi
movl $0x6, %esi
movl $0x1, %edx
leaq -0x18(%rbp), %rcx
movl $0x4, %r8d
callq 0x3210
movq -0x10(%rbp), %rax
movl 0x3c(%rax), %edi
movl $0x6, %esi
movl $0x1, %edx
leaq -0x18(%rbp), %rcx
movl $0x4, %r8d
callq 0x3210
movq -0x10(%rbp), %rax
movl 0x38(%rax), %edi
movq -0x10(%rbp), %rax
movl 0x3c(%rax), %esi
movq -0x10(%rbp), %rax
movl 0x18(%rax), %edx
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rcx
movq -0x10(%rbp), %r8
addq $0x80, %r8
movq -0x10(%rbp), %rax
leaq 0x93(%rip), %r9         # 0xd3f0
movq %rax, (%rsp)
callq 0xe860
movq -0x10(%rbp), %rcx
movq %rax, 0x70(%rcx)
cmpq $0x0, %rax
jne 0xd376
jmp 0xd3d6
movq -0x10(%rbp), %rax
movl 0x3c(%rax), %edi
movq -0x10(%rbp), %rax
movl 0x38(%rax), %esi
movq -0x10(%rbp), %rax
cmpl $0x0, 0x18(%rax)
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %edx
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rcx
movq -0x10(%rbp), %r8
addq $0x84, %r8
movq -0x10(%rbp), %rax
leaq 0x3c(%rip), %r9         # 0xd3f0
movq %rax, (%rsp)
callq 0xe860
movq -0x10(%rbp), %rcx
movq %rax, 0x78(%rcx)
cmpq $0x0, %rax
jne 0xd3cd
jmp 0xd3d6
movl $0x0, -0x4(%rbp)
jmp 0xd3dd
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)