// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/Purge_Dups.cpp
// Function: determine_hap_overlap_type(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, long long*, long long*, long long*, long long*)
uint32_t determine_hap_overlap_type(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,
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(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), 0, Get_rev(*hap_can), &x_pos_beg, &y_pos_beg);

    get_base_boundary(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), 1, Get_rev(*hap_can), &x_pos_end, &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 $0x38, %rsp
movq %r9, 0x18(%rsp)
movq %r8, %r13
movq %r8, 0x10(%rsp)
movq %rcx, 0x8(%rsp)
movq %rdx, 0x20(%rsp)
movq %rsi, 0x28(%rsp)
movq %rdi, %rbp
movq 0x78(%rsp), %r8
movl 0x8(%rdi), %eax
movl 0xc(%rdi), %r10d
movl 0x10(%rdi), %r11d
movl 0x14(%rdi), %ebx
movzbl 0x28(%rdi), %r14d
subq $0x8, %rsp
leaq 0x8(%rsp), %r12
leaq 0xc(%rsp), %r15
movq %rcx, %rdi
movq %r13, %rsi
movq %r9, %rdx
movq 0x78(%rsp), %rcx
movl 0x88(%rsp), %r9d
pushq %r12
pushq %r15
pushq %r14
pushq $0x0
pushq %rbx
pushq %r11
pushq %r10
pushq %rax
movl 0xe0(%rsp), %eax
pushq %rax
movl 0xe0(%rsp), %eax
pushq %rax
movq 0x78(%rsp), %r14
pushq %r14
movq 0x88(%rsp), %r15
pushq %r15
movl 0xf0(%rsp), %eax
pushq %rax
callq 0x10772f
addq $0x70, %rsp
movl 0x8(%rbp), %eax
movl 0xc(%rbp), %r10d
movl 0x10(%rbp), %r11d
movl 0x14(%rbp), %r12d
movzbl 0x28(%rbp), %ebp
subq $0x8, %rsp
leaq 0x38(%rsp), %r13
leaq 0x3c(%rsp), %rbx
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdx
movq 0x78(%rsp), %rcx
movq 0x80(%rsp), %r8
movl 0x88(%rsp), %r9d
pushq %r13
pushq %rbx
pushq %rbp
pushq $0x1
pushq %r12
pushq %r11
pushq %r10
pushq %rax
movl 0xe0(%rsp), %eax
pushq %rax
movl 0xe0(%rsp), %eax
pushq %rax
pushq %r14
pushq %r15
movl 0xf0(%rsp), %eax
pushq %rax
callq 0x10772f
addq $0x70, %rsp
leaq 0x4(%rsp), %rax
movl (%rax), %edi
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, %rdi
sete %cl
movq %rsp, %rax
movl (%rax), %eax
cmpl $-0x1, %eax
sete %sil
orb %cl, %sil
movl (%rbx), %edx
cmpl $-0x1, %edx
sete %cl
movl (%r13), %r8d
cmpl $-0x1, %r8d
sete %r9b
orb %cl, %r9b
orb %sil, %r9b
jne 0x10acdb
movl %eax, %ecx
movl %edx, %esi
movl %r8d, %r8d
cmpl %esi, %edi
seta %al
cmpl %r8d, %ecx
seta %dl
orb %al, %dl
je 0x10ace6
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x38, %rsp
jmp 0x10ad1c
movl (%r15), %edx
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
andq %rax, %rdx
movl (%r14), %r9d
andq %rax, %r9
pushq 0xb8(%rsp)
pushq 0xb8(%rsp)
pushq 0xb8(%rsp)
pushq 0xb8(%rsp)
callq 0x105f44
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq