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

/* The five-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 five-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 five-reductions (mirror-image editions)
   that might be canonical, with the first *ngood_mir_ref of those being
   ref.
   *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).
*/
{
    EDGE *e;
    long deg1,deg2,deg3,bestdeg;
#define FIVETYPE(d1,d2,d3) (((d1)<<21)+((d2)<<11)+(d3))
    long besttype,type1,type2;
    int nor,nmir,i,j,v,w;
    EDGE *ez,*ezlast;

    e = ref;
    bestdeg = degree[e->end];
    deg2 = degree[e->prev->end];
    deg3 = degree[e->next->end];

    type1 = FIVETYPE(bestdeg,deg2,deg3);
    type2 = FIVETYPE(bestdeg,deg3,deg2);
    besttype = type1 > type2 ? type1 : type2;

    nor = nmir = 0;
    if (type1 == besttype) good_or[nor++] = e;
    if (type2 == besttype) good_mir[nmir++] = e;

    *ngood_ref = nor;
    *ngood_mir_ref = nmir;

    for (i = 0; i < nv; ++i)
    if (degree[i] == 5)
    {
	for (e = firstedge[i], j = 0; j < 5; ++j, e = e->next)
        {
	    if (e == ref) continue;
            deg1 = degree[e->end];
	    if (deg1 < bestdeg) continue;
	    deg2 = degree[e->prev->end];
	    if (deg2 == 4) continue;
	    deg3 = degree[e->next->end];
	    if (deg3 == 4) continue;

	    v = e->next->next->end;
	    w = e->next->next->next->end;
	    ez = e->invers;
	    ezlast = ez->prev;
	    for (ez = ez->next->next; ez != ezlast; ez = ez->next)
	        if (ez->end == w || ez->end == v) break;
	    if (ez != ezlast) continue;

	    if (deg1 > bestdeg)
	    {
		*ngood_ref = *ngood_mir_ref = 0;
		return;
	    }

	    type1 = FIVETYPE(deg1,deg2,deg3);
    	    type2 = FIVETYPE(deg1,deg3,deg2);

	    if (type1 > besttype || type2 > besttype)
	    {
                *ngood_ref = *ngood_mir_ref = 0;
                return;
            }
    	    if (type1 == besttype) good_or[nor++] = e;
    	    if (type2 == besttype) good_mir[nmir++] = e;
        }
    }

    *ngood_or = nor;
    *ngood_mir = nmir;    
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %r9, -0x10(%rsp)
movq %r8, -0x20(%rsp)
movq %rdx, -0x18(%rsp)
movq %rsi, -0x28(%rsp)
movslq 0x4(%rdi), %rdx
leaq 0xdc8e(%rip), %rax      # 0x27bf0
movslq (%rax,%rdx,4), %r10
movq 0x10(%rdi), %rsi
movq 0x18(%rdi), %rdx
movslq 0x4(%rsi), %rsi
movslq (%rax,%rsi,4), %rsi
movslq 0x4(%rdx), %rdx
movslq (%rax,%rdx,4), %r8
movq %r10, %r11
shlq $0x15, %r11
leaq (%r11,%r8), %r9
addq %rsi, %r11
movq %rsi, %rdx
shlq $0xb, %rdx
addq %r9, %rdx
shlq $0xb, %r8
addq %r8, %r11
xorl %r8d, %r8d
movq %r11, %r14
movl $0x0, %esi
cmpq %r11, %rdx
cmovgq %rdx, %r14
jl 0x19fbe
movq -0x28(%rsp), %rsi
movq %rdi, (%rsi)
movl $0x1, %esi
movq 0x38(%rsp), %r9
cmpq %rdx, %r11
jl 0x19fd6
movq -0x20(%rsp), %rdx
movq %rdi, (%rdx)
movl $0x1, %r8d
movl %esi, -0x38(%rsp)
movl %esi, (%rcx)
movl %r8d, -0x34(%rsp)
movl %r8d, (%r9)
movslq 0x22a625(%rip), %rdx    # 0x244610
movq %rdx, -0x8(%rsp)
testq %rdx, %rdx
jle 0x1a112
movq %rcx, -0x30(%rsp)
xorl %r13d, %r13d
cmpl $0x5, (%rax,%r13,4)
jne 0x1a104
leaq 0xd9dd(%rip), %rcx      # 0x279f0
leaq (%rcx,%r13,8), %r15
xorl %ebp, %ebp
movq (%r15), %r15
cmpq %rdi, %r15
je 0x1a052
movslq 0x4(%r15), %rcx
movslq (%rax,%rcx,4), %r9
cmpl %r10d, %r9d
jl 0x1a052
movq 0x10(%r15), %rcx
movslq 0x4(%rcx), %rcx
movslq (%rax,%rcx,4), %rdx
cmpq $0x4, %rdx
je 0x1a052
movq 0x18(%r15), %rsi
movslq 0x4(%rsi), %rcx
movslq (%rax,%rcx,4), %rcx
cmpq $0x4, %rcx
jne 0x1a062
incl %ebp
addq $0x18, %r15
cmpl $0x5, %ebp
jne 0x1a019
jmp 0x1a104
movq 0x18(%rsi), %rsi
movl 0x4(%rsi), %r11d
movq 0x18(%rsi), %rsi
movl 0x4(%rsi), %r8d
movq 0x20(%r15), %rbx
movq 0x10(%rbx), %rsi
movq 0x18(%rbx), %rbx
movq 0x18(%rbx), %rbx
cmpq %rsi, %rbx
je 0x1a097
movl 0x4(%rbx), %r12d
cmpl %r8d, %r12d
je 0x1a052
cmpl %r11d, %r12d
jne 0x1a07e
jmp 0x1a052
cmpl %r10d, %r9d
jg 0x1a12a
shlq $0x15, %r9
movq %rdx, %r11
shlq $0xb, %r11
addq %r9, %r11
addq %rcx, %r11
cmpq %r14, %r11
jg 0x1a12a
shlq $0xb, %rcx
addq %rdx, %r9
addq %rcx, %r9
cmpq %r14, %r9
jg 0x1a12a
cmpq %r14, %r11
jne 0x1a0e0
movl -0x38(%rsp), %edx
movslq %edx, %rcx
incl %edx
movl %edx, -0x38(%rsp)
movq -0x28(%rsp), %rdx
movq %r15, (%rdx,%rcx,8)
cmpq %r14, %r9
jne 0x1a052
movl -0x34(%rsp), %edx
movslq %edx, %rcx
incl %edx
movl %edx, -0x34(%rsp)
movq -0x20(%rsp), %rdx
movq %r15, (%rdx,%rcx,8)
jmp 0x1a052
incq %r13
cmpq -0x8(%rsp), %r13
jne 0x1a001
movq -0x18(%rsp), %rax
movl -0x38(%rsp), %ecx
movl %ecx, (%rax)
movq -0x10(%rsp), %rax
movl -0x34(%rsp), %ecx
movl %ecx, (%rax)
jmp 0x1a13a
xorl %eax, %eax
movq 0x38(%rsp), %rcx
movl %eax, (%rcx)
movq -0x30(%rsp), %rcx
movl %eax, (%rcx)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq