// File: chhylp123[P]hifiasm/Overlaps.cpp
// Function: update_ma_hit_t_norm(void*, long, int)
static void update_ma_hit_t_norm(void *data, long i, int tid) // callback for kt_for()
{
	ma_hit_t_aux *sl = (ma_hit_t_aux *)data;
	ma_hit_t_alloc* src = sl->src;
	uint64_t z, qn, tn, is_del = 0; 
    int64_t idx, qLen_0, qLen_1;

    for (z = 0; z < src[i].length; z++) {
        qn = Get_qn(src[i].buffer[z]);
        tn = Get_tn(src[i].buffer[z]);
        is_del = 0; idx = get_specific_overlap(&(src[tn]), tn, qn);

        if(idx != -1 && qn <= tn) { ///qn must be not equal to tn
            if(src[i].buffer[z].del || src[tn].buffer[idx].del) is_del = 1;
            qLen_0 = Get_qe(src[i].buffer[z]) - Get_qs(src[i].buffer[z]);
            qLen_1 = Get_qe(src[tn].buffer[idx]) - Get_qs(src[tn].buffer[idx]);

            if(qLen_0 == qLen_1) {
                ///qn must be not equal to tn
                ///make sources[qn] = sources[tn] if qn > tn
                set_reverse_overlap(&(src[tn].buffer[idx]), &(src[i].buffer[z]));
            }
            else if(qLen_0 > qLen_1) {
                set_reverse_overlap(&(src[tn].buffer[idx]), &(src[i].buffer[z]));
            } else {
                set_reverse_overlap(&(src[i].buffer[z]), &(src[tn].buffer[idx]));
            }
            
            src[i].buffer[z].del = is_del; src[tn].buffer[idx].del = is_del;
        }
        else ///means this edge just occurs in one direction
        {
            tn = i; tn <<= 32; tn |= z;
            kv_push(uint64_t, sl->buf[tid].a, tn);
            src[i].buffer[z].del = 1;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
movq $0x0, -0x48(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x28(%rbp), %rcx
imulq $0x18, -0x10(%rbp), %rdx
addq %rdx, %rcx
movl 0xc(%rcx), %ecx
cmpq %rcx, %rax
jae 0xcee5b
movq -0x28(%rbp), %rax
imulq $0x18, -0x10(%rbp), %rcx
addq %rcx, %rax
movq (%rax), %rax
imulq $0x28, -0x30(%rbp), %rcx
addq %rcx, %rax
movq (%rax), %rax
shrq $0x20, %rax
movl %eax, %eax
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rax
imulq $0x18, -0x10(%rbp), %rcx
addq %rcx, %rax
movq (%rax), %rax
imulq $0x28, -0x30(%rbp), %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
movq %rax, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movq -0x28(%rbp), %rdi
imulq $0x18, -0x40(%rbp), %rax
addq %rax, %rdi
movq -0x40(%rbp), %rax
movl %eax, %esi
movq -0x38(%rbp), %rax
movl %eax, %edx
callq 0xce1b0
movq %rax, -0x50(%rbp)
cmpq $-0x1, -0x50(%rbp)
je 0xcecd9
movq -0x38(%rbp), %rax
cmpq -0x40(%rbp), %rax
ja 0xcecd9
movq -0x28(%rbp), %rax
imulq $0x18, -0x10(%rbp), %rcx
addq %rcx, %rax
movq (%rax), %rax
imulq $0x28, -0x30(%rbp), %rcx
addq %rcx, %rax
movq 0x18(%rax), %rax
shrq $0x3f, %rax
cmpl $0x0, %eax
jne 0xceb1f
movq -0x28(%rbp), %rax
imulq $0x18, -0x40(%rbp), %rcx
addq %rcx, %rax
movq (%rax), %rax
imulq $0x28, -0x50(%rbp), %rcx
addq %rcx, %rax
movq 0x18(%rax), %rax
shrq $0x3f, %rax
cmpl $0x0, %eax
je 0xceb27
movq $0x1, -0x48(%rbp)
movq -0x28(%rbp), %rax
imulq $0x18, -0x10(%rbp), %rcx
addq %rcx, %rax
movq (%rax), %rax
imulq $0x28, -0x30(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movq -0x28(%rbp), %rcx
imulq $0x18, -0x10(%rbp), %rdx
addq %rdx, %rcx
movq (%rcx), %rcx
imulq $0x28, -0x30(%rbp), %rdx
addq %rdx, %rcx
movq (%rcx), %rcx
subl %ecx, %eax
movl %eax, %eax
movq %rax, -0x58(%rbp)
movq -0x28(%rbp), %rax
imulq $0x18, -0x40(%rbp), %rcx
addq %rcx, %rax
movq (%rax), %rax
imulq $0x28, -0x50(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movq -0x28(%rbp), %rcx
imulq $0x18, -0x40(%rbp), %rdx
addq %rdx, %rcx
movq (%rcx), %rcx
imulq $0x28, -0x50(%rbp), %rdx
addq %rdx, %rcx
movq (%rcx), %rcx
subl %ecx, %eax
movl %eax, %eax
movq %rax, -0x60(%rbp)
movq -0x58(%rbp), %rax
cmpq -0x60(%rbp), %rax
jne 0xcebde
movq -0x28(%rbp), %rax
imulq $0x18, -0x40(%rbp), %rcx
addq %rcx, %rax
movq (%rax), %rdi
imulq $0x28, -0x50(%rbp), %rax
addq %rax, %rdi
movq -0x28(%rbp), %rax
imulq $0x18, -0x10(%rbp), %rcx
addq %rcx, %rax
movq (%rax), %rsi
imulq $0x28, -0x30(%rbp), %rax
addq %rax, %rsi
callq 0xce230
jmp 0xcec52
movq -0x58(%rbp), %rax
cmpq -0x60(%rbp), %rax
jle 0xcec1d
movq -0x28(%rbp), %rax
imulq $0x18, -0x40(%rbp), %rcx
addq %rcx, %rax
movq (%rax), %rdi
imulq $0x28, -0x50(%rbp), %rax
addq %rax, %rdi
movq -0x28(%rbp), %rax
imulq $0x18, -0x10(%rbp), %rcx
addq %rcx, %rax
movq (%rax), %rsi
imulq $0x28, -0x30(%rbp), %rax
addq %rax, %rsi
callq 0xce230
jmp 0xcec50
movq -0x28(%rbp), %rax
imulq $0x18, -0x10(%rbp), %rcx
addq %rcx, %rax
movq (%rax), %rdi
imulq $0x28, -0x30(%rbp), %rax
addq %rax, %rdi
movq -0x28(%rbp), %rax
imulq $0x18, -0x40(%rbp), %rcx
addq %rcx, %rax
movq (%rax), %rsi
imulq $0x28, -0x50(%rbp), %rax
addq %rax, %rsi
callq 0xce230
jmp 0xcec52
movq -0x48(%rbp), %rax
movl %eax, %ecx
movq -0x28(%rbp), %rax
imulq $0x18, -0x10(%rbp), %rdx
addq %rdx, %rax
movq (%rax), %rax
imulq $0x28, -0x30(%rbp), %rdx
addq %rdx, %rax
movl %ecx, %ecx
movl %ecx, %edx
movq 0x18(%rax), %rcx
andq $0x1, %rdx
shlq $0x3f, %rdx
movabsq $0x7fffffffffffffff, %rsi # imm = 0x7FFFFFFFFFFFFFFF
andq %rsi, %rcx
orq %rdx, %rcx
movq %rcx, 0x18(%rax)
movq -0x48(%rbp), %rax
movl %eax, %ecx
movq -0x28(%rbp), %rax
imulq $0x18, -0x40(%rbp), %rdx
addq %rdx, %rax
movq (%rax), %rax
imulq $0x28, -0x50(%rbp), %rdx
addq %rdx, %rax
movl %ecx, %ecx
movl %ecx, %edx
movq 0x18(%rax), %rcx
andq $0x1, %rdx
shlq $0x3f, %rdx
movabsq $0x7fffffffffffffff, %rsi # imm = 0x7FFFFFFFFFFFFFFF
andq %rsi, %rcx
orq %rdx, %rcx
movq %rcx, 0x18(%rax)
jmp 0xcee48
movq -0x10(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
shlq $0x20, %rax
movq %rax, -0x40(%rbp)
movq -0x30(%rbp), %rax
orq -0x40(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movslq -0x14(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq -0x20(%rbp), %rcx
movq (%rcx), %rcx
movslq -0x14(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rcx
cmpq 0x8(%rcx), %rax
jne 0xcedd5
movq -0x20(%rbp), %rax
movq (%rax), %rax
movslq -0x14(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
cmpq $0x0, 0x8(%rax)
je 0xced62
movq -0x20(%rbp), %rax
movq (%rax), %rax
movslq -0x14(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x68(%rbp)
jmp 0xced6d
movl $0x2, %eax
movq %rax, -0x68(%rbp)
jmp 0xced6d
movq -0x68(%rbp), %rcx
movq -0x20(%rbp), %rax
movq (%rax), %rax
movslq -0x14(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movslq -0x14(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rdi
movq -0x20(%rbp), %rax
movq (%rax), %rax
movslq -0x14(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq (%rax), %rax
movslq -0x14(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rax
movq %rcx, 0x10(%rax)
movq -0x40(%rbp), %rdx
movq -0x20(%rbp), %rax
movq (%rax), %rax
movslq -0x14(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movq -0x20(%rbp), %rcx
movq (%rcx), %rsi
movslq -0x14(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movq %rdx, (%rax,%rcx,8)
movq -0x28(%rbp), %rax
imulq $0x18, -0x10(%rbp), %rcx
addq %rcx, %rax
movq (%rax), %rax
imulq $0x28, -0x30(%rbp), %rcx
addq %rcx, %rax
movabsq $0x7fffffffffffffff, %rcx # imm = 0x7FFFFFFFFFFFFFFF
andq 0x18(%rax), %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
orq %rdx, %rcx
movq %rcx, 0x18(%rax)
jmp 0xcee4a
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0xcea37
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)