// File: /workspace/github_c_makefile_star2_O0/mishun[P]plantri/plantri.c
// Function: compute_code
static void
compute_code(unsigned char code[])
 
/* computes a code by numbering the vertices in a breadth first manner and
   then listing them in code. Code is a sequence of numbers of length ne+nv+1.
   The first entry is the number of vertices.
   Then the numbers of the vertices adjacent to the vertex numbered 1 are
   given -- ended by a 0, and listed in clockwise orientation.
   Then those adjacent to 2, ended by a 0, etc. . In case of no
   double edges, the identification of the corresponding "half edges" leaving 
   each vertex is unique. Nevertheless also for this case the following rules
   apply (not in the definition of the code, but in this routine):

   In case of double edges, the first time a new vertex
   b occurs in the list, say it is in the list of vertex a, must be matched
   with the first occurence of vertex a in the list of b. In this routine
   it will always be the first position in the list of b.

   This spanning tree
   gives a unique matching for the other "half edges" -- provided the fact
   that the ordering comes from an embedding on the sphere. 

   In case of a given starting edge in code_edge, the start of this
   edge is numbered 1 and the end 2.
*/
{
    register EDGE *run;
    register int vertex;
    EDGE *temp;  
    EDGE *startedge[MAXN+1]; 
    int number[MAXN+1], i; 
    int last_number, actual_number;
    EDGE *givenedge;

    for (i = 0; i < nv; i++) number[i] = 0;
 
    *code=nv; code++;
    if (code_edge==NULL) givenedge=firstedge[0]; 
    else { givenedge=code_edge; number[nv]=0; }
    number[givenedge->start] = 1; 
    if (givenedge->start != givenedge->end)
      {
	number[givenedge->end] = 2;
	last_number = 2;
	startedge[1] = givenedge->invers;
      }
    else  last_number = 1;  

    actual_number = 1;
    temp = givenedge;

    while (last_number < nv)
    {   *code=number[temp->end]; code++;
        for (run = temp->next; run != temp; run = run->next)
          { vertex = run->end;
            if (!number[vertex])
              { startedge[last_number] = run->invers;
                last_number++; number[vertex] = last_number; 
                *code = last_number; }
            else *code = number[vertex]; 
            code++;
          }
        *code = 0;  code++;
        temp = startedge[actual_number];  actual_number++;
    }

    while (actual_number <= nv) 
    {  	*code=number[temp->end]; code++;
        for (run = temp->next; run != temp; run = run->next)
          { 
            *code = number[run->end]; code++;
          }
        *code = 0;
        code++;
        temp = startedge[actual_number];  actual_number++;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2e0, %rsp            # imm = 0x2E0
movq %rdi, -0x8(%rbp)
movl $0x0, -0x344(%rbp)
movl -0x344(%rbp), %eax
cmpl 0x24fbfb(%rip), %eax    # 0x25a620
jge 0xaa4a
movslq -0x344(%rbp), %rax
movl $0x0, -0x340(%rbp,%rax,4)
movl -0x344(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x344(%rbp)
jmp 0xaa19
movl 0x24fbd0(%rip), %eax    # 0x25a620
movb %al, %cl
movq -0x8(%rbp), %rax
movb %cl, (%rax)
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
cmpq $0x0, 0x24fbbc(%rip)    # 0x25a628
jne 0xaa7e
movq 0x32f8b(%rip), %rax     # 0x3da00
movq %rax, -0x358(%rbp)
jmp 0xaa9e
movq 0x24fba3(%rip), %rax    # 0x25a628
movq %rax, -0x358(%rbp)
movslq 0x24fb8d(%rip), %rax    # 0x25a620
movl $0x0, -0x340(%rbp,%rax,4)
movq -0x358(%rbp), %rax
movslq (%rax), %rax
movl $0x1, -0x340(%rbp,%rax,4)
movq -0x358(%rbp), %rax
movl (%rax), %eax
movq -0x358(%rbp), %rcx
cmpl 0x4(%rcx), %eax
je 0xaafc
movq -0x358(%rbp), %rax
movslq 0x4(%rax), %rax
movl $0x2, -0x340(%rbp,%rax,4)
movl $0x2, -0x348(%rbp)
movq -0x358(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x228(%rbp)
jmp 0xab06
movl $0x1, -0x348(%rbp)
movl $0x1, -0x34c(%rbp)
movq -0x358(%rbp), %rax
movq %rax, -0x20(%rbp)
movl -0x348(%rbp), %eax
cmpl 0x24faf9(%rip), %eax    # 0x25a620
jge 0xac33
movq -0x20(%rbp), %rax
movslq 0x4(%rax), %rax
movl -0x340(%rbp,%rax,4), %eax
movb %al, %cl
movq -0x8(%rbp), %rax
movb %cl, (%rax)
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpq -0x20(%rbp), %rax
je 0xabf9
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x14(%rbp)
movslq -0x14(%rbp), %rax
cmpl $0x0, -0x340(%rbp,%rax,4)
jne 0xabc9
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rcx
movslq -0x348(%rbp), %rax
movq %rcx, -0x230(%rbp,%rax,8)
movl -0x348(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x348(%rbp)
movl -0x348(%rbp), %ecx
movslq -0x14(%rbp), %rax
movl %ecx, -0x340(%rbp,%rax,4)
movl -0x348(%rbp), %eax
movb %al, %cl
movq -0x8(%rbp), %rax
movb %cl, (%rax)
jmp 0xabdc
movslq -0x14(%rbp), %rax
movl -0x340(%rbp,%rax,4), %eax
movb %al, %cl
movq -0x8(%rbp), %rax
movb %cl, (%rax)
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x10(%rbp)
jmp 0xab5c
movq -0x8(%rbp), %rax
movb $0x0, (%rax)
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
movslq -0x34c(%rbp), %rax
movq -0x230(%rbp,%rax,8), %rax
movq %rax, -0x20(%rbp)
movl -0x34c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34c(%rbp)
jmp 0xab1b
jmp 0xac35
movl -0x34c(%rbp), %eax
cmpl 0x24f9df(%rip), %eax    # 0x25a620
jg 0xaceb
movq -0x20(%rbp), %rax
movslq 0x4(%rax), %rax
movl -0x340(%rbp,%rax,4), %eax
movb %al, %cl
movq -0x8(%rbp), %rax
movb %cl, (%rax)
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpq -0x20(%rbp), %rax
je 0xacb1
movq -0x10(%rbp), %rax
movslq 0x4(%rax), %rax
movl -0x340(%rbp,%rax,4), %eax
movb %al, %cl
movq -0x8(%rbp), %rax
movb %cl, (%rax)
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x10(%rbp)
jmp 0xac76
movq -0x8(%rbp), %rax
movb $0x0, (%rax)
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
movslq -0x34c(%rbp), %rax
movq -0x230(%rbp,%rax,8), %rax
movq %rax, -0x20(%rbp)
movl -0x34c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34c(%rbp)
jmp 0xac35
addq $0x2e0, %rsp            # imm = 0x2E0
popq %rbp
retq
nopw %cs:(%rax,%rax)