// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
cmpq $0x4000, -0x20(%rbp)    # imm = 0x4000
ja 0x3a48
jmp 0x3a67
leaq 0x148b6(%rip), %rdi     # 0x18305
leaq 0x148c4(%rip), %rsi     # 0x1831a
movl $0x8a, %edx
leaq 0x148d8(%rip), %rcx     # 0x1833a
callq 0x2120
movq -0x28(%rbp), %rax
cmpl $0x0, 0x28(%rax)
jne 0x3b64
movq -0x28(%rbp), %rdi
addq $0x10, %rdi
callq 0x2230
cmpl $0x0, %eax
je 0x3ac3
jmp 0x3a89
callq 0x2340
cmpl $0x0, (%rax)
je 0x3aae
leaq 0x1490b(%rip), %rdi     # 0x183a5
movb $0x0, %al
callq 0x14390
callq 0x2340
movl $0x0, (%rax)
jmp 0x3abc
leaq 0x148f0(%rip), %rdi     # 0x183a5
movb $0x0, %al
callq 0x145e0
jmp 0x3abe
jmp 0x3d54
movq -0x28(%rbp), %rdi
addq $0x18, %rdi
callq 0x2230
cmpl $0x0, %eax
je 0x3b11
jmp 0x3ad7
callq 0x2340
cmpl $0x0, (%rax)
je 0x3afc
leaq 0x148bd(%rip), %rdi     # 0x183a5
movb $0x0, %al
callq 0x14390
callq 0x2340
movl $0x0, (%rax)
jmp 0x3b0a
leaq 0x148a2(%rip), %rdi     # 0x183a5
movb $0x0, %al
callq 0x145e0
jmp 0x3b0c
jmp 0x3d54
movq -0x28(%rbp), %rdi
addq $0x20, %rdi
callq 0x2230
cmpl $0x0, %eax
je 0x3b5f
jmp 0x3b25
callq 0x2340
cmpl $0x0, (%rax)
je 0x3b4a
leaq 0x1486f(%rip), %rdi     # 0x183a5
movb $0x0, %al
callq 0x14390
callq 0x2340
movl $0x0, (%rax)
jmp 0x3b58
leaq 0x14854(%rip), %rdi     # 0x183a5
movb $0x0, %al
callq 0x145e0
jmp 0x3b5a
jmp 0x3d54
jmp 0x3c80
movq -0x28(%rbp), %rax
cmpl $0x1, 0x28(%rax)
jne 0x3c79
movq -0x28(%rbp), %rcx
addq $0x10, %rcx
movl $0x1, %esi
xorl %edx, %edx
movl %esi, %edi
callq 0x2290
cmpl $0x0, %eax
je 0x3bc9
jmp 0x3b8f
callq 0x2340
cmpl $0x0, (%rax)
je 0x3bb4
leaq 0x147c7(%rip), %rdi     # 0x18367
movb $0x0, %al
callq 0x14390
callq 0x2340
movl $0x0, (%rax)
jmp 0x3bc2
leaq 0x147ac(%rip), %rdi     # 0x18367
movb $0x0, %al
callq 0x145e0
jmp 0x3bc4
jmp 0x3d54
movq -0x28(%rbp), %rcx
addq $0x18, %rcx
movl $0x1, %esi
xorl %edx, %edx
movl %esi, %edi
callq 0x2290
cmpl $0x0, %eax
je 0x3c20
jmp 0x3be6
callq 0x2340
cmpl $0x0, (%rax)
je 0x3c0b
leaq 0x14770(%rip), %rdi     # 0x18367
movb $0x0, %al
callq 0x14390
callq 0x2340
movl $0x0, (%rax)
jmp 0x3c19
leaq 0x14755(%rip), %rdi     # 0x18367
movb $0x0, %al
callq 0x145e0
jmp 0x3c1b
jmp 0x3d54
movq -0x28(%rbp), %rcx
addq $0x20, %rcx
movl $0x1, %esi
xorl %edx, %edx
movl %esi, %edi
callq 0x2290
cmpl $0x0, %eax
je 0x3c77
jmp 0x3c3d
callq 0x2340
cmpl $0x0, (%rax)
je 0x3c62
leaq 0x14719(%rip), %rdi     # 0x18367
movb $0x0, %al
callq 0x14390
callq 0x2340
movl $0x0, (%rax)
jmp 0x3c70
leaq 0x146fe(%rip), %rdi     # 0x18367
movb $0x0, %al
callq 0x145e0
jmp 0x3c72
jmp 0x3d54
jmp 0x3c7e
jmp 0x3d54
jmp 0x3c80
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x20(%rbp), %rax
jae 0x3cb7
movq -0x30(%rbp), %rax
andq $0xff, %rax
movb %al, %dl
movq -0x18(%rbp), %rax
movq -0x30(%rbp), %rcx
movb %dl, (%rax,%rcx)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x3c88
movq -0x28(%rbp), %rdi
addq $0x8, %rdi
movq -0x28(%rbp), %rcx
xorl %eax, %eax
movl %eax, %esi
leaq 0x3a2(%rip), %rdx       # 0x4070
callq 0x14d40
movl %eax, -0x34(%rbp)
cmpl $0x0, %eax
je 0x3d03
jmp 0x3cdd
movl -0x34(%rbp), %edi
callq 0x2280
movq %rax, %rsi
leaq 0x14683(%rip), %rdi     # 0x18372
movb $0x0, %al
callq 0x145e0
callq 0x2340
movl $0x0, (%rax)
jmp 0x3d54
movq -0x28(%rbp), %rdi
movq -0x28(%rbp), %rcx
xorl %eax, %eax
movl %eax, %esi
leaq 0x3ea(%rip), %rdx       # 0x4100
callq 0x14d40
movl %eax, -0x34(%rbp)
cmpl $0x0, %eax
je 0x3d4b
jmp 0x3d25
movl -0x34(%rbp), %edi
callq 0x2280
movq %rax, %rsi
leaq 0x1463b(%rip), %rdi     # 0x18372
movb $0x0, %al
callq 0x145e0
callq 0x2340
movl $0x0, (%rax)
jmp 0x3d54
movl $0x0, -0x4(%rbp)
jmp 0x3d5b
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)