// File: /workspace/github_c_makefile_star2_O3/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 %r14
pushq %rbx
subq $0x318, %rsp            # imm = 0x318
movq %rdi, %rbx
movslq 0x2393c6(%rip), %r14    # 0x244610
testq %r14, %r14
jle 0xb261
leaq (,%r14,4), %rdx
movq %rsp, %rdi
xorl %esi, %esi
callq 0x1030
movb %r14b, (%rbx)
movq 0x2393ad(%rip), %rax    # 0x244618
testq %rax, %rax
je 0xb27e
movq 0x20(%rax), %rax
movl $0x0, (%rsp,%r14,4)
jmp 0xb285
movq 0x1c76b(%rip), %rax     # 0x279f0
movslq (%rax), %rdi
movl $0x1, (%rsp,%rdi,4)
movslq 0x4(%rax), %rsi
movl $0x1, %ecx
movl $0x1, %edx
cmpl %esi, %edi
je 0xb2b9
movl $0x2, (%rsp,%rsi,4)
movq 0x20(%rax), %rdx
movq %rdx, 0x118(%rsp)
movl $0x2, %edx
cmpl %r14d, %edx
jge 0xb31e
movl $0x1, %ecx
movslq 0x4(%rax), %rsi
movb (%rsp,%rsi,4), %sil
movb %sil, 0x1(%rbx)
addq $0x2, %rbx
movq 0x10(%rax), %rsi
cmpq %rax, %rsi
je 0xb30b
movslq 0x4(%rsi), %r8
movl (%rsp,%r8,4), %edi
testl %edi, %edi
jne 0xb2ff
movq 0x20(%rsi), %r9
movslq %edx, %rdi
movq %r9, 0x110(%rsp,%rdi,8)
incl %edi
movl %edi, (%rsp,%r8,4)
movl %edi, %edx
movb %dil, (%rbx)
incq %rbx
movq 0x10(%rsi), %rsi
jmp 0xb2d7
movb $0x0, (%rbx)
movq 0x110(%rsp,%rcx,8), %rax
incq %rcx
cmpl %r14d, %edx
jl 0xb2c3
incq %rbx
cmpl %r14d, %ecx
jg 0xb374
movl %ecx, %ecx
movslq 0x4(%rax), %rdx
movb (%rsp,%rdx,4), %dl
movb %dl, (%rbx)
leaq 0x1(%rbx), %rdx
movq 0x10(%rax), %rsi
cmpq %rax, %rsi
je 0xb359
movslq 0x4(%rsi), %rdi
movb (%rsp,%rdi,4), %dil
movb %dil, (%rdx)
incq %rdx
movq 0x10(%rsi), %rsi
cmpq %rax, %rsi
jne 0xb33e
leaq -0x1(%rdx), %rbx
movb $0x0, (%rdx)
addq $0x2, %rbx
movq 0x110(%rsp,%rcx,8), %rax
leaq 0x1(%rcx), %rdx
cmpl %ecx, %r14d
movq %rdx, %rcx
jg 0xb328
addq $0x318, %rsp            # imm = 0x318
popq %rbx
popq %r14
retq