// File: chhylp123[P]hifiasm/Hash_Table.cpp
// Function: push_ovlp_chain_qgen(overlap_region*, unsigned int, long, long, long, k_mer_hit*, k_mer_hit*)
void push_ovlp_chain_qgen(overlap_region* o, uint32_t xid, int64_t xl, int64_t yl, int64_t sc, 
k_mer_hit *beg, k_mer_hit *end)
{
    int64_t xr, yr; 
    o->x_id = xid; o->y_id = beg->readID;
    o->x_pos_strand = 0; o->y_pos_strand = beg->strand;
    o->x_pos_s = beg->self_offset; o->y_pos_s = beg->offset;
    o->x_pos_e = end->self_offset; o->y_pos_e = end->offset;

    if(o->x_pos_s <= o->y_pos_s) {
        o->y_pos_s -= o->x_pos_s; o->x_pos_s = 0;
    } else {
        o->x_pos_s -= o->y_pos_s; o->y_pos_s = 0;
    }

    xr = xl-o->x_pos_e-1; yr = yl-o->y_pos_e-1;
    if(xr <= yr) {
        o->x_pos_e = xl-1; o->y_pos_e += xr;        
    } else {
        o->y_pos_e = yl-1; o->x_pos_e += yr; 
    }

    o->shared_seed = sc;
    o->align_length = 0;
    o->is_match = 0;
    o->non_homopolymer_errors = 0;
    o->strong = 0;
    o->overlapLen = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movl -0xc(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, (%rax)
movq -0x30(%rbp), %rax
movl (%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movq -0x8(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0xc(%rax)
movq -0x30(%rbp), %rax
movl (%rax), %ecx
shrl $0x1f, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x1c(%rax)
movq -0x30(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x30(%rbp), %rax
movl 0x4(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x14(%rax)
movq 0x10(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x8(%rax)
movq 0x10(%rbp), %rax
movl 0x4(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0x8(%rbp), %rax
movl 0x4(%rax), %eax
movq -0x8(%rbp), %rcx
cmpl 0x14(%rcx), %eax
ja 0x24e7e
movq -0x8(%rbp), %rax
movl 0x4(%rax), %edx
movq -0x8(%rbp), %rax
movl 0x14(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x14(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x4(%rax)
jmp 0x24e9c
movq -0x8(%rbp), %rax
movl 0x14(%rax), %edx
movq -0x8(%rbp), %rax
movl 0x4(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x4(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x14(%rax)
movq -0x18(%rbp), %rax
movq -0x8(%rbp), %rcx
movl 0x8(%rcx), %ecx
subq %rcx, %rax
subq $0x1, %rax
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rax
movq -0x8(%rbp), %rcx
movl 0x18(%rcx), %ecx
subq %rcx, %rax
subq $0x1, %rax
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rax
cmpq -0x40(%rbp), %rax
jg 0x24ef6
movq -0x18(%rbp), %rax
subq $0x1, %rax
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x38(%rbp), %rdx
movq -0x8(%rbp), %rax
movl 0x18(%rax), %ecx
addq %rdx, %rcx
movl %ecx, 0x18(%rax)
jmp 0x24f18
movq -0x20(%rbp), %rax
subq $0x1, %rax
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0x40(%rbp), %rdx
movq -0x8(%rbp), %rax
movl 0x8(%rax), %ecx
addq %rdx, %rcx
movl %ecx, 0x8(%rax)
movq -0x28(%rbp), %rax
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x24(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x28(%rax)
movq -0x8(%rbp), %rax
movb $0x0, 0x2c(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x30(%rax)
movq -0x8(%rbp), %rax
movb $0x0, 0x2e(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x20(%rax)
popq %rbp
retq
nopl (%rax,%rax)