// File: /workspace/github_c_makefile_star2_O2/mishun[P]plantri/plantri.c
// Function: compute_code_mirror
static void
compute_code_mirror(unsigned char code[])
 
/* In the case of no double edges -- that is when the identifications are
   clear -- there is no problem in just returning the inverse order of
   the previously computed code. Nevertheless in the case where edge 
   identifications must be made via the spanning tree described in the code,
   this is not that easy, so we can as well just compute mirror code just
   like the normal code computed before.

   In case code_edge is not NULL, its start is numbered 1 and its
   end is numbered 0.
*/
{
    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->invers; 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->prev; run != temp; run = run->prev)
          { 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->prev; run != temp; run = run->prev)
          { 
            *code = number[run->end]; code++;
          }
        *code = 0;
        code++;
        temp = startedge[actual_number];  actual_number++;
    }
}

// Assembly:
pushq %rbx
subq $0x2a0, %rsp            # imm = 0x2A0
movslq 0x238215(%rip), %rcx    # 0x242600
xorl %eax, %eax
testl %ecx, %ecx
movl $0x0, %edx
cmovgl %ecx, %edx
cmpq %rax, %rdx
je 0xa406
andl $0x0, -0x80(%rsp,%rax,4)
incq %rax
jmp 0xa3f7
movb %cl, (%rdi)
movq 0x2381f9(%rip), %rax    # 0x242608
testq %rax, %rax
je 0xa41f
movq 0x20(%rax), %rax
andl $0x0, -0x80(%rsp,%rcx,4)
jmp 0xa426
movq 0x1b5ba(%rip), %rax     # 0x259e0
movslq (%rax), %rsi
movl $0x1, -0x80(%rsp,%rsi,4)
movslq 0x4(%rax), %rdx
cmpl %edx, %esi
jne 0xa441
movl $0x1, %r8d
jmp 0xa45b
movl $0x2, -0x80(%rsp,%rdx,4)
movq 0x20(%rax), %rdx
movq %rdx, 0x98(%rsp)
movl $0x2, %r8d
movabsq $0x1, %rdx
xorl %esi, %esi
cmpl %ecx, %r8d
jge 0xa4cb
movslq 0x4(%rax), %r9
movb -0x80(%rsp,%r9,4), %r9b
movb %r9b, 0x1(%rdi)
addq $0x2, %rdi
movq %rax, %r9
movq 0x10(%r9), %r9
cmpq %rax, %r9
je 0xa4b9
movslq 0x4(%r9), %r11
movl -0x80(%rsp,%r11,4), %r10d
testl %r10d, %r10d
jne 0xa4b1
movq 0x20(%r9), %rbx
movslq %r8d, %r10
movq %rbx, 0x90(%rsp,%r10,8)
incl %r10d
movl %r10d, -0x80(%rsp,%r11,4)
movl %r10d, %r8d
movb %r10b, (%rdi)
incq %rdi
jmp 0xa480
movb $0x0, (%rdi)
movq 0x90(%rsp,%rdx,8), %rax
incq %rdx
incl %esi
jmp 0xa467
incq %rdi
cmpl %esi, %ecx
cmovgl %ecx, %esi
incl %esi
cmpq %rsi, %rdx
je 0xa50a
incq %rdi
movq %rax, %rcx
movslq 0x4(%rcx), %r8
movb -0x80(%rsp,%r8,4), %r8b
movb %r8b, -0x1(%rdi)
movq 0x10(%rcx), %rcx
incq %rdi
cmpq %rax, %rcx
jne 0xa4e0
movb $0x0, -0x1(%rdi)
movq 0x90(%rsp,%rdx,8), %rax
incq %rdx
jmp 0xa4d5
addq $0x2a0, %rsp            # imm = 0x2A0
popq %rbx
retq