// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/Assembly.cpp
// Function: push_overlaps(ma_hit_t_alloc*, overlap_region_alloc*, int, All_reads*, int)
void push_overlaps(ma_hit_t_alloc* paf, overlap_region_alloc* overlap_list, int flag, All_reads* R_INF, int if_reverse)
{
    long long i = 0, xLen, yLen;
	int32_t size = 0;
    ma_hit_t tmp;
	for (i = 0; i < (long long)overlap_list->length; ++i)
		if (overlap_list->list[i].is_match == flag)
			++size;
	resize_ma_hit_t_alloc(paf, size);
    clear_ma_hit_t_alloc(paf);
    for (i = 0; i < (long long)overlap_list->length; i++)
    {
        if (overlap_list->list[i].is_match == flag)
        {
            xLen = Get_READ_LENGTH((*R_INF), overlap_list->list[i].x_id);
            yLen = Get_READ_LENGTH((*R_INF), overlap_list->list[i].y_id);

            tmp.qns = overlap_list->list[i].x_id;
            tmp.qns = tmp.qns << 32;
            tmp.tn = overlap_list->list[i].y_id;

            if(if_reverse != 0)
            {
                tmp.qns = tmp.qns | (uint64_t)(xLen - overlap_list->list[i].x_pos_s - 1);
                tmp.qe = xLen - overlap_list->list[i].x_pos_e - 1;
                tmp.ts = yLen - overlap_list->list[i].y_pos_s - 1;
                tmp.te = yLen - overlap_list->list[i].y_pos_e - 1;
            }
            else
            {
                tmp.qns = tmp.qns | (uint64_t)(overlap_list->list[i].x_pos_s);
                tmp.qe = overlap_list->list[i].x_pos_e;
                tmp.ts = overlap_list->list[i].y_pos_s;
                tmp.te = overlap_list->list[i].y_pos_e;
            }

            ///for overlap_list, the x_strand of all overlaps are 0, so the tmp.rev is the same as the y_strand
            tmp.rev = overlap_list->list[i].y_pos_strand;

            ///tmp.bl = R_INF.read_length[overlap_list->list[i].y_id];
            tmp.bl = Get_READ_LENGTH((*R_INF), overlap_list->list[i].y_id);
            tmp.ml = overlap_list->list[i].strong;
            tmp.no_l_indel = overlap_list->list[i].without_large_indel;

            add_ma_hit_t_alloc(paf, &tmp);
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %r8d, 0xc(%rsp)
movq %rcx, %r14
movl %edx, %ebp
movq %rsi, %r15
movq %rdi, %r12
movq 0x10(%rsi), %rax
xorl %esi, %esi
testq %rax, %rax
cmovleq %rsi, %rax
pushq $0x2c
popq %rcx
subq $0x1, %rax
jb 0xbf29
movq (%r15), %rdx
movzbl (%rdx,%rcx), %edx
xorl %edi, %edi
cmpl %ebp, %edx
sete %dil
addl %edi, %esi
addq $0xa8, %rcx
jmp 0xbf09
movq %r12, %rdi
callq 0x69660
movq %r12, %rdi
callq 0x6965b
pushq $0x2e
popq %r13
xorl %ebx, %ebx
cmpq 0x10(%r15), %rbx
jge 0xc064
movq (%r15), %rax
movzbl -0x2(%rax,%r13), %ecx
cmpl %ebp, %ecx
jne 0xc055
movl -0x2e(%rax,%r13), %edi
movl -0x1e(%rax,%r13), %r8d
movq 0x18(%r14), %rcx
movq (%rcx,%rdi,8), %rsi
shlq $0x20, %rdi
movq (%rcx,%r8,8), %rdx
movl %r8d, 0x1c(%rsp)
movl -0x2a(%rax,%r13), %r8d
cmpl $0x0, 0xc(%rsp)
je 0xbfb8
notq %r8
addq %rsi, %r8
orq %rdi, %r8
movq %r8, 0x10(%rsp)
movl -0x26(%rax,%r13), %edi
notl %edi
addl %edi, %esi
movl %esi, 0x18(%rsp)
movl -0x1a(%rax,%r13), %esi
notl %esi
addl %edx, %esi
movl %esi, 0x20(%rsp)
movl -0x16(%rax,%r13), %esi
notl %esi
addl %edx, %esi
jmp 0xbfd7
orq %r8, %rdi
movq %rdi, 0x10(%rsp)
movl -0x26(%rax,%r13), %edx
movl %edx, 0x18(%rsp)
movl -0x1a(%rax,%r13), %edx
movl %edx, 0x20(%rsp)
movl -0x16(%rax,%r13), %esi
movl %esi, 0x24(%rsp)
movl -0x12(%rax,%r13), %edx
shll $0x1f, %edx
movq 0x28(%rsp), %rsi
movabsq $-0x80000001, %rdi      # imm = 0xFFFFFFFF7FFFFFFF
andq %rdi, %rsi
orq %rdx, %rsi
movq %rsi, 0x28(%rsp)
movl -0x1e(%rax,%r13), %edx
movq (%rcx,%rdx,8), %rcx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
shlq $0x20, %rcx
movabsq $-0x7fffffff00000001, %rdx # imm = 0x80000000FFFFFFFF
andq %rdx, %rsi
orq %rcx, %rsi
movq %rsi, 0x28(%rsp)
movzbl (%rax,%r13), %ecx
andl $0x1, %ecx
shll $0x1e, %ecx
andq $-0x40000001, %rsi      # imm = 0xBFFFFFFF
orq %rcx, %rsi
movq %rsi, 0x28(%rsp)
movb -0x1(%rax,%r13), %al
movb %al, 0x31(%rsp)
movq %r12, %rdi
leaq 0x10(%rsp), %rsi
callq 0x69052
incq %rbx
addq $0xa8, %r13
jmp 0xbf3f
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq