// File: 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
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x88, %rsp
movl 0x48(%rbp), %eax
movq 0x40(%rbp), %rax
movq 0x38(%rbp), %rax
movq 0x30(%rbp), %rax
movl 0x28(%rbp), %eax
movl 0x20(%rbp), %eax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x20(%rbp)
movl %esi, -0x24(%rbp)
movq %rdx, -0x30(%rbp)
movq %rcx, -0x38(%rbp)
movq %r8, -0x40(%rbp)
movq %r9, -0x48(%rbp)
movq 0x38(%rbp), %rax
movq $0x0, (%rax)
movq -0x20(%rbp), %rax
cmpl $0x2, 0x10(%rax)
jae 0xf4e2e
jmp 0xf5175
movq $0x0, -0x60(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, 0xc(%rax)
jne 0xf4e45
jmp 0xf5175
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jae 0xf4e84
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x4c(%rbp), %ecx
movq (%rax,%rcx,8), %rax
shrq $0x21, %rax
movl %eax, -0x58(%rbp)
movq 0x30(%rbp), %rax
movl -0x58(%rbp), %ecx
movb $0x1, (%rax,%rcx)
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0xf4e4c
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jae 0xf4f90
jmp 0xf4e9d
movq 0x38(%rbp), %rax
movq (%rax), %rax
movq 0x38(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0xf4f05
movq 0x38(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0xf4eca
movq 0x38(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x70(%rbp)
jmp 0xf4ed5
movl $0x2, %eax
movq %rax, -0x70(%rbp)
jmp 0xf4ed5
movq -0x70(%rbp), %rcx
movq 0x38(%rbp), %rax
movq %rcx, 0x8(%rax)
movq 0x38(%rbp), %rax
movq 0x10(%rax), %rdi
movq 0x38(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x2, %rsi
callq 0x2360
movq %rax, %rcx
movq 0x38(%rbp), %rax
movq %rcx, 0x10(%rax)
movq 0x38(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x38(%rbp), %rdx
movq (%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, (%rdx)
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0x20(%rbp), %rdi
movl -0x4c(%rbp), %esi
movl -0x4c(%rbp), %edx
addl $0x1, %edx
movq -0x30(%rbp), %rcx
movq -0x38(%rbp), %r8
movq -0x48(%rbp), %r9
movq 0x10(%rbp), %r15
movq -0x40(%rbp), %r14
movl 0x20(%rbp), %ebx
movl 0x28(%rbp), %r11d
movq 0x18(%rbp), %r10
movq 0x30(%rbp), %rax
movq %r15, (%rsp)
movq %r14, 0x8(%rsp)
movl %ebx, 0x10(%rsp)
movl %r11d, 0x18(%rsp)
movq %r10, 0x20(%rsp)
movq %rax, 0x28(%rsp)
callq 0xf1ff0
movl %eax, %ecx
movq -0x60(%rbp), %rax
movl %ecx, (%rax)
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0xf4e8b
movl $0xffffffff, -0x50(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x54(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movq 0x40(%rbp), %rcx
cmpq (%rcx), %rax
jae 0xf5136
movq 0x40(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x4c(%rbp), %ecx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
movl -0x24(%rbp), %ecx
cmpq %rcx, %rax
je 0xf4fd5
jmp 0xf5128
movq 0x40(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x4c(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x54(%rbp)
movq 0x38(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x54(%rbp), %ecx
movl (%rax,%rcx,4), %eax
movl %eax, -0x50(%rbp)
movl $0x0, -0x68(%rbp)
movl -0x54(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x64(%rbp)
cmpl $0x0, -0x64(%rbp)
jl 0xf508c
movq 0x38(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x64(%rbp), %rcx
movl (%rax,%rcx,4), %eax
cmpl 0x48(%rbp), %eax
jb 0xf5024
jmp 0xf508c
movq 0x38(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x64(%rbp), %rcx
movl (%rax,%rcx,4), %eax
cmpl -0x50(%rbp), %eax
jae 0xf5050
movq 0x2cefa1(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x292211(%rip), %rsi    # 0x38725a
movb $0x0, %al
callq 0x22a0
movl -0x64(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x64(%rbp)
cmpl $0x0, -0x64(%rbp)
jge 0xf5087
movq -0x20(%rbp), %rax
movl (%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0xf5087
cmpl $0x0, -0x68(%rbp)
jne 0xf5087
movq -0x20(%rbp), %rax
movl 0x10(%rax), %eax
subl $0x1, %eax
movl %eax, -0x64(%rbp)
movl $0x1, -0x68(%rbp)
jmp 0xf5008
movl $0x0, -0x68(%rbp)
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
movl -0x64(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jge 0xf5126
movq 0x38(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x64(%rbp), %rcx
movl (%rax,%rcx,4), %eax
cmpl 0x48(%rbp), %eax
jb 0xf50be
jmp 0xf5126
movq 0x38(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x64(%rbp), %rcx
movl (%rax,%rcx,4), %eax
cmpl -0x50(%rbp), %eax
jae 0xf50ea
movq 0x2cef07(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x29217f(%rip), %rsi    # 0x387262
movb $0x0, %al
callq 0x22a0
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
movl -0x64(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jl 0xf5121
movq -0x20(%rbp), %rax
movl (%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0xf5121
cmpl $0x0, -0x68(%rbp)
jne 0xf5121
movl $0x0, -0x64(%rbp)
movl $0x1, -0x68(%rbp)
jmp 0xf509c
jmp 0xf5128
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0xf4fa5
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jae 0xf5175
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x4c(%rbp), %ecx
movq (%rax,%rcx,8), %rax
shrq $0x21, %rax
movl %eax, -0x58(%rbp)
movq 0x30(%rbp), %rax
movl -0x58(%rbp), %ecx
movb $0x0, (%rax,%rcx)
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0xf513d
addq $0x88, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nopw %cs:(%rax,%rax)