// File: /workspace/github_c_makefile_star2_O0/lh3[P]fermi2/correct.c
// Function: fmc_cns_ungap
int fmc_cns_ungap(ecseq_t *s1, const ecseq_t *s2)
{
	int i, n = 0;
	assert(s1->n == s2->n);
	for (i = 0; i < s1->n; ++i) {
		ecbase_t *b1 = &s1->a[i];
		const ecbase_t *b2 = &s2->a[i];
		if (b2->state == STATE_N) continue;
		if (b1->state == STATE_N) {
			*b1 = *b2;
		} else if (b1->b == b2->b) { // same correction in both directions
			b1->f = b1->f > b2->f? b1->f : b2->f;
			b1->min_diff = b1->min_diff > b2->min_diff? b1->min_diff : b2->min_diff;
		} else { // conflicting correction; don't make a correction
			b1->f = 0; b1->min_diff = 0;
			b1->b = b1->ob; b1->q = b1->oq;
			++n;
		}
	}
	return n;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq -0x10(%rbp), %rcx
cmpq (%rcx), %rax
jne 0xafd9
jmp 0xaff8
leaq 0x21677(%rip), %rdi     # 0x2c657
leaq 0x21514(%rip), %rsi     # 0x2c4fb
movl $0x354, %edx            # imm = 0x354
leaq 0x21673(%rip), %rcx     # 0x2c666
callq 0x2140
movl $0x0, -0x14(%rbp)
movslq -0x14(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq (%rcx), %rax
jae 0xb1c1
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x14(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x14(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movw (%rax), %ax
shrw $0x4, %ax
andw $0xf, %ax
movzbl %al, %eax
cmpl $0x0, %eax
jne 0xb05a
jmp 0xb1b3
movq -0x20(%rbp), %rax
movw (%rax), %ax
shrw $0x4, %ax
andw $0xf, %ax
movzbl %al, %eax
cmpl $0x0, %eax
jne 0xb08a
movq -0x20(%rbp), %rax
movq -0x28(%rbp), %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movl 0x8(%rcx), %ecx
movl %ecx, 0x8(%rax)
jmp 0xb1b1
movq -0x20(%rbp), %rax
movw (%rax), %ax
andw $0xf, %ax
movzbl %al, %eax
movq -0x28(%rbp), %rcx
movw (%rcx), %cx
andw $0xf, %cx
movzbl %cl, %ecx
cmpl %ecx, %eax
jne 0xb151
movq -0x20(%rbp), %rax
movw (%rax), %ax
shrw $0xc, %ax
movzbl %al, %eax
movq -0x28(%rbp), %rcx
movw (%rcx), %cx
shrw $0xc, %cx
movzbl %cl, %ecx
cmpl %ecx, %eax
jle 0xb0e1
movq -0x20(%rbp), %rax
movw (%rax), %ax
shrw $0xc, %ax
movzbl %al, %eax
movl %eax, -0x2c(%rbp)
jmp 0xb0f2
movq -0x28(%rbp), %rax
movw (%rax), %ax
shrw $0xc, %ax
movzbl %al, %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movb %al, %cl
movq -0x20(%rbp), %rax
movzbl %cl, %ecx
movw %cx, %dx
movw (%rax), %cx
andw $0xf, %dx
shlw $0xc, %dx
andw $0xfff, %cx             # imm = 0xFFF
orw %dx, %cx
movw %cx, (%rax)
movq -0x20(%rbp), %rax
movzbl 0x4(%rax), %eax
movq -0x28(%rbp), %rcx
movzbl 0x4(%rcx), %ecx
cmpl %ecx, %eax
jle 0xb138
movq -0x20(%rbp), %rax
movzbl 0x4(%rax), %eax
movl %eax, -0x30(%rbp)
jmp 0xb143
movq -0x28(%rbp), %rax
movzbl 0x4(%rax), %eax
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %eax
movb %al, %cl
movq -0x20(%rbp), %rax
movb %cl, 0x4(%rax)
jmp 0xb1af
movq -0x20(%rbp), %rax
movw (%rax), %cx
andw $0xfff, %cx             # imm = 0xFFF
orw $0x0, %cx
movw %cx, (%rax)
movq -0x20(%rbp), %rax
movb $0x0, 0x4(%rax)
movq -0x20(%rbp), %rax
movw (%rax), %ax
shrw $0x8, %ax
andw $0xf, %ax
movb %al, %cl
movq -0x20(%rbp), %rax
movzbl %cl, %ecx
movw %cx, %dx
movw (%rax), %cx
andw $0xf, %dx
andw $-0x10, %cx
orw %dx, %cx
movw %cx, (%rax)
movq -0x20(%rbp), %rax
movb 0x3(%rax), %cl
movq -0x20(%rbp), %rax
movb %cl, 0x2(%rax)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0xb1b1
jmp 0xb1b3
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xafff
movl -0x18(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)