// File: /workspace/github_c_makefile_star2_O0/mishun[P]plantri/plantri.c
// Function: make_edge_colours
static void
make_edge_colours(EDGE *test_edge, EDGE *list[], int numlist,
                           EDGE *good[], int *ngood)

/* list[0..numlist-1] give a list of undirected edges, and
   test_edge is another undirected edge (perhaps included). 
   Both must be in min form.

   Calculate a colour for each orientation of all these edges. 
   If the least colour of an orientation of test_edge is not the
   least of all, return with *ngood == 0.
   Otherwise, put those directed edges with the same least colour
   in good[0..*ngood-1], with test_edge and/or its inverse first.

   It is guaranteed that the edges selected all have the same starting
   and ending degree. 

   Note that the definition of colour is used also in find_feasible_flips. */
{
    EDGE *e;
    int i,num_good;
    int d1,d2;
    long bestcol,col1,col2;

    col1 = col2 = (long)(degree[test_edge->prev->end]
                                + degree[test_edge->next->end]) << 20;
    d1 = degree[test_edge->start];
    d2 = degree[test_edge->end];
    col1 += (long)d1 + ((long)d2 << 10);
    col2 += (long)d2 + ((long)d1 << 10);

    bestcol = col1 < col2 ? col1 : col2;

    num_good = 0;
    if (col1 == bestcol) good[num_good++] = test_edge;
    if (col2 == bestcol) good[num_good++] = test_edge->invers;

    for (i = numlist; --i >= 0; )
    {
        e = list[i];
        if (e == test_edge) continue;

        col1 = col2 = (long)(degree[e->prev->end]
                         + degree[e->next->end]) << 20;
        d1 = degree[e->start];
        d2 = degree[e->end];
        col1 += (long)d1 + ((long)d2 << 10);
        col2 += (long)d2 + ((long)d1 << 10);
        if (col1 < bestcol || col2 < bestcol)
        {
            *ngood = 0;
            return;
        }
        if (col1 == bestcol) good[num_good++] = e;
        if (col2 == bestcol) good[num_good++] = e->invers;
    }

    *ngood = num_good;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movslq 0x4(%rax), %rcx
leaq 0xe6d6(%rip), %rax      # 0x3dc00
movl (%rax,%rcx,4), %eax
movq -0x8(%rbp), %rcx
movq 0x18(%rcx), %rcx
movslq 0x4(%rcx), %rdx
leaq 0xe6c0(%rip), %rcx      # 0x3dc00
addl (%rcx,%rdx,4), %eax
cltq
shlq $0x14, %rax
movq %rax, -0x58(%rbp)
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rax
movslq (%rax), %rcx
leaq 0xe6a1(%rip), %rax      # 0x3dc00
movl (%rax,%rcx,4), %eax
movl %eax, -0x3c(%rbp)
movq -0x8(%rbp), %rax
movslq 0x4(%rax), %rcx
leaq 0xe68c(%rip), %rax      # 0x3dc00
movl (%rax,%rcx,4), %eax
movl %eax, -0x40(%rbp)
movslq -0x3c(%rbp), %rax
movslq -0x40(%rbp), %rcx
shlq $0xa, %rcx
addq %rcx, %rax
addq -0x50(%rbp), %rax
movq %rax, -0x50(%rbp)
movslq -0x40(%rbp), %rax
movslq -0x3c(%rbp), %rcx
shlq $0xa, %rcx
addq %rcx, %rax
addq -0x58(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x58(%rbp), %rax
jge 0x2f5bc
movq -0x50(%rbp), %rax
movq %rax, -0x60(%rbp)
jmp 0x2f5c4
movq -0x58(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x48(%rbp)
movl $0x0, -0x38(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x48(%rbp), %rax
jne 0x2f5f7
movq -0x8(%rbp), %rdx
movq -0x20(%rbp), %rax
movl -0x38(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x38(%rbp)
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x58(%rbp), %rax
cmpq -0x48(%rbp), %rax
jne 0x2f61f
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdx
movq -0x20(%rbp), %rax
movl -0x38(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x38(%rbp)
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x14(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x34(%rbp)
cmpl $0x0, %eax
jl 0x2f755
movq -0x10(%rbp), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x8(%rbp), %rax
jne 0x2f653
jmp 0x2f625
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movslq 0x4(%rax), %rcx
leaq 0xe59a(%rip), %rax      # 0x3dc00
movl (%rax,%rcx,4), %eax
movq -0x30(%rbp), %rcx
movq 0x18(%rcx), %rcx
movslq 0x4(%rcx), %rdx
leaq 0xe584(%rip), %rcx      # 0x3dc00
addl (%rcx,%rdx,4), %eax
cltq
shlq $0x14, %rax
movq %rax, -0x58(%rbp)
movq %rax, -0x50(%rbp)
movq -0x30(%rbp), %rax
movslq (%rax), %rcx
leaq 0xe565(%rip), %rax      # 0x3dc00
movl (%rax,%rcx,4), %eax
movl %eax, -0x3c(%rbp)
movq -0x30(%rbp), %rax
movslq 0x4(%rax), %rcx
leaq 0xe550(%rip), %rax      # 0x3dc00
movl (%rax,%rcx,4), %eax
movl %eax, -0x40(%rbp)
movslq -0x3c(%rbp), %rax
movslq -0x40(%rbp), %rcx
shlq $0xa, %rcx
addq %rcx, %rax
addq -0x50(%rbp), %rax
movq %rax, -0x50(%rbp)
movslq -0x40(%rbp), %rax
movslq -0x3c(%rbp), %rcx
shlq $0xa, %rcx
addq %rcx, %rax
addq -0x58(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x48(%rbp), %rax
jl 0x2f6f8
movq -0x58(%rbp), %rax
cmpq -0x48(%rbp), %rax
jge 0x2f704
movq -0x28(%rbp), %rax
movl $0x0, (%rax)
jmp 0x2f75e
movq -0x50(%rbp), %rax
cmpq -0x48(%rbp), %rax
jne 0x2f728
movq -0x30(%rbp), %rdx
movq -0x20(%rbp), %rax
movl -0x38(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x38(%rbp)
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x58(%rbp), %rax
cmpq -0x48(%rbp), %rax
jne 0x2f750
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rdx
movq -0x20(%rbp), %rax
movl -0x38(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x38(%rbp)
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
jmp 0x2f625
movl -0x38(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
popq %rbp
retq