LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/Tarsnap[P]kivaloo/kvlds/btree_find.c
// Function: btree_find_leaf
int
btree_find_leaf(struct btree * T, struct node * N, const struct kvldskey * k,
    int (* callback)(void *, struct node *), void * cookie)
{
	struct findleaf_cookie * C;

	/* Bake a cookie. */
	if ((C = mpool_findleaf_malloc()) == NULL)
		goto err0;
	C->callback = callback;
	C->callback_range = NULL;
	C->cookie = cookie;
	C->T = T;
	C->N = N;
	C->k = k;
	C->h = 0;
	C->e = NULL;

	/* Lock the node. */
	btree_node_lock(C->T, C->N);

	/* Call into findleaf. */
	if (findleaf(C)) {
		/* Upon error, findleaf has already freed C. */
		goto err0;
	}

	/* Success! */
	return (0);

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %r12
movq %rcx, %r13
movq %rdx, %r15
incq 0x1528e(%rip)           # 0x1d2b8
movq %rsi, %rbx
movq %rdi, %r14
movq 0x15269(%rip), %rax     # 0x1d2a0
testq %rax, %rax
je 0x8055
movq 0x1526d(%rip), %rcx     # 0x1d2b0
leaq -0x1(%rax), %rdx
movq %rdx, 0x15252(%rip)     # 0x1d2a0
movq -0x8(%rcx,%rax,8), %rbp
jmp 0x8088
incq 0x15264(%rip)           # 0x1d2c0
cmpl $0x0, 0x15265(%rip)     # 0x1d2c8
jne 0x807b
movq 0x1526c(%rip), %rdi     # 0x1d2d8
callq 0x13090
movl $0x1, 0x1524d(%rip)     # 0x1d2c8
movl $0x40, %edi
callq 0x22a0
movq %rax, %rbp
testq %rbp, %rbp
je 0x80e7
movq %r13, (%rbp)
xorl %r13d, %r13d
movq %r13, 0x8(%rbp)
movq %r12, 0x10(%rbp)
movq %r14, 0x18(%rbp)
movq %rbx, 0x20(%rbp)
movq %r15, 0x28(%rbp)
movl $0x0, 0x30(%rbp)
movq %r13, 0x38(%rbp)
testq %rbx, %rbx
je 0x80db
movq 0x30(%r14), %rdi
movq 0x20(%rdi), %rax
movq (%rbx,%rax), %rax
movq (%rax), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, (%rax)
testq %rcx, %rcx
jne 0x80db
movq %rbx, %rsi
callq 0x1070f
movq %rbp, %rdi
callq 0x80ff
testl %eax, %eax
je 0x80ed
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
movl %r13d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/Tarsnap[P]kivaloo/kvlds/btree_mutate.c
// Function: btree_mutate_mutable
int
btree_mutate_mutable(struct node * N)
{

	/* Sanity check. */
	assert(N->type == NODE_TYPE_LEAF);
	assert(N->state == NODE_STATE_DIRTY);
	assert(N->pagesize == (uint32_t)(-1));
	assert(N->v.H == NULL);

	/* Create a hash table for short-term key-value storage. */
	if ((N->v.H = kvhash_init()) == NULL)
		goto err0;

	/* Success! */
	return (0);

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

// Assembly:
pushq %rbx
movb 0x1c(%rdi), %al
movl %eax, %ecx
andb $0x3, %cl
cmpb $0x1, %cl
jne 0x86a9
andb $0xc, %al
cmpb $0x8, %al
jne 0x86c8
movq %rdi, %rbx
cmpl $-0x1, 0x18(%rdi)
jne 0x86e7
cmpq $0x0, 0x48(%rbx)
jne 0x8706
callq 0x10350
movq %rax, 0x48(%rbx)
xorl %ecx, %ecx
cmpq $0x1, %rax
sbbl %ecx, %ecx
movl %ecx, %eax
popq %rbx
retq
leaq 0xc623(%rip), %rdi      # 0x14cd3
leaq 0xc898(%rip), %rsi      # 0x14f4f
leaq 0xc8a0(%rip), %rcx      # 0x14f5e
movl $0x19, %edx
callq 0x21c0
leaq 0xc8b7(%rip), %rdi      # 0x14f86
leaq 0xc879(%rip), %rsi      # 0x14f4f
leaq 0xc881(%rip), %rcx      # 0x14f5e
movl $0x1a, %edx
callq 0x21c0
leaq 0xc8b5(%rip), %rdi      # 0x14fa3
leaq 0xc85a(%rip), %rsi      # 0x14f4f
leaq 0xc862(%rip), %rcx      # 0x14f5e
movl $0x1b, %edx
callq 0x21c0
leaq 0xc8b4(%rip), %rdi      # 0x14fc1
leaq 0xc83b(%rip), %rsi      # 0x14f4f
leaq 0xc843(%rip), %rcx      # 0x14f5e
movl $0x1c, %edx
callq 0x21c0
// File: /workspace/github_c_makefile_star2_O3/Tarsnap[P]kivaloo/kvlds/btree_mutate.c
// Function: btree_mutate_add
int
btree_mutate_add(struct node * N, struct kvpair_const * pos,
    const struct kvldskey * k, const struct kvldskey * v)
{
	size_t mlen;

	/* Update the all-keys-present-match-up-to value. */
	if (N->nkeys) {
		mlen = kvldskey_mlen(k, N->u.pairs[0].k);
		if (mlen < N->mlen_n)
			N->mlen_n = (uint8_t)mlen;
	} else {
		N->mlen_n = 0;
	}

	/* Record the pair. */
	pos->k = k;
	pos->v = v;

	/* Grow the hash table if necessary. */
	return (kvhash_postadd(N->v.H));
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %r14
cmpq $0x0, 0x38(%rdi)
je 0x878e
movq 0x40(%r14), %rax
movq (%rax), %rsi
movq %r12, %rdi
callq 0x1032f
movzbl 0x1f(%r14), %ecx
cmpq %rcx, %rax
jae 0x8793
movb %al, 0x1f(%r14)
jmp 0x8793
movb $0x0, 0x1f(%r14)
movq %r12, (%r15)
movq %rbx, 0x8(%r15)
movq 0x48(%r14), %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x1047c
// File: /workspace/github_c_makefile_star2_O3/Tarsnap[P]kivaloo/kvlds/btree_node.c
// Function: btree_node_mknode
struct node *
btree_node_mknode(struct btree * T, unsigned int type, int height, size_t nkeys,
    const struct kvldskey ** keys, struct node ** children,
    struct kvpair_const * pairs)
{
	struct node * N;

	/* Sanity check. */
	assert((height <= INT8_MAX) && (height >= -1));

	/* Allocate node. */
	if ((N = node_alloc((uint64_t)(-1), (uint64_t)(-1), (uint32_t)(-1)))
	    == NULL)
		goto err0;

	/* Make the node present. */
	if (makepresent(T, N))
		goto err1;

	/* This is a DIRTY node of the indicated type and height. */
	N->state = NODE_STATE_DIRTY;
	N->type = type;
	N->height = (int8_t)height;

	/* Store node data. */
	N->nkeys = nkeys;
	if (type == NODE_TYPE_LEAF) {
		N->u.pairs = pairs;
		if ((N->nkeys > 0) && (pairs != NULL)) {
			N->mlen_n = (uint8_t)kvldskey_mlen(N->u.pairs[0].k,
			    N->u.pairs[N->nkeys - 1].k);
		} else {
			N->mlen_n = 255;
		}
	} else {
		N->u.keys = keys;
		N->v.children = children;
	}

	/* We don't know how far keys in this subtree match. */
	N->mlen_t = 0;

	/* Success! */
	return (N);

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, (%rsp)
movl %edx, %r13d
leal 0x1(%r13), %eax
cmpl $0x81, %eax
jae 0x8b25
movq %r8, %r12
movq %rcx, %r14
movl %esi, %ebp
movq %rdi, %r15
movq $-0x1, %rdi
movq $-0x1, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0xab58
testq %rax, %rax
je 0x8aab
movq %rax, %rbx
movq %r15, %rdi
movq %rax, %rsi
callq 0x8b44
testl %eax, %eax
je 0x8aaf
movq %rbx, %rdi
callq 0xab9b
xorl %ebx, %ebx
jmp 0x8b13
movb 0x1c(%rbx), %al
andb $-0x10, %al
movl %ebp, %ecx
andb $0x3, %cl
orb %al, %cl
orb $0x8, %cl
movb %cl, 0x1c(%rbx)
movb %r13b, 0x1d(%rbx)
movq %r14, 0x38(%rbx)
cmpl $0x1, %ebp
jne 0x8afd
movq 0x40(%rsp), %rax
movq %rax, 0x40(%rbx)
testq %r14, %r14
sete %cl
testq %rax, %rax
sete %dl
orb %cl, %dl
jne 0x8b0b
movq (%rax), %rdi
shlq $0x4, %r14
movq -0x10(%rax,%r14), %rsi
callq 0x1032f
movb %al, 0x1f(%rbx)
jmp 0x8b0f
movq %r12, 0x40(%rbx)
movq (%rsp), %rax
movq %rax, 0x48(%rbx)
jmp 0x8b0f
movb $-0x1, 0x1f(%rbx)
movb $0x0, 0x1e(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xc4ce(%rip), %rdi      # 0x14ffa
leaq 0xc4ee(%rip), %rsi      # 0x15021
leaq 0xc4f4(%rip), %rcx      # 0x1502e
movl $0x8e, %edx
callq 0x21c0
// File: /workspace/github_c_makefile_star2_O3/Tarsnap[P]kivaloo/kvlds/btree_node.c
// Function: makepresent
static int
makepresent(struct btree * T, struct node * N)
{
	void * evict;
	struct node * N_evict;

	/* Add the node to the pool. */
	if (pool_rec_add(T->P, N, &evict))
		goto err0;
	N_evict = evict;

	/* If a node was evicted, make it non-present. */
	if (N_evict != NULL) {
		/* Sanity-check: We can only evict clean nodes. */
		assert(N_evict->state == NODE_STATE_CLEAN);

		/* Delete the node's data and mark it as non-present. */
		freedata(T, N_evict);
	}

	/* Success! */
	return (0);

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

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x30(%rdi), %rdi
movq %rsp, %rdx
callq 0x10693
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %eax, %eax
jne 0x8b78
movq (%rsp), %rsi
xorl %ebp, %ebp
testq %rsi, %rsi
je 0x8b78
testb $0xc, 0x1c(%rsi)
jne 0x8b81
movq %rbx, %rdi
callq 0x8dca
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0xc60c(%rip), %rdi      # 0x15194
leaq 0xc492(%rip), %rsi      # 0x15021
leaq 0xc621(%rip), %rcx      # 0x151b7
movl $0x71, %edx
callq 0x21c0
// File: /workspace/github_c_makefile_star2_O3/Tarsnap[P]kivaloo/kvlds/btree_node.c
// Function: btree_node_destroy
void
btree_node_destroy(struct btree * T, struct node * N)
{

	/* Sanity-check: We can't free a node we're fetching. */
	assert(N->type != NODE_TYPE_READ);

	/* Make the page non-present. */
	if (N->type != NODE_TYPE_NP) {
		/* Remove from the node pool. */
		pool_rec_free(T->P, N);
		N->pool_cookie = NULL;

		/* Free the node data. */
		freedata(T, N);
	}

	/* Free node. */
	node_free(N);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movzbl 0x1c(%rsi), %eax
andl $0x3, %eax
cmpl $0x2, %eax
je 0x8d9c
cmpl $0x3, %eax
je 0x8dab
movq %rdi, %r14
movq 0x30(%rdi), %rdi
movq %rbx, %rsi
callq 0x10770
movq $0x0, 0x30(%rbx)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x8dca
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xab9b
leaq 0xc307(%rip), %rdi      # 0x150b9
leaq 0xc268(%rip), %rsi      # 0x15021
leaq 0xc313(%rip), %rcx      # 0x150d3
movl $0x18b, %edx            # imm = 0x18B
callq 0x21c0
// File: /workspace/github_c_makefile_star2_O3/Tarsnap[P]kivaloo/kvlds/btree_node.c
// Function: freedata
static void
freedata(struct btree * T, struct node * N)
{
	size_t i;

	/* Sanity check. */
	assert(node_present(N));

	/* If the node has data, free it. */
	if (N->nkeys != (size_t)(-1)) {
		/* Leaf or parent? */
		if (N->type == NODE_TYPE_LEAF) {
			/* Free array of key-value pairs. */
			free(N->u.pairs);
		} else {
			/* Free array of keys. */
			free(N->u.keys);

			/* Free children and their array. */
			for (i = 0; i <= N->nkeys; i++)
				node_free(N->v.children[i]);
			free(N->v.children);
		}

		/* This node no longer has any data. */
		N->nkeys = (size_t)(-1);
	}

	/* If the node has a serialized buffer, free it. */
	if (N->pagebuf) {
		free(N->pagebuf);
		N->pagebuf = NULL;
	}

	/* We just removed a reason for keeping the parent(s) present. */
	btree_node_unlock(T, N->p_shadow);
	btree_node_unlock(T, N->p_dirty);

	/* This node now has indeterminate height. */
	N->height = -1;

	/* Mark the node as not present. */
	N->type = NODE_TYPE_NP;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movb 0x1c(%rsi), %bpl
testb $0x2, %bpl
jne 0x8ec7
movq %rsi, %rbx
movq %rdi, %r14
cmpq $-0x1, 0x38(%rsi)
je 0x8e25
movq 0x40(%rbx), %rdi
callq 0x2040
testb $0x1, %bpl
jne 0x8e1d
xorl %r15d, %r15d
movq 0x48(%rbx), %rax
movq (%rax,%r15,8), %rdi
callq 0xab9b
incq %r15
cmpq 0x38(%rbx), %r15
jbe 0x8dfe
movq 0x48(%rbx), %rdi
callq 0x2040
movq $-0x1, 0x38(%rbx)
movq 0x50(%rbx), %rdi
testq %rdi, %rdi
je 0x8e3b
callq 0x2040
movq $0x0, 0x50(%rbx)
movq 0x20(%rbx), %rsi
testq %rsi, %rsi
je 0x8e65
movq 0x30(%r14), %rdi
movq 0x20(%rdi), %rax
movq (%rsi,%rax), %rax
movq (%rax), %rcx
testq %rcx, %rcx
je 0x8ea8
decq %rcx
movq %rcx, (%rax)
jne 0x8e65
callq 0x107ea
movq 0x28(%rbx), %rsi
testq %rsi, %rsi
je 0x8e8f
movq 0x30(%r14), %rdi
movq 0x20(%rdi), %rax
movq (%rsi,%rax), %rax
movq (%rax), %rcx
testq %rcx, %rcx
je 0x8ea8
decq %rcx
movq %rcx, (%rax)
jne 0x8e8f
callq 0x107ea
movb $-0x1, 0x1d(%rbx)
movb 0x1c(%rbx), %al
andb $-0x4, %al
orb $0x2, %al
movb %al, 0x1c(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0xb7a1(%rip), %rdi      # 0x14650
leaq 0xb7c0(%rip), %rsi      # 0x14676
leaq 0xb7d2(%rip), %rcx      # 0x1468f
movl $0x88, %edx
callq 0x21c0
leaq 0xc23c(%rip), %rdi      # 0x1510a
leaq 0xc14c(%rip), %rsi      # 0x15021
leaq 0xc404(%rip), %rcx      # 0x152e0
movl $0x3b, %edx
callq 0x21c0
// File: /workspace/github_c_makefile_star2_O3/Tarsnap[P]kivaloo/kvlds/btree_node.c
// Function: btree_node_pageout_recursive
void
btree_node_pageout_recursive(struct btree * T, struct node * N)
{
	size_t i;

	/* If this node is not paged in, return immediately. */
	if ((N->type == NODE_TYPE_NP) || (N->type == NODE_TYPE_READ))
		return;

	/* Otherwise, pick up a lock in order to keep the node paged in. */
	btree_node_lock(T, N);

	/* Recurse down. */
	if (N->type == NODE_TYPE_PARENT) {
		for (i = 0; i <= N->nkeys; i++)
			btree_node_pageout_recursive(T, N->v.children[i]);
	}

	/* Evict this node from the pool. */
	pool_rec_free(T->P, N);
	N->pool_cookie = NULL;

	/* Free the node data. */
	freedata(T, N);
}

// Assembly:
testb $0x2, 0x1c(%rsi)
jne 0x8f60
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq 0x30(%rdi), %rdi
movq 0x20(%rdi), %rax
movq (%rsi,%rax), %rax
movq (%rax), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, (%rax)
testq %rcx, %rcx
jne 0x8f1a
movq %rbx, %rsi
callq 0x1070f
testb $0x3, 0x1c(%rbx)
jne 0x8f3c
xorl %r15d, %r15d
movq 0x48(%rbx), %rax
movq (%rax,%r15,8), %rsi
movq %r14, %rdi
callq 0x8ee6
incq %r15
cmpq 0x38(%rbx), %r15
jbe 0x8f23
movq 0x30(%r14), %rdi
movq %rbx, %rsi
callq 0x10770
movq $0x0, 0x30(%rbx)
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x8dca
retq
// File: /workspace/github_c_makefile_star2_O3/Tarsnap[P]kivaloo/kvlds/btree_node.c
// Function: btree_node_descend
int
btree_node_descend(struct btree * T, struct node * N,
    int (* callback)(void *, struct node *), void * cookie)
{
	struct descend * C;

	/* Bake a cookie. */
	if ((C = malloc(sizeof(struct descend))) == NULL)
		goto err0;
	C->callback = callback;
	C->cookie = cookie;
	C->N = N;

	/* Fetch the node or schedule an immediate callback. */
	if (!node_present(N)) {
		if (btree_node_fetch(T, N, callback_descend, C))
			goto err1;
	} else {
		btree_node_lock(T, N);
		if (!events_immediate_register(callback_descend, C, 0))
			goto err1;
	}

	/* Success! */
	return (0);

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r12
movq %rdx, %r13
movq %rsi, %r14
movq %rdi, %r15
movl $0x18, %edi
callq 0x22a0
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testq %rax, %rax
je 0x942b
movq %rax, %rbx
movq %r13, (%rax)
movq %r12, 0x8(%rax)
movq %r14, 0x10(%rax)
testb $0x2, 0x1c(%r14)
jne 0x9400
movq 0x30(%r15), %rdi
movq 0x20(%rdi), %rax
movq (%r14,%rax), %rax
movq (%rax), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, (%rax)
testq %rcx, %rcx
jne 0x93e6
movq %r14, %rsi
callq 0x1070f
leaq 0x4f(%rip), %rdi        # 0x943c
xorl %ebp, %ebp
movq %rbx, %rsi
xorl %edx, %edx
callq 0xb910
testq %rax, %rax
jne 0x942b
jmp 0x941e
leaq 0x35(%rip), %rdx        # 0x943c
xorl %ebp, %ebp
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rcx
xorl %r8d, %r8d
callq 0x8ba5
testl %eax, %eax
je 0x942b
movq %rbx, %rdi
callq 0x2040
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/Tarsnap[P]kivaloo/kvlds/btree_node_split.c
// Function: btree_node_split_nparts
size_t
btree_node_split_nparts(struct btree * T, struct node * N)
{
	size_t breakat;

	/* We will split when we exceed 2/3 of a full node. */
	breakat = (T->pagelen * 2)/3;

	/* Handle leaves and parents separately. */
	if (N->type == NODE_TYPE_LEAF)
		return (nparts_leaf(N, breakat));
	else
		return (nparts_parent(N, breakat));
}

// Assembly:
pushq %rax
movq (%rdi), %rax
addq %rax, %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
mulq %rcx
shrq %rdx
movzbl 0x1c(%rsi), %eax
andl $0x3, %eax
je 0x974b
cmpl $0x1, %eax
jne 0x97a8
movq 0x38(%rsi), %rcx
testq %rcx, %rcx
je 0x97a1
movq 0x40(%rsi), %rsi
addq $0x8, %rsi
movl $0x1, %eax
movl $0xa, %r8d
movl $0xc, %edi
leaq 0x2(%r8), %r9
xorl %r10d, %r10d
cmpq %rdx, %r8
seta %r10b
cmovaq %rdi, %r9
addq %r10, %rax
movq -0x8(%rsi), %r8
movq (%rsi), %r10
movzbl (%r8), %r11d
addq %r9, %r11
movzbl (%r10), %r8d
addq %r11, %r8
addq $0x10, %rsi
decq %rcx
jne 0x9716
jmp 0x97a6
movq 0x38(%rsi), %rax
testq %rax, %rax
je 0x97a1
incq %rax
cmpq $0x3, %rax
movl $0x2, %ecx
cmovaeq %rax, %rcx
decq %rcx
movl $0x1, %eax
movl $0x1e, %r8d
xorl %edi, %edi
cmpq %rdx, %r8
jbe 0x9784
incq %rax
movl $0x1e, %r8d
jmp 0x9797
movq 0x40(%rsi), %r9
movq (%r9,%rdi,8), %r9
movzbl (%r9), %r9d
addq %r9, %r8
addq $0x15, %r8
incq %rdi
cmpq %rdi, %rcx
jne 0x9774
jmp 0x97a6
movl $0x1, %eax
popq %rcx
retq
leaq 0xb71c(%rip), %rdi      # 0x14ecb
leaq 0xbb57(%rip), %rsi      # 0x1530d
leaq 0xbbcb(%rip), %rcx      # 0x15388
movl $0x38, %edx
callq 0x21c0
// File: /workspace/github_c_makefile_star2_O3/Tarsnap[P]kivaloo/kvlds/btree_node_split.c
// Function: makeleaf
static struct node *
makeleaf(struct btree * T, size_t nkeys, struct kvpair_const * pairs)
{
	struct kvpair_const * new_pairs;
	struct node * N;

	/* Allocate new array of pairs and copy keys and values. */
	if (IMALLOC(new_pairs, nkeys, struct kvpair_const))
		goto err0;
	memcpy(new_pairs, pairs, nkeys * sizeof(struct kvpair_const));

	/* Construct a leaf node. */
	if ((N = btree_node_mkleaf(T, nkeys, new_pairs)) == NULL)
		goto err1;

	/* Success! */
	return (N);

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

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r12
movq %rsi, %rbx
movq %rdi, %r14
testq %rsi, %rsi
je 0x9bad
movq %rbx, %rax
shrq $0x3c, %rax
je 0x9bb2
callq 0x20a0
movl $0xc, (%rax)
jmp 0x9c01
xorl %r15d, %r15d
jmp 0x9bc6
movq %rbx, %rdi
shlq $0x4, %rdi
callq 0x22a0
movq %rax, %r15
testq %rax, %rax
je 0x9c01
movq %rbx, %rdx
shlq $0x4, %rdx
movq %r15, %rdi
movq %r12, %rsi
callq 0x2280
movq %r15, (%rsp)
movq %r14, %rdi
movl $0x1, %esi
xorl %edx, %edx
movq %rbx, %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x8a48
testq %rax, %rax
jne 0x9c03
movq %r15, %rdi
callq 0x2040
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/Tarsnap[P]kivaloo/kvlds/btree_node_split.c
// Function: makeparent
static struct node *
makeparent(struct btree * T, int height, size_t nkeys,
    const struct kvldskey ** keys, struct node ** children)
{
	const struct kvldskey ** new_keys;
	struct node ** new_children;
	struct node * N;

	/* Allocate new key array and copy pointers to keys. */
	if (IMALLOC(new_keys, nkeys, const struct kvldskey *))
		goto err0;
	memcpy(new_keys, keys, nkeys * sizeof(const struct kvldskey *));

	/* Allocate new child array and copy pointers to children. */
	if (IMALLOC(new_children, nkeys + 1, struct node *))
		goto err1;
	memcpy(new_children, children, (nkeys + 1) * sizeof(struct node *));

	/* Construct a parent node. */
	if ((N = btree_node_mkparent(T, height,
	    nkeys, new_keys, new_children)) == NULL)
		goto err2;

	/* Success! */
	return (N);

err2:
	free(new_children);
err1:
	free(new_keys);
err0:
	/* Failure! */
	return (NULL);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, %r12
movq %rdx, %r14
movq %rdi, %r15
testq %rdx, %rdx
je 0x9c44
movq %r14, %rax
shrq $0x3d, %rax
je 0x9c51
callq 0x20a0
movl $0xc, (%rax)
jmp 0x9cf8
movl %esi, 0x14(%rsp)
movl $0x1, %ebp
xorl %ebx, %ebx
jmp 0x9ca2
movq %rcx, %r13
movl %esi, 0x14(%rsp)
leaq (,%r14,8), %rbp
movq %rbp, %rdi
callq 0x22a0
testq %rax, %rax
je 0x9cf8
movq %rax, %rbx
movq %rax, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x2280
movabsq $0x1fffffffffffffff, %rax # imm = 0x1FFFFFFFFFFFFFFF
cmpq %rax, %r14
jne 0x9c9e
callq 0x20a0
movl $0xc, (%rax)
jmp 0x9cf0
leaq 0x1(%r14), %rbp
shlq $0x3, %rbp
movq %rbp, %rdi
callq 0x22a0
testq %rax, %rax
je 0x9cf0
movq %rax, %r13
movq %rax, %rdi
movq %r12, %rsi
movq %rbp, %rdx
callq 0x2280
movq $0x0, (%rsp)
movq %r15, %rdi
xorl %esi, %esi
movl 0x14(%rsp), %edx
movq %r14, %rcx
movq %rbx, %r8
movq %r13, %r9
callq 0x8a48
testq %rax, %rax
jne 0x9cfa
movq %r13, %rdi
callq 0x2040
movq %rbx, %rdi
callq 0x2040
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/Tarsnap[P]kivaloo/liball/../libcperciva/network/network_accept.c
// Function: network_accept
void *
network_accept(int fd, int (* callback)(void *, int), void * cookie)
{
	struct accept_cookie * C;

	/* Bake a cookie. */
	if ((C = malloc(sizeof(struct accept_cookie))) == NULL)
		goto err0;
	C->callback = callback;
	C->cookie = cookie;
	C->fd = fd;

	/*
	 * Register a network event.  A connection arriving on a listening
	 * socket is treated by select(2) as the socket becoming readable.
	 */
	if (events_network_register(callback_accept, C, C->fd,
	    EVENTS_NETWORK_OP_READ))
		goto err1;

	/* Success! */
	return (C);

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %r15
movl %edi, %ebp
movl $0x18, %edi
callq 0x22a0
testq %rax, %rax
je 0xd1ce
movq %rax, %rbx
movq %r15, (%rax)
movq %r14, 0x8(%rax)
movl %ebp, 0x10(%rax)
leaq 0x28(%rip), %rdi        # 0xd1de
movq %rax, %rsi
movl %ebp, %edx
xorl %ecx, %ecx
callq 0xbd0c
testl %eax, %eax
je 0xd1d0
movq %rbx, %rdi
callq 0x2040
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/Tarsnap[P]kivaloo/liball/../libcperciva/network/network_accept.c
// Function: callback_accept
static int
callback_accept(void * cookie)
{
	struct accept_cookie * C = cookie;
	int s;
	int rc;

	/* Attempt to accept a new connection. */
	if ((s = accept(C->fd, NULL, NULL)) == -1) {
		/* If a connection isn't available, reset the callback. */
		if ((errno == EAGAIN) ||
#if EAGAIN != EWOULDBLOCK
		    (errno == EWOULDBLOCK) ||
#endif
		    (errno == ECONNABORTED) ||
		    (errno == EINTR))
			goto tryagain;
	}

	/* Call the upstream callback. */
	rc = (C->callback)(C->cookie, s);

	/* Free the cookie. */
	free(C);

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

tryagain:
	/* Reset the callback. */
	return (events_network_register(callback_accept, C, C->fd,
	    EVENTS_NETWORK_OP_READ));
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x10(%rdi), %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2350
movl %eax, %ebp
cmpl $-0x1, %eax
je 0xd212
movq 0x8(%rbx), %rdi
movl %ebp, %esi
callq *(%rbx)
movl %eax, %ebp
movq %rbx, %rdi
callq 0x2040
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
callq 0x20a0
movl (%rax), %eax
cmpl $0x4, %eax
je 0xd228
cmpl $0xb, %eax
je 0xd228
cmpl $0x67, %eax
jne 0xd1f7
movl 0x10(%rbx), %edx
leaq -0x54(%rip), %rdi       # 0xd1de
movq %rbx, %rsi
xorl %ecx, %ecx
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xbd0c
// File: /workspace/github_c_makefile_star2_O3/Tarsnap[P]kivaloo/liball/../libcperciva/util/humansize.c
// Function: humansize
char *
humansize(uint64_t size)
{
	char * s;
	char prefix;
	int shiftcnt;
	int rc;

	/* Special-case for size < 1000. */
	if (size < 1000) {
		rc = asprintf(&s, "%d B", (int)size);
	} else {
		/* Keep 10 * size / 1000^(3n) in size. */
		for (size /= 100, shiftcnt = 1; size >= 10000; shiftcnt++)
			size /= 1000;

		/*
		 * Figure out what prefix to use.  Since 1 EB = 10^18 B and
		 * the maximum value of a uint64_t is 2^64 which is roughly
		 * 18.4 * 10^18, this cannot reference beyond the end of the
		 * string.
		 */
		prefix = " kMGTPE"[shiftcnt];

		/* Construct the string. */
		if (size < 100)
			rc = asprintf(&s, "%d.%d %cB", (int)size / 10,
			    (int)size % 10, prefix);
		else
			rc = asprintf(&s, "%d %cB", (int)size / 10, prefix);
	}

	if (rc == -1) {
		warnp("asprintf");
		goto err0;
	}

	/* Success! */
	return (s);

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

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r8
cmpq $0x3e7, %rdi            # imm = 0x3E7
ja 0xe691
leaq 0x7b19(%rip), %rsi      # 0x16198
movq %rsp, %rdi
movl %r8d, %edx
xorl %eax, %eax
callq 0xdcdc
jmp 0xe744
movq %r8, %rax
shrq $0x2, %rax
movabsq $0x28f5c28f5c28f5c3, %rcx # imm = 0x28F5C28F5C28F5C3
mulq %rcx
movq %rdx, %rcx
shrq $0x2, %rcx
movl $0x1, %esi
cmpq $0xf4240, %r8           # imm = 0xF4240
jb 0xe6e3
movabsq $0x20c49ba5e353f7cf, %rdi # imm = 0x20C49BA5E353F7CF
movq %rcx, %rax
shrq $0x3, %rax
mulq %rdi
shrq $0x4, %rdx
incq %rsi
cmpq $0x98967f, %rcx         # imm = 0x98967F
movq %rdx, %rcx
ja 0xe6c4
jmp 0xe6e6
movq %rcx, %rdx
leaq 0x7ab0(%rip), %rax      # 0x1619d
movsbl (%rsi,%rax), %r8d
cmpq $0x63, %rdx
ja 0xe724
movzbl %dl, %eax
imull $0xcd, %eax, %eax
shrl $0xb, %eax
leal (%rax,%rax), %ecx
leal (%rcx,%rcx,4), %ecx
subb %cl, %dl
movzbl %dl, %ecx
leaq 0x7a8f(%rip), %rsi      # 0x161a5
movq %rsp, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xdcdc
jmp 0xe744
movzwl %dx, %eax
imull $0xcccd, %eax, %edx     # imm = 0xCCCD
shrl $0x13, %edx
leaq 0x7a71(%rip), %rsi      # 0x161a8
movq %rsp, %rdi
movl %r8d, %ecx
xorl %eax, %eax
callq 0xdcdc
cmpl $-0x1, %eax
je 0xe74f
movq (%rsp), %rbx
jmp 0xe785
callq 0x20a0
cmpl $0x0, (%rax)
je 0xe775
movq %rax, %r14
leaq 0x5b1a(%rip), %rdi      # 0x1427d
xorl %ebx, %ebx
xorl %eax, %eax
callq 0xffd0
movl $0x0, (%r14)
jmp 0xe785
leaq 0x5b01(%rip), %rdi      # 0x1427d
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x100ef
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/Tarsnap[P]kivaloo/liball/../libcperciva/util/ipc_sync.c
// Function: ipc_sync_init
struct ipc_sync *
ipc_sync_init(void)
{
	struct ipc_sync * IS;

	/* Allocate the cookie. */
	if ((IS = malloc(sizeof(struct ipc_sync))) == NULL) {
		warnp("malloc");
		goto err0;
	}

	/* Set up synchronization. */
	if (pipe(IS->fd)) {
		warnp("pipe");
		goto err1;
	}

	/* Success! */
	return (IS);

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

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl $0x8, %edi
callq 0x22a0
testq %rax, %rax
je 0xe962
movq %rax, %rbx
movq %rax, %rdi
callq 0x2200
testl %eax, %eax
je 0xe9b2
callq 0x20a0
cmpl $0x0, (%rax)
je 0xe988
movq %rax, %r14
leaq 0x7876(%rip), %rdi      # 0x161c8
xorl %eax, %eax
callq 0xffd0
movl $0x0, (%r14)
jmp 0xe996
callq 0x20a0
cmpl $0x0, (%rax)
je 0xe9a2
movq %rax, %r14
leaq 0x7839(%rip), %rdi      # 0x161af
xorl %ebx, %ebx
xorl %eax, %eax
callq 0xffd0
movl $0x0, (%r14)
jmp 0xe9b2
leaq 0x7839(%rip), %rdi      # 0x161c8
xorl %eax, %eax
callq 0x100ef
movq %rbx, %rdi
callq 0x2040
xorl %ebx, %ebx
jmp 0xe9b2
leaq 0x7806(%rip), %rdi      # 0x161af
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x100ef
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/Tarsnap[P]kivaloo/liball/../libcperciva/util/ipc_sync.c
// Function: ipc_sync_wait
int
ipc_sync_wait(struct ipc_sync * IS)
{

	/* Ensure that we've closed the write end. */
	if (ipc_sync_prep(IS, W))
		return (-1);

	/* Read and discard a byte from the read end of the pipe. */
	return (readbyte(IS->fd[R]));
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movl $0x1, %esi
callq 0xea66
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %ecx, %ecx
jne 0xea5c
movl (%rbx), %ebx
leaq 0xf(%rsp), %r14
movl $0x1, %edx
movl %ebx, %edi
movq %r14, %rsi
callq 0x2240
cmpq $-0x1, %rax
je 0xea07
testq %rax, %rax
je 0xea2e
cmpq $0x1, %rax
jne 0xe9e5
jmp 0xea2a
callq 0x20a0
movq %rax, %r15
movl (%rax), %eax
cmpl $0x4, %eax
je 0xe9e5
leaq 0x6cde(%rip), %rdi      # 0x156fb
testl %eax, %eax
jne 0xea49
xorl %eax, %eax
callq 0x100ef
jmp 0xea57
xorl %eax, %eax
jmp 0xea5c
leaq 0x7781(%rip), %rdi      # 0x161b6
xorl %eax, %eax
callq 0x100ef
callq 0x20a0
movl $0x0, (%rax)
jmp 0xea57
xorl %eax, %eax
callq 0xffd0
movl $0x0, (%r15)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/Tarsnap[P]kivaloo/liball/../libcperciva/util/ipc_sync.c
// Function: ipc_sync_prep
static int
ipc_sync_prep(struct ipc_sync * IS, int num)
{

	/* Bail if there's nothing to do. */
	if (IS->fd[num] == -1)
		return (0);

	/*
	 * Close the indicated end of pipe so that if the other process dies,
	 * we will notice the pipe being reset.
	 */
	if (ipc_sync_close(IS->fd[num]))
		goto err0;
	IS->fd[num] = -1;

	/* Success! */
	return (0);

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %r12d
movl (%rdi,%r12,4), %ebp
xorl %ebx, %ebx
cmpl $-0x1, %ebp
je 0xeaca
movq %rdi, %r14
movl %ebp, %edi
callq 0x21f0
testl %eax, %eax
je 0xeaad
callq 0x20a0
movq %rax, %r15
movl (%rax), %eax
cmpl $0x4, %eax
je 0xea7f
leaq 0x7462(%rip), %rdi      # 0x15f02
testl %eax, %eax
jne 0xeab7
xorl %eax, %eax
callq 0x100ef
jmp 0xeac5
movl $0xffffffff, (%r14,%r12,4) # imm = 0xFFFFFFFF
jmp 0xeaca
xorl %eax, %eax
callq 0xffd0
movl $0x0, (%r15)
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/Tarsnap[P]kivaloo/liball/../libcperciva/util/ipc_sync.c
// Function: ipc_sync_signal
int
ipc_sync_signal(struct ipc_sync * IS)
{

	/* Ensure that we've closed the read end. */
	if (ipc_sync_prep(IS, R))
		return (-1);

	/* Write a byte to the write end of the pipe. */
	return (writebyte(IS->fd[W]));
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %ebp, %ebp
xorl %esi, %esi
callq 0xea66
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %ecx, %ecx
jne 0xeb42
movl 0x4(%rbx), %edi
leaq 0x7(%rsp), %rsi
movb $0x0, (%rsi)
movl $0x1, %edx
callq 0xee8c
cmpq $-0x1, %rax
jne 0xeb40
callq 0x20a0
cmpl $0x0, (%rax)
je 0xeb2d
movq %rax, %rbx
leaq 0x76af(%rip), %rdi      # 0x161cd
xorl %eax, %eax
callq 0xffd0
movl $0x0, (%rbx)
jmp 0xeb3b
leaq 0x7699(%rip), %rdi      # 0x161cd
xorl %eax, %eax
callq 0x100ef
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/Tarsnap[P]kivaloo/liball/../libcperciva/util/ipc_sync.c
// Function: ipc_sync_done
int
ipc_sync_done(struct ipc_sync * IS)
{

	/* Close any open file descriptors. */
	if ((IS->fd[W] != -1) && ipc_sync_close(IS->fd[W]))
		goto err1;
	if ((IS->fd[R] != -1) && ipc_sync_close(IS->fd[R]))
		goto err2;

	/* Clean up. */
	free(IS);

	/* Success! */
	return (0);

err2:
	if (IS->fd[R] != -1)
		ipc_sync_close(IS->fd[R]);
err1:
	free(IS);

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x4(%rdi), %ebp
cmpl $-0x1, %ebp
je 0xeb9a
movl %ebp, %edi
callq 0x21f0
testl %eax, %eax
je 0xeb9a
callq 0x20a0
movq %rax, %r14
movl (%rax), %eax
cmpl $0x4, %eax
je 0xeb6c
leaq 0x7375(%rip), %rdi      # 0x15f02
testl %eax, %eax
jne 0xebd4
xorl %eax, %eax
callq 0x100ef
jmp 0xebe2
movl (%rbx), %r15d
xorl %ebp, %ebp
cmpl $-0x1, %r15d
je 0xebe7
movl %r15d, %edi
callq 0x21f0
testl %eax, %eax
je 0xebe7
callq 0x20a0
movq %rax, %r14
movl (%rax), %eax
cmpl $0x4, %eax
je 0xeba5
leaq 0x733b(%rip), %rdi      # 0x15f02
testl %eax, %eax
jne 0xebfc
xorl %eax, %eax
callq 0x100ef
jmp 0xec0a
xorl %eax, %eax
callq 0xffd0
movl $0x0, (%r14)
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movq %rbx, %rdi
callq 0x2040
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
callq 0xffd0
movl $0x0, (%r14)
movl (%rbx), %r15d
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $-0x1, %r15d
je 0xebe7
movl %r15d, %edi
callq 0x21f0
testl %eax, %eax
je 0xebe7
movl (%r14), %eax
cmpl $0x4, %eax
je 0xec18
leaq 0x72cf(%rip), %rdi      # 0x15f02
testl %eax, %eax
jne 0xec40
xorl %eax, %eax
callq 0x100ef
jmp 0xebe7
xorl %eax, %eax
callq 0xffd0
movl $0x0, (%r14)
jmp 0xebe7
// File: /workspace/github_c_makefile_star2_O3/Tarsnap[P]kivaloo/liball/../lib/datastruct/kvhash.c
// Function: kvhash_init
struct kvhash *
kvhash_init(void)
{
	struct kvhash * H;

	/* Allocate a kvhash. */
	if ((H = malloc(sizeof(struct kvhash))) == NULL)
		goto err0;

	/* We start with 4 slots. */
	H->nslots = 4;
	if (IMALLOC(H->pairs, H->nslots, struct kvpair_const))
		goto err1;
	if (IMALLOC(H->hashes, H->nslots, uint32_t))
		goto err2;

	/* This table is empty. */
	H->nkeys = 0;
	memset(H->pairs, 0, H->nslots * sizeof(struct kvpair_const));

	/* Success! */
	return (H);

err2:
	free(H->pairs);
err1:
	free(H);
err0:
	/* Failure! */
	return (NULL);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl $0x20, %edi
callq 0x22a0
testq %rax, %rax
je 0x103c6
movq %rax, %rbx
movq $0x4, 0x18(%rax)
movl $0x40, %edi
callq 0x22a0
movq %rax, (%rbx)
testq %rax, %rax
je 0x103be
movq %rax, %r14
movl $0x10, %edi
callq 0x22a0
movq %rax, 0x8(%rbx)
testq %rax, %rax
je 0x103b6
movq $0x0, 0x10(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x30(%r14)
movups %xmm0, 0x20(%r14)
movups %xmm0, 0x10(%r14)
movups %xmm0, (%r14)
jmp 0x103c8
movq %r14, %rdi
callq 0x2040
movq %rbx, %rdi
callq 0x2040
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/Tarsnap[P]kivaloo/liball/../lib/datastruct/kvhash.c
// Function: kvhash_search
struct kvpair_const *
kvhash_search(struct kvhash * H, const struct kvldskey * k)
{
	size_t pos;
	uint32_t h;

	/* Compute the hash. */
	h = hash(k);

	/* Scan the table until we find an empty slot or the key. */
	pos = h & (H->nslots - 1);
	do {
		/* If this slot is empty, stop. */
		if (H->pairs[pos].k == NULL)
			break;

		/* If the hash and key match, stop. */
		if ((H->hashes[pos] == h) &&
		    (kvldskey_cmp(k, H->pairs[pos].k) == 0))
			break;

		/* Move on to the next slot. */
		pos = (pos + 1) & (H->nslots - 1);
	} while (1);

	/*
	 * Write the hash here.  If the key is already present, this has no
	 * effect; if the key is not present, this ensures that they hash is
	 * in place if/when the key is added.
	 */
	H->hashes[pos] = h;

	/* Return a pointer to the kvpair struct. */
	return (&H->pairs[pos]);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0xc(%rsp), %r15
movq %r15, %rdi
callq 0x1275c
leaq 0x1(%r14), %rsi
movzbl (%r14), %edx
movq %r15, %rdi
callq 0x12a0c
leaq 0x8(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x12af4
movl (%r12), %ebp
movq (%rbx), %rcx
movq 0x18(%rbx), %rax
leal -0x1(%rax), %r15d
andl %ebp, %r15d
movq %r15, %rdx
shlq $0x4, %rdx
movq (%rcx,%rdx), %rsi
testq %rsi, %rsi
je 0x1045d
movq 0x8(%rbx), %rdx
cmpl %ebp, (%rdx,%r15,4)
jne 0x10451
movq %r14, %rdi
callq 0x102c6
movq (%rbx), %rcx
testl %eax, %eax
je 0x1045d
movq 0x18(%rbx), %rax
incq %r15
leaq -0x1(%rax), %rdx
andq %rdx, %r15
jmp 0x10424
movq 0x8(%rbx), %rax
movl %ebp, (%rax,%r15,4)
shlq $0x4, %r15
addq %rcx, %r15
movq %r15, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/Tarsnap[P]kivaloo/liball/../lib/datastruct/kvhash.c
// Function: kvhash_postadd
int
kvhash_postadd(struct kvhash * H)
{

	/* We've added an entry to the hash table. */
	H->nkeys += 1;

	/* Rehash if the table is more than 3/4 full. */
	if (H->nkeys + H->nslots / 4 > H->nslots) {
		if (rehash(H))
			goto err0;
	}

	/* Success! */
	return (0);

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq 0x10(%rdi), %rax
movq 0x18(%rdi), %r13
leaq 0x1(%rax), %rcx
movq %rcx, 0x10(%rdi)
movq %r13, %rcx
shrq $0x2, %rcx
addq %rcx, %rax
incq %rax
xorl %ebp, %ebp
cmpq %r13, %rax
jbe 0x105a7
testq %r13, %r13
jle 0x105b8
movq %r13, %rax
shrq $0x3b, %rax
je 0x104d6
callq 0x20a0
movl $0xc, (%rax)
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x105a7
movq %rdi, %rbx
movq %r13, %r12
shlq $0x5, %r12
movq %r12, %rdi
callq 0x22a0
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testq %rax, %rax
je 0x105a7
movq %rax, %r14
leaq (,%r13,8), %rdi
callq 0x22a0
testq %rax, %rax
je 0x1059f
movq %rax, %r15
leaq (,%r13,2), %rax
xorl %ebp, %ebp
movq %r14, %rdi
xorl %esi, %esi
movq %r12, %rdx
movq %rax, %r12
callq 0x21e0
movq (%rbx), %rdi
leaq -0x1(%r12), %rax
movq %rbp, %rcx
shlq $0x4, %rcx
movq (%rdi,%rcx), %rdx
testq %rdx, %rdx
je 0x1057a
movq 0x8(%rbx), %rsi
movl (%rsi,%rbp,4), %esi
movl %eax, %r8d
andl %esi, %r8d
movq %r8, %r9
shlq $0x4, %r9
cmpq $0x0, (%r14,%r9)
je 0x10567
incq %r8
andq %rax, %r8
jmp 0x10551
addq %r14, %r9
movq %rdx, (%r9)
movq 0x8(%rdi,%rcx), %rcx
movq %rcx, 0x8(%r9)
movl %esi, (%r15,%r8,4)
incq %rbp
cmpq %r13, %rbp
jne 0x10534
callq 0x2040
movq 0x8(%rbx), %rdi
callq 0x2040
movq %r14, (%rbx)
movq %r15, 0x8(%rbx)
movq %r12, 0x18(%rbx)
xorl %ebp, %ebp
jmp 0x105a7
movq %r14, %rdi
callq 0x2040
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x60f2(%rip), %rdi      # 0x166b1
leaq 0x611a(%rip), %rsi      # 0x166e0
leaq 0x612e(%rip), %rcx      # 0x166fb
movl $0x18, %edx
callq 0x21c0
// File: /workspace/github_c_makefile_star2_O3/Tarsnap[P]kivaloo/liball/../lib/datastruct/kvhash.c
// Function: kvhash_free
void
kvhash_free(struct kvhash * H)
{

	/* Be compatible with free(NULL). */
	if (H == NULL)
		return;

	/* Free the hash table. */
	free(H->hashes);
	free(H->pairs);
	free(H);
}

// Assembly:
testq %rdi, %rdi
je 0x105fa
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
callq 0x2040
movq (%rbx), %rdi
callq 0x2040
movq %rbx, %rdi
popq %rbx
jmp 0x2040
retq
nop
// File: /workspace/github_c_makefile_star2_O3/Tarsnap[P]kivaloo/liball/../lib/datastruct/kvpair.c
// Function: kvpair_sort
void
kvpair_sort(struct kvpair * pairs, size_t npairs, size_t mlen)
{

	/* Sanity check. */
	assert(pairs != NULL);

	/* See above comments about cookie_mlen and non-threadsafety. */
	cookie_mlen = mlen;

	/* Do the sort. */
	qsort(pairs, npairs, sizeof(struct kvpair), compar);
}

// Assembly:
testq %rdi, %rdi
je 0x1062a
movq %rdx, 0x352cf(%rip)     # 0x458e8
leaq 0x2a(%rip), %rcx        # 0x1064a
movl $0x10, %edx
jmp 0x20e0
pushq %rax
leaq 0x60e5(%rip), %rdi      # 0x16717
leaq 0x60ec(%rip), %rsi      # 0x16725
leaq 0x6100(%rip), %rcx      # 0x16740
movl $0x32, %edx
callq 0x21c0
// File: /workspace/github_c_makefile_star2_O3/Tarsnap[P]kivaloo/liball/../lib/datastruct/pool.c
// Function: pool_rec_add
int
pool_rec_add(struct pool * P, void * rec, void ** evict)
{

	/* Create a pool_elem structure for this record. */
	if ((get_pool_elem(P, rec) =
	    malloc(sizeof(struct pool_elem))) == NULL)
		goto err0;
	get_pool_elem(P, rec)->wire_count = 1;

	/* Add the record to the pool. */
	P->used += 1;

	/* Evict a record if necessary and possible. */
	if ((P->used > P->size) && (P->evict_head != NULL)) {
		/* Grab the record at the head of the evict queue. */
		*evict = P->evict_head;

		/* Remove said record from the queue. */
		pool_delqueue(P, *evict);

		/* Remove the record from the pool. */
		free(get_pool_elem(P, *evict));
		P->used -= 1;
	} else {
		*evict = NULL;
	}

	/* Success! */
	return (0);

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

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movl $0x18, %edi
callq 0x22a0
movq 0x20(%rbx), %rcx
movq %rax, (%r15,%rcx)
testq %rax, %rax
je 0x10704
movq $0x1, (%rax)
movq 0x8(%rbx), %rax
incq %rax
movq %rax, 0x8(%rbx)
cmpq (%rbx), %rax
jbe 0x106f9
movq 0x10(%rbx), %rsi
testq %rsi, %rsi
je 0x106f9
movq %rsi, (%r14)
movq %rbx, %rdi
callq 0x1070f
movq (%r14), %rax
movq 0x20(%rbx), %rcx
movq (%rax,%rcx), %rdi
callq 0x2040
decq 0x8(%rbx)
jmp 0x10700
movq $0x0, (%r14)
xorl %eax, %eax
jmp 0x10709
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/Tarsnap[P]kivaloo/liball/../lib/datastruct/pool.c
// Function: pool_delqueue
void
pool_delqueue(struct pool * P, void * rec)
{
	void * next = get_pool_elem(P, rec)->next;
	void * prev = get_pool_elem(P, rec)->prev;

	/* If this is the only record in the queue, it becomes empty. */
	if ((P->evict_head == rec) && (P->evict_tail == rec)) {
		P->evict_head = P->evict_tail = NULL;
	} else
	/* If this is the head, we have a new head. */
	    if (P->evict_head == rec) {
		P->evict_head = next;
		get_pool_elem(P, next)->prev = NULL;
	} else
	/* If this is the tail, we have a new tail. */
	    if (P->evict_tail == rec) {
		P->evict_tail = prev;
		get_pool_elem(P, prev)->next = NULL;
	} else
	/* This is in the middle; point prev and next to each other. */
	    {
		get_pool_elem(P, next)->prev = prev;
		get_pool_elem(P, prev)->next = next;
	}
}

// Assembly:
movq 0x20(%rdi), %rax
movq (%rsi,%rax), %rdx
movq 0x8(%rdx), %rcx
movq 0x18(%rdi), %r8
cmpq %rsi, 0x10(%rdi)
je 0x1073f
movq 0x10(%rdx), %rdx
cmpq %rsi, %r8
je 0x10758
movq (%rcx,%rax), %rsi
movq %rdx, 0x10(%rsi)
movq (%rdx,%rax), %rax
movq %rcx, 0x8(%rax)
retq
addq $0x10, %rdi
cmpq %rsi, %r8
je 0x10769
movq %rcx, (%rdi)
movq (%rcx,%rax), %rax
movq $0x0, 0x10(%rax)
retq
movq %rdx, 0x18(%rdi)
movq (%rdx,%rax), %rax
movq $0x0, 0x8(%rax)
retq
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
retq
// File: /workspace/github_c_makefile_star2_O3/Tarsnap[P]kivaloo/liball/../lib/datastruct/pool.c
// Function: pool_rec_free
void
pool_rec_free(struct pool * P, void * rec)
{

	/* Make sure that the lock count is 1. */
	assert(get_pool_elem(P, rec)->wire_count == 1);

	/* Remove the record from the pool. */
	free(get_pool_elem(P, rec));
	P->used -= 1;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x20(%rdi), %rax
movq (%rsi,%rax), %rdi
cmpq $0x1, (%rdi)
jne 0x1078d
callq 0x2040
decq 0x8(%rbx)
popq %rbx
retq
leaq 0x5fde(%rip), %rdi      # 0x16772
leaq 0x5ffe(%rip), %rsi      # 0x16799
leaq 0x6010(%rip), %rcx      # 0x167b2
movl $0x5a, %edx
callq 0x21c0
// File: /workspace/github_c_makefile_star2_O3/Tarsnap[P]kivaloo/liball/../lib/proto_kvlds/proto_kvlds_server.c
// Function: proto_kvlds_response_params
int
proto_kvlds_response_params(struct netbuf_write * Q, uint64_t ID,
    uint32_t kmax, uint32_t vmax)
{
	uint8_t * wbuf;

	/* Get a packet data buffer. */
	if ((wbuf = wire_writepacket_getbuf(Q, ID, 8)) == NULL)
		goto err0;

	/* Write the packet data. */
	be32enc(&wbuf[0], kmax);
	be32enc(&wbuf[4], vmax);

	/* Finish the packet. */
	if (wire_writepacket_done(Q, wbuf, 8))
		goto err0;

	/* Success! */
	return (0);

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

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %ecx, %ebx
movl %edx, %ebp
movq %rdi, %r14
movl $0x8, %edx
callq 0x125c8
testq %rax, %rax
je 0x10cd9
movl %ebp, %ecx
rolw $0x8, %cx
movw %cx, 0x2(%rax)
movl %ebp, %ecx
shrl $0x10, %ecx
movb %cl, 0x1(%rax)
shrl $0x18, %ebp
movb %bpl, (%rax)
movb %bl, 0x7(%rax)
movb %bh, 0x6(%rax)
movl %ebx, %ecx
shrl $0x10, %ecx
movb %cl, 0x5(%rax)
shrl $0x18, %ebx
movb %bl, 0x4(%rax)
movl $0x8, %edx
movq %r14, %rdi
movq %rax, %rsi
callq 0x12696
testl %eax, %eax
je 0x10ce0
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x10ce2
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/Tarsnap[P]kivaloo/liball/../lib/proto_kvlds/proto_kvlds_server.c
// Function: proto_kvlds_response_status
int
proto_kvlds_response_status(struct netbuf_write * Q, uint64_t ID,
    int status)
{
	uint8_t * wbuf;

	/* Sanity check. */
	assert((status == 0) || (status == 1));

	/* Get a packet data buffer. */
	if ((wbuf = wire_writepacket_getbuf(Q, ID, 4)) == NULL)
		goto err0;

	/* Write the packet data. */
	be32enc(&wbuf[0], (uint32_t)status);

	/* Finish the packet. */
	if (wire_writepacket_done(Q, wbuf, 4))
		goto err0;

	/* Success! */
	return (0);

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

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
cmpl $0x2, %edx
jae 0x10d34
movl %edx, %ebp
movq %rdi, %rbx
movl $0x4, %edx
callq 0x125c8
testq %rax, %rax
je 0x10d24
movb %bpl, 0x3(%rax)
movb $0x0, 0x2(%rax)
movw $0x0, (%rax)
movl $0x4, %edx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x12696
testl %eax, %eax
je 0x10d2b
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x10d2d
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x5acc(%rip), %rdi      # 0x16807
leaq 0x5ae4(%rip), %rsi      # 0x16826
leaq 0x5b05(%rip), %rcx      # 0x1684e
movl $0xed, %edx
callq 0x21c0
// File: /workspace/github_c_makefile_star2_O3/Tarsnap[P]kivaloo/liball/../lib/proto_kvlds/proto_kvlds_server.c
// Function: proto_kvlds_response_get
int
proto_kvlds_response_get(struct netbuf_write * Q, uint64_t ID,
    int status, const struct kvldskey * value)
{
	uint8_t * wbuf;
	size_t len;

	/* Sanity check. */
	assert((status == 0) || (status == 1));

	/* Compute the response length. */
	len = 4;
	if (status == 0)
		len += kvldskey_serial_size(value);

	/* Get a packet data buffer. */
	if ((wbuf = wire_writepacket_getbuf(Q, ID, len)) == NULL)
		goto err0;

	/* Write the packet data. */
	be32enc(&wbuf[0], (uint32_t)status);
	if (status == 0)
		kvldskey_serialize(value, &wbuf[4]);

	/* Finish the packet. */
	if (wire_writepacket_done(Q, wbuf, len))
		goto err0;

	/* Success! */
	return (0);

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
cmpl $0x2, %edx
jae 0x10dd8
movq %rcx, %r14
movl %edx, %ebp
movq %rdi, %rbx
movl $0x4, %r15d
testl %edx, %edx
jne 0x10d7a
movzbl (%r14), %r15d
addq $0x5, %r15
movq %rbx, %rdi
movq %r15, %rdx
callq 0x125c8
testq %rax, %rax
je 0x10dc6
movq %rax, %r12
movb %bpl, 0x3(%rax)
movb $0x0, 0x2(%rax)
movw $0x0, (%rax)
testl %ebp, %ebp
jne 0x10db4
movq %r12, %rdi
addq $0x4, %rdi
movzbl (%r14), %edx
incq %rdx
movq %r14, %rsi
callq 0x2280
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x12696
testl %eax, %eax
je 0x10dcd
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x10dcf
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5a28(%rip), %rdi      # 0x16807
leaq 0x5a40(%rip), %rsi      # 0x16826
leaq 0x5aa7(%rip), %rcx      # 0x16894
movl $0x110, %edx            # imm = 0x110
callq 0x21c0
// File: /workspace/github_c_makefile_star2_O3/Tarsnap[P]kivaloo/liball/../lib/proto_lbs/proto_lbs_client.c
// Function: proto_lbs_request_params
int
proto_lbs_request_params(struct wire_requestqueue * Q,
    int (* callback)(void *, int, size_t, uint64_t), void * cookie)
{
	struct params_cookie * C;
	uint8_t buf[4];

	/* Sanity check. */
	assert(callback != NULL);

	/* Bake a cookie. */
	if ((C = malloc(sizeof(struct params_cookie))) == NULL)
		goto err0;
	C->callback = callback;
	C->cookie = cookie;

	/* Construct request. */
	be32enc(&buf[0], PROTO_LBS_PARAMS);

	/* Send request. */
	if (wire_requestqueue_add(Q, buf, 4, callback_params, C))
		goto err1;

	/* Success! */
	return (0);

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

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
testq %rsi, %rsi
je 0x11033
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %r15
movl $0x10, %edi
callq 0x22a0
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testq %rax, %rax
je 0x11023
movq %rax, %r14
movq %r13, (%rax)
movq %r12, 0x8(%rax)
leaq 0xc(%rsp), %rsi
movl $0x0, (%rsi)
leaq 0x4f(%rip), %rcx        # 0x11052
movl $0x4, %edx
movq %r15, %rdi
movq %rax, %r8
callq 0x12491
testl %eax, %eax
je 0x11021
movq %r14, %rdi
callq 0x2040
jmp 0x11023
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x59aa(%rip), %rdi      # 0x169e4
leaq 0x59b4(%rip), %rsi      # 0x169f5
leaq 0x59d1(%rip), %rcx      # 0x16a19
movl $0x41, %edx
callq 0x21c0
// File: /workspace/github_c_makefile_star2_O3/Tarsnap[P]kivaloo/liball/../lib/proto_lbs/proto_lbs_client.c
// Function: callback_params
static int
callback_params(void * cookie, uint8_t * buf, size_t buflen)
{
	struct params_cookie * C = cookie;
	int failed = 1;
	size_t blklen = 0;
	uint64_t blkno = 0;
	int rc;

	/* If we have a packet, parse it. */
	if (buf != NULL) {
		/* Do we have the right packet length? */
		if (buflen != 12)
			BAD("PARAMS", "bogus length");

		/* Parse the packet. */
		blklen = be32dec(&buf[0]);
		blkno = be64dec(&buf[4]);

		/* We successfully parsed this response. */
		failed = 0;
	}

failed:
	/* Invoke the upstream callback. */
	rc = (C->callback)(C->cookie, failed, blklen, blkno);

	/* Free the cookie. */
	free(C);

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

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movl $0x1, %ebp
testq %rsi, %rsi
je 0x1107a
cmpq $0xc, %rdx
jne 0x1107f
movl (%rsi), %r14d
bswapl %r14d
movq 0x4(%rsi), %rcx
bswapq %rcx
xorl %ebp, %ebp
jmp 0x110ab
xorl %r14d, %r14d
jmp 0x110a9
leaq 0x5bf4(%rip), %rdi      # 0x16c7a
leaq 0x5c0a(%rip), %rsi      # 0x16c97
leaq 0x5c0a(%rip), %rdx      # 0x16c9e
xorl %r14d, %r14d
xorl %eax, %eax
callq 0x100ef
callq 0x20a0
movl $0x0, (%rax)
xorl %ecx, %ecx
movq 0x8(%rbx), %rdi
movl %ebp, %esi
movq %r14, %rdx
callq *(%rbx)
movl %eax, %ebp
movq %rbx, %rdi
callq 0x2040
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq