// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/Purge_Dups.cpp
// Function: push_hap_can(asg_arc_t_offset*, kvec_hap_candidates*, int*, long long, long long, long long)
inline void push_hap_can(asg_arc_t_offset* x, kvec_hap_candidates* u_can, int32_t* Results, 
long long chainLen, long long x_readLen, long long y_readLen)
{
    if(chainLen <= 0) return;
    hap_candidates hap_can;
    hap_can.rev = x[Results[0]].x.el;
    hap_can.x_beg_pos = hap_can.x_end_pos = (uint32_t)(x[Results[0]].Off>>32);
    hap_can.y_beg_pos = hap_can.y_end_pos = (uint32_t)(x[Results[0]].Off);
    hap_can.weight = 0;
    long long i = 0;
    uint64_t totalWeigth = 0;
    ///fprintf(stderr, "^^^chainLen: %lld\n", chainLen);
    for (i = 0; i < chainLen; i++)
    {
        ///fprintf(stderr, "i: %lld, Results[i]: %d\n", i, Results[i]);
        hap_can.x_beg_pos = (uint32_t)(x[Results[i]].Off>>32);
        hap_can.y_beg_pos = (uint32_t)(x[Results[i]].Off);
        hap_can.weight += x[Results[i]].weight;
    }

    for (i = 0; i < chainLen; i++)
    {
        totalWeigth += x[Results[i]].weight;
        if(totalWeigth >= (hap_can.weight/2)) break;
    }

    if(i >= chainLen) i = chainLen-1;
    ///Get_total(hap_can) = Results[i];
    hap_can.t = x[Results[i]].x;
    Get_type(hap_can) = classify_hap_overlap(hap_can.x_beg_pos, hap_can.x_end_pos, 
    x_readLen, hap_can.y_beg_pos, hap_can.y_end_pos, y_readLen, NULL, NULL, NULL, NULL);
    kv_push(hap_candidates, u_can->a, hap_can);
    if(hap_can.x_beg_pos > hap_can.x_end_pos || hap_can.y_beg_pos > hap_can.y_end_pos)
    {
        fprintf(stderr, "ERROR\n");
    }
}

// Assembly:
testq %rcx, %rcx
jle 0xd4088
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %r14
movslq (%rdx), %rax
imulq $0x28, %rax, %rax
movb 0x12(%rdi,%rax), %sil
movb %sil, 0x23(%rsp)
movq 0x18(%rdi,%rax), %r12
movq %r12, %rbx
shrq $0x20, %rbx
xorl %ebp, %ebp
movl %r12d, %r15d
movl %ebx, %r13d
xorl %eax, %eax
cmpq %rax, %rcx
je 0xd3f77
movslq (%rdx,%rax,4), %rsi
imulq $0x28, %rsi, %rsi
movq 0x18(%rdi,%rsi), %r15
movq %r15, %r13
shrq $0x20, %r13
addq 0x20(%rdi,%rsi), %rbp
incq %rax
jmp 0xd3f54
movq %rbp, %rsi
shrq %rsi
xorl %eax, %eax
xorl %r10d, %r10d
cmpq %rax, %rcx
je 0xd3f9e
movslq (%rdx,%rax,4), %r11
imulq $0x28, %r11, %r11
addq 0x20(%rdi,%r11), %r10
cmpq %rsi, %r10
jae 0xd3fa3
incq %rax
jmp 0xd3f82
movq %rcx, %rsi
jmp 0xd3fa6
movq %rax, %rsi
leaq -0x1(%rcx), %r10
cmpq %rcx, %rax
cmovlq %rsi, %r10
movslq (%rdx,%r10,4), %rax
imulq $0x28, %rax, %rax
movq 0x10(%rdi,%rax), %rcx
movq %rcx, 0x40(%rsp)
movups (%rdi,%rax), %xmm0
movups %xmm0, 0x30(%rsp)
movl %r13d, %edi
movl %r15d, %ecx
movl %r12d, %eax
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rsp)
movups %xmm0, (%rsp)
movq %rbx, %rsi
movq %r8, %rdx
movq %rax, %r8
callq 0xc7ff2
movl %eax, %esi
movq (%r14), %rcx
cmpq 0x8(%r14), %rcx
jne 0xd402a
leaq (%rcx,%rcx), %rax
testq %rcx, %rcx
pushq $0x2
popq %rcx
cmovneq %rax, %rcx
movq %rcx, 0x8(%r14)
movq 0x10(%r14), %rdi
movl %esi, 0x24(%rsp)
imulq $0x48, %rcx, %rsi
callq 0x2370
movl 0x24(%rsp), %esi
movq %rax, 0x10(%r14)
movq (%r14), %rcx
jmp 0xd402e
movq 0x10(%r14), %rax
leaq 0x1(%rcx), %rdx
movq %rdx, (%r14)
imulq $0x48, %rcx, %rcx
movq %rbp, (%rax,%rcx)
movl %r13d, 0x8(%rax,%rcx)
movl %ebx, 0xc(%rax,%rcx)
movl %r15d, 0x10(%rax,%rcx)
movl %r12d, 0x14(%rax,%rcx)
movl %esi, 0x1c(%rax,%rcx)
movb 0x23(%rsp), %dl
movb %dl, 0x28(%rax,%rcx)
movups 0x29(%rsp), %xmm0
movups 0x38(%rsp), %xmm1
movups %xmm0, 0x29(%rax,%rcx)
movups %xmm1, 0x38(%rax,%rcx)
cmpl %ebx, %r13d
ja 0xd4089
cmpl %r12d, %r15d
ja 0xd4089
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x17ef50(%rip), %rax    # 0x252fe0
movq (%rax), %rcx
leaq 0x116cea(%rip), %rdi    # 0x1ead84
pushq $0x6
popq %rsi
pushq $0x1
popq %rdx
callq 0x2410
jmp 0xd407a