LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/cyb70289[P]tt/src/common/queue.c
// Function: tt_queue_enque_array
static int tt_queue_enque_array(struct tt_queue *queue, const void *e)
{
	if (queue->_count >= queue->cap) {
		tt_debug("Overflow");
		return TT_EOVERFLOW;
	}
	memcpy(queue->_qtail, e, queue->esize);
	queue->_qtail += queue->esize;
	/* Wrap to head */
	if (queue->_qtail >= queue->_data + queue->cap * queue->esize)
		queue->_qtail = queue->_data;

	queue->_count++;
	return 0;
}

// Assembly:
pushq %rbx
movl 0x8(%rdi), %eax
cmpl (%rdi), %eax
jae 0x3963
movq %rdi, %rbx
movq 0x20(%rdi), %rdi
movl 0x4(%rbx), %edx
callq 0x1100
movl 0x4(%rbx), %eax
movl (%rbx), %ecx
imull %eax, %ecx
addq 0x20(%rbx), %rax
movq 0x10(%rbx), %rdx
addq %rdx, %rcx
cmpq %rcx, %rax
cmovaeq %rdx, %rax
movq %rax, 0x20(%rbx)
incl 0x8(%rbx)
xorl %eax, %eax
jmp 0x3982
leaq 0x1d22(%rip), %rsi      # 0x568c
leaq 0x1c80(%rip), %rdx      # 0x55f1
movl $0x3, %edi
xorl %eax, %eax
callq 0x290e
movl $0xfffffffd, %eax       # imm = 0xFFFFFFFD
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/cyb70289[P]tt/src/common/queue.c
// Function: tt_queue_deque_array
static int tt_queue_deque_array(struct tt_queue *queue, void *e)
{
	if (queue->_count == 0) {
		tt_debug("Underflow");
		return TT_EUNDERFLOW;
	}
	memcpy(e, queue->_qhead, queue->esize);
	queue->_qhead += queue->esize;
	/* Wrap to head */
	if (queue->_qhead >= queue->_data + queue->cap * queue->esize)
		queue->_qhead = queue->_data;

	queue->_count--;
	return 0;
}

// Assembly:
pushq %rbx
cmpl $0x0, 0x8(%rdi)
je 0x39c5
movq %rdi, %rbx
movq 0x18(%rdi), %rax
movl 0x4(%rdi), %edx
movq %rsi, %rdi
movq %rax, %rsi
callq 0x1100
movl 0x4(%rbx), %eax
movl (%rbx), %ecx
imull %eax, %ecx
addq 0x18(%rbx), %rax
movq 0x10(%rbx), %rdx
addq %rdx, %rcx
cmpq %rcx, %rax
cmovaeq %rdx, %rax
movq %rax, 0x18(%rbx)
decl 0x8(%rbx)
xorl %eax, %eax
jmp 0x39e4
leaq 0x1cd5(%rip), %rsi      # 0x56a1
leaq 0x1c3a(%rip), %rdx      # 0x560d
movl $0x3, %edi
xorl %eax, %eax
callq 0x290e
movl $0xfffffffc, %eax       # imm = 0xFFFFFFFC
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/cyb70289[P]tt/src/common/queue.c
// Function: tt_queue_enque_list
static int tt_queue_enque_list(struct tt_queue *queue, const void *e)
{
	void *qe = malloc(sizeof(struct tt_list) + queue->esize);
	if (!qe)
		return TT_EOVERFLOW;
	memcpy(qe + sizeof(struct tt_list), e, queue->esize);
	tt_list_add(qe, &queue->_head);

	queue->_count++;
	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movl 0x4(%rdi), %r12d
leaq 0x10(%r12), %rdi
callq 0x1120
testq %rax, %rax
je 0x3a3a
movq %rax, %r15
movq %rax, %rdi
addq $0x10, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x1100
leaq 0x10(%rbx), %rax
movq 0x10(%rbx), %rcx
movq %r15, 0x10(%rbx)
movq %rax, 0x8(%r15)
movq %rcx, (%r15)
movq %r15, 0x8(%rcx)
incl 0x8(%rbx)
xorl %eax, %eax
jmp 0x3a3f
movl $0xfffffffd, %eax       # imm = 0xFFFFFFFD
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/cyb70289[P]tt/src/common/queue.c
// Function: tt_queue_deque_list
static int tt_queue_deque_list(struct tt_queue *queue, void *e)
{
	if (queue->_count == 0) {
		tt_debug("Underflow");
		return TT_EUNDERFLOW;
	}
	void *qe = queue->_head.next;
	memcpy(e, qe + sizeof(struct tt_list), queue->esize);
	tt_list_del(qe);
	free(qe);

	queue->_count--;
	return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
cmpl $0x0, 0x8(%rdi)
je 0x3a8b
movq %rdi, %rbx
movq 0x18(%rdi), %r14
leaq 0x10(%r14), %rax
movl 0x4(%rdi), %edx
movq %rsi, %rdi
movq %rax, %rsi
callq 0x1100
movq (%r14), %rax
movq 0x8(%r14), %rcx
movq %rax, (%rcx)
movq %rcx, 0x8(%rax)
movq %r14, %rdi
callq 0x1030
decl 0x8(%rbx)
xorl %eax, %eax
jmp 0x3aaa
leaq 0x1c24(%rip), %rsi      # 0x56b6
leaq 0x1b74(%rip), %rdx      # 0x560d
movl $0x3, %edi
xorl %eax, %eax
callq 0x290e
movl $0xfffffffc, %eax       # imm = 0xFFFFFFFC
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/cyb70289[P]tt/src/common/queue.c
// Function: tt_queue_free
void tt_queue_free(struct tt_queue *queue)
{
	if (queue->cap) {
		/* Free the array */
		free(queue->_data);
		queue->_data = NULL;
	} else {
		/* Free the list */
		struct tt_list *pos, *tmp;
		tt_list_for_each_safe(pos, tmp, &queue->_head)
			free(pos);
	}

	tt_debug("Queue destroyed");
	queue->_count = 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x10(%rdi), %r14
cmpl $0x0, (%rdi)
je 0x3ad4
movq (%r14), %rdi
callq 0x1030
movq $0x0, (%r14)
jmp 0x3aee
movq 0x18(%rbx), %rdi
cmpq %r14, %rdi
je 0x3aee
movq 0x8(%rdi), %r15
callq 0x1030
movq %r15, %rdi
cmpq %r14, %r15
jne 0x3add
leaq 0x1b79(%rip), %rsi      # 0x566e
leaq 0x1b80(%rip), %rdx      # 0x567c
movl $0x3, %edi
xorl %eax, %eax
callq 0x290e
movl $0x0, 0x8(%rbx)
popq %rbx
popq %r14
popq %r15
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/cyb70289[P]tt/src/common/heap.c
// Function: tt_heap_adjust
int tt_heap_adjust(struct tt_heap *heap, int index, const void *v)
{
	tt_assert(index < heap->__heaplen);
	/* Verify new value
	 * max-heap: increase, min-heap: decrease
	 */
	int d = heap->num.cmp(&heap->num, heap_ptr(heap, index), v);
	if (d == 0)
		return 0;
	if ((heap->htype == TT_HEAP_MAX && d > 0) ||
			(heap->htype == TT_HEAP_MIN && d < 0)) {
		tt_error("Invalid new value");
		return TT_EINVAL;
	}

	heap->_adjust(heap, index);
	return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
cmpl %esi, 0x30(%rdi)
jbe 0x3b8f
movl %esi, %ebp
movq %rdi, %rbx
movslq (%rdi), %rax
movslq %esi, %rsi
imulq %rax, %rsi
addq 0x20(%rdi), %rsi
callq *0x8(%rdi)
xorl %r14d, %r14d
testl %eax, %eax
je 0x3b87
movl 0x2c(%rbx), %ecx
testl %ecx, %ecx
sete %dl
testl %eax, %eax
setg %sil
testb %dl, %sil
jne 0x3b60
cmpl $0x1, %ecx
setne %cl
testl %eax, %eax
setns %al
orb %cl, %al
jne 0x3b7f
leaq 0x1b63(%rip), %rsi      # 0x56ca
leaq 0x1b7d(%rip), %rdx      # 0x56eb
xorl %edi, %edi
xorl %eax, %eax
callq 0x290e
movl $0xfffffffe, %r14d      # imm = 0xFFFFFFFE
jmp 0x3b87
movq %rbx, %rdi
movl %ebp, %esi
callq *0x40(%rbx)
movl %r14d, %eax
popq %rbx
popq %r14
popq %rbp
retq
callq 0x15c1
// File: /workspace/github_c_makefile_star2_O3/cyb70289[P]tt/src/common/heap.c
// Function: tt_heap_extract
int tt_heap_extract(struct tt_heap *heap, void *v)
{
	if (heap->__heaplen == 0)
		return TT_EUNDERFLOW;
	heap->num._set(&heap->num, v, heap->data);

	heap->__heaplen--;
	if (heap->__heaplen) {
		heap->num._set(&heap->num, heap->data,
				heap_ptr(heap, heap->__heaplen));
		tt_heap_heapify(heap, 0);
	}

	return 0;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
cmpl $0x0, 0x30(%rdi)
je 0x3bcd
movq %rdi, %rbx
movq 0x20(%rdi), %rdx
callq *0x18(%rdi)
movl 0x30(%rbx), %edx
decl %edx
movl %edx, 0x30(%rbx)
je 0x3bd4
movq 0x20(%rbx), %rsi
imull (%rbx), %edx
addq %rsi, %rdx
movq %rbx, %rdi
callq *0x18(%rbx)
xorl %ebp, %ebp
movq %rbx, %rdi
xorl %esi, %esi
callq *0x38(%rbx)
jmp 0x3bd6
movl $0xfffffffc, %ebp       # imm = 0xFFFFFFFC
jmp 0x3bd6
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/cyb70289[P]tt/src/common/heap.c
// Function: tt_heap_init
int tt_heap_init(struct tt_heap *heap)
{
	int ret = _tt_key_select(&heap->num);
	if (ret)
		return ret;

	if (heap->htype == TT_HEAP_MIN) {
		tt_debug("Min-heap initialized");
		heap->_heapify = tt_heap_heapify_min;
		heap->_adjust = tt_heap_adjust_min;
	} else {
		tt_debug("Max-heap initialized");
		heap->_heapify = tt_heap_heapify_max;
		heap->_adjust = tt_heap_adjust_max;
	}

	heap->__heaplen = 0;

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x2ae4
movl %eax, %ebp
testl %eax, %eax
jne 0x3c50
cmpl $0x1, 0x2c(%rbx)
leaq 0x1b0b(%rip), %rax      # 0x570a
leaq 0x1b19(%rip), %rdx      # 0x571f
cmoveq %rax, %rdx
leaq 0x4c(%rip), %rax        # 0x3c5d
leaq 0x10c(%rip), %r14       # 0x3d24
cmoveq %rax, %r14
leaq 0xf5(%rip), %rax        # 0x3d18
leaq 0x1c5(%rip), %r15       # 0x3def
cmoveq %rax, %r15
leaq 0x1ac8(%rip), %rsi      # 0x56fd
movl $0x3, %edi
xorl %eax, %eax
callq 0x290e
movq %r14, 0x38(%rbx)
movq %r15, 0x40(%rbx)
movl $0x0, 0x30(%rbx)
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/cyb70289[P]tt/src/common/heap.c
// Function: tt_heap_heapify_max
static inline void tt_heap_heapify_internal(
		struct tt_heap *heap, int index,
		int (*cmp)(const struct tt_key *, const void *, const void*))
{
	while (index < heap->__heaplen / 2) {
		/* Compare and swap with [2*index+1], [2*index+2] */
		void *iptr = heap_ptr(heap, index);
		index = index * 2 + 1;	/* Left child */
		void *lptr = heap_ptr(heap, index);
		void *rptr = lptr + heap->num.size;

		void *swaptr = iptr;
		if (cmp(&heap->num, swaptr, lptr) < 0)
			swaptr = lptr;
		if (index < heap->__heaplen - 1 &&
				cmp(&heap->num, swaptr, rptr) < 0) {
			swaptr = rptr;
			index++;	/* Right child */
		}
		if (swaptr != iptr)
			heap->num.swap(&heap->num, iptr, swaptr);
		else
			break;
	}
}

// Assembly:
movl 0x30(%rdi), %eax
shrl %eax
cmpl %esi, %eax
jbe 0x3dee
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %esi, %r13d
movq %rdi, %rbx
movq 0x8(%rdi), %rax
movq %rax, 0x8(%rsp)
movq 0x20(%rbx), %rax
movslq (%rbx), %r14
movl %r14d, %ecx
imull %r13d, %ecx
movslq %ecx, %r15
addq %rax, %r15
movq %r13, 0x10(%rsp)
leal 0x1(,%r13,2), %ebp
movl %r14d, %ecx
imull %ebp, %ecx
movslq %ecx, %r13
addq %rax, %r13
movq %rbx, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq *0x8(%rsp)
movq %r13, %r12
testl %eax, %eax
js 0x3d92
movq %r15, %r12
movl 0x30(%rbx), %eax
decl %eax
cmpl %eax, %ebp
jae 0x3dbe
addq %r14, %r13
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq *0x8(%rsp)
testl %eax, %eax
jns 0x3dbe
movq 0x10(%rsp), %rax
addl %eax, %eax
addl $0x2, %eax
movl %eax, %ebp
movq %r13, %r12
movl %ebp, %r13d
cmpq %r15, %r12
je 0x3de0
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq *0x10(%rbx)
movl 0x30(%rbx), %eax
shrl %eax
cmpl %eax, %r13d
jb 0x3d4e
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/cyb70289[P]tt/src/common/heap.c
// Function: tt_heap_adjust_internal
static inline void tt_heap_adjust_internal(
		struct tt_heap *heap, int index,
		int (*cmp)(const struct tt_key *, const void *, const void*))
{
	/* Buffer for one element */
	char tmp[heap->num.size] _tt_align(8);	/* C99 VLA, huha! */
	void *v = heap_ptr(heap, index);
	heap->num._set(&heap->num, tmp, v);

	while (index > 0) {
		int parent = (index - 1) / 2;
		void *pv = heap_ptr(heap, parent);
		if (cmp(&heap->num, tmp, pv) <= 0)
			break;
		heap->num._set(&heap->num, v, pv);
		v = pv;
		index = parent;
	}

	heap->num._set(&heap->num, v, tmp);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, -0x38(%rbp)
movl %esi, %r14d
movq %rdi, %rbx
movl (%rdi), %eax
movq %rsp, %rsi
movq %rax, %rcx
addq $0xf, %rcx
andq $-0x10, %rcx
subq %rcx, %rsi
movq %rsi, %rsp
imull %r14d, %eax
movslq %eax, %r13
addq 0x20(%rdi), %r13
movq %rsi, -0x30(%rbp)
movq %r13, %rdx
callq *0x18(%rdi)
testl %r14d, %r14d
jle 0x3e8a
movl %r14d, %r15d
decl %r15d
movl %r15d, %r14d
shrl %r14d
movslq (%rbx), %rax
movq %r14, %r12
imulq %rax, %r12
addq 0x20(%rbx), %r12
movq %rbx, %rdi
movq -0x30(%rbp), %rsi
movq %r12, %rdx
callq *-0x38(%rbp)
testl %eax, %eax
jle 0x3e8a
movq %rbx, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq *0x18(%rbx)
movq %r12, %r13
cmpl $0x1, %r15d
ja 0x3e48
jmp 0x3e8d
movq %r13, %r12
movq %rbx, %rdi
movq %r12, %rsi
movq -0x30(%rbp), %rdx
callq *0x18(%rbx)
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/cyb70289[P]tt/src/common/tree.c
// Function: tt_bintree_init
void tt_bintree_init(struct tt_bintree *tree)
{
	if (!tree->ops) {
		tt_debug("Red-Black tree initialized");
		tree->ops = &tt_rbtree_ops;
	} else {
		tt_debug("Binary tree initialized");
	}

	if (!tree->knum.swap)
		tree->knum.swap = tt_bintree_swap_dummy;
	_tt_key_select(&tree->knum);

	tree->_root = NULL;
	tree->_count = 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
cmpq $0x0, 0x20(%rdi)
je 0x3ed3
leaq 0x1876(%rip), %rsi      # 0x5734
leaq 0x189a(%rip), %rdx      # 0x575f
movl $0x3, %edi
xorl %eax, %eax
callq 0x290e
jmp 0x3ef8
leaq 0x185a(%rip), %rsi      # 0x5734
leaq 0x1863(%rip), %rdx      # 0x5744
movl $0x3, %edi
xorl %eax, %eax
callq 0x290e
leaq 0x41e4(%rip), %rax      # 0x80d8
movq %rax, 0x20(%rbx)
cmpq $0x0, 0x10(%rbx)
jne 0x3f0a
leaq 0x1d(%rip), %rax        # 0x3f23
movq %rax, 0x10(%rbx)
movq %rbx, %rdi
callq 0x2ae4
movq $0x0, 0x28(%rbx)
movl $0x0, 0x30(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/cyb70289[P]tt/src/common/tree.c
// Function: tt_bintree_free_internal
static void tt_bintree_free_internal(struct tt_bintree_node *node)
{
	if (node) {
		tt_bintree_free_internal(node->left);
		tt_bintree_free_internal(node->right);
		free(node);
	}
}

// Assembly:
testq %rdi, %rdi
je 0x3f7f
pushq %rbx
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
callq 0x3f5b
movq 0x20(%rbx), %rdi
callq 0x3f5b
movq %rbx, %rdi
popq %rbx
jmp 0x1030
retq
// File: /workspace/github_c_makefile_star2_O3/cyb70289[P]tt/src/common/tree.c
// Function: tt_rbtree_min
static inline struct tt_bintree_node *tt_rbtree_min(
		struct tt_bintree_node *node)
{
	if (node) {
		while (node->left)
			node = node->left;
	}
	return node;
}

// Assembly:
testq %rdi, %rdi
je 0x3f92
movq %rdi, %rax
movq 0x18(%rdi), %rdi
testq %rdi, %rdi
jne 0x3f85
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/cyb70289[P]tt/src/common/tree.c
// Function: tt_rbtree_max
static inline struct tt_bintree_node *tt_rbtree_max(
		struct tt_bintree_node *node)
{
	if (node) {
		while (node->right)
			node = node->right;
	}
	return node;
}

// Assembly:
testq %rdi, %rdi
je 0x3fa7
movq %rdi, %rax
movq 0x20(%rdi), %rdi
testq %rdi, %rdi
jne 0x3f9a
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/cyb70289[P]tt/src/common/tree.c
// Function: tt_rbtree_search
static struct tt_bintree_node *tt_rbtree_search(
		const struct tt_bintree *tree, const void *key)
{
	struct tt_bintree_node *node = tree->_root;
	while (node) {
		int c = tree->knum.cmp(&tree->knum, key, node->key);
		if (c == 0)
			break;
		else if (c < 0)
			node = node->left;
		else
			node = node->right;
	}
	return node;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq 0x28(%rdi), %rbx
testq %rbx, %rbx
je 0x3fde
movq %rsi, %r14
movq %rdi, %r15
movq (%rbx), %rdx
movq %r15, %rdi
movq %r14, %rsi
callq *0x8(%r15)
testl %eax, %eax
je 0x3fe0
notl %eax
shrl $0x1f, %eax
movq 0x18(%rbx,%rax,8), %rbx
testq %rbx, %rbx
jne 0x3fbe
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/cyb70289[P]tt/src/common/tree.c
// Function: tt_rbtree_walk_in
static int tt_rbtree_walk_in(const struct tt_bintree_node *node, void *context,
		bool (*walk)(const void *key, const void *v, void *context))
{
	while (node) {
		if (tt_rbtree_walk_in(node->left, context, walk))
			return TT_ESTOP;
		if (!walk(node->key, node->data, context))
			return TT_ESTOP;
		node = node->right;
	}

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x46ff
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movl $0x5, %ebp
movq 0x18(%r15), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x46b9
testl %eax, %eax
jne 0x4701
movq (%r15), %rdi
movq 0x8(%r15), %rsi
movq %r14, %rdx
callq *%rbx
testb %al, %al
je 0x4701
movq 0x20(%r15), %r15
testq %r15, %r15
jne 0x46d3
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/dlbeer[P]dhara/dhara/map.c
// Function: trace_path
static int trace_path(struct dhara_map *m, dhara_sector_t target,
		      dhara_page_t *loc, uint8_t *new_meta,
		      dhara_error_t *err)
{
	uint8_t meta[DHARA_META_SIZE];
	int depth = 0;
	dhara_page_t p = dhara_journal_root(&m->journal);

	if (new_meta)
		meta_set_id(new_meta, target);

	if (p == DHARA_PAGE_NONE)
		goto not_found;

	if (dhara_journal_read_meta(&m->journal, p, meta, err) < 0)
		return -1;

	while (depth < DHARA_RADIX_DEPTH) {
		const dhara_sector_t id = meta_get_id(meta);

		if (id == DHARA_SECTOR_NONE)
			goto not_found;

		if ((target ^ id) & d_bit(depth)) {
			if (new_meta)
				meta_set_alt(new_meta, depth, p);

			p = meta_get_alt(meta, depth);
			if (p == DHARA_PAGE_NONE) {
				depth++;
				goto not_found;
			}

			if (dhara_journal_read_meta(&m->journal, p,
						    meta, err) < 0)
				return -1;
		} else {
			if (new_meta)
				meta_set_alt(new_meta, depth,
					meta_get_alt(meta, depth));
		}

		depth++;
	}

	if (loc)
		*loc = p;

	return 0;

not_found:
	if (new_meta) {
		while (depth < DHARA_RADIX_DEPTH)
			meta_set_alt(new_meta, depth++, DHARA_SECTOR_NONE);
	}

	dhara_set_error(err, DHARA_E_NOT_FOUND);
	return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %r8, %rbx
movq %rcx, %r14
movq %rdx, %r12
movl %esi, %r15d
movq %rdi, %rbp
movl 0x28(%rdi), %r13d
testq %rcx, %rcx
je 0x13a5
movl %r15d, (%r14)
cmpl $-0x1, %r13d
je 0x1445
leaq 0x10(%rsp), %rdx
movq %rbp, %rdi
movl %r13d, %esi
movq %rbx, %rcx
callq 0x2175
testl %eax, %eax
js 0x1483
movq %r12, 0x8(%rsp)
xorl %r12d, %r12d
movl 0x10(%rsp), %eax
cmpl $-0x1, %eax
je 0x1448
xorl %r15d, %eax
movl %r12d, %ecx
shll %cl, %eax
testl $0x80000000, %eax       # imm = 0x80000000
je 0x141c
testq %r14, %r14
je 0x13f4
movl %r13d, 0x4(%r14,%r12,4)
movl 0x14(%rsp,%r12,4), %r13d
cmpl $-0x1, %r13d
je 0x149a
movq %rbp, %rdi
movl %r13d, %esi
leaq 0x10(%rsp), %rdx
movq %rbx, %rcx
callq 0x2175
testl %eax, %eax
jns 0x142b
jmp 0x1483
testq %r14, %r14
je 0x142b
movl 0x14(%rsp,%r12,4), %eax
movl %eax, 0x4(%r14,%r12,4)
incq %r12
cmpq $0x20, %r12
jne 0x13d2
xorl %eax, %eax
movq 0x8(%rsp), %rcx
testq %rcx, %rcx
je 0x1488
movl %r13d, (%rcx)
jmp 0x1488
xorl %r12d, %r12d
testq %r14, %r14
je 0x1471
cmpl $0x1f, %r12d
ja 0x1471
shll $0x2, %r12d
leaq (%r14,%r12), %rdi
addq $0x4, %rdi
movl $0x80, %edx
subl %r12d, %edx
movl $0xff, %esi
callq 0x1090
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testq %rbx, %rbx
je 0x1488
movl $0x6, (%rbx)
jmp 0x1488
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
incl %r12d
jmp 0x1448
// File: /workspace/github_c_makefile_star2_O3/dlbeer[P]dhara/dhara/map.c
// Function: dhara_map_read
int dhara_map_read(struct dhara_map *m, dhara_sector_t s,
		   uint8_t *data, dhara_error_t *err)
{
	const struct dhara_nand *n = m->journal.nand;
	dhara_error_t my_err;
	dhara_page_t p;

	if (dhara_map_find(m, s, &p, &my_err) < 0) {
		if (my_err == DHARA_E_NOT_FOUND) {
			memset(data, 0xff, 1 << n->log2_page_size);
			return 0;
		}

		dhara_set_error(err, my_err);
		return -1;
	}

	return dhara_nand_read(n, p, 0, 1 << n->log2_page_size, data, err);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rcx, %r14
movq %rdx, %rbx
movq (%rdi), %r15
leaq 0x8(%rsp), %rdx
leaq 0xc(%rsp), %r8
xorl %ecx, %ecx
callq 0x1379
testl %eax, %eax
js 0x14e9
movl 0x8(%rsp), %esi
movb (%r15), %cl
movl $0x1, %eax
shll %cl, %eax
movslq %eax, %rcx
movq %r15, %rdi
xorl %edx, %edx
movq %rbx, %r8
movq %r14, %r9
callq 0x33f0
jmp 0x151d
movl 0xc(%rsp), %ecx
cmpl $0x6, %ecx
jne 0x1510
movb (%r15), %cl
movl $0x1, %eax
shll %cl, %eax
movslq %eax, %rdx
movq %rbx, %rdi
movl $0xff, %esi
callq 0x1090
xorl %eax, %eax
jmp 0x151d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testq %r14, %r14
je 0x151d
movl %ecx, (%r14)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/dlbeer[P]dhara/dhara/map.c
// Function: dhara_map_write
int dhara_map_write(struct dhara_map *m, dhara_sector_t dst,
		    const uint8_t *data, dhara_error_t *err)
{
	for (;;) {
		uint8_t meta[DHARA_META_SIZE];
		dhara_error_t my_err;
		const dhara_sector_t old_count = m->count;

		if (prepare_write(m, dst, meta, err) < 0)
			return -1;

		if (!dhara_journal_enqueue(&m->journal, data, meta, &my_err))
			break;

		m->count = old_count;

		if (try_recover(m, my_err, err) < 0)
			return -1;
	}

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rcx, %rbx
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, %r15
movl 0x3c(%rdi), %r13d
leaq 0x10(%rsp), %rdx
callq 0x15bb
testl %eax, %eax
js 0x15a0
leaq 0x10(%rsp), %r12
movq %r15, %rdi
movq %r14, %rsi
movq %r12, %rdx
leaq 0xc(%rsp), %rcx
callq 0x2337
testl %eax, %eax
je 0x15a7
movl %r13d, 0x3c(%r15)
movl 0xc(%rsp), %esi
movq %r15, %rdi
movq %rbx, %rdx
callq 0x1677
testl %eax, %eax
js 0x15a0
movl 0x3c(%r15), %r13d
movq %r15, %rdi
movl %ebp, %esi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x15bb
testl %eax, %eax
jns 0x155a
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x15a9
xorl %eax, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/dlbeer[P]dhara/dhara/map.c
// Function: prepare_write
static int prepare_write(struct dhara_map *m, dhara_sector_t dst,
			 uint8_t *meta, dhara_error_t *err)
{
	dhara_error_t my_err;

	if (auto_gc(m, err) < 0)
		return -1;

	if (trace_path(m, dst, NULL, meta, &my_err) < 0) {
		if (my_err != DHARA_E_NOT_FOUND) {
			dhara_set_error(err, my_err);
			return -1;
		}

		if (m->count >= dhara_map_capacity(m)) {
			dhara_set_error(err, DHARA_E_MAP_FULL);
			return -1;
		}

		m->count++;
	}

	ck_set_count(dhara_journal_cookie(&m->journal), m->count);
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rcx, %r15
movq %rdx, %r12
movl %esi, %ebp
movq %rdi, %r14
movq %rcx, %rsi
callq 0x1933
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testl %eax, %eax
js 0x1608
leaq 0xc(%rsp), %r8
movq %r14, %rdi
movl %ebp, %esi
xorl %edx, %edx
movq %r12, %rcx
callq 0x1379
testl %eax, %eax
js 0x1617
movl 0x3c(%r14), %eax
movq 0x8(%r14), %rcx
movl %eax, 0x10(%rcx)
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl 0xc(%rsp), %eax
cmpl $0x6, %eax
jne 0x165f
movl 0x3c(%r14), %ebp
movq %r14, %rdi
callq 0x2112
movl %eax, %esi
movzbl 0x38(%r14), %ecx
incl %ecx
xorl %edx, %edx
divl %ecx
movq (%r14), %rcx
movb 0x1(%rcx), %cl
movl $0x8, %edx
shll %cl, %edx
xorl %ecx, %ecx
addl %eax, %edx
subl %edx, %esi
cmovbl %ecx, %esi
cmpl %esi, %ebp
jae 0x1669
movl 0x3c(%r14), %eax
incl %eax
movl %eax, 0x3c(%r14)
jmp 0x15ff
testq %r15, %r15
je 0x1608
movl %eax, (%r15)
jmp 0x1608
testq %r15, %r15
je 0x1608
movl $0x7, (%r15)
jmp 0x1608
// File: /workspace/github_c_makefile_star2_O3/dlbeer[P]dhara/dhara/map.c
// Function: try_recover
static int try_recover(struct dhara_map *m, dhara_error_t cause,
		       dhara_error_t *err)
{
	int restart_count = 0;

	if (cause != DHARA_E_RECOVER) {
		dhara_set_error(err, cause);
		return -1;
	}

	while (dhara_journal_in_recovery(&m->journal)) {
		dhara_page_t p = dhara_journal_next_recoverable(&m->journal);
		dhara_error_t my_err;
		int ret;

		if (p == DHARA_PAGE_NONE)
			ret = pad_queue(m, &my_err);
		else
			ret = raw_gc(m, p, &my_err);

		if (ret < 0) {
			if (my_err != DHARA_E_RECOVER) {
				dhara_set_error(err, my_err);
				return -1;
			}

			if (restart_count >= DHARA_MAX_RETRIES) {
				dhara_set_error(err, DHARA_E_TOO_BAD);
				return -1;
			}

			restart_count++;
		}
	}

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
cmpl $0x4, %esi
jne 0x16d9
movq %rdi, %r14
testb $0x4, 0x12(%rdi)
je 0x16d5
xorl %ebp, %ebp
leaq 0x4(%rsp), %r15
movq %r14, %rdi
callq 0x2804
movq %r14, %rdi
cmpl $-0x1, %eax
je 0x16b2
movl %eax, %esi
movq %r15, %rdx
callq 0x1aa0
jmp 0x16ba
movq %r15, %rsi
callq 0x1a2c
testl %eax, %eax
jns 0x16ce
movl 0x4(%rsp), %eax
cmpl $0x4, %eax
jne 0x16ec
cmpl $0x8, %ebp
jge 0x16e7
incl %ebp
testb $0x4, 0x12(%r14)
jne 0x1696
xorl %eax, %eax
jmp 0x16f8
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testq %rbx, %rbx
je 0x16f8
movl %esi, (%rbx)
jmp 0x16f8
movl $0x3, %eax
testq %rbx, %rbx
je 0x16f3
movl %eax, (%rbx)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/dlbeer[P]dhara/dhara/map.c
// Function: dhara_map_copy_page
int dhara_map_copy_page(struct dhara_map *m, dhara_page_t src,
			dhara_sector_t dst, dhara_error_t *err)
{
	for (;;) {
		uint8_t meta[DHARA_META_SIZE];
		dhara_error_t my_err;
		const dhara_sector_t old_count = m->count;

		if (prepare_write(m, dst, meta, err) < 0)
			return -1;

		if (!dhara_journal_copy(&m->journal, src, meta, &my_err))
			break;

		m->count = old_count;

		if (try_recover(m, my_err, err) < 0)
			return -1;
	}

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rcx, %rbx
movl %edx, %ebp
movl %esi, %r14d
movq %rdi, %r15
movl 0x3c(%rdi), %r13d
leaq 0x10(%rsp), %rdx
movl %ebp, %esi
callq 0x15bb
testl %eax, %eax
js 0x177e
leaq 0x10(%rsp), %r12
movq %r15, %rdi
movl %r14d, %esi
movq %r12, %rdx
leaq 0xc(%rsp), %rcx
callq 0x2776
testl %eax, %eax
je 0x1785
movl %r13d, 0x3c(%r15)
movl 0xc(%rsp), %esi
movq %r15, %rdi
movq %rbx, %rdx
callq 0x1677
testl %eax, %eax
js 0x177e
movl 0x3c(%r15), %r13d
movq %r15, %rdi
movl %ebp, %esi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x15bb
testl %eax, %eax
jns 0x1738
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x1787
xorl %eax, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/dlbeer[P]dhara/dhara/map.c
// Function: dhara_map_copy_sector
int dhara_map_copy_sector(struct dhara_map *m, dhara_sector_t src,
			  dhara_sector_t dst, dhara_error_t *err)
{
	dhara_error_t my_err;
	dhara_page_t p;

	if (dhara_map_find(m, src, &p, &my_err) < 0) {
		if (my_err == DHARA_E_NOT_FOUND)
			return dhara_map_trim(m, dst, err);

		dhara_set_error(err, my_err);
		return -1;
	}

	return dhara_map_copy_page(m, p, dst, err);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rcx, %rbx
movl %edx, %ebp
movq %rdi, %r14
leaq 0x8(%rsp), %rdx
leaq 0xc(%rsp), %r8
xorl %ecx, %ecx
callq 0x1379
testl %eax, %eax
js 0x17d1
movl 0x8(%rsp), %esi
movq %r14, %rdi
movl %ebp, %edx
movq %rbx, %rcx
callq 0x1703
jmp 0x17f5
movl 0xc(%rsp), %ecx
cmpl $0x6, %ecx
jne 0x17e9
movq %r14, %rdi
movl %ebp, %esi
movq %rbx, %rdx
callq 0x17fe
jmp 0x17f5
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testq %rbx, %rbx
je 0x17f5
movl %ecx, (%rbx)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/dlbeer[P]dhara/dhara/map.c
// Function: dhara_map_trim
int dhara_map_trim(struct dhara_map *m, dhara_sector_t s, dhara_error_t *err)
{
	for (;;) {
		dhara_error_t my_err;

		if (auto_gc(m, err) < 0)
			return -1;

		if (!try_delete(m, s, &my_err))
			break;

		if (try_recover(m, my_err, err) < 0)
			return -1;
	}

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, %rbx
movq %rdx, %rsi
callq 0x1933
testl %eax, %eax
js 0x1917
movq %rbx, %rdi
movl %ebp, %esi
xorl %edx, %edx
leaq 0x10(%rsp), %rcx
leaq 0xc(%rsp), %r8
callq 0x1379
testl %eax, %eax
js 0x1863
movl $0x1f, %r12d
xorl %r15d, %r15d
movl 0x14(%rsp,%r12,4), %r13d
cmpl $-0x1, %r13d
jne 0x1876
decq %r15
addq $-0x1, %r12
jb 0x184a
jmp 0x1904
movl 0xc(%rsp), %eax
cmpl $0x6, %eax
je 0x1913
movl %eax, 0x8(%rsp)
jmp 0x18e6
movq %rbx, %rdi
movl %r13d, %esi
leaq 0xa0(%rsp), %rdx
leaq 0x8(%rsp), %rcx
callq 0x2175
testl %eax, %eax
js 0x18e6
movl 0xa0(%rsp), %eax
movl %eax, 0x10(%rsp)
cmpq $0x1e, %r12
ja 0x18b8
movl 0x124(%rsp,%r15,4), %eax
movl %eax, 0x94(%rsp,%r15,4)
incq %r15
jne 0x18a3
movl $0xffffffff, 0x14(%rsp,%r12,4) # imm = 0xFFFFFFFF
movq 0x8(%rbx), %rax
movl 0x3c(%rbx), %ecx
decl %ecx
movl %ecx, 0x10(%rax)
movq %rbx, %rdi
movl %r13d, %esi
leaq 0x10(%rsp), %rdx
leaq 0x8(%rsp), %rcx
callq 0x2776
testl %eax, %eax
jns 0x192e
movl 0x8(%rsp), %esi
movq %rbx, %rdi
movq %r14, %rdx
callq 0x1677
testl %eax, %eax
js 0x1917
movq %rbx, %rdi
movq %r14, %rsi
jmp 0x181a
movl $0x0, 0x3c(%rbx)
movq %rbx, %rdi
callq 0x2302
xorl %eax, %eax
jmp 0x191c
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
decl 0x3c(%rbx)
jmp 0x1913
// File: /workspace/github_c_makefile_star2_O3/dlbeer[P]dhara/dhara/map.c
// Function: auto_gc
static int auto_gc(struct dhara_map *m, dhara_error_t *err)
{
	int i;

	if (dhara_journal_size(&m->journal) < dhara_map_capacity(m))
		return 0;

	for (i = 0; i <= m->gc_ratio; i++)
		if (dhara_map_gc(m, err) < 0)
			return -1;

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
callq 0x2139
movl %eax, %r15d
movq %r14, %rdi
callq 0x2112
movl %eax, %esi
movzbl 0x38(%r14), %ecx
incl %ecx
xorl %edx, %edx
divl %ecx
movq (%r14), %rcx
movb 0x1(%rcx), %cl
movl $0x8, %edx
shll %cl, %edx
xorl %ebp, %ebp
addl %eax, %edx
subl %edx, %esi
cmovbl %ebp, %esi
cmpl %esi, %r15d
jb 0x19a1
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1b40
testl %eax, %eax
js 0x199c
movzbl 0x38(%r14), %eax
incl %r15d
cmpl %eax, %r15d
jb 0x197e
jmp 0x19a1
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/dlbeer[P]dhara/dhara/map.c
// Function: dhara_map_sync
int dhara_map_sync(struct dhara_map *m, dhara_error_t *err)
{
	while (!dhara_journal_is_clean(&m->journal)) {
		dhara_page_t p = dhara_journal_peek(&m->journal);
		dhara_error_t my_err;
		int ret;

		if (p == DHARA_PAGE_NONE) {
			ret = pad_queue(m, &my_err);
		} else {
			ret = raw_gc(m, p, &my_err);
			if (!ret)
				dhara_journal_dequeue(&m->journal);
		}

		if ((ret < 0) && (try_recover(m, my_err, err) < 0))
			return -1;
	}

	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
xorl %ebx, %ebx
testb $0x1, 0x12(%rdi)
je 0x1a1e
movq %rsi, %r14
movq %rdi, %r15
leaq 0x4(%rsp), %r12
movq %r15, %rdi
callq 0x21fb
movq %r15, %rdi
cmpl $-0x1, %eax
je 0x19f1
movl %eax, %esi
movq %r12, %rdx
callq 0x1aa0
testl %eax, %eax
jne 0x19fd
movq %r15, %rdi
callq 0x228b
jmp 0x1a10
movq %r12, %rsi
callq 0x1a2c
testl %eax, %eax
jns 0x1a10
movl 0x4(%rsp), %esi
movq %r15, %rdi
movq %r14, %rdx
callq 0x1677
testl %eax, %eax
js 0x1a19
testb $0x1, 0x12(%r15)
jne 0x19c9
jmp 0x1a1e
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/dlbeer[P]dhara/dhara/map.c
// Function: pad_queue
static int pad_queue(struct dhara_map *m, dhara_error_t *err)
{
	dhara_page_t p = dhara_journal_root(&m->journal);
	uint8_t root_meta[DHARA_META_SIZE];

	ck_set_count(dhara_journal_cookie(&m->journal), m->count);

	if (p == DHARA_PAGE_NONE)
		return dhara_journal_enqueue(&m->journal, NULL, NULL, err);

	if (dhara_journal_read_meta(&m->journal, p, root_meta, err) < 0)
		return -1;

	return dhara_journal_copy(&m->journal, p, root_meta, err);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x90, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movl 0x28(%rdi), %ebp
movq 0x8(%rdi), %rax
movl 0x3c(%rdi), %ecx
movl %ecx, 0x10(%rax)
cmpl $-0x1, %ebp
je 0x1a75
movq %rsp, %rdx
movq %r14, %rdi
movl %ebp, %esi
movq %rbx, %rcx
callq 0x2175
testl %eax, %eax
js 0x1a8f
movq %rsp, %rdx
movq %r14, %rdi
movl %ebp, %esi
movq %rbx, %rcx
callq 0x2776
jmp 0x1a94
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
movq %rbx, %rcx
addq $0x90, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x2337
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x90, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/dlbeer[P]dhara/dhara/map.c
// Function: raw_gc
static int raw_gc(struct dhara_map *m, dhara_page_t src,
		  dhara_error_t *err)
{
	dhara_sector_t target;
	dhara_page_t current;
	dhara_error_t my_err;
	uint8_t meta[DHARA_META_SIZE];

	if (dhara_journal_read_meta(&m->journal, src, meta, err) < 0)
		return -1;

	/* Is the page just filler/garbage? */
	target = meta_get_id(meta);
	if (target == DHARA_SECTOR_NONE)
		return 0;

	/* Find out where the sector once represented by this page
	 * currently resides (if anywhere).
	 */
	if (trace_path(m, target, &current, meta, &my_err) < 0) {
		if (my_err == DHARA_E_NOT_FOUND)
			return 0;

		dhara_set_error(err, my_err);
		return -1;
	}

	/* Is this page still the most current representative? If not,
	 * do nothing.
	 */
	if (current != src)
		return 0;

	/* Rewrite it at the front of the journal with updated metadata */
	ck_set_count(dhara_journal_cookie(&m->journal), m->count);
	if (dhara_journal_copy(&m->journal, src, meta, err) < 0)
		return -1;

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x98, %rsp
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r14
leaq 0x10(%rsp), %rdx
movq %rbx, %rcx
callq 0x2175
testl %eax, %eax
js 0x1b29
movl 0x10(%rsp), %esi
xorl %r15d, %r15d
cmpl $-0x1, %esi
je 0x1b2f
leaq 0xc(%rsp), %rdx
leaq 0x10(%rsp), %rcx
leaq 0x8(%rsp), %r8
movq %r14, %rdi
callq 0x1379
testl %eax, %eax
js 0x1b19
cmpl %ebp, 0xc(%rsp)
jne 0x1b2f
movq 0x8(%r14), %rax
movl 0x3c(%r14), %ecx
movl %ecx, 0x10(%rax)
leaq 0x10(%rsp), %rdx
movq %r14, %rdi
movl %ebp, %esi
movq %rbx, %rcx
callq 0x2776
movl %eax, %r15d
sarl $0x1f, %r15d
jmp 0x1b2f
movl 0x8(%rsp), %eax
cmpl $0x6, %eax
je 0x1b2f
testq %rbx, %rbx
je 0x1b29
movl %eax, (%rbx)
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
movl %r15d, %eax
addq $0x98, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/dlbeer[P]dhara/dhara/map.c
// Function: dhara_map_gc
int dhara_map_gc(struct dhara_map *m, dhara_error_t *err)
{
	if (!m->count)
		return 0;

	for (;;) {
		dhara_page_t tail = dhara_journal_peek(&m->journal);
		dhara_error_t my_err;

		if (tail == DHARA_PAGE_NONE)
			break;

		if (!raw_gc(m, tail, &my_err)) {
			dhara_journal_dequeue(&m->journal);
			break;
		}

		if (try_recover(m, my_err, err) < 0)
			return -1;
	}

	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
xorl %ebx, %ebx
cmpl $0x0, 0x3c(%rdi)
je 0x1ba7
movq %rsi, %r15
movq %rdi, %r14
callq 0x21fb
cmpl $-0x1, %eax
je 0x1ba7
leaq 0x4(%rsp), %r12
movq %r14, %rdi
movl %eax, %esi
movq %r12, %rdx
callq 0x1aa0
testl %eax, %eax
je 0x1b98
movl 0x4(%rsp), %esi
movq %r14, %rdi
movq %r15, %rdx
callq 0x1677
testl %eax, %eax
js 0x1ba2
movq %r14, %rdi
callq 0x21fb
cmpl $-0x1, %eax
jne 0x1b65
jmp 0x1ba7
movq %r14, %rdi
callq 0x228b
jmp 0x1ba7
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/dlbeer[P]dhara/dhara/journal.c
// Function: dhara_journal_init
void dhara_journal_init(struct dhara_journal *j,
			const struct dhara_nand *n,
			uint8_t *page_buf)
{
	/* Set fixed parameters */
	j->nand = n;
	j->page_buf = page_buf;
	j->log2_ppc = choose_ppc(n->log2_page_size, n->log2_ppb);

	reset_journal(j);
}

// Assembly:
movq %rdx, %rax
movq %rsi, (%rdi)
movq %rdx, 0x8(%rdi)
movb (%rsi), %cl
movl $0x1, %r8d
shll %cl, %r8d
movzbl 0x1(%rsi), %r9d
movl $0x1, %edx
movb $0x1, %cl
cmpl $0x2, %r9d
jb 0x1c05
addl $-0x14, %r8d
movl $0x84, %r10d
movl $0x1, %ecx
leal 0x84(,%r10,2), %r10d
cmpl %r8d, %r10d
jg 0x1c05
incl %ecx
cmpl %ecx, %r9d
jne 0x1bee
movl %r9d, %ecx
movb %cl, 0x10(%rdi)
xorl %ecx, %ecx
movb %cl, 0x11(%rdi)
movl 0x4(%rsi), %r8d
shrl $0x6, %r8d
movl %r8d, 0x18(%rdi)
movl %ecx, 0x14(%rdi)
movl %ecx, 0x24(%rdi)
movq $0x0, 0x1c(%rdi)
pcmpeqd %xmm0, %xmm0
movdqu %xmm0, 0x28(%rdi)
movb %cl, 0x12(%rdi)
movb (%rsi), %cl
shll %cl, %edx
movslq %edx, %rdx
movq %rax, %rdi
movl $0xff, %esi
jmp 0x1090
// File: /workspace/github_c_makefile_star2_O3/dlbeer[P]dhara/dhara/journal.c
// Function: find_checkblock
static int find_checkblock(struct dhara_journal *j,
			   dhara_block_t blk, dhara_block_t *where,
			   dhara_error_t *err)
{
	int i;

	for (i = 0; (blk < j->nand->num_blocks) &&
		    (i < DHARA_MAX_RETRIES); i++) {
		const dhara_page_t p =
			(blk << j->nand->log2_ppb) |
			((1 << j->log2_ppc) - 1);

		if (!(dhara_nand_is_bad(j->nand, blk) ||
		      dhara_nand_read(j->nand, p,
				      0, 1 << j->nand->log2_page_size,
				      j->page_buf, err)) &&
		    hdr_has_magic(j->page_buf)) {
			*where = blk;
			return 0;
		}

		blk++;
	}

	dhara_set_error(err, DHARA_E_TOO_BAD);
	return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, 0x8(%rsp)
movq %rdx, 0x10(%rsp)
movq %rdi, %r12
movq (%rdi), %rdi
cmpl %esi, 0x4(%rdi)
jbe 0x20e3
movl %esi, %r15d
xorl %ebx, %ebx
leal (%r15,%rbx), %ebp
movzbl 0x1(%rdi), %r14d
movzbl 0x10(%r12), %r13d
movl %ebp, %esi
callq 0x319b
testl %eax, %eax
jne 0x20c6
movl %ebp, %eax
movl %r14d, %ecx
shll %cl, %eax
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl %r13d, %ecx
shll %cl, %esi
notl %esi
orl %eax, %esi
movq (%r12), %rdi
movq 0x8(%r12), %r8
movb (%rdi), %cl
movl $0x1, %eax
shll %cl, %eax
movslq %eax, %rcx
xorl %edx, %edx
movq 0x8(%rsp), %r9
callq 0x33f0
testl %eax, %eax
jne 0x20c6
movq 0x8(%r12), %rax
cmpb $0x44, (%rax)
jne 0x20c6
cmpb $0x68, 0x1(%rax)
jne 0x20c6
cmpb $0x61, 0x2(%rax)
je 0x2107
leal (%rbx,%r15), %eax
incl %eax
movq (%r12), %rdi
cmpl 0x4(%rdi), %eax
jae 0x20e3
leal 0x1(%rbx), %eax
cmpl $0x7, %ebx
movl %eax, %ebx
jb 0x205c
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq 0x8(%rsp), %rcx
testq %rcx, %rcx
je 0x20f8
movl $0x3, (%rcx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x10(%rsp), %rax
movl %ebp, (%rax)
xorl %eax, %eax
jmp 0x20f8
// File: /workspace/github_c_makefile_star2_O3/dlbeer[P]dhara/dhara/journal.c
// Function: dhara_journal_read_meta
int dhara_journal_read_meta(struct dhara_journal *j, dhara_page_t p,
			    uint8_t *buf, dhara_error_t *err)
{
	/* Offset of metadata within the metadata page */
	const dhara_page_t ppc_mask = (1 << j->log2_ppc) - 1;
	const size_t offset = hdr_user_offset(p & ppc_mask);

	/* Special case: buffered metadata */
	if (align_eq(p, j->head, j->log2_ppc)) {
		memcpy(buf, j->page_buf + offset, DHARA_META_SIZE);
		return 0;
	}

	/* Special case: incomplete metadata dumped at start of
	 * recovery.
	 */
	if ((j->recover_meta != DHARA_PAGE_NONE) &&
	    align_eq(p, j->recover_root, j->log2_ppc))
		return dhara_nand_read(j->nand, j->recover_meta,
				       offset, DHARA_META_SIZE,
				       buf, err);

	/* General case: fetch from metadata page for checkpoint group */
	return dhara_nand_read(j->nand, p | ppc_mask,
			       offset, DHARA_META_SIZE,
			       buf, err);
}

// Assembly:
movq %rcx, %r9
movzbl 0x10(%rdi), %ecx
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
shll %cl, %r10d
movq %rdx, %r8
notl %r10d
movl %esi, %eax
andl %r10d, %eax
movzbl %al, %eax
movl %eax, %edx
shll $0x7, %edx
leal (%rdx,%rax,4), %eax
addl $0x14, %eax
movl 0x24(%rdi), %edx
xorl %esi, %edx
shrl %cl, %edx
testl %edx, %edx
je 0x21d0
movl 0x34(%rdi), %edx
cmpl $-0x1, %edx
je 0x21c0
movl 0x30(%rdi), %r11d
xorl %esi, %r11d
shrl %cl, %r11d
testl %r11d, %r11d
je 0x21e9
movq (%rdi), %rdi
orl %esi, %r10d
movl $0x84, %ecx
movl %r10d, %esi
jmp 0x21f3
pushq %rax
addq 0x8(%rdi), %rax
movl $0x84, %edx
movq %r8, %rdi
movq %rax, %rsi
callq 0x10c0
xorl %eax, %eax
popq %rcx
retq
movq (%rdi), %rdi
movl $0x84, %ecx
movl %edx, %esi
movq %rax, %rdx
jmp 0x33f0
// File: /workspace/github_c_makefile_star2_O3/dlbeer[P]dhara/dhara/journal.c
// Function: dhara_journal_peek
dhara_page_t dhara_journal_peek(struct dhara_journal *j)
{
	if (j->head == j->tail)
		return DHARA_PAGE_NONE;

	if (is_aligned(j->tail, j->nand->log2_ppb)) {
		dhara_block_t blk = j->tail >> j->nand->log2_ppb;
		int i;

		for (i = 0; i < DHARA_MAX_RETRIES; i++) {
			if ((blk == (j->head >> j->nand->log2_ppb)) ||
			    !dhara_nand_is_bad(j->nand, blk)) {
				j->tail = blk << j->nand->log2_ppb;

				if (j->tail == j->head)
					j->root = DHARA_PAGE_NONE;

				return j->tail;
			}

			blk = next_block(j->nand, blk);
		}
	}

	return j->tail;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl 0x20(%rdi), %eax
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl %eax, 0x24(%rdi)
je 0x2228
movq %rdi, %rbx
movq (%rdi), %rdi
movzbl 0x1(%rdi), %ecx
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
shll %cl, %edx
notl %edx
testl %edx, %eax
je 0x2235
movl %eax, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
shrl %cl, %eax
movl $0x8, %r14d
xorl %r15d, %r15d
movl %eax, %ebp
movl 0x24(%rbx), %eax
movzbl 0x1(%rdi), %ecx
movl %eax, %edx
shrl %cl, %edx
cmpl %edx, %ebp
je 0x2279
movl %ebp, %esi
callq 0x319b
movq (%rbx), %rdi
testl %eax, %eax
je 0x2272
incl %ebp
cmpl 0x4(%rdi), %ebp
cmovael %r15d, %ebp
decl %r14d
jne 0x2242
movl 0x20(%rbx), %ebp
jmp 0x2228
movzbl 0x1(%rdi), %ecx
movl 0x24(%rbx), %eax
shll %cl, %ebp
movl %ebp, 0x20(%rbx)
cmpl %eax, %ebp
jne 0x2228
movl $0xffffffff, 0x28(%rbx) # imm = 0xFFFFFFFF
jmp 0x2226
// File: /workspace/github_c_makefile_star2_O3/dlbeer[P]dhara/dhara/journal.c
// Function: dhara_journal_dequeue
void dhara_journal_dequeue(struct dhara_journal *j)
{
	if (j->head == j->tail)
		return;

	j->tail = next_upage(j, j->tail);

	/* If the journal is clean at the time of dequeue, then this
	 * data was always obsolete, and can be reused immediately.
	 */
	if (!(j->flags & (DHARA_JOURNAL_F_DIRTY | DHARA_JOURNAL_F_RECOVERY)))
		j->tail_sync = j->tail;

	const dhara_page_t chip_size = j->nand->num_blocks << j->nand->log2_ppb;
	const dhara_page_t raw_size = wrap(j->head + chip_size - j->tail,
		chip_size);
	const dhara_page_t root_offset = wrap(j->head + chip_size - j->root,
		chip_size);

	if (root_offset > raw_size)
		j->root = DHARA_PAGE_NONE;
}

// Assembly:
movl 0x20(%rdi), %r8d
movl 0x24(%rdi), %edx
cmpl %r8d, %edx
je 0x2301
movq (%rdi), %rsi
movb 0x10(%rdi), %cl
movb 0x1(%rsi), %al
movl 0x4(%rsi), %esi
leal 0x1(%r8), %r9d
addl $0x2, %r8d
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
shll %cl, %r10d
notl %r10d
testl %r10d, %r8d
cmovnel %r9d, %r8d
movl %eax, %ecx
shll %cl, %esi
xorl %eax, %eax
cmpl %esi, %r8d
cmovael %eax, %r8d
movl %r8d, 0x20(%rdi)
testb $0x5, 0x12(%rdi)
jne 0x22d9
movl %r8d, 0x1c(%rdi)
addl %esi, %edx
movl %edx, %ecx
subl %r8d, %ecx
cmpl %esi, %ecx
movl %esi, %r8d
cmovbl %eax, %r8d
subl %r8d, %ecx
subl 0x28(%rdi), %edx
cmpl %esi, %edx
cmovbl %eax, %esi
subl %esi, %edx
cmpl %ecx, %edx
jbe 0x2301
movl $0xffffffff, 0x28(%rdi) # imm = 0xFFFFFFFF
retq
// File: /workspace/github_c_makefile_star2_O3/dlbeer[P]dhara/dhara/journal.c
// Function: dhara_journal_enqueue
int dhara_journal_enqueue(struct dhara_journal *j,
			  const uint8_t *data, const uint8_t *meta,
			  dhara_error_t *err)
{
	dhara_error_t my_err;
	int i;

	for (i = 0; i < DHARA_MAX_RETRIES; i++) {
		if (!(prepare_head(j, &my_err) ||
		      (data && dhara_nand_prog(j->nand, j->head, data,
					       &my_err))))
			return push_meta(j, meta, err);

		if (recover_from(j, my_err, err) < 0)
			return -1;
	}

	dhara_set_error(err, DHARA_E_TOO_BAD);
	return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %r15
movl $0x8, %ebp
leaq 0x4(%rsp), %r13
movq %r15, %rdi
movq %r13, %rsi
callq 0x23ca
testl %eax, %eax
jne 0x2382
testq %r12, %r12
je 0x23ad
movq (%r15), %rdi
movl 0x24(%r15), %esi
movq %r12, %rdx
movq %r13, %rcx
callq 0x32ba
testl %eax, %eax
je 0x23ad
movl 0x4(%rsp), %esi
movq %r15, %rdi
movq %rbx, %rdx
callq 0x2658
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %ecx, %ecx
js 0x23bb
decl %ebp
jne 0x2358
testq %rbx, %rbx
je 0x23bb
movl $0x3, (%rbx)
jmp 0x23bb
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x24b9
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/dlbeer[P]dhara/dhara/journal.c
// Function: prepare_head
static int prepare_head(struct dhara_journal *j, dhara_error_t *err)
{
	const dhara_page_t next = next_upage(j, j->head);
	int i;

	/* We can't write if doing so would cause the head pointer to
	 * roll onto the same block as the last-synced tail.
	 */
	if (align_eq(next, j->tail_sync, j->nand->log2_ppb) &&
	    !align_eq(next, j->head, j->nand->log2_ppb)) {
		dhara_set_error(err, DHARA_E_JOURNAL_FULL);
		return -1;
	}

	j->flags |= DHARA_JOURNAL_F_DIRTY;
	if (!is_aligned(j->head, j->nand->log2_ppb))
		return 0;

	for (i = 0; i < DHARA_MAX_RETRIES; i++) {
		const dhara_block_t blk = j->head >> j->nand->log2_ppb;

		if (!dhara_nand_is_bad(j->nand, blk))
			return dhara_nand_erase(j->nand, blk, err);

		j->bb_current++;
		if (skip_block(j, err) < 0)
			return -1;
	}

	dhara_set_error(err, DHARA_E_TOO_BAD);
	return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movl 0x24(%rdi), %esi
movq (%rdi), %rax
movb 0x10(%rdi), %cl
movzbl 0x1(%rax), %edx
movl 0x4(%rax), %r8d
leal 0x1(%rsi), %edi
leal 0x2(%rsi), %eax
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
shll %cl, %r9d
notl %r9d
testl %r9d, %eax
cmovel %eax, %edi
movl %edx, %ecx
shll %cl, %r8d
xorl %eax, %eax
cmpl %r8d, %edi
cmovael %eax, %edi
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
movl 0x1c(%r14), %r9d
xorl %edi, %r9d
shrl %cl, %r9d
testl %r9d, %r9d
je 0x247d
orb $0x1, 0x12(%r14)
movl %edx, %ecx
shll %cl, %r8d
notl %r8d
testl %r8d, %esi
jne 0x2497
movl $0x8, %r15d
movl 0x24(%r14), %ebp
movq (%r14), %rdi
movb 0x1(%rdi), %cl
shrl %cl, %ebp
movl %ebp, %esi
callq 0x319b
testl %eax, %eax
je 0x24a2
incl 0x14(%r14)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x28a8
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %ecx, %ecx
js 0x2497
decl %r15d
jne 0x243a
testq %rbx, %rbx
je 0x2497
movl $0x3, (%rbx)
jmp 0x2497
xorl %esi, %edi
movl %edx, %ecx
shrl %cl, %edi
testl %edi, %edi
je 0x2422
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testq %rbx, %rbx
je 0x2497
movl $0x5, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq (%r14), %rdi
movl %ebp, %esi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x31f9