// File: /workspace/github_c_makefile_star2_O3/mishun[P]plantri/plantri.c
// Function: find_extensions_min5
static void
find_extensions_min5(int nbtot, int nbop, EDGE *extA1[], EDGE *extA2[],
   int *nextA, EDGE *extB[], int extBmirror[], int *nextB,
   EDGE *extC[], int *nextC, EDGE *lastA)

/* Determine the inequivalent places to make extensions, for the
   ordinary triangulations of minimum degree 5.  The results are
   put in the arrays extD1[0..*nextD-1], etc..
   nbtot and nbop are the usual group parameters.
   If lastA != NULL, this graph was made with an A-operation and lastA
   is its central edge.  If lastA == NULL, it wasn't made with A.
*/
{
    register int i,k;
    register EDGE *e,*e1,*e2,*elast,*elast1,*elast2;
    EDGE **nb,**nb0,**nblim,**nboplim,**nb1,**nb2;
    int v1,v2,d1,d2,xd1,xd2,oldcola,oldcolb,alpha,cola,colb;


    RESETMARKS_V;
    if (lastA)
    {
        v1 = lastA->start;
	v2 = lastA->end;
	d1 = degree[v1];
	d2 = degree[v2];
        MARK_V(v1);
        MARK_V(v2);
        MARK_V(lastA->prev->end);
        MARK_V(lastA->next->end);
    }

    if (nbtot == 1)
    {
      /* A-extensions, trivial group */

	k = 0;
	for (i = 0; i < nv; ++i)
	if (degree[i] >= 6)
	{
	    cola = degree[i] + 4;

	    if (ISMARKED_V(i) || !lastA || cola >= d1+d2+2)
	    {
	        e1 = elast1 = firstedge[i];
                do
                {
		    e2 = e1->next->next->next;
		    elast2 = e1->prev->prev;
		    do
		    {
		        if (e2 > e1)
		        {
			    extA1[k] = e1;
			    extA2[k] = e2;
			    ++k;
		        }
		        e2 = e2->next;
		    } while (e2 != elast2);
		    e1 = e1->next;
	        } while (e1 != elast1);
	    }
	    else if (cola < d1+d2)
		continue;
	    else
            {
                e1 = elast1 = firstedge[i];
                do
                {
                    e2 = e1->next->next->next;
                    elast2 = e1->prev->prev;
                    alpha = 2;
                    do
                    {
                        if (e2 > e1)
                        {
			    if (e1->end == v1 || e2->end == v1) xd1 = d1+1;
			    else                                xd1 = d1;
			    if (e1->end == v2 || e2->end == v2) xd2 = d2+1;
			    else                                xd2 = d2;

			    oldcola = xd1 + xd2;
			    if (cola > oldcola)
			    {
                                extA1[k] = e1;
                                extA2[k] = e2;
                                ++k;
			    }
			    else if (cola == oldcola)
			    {
			        oldcolb = MIN(xd1,xd2);
				colb = 3 + MIN(alpha,degree[i]-alpha-2);
			   	if (colb >= oldcolb)
			        {
                                    extA1[k] = e1;
                                    extA2[k] = e2;
                                    ++k;
			        }
			    }
                        }
                        ++alpha;
                        e2 = e2->next;
                    } while (e2 != elast2);
                    e1 = e1->next;
                } while (e1 != elast1);
            }
	}

	*nextA = k;

      /* B-extensions, trivial group */

	if (lastA || nv >= maxnv-1)
	    *nextB = 0;
	else
	{
            k = 0;

	    for (i = 0; i < nv; ++i)
	    if (degree[i] == 5)
	    {
		e = elast = firstedge[i];
		do
		{
		    if (degree[e->end] == 5 && e == e->min)
		    {
			extB[k] = extB[k+1] = e;
			extBmirror[k] = FALSE;
			extBmirror[k+1] = TRUE;
			k += 2;
		    }
		    e = e->next;
		} while (e != elast);
	    }
	    *nextB = k;
	}

      /* C-extensions, trivial group */

	if (nv >= maxnv-4)
	    *nextC = 0;
	else
	{
	    k = 0;
	    for (i = 0; i < nv; ++i)
		if (degree[i] == 5) extC[k++] = firstedge[i];
	    *nextC = k;
	}
    }
    else    
    {
        nb0 = (EDGE**)numbering[0];
        nboplim = (EDGE**)numbering[nbop==0?nbtot:nbop];
        nblim = (EDGE**)numbering[nbtot];

	for (i = 0; i < ne; ++i) nb0[i]->index = i;

      /* A-extensions, non-trivial group */
    
	k = 0;

	for (i = 0; i < nv; ++i)
	if (degree[i] >= 6)
	{
            if (!ISMARKED_V(i) && lastA && degree[i]+4 < d1+d2) continue;

	    e1 = elast1 = firstedge[i];
            do
            {
		e2 = e1->next->next->next;
		elast2 = e1->prev->prev;
		do
		{
		    if (e1 < e2)
		    {
			nb1 = &nb0[e1->index + MAXE];
			nb2 = &nb0[e2->index + MAXE];
			for ( ; nb1 < nblim; nb1 += MAXE, nb2 += MAXE)
			    if (*nb1 < *nb2)
			    {
				if (*nb1 < e1 || (*nb1 == e1 && *nb2 < e2))
				    break;	
			    }
			    else
			    {
				if (*nb2 < e1 || (*nb2 == e1 && *nb1 < e2))
				    break;	
			    }

			if (nb1 >= nblim)
			{
			    extA1[k] = e1;
			    extA2[k] = e2;
			    ++k;
			}
		    }
		    e2 = e2->next;
		} while (e2 != elast2);
		e1 = e1->next;
	    } while (e1 != elast1);
	}

	*nextA = k;

      /* B-extensions, non-trivial group */

        if (lastA || nv >= maxnv-1)
            *nextB = 0;
        else
        {
            k = 0;
            RESETMARKS;

	    for (i = 0; i < ne; ++i)
		if (!ISMARKEDLO(nb0[i]) && degree[nb0[i]->start] == 5
					 && degree[nb0[i]->end] == 5)
		{
		    extB[k] = nb0[i]->min;
		    if (nb0[i] == nb0[i]->min)
		    {
			extBmirror[k] = TRUE;

		        for (nb = &nb0[i]; nb < nboplim; nb += MAXE)
			    MARKLO((*nb)->min);
		        for ( ; nb < nblim; nb += MAXE)
			    MARKLO((*nb)->min->invers);
		    }
		    else
                    {
                        extBmirror[k] = FALSE;

                        for (nb = &nb0[i]; nb < nboplim; nb += MAXE)
                            MARKLO((*nb)->min->invers);
                        for ( ; nb < nblim; nb += MAXE)
                            MARKLO((*nb)->min);
                    }
		    ++k;
		}

	    *nextB = k;
	}

      /* C-extensions, non-trivial group */

        if (nv >= maxnv-4)
            *nextC = 0;
        else
        {
            k = 0;

	    RESETMARKS_V;
	    for (i = 0; i < nv; ++i)
	        if (!ISMARKED_V(i) && degree[i] == 5)
		{
		    extC[k++] = firstedge[i];
		    for (nb = nb0+firstedge[i]->index; nb < nblim; nb += MAXE)
			MARK_V((*nb)->start);
		}
	    *nextC = k;
	}		
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %r9, 0x48(%rsp)
movq %r8, 0x50(%rsp)
movq %rcx, %r15
movq %rdx, %r12
movl %esi, %ebp
movl %edi, %r13d
movq 0xb0(%rsp), %r8
movl 0x1381c(%rip), %eax     # 0x26090
leal 0x1(%rax), %ecx
movq %rcx, 0x18(%rsp)
movl %ecx, 0x1380e(%rip)     # 0x26090
cmpl $0x7530, %eax           # imm = 0x7530
jl 0x128b6
movl $0x1, 0x137fd(%rip)     # 0x26090
leaq 0x278396(%rip), %rdi    # 0x28ac30
movl $0x100, %edx            # imm = 0x100
xorl %esi, %esi
movq %r8, %rbx
callq 0x1030
movq %rbx, %r8
movl $0x1, %eax
movq %rax, 0x18(%rsp)
testq %r8, %r8
je 0x12907
movslq (%r8), %r10
movslq 0x4(%r8), %r11
leaq 0x15327(%rip), %rax     # 0x27bf0
movl (%rax,%r10,4), %ecx
movq %rcx, 0x30(%rsp)
movl (%rax,%r11,4), %eax
movq %rax, 0x10(%rsp)
leaq 0x27834e(%rip), %rax    # 0x28ac30
movq 0x18(%rsp), %rdx
movl %edx, (%rax,%r10,4)
movl %edx, (%rax,%r11,4)
movq 0x10(%r8), %rcx
movslq 0x4(%rcx), %rcx
movl %edx, (%rax,%rcx,4)
movq 0x18(%r8), %rcx
movslq 0x4(%rcx), %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x12911
movq %rax, 0x30(%rsp)
movq %rax, 0x10(%rsp)
cmpl $0x1, %r13d
jne 0x12af9
movslq 0x231cee(%rip), %rbp    # 0x244610
movl $0x0, %r13d
testq %rbp, %rbp
jle 0x12abc
movq 0x10(%rsp), %rax
movq 0x30(%rsp), %rcx
leal (%rax,%rcx), %edx
movl %edx, 0x2c(%rsp)
incl %ecx
movl %ecx, (%rsp)
incl %eax
xorl %edx, %edx
xorl %r13d, %r13d
movq %rbp, 0x38(%rsp)
leaq 0x15296(%rip), %rcx     # 0x27bf0
movl (%rcx,%rdx,4), %edi
cmpl $0x6, %edi
movq %rdx, 0x40(%rsp)
jl 0x12aa6
cmpq $0x0, 0xb0(%rsp)
je 0x12a5f
movq 0x18(%rsp), %rcx
leaq 0x2782aa(%rip), %rsi    # 0x28ac30
cmpl %ecx, (%rsi,%rdx,4)
je 0x12a5f
leal 0x2(%rdi), %ecx
cmpl 0x2c(%rsp), %ecx
jge 0x12a5f
leal 0x4(%rdi), %ebx
cmpl 0x2c(%rsp), %ebx
jb 0x12aa6
leaq 0x15040(%rip), %rcx     # 0x279f0
movq (%rcx,%rdx,8), %rbp
addl $-0x4, %edi
movq %rdi, 0x8(%rsp)
movq %rbp, 0x20(%rsp)
movq 0x10(%rbp), %rcx
movq 0x18(%rbp), %rdx
movq 0x18(%rdx), %rdx
movq 0x18(%rdx), %r8
movq 0x10(%rcx), %rdi
movl $0x2, %ecx
movq 0x8(%rsp), %rdx
cmpq %rbp, %r8
jbe 0x12a41
movl 0x4(%rbp), %esi
cmpl %r10d, %esi
je 0x129f7
movq 0x30(%rsp), %r9
cmpl %r10d, 0x4(%r8)
jne 0x129fb
movl (%rsp), %r9d
cmpl %r11d, %esi
je 0x12a0b
movq 0x10(%rsp), %rsi
cmpl %r11d, 0x4(%r8)
jne 0x12a0d
movl %eax, %esi
leal (%rsi,%r9), %r14d
cmpl %r14d, %ebx
jle 0x12a26
movslq %r13d, %r13
movq %rbp, (%r12,%r13,8)
movq %r8, (%r15,%r13,8)
incl %r13d
jmp 0x12a41
jne 0x12a41
cmpl %esi, %r9d
cmovll %r9d, %esi
cmpl %edx, %ecx
movl %edx, %r9d
cmovll %ecx, %r9d
addl $0x3, %r9d
cmpl %esi, %r9d
jge 0x12a16
incl %ecx
movq 0x18(%r8), %r8
decl %edx
cmpq %rdi, %r8
jne 0x129df
movq 0x18(%rbp), %rbp
cmpq 0x20(%rsp), %rbp
jne 0x129c1
jmp 0x12aa6
leaq 0x14f8a(%rip), %rcx     # 0x279f0
movq (%rcx,%rdx,8), %rcx
movq %rcx, %rdx
movq 0x10(%rdx), %rsi
movq 0x18(%rdx), %rdi
movq 0x18(%rdi), %rdi
movq 0x18(%rdi), %rdi
movq 0x10(%rsi), %r8
cmpq %rdx, %rdi
jbe 0x12a94
movslq %r13d, %r13
movq %rdx, (%r12,%r13,8)
movq %rdi, (%r15,%r13,8)
incl %r13d
movq 0x18(%rdi), %rdi
cmpq %r8, %rdi
jne 0x12a81
movq 0x18(%rdx), %rdx
cmpq %rcx, %rdx
jne 0x12a6d
movq 0x40(%rsp), %rdx
incq %rdx
movq 0x38(%rsp), %rbp
cmpq %rbp, %rdx
jne 0x12953
movq 0x50(%rsp), %rax
movl %r13d, (%rax)
movl 0x137a6(%rip), %eax     # 0x26270
cmpq $0x0, 0xb0(%rsp)
je 0x12f06
movq 0xa8(%rsp), %r10
movq 0xa0(%rsp), %r11
movq 0x98(%rsp), %r14
xorl %r12d, %r12d
jmp 0x12fa5
testl %ebp, %ebp
cmovel %r13d, %ebp
movl %ebp, 0x38(%rsp)
leaq 0x151e6(%rip), %rbp     # 0x27cf0
movslq %r13d, %rax
imulq $0xba0, %rax, %rsi      # imm = 0xBA0
movslq 0x231af9(%rip), %rdi    # 0x244614
testq %rdi, %rdi
jle 0x12b37
xorl %eax, %eax
movq %rbp, %rcx
movq (%rcx), %rdx
movl %eax, 0x34(%rdx)
incq %rax
addq $0x8, %rcx
cmpq %rax, %rdi
jne 0x12b25
movq %rdi, 0x20(%rsp)
movq %rsi, 0x40(%rsp)
leaq (%rsi,%rbp), %r13
movslq 0x231ac4(%rip), %rdx    # 0x244610
movl $0x0, 0x8(%rsp)
movl $0x0, %eax
movq %rdx, (%rsp)
testq %rdx, %rdx
jle 0x12c66
movq 0x10(%rsp), %rax
addl 0x30(%rsp), %eax
movq %rax, 0x10(%rsp)
xorl %ecx, %ecx
movl $0xba0, %r11d           # imm = 0xBA0
xorl %eax, %eax
leaq 0x1506b(%rip), %rdx     # 0x27bf0
movl (%rdx,%rcx,4), %edx
cmpl $0x6, %edx
jl 0x12c59
cmpq $0x0, 0xb0(%rsp)
je 0x12bba
movq 0x18(%rsp), %rsi
leaq 0x278088(%rip), %rdi    # 0x28ac30
cmpl %esi, (%rdi,%rcx,4)
je 0x12bba
addl $0x4, %edx
cmpl 0x10(%rsp), %edx
jl 0x12c59
leaq 0x14e2f(%rip), %rdx     # 0x279f0
movq (%rdx,%rcx,8), %r10
movq %r10, %rbx
movq 0x10(%rbx), %rdx
movq 0x18(%rbx), %rsi
movq 0x18(%rsi), %rsi
movq 0x18(%rsi), %r8
movq 0x10(%rdx), %r9
cmpq %r8, %rbx
jae 0x12c43
movslq 0x34(%rbx), %rdx
leaq 0xba0(,%rdx,8), %rdx
addq %rbp, %rdx
cmpq %r13, %rdx
jae 0x12c37
movslq 0x34(%r8), %rsi
leaq 0xba0(,%rsi,8), %r14
addq %rbp, %r14
movq (%rdx), %rdi
movq (%r14), %rsi
cmpq %rsi, %rdi
jae 0x12c1d
cmpq %rbx, %rdi
jb 0x12c43
jne 0x12c2c
cmpq %r8, %rsi
jae 0x12c2c
jmp 0x12c43
cmpq %rbx, %rsi
jb 0x12c43
cmpq %r8, %rdi
jae 0x12c2c
cmpq %rbx, %rsi
je 0x12c43
addq %r11, %r14
addq %r11, %rdx
cmpq %r13, %rdx
jb 0x12c04
cltq
movq %rbx, (%r12,%rax,8)
movq %r8, (%r15,%rax,8)
incl %eax
movq 0x18(%r8), %r8
cmpq %r9, %r8
jne 0x12bdc
movq 0x18(%rbx), %rbx
cmpq %r10, %rbx
jne 0x12bc8
incq %rcx
cmpq (%rsp), %rcx
jne 0x12b7e
cmpq $0x0, 0xb0(%rsp)
setne %cl
movq 0x50(%rsp), %rdx
movl %eax, (%rdx)
movl 0x135f1(%rip), %eax     # 0x26270
leal -0x1(%rax), %edx
cmpl %edx, (%rsp)
setge %dl
orb %cl, %dl
je 0x12ca1
movq 0xa0(%rsp), %r14
movq 0x98(%rsp), %r12
jmp 0x12e2f
movl 0x133e5(%rip), %edx     # 0x2608c
leal 0x2(%rdx), %ecx
movl %ecx, 0x133dc(%rip)     # 0x2608c
cmpl $0x752f, %edx           # imm = 0x752F
movq 0xa0(%rsp), %r14
movq 0x48(%rsp), %r15
movq 0x98(%rsp), %r12
movq 0x20(%rsp), %r11
jl 0x12d01
movl $0x2, 0x133b0(%rip)     # 0x2608c
movl $0x30, %ecx
leaq 0x231938(%rip), %rdx    # 0x244620
movl $0x0, (%rcx,%rdx)
addq $0x40, %rcx
cmpq $0x46630, %rcx          # imm = 0x46630
jne 0x12ce8
movl $0x2, %ecx
testl %r11d, %r11d
jle 0x12e2f
movslq 0x38(%rsp), %rdx
imulq $0xba0, %rdx, %rdx      # imm = 0xBA0
leaq (%rdx,%rbp), %rsi
xorl %r9d, %r9d
leaq 0x14ecc(%rip), %r10     # 0x27bf0
movl $0x0, 0x8(%rsp)
movq (%rbp,%r9,8), %rbx
cmpl %ecx, 0x30(%rbx)
je 0x12e23
movslq (%rbx), %rdi
cmpl $0x5, (%r10,%rdi,4)
jne 0x12e23
movslq 0x4(%rbx), %rdi
cmpl $0x5, (%r10,%rdi,4)
jne 0x12e23
leaq (,%r9,8), %r11
leaq (,%r9,8), %r8
addq %rbp, %r8
movq 0x28(%rbx), %rbx
movslq 0x8(%rsp), %rdi
movq %rbx, (%r15,%rdi,8)
movq (%r11,%rbp), %rbx
cmpq 0x28(%rbx), %rbx
je 0x12dd1
movq 0x90(%rsp), %rbx
movl $0x0, (%rbx,%rdi,4)
cmpq %rdx, %r11
jge 0x12daf
movq (%r8), %rdi
movq 0x28(%rdi), %rdi
movq 0x20(%rdi), %rdi
movl %ecx, 0x30(%rdi)
addq $0xba0, %r8             # imm = 0xBA0
cmpq %rsi, %r8
jb 0x12d95
cmpq %r13, %r8
movq 0x20(%rsp), %r11
jae 0x12e1f
movq (%r8), %rdi
movq 0x28(%rdi), %rdi
movl %ecx, 0x30(%rdi)
addq $0xba0, %r8             # imm = 0xBA0
cmpq %r13, %r8
jb 0x12db9
jmp 0x12e1f
movq 0x90(%rsp), %rbx
movl $0x1, (%rbx,%rdi,4)
cmpq %rdx, %r11
jge 0x12dfb
movq (%r8), %rdi
movq 0x28(%rdi), %rdi
movl %ecx, 0x30(%rdi)
addq $0xba0, %r8             # imm = 0xBA0
cmpq %rsi, %r8
jb 0x12de5
cmpq %r13, %r8
movq 0x20(%rsp), %r11
jae 0x12e1f
movq (%r8), %rdi
movq 0x28(%rdi), %rdi
movq 0x20(%rdi), %rdi
movl %ecx, 0x30(%rdi)
addq $0xba0, %r8             # imm = 0xBA0
cmpq %r13, %r8
jb 0x12e05
incl 0x8(%rsp)
incq %r9
cmpq %r11, %r9
jne 0x12d2c
movl 0x8(%rsp), %ecx
movl %ecx, (%r12)
addl $-0x4, %eax
xorl %ebx, %ebx
cmpl %eax, (%rsp)
jge 0x12ef9
movq 0x18(%rsp), %rcx
leal 0x1(%rcx), %eax
movl %eax, 0x1323d(%rip)     # 0x26090
cmpl $0x7530, %ecx           # imm = 0x7530
jl 0x12e7d
movl $0x1, 0x1322b(%rip)     # 0x26090
leaq 0x277dc4(%rip), %rdi    # 0x28ac30
movl $0x100, %edx            # imm = 0x100
xorl %esi, %esi
callq 0x1030
movl $0x1, %eax
cmpl $0x0, (%rsp)
movq 0xa8(%rsp), %r10
movq 0x40(%rsp), %r11
jle 0x12ff0
xorl %ecx, %ecx
leaq 0x277d93(%rip), %rdx    # 0x28ac30
leaq 0x14d4c(%rip), %rsi     # 0x27bf0
leaq 0x14b45(%rip), %rdi     # 0x279f0
xorl %ebx, %ebx
cmpl %eax, (%rdx,%rcx,4)
je 0x12eeb
cmpl $0x5, (%rsi,%rcx,4)
jne 0x12eeb
movq (%rdi,%rcx,8), %r8
movslq %ebx, %r9
incl %ebx
movq %r8, (%r14,%r9,8)
movslq 0x34(%r8), %r8
shlq $0x3, %r8
cmpq %r11, %r8
jge 0x12eeb
addq %rbp, %r8
movq (%r8), %r9
movslq (%r9), %r9
movl %eax, (%rdx,%r9,4)
addq $0xba0, %r8             # imm = 0xBA0
cmpq %r13, %r8
jb 0x12ed5
incq %rcx
cmpq (%rsp), %rcx
jne 0x12ead
jmp 0x12ff0
movq 0xa8(%rsp), %r10
jmp 0x12ff0
testl %ebp, %ebp
setle %cl
leal -0x1(%rax), %edx
cmpl %edx, %ebp
setge %dl
orb %cl, %dl
movq 0xa8(%rsp), %r10
movq 0xa0(%rsp), %r11
movq 0x48(%rsp), %rbx
movq 0x98(%rsp), %r14
movq 0x90(%rsp), %r15
movl $0x0, %r12d
jne 0x12fa5
xorl %ecx, %ecx
leaq 0x14ca5(%rip), %rdx     # 0x27bf0
leaq 0x14a9e(%rip), %rsi     # 0x279f0
xorl %r12d, %r12d
cmpl $0x5, (%rdx,%rcx,4)
jne 0x12f9d
movq (%rsi,%rcx,8), %rdi
movq %rdi, %r8
movslq 0x4(%r8), %r9
cmpl $0x5, (%rdx,%r9,4)
jne 0x12f94
cmpq 0x28(%r8), %r8
jne 0x12f94
movslq %r12d, %r12
movq %r8, 0x8(%rbx,%r12,8)
movq %r8, (%rbx,%r12,8)
movl $0x0, (%r15,%r12,4)
movl $0x1, 0x4(%r15,%r12,4)
addl $0x2, %r12d
movq 0x18(%r8), %r8
cmpq %rdi, %r8
jne 0x12f62
incq %rcx
cmpq %rbp, %rcx
jne 0x12f55
testl %ebp, %ebp
setle %cl
movl %r12d, (%r14)
addl $-0x4, %eax
cmpl %eax, %ebp
setge %al
xorl %ebx, %ebx
orb %cl, %al
jne 0x12ff0
shlq $0x2, %rbp
xorl %eax, %eax
leaq 0x14a28(%rip), %rcx     # 0x279f0
leaq 0x14c21(%rip), %rdx     # 0x27bf0
xorl %ebx, %ebx
cmpl $0x5, (%rax,%rdx)
jne 0x12fe3
movq (%rcx), %rsi
movslq %ebx, %rdi
incl %ebx
movq %rsi, (%r11,%rdi,8)
addq $0x8, %rcx
addq $0x4, %rax
cmpq %rax, %rbp
jne 0x12fd1
movl %ebx, (%r10)
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq