// File: chhylp123[P]hifiasm/Overlaps.cpp
// Function: dedup_tang_flank(unsigned int*, unsigned int*, unsigned int*, unsigned int*, unsigned int*, unsigned int*)
void dedup_tang_flank(uint32_t *va, uint32_t *vd, uint32_t *vn0, uint32_t *wa, uint32_t *wd, uint32_t *wn0)
{
    uint64_t k, z, vn = (*vn0), wn = (*wn0);
    uint32_t vp, wp;
    for (k = 0; k < vn && k < wn; k++) {
        if(k < vn) {
            vp = va[vn-k-1]>>1;
            for (z = k; (z < wn) && (vp != (wa[z]>>1)); z++);
            if(z < wn) wn = z;
        }
        if(k < wn) {
            wp = wa[k]>>1;
            for (z = k; (z < vn) && (wp != (va[vn-z-1]>>1)); z++);
            if(z < vn) vn = z;
        }
    }
    if(vn < (*vn0)) {
        z = (*vn0) - vn;
        for (k = 0; k < vn; k++) {
            va[k] = va[k + z]; vd[k] = vd[k + z];
        }
    }
    (*vn0) = vn; (*wn0) = wn;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq -0x18(%rbp), %rax
movl (%rax), %eax
movq %rax, -0x48(%rbp)
movq -0x30(%rbp), %rax
movl (%rax), %eax
movq %rax, -0x50(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x38(%rbp), %rcx
xorl %eax, %eax
cmpq -0x48(%rbp), %rcx
movb %al, -0x59(%rbp)
jae 0x12a855
movq -0x38(%rbp), %rax
cmpq -0x50(%rbp), %rax
setb %al
movb %al, -0x59(%rbp)
movb -0x59(%rbp), %al
testb $0x1, %al
jne 0x12a861
jmp 0x12a970
movq -0x38(%rbp), %rax
cmpq -0x48(%rbp), %rax
jae 0x12a8df
movq -0x8(%rbp), %rax
movq -0x48(%rbp), %rcx
subq -0x38(%rbp), %rcx
subq $0x1, %rcx
movl (%rax,%rcx,4), %eax
shrl %eax
movl %eax, -0x54(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rcx
xorl %eax, %eax
cmpq -0x50(%rbp), %rcx
movb %al, -0x5a(%rbp)
jae 0x12a8b2
movl -0x54(%rbp), %eax
movq -0x20(%rbp), %rcx
movq -0x40(%rbp), %rdx
movl (%rcx,%rdx,4), %ecx
shrl %ecx
cmpl %ecx, %eax
setne %al
movb %al, -0x5a(%rbp)
movb -0x5a(%rbp), %al
testb $0x1, %al
jne 0x12a8bb
jmp 0x12a8cb
jmp 0x12a8bd
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x12a88b
movq -0x40(%rbp), %rax
cmpq -0x50(%rbp), %rax
jae 0x12a8dd
movq -0x40(%rbp), %rax
movq %rax, -0x50(%rbp)
jmp 0x12a8df
movq -0x38(%rbp), %rax
cmpq -0x50(%rbp), %rax
jae 0x12a95d
movq -0x20(%rbp), %rax
movq -0x38(%rbp), %rcx
movl (%rax,%rcx,4), %eax
shrl %eax
movl %eax, -0x58(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rcx
xorl %eax, %eax
cmpq -0x48(%rbp), %rcx
movb %al, -0x5b(%rbp)
jae 0x12a930
movl -0x58(%rbp), %eax
movq -0x8(%rbp), %rcx
movq -0x48(%rbp), %rdx
subq -0x40(%rbp), %rdx
subq $0x1, %rdx
movl (%rcx,%rdx,4), %ecx
shrl %ecx
cmpl %ecx, %eax
setne %al
movb %al, -0x5b(%rbp)
movb -0x5b(%rbp), %al
testb $0x1, %al
jne 0x12a939
jmp 0x12a949
jmp 0x12a93b
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x12a901
movq -0x40(%rbp), %rax
cmpq -0x48(%rbp), %rax
jae 0x12a95b
movq -0x40(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x12a95d
jmp 0x12a95f
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x12a838
movq -0x48(%rbp), %rax
movq -0x18(%rbp), %rcx
movl (%rcx), %ecx
cmpq %rcx, %rax
jae 0x12a9e3
movq -0x18(%rbp), %rax
movl (%rax), %eax
subq -0x48(%rbp), %rax
movq %rax, -0x40(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x38(%rbp), %rax
cmpq -0x48(%rbp), %rax
jae 0x12a9e1
movq -0x8(%rbp), %rax
movq -0x38(%rbp), %rcx
addq -0x40(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movq -0x8(%rbp), %rax
movq -0x38(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movq -0x10(%rbp), %rax
movq -0x38(%rbp), %rcx
addq -0x40(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movq -0x10(%rbp), %rax
movq -0x38(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x12a995
jmp 0x12a9e3
movq -0x48(%rbp), %rax
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movq -0x50(%rbp), %rax
movl %eax, %ecx
movq -0x30(%rbp), %rax
movl %ecx, (%rax)
popq %rbp
retq
nopl (%rax)