LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../lib/wire/wire_requestqueue.c
// Function: failqueue
static int
failqueue(void * cookie)
{
	struct wire_requestqueue * Q = cookie;
	struct request * R;
	int64_t ID;
	int rc = 0;	/* Success unless we fail to schedule a callback. */

	/* This queue is dying. */
	assert(Q->failed == 0);
	Q->failed = 1;

	/* Cancel any pending packet-reading wait. */
	if (Q->read_cookie != NULL) {
		wire_readpacket_wait_cancel(Q->read_cookie);
		Q->read_cookie = NULL;
	}

	/* Free the buffered writer. */
	netbuf_write_free(Q->WQ);

	/* Schedule callbacks for pending requests. */
	while ((ID = seqptrmap_getmin(Q->reqs)) != -1) {
		/* Get the first pending request. */
		R = seqptrmap_get(Q->reqs, ID);

		/* Said request can't be NULL unless seqptrmap is broken. */
		assert(R != NULL);

		/* Schedule a failure callback to occur later. */
		if (events_immediate_register(failreq, R, 0) == NULL)
			rc = -1;

		/* Delete the request from the map. */
		seqptrmap_delete(Q->reqs, ID);
	}

	/* Success unless we failed to schedule a callback. */
	return (rc);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
cmpl $0x0, 0x20(%rdi)
jne 0x64b9
movq %rdi, %rbx
movl $0x1, 0x20(%rdi)
movq 0x10(%rdi), %rdi
testq %rdi, %rdi
je 0x6430
callq 0x879c
andq $0x0, 0x10(%rbx)
movq 0x8(%rbx), %rdi
callq 0x7bd4
xorl %ebp, %ebp
leaq 0x266(%rip), %r14       # 0x66a8
movq 0x18(%rbx), %rdi
callq 0x72f8
cmpq $-0x1, %rax
je 0x648d
movq %rax, %r15
movq 0x18(%rbx), %rdi
movq %rax, %rsi
callq 0x72d8
testq %rax, %rax
je 0x649a
movq %r14, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x2b2c
cmpq $0x1, %rax
movl $0x0, %eax
sbbl %eax, %eax
orl %eax, %ebp
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0x7314
jmp 0x6442
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x38e7(%rip), %rdi      # 0x9d88
leaq 0x3843(%rip), %rsi      # 0x9ceb
leaq 0x38c3(%rip), %rcx      # 0x9d72
movl $0x8f, %edx
callq 0x2180
leaq 0x38a3(%rip), %rdi      # 0x9d63
leaq 0x3824(%rip), %rsi      # 0x9ceb
leaq 0x38a4(%rip), %rcx      # 0x9d72
pushq $0x7d
popq %rdx
callq 0x2180
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../lib/wire/wire_requestqueue.c
// Function: readpackets
static int
readpackets(void * cookie, int status)
{
	struct wire_requestqueue * Q = cookie;
	struct wire_packet P;
	struct request * R;

	/* We're not waiting for a packet to be available any more. */
	Q->read_cookie = NULL;

	/* If the wait failed, the connection is dying. */
	if (status)
		goto fail;

	/* Handle packets until there are no more or we encounter an error. */
	do {
		/* Grab a packet. */
		if (wire_readpacket_peek(Q->R, &P))
			goto fail;

		/* Exit the loop if no packet is available. */
		if (P.buf == NULL)
			break;

		/* Look up the request associated with this response. */
		if ((R = seqptrmap_get(Q->reqs, (int64_t)P.ID)) == NULL) {
			/* Is this response ID reasonable? */
			warn0("Received bogus response ID: %016" PRIx64, P.ID);

			/* This connection is not useful. */
			goto fail;
		}

		/* Delete the request from the pending request map. */
		seqptrmap_delete(Q->reqs, (int64_t)P.ID);

		/* Invoke the upstream callback. */
		if ((R->callback)(R->cookie, P.buf, P.len))
			goto err0;

		/* Free the request structure. */
		mpool_request_free(R);

		/* Consume the packet. */
		wire_readpacket_consume(Q->R, &P);
	} while (1);

	/* Wait for another packet to arrive. */
	if ((Q->read_cookie =
	    wire_readpacket_wait(Q->R, readpackets, Q)) == NULL)
		goto err0;

	/* Success! */
	return (0);

fail:
	/* This request queue has failed. */
	return (failqueue(Q));

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

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
andq $0x0, 0x10(%rdi)
testl %esi, %esi
je 0x64fd
movq %rbx, %rdi
callq 0x6402
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
leaq 0x8(%rsp), %r14
movq (%rbx), %rdi
movq %r14, %rsi
callq 0x84f8
testl %eax, %eax
jne 0x64eb
cmpq $0x0, 0x18(%rsp)
je 0x6567
movq 0x18(%rbx), %rdi
movq 0x8(%rsp), %rsi
callq 0x72d8
testq %rax, %rax
je 0x6593
movq %rax, %r15
movq 0x18(%rbx), %rdi
movq 0x8(%rsp), %rsi
callq 0x7314
movq 0x8(%r15), %rdi
movq 0x10(%rsp), %rdx
movq 0x18(%rsp), %rsi
callq *(%r15)
testl %eax, %eax
jne 0x658b
movq %r15, %rdi
callq 0x66cb
movq (%rbx), %rdi
movq %r14, %rsi
callq 0x88b8
jmp 0x6502
movq (%rbx), %rdi
leaq -0x9b(%rip), %rsi       # 0x64d6
movq %rbx, %rdx
callq 0x8629
movq %rax, %rcx
movq %rax, 0x10(%rbx)
xorl %eax, %eax
testq %rcx, %rcx
jne 0x64f3
pushq $-0x1
popq %rax
jmp 0x64f3
movq 0x8(%rsp), %rsi
leaq 0x37f3(%rip), %rdi      # 0x9d92
xorl %eax, %eax
callq 0x4be4
callq 0x2090
andl $0x0, (%rax)
jmp 0x64eb
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../lib/wire/wire_requestqueue.c
// Function: wire_requestqueue_add_getbuf
uint8_t *
wire_requestqueue_add_getbuf(struct wire_requestqueue * Q, size_t len,
    int (* callback)(void *, uint8_t *, size_t), void * cookie)
{
	struct request * R;
	uint8_t * wbuf;
	uint64_t ID;

	/* Bake a cookie. */
	if ((R = mpool_request_malloc()) == NULL)
		goto err0;
	R->callback = callback;
	R->cookie = cookie;

	/* If the request queue has failed, we can't send a request. */
	if (Q->failed) {
		/* Schedule a failure callback. */
		if (events_immediate_register(failreq, R, 0) == NULL)
			goto err1;

		/* Return a dummy buffer for the request. */
		return (malloc(len));
	}

	/* Insert the cookie into the pending request map. */
	if ((ID = (uint64_t)seqptrmap_add(Q->reqs, R)) == (uint64_t)(-1))
		goto err1;

	/* Start writing a packet. */
	if ((wbuf = wire_writepacket_getbuf(Q->WQ, ID, len)) == NULL)
		goto err2;

	/* Return a pointer to the packet data buffer. */
	return (wbuf);

err2:
	seqptrmap_delete(Q->reqs, (int64_t)ID);
err1:
	mpool_request_free(R);
err0:
	/* Failure! */
	return (NULL);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rcx, %r12
movq %rdx, %r13
incq 0x8f5f(%rip)            # 0xf528
movq %rsi, %rbx
movq %rdi, %r14
movq 0x8f3a(%rip), %rax      # 0xf510
testq %rax, %rax
je 0x65f4
movq 0x8f3e(%rip), %rcx      # 0xf520
leaq -0x1(%rax), %rdx
movq %rdx, 0x8f23(%rip)      # 0xf510
movq -0x8(%rcx,%rax,8), %r15
jmp 0x6625
incq 0x8f35(%rip)            # 0xf530
cmpl $0x0, 0x8f36(%rip)      # 0xf538
jne 0x661a
movq 0x8f3d(%rip), %rdi      # 0xf548
callq 0x8fd0
movl $0x1, 0x8f1e(%rip)      # 0xf538
pushq $0x10
popq %rdi
callq 0x2220
movq %rax, %r15
testq %r15, %r15
je 0x669c
movq %r13, (%r15)
movq %r12, 0x8(%r15)
cmpl $0x0, 0x20(%r14)
je 0x665f
leaq 0x69(%rip), %rdi        # 0x66a8
movq %r15, %rsi
xorl %edx, %edx
callq 0x2b2c
testq %rax, %rax
je 0x6694
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x2220
movq 0x18(%r14), %rdi
movq %r15, %rsi
callq 0x724f
cmpq $-0x1, %rax
je 0x6694
movq %rax, %r12
movq 0x8(%r14), %rdi
movq %rax, %rsi
movq %rbx, %rdx
callq 0x6920
testq %rax, %rax
jne 0x669e
movq 0x18(%r14), %rdi
movq %r12, %rsi
callq 0x7314
movq %r15, %rdi
callq 0x66cb
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../lib/wire/wire_requestqueue.c
// Function: wire_requestqueue_add
int
wire_requestqueue_add(struct wire_requestqueue * Q,
    uint8_t * buf, size_t buflen,
    int (* callback)(void *, uint8_t *, size_t), void * cookie)
{
	uint8_t * wbuf;

	/* Start writing the request. */
	if ((wbuf = wire_requestqueue_add_getbuf(Q, buflen,
	    callback, cookie)) == NULL)
		goto err0;

	/* Copy the request data into the provided buffer. */
	memcpy(wbuf, buf, buflen);

	/* Finish writing the request. */
	if (wire_requestqueue_add_done(Q, wbuf, buflen))
		goto err0;

	/* Success! */
	return (0);

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

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movq %rdx, %rsi
movq %rcx, %rdx
movq %r8, %rcx
callq 0x65b3
testq %rax, %rax
je 0x6838
movq %rax, %r12
movq %rax, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x2200
movq %r14, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x67d5
testl %eax, %eax
je 0x683d
pushq $-0x1
popq %rax
jmp 0x683f
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../lib/wire/wire_requestqueue.c
// Function: wire_requestqueue_free
void
wire_requestqueue_free(struct wire_requestqueue * Q)
{

	/* Sanity check: The queue must have been destroyed. */
	assert(Q->destroyed);

	/* Sanity check: There must be no pending requests. */
	assert(seqptrmap_getmin(Q->reqs) == -1);

	/* Free the pending request map. */
	seqptrmap_free(Q->reqs);

	/* Free the buffered reader. */
	netbuf_read_free(Q->R);

	/* Free the request queue. */
	free(Q);
}

// Assembly:
pushq %rbx
cmpl $0x0, 0x24(%rdi)
je 0x6892
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
callq 0x72f8
cmpq $-0x1, %rax
jne 0x68b1
movq 0x18(%rbx), %rdi
callq 0x736b
movq (%rbx), %rdi
callq 0x781f
movq %rbx, %rdi
popq %rbx
jmp 0x2040
leaq 0x3445(%rip), %rdi      # 0x9cde
leaq 0x344b(%rip), %rsi      # 0x9ceb
leaq 0x3464(%rip), %rcx      # 0x9d0b
movl $0x161, %edx            # imm = 0x161
callq 0x2180
leaq 0x348b(%rip), %rdi      # 0x9d43
leaq 0x342c(%rip), %rsi      # 0x9ceb
leaq 0x3445(%rip), %rcx      # 0x9d0b
movl $0x164, %edx            # imm = 0x164
callq 0x2180
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../lib/wire/wire_writepacket.c
// Function: wire_writepacket_getbuf
uint8_t *
wire_writepacket_getbuf(struct netbuf_write * W, uint64_t ID, size_t len)
{
	CRC32C_CTX ctx;
	uint8_t * wbuf;

	/* Sanity-check packet length. */
	assert(len <= UINT32_MAX);
	assert(len <= SIZE_MAX - 20);

	/* Reserve space to write the serialized packet into. */
	if ((wbuf = netbuf_write_reserve(W, len + 20)) == NULL)
		goto err0;

	/* Construct the header in-place. */
	be64enc(&wbuf[0], ID);
	be32enc(&wbuf[8], (uint32_t)len);
	CRC32C_Init(&ctx);
	CRC32C_Update(&ctx, wbuf, 12);
	CRC32C_Final(&wbuf[12], &ctx);

	/* Return a pointer to where the data should be written. */
	return (&wbuf[16]);

err0:
	/* Failure! */
	return (NULL);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdx, %rax
shrq $0x20, %rax
jne 0x69cd
movq %rsi, %r14
movq %rdx, %r15
leaq 0x14(%rdx), %rsi
callq 0x794b
testq %rax, %rax
je 0x69be
movq %rax, %rbx
movl %r14d, %eax
bswapl %eax
movl %eax, 0x4(%rbx)
movq %r14, %rax
shrq $0x20, %rax
movb %al, 0x3(%rbx)
movq %r14, %rax
shrq $0x28, %rax
movb %al, 0x2(%rbx)
movq %r14, %rax
shrq $0x30, %rax
movb %al, 0x1(%rbx)
shrq $0x38, %r14
movb %r14b, (%rbx)
movq %r15, %rcx
movb %cl, 0xb(%rbx)
movb %ch, 0xa(%rbx)
movl %ecx, %eax
shrl $0x10, %eax
movb %al, 0x9(%rbx)
shrl $0x18, %ecx
movb %cl, 0x8(%rbx)
leaq 0xc(%rsp), %r14
movq %r14, %rdi
callq 0x6ab0
pushq $0xc
popq %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x6ce9
leaq 0xc(%rbx), %rdi
movq %r14, %rsi
callq 0x6db1
addq $0x10, %rbx
jmp 0x69c0
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
leaq 0x33e1(%rip), %rdi      # 0x9db5
leaq 0x33ec(%rip), %rsi      # 0x9dc7
leaq 0x3404(%rip), %rcx      # 0x9de6
pushq $0x18
popq %rdx
callq 0x2180
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../lib/wire/wire_writepacket.c
// Function: wire_writepacket_done
int
wire_writepacket_done(struct netbuf_write * W, uint8_t * wbuf, size_t len)
{
	CRC32C_CTX ctx;
	uint8_t cbuf[4];
	size_t i;
	uint8_t * header_crc;

	/*
	 * This is safe due to the requirement that ${wbuf} be the pointer
	 * returned by wire_writepacket_getbuf -- that function returns
	 * &wbuf[16], so position [-4] in the new buffer is still within
	 * the allocated memory.
	 */
	header_crc = &wbuf[-4];

	/* Compute the CRC32C of the packet data. */
	CRC32C_Init(&ctx);
	CRC32C_Update(&ctx, wbuf, len);
	CRC32C_Final(cbuf, &ctx);

	/* Write the trailer. */
	for (i = 0; i < 4; i++)
		wbuf[len + i] = cbuf[i] ^ header_crc[i];

	/* We've finished constructing the packet. */
	if (netbuf_write_consume(W, len + 20))
		goto err0;

	/* Success! */
	return (0);

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

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
leaq 0x4(%rsp), %r12
movq %r12, %rdi
callq 0x6ab0
movq %r12, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x6ce9
movq %rsp, %rdi
movq %r12, %rsi
callq 0x6db1
leaq (%r15,%rbx), %rax
xorl %ecx, %ecx
cmpq $0x4, %rcx
je 0x6a3d
movb -0x4(%r15,%rcx), %dl
xorb (%rsp,%rcx), %dl
movb %dl, (%rax,%rcx)
incq %rcx
jmp 0x6a27
addq $0x14, %rbx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x7a04
xorl %ecx, %ecx
negl %eax
sbbl %ecx, %ecx
movl %ecx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../lib/wire/wire_writepacket.c
// Function: wire_writepacket
int
wire_writepacket(struct netbuf_write * W, const struct wire_packet * packet)
{
	uint8_t * wbuf;

	/* Write the packet header. */
	if ((wbuf =
	    wire_writepacket_getbuf(W, packet->ID, packet->len)) == NULL)
		goto err0;

	/* Copy the packet data into place. */
	memcpy(wbuf, packet->buf, packet->len);

	/* Write the packet trailer. */
	if (wire_writepacket_done(W, wbuf, packet->len))
		goto err0;

	/* Success! */
	return (0);

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

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq (%rsi), %rsi
movq 0x8(%r14), %rdx
callq 0x6920
testq %rax, %rax
je 0x6aa2
movq %rax, %r15
movq 0x8(%r14), %rdx
movq 0x10(%r14), %rsi
movq %rax, %rdi
callq 0x2200
movq 0x8(%r14), %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x69ea
testl %eax, %eax
je 0x6aa7
pushq $-0x1
popq %rax
jmp 0x6aa9
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../libcperciva/alg/crc32c.c
// Function: CRC32C_Update
void
CRC32C_Update(CRC32C_CTX * ctx, const uint8_t * buf, size_t len)
{

#if defined(CPUSUPPORT_X86_SSE42)
	if ((len >= 8) && (hwaccel == HW_X86_CRC32)) {
		ctx->state = CRC32C_Update_SSE42(ctx->state, buf, len);
		return;
	}
#endif
#if defined(CPUSUPPORT_ARM_CRC32_64)
	if ((len >= 8) && (hwaccel == HW_ARM_CRC32_64)) {
		ctx->state = CRC32C_Update_ARM(ctx->state, buf, len);
		return;
	}
#endif

	/* Handle blocks of 4 bytes. */
	for (; len >= 4; len -= 4, buf += 4) {
		ctx->state =
		    T0[((ctx->state >> 24) & 0xff) ^ buf[3]] ^
		    T1[((ctx->state >> 16) & 0xff) ^ buf[2]] ^
		    T2[((ctx->state >> 8)  & 0xff) ^ buf[1]] ^
		    T3[((ctx->state)       & 0xff) ^ buf[0]];
	}

	/* Handle individual bytes. */
	for (; len > 0; len--, buf++) {
		ctx->state = (ctx->state >> 8) ^
		    T0[((ctx->state) & 0xff) ^ buf[0]];
	}
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
cmpq $0x8, %rdx
jb 0x6d7d
cmpl $0x1, 0x8852(%rip)      # 0xf550
jne 0x6d7d
movl (%rbx), %edi
callq 0x6de8
movl %eax, (%rbx)
popq %rbx
retq
movl (%rbx), %eax
movl %eax, %ecx
shrl $0x18, %ecx
movzbl 0x3(%rsi), %edi
xorl %ecx, %edi
leaq 0x389b1(%rip), %rcx     # 0x3f6d0
movl %eax, %r8d
shrl $0x10, %r8d
movl $0xff, %r9d
andl %r9d, %r8d
movzbl 0x2(%rsi), %r10d
xorl %r8d, %r10d
leaq 0x38d92(%rip), %r8      # 0x3fad0
movl (%r8,%r10,4), %r8d
xorl (%rcx,%rdi,4), %r8d
movl %eax, %ecx
shrl $0x8, %ecx
andl %r9d, %ecx
movzbl 0x1(%rsi), %edi
xorl %ecx, %edi
leaq 0x39175(%rip), %rcx     # 0x3fed0
xorl (%rcx,%rdi,4), %r8d
andl %r9d, %eax
movzbl (%rsi), %ecx
xorl %eax, %ecx
leaq 0x39562(%rip), %rax     # 0x402d0
xorl (%rax,%rcx,4), %r8d
movl %r8d, (%rbx)
addq $-0x4, %rdx
addq $0x4, %rsi
cmpq $0x3, %rdx
ja 0x6d0b
xorl %eax, %eax
leaq 0x38944(%rip), %rcx     # 0x3f6d0
cmpq %rax, %rdx
je 0x6d09
movl (%rbx), %edi
movzbl %dil, %r8d
shrl $0x8, %edi
movzbl (%rsi,%rax), %r9d
xorl %r8d, %r9d
xorl (%rcx,%r9,4), %edi
movl %edi, (%rbx)
incq %rax
jmp 0x6d8c
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../libcperciva/alg/crc32c.c
// Function: times256
static uint32_t
times256(uint32_t r)
{
	int k;

	/* Shift left one bit at a time. */
	for (k = 0; k < 8; k++) {
		if (r & 0x80000000)
			r = (r << 1) ^ 0x1EDC6F41;
		else
			r = (r << 1);
	}

	return (r);
}

// Assembly:
movl %edi, %eax
pushq $0x8
popq %rcx
subl $0x1, %ecx
jb 0x6de6
leal (%rax,%rax), %edx
movl %edx, %esi
xorl $0x1edc6f41, %esi       # imm = 0x1EDC6F41
testl %eax, %eax
cmovnsl %edx, %esi
movl %esi, %eax
jmp 0x6dcd
retq
nop
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../libcperciva/alg/crc32c_sse42.c
// Function: CRC32C_Update_SSE42
uint32_t
CRC32C_Update_SSE42(uint32_t state, const uint8_t * buf, size_t len)
{
	size_t pre_block;
	size_t remaining_bytes;
	size_t in_block;
	size_t i = 0;

	/* Sanity test. */
	assert(len >= 8);

	/*
	 * Calculate how many bytes are before an aligned block.  Assume that
	 * the (uintptr_t) value indicates the memory layout.
	 */
	pre_block = (8 - (uintptr_t)buf) & 7;

	/* Calculate how many bytes are in aligned blocks. */
	remaining_bytes = len - pre_block;
	in_block = remaining_bytes - (remaining_bytes % 8);

	/* Process bytes before the alignment. */
	for (; i < pre_block; i++)
		state = _mm_crc32_u8(state, buf[i]);

	/* If we would process a block, ensure that it's aligned. */
	assert(!((i < in_block) && !((((uintptr_t)&buf[i]) & 7) == 0)));

	/*
	 * Process blocks of 8.  It's ok if (i % 8 != 0), because we're
	 * checking that (i < in_block), not (i != in_block).  For example,
	 * if we start with i = 4 and want 1 block, we'll end up at i == 12.
	 */
	for (; i < in_block; i += 8) {
#ifdef CPUSUPPORT_X86_SSE42_64
		state = (uint32_t)_mm_crc32_u64(state,
		    *(const uint64_t *)&buf[i]);
#else
		/* Only process 32 bits at once. */
		state = (uint32_t)_mm_crc32_u32(state,
		    *(const uint32_t *)&buf[i]);
		state = (uint32_t)_mm_crc32_u32(state,
		    *(const uint32_t *)&buf[i + 4]);
#endif
	}

	/* Ensure that we don't have too many bytes remaining. */
	assert((len - i) < 8);

	/* Process any remaining bytes. */
	for (; i < len; i++)
		state = _mm_crc32_u8(state, buf[i]);

	return (state);
}

// Assembly:
pushq %rax
cmpq $0x7, %rdx
jbe 0x6e64
movl %esi, %eax
negl %eax
andl $0x7, %eax
movq %rdx, %rcx
subq %rax, %rcx
xorl %r8d, %r8d
cmpq %r8, %rax
je 0x6e10
crc32b (%rsi,%r8), %edi
incq %r8
jmp 0x6dff
andq $-0x8, %rcx
cmpq %rcx, %rax
setae %r8b
leal (%rax,%rsi), %r9d
testb $0x7, %r9b
sete %r9b
orb %r8b, %r9b
cmpb $0x1, %r9b
jne 0x6e7d
cmpq %rcx, %rax
jae 0x6e44
movl %edi, %edi
crc32q (%rsi,%rax), %rdi
addq $0x8, %rax
jmp 0x6e30
movq %rdx, %rcx
subq %rax, %rcx
cmpq $0x7, %rcx
ja 0x6e96
cmpq %rdx, %rax
jae 0x6e60
crc32b (%rsi,%rax), %edi
incq %rax
jmp 0x6e50
movl %edi, %eax
popq %rcx
retq
leaq 0x3041(%rip), %rdi      # 0x9eac
leaq 0x3043(%rip), %rsi      # 0x9eb5
leaq 0x305e(%rip), %rcx      # 0x9ed7
pushq $0x22
jmp 0x6ead
leaq 0x3093(%rip), %rdi      # 0x9f17
leaq 0x302a(%rip), %rsi      # 0x9eb5
leaq 0x3045(%rip), %rcx      # 0x9ed7
pushq $0x33
jmp 0x6ead
leaq 0x30b2(%rip), %rdi      # 0x9f4f
leaq 0x3011(%rip), %rsi      # 0x9eb5
leaq 0x302c(%rip), %rcx      # 0x9ed7
pushq $0x48
popq %rdx
callq 0x2180
nop
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../libcperciva/datastruct/seqptrmap.c
// Function: seqptrmap_add
int64_t
seqptrmap_add(struct seqptrmap * M, void * ptr)
{

	/* Add the pointer to the end of the queue. */
	if (elasticqueue_add(M->ptrs, &ptr))
		goto err0;
	M->len += 1;

	/* Check for overflow. */
#if SIZE_MAX > INT64_MAX
	assert(M->len <= (uint64_t)INT64_MAX);
#endif
	assert(INT64_MAX - (int64_t)M->len >= M->offset);

	/* Return associated integer. */
	return (M->offset + (int64_t)M->len - 1);

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

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
leaq 0x8(%rsp), %rax
movq %rsi, (%rax)
movq (%rdi), %rdi
movq %rax, %rsi
callq 0x89b1
testl %eax, %eax
je 0x7273
pushq $-0x1
popq %rax
jmp 0x729c
movq 0x10(%rbx), %rcx
movq %rcx, %rax
incq %rax
movq %rax, 0x10(%rbx)
js 0x72a2
movabsq $0x7ffffffffffffffe, %rdx # imm = 0x7FFFFFFFFFFFFFFE
subq %rcx, %rdx
movq 0x8(%rbx), %rax
cmpq %rax, %rdx
jl 0x72bb
addq %rcx, %rax
addq $0x10, %rsp
popq %rbx
retq
leaq 0x2dc7(%rip), %rdi      # 0xa070
leaq 0x2dde(%rip), %rsi      # 0xa08e
leaq 0x2dfd(%rip), %rcx      # 0xa0b4
pushq $0x3e
jmp 0x72d2
leaq 0x2e24(%rip), %rdi      # 0xa0e6
leaq 0x2dc5(%rip), %rsi      # 0xa08e
leaq 0x2de4(%rip), %rcx      # 0xa0b4
pushq $0x40
popq %rdx
callq 0x2180
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../libcperciva/datastruct/seqptrmap.c
// Function: seqptrmap_delete
void
seqptrmap_delete(struct seqptrmap * M, int64_t i)
{

	/* No valid pointer is less than the offset. */
	if (i < M->offset)
		return;

	/*
	 * If the provided integer is not within the bounds of our elastic
	 * queue, return without taking any action.
	 */
	if ((uint64_t)(i - M->offset) >= (uint64_t)(M->len))
		return;

	/* Delete the specified pointer by setting it to NULL. */
	*(void **)elasticqueue_get(M->ptrs, (size_t)(i - M->offset)) = NULL;

	/* Delete leading NULLs from the queue. */
	while ((elasticqueue_getlen(M->ptrs) > 0) &&
	    (*(void **)elasticqueue_get(M->ptrs, 0) == NULL)) {
		elasticqueue_delete(M->ptrs);
		M->offset += 1;
		M->len -= 1;
	}
}

// Assembly:
subq 0x8(%rdi), %rsi
jl 0x736a
pushq %rbx
movq %rdi, %rbx
cmpq 0x10(%rdi), %rsi
jae 0x7369
movq (%rbx), %rdi
callq 0x8a5f
andq $0x0, (%rax)
movq (%rbx), %rdi
callq 0x8a5a
testq %rax, %rax
je 0x7369
movq (%rbx), %rdi
xorl %esi, %esi
callq 0x8a5f
cmpq $0x0, (%rax)
jne 0x7369
movq (%rbx), %rdi
callq 0x89d5
movdqu 0x8(%rbx), %xmm0
paddq 0x2cfe(%rip), %xmm0     # 0xa060
movdqu %xmm0, 0x8(%rbx)
jmp 0x7330
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../libcperciva/netbuf/netbuf_read.c
// Function: netbuf_read_init2
struct netbuf_read *
netbuf_read_init2(int s, struct network_ssl_ctx * ssl)
{
	struct netbuf_read * R;

	/* Bake a cookie. */
	if ((R = malloc(sizeof(struct netbuf_read))) == NULL)
		goto err0;
	R->s = s;
	R->ssl = ssl;
	R->read_cookie = NULL;
	R->immediate_cookie = NULL;

	/* Allocate buffer. */
	R->buflen = 4096;
	if ((R->buf = malloc(R->buflen)) == NULL)
		goto err1;
	R->bufpos = 0;
	R->datalen = 0;

	/* Success! */
	return (R);

err1:
	free(R);
err0:
	/* Failure! */
	return (NULL);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %r14
movl %edi, %ebp
pushq $0x50
popq %rdi
callq 0x2220
testq %rax, %rax
je 0x7565
movq %rax, %rbx
movl %ebp, (%rax)
movq %r14, 0x8(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rax)
movq $0x1000, 0x38(%rax)     # imm = 0x1000
movl $0x1000, %edi           # imm = 0x1000
callq 0x2220
movq %rax, 0x30(%rbx)
testq %rax, %rax
je 0x755d
xorps %xmm0, %xmm0
movups %xmm0, 0x40(%rbx)
jmp 0x7567
movq %rbx, %rdi
callq 0x2040
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../libcperciva/netbuf/netbuf_read.c
// Function: callback_success
static int
callback_success(void * cookie)
{
	struct netbuf_read * R = cookie;

	/* Sanity-check: We should be expecting this callback. */
	assert(R->immediate_cookie != NULL);

	/* This callback is no longer pending. */
	R->immediate_cookie = NULL;

	/* Perform callback. */
	return ((R->callback)(R->cookie, 0));
}

// Assembly:
cmpq $0x0, 0x28(%rdi)
je 0x7740
andq $0x0, 0x28(%rdi)
movq 0x10(%rdi), %rax
movq 0x18(%rdi), %rdi
xorl %esi, %esi
jmpq *%rax
pushq %rax
leaq 0x2af0(%rip), %rdi      # 0xa238
leaq 0x29d7(%rip), %rsi      # 0xa126
leaq 0x2afe(%rip), %rcx      # 0xa254
movl $0xd0, %edx
callq 0x2180
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../libcperciva/netbuf/netbuf_read.c
// Function: netbuf_read_wait_cancel
void
netbuf_read_wait_cancel(struct netbuf_read * R)
{

	/* If we have an in-progress read, cancel it. */
	if (R->read_cookie != NULL) {
		if (R->ssl)
			(netbuf_read_ssl_cancel_func)(R->read_cookie);
		else
			network_read_cancel(R->read_cookie);
		R->read_cookie = NULL;
	}

	/* If we have an immediate callback pending, cancel it. */
	if (R->immediate_cookie != NULL) {
		events_immediate_cancel(R->immediate_cookie);
		R->immediate_cookie = NULL;
	}
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x20(%rdi), %rdi
testq %rdi, %rdi
je 0x77d2
cmpq $0x0, 0x8(%rbx)
je 0x77c8
callq *0x38f1a(%rip)          # 0x406e0
jmp 0x77cd
callq 0x800b
andq $0x0, 0x20(%rbx)
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x77e5
callq 0x2c17
andq $0x0, 0x28(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../libcperciva/netbuf/netbuf_read.c
// Function: netbuf_read_free
void
netbuf_read_free(struct netbuf_read * R)
{

	/* Behave consistently with free(NULL). */
	if (R == NULL)
		return;

	/* Can't free a reader which is busy. */
	assert(R->read_cookie == NULL);
	assert(R->immediate_cookie == NULL);

	/* Free the buffer and the reader. */
	free(R->buf);
	free(R);
}

// Assembly:
pushq %rbx
testq %rdi, %rdi
je 0x7848
movq %rdi, %rbx
cmpq $0x0, 0x20(%rdi)
jne 0x784a
cmpq $0x0, 0x28(%rbx)
jne 0x7869
movq 0x30(%rbx), %rdi
callq 0x2040
movq %rbx, %rdi
popq %rbx
jmp 0x2040
popq %rbx
retq
leaq 0x28be(%rip), %rdi      # 0xa10f
leaq 0x28ce(%rip), %rsi      # 0xa126
leaq 0x29ad(%rip), %rcx      # 0xa20c
movl $0x132, %edx            # imm = 0x132
callq 0x2180
leaq 0x292b(%rip), %rdi      # 0xa19b
leaq 0x28af(%rip), %rsi      # 0xa126
leaq 0x298e(%rip), %rcx      # 0xa20c
movl $0x133, %edx            # imm = 0x133
callq 0x2180
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../libcperciva/netbuf/netbuf_write.c
// Function: netbuf_write_init2
struct netbuf_write *
netbuf_write_init2(int s, struct network_ssl_ctx * ssl,
    int (* fail_callback)(void *), void * fail_cookie)
{
	struct netbuf_write * W;
	int val;

	/* Bake a cookie. */
	if ((W = malloc(sizeof(struct netbuf_write))) == NULL)
		goto err0;
	W->s = s;
	W->ssl = ssl;
	W->reserved = 0;
	W->failed = 0;
	W->fail_callback = (fail_callback != NULL) ? fail_callback : dummyfail;
	W->fail_cookie = fail_cookie;
	STAILQ_INIT(&W->buffers);
	W->write_cookie = NULL;
	W->curr = NULL;

	/* Additional configuration if we're using a socket. */
	if (W->ssl == NULL) {
		/* Sanity check. */
		assert(W->s >= 0);

		/*
		 * Request that the OS not attempt to coalesce small segments.
		 * We do this ourselves, and we're smarter than the OS is.  We
		 * don't check the error code here, because POSIX does not
		 * require that TCP_NODELAY be implemented (although it must
		 * be defined); and we might not even be operating on a TCP
		 * socket.
		 */
		val = 1;
		(void)setsockopt(W->s, IPPROTO_TCP, TCP_NODELAY, &val,
		    sizeof(int));
	}

	/* Success! */
	return (W);

err0:
	/* Failure! */
	return (NULL);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %r14
movl %edi, %ebp
pushq $0x48
popq %rdi
callq 0x2220
movq %rax, %rbx
testq %rax, %rax
je 0x7919
movl %ebp, (%rbx)
movq %r14, 0x8(%rbx)
andq $0x0, 0x10(%rbx)
testq %r12, %r12
leaq 0x77(%rip), %rax        # 0x7948
cmovneq %r12, %rax
movq %rax, 0x18(%rbx)
movq %r15, 0x20(%rbx)
movq %rbx, %rax
addq $0x28, %rax
andq $0x0, 0x28(%rbx)
movq %rax, 0x30(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x38(%rbx)
testq %r14, %r14
jne 0x7919
testl %ebp, %ebp
js 0x7929
leaq 0xc(%rsp), %rcx
movl $0x1, (%rcx)
pushq $0x6
popq %rsi
pushq $0x1
popq %rdx
pushq $0x4
popq %r8
movl %ebp, %edi
callq 0x20e0
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x297b(%rip), %rdi      # 0xa2ab
leaq 0x297e(%rip), %rsi      # 0xa2b5
leaq 0x299c(%rip), %rcx      # 0xa2da
movl $0xc3, %edx
callq 0x2180
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../libcperciva/netbuf/netbuf_write.c
// Function: netbuf_write_reserve
uint8_t *
netbuf_write_reserve(struct netbuf_write * W, size_t len)
{
	struct writebuf * WB;

	/* Sanity-check: No calls while buffer space reserved. */
	assert(W->reserved == 0);

	/* We're reserving some space. */
	W->reserved = 1;

	/* Do we have a buffer with enough space?  Return it. */
	if ((WB = STAILQ_LAST(&W->buffers, writebuf, entries)) != NULL) {
		if (WB->buflen - WB->datalen >= len)
			goto oldbuf;
	}

	/* We need to add a new buffer to the queue. */
	if ((WB = malloc(sizeof(struct writebuf))) == NULL)
		goto err0;

	/* We want to hold this write or WBUFLEN of small writes. */
	if (len > WBUFLEN)
		WB->buflen = len;
	else
		WB->buflen = WBUFLEN;

	/* Allocate memory. */
	if ((WB->buf = malloc(WB->buflen)) == NULL)
		goto err1;

	/* No data in this buffer yet. */
	WB->datalen = 0;

	/* Add this buffer to the queue. */
	STAILQ_INSERT_TAIL(&W->buffers, WB, entries);

	/* Return a pointer to the new buffer. */
	return (WB->buf);

oldbuf:
	/* Return a pointer into the old buffer. */
	return (&WB->buf[WB->datalen]);

err1:
	free(WB);
err0:
	/* Failure! */
	return (NULL);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
cmpl $0x0, 0x10(%rdi)
jne 0x79e5
movq %rsi, %r14
movq %rdi, %rbx
movl $0x1, 0x10(%rdi)
cmpq $0x0, 0x28(%rdi)
je 0x7982
movq 0x30(%rbx), %rcx
movq -0x10(%rcx), %rdx
movq -0x8(%rcx), %rax
subq %rax, %rdx
cmpq %r14, %rdx
jae 0x79cf
pushq $0x20
popq %rdi
callq 0x2220
testq %rax, %rax
je 0x79dd
movq %rax, %r15
cmpq $0x1001, %r14           # imm = 0x1001
movl $0x1000, %edi           # imm = 0x1000
cmovaeq %r14, %rdi
movq %rdi, 0x8(%rax)
callq 0x2220
movq %rax, (%r15)
testq %rax, %rax
je 0x79d5
movq %r15, %rcx
addq $0x18, %rcx
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%r15)
movq 0x30(%rbx), %rdx
movq %r15, (%rdx)
movq %rcx, 0x30(%rbx)
jmp 0x79df
addq -0x18(%rcx), %rax
jmp 0x79df
movq %r15, %rdi
callq 0x2040
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
leaq 0x294e(%rip), %rdi      # 0xa33a
leaq 0x28c2(%rip), %rsi      # 0xa2b5
leaq 0x2951(%rip), %rcx      # 0xa34b
movl $0xe8, %edx
callq 0x2180
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../libcperciva/netbuf/netbuf_write.c
// Function: netbuf_write_consume
int
netbuf_write_consume(struct netbuf_write * W, size_t len)
{
	struct writebuf * WB;

	/* Sanity-check: We must have space reserved. */
	assert(W->reserved == 1);

	/* Get the old buffer. */
	WB = STAILQ_LAST(&W->buffers, writebuf, entries);

	/* Sanity-check: We must have a buffer. */
	assert(WB != NULL);

	/* Sanity-check: We must have enough space reserved. */
	assert(WB->buflen - WB->datalen >= len);

	/*
	 * Advance the buffer pointer, unless we've failed -- if we've failed
	 * there's no point since we're never going to look at the buffered
	 * data anyway.
	 */
	if (W->failed == 0)
		WB->datalen += len;

	/* We no longer have space reserved. */
	W->reserved = 0;

	/* Poke the queue to see if we can launch more writing now. */
	return (poke(W));
}

// Assembly:
pushq %rax
cmpl $0x1, 0x10(%rdi)
jne 0x7a3a
cmpq $0x0, 0x28(%rdi)
je 0x7a59
movq 0x30(%rdi), %rax
movq -0x10(%rax), %rdx
movq -0x8(%rax), %rcx
subq %rcx, %rdx
cmpq %rsi, %rdx
jb 0x7a78
cmpl $0x0, 0x14(%rdi)
jne 0x7a33
addq %rsi, %rcx
movq %rcx, -0x8(%rax)
andl $0x0, 0x10(%rdi)
popq %rax
jmp 0x7a97
leaq 0x2947(%rip), %rdi      # 0xa388
leaq 0x286d(%rip), %rsi      # 0xa2b5
leaq 0x294a(%rip), %rcx      # 0xa399
movl $0x120, %edx            # imm = 0x120
callq 0x2180
leaq 0x2971(%rip), %rdi      # 0xa3d1
leaq 0x284e(%rip), %rsi      # 0xa2b5
leaq 0x292b(%rip), %rcx      # 0xa399
movl $0x126, %edx            # imm = 0x126
callq 0x2180
leaq 0x295d(%rip), %rdi      # 0xa3dc
leaq 0x282f(%rip), %rsi      # 0xa2b5
leaq 0x290c(%rip), %rcx      # 0xa399
movl $0x129, %edx            # imm = 0x129
callq 0x2180
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../libcperciva/netbuf/netbuf_write.c
// Function: poke
static int
poke(struct netbuf_write * W)
{
	struct writebuf * WB;

	/* If a write is in progress or we have nothing to write, return. */
	if ((W->write_cookie != NULL) || (STAILQ_EMPTY(&W->buffers)))
		return (0);

	/* If we've failed, don't try to do anything more. */
	if (W->failed)
		return (0);

	/* Sanity-check: We don't have a buffer in progress. */
	assert(W->curr == NULL);

	/* Start writing a buffer. */
	WB = STAILQ_FIRST(&W->buffers);
	if (W->ssl) {
		if ((W->write_cookie = (netbuf_write_ssl_func)(W->ssl,
		    WB->buf, WB->datalen, WB->datalen, writbuf, W)) == NULL)
			goto err0;
	} else {
		if ((W->write_cookie = network_write(W->s, WB->buf,
		    WB->datalen, WB->datalen, writbuf, W)) == NULL)
			goto err0;
	}
	W->curr = WB;

	/* Remove the buffer from the queue. */
	STAILQ_REMOVE(&W->buffers, WB, writebuf, entries);

	/* Success! */
	return (0);

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

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
xorl %ebx, %ebx
cmpq $0x0, 0x38(%rdi)
je 0x7aad
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
movq %rdi, %r14
movq 0x28(%rdi), %r15
testq %r15, %r15
je 0x7aa5
cmpl $0x0, 0x14(%r14)
jne 0x7aa5
cmpq $0x0, 0x40(%r14)
jne 0x7b63
movq 0x8(%r14), %rdi
movq (%r15), %rsi
movq 0x10(%r15), %rcx
testq %rdi, %rdi
je 0x7af0
leaq 0x16d(%rip), %r8        # 0x7c4f
movq %rcx, %rdx
movq %r14, %r9
callq *0x38bfa(%rip)          # 0x406e8
jmp 0x7b05
movl (%r14), %edi
leaq 0x155(%rip), %r8        # 0x7c4f
movq %rcx, %rdx
movq %r14, %r9
callq 0x8090
movq %rax, 0x38(%r14)
testq %rax, %rax
je 0x7b3e
movq %r15, 0x40(%r14)
movq 0x28(%r14), %rcx
cmpq %r15, %rcx
je 0x7b46
movq %rcx, %rax
movq 0x18(%rcx), %rcx
cmpq %r15, %rcx
jne 0x7b1b
movq 0x18(%rcx), %rcx
movq %rcx, 0x18(%rax)
testq %rcx, %rcx
jne 0x7aa5
addq $0x18, %rax
jmp 0x7b5a
pushq $-0x1
popq %rbx
jmp 0x7aa5
leaq 0x28(%r14), %rax
movq 0x18(%rcx), %rcx
movq %rcx, (%rax)
testq %rcx, %rcx
jne 0x7aa5
movq %rax, 0x30(%r14)
jmp 0x7aa5
leaq 0x2892(%rip), %rdi      # 0xa3fc
leaq 0x2744(%rip), %rsi      # 0xa2b5
leaq 0x2894(%rip), %rcx      # 0xa40c
pushq $0x72
popq %rdx
callq 0x2180
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../libcperciva/netbuf/netbuf_write.c
// Function: netbuf_write_write
int
netbuf_write_write(struct netbuf_write * W, const uint8_t * buf, size_t buflen)
{
	uint8_t * wbuf;

	/* If we've failed, just silently discard writes. */
	if (W->failed)
		return (0);

	/* Reserve space to write the data into. */
	if ((wbuf = netbuf_write_reserve(W, buflen)) == NULL)
		goto err0;

	/* Copy data into the returned buffer. */
	memcpy(wbuf, buf, buflen);

	/* Consume the reservation. */
	if (netbuf_write_consume(W, buflen))
		goto err0;

	/* Success! */
	return (0);

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

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
xorl %ebx, %ebx
cmpl $0x0, 0x14(%rdi)
jne 0x7bc6
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %r15
movq %rdx, %rsi
callq 0x794b
testq %rax, %rax
je 0x7bc3
movq %rax, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x2200
movq %r15, %rdi
movq %r14, %rsi
callq 0x7a04
testl %eax, %eax
je 0x7bc6
pushq $-0x1
popq %rbx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../libcperciva/netbuf/netbuf_write.c
// Function: netbuf_write_free
void
netbuf_write_free(struct netbuf_write * W)
{
	struct writebuf * WB;

	/* Behave consistently with free(NULL). */
	if (W == NULL)
		return;

	/* Cancel any in-progress write. */
	if (W->write_cookie != NULL) {
		if (W->ssl)
			(netbuf_write_ssl_cancel_func)(W->write_cookie);
		else
			network_write_cancel(W->write_cookie);
		free(W->curr->buf);
		free(W->curr);
	}

	/* Free write buffers. */
	while (!STAILQ_EMPTY(&W->buffers)) {
		WB = STAILQ_FIRST(&W->buffers);
		STAILQ_REMOVE_HEAD(&W->buffers, entries);
		free(WB->buf);
		free(WB);
	}

	/* Free the buffered writer. */
	free(W);
}

// Assembly:
testq %rdi, %rdi
je 0x7bf9
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x38(%rdi), %rdi
testq %rdi, %rdi
je 0x7c14
cmpq $0x0, 0x8(%rbx)
je 0x7bfa
callq *0x38af9(%rip)          # 0x406f0
jmp 0x7bff
retq
callq 0x837f
movq 0x40(%rbx), %rax
movq (%rax), %rdi
callq 0x2040
movq 0x40(%rbx), %rdi
callq 0x2040
leaq 0x28(%rbx), %r15
movq (%r15), %r14
testq %r14, %r14
je 0x7c42
movq 0x18(%r14), %rax
movq %rax, (%r15)
testq %rax, %rax
jne 0x7c30
movq %r15, 0x30(%rbx)
movq (%r14), %rdi
callq 0x2040
movq %r14, %rdi
callq 0x2040
jmp 0x7c18
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x2040
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../libcperciva/netbuf/netbuf_write.c
// Function: writbuf
static int
writbuf(void * cookie, ssize_t writelen)
{
	struct netbuf_write * W = cookie;
	struct writebuf * WB = W->curr;

	/* Sanity-check: No callbacks while buffer space reserved. */
	assert(W->reserved == 0);

	/* Sanity-check: We must have had a write in progress. */
	assert(W->write_cookie != NULL);
	assert(W->curr != NULL);

	/* This write is no longer in progress. */
	W->write_cookie = NULL;
	W->curr = NULL;

	/* Sanity-check: We can't get here if we've previously failed. */
	assert(W->failed == 0);

	/*
	 * If we didn't write the correct number of bytes, mark the queue as
	 * failed.  Note that since datalen can't be equal to (size_t)(-1)
	 * this also handles the case of writelen == -1.
	 */
	if ((size_t)(writelen) != WB->datalen)
		W->failed = 1;

	/* Free this buffer. */
	free(WB->buf);
	free(WB);

	/* If we failed, invoke the failure callback. */
	if (W->failed)
		return ((W->fail_callback)(W->fail_cookie));

	/* Poke the queue to launch more writes. */
	return (poke(W));
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
cmpl $0x0, 0x10(%rdi)
jne 0x7ccf
movq %rdi, %rcx
cmpq $0x0, 0x38(%rdi)
je 0x7ce8
movq 0x40(%rcx), %rbx
testq %rbx, %rbx
je 0x7d01
leaq 0x38(%rcx), %rax
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
cmpl $0x0, 0x14(%rcx)
jne 0x7d1a
cmpq %rsi, 0x10(%rbx)
je 0x7c95
movl $0x1, 0x14(%rcx)
movq (%rbx), %rdi
movq %rcx, %r14
callq 0x2040
movq %rbx, %rdi
callq 0x2040
movq %r14, %rax
cmpl $0x0, 0x14(%r14)
je 0x7cc0
movq 0x20(%rax), %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmpq *0x18(%rax)
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x7a97
leaq 0x2664(%rip), %rdi      # 0xa33a
leaq 0x25d8(%rip), %rsi      # 0xa2b5
leaq 0x2748(%rip), %rcx      # 0xa42c
pushq $0x42
jmp 0x7d31
leaq 0x275a(%rip), %rdi      # 0xa449
leaq 0x25bf(%rip), %rsi      # 0xa2b5
leaq 0x272f(%rip), %rcx      # 0xa42c
pushq $0x45
jmp 0x7d31
leaq 0x2759(%rip), %rdi      # 0xa461
leaq 0x25a6(%rip), %rsi      # 0xa2b5
leaq 0x2716(%rip), %rcx      # 0xa42c
pushq $0x46
jmp 0x7d31
leaq 0x2750(%rip), %rdi      # 0xa471
leaq 0x258d(%rip), %rsi      # 0xa2b5
leaq 0x26fd(%rip), %rcx      # 0xa42c
pushq $0x4d
popq %rdx
callq 0x2180
nop
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../libcperciva/network/network_write.c
// Function: network_write
void *
network_write(int fd, const uint8_t * buf, size_t buflen, size_t minwrite,
    int (* callback)(void *, ssize_t), void * cookie)
{
	struct network_write_cookie * C;

	/* Make sure buflen is non-zero. */
	assert(buflen != 0);

	/* Sanity-check: # bytes must fit into a ssize_t. */
	assert(buflen <= SSIZE_MAX);

	/* Bake a cookie. */
	if ((C = mpool_network_write_cookie_malloc()) == NULL)
		goto err0;
	C->callback = callback;
	C->cookie = cookie;
	C->fd = fd;
	C->buf = buf;
	C->buflen = buflen;
	C->minlen = minwrite;
	C->bufpos = 0;

	/* Register a callback for network readiness. */
	if (events_network_register(callback_buf, C, C->fd,
	    EVENTS_NETWORK_OP_WRITE))
		goto err1;

	/* Success! */
	return (C);

err1:
	mpool_network_write_cookie_free(C);
err0:
	/* Failure! */
	return (NULL);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdx, %rdx
je 0x8173
js 0x8192
movq %r9, %r12
movq %r8, %rbp
movq %rdx, %r15
movq %rsi, %r13
movl %edi, %ebx
incq 0x74f1(%rip)            # 0xf5b0
movq 0x74d2(%rip), %rax      # 0xf598
testq %rax, %rax
je 0x80e4
movq 0x74d6(%rip), %rsi      # 0xf5a8
leaq -0x1(%rax), %rdx
movq %rdx, 0x74bb(%rip)      # 0xf598
movq -0x8(%rsi,%rax,8), %r14
jmp 0x811d
movq %rcx, (%rsp)
incq 0x74c9(%rip)            # 0xf5b8
cmpl $0x0, 0x74ca(%rip)      # 0xf5c0
jne 0x810e
movq 0x74d1(%rip), %rdi      # 0xf5d0
callq 0x8fd0
movl $0x1, 0x74b2(%rip)      # 0xf5c0
pushq $0x38
popq %rdi
callq 0x2220
movq %rax, %r14
movq (%rsp), %rcx
testq %r14, %r14
je 0x815e
movq %rbp, (%r14)
movq %r12, 0x8(%r14)
movl %ebx, 0x10(%r14)
movq %r13, 0x18(%r14)
movq %r15, 0x20(%r14)
movq %rcx, 0x28(%r14)
andq $0x0, 0x30(%r14)
leaq 0x6c(%rip), %rdi        # 0x81b1
pushq $0x1
popq %rcx
movq %r14, %rsi
movl %ebx, %edx
callq 0x2e24
testl %eax, %eax
je 0x8161
movq %r14, %rdi
callq 0x8275
xorl %r14d, %r14d
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2306(%rip), %rdi      # 0xa480
leaq 0x23ca(%rip), %rsi      # 0xa54b
leaq 0x23ea(%rip), %rcx      # 0xa572
movl $0x9f, %edx
callq 0x2180
leaq 0x236e(%rip), %rdi      # 0xa507
leaq 0x23ab(%rip), %rsi      # 0xa54b
leaq 0x23cb(%rip), %rcx      # 0xa572
movl $0xa2, %edx
callq 0x2180
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../libcperciva/network/network_write.c
// Function: mpool_network_write_cookie_atexit
static int
docallback(struct network_write_cookie * C, ssize_t nbytes)
{
	int rc;

	/* Invoke the callback. */
	rc = (C->callback)(C->cookie, nbytes);

	/* Clean up. */
	mpool_network_write_cookie_free(C);

	/* Return the callback's status. */
	return (rc);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq 0x7206(%rip), %rbx      # 0xf5a8
movq 0x71ef(%rip), %r14      # 0xf598
decq %r14
cmpq $-0x1, %r14
je 0x83c4
movq %r14, 0x71df(%rip)      # 0xf598
movq (%rbx,%r14,8), %rdi
callq 0x2040
jmp 0x83a9
cmpq 0x71fd(%rip), %rbx      # 0xf5c8
je 0x83dc
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2040
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../lib/wire/wire_readpacket.c
// Function: wire_readpacket_peek
int
wire_readpacket_peek(struct netbuf_read * R, struct wire_packet * P)
{
	CRC32C_CTX ctx;
	uint8_t * data;
	size_t datalen;
	uint8_t cbuf[4];
	size_t i;

	/* No packet data yet. */
	P->buf = NULL;

	/* Ask the buffered reader what it has. */
	netbuf_read_peek(R, &data, &datalen);

	/* If we have less than 20 bytes, we don't have a complete packet. */
	if (datalen < 20)
		goto nopacket;

	/* Verify the header checksum. */
	CRC32C_Init(&ctx);
	CRC32C_Update(&ctx, data, 12);
	CRC32C_Final(cbuf, &ctx);
	if (memcmp(&data[12], cbuf, 4)) {
		warn0("Incorrect CRC on packet header");
		goto failed;
	}

	/* Parse ID and length. */
	P->ID = be64dec(&data[0]);
	P->len = be32dec(&data[8]);

	/* Make sure the length is reasonable. */
	if (P->len > SIZE_MAX - 20)
		goto failed;

	/* Do we have the complete packet? */
	if (datalen < P->len + 20)
		goto nopacket;

	/* Verify the data checksum. */
	CRC32C_Init(&ctx);
	CRC32C_Update(&ctx, &data[16], P->len);
	CRC32C_Final(cbuf, &ctx);
	for (i = 0; i < 4; i++)
		cbuf[i] ^= data[16 + P->len + i];
	if (memcmp(&data[12], cbuf, 4)) {
		warn0("Incorrect CRC on packet data");
		goto failed;
	}

	/* Point at the data. */
	P->buf = &data[16];

nopacket:
	/* Success! */
	return (0);

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
andq $0x0, 0x10(%rsi)
leaq 0x10(%rsp), %rsi
leaq 0x20(%rsp), %r14
movq %r14, %rdx
callq 0x756f
xorl %ebp, %ebp
cmpq $0x14, (%r14)
jb 0x8617
leaq 0x1c(%rsp), %r14
movq %r14, %rdi
callq 0x6ab0
movq 0x10(%rsp), %rsi
pushq $0xc
popq %rdx
movq %r14, %rdi
callq 0x6ce9
leaq 0xc(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x6db1
movq 0x10(%rsp), %rdi
movl 0xc(%rdi), %eax
cmpl (%r15), %eax
je 0x8580
leaq 0x2065(%rip), %rdi      # 0xa5ce
xorl %eax, %eax
callq 0x4be4
callq 0x2090
andl $0x0, (%rax)
pushq $-0x1
popq %rbp
jmp 0x8617
movq (%rdi), %rax
bswapq %rax
movq %rax, (%rbx)
addq $0x8, %rdi
callq 0x8624
movl %eax, %eax
movq %rax, 0x8(%rbx)
addq $0x14, %rax
cmpq %rax, 0x20(%rsp)
jb 0x8617
leaq 0x1c(%rsp), %r14
movq %r14, %rdi
callq 0x6ab0
movq 0x10(%rsp), %rsi
addq $0x10, %rsi
movq 0x8(%rbx), %rdx
movq %r14, %rdi
callq 0x6ce9
leaq 0xc(%rsp), %rdi
movq %r14, %rsi
callq 0x6db1
movq 0x10(%rsp), %rax
movq 0x8(%rbx), %rcx
addq %rax, %rcx
addq $0x10, %rcx
xorl %edx, %edx
cmpq $0x4, %rdx
je 0x85f8
movb (%rcx,%rdx), %sil
xorb %sil, 0xc(%rsp,%rdx)
incq %rdx
jmp 0x85e4
movl 0xc(%rax), %ecx
cmpl 0xc(%rsp), %ecx
je 0x860d
leaq 0x1fe5(%rip), %rdi      # 0xa5ed
jmp 0x8569
addq $0x10, %rax
movq %rax, 0x10(%rbx)
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../lib/wire/wire_readpacket.c
// Function: wire_readpacket_wait
void *
wire_readpacket_wait(struct netbuf_read * R,
    int (* callback)(void *, int), void * cookie)
{
	struct wait_cookie * W;

	/* Bake a cookie. */
	if ((W = mpool_wait_cookie_malloc()) == NULL)
		goto err0;
	W->R = R;
	W->callback = callback;
	W->cookie = cookie;

	/* Wait for a header to be available. */
	if (netbuf_read_wait(W->R, 16, callback_wait_gotheader, W))
		goto err0;

	/* Success! */
	return (W);

err0:
	/* Failure! */
	return (NULL);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
incq 0x6fb5(%rip)            # 0xf5f0
movq %rsi, %r15
movq %rdi, %r14
movq 0x6f90(%rip), %rax      # 0xf5d8
testq %rax, %rax
je 0x8666
movq 0x6f94(%rip), %rcx      # 0xf5e8
leaq -0x1(%rax), %rdx
movq %rdx, 0x6f79(%rip)      # 0xf5d8
movq -0x8(%rcx,%rax,8), %r12
jmp 0x8697
incq 0x6f8b(%rip)            # 0xf5f8
cmpl $0x0, 0x6f8c(%rip)      # 0xf600
jne 0x868c
movq 0x6f93(%rip), %rdi      # 0xf610
callq 0x8fd0
movl $0x1, 0x6f74(%rip)      # 0xf600
pushq $0x18
popq %rdi
callq 0x2220
movq %rax, %r12
testq %r12, %r12
je 0x86c3
movq %r14, (%r12)
movq %r15, 0x8(%r12)
movq %rbx, 0x10(%r12)
leaq 0x24(%rip), %rdx        # 0x86d5
pushq $0x10
popq %rsi
movq %r14, %rdi
movq %r12, %rcx
callq 0x7588
testl %eax, %eax
je 0x86c6
xorl %r12d, %r12d
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../lib/wire/wire_readpacket.c
// Function: callback_wait_gotheader
static int
callback_wait_gotheader(void * cookie, int status)
{
	CRC32C_CTX ctx;
	struct wait_cookie * W = cookie;
	uint8_t * data;
	size_t datalen;
	size_t len;
	uint8_t cbuf[4];
	int rc;

	/* Did we fail or prematurely EOF? */
	if (status)
		goto failed;

	/* Grab the header and verify the checksum. */
	netbuf_read_peek(W->R, &data, &datalen);
	CRC32C_Init(&ctx);
	CRC32C_Update(&ctx, data, 12);
	CRC32C_Final(cbuf, &ctx);
	if (memcmp(&data[12], cbuf, 4)) {
		warn0("Incorrect CRC on packet header");
		goto failed;
	}

	/* Parse length and wait for the complete packet to be available. */
	len = be32dec(&data[8]);
	if (len > SIZE_MAX - 20)
		goto failed;
	if (netbuf_read_wait(W->R, len + 20, callback_wait_gotdata, W))
		goto failed;

	/* Success! */
	return (0);

failed:
	/* Perform a failure callback. */
	rc = (W->callback)(W->cookie, 1);

	/* Free the cookie. */
	mpool_wait_cookie_free(W);

	/* Return status from callback. */
	return (rc);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
testl %esi, %esi
jne 0x8775
movq (%rbx), %rdi
leaq 0x18(%rsp), %r14
leaq 0x10(%rsp), %rdx
movq %r14, %rsi
callq 0x756f
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x6ab0
movq (%r14), %rsi
pushq $0xc
popq %rdx
movq %r15, %rdi
callq 0x6ce9
leaq 0xc(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x6db1
movq (%r14), %rdi
movl 0xc(%rdi), %eax
cmpl (%r12), %eax
je 0x8750
leaq 0x1e8f(%rip), %rdi      # 0xa5ce
xorl %eax, %eax
callq 0x4be4
callq 0x2090
andl $0x0, (%rax)
jmp 0x8775
addq $0x8, %rdi
callq 0x8624
movl %eax, %esi
movq (%rbx), %rdi
addq $0x14, %rsi
leaq 0x1a9(%rip), %rdx       # 0x8912
movq %rbx, %rcx
callq 0x7588
testl %eax, %eax
je 0x8798
movq 0x10(%rbx), %rdi
pushq $0x1
popq %rsi
callq *0x8(%rbx)
movl %eax, %ebp
movq %rbx, %rdi
callq 0x87ae
movl %ebp, %eax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
xorl %ebp, %ebp
jmp 0x8789