// File: /workspace/github_c_makefile_star2_O3/mishun[P]plantri/plantri.c
// Function: prune_oriented_lists
static void
prune_oriented_lists(EDGE *good_or[], int *ngood_or, int *ngood_ref,
                     EDGE *good_mir[], int *ngood_mir, int *ngood_mir_ref)

/* Try to prune the edge lists (of the form required by
   canon_edge_oriented()) by using the degrees of a couple of
   extra vertices.  The result is returned in the same form.
   As always, if *ngood_ref==*ngood_mir_ref==0 on output
   (which must not be true on input), all else is undefined.
*/
{
    int i,k,kref;
    long code_or[MAXE],code_mir[MAXE],maxcode;
#define PRUNE_OR(e) ((degree[(e)->invers->prev->prev->end] << 10) \
		      + degree[(e)->next->invers->prev->end])
#define PRUNE_MIR(e) ((degree[(e)->invers->next->next->end] << 10) \
                      + degree[(e)->prev->invers->next->end])

    maxcode = 0;
    for (i = 0; i < *ngood_or; ++i)
    {
	code_or[i] = PRUNE_OR(good_or[i]);
	if (code_or[i] > maxcode) maxcode = code_or[i];
    }

    for (i = 0; i < *ngood_mir; ++i)
    {
        code_mir[i] = PRUNE_MIR(good_mir[i]);
        if (code_mir[i] > maxcode) maxcode = code_mir[i];
    }

    k = kref = 0;
    for (i = 0; i < *ngood_or; ++i)
        if (code_or[i] == maxcode)
	{
	    if (i < *ngood_ref) ++kref;
	    good_or[k++] = good_or[i];
	}
    *ngood_or = k;
    *ngood_ref = kref;

    k = kref = 0;
    for (i = 0; i < *ngood_mir; ++i)
        if (code_mir[i] == maxcode)
        {
            if (i < *ngood_mir_ref) ++kref;
            good_mir[k++] = good_mir[i];
        }
    *ngood_mir = k;
    *ngood_mir_ref = kref;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x16c0, %rsp           # imm = 0x16C0
movslq (%rsi), %rax
leaq 0x1973d(%rip), %r11     # 0x27bf0
testq %rax, %rax
jle 0xe50f
xorl %r10d, %r10d
xorl %r14d, %r14d
movq (%rdi,%r10,8), %rbx
movq 0x18(%rbx), %r15
movq 0x20(%rbx), %rbx
movq 0x10(%rbx), %rbx
movq 0x10(%rbx), %rbx
movslq 0x4(%rbx), %rbx
movl (%r11,%rbx,4), %ebx
shll $0xa, %ebx
movq 0x20(%r15), %r15
movq 0x10(%r15), %r15
movslq 0x4(%r15), %r15
movslq (%r11,%r15,4), %r15
movslq %ebx, %rbx
addq %r15, %rbx
movq %rbx, 0xb20(%rsp,%r10,8)
cmpq %rbx, %r14
cmovgq %r14, %rbx
incq %r10
movq %rbx, %r14
cmpq %r10, %rax
jne 0xe4be
jmp 0xe511
xorl %ebx, %ebx
movslq (%r8), %r14
testq %r14, %r14
jle 0xe56e
xorl %r15d, %r15d
movq (%rcx,%r15,8), %r10
movq 0x10(%r10), %r12
movq 0x20(%r10), %r10
movq 0x18(%r10), %r10
movq 0x18(%r10), %r10
movslq 0x4(%r10), %r10
movl (%r11,%r10,4), %r10d
shll $0xa, %r10d
movq 0x20(%r12), %r12
movq 0x18(%r12), %r12
movslq 0x4(%r12), %r12
movslq (%r11,%r12,4), %r12
movslq %r10d, %r10
addq %r12, %r10
movq %r10, -0x80(%rsp,%r15,8)
cmpq %r10, %rbx
cmovgq %rbx, %r10
incq %r15
movq %r10, %rbx
cmpq %r15, %r14
jne 0xe51c
jmp 0xe571
movq %rbx, %r10
xorl %r11d, %r11d
movl $0x0, %ebp
movl $0x0, %ebx
testl %eax, %eax
jle 0xe5b8
xorl %r14d, %r14d
xorl %ebx, %ebx
xorl %ebp, %ebp
cmpq %r10, 0xb20(%rsp,%r14,8)
jne 0xe5b0
movslq (%rdx), %r15
xorl %r12d, %r12d
cmpq %r15, %r14
setl %r12b
addl %r12d, %ebx
movq (%rdi,%r14,8), %r15
movslq %ebp, %r12
incl %ebp
movq %r15, (%rdi,%r12,8)
incq %r14
cmpq %r14, %rax
jne 0xe589
movl %ebp, (%rsi)
movl %ebx, (%rdx)
movslq (%r8), %rax
movl $0x0, %edx
testq %rax, %rax
jle 0xe5fa
xorl %esi, %esi
xorl %edx, %edx
xorl %r11d, %r11d
cmpq %r10, -0x80(%rsp,%rsi,8)
jne 0xe5f2
movslq (%r9), %rdi
xorl %ebx, %ebx
cmpq %rdi, %rsi
setl %bl
addl %ebx, %edx
movq (%rcx,%rsi,8), %rdi
movslq %r11d, %rbx
incl %r11d
movq %rdi, (%rcx,%rbx,8)
incq %rsi
cmpq %rsi, %rax
jne 0xe5d0
movl %r11d, (%r8)
movl %edx, (%r9)
addq $0x16c0, %rsp           # imm = 0x16C0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq