// File: /workspace/github_c_makefile_star2_O2/mishun[P]plantri/plantri.c
// Function: testcanon_mirror_init
static int 
testcanon_mirror_init(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. A better representation will be completely constructed and 
   returned in "representation".  It works pretty similar to testcanon except 
   for obviously necessary changes, so for extensive comments see testcanon */
{
    EDGE *temp, *run;  
    EDGE *startedge[MAXN+1]; 
    int number[MAXN], i; 
    int better = 0; /* is the representation already better ? */
    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 (better) *representation = vertex; 
            else { if (vertex > (*representation)) return 0;
                   else if (vertex < (*representation)) 
                     { better = 1; *representation = vertex; }
                 }
            representation++; 
          }
        if ((*representation) != 0) { better = 1; *representation = 0; }
        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 (better) *representation = vertex;
            else                  
              {
                if (vertex > (*representation)) return 0;
                if (vertex < (*representation))
                  { better = 1; *representation = vertex; }
              }
            representation++;
          }
       if ((*representation) != 0) { better = 1; *representation = 0; }
       representation++;
       temp = startedge[actual_number];  actual_number++;
    }

    if (better) return 2;
    return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x288, %rsp            # imm = 0x288
movl 0x23780d(%rip), %r9d    # 0x242600
xorl %eax, %eax
testl %r9d, %r9d
movl $0x0, %ecx
cmovgl %r9d, %ecx
cmpq %rax, %rcx
je 0xae10
andl $0x0, -0x80(%rsp,%rax,4)
incq %rax
jmp 0xae01
movslq (%rdi), %rcx
movl $0x1, -0x80(%rsp,%rcx,4)
movslq 0x4(%rdi), %rax
movl $0x1, %r10d
movl %r10d, %r11d
cmpl %eax, %ecx
je 0xae46
movl $0x2, %r11d
movl $0x2, -0x80(%rsp,%rax,4)
movq 0x20(%rdi), %rax
movq %rax, 0x88(%rsp)
movabsq $0x1, %rax
xorl %ecx, %ecx
xorl %r8d, %r8d
cmpl %r9d, %r11d
jge 0xaed4
addq $0x4, %rsi
movq %rdi, %rbx
movq 0x10(%rbx), %rbx
cmpq %rdi, %rbx
je 0xaeb8
movslq 0x4(%rbx), %r14
movl -0x80(%rsp,%r14,4), %ebp
testl %ebp, %ebp
jne 0xae92
movq 0x20(%rbx), %r15
movslq %r11d, %r11
movq %r15, 0x80(%rsp,%r11,8)
incl %r11d
movl %r11d, -0x80(%rsp,%r14,4)
movl (%rdx,%r14,4), %ebp
testl %r8d, %r8d
jne 0xaeac
movl -0x4(%rsi), %r14d
cmpl %r14d, %ebp
jg 0xaf3d
xorl %r8d, %r8d
cmpl %r14d, %ebp
jge 0xaeb2
movl %ebp, -0x4(%rsi)
movl %r10d, %r8d
addq $0x4, %rsi
jmp 0xae61
cmpl $0x0, -0x4(%rsi)
je 0xaec5
andl $0x0, -0x4(%rsi)
movl %r10d, %r8d
movq 0x80(%rsp,%rax,8), %rdi
incq %rax
incl %ecx
jmp 0xae55
cmpl %ecx, %r9d
cmovgl %r9d, %ecx
incl %ecx
movl $0x1, %edx
cmpq %rcx, %rax
je 0xaf4d
addq $0x4, %rsi
movq %rdi, %r9
movq 0x10(%r9), %r9
cmpq %rdi, %r9
je 0xaf23
movslq 0x4(%r9), %r10
movl -0x80(%rsp,%r10,4), %r10d
testl %r8d, %r8d
jne 0xaf16
movl -0x4(%rsi), %r11d
cmpl %r11d, %r10d
jg 0xaf3d
xorl %r8d, %r8d
cmpl %r11d, %r10d
jge 0xaf1d
movl %r10d, -0x4(%rsi)
movl %edx, %r8d
addq $0x4, %rsi
jmp 0xaeee
cmpl $0x0, -0x4(%rsi)
je 0xaf30
andl $0x0, -0x4(%rsi)
movl %edx, %r8d
movq 0x80(%rsp,%rax,8), %rdi
incq %rax
jmp 0xaee2
xorl %eax, %eax
addq $0x288, %rsp            # imm = 0x288
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x1, %r8d
movl $0x2, %eax
sbbl $0x0, %eax
jmp 0xaf3f