// File: /workspace/github_c_makefile_star2_O3/lh3[P]minigraph/gfa-io.c
// Function: gfa_print
void gfa_print(const gfa_t *g, FILE *fp, int flag)
{
	uint32_t i;
	uint64_t k;
	for (i = 0; i < g->n_seg; ++i) {
		const gfa_seg_t *s = &g->seg[i];
		if (s->del) continue;
		fprintf(fp, "S\t%s\t", s->name);
		if (s->seq && !(flag & GFA_O_NO_SEQ)) fputs(s->seq, fp);
		else fputc('*', fp);
		fprintf(fp, "\tLN:i:%d", s->len);
		if (s->snid >= 0 && s->soff >= 0)
			fprintf(fp, "\tSN:Z:%s\tSO:i:%d", g->sseq[s->snid].name, s->soff);
		if (s->rank >= 0)
			fprintf(fp, "\tSR:i:%d", s->rank);
		if (s->utg && s->utg->n) fprintf(fp, "\tRC:i:%d\tlc:i:%d", s->utg->n, s->utg->len_comp);
		if (s->aux.l_aux > 0) {
			char *t = 0;
			int max = 0;
			gfa_aux_format(s->aux.l_aux, s->aux.aux, &t, &max);
			fputs(t, fp);
			free(t);
		}
		fputc('\n', fp);
		if (s->utg && s->utg->n) {
			uint32_t j, l;
			for (j = l = 0; j < s->utg->n; ++j) {
				const gfa_utg_t *u = s->utg;
				fprintf(fp, "A\t%s\t%d\t%c\t%s\t%d\t%d\n", s->name, l, "+-"[u->a[j]>>32&1], u->name[j], (int32_t)(u->r[j]>>32), (int32_t)u->r[j]);
				l += (uint32_t)u->a[j];
			}
		}
	}
	for (k = 0; k < g->n_arc; ++k) {
		const gfa_arc_t *a = &g->arc[k];
		const gfa_aux_t *aux = a->link_id < g->n_arc? &g->link_aux[a->link_id] : 0;
		if (a->del || a->comp) continue;
		fprintf(fp, "L\t%s\t%c\t%s\t%c", g->seg[a->v_lv>>33].name, "+-"[a->v_lv>>32&1], g->seg[a->w>>1].name, "+-"[a->w&1]);
		if (!(flag & GFA_O_OV_EXT)) {
			fprintf(fp, "\t%dM", a->ov < a->ow? a->ov : a->ow);
		} else {
			if (a->ov == a->ow) fprintf(fp, "\t%dM", a->ov);
			else fprintf(fp, "\t%d:%d", a->ov, a->ow);
		}
		if (a->rank >= 0) fprintf(fp, "\tSR:i:%d", a->rank);
		fprintf(fp, "\tL1:i:%d", gfa_arc_len(*a));
		fprintf(fp, "\tL2:i:%d", gfa_arc_lw(g, *a));
		if (aux && aux->l_aux) {
			char *t = 0;
			int max = 0;
			gfa_aux_format(aux->l_aux, aux->aux, &t, &max);
			if (t) fputs(t, fp);
			free(t);
		}
		fputc('\n', fp);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %edx, 0x1c(%rsp)
movq %rsi, (%rsp)
cmpl $0x0, 0x4(%rdi)
movq %rdi, 0x20(%rsp)
je 0x8f15
xorl %ebx, %ebx
movq 0x10(%rdi), %r13
movq %rbx, %rax
shlq $0x6, %rax
cmpw $0x0, 0x4(%r13,%rax)
movq (%rsp), %rdi
je 0x8d61
incq %rbx
movq 0x20(%rsp), %rdi
movl 0x4(%rdi), %eax
cmpq %rax, %rbx
jb 0x8d34
jmp 0x8f15
addq %rax, %r13
movq 0x18(%r13), %rdx
leaq 0x1f75d(%rip), %rsi     # 0x284cc
xorl %eax, %eax
callq 0x2210
testb $0x2, 0x1c(%rsp)
jne 0x8d94
movq 0x20(%r13), %rdi
testq %rdi, %rdi
je 0x8d94
movq (%rsp), %r14
movq %r14, %rsi
callq 0x2170
jmp 0x8da5
movl $0x2a, %edi
movq (%rsp), %r14
movq %r14, %rsi
callq 0x21b0
movl (%r13), %edx
movq %r14, %rdi
leaq 0x1f71f(%rip), %rsi     # 0x284d2
xorl %eax, %eax
callq 0x2210
movslq 0x8(%r13), %rax
testq %rax, %rax
js 0x8dee
movl 0xc(%r13), %ecx
testl %ecx, %ecx
js 0x8dee
movq 0x20(%rsp), %rdx
movq 0x28(%rdx), %rdx
leaq (%rax,%rax,2), %rax
movq (%rdx,%rax,8), %rdx
movq (%rsp), %rdi
leaq 0x1f6f4(%rip), %rsi     # 0x284db
xorl %eax, %eax
callq 0x2210
movl 0x10(%r13), %edx
testl %edx, %edx
js 0x8e08
movq (%rsp), %rdi
leaq 0x1f6eb(%rip), %rsi     # 0x284ec
xorl %eax, %eax
callq 0x2210
movq 0x28(%r13), %rax
testq %rax, %rax
je 0x8e2d
movl 0x14(%rax), %edx
testl %edx, %edx
je 0x8e2d
movl 0x8(%rax), %ecx
movq (%rsp), %rdi
leaq 0x1f6cf(%rip), %rsi     # 0x284f5
xorl %eax, %eax
callq 0x2210
movl 0x34(%r13), %edi
testl %edi, %edi
movq (%rsp), %r14
je 0x8e75
movq $0x0, 0x10(%rsp)
movl $0x0, 0xc(%rsp)
movq 0x38(%r13), %rsi
leaq 0x10(%rsp), %rdx
leaq 0xc(%rsp), %rcx
callq 0x708b
movq 0x10(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0x2170
movq %r12, %rdi
callq 0x2040
movl $0xa, %edi
movq %r14, %rsi
callq 0x21b0
movq 0x28(%r13), %rbp
testq %rbp, %rbp
leaq 0x1f4df(%rip), %rsi     # 0x2836f
je 0x8d4c
cmpl $0x0, 0x14(%rbp)
je 0x8d4c
xorl %r15d, %r15d
xorl %r12d, %r12d
movq 0x18(%r13), %rdx
movq 0x18(%rbp), %rax
movq 0x20(%rbp), %rcx
btq $0x20, (%rax,%r15,8)
movq %rsi, %rax
adcq $0x0, %rax
movsbl (%rax), %r8d
movq 0x28(%rbp), %rax
movq (%rax,%r15,8), %r9
movq (%rcx,%r15,8), %r10
movq %r10, %r11
shrq $0x20, %r11
movq %r14, %rdi
leaq 0x1f626(%rip), %rsi     # 0x28506
movl %r12d, %ecx
xorl %eax, %eax
pushq %r10
pushq %r11
callq 0x2210
leaq 0x1f47a(%rip), %rsi     # 0x2836f
addq $0x10, %rsp
movq 0x18(%rbp), %rax
addl (%rax,%r15,8), %r12d
incq %r15
movq 0x28(%r13), %rbp
movl 0x14(%rbp), %eax
cmpq %rax, %r15
jb 0x8ea6
jmp 0x8d4c
movq 0x40(%rdi), %rax
testq %rax, %rax
movq (%rsp), %r14
je 0x90d1
movl $0x18, %ebp
movabsq $0x1fffffffffffffff, %r15 # imm = 0x1FFFFFFFFFFFFFFF
xorl %r13d, %r13d
movq 0x48(%rdi), %rbx
movq (%rbx,%rbp), %rcx
movq %rcx, %r12
andq %r15, %r12
cmpq %rax, %r12
jae 0x8f55
shlq $0x4, %r12
addq 0x50(%rdi), %r12
jmp 0x8f58
xorl %r12d, %r12d
shrq $0x3e, %rcx
jne 0x90c1
movq 0x10(%rdi), %rax
movq -0x18(%rbx,%rbp), %rcx
movq %rcx, %rdx
shrq $0x1b, %rdx
andq $-0x40, %rdx
movq 0x18(%rax,%rdx), %rdx
btq $0x20, %rcx
leaq 0x1f3e8(%rip), %r9      # 0x2836f
movq %r9, %rcx
adcq $0x0, %rcx
movsbl (%rcx), %ecx
movl -0x10(%rbx,%rbp), %esi
movl %esi, %edi
shrl %edi
shlq $0x6, %rdi
movq 0x18(%rax,%rdi), %r8
andl $0x1, %esi
movsbl (%rsi,%r9), %r9d
movq %r14, %rdi
leaq 0x1f567(%rip), %rsi     # 0x2851b
xorl %eax, %eax
callq 0x2210
movl -0x8(%rbx,%rbp), %edx
movl -0x4(%rbx,%rbp), %ecx
testb $0x1, 0x1c(%rsp)
jne 0x8fdd
cmpl %ecx, %edx
cmovll %edx, %ecx
movq %r14, %rdi
leaq 0x1f550(%rip), %rsi     # 0x28529
movl %ecx, %edx
jmp 0x8feb
movq %r14, %rdi
cmpl %ecx, %edx
jne 0x8ff4
leaq 0x1f53e(%rip), %rsi     # 0x28529
xorl %eax, %eax
callq 0x2210
jmp 0x9002
leaq 0x1f533(%rip), %rsi     # 0x2852e
xorl %eax, %eax
callq 0x2210
movl -0xc(%rbx,%rbp), %edx
testl %edx, %edx
js 0x901b
movq %r14, %rdi
leaq 0x1f4d8(%rip), %rsi     # 0x284ec
xorl %eax, %eax
callq 0x2210
movl -0x18(%rbx,%rbp), %edx
movq %r14, %rdi
leaq 0x1f50c(%rip), %rsi     # 0x28535
xorl %eax, %eax
callq 0x2210
movq 0x20(%rsp), %rax
movq 0x10(%rax), %rax
movl -0x10(%rbx,%rbp), %ecx
shrl %ecx
shlq $0x6, %rcx
movl (%rax,%rcx), %edx
subl -0x4(%rbx,%rbp), %edx
movq %r14, %rdi
leaq 0x1f4ea(%rip), %rsi     # 0x2853e
xorl %eax, %eax
callq 0x2210
testq %r12, %r12
je 0x90ab
movl 0x4(%r12), %edi
testl %edi, %edi
je 0x90ab
movq $0x0, 0x10(%rsp)
movl $0x0, 0xc(%rsp)
movq 0x8(%r12), %rsi
leaq 0x10(%rsp), %rdx
leaq 0xc(%rsp), %rcx
callq 0x708b
movq 0x10(%rsp), %r12
testq %r12, %r12
je 0x90a3
movq %r12, %rdi
movq %r14, %rsi
callq 0x2170
movq %r12, %rdi
callq 0x2040
movl $0xa, %edi
movq %r14, %rsi
callq 0x21b0
movq 0x20(%rsp), %rdi
movq 0x40(%rdi), %rax
incq %r13
addq $0x20, %rbp
cmpq %rax, %r13
jb 0x8f38
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq