// File: /workspace/github_c_makefile_star2_O0/c-zhou[P]oatk/path.c
// Function: path_add_hmm_annot_bed6
void path_add_hmm_annot_bed6(hmm_annot_bed6_db_t *bed_annots, hmm_annot_db_t *annot_db, asg_t *asg, path_t *path, 
        int id, int force_linear, int gap_size, OG_TYPE_t og_type, double max_evalue)
{
    uint32_t i, n, v, lo, n_gap;
    uint64_t l;
    asmg_t *g;
    asmg_arc_t *a;
    char *cname;
    
    n = path->nv;
    if (n == 0) return;

    cname = 0;
    if (path->sid) {
        cname = strdup(path->sid);
    } else {
        MYMALLOC(cname, 12);
        sprintf(cname, "ctg%06d%c", id, (force_linear || !path->circ)? 'l' : 'c');
    }
    
    if (bed_annots->n_seg == bed_annots->m_seg) {
        ++bed_annots->m_seg;
        kroundup32(bed_annots->m_seg);
        MYREALLOC(bed_annots->snames, bed_annots->m_seg);
    }
    bed_annots->snames[bed_annots->n_seg++] = cname;

    g = asg->asmg;
    l = 0;
    v = path->v[0];
    lo = (force_linear || !path->circ)? 0 : asmg_arc1(g, path->v[n-1], v)->ls;
    hmm_annot_bed6_sname_add(bed_annots, annot_db, cname, asg->seg[v>>1].name, asg->seg[v>>1].len, lo, v&1, l, og_type, max_evalue);
    l += asg->seg[v>>1].len - lo;

    n_gap = 0;
    for (i = 1; i < n; ++i) {
        v = path->v[i];
        a = asmg_arc1(g, path->v[i-1], v);
        if (!a) l += gap_size, ++n_gap;
        hmm_annot_bed6_sname_add(bed_annots, annot_db, cname, asg->seg[v>>1].name, asg->seg[v>>1].len, a->ls, v&1, l, og_type, max_evalue);
        l += asg->seg[v>>1].len - a->ls;
    }

    if (!path->circ || !force_linear)
        assert(l - (uint64_t) n_gap * gap_size == path->len);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movl 0x18(%rbp), %eax
movl 0x10(%rbp), %eax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movl %r9d, -0x28(%rbp)
movsd %xmm0, -0x30(%rbp)
movq -0x20(%rbp), %rax
movl 0x8(%rax), %eax
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
movl %eax, -0x38(%rbp)
cmpl $0x0, -0x38(%rbp)
jne 0xa908
jmp 0xad15
movq $0x0, -0x68(%rbp)
movq -0x20(%rbp), %rax
cmpq $0x0, (%rax)
je 0xa92c
movq -0x20(%rbp), %rax
movq (%rax), %rdi
callq 0x2470
movq %rax, -0x68(%rbp)
jmp 0xa995
movl $0xc, %edi
callq 0x22f0
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x78(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x70(%rbp)
movb $0x1, %al
cmpl $0x0, -0x28(%rbp)
movb %al, -0x69(%rbp)
jne 0xa96b
movq -0x20(%rbp), %rax
movl 0x8(%rax), %eax
shrl $0x1e, %eax
andl $0x1, %eax
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
movb %al, -0x69(%rbp)
movl -0x70(%rbp), %edx
movq -0x78(%rbp), %rdi
movb -0x69(%rbp), %sil
movl $0x63, %ecx
movl $0x6c, %eax
testb $0x1, %sil
cmovnel %eax, %ecx
leaq 0x18f62(%rip), %rsi     # 0x238f0
movb $0x0, %al
callq 0x2420
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x8(%rbp), %rcx
cmpq 0x20(%rcx), %rax
jne 0xaa76
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x20(%rax)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x20(%rax)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rcx
shrq %rcx
movq -0x8(%rbp), %rax
orq 0x20(%rax), %rcx
movq %rcx, 0x20(%rax)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rcx
shrq $0x2, %rcx
movq -0x8(%rbp), %rax
orq 0x20(%rax), %rcx
movq %rcx, 0x20(%rax)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rcx
shrq $0x4, %rcx
movq -0x8(%rbp), %rax
orq 0x20(%rax), %rcx
movq %rcx, 0x20(%rax)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rcx
shrq $0x8, %rcx
movq -0x8(%rbp), %rax
orq 0x20(%rax), %rcx
movq %rcx, 0x20(%rax)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rcx
shrq $0x10, %rcx
movq -0x8(%rbp), %rax
orq 0x20(%rax), %rcx
movq %rcx, 0x20(%rax)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x20(%rax)
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
shlq $0x3, %rsi
callq 0x2330
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x68(%rbp), %rdx
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x8(%rbp), %rsi
movq 0x18(%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, 0x18(%rsi)
movq %rdx, (%rax,%rcx,8)
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x58(%rbp)
movq $0x0, -0x50(%rbp)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movl (%rax), %eax
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x28(%rbp)
jne 0xaad2
movq -0x20(%rbp), %rax
movl 0x8(%rax), %eax
shrl $0x1e, %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0xaada
xorl %eax, %eax
movq %rax, -0x80(%rbp)
jmp 0xab05
movq -0x58(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x38(%rbp), %ecx
subl $0x1, %ecx
movl %ecx, %ecx
movl (%rax,%rcx,4), %eax
movl %eax, %esi
movl -0x3c(%rbp), %eax
movl %eax, %edx
callq 0x8370
movq 0x18(%rax), %rax
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rax
movl %eax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x68(%rbp), %rdx
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x3c(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x3c(%rbp), %r8d
shrl %r8d
movl %r8d, %r8d
imulq $0x18, %r8, %r8
addq %r8, %rax
movl 0x10(%rax), %r8d
movl -0x40(%rbp), %r9d
movl -0x3c(%rbp), %r11d
andl $0x1, %r11d
movq -0x50(%rbp), %rax
movl %eax, %r10d
movl 0x18(%rbp), %eax
movsd -0x30(%rbp), %xmm0
movl %r11d, (%rsp)
movl %r10d, 0x8(%rsp)
movl %eax, 0x10(%rsp)
callq 0x1f900
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x3c(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
subl -0x40(%rbp), %eax
movl %eax, %eax
addq -0x50(%rbp), %rax
movq %rax, -0x50(%rbp)
movl $0x0, -0x44(%rbp)
movl $0x1, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x38(%rbp), %eax
jae 0xacbc
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x34(%rbp), %ecx
movl (%rax,%rcx,4), %eax
movl %eax, -0x3c(%rbp)
movq -0x58(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x34(%rbp), %ecx
subl $0x1, %ecx
movl %ecx, %ecx
movl (%rax,%rcx,4), %eax
movl %eax, %esi
movl -0x3c(%rbp), %eax
movl %eax, %edx
callq 0x8370
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x60(%rbp)
jne 0xac0f
movslq 0x10(%rbp), %rax
addq -0x50(%rbp), %rax
movq %rax, -0x50(%rbp)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x68(%rbp), %rdx
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x3c(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x3c(%rbp), %r8d
shrl %r8d
movl %r8d, %r8d
imulq $0x18, %r8, %r8
addq %r8, %rax
movl 0x10(%rax), %r8d
movq -0x60(%rbp), %rax
movq 0x18(%rax), %rax
movl %eax, %r9d
movl -0x3c(%rbp), %r11d
andl $0x1, %r11d
movq -0x50(%rbp), %rax
movl %eax, %r10d
movl 0x18(%rbp), %eax
movsd -0x30(%rbp), %xmm0
movl %r11d, (%rsp)
movl %r10d, 0x8(%rsp)
movl %eax, 0x10(%rsp)
callq 0x1f900
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x3c(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
movq -0x60(%rbp), %rcx
subq 0x18(%rcx), %rax
addq -0x50(%rbp), %rax
movq %rax, -0x50(%rbp)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xabaf
movq -0x20(%rbp), %rax
movl 0x8(%rax), %eax
shrl $0x1e, %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0xacd4
cmpl $0x0, -0x28(%rbp)
jne 0xad15
movq -0x50(%rbp), %rax
movl -0x44(%rbp), %ecx
movslq 0x10(%rbp), %rdx
imulq %rdx, %rcx
subq %rcx, %rax
movq -0x20(%rbp), %rcx
movl 0x18(%rcx), %ecx
cmpq %rcx, %rax
jne 0xacf4
jmp 0xad13
leaq 0x18bc8(%rip), %rdi     # 0x238c3
leaq 0x188a3(%rip), %rsi     # 0x235a5
movl $0x791, %edx            # imm = 0x791
leaq 0x18bec(%rip), %rcx     # 0x238fa
callq 0x21a0
jmp 0xad15
addq $0xa0, %rsp
popq %rbp
retq
nop