// File: /workspace/github_c_makefile_star2_O2/dlbeer[P]dhara/dhara/journal.c
// Function: push_meta
static int push_meta(struct dhara_journal *j, const uint8_t *meta,
		     dhara_error_t *err)
{
	const dhara_page_t old_head = j->head;
	dhara_error_t my_err;
	const size_t offset =
		hdr_user_offset(j->head & ((1 << j->log2_ppc) - 1));

	/* We've just written a user page. Add the metadata to the
	 * buffer.
	 */
	if (meta)
		memcpy(j->page_buf + offset, meta, DHARA_META_SIZE);
	else
		memset(j->page_buf + offset, 0xff, DHARA_META_SIZE);

	/* Unless we've filled the buffer, don't do any IO */
	if (!is_aligned(j->head + 2, j->log2_ppc)) {
		j->root = j->head;
		j->head++;
		return 0;
	}

	/* We don't need to check for immediate recover, because that'll
	 * never happen -- we're not block-aligned.
	 */
	hdr_put_magic(j->page_buf);
	hdr_set_epoch(j->page_buf, j->epoch);
	hdr_set_tail(j->page_buf, j->tail);
	hdr_set_bb_current(j->page_buf, j->bb_current);
	hdr_set_bb_last(j->page_buf, j->bb_last);

	if (dhara_nand_prog(j->nand, j->head + 1, j->page_buf, &my_err) < 0)
		return recover_from(j, my_err, err);

	j->flags &= ~DHARA_JOURNAL_F_DIRTY;

	j->root = old_head;
	j->head = next_upage(j, j->head);

	if (!j->head)
		roll_stats(j);

	if (j->flags & DHARA_JOURNAL_F_ENUM_DONE)
		finish_recovery(j);

	if (!(j->flags & DHARA_JOURNAL_F_RECOVERY))
		j->tail_sync = j->tail;

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rdi, %rbx
movb 0x10(%rdi), %cl
pushq $-0x1
popq %r15
movl %r15d, %eax
shll %cl, %eax
movl 0x24(%rdi), %ebp
notl %eax
andl %ebp, %eax
movzbl %al, %eax
imull $0x84, %eax, %eax
movq 0x8(%rdi), %rcx
leaq (%rcx,%rax), %rdi
addq $0x14, %rdi
movl $0x84, %edx
testq %rsi, %rsi
je 0x224a
callq 0x10c0
jmp 0x2254
movl $0xff, %esi
callq 0x1090
movl 0x24(%rbx), %eax
movb 0x10(%rbx), %cl
shll %cl, %r15d
movl $0x7ffffffd, %ecx       # imm = 0x7FFFFFFD
subl %eax, %ecx
orl %r15d, %ecx
cmpl $-0x1, %ecx
je 0x2281
movl %eax, 0x28(%rbx)
incl %eax
movl %eax, 0x24(%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%rbx), %rax
movw $0x6844, (%rax)         # imm = 0x6844
movb $0x61, 0x2(%rax)
movq 0x8(%rbx), %rax
movb 0x11(%rbx), %cl
movb %cl, 0x3(%rax)
movq 0x8(%rbx), %rax
movl 0x20(%rbx), %ecx
movl %ecx, 0x4(%rax)
movq 0x8(%rbx), %rax
movl 0x14(%rbx), %ecx
movl %ecx, 0x8(%rax)
movq 0x8(%rbx), %rax
movl 0x18(%rbx), %ecx
movl %ecx, 0xc(%rax)
movl 0x24(%rbx), %esi
incl %esi
movq (%rbx), %rdi
movq 0x8(%rbx), %rdx
leaq 0x4(%rsp), %rcx
callq 0x2f9d
testl %eax, %eax
js 0x2361
movb 0x12(%rbx), %r15b
movl %r15d, %r14d
andb $-0x2, %r14b
movb %r14b, 0x12(%rbx)
movl %ebp, 0x28(%rbx)
movl 0x24(%rbx), %esi
movq %rbx, %rdi
callq 0x2053
movl %eax, 0x24(%rbx)
testl %eax, %eax
jne 0x2305
movl 0x14(%rbx), %eax
movl %eax, 0x18(%rbx)
andl $0x0, 0x14(%rbx)
incb 0x11(%rbx)
testb $0x8, %r15b
je 0x234a
movq (%rbx), %rdi
movl 0x30(%rbx), %esi
movb 0x1(%rdi), %cl
shrl %cl, %esi
callq 0x2e52
movb 0x12(%rbx), %r14b
testb $0x2, %r14b
je 0x2339
movq (%rbx), %rdi
movl 0x34(%rbx), %esi
movb 0x1(%rdi), %cl
shrl %cl, %esi
callq 0x2e52
movb 0x12(%rbx), %r14b
orq $-0x1, 0x2c(%rbx)
orl $-0x1, 0x34(%rbx)
andb $-0xf, %r14b
movb %r14b, 0x12(%rbx)
xorl %eax, %eax
testb $0x4, %r14b
jne 0x2276
movl 0x20(%rbx), %ecx
movl %ecx, 0x1c(%rbx)
jmp 0x2276
movl 0x4(%rsp), %esi
movq %rbx, %rdi
movq %r14, %rdx
callq 0x2375
jmp 0x2276