// File: 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
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq 0x70(%rbp), %rax
movq 0x68(%rbp), %rax
movq 0x60(%rbp), %rax
movq 0x58(%rbp), %rax
movq 0x50(%rbp), %rax
movq 0x48(%rbp), %rax
movq 0x40(%rbp), %rax
movl 0x38(%rbp), %eax
movl 0x30(%rbp), %eax
movl 0x28(%rbp), %eax
movl 0x20(%rbp), %eax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x38(%rbp)
movq %rsi, -0x40(%rbp)
movq %rdx, -0x48(%rbp)
movq %rcx, -0x50(%rbp)
movq %r8, -0x58(%rbp)
movq %r9, -0x60(%rbp)
movq -0x50(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq -0x60(%rbp), %rdx
movq 0x10(%rbp), %rcx
movq 0x18(%rbp), %r8
movl 0x20(%rbp), %r9d
movl 0x28(%rbp), %eax
movl %eax, -0xb4(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0xa8(%rbp)
movl 0x30(%rbp), %eax
movl %eax, -0xa0(%rbp)
movl 0x38(%rbp), %eax
movl %eax, -0x9c(%rbp)
movq -0x38(%rbp), %rax
movl 0x8(%rax), %eax
movq %rax, -0x98(%rbp)
movq -0x38(%rbp), %rax
movl 0xc(%rax), %eax
movq %rax, -0x90(%rbp)
movq -0x38(%rbp), %rax
movl 0x10(%rax), %eax
movq %rax, -0x88(%rbp)
movq -0x38(%rbp), %rax
movl 0x14(%rax), %eax
movq %rax, -0x80(%rbp)
movq -0x38(%rbp), %rax
movzbl 0x28(%rax), %r13d
movq 0x40(%rbp), %r12
movq 0x48(%rbp), %r15
movq 0x50(%rbp), %r14
leaq -0x64(%rbp), %rbx
leaq -0x6c(%rbp), %r11
leaq -0x68(%rbp), %r10
leaq -0x70(%rbp), %rax
movq %rax, -0x78(%rbp)
movl -0xb4(%rbp), %eax
movl %eax, (%rsp)
movq -0xb0(%rbp), %rax
movq %rax, 0x8(%rsp)
movq -0xa8(%rbp), %rax
movq %rax, 0x10(%rsp)
movl -0xa0(%rbp), %eax
movl %eax, 0x18(%rsp)
movl -0x9c(%rbp), %eax
movl %eax, 0x20(%rsp)
movq -0x98(%rbp), %rax
movq %rax, 0x28(%rsp)
movq -0x90(%rbp), %rax
movq %rax, 0x30(%rsp)
movq -0x88(%rbp), %rax
movq %rax, 0x38(%rsp)
movq -0x80(%rbp), %rax
movq %rax, 0x40(%rsp)
movq -0x78(%rbp), %rax
movl %r13d, 0x48(%rsp)
movq %r12, 0x50(%rsp)
movq %r15, 0x58(%rsp)
movq %r14, 0x60(%rsp)
movq %rbx, 0x68(%rsp)
movq %r11, 0x70(%rsp)
movq %r10, 0x78(%rsp)
movq %rax, 0x80(%rsp)
callq 0x174c20
cmpl $-0x1, -0x64(%rbp)
je 0x175581
cmpl $-0x1, -0x68(%rbp)
je 0x175581
cmpl $-0x1, -0x6c(%rbp)
je 0x175581
cmpl $-0x1, -0x70(%rbp)
jne 0x17558a
movl $0xffffffff, -0x2c(%rbp) # imm = 0xFFFFFFFF
jmp 0x175602
movl -0x64(%rbp), %eax
cmpl -0x6c(%rbp), %eax
ja 0x17559a
movl -0x68(%rbp), %eax
cmpl -0x70(%rbp), %eax
jbe 0x1755a3
movl $0xffffffff, -0x2c(%rbp) # imm = 0xFFFFFFFF
jmp 0x175602
movl -0x64(%rbp), %eax
movl %eax, %edi
movl -0x6c(%rbp), %eax
movl %eax, %esi
movq -0x40(%rbp), %rax
movl (%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
movl %eax, %edx
movl -0x68(%rbp), %eax
movl %eax, %ecx
movl -0x70(%rbp), %eax
movl %eax, %r8d
movq -0x48(%rbp), %rax
movl (%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
movl %eax, %r9d
movq 0x58(%rbp), %rbx
movq 0x60(%rbp), %r11
movq 0x68(%rbp), %r10
movq 0x70(%rbp), %rax
movq %rbx, (%rsp)
movq %r11, 0x8(%rsp)
movq %r10, 0x10(%rsp)
movq %rax, 0x18(%rsp)
callq 0x170800
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopw (%rax,%rax)