// File: /workspace/github_c_makefile_star2_O3/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
testl %esi, %esi
je 0x13ce7
movq %rdi, (%r9)
movq 0x20(%rdi), %rax
movl $0x2, (%rsp)
xorl %ebx, %ebx
movl $0x2, %r12d
movq %r9, %rcx
jmp 0x13d01
movl $0x1, 0x4(%rsp)
movq %rdi, (%rdx)
movq 0x20(%rdi), %rax
movl $0x2, %ebx
xorl %r12d, %r12d
movq %rdx, %rcx
movq %rax, 0x8(%rcx)
movl %ebx, (%r8)
movl %r12d, (%r10)
movl 0x1237b(%rip), %ecx     # 0x2608c
leal 0x2(%rcx), %eax
movl %eax, 0x12372(%rip)     # 0x2608c
cmpl $0x752f, %ecx           # imm = 0x752F
jl 0x13d50
movl $0x2, 0x12360(%rip)     # 0x2608c
movl $0x30, %eax
leaq 0x2308e8(%rip), %rcx    # 0x244620
movl $0x0, (%rax,%rcx)
addq $0x40, %rax
cmpq $0x46630, %rax          # imm = 0x46630
jne 0x13d38
movl $0x2, %eax
movq %rdx, 0x8(%rsp)
movq %r8, 0x18(%rsp)
movq %r9, 0x10(%rsp)
movl %eax, 0x30(%rdi)
movl 0x2308a8(%rip), %eax    # 0x244610
testl %eax, %eax
jle 0x13e47
xorl %r15d, %r15d
leaq 0x13e76(%rip), %r13     # 0x27bf0
cmpl $0x5, (%r13,%r15,4)
jne 0x13e38
leaq 0x13c63(%rip), %rax     # 0x279f0
movq (%rax,%r15,8), %r14
movq %r14, %rbp
cmpq 0x28(%rbp), %rbp
jne 0x13e25
movl 0x30(%rbp), %eax
cmpl 0x122e5(%rip), %eax     # 0x2608c
je 0x13e25
movq 0x10(%rbp), %rax
movslq 0x4(%rax), %rax
cmpl $0x5, (%r13,%rax,4)
jne 0x13e25
movslq 0x4(%rbp), %rax
cmpl $0x5, (%r13,%rax,4)
jne 0x13e25
movq 0x18(%rbp), %rax
movslq 0x4(%rax), %rax
cmpl $0x5, (%r13,%rax,4)
jne 0x13e25
movq %rbp, %rdi
xorl %esi, %esi
callq 0x186e9
testl %eax, %eax
je 0x13dfb
movslq %ebx, %rax
movq 0x8(%rsp), %rdx
movq %rbp, (%rdx,%rax,8)
movq 0x20(%rbp), %rcx
leal 0x2(%rax), %ebx
movq %rcx, 0x8(%rdx,%rax,8)
movq %rbp, %rdi
movl $0x1, %esi
callq 0x186e9
testl %eax, %eax
je 0x13e25
movslq %r12d, %rax
movq 0x10(%rsp), %rdx
movq %rbp, (%rdx,%rax,8)
movq 0x20(%rbp), %rcx
leal 0x2(%rax), %r12d
movq %rcx, 0x8(%rdx,%rax,8)
movq 0x18(%rbp), %rbp
cmpq %r14, %rbp
jne 0x13d94
movl 0x2307d8(%rip), %eax    # 0x244610
incq %r15
movslq %eax, %rcx
cmpq %rcx, %r15
jl 0x13d7a
movq 0x60(%rsp), %r14
movl %ebx, 0x4(%rsp)
movl %r12d, (%rsp)
movq 0x18(%rsp), %rdx
cmpl (%rdx), %ebx
movq 0x68(%rsp), %r9
jg 0x13e67
cmpl (%r9), %r12d
jle 0x13e8b
leaq 0x4(%rsp), %rbp
movq %rsp, %r12
movq 0x8(%rsp), %rdi
movq %rbp, %rsi
movq 0x10(%rsp), %rcx
movq %r12, %r8
callq 0xe49a
movl (%rbp), %ebx
movl (%r12), %r12d
movq 0x20(%rsp), %rax
movl %ebx, (%rax)
movl %r12d, (%r14)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq