// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x2e0, %rsp            # imm = 0x2E0
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl $0x0, -0x348(%rbp)
movl $0x0, -0x344(%rbp)
movl -0x344(%rbp), %eax
cmpl 0x24d6a9(%rip), %eax    # 0x25a620
jge 0xcf9c
movslq -0x344(%rbp), %rax
movl $0x0, -0x340(%rbp,%rax,4)
movl -0x344(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x344(%rbp)
jmp 0xcf6b
movq -0x10(%rbp), %rax
movslq (%rax), %rax
movl $0x1, -0x340(%rbp,%rax,4)
movq -0x10(%rbp), %rax
movl (%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x4(%rcx), %eax
je 0xcfeb
movq -0x10(%rbp), %rax
movslq 0x4(%rax), %rax
movl $0x2, -0x340(%rbp,%rax,4)
movl $0x2, -0x34c(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x238(%rbp)
jmp 0xcff5
movl $0x1, -0x34c(%rbp)
movl $0x1, -0x350(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movl -0x34c(%rbp), %eax
cmpl 0x24d60d(%rip), %eax    # 0x25a620
jge 0xd17b
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x28(%rbp), %rax
je 0xd12b
movq -0x30(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x354(%rbp)
movslq -0x354(%rbp), %rax
cmpl $0x0, -0x340(%rbp,%rax,4)
jne 0xd0a1
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rcx
movslq -0x34c(%rbp), %rax
movq %rcx, -0x240(%rbp,%rax,8)
movl -0x34c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34c(%rbp)
movl -0x34c(%rbp), %ecx
movslq -0x354(%rbp), %rax
movl %ecx, -0x340(%rbp,%rax,4)
movq -0x20(%rbp), %rax
movslq -0x354(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x354(%rbp)
jmp 0xd0b5
movslq -0x354(%rbp), %rax
movl -0x340(%rbp,%rax,4), %eax
movl %eax, -0x354(%rbp)
cmpl $0x0, -0x348(%rbp)
je 0xd0cc
movl -0x354(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
jmp 0xd10e
movl -0x354(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl (%rcx), %eax
jle 0xd0e6
movl $0x0, -0x4(%rbp)
jmp 0xd29b
movl -0x354(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl (%rcx), %eax
jge 0xd10a
movl $0x1, -0x348(%rbp)
movl -0x354(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
jmp 0xd10c
jmp 0xd10e
movq -0x18(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x18(%rbp)
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0xd025
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0xd148
movl $0x1, -0x348(%rbp)
movq -0x18(%rbp), %rax
movl $0x0, (%rax)
movq -0x18(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x18(%rbp)
movslq -0x350(%rbp), %rax
movq -0x240(%rbp,%rax,8), %rax
movq %rax, -0x28(%rbp)
movl -0x350(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x350(%rbp)
jmp 0xd007
jmp 0xd17d
movl -0x350(%rbp), %eax
cmpl 0x24d497(%rip), %eax    # 0x25a620
jg 0xd282
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x28(%rbp), %rax
je 0xd232
movq -0x30(%rbp), %rax
movslq 0x4(%rax), %rax
movl -0x340(%rbp,%rax,4), %eax
movl %eax, -0x354(%rbp)
cmpl $0x0, -0x348(%rbp)
je 0xd1d5
movl -0x354(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
jmp 0xd215
movl -0x354(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl (%rcx), %eax
jle 0xd1ef
movl $0x0, -0x4(%rbp)
jmp 0xd29b
movl -0x354(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl (%rcx), %eax
jge 0xd213
movl $0x1, -0x348(%rbp)
movl -0x354(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
jmp 0xd215
movq -0x18(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x18(%rbp)
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0xd19b
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0xd24f
movl $0x1, -0x348(%rbp)
movq -0x18(%rbp), %rax
movl $0x0, (%rax)
movq -0x18(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x18(%rbp)
movslq -0x350(%rbp), %rax
movq -0x240(%rbp,%rax,8), %rax
movq %rax, -0x28(%rbp)
movl -0x350(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x350(%rbp)
jmp 0xd17d
cmpl $0x0, -0x348(%rbp)
je 0xd294
movl $0x2, -0x4(%rbp)
jmp 0xd29b
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x2e0, %rsp            # imm = 0x2E0
popq %rbp
retq
nopw (%rax,%rax)