// File: /workspace/github_c_makefile_star2_O2/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
movq %r8, -0x18(%rsp)
movq 0x58(%rsp), %rbx
movl 0x12b1e(%rip), %eax     # 0x24080
leal 0x1(%rax), %r8d
movq %r8, -0x50(%rsp)
movl %r8d, 0x12b0e(%rip)     # 0x24080
cmpl $0x7530, %eax           # imm = 0x7530
jl 0x115aa
movl $0x1, 0x12afd(%rip)     # 0x24080
xorl %eax, %eax
movl $0x1, %r8d
movq %r8, -0x50(%rsp)
leaq 0x277689(%rip), %r8     # 0x288c20
cmpq $0x100, %rax            # imm = 0x100
je 0x115aa
andl $0x0, (%rax,%r8)
addq $0x4, %rax
jmp 0x11597
testq %rbx, %rbx
je 0x115fd
movslq (%rbx), %r10
movslq 0x4(%rbx), %r13
leaq 0x14623(%rip), %rax     # 0x25be0
movl (%rax,%r10,4), %r8d
movq %r8, -0x60(%rsp)
movl (%rax,%r13,4), %eax
movq %rax, -0x58(%rsp)
leaq 0x27764a(%rip), %rax    # 0x288c20
movq -0x50(%rsp), %r11
movl %r11d, (%rax,%r10,4)
movl %r11d, (%rax,%r13,4)
movq 0x10(%rbx), %r8
movslq 0x4(%r8), %r8
movl %r11d, (%rax,%r8,4)
movq 0x18(%rbx), %r8
movslq 0x4(%r8), %r8
movl %r11d, (%rax,%r8,4)
jmp 0x11607
movq %rax, -0x60(%rsp)
movq %rax, -0x58(%rsp)
cmpl $0x1, %edi
movq %r9, -0x10(%rsp)
jne 0x117c7
movl 0x230fe5(%rip), %esi    # 0x242600
movq -0x58(%rsp), %rax
movq -0x60(%rsp), %rdi
leal (%rax,%rdi), %r8d
movl %r8d, -0x44(%rsp)
incl %edi
movl %edi, -0x38(%rsp)
leal 0x1(%rax), %r15d
xorl %edi, %edi
testl %esi, %esi
movl $0x0, %eax
movl %esi, -0x1c(%rsp)
cmovgl %esi, %eax
movq %rax, -0x40(%rsp)
xorl %r14d, %r14d
cmpq -0x40(%rsp), %rdi
je 0x11807
leaq 0x1457e(%rip), %rax     # 0x25be0
movl (%rax,%rdi,4), %r8d
cmpl $0x6, %r8d
movq %rdi, -0x8(%rsp)
jl 0x117ba
cmpq $0x0, 0x58(%rsp)
je 0x11773
movq -0x50(%rsp), %rax
leaq 0x277593(%rip), %rsi    # 0x288c20
cmpl %eax, (%rsi,%rdi,4)
je 0x11773
leal 0x2(%r8), %eax
cmpl -0x44(%rsp), %eax
jge 0x11773
leal 0x4(%r8), %r9d
cmpl -0x44(%rsp), %r9d
jb 0x117ba
leaq 0x14326(%rip), %rax     # 0x259e0
movq (%rax,%rdi,8), %rax
addl $-0x4, %r8d
movq %rax, -0x30(%rsp)
movq %r8, -0x28(%rsp)
movq 0x10(%rax), %rdi
movq 0x18(%rax), %rsi
movq 0x18(%rsi), %rsi
movq 0x18(%rsi), %rsi
movq 0x10(%rdi), %rbx
movl %r8d, %ebp
movl $0x2, %edi
cmpq %rax, %rsi
jbe 0x11750
movl 0x4(%rax), %r12d
cmpl %r10d, %r12d
je 0x11701
movq -0x60(%rsp), %r11
cmpl %r10d, 0x4(%rsi)
jne 0x11709
movl -0x38(%rsp), %r8d
movl %r8d, %r11d
cmpl %r13d, %r12d
je 0x11719
movq -0x58(%rsp), %r12
cmpl %r13d, 0x4(%rsi)
jne 0x1171c
movl %r15d, %r12d
leal (%r12,%r11), %r8d
cmpl %r8d, %r9d
jle 0x11735
movslq %r14d, %r14
movq %rax, (%rdx,%r14,8)
movq %rsi, (%rcx,%r14,8)
incl %r14d
jmp 0x11750
jne 0x11750
cmpl %r12d, %r11d
cmovll %r11d, %r12d
cmpl %ebp, %edi
movl %ebp, %r8d
cmovll %edi, %r8d
addl $0x3, %r8d
cmpl %r12d, %r8d
jge 0x11725
incl %edi
movq 0x18(%rsi), %rsi
decl %ebp
cmpq %rbx, %rsi
jne 0x116e8
movq 0x18(%rax), %rax
cmpq -0x30(%rsp), %rax
movq -0x28(%rsp), %r8
jne 0x116cc
jmp 0x117ba
leaq 0x14266(%rip), %rax     # 0x259e0
movq (%rax,%rdi,8), %rax
movq %rax, %rsi
movq 0x10(%rsi), %r9
movq 0x18(%rsi), %rdi
movq 0x18(%rdi), %rdi
movq 0x18(%rdi), %rdi
movq 0x10(%r9), %r9
cmpq %rsi, %rdi
jbe 0x117a8
movslq %r14d, %r14
movq %rsi, (%rdx,%r14,8)
movq %rdi, (%rcx,%r14,8)
incl %r14d
movq 0x18(%rdi), %rdi
cmpq %r9, %rdi
jne 0x11795
movq 0x18(%rsi), %rsi
cmpq %rax, %rsi
jne 0x11781
movq -0x8(%rsp), %rdi
incq %rdi
jmp 0x11650
testl %esi, %esi
cmovel %edi, %esi
movslq %esi, %rax
movq %rax, -0x30(%rsp)
movslq %edi, %rax
movl 0x230e26(%rip), %r10d   # 0x242604
xorl %esi, %esi
testl %r10d, %r10d
cmovlel %esi, %r10d
leaq 0x144f2(%rip), %rdi     # 0x25ce0
cmpq %rsi, %r10
je 0x11892
movq (%rdi), %r8
movl %esi, 0x34(%r8)
incq %rsi
addq $0x8, %rdi
jmp 0x117ee
cmpq $0x0, 0x58(%rsp)
setne %dl
movq -0x18(%rsp), %rax
movl %r14d, (%rax)
movl 0x12a42(%rip), %eax     # 0x24260
leal -0x1(%rax), %ecx
movl -0x1c(%rsp), %ebp
cmpl %ecx, %ebp
setge %sil
xorl %ecx, %ecx
orb %dl, %sil
movl $0x0, %edx
movq 0x48(%rsp), %r10
leaq 0x1439f(%rip), %r14     # 0x25be0
leaq 0x14198(%rip), %r15     # 0x259e0
je 0x11a66
movq 0x40(%rsp), %rsi
movl %edx, (%rsi)
addl $-0x4, %eax
cmpl %eax, %ebp
jge 0x11b72
shlq $0x2, -0x40(%rsp)
xorl %eax, %eax
xorl %ecx, %ecx
cmpq %rax, -0x40(%rsp)
je 0x11b72
cmpl $0x5, (%rax,%r14)
jne 0x11888
movq (%r15), %rdx
movslq %ecx, %rsi
incl %ecx
movq %rdx, (%r10,%rsi,8)
addq $0x4, %rax
addq $0x8, %r15
jmp 0x1186a
movq %r10, -0x28(%rsp)
imulq $0xba0, %rax, %rsi      # imm = 0xBA0
leaq 0x1443b(%rip), %rdi     # 0x25ce0
addq %rdi, %rsi
movl 0x230d51(%rip), %r8d    # 0x242600
movq -0x58(%rsp), %rax
addl -0x60(%rsp), %eax
movq %rax, -0x58(%rsp)
xorl %r14d, %r14d
testl %r8d, %r8d
movl $0x0, %eax
movl %r8d, -0x60(%rsp)
cmovgl %r8d, %eax
movq %rax, -0x38(%rsp)
leaq 0x14303(%rip), %r12     # 0x25be0
movl $0xba0, %ebx            # imm = 0xBA0
xorl %r15d, %r15d
cmpq -0x38(%rsp), %r14
je 0x119d5
movl (%r12,%r14,4), %r8d
cmpl $0x6, %r8d
jl 0x119c6
cmpq $0x0, 0x58(%rsp)
je 0x11927
movq -0x50(%rsp), %rax
leaq 0x27730e(%rip), %r9     # 0x288c20
cmpl %eax, (%r9,%r14,4)
je 0x11927
addl $0x4, %r8d
cmpl -0x58(%rsp), %r8d
jl 0x119c6
leaq 0x140b2(%rip), %rax     # 0x259e0
movq (%rax,%r14,8), %r8
movq %r8, %r9
movq 0x10(%r9), %rax
movq 0x18(%r9), %r10
movq 0x18(%r10), %r10
movq 0x18(%r10), %r11
movq 0x10(%rax), %rbp
cmpq %r11, %r9
jae 0x119b0
movslq 0x34(%r9), %rax
movslq 0x34(%r11), %r10
leaq (%rdi,%rax,8), %r13
addq $0xba0, %r13            # imm = 0xBA0
leaq (%rdi,%r10,8), %r10
addq $0xba0, %r10            # imm = 0xBA0
cmpq %rsi, %r13
jae 0x119a2
movq (%r13), %rax
movq (%r10), %r12
cmpq %r12, %rax
jae 0x1198b
cmpq %r9, %rax
jb 0x119b0
jne 0x1199a
cmpq %r11, %r12
jae 0x1199a
jmp 0x119b0
cmpq %r9, %r12
jb 0x119b0
cmpq %r11, %rax
jae 0x1199a
cmpq %r9, %r12
je 0x119b0
addq %rbx, %r13
addq %rbx, %r10
jmp 0x1196c
movslq %r15d, %r15
movq %r9, (%rdx,%r15,8)
movq %r11, (%rcx,%r15,8)
incl %r15d
movq 0x18(%r11), %r11
cmpq %rbp, %r11
jne 0x11949
movq 0x18(%r9), %r9
cmpq %r8, %r9
jne 0x11935
incq %r14
leaq 0x14210(%rip), %r12     # 0x25be0
jmp 0x118e5
cmpq $0x0, 0x58(%rsp)
setne %al
movq -0x18(%rsp), %rcx
movl %r15d, (%rcx)
movl 0x12874(%rip), %edx     # 0x24260
leal -0x1(%rdx), %ecx
cmpl %ecx, -0x60(%rsp)
setge %r8b
xorl %ecx, %ecx
orb %al, %r8b
movl $0x0, %r14d
je 0x11ac7
movq 0x40(%rsp), %rax
movl %r14d, (%rax)
addl $-0x4, %edx
cmpl %edx, -0x60(%rsp)
movq 0x48(%rsp), %r10
jge 0x11b72
movq -0x50(%rsp), %rax
leal 0x1(%rax), %edx
movl %edx, 0x12650(%rip)     # 0x24080
cmpl $0x7530, %eax           # imm = 0x7530
leaq 0x2771e4(%rip), %r11    # 0x288c20
jl 0x11b20
movl $0x1, 0x12634(%rip)     # 0x24080
xorl %ecx, %ecx
cmpq $0x100, %rcx            # imm = 0x100
je 0x11b1b
andl $0x0, (%rcx,%r11)
addq $0x4, %rcx
jmp 0x11a4e
xorl %esi, %esi
xorl %edx, %edx
movq -0x10(%rsp), %r11
movq 0x38(%rsp), %rbx
cmpq -0x40(%rsp), %rsi
je 0x1184e
cmpl $0x5, (%r14,%rsi,4)
jne 0x11ac2
movq (%r15,%rsi,8), %rdi
movq %rdi, %r8
movslq 0x4(%r8), %r9
cmpl $0x5, (%r14,%r9,4)
jne 0x11ab9
cmpq 0x28(%r8), %r8
jne 0x11ab9
movslq %edx, %rdx
movq %r8, 0x8(%r11,%rdx,8)
movq %r8, (%r11,%rdx,8)
andl $0x0, (%rbx,%rdx,4)
movl $0x1, 0x4(%rbx,%rdx,4)
addl $0x2, %edx
movq 0x18(%r8), %r8
cmpq %rdi, %r8
jne 0x11a8d
incq %rsi
jmp 0x11a74
imulq $0xba0, -0x30(%rsp), %rbx # imm = 0xBA0
movl 0x125a6(%rip), %eax     # 0x2407c
leal 0x2(%rax), %r9d
movl %r9d, 0x1259b(%rip)     # 0x2407c
cmpl $0x752f, %eax           # imm = 0x752F
jl 0x11b8a
movl $0x2, 0x12586(%rip)     # 0x2407c
movabsq $0x30, %r8
leaq 0x230b09(%rip), %r9     # 0x242610
cmpq $0x46630, %r8           # imm = 0x46630
je 0x11b84
andl $0x0, (%r8,%r9)
addq $0x40, %r8
jmp 0x11b07
movl $0x1, %edx
xorl %r8d, %r8d
xorl %ecx, %ecx
cmpq -0x38(%rsp), %r8
je 0x11b72
cmpl %edx, (%r11,%r8,4)
je 0x11b6d
cmpl $0x5, (%r12,%r8,4)
jne 0x11b6d
leaq 0x13ea0(%rip), %rax     # 0x259e0
movq (%rax,%r8,8), %rax
movslq %ecx, %r9
movq %rax, (%r10,%r9,8)
movslq 0x34(%rax), %rax
leaq (%rdi,%rax,8), %r9
cmpq %rsi, %r9
jae 0x11b6b
movq (%r9), %rax
movslq (%rax), %rax
movl %edx, (%r11,%rax,4)
addq $0xba0, %r9             # imm = 0xBA0
jmp 0x11b53
incl %ecx
incq %r8
jmp 0x11b25
movq 0x50(%rsp), %rax
movl %ecx, (%rax)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x2, %r9d
addq %rdi, %rbx
xorl %r15d, %r15d
xorl %r14d, %r14d
movq -0x10(%rsp), %r11
cmpq -0x28(%rsp), %r15
je 0x11a08
movq (%rdi,%r15,8), %r10
cmpl %r9d, 0x30(%r10)
je 0x11c6a
movslq (%r10), %rax
cmpl $0x5, (%r12,%rax,4)
jne 0x11c6a
movslq 0x4(%r10), %rax
cmpl $0x5, (%r12,%rax,4)
jne 0x11c6a
leaq (%rdi,%r15,8), %r8
movq 0x28(%r10), %r10
movslq %r14d, %rax
movq %r10, (%r11,%rax,8)
movq (%r8), %r10
cmpq 0x28(%r10), %r10
je 0x11c26
movq 0x38(%rsp), %r10
andl $0x0, (%r10,%rax,4)
cmpq %rbx, %r8
jae 0x11c1f
movq (%r8), %rax
movq 0x28(%rax), %rax
movq 0x20(%rax), %rax
movl %r9d, 0x30(%rax)
addq $0xba0, %r8             # imm = 0xBA0
jmp 0x11bf0
movq (%r8), %rax
movq 0x28(%rax), %rax
movl %r9d, 0x30(%rax)
addq $0xba0, %r8             # imm = 0xBA0
cmpq %rsi, %r8
jb 0x11c0d
jmp 0x11c67
movq 0x38(%rsp), %r10
movl $0x1, (%r10,%rax,4)
cmpq %rbx, %r8
jae 0x11c62
movq (%r8), %rax
movq 0x28(%rax), %rax
movl %r9d, 0x30(%rax)
addq $0xba0, %r8             # imm = 0xBA0
jmp 0x11c33
movq (%r8), %rax
movq 0x28(%rax), %rax
movq 0x20(%rax), %rax
movl %r9d, 0x30(%rax)
addq $0xba0, %r8             # imm = 0xBA0
cmpq %rsi, %r8
jb 0x11c4c
incl %r14d
incq %r15
jmp 0x11b98