// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movl 0x1197e(%rip), %eax     # 0x3c084
addl $0x2, %eax
movl %eax, 0x11975(%rip)     # 0x3c084
cmpl $0x7530, %eax           # imm = 0x7530
jle 0x2a756
movl $0x2, 0x11964(%rip)     # 0x3c084
movl $0x0, -0x54(%rbp)
cmpl $0x1198, -0x54(%rbp)    # imm = 0x1198
jge 0x2a754
movslq -0x54(%rbp), %rcx
leaq 0x22fef5(%rip), %rax    # 0x25a630
shlq $0x6, %rcx
addq %rcx, %rax
movl $0x0, 0x30(%rax)
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x2a727
jmp 0x2a756
movq -0x8(%rbp), %rax
movq %rax, -0x38(%rbp)
movl $0x0, -0x48(%rbp)
movl $0x0, -0x44(%rbp)
movq -0x38(%rbp), %rdx
movq -0x10(%rbp), %rax
movl -0x44(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x44(%rbp)
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rdx
movq -0x28(%rbp), %rax
movl -0x48(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x48(%rbp)
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movl 0x118da(%rip), %ecx     # 0x3c084
movq -0x38(%rbp), %rax
movl %ecx, 0x30(%rax)
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdx
movq -0x10(%rbp), %rax
movl -0x44(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x44(%rbp)
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rdx
movq -0x28(%rbp), %rax
movl -0x48(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x48(%rbp)
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movl 0x1187d(%rip), %ecx     # 0x3c084
movq -0x40(%rbp), %rax
movl %ecx, 0x30(%rax)
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdx
movq -0x10(%rbp), %rax
movl -0x44(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x44(%rbp)
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rdx
movq -0x28(%rbp), %rax
movl -0x48(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x48(%rbp)
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movl 0x11820(%rip), %ecx     # 0x3c084
movq -0x40(%rbp), %rax
movl %ecx, 0x30(%rax)
movl -0x44(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movl -0x48(%rbp), %ecx
movq 0x10(%rbp), %rax
movl %ecx, (%rax)
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
cmpl 0x22fd93(%rip), %eax    # 0x25a620
jge 0x2aaaf
movslq -0x4c(%rbp), %rcx
leaq 0x13362(%rip), %rax     # 0x3dc00
cmpl $0x6, (%rax,%rcx,4)
jl 0x2aa9f
movslq -0x4c(%rbp), %rcx
leaq 0x1314d(%rip), %rax     # 0x3da00
movq (%rax,%rcx,8), %rax
movq %rax, -0x38(%rbp)
movslq -0x4c(%rbp), %rcx
leaq 0x1333a(%rip), %rax     # 0x3dc00
movl (%rax,%rcx,4), %eax
movl %eax, -0x50(%rbp)
movl -0x50(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x50(%rbp)
cmpl $0x0, %eax
jl 0x2aa9d
movq -0x38(%rbp), %rax
movl 0x30(%rax), %eax
cmpl 0x11799(%rip), %eax     # 0x3c084
jne 0x2a8f2
jmp 0x2aa8c
movq -0x38(%rbp), %rax
movslq 0x4(%rax), %rcx
leaq 0x132ff(%rip), %rax     # 0x3dc00
cmpl $0x6, (%rax,%rcx,4)
jl 0x2a95e
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rax
movslq 0x4(%rax), %rcx
leaq 0x132e6(%rip), %rax     # 0x3dc00
cmpl $0x4, (%rax,%rcx,4)
jne 0x2a95e
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x18(%rax), %rax
movslq 0x4(%rax), %rcx
leaq 0x132c9(%rip), %rax     # 0x3dc00
cmpl $0x4, (%rax,%rcx,4)
jne 0x2a95e
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x18(%rax), %rax
movq 0x18(%rax), %rax
movslq 0x4(%rax), %rcx
leaq 0x132a8(%rip), %rax     # 0x3dc00
cmpl $0x6, (%rax,%rcx,4)
jge 0x2a963
jmp 0x2aa8c
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x20(%rax), %rax
movq 0x18(%rax), %rax
movq 0x18(%rax), %rax
movslq 0x4(%rax), %rcx
leaq 0x1327e(%rip), %rax     # 0x3dc00
cmpl $0x4, (%rax,%rcx,4)
je 0x2a98d
jmp 0x2aa8c
movq -0x38(%rbp), %rdx
movq -0x10(%rbp), %rax
movl -0x44(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x44(%rbp)
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rdx
movq -0x28(%rbp), %rax
movl -0x48(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x48(%rbp)
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movl 0x116b9(%rip), %ecx     # 0x3c084
movq -0x38(%rbp), %rax
movl %ecx, 0x30(%rax)
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdx
movq -0x10(%rbp), %rax
movl -0x44(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x44(%rbp)
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rdx
movq -0x28(%rbp), %rax
movl -0x48(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x48(%rbp)
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movl 0x1165c(%rip), %ecx     # 0x3c084
movq -0x40(%rbp), %rax
movl %ecx, 0x30(%rax)
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdx
movq -0x10(%rbp), %rax
movl -0x44(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x44(%rbp)
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rdx
movq -0x28(%rbp), %rax
movl -0x48(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x48(%rbp)
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movl 0x115ff(%rip), %ecx     # 0x3c084
movq -0x40(%rbp), %rax
movl %ecx, 0x30(%rax)
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0x2a8cc
jmp 0x2aa9f
jmp 0x2aaa1
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x2a884
movl -0x44(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movl -0x48(%rbp), %ecx
movq -0x30(%rbp), %rax
movl %ecx, (%rax)
popq %rbp
retq
nopw %cs:(%rax,%rax)