// File: /workspace/github_c_makefile_star2_O0/mishun[P]plantri/plantri.c
// Function: canon_edge_oriented
static int 
canon_edge_oriented(EDGE *edgelist_or[], int num_edges_or, int can_edges_or,
		    EDGE *edgelist_inv[], int num_edges_inv, int can_edges_inv,
		    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.

   This routine checks all num_edges_or elements of edgelist_or just for one 
   orientation and all num_edges_inv elements of the list edgelist_inv just
   for the other. It returns 1 if and only if one of the first can_edges_or
   elements of the first list or first can_edges_inv elements of the second 
   give an optimal numbering among all the possibilities provided by the
   lists.

   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 possible with
   edgelist_or */

    if (can_edges_or > 0)
      { testcanon_first_init(edgelist_or[0], representation, colour);
	numblist[0] = edgelist_or[0];
	for (i=1; i<can_edges_or; i++)
	  { test = testcanon_init(edgelist_or[i], representation, colour);
	    if (test == 1) { numblist[numbs] = edgelist_or[i]; numbs++; }
	    else if (test == 2) 
	      { numbs = 1; numblist[0] = edgelist_or[i]; }
	  }
	i=0; /* the next for-loop can start at the beginning */
      }
    else
      { numbs=0; numbs_mirror=1;
        testcanon_first_init_mirror(edgelist_inv[0], representation, colour);
        numblist_mirror[0] = edgelist_inv[0];
	i=1; /* the next for-loop must start at position 1 */
      }

    for (   ; i<can_edges_inv; i++)
      { test = testcanon_mirror_init(edgelist_inv[i], representation, colour);
        if (test == 1)
          { numblist_mirror[numbs_mirror] = edgelist_inv[i]; numbs_mirror++; }
	else if (test == 2) 
	  { numbs = 0; numbs_mirror=1; numblist_mirror[0] = edgelist_inv[i]; }
      }


    /* now we know the best we can get for a "canonical edge".
       Next we will check all the others. We can return 0 at once if we find a 
       better one */

    for (i=can_edges_or ; i < num_edges_or; i++)
      { test = testcanon(edgelist_or[i], representation, colour);
        if (test == 1) { numblist[numbs] = edgelist_or[i]; numbs++; }
        else if (test == 2) return 0;
      }
    for (i=can_edges_inv ; i < num_edges_inv; i++)
      { test = testcanon_mirror(edgelist_inv[i], representation, colour);
        if (test == 1) 
          { numblist_mirror[numbs_mirror] = edgelist_inv[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 $0x1e50, %rsp           # imm = 0x1E50
movq 0x28(%rbp), %rax
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movl %r9d, -0x28(%rbp)
movl $0x1, -0x1d44(%rbp)
movl $0x0, -0x1d48(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl 0x24b11b(%rip), %eax    # 0x25a620
jge 0xf52b
movq 0x10(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movl (%rax,%rcx,4), %ecx
addl $0x40, %ecx
movslq -0x2c(%rbp), %rax
movl %ecx, -0x1e50(%rbp,%rax,4)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0xf4fc
cmpl $0x0, -0x18(%rbp)
jle 0xf602
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq -0x600(%rbp), %rsi
leaq -0x1e50(%rbp), %rdx
callq 0xcce0
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x11a0(%rbp)
movl $0x1, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0xf5f9
movq -0x10(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq -0x600(%rbp), %rsi
leaq -0x1e50(%rbp), %rdx
callq 0xd2b0
movl %eax, -0x30(%rbp)
cmpl $0x1, -0x30(%rbp)
jne 0xf5c4
movq -0x10(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rcx
movslq -0x1d44(%rbp), %rax
movq %rcx, -0x11a0(%rbp,%rax,8)
movl -0x1d44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1d44(%rbp)
jmp 0xf5e9
cmpl $0x2, -0x30(%rbp)
jne 0xf5e7
movl $0x1, -0x1d44(%rbp)
movq -0x10(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x11a0(%rbp)
jmp 0xf5e9
jmp 0xf5eb
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0xf564
movl $0x0, -0x2c(%rbp)
jmp 0xf645
movl $0x0, -0x1d44(%rbp)
movl $0x1, -0x1d48(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rdi
leaq -0x600(%rbp), %rsi
leaq -0x1e50(%rbp), %rdx
callq 0x12e90
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x1d40(%rbp)
movl $0x1, -0x2c(%rbp)
jmp 0xf647
movl -0x2c(%rbp), %eax
cmpl -0x28(%rbp), %eax
jge 0xf6e6
movq -0x20(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq -0x600(%rbp), %rsi
leaq -0x1e50(%rbp), %rdx
callq 0xcf40
movl %eax, -0x30(%rbp)
cmpl $0x1, -0x30(%rbp)
jne 0xf6a7
movq -0x20(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rcx
movslq -0x1d48(%rbp), %rax
movq %rcx, -0x1d40(%rbp,%rax,8)
movl -0x1d48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1d48(%rbp)
jmp 0xf6d6
cmpl $0x2, -0x30(%rbp)
jne 0xf6d4
movl $0x0, -0x1d44(%rbp)
movl $0x1, -0x1d48(%rbp)
movq -0x20(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x1d40(%rbp)
jmp 0xf6d6
jmp 0xf6d8
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0xf647
movl -0x18(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0xf769
movq -0x10(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq -0x600(%rbp), %rsi
leaq -0x1e50(%rbp), %rdx
callq 0xd5f0
movl %eax, -0x30(%rbp)
cmpl $0x1, -0x30(%rbp)
jne 0xf748
movq -0x10(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rcx
movslq -0x1d44(%rbp), %rax
movq %rcx, -0x11a0(%rbp,%rax,8)
movl -0x1d44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1d44(%rbp)
jmp 0xf75c
cmpl $0x2, -0x30(%rbp)
jne 0xf75a
movl $0x0, -0x4(%rbp)
jmp 0xf8b2
jmp 0xf75c
jmp 0xf75e
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0xf6ec
movl -0x28(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0xf7ec
movq -0x20(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq -0x600(%rbp), %rsi
leaq -0x1e50(%rbp), %rdx
callq 0xd8e0
movl %eax, -0x30(%rbp)
cmpl $0x1, -0x30(%rbp)
jne 0xf7cb
movq -0x20(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rcx
movslq -0x1d48(%rbp), %rax
movq %rcx, -0x1d40(%rbp,%rax,8)
movl -0x1d48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1d48(%rbp)
jmp 0xf7df
cmpl $0x2, -0x30(%rbp)
jne 0xf7dd
movl $0x0, -0x4(%rbp)
jmp 0xf8b2
jmp 0xf7df
jmp 0xf7e1
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0xf76f
movl -0x1d44(%rbp), %ecx
movq 0x28(%rbp), %rax
movl %ecx, (%rax)
movl -0x1d44(%rbp), %ecx
addl -0x1d48(%rbp), %ecx
movq 0x20(%rbp), %rax
movl %ecx, (%rax)
movq 0x20(%rbp), %rax
cmpl $0x1, (%rax)
jle 0xf8ab
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x1d44(%rbp), %eax
jge 0xf857
movslq -0x2c(%rbp), %rax
movq -0x11a0(%rbp,%rax,8), %rdi
movq 0x18(%rbp), %rsi
movslq -0x2c(%rbp), %rax
imulq $0xba0, %rax, %rax      # imm = 0xBA0
addq %rax, %rsi
callq 0xdbd0
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0xf81e
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x1d48(%rbp), %eax
jge 0xf8a9
movslq -0x2c(%rbp), %rax
movq -0x1d40(%rbp,%rax,8), %rdi
movq 0x18(%rbp), %rsi
movslq -0x1d44(%rbp), %rax
imulq $0xba0, %rax, %rax      # imm = 0xBA0
addq %rax, %rsi
callq 0xde70
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
movl -0x1d44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1d44(%rbp)
jmp 0xf85e
jmp 0xf8ab
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x1e50, %rsp           # imm = 0x1E50
popq %rbp
retq
nop