// File: /workspace/github_cpp_makefile_star2_O1/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, 0x8(%rsp)
movq %r8, 0x20(%rsp)
movq %rcx, 0x18(%rsp)
movq %rdi, %rbx
movq 0x88(%rsp), %rdi
movq $0x0, (%rdi)
cmpl $0x2, 0x10(%rbx)
jb 0xb9e23
cmpl $0x0, 0xc(%rbx)
je 0xb9e23
movq %rdx, %r13
movl %esi, 0x14(%rsp)
movq 0x80(%rsp), %rdx
cmpl $0x0, 0x10(%rbx)
je 0xb9c06
xorl %eax, %eax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %rcx
shrq $0x21, %rcx
movb $0x1, (%rdx,%rcx)
incq %rax
movl 0x10(%rbx), %ecx
cmpq %rcx, %rax
jb 0xb9beb
cmpl $0x0, 0x10(%rbx)
je 0xb9cbf
xorl %ebp, %ebp
movq 0x8(%rdi), %rax
cmpq %rax, (%rdi)
jne 0xb9c50
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x8(%rdi)
movq 0x88(%rsp), %rax
movq 0x10(%rax), %rdi
shlq $0x2, %rsi
callq 0x2370
movq 0x88(%rsp), %rdi
movq %rax, 0x10(%rdi)
movq (%rdi), %r15
movq 0x10(%rdi), %r12
leaq 0x1(%r15), %rax
movq %rax, (%rdi)
leal 0x1(%rbp), %r14d
movq %rbx, %rdi
movl %ebp, %esi
movl %r14d, %edx
movq %r13, %rcx
movq 0x18(%rsp), %r8
movq 0x8(%rsp), %r9
pushq 0x80(%rsp)
pushq 0x70(%rsp)
movl 0x88(%rsp), %eax
pushq %rax
movl 0x88(%rsp), %eax
pushq %rax
pushq 0x40(%rsp)
pushq 0x88(%rsp)
callq 0xb811f
movq 0xb8(%rsp), %rdi
addq $0x30, %rsp
movl %eax, (%r12,%r15,4)
movl %r14d, %ebp
cmpl 0x10(%rbx), %r14d
jb 0xb9c12
movq 0x90(%rsp), %r15
cmpq $0x0, (%r15)
je 0xb9df8
movl 0x98(%rsp), %edx
movl 0x14(%rsp), %eax
movq %rax, 0x8(%rsp)
xorl %esi, %esi
movl $0x1, %r8d
xorl %eax, %eax
xorl %r12d, %r12d
movq 0x10(%r15), %rcx
movq (%rcx,%rax,8), %r13
movq %r13, %rax
shrq $0x20, %rax
cmpl 0x8(%rsp), %eax
jne 0xb9de9
movq 0x10(%rdi), %rax
movl %r13d, %ecx
movl (%rax,%rcx,4), %r14d
testl %r13d, %r13d
jle 0xb9d7f
leal -0x1(%r13), %r15d
xorl %ebp, %ebp
movq 0x10(%rdi), %rax
movl %r15d, %ecx
movl (%rax,%rcx,4), %eax
cmpl %edx, %eax
jae 0xb9d7f
cmpl %r14d, %eax
jb 0xb9d61
subl $0x1, %r15d
jae 0xb9d5a
cmpl $0x0, (%rbx)
sets %al
testl %ebp, %ebp
sete %cl
andb %al, %cl
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
cmpb $0x1, %cl
jne 0xb9d5a
movl 0x10(%rbx), %r15d
decl %r15d
movl $0x1, %ebp
testl %r15d, %r15d
jns 0xb9d1d
jmp 0xb9d7f
callq 0x1059a
movl $0x1, %r8d
xorl %esi, %esi
movl 0x98(%rsp), %edx
movq 0x88(%rsp), %rdi
jmp 0xb9d30
incl %r13d
cmpl 0x10(%rbx), %r13d
movq 0x90(%rsp), %r15
jge 0xb9de9
xorl %ebp, %ebp
movq 0x10(%rdi), %rax
movslq %r13d, %rcx
movl (%rax,%rcx,4), %eax
cmpl %edx, %eax
jae 0xb9de9
cmpl %r14d, %eax
jb 0xb9dcb
incl %r13d
cmpl 0x10(%rbx), %r13d
jl 0xb9dc3
cmpl $0x0, (%rbx)
sets %al
testl %ebp, %ebp
sete %cl
testb %cl, %al
cmovnel %esi, %r13d
cmovnel %r8d, %ebp
cmpl 0x10(%rbx), %r13d
jl 0xb9d92
jmp 0xb9de9
callq 0x105b6
movl $0x1, %r8d
xorl %esi, %esi
movl 0x98(%rsp), %edx
movq 0x88(%rsp), %rdi
jmp 0xb9da5
incl %r12d
movq %r12, %rax
cmpq %r12, (%r15)
ja 0xb9cee
cmpl $0x0, 0x10(%rbx)
movq 0x80(%rsp), %rdx
je 0xb9e23
xorl %eax, %eax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %rcx
shrq $0x21, %rcx
movb $0x0, (%rdx,%rcx)
incq %rax
movl 0x10(%rbx), %ecx
cmpq %rcx, %rax
jb 0xb9e08
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq