// File: /workspace/github_c_makefile_star2_O1/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
cmpl $0x0, 0x4(%rdi)
movq %rdi, 0x20(%rsp)
je 0x8b11
xorl %ebx, %ebx
movq 0x10(%rdi), %r13
movq %rbx, %rax
shlq $0x6, %rax
cmpw $0x0, 0x4(%r13,%rax)
je 0x8964
incq %rbx
movq 0x20(%rsp), %rdi
movl 0x4(%rdi), %eax
cmpq %rax, %rbx
jb 0x893b
jmp 0x8b11
addq %rax, %r13
movq 0x18(%r13), %rdx
movq %r14, %rdi
leaq 0x1fb57(%rip), %rsi     # 0x284cc
xorl %eax, %eax
callq 0x2210
testb $0x2, 0x1c(%rsp)
jne 0x8996
movq 0x20(%r13), %rdi
testq %rdi, %rdi
je 0x8996
movq %r14, %rsi
callq 0x2170
jmp 0x89a3
movl $0x2a, %edi
movq %r14, %rsi
callq 0x21b0
movl (%r13), %edx
movq %r14, %rdi
leaq 0x1fb21(%rip), %rsi     # 0x284d2
xorl %eax, %eax
callq 0x2210
movslq 0x8(%r13), %rax
testq %rax, %rax
js 0x89eb
movl 0xc(%r13), %ecx
testl %ecx, %ecx
js 0x89eb
movq 0x20(%rsp), %rdx
movq 0x28(%rdx), %rdx
leaq (%rax,%rax,2), %rax
movq (%rdx,%rax,8), %rdx
movq %r14, %rdi
leaq 0x1faf7(%rip), %rsi     # 0x284db
xorl %eax, %eax
callq 0x2210
movl 0x10(%r13), %edx
testl %edx, %edx
js 0x8a04
movq %r14, %rdi
leaq 0x1faef(%rip), %rsi     # 0x284ec
xorl %eax, %eax
callq 0x2210
movq 0x28(%r13), %rax
testq %rax, %rax
je 0x8a28
movl 0x14(%rax), %edx
testl %edx, %edx
je 0x8a28
movl 0x8(%rax), %ecx
movq %r14, %rdi
leaq 0x1fad4(%rip), %rsi     # 0x284f5
xorl %eax, %eax
callq 0x2210
movl 0x34(%r13), %edi
testl %edi, %edi
je 0x8a6c
movq $0x0, 0x10(%rsp)
movl $0x0, 0xc(%rsp)
movq 0x38(%r13), %rsi
leaq 0x10(%rsp), %rdx
leaq 0xc(%rsp), %rcx
callq 0x70b6
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), %rax
testq %rax, %rax
je 0x894f
cmpl $0x0, 0x14(%rax)
je 0x894f
movq 0x28(%r13), %r15
cmpl $0x0, 0x14(%r15)
je 0x894f
xorl %ebp, %ebp
xorl %r12d, %r12d
movq 0x18(%r13), %rdx
movq 0x18(%r15), %rax
movq 0x20(%r15), %rcx
btq $0x20, (%rax,%rbp,8)
leaq 0x1f8b2(%rip), %rax     # 0x2836f
adcq $0x0, %rax
movsbl (%rax), %r8d
movq 0x28(%r15), %rax
movq (%rax,%rbp,8), %r9
movq (%rcx,%rbp,8), %r10
movq %r10, %r11
shrq $0x20, %r11
movq %r14, %rdi
leaq 0x1fa24(%rip), %rsi     # 0x28506
movl %r12d, %ecx
xorl %eax, %eax
pushq %r10
pushq %r11
callq 0x2210
addq $0x10, %rsp
movq 0x18(%r15), %rax
addl (%rax,%rbp,8), %r12d
incq %rbp
movq 0x28(%r13), %r15
movl 0x14(%r15), %eax
cmpq %rax, %rbp
jb 0x8aa4
jmp 0x894f
movq 0x40(%rdi), %rax
testq %rax, %rax
je 0x8cd0
movl $0x18, %ebx
movabsq $0x1fffffffffffffff, %r15 # imm = 0x1FFFFFFFFFFFFFFF
xorl %ebp, %ebp
movq 0x48(%rdi), %r13
movq (%r13,%rbx), %rcx
movq %rcx, %r12
andq %r15, %r12
cmpq %rax, %r12
jae 0x8b4d
shlq $0x4, %r12
addq 0x50(%rdi), %r12
jmp 0x8b50
xorl %r12d, %r12d
shrq $0x3e, %rcx
jne 0x8cbc
movq 0x10(%rdi), %rax
movq -0x18(%r13,%rbx), %rcx
movq %rcx, %rdx
shrq $0x1b, %rdx
andq $-0x40, %rdx
movq 0x18(%rax,%rdx), %rdx
btq $0x20, %rcx
leaq 0x1f7f0(%rip), %r9      # 0x2836f
movq %r9, %rcx
adcq $0x0, %rcx
movsbl (%rcx), %ecx
movl -0x10(%r13,%rbx), %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 0x1f96e(%rip), %rsi     # 0x2851b
xorl %eax, %eax
callq 0x2210
movl -0x8(%r13,%rbx), %edx
movl -0x4(%r13,%rbx), %ecx
testb $0x1, 0x1c(%rsp)
jne 0x8bd8
cmpl %ecx, %edx
cmovll %edx, %ecx
movq %r14, %rdi
leaq 0x1f955(%rip), %rsi     # 0x28529
movl %ecx, %edx
jmp 0x8be6
movq %r14, %rdi
cmpl %ecx, %edx
jne 0x8bef
leaq 0x1f943(%rip), %rsi     # 0x28529
xorl %eax, %eax
callq 0x2210
jmp 0x8bfd
leaq 0x1f938(%rip), %rsi     # 0x2852e
xorl %eax, %eax
callq 0x2210
movl -0xc(%r13,%rbx), %edx
testl %edx, %edx
js 0x8c17
movq %r14, %rdi
leaq 0x1f8dc(%rip), %rsi     # 0x284ec
xorl %eax, %eax
callq 0x2210
movl -0x18(%r13,%rbx), %edx
movq %r14, %rdi
leaq 0x1f90f(%rip), %rsi     # 0x28535
xorl %eax, %eax
callq 0x2210
movq 0x20(%rsp), %rax
movq 0x10(%rax), %rax
movl -0x10(%r13,%rbx), %ecx
shrl %ecx
shlq $0x6, %rcx
movl (%rax,%rcx), %edx
subl -0x4(%r13,%rbx), %edx
movq %r14, %rdi
leaq 0x1f8eb(%rip), %rsi     # 0x2853e
xorl %eax, %eax
callq 0x2210
testq %r12, %r12
je 0x8caa
movl 0x4(%r12), %edi
testl %edi, %edi
je 0x8caa
movq $0x0, 0x10(%rsp)
movl $0x0, 0xc(%rsp)
movq 0x8(%r12), %rsi
leaq 0x10(%rsp), %rdx
leaq 0xc(%rsp), %rcx
callq 0x70b6
movq 0x10(%rsp), %r12
testq %r12, %r12
je 0x8ca2
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
incq %rbp
movq 0x40(%rdi), %rax
addq $0x20, %rbx
cmpq %rax, %rbp
jb 0x8b2f
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop