// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/Overlaps.cpp
// Function: print_simple_dbg_gfa(asg_t*, char const*)
void print_simple_dbg_gfa(asg_t *g, const char* prt)
{
    char* gfa_name = (char*)malloc(strlen(prt)+50);
    sprintf(gfa_name, "%s.dbg.noseq.gfa", prt);
    FILE *fp = fopen(gfa_name, "w");
    uint32_t i, j; char name[32];
    for (i = 0; i < g->n_seq; ++i) { // the Segment lines in GFA
        if(g->seq[i].del) continue;
        sprintf(name, "utg%.6dl", i + 1);
		fprintf(fp, "S\t%s\t*\tLN:i:%d\trd:i:%u\n", name, g->seq[i].len, 0);
	}

    asg_arc_t* au = NULL; uint32_t nu, u, v;
    for (i = 0; i < g->n_seq; ++i) {
        if(g->seq[i].del) continue;

        u = i<<1;
        au = asg_arc_a(g, u); nu = asg_arc_n(g, u);
        for (j = 0; j < nu; j++) {
            if(au[j].del) continue;
            v = au[j].v;
            fprintf(fp, "L\tutg%.6dl\t%c\tutg%.6dl\t%c\t%dM\tL1:i:%d\tL2:i:%u\n", 
            (u>>1)+1, "+-"[u&1], (v>>1)+1, "+-"[v&1], au[j].ol, asg_arc_len(au[j]), 0/**au[j].ou**/);
        }


        u = (i<<1) + 1;
        au = asg_arc_a(g, u); nu = asg_arc_n(g, u);
        for (j = 0; j < nu; j++) {
            if(au[j].del) continue;
            v = au[j].v;
            fprintf(fp, "L\tutg%.6dl\t%c\tutg%.6dl\t%c\t%dM\tL1:i:%d\tL2:i:%u\n", 
            (u>>1)+1, "+-"[u&1], (v>>1)+1, "+-"[v&1], au[j].ol, asg_arc_len(au[j]), 0/**au[j].ou**/);
        }
    }

    fclose(fp); free(gfa_name);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %r15
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x2090
leaq 0x32(%rax), %rdi
callq 0x2280
movq %rax, %r14
leaq 0x161b44(%rip), %rsi    # 0x22ae4c
movq %rax, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x2050
leaq 0x1730e2(%rip), %rsi    # 0x23c3fe
movq %r14, 0x8(%rsp)
movq %r14, %rdi
callq 0x2210
movq %rbx, %rcx
movq %rax, %r15
testl $0x7fffffff, 0x14(%rbx) # imm = 0x7FFFFFFF
movq %rbx, (%rsp)
je 0xc93a8
leaq 0x161b1a(%rip), %r12    # 0x22ae5d
leaq 0x10(%rsp), %r13
movl $0x7fffffff, %ebx       # imm = 0x7FFFFFFF
leaq 0x160eba(%rip), %rbp    # 0x22a20e
xorl %r14d, %r14d
movq 0x20(%rcx), %rax
cmpl $0x0, (%rax,%r14,8)
js 0xc9398
leal 0x1(%r14), %edx
movq %r13, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0x2050
movq (%rsp), %rax
movq 0x20(%rax), %rax
movl (%rax,%r14,8), %ecx
andl %ebx, %ecx
movq %r15, %rdi
movq %rbp, %rsi
movq %r13, %rdx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x22b0
movq (%rsp), %rcx
incq %r14
movl 0x14(%rcx), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpq %rax, %r14
jb 0xc9357
testl $0x7fffffff, 0x14(%rcx) # imm = 0x7FFFFFFF
je 0xc951f
xorl %r14d, %r14d
movq 0x20(%rcx), %rax
cmpl $0x0, (%rax,%r14,8)
js 0xc9507
movq (%rsp), %rax
movq 0x28(%rax), %rax
movq %r14, %rcx
shlq $0x4, %rcx
movq (%rax,%rcx), %rax
testl %eax, %eax
je 0xc9468
movq (%rsp), %rcx
movq 0x8(%rcx), %rcx
movq %rax, %rdx
shrq $0x20, %rdx
movl %eax, %eax
leal 0x1(%r14), %ebp
leaq (%rdx,%rdx,2), %rdx
leaq (%rcx,%rdx,8), %rbx
addq $0xc, %rbx
shlq $0x3, %rax
leaq (%rax,%rax,2), %r13
xorl %r12d, %r12d
movl (%rbx,%r12), %r10d
testl %r10d, %r10d
js 0xc945f
movl -0xc(%rbx,%r12), %r11d
movl -0x4(%rbx,%r12), %eax
movl %eax, %r8d
shrl %r8d
incl %r8d
andl $0x1, %eax
leaq 0x15cd8f(%rip), %rcx    # 0x2261c3
movsbl (%rax,%rcx), %r9d
subq $0x8, %rsp
movq %r15, %rdi
leaq 0x1631f9(%rip), %rsi    # 0x22c640
movl %ebp, %edx
movl $0x2b, %ecx
xorl %eax, %eax
pushq $0x0
pushq %r11
pushq %r10
callq 0x22b0
addq $0x20, %rsp
addq $0x18, %r12
cmpq %r12, %r13
jne 0xc940e
leaq (%r14,%r14), %rax
movq (%rsp), %rcx
movq 0x28(%rcx), %rcx
movq 0x8(%rcx,%rax,8), %rax
testl %eax, %eax
je 0xc9507
movq (%rsp), %rcx
movq 0x8(%rcx), %rcx
movq %rax, %rdx
shrq $0x20, %rdx
movl %eax, %eax
leal 0x1(%r14), %ebp
leaq (%rdx,%rdx,2), %rdx
leaq (%rcx,%rdx,8), %rbx
addq $0xc, %rbx
shlq $0x3, %rax
leaq (%rax,%rax,2), %r13
xorl %r12d, %r12d
movl (%rbx,%r12), %r10d
testl %r10d, %r10d
js 0xc94fe
movl -0xc(%rbx,%r12), %r11d
movl -0x4(%rbx,%r12), %eax
movl %eax, %r8d
shrl %r8d
incl %r8d
andl $0x1, %eax
leaq 0x15ccf0(%rip), %rcx    # 0x2261c3
movsbl (%rax,%rcx), %r9d
subq $0x8, %rsp
movq %r15, %rdi
leaq 0x16315a(%rip), %rsi    # 0x22c640
movl %ebp, %edx
movl $0x2d, %ecx
xorl %eax, %eax
pushq $0x0
pushq %r11
pushq %r10
callq 0x22b0
addq $0x20, %rsp
addq $0x18, %r12
cmpq %r12, %r13
jne 0xc94ad
incq %r14
movq (%rsp), %rcx
movl 0x14(%rcx), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpq %rax, %r14
jb 0xc93b8
movq %r15, %rdi
callq 0x2190
movq 0x8(%rsp), %rdi
callq 0x2220
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq