// File: /workspace/github_c_makefile_star2_O2/c-zhou[P]oatk/path.c
// Function: print_seq
void print_seq(asg_t *asg, path_t *path, FILE *fo, int id, int force_linear, int line_wd, int gap_size)
{
    uint32_t i, n, v, lo, cov, n_gap;
    uint64_t l;
    asmg_t *g;
    asmg_arc_t *a;
    
    n = path->nv;
    if (n == 0) return;

    for (i = 0; i < n; ++i) {
        v = path->v[i];
        if (!asg->seg[v>>1].seq) {
            fprintf(stderr, "[E::%s] cannot make FASTA output: sequence not included in the GFA file\n", __func__);
            return;
        }
    }

    g = asg->asmg;
    lo = 0;
    cov = 0;
    if (path->circ && force_linear) {
        a = asmg_arc1(g, path->v[n-1], path->v[0]);
        assert(!!a);
        lo = a->ls;
        cov = g->vtx[path->v[0]>>1].cov;
    }
    
    if (path->sid)
        fprintf(fo, ">%s\tlength=%u wlength=%.1f nv=%u circular=%s path=%s%c", path->sid, path->len + lo, path->wlen + (double) cov * lo,
                path->nv, (force_linear || !path->circ)? "false" : "true", asg->seg[path->v[0]>>1].name, "+-"[path->v[0]&1]);
    else
        fprintf(fo, ">ctg%06d%c\tlength=%u wlength=%.1f nv=%u circular=%s path=%s%c", id, (force_linear || !path->circ)? 'l' : 'c', 
                path->len + lo, path->wlen + (double) cov * lo, path->nv, (force_linear || !path->circ)? "false" : "true", 
                asg->seg[path->v[0]>>1].name, "+-"[path->v[0]&1]);

    for (i = 1; i < n; ++i)
        fprintf(fo, ",%s%c", asg->seg[path->v[i]>>1].name, "+-"[path->v[i]&1]);
    fprintf(fo, "\n");

    l = 0;
    v = path->v[0];
    lo = (force_linear || !path->circ)? 0 : asmg_arc1(g, path->v[n-1], v)->ls;
    put_chars(asg->seg[v>>1].seq, asg->seg[v>>1].len, v&1, lo, fo, &l, line_wd);

    n_gap = 0;
    for (i = 1; i < n; ++i) {
        v = path->v[i];
        a = asmg_arc1(g, path->v[i-1], v);
        if (!!a) {
            put_chars(asg->seg[v>>1].seq, asg->seg[v>>1].len, v&1, a->ls, fo, &l, line_wd);
        } else {
            make_gap(fo, &l, line_wd, gap_size);
            put_chars(asg->seg[v>>1].seq, asg->seg[v>>1].len, v&1, 0, fo, &l, line_wd);
            ++n_gap;
        }
    }

    if (!path->circ || !force_linear)
        assert(l - (uint64_t) n_gap * gap_size == path->len);
    if (l % line_wd != 0)
        fputc('\n', fo);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movl %r8d, 0x24(%rsp)
movl 0x8(%rsi), %ebp
movl %ebp, %eax
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
movq %rax, 0x28(%rsp)
je 0x8bca
movl %ecx, %r10d
movq %rdx, %rbx
movl 0xb0(%rsp), %eax
movl %eax, 0x40(%rsp)
movq %rsi, 0x38(%rsp)
movq 0x10(%rsi), %r13
movq %rdi, 0x48(%rsp)
movq 0x10(%rdi), %r12
xorl %eax, %eax
cmpq %rax, 0x28(%rsp)
je 0x87dd
movl (%r13,%rax,4), %ecx
shrl %ecx
imulq $0x18, %rcx, %rcx
incq %rax
cmpq $0x0, 0x8(%r12,%rcx)
jne 0x8793
movq 0x14841(%rip), %rax     # 0x1cff8
movq (%rax), %rdi
leaq 0xe0e1(%rip), %rsi      # 0x168a2
leaq 0xe123(%rip), %rdx      # 0x168eb
xorl %eax, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3290
movq 0x48(%rsp), %rax
movq 0x20(%rax), %r15
btl $0x1e, %ebp
setae %al
cmpl $0x0, 0x24(%rsp)
sete %cl
orb %al, %cl
movl %r9d, 0x44(%rsp)
movq %r15, 0x50(%rsp)
jne 0x884d
movl %r10d, 0x60(%rsp)
movq 0x28(%rsp), %rax
movl -0x4(%r13,%rax,4), %esi
movl (%r13), %r14d
movq %r15, %rdi
movq %r14, %rdx
callq 0x703e
testq %rax, %rax
je 0x8bd9
movl 0x18(%rax), %r8d
movq 0x10(%r15), %rax
shrl %r14d
imulq $0x28, %r14, %rcx
movl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
andl 0x20(%rax,%rcx), %edx
cvtsi2sd %edx, %xmm0
movl 0x60(%rsp), %r10d
jmp 0x8854
xorpd %xmm0, %xmm0
xorl %r8d, %r8d
movq 0x38(%rsp), %rsi
movq (%rsi), %rdx
testq %rdx, %rdx
je 0x88d9
movl %r8d, %eax
addl 0x18(%rsi), %r8d
btl $0x1e, %ebp
leaq 0xe0f7(%rip), %rcx      # 0x1696a
leaq 0xe0f6(%rip), %r9       # 0x16970
cmovaeq %rcx, %r9
cmpl $0x0, 0x24(%rsp)
cvtsi2sd %rax, %xmm1
mulsd %xmm1, %xmm0
addsd 0x20(%rsi), %xmm0
cmovneq %rcx, %r9
movl (%r13), %eax
movl %eax, %ecx
shrl %ecx
imulq $0x18, %rcx, %rcx
movq (%r12,%rcx), %rcx
andl $0x1, %eax
leaq 0xdfbd(%rip), %rsi      # 0x1686c
movsbl (%rax,%rsi), %eax
movl %eax, 0x8(%rsp)
movq %rcx, (%rsp)
leaq 0xe071(%rip), %rsi      # 0x16933
movq %rbx, %rdi
movl %r8d, %ecx
movq 0x28(%rsp), %r8
movb $0x1, %al
callq 0x3290
jmp 0x8960
cmpl $0x0, 0x24(%rsp)
setne %al
btl $0x1e, %ebp
setae %cl
orb %al, %cl
movzbl %cl, %eax
leal (%rax,%rax,8), %ecx
addl $0x63, %ecx
movl %r8d, %edx
addl 0x18(%rsi), %r8d
cvtsi2sd %rdx, %xmm1
mulsd %xmm1, %xmm0
addsd 0x20(%rsi), %xmm0
leaq 0xe05b(%rip), %rdx      # 0x1696a
leaq 0xe05a(%rip), %rsi      # 0x16970
testb %al, %al
cmovneq %rdx, %rsi
movl (%r13), %eax
movl %eax, %edx
shrl %edx
imulq $0x18, %rdx, %rdx
movq (%r12,%rdx), %rdx
andl $0x1, %eax
leaq 0xdf36(%rip), %rdi      # 0x1686c
movsbl (%rax,%rdi), %eax
movl %eax, 0x10(%rsp)
movq %rdx, 0x8(%rsp)
movq %rsi, (%rsp)
leaq 0xe027(%rip), %rsi      # 0x16975
movq %rbx, %rdi
movl %r10d, %edx
movq 0x28(%rsp), %r9
movb $0x1, %al
callq 0x3290
pushq $0x1
popq %r15
leaq 0xdf01(%rip), %r12      # 0x1686c
leaq 0xdf2a(%rip), %r14      # 0x1689c
movq 0x38(%rsp), %r13
movq 0x48(%rsp), %rbp
cmpq 0x28(%rsp), %r15
jae 0x89b5
movq 0x10(%rbp), %rax
movq 0x10(%r13), %rcx
movl (%rcx,%r15,4), %ecx
movl %ecx, %edx
shrl %edx
imulq $0x18, %rdx, %rdx
movq (%rax,%rdx), %rdx
andl $0x1, %ecx
movsbl (%rcx,%r12), %ecx
movq %rbx, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x3290
incq %r15
jmp 0x897c
pushq $0xa
popq %rdi
movq %rbx, %rsi
callq 0x3200
andq $0x0, 0x30(%rsp)
movq $0x0, 0x58(%rsp)
movq 0x10(%r13), %rax
movl (%rax), %r15d
movl $0x0, %ecx
cmpl $0x0, 0x24(%rsp)
jne 0x8a02
testb $0x40, 0xb(%r13)
je 0x8a02
movq 0x28(%rsp), %rcx
movl -0x4(%rax,%rcx,4), %esi
movq 0x50(%rsp), %rdi
movq %r15, %rdx
callq 0x703e
movl 0x18(%rax), %ecx
movq 0x10(%rbp), %rax
movl %r15d, %edx
shrl %edx
imulq $0x18, %rdx, %rdx
movq 0x8(%rax,%rdx), %rdi
movl 0x10(%rax,%rdx), %esi
andl $0x1, %r15d
movl 0x44(%rsp), %r14d
movl %r14d, (%rsp)
leaq 0x30(%rsp), %r9
movl %r15d, %edx
movq %rbx, %r8
callq 0x8c17
movl 0x40(%rsp), %eax
testl %eax, %eax
movl $0x0, %ecx
cmovgl %eax, %ecx
movq %rcx, 0x68(%rsp)
movslq %r14d, %r13
pushq $0x1
popq %rcx
pushq $0x4e
popq %rbp
movq 0x50(%rsp), %r15
cmpq 0x28(%rsp), %rcx
jae 0x8b6c
movq 0x38(%rsp), %rax
movq 0x10(%rax), %rax
movl -0x4(%rax,%rcx,4), %esi
movq %rcx, 0x60(%rsp)
movl (%rax,%rcx,4), %r12d
movq %r15, %rdi
movq %r12, %rdx
callq 0x703e
testq %rax, %rax
je 0x8ac2
movq 0x48(%rsp), %rcx
movq 0x10(%rcx), %rcx
movl %r12d, %edx
shrl %edx
imulq $0x18, %rdx, %rdx
movq 0x8(%rcx,%rdx), %rdi
movl 0x10(%rcx,%rdx), %esi
andl $0x1, %r12d
movl 0x18(%rax), %ecx
movl %r14d, (%rsp)
movl %r12d, %edx
movq %rbx, %r8
leaq 0x30(%rsp), %r9
callq 0x8c17
jmp 0x8b5f
movq 0x30(%rsp), %rax
movq %rax, 0x70(%rsp)
leaq 0x1(%rax), %r14
movq 0x68(%rsp), %rax
movl %eax, %r15d
subl $0x1, %r15d
jb 0x8b05
movl %ebp, %edi
movq %rbx, %rsi
callq 0x3200
movq %r14, %rax
xorl %edx, %edx
divq %r13
testq %rdx, %rdx
jne 0x8b00
pushq $0xa
popq %rdi
movq %rbx, %rsi
callq 0x3200
incq %r14
jmp 0x8ad8
movq 0x70(%rsp), %rax
addq 0x68(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x48(%rsp), %rax
movq 0x10(%rax), %rax
movl %r12d, %ecx
shrl %ecx
imulq $0x18, %rcx, %rcx
movq 0x8(%rax,%rcx), %rdi
movl 0x10(%rax,%rcx), %esi
andl $0x1, %r12d
movl 0x44(%rsp), %r14d
movl %r14d, (%rsp)
movl %r12d, %edx
xorl %ecx, %ecx
movq %rbx, %r8
leaq 0x30(%rsp), %r9
callq 0x8c17
movq 0x58(%rsp), %rax
incl %eax
movq %rax, 0x58(%rsp)
movq 0x50(%rsp), %r15
movq 0x60(%rsp), %rcx
incq %rcx
jmp 0x8a56
movq 0x30(%rsp), %rax
cmpl $0x0, 0x24(%rsp)
je 0x8b87
movl $0x40000000, %ecx       # imm = 0x40000000
movq 0x38(%rsp), %rdx
andl 0x8(%rdx), %ecx
jne 0x8ba7
movl 0x58(%rsp), %ecx
movslq 0x40(%rsp), %rdx
imulq %rcx, %rdx
movq %rax, %rcx
subq %rdx, %rcx
movq 0x38(%rsp), %rdx
movl 0x18(%rdx), %edx
cmpq %rdx, %rcx
jne 0x8bf8
xorl %edx, %edx
divq %r13
testq %rdx, %rdx
je 0x8bca
pushq $0xa
popq %rdi
movq %rbx, %rsi
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3200
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xdbdd(%rip), %rdi      # 0x167bd
leaq 0xdaae(%rip), %rsi      # 0x16695
leaq 0xdd07(%rip), %rcx      # 0x168f5
movl $0x73c, %edx            # imm = 0x73C
callq 0x3190
leaq 0xddb4(%rip), %rdi      # 0x169b3
leaq 0xda8f(%rip), %rsi      # 0x16695
leaq 0xdce8(%rip), %rcx      # 0x168f5
movl $0x760, %edx            # imm = 0x760
callq 0x3190