// File: /workspace/github_c_makefile_star2_O2/mishun[P]plantri/plantri.c
// Function: testcanon_first_init
static void
testcanon_first_init(EDGE *givenedge, int representation[], int colour[])
 
/* Tests whether starting from a given edge and constructing the code in
   "->next" 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 */
{
    register EDGE *run;
    register int vertex;
    EDGE *temp;  
    EDGE *startedge[MAXN+1]; 
    int number[MAXN], i; 
    int last_number, actual_number;

 
    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->next; run != temp; run = run->next)
          { vertex = run->end;
            if (!number[vertex])
              { startedge[last_number] = run->invers;
                last_number++; number[vertex] = last_number; 
                *representation = colour[vertex]; }
            else *representation = number[vertex]; 
            representation++;
          }
        *representation = 0;
        representation++;
        temp = startedge[actual_number];  actual_number++;
    }

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

    return;
}

// Assembly:
pushq %rbx
subq $0x290, %rsp            # imm = 0x290
movl 0x237925(%rip), %r8d    # 0x242600
xorl %eax, %eax
testl %r8d, %r8d
movl $0x0, %ecx
cmovgl %r8d, %ecx
cmpq %rax, %rcx
je 0xacf8
andl $0x0, -0x80(%rsp,%rax,4)
incq %rax
jmp 0xace9
movslq (%rdi), %rcx
movl $0x1, -0x80(%rsp,%rcx,4)
movslq 0x4(%rdi), %rax
cmpl %eax, %ecx
jne 0xad13
movl $0x1, %r9d
jmp 0xad2d
movl $0x2, -0x80(%rsp,%rax,4)
movq 0x20(%rdi), %rax
movq %rax, 0x88(%rsp)
movl $0x2, %r9d
movabsq $0x1, %rax
xorl %ecx, %ecx
cmpl %r8d, %r9d
jge 0xad94
addq $0x4, %rsi
movq %rdi, %r10
movq 0x18(%r10), %r10
cmpq %rdi, %r10
je 0xad81
movslq 0x4(%r10), %rbx
movl -0x80(%rsp,%rbx,4), %r11d
testl %r11d, %r11d
jne 0xad77
movq 0x20(%r10), %r11
movslq %r9d, %r9
movq %r11, 0x80(%rsp,%r9,8)
incl %r9d
movl %r9d, -0x80(%rsp,%rbx,4)
movl (%rdx,%rbx,4), %r11d
movl %r11d, -0x4(%rsi)
addq $0x4, %rsi
jmp 0xad45
andl $0x0, -0x4(%rsi)
movq 0x80(%rsp,%rax,8), %rdi
incq %rax
incl %ecx
jmp 0xad39
cmpl %ecx, %r8d
cmovgl %r8d, %ecx
incl %ecx
cmpq %rcx, %rax
je 0xadd6
addq $0x4, %rsi
movq %rdi, %rdx
movq 0x18(%rdx), %rdx
cmpq %rdi, %rdx
je 0xadc5
movslq 0x4(%rdx), %r8
movl -0x80(%rsp,%r8,4), %r8d
movl %r8d, -0x4(%rsi)
addq $0x4, %rsi
jmp 0xada9
andl $0x0, -0x4(%rsi)
movq 0x80(%rsp,%rax,8), %rdi
incq %rax
jmp 0xad9d
addq $0x290, %rsp            # imm = 0x290
popq %rbx
retq