// File: /workspace/github_c_makefile_star2_O2/mishun[P]plantri/plantri.c
// Function: extend_bip_P
static void
extend_bip_P(EDGE *ref)

/* This routine is the implementation of the P-operation in Batagelj's paper.
   It inserts two new vertices -- nv and nv+1. The reference edge ref is
   the one starting at the vertex to be split that will (always) become a 
   valency 4 vertex neighbouring the one in the center. 


       a
      / \
  ---b---c---e  The edge c-->e is the reference edge
      \ /
       d

The operations can only be understood by drawing a picture containing the edge
numbers as initialized in init_P_op().
*/
{
    EDGE *rp, *rn; /* reference->prev and reference->next */
    EDGE *start, *work, *work2;
    int buffer; 

    start=P_op(nv);
    rp=ref->prev; rn=ref->next;

    firstedge[ref->start]=rn; /* just in case ref was "firstedge" */
    ref->start=ref->invers->end=nv; ref->next=start+4; ref->prev=start+2;
    degree[nv]=degree[nv+1]=4;
    firstedge[nv]=start; firstedge[nv+1]=start+1;


    buffer=rn->end;
    degree[buffer]+=2;
    work=start+4; work->end=buffer; work->prev=ref;
    work2=rn->invers->next;
    /*work=start+5;*/ work++;
      work->start=buffer; work->next=work2; work2->prev=work;
    work2=rn->invers;
    /*work=start+6;*/ work++;
      work->start=buffer; work->prev=work2; work2->next=work;
    /*(start+7)*/ work++; work->end=buffer;

    buffer=rn->start;
    /*work=start+8;*/ work++;
      work->start=buffer; work->prev=rp; work->next=rn; rn->prev=rp->next=work;
    /*(start+9)*/ work++; work->end=buffer;

    buffer=rp->end;
    degree[buffer]+=2;
    work2=rp->invers->prev;
    /*work=start+10;*/ work++;
      work->start=buffer; work->next=rp->invers; rp->invers->prev=work;
    /*(start+11)*/ work++; work->end=buffer;
    work=start+3; work->start=buffer; work->prev=work2; work2->next=work; 
    /*work=start+2;*/ work--; work->end=buffer; work->next=ref; 

    nv += 2;
    ne += 12;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movslq 0x226d30(%rip), %rax    # 0x242600
imulq $0x300, %rax, %rcx      # imm = 0x300
leaq 0x226d32(%rip), %rdx    # 0x242610
leaq (%rcx,%rdx), %r10
addq $0x600, %r10            # imm = 0x600
movq 0x10(%rdi), %rsi
movq 0x18(%rdi), %r8
movslq (%rdi), %r9
leaq 0xa0e5(%rip), %r11      # 0x259e0
movq %r8, (%r11,%r9,8)
movq 0x20(%rdi), %r9
movl %eax, 0x4(%r9)
movl %eax, (%rdi)
leaq 0x700(%rcx,%rdx), %rbx
movq %rbx, 0x18(%rdi)
leaq 0x680(%rcx,%rdx), %r9
movq %r9, 0x10(%rdi)
leaq 0xa2b8(%rip), %r9       # 0x25be0
movl $0x4, %ebp
movl %ebp, 0x4(%r9,%rax,4)
movl %ebp, (%r9,%rax,4)
movq %r10, (%r11,%rax,8)
leaq (%rcx,%rdx), %r10
addq $0x640, %r10            # imm = 0x640
movq %r10, 0x8(%r11,%rax,8)
movslq 0x4(%r8), %r10
addl $0x2, (%r9,%r10,4)
movl %r10d, 0x4(%rbx)
movq %rdi, 0x10(%rbx)
movq 0x20(%r8), %r11
movq 0x18(%r11), %rbx
leaq 0x740(%rcx,%rdx), %r14
movl %r10d, (%r14)
movq %rbx, 0x18(%r14)
movq %r14, 0x10(%rbx)
leaq 0x780(%rcx,%rdx), %rbx
movl %r10d, (%rbx)
movq %r11, 0x10(%rbx)
movq %rbx, 0x18(%r11)
movl %r10d, 0x44(%rbx)
movl (%r8), %r10d
leaq 0x800(%rcx,%rdx), %r11
movl %r10d, (%r11)
movq %rsi, 0x10(%r11)
movq %r8, 0x18(%r11)
movq %r11, 0x18(%rsi)
movq %r11, 0x10(%r8)
movl %r10d, 0x44(%r11)
movslq 0x4(%rsi), %r8
addl $0x2, (%r9,%r8,4)
movq 0x20(%rsi), %rsi
movq 0x10(%rsi), %r9
leaq (%rcx,%rdx), %r10
addq $0x880, %r10            # imm = 0x880
movl %r8d, (%r10)
movq %rsi, 0x18(%r10)
movq %r10, 0x10(%rsi)
movl %r8d, 0x44(%r10)
leaq 0x6c0(%rcx,%rdx), %rcx
movl %r8d, (%rcx)
movq %r9, 0x10(%rcx)
movq %rcx, 0x18(%r9)
movl %r8d, -0x3c(%rcx)
movq %rdi, -0x28(%rcx)
addl $0x2, %eax
movl %eax, 0x226c02(%rip)    # 0x242600
addl $0xc, 0x226bff(%rip)    # 0x242604
popq %rbx
popq %r14
popq %rbp
retq