// File: chhylp123[P]hifiasm/Overlaps.cpp
// Function: add_overlaps_from_different_sources(ma_hit_t_alloc*, ma_hit_t_alloc*, unsigned long*, long long)
void add_overlaps_from_different_sources(ma_hit_t_alloc* source_paf_list, ma_hit_t_alloc* dest_paf, 
uint64_t* source_index, long long listLen)
{
    long long i;
    ma_hit_t ele;
    ma_hit_t* tmp;
    uint32_t source_n, source_i;
    for (i = 0; i < listLen; i++)
    {
        source_n = source_index[i] >> 32;
        source_i = (uint32_t)(source_index[i]);
        tmp = &(source_paf_list[source_n].buffer[source_i]);

        ele.del = 0;
        ele.rev = tmp->rev;
        ele.qns = Get_tn((*tmp));
        ele.qns = ele.qns << 32;
        ele.qns = ele.qns | (uint64_t)(Get_ts((*tmp)));
        ele.qe = Get_te((*tmp));

        ele.tn = Get_qn((*tmp));
        ele.ts = Get_qs((*tmp));
        ele.te = Get_qe((*tmp));

        ele.bl = R_INF.read_length[ele.tn];
        ele.ml = tmp->ml;
        ele.el = tmp->el;
        ele.no_l_indel = tmp->no_l_indel;
        
        add_ma_hit_t_alloc(dest_paf, &ele);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x20(%rbp), %rax
jge 0xcd6e6
movq -0x18(%rbp), %rax
movq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
movl %eax, -0x5c(%rbp)
movq -0x18(%rbp), %rax
movq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl %eax, -0x60(%rbp)
movq -0x8(%rbp), %rax
movl -0x5c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
movl -0x60(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movabsq $0x7fffffffffffffff, %rax # imm = 0x7FFFFFFFFFFFFFFF
andq -0x38(%rbp), %rax
orq $0x0, %rax
movq %rax, -0x38(%rbp)
movq -0x58(%rbp), %rax
movq 0x18(%rax), %rax
shrq $0x1f, %rax
andq $0x1, %rax
movl %eax, %eax
movl %eax, %ecx
movq -0x38(%rbp), %rax
andq $0x1, %rcx
shlq $0x1f, %rcx
movabsq $-0x80000001, %rdx      # imm = 0xFFFFFFFF7FFFFFFF
andq %rdx, %rax
orq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x58(%rbp), %rax
movl 0xc(%rax), %eax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
shlq $0x20, %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movq -0x58(%rbp), %rcx
movl 0x10(%rcx), %ecx
orq %rcx, %rax
movq %rax, -0x50(%rbp)
movq -0x58(%rbp), %rax
movl 0x14(%rax), %eax
movl %eax, -0x48(%rbp)
movq -0x58(%rbp), %rax
movq (%rax), %rax
shrq $0x20, %rax
movl %eax, -0x44(%rbp)
movq -0x58(%rbp), %rax
movq (%rax), %rax
movl %eax, -0x40(%rbp)
movq -0x58(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x3c(%rbp)
leaq 0x2f7c7b(%rip), %rax    # 0x3c52d0
movq 0x18(%rax), %rax
movl -0x44(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
movl %eax, %ecx
movq -0x38(%rbp), %rax
andq $0x7fffffff, %rcx       # imm = 0x7FFFFFFF
shlq $0x20, %rcx
movabsq $-0x7fffffff00000001, %rdx # imm = 0x80000000FFFFFFFF
andq %rdx, %rax
orq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x58(%rbp), %rax
movq 0x18(%rax), %rax
shrq $0x1e, %rax
andq $0x1, %rax
movl %eax, %eax
movl %eax, %ecx
movq -0x38(%rbp), %rax
andq $0x1, %rcx
shlq $0x1e, %rcx
andq $-0x40000001, %rax      # imm = 0xBFFFFFFF
orq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x58(%rbp), %rax
movb 0x20(%rax), %al
movb %al, -0x30(%rbp)
movq -0x58(%rbp), %rax
movb 0x21(%rax), %al
movb %al, -0x2f(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0xcd340
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0xcd560
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)