// File: chhylp123[P]hifiasm/Overlaps.cpp
// Function: ma_ug_print_bed(ma_ug_t const*, asg_t*, All_reads*, ma_sub_t*, ma_hit_t_alloc*, kvec_asg_arc_t_warp*, int, int, unsigned int, char const*, _IO_FILE*, trans_chain*)
void ma_ug_print_bed(const ma_ug_t *g, asg_t *read_g, All_reads *RNF, ma_sub_t *coverage_cut,
ma_hit_t_alloc* sources, kvec_asg_arc_t_warp* edge, int max_hang, int min_ovlp, uint32_t rate_thres,
const char* prefix, FILE *fp, trans_chain* t_ch)
{
	UC_Read g_read;
    init_UC_Read(&g_read);
    UC_Read tmp;
    init_UC_Read(&tmp);
    kvec_t_u32_warp exact_count, total_count;
    kv_init(exact_count.a);
    kv_init(total_count.a);
    uint32_t i, j, l, eLen, start;
    for (i = 0; i < g->u.n; ++i) {
		ma_utg_t *u = &g->u.a[i];
        if(u->m == 0) continue;
        if(u->n < 2) continue;
        l = 0;
        for (j = 0; j < u->n; ++j) 
        {
            start = l;
            eLen = (uint32_t)u->a[j];
			l += eLen;

            print_rough_inconsistent_sites(u, j, j+1, read_g, RNF, sources, coverage_cut, 
            edge, &g_read, &tmp, max_hang, min_ovlp, start, rate_thres, &exact_count, 
            &total_count, prefix, i+1, fp, t_ch? &(t_ch->bed.a[i]): NULL);
        }
    }

    destory_UC_Read(&g_read);
    destory_UC_Read(&tmp);
    kv_destroy(exact_count.a);
    kv_destroy(total_count.a);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movq 0x38(%rbp), %rax
movq 0x30(%rbp), %rax
movq 0x28(%rbp), %rax
movl 0x20(%rbp), %eax
movl 0x18(%rbp), %eax
movl 0x10(%rbp), %eax
movq %rdi, -0x30(%rbp)
movq %rsi, -0x38(%rbp)
movq %rdx, -0x40(%rbp)
movq %rcx, -0x48(%rbp)
movq %r8, -0x50(%rbp)
movq %r9, -0x58(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x9850
leaq -0x98(%rbp), %rdi
callq 0x9850
movq $0x0, -0xb0(%rbp)
movq $0x0, -0xb8(%rbp)
movq $0x0, -0xa8(%rbp)
movq $0x0, -0xd0(%rbp)
movq $0x0, -0xd8(%rbp)
movq $0x0, -0xc8(%rbp)
movl $0x0, -0xdc(%rbp)
movl -0xdc(%rbp), %eax
movq -0x30(%rbp), %rcx
cmpq (%rcx), %rax
jae 0xf1faf
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movl -0xdc(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xf8(%rbp)
movq -0xf8(%rbp), %rax
cmpl $0x0, 0xc(%rax)
jne 0xf1d63
jmp 0xf1f9b
movq -0xf8(%rbp), %rax
cmpl $0x2, 0x10(%rax)
jae 0xf1d75
jmp 0xf1f9b
movl $0x0, -0xe4(%rbp)
movl $0x0, -0xe0(%rbp)
movl -0xe0(%rbp), %eax
movq -0xf8(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jae 0xf1f99
movl -0xe4(%rbp), %eax
movl %eax, -0xec(%rbp)
movq -0xf8(%rbp), %rax
movq 0x18(%rax), %rax
movl -0xe0(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0xe8(%rbp)
movl -0xe8(%rbp), %eax
addl -0xe4(%rbp), %eax
movl %eax, -0xe4(%rbp)
movq -0xf8(%rbp), %rax
movq %rax, -0x158(%rbp)
movl -0xe0(%rbp), %eax
movl %eax, -0x150(%rbp)
movl -0xe0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14c(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x148(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x140(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x138(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x130(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x128(%rbp)
movl 0x10(%rbp), %eax
movl %eax, -0x120(%rbp)
movl 0x18(%rbp), %eax
movl %eax, -0x11c(%rbp)
movl -0xec(%rbp), %eax
movl %eax, -0x118(%rbp)
movl 0x20(%rbp), %eax
movl %eax, -0x114(%rbp)
movq 0x28(%rbp), %rax
movq %rax, -0x110(%rbp)
movl -0xdc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x104(%rbp)
movq 0x30(%rbp), %rax
movq %rax, -0x100(%rbp)
cmpq $0x0, 0x38(%rbp)
je 0xf1ea9
movq 0x38(%rbp), %rax
movq 0x30(%rax), %rax
movl -0xdc(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x160(%rbp)
jmp 0xf1eb4
xorl %eax, %eax
movq %rax, -0x160(%rbp)
jmp 0xf1eb4
movl -0x114(%rbp), %r12d
movl -0x118(%rbp), %r13d
movq -0x130(%rbp), %rbx
movq -0x138(%rbp), %r9
movq -0x140(%rbp), %r8
movq -0x148(%rbp), %rcx
movl -0x14c(%rbp), %edx
movl -0x150(%rbp), %esi
movq -0x158(%rbp), %rdi
movq -0x160(%rbp), %rax
leaq -0x78(%rbp), %r11
leaq -0x98(%rbp), %r10
leaq -0xb8(%rbp), %r15
leaq -0xd8(%rbp), %r14
movq %rbx, (%rsp)
movq -0x128(%rbp), %rbx
movq %rbx, 0x8(%rsp)
movq -0x110(%rbp), %rbx
movq %r11, 0x10(%rsp)
movl -0x104(%rbp), %r11d
movq %r10, 0x18(%rsp)
movl -0x120(%rbp), %r10d
movl %r10d, 0x20(%rsp)
movl -0x11c(%rbp), %r10d
movl %r10d, 0x28(%rsp)
movq -0x100(%rbp), %r10
movl %r13d, 0x30(%rsp)
movl %r12d, 0x38(%rsp)
movq %r15, 0x40(%rsp)
movq %r14, 0x48(%rsp)
movq %rbx, 0x50(%rsp)
movl %r11d, 0x58(%rsp)
movq %r10, 0x60(%rsp)
movq %rax, 0x68(%rsp)
callq 0xeb280
movl -0xe0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xe0(%rbp)
jmp 0xf1d89
jmp 0xf1f9b
movl -0xdc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xdc(%rbp)
jmp 0xf1d22
leaq -0x78(%rbp), %rdi
callq 0x9670
leaq -0x98(%rbp), %rdi
callq 0x9670
movq -0xa8(%rbp), %rdi
callq 0x2210
movq -0xc8(%rbp), %rdi
callq 0x2210
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop