// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/Purge_Dups.cpp
// Function: get_hap_arch(hap_overlaps*, unsigned int, unsigned int, int, float, int, asg_arc_t*)
int get_hap_arch(hap_overlaps* hap, uint32_t qLen, uint32_t tLen, int max_hang, float max_hang_rate, 
int min_ovlp, asg_arc_t* t)
{
    int r;
    ma_hit_t h;
    h.qns = hap->xUid;
    h.qns = h.qns << 32;
    h.qns = h.qns | hap->x_beg_pos;
    h.qe = hap->x_end_pos;
    h.tn = hap->yUid;
    h.ts = hap->y_beg_pos;
    h.te = hap->y_end_pos;
    h.rev = hap->rev;
    h.del = 0;
    h.bl = h.el = h.ml = h.no_l_indel = 0;

    r = ma_hit2arc(&h, qLen, tLen, max_hang, max_hang_rate, min_ovlp, t);
    if(r < 0) return r;
    uint64_t score = (hap->score >= 0? (hap->score) : (hap->score*(-1)));
    if(hap->score >= 0) score += (((uint64_t)1)<<63);
    t->ol = (uint32_t)score;
    t->ul >>= 32; t->ul <<= 32; t->ul |= (score>>32);
    return r;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl %r8d, -0x4(%rsp)
movl 0x4(%rdi), %r10d
movl 0x8(%rdi), %r11d
movl 0xc(%rdi), %r13d
movl 0x10(%rdi), %r12d
movb (%rdi), %r8b
subl %r12d, %edx
testb $0x1, %r8b
movl %r13d, %ebp
cmovel %edx, %ebp
cmovel %r13d, %edx
cmpl %r10d, %edx
movl %r10d, %ebx
cmovll %edx, %ebx
movl %esi, %r15d
subl %r11d, %r15d
cmpl %ebp, %r15d
movl %ebp, %r14d
cmovll %r15d, %r14d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl %ecx, %ebx
jg 0x10db66
cmpl %ecx, %r14d
jg 0x10db66
movl %r11d, %ecx
subl %r10d, %ecx
cvtsi2ss %rcx, %xmm1
addl %ebx, %r14d
addl %r14d, %ecx
cvtsi2ss %rcx, %xmm2
mulss %xmm0, %xmm2
ucomiss %xmm1, %xmm2
ja 0x10db66
subl %r13d, %r12d
xorps %xmm1, %xmm1
cvtsi2ss %r12, %xmm1
addl %r12d, %r14d
xorps %xmm2, %xmm2
cvtsi2ss %r14, %xmm2
mulss %xmm0, %xmm2
ucomiss %xmm1, %xmm2
ja 0x10db66
cmpl %edx, %r10d
setg %al
cmpl %ebp, %r15d
setg %bl
orb %al, %bl
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
cmpb $0x1, %bl
jne 0x10db66
cmpl %ebp, %r15d
setl %al
cmpl %edx, %r10d
setl %bl
orb %al, %bl
movl $0xfffffffd, %eax       # imm = 0xFFFFFFFD
cmpb $0x1, %bl
jne 0x10db66
movl $0xfffffffc, %eax       # imm = 0xFFFFFFFC
movl -0x4(%rsp), %ebx
cmpl %ebx, %ecx
jl 0x10db66
cmpl %ebx, %r14d
jl 0x10db66
movl 0x24(%rdi), %eax
addq %rax, %rax
movl 0x28(%rdi), %ecx
testb $0x1, %r8b
sete %r8b
addl %ebp, %r11d
movl %esi, %ebx
subl %r11d, %ebx
xorl %r11d, %r11d
subl %edx, %r10d
setle %r11b
setg %dl
cmovlel %ebx, %r10d
xorb %r8b, %dl
movzbl %dl, %edx
andl $-0x2, %eax
orl %eax, %r11d
leal (%rdx,%rcx,2), %eax
shlq $0x20, %r11
leaq (%r10,%r11), %rcx
movq %rcx, (%r9)
movl %eax, 0x8(%r9)
subl %r10d, %esi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
movl %esi, 0xc(%r9)
movb $0x0, 0x12(%r9)
andb $0x3f, 0x11(%r9)
movl %r10d, %eax
testl %eax, %eax
js 0x10dbae
movq 0x30(%rdi), %rcx
movq %rcx, %rdx
negq %rdx
cmovsq %rcx, %rdx
movabsq $-0x8000000000000000, %rsi # imm = 0x8000000000000000
andq %rcx, %rsi
orq %rdx, %rsi
movl $0x80000000, %ecx       # imm = 0x80000000
andl 0xc(%r9), %ecx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
orl %edx, %ecx
movl %ecx, 0xc(%r9)
movl 0x4(%r9), %ecx
shldq $0x20, %rsi, %rcx
btcq $0x1f, %rcx
movq %rcx, (%r9)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq