// File: /workspace/github_cpp_makefile_star2_O2/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 $0x38, %rsp
movq %r9, 0x8(%rsp)
movq %r8, 0x30(%rsp)
movq %rcx, 0x28(%rsp)
movq %rdx, 0x20(%rsp)
movq 0x98(%rsp), %r12
andq $0x0, (%r12)
movl 0x10(%rdi), %eax
cmpl $0x2, %eax
jb 0x7fa76
cmpl $0x0, 0xc(%rdi)
je 0x7fa76
movl %esi, 0x1c(%rsp)
movl 0xa8(%rsp), %esi
movq 0x90(%rsp), %r13
xorl %ecx, %ecx
movl %eax, %edx
cmpq %rdx, %rcx
jae 0x7f870
movq 0x18(%rdi), %rax
movq (%rax,%rcx,8), %rax
shrq $0x21, %rax
movb $0x1, (%r13,%rax)
incq %rcx
movl 0x10(%rdi), %eax
jmp 0x7f84f
pushq $0x1
popq %rbp
movq %rdi, 0x10(%rsp)
leal -0x1(%rbp), %r15d
cmpl %eax, %r15d
jae 0x7f928
movq (%r12), %rbx
movq 0x10(%r12), %r14
cmpq 0x8(%r12), %rbx
jne 0x7f8c0
leaq (%rbx,%rbx), %rsi
testq %rbx, %rbx
pushq $0x2
popq %rax
cmoveq %rax, %rsi
movq %rsi, 0x8(%r12)
shlq $0x2, %rsi
movq %r14, %rdi
callq 0x2370
movq %rax, %r14
movq %rax, 0x10(%r12)
movq (%r12), %rbx
leaq 0x1(%rbx), %rax
movq %rax, (%r12)
movq 0x10(%rsp), %rdi
movl %r15d, %esi
movl %ebp, %edx
movq 0x20(%rsp), %rcx
movq 0x28(%rsp), %r8
movq 0x8(%rsp), %r9
pushq %r13
pushq 0x80(%rsp)
movl 0x98(%rsp), %eax
pushq %rax
movl 0x98(%rsp), %eax
pushq %rax
pushq 0x50(%rsp)
pushq 0x98(%rsp)
callq 0x7e059
movq 0x40(%rsp), %rdi
addq $0x30, %rsp
movl %eax, (%r14,%rbx,4)
movl 0x10(%rdi), %eax
incl %ebp
movl 0xa8(%rsp), %esi
jmp 0x7f878
movl 0x1c(%rsp), %edx
xorl %r15d, %r15d
movq %rdx, 0x8(%rsp)
movl %r15d, %r15d
movq 0xa0(%rsp), %rcx
cmpq %r15, (%rcx)
jbe 0x7fa53
movq 0x10(%rcx), %rcx
movq (%rcx,%r15,8), %rbp
movq %rbp, %rcx
shrq $0x20, %rcx
cmpl %edx, %ecx
jne 0x7fa4b
movq 0x10(%r12), %rax
movl %ebp, %ecx
movl (%rax,%rcx,4), %r14d
movb $0x1, %r13b
movl %ebp, %ebx
decl %ebx
testl %ebx, %ebx
js 0x7f9cc
movq 0x10(%r12), %rax
movl %ebx, %ecx
movl (%rax,%rcx,4), %eax
cmpl %esi, %eax
jae 0x7f9cc
cmpl %r14d, %eax
jb 0x7f99a
subl $0x1, %ebx
jae 0x7f971
cmpl $0x0, (%rdi)
sets %al
testb %r13b, %al
je 0x7f971
jmp 0x7f9c4
movq 0x1d363f(%rip), %rax    # 0x252fe0
movq (%rax), %rcx
leaq 0x168d81(%rip), %rdi    # 0x1e872c
pushq $0x7
popq %rsi
pushq $0x1
popq %rdx
callq 0x2410
movl 0xa8(%rsp), %esi
movq 0x10(%rsp), %rdi
jmp 0x7f988
movl 0x10(%rdi), %ebx
xorl %r13d, %r13d
jmp 0x7f96f
incl %ebp
movl 0x10(%rdi), %eax
xorl %ebx, %ebx
movq 0x90(%rsp), %r13
movslq %ebp, %rbp
cmpl %eax, %ebp
jge 0x7fa46
movq 0x10(%r12), %rcx
movl (%rcx,%rbp,4), %ecx
cmpl %esi, %ecx
jae 0x7fa46
cmpl %r14d, %ecx
jb 0x7f9fc
incq %rbp
cmpl %eax, %ebp
jl 0x7f9de
jmp 0x7fa29
movq 0x1d35dd(%rip), %rax    # 0x252fe0
movq (%rax), %rcx
leaq 0x168d27(%rip), %rdi    # 0x1e8734
pushq $0x7
popq %rsi
pushq $0x1
popq %rdx
callq 0x2410
movl 0xa8(%rsp), %esi
movq 0x10(%rsp), %rdi
movl 0x10(%rdi), %eax
jmp 0x7f9f3
cmpl $0x0, (%rdi)
sets %cl
testl %ebx, %ebx
sete %dl
testb %dl, %cl
movl $0x0, %ecx
cmovnel %ecx, %ebp
pushq $0x1
popq %rcx
cmovnel %ecx, %ebx
jmp 0x7f9db
movq 0x8(%rsp), %rdx
incl %r15d
jmp 0x7f934
xorl %ecx, %ecx
movl %eax, %eax
cmpq %rax, %rcx
jae 0x7fa76
movq 0x18(%rdi), %rax
movq (%rax,%rcx,8), %rax
shrq $0x21, %rax
movb $0x0, (%r13,%rax)
incq %rcx
movl 0x10(%rdi), %eax
jmp 0x7fa55
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq