// File: /workspace/github_cpp_makefile_star2_O2/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, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x2090
leaq 0x32(%rax), %rdi
callq 0x2280
movq %rax, %r15
leaq 0x15a8c4(%rip), %rsi    # 0x1e8f3c
movq %rax, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2050
leaq 0x16c015(%rip), %rsi    # 0x1fa6a1
movq %r15, 0x8(%rsp)
movq %r15, %rdi
callq 0x2210
movq %rax, (%rsp)
leaq 0x15a8a9(%rip), %r14    # 0x1e8f4d
leaq 0x10(%rsp), %r12
movl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
leaq 0x159c49(%rip), %r13    # 0x1e82fe
xorl %r15d, %r15d
movl 0x14(%rbx), %eax
movl %eax, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpq %rcx, %r15
jae 0x8e707
movq 0x20(%rbx), %rax
cmpl $0x0, (%rax,%r15,8)
js 0x8e702
leal 0x1(%r15), %edx
movq %r12, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x2050
movq 0x20(%rbx), %rax
movl (%rax,%r15,8), %ecx
andl %ebp, %ecx
movq (%rsp), %rdi
movq %r13, %rsi
movq %r12, %rdx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x22b0
incq %r15
jmp 0x8e6b8
xorl %r14d, %r14d
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
leaq 0x1(%r14), %rcx
shlq $0x4, %r14
movq %r14, %r13
movq %rcx, %r14
leaq -0x1(%r14), %rcx
cmpq %rax, %rcx
jae 0x8e84e
movq 0x20(%rbx), %rcx
cmpl $0x0, -0x8(%rcx,%r14,8)
jns 0x8e73f
incq %r14
addq $0x10, %r13
jmp 0x8e71d
movq 0x8(%rbx), %rax
movq 0x28(%rbx), %rcx
movq (%rcx,%r13), %rcx
movl %ecx, %edx
shrq $0x20, %rcx
imulq $0x18, %rdx, %rbp
imulq $0x18, %rcx, %rcx
leaq (%rax,%rcx), %r12
addq $0xc, %r12
xorl %r15d, %r15d
cmpq %r15, %rbp
je 0x8e7c1
movl (%r12,%r15), %r10d
testl %r10d, %r10d
js 0x8e7bb
movl -0xc(%r12,%r15), %r11d
movl -0x4(%r12,%r15), %eax
movl %eax, %r8d
shrl %r8d
incl %r8d
andl $0x1, %eax
leaq 0x155a94(%rip), %rcx    # 0x1e4223
movsbl (%rax,%rcx), %r9d
subq $0x8, %rsp
movq 0x8(%rsp), %rdi
leaq 0x15bf8c(%rip), %rsi    # 0x1ea730
movl %r14d, %edx
pushq $0x2b
popq %rcx
xorl %eax, %eax
pushq $0x0
pushq %r11
pushq %r10
callq 0x22b0
addq $0x20, %rsp
addq $0x18, %r15
jmp 0x8e764
movq 0x8(%rbx), %rax
movq 0x28(%rbx), %rcx
movq 0x8(%rcx,%r13), %rcx
movl %ecx, %edx
shrq $0x20, %rcx
imulq $0x18, %rdx, %r13
imulq $0x18, %rcx, %rcx
leaq (%rax,%rcx), %r12
addq $0xc, %r12
xorl %r15d, %r15d
pushq $0x2d
popq %rbp
cmpq %r15, %r13
je 0x8e846
movl (%r12,%r15), %r10d
testl %r10d, %r10d
js 0x8e840
movl -0xc(%r12,%r15), %r11d
movl -0x4(%r12,%r15), %eax
movl %eax, %r8d
shrl %r8d
incl %r8d
andl $0x1, %eax
leaq 0x155a0e(%rip), %rcx    # 0x1e4223
movsbl (%rax,%rcx), %r9d
subq $0x8, %rsp
movq 0x8(%rsp), %rdi
leaq 0x15bf06(%rip), %rsi    # 0x1ea730
movl %r14d, %edx
movl %ebp, %ecx
xorl %eax, %eax
pushq $0x0
pushq %r11
pushq %r10
callq 0x22b0
addq $0x20, %rsp
addq $0x18, %r15
jmp 0x8e7ea
movl 0x14(%rbx), %eax
jmp 0x8e70a
movq (%rsp), %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