// File: /workspace/github_c_makefile_star2_O3/lh3[P]fermi-lite/bfc.c
// Function: buf_update
static void buf_update(bfc_ec1buf_t *e, const echeap1_t *prev, bfc_penalty_t pen, int cnt)
{
	ecstack1_t *q;
	echeap1_t *r;
	const bfc_opt_t *o = e->opt;
	int b = pen.b;
	// update stack
	kv_pushp(ecstack1_t, e->stack, &q);
	q->parent = prev->k;
	q->i = prev->i;
	q->b = b;
	q->pen = pen;
	q->cnt = cnt > 0? cnt&0xff : 0;
	q->tot_pen = prev->tot_pen + weighted_penalty(o, pen);
	// update heap
	kv_pushp(echeap1_t, e->heap, &r);
	r->i = prev->i + 1;
	r->k = e->stack.n - 1;
	r->x = prev->x;
	if (pen.ec_high) {
		memcpy(r->ecpos_high + 1, prev->ecpos_high, (BFC_EC_HIST_HIGH - 1) * 4);
		r->ecpos_high[0] = prev->i;
	} else memcpy(r->ecpos_high, prev->ecpos_high, BFC_EC_HIST_HIGH * 4);
	if (pen.ec) {
		memcpy(r->ecpos + 1, prev->ecpos, (BFC_EC_HIST - 1) * 4);
		r->ecpos[0] = prev->i;
	} else memcpy(r->ecpos, prev->ecpos, BFC_EC_HIST * 4);
	r->tot_pen = q->tot_pen;
	bfc_kmer_append(e->opt->k, r->x.x, b);
	ks_heapup_ec(e->heap.n, e->heap.a);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
movq (%rdi), %r8
movq 0x28(%rdi), %r13
movl %ebp, %esi
shrb $0x4, %sil
cmpq 0x30(%rdi), %r13
jne 0x774e
leaq (,%r13,2), %rax
testq %r13, %r13
movl %esi, %r15d
movl $0x2, %esi
cmovneq %rax, %rsi
movq %rsi, 0x30(%rbx)
movq 0x38(%rbx), %rdi
shlq $0x4, %rsi
movq %r8, %r12
movl %ecx, %r13d
callq 0x21c0
movl %r13d, %ecx
movq %r12, %r8
movl %r15d, %esi
movq %rax, %r15
movq %rax, 0x38(%rbx)
movq 0x28(%rbx), %r13
jmp 0x7752
movq 0x38(%rbx), %r15
leaq 0x1(%r13), %rax
movq %rax, 0x28(%rbx)
shlq $0x4, %r13
movq 0x4(%r14), %xmm0
pshufd $0xe1, %xmm0, %xmm0     # xmm0 = xmm0[1,0,2,3]
movq %xmm0, (%r15,%r13)
movb %sil, 0xc(%r15,%r13)
movb %bpl, 0xd(%r15,%r13)
xorl %eax, %eax
testl %ecx, %ecx
movzbl %cl, %ecx
cmovlel %eax, %ecx
movw %cx, 0xe(%r15,%r13)
movl %ebp, %edi
andb $0x1, %dil
movzbl %dil, %eax
imull 0x20(%r8), %eax
movl %ebp, %r12d
shrb %r12b
andb $0x1, %r12b
movzbl %r12b, %ecx
imull 0x24(%r8), %ecx
movl %ebp, %edx
shrb $0x2, %dl
andb $0x1, %dl
movzbl %dl, %edx
imull 0x28(%r8), %edx
addl %ecx, %edx
shrb $0x3, %bpl
andb $0x1, %bpl
movzbl %bpl, %ecx
imull 0x2c(%r8), %ecx
addl (%r14), %eax
addl %edx, %eax
addl %ecx, %eax
movl %eax, 0x8(%r15,%r13)
movq 0x10(%rbx), %rcx
cmpq 0x18(%rbx), %rcx
jne 0x7821
leaq (%rcx,%rcx), %rax
testq %rcx, %rcx
movl $0x2, %ecx
cmovneq %rax, %rcx
movq %rcx, 0x18(%rbx)
movb %dil, 0x7(%rsp)
movq 0x20(%rbx), %rdi
shlq $0x3, %rcx
movl %esi, %ebp
leaq (%rcx,%rcx,8), %rsi
callq 0x21c0
movb 0x7(%rsp), %dil
movl %ebp, %esi
movq %rax, 0x20(%rbx)
movq 0x10(%rbx), %rcx
jmp 0x7825
movq 0x20(%rbx), %rax
leaq 0x1(%rcx), %rdx
movq %rdx, 0x10(%rbx)
leaq (%rcx,%rcx,8), %rcx
leaq (%rax,%rcx,8), %rax
movl 0x4(%r14), %ecx
incl %ecx
movl %ecx, 0x4(%rax)
movl 0x28(%rbx), %ecx
decl %ecx
movl %ecx, 0x8(%rax)
movups 0x28(%r14), %xmm0
movups 0x38(%r14), %xmm1
movups %xmm0, 0x28(%rax)
movups %xmm1, 0x38(%rax)
testb %r12b, %r12b
jne 0x7867
movq 0xc(%r14), %rcx
movq %rcx, 0xc(%rax)
jmp 0x7875
movl 0xc(%r14), %ecx
movl %ecx, 0x10(%rax)
movl 0x4(%r14), %ecx
movl %ecx, 0xc(%rax)
addq %r13, %r15
testb %dil, %dil
jne 0x7892
leaq 0x14(%rax), %rcx
movl 0x24(%r14), %edx
movl %edx, 0x10(%rcx)
movups 0x14(%r14), %xmm0
movups %xmm0, (%rcx)
jmp 0x78a2
movups 0x14(%r14), %xmm0
movups %xmm0, 0x18(%rax)
movl 0x4(%r14), %ecx
movl %ecx, 0x14(%rax)
movzbl %sil, %edx
movl 0x8(%r15), %ecx
movl %ecx, (%rax)
movq (%rbx), %rcx
movb 0x8(%rcx), %cl
movq $-0x1, %rdi
shlq %cl, %rdi
notq %rdi
movl %edx, %esi
andl $0x1, %esi
movq 0x28(%rax), %r8
movq 0x30(%rax), %r9
leaq (%rsi,%r8,2), %r8
andq %rdi, %r8
movq %r8, 0x28(%rax)
addq %r9, %r9
shrl %edx
orq %rdx, %r9
andq %rdi, %r9
movq %r9, 0x30(%rax)
movq 0x38(%rax), %rdi
xorq $0x1, %rsi
decb %cl
shlq %cl, %rsi
shrq %rdi
orq %rdi, %rsi
movq %rsi, 0x38(%rax)
xorq $0x1, %rdx
shlq %cl, %rdx
movq 0x40(%rax), %rcx
shrq %rcx
orq %rcx, %rdx
movq %rdx, 0x40(%rax)
movq 0x10(%rbx), %rdi
movq 0x20(%rbx), %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5614
nopl (%rax)