// File: /workspace/github_c_makefile_star2_O3/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 $0x148, %rsp            # imm = 0x148
movq %r9, 0x38(%rsp)
movq %r8, 0x18(%rsp)
movq %rcx, 0x30(%rsp)
movq %rdx, 0x28(%rsp)
movl %esi, 0x14(%rsp)
movl %edi, 0x4(%rsp)
movslq 0x2279ed(%rip), %r15    # 0x244610
testq %r15, %r15
jle 0x1cc3c
leaq (,%r15,4), %rdx
leaq 0x40(%rsp), %rdi
xorl %esi, %esi
callq 0x1030
movl 0x188(%rsp), %edx
movl 0x9443(%rip), %eax      # 0x2608c
leal 0x2(%rax), %ebp
movl %ebp, 0x943a(%rip)      # 0x2608c
cmpl $0x752f, %eax           # imm = 0x752F
jl 0x1cc87
movl $0x2, 0x9429(%rip)      # 0x2608c
movl $0x30, %eax
leaq 0x2279b1(%rip), %rcx    # 0x244620
movl $0x0, (%rax,%rcx)
addq $0x40, %rax
cmpq $0x46630, %rax          # imm = 0x46630
jne 0x1cc6f
movl $0x2, %ebp
testl %edx, %edx
movq %r15, 0x20(%rsp)
jle 0x1cdbf
movq 0x180(%rsp), %rsi
leal -0x1(%rdx), %r12d
movl %edx, %edi
xorl %r15d, %r15d
leaq 0xaf44(%rip), %r13      # 0x27bf0
xorl %r14d, %r14d
movq %rdi, 0x8(%rsp)
cmpq %r12, %r15
jne 0x1ccbf
movq (%rsi,%r12,8), %rbx
jmp 0x1ccec
movq (%rsi,%r15,8), %rbx
movq %rbx, %rdi
movl %r14d, (%rsp)
movq %rbp, %r14
movq %rsi, %rbp
callq 0x1db27
movq 0x8(%rsp), %rdi
movq %rbp, %rsi
movq %r14, %rbp
movl (%rsp), %r14d
testl %eax, %eax
je 0x1cd6f
cmpl %ebp, 0x30(%rbx)
je 0x1cd6f
movl %ebp, 0x30(%rbx)
movslq (%rbx), %rax
incl 0x40(%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 0x40(%rsp,%rcx,4)
movslq 0x4(%rax), %rdx
incl 0x40(%rsp,%rdx,4)
cmpl $0x4, (%r13,%rdx,4)
jne 0x1cd41
movq 0x20(%rax), %rax
movq 0x18(%rax), %rax
movq 0x18(%rax), %rax
movslq 0x4(%rax), %rcx
cmpl $0x4, (%r13,%rcx,4)
je 0x1cd26
movslq (%rax), %rcx
movl %ebp, 0x30(%rax)
incl 0x40(%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 0x40(%rsp,%rcx,4)
movslq 0x4(%rax), %rax
incl 0x40(%rsp,%rax,4)
addl $0x2, %r14d
incq %r15
cmpq %rdi, %r15
jne 0x1ccb4
movl 0x94ef(%rip), %eax      # 0x26270
decl %eax
movq 0x20(%rsp), %r15
cmpl %eax, %r15d
je 0x1cdd8
movl 0x188(%rsp), %eax
testl %eax, %eax
jle 0x1cf9d
movq -0x8(%rsi,%rdi,8), %rax
movslq 0x4(%rax), %rcx
movl (%r13,%rcx,4), %edx
movl (%rax), %esi
movq 0x18(%rax), %rax
movq 0x18(%rax), %rax
movl 0x4(%rax), %eax
movl %eax, (%rsp)
jmp 0x1cf9f
movl 0x94ab(%rip), %eax      # 0x26270
decl %eax
xorl %r14d, %r14d
movl $0x0, %edx
cmpl %eax, %r15d
jne 0x1cf9f
movl 0x4(%rsp), %eax
cmpl $0x1, %eax
jne 0x1ce6e
testl %r15d, %r15d
jle 0x1d0b9
xorl %ecx, %ecx
leaq 0xadf9(%rip), %rdx      # 0x27bf0
leaq 0xabf2(%rip), %rsi      # 0x279f0
xorl %eax, %eax
cmpl $0x4, (%rdx,%rcx,4)
je 0x1ce61
movq (%rsi,%rcx,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 0x40(%rsp,%r10,4), %ebp
addl 0x40(%rsp,%rbx,4), %ebp
cmpl %r14d, %ebp
jl 0x1ce59
movq 0x20(%r11), %r11
movq %r11, %rbx
movq 0x18(%rbx), %rbx
cmpq %r11, %rbx
je 0x1ce47
cmpl %r10d, 0x4(%rbx)
jne 0x1ce36
jmp 0x1ce59
movslq %eax, %r8
incl %eax
movq 0x18(%rsp), %r10
movq %r9, (%r10,%r8,8)
movq 0x18(%r9), %r8
movq %r8, %r9
cmpq %rdi, %r8
jne 0x1ce0d
incq %rcx
cmpq %r15, %rcx
jne 0x1ce00
jmp 0x1cf96
movl 0x14(%rsp), %esi
testl %esi, %esi
cmovel %eax, %esi
leal 0x2(%rbp), %ecx
movl %ecx, 0x920c(%rip)      # 0x2608c
cmpl $0x752f, %ebp           # imm = 0x752F
jl 0x1ceba
movl $0x2, 0x91fa(%rip)      # 0x2608c
movl $0x30, %eax
leaq 0x227782(%rip), %rcx    # 0x244620
movl $0x0, (%rax,%rcx)
addq $0x40, %rax
cmpq $0x46630, %rax          # imm = 0x46630
jne 0x1ce9e
movl $0x2, %ecx
movl 0x4(%rsp), %eax
movl 0x227754(%rip), %edx    # 0x244614
testl %edx, %edx
jle 0x1d0b9
cltq
movslq %esi, %r8
imulq $0xba0, %rax, %rsi      # imm = 0xBA0
leaq 0xae15(%rip), %rdi      # 0x27cf0
imulq $0xba0, %r8, %r8        # imm = 0xBA0
addq %rdi, %rsi
addq %rdi, %r8
xorl %r9d, %r9d
leaq 0xacfe(%rip), %r10      # 0x27bf0
xorl %eax, %eax
movq (%rdi), %r11
cmpl %ecx, 0x30(%r11)
je 0x1cf86
movslq (%r11), %rbx
cmpl $0x6, (%r10,%rbx,4)
jl 0x1cf86
movq 0x10(%r11), %r15
movq 0x18(%r11), %rbx
movslq 0x4(%r15), %r12
movq 0x18(%rbx), %rbx
movslq 0x4(%rbx), %rbx
movl 0x40(%rsp,%rbx,4), %ebp
addl 0x40(%rsp,%r12,4), %ebp
cmpl %r14d, %ebp
jl 0x1cf55
movq 0x20(%r15), %r15
movq %r15, %r12
movq 0x18(%r12), %r12
cmpq %r15, %r12
je 0x1cf47
cmpl %ebx, 0x4(%r12)
jne 0x1cf34
jmp 0x1cf55
movslq %eax, %rbx
incl %eax
movq 0x18(%rsp), %r15
movq %r11, (%r15,%rbx,8)
leaq 0xba0(%rdi), %r11
cmpq %r8, %r11
jae 0x1cf81
movq (%r11), %rbx
movl %ecx, 0x30(%rbx)
addq $0xba0, %r11            # imm = 0xBA0
jmp 0x1cf5c
movq (%r11), %rbx
movq 0x10(%rbx), %rbx
movl %ecx, 0x30(%rbx)
addq $0xba0, %r11            # imm = 0xBA0
cmpq %rsi, %r11
jb 0x1cf70
incl %r9d
addq $0x8, %rdi
cmpl %edx, %r9d
jne 0x1cef4
xorl %ecx, %ecx
jmp 0x1d305
xorl %edx, %edx
movl 0x4(%rsp), %eax
cmpl $0x1, %eax
jne 0x1d0c0
testl %r15d, %r15d
jle 0x1d0b9
xorl %r8d, %r8d
leaq 0xac31(%rip), %r9       # 0x27bf0
xorl %eax, %eax
xorl %ecx, %ecx
movl (%r9,%r8,4), %r11d
cmpl $0x4, %r11d
je 0x1d0a6
leaq 0xaa18(%rip), %rdi      # 0x279f0
movq (%rdi,%r8,8), %rbx
movq %rbx, %r15
cmpl %edx, %r11d
jge 0x1d00a
movq 0x18(%r15), %r10
movl 0x4(%r10), %r10d
cmpl %esi, %r10d
je 0x1d00a
cmpl (%rsp), %r10d
je 0x1d00a
movq 0x10(%r15), %r10
movl 0x4(%r10), %r10d
cmpl %esi, %r10d
je 0x1d00a
cmpl (%rsp), %r10d
jne 0x1d04c
movslq 0x4(%r15), %r10
movl (%r9,%r10,4), %ebp
cmpl $0x4, %ebp
jne 0x1d035
movq %r15, %r12
movq 0x20(%r12), %r10
movq 0x18(%r10), %r10
movq 0x18(%r10), %r12
movslq 0x4(%r12), %r10
movl (%r9,%r10,4), %ebp
cmpl $0x4, %ebp
je 0x1d01a
cmpl %ebp, %r11d
jl 0x1d04c
movq 0x20(%r15), %r10
movslq %ecx, %r12
incl %ecx
movq 0x28(%rsp), %rdi
movq %r10, (%rdi,%r12,8)
movq 0x10(%r15), %rbp
movq 0x18(%r15), %r12
movslq 0x4(%rbp), %r10
movq 0x18(%r12), %r13
movslq 0x4(%r13), %r13
movl 0x40(%rsp,%r13,4), %edi
addl 0x40(%rsp,%r10,4), %edi
cmpl %r14d, %edi
jl 0x1d09a
movq 0x20(%rbp), %r10
movq %r10, %rbp
movq 0x18(%rbp), %rbp
cmpq %r10, %rbp
je 0x1d088
cmpl %r13d, 0x4(%rbp)
jne 0x1d077
jmp 0x1d09a
movslq %eax, %rdi
incl %eax
movq 0x18(%rsp), %r10
movq %r15, (%r10,%rdi,8)
movq 0x18(%r15), %r12
movq %r12, %r15
cmpq %rbx, %r12
jne 0x1cfdf
incq %r8
cmpq 0x20(%rsp), %r8
jne 0x1cfc3
jmp 0x1d305
xorl %ecx, %ecx
jmp 0x1d303
cltq
imulq $0xba0, %rax, %r8       # imm = 0xBA0
leaq 0xac20(%rip), %r9       # 0x27cf0
cmpl $0x752f, %ebp           # imm = 0x752F
jl 0x1d0fe
movl $0x30, %eax
leaq 0x22753c(%rip), %rcx    # 0x244620
movl $0x0, (%rax,%rcx)
addq $0x40, %rax
cmpq $0x46630, %rax          # imm = 0x46630
jne 0x1d0e4
movl $0x2, %ebp
jmp 0x1d101
addl $0x2, %ebp
addq %r9, %r8
movl 0x227509(%rip), %r13d   # 0x244614
leaq 0xaade(%rip), %r11      # 0x27bf0
testl %r13d, %r13d
movl %r13d, 0x8(%rsp)
jle 0x1d1e6
leaq 0xabc9(%rip), %rax      # 0x27cf0
xorl %ebx, %ebx
xorl %ecx, %ecx
movq (%rax), %r10
cmpl %ebp, 0x30(%r10)
je 0x1d1d5
movslq (%r10), %rdi
movl (%r11,%rdi,4), %r12d
cmpl $0x6, %r12d
jl 0x1d1d5
cmpl %edx, %r12d
jge 0x1d174
movq 0x18(%r10), %rdi
movl 0x4(%rdi), %r15d
cmpl %esi, %r15d
je 0x1d174
cmpl (%rsp), %r15d
je 0x1d174
movq 0x10(%r10), %rdi
movl 0x4(%rdi), %r15d
cmpl %esi, %r15d
je 0x1d174
cmpl (%rsp), %r15d
jne 0x1d1bb
movslq 0x4(%r10), %rdi
movl (%r11,%rdi,4), %r13d
cmpl $0x4, %r13d
jne 0x1d19f
movq %r10, %r15
movq 0x20(%r15), %rdi
movq 0x18(%rdi), %rdi
movq 0x18(%rdi), %r15
movslq 0x4(%r15), %rdi
movl (%r11,%rdi,4), %r13d
cmpl $0x4, %r13d
je 0x1d185
cmpl %r13d, %r12d
jl 0x1d1b6
movq 0x20(%r10), %rdi
movslq %ecx, %r10
incl %ecx
movq 0x28(%rsp), %r15
movq %rdi, (%r15,%r10,8)
movl 0x8(%rsp), %r13d
cmpq %r8, %rax
jae 0x1d1d5
movq %rax, %r10
movq (%r10), %rdi
movl %ebp, 0x30(%rdi)
addq $0xba0, %r10            # imm = 0xBA0
cmpq %r8, %r10
jb 0x1d1c3
incl %ebx
addq $0x8, %rax
cmpl %r13d, %ebx
jne 0x1d12b
jmp 0x1d1e8
xorl %ecx, %ecx
movl 0x14(%rsp), %eax
testl %eax, %eax
movl 0x4(%rsp), %esi
cmovnel %eax, %esi
leal 0x2(%rbp), %edx
movl %edx, 0x8e8e(%rip)      # 0x2608c
cmpl $0x752f, %ebp           # imm = 0x752F
jl 0x1d234
movl $0x2, 0x8e7c(%rip)      # 0x2608c
movl $0x30, %eax
leaq 0x227404(%rip), %rdx    # 0x244620
movl $0x0, (%rax,%rdx)
addq $0x40, %rax
cmpq $0x46630, %rax          # imm = 0x46630
jne 0x1d21c
movl $0x2, %edx
testl %r13d, %r13d
jle 0x1d303
movslq %esi, %rax
imulq $0xba0, %rax, %rsi      # imm = 0xBA0
addq %r9, %rsi
xorl %edi, %edi
xorl %eax, %eax
movq (%r9), %rbx
cmpl %edx, 0x30(%rbx)
je 0x1d2f2
movslq (%rbx), %r10
cmpl $0x6, (%r11,%r10,4)
jl 0x1d2f2
movq 0x10(%rbx), %r12
movq 0x18(%rbx), %r10
movslq 0x4(%r12), %r13
movq 0x18(%r10), %r10
movslq 0x4(%r10), %r15
movl 0x40(%rsp,%r15,4), %r10d
addl 0x40(%rsp,%r13,4), %r10d
cmpl %r14d, %r10d
jge 0x1d293
movl 0x8(%rsp), %r13d
jmp 0x1d2bf
movq 0x20(%r12), %r12
movq %r12, %r10
movl 0x8(%rsp), %r13d
movq 0x18(%r10), %r10
cmpq %r12, %r10
je 0x1d2b1
cmpl %r15d, 0x4(%r10)
jne 0x1d2a0
jmp 0x1d2bf
movslq %eax, %r10
incl %eax
movq 0x18(%rsp), %r15
movq %rbx, (%r15,%r10,8)
leaq 0xba0(%r9), %rbx
cmpq %rsi, %rbx
jae 0x1d2ed
movq (%rbx), %r10
movl %edx, 0x30(%r10)
addq $0xba0, %rbx            # imm = 0xBA0
jmp 0x1d2c6
movq (%rbx), %r10
movq 0x10(%r10), %r10
movl %edx, 0x30(%r10)
addq $0xba0, %rbx            # imm = 0xBA0
cmpq %r8, %rbx
jb 0x1d2db
incl %edi
addq $0x8, %r9
cmpl %r13d, %edi
jne 0x1d24e
jmp 0x1d305
xorl %eax, %eax
movq 0x30(%rsp), %rdx
movl %ecx, (%rdx)
movq 0x38(%rsp), %rcx
movl %eax, (%rcx)
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq