// File: /workspace/github_c_makefile_star2_O2/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
movq %rdi, %r10
movl 0x4(%rdi), %r11d
addl %r11d, %r11d
xorl %r13d, %r13d
cmpq %r11, %r13
je 0x86e2
movq 0x10(%r10), %rcx
movl %r13d, %eax
shrl %eax
shlq $0x6, %rax
cmpl $0x0, 0x10(%rcx,%rax)
jne 0x867b
addq %rcx, %rax
movq 0x48(%r10), %rsi
movq 0x58(%r10), %rdx
movq (%rdx,%r13,8), %r15
movq %r15, %rdi
shrq $0x1b, %rdi
andq $-0x20, %rdi
leaq (%rsi,%rdi), %rbp
movl %r13d, %edx
andl $0x1, %edx
movslq %r15d, %r12
testl %r12d, %r12d
movl $0x0, %ebx
cmovgl %r15d, %ebx
addq %rdi, %rsi
addq $0x8, %rsi
xorl %r14d, %r14d
cmpq %r14, %rbx
je 0x860a
movl (%rsi), %r8d
movl %r8d, %edi
shrl %edi
shlq $0x6, %rdi
cmpl $0x0, 0x10(%rcx,%rdi)
je 0x85d1
incq %r14
addq $0x20, %rsi
jmp 0x85b0
addq %rcx, %rdi
movl 0x8(%rdi), %r9d
cmpl 0x8(%rax), %r9d
jne 0x85c8
andl $0x1, %r8d
cmpl %r8d, %edx
jne 0x85c8
testl %edx, %edx
jne 0x85fa
movl (%rax), %r8d
addl 0xc(%rax), %r8d
cmpl 0xc(%rdi), %r8d
jne 0x85c8
jmp 0x8607
movl (%rdi), %r8d
addl 0xc(%rdi), %r8d
cmpl 0xc(%rax), %r8d
jne 0x85c8
movl %r14d, %ebx
testl %r15d, %r15d
setle %cl
cmpl %r15d, %ebx
setne %dl
orb %cl, %dl
je 0x8683
cmpq %r12, %r14
setl %al
testl %r15d, %r15d
sete %cl
orb %al, %cl
je 0x86f1
cmpq %r12, %r14
setge %al
testl %ebx, %ebx
sete %cl
orb %al, %cl
jne 0x867b
movl %ebx, %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
jmp 0x8552
movq 0x2596e(%rip), %rcx     # 0x2dff8
movq (%rcx), %rdi
movl %r13d, %ecx
andl $0x1, %ecx
leaq 0x1b019(%rip), %rdx     # 0x236b3
movsbl (%rcx,%rdx), %edx
movq 0x18(%rax), %rcx
movq 0x28(%r10), %rsi
movslq 0x8(%rax), %r8
imulq $0x18, %r8, %r8
movq (%rsi,%r8), %r9
movl 0xc(%rax), %eax
movl %eax, (%rsp)
leaq 0x1b036(%rip), %rsi     # 0x236f5
movl %r15d, %r8d
xorl %eax, %eax
movq %r10, 0x18(%rsp)
movq %r11, 0x10(%rsp)
callq 0x2210
movq 0x10(%rsp), %r11
movq 0x18(%rsp), %r10
jmp 0x861a
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1b00e(%rip), %rdi     # 0x23706
leaq 0x1afb7(%rip), %rsi     # 0x236b6
leaq 0x1b012(%rip), %rcx     # 0x23718
pushq $0x1e
popq %rdx
callq 0x2160