// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/Purge_Dups.cpp
// Function: determine_hap_overlap_type_advance_back(hap_candidates*, ma_utg_t*, ma_utg_t*, R_to_U*, ma_hit_t_alloc*, ma_sub_t*, asg_t*, unsigned long*, int, int, unsigned int, unsigned int, kvec_asg_arc_t_offset*, kvec_t_i32_warp*, kvec_t_i32_warp*, long long*, long long*, long long*, long long*)
uint32_t determine_hap_overlap_type_advance_back(hap_candidates* hap_can, ma_utg_t *xReads, ma_utg_t *yReads,
R_to_U* ruIndex, ma_hit_t_alloc* reverse_sources, ma_sub_t *coverage_cut, asg_t *read_g, uint64_t* position_index, 
int max_hang, int min_ovlp, uint32_t xUid, uint32_t yUid, kvec_asg_arc_t_offset* u_buffer, kvec_t_i32_warp* tailIndex, 
kvec_t_i32_warp* prevIndex, long long* r_x_pos_beg, long long* r_x_pos_end, long long* r_y_pos_beg, long long* r_y_pos_end)
{
    uint32_t x_pos_beg, y_pos_beg, x_pos_end, y_pos_end;
    /*************************x***************************/
    get_base_boundary_advance_back(ruIndex, reverse_sources, coverage_cut, read_g, position_index, 
    max_hang, min_ovlp, xReads, yReads, xUid, yUid, Get_x_beg(*hap_can), Get_x_end(*hap_can), 
    Get_y_beg(*hap_can), Get_y_end(*hap_can), Get_rev(*hap_can), u_buffer, tailIndex, prevIndex, 
    &x_pos_beg, &x_pos_end, &y_pos_beg, &y_pos_end);
    /*************************x***************************/

    if(x_pos_beg == (uint32_t)-1 || y_pos_beg == (uint32_t)-1 
                    || x_pos_end == (uint32_t)-1 || y_pos_end == (uint32_t)-1)
    {
        return (uint32_t)-1;
    }
    if(x_pos_beg > x_pos_end || y_pos_beg > y_pos_end) return (uint32_t)-1;
    
    /**
    #define X2Y 0
    #define Y2X 1
    #define XCY 2
    #define YCX 3
    **/
    return classify_hap_overlap(x_pos_beg, x_pos_end, xReads->len, y_pos_beg, y_pos_end, yReads->len, 
    r_x_pos_beg, r_x_pos_end, r_y_pos_beg, r_y_pos_end);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r9, %r11
movq %r8, %r10
movl 0x70(%rsp), %r9d
movaps 0x80(%rsp), %xmm0
movl 0x8(%rdi), %ebp
movl 0xc(%rdi), %ebx
movl 0x10(%rdi), %r14d
movl 0x14(%rdi), %eax
movzbl 0x28(%rdi), %edi
movl 0x78(%rsp), %r8d
movq 0x90(%rsp), %r15
subq $0x90, %rsp
movq %r15, 0x60(%rsp)
leaq 0x98(%rsp), %r15
movq %r15, 0x80(%rsp)
leaq 0xa0(%rsp), %r13
movq %r13, 0x78(%rsp)
leaq 0x9c(%rsp), %r12
movq %r12, 0x70(%rsp)
leaq 0xa4(%rsp), %r15
movq %r15, 0x68(%rsp)
movups %xmm0, 0x50(%rsp)
movl %edi, 0x48(%rsp)
movq %rax, 0x40(%rsp)
movq %r14, 0x38(%rsp)
movq %rsi, %r14
movq %rbx, 0x30(%rsp)
movq %rdx, %rbx
movq %rbp, 0x28(%rsp)
movl %r8d, 0x20(%rsp)
movl %r9d, 0x18(%rsp)
movl 0xf8(%rsp), %eax
movl %eax, (%rsp)
movq %rdx, 0x10(%rsp)
movq %rsi, 0x8(%rsp)
movq 0xe8(%rsp), %r8
movl 0xf0(%rsp), %r9d
movq %rcx, %rdi
movq %r10, %rsi
movq %r11, %rdx
movq 0xe0(%rsp), %rcx
callq 0x108ed6
addq $0x90, %rsp
movl (%r15), %edi
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, %rdi
sete %cl
movl (%r13), %eax
cmpl $-0x1, %eax
sete %sil
orb %cl, %sil
movl (%r12), %edx
cmpl $-0x1, %edx
sete %cl
leaq 0x8(%rsp), %r8
movl (%r8), %r8d
cmpl $-0x1, %r8d
sete %r9b
orb %cl, %r9b
orb %sil, %r9b
jne 0x1095ee
movl %eax, %ecx
movl %edx, %esi
movl %r8d, %r8d
cmpl %esi, %edi
seta %al
cmpl %r8d, %ecx
seta %dl
orb %al, %dl
je 0x1095f9
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x18, %rsp
jmp 0x10962f
movl (%r14), %edx
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
andq %rax, %rdx
movl (%rbx), %r9d
andq %rax, %r9
pushq 0xb0(%rsp)
pushq 0xb0(%rsp)
pushq 0xb0(%rsp)
pushq 0xb0(%rsp)
callq 0x105f44
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq