// File: /workspace/github_cpp_makefile_star2_O3/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 0x16ca5b(%rip), %rsi    # 0x23703c
movq %rax, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x2050
leaq 0x17e0ed(%rip), %rsi    # 0x2486e2
movq %r14, 0x8(%rsp)
movq %r14, %rdi
callq 0x2210
movq %rax, %r15
movl 0x14(%rbx), %eax
testl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
je 0xca7ed
movq %rbx, %rdx
leaq 0x16ca30(%rip), %r12    # 0x23704d
leaq 0x10(%rsp), %r13
movl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
leaq 0x16bdcf(%rip), %rbp    # 0x2363fe
xorl %ebx, %ebx
movq %rdx, (%rsp)
movq 0x20(%rdx), %rcx
cmpl $0x0, (%rcx,%rbx,8)
js 0xca677
leal 0x1(%rbx), %edx
movq %r13, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0x2050
movq (%rsp), %rax
movq 0x20(%rax), %rax
movl (%rax,%rbx,8), %ecx
andl %r14d, %ecx
movq %r15, %rdi
movq %rbp, %rsi
movq %r13, %rdx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x22b0
movq (%rsp), %rdx
movl 0x14(%rdx), %eax
incq %rbx
movl %eax, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpq %rcx, %rbx
jb 0xca635
testl %ecx, %ecx
je 0xca7ed
xorl %r14d, %r14d
movq 0x20(%rdx), %rax
cmpl $0x0, (%rax,%r14,8)
js 0xca7d5
movq (%rsp), %rcx
movq 0x8(%rcx), %rax
movq 0x28(%rcx), %rcx
movq %r14, %rdx
shlq $0x4, %rdx
movq (%rcx,%rdx), %rdx
testl %edx, %edx
je 0xca74a
movq %rdx, %rcx
shrq $0x20, %rcx
movl %edx, %edx
leal 0x1(%r14), %ebp
leaq (%rcx,%rcx,2), %rcx
leaq (%rax,%rcx,8), %rbx
addq $0xc, %rbx
shlq $0x3, %rdx
leaq (%rdx,%rdx,2), %r13
xorl %r12d, %r12d
movl (%rbx,%r12), %r10d
testl %r10d, %r10d
js 0xca735
movl -0xc(%rbx,%r12), %r11d
movl -0x4(%rbx,%r12), %eax
movl %eax, %r8d
shrl %r8d
incl %r8d
andl $0x1, %eax
leaq 0x167bc9(%rip), %rcx    # 0x2322d3
movsbl (%rax,%rcx), %r9d
subq $0x8, %rsp
movq %r15, %rdi
leaq 0x16e113(%rip), %rsi    # 0x238830
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 0xca6e4
movq (%rsp), %rcx
movq 0x8(%rcx), %rax
movq 0x28(%rcx), %rcx
leaq (%r14,%r14), %rdx
movq 0x8(%rcx,%rdx,8), %rcx
testl %ecx, %ecx
je 0xca7d5
movq %rcx, %rdx
shrq $0x20, %rdx
movl %ecx, %ecx
leal 0x1(%r14), %ebp
leaq (%rdx,%rdx,2), %rdx
leaq (%rax,%rdx,8), %rbx
addq $0xc, %rbx
shlq $0x3, %rcx
leaq (%rcx,%rcx,2), %r13
xorl %r12d, %r12d
movl (%rbx,%r12), %r10d
testl %r10d, %r10d
js 0xca7cc
movl -0xc(%rbx,%r12), %r11d
movl -0x4(%rbx,%r12), %eax
movl %eax, %r8d
shrl %r8d
incl %r8d
andl $0x1, %eax
leaq 0x167b32(%rip), %rcx    # 0x2322d3
movsbl (%rax,%rcx), %r9d
subq $0x8, %rsp
movq %r15, %rdi
leaq 0x16e07c(%rip), %rsi    # 0x238830
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 0xca77b
incq %r14
movq (%rsp), %rdx
movl 0x14(%rdx), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpq %rax, %r14
jb 0xca692
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