// File: /workspace/github_c_makefile_star2_O0/lh3[P]minigraph/gfa-bbl.c
// Function: gfa_sort_ref_arc
void gfa_sort_ref_arc(gfa_t *g)
{
	uint32_t v, n_vtx = gfa_n_vtx(g);
	for (v = 0; v < n_vtx; ++v) {
		gfa_seg_t *s = &g->seg[v>>1];
		int32_t i, nv;
		gfa_arc_t *av, b;
		if (s->rank != 0) continue;
		nv = gfa_arc_n(g, v);
		av = gfa_arc_a(g, v);
		for (i = 0; i < nv; ++i) {
			uint32_t w = av[i].w;
			gfa_seg_t *t = &g->seg[w>>1];
			if (t->rank == 0 && t->snid == s->snid && (v&1) == (w&1)) {
				if (((v&1) == 0 && s->soff + s->len == t->soff) || ((v&1) == 1 && t->soff + t->len == s->soff))
					break;
			}
		}
		if (nv > 0 && i == nv) fprintf(stderr, "X\t%c%s\t%d\t%s\t%d\n", "><"[v&1], s->name, i, g->sseq[s->snid].name, s->soff);
		assert(nv == 0 || i < nv);
		if (i > 0 && i < nv) b = av[i], av[i] = av[0], av[0] = b;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movl 0x4(%rax), %eax
shll %eax
movl %eax, -0x10(%rbp)
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
cmpl -0x10(%rbp), %eax
jae 0xda10
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0xc(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
shlq $0x6, %rcx
addq %rcx, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, 0x10(%rax)
je 0xd7d4
jmp 0xda02
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movl -0xc(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x58(%rcx), %rcx
movl -0xc(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0xd8ce
movq -0x28(%rbp), %rax
movslq -0x1c(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl %eax, -0x4c(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x4c(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
shlq $0x6, %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
cmpl $0x0, 0x10(%rax)
jne 0xd8be
movq -0x58(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x18(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jne 0xd8be
movl -0xc(%rbp), %eax
andl $0x1, %eax
movl -0x4c(%rbp), %ecx
andl $0x1, %ecx
cmpl %ecx, %eax
jne 0xd8be
movl -0xc(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0xd899
movq -0x18(%rbp), %rax
movl 0xc(%rax), %eax
movq -0x18(%rbp), %rcx
addl (%rcx), %eax
movq -0x58(%rbp), %rcx
cmpl 0xc(%rcx), %eax
je 0xd8ba
movl -0xc(%rbp), %eax
andl $0x1, %eax
cmpl $0x1, %eax
jne 0xd8bc
movq -0x58(%rbp), %rax
movl 0xc(%rax), %eax
movq -0x58(%rbp), %rcx
addl (%rcx), %eax
movq -0x18(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jne 0xd8bc
jmp 0xd8ce
jmp 0xd8be
jmp 0xd8c0
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xd813
cmpl $0x0, -0x20(%rbp)
jle 0xd939
movl -0x1c(%rbp), %eax
cmpl -0x20(%rbp), %eax
jne 0xd939
movq 0x37715(%rip), %rax     # 0x44ff8
movq (%rax), %rdi
movl -0xc(%rbp), %eax
andl $0x1, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x2ed95(%rip), %rax     # 0x3c68c
movsbl (%rax,%rcx), %edx
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rcx
movl -0x1c(%rbp), %r8d
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x18(%rbp), %rsi
movslq 0x8(%rsi), %rsi
imulq $0x18, %rsi, %rsi
addq %rsi, %rax
movq (%rax), %r9
movq -0x18(%rbp), %rax
movl 0xc(%rax), %eax
leaq 0x2ed9f(%rip), %rsi     # 0x3c6ce
movl %eax, (%rsp)
movb $0x0, %al
callq 0x2210
cmpl $0x0, -0x20(%rbp)
je 0xd947
movl -0x1c(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0xd949
jmp 0xd968
leaq 0x2ed8f(%rip), %rdi     # 0x3c6df
leaq 0x2ed38(%rip), %rsi     # 0x3c68f
movl $0x1e, %edx
leaq 0x2ed8e(%rip), %rcx     # 0x3c6f1
callq 0x2170
cmpl $0x0, -0x1c(%rbp)
jle 0xda00
movl -0x1c(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0xda00
movq -0x28(%rbp), %rax
movslq -0x1c(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, -0x48(%rbp)
movq 0x8(%rax), %rcx
movq %rcx, -0x40(%rbp)
movq 0x10(%rax), %rcx
movq %rcx, -0x38(%rbp)
movq 0x18(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rax
movslq -0x1c(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq -0x28(%rbp), %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq 0x10(%rcx), %rdx
movq %rdx, 0x10(%rax)
movq 0x18(%rcx), %rcx
movq %rcx, 0x18(%rax)
movq -0x28(%rbp), %rax
movq -0x48(%rbp), %rcx
movq %rcx, (%rax)
movq -0x40(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x38(%rbp), %rcx
movq %rcx, 0x10(%rax)
movq -0x30(%rbp), %rcx
movq %rcx, 0x18(%rax)
jmp 0xda02
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0xd79f
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)