// File: /workspace/github_cpp_makefile_star2_O3/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
testq %rax, %rax
jle 0x38294
movq (%r15), %rcx
addq $0x2c, %rcx
xorl %esi, %esi
movzbl (%rcx), %edx
xorl %edi, %edi
cmpl %ebp, %edx
sete %dil
addl %edi, %esi
addq $0xa8, %rcx
decq %rax
jne 0x38279
jmp 0x38296
xorl %esi, %esi
movq %r12, %rdi
callq 0xa0c4a
movq %r12, %rdi
callq 0xa0c42
movq 0x10(%r15), %rcx
testq %rcx, %rcx
jle 0x383de
movl $0x2e, %r13d
xorl %ebx, %ebx
movq (%r15), %rax
movzbl -0x2(%rax,%r13), %edx
cmpl %ebp, %edx
jne 0x383cb
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 0x3832a
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 0x38349
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 0xa058c
movq 0x10(%r15), %rcx
incq %rbx
addq $0xa8, %r13
cmpq %rcx, %rbx
jl 0x382bb
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq