// File: 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
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x20a0
movq %rax, %rdi
addq $0x32, %rdi
callq 0x2270
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rdx
leaq 0x27976c(%rip), %rsi    # 0x387c27
movb $0x0, %al
callq 0x2050
movq -0x18(%rbp), %rdi
leaq 0x28af05(%rip), %rsi    # 0x3993d2
callq 0x2200
movq %rax, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x8(%rbp), %rcx
movl 0x14(%rcx), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpl %ecx, %eax
jae 0x10e559
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x24(%rbp), %ecx
movl (%rax,%rcx,8), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x10e509
jmp 0x10e54e
leaq -0x50(%rbp), %rdi
movl -0x24(%rbp), %edx
addl $0x1, %edx
leaq 0x27971e(%rip), %rsi    # 0x387c38
movb $0x0, %al
callq 0x2050
movq -0x20(%rbp), %rdi
leaq -0x50(%rbp), %rdx
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x24(%rbp), %ecx
movl (%rax,%rcx,8), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
leaq 0x2788e6(%rip), %rsi    # 0x386e2a
xorl %r8d, %r8d
movb $0x0, %al
callq 0x22a0
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x10e4dd
movq $0x0, -0x58(%rbp)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x8(%rbp), %rcx
movl 0x14(%rcx), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpl %ecx, %eax
jae 0x10e7ee
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x24(%rbp), %ecx
movl (%rax,%rcx,8), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x10e59b
jmp 0x10e7e0
movl -0x24(%rbp), %eax
shll %eax
movl %eax, -0x60(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x28(%rcx), %rcx
movl -0x60(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x60(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x5c(%rbp)
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x5c(%rbp), %eax
jae 0x10e6bb
movq -0x58(%rbp), %rax
movl -0x28(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x10e60c
jmp 0x10e6ad
movq -0x58(%rbp), %rax
movl -0x28(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl %eax, -0x64(%rbp)
movq -0x20(%rbp), %rdi
movl -0x60(%rbp), %edx
shrl %edx
addl $0x1, %edx
movl -0x60(%rbp), %eax
andl $0x1, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x27485e(%rip), %rax    # 0x382e9b
movsbl (%rax,%rcx), %ecx
movl -0x64(%rbp), %r8d
shrl %r8d
addl $0x1, %r8d
movl -0x64(%rbp), %eax
andl $0x1, %eax
movl %eax, %eax
movl %eax, %esi
leaq 0x27483e(%rip), %rax    # 0x382e9b
movsbl (%rax,%rsi), %r9d
movq -0x58(%rbp), %rax
movl -0x28(%rbp), %esi
imulq $0x18, %rsi, %rsi
addq %rsi, %rax
movl 0xc(%rax), %r10d
andl $0x7fffffff, %r10d      # imm = 0x7FFFFFFF
movq -0x58(%rbp), %rax
movl -0x28(%rbp), %esi
imulq $0x18, %rsi, %rsi
addq %rsi, %rax
movq (%rax), %rax
leaq 0x27adc8(%rip), %rsi    # 0x38945b
xorl %r11d, %r11d
movl %r10d, (%rsp)
movl %eax, 0x8(%rsp)
movl $0x0, 0x10(%rsp)
movb $0x0, %al
callq 0x22a0
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x10e5e2
movl -0x24(%rbp), %eax
shll %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x28(%rcx), %rcx
movl -0x60(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x60(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x5c(%rbp)
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x5c(%rbp), %eax
jae 0x10e7de
movq -0x58(%rbp), %rax
movl -0x28(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x10e72f
jmp 0x10e7d0
movq -0x58(%rbp), %rax
movl -0x28(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl %eax, -0x64(%rbp)
movq -0x20(%rbp), %rdi
movl -0x60(%rbp), %edx
shrl %edx
addl $0x1, %edx
movl -0x60(%rbp), %eax
andl $0x1, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x27473b(%rip), %rax    # 0x382e9b
movsbl (%rax,%rcx), %ecx
movl -0x64(%rbp), %r8d
shrl %r8d
addl $0x1, %r8d
movl -0x64(%rbp), %eax
andl $0x1, %eax
movl %eax, %eax
movl %eax, %esi
leaq 0x27471b(%rip), %rax    # 0x382e9b
movsbl (%rax,%rsi), %r9d
movq -0x58(%rbp), %rax
movl -0x28(%rbp), %esi
imulq $0x18, %rsi, %rsi
addq %rsi, %rax
movl 0xc(%rax), %r10d
andl $0x7fffffff, %r10d      # imm = 0x7FFFFFFF
movq -0x58(%rbp), %rax
movl -0x28(%rbp), %esi
imulq $0x18, %rsi, %rsi
addq %rsi, %rax
movq (%rax), %rax
leaq 0x27aca5(%rip), %rsi    # 0x38945b
xorl %r11d, %r11d
movl %r10d, (%rsp)
movl %eax, 0x8(%rsp)
movl $0x0, 0x10(%rsp)
movb $0x0, %al
callq 0x22a0
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x10e705
jmp 0x10e7e0
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x10e568
movq -0x20(%rbp), %rdi
callq 0x21a0
movq -0x18(%rbp), %rdi
callq 0x2210
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax)