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

/* The Q-operation with reference edge *ref has just been performed.
   Make a list in good_or[0..*ngood_or-1] of the reference edges of
   legal Q-reductions (oriented editions) that might be canonical,
   with the first *ngood_ref of those being ref.
   Make a list in good_mir[0..*ngood_mir-1] of the
   reference edges of legal P-reductions (mirror-image editions) that
   might be canonical, with the first *ngood_mir_ref of those being
   ref->next.
   *ngood_ref and *ngood_mir_ref might each be 0 or 1.  If they are  
   both 0, nothing else need be correct.  
   All the edges in good_or[] and good_mir[] must start with the same
   vertex degree and end with the same vertex degree (actually, colour
   as passed to canon_edge_oriented).
*/
{
    int i,j,w,z1,z2;
    long thistype,besttype;
    EDGE *e,*e1,*ew,*ewlast;

    besttype = ((long)degree[ref->end]<<10)
               + degree[ref->next->end] + degree[ref->prev->end];
    good_or[0] = ref;
    *ngood_or = *ngood_ref = 1;

    e = ref->next;
    thistype = ((long)degree[e->end]<<10)
               + degree[e->next->end] + degree[e->prev->end];
    if (thistype >= besttype)
    {
        good_mir[0] = e;
	*ngood_mir = *ngood_mir_ref = 1;
    }
    else
	*ngood_mir = *ngood_mir_ref = 0;

    if (thistype > besttype)
    {
	*ngood_or = *ngood_ref = 0;
	besttype = thistype;
    }
 
    for (i = 0; i < nv; ++i)
    if (degree[i] == 4)
    {
        e = firstedge[i];
        e1 = e->next->next;
        for (j = 0; j < 4; ++j, e=e->next, e1=e1->next)
        {
            if (degree[e->prev->end] < 6 || degree[e1->end] < 6) continue;
            if (e == ref) continue;
            w = e1->invers->prev->prev->end;

	    z1 = e->end;
	    z2 = e->next->end;
            ew = ewlast = firstedge[w];
            do
            {
                if (ew->end == z1 || ew->end == z2) break;
                ew = ew->next;
            } while (ew != ewlast);
            if (ew->end == z1 || ew->end == z2) continue;

            thistype = ((long)degree[z1]<<10)
				+ degree[z2] + degree[e->prev->end];
            if (thistype > besttype)
            {
                *ngood_ref = *ngood_mir_ref = 0;
                return;
            }
	    else if (thistype == besttype)
                good_or[(*ngood_or)++] = e;

	    thistype = ((long)degree[z2]<<10) + degree[z1] + degree[e1->end];
            if (thistype > besttype)
            {   
                *ngood_ref = *ngood_mir_ref = 0;
                return;
            }
            else if (thistype == besttype)
                good_mir[(*ngood_mir)++] = e->next;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq -0x8(%rbp), %rax
movslq 0x4(%rax), %rcx
leaq 0x9ce1(%rip), %rax      # 0x3dc00
movslq (%rax,%rcx,4), %rax
shlq $0xa, %rax
movq -0x8(%rbp), %rcx
movq 0x18(%rcx), %rcx
movslq 0x4(%rcx), %rdx
leaq 0x9cc6(%rip), %rcx      # 0x3dc00
movslq (%rcx,%rdx,4), %rcx
addq %rcx, %rax
movq -0x8(%rbp), %rcx
movq 0x10(%rcx), %rcx
movslq 0x4(%rcx), %rdx
leaq 0x9cac(%rip), %rcx      # 0x3dc00
movslq (%rcx,%rdx,4), %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
movl $0x1, (%rax)
movq -0x18(%rbp), %rax
movl $0x1, (%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movslq 0x4(%rax), %rcx
leaq 0x9c67(%rip), %rax      # 0x3dc00
movslq (%rax,%rcx,4), %rax
shlq $0xa, %rax
movq -0x60(%rbp), %rcx
movq 0x18(%rcx), %rcx
movslq 0x4(%rcx), %rdx
leaq 0x9c4c(%rip), %rcx      # 0x3dc00
movslq (%rcx,%rdx,4), %rcx
addq %rcx, %rax
movq -0x60(%rbp), %rcx
movq 0x10(%rcx), %rcx
movslq 0x4(%rcx), %rdx
leaq 0x9c32(%rip), %rcx      # 0x3dc00
movslq (%rcx,%rdx,4), %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x58(%rbp), %rax
jl 0x34004
movq -0x60(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movq 0x10(%rbp), %rax
movl $0x1, (%rax)
movq -0x30(%rbp), %rax
movl $0x1, (%rax)
jmp 0x34018
movq 0x10(%rbp), %rax
movl $0x0, (%rax)
movq -0x30(%rbp), %rax
movl $0x0, (%rax)
movq -0x50(%rbp), %rax
cmpq -0x58(%rbp), %rax
jle 0x3403e
movq -0x20(%rbp), %rax
movl $0x0, (%rax)
movq -0x18(%rbp), %rax
movl $0x0, (%rax)
movq -0x50(%rbp), %rax
movq %rax, -0x58(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl 0x2265d2(%rip), %eax    # 0x25a620
jge 0x342c4
movslq -0x34(%rbp), %rcx
leaq 0x9ba1(%rip), %rax      # 0x3dc00
cmpl $0x4, (%rax,%rcx,4)
jne 0x342b4
movslq -0x34(%rbp), %rcx
leaq 0x998c(%rip), %rax      # 0x3da00
movq (%rax,%rcx,8), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x18(%rax), %rax
movq %rax, -0x68(%rbp)
movl $0x0, -0x38(%rbp)
cmpl $0x4, -0x38(%rbp)
jge 0x342b2
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rax
movslq 0x4(%rax), %rcx
leaq 0x9b50(%rip), %rax      # 0x3dc00
cmpl $0x6, (%rax,%rcx,4)
jl 0x340cb
movq -0x68(%rbp), %rax
movslq 0x4(%rax), %rcx
leaq 0x9b3b(%rip), %rax      # 0x3dc00
cmpl $0x6, (%rax,%rcx,4)
jge 0x340d0
jmp 0x3428c
movq -0x60(%rbp), %rax
cmpq -0x8(%rbp), %rax
jne 0x340df
jmp 0x3428c
movq -0x68(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rax
movl 0x4(%rax), %eax
movl %eax, -0x3c(%rbp)
movq -0x60(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x40(%rbp)
movq -0x60(%rbp), %rax
movq 0x18(%rax), %rax
movl 0x4(%rax), %eax
movl %eax, -0x44(%rbp)
movslq -0x3c(%rbp), %rcx
leaq 0x98e8(%rip), %rax      # 0x3da00
movq (%rax,%rcx,8), %rax
movq %rax, -0x78(%rbp)
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
movl 0x4(%rax), %eax
cmpl -0x40(%rbp), %eax
je 0x3413c
movq -0x70(%rbp), %rax
movl 0x4(%rax), %eax
cmpl -0x44(%rbp), %eax
jne 0x3413e
jmp 0x34154
movq -0x70(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
cmpq -0x78(%rbp), %rax
jne 0x34124
movq -0x70(%rbp), %rax
movl 0x4(%rax), %eax
cmpl -0x40(%rbp), %eax
je 0x3416c
movq -0x70(%rbp), %rax
movl 0x4(%rax), %eax
cmpl -0x44(%rbp), %eax
jne 0x34171
jmp 0x3428c
movslq -0x40(%rbp), %rcx
leaq 0x9a84(%rip), %rax      # 0x3dc00
movslq (%rax,%rcx,4), %rax
shlq $0xa, %rax
movslq -0x44(%rbp), %rdx
leaq 0x9a71(%rip), %rcx      # 0x3dc00
movslq (%rcx,%rdx,4), %rcx
addq %rcx, %rax
movq -0x60(%rbp), %rcx
movq 0x10(%rcx), %rcx
movslq 0x4(%rcx), %rdx
leaq 0x9a57(%rip), %rcx      # 0x3dc00
movslq (%rcx,%rdx,4), %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x58(%rbp), %rax
jle 0x341d7
movq 0x10(%rbp), %rax
movl $0x0, (%rax)
movq -0x20(%rbp), %rax
movl $0x0, (%rax)
jmp 0x342c4
movq -0x50(%rbp), %rax
cmpq -0x58(%rbp), %rax
jne 0x341fd
movq -0x60(%rbp), %rdx
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rsi
movl (%rsi), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, (%rsi)
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
jmp 0x341ff
movslq -0x44(%rbp), %rcx
leaq 0x99f6(%rip), %rax      # 0x3dc00
movslq (%rax,%rcx,4), %rax
shlq $0xa, %rax
movslq -0x40(%rbp), %rdx
leaq 0x99e3(%rip), %rcx      # 0x3dc00
movslq (%rcx,%rdx,4), %rcx
addq %rcx, %rax
movq -0x68(%rbp), %rcx
movslq 0x4(%rcx), %rdx
leaq 0x99cd(%rip), %rcx      # 0x3dc00
movslq (%rcx,%rdx,4), %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x58(%rbp), %rax
jle 0x3425e
movq 0x10(%rbp), %rax
movl $0x0, (%rax)
movq -0x20(%rbp), %rax
movl $0x0, (%rax)
jmp 0x342c4
movq -0x50(%rbp), %rax
cmpq -0x58(%rbp), %rax
jne 0x34288
movq -0x60(%rbp), %rax
movq 0x18(%rax), %rdx
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rsi
movl (%rsi), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, (%rsi)
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
jmp 0x3428a
jmp 0x3428c
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
movq -0x60(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x68(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x68(%rbp)
jmp 0x34093
jmp 0x342b4
jmp 0x342b6
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x34045
popq %rbp
retq
nopw %cs:(%rax,%rax)