// File: /workspace/github_c_makefile_star2_O1/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 %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
cmpq $0x4001, %rdx           # imm = 0x4001
jae 0x32c9
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movl 0x28(%rdi), %eax
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
cmpl $0x1, %eax
je 0x31c0
testl %eax, %eax
jne 0x324b
leaq 0x10(%rbx), %rdi
callq 0x2250
testl %eax, %eax
jne 0x31aa
leaq 0x18(%rbx), %rdi
callq 0x2250
testl %eax, %eax
jne 0x31aa
leaq 0x20(%rbx), %rdi
callq 0x2250
testl %eax, %eax
je 0x325a
callq 0x2370
cmpl $0x0, (%rax)
je 0x322e
movq %rax, %rbx
leaq 0x917d(%rip), %rdi      # 0xc33b
jmp 0x321f
leaq 0x10(%rbx), %rcx
movl $0x1, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x22b0
testl %eax, %eax
jne 0x320b
leaq 0x18(%rbx), %rcx
movl $0x1, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x22b0
testl %eax, %eax
jne 0x320b
leaq 0x20(%rbx), %rcx
movl $0x1, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x22b0
testl %eax, %eax
je 0x325a
callq 0x2370
cmpl $0x0, (%rax)
je 0x3237
movq %rax, %rbx
leaq 0x9191(%rip), %rdi      # 0xc3b0
xorl %eax, %eax
callq 0x9f98
movl $0x0, (%rbx)
jmp 0x3245
leaq 0x9106(%rip), %rdi      # 0xc33b
jmp 0x323e
leaq 0x9172(%rip), %rdi      # 0xc3b0
xorl %eax, %eax
callq 0xa0b7
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
movl %r12d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
testq %r14, %r14
je 0x326d
xorl %eax, %eax
movb %al, (%r15,%rax)
incq %rax
cmpq %rax, %r14
jne 0x3261
leaq 0x8(%rbx), %rdi
leaq 0x246(%rip), %rdx       # 0x34be
xorl %r12d, %r12d
xorl %esi, %esi
movq %rbx, %rcx
callq 0xa508
testl %eax, %eax
jne 0x32a1
leaq 0x298(%rip), %rdx       # 0x3528
movq %rbx, %rdi
xorl %esi, %esi
movq %rbx, %rcx
callq 0xa508
testl %eax, %eax
je 0x324b
movl %eax, %edi
callq 0x22a0
leaq 0x9059(%rip), %rdi      # 0xc308
movq %rax, %rsi
xorl %eax, %eax
callq 0xa0b7
callq 0x2370
movl $0x0, (%rax)
jmp 0x3245
leaq 0x8fd6(%rip), %rdi      # 0xc2a6
leaq 0x8fe4(%rip), %rsi      # 0xc2bb
leaq 0x8ffd(%rip), %rcx      # 0xc2db
movl $0x8a, %edx
callq 0x2130