// File: /workspace/github_c_makefile_star2_O2/mishun[P]plantri/plantri.c
// Function: find_extensions_bip
static void
find_extensions_bip(int nbtot, int nbop, EDGE *extP[], int *nextP,
    EDGE *extQ[], int *nextQ, EDGE *Pedges[], int nPedges)

/* nbtot and nbop are the usual group parameters.
   Place in extP{0..nextP-1] the reference edges of possible P_ops, and
   place in extQ{0..nextQ-1] the reference edges of possible Q_ops.
   In both cases, only inequivalent edges are listed.
*/
{
    int Ptot,Qtot;
    EDGE *e,*elast,*ev,*evlast,*ee;
    EDGE **nb,**nb0,**nblim,**nboplim;
    register int i,v,w;
    int weight[MAXN],minweight;
    int oldPwt,Pv1,Pv2;
   
    Ptot = Qtot = 0;
    for (i = 0; i < nv; ++i) weight[i] = 0;
    minweight = 0;
    RESETMARKS;
    for (i = 0; i < nPedges; ++i)
    if (i == nPedges-1 || is_bip_P(Pedges[i]))
    {
	e = Pedges[i];
	if (ISMARKEDLO(e)) continue;
	MARKLO(e);
	++weight[e->start];
	e = e->next->next->invers->next->next;
	++weight[e->start]; ++weight[e->end];
	while (degree[e->end] == 4) e = e->invers->next->next;
	MARKLO(e);
	++weight[e->start];
	e = e->prev->prev->invers->prev->prev;
	++weight[e->start]; ++weight[e->end];
	minweight += 2;
    }

    if (nv == maxnv-1)
    {
        if (nbtot == 1)  /* Case of trivial group */
        {
            for (i = 0; i < nv; ++i)
	    if (degree[i] != 4)
	    {
	        e = elast = firstedge[i];
	        do
	        {
		    v = e->prev->end;
                    w = e->next->next->end;
		    if (weight[v]+weight[w] >= minweight)
   		    { 
			ev = evlast = e->prev->invers;
                        for (ev = ev->next; ev != evlast; ev = ev->next)
                            if (ev->end == w) break;
                        if (ev == evlast) extQ[Qtot++] = e;
    		    }
		    e = e->next;
	        } while (e != elast);
	    }
        }
        else             /* Case of nontrivial group */
        {
            nb0 = (EDGE**)numbering[0];
            nblim = (EDGE**)numbering[nbtot];
	    nboplim = (EDGE**)numbering[nbop==0?nbtot:nbop];
            RESETMARKS;
            for (i = 0; i < ne; ++i, ++nb0)
            {
	        e = *nb0;
                if (!ISMARKEDLO(e) && degree[e->start] >= 6)
                {
		    v = e->prev->end;
                    w = e->next->next->end;
    
		    if (weight[v]+weight[w] >= minweight)
                    {
                        ev = evlast = e->prev->invers;
                        for (ev = ev->next; ev != evlast; ev = ev->next)
                            if (ev->end == w) break;
                        if (ev == evlast) extQ[Qtot++] = e;
		    }
    
		    nb = nb0 + MAXE;
                    for (; nb < nboplim; nb += MAXE) MARKLO(*nb);
                    for (; nb < nblim; nb += MAXE) MARKLO((*nb)->prev);
                }
            }
        }
    }
    else  /* nv <= maxnv-2 */
    {
        if (nPedges > 0)
	{
	    e = Pedges[nPedges-1];
	    oldPwt = degree[e->end];
	    Pv1 = e->start;
	    Pv2 = e->next->next->end;
	}
	else
	    oldPwt = 0;


        if (nbtot == 1)  /* Case of trivial group */
        {
            for (i = 0; i < nv; ++i)
	    if (degree[i] != 4)
	    {
	        e = elast = firstedge[i];
	        do
	        {
		    if (degree[i] >= oldPwt ||
		        e->next->end == Pv1 || e->next->end == Pv2 ||
			e->prev->end == Pv1 || e->prev->end == Pv2)
		    {
		        for (ee = e; degree[ee->end] == 4;
				         ee = ee->invers->next->next)
		        {}
		        if (degree[i] >= degree[ee->end])
		            extP[Ptot++] = e->invers;
		    }
    
		    v = e->prev->end;
                    w = e->next->next->end;
    
		    if (weight[v]+weight[w] >= minweight)
		    {
                        ev = evlast = e->prev->invers;
                        for (ev = ev->next; ev != evlast; ev = ev->next)
                            if (ev->end == w) break;
                        if (ev == evlast) extQ[Qtot++] = e;
		    }
    
		    e = e->next;
	        } while (e != elast);
	    }
        }
        else             /* Case of nontrivial group */
        {
            nb0 = (EDGE**)numbering[0];
            nblim = (EDGE**)numbering[nbtot];
            RESETMARKS;
	    for (i = 0; i < ne; ++i, ++nb0)
	    {
	        if (!ISMARKEDLO(*nb0) && degree[(*nb0)->start] >= 6)
	        {
		    e = *nb0;
                    if (degree[e->start] >= oldPwt ||
                                e->next->end == Pv1 || e->next->end == Pv2 ||
                                e->prev->end == Pv1 || e->prev->end == Pv2)
		    {
                        for (ee = e; degree[ee->end] == 4;
				        ee = ee->invers->next->next)
                        {}
                        if (degree[e->start] >= degree[ee->end])
                            extP[Ptot++] = e->invers;
		    }
    
		    for (nb = nb0; nb < nblim; nb += MAXE) MARKLO(*nb);
                }
	    }

	    nb0 = (EDGE**)numbering[0];
	    nboplim = (EDGE**)numbering[nbop==0?nbtot:nbop];
            RESETMARKS;
            for (i = 0; i < ne; ++i, ++nb0)
            {
	        e = *nb0;
                if (!ISMARKEDLO(e) && degree[e->start] >= 6)
                {
		    v = e->prev->end;
                    w = e->next->next->end;
    
		    if (weight[v]+weight[w] >= minweight)
		    {
                        ev = evlast = e->prev->invers;
                        for (ev = ev->next; ev != evlast; ev = ev->next)
                            if (ev->end == w) break;
                        if (ev == evlast) extQ[Qtot++] = e;
		    }
    
		    nb = nb0 + MAXE;
                    for (; nb < nboplim; nb += MAXE) MARKLO(*nb);
                    for (; nb < nblim; nb += MAXE) MARKLO((*nb)->prev);
                }
            }
        }
    }

    *nextP = Ptot;
    *nextQ = Qtot;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x158, %rsp            # imm = 0x158
movq %r9, 0x40(%rsp)
movq %r8, 0x20(%rsp)
movq %rcx, 0x38(%rsp)
movq %rdx, 0x18(%rsp)
movl %esi, 0x14(%rsp)
movl %edi, 0x10(%rsp)
movl 0x198(%rsp), %esi
movq 0x190(%rsp), %rdx
movl 0x2273ce(%rip), %edi    # 0x242600
xorl %eax, %eax
testl %edi, %edi
movl $0x0, %ecx
movl %edi, 0x2c(%rsp)
cmovgl %edi, %ecx
cmpq %rax, %rcx
je 0x1b251
andl $0x0, 0x50(%rsp,%rax,4)
incq %rax
jmp 0x1b242
movq %rcx, 0x30(%rsp)
movl 0x8e20(%rip), %eax      # 0x2407c
leal 0x2(%rax), %r15d
movl %r15d, 0x8e15(%rip)     # 0x2407c
leaq 0x2273a2(%rip), %rcx    # 0x242610
cmpl $0x752f, %eax           # imm = 0x752F
jl 0x1b298
movl $0x2, 0x8dfd(%rip)      # 0x2407c
pushq $0x30
popq %rax
pushq $0x2
popq %r15
cmpq $0x46630, %rax          # imm = 0x46630
je 0x1b298
andl $0x0, (%rax,%rcx)
addq $0x40, %rax
jmp 0x1b286
leal -0x1(%rsi), %edi
xorl %ebp, %ebp
testl %esi, %esi
movl $0x0, %r12d
cmovgl %esi, %r12d
leaq 0xa930(%rip), %r14      # 0x25be0
xorl %r13d, %r13d
movq %r15, 0x8(%rsp)
movq %rdi, 0x48(%rsp)
cmpq %r12, %rbp
je 0x1b384
cmpq %rdi, %rbp
jne 0x1b2d1
movq (%rdx,%rdi,8), %rbx
jmp 0x1b2fb
movq (%rdx,%rbp,8), %rbx
movq %rbx, %rdi
movl %r13d, %r15d
movq %rdx, %r13
callq 0x1c0d0
movq 0x48(%rsp), %rdi
movq %r13, %rdx
movl %r15d, %r13d
movq 0x8(%rsp), %r15
testl %eax, %eax
je 0x1b37c
cmpl %r15d, 0x30(%rbx)
je 0x1b37c
movl %r15d, 0x30(%rbx)
movslq (%rbx), %rax
incl 0x50(%rsp,%rax,4)
movq 0x18(%rbx), %rax
movq 0x18(%rax), %rax
movq 0x20(%rax), %rax
movq 0x18(%rax), %rax
movq 0x18(%rax), %rax
movslq (%rax), %rcx
incl 0x50(%rsp,%rcx,4)
movslq 0x4(%rax), %rcx
incl 0x50(%rsp,%rcx,4)
movslq %ecx, %rcx
cmpl $0x4, (%r14,%rcx,4)
jne 0x1b34a
movq 0x20(%rax), %rax
movq 0x18(%rax), %rax
movq 0x18(%rax), %rax
movl 0x4(%rax), %ecx
jmp 0x1b32f
movl %r15d, 0x30(%rax)
movslq (%rax), %rcx
incl 0x50(%rsp,%rcx,4)
movq 0x10(%rax), %rax
movq 0x10(%rax), %rax
movq 0x20(%rax), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rax
movslq (%rax), %rcx
incl 0x50(%rsp,%rcx,4)
movslq 0x4(%rax), %rax
incl 0x50(%rsp,%rax,4)
addl $0x2, %r13d
incq %rbp
jmp 0x1b2bd
movl 0x8ed6(%rip), %ecx      # 0x24260
decl %ecx
movl 0x10(%rsp), %edi
movslq %edi, %rax
cmpl %ecx, 0x2c(%rsp)
jne 0x1b42f
cmpl $0x1, %edi
leaq 0x227269(%rip), %rcx    # 0x242610
jne 0x1b466
xorl %eax, %eax
leaq 0xa62a(%rip), %rdx      # 0x259e0
xorl %esi, %esi
xorl %ecx, %ecx
movq 0x30(%rsp), %r15
cmpq %r15, %rsi
je 0x1b8a5
cmpl $0x4, (%r14,%rsi,4)
je 0x1b42a
movq (%rdx,%rsi,8), %rdi
movq %rdi, %r9
movq 0x10(%r9), %r11
movq 0x18(%r9), %r8
movslq 0x4(%r11), %rbx
movq 0x18(%r8), %r10
movslq 0x4(%r10), %r10
movl 0x50(%rsp,%r10,4), %ebp
addl 0x50(%rsp,%rbx,4), %ebp
cmpl %r13d, %ebp
jl 0x1b422
movq 0x20(%r11), %r11
movq %r11, %rbx
movq 0x18(%rbx), %rbx
cmpq %r11, %rbx
je 0x1b410
cmpl %r10d, 0x4(%rbx)
jne 0x1b3ff
jmp 0x1b422
movslq %ecx, %r8
incl %ecx
movq 0x20(%rsp), %r10
movq %r9, (%r10,%r8,8)
movq 0x18(%r9), %r8
movq %r8, %r9
cmpq %rdi, %r8
jne 0x1b3d6
incq %rsi
jmp 0x1b3bf
movl 0x198(%rsp), %ecx
testl %ecx, %ecx
leaq 0x2271d1(%rip), %r9     # 0x242610
jle 0x1b58f
movl %ecx, %ecx
movq -0x8(%rdx,%rcx,8), %rcx
movslq 0x4(%rcx), %rdx
movl (%r14,%rdx,4), %edx
movl (%rcx), %esi
movq 0x18(%rcx), %rcx
movq 0x18(%rcx), %rcx
movl 0x4(%rcx), %edi
jmp 0x1b591
imulq $0xba0, %rax, %rdx      # imm = 0xBA0
leaq 0xa86c(%rip), %rsi      # 0x25ce0
movl 0x14(%rsp), %eax
testl %eax, %eax
cmovnel %eax, %edi
movslq %edi, %rax
imulq $0xba0, %rax, %rdi      # imm = 0xBA0
leal 0x2(%r15), %r8d
movl %r8d, 0x8bea(%rip)      # 0x2407c
cmpl $0x752f, %r15d          # imm = 0x752F
jl 0x1b4be
movl $0x2, 0x8bd7(%rip)      # 0x2407c
pushq $0x30
popq %rax
pushq $0x2
popq %r8
cmpq $0x46630, %rax          # imm = 0x46630
je 0x1b4be
andl $0x0, (%rax,%rcx)
addq $0x40, %rax
jmp 0x1b4ac
addq %rsi, %rdx
addq %rsi, %rdi
movl 0x22713a(%rip), %ebp    # 0x242604
xorl %eax, %eax
testl %ebp, %ebp
cmovlel %eax, %ebp
leaq 0xb3a8(%rip), %r10      # 0x26880
xorl %ecx, %ecx
xorl %r11d, %r11d
movl %ebp, 0x18(%rsp)
cmpl %ebp, %r11d
je 0x1b8a5
movq (%rsi), %rbx
cmpl %r8d, 0x30(%rbx)
je 0x1b57f
movslq (%rbx), %r15
cmpl $0x6, (%r14,%r15,4)
jl 0x1b57f
movq 0x10(%rbx), %r12
movq 0x18(%rbx), %r15
movslq 0x4(%r12), %rbp
movq 0x18(%r15), %r15
movslq 0x4(%r15), %r15
movl 0x50(%rsp,%r15,4), %r9d
addl 0x50(%rsp,%rbp,4), %r9d
cmpl %r13d, %r9d
jl 0x1b54c
movq 0x20(%r12), %r12
movq %r12, %rbp
movq 0x18(%rbp), %rbp
cmpq %r12, %rbp
je 0x1b53e
cmpl %r15d, 0x4(%rbp)
jne 0x1b52d
jmp 0x1b54c
movslq %ecx, %r9
incl %ecx
movq 0x20(%rsp), %r15
movq %rbx, (%r15,%r9,8)
movq %r10, %rbx
movl 0x18(%rsp), %ebp
cmpq %rdi, %rbx
jae 0x1b57a
movq (%rbx), %r9
movl %r8d, 0x30(%r9)
addq $0xba0, %rbx            # imm = 0xBA0
jmp 0x1b553
movq (%rbx), %r9
movq 0x10(%r9), %r9
movl %r8d, 0x30(%r9)
addq $0xba0, %rbx            # imm = 0xBA0
cmpq %rdx, %rbx
jb 0x1b568
incl %r11d
addq $0x8, %rsi
addq $0x8, %r10
jmp 0x1b4e1
xorl %edx, %edx
cmpl $0x1, 0x10(%rsp)
jne 0x1b695
xorl %r8d, %r8d
xorl %eax, %eax
xorl %ecx, %ecx
cmpq 0x30(%rsp), %r8
je 0x1b8a5
movl (%r14,%r8,4), %r10d
cmpl $0x4, %r10d
movq %r8, 0x8(%rsp)
je 0x1b688
leaq 0xa418(%rip), %r9       # 0x259e0
movq (%r9,%r8,8), %r11
movq %r11, %rbx
cmpl %edx, %r10d
jge 0x1b5f8
movq 0x18(%rbx), %r9
movl 0x4(%r9), %r9d
cmpl %esi, %r9d
je 0x1b5f8
cmpl %edi, %r9d
je 0x1b5f8
movq 0x10(%rbx), %r9
movl 0x4(%r9), %r9d
cmpl %esi, %r9d
je 0x1b5f8
cmpl %edi, %r9d
jne 0x1b62e
movq %rbx, %r15
movslq 0x4(%r15), %r9
movl (%r14,%r9,4), %r9d
cmpl $0x4, %r9d
jne 0x1b617
movq 0x20(%r15), %r9
movq 0x18(%r9), %r9
movq 0x18(%r9), %r15
jmp 0x1b5fb
cmpl %r9d, %r10d
jl 0x1b62e
movq 0x20(%rbx), %r9
movslq %eax, %r15
incl %eax
movq 0x18(%rsp), %r8
movq %r9, (%r8,%r15,8)
movq 0x10(%rbx), %rbp
movq 0x18(%rbx), %r15
movslq 0x4(%rbp), %r9
movq 0x18(%r15), %r12
movslq 0x4(%r12), %r12
movl 0x50(%rsp,%r12,4), %r8d
addl 0x50(%rsp,%r9,4), %r8d
cmpl %r13d, %r8d
jl 0x1b67c
movq 0x20(%rbp), %r9
movq %r9, %rbp
movq 0x18(%rbp), %rbp
cmpq %r9, %rbp
je 0x1b66a
cmpl %r12d, 0x4(%rbp)
jne 0x1b659
jmp 0x1b67c
movslq %ecx, %r8
incl %ecx
movq 0x20(%rsp), %r9
movq %rbx, (%r9,%r8,8)
movq 0x18(%rbx), %r15
movq %r15, %rbx
cmpq %r11, %r15
jne 0x1b5cf
movq 0x8(%rsp), %r8
incq %r8
jmp 0x1b5a3
imulq $0xba0, %rax, %r8       # imm = 0xBA0
leaq 0xa63d(%rip), %rcx      # 0x25ce0
cmpl $0x752f, %r15d          # imm = 0x752F
jl 0x1b6c6
pushq $0x30
popq %rax
pushq $0x2
popq %r15
cmpq $0x46630, %rax          # imm = 0x46630
je 0x1b6ca
andl $0x0, (%rax,%r9)
addq $0x40, %rax
jmp 0x1b6b3
addl $0x2, %r15d
addq %rcx, %r8
movl 0x226f31(%rip), %ebp    # 0x242604
xorl %eax, %eax
testl %ebp, %ebp
cmovlel %eax, %ebp
xorl %r10d, %r10d
movl %ebp, 0x8(%rsp)
cmpl %ebp, %r10d
je 0x1b794
movq (%rcx), %r11
cmpl %r15d, 0x30(%r11)
je 0x1b788
movslq (%r11), %rbx
movl (%r14,%rbx,4), %ebx
cmpl $0x6, %ebx
jl 0x1b788
cmpl %edx, %ebx
jge 0x1b72d
movq 0x18(%r11), %r12
movl 0x4(%r12), %ebp
cmpl %esi, %ebp
je 0x1b72d
cmpl %edi, %ebp
je 0x1b72d
movq 0x10(%r11), %r12
movl 0x4(%r12), %ebp
cmpl %esi, %ebp
je 0x1b72d
cmpl %edi, %ebp
jne 0x1b765
movq %r11, %r12
movslq 0x4(%r12), %rbp
movl (%r14,%rbp,4), %ebp
cmpl $0x4, %ebp
jne 0x1b74f
movq 0x20(%r12), %r12
movq 0x18(%r12), %r12
movq 0x18(%r12), %r12
jmp 0x1b730
cmpl %ebp, %ebx
jl 0x1b765
movq 0x20(%r11), %r11
movslq %eax, %rbx
incl %eax
movq 0x18(%rsp), %r9
movq %r11, (%r9,%rbx,8)
leaq 0x226ea4(%rip), %r9     # 0x242610
movl 0x8(%rsp), %ebp
movq %rcx, %r11
cmpq %r8, %r11
jae 0x1b788
movq (%r11), %rbx
movl %r15d, 0x30(%rbx)
addq $0xba0, %r11            # imm = 0xBA0
jmp 0x1b773
incl %r10d
addq $0x8, %rcx
jmp 0x1b6e1
movl 0x14(%rsp), %edx
testl %edx, %edx
movl 0x10(%rsp), %ecx
cmovnel %edx, %ecx
movslq %ecx, %rcx
imulq $0xba0, %rcx, %rdx      # imm = 0xBA0
leaq 0xa52e(%rip), %rsi      # 0x25ce0
leal 0x2(%r15), %edi
movl %edi, 0x88c0(%rip)      # 0x2407c
cmpl $0x752f, %r15d          # imm = 0x752F
jl 0x1b7e9
movl $0x2, 0x88ad(%rip)      # 0x2407c
pushq $0x30
popq %rcx
cmpq $0x46630, %rcx          # imm = 0x46630
je 0x1b7e6
andl $0x0, (%rcx,%r9)
addq $0x40, %rcx
jmp 0x1b7d2
pushq $0x2
popq %rdi
addq %rsi, %rdx
xorl %ecx, %ecx
leaq 0xb08b(%rip), %r10      # 0x26880
xorl %r11d, %r11d
cmpl %ebp, %r11d
je 0x1b8a5
movq (%rsi), %rbx
cmpl %edi, 0x30(%rbx)
je 0x1b895
movslq (%rbx), %r15
cmpl $0x6, (%r14,%r15,4)
jl 0x1b895
movq 0x10(%rbx), %r12
movq 0x18(%rbx), %r15
movslq 0x4(%r12), %rbp
movq 0x18(%r15), %r15
movslq 0x4(%r15), %r15
movl 0x50(%rsp,%r15,4), %r9d
addl 0x50(%rsp,%rbp,4), %r9d
cmpl %r13d, %r9d
jl 0x1b862
movq 0x20(%r12), %r12
movq %r12, %rbp
movq 0x18(%rbp), %rbp
cmpq %r12, %rbp
je 0x1b854
cmpl %r15d, 0x4(%rbp)
jne 0x1b843
jmp 0x1b862
movslq %ecx, %r9
incl %ecx
movq 0x20(%rsp), %r15
movq %rbx, (%r15,%r9,8)
movq %r10, %rbx
movl 0x8(%rsp), %ebp
cmpq %rdx, %rbx
jae 0x1b890
movq (%rbx), %r9
movl %edi, 0x30(%r9)
addq $0xba0, %rbx            # imm = 0xBA0
jmp 0x1b869
movq (%rbx), %r9
movq 0x10(%r9), %r9
movl %edi, 0x30(%r9)
addq $0xba0, %rbx            # imm = 0xBA0
cmpq %r8, %rbx
jb 0x1b87e
incl %r11d
addq $0x8, %rsi
addq $0x8, %r10
jmp 0x1b7f8
movq 0x38(%rsp), %rdx
movl %eax, (%rdx)
movq 0x40(%rsp), %rax
movl %ecx, (%rax)
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq