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

/* The B-operation with reference edge *ref and side mirror has just been
   performed.
   Make a list in good_or[0..*ngood_or-1] of the reference edges of
   legal B-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 four-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-2.  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).
   This procedure does NOT determine that there are no A-reductions.
*/
{
    EDGE *e,*elast;
    int nor,nmir,i;

    ref = ref->min;
    nor = nmir = 0;

    if (!mirror)
    {
	good_or[nor++] = ref;
	good_or[nor++] = ref->invers;
    }
    else
    {
	good_mir[nmir++] = ref;
	good_mir[nmir++] = ref->invers;
    }

    *ngood_ref = nor;
    *ngood_mir_ref = nmir;

    RESETMARKS;
    MARKLO(ref);

    for (i = 0; i < nv; ++i)
    if (degree[i] == 5)
    {
	e = elast = firstedge[i];
	do
	{
	    if (e == e->min && !ISMARKEDLO(e) && degree[e->prev->end] == 5
			&& degree[e->end] == 5 && degree[e->next->end] == 5)
	    {
		if (is_valid_min5_b(e,FALSE))
		{   
        	    good_or[nor++] = e;
        	    good_or[nor++] = e->invers;
    		}
		if (is_valid_min5_b(e,TRUE))
		{   
        	    good_mir[nmir++] = e;
        	    good_mir[nmir++] = e->invers;
		}
	    }
	    e = e->next;
	} while (e != elast);
    }

    if (nor > *ngood_ref || nmir > *ngood_mir_ref)
        prune_oriented_lists(good_or,&nor,ngood_ref,
                             good_mir,&nmir,ngood_mir_ref);

    *ngood_or = nor;
    *ngood_mir = nmir;    
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, 0x20(%rsp)
movq 0x68(%rsp), %r10
movq 0x28(%rdi), %rax
testl %esi, %esi
movq %rdx, 0x8(%rsp)
je 0x12898
pushq $0x2
popq %rbx
movl $0x1, (%rsp)
xorl %r15d, %r15d
movq %r9, %rcx
jmp 0x128a9
movl $0x1, 0x4(%rsp)
pushq $0x2
popq %r15
xorl %ebx, %ebx
movq %rdx, %rcx
movq %rax, (%rcx)
movq 0x20(%rax), %rdx
movq %rdx, 0x8(%rcx)
movl %r15d, (%r8)
movl %ebx, (%r10)
movl 0x117bc(%rip), %edx     # 0x2407c
leal 0x2(%rdx), %ecx
movl %ecx, 0x117b3(%rip)     # 0x2407c
cmpl $0x752f, %edx           # imm = 0x752F
jl 0x128fb
movl $0x2, 0x117a1(%rip)     # 0x2407c
pushq $0x30
popq %rdx
pushq $0x2
popq %rcx
leaq 0x22fd28(%rip), %rsi    # 0x242610
cmpq $0x46630, %rdx          # imm = 0x46630
je 0x128fb
andl $0x0, (%rdx,%rsi)
addq $0x40, %rdx
jmp 0x128e8
movq %r8, 0x18(%rsp)
movq %r9, 0x10(%rsp)
movl %ecx, 0x30(%rax)
xorl %ebp, %ebp
leaq 0x132cf(%rip), %r14     # 0x25be0
movslq 0x22fce8(%rip), %rax    # 0x242600
cmpq %rax, %rbp
jge 0x129e4
cmpl $0x5, (%r14,%rbp,4)
jne 0x129dc
leaq 0x130ad(%rip), %rax     # 0x259e0
movq (%rax,%rbp,8), %r13
movq %r13, %r12
cmpq 0x28(%r12), %r12
jne 0x129ce
movl 0x30(%r12), %eax
cmpl 0x1172c(%rip), %eax     # 0x2407c
je 0x129ce
movq 0x10(%r12), %rax
movslq 0x4(%rax), %rax
cmpl $0x5, (%r14,%rax,4)
jne 0x129ce
movslq 0x4(%r12), %rax
cmpl $0x5, (%r14,%rax,4)
jne 0x129ce
movq 0x18(%r12), %rax
movslq 0x4(%rax), %rax
cmpl $0x5, (%r14,%rax,4)
jne 0x129ce
movq %r12, %rdi
xorl %esi, %esi
callq 0x1700a
testl %eax, %eax
je 0x129a6
movslq %r15d, %rax
movq 0x8(%rsp), %rdx
movq %r12, (%rdx,%rax,8)
movq 0x20(%r12), %rcx
leal 0x2(%rax), %r15d
movq %rcx, 0x8(%rdx,%rax,8)
movq %r12, %rdi
pushq $0x1
popq %rsi
callq 0x1700a
testl %eax, %eax
je 0x129ce
movslq %ebx, %rax
movq 0x10(%rsp), %rdx
movq %r12, (%rdx,%rax,8)
movq 0x20(%r12), %rcx
leal 0x2(%rax), %ebx
movq %rcx, 0x8(%rdx,%rax,8)
movq 0x18(%r12), %r12
cmpq %r13, %r12
jne 0x1293a
incq %rbp
jmp 0x12911
movl %r15d, 0x4(%rsp)
movl %ebx, (%rsp)
movq 0x18(%rsp), %rdx
cmpl (%rdx), %r15d
movq 0x68(%rsp), %r9
jg 0x12a00
cmpl (%r9), %ebx
jle 0x12a24
leaq 0x4(%rsp), %r12
movq %rsp, %rbp
movq 0x8(%rsp), %rdi
movq %r12, %rsi
movq 0x10(%rsp), %rcx
movq %rbp, %r8
callq 0xd354
movl (%r12), %r15d
movl (%rbp), %ebx
movq 0x20(%rsp), %rax
movl %r15d, (%rax)
movq 0x60(%rsp), %rax
movl %ebx, (%rax)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq