// File: /workspace/github_c_makefile_star2_O2/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, %r14
movq %rdi, %r15
xorl %ebp, %ebp
movq %rdi, 0x20(%rsp)
movl 0x4(%r15), %eax
cmpq %rax, %rbp
jae 0x6fb3
movq 0x10(%r15), %rbx
movq %rbp, %rax
shlq $0x6, %rax
cmpw $0x0, 0x4(%rbx,%rax)
je 0x6e1a
incq %rbp
movq 0x20(%rsp), %r15
jmp 0x6df0
addq %rax, %rbx
movq 0x18(%rbx), %rdx
movq %r14, %rdi
leaq 0x1c6aa(%rip), %rsi     # 0x234d5
xorl %eax, %eax
callq 0x2210
testb $0x2, 0x1c(%rsp)
jne 0x6e4c
movq 0x20(%rbx), %rdi
testq %rdi, %rdi
je 0x6e4c
movq %r14, %rsi
callq 0x2170
jmp 0x6e57
pushq $0x2a
popq %rdi
movq %r14, %rsi
callq 0x21b0
movl (%rbx), %edx
movq %r14, %rdi
leaq 0x1c678(%rip), %rsi     # 0x234db
xorl %eax, %eax
callq 0x2210
movslq 0x8(%rbx), %rax
testq %rax, %rax
movq 0x20(%rsp), %rdx
js 0x6e9c
movl 0xc(%rbx), %ecx
testl %ecx, %ecx
js 0x6e9c
movq 0x28(%rdx), %rdx
imulq $0x18, %rax, %rax
movq (%rdx,%rax), %rdx
movq %r14, %rdi
leaq 0x1c64f(%rip), %rsi     # 0x234e4
xorl %eax, %eax
callq 0x2210
movl 0x10(%rbx), %edx
testl %edx, %edx
js 0x6eb4
movq %r14, %rdi
leaq 0x1c648(%rip), %rsi     # 0x234f5
xorl %eax, %eax
callq 0x2210
movq 0x28(%rbx), %rax
testq %rax, %rax
je 0x6ed8
movl 0x14(%rax), %edx
testl %edx, %edx
je 0x6ed8
movl 0x8(%rax), %ecx
movq %r14, %rdi
leaq 0x1c62d(%rip), %rsi     # 0x234fe
xorl %eax, %eax
callq 0x2210
movl 0x34(%rbx), %edi
testl %edi, %edi
je 0x6f15
andq $0x0, 0x10(%rsp)
andl $0x0, 0xc(%rsp)
movq 0x38(%rbx), %rsi
leaq 0x10(%rsp), %rdx
leaq 0xc(%rsp), %rcx
callq 0x5c6e
movq 0x10(%rsp), %r13
movq %r13, %rdi
movq %r14, %rsi
callq 0x2170
movq %r13, %rdi
callq 0x2040
pushq $0xa
popq %rdi
movq %r14, %rsi
callq 0x21b0
movq 0x28(%rbx), %r12
testq %r12, %r12
je 0x6e10
movl 0x14(%r12), %eax
testl %eax, %eax
je 0x6e10
xorl %r15d, %r15d
xorl %r13d, %r13d
movl %eax, %eax
cmpq %rax, %r15
jae 0x6e10
movq 0x18(%rbx), %rdx
movq 0x18(%r12), %rax
movq 0x20(%r12), %rcx
btq $0x20, (%rax,%r15,8)
leaq 0x1c409(%rip), %rax     # 0x2336f
adcq $0x0, %rax
movsbl (%rax), %r8d
movq 0x28(%r12), %rax
movq (%rax,%r15,8), %r9
movq (%rcx,%r15,8), %r10
movq %r10, %r11
shrq $0x20, %r11
movq %r14, %rdi
leaq 0x1c583(%rip), %rsi     # 0x2350f
movl %r13d, %ecx
xorl %eax, %eax
pushq %r10
pushq %r11
callq 0x2210
popq %rcx
popq %rdx
movq 0x18(%r12), %rax
addl (%rax,%r15,8), %r13d
incq %r15
movq 0x28(%rbx), %r12
movl 0x14(%r12), %eax
jmp 0x6f40
pushq $0x18
popq %r13
movabsq $0x1fffffffffffffff, %rdx # imm = 0x1FFFFFFFFFFFFFFF
xorl %ebx, %ebx
movq 0x40(%r15), %rcx
cmpq %rcx, %rbx
jae 0x715c
movq 0x48(%r15), %r12
movq (%r12,%r13), %rax
movq %rax, %rbp
andq %rdx, %rbp
cmpq %rcx, %rbp
jae 0x6fed
shlq $0x4, %rbp
addq 0x50(%r15), %rbp
jmp 0x6fef
xorl %ebp, %ebp
shrq $0x3e, %rax
jne 0x7150
movq 0x10(%r15), %rax
movq -0x18(%r12,%r13), %rcx
movq %rcx, %rdx
shrq $0x1b, %rdx
andq $-0x40, %rdx
movq 0x18(%rax,%rdx), %rdx
btq $0x20, %rcx
leaq 0x1c351(%rip), %r9      # 0x2336f
movq %r9, %rcx
adcq $0x0, %rcx
movsbl (%rcx), %ecx
movl -0x10(%r12,%r13), %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 0x1c4d8(%rip), %rsi     # 0x23524
xorl %eax, %eax
callq 0x2210
movl -0x8(%r12,%r13), %edx
movl -0x4(%r12,%r13), %ecx
testb $0x1, 0x1c(%rsp)
jne 0x7077
cmpl %ecx, %edx
cmovll %edx, %ecx
movq %r14, %rdi
leaq 0x1c4bf(%rip), %rsi     # 0x23532
movl %ecx, %edx
jmp 0x7085
movq %r14, %rdi
cmpl %ecx, %edx
jne 0x708e
leaq 0x1c4ad(%rip), %rsi     # 0x23532
xorl %eax, %eax
callq 0x2210
jmp 0x709c
leaq 0x1c4a2(%rip), %rsi     # 0x23537
xorl %eax, %eax
callq 0x2210
movl -0xc(%r12,%r13), %edx
testl %edx, %edx
js 0x70b6
movq %r14, %rdi
leaq 0x1c446(%rip), %rsi     # 0x234f5
xorl %eax, %eax
callq 0x2210
movl -0x18(%r12,%r13), %edx
movq %r14, %rdi
leaq 0x1c479(%rip), %rsi     # 0x2353e
xorl %eax, %eax
callq 0x2210
movq 0x10(%r15), %rax
movl -0x10(%r12,%r13), %ecx
shrl %ecx
shlq $0x6, %rcx
movl (%rax,%rcx), %edx
subl -0x4(%r12,%r13), %edx
movq %r14, %rdi
leaq 0x1c45a(%rip), %rsi     # 0x23547
xorl %eax, %eax
callq 0x2210
testq %rbp, %rbp
je 0x713b
movl 0x4(%rbp), %edi
testl %edi, %edi
je 0x713b
andq $0x0, 0x10(%rsp)
andl $0x0, 0xc(%rsp)
movq 0x8(%rbp), %rsi
leaq 0x10(%rsp), %rdx
leaq 0xc(%rsp), %rcx
callq 0x5c6e
movq 0x10(%rsp), %rbp
testq %rbp, %rbp
je 0x7133
movq %rbp, %rdi
movq %r14, %rsi
callq 0x2170
movq %rbp, %rdi
callq 0x2040
pushq $0xa
popq %rdi
movq %r14, %rsi
callq 0x21b0
movabsq $0x1fffffffffffffff, %rdx # imm = 0x1FFFFFFFFFFFFFFF
incq %rbx
addq $0x20, %r13
jmp 0x6fc3
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop