// File: /workspace/github_c_makefile_star2_O0/mishun[P]plantri/plantri.c
// Function: find_loopmakers
static void
find_loopmakers(EDGE *doubleedges[], int num_doubleedges,
                EDGE *possible_loops[], int *number_pos_loops)

/* This routine uses nv>3!!

   Computes the lists of edges that can be switched to give a loop.
   For every pair of inverse edges, ONE (the smaller one) is written 
   to list. The total number of edges is written to *number_pos_loops.

   For the computation of the switchers it is useful to know where the
   double edges are.  The list doubleedges[] must be supplied as a
   list of all edges contained in multiple edges (one direction
   only). "num_doubleedges" is its number;

   Some reasoning about degrees in this functions uses the fact that
   so far no loops are present in the graph.

   An edge being contained in a double edge cannot be switched to give a 
   loop.
*/

{
    int i,counter=0;
    EDGE *run,*buffer;


    RESETMARKS;

    if ((num_doubleedges<2) || 
	((minimumdeg>=3) && (num_doubleedges<4))) { *number_pos_loops=0; return; }

    for (i=0; i<num_doubleedges; i++)
    {   run=doubleedges[i];
        MARKLO(run);
        MARKLO(run->invers);
    }

/* Now all the edges contained in doubleedges are marked and we can
   start testing. We will first look for edges connecting two sets of
   double edges. */

    if (num_doubleedges>=4)
    for (i=0; i<num_doubleedges; i++)
    {   /* there must be a neighbouring doubleedge */
        run= doubleedges[i];
        if (ISMARKEDLO(run->next) && (!ISMARKEDHI(run->invers->prev))
                    && (run->start == run->invers->prev->prev->end))
        {   buffer=run->invers->prev;
            MARKHI(buffer);
            MARKHI(buffer->invers);
            possible_loops[counter]=buffer->min;
            counter++;
        }
        run= run->invers;
        if (ISMARKEDLO(run->next) && (!ISMARKEDHI(run->invers->prev))
                    && (run->start == run->invers->prev->prev->end))
        {   buffer=run->invers->prev;
            MARKHI(buffer);  MARKHI(buffer->invers);
        possible_loops[counter]=buffer->min;
        counter++;
        }
    }

/* We will now look for switchers that make degree one vertices. They can 
   be easily found: they are exactly the edges adjacent to degree 2 vertices.
   Note that for n>3 there can never be 2 degree 2 vertices neighbouring each other.
*/

    if (minimumdeg==1)
      for (i=0;i<nv;i++)
	{
	if (degree[i]==2)
	  { 
	    possible_loops[counter]=(firstedge[i])->min; counter++;
	    possible_loops[counter]=(firstedge[i])->next->min; counter++;
	  }
	}

    *number_pos_loops=counter;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl $0x0, -0x28(%rbp)
movl 0xc904(%rip), %eax      # 0x3c084
addl $0x2, %eax
movl %eax, 0xc8fb(%rip)      # 0x3c084
cmpl $0x7530, %eax           # imm = 0x7530
jle 0x2f7d0
movl $0x2, 0xc8ea(%rip)      # 0x3c084
movl $0x0, -0x3c(%rbp)
cmpl $0x1198, -0x3c(%rbp)    # imm = 0x1198
jge 0x2f7ce
movslq -0x3c(%rbp), %rcx
leaq 0x22ae7b(%rip), %rax    # 0x25a630
shlq $0x6, %rcx
addq %rcx, %rax
movl $0x0, 0x30(%rax)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x2f7a1
jmp 0x2f7d0
cmpl $0x2, -0xc(%rbp)
jl 0x2f7e5
cmpl $0x3, 0xc9db(%rip)      # 0x3c1b8
jl 0x2f7f4
cmpl $0x4, -0xc(%rbp)
jge 0x2f7f4
movq -0x20(%rbp), %rax
movl $0x0, (%rax)
jmp 0x2fa57
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x2f83c
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x30(%rbp)
movl 0xc86b(%rip), %ecx      # 0x3c084
movq -0x30(%rbp), %rax
movl %ecx, 0x30(%rax)
movl 0xc85e(%rip), %ecx      # 0x3c084
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
movl %ecx, 0x30(%rax)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x2f7fb
cmpl $0x4, -0xc(%rbp)
jl 0x2f9bb
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x2f9b9
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movl 0x30(%rax), %eax
cmpl 0xc80a(%rip), %eax      # 0x3c084
jne 0x2f903
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x10(%rax), %rax
movl 0x30(%rax), %eax
cmpl 0xc7ef(%rip), %eax      # 0x3c084
jg 0x2f903
movq -0x30(%rbp), %rax
movl (%rax), %eax
movq -0x30(%rbp), %rcx
movq 0x20(%rcx), %rcx
movq 0x10(%rcx), %rcx
movq 0x10(%rcx), %rcx
cmpl 0x4(%rcx), %eax
jne 0x2f903
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x38(%rbp)
movl 0xc7bc(%rip), %ecx      # 0x3c084
addl $0x1, %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x30(%rax)
movl 0xc7ac(%rip), %ecx      # 0x3c084
addl $0x1, %ecx
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rax
movl %ecx, 0x30(%rax)
movq -0x38(%rbp), %rax
movq 0x28(%rax), %rdx
movq -0x18(%rbp), %rax
movslq -0x28(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movl 0x30(%rax), %eax
cmpl 0xc764(%rip), %eax      # 0x3c084
jne 0x2f9a9
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x10(%rax), %rax
movl 0x30(%rax), %eax
cmpl 0xc749(%rip), %eax      # 0x3c084
jg 0x2f9a9
movq -0x30(%rbp), %rax
movl (%rax), %eax
movq -0x30(%rbp), %rcx
movq 0x20(%rcx), %rcx
movq 0x10(%rcx), %rcx
movq 0x10(%rcx), %rcx
cmpl 0x4(%rcx), %eax
jne 0x2f9a9
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x38(%rbp)
movl 0xc716(%rip), %ecx      # 0x3c084
addl $0x1, %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x30(%rax)
movl 0xc706(%rip), %ecx      # 0x3c084
addl $0x1, %ecx
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rax
movl %ecx, 0x30(%rax)
movq -0x38(%rbp), %rax
movq 0x28(%rax), %rdx
movq -0x18(%rbp), %rax
movslq -0x28(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x2f9ab
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x2f84d
jmp 0x2f9bb
cmpl $0x1, 0xc7f6(%rip)      # 0x3c1b8
jne 0x2fa4e
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl 0x22ac48(%rip), %eax    # 0x25a620
jge 0x2fa4c
movslq -0x24(%rbp), %rcx
leaq 0xe21b(%rip), %rax      # 0x3dc00
cmpl $0x2, (%rax,%rcx,4)
jne 0x2fa3f
movslq -0x24(%rbp), %rcx
leaq 0xe00a(%rip), %rax      # 0x3da00
movq (%rax,%rcx,8), %rax
movq 0x28(%rax), %rdx
movq -0x18(%rbp), %rax
movslq -0x28(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
movslq -0x24(%rbp), %rcx
leaq 0xdfe2(%rip), %rax      # 0x3da00
movq (%rax,%rcx,8), %rax
movq 0x18(%rax), %rax
movq 0x28(%rax), %rdx
movq -0x18(%rbp), %rax
movslq -0x28(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x2fa41
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x2f9cf
jmp 0x2fa4e
movl -0x28(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
popq %rbp
retq
nopl (%rax)