// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/Overlaps.cpp
// Function: debug_break_point(ma_utg_t*, unsigned int, asg_t*, All_reads*, ma_sub_t*, ma_hit_t_alloc*, R_to_U*, kvec_asg_arc_t_warp*, int, int, unsigned char*, kvec_t_u32_warp*, kvec_t_u64_warp*, unsigned int)
void debug_break_point(ma_utg_t *u, uint32_t uID, asg_t* read_g, All_reads *RNF, ma_sub_t* coverage_cut, 
ma_hit_t_alloc* sources, R_to_U* ruIndex, kvec_asg_arc_t_warp* edge, int max_hang, int min_ovlp,
uint8_t* r_flag, kvec_t_u32_warp* depth, kvec_t_u64_warp* res, uint32_t b_low_cov)
{
    depth->a.n = 0;
    ///res->a.n = 0;
    if(u->n < 2) return;
    uint32_t k, min, min_idx, rId, *p = NULL;
    if(u->m == 0) return;
    for (k = 0; k < u->n; k++)
    {
        rId = u->a[k]>>33;
        r_flag[rId] = 1;
    }


    for (k = 0; k < u->n; k++)
    {
        kv_pushp(uint32_t, depth->a, &p);
        (*p) = get_break_point_cov(u, k, k+1, read_g, RNF, sources, ruIndex, coverage_cut, max_hang, min_ovlp, edge, r_flag);
    }

    int k_i, is_end;
    min_idx = min = (uint32_t)-1;
    for (k = 0; k < res->a.n; k++)
    {
        if((res->a.a[k]>>32) != uID) continue;
        min_idx = (uint32_t)res->a.a[k];
        min = depth->a.a[min_idx];

        is_end = 0;
        k_i = (int)(min_idx) - 1;
        while (k_i >= 0)
        {
            if(depth->a.a[k_i] >= b_low_cov) break;
            if(depth->a.a[k_i] < min) fprintf(stderr, "ERROR1\n");
            k_i--;
            if(k_i < 0 && u->circ && is_end == 0)
            {
                k_i = u->n - 1;
                is_end = 1;
            }
        }

        is_end = 0;
        k_i = (int)(min_idx) + 1;
        while(k_i < (int)u->n)
        {
            if(depth->a.a[k_i] >= b_low_cov) break;
            if(depth->a.a[k_i] < min) fprintf(stderr, "ERROR2\n");
            k_i++;
            if(k_i >= (int)u->n && u->circ && is_end == 0)
            {
                k_i = 0;
                is_end = 1;
            }
        }
    }

    
    for (k = 0; k < u->n; k++)
    {
        rId = u->a[k]>>33;
        r_flag[rId] = 0;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r9, (%rsp)
movq %r8, 0x20(%rsp)
movq %rcx, 0x18(%rsp)
movq %rdx, 0x10(%rsp)
movq %rdi, %rbx
movq 0x88(%rsp), %rdi
movq $0x0, (%rdi)
cmpl $0x2, 0x10(%rbx)
jb 0xbad7d
cmpl $0x0, 0xc(%rbx)
je 0xbad7d
movq 0x80(%rsp), %r12
xorl %eax, %eax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %rcx
shrq $0x21, %rcx
movb $0x1, (%r12,%rcx)
incq %rax
movl 0x10(%rbx), %ecx
cmpq %rcx, %rax
jb 0xbab1c
movl %esi, 0xc(%rsp)
testl %ecx, %ecx
je 0xbabf4
xorl %r14d, %r14d
movq (%rdi), %r13
movq 0x10(%rdi), %rbp
cmpq 0x8(%rdi), %r13
jne 0xbab8a
leaq (,%r13,2), %rsi
testq %r13, %r13
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x8(%rdi)
shlq $0x2, %rsi
movq %rbp, %rdi
callq 0x2370
movq 0x88(%rsp), %rdi
movq %rax, %rbp
movq %rax, 0x10(%rdi)
movq (%rdi), %r13
leaq 0x1(%r13), %rax
movq %rax, (%rdi)
leal 0x1(%r14), %r15d
movq %rbx, %rdi
movl %r14d, %esi
movl %r15d, %edx
movq 0x10(%rsp), %rcx
movq 0x18(%rsp), %r8
movq (%rsp), %r9
pushq %r12
pushq 0x70(%rsp)
movl 0x88(%rsp), %eax
pushq %rax
movl 0x88(%rsp), %eax
pushq %rax
pushq 0x40(%rsp)
pushq 0x88(%rsp)
callq 0xb90be
movq 0xb8(%rsp), %rdi
addq $0x30, %rsp
movl %eax, (%rbp,%r13,4)
movl 0x10(%rbx), %eax
movl %r15d, %r14d
cmpl %eax, %r15d
jb 0xbab47
jmp 0xbabf6
xorl %eax, %eax
movq 0x90(%rsp), %r8
cmpq $0x0, (%r8)
je 0xbad5b
movl 0xc(%rsp), %r9d
xorl %r10d, %r10d
movl $0x1, %r11d
xorl %ecx, %ecx
xorl %ebp, %ebp
movl 0x98(%rsp), %esi
movq %r9, (%rsp)
movq 0x10(%r8), %rdx
movq (%rdx,%rcx,8), %r15
movq %r15, %rcx
shrq $0x20, %rcx
cmpl %r9d, %ecx
jne 0xbad4d
movq 0x10(%rdi), %rcx
movl %r15d, %edx
movl (%rcx,%rdx,4), %r14d
testl %r15d, %r15d
jle 0xbacbd
leal -0x1(%r15), %r12d
xorl %r13d, %r13d
movq 0x10(%rdi), %rax
movl %r12d, %ecx
movl (%rax,%rcx,4), %eax
cmpl %esi, %eax
jae 0xbacb2
cmpl %r14d, %eax
jb 0xbac87
testl %r12d, %r12d
jne 0xbac80
cmpl $0x0, (%rbx)
jns 0xbacb2
testl %r13d, %r13d
jne 0xbacb2
movl 0x10(%rbx), %r12d
movl $0x1, %r13d
decl %r12d
jns 0xbac54
jmp 0xbacb2
callq 0x10369
movl $0x1, %r11d
xorl %r10d, %r10d
movq (%rsp), %r9
movq 0x90(%rsp), %r8
movl 0x98(%rsp), %esi
movq 0x88(%rsp), %rdi
jmp 0xbac67
movl 0x10(%rbx), %eax
movq 0x80(%rsp), %r12
incl %r15d
cmpl %eax, %r15d
jge 0xbad4d
xorl %r13d, %r13d
movq 0x10(%rdi), %rcx
movslq %r15d, %rdx
movl (%rcx,%rdx,4), %ecx
cmpl %esi, %ecx
jae 0xbad4d
cmpl %r14d, %ecx
jb 0xbad04
incl %r15d
cmpl %eax, %r15d
jl 0xbacfd
cmpl $0x0, (%rbx)
sets %cl
testl %r13d, %r13d
sete %dl
testb %dl, %cl
cmovnel %r10d, %r15d
cmovnel %r11d, %r13d
cmpl %eax, %r15d
jl 0xbaccc
jmp 0xbad4d
movq 0x1da2d5(%rip), %rax    # 0x294fe0
movq (%rax), %rcx
movl $0x7, %esi
movl $0x1, %edx
leaq 0x17bb15(%rip), %rdi    # 0x236834
callq 0x2410
movl $0x1, %r11d
xorl %r10d, %r10d
movq (%rsp), %r9
movq 0x90(%rsp), %r8
movl 0x98(%rsp), %esi
movq 0x88(%rsp), %rdi
movl 0x10(%rbx), %eax
jmp 0xbacdf
incl %ebp
movq %rbp, %rcx
cmpq %rbp, (%r8)
ja 0xbac25
testl %eax, %eax
je 0xbad7d
xorl %eax, %eax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %rcx
shrq $0x21, %rcx
movb $0x0, (%r12,%rcx)
incq %rax
movl 0x10(%rbx), %ecx
cmpq %rcx, %rax
jb 0xbad61
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq