// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]spiped/perftests/standalone-enc/standalone_transfer_noencrypt.c
// Function: perftest_init
static int
perftest_init(void * cookie, uint8_t * buf, size_t buflen)
{
	struct shared * shared = cookie;
	size_t i;
	int rc;

	/* Sanity checks. */
	assert(buflen <= MAXOUTSIZE);

	/* Create communication endpoints. */
	if (shared->method == 0) {
		/* Use pipes. */
		if (pipe(shared->in)) {
			warnp("pipe");
			goto err0;
		}
		if (pipe(shared->out)) {
			warnp("pipe");
			goto err0;
		}
		if (pipe(shared->finished)) {
			warnp("pipe");
			goto err0;
		}
	} else if (shared->method == 1) {
		/* Use socketpairs. */
		if (socketpair(AF_UNIX, SOCK_STREAM, 0, shared->in)) {
			warnp("socketpair");
			goto err0;
		}
		if (socketpair(AF_UNIX, SOCK_STREAM, 0, shared->out)) {
			warnp("socketpair");
			goto err0;
		}
		if (socketpair(AF_UNIX, SOCK_STREAM, 0, shared->finished)) {
			warnp("socketpair");
			goto err0;
		}
	} else
		goto err0;

	/* Set the input. */
	for (i = 0; i < buflen; i++)
		buf[i] = (uint8_t)(i & 0xff);

	/* Create the threads. */
	if ((rc = pthread_create_blocking_np(&shared->output_thr, NULL,
	    drain_output, shared))) {
		warn0("pthread_create: %s", strerror(rc));
		goto err0;
	}
	if ((rc = pthread_create_blocking_np(&shared->data_thr, NULL,
	    transfer_data, shared))) {
		warn0("pthread_create: %s", strerror(rc));
		goto err0;
	}

	/* Success! */
	return (0);

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
cmpq $0x4001, %rdx           # imm = 0x4001
jae 0x3119
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movl 0x28(%rdi), %eax
pushq $-0x1
popq %rbp
cmpl $0x1, %eax
je 0x302f
testl %eax, %eax
jne 0x30a2
leaq 0x10(%rbx), %rdi
callq 0x2250
testl %eax, %eax
jne 0x3019
leaq 0x18(%rbx), %rdi
callq 0x2250
testl %eax, %eax
jne 0x3019
leaq 0x20(%rbx), %rdi
callq 0x2250
testl %eax, %eax
je 0x30b3
callq 0x2370
cmpl $0x0, (%rax)
je 0x3094
movq %rax, %rbx
leaq 0x930e(%rip), %rdi      # 0xc33b
jmp 0x307f
leaq 0x10(%rbx), %rcx
pushq $0x1
popq %rdi
movl %edi, %esi
xorl %edx, %edx
callq 0x22b0
testl %eax, %eax
jne 0x306b
leaq 0x18(%rbx), %rcx
pushq $0x1
popq %rdi
movl %edi, %esi
xorl %edx, %edx
callq 0x22b0
testl %eax, %eax
jne 0x306b
leaq 0x20(%rbx), %rcx
pushq $0x1
popq %rdi
movl %edi, %esi
xorl %edx, %edx
callq 0x22b0
testl %eax, %eax
je 0x30b3
callq 0x2370
cmpl $0x0, (%rax)
je 0x308b
movq %rax, %rbx
leaq 0x9331(%rip), %rdi      # 0xc3b0
xorl %eax, %eax
callq 0x955d
andl $0x0, (%rbx)
jmp 0x30a2
leaq 0x931e(%rip), %rdi      # 0xc3b0
jmp 0x309b
leaq 0x92a0(%rip), %rdi      # 0xc33b
xorl %eax, %eax
callq 0x96ec
movl %ebp, %r14d
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
cmpq %rax, %r14
je 0x30c3
movb %al, (%r15,%rax)
incq %rax
jmp 0x30b5
leaq 0x8(%rbx), %rdi
leaq 0x21c(%rip), %rdx       # 0x32ea
xorl %r14d, %r14d
xorl %esi, %esi
movq %rbx, %rcx
callq 0x9b60
testl %eax, %eax
jne 0x30f7
leaq 0x269(%rip), %rdx       # 0x334f
movq %rbx, %rdi
xorl %esi, %esi
movq %rbx, %rcx
callq 0x9b60
testl %eax, %eax
je 0x30a5
movl %eax, %edi
callq 0x22a0
leaq 0x9203(%rip), %rdi      # 0xc308
movq %rax, %rsi
xorl %eax, %eax
callq 0x96ec
callq 0x2370
andl $0x0, (%rax)
jmp 0x30a2
leaq 0x9186(%rip), %rdi      # 0xc2a6
leaq 0x9194(%rip), %rsi      # 0xc2bb
leaq 0x91ad(%rip), %rcx      # 0xc2db
movl $0x8a, %edx
callq 0x2130