// File: /workspace/github_c_makefile_star2_O1/mishun[P]plantri/plantri.c
// Function: testcanon_mirror
static int 
testcanon_mirror(EDGE *givenedge, int representation[], int colour[])

/* Tests whether starting from a given edge and constructing the code in
   "->prev" direction, an automorphism or even a better representation can 
   be found. Comments see testcanon -- it is exactly the same except for 
   the orientation */
{
    EDGE *temp, *run;  
    EDGE *startedge[MAXN+1];
    int number[MAXN], i; 
    int last_number, actual_number, vertex;

    for (i = 0; i < nv; i++) number[i] = 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)
    {  
        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;
                vertex = colour[vertex]; }
            else vertex = number[vertex];
            if (vertex > (*representation)) return 0;
            if (vertex < (*representation)) return 2;
            representation++; 
          }
        if ((*representation) != 0) return 2; 
        representation++;
        temp = startedge[actual_number];  actual_number++; 
    }

    while (actual_number <= nv) 
    {  
        for (run = temp->prev; run != temp; run = run->prev)
          { 
            vertex = number[run->end];
            if (vertex > (*representation)) return 0;
            if (vertex < (*representation)) return 2;
            representation++;
          }
        if ((*representation) != 0) return 2; 
        representation++;
        temp = startedge[actual_number];  actual_number++; 
    }

    return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x308, %rsp            # imm = 0x308
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
movslq 0x2385e9(%rip), %r12    # 0x244610
testq %r12, %r12
jle 0xc03e
leaq (,%r12,4), %rdx
movq %rsp, %rdi
xorl %esi, %esi
callq 0x1030
movslq (%r14), %rsi
movl $0x1, (%rsp,%rsi,4)
movslq 0x4(%r14), %rdx
movl $0x1, %ecx
movl $0x1, %eax
cmpl %edx, %esi
je 0xc072
movl $0x2, (%rsp,%rdx,4)
movq 0x20(%r14), %rax
movq %rax, 0x108(%rsp)
movl $0x2, %eax
cmpl %r12d, %eax
jge 0xc0d0
movl $0x1, %ecx
movq 0x10(%r14), %rdx
cmpq %r14, %rdx
je 0xc0b7
movslq 0x4(%rdx), %rdi
movl (%rsp,%rdi,4), %esi
testl %esi, %esi
jne 0xc0a7
movq 0x20(%rdx), %rsi
cltq
movq %rsi, 0x100(%rsp,%rax,8)
incl %eax
movl %eax, (%rsp,%rdi,4)
movl (%r15,%rdi,4), %esi
cmpl (%rbx), %esi
jg 0xc122
jl 0xc11b
addq $0x4, %rbx
movq 0x10(%rdx), %rdx
jmp 0xc080
cmpl $0x0, (%rbx)
jne 0xc11b
addq $0x4, %rbx
movq 0x100(%rsp,%rcx,8), %r14
incq %rcx
cmpl %r12d, %eax
jl 0xc07c
movl $0x1, %eax
cmpl %r12d, %ecx
jg 0xc124
movl %ecx, %ecx
movq 0x10(%r14), %rdx
cmpq %r14, %rdx
je 0xc0fc
movslq 0x4(%rdx), %rsi
movl (%rbx), %edi
cmpl %edi, (%rsp,%rsi,4)
jg 0xc122
jl 0xc11b
addq $0x4, %rbx
movq 0x10(%rdx), %rdx
jmp 0xc0e0
cmpl $0x0, (%rbx)
jne 0xc11b
addq $0x4, %rbx
movq 0x100(%rsp,%rcx,8), %r14
leaq 0x1(%rcx), %rdx
cmpl %ecx, %r12d
movq %rdx, %rcx
jg 0xc0dc
jmp 0xc124
movl $0x2, %eax
jmp 0xc124
xorl %eax, %eax
addq $0x308, %rsp            # imm = 0x308
popq %rbx
popq %r12
popq %r14
popq %r15
retq