// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl 0x4(%rdi), %eax
addl %eax, %eax
je 0xa730
movq %rdi, %r11
movl %eax, %esi
xorl %r13d, %r13d
movq %rsi, 0x10(%rsp)
movq 0x10(%r11), %rcx
movl %r13d, %eax
shrl %eax
shlq $0x6, %rax
cmpl $0x0, 0x10(%rcx,%rax)
jne 0xa6cd
movq 0x48(%r11), %rbp
movq 0x58(%r11), %rdx
movq (%rdx,%r13,8), %r14
movq %r14, %r12
shrq $0x20, %r12
shlq $0x5, %r12
testl %r14d, %r14d
jle 0xa669
addq %rcx, %rax
movl %r13d, %edx
andl $0x1, %edx
movl %r14d, %esi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
leaq (%r12,%rbp), %rdi
addq $0x8, %rdi
movb $0x1, %bl
xorl %r15d, %r15d
movl (%rdi), %r9d
movl %r9d, %r8d
shrl %r8d
shlq $0x6, %r8
cmpl $0x0, 0x10(%rcx,%r8)
je 0xa617
incq %r15
cmpq %rsi, %r15
setb %bl
addq $0x20, %rdi
cmpq %r15, %rsi
jne 0xa5ee
jmp 0xa64f
addq %rcx, %r8
movl 0x8(%r8), %r10d
cmpl 0x8(%rax), %r10d
jne 0xa603
andl $0x1, %r9d
cmpl %r9d, %edx
jne 0xa603
testl %edx, %edx
jne 0xa640
movl (%rax), %r9d
addl 0xc(%rax), %r9d
cmpl 0xc(%r8), %r9d
jne 0xa603
jmp 0xa652
movl (%r8), %r9d
addl 0xc(%r8), %r9d
cmpl 0xc(%rax), %r9d
jne 0xa603
jmp 0xa652
movl %r14d, %r15d
testl %r14d, %r14d
setle %cl
cmpl %r14d, %r15d
setne %dl
orb %cl, %dl
je 0xa6db
movq 0x10(%rsp), %rsi
jmp 0xa66e
xorl %ebx, %ebx
xorl %r15d, %r15d
testl %r14d, %r14d
je 0xa67c
testb $0x1, %bl
je 0xa73f
testl %r15d, %r15d
sete %al
notb %bl
orb %al, %bl
testb $0x1, %bl
jne 0xa6cd
addq %r12, %rbp
movl %r15d, %eax
shlq $0x5, %rax
movups (%rbp,%rax), %xmm0
movups 0x10(%rbp,%rax), %xmm1
movaps %xmm1, 0x30(%rsp)
movaps %xmm0, 0x20(%rsp)
movups (%rbp), %xmm0
movups 0x10(%rbp), %xmm1
movups %xmm1, 0x10(%rbp,%rax)
movups %xmm0, (%rbp,%rax)
movaps 0x20(%rsp), %xmm0
movaps 0x30(%rsp), %xmm1
movups %xmm1, 0x10(%rbp)
movups %xmm0, (%rbp)
incq %r13
cmpq %rsi, %r13
jne 0xa597
jmp 0xa730
movq 0x27916(%rip), %rcx     # 0x31ff8
movq (%rcx), %rdi
movl %r13d, %ecx
andl $0x1, %ecx
leaq 0x1dfb8(%rip), %rdx     # 0x286aa
movsbl (%rcx,%rdx), %edx
movq 0x18(%rax), %rcx
movq 0x28(%r11), %rsi
movslq 0x8(%rax), %r8
leaq (%r8,%r8,2), %r8
movq (%rsi,%r8,8), %r9
movl 0xc(%rax), %eax
movl %eax, (%rsp)
leaq 0x1dfd5(%rip), %rsi     # 0x286ec
movl %r14d, %r8d
xorl %eax, %eax
movq %r11, 0x18(%rsp)
callq 0x2210
movq 0x18(%rsp), %r11
jmp 0xa662
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1dfb7(%rip), %rdi     # 0x286fd
leaq 0x1df60(%rip), %rsi     # 0x286ad
leaq 0x1dfbb(%rip), %rcx     # 0x2870f
movl $0x1e, %edx
callq 0x2160