LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movl %esi, 0x24(%rsp)
movq %rdx, 0x18(%rsp)
movq %rcx, 0x10(%rsp)
movq 0x28(%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0x1bc0
cmpl $0x0, %eax
jge 0x1808
movl $0xffffffff, 0x34(%rsp) # imm = 0xFFFFFFFF
jmp 0x18b1
movq 0x28(%rsp), %rdi
movl 0x24(%rsp), %esi
movq 0x18(%rsp), %rcx
xorl %eax, %eax
movl %eax, %edx
leaq 0xc(%rsp), %r8
callq 0x13a0
cmpl $0x0, %eax
jge 0x188f
cmpl $0x6, 0xc(%rsp)
je 0x1848
movq 0x10(%rsp), %rdi
movl 0xc(%rsp), %esi
callq 0x16c0
movl $0xffffffff, 0x34(%rsp) # imm = 0xFFFFFFFF
jmp 0x18b1
movq 0x28(%rsp), %rax
movl 0x3c(%rax), %eax
movl %eax, 0x8(%rsp)
movq 0x28(%rsp), %rdi
callq 0x12e0
movl %eax, %ecx
movl 0x8(%rsp), %eax
cmpl %ecx, %eax
jb 0x1881
movq 0x10(%rsp), %rdi
movl $0x7, %esi
callq 0x16c0
movl $0xffffffff, 0x34(%rsp) # imm = 0xFFFFFFFF
jmp 0x18b1
movq 0x28(%rsp), %rax
movl 0x3c(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x3c(%rax)
movq 0x28(%rsp), %rdi
callq 0x1290
movq %rax, %rdi
movq 0x28(%rsp), %rax
movl 0x3c(%rax), %esi
callq 0x23f0
movl $0x0, 0x34(%rsp)
movl 0x34(%rsp), %eax
addq $0x38, %rsp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movl %esi, 0x24(%rsp)
movq %rdx, 0x18(%rsp)
movl $0x0, 0x14(%rsp)
cmpl $0x4, 0x24(%rsp)
je 0x18fc
movq 0x18(%rsp), %rdi
movl 0x24(%rsp), %esi
callq 0x16c0
movl $0xffffffff, 0x34(%rsp) # imm = 0xFFFFFFFF
jmp 0x19b0
jmp 0x18fe
movq 0x28(%rsp), %rdi
callq 0x2410
cmpl $0x0, %eax
je 0x19a8
movq 0x28(%rsp), %rdi
callq 0x3bd0
movl %eax, 0x10(%rsp)
cmpl $-0x1, 0x10(%rsp)
jne 0x193b
movq 0x28(%rsp), %rdi
leaq 0xc(%rsp), %rsi
callq 0x1fa0
movl %eax, 0x8(%rsp)
jmp 0x1952
movq 0x28(%rsp), %rdi
movl 0x10(%rsp), %esi
leaq 0xc(%rsp), %rdx
callq 0x2080
movl %eax, 0x8(%rsp)
cmpl $0x0, 0x8(%rsp)
jge 0x19a3
cmpl $0x4, 0xc(%rsp)
je 0x1978
movq 0x18(%rsp), %rdi
movl 0xc(%rsp), %esi
callq 0x16c0
movl $0xffffffff, 0x34(%rsp) # imm = 0xFFFFFFFF
jmp 0x19b0
cmpl $0x8, 0x14(%rsp)
jl 0x1998
movq 0x18(%rsp), %rdi
movl $0x3, %esi
callq 0x16c0
movl $0xffffffff, 0x34(%rsp) # imm = 0xFFFFFFFF
jmp 0x19b0
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0x18fe
movl $0x0, 0x34(%rsp)
movl 0x34(%rsp), %eax
addq $0x38, %rsp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/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:
subq $0xb8, %rsp
movq %rdi, 0xa8(%rsp)
movl %esi, 0xa4(%rsp)
movl %edx, 0xa0(%rsp)
movq %rcx, 0x98(%rsp)
movq 0xa8(%rsp), %rax
movl 0x3c(%rax), %eax
movl %eax, 0x8(%rsp)
movq 0xa8(%rsp), %rdi
movl 0xa0(%rsp), %esi
leaq 0x10(%rsp), %rdx
movq 0x98(%rsp), %rcx
callq 0x17d0
cmpl $0x0, %eax
jge 0x1a27
movl $0xffffffff, 0xb4(%rsp) # imm = 0xFFFFFFFF
jmp 0x1a96
movq 0xa8(%rsp), %rdi
movl 0xa4(%rsp), %esi
leaq 0x10(%rsp), %rdx
leaq 0xc(%rsp), %rcx
callq 0x3b00
cmpl $0x0, %eax
jne 0x1a4c
jmp 0x1a8b
movl 0x8(%rsp), %ecx
movq 0xa8(%rsp), %rax
movl %ecx, 0x3c(%rax)
movq 0xa8(%rsp), %rdi
movl 0xc(%rsp), %esi
movq 0x98(%rsp), %rdx
callq 0x18c0
cmpl $0x0, %eax
jge 0x1a86
movl $0xffffffff, 0xb4(%rsp) # imm = 0xFFFFFFFF
jmp 0x1a96
jmp 0x19e5
movl $0x0, 0xb4(%rsp)
movl 0xb4(%rsp), %eax
addq $0xb8, %rsp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
movl %esi, 0x14(%rsp)
movl %edx, 0x10(%rsp)
movq %rcx, 0x8(%rsp)
movq 0x18(%rsp), %rdi
movl 0x14(%rsp), %esi
movq %rsp, %rdx
leaq 0x4(%rsp), %rcx
callq 0x1360
cmpl $0x0, %eax
jge 0x1b19
cmpl $0x6, 0x4(%rsp)
jne 0x1b01
movq 0x18(%rsp), %rdi
movl 0x10(%rsp), %esi
movq 0x8(%rsp), %rdx
callq 0x1b40
movl %eax, 0x24(%rsp)
jmp 0x1b33
movq 0x8(%rsp), %rdi
movl 0x4(%rsp), %esi
callq 0x16c0
movl $0xffffffff, 0x24(%rsp) # imm = 0xFFFFFFFF
jmp 0x1b33
movq 0x18(%rsp), %rdi
movl (%rsp), %esi
movl 0x10(%rsp), %edx
movq 0x8(%rsp), %rcx
callq 0x19c0
movl %eax, 0x24(%rsp)
movl 0x24(%rsp), %eax
addq $0x28, %rsp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
movl %esi, 0x14(%rsp)
movq %rdx, 0x8(%rsp)
movq 0x18(%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x1bc0
cmpl $0x0, %eax
jge 0x1b70
movl $0xffffffff, 0x24(%rsp) # imm = 0xFFFFFFFF
jmp 0x1bb6
movq 0x18(%rsp), %rdi
movl 0x14(%rsp), %esi
leaq 0x4(%rsp), %rdx
callq 0x1c60
cmpl $0x0, %eax
jne 0x1b8a
jmp 0x1bae
movq 0x18(%rsp), %rdi
movl 0x4(%rsp), %esi
movq 0x8(%rsp), %rdx
callq 0x18c0
cmpl $0x0, %eax
jge 0x1bac
movl $0xffffffff, 0x24(%rsp) # imm = 0xFFFFFFFF
jmp 0x1bb6
jmp 0x1b52
movl $0x0, 0x24(%rsp)
movl 0x24(%rsp), %eax
addq $0x28, %rsp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
movq %rsi, 0x10(%rsp)
movq 0x18(%rsp), %rdi
callq 0x2f20
movl %eax, 0x8(%rsp)
movq 0x18(%rsp), %rdi
callq 0x12e0
movl %eax, %ecx
movl 0x8(%rsp), %eax
cmpl %ecx, %eax
jae 0x1bfa
movl $0x0, 0x24(%rsp)
jmp 0x1c48
movl $0x0, 0xc(%rsp)
movl 0xc(%rsp), %eax
movq 0x18(%rsp), %rcx
movzbl 0x38(%rcx), %ecx
cmpl %ecx, %eax
jg 0x1c40
movq 0x18(%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0x21f0
cmpl $0x0, %eax
jge 0x1c31
movl $0xffffffff, 0x24(%rsp) # imm = 0xFFFFFFFF
jmp 0x1c48
jmp 0x1c33
movl 0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0x1c02
movl $0x0, 0x24(%rsp)
movl 0x24(%rsp), %eax
addq $0x28, %rsp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
movq %rsi, 0x10(%rsp)
movq 0x18(%rsp), %rdi
callq 0x1f80
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x1ee9
jmp 0x1f6b
movq 0x18(%rsp), %rdi
callq 0x3150
movl %eax, 0xc(%rsp)
cmpl $-0x1, 0xc(%rsp)
jne 0x1f13
movq 0x18(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x1fa0
movl %eax, 0x4(%rsp)
jmp 0x1f3d
movq 0x18(%rsp), %rdi
movl 0xc(%rsp), %esi
leaq 0x8(%rsp), %rdx
callq 0x2080
movl %eax, 0x4(%rsp)
cmpl $0x0, 0x4(%rsp)
jne 0x1f3b
movq 0x18(%rsp), %rdi
callq 0x32e0
jmp 0x1f3d
cmpl $0x0, 0x4(%rsp)
jge 0x1f66
movq 0x18(%rsp), %rdi
movl 0x8(%rsp), %esi
movq 0x10(%rsp), %rdx
callq 0x18c0
cmpl $0x0, %eax
jge 0x1f66
movl $0xffffffff, 0x24(%rsp) # imm = 0xFFFFFFFF
jmp 0x1f73
jmp 0x1ece
movl $0x0, 0x24(%rsp)
movl 0x24(%rsp), %eax
addq $0x28, %rsp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/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:
subq $0xa8, %rsp
movq %rdi, 0x98(%rsp)
movq %rsi, 0x90(%rsp)
movq 0x98(%rsp), %rdi
callq 0x22d0
movl %eax, 0x8c(%rsp)
movq 0x98(%rsp), %rdi
callq 0x1290
movq %rax, %rdi
movq 0x98(%rsp), %rax
movl 0x3c(%rax), %esi
callq 0x23f0
cmpl $-0x1, 0x8c(%rsp)
jne 0x201a
movq 0x98(%rsp), %rdi
movq 0x90(%rsp), %rcx
xorl %eax, %eax
movl %eax, %edx
movq %rdx, %rsi
callq 0x34c0
movl %eax, 0xa4(%rsp)
jmp 0x2071
movq 0x98(%rsp), %rdi
movl 0x8c(%rsp), %esi
movq %rsp, %rdx
movq 0x90(%rsp), %rcx
callq 0x2fe0
cmpl $0x0, %eax
jge 0x204b
movl $0xffffffff, 0xa4(%rsp) # imm = 0xFFFFFFFF
jmp 0x2071
movq 0x98(%rsp), %rdi
movl 0x8c(%rsp), %esi
movq %rsp, %rdx
movq 0x90(%rsp), %rcx
callq 0x3b00
movl %eax, 0xa4(%rsp)
movl 0xa4(%rsp), %eax
addq $0xa8, %rsp
retq
// File: /workspace/github_c_makefile_star2_O0/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:
subq $0xb8, %rsp
movq %rdi, 0xa8(%rsp)
movl %esi, 0xa4(%rsp)
movq %rdx, 0x98(%rsp)
movq 0xa8(%rsp), %rdi
movl 0xa4(%rsp), %esi
movq %rsp, %rdx
movq 0x98(%rsp), %rcx
callq 0x2fe0
cmpl $0x0, %eax
jge 0x20d2
movl $0xffffffff, 0xb4(%rsp) # imm = 0xFFFFFFFF
jmp 0x21db
movq %rsp, %rdi
callq 0x2300
movl %eax, 0x94(%rsp)
cmpl $-0x1, 0x94(%rsp)
jne 0x20fb
movl $0x0, 0xb4(%rsp)
jmp 0x21db
movq 0xa8(%rsp), %rdi
movl 0x94(%rsp), %esi
movq %rsp, %rcx
leaq 0x90(%rsp), %rdx
leaq 0x8c(%rsp), %r8
callq 0x13a0
cmpl $0x0, %eax
jge 0x2162
cmpl $0x6, 0x8c(%rsp)
jne 0x2141
movl $0x0, 0xb4(%rsp)
jmp 0x21db
movq 0x98(%rsp), %rdi
movl 0x8c(%rsp), %esi
callq 0x16c0
movl $0xffffffff, 0xb4(%rsp) # imm = 0xFFFFFFFF
jmp 0x21db
movl 0x90(%rsp), %eax
cmpl 0xa4(%rsp), %eax
je 0x217f
movl $0x0, 0xb4(%rsp)
jmp 0x21db
movq 0xa8(%rsp), %rdi
callq 0x1290
movq %rax, %rdi
movq 0xa8(%rsp), %rax
movl 0x3c(%rax), %esi
callq 0x23f0
movq 0xa8(%rsp), %rdi
movl 0xa4(%rsp), %esi
movq %rsp, %rdx
movq 0x98(%rsp), %rcx
callq 0x3b00
cmpl $0x0, %eax
jge 0x21d0
movl $0xffffffff, 0xb4(%rsp) # imm = 0xFFFFFFFF
jmp 0x21db
movl $0x0, 0xb4(%rsp)
movl 0xb4(%rsp), %eax
addq $0xb8, %rsp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
movq %rsi, 0x10(%rsp)
movq 0x18(%rsp), %rax
cmpl $0x0, 0x3c(%rax)
jne 0x2213
movl $0x0, 0x24(%rsp)
jmp 0x227c
jmp 0x2215
movq 0x18(%rsp), %rdi
callq 0x3150
movl %eax, 0xc(%rsp)
cmpl $-0x1, 0xc(%rsp)
jne 0x222c
jmp 0x2274
movq 0x18(%rsp), %rdi
movl 0xc(%rsp), %esi
leaq 0x8(%rsp), %rdx
callq 0x2080
cmpl $0x0, %eax
jne 0x2250
movq 0x18(%rsp), %rdi
callq 0x32e0
jmp 0x2274
movq 0x18(%rsp), %rdi
movl 0x8(%rsp), %esi
movq 0x10(%rsp), %rdx
callq 0x18c0
cmpl $0x0, %eax
jge 0x2272
movl $0xffffffff, 0x24(%rsp) # imm = 0xFFFFFFFF
jmp 0x227c
jmp 0x2215
movl $0x0, 0x24(%rsp)
movl 0x24(%rsp), %eax
addq $0x28, %rsp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]dhara/dhara/bytes.h
// Function: dhara_r32
static inline uint32_t dhara_r32(const uint8_t *data)
{
	return ((uint32_t)data[0]) |
	       (((uint32_t)data[1]) << 8) |
	       (((uint32_t)data[2]) << 16) |
	       (((uint32_t)data[3]) << 24);
}

// Assembly:
movq %rdi, -0x8(%rsp)
movq -0x8(%rsp), %rax
movzbl (%rax), %eax
movq -0x8(%rsp), %rcx
movzbl 0x1(%rcx), %ecx
shll $0x8, %ecx
orl %ecx, %eax
movq -0x8(%rsp), %rcx
movzbl 0x2(%rcx), %ecx
shll $0x10, %ecx
orl %ecx, %eax
movq -0x8(%rsp), %rcx
movzbl 0x3(%rcx), %ecx
shll $0x18, %ecx
orl %ecx, %eax
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]dhara/dhara/bytes.h
// Function: dhara_w32
static inline void dhara_w32(uint8_t *data, uint32_t v)
{
	data[0] = v;
	data[1] = v >> 8;
	data[2] = v >> 16;
	data[3] = v >> 24;
}

// Assembly:
movq %rdi, -0x8(%rsp)
movl %esi, -0xc(%rsp)
movl -0xc(%rsp), %eax
movb %al, %cl
movq -0x8(%rsp), %rax
movb %cl, (%rax)
movl -0xc(%rsp), %eax
shrl $0x8, %eax
movb %al, %cl
movq -0x8(%rsp), %rax
movb %cl, 0x1(%rax)
movl -0xc(%rsp), %eax
shrl $0x10, %eax
movb %al, %cl
movq -0x8(%rsp), %rax
movb %cl, 0x2(%rax)
movl -0xc(%rsp), %eax
shrl $0x18, %eax
movb %al, %cl
movq -0x8(%rsp), %rax
movb %cl, 0x3(%rax)
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movq %rsi, 0x8(%rsp)
movq %rdx, (%rsp)
movq 0x8(%rsp), %rcx
movq 0x10(%rsp), %rax
movq %rcx, (%rax)
movq (%rsp), %rcx
movq 0x10(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x8(%rsp), %rax
movzbl (%rax), %edi
movq 0x8(%rsp), %rax
movzbl 0x1(%rax), %esi
callq 0x2490
movb %al, %cl
movq 0x10(%rsp), %rax
movb %cl, 0x10(%rax)
movq 0x10(%rsp), %rdi
callq 0x2500
addq $0x18, %rsp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]dhara/dhara/journal.c
// Function: choose_ppc
static int choose_ppc(int log2_page_size, int max)
{
	const int max_meta = (1 << log2_page_size) -
		DHARA_HEADER_SIZE - DHARA_COOKIE_SIZE;
	int total_meta = DHARA_META_SIZE;
	int ppc = 1;

	while (ppc < max) {
		total_meta <<= 1;
		total_meta += DHARA_META_SIZE;

		if (total_meta > max_meta)
			break;

		ppc++;
	}

	return ppc;
}

// Assembly:
movl %edi, -0x4(%rsp)
movl %esi, -0x8(%rsp)
movl -0x4(%rsp), %ecx
movl $0x1, %eax
shll %cl, %eax
subl $0x10, %eax
subl $0x4, %eax
movl %eax, -0xc(%rsp)
movl $0x84, -0x10(%rsp)
movl $0x1, -0x14(%rsp)
movl -0x14(%rsp), %eax
cmpl -0x8(%rsp), %eax
jge 0x24f7
movl -0x10(%rsp), %eax
shll %eax
movl %eax, -0x10(%rsp)
movl -0x10(%rsp), %eax
addl $0x84, %eax
movl %eax, -0x10(%rsp)
movl -0x10(%rsp), %eax
cmpl -0xc(%rsp), %eax
jle 0x24ea
jmp 0x24f7
movl -0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rsp)
jmp 0x24bd
movl -0x14(%rsp), %eax
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]dhara/dhara/journal.c
// Function: reset_journal
static void reset_journal(struct dhara_journal *j)
{
	/* We don't yet have a bad block estimate, so make a
	 * conservative guess.
	 */
	j->epoch = 0;
	j->bb_last = j->nand->num_blocks >> 6;
	j->bb_current = 0;

	j->flags = 0;

	/* Empty journal */
	j->head = 0;
	j->tail = 0;
	j->tail_sync = 0;
	j->root = DHARA_PAGE_NONE;

	/* No recovery required */
	clear_recovery(j);

	/* Empty metadata buffer */
	memset(j->page_buf, 0xff, 1 << j->nand->log2_page_size);
}

// Assembly:
pushq %rax
movq %rdi, (%rsp)
movq (%rsp), %rax
movb $0x0, 0x11(%rax)
movq (%rsp), %rax
movq (%rax), %rax
movl 0x4(%rax), %ecx
shrl $0x6, %ecx
movq (%rsp), %rax
movl %ecx, 0x18(%rax)
movq (%rsp), %rax
movl $0x0, 0x14(%rax)
movq (%rsp), %rax
movb $0x0, 0x12(%rax)
movq (%rsp), %rax
movl $0x0, 0x24(%rax)
movq (%rsp), %rax
movl $0x0, 0x20(%rax)
movq (%rsp), %rax
movl $0x0, 0x1c(%rax)
movq (%rsp), %rax
movl $0xffffffff, 0x28(%rax) # imm = 0xFFFFFFFF
movq (%rsp), %rdi
callq 0x2e50
movq (%rsp), %rax
movq 0x8(%rax), %rdi
movq (%rsp), %rax
movq (%rax), %rax
movzbl (%rax), %ecx
movl $0x1, %eax
shll %cl, %eax
movslq %eax, %rdx
movl $0xff, %esi
callq 0x1070
popq %rax
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]dhara/dhara/journal.c
// Function: dhara_journal_resume
int dhara_journal_resume(struct dhara_journal *j, dhara_error_t *err)
{
	dhara_block_t first, last;
	dhara_page_t last_group;

	/* Find the first checkpoint-containing block */
	if (find_checkblock(j, 0, &first, err) < 0) {
		reset_journal(j);
		return -1;
	}

	/* Find the last checkpoint-containing block in this epoch */
	j->epoch = hdr_get_epoch(j->page_buf);
	last = find_last_checkblock(j, first);

	/* Find the last programmed checkpoint group in the block */
	last_group = find_last_group(j, last);

	/* Perform a linear scan to find the last good checkpoint (and
	 * therefore the root).
	 */
	if (find_root(j, last_group, err) < 0) {
		reset_journal(j);
		return -1;
	}

	/* Restore settings from checkpoint */
	j->tail = hdr_get_tail(j->page_buf);
	j->bb_current = hdr_get_bb_current(j->page_buf);
	j->bb_last = hdr_get_bb_last(j->page_buf);
	hdr_clear_user(j->page_buf, j->nand->log2_page_size);

	/* Perform another linear scan to find the next free user page */
	if (find_head(j, last_group, err) < 0) {
		reset_journal(j);
		return -1;
	}

	j->flags = 0;
	j->tail_sync = j->tail;

	clear_recovery(j);
	return 0;
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
movq %rsi, 0x10(%rsp)
movq 0x18(%rsp), %rdi
movq 0x10(%rsp), %rcx
xorl %esi, %esi
leaq 0xc(%rsp), %rdx
callq 0x2710
cmpl $0x0, %eax
jge 0x25e0
movq 0x18(%rsp), %rdi
callq 0x2500
movl $0xffffffff, 0x24(%rsp) # imm = 0xFFFFFFFF
jmp 0x2703
movq 0x18(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x2850
movb %al, %cl
movq 0x18(%rsp), %rax
movb %cl, 0x11(%rax)
movq 0x18(%rsp), %rdi
movl 0xc(%rsp), %esi
callq 0x2860
movl %eax, 0x8(%rsp)
movq 0x18(%rsp), %rdi
movl 0x8(%rsp), %esi
callq 0x2980
movl %eax, 0x4(%rsp)
movq 0x18(%rsp), %rdi
movl 0x4(%rsp), %esi
movq 0x10(%rsp), %rdx
callq 0x2a90
cmpl $0x0, %eax
jge 0x264b
movq 0x18(%rsp), %rdi
callq 0x2500
movl $0xffffffff, 0x24(%rsp) # imm = 0xFFFFFFFF
jmp 0x2703
movq 0x18(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x2be0
movl %eax, %ecx
movq 0x18(%rsp), %rax
movl %ecx, 0x20(%rax)
movq 0x18(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x2c00
movl %eax, %ecx
movq 0x18(%rsp), %rax
movl %ecx, 0x14(%rax)
movq 0x18(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x2c20
movl %eax, %ecx
movq 0x18(%rsp), %rax
movl %ecx, 0x18(%rax)
movq 0x18(%rsp), %rax
movq 0x8(%rax), %rdi
movq 0x18(%rsp), %rax
movq (%rax), %rax
movzbl (%rax), %esi
callq 0x2c40
movq 0x18(%rsp), %rdi
movl 0x4(%rsp), %esi
movq 0x10(%rsp), %rdx
callq 0x2c90
cmpl $0x0, %eax
jge 0x26d8
movq 0x18(%rsp), %rdi
callq 0x2500
movl $0xffffffff, 0x24(%rsp) # imm = 0xFFFFFFFF
jmp 0x2703
movq 0x18(%rsp), %rax
movb $0x0, 0x12(%rax)
movq 0x18(%rsp), %rax
movl 0x20(%rax), %ecx
movq 0x18(%rsp), %rax
movl %ecx, 0x1c(%rax)
movq 0x18(%rsp), %rdi
callq 0x2e50
movl $0x0, 0x24(%rsp)
movl 0x24(%rsp), %eax
addq $0x28, %rsp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movl %esi, 0x24(%rsp)
movq %rdx, 0x18(%rsp)
movq %rcx, 0x10(%rsp)
movl $0x0, 0xc(%rsp)
movl 0x24(%rsp), %ecx
movq 0x28(%rsp), %rax
movq (%rax), %rdx
xorl %eax, %eax
cmpl 0x4(%rdx), %ecx
movb %al, 0x7(%rsp)
jae 0x2752
cmpl $0x8, 0xc(%rsp)
setl %al
movb %al, 0x7(%rsp)
movb 0x7(%rsp), %al
testb $0x1, %al
jne 0x275f
jmp 0x2822
movl 0x24(%rsp), %eax
movq 0x28(%rsp), %rcx
movq (%rcx), %rcx
movzbl 0x1(%rcx), %ecx
shll %cl, %eax
movq 0x28(%rsp), %rcx
movzbl 0x10(%rcx), %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
subl $0x1, %ecx
orl %ecx, %eax
movl %eax, 0x8(%rsp)
movq 0x28(%rsp), %rax
movq (%rax), %rdi
movl 0x24(%rsp), %esi
callq 0x4da0
cmpl $0x0, %eax
jne 0x2807
movq 0x28(%rsp), %rax
movq (%rax), %rdi
movl 0x8(%rsp), %esi
movq 0x28(%rsp), %rax
movq (%rax), %rax
movzbl (%rax), %ecx
movl $0x1, %eax
shll %cl, %eax
movslq %eax, %rcx
movq 0x28(%rsp), %rax
movq 0x8(%rax), %r8
movq 0x10(%rsp), %r9
xorl %eax, %eax
movl %eax, %edx
callq 0x52d0
cmpl $0x0, %eax
jne 0x2807
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x3c90
cmpl $0x0, %eax
je 0x2807
movl 0x24(%rsp), %ecx
movq 0x18(%rsp), %rax
movl %ecx, (%rax)
movl $0x0, 0x34(%rsp)
jmp 0x2839
movl 0x24(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
movl 0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0x272f
movq 0x10(%rsp), %rdi
movl $0x3, %esi
callq 0x3ae0
movl $0xffffffff, 0x34(%rsp) # imm = 0xFFFFFFFF
movl 0x34(%rsp), %eax
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]dhara/dhara/journal.c
// Function: find_last_checkblock
static dhara_block_t find_last_checkblock(struct dhara_journal *j,
					  dhara_block_t first)
{
	dhara_block_t low = first;
	dhara_block_t high = j->nand->num_blocks - 1;

	while (low <= high) {
		const dhara_block_t mid = (low + high) >> 1;
		dhara_block_t found;

		if ((find_checkblock(j, mid, &found, NULL) < 0) ||
		    (hdr_get_epoch(j->page_buf) != j->epoch)) {
			if (!mid)
				return first;

			high = mid - 1;
		} else {
			dhara_block_t nf;

			if (((found + 1) >= j->nand->num_blocks) ||
			    (find_checkblock(j, found + 1,
					     &nf, NULL) < 0) ||
			    (hdr_get_epoch(j->page_buf) != j->epoch))
				return found;

			low = nf;
		}
	}

	return first;
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
movl %esi, 0x14(%rsp)
movl 0x14(%rsp), %eax
movl %eax, 0x10(%rsp)
movq 0x18(%rsp), %rax
movq (%rax), %rax
movl 0x4(%rax), %eax
subl $0x1, %eax
movl %eax, 0xc(%rsp)
movl 0x10(%rsp), %eax
cmpl 0xc(%rsp), %eax
ja 0x2960
movl 0x10(%rsp), %eax
addl 0xc(%rsp), %eax
shrl %eax
movl %eax, 0x8(%rsp)
movq 0x18(%rsp), %rdi
movl 0x8(%rsp), %esi
leaq 0x4(%rsp), %rdx
xorl %eax, %eax
movl %eax, %ecx
callq 0x2710
cmpl $0x0, %eax
jl 0x28dd
movq 0x18(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x2850
movzbl %al, %eax
movq 0x18(%rsp), %rcx
movzbl 0x11(%rcx), %ecx
cmpl %ecx, %eax
je 0x28fb
cmpl $0x0, 0x8(%rsp)
jne 0x28ee
movl 0x14(%rsp), %eax
movl %eax, 0x24(%rsp)
jmp 0x2968
movl 0x8(%rsp), %eax
subl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0x295b
movl 0x4(%rsp), %eax
addl $0x1, %eax
movq 0x18(%rsp), %rcx
movq (%rcx), %rcx
cmpl 0x4(%rcx), %eax
jae 0x294a
movq 0x18(%rsp), %rdi
movl 0x4(%rsp), %esi
addl $0x1, %esi
movq %rsp, %rdx
xorl %eax, %eax
movl %eax, %ecx
callq 0x2710
cmpl $0x0, %eax
jl 0x294a
movq 0x18(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x2850
movzbl %al, %eax
movq 0x18(%rsp), %rcx
movzbl 0x11(%rcx), %ecx
cmpl %ecx, %eax
je 0x2954
movl 0x4(%rsp), %eax
movl %eax, 0x24(%rsp)
jmp 0x2968
movl (%rsp), %eax
movl %eax, 0x10(%rsp)
jmp 0x2887
movl 0x14(%rsp), %eax
movl %eax, 0x24(%rsp)
movl 0x24(%rsp), %eax
addq $0x28, %rsp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]dhara/dhara/journal.c
// Function: find_last_group
static dhara_page_t find_last_group(struct dhara_journal *j,
				    dhara_block_t blk)
{
	const int num_groups = 1 << (j->nand->log2_ppb - j->log2_ppc);
	int low = 0;
	int high = num_groups - 1;

	/* If a checkpoint group is completely unprogrammed, everything
	 * following it will be completely unprogrammed also.
	 *
	 * Therefore, binary search checkpoint groups until we find the
	 * last programmed one.
	 */
	while (low <= high) {
		int mid = (low + high) >> 1;
		const dhara_page_t p = (mid << j->log2_ppc) |
				 (blk << j->nand->log2_ppb);

		if (cp_free(j, p)) {
			high = mid - 1;
		} else if (((mid + 1) >= num_groups) ||
			   cp_free(j, p + (1 << j->log2_ppc))) {
			return p;
		} else {
			low = mid + 1;
		}
	}

	return blk << j->nand->log2_ppb;
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
movl %esi, 0x14(%rsp)
movq 0x18(%rsp), %rax
movq (%rax), %rax
movzbl 0x1(%rax), %ecx
movq 0x18(%rsp), %rax
movzbl 0x10(%rax), %eax
subl %eax, %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, 0x10(%rsp)
movl $0x0, 0xc(%rsp)
movl 0x10(%rsp), %eax
subl $0x1, %eax
movl %eax, 0x8(%rsp)
movl 0xc(%rsp), %eax
cmpl 0x8(%rsp), %eax
jg 0x2a71
movl 0xc(%rsp), %eax
addl 0x8(%rsp), %eax
sarl %eax
movl %eax, 0x4(%rsp)
movl 0x4(%rsp), %eax
movq 0x18(%rsp), %rcx
movzbl 0x10(%rcx), %ecx
shll %cl, %eax
movl 0x14(%rsp), %edx
movq 0x18(%rsp), %rcx
movq (%rcx), %rcx
movzbl 0x1(%rcx), %ecx
shll %cl, %edx
movl %edx, %ecx
orl %ecx, %eax
movl %eax, (%rsp)
movq 0x18(%rsp), %rdi
movl (%rsp), %esi
callq 0x3ce0
cmpl $0x0, %eax
je 0x2a25
movl 0x4(%rsp), %eax
subl $0x1, %eax
movl %eax, 0x8(%rsp)
jmp 0x2a6c
movl 0x4(%rsp), %eax
addl $0x1, %eax
cmpl 0x10(%rsp), %eax
jge 0x2a56
movq 0x18(%rsp), %rdi
movl (%rsp), %esi
movq 0x18(%rsp), %rax
movzbl 0x10(%rax), %ecx
movl $0x1, %eax
shll %cl, %eax
addl %eax, %esi
callq 0x3ce0
cmpl $0x0, %eax
je 0x2a5f
movl (%rsp), %eax
movl %eax, 0x24(%rsp)
jmp 0x2a87
movl 0x4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0x2a6c
jmp 0x29c2
movl 0x14(%rsp), %eax
movq 0x18(%rsp), %rcx
movq (%rcx), %rcx
movzbl 0x1(%rcx), %ecx
shll %cl, %eax
movl %eax, 0x24(%rsp)
movl 0x24(%rsp), %eax
addq $0x28, %rsp
retq
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]dhara/dhara/journal.c
// Function: find_root
static int find_root(struct dhara_journal *j, dhara_page_t start,
		     dhara_error_t *err)
{
	const dhara_block_t blk = start >> j->nand->log2_ppb;
	int i = (start & ((1 << j->nand->log2_ppb) - 1)) >> j->log2_ppc;

	while (i >= 0) {
		const dhara_page_t p = (blk << j->nand->log2_ppb) +
			((i + 1) << j->log2_ppc) - 1;

		if (!dhara_nand_read(j->nand, p,
				     0, 1 << j->nand->log2_page_size,
				     j->page_buf, err) &&
		    (hdr_has_magic(j->page_buf)) &&
		    (hdr_get_epoch(j->page_buf) == j->epoch)) {
			j->root = p - 1;
			return 0;
		}

		i--;
	}

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

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movl %esi, 0x24(%rsp)
movq %rdx, 0x18(%rsp)
movl 0x24(%rsp), %eax
movq 0x28(%rsp), %rcx
movq (%rcx), %rcx
movzbl 0x1(%rcx), %ecx
shrl %cl, %eax
movl %eax, 0x14(%rsp)
movl 0x24(%rsp), %eax
movq 0x28(%rsp), %rcx
movq (%rcx), %rcx
movzbl 0x1(%rcx), %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
subl $0x1, %ecx
andl %ecx, %eax
movq 0x28(%rsp), %rcx
movzbl 0x10(%rcx), %ecx
shrl %cl, %eax
movl %eax, 0x10(%rsp)
cmpl $0x0, 0x10(%rsp)
jl 0x2bb6
movl 0x14(%rsp), %eax
movq 0x28(%rsp), %rcx
movq (%rcx), %rcx
movzbl 0x1(%rcx), %ecx
shll %cl, %eax
movl 0x10(%rsp), %edx
addl $0x1, %edx
movq 0x28(%rsp), %rcx
movzbl 0x10(%rcx), %ecx
shll %cl, %edx
movl %edx, %ecx
addl %ecx, %eax
subl $0x1, %eax
movl %eax, 0xc(%rsp)
movq 0x28(%rsp), %rax
movq (%rax), %rdi
movl 0xc(%rsp), %esi
movq 0x28(%rsp), %rax
movq (%rax), %rax
movzbl (%rax), %ecx
movl $0x1, %eax
shll %cl, %eax
movslq %eax, %rcx
movq 0x28(%rsp), %rax
movq 0x8(%rax), %r8
movq 0x18(%rsp), %r9
xorl %eax, %eax
movl %eax, %edx
callq 0x52d0
cmpl $0x0, %eax
jne 0x2ba6
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x3c90
cmpl $0x0, %eax
je 0x2ba6
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x2850
movzbl %al, %eax
movq 0x28(%rsp), %rcx
movzbl 0x11(%rcx), %ecx
cmpl %ecx, %eax
jne 0x2ba6
movl 0xc(%rsp), %ecx
subl $0x1, %ecx
movq 0x28(%rsp), %rax
movl %ecx, 0x28(%rax)
movl $0x0, 0x34(%rsp)
jmp 0x2bcd
movl 0x10(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x10(%rsp)
jmp 0x2ae5
movq 0x18(%rsp), %rdi
movl $0x3, %esi
callq 0x3ae0
movl $0xffffffff, 0x34(%rsp) # imm = 0xFFFFFFFF
movl 0x34(%rsp), %eax
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]dhara/dhara/journal.c
// Function: clear_recovery
static void clear_recovery(struct dhara_journal *j)
{
	j->recover_next = DHARA_PAGE_NONE;
	j->recover_root = DHARA_PAGE_NONE;
	j->recover_meta = DHARA_PAGE_NONE;
	j->flags &= ~(DHARA_JOURNAL_F_BAD_META |
		      DHARA_JOURNAL_F_RECOVERY |
		      DHARA_JOURNAL_F_ENUM_DONE);
}

// Assembly:
movq %rdi, -0x8(%rsp)
movq -0x8(%rsp), %rax
movl $0xffffffff, 0x2c(%rax) # imm = 0xFFFFFFFF
movq -0x8(%rsp), %rax
movl $0xffffffff, 0x30(%rax) # imm = 0xFFFFFFFF
movq -0x8(%rsp), %rax
movl $0xffffffff, 0x34(%rax) # imm = 0xFFFFFFFF
movq -0x8(%rsp), %rax
movzbl 0x12(%rax), %ecx
andl $-0xf, %ecx
movb %cl, 0x12(%rax)
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]dhara/dhara/journal.c
// Function: dhara_journal_capacity
dhara_page_t dhara_journal_capacity(const struct dhara_journal *j)
{
	const dhara_block_t max_bad = j->bb_last > j->bb_current ?
		j->bb_last : j->bb_current;
	const dhara_block_t good_blocks = j->nand->num_blocks - max_bad - 1;
	const int log2_cpb = j->nand->log2_ppb - j->log2_ppc;
	const dhara_page_t good_cps = good_blocks << log2_cpb;

	/* Good checkpoints * (checkpoint period - 1) */
	return (good_cps << j->log2_ppc) - good_cps;
}

// Assembly:
movq %rdi, -0x8(%rsp)
movq -0x8(%rsp), %rax
movl 0x18(%rax), %eax
movq -0x8(%rsp), %rcx
cmpl 0x14(%rcx), %eax
jbe 0x2eb5
movq -0x8(%rsp), %rax
movl 0x18(%rax), %eax
movl %eax, -0x1c(%rsp)
jmp 0x2ec1
movq -0x8(%rsp), %rax
movl 0x14(%rax), %eax
movl %eax, -0x1c(%rsp)
movl -0x1c(%rsp), %eax
movl %eax, -0xc(%rsp)
movq -0x8(%rsp), %rax
movq (%rax), %rax
movl 0x4(%rax), %eax
subl -0xc(%rsp), %eax
subl $0x1, %eax
movl %eax, -0x10(%rsp)
movq -0x8(%rsp), %rax
movq (%rax), %rax
movzbl 0x1(%rax), %eax
movq -0x8(%rsp), %rcx
movzbl 0x10(%rcx), %ecx
subl %ecx, %eax
movl %eax, -0x14(%rsp)
movl -0x10(%rsp), %eax
movl -0x14(%rsp), %ecx
shll %cl, %eax
movl %eax, -0x18(%rsp)
movl -0x18(%rsp), %eax
movq -0x8(%rsp), %rcx
movzbl 0x10(%rcx), %ecx
shll %cl, %eax
subl -0x18(%rsp), %eax
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]dhara/dhara/journal.c
// Function: dhara_journal_size
dhara_page_t dhara_journal_size(const struct dhara_journal *j)
{
	/* Find the number of raw pages, and the number of checkpoints
	 * between the head and the tail. The difference between the two
	 * is the number of user pages (upper limit).
	 */
	dhara_page_t num_pages = j->head;
	dhara_page_t num_cps = j->head >> j->log2_ppc;

	if (j->head < j->tail_sync) {
		const dhara_page_t total_pages =
			j->nand->num_blocks << j->nand->log2_ppb;

		num_pages += total_pages;
		num_cps += total_pages >> j->log2_ppc;
	}

	num_pages -= j->tail_sync;
	num_cps -= j->tail_sync >> j->log2_ppc;

	return num_pages - num_cps;
}

// Assembly:
movq %rdi, -0x8(%rsp)
movq -0x8(%rsp), %rax
movl 0x24(%rax), %eax
movl %eax, -0xc(%rsp)
movq -0x8(%rsp), %rax
movl 0x24(%rax), %eax
movq -0x8(%rsp), %rcx
movzbl 0x10(%rcx), %ecx
shrl %cl, %eax
movl %eax, -0x10(%rsp)
movq -0x8(%rsp), %rax
movl 0x24(%rax), %eax
movq -0x8(%rsp), %rcx
cmpl 0x1c(%rcx), %eax
jae 0x2f9a
movq -0x8(%rsp), %rax
movq (%rax), %rax
movl 0x4(%rax), %eax
movq -0x8(%rsp), %rcx
movq (%rcx), %rcx
movzbl 0x1(%rcx), %ecx
shll %cl, %eax
movl %eax, -0x14(%rsp)
movl -0x14(%rsp), %eax
addl -0xc(%rsp), %eax
movl %eax, -0xc(%rsp)
movl -0x14(%rsp), %eax
movq -0x8(%rsp), %rcx
movzbl 0x10(%rcx), %ecx
shrl %cl, %eax
addl -0x10(%rsp), %eax
movl %eax, -0x10(%rsp)
movq -0x8(%rsp), %rax
movl 0x1c(%rax), %ecx
movl -0xc(%rsp), %eax
subl %ecx, %eax
movl %eax, -0xc(%rsp)
movq -0x8(%rsp), %rax
movl 0x1c(%rax), %eax
movq -0x8(%rsp), %rcx
movzbl 0x10(%rcx), %ecx
shrl %cl, %eax
movl %eax, %ecx
movl -0x10(%rsp), %eax
subl %ecx, %eax
movl %eax, -0x10(%rsp)
movl -0xc(%rsp), %eax
subl -0x10(%rsp), %eax
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movl %esi, 0x24(%rsp)
movq %rdx, 0x18(%rsp)
movq %rcx, 0x10(%rsp)
movq 0x28(%rsp), %rax
movzbl 0x10(%rax), %ecx
movl $0x1, %eax
shll %cl, %eax
subl $0x1, %eax
movl %eax, 0xc(%rsp)
movl 0x24(%rsp), %eax
andl 0xc(%rsp), %eax
movzbl %al, %edi
callq 0x3100
movq %rax, (%rsp)
movl 0x24(%rsp), %edi
movq 0x28(%rsp), %rax
movl 0x24(%rax), %esi
movq 0x28(%rsp), %rax
movzbl 0x10(%rax), %edx
callq 0x3120
cmpl $0x0, %eax
je 0x306a
movq 0x18(%rsp), %rdi
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rsi
addq (%rsp), %rsi
movl $0x84, %edx
callq 0x10a0
movl $0x0, 0x34(%rsp)
jmp 0x30ee
movq 0x28(%rsp), %rax
cmpl $-0x1, 0x34(%rax)
je 0x30c2
movl 0x24(%rsp), %edi
movq 0x28(%rsp), %rax
movl 0x30(%rax), %esi
movq 0x28(%rsp), %rax
movzbl 0x10(%rax), %edx
callq 0x3120
cmpl $0x0, %eax
je 0x30c2
movq 0x28(%rsp), %rax
movq (%rax), %rdi
movq 0x28(%rsp), %rax
movl 0x34(%rax), %esi
movq (%rsp), %rdx
movq 0x18(%rsp), %r8
movq 0x10(%rsp), %r9
movl $0x84, %ecx
callq 0x52d0
movl %eax, 0x34(%rsp)
jmp 0x30ee
movq 0x28(%rsp), %rax
movq (%rax), %rdi
movl 0x24(%rsp), %esi
orl 0xc(%rsp), %esi
movq (%rsp), %rdx
movq 0x18(%rsp), %r8
movq 0x10(%rsp), %r9
movl $0x84, %ecx
callq 0x52d0
movl %eax, 0x34(%rsp)
movl 0x34(%rsp), %eax
addq $0x38, %rsp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x18, %rsp
movq %rdi, 0x8(%rsp)
movq 0x8(%rsp), %rax
movl 0x24(%rax), %eax
movq 0x8(%rsp), %rcx
cmpl 0x20(%rcx), %eax
jne 0x3178
movl $0xffffffff, 0x14(%rsp) # imm = 0xFFFFFFFF
jmp 0x3274
movq 0x8(%rsp), %rax
movl 0x20(%rax), %edi
movq 0x8(%rsp), %rax
movq (%rax), %rax
movzbl 0x1(%rax), %esi
callq 0x3280
cmpl $0x0, %eax
je 0x3268
movq 0x8(%rsp), %rax
movl 0x20(%rax), %eax
movq 0x8(%rsp), %rcx
movq (%rcx), %rcx
movzbl 0x1(%rcx), %ecx
shrl %cl, %eax
movl %eax, 0x4(%rsp)
movl $0x0, (%rsp)
cmpl $0x8, (%rsp)
jge 0x3266
movl 0x4(%rsp), %eax
movq 0x8(%rsp), %rcx
movl 0x24(%rcx), %edx
movq 0x8(%rsp), %rcx
movq (%rcx), %rcx
movzbl 0x1(%rcx), %ecx
shrl %cl, %edx
movl %edx, %ecx
cmpl %ecx, %eax
je 0x31fb
movq 0x8(%rsp), %rax
movq (%rax), %rdi
movl 0x4(%rsp), %esi
callq 0x4da0
cmpl $0x0, %eax
jne 0x3243
movl 0x4(%rsp), %eax
movq 0x8(%rsp), %rcx
movq (%rcx), %rcx
movzbl 0x1(%rcx), %ecx
shll %cl, %eax
movl %eax, %ecx
movq 0x8(%rsp), %rax
movl %ecx, 0x20(%rax)
movq 0x8(%rsp), %rax
movl 0x20(%rax), %eax
movq 0x8(%rsp), %rcx
cmpl 0x24(%rcx), %eax
jne 0x3235
movq 0x8(%rsp), %rax
movl $0xffffffff, 0x28(%rax) # imm = 0xFFFFFFFF
movq 0x8(%rsp), %rax
movl 0x20(%rax), %eax
movl %eax, 0x14(%rsp)
jmp 0x3274
movq 0x8(%rsp), %rax
movq (%rax), %rdi
movl 0x4(%rsp), %esi
callq 0x32b0
movl %eax, 0x4(%rsp)
movl (%rsp), %eax
addl $0x1, %eax
movl %eax, (%rsp)
jmp 0x31bb
jmp 0x3268
movq 0x8(%rsp), %rax
movl 0x20(%rax), %eax
movl %eax, 0x14(%rsp)
movl 0x14(%rsp), %eax
addq $0x18, %rsp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]dhara/dhara/journal.c
// Function: next_block
static dhara_block_t next_block(const struct dhara_nand *n, dhara_block_t blk)
{
	blk++;
	if (blk >= n->num_blocks)
		blk = 0;

	return blk;
}

// Assembly:
movq %rdi, -0x8(%rsp)
movl %esi, -0xc(%rsp)
movl -0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rsp)
movl -0xc(%rsp), %eax
movq -0x8(%rsp), %rcx
cmpl 0x4(%rcx), %eax
jb 0x32da
movl $0x0, -0xc(%rsp)
movl -0xc(%rsp), %eax
retq
nop
// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movq 0x10(%rsp), %rax
movl 0x24(%rax), %eax
movq 0x10(%rsp), %rcx
cmpl 0x20(%rcx), %eax
jne 0x3300
jmp 0x33b2
movq 0x10(%rsp), %rdi
movq 0x10(%rsp), %rax
movl 0x20(%rax), %esi
callq 0x33c0
movl %eax, %ecx
movq 0x10(%rsp), %rax
movl %ecx, 0x20(%rax)
movq 0x10(%rsp), %rax
movzbl 0x12(%rax), %eax
andl $0x5, %eax
cmpl $0x0, %eax
jne 0x333d
movq 0x10(%rsp), %rax
movl 0x20(%rax), %ecx
movq 0x10(%rsp), %rax
movl %ecx, 0x1c(%rax)
movq 0x10(%rsp), %rax
movq (%rax), %rax
movl 0x4(%rax), %eax
movq 0x10(%rsp), %rcx
movq (%rcx), %rcx
movzbl 0x1(%rcx), %ecx
shll %cl, %eax
movl %eax, 0xc(%rsp)
movq 0x10(%rsp), %rax
movl 0x24(%rax), %edi
addl 0xc(%rsp), %edi
movq 0x10(%rsp), %rax
subl 0x20(%rax), %edi
movl 0xc(%rsp), %esi
callq 0x3440
movl %eax, 0x8(%rsp)
movq 0x10(%rsp), %rax
movl 0x24(%rax), %edi
addl 0xc(%rsp), %edi
movq 0x10(%rsp), %rax
subl 0x28(%rax), %edi
movl 0xc(%rsp), %esi
callq 0x3440
movl %eax, 0x4(%rsp)
movl 0x4(%rsp), %eax
cmpl 0x8(%rsp), %eax
jbe 0x33b2
movq 0x10(%rsp), %rax
movl $0xffffffff, 0x28(%rax) # imm = 0xFFFFFFFF
addq $0x18, %rsp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]dhara/dhara/journal.c
// Function: next_upage
static dhara_page_t next_upage(const struct dhara_journal *j,
			       dhara_page_t p)
{
	p++;
	if (is_aligned(p + 1, j->log2_ppc))
		p++;

	if (p >= (j->nand->num_blocks << j->nand->log2_ppb))
		p = 0;

	return p;
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movl %esi, 0xc(%rsp)
movl 0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
movl 0xc(%rsp), %edi
addl $0x1, %edi
movq 0x10(%rsp), %rax
movzbl 0x10(%rax), %esi
callq 0x3280
cmpl $0x0, %eax
je 0x33fd
movl 0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
movl 0xc(%rsp), %eax
movq 0x10(%rsp), %rcx
movq (%rcx), %rcx
movl 0x4(%rcx), %edx
movq 0x10(%rsp), %rcx
movq (%rcx), %rcx
movzbl 0x1(%rcx), %ecx
shll %cl, %edx
movl %edx, %ecx
cmpl %ecx, %eax
jb 0x3428
movl $0x0, 0xc(%rsp)
movl 0xc(%rsp), %eax
addq $0x18, %rsp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]dhara/dhara/journal.c
// Function: dhara_journal_clear
void dhara_journal_clear(struct dhara_journal *j)
{
	j->tail = j->head;
	j->root = DHARA_PAGE_NONE;
	j->flags |= DHARA_JOURNAL_F_DIRTY;

	hdr_clear_user(j->page_buf, j->nand->log2_page_size);
}

// Assembly:
pushq %rax
movq %rdi, (%rsp)
movq (%rsp), %rax
movl 0x24(%rax), %ecx
movq (%rsp), %rax
movl %ecx, 0x20(%rax)
movq (%rsp), %rax
movl $0xffffffff, 0x28(%rax) # imm = 0xFFFFFFFF
movq (%rsp), %rax
movzbl 0x12(%rax), %ecx
orl $0x1, %ecx
movb %cl, 0x12(%rax)
movq (%rsp), %rax
movq 0x8(%rax), %rdi
movq (%rsp), %rax
movq (%rax), %rax
movzbl (%rax), %esi
callq 0x2c40
popq %rax
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movq %rsi, 0x20(%rsp)
movq %rdx, 0x18(%rsp)
movq %rcx, 0x10(%rsp)
movl $0x0, 0x8(%rsp)
cmpl $0x8, 0x8(%rsp)
jge 0x3579
movq 0x28(%rsp), %rdi
leaq 0xc(%rsp), %rsi
callq 0x35a0
cmpl $0x0, %eax
jne 0x3545
cmpq $0x0, 0x20(%rsp)
je 0x352b
movq 0x28(%rsp), %rax
movq (%rax), %rdi
movq 0x28(%rsp), %rax
movl 0x24(%rax), %esi
movq 0x20(%rsp), %rdx
leaq 0xc(%rsp), %rcx
callq 0x5050
cmpl $0x0, %eax
jne 0x3545
movq 0x28(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq 0x10(%rsp), %rdx
callq 0x3720
movl %eax, 0x34(%rsp)
jmp 0x3590
movq 0x28(%rsp), %rdi
movl 0xc(%rsp), %esi
movq 0x10(%rsp), %rdx
callq 0x3940
cmpl $0x0, %eax
jge 0x3567
movl $0xffffffff, 0x34(%rsp) # imm = 0xFFFFFFFF
jmp 0x3590
jmp 0x3569
movl 0x8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x8(%rsp)
jmp 0x34e0
movq 0x10(%rsp), %rdi
movl $0x3, %esi
callq 0x3ae0
movl $0xffffffff, 0x34(%rsp) # imm = 0xFFFFFFFF
movl 0x34(%rsp), %eax
addq $0x38, %rsp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
movq %rsi, 0x10(%rsp)
movq 0x18(%rsp), %rdi
movq 0x18(%rsp), %rax
movl 0x24(%rax), %esi
callq 0x33c0
movl %eax, 0xc(%rsp)
movl 0xc(%rsp), %edi
movq 0x18(%rsp), %rax
movl 0x1c(%rax), %esi
movq 0x18(%rsp), %rax
movq (%rax), %rax
movzbl 0x1(%rax), %edx
callq 0x3120
cmpl $0x0, %eax
je 0x3624
movl 0xc(%rsp), %edi
movq 0x18(%rsp), %rax
movl 0x24(%rax), %esi
movq 0x18(%rsp), %rax
movq (%rax), %rax
movzbl 0x1(%rax), %edx
callq 0x3120
cmpl $0x0, %eax
jne 0x3624
movq 0x10(%rsp), %rdi
movl $0x5, %esi
callq 0x3ae0
movl $0xffffffff, 0x24(%rsp) # imm = 0xFFFFFFFF
jmp 0x3712
movq 0x18(%rsp), %rax
movzbl 0x12(%rax), %ecx
orl $0x1, %ecx
movb %cl, 0x12(%rax)
movq 0x18(%rsp), %rax
movl 0x24(%rax), %edi
movq 0x18(%rsp), %rax
movq (%rax), %rax
movzbl 0x1(%rax), %esi
callq 0x3280
cmpl $0x0, %eax
jne 0x365e
movl $0x0, 0x24(%rsp)
jmp 0x3712
movl $0x0, 0x8(%rsp)
cmpl $0x8, 0x8(%rsp)
jge 0x36fb
movq 0x18(%rsp), %rax
movl 0x24(%rax), %eax
movq 0x18(%rsp), %rcx
movq (%rcx), %rcx
movzbl 0x1(%rcx), %ecx
shrl %cl, %eax
movl %eax, 0x4(%rsp)
movq 0x18(%rsp), %rax
movq (%rax), %rdi
movl 0x4(%rsp), %esi
callq 0x4da0
cmpl $0x0, %eax
jne 0x36bd
movq 0x18(%rsp), %rax
movq (%rax), %rdi
movl 0x4(%rsp), %esi
movq 0x10(%rsp), %rdx
callq 0x4e80
movl %eax, 0x24(%rsp)
jmp 0x3712
movq 0x18(%rsp), %rax
movl 0x14(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x14(%rax)
movq 0x18(%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0x3dd0
cmpl $0x0, %eax
jge 0x36e9
movl $0xffffffff, 0x24(%rsp) # imm = 0xFFFFFFFF
jmp 0x3712
jmp 0x36eb
movl 0x8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x8(%rsp)
jmp 0x3666
movq 0x10(%rsp), %rdi
movl $0x3, %esi
callq 0x3ae0
movl $0xffffffff, 0x24(%rsp) # imm = 0xFFFFFFFF
movl 0x24(%rsp), %eax
addq $0x28, %rsp
retq
nopl (%rax,%rax)