// File: /workspace/github_c_makefile_star2_O3/rikuu[P]kermit/miniasm/asm.c
// Function: ma_ug_print
void ma_ug_print(const ma_ug_t *ug, const sdict_t *d, const ma_sub_t *sub, FILE *fp)
{
	uint32_t i, j, l;
	char name[32];
	for (i = 0; i < ug->u.n; ++i) { // the Segment lines in GFA
		ma_utg_t *p = &ug->u.a[i];
		sprintf(name, "utg%.6d%c", i + 1, "lc"[p->circ]);
		fprintf(fp, "S\t%s\t%s\tLN:i:%d\n", name, p->s? p->s : "*", p->len);
		for (j = l = 0; j < p->n; l += (uint32_t)p->a[j++]) {
			uint32_t x = p->a[j]>>33;
			if (sub) fprintf(fp, "a\t%s\t%d\t%s:%d-%d\t%c\t%d\n", name, l, d->seq[x].name, sub[x].s + 1, sub[x].e, "+-"[p->a[j]>>32&1], (uint32_t)p->a[j]);
			else fprintf(fp, "a\t%s\t%d\t%s\t%c\t%d\n", name, l, d->seq[x].name, "+-"[p->a[j]>>32&1], (uint32_t)p->a[j]);
		}
	}
	for (i = 0; i < ug->g->n_arc; ++i) { // the Link lines in GFA
		uint32_t u = ug->g->arc[i].ul>>32, v = ug->g->arc[i].v;
		fprintf(fp, "L\tutg%.6d%c\t%c\tutg%.6d%c\t%c\t%dM\tSD:i:%d\n", (u>>1)+1, "lc"[ug->u.a[u>>1].circ], "+-"[u&1],
				(v>>1)+1, "lc"[ug->u.a[v>>1].circ], "+-"[v&1], ug->g->arc[i].ol, asg_arc_len(ug->g->arc[i]));
	}
	for (i = 0; i < ug->u.n; ++i) { // summary of unitigs
		uint32_t cnt[2];
		ma_utg_t *u = &ug->u.a[i];
		if (u->start == UINT32_MAX) {
			fprintf(fp, "x\tutg%.6dc\t%d\t%d\n", i + 1, u->len, u->n);
		} else {
			for (j = 0; j < 2; ++j) cnt[j] = asg_arc_n(ug->g, i<<1|j);
			if (sub)
				fprintf(fp, "x\tutg%.6dl\t%d\t%d\t%d\t%d\t%s:%d-%d\t%c\t%s:%d-%d\t%c\n", i + 1, u->len, u->n, cnt[1], cnt[0],
						d->seq[u->start>>1].name, sub[u->start>>1].s + 1, sub[u->start>>1].e, "+-"[u->start&1],
						d->seq[u->end>>1].name, sub[u->end>>1].s + 1, sub[u->end>>1].e, "+-"[u->end&1]);
			else
				fprintf(fp, "x\tutg%.6dl\t%d\t%d\t%d\t%d\t%s\t%c\t%s\t%c\n", i + 1, u->len, u->n, cnt[1], cnt[0],
						d->seq[u->start>>1].name, "+-"[u->start&1], d->seq[u->end>>1].name, "+-"[u->end&1]);
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rcx, 0x8(%rsp)
movq %rdx, %r14
movq %rsi, 0x28(%rsp)
movq %rdi, %rbx
cmpq $0x0, (%rdi)
movq %rdi, 0x18(%rsp)
je 0x691c
leaq 0x40(%rsp), %rbp
xorl %eax, %eax
xorl %edx, %edx
movq 0x10(%rbx), %rbx
leaq (%rax,%rax,4), %r15
incl %edx
movl (%rbx,%r15,8), %eax
shrl $0x1f, %eax
leaq 0x3dc0(%rip), %rcx      # 0xa598
movsbl (%rax,%rcx), %ecx
movq %rbp, %rdi
leaq 0x3da8(%rip), %rsi      # 0xa58e
movl %edx, 0x10(%rsp)
xorl %eax, %eax
callq 0x11f0
movq 0x20(%rbx,%r15,8), %rcx
testq %rcx, %rcx
leaq 0x3dac(%rip), %rax      # 0xa5ac
cmoveq %rax, %rcx
movl (%rbx,%r15,8), %r8d
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
andl %eax, %r8d
movq 0x8(%rsp), %rdi
leaq 0x3d7f(%rip), %rsi      # 0xa59b
movq %rbp, %rdx
xorl %eax, %eax
callq 0x1120
cmpl $0x0, 0x10(%rbx,%r15,8)
je 0x6903
leaq (%rbx,%r15,8), %r15
movq 0x18(%r15), %rax
xorl %ebx, %ebx
xorl %r13d, %r13d
movq (%rax,%rbx,8), %r10
movq %r10, %rax
shrq $0x21, %rax
movq %rax, %rcx
shlq $0x4, %rcx
movq 0x28(%rsp), %rdx
movq 0x8(%rdx), %rdx
movq (%rdx,%rcx), %r8
testq %r14, %r14
je 0x68b4
movl (%r14,%rax,8), %r9d
movl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
andl %ecx, %r9d
incl %r9d
movl 0x4(%r14,%rax,8), %r11d
btq $0x20, %r10
leaq 0x3ced(%rip), %rax      # 0xa570
adcq $0x0, %rax
movsbl (%rax), %r12d
subq $0x8, %rsp
movq 0x10(%rsp), %rdi
leaq 0x3d13(%rip), %rsi      # 0xa5ae
movq %rbp, %rdx
movl %r13d, %ecx
xorl %eax, %eax
pushq %r10
pushq %r12
pushq %r11
callq 0x1120
addq $0x20, %rsp
jmp 0x68eb
btq $0x20, %r10
leaq 0x3cb0(%rip), %rax      # 0xa570
adcq $0x0, %rax
movsbl (%rax), %r9d
subq $0x8, %rsp
movq 0x10(%rsp), %rdi
leaq 0x3cee(%rip), %rsi      # 0xa5c6
movq %rbp, %rdx
movl %r13d, %ecx
xorl %eax, %eax
pushq %r10
callq 0x1120
addq $0x10, %rsp
movq 0x18(%r15), %rax
addl (%rax,%rbx,8), %r13d
incq %rbx
movl 0x10(%r15), %ecx
cmpq %rcx, %rbx
jb 0x683f
movl 0x10(%rsp), %edx
movl %edx, %eax
movq 0x18(%rsp), %rbx
movq (%rbx), %rcx
cmpq %rax, %rcx
ja 0x67c0
jmp 0x691e
xorl %ecx, %ecx
movq 0x18(%rbx), %rax
testl $0x7fffffff, 0x4(%rax)  # imm = 0x7FFFFFFF
je 0x69f2
movl $0xc, %r13d
xorl %ebp, %ebp
movq 0x8(%rsp), %r12
movq 0x8(%rax), %rax
movq -0xc(%rax,%r13), %r10
movl -0x4(%rax,%r13), %esi
movq %r10, %rcx
shrq $0x21, %rcx
leal 0x1(%rcx), %edx
movq 0x10(%rbx), %rdi
leaq (%rcx,%rcx,4), %rcx
movl (%rdi,%rcx,8), %ecx
shrl $0x1f, %ecx
leaq 0x3c2f(%rip), %rbx      # 0xa598
movsbl (%rcx,%rbx), %ecx
btq $0x20, %r10
leaq 0x3bf7(%rip), %r15      # 0xa570
movq %r15, %r8
adcq $0x0, %r8
movsbl (%r8), %r8d
movl %esi, %r9d
shrl %r9d
leaq (%r9,%r9,4), %r11
incl %r9d
movl (%rdi,%r11,8), %edi
shrl $0x1f, %edi
movsbl (%rdi,%rbx), %r11d
andl $0x1, %esi
movsbl (%rsi,%r15), %ebx
movl (%rax,%r13), %r15d
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
andl %eax, %r15d
movq %r12, %rdi
leaq 0x3c1d(%rip), %rsi      # 0xa5d8
xorl %eax, %eax
pushq %r10
pushq %r15
pushq %rbx
movq 0x30(%rsp), %rbx
pushq %r11
callq 0x1120
addq $0x20, %rsp
incq %rbp
movq 0x18(%rbx), %rax
movl 0x4(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
addq $0x10, %r13
cmpq %rcx, %rbp
jb 0x693c
movq (%rbx), %rcx
testq %rcx, %rcx
movq 0x8(%rsp), %r15
je 0x6b8b
movl $0x7fffffff, %r12d      # imm = 0x7FFFFFFF
xorl %eax, %eax
xorl %r13d, %r13d
movq 0x10(%rbx), %rcx
leaq (%rax,%rax,4), %rax
leaq (%rcx,%rax,8), %rax
movl 0x4(%rax), %edx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpq %rcx, %rdx
je 0x6b04
leal (,%r13,2), %edi
incl %r13d
movl (%rax), %ecx
andl %r12d, %ecx
movl %edx, %esi
shrl %esi
movq %rsi, %r11
shlq $0x4, %r11
movq 0x18(%rbx), %r8
movq 0x20(%r8), %r8
movl (%r8,%rdi,8), %r9d
movq %r9, 0x10(%rsp)
movl 0x8(%r8,%rdi,8), %r9d
movl 0x10(%rax), %r8d
movq 0x28(%rsp), %rdi
movl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
movq 0x8(%rdi), %r12
movq (%r12,%r11), %rdi
movq %rdi, 0x20(%rsp)
testq %r14, %r14
je 0x6b26
movl (%r14,%rsi,8), %ebx
andl %ebp, %ebx
incl %ebx
movl 0x4(%r14,%rsi,8), %esi
movq %rsi, 0x38(%rsp)
andl $0x1, %edx
leaq 0x3ad7(%rip), %rsi      # 0xa570
movsbl (%rdx,%rsi), %edx
movq %rdx, 0x30(%rsp)
movl 0x8(%rax), %eax
movl %eax, %r15d
shrl %r15d
movl (%r14,%r15,8), %r10d
movl 0x4(%r14,%r15,8), %r11d
shlq $0x4, %r15
andl %ebp, %r10d
incl %r10d
andl $0x1, %eax
movsbl (%rax,%rsi), %ebp
subq $0x8, %rsp
movq 0x10(%rsp), %rdi
leaq 0x3b3e(%rip), %rsi      # 0xa613
movl %r13d, %edx
xorl %eax, %eax
pushq %rbp
pushq %r11
pushq %r10
pushq (%r12,%r15)
movq 0x30(%rsp), %r15
pushq 0x58(%rsp)
pushq 0x68(%rsp)
pushq %rbx
pushq 0x60(%rsp)
pushq 0x58(%rsp)
callq 0x1120
addq $0x50, %rsp
jmp 0x6b74
incl %r13d
movl (%rax), %ecx
andl %r12d, %ecx
movl 0x10(%rax), %r8d
movq %r15, %rdi
leaq 0x3ae7(%rip), %rsi      # 0xa601
movl %r13d, %edx
xorl %eax, %eax
callq 0x1120
jmp 0x6b7f
andl $0x1, %edx
leaq 0x3a40(%rip), %rsi      # 0xa570
movsbl (%rdx,%rsi), %r10d
movl 0x8(%rax), %eax
movl %eax, %r11d
shrl %r11d
shlq $0x4, %r11
andl $0x1, %eax
movsbl (%rax,%rsi), %ebx
subq $0x8, %rsp
movq %r15, %rdi
leaq 0x3aec(%rip), %rsi      # 0xa643
movl %r13d, %edx
xorl %eax, %eax
pushq %rbx
pushq (%r12,%r11)
pushq %r10
pushq 0x40(%rsp)
pushq 0x38(%rsp)
callq 0x1120
addq $0x30, %rsp
movq 0x18(%rsp), %rbx
movl $0x7fffffff, %r12d      # imm = 0x7FFFFFFF
movl %r13d, %eax
cmpq %rax, (%rbx)
ja 0x6a0b
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq