// File: /workspace/github_c_makefile_star2_O0/mishun[P]plantri/plantri.c
// Function: canon_edge
static int 
canon_edge(EDGE *edgelist[], int num_edges,
           int lcolour[], EDGE *can_numberings[][MAXE], 
           int *nbtot, int *nbop)

/* 
   IT IS ASSUMED that the values of the colour function are positive and
   at most INT_MAX-MAXN.

   In case edgelist[0] == edgelist[1]->inverse, it checks whether 
   edgelist[0] or edgelist[1] are canonical. Otherwise only
   edgelist[0] is checked to be canonical.

   It is only compared with the other edges contained in edgelist.
   The number of those edges in the list is given in num_edges.
   Returns 1 if yes, 0 if not. 

   Edges given are not in minimal form -- but it is guaranteed that all
   colours of the startpoints are the same and all colours of the endpoints
   are the same.

   In case of only the identity automorphism, the entries of can_numberings[][]
   are undefined.

   Otherwise in can_numberings[][] the canonical numberings are stored as
   sequences of oriented edges.  For every 0 <= i,j < *nbtot
   and every 0 <= k < ne the edges can_numberings[i][k] and
   can_numberings[j][k] can be mapped onto each other by an automorphism.
   The first *nbop numberings are orientation
   preserving while the rest are orientation reversing.

   In case of an orientation preserving numbering the edges are listed in 
   ->next direction, otherwise in ->prev direction.

   Works OK if at least one vertex has valence >= 3. Otherwise some numberings 
   are computed twice, since changing the orientation (the cyclic order around 
   each vertex) doesn't change anything */
{
    int i, test;
    int representation[MAXE];
    EDGE *numblist[MAXE], *numblist_mirror[MAXE]; /* lists of edges where 
                            starting gives a canonical representation */
    int numbs = 1, numbs_mirror = 0;
    int colour[MAXN];

    for (i=0; i<nv; i++) colour[i]=lcolour[i]+MAXN;
				/* to distinguish colours from vertices */

/* First we have to determine the smallest representation of edgelist[0] */

    testcanon_first_init(edgelist[0], representation, colour);
    numblist[0] = edgelist[0];
    test = testcanon_mirror_init(edgelist[0], representation, colour);
    if (test == 1) 
      { numbs_mirror = 1; numblist_mirror[0] = edgelist[0]; }
    else if (test == 2)  
      { numbs_mirror = 1; numbs = 0; 
        numblist_mirror[0] = edgelist[0]; }

    if ((num_edges>1) && (edgelist[0]==edgelist[1]->invers))
      { test = testcanon_init(edgelist[1], representation, colour);
        if (test == 1) { numblist[numbs] = edgelist[1]; numbs++; }
        else if (test == 2) 
          { numbs_mirror = 0; numbs = 1; numblist[0] = edgelist[1]; }
        test = testcanon_mirror_init(edgelist[1],representation, colour);
        if (test == 1)  
          { numblist_mirror[numbs_mirror] = edgelist[1]; 
            numbs_mirror++; }
        else if (test == 2) 
          { numbs_mirror = 1; numbs = 0; 
            numblist_mirror[0] = edgelist[1]; }
        i=2; /* start rejecting at the second entry */
      }
    else i=1; /* start rejecting at the first entry */
/* Now we know the best representation we can obtain with testedge.
   Next we will check all the others. We can return 0 at once if we find a 
   better one */

    for ( ; i < num_edges; i++)
      { test = testcanon(edgelist[i], representation, colour);
        if (test == 1) { numblist[numbs] = edgelist[i]; numbs++; }
        else if (test == 2) return 0;
        test = testcanon_mirror(edgelist[i], representation, colour);
        if (test == 1) 
          { numblist_mirror[numbs_mirror] = edgelist[i]; numbs_mirror++; }
        else if (test == 2) return 0;
      }

    *nbop = numbs;
    *nbtot = numbs+numbs_mirror;

    if (*nbtot > 1)
      {
        for (i = 0; i < numbs; i++) 
            construct_numb(numblist[i], can_numberings[i]); 
        for (i = 0; i < numbs_mirror; i++, numbs++) 
            construct_numb_mirror(numblist_mirror[i],can_numberings[numbs]);
      }

    return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1e60, %rsp           # imm = 0x1E60
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movl $0x1, -0x1d54(%rbp)
movl $0x0, -0x1d58(%rbp)
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl 0x2360fa(%rip), %eax    # 0x25a620
jge 0x2454c
movq -0x20(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movl (%rax,%rcx,4), %ecx
addl $0x40, %ecx
movslq -0x3c(%rbp), %rax
movl %ecx, -0x1e60(%rbp,%rax,4)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x2451d
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq -0x610(%rbp), %rsi
leaq -0x1e60(%rbp), %rdx
callq 0xcce0
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x11b0(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq -0x610(%rbp), %rsi
leaq -0x1e60(%rbp), %rdx
callq 0xcf40
movl %eax, -0x40(%rbp)
cmpl $0x1, -0x40(%rbp)
jne 0x245b1
movl $0x1, -0x1d58(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x1d50(%rbp)
jmp 0x245db
cmpl $0x2, -0x40(%rbp)
jne 0x245d9
movl $0x1, -0x1d58(%rbp)
movl $0x0, -0x1d54(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x1d50(%rbp)
jmp 0x245db
cmpl $0x1, -0x14(%rbp)
jle 0x246f5
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x8(%rcx), %rcx
cmpq 0x20(%rcx), %rax
jne 0x246f5
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq -0x610(%rbp), %rsi
leaq -0x1e60(%rbp), %rdx
callq 0xd2b0
movl %eax, -0x40(%rbp)
cmpl $0x1, -0x40(%rbp)
jne 0x2464a
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
movslq -0x1d54(%rbp), %rax
movq %rcx, -0x11b0(%rbp,%rax,8)
movl -0x1d54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1d54(%rbp)
jmp 0x24675
cmpl $0x2, -0x40(%rbp)
jne 0x24673
movl $0x0, -0x1d58(%rbp)
movl $0x1, -0x1d54(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x11b0(%rbp)
jmp 0x24675
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq -0x610(%rbp), %rsi
leaq -0x1e60(%rbp), %rdx
callq 0xcf40
movl %eax, -0x40(%rbp)
cmpl $0x1, -0x40(%rbp)
jne 0x246c1
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
movslq -0x1d58(%rbp), %rax
movq %rcx, -0x1d50(%rbp,%rax,8)
movl -0x1d58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1d58(%rbp)
jmp 0x246ec
cmpl $0x2, -0x40(%rbp)
jne 0x246ea
movl $0x1, -0x1d58(%rbp)
movl $0x0, -0x1d54(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x1d50(%rbp)
jmp 0x246ec
movl $0x2, -0x3c(%rbp)
jmp 0x246fc
movl $0x1, -0x3c(%rbp)
jmp 0x246fe
movl -0x3c(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x247ea
movq -0x10(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq -0x610(%rbp), %rsi
leaq -0x1e60(%rbp), %rdx
callq 0xd5f0
movl %eax, -0x40(%rbp)
cmpl $0x1, -0x40(%rbp)
jne 0x2475e
movq -0x10(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movq (%rax,%rcx,8), %rcx
movslq -0x1d54(%rbp), %rax
movq %rcx, -0x11b0(%rbp,%rax,8)
movl -0x1d54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1d54(%rbp)
jmp 0x24772
cmpl $0x2, -0x40(%rbp)
jne 0x24770
movl $0x0, -0x4(%rbp)
jmp 0x248b0
jmp 0x24772
movq -0x10(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq -0x610(%rbp), %rsi
leaq -0x1e60(%rbp), %rdx
callq 0xd8e0
movl %eax, -0x40(%rbp)
cmpl $0x1, -0x40(%rbp)
jne 0x247c6
movq -0x10(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movq (%rax,%rcx,8), %rcx
movslq -0x1d58(%rbp), %rax
movq %rcx, -0x1d50(%rbp,%rax,8)
movl -0x1d58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1d58(%rbp)
jmp 0x247da
cmpl $0x2, -0x40(%rbp)
jne 0x247d8
movl $0x0, -0x4(%rbp)
jmp 0x248b0
jmp 0x247da
jmp 0x247dc
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x246fe
movl -0x1d54(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, (%rax)
movl -0x1d54(%rbp), %ecx
addl -0x1d58(%rbp), %ecx
movq -0x30(%rbp), %rax
movl %ecx, (%rax)
movq -0x30(%rbp), %rax
cmpl $0x1, (%rax)
jle 0x248a9
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x1d54(%rbp), %eax
jge 0x24855
movslq -0x3c(%rbp), %rax
movq -0x11b0(%rbp,%rax,8), %rdi
movq -0x28(%rbp), %rsi
movslq -0x3c(%rbp), %rax
imulq $0xba0, %rax, %rax      # imm = 0xBA0
addq %rax, %rsi
callq 0xdbd0
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x2481c
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x1d58(%rbp), %eax
jge 0x248a7
movslq -0x3c(%rbp), %rax
movq -0x1d50(%rbp,%rax,8), %rdi
movq -0x28(%rbp), %rsi
movslq -0x1d54(%rbp), %rax
imulq $0xba0, %rax, %rax      # imm = 0xBA0
addq %rax, %rsi
callq 0xde70
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
movl -0x1d54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1d54(%rbp)
jmp 0x2485c
jmp 0x248a9
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x1e60, %rsp           # imm = 0x1E60
popq %rbp
retq
nopl (%rax)