// File: /workspace/github_c_makefile_star2_O1/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
xorl %ecx, %ecx
movl %ecx, (%rsp)
movl %ecx, 0x4(%rsp)
testl %esi, %esi
movq %rdx, 0x8(%rsp)
je 0x13ccf
movl $0x1, (%rsp)
movq %rax, (%r9)
movq 0x20(%rax), %rcx
movl $0x2, (%rsp)
movq %r9, %rdx
jmp 0x13ce6
movl $0x1, 0x4(%rsp)
movq %rax, (%rdx)
movq 0x20(%rax), %rcx
movl $0x2, 0x4(%rsp)
movq %r9, 0x10(%rsp)
movq %rcx, 0x8(%rdx)
movl 0x4(%rsp), %ecx
movq %r8, 0x18(%rsp)
movl %ecx, (%r8)
movl (%rsp), %ecx
movl %ecx, (%r10)
movl 0x1238d(%rip), %ecx     # 0x26094
leal 0x2(%rcx), %edx
movl %edx, 0x12384(%rip)     # 0x26094
cmpl $0x752f, %ecx           # imm = 0x752F
jl 0x13d42
movl $0x2, 0x12372(%rip)     # 0x26094
movl $0x30, %ecx
leaq 0x2308f2(%rip), %rdx    # 0x244620
movl $0x0, (%rcx,%rdx)
addq $0x40, %rcx
cmpq $0x46630, %rcx          # imm = 0x46630
jne 0x13d2e
movl 0x1234c(%rip), %ecx     # 0x26094
movl %ecx, 0x30(%rax)
movl 0x4(%rsp), %r12d
movl (%rsp), %ebx
cmpl $0x0, 0x2308b6(%rip)    # 0x244610
jle 0x13e35
xorl %r15d, %r15d
leaq 0x13e86(%rip), %r13     # 0x27bf0
cmpl $0x5, (%r13,%r15,4)
jne 0x13e22
leaq 0x13c73(%rip), %rax     # 0x279f0
movq (%rax,%r15,8), %r14
movq %r14, %rbp
cmpq 0x28(%rbp), %rbp
jne 0x13e15
movl 0x30(%rbp), %eax
cmpl 0x122fd(%rip), %eax     # 0x26094
je 0x13e15
movq 0x10(%rbp), %rax
movslq 0x4(%rax), %rax
cmpl $0x5, (%r13,%rax,4)
jne 0x13e15
movslq 0x4(%rbp), %rax
cmpl $0x5, (%r13,%rax,4)
jne 0x13e15
movq 0x18(%rbp), %rax
movslq 0x4(%rax), %rax
cmpl $0x5, (%r13,%rax,4)
jne 0x13e15
movq %rbp, %rdi
xorl %esi, %esi
callq 0x18638
testl %eax, %eax
je 0x13dec
movslq %r12d, %rax
movq 0x8(%rsp), %rdx
movq %rbp, (%rdx,%rax,8)
movq 0x20(%rbp), %rcx
leal 0x2(%rax), %r12d
movq %rcx, 0x8(%rdx,%rax,8)
movq %rbp, %rdi
movl $0x1, %esi
callq 0x18638
testl %eax, %eax
je 0x13e15
movslq %ebx, %rax
movq 0x10(%rsp), %rdx
movq %rbp, (%rdx,%rax,8)
movq 0x20(%rbp), %rcx
leal 0x2(%rax), %ebx
movq %rcx, 0x8(%rdx,%rax,8)
movq 0x18(%rbp), %rbp
cmpq %r14, %rbp
jne 0x13d84
incq %r15
movslq 0x2307e4(%rip), %rax    # 0x244610
cmpq %rax, %r15
jl 0x13d6a
movq 0x60(%rsp), %r14
movl %r12d, 0x4(%rsp)
movl %ebx, (%rsp)
movq 0x18(%rsp), %rdx
cmpl (%rdx), %r12d
movq 0x68(%rsp), %r9
jg 0x13e59
movl (%rsp), %eax
cmpl (%r9), %eax
jle 0x13e70
leaq 0x4(%rsp), %rsi
movq %rsp, %r8
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rcx
callq 0xe385
movl 0x4(%rsp), %eax
movq 0x20(%rsp), %rcx
movl %eax, (%rcx)
movl (%rsp), %eax
movl %eax, (%r14)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq