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

/* The S-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 S-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 S-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).

   Hopefully this routine is used rarely, so we are going for simple
   rather than fast.  If the S operation ever becomes a critical part
   of some generation, optimising this routine would be necesary.
*/
{
    EDGE *e,*ee;
    int nor,nmir,i,j;

    RESETMARKS;
    e = ref;

    nor = nmir = 0;
    good_or[nor++] = e;
    good_mir[nmir++] = e->invers;
    MARKLO(e); 

    ee = e->invers->prev->prev->prev;
    good_or[nor++] = ee;
    good_mir[nmir++] = ee->invers;
    MARKLO(ee);

    ee = ee->invers->prev->prev->prev;
    good_or[nor++] = ee;
    good_mir[nmir++] = ee->invers;
    MARKLO(ee);

    *ngood_ref = nor;
    *ngood_mir_ref = nmir;

    for (i = 0; i < nv; ++i)
    if (degree[i] >= 6)
    {
	for (e = firstedge[i], j = degree[i]; --j >= 0; e = e->next)
        {
	    if (ISMARKEDLO(e)) continue;
            if (degree[e->end] < 6 || degree[e->next->end] != 4 ||
		degree[e->next->next->end] != 4 || 
		degree[e->next->next->next->end] < 6) continue;
	    if (degree[e->next->invers->next->next->end] != 4) continue;

	    good_or[nor++] = e;
            good_mir[nmir++] = e->invers;
            MARKLO(e);
        
            ee = e->invers->prev->prev->prev;
            good_or[nor++] = ee;
            good_mir[nmir++] = ee->invers;
            MARKLO(ee);

            ee = ee->invers->prev->prev->prev;
            good_or[nor++] = ee;
            good_mir[nmir++] = ee->invers;
            MARKLO(ee);
        }
    }

    *ngood_or = nor;
    *ngood_mir = nmir;    
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %r9, -0x8(%rsp)
movq 0x38(%rsp), %r10
movl 0xbd02(%rip), %r11d     # 0x2608c
leal 0x2(%r11), %eax
movl %eax, 0xbcf8(%rip)      # 0x2608c
cmpl $0x752f, %r11d          # imm = 0x752F
jl 0x1a3cc
movl $0x2, 0xbce5(%rip)      # 0x2608c
movl $0x30, %eax
leaq 0x22a26d(%rip), %r11    # 0x244620
movl $0x0, (%rax,%r11)
addq $0x40, %rax
cmpq $0x46630, %rax          # imm = 0x46630
jne 0x1a3b3
movl $0x2, %eax
movq %rdi, (%rsi)
movq 0x20(%rdi), %r11
movq %r11, (%r8)
movl %eax, 0x30(%rdi)
movq 0x10(%r11), %rdi
movq 0x10(%rdi), %rdi
movq 0x10(%rdi), %rdi
movq %rdi, 0x8(%rsi)
movq 0x20(%rdi), %r11
movq %r11, 0x8(%r8)
movl %eax, 0x30(%rdi)
movq 0x10(%r11), %rdi
movq 0x10(%rdi), %rdi
movq 0x10(%rdi), %rdi
movq %rdi, 0x10(%rsi)
movq 0x20(%rdi), %r11
movq %r11, 0x10(%r8)
movl %eax, 0x30(%rdi)
movl $0x3, %ebp
movl %ebp, (%rcx)
movl %ebp, (%r10)
movslq 0x22a1f0(%rip), %rcx    # 0x244610
movl $0x3, %ebx
testq %rcx, %rcx
jle 0x1a538
xorl %edi, %edi
leaq 0xd7b9(%rip), %r10      # 0x27bf0
leaq 0xd5b2(%rip), %r9       # 0x279f0
movl (%r10,%rdi,4), %r14d
cmpl $0x6, %r14d
jl 0x1a52c
leaq (%r9,%rdi,8), %r15
incl %r14d
movq (%r15), %r15
cmpl %eax, 0x30(%r15)
je 0x1a51b
movslq 0x4(%r15), %r12
cmpl $0x6, (%r10,%r12,4)
jl 0x1a51b
movq 0x18(%r15), %r12
movslq 0x4(%r12), %r13
cmpl $0x4, (%r10,%r13,4)
jne 0x1a51b
movq 0x18(%r12), %r13
movslq 0x4(%r13), %r11
cmpl $0x4, (%r10,%r11,4)
jne 0x1a51b
movq 0x18(%r13), %r11
movslq 0x4(%r11), %r11
cmpl $0x6, (%r10,%r11,4)
jl 0x1a51b
movq 0x20(%r12), %r11
movq 0x18(%r11), %r11
movq 0x18(%r11), %r11
movslq 0x4(%r11), %r11
cmpl $0x4, (%r10,%r11,4)
jne 0x1a51b
movslq %ebp, %r11
movq %r15, (%rsi,%r11,8)
movq 0x20(%r15), %r12
movslq %ebx, %r13
movq %r12, (%r8,%r13,8)
movl %eax, 0x30(%r15)
movq 0x10(%r12), %rbx
movq 0x10(%rbx), %rbx
movq 0x10(%rbx), %rbx
movq %rbx, 0x8(%rsi,%r11,8)
movq 0x20(%rbx), %r12
movq %r12, 0x8(%r8,%r13,8)
movl %eax, 0x30(%rbx)
movq 0x10(%r12), %rbx
movq 0x10(%rbx), %rbx
movq 0x10(%rbx), %r12
leal 0x3(%r11), %ebp
movq %r12, 0x10(%rsi,%r11,8)
movq 0x20(%r12), %r11
leal 0x3(%r13), %ebx
movq %r11, 0x10(%r8,%r13,8)
movl %eax, 0x30(%r12)
addq $0x18, %r15
decl %r14d
cmpl $0x1, %r14d
ja 0x1a453
incq %rdi
cmpq %rcx, %rdi
jne 0x1a43e
movl %ebp, (%rdx)
movq -0x8(%rsp), %rax
movl %ebx, (%rax)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq