// File: /workspace/github_c_makefile_star2_O0/mishun[P]plantri/plantri.c
// Function: find_special_loopmakers
static void
find_special_loopmakers(EDGE *loops[], int num_loops, 
		        EDGE *special_loop_makers[], int *num_spec_loops)

/* Finds all those loops so that after switching on one side of it there is
   a triangle consisting only of loops and on the other there is a double edge.
   The edges are given in min form.  

   It is assumed that the map handed to this routine does not contain
   vertices of valency smaller than "minimumdegree" and the routine only 
   returns edges that can be switched without producing some.

   Additionally, if tswitch==0 (no -t) it is checked that the double
   edges inside the one of the triangles do not contain a loop on
   one side, since this would give a double edge in the dual.

   Or to be exact: They do not contain a loop that is neighbouring both the
   double edges.

   Note that "other" double edges can occur in the dual in case minimumdegree<3.
*/

{
    int i; 
    EDGE *run, *test;

    *num_spec_loops=0;

    if (num_loops < 2) return;
    
    RESETMARKS;
    RESETMARKS_V;

    for (i=0; i<num_loops; i++)
      { run=loops[i];
        MARKLO(run); MARKLO(run->invers);
        if (ISMARKED_V(run->start)) /* already another loop started
				                       at the same vertex */
          /* To determine a switcher, a pair of loops is necessary.
             The switcher is always detected by the second loop of the
             pair that is visited */
          { 
	    if (ISMARKED(run->prev->prev) && (degree[run->prev->end]>minimumdeg)
	        && (run->prev->start != run->prev->end))
	    { test=run->prev->invers; 
	      /* the first edge at the top inside the double edge */
	      if (tswitch || (test->next->next->invers != test->prev->prev))
		/* the last test is a bit weird in case degree<4 of the test->start
		   but the result is correct */
		{ special_loop_makers[*num_spec_loops]=run->prev->min;
                  (*num_spec_loops)++; }
	    }
            if (ISMARKED(run->next->next) && (degree[run->next->end]>minimumdeg)
	        && (run->next->start != run->next->end))
	    { test=run->next->invers; 
	       if (tswitch || (test->next->next->invers != test->prev->prev))
	      { special_loop_makers[*num_spec_loops]=run->next->min;
                (*num_spec_loops)++; }
	    }
            run=run->invers;
	    if (ISMARKED(run->prev->prev) && (degree[run->prev->end]>minimumdeg)
	        && (run->prev->start != run->prev->end))
	    { test=run->prev->invers; 
	      if (tswitch || (test->next->next->invers != test->prev->prev))
		{ special_loop_makers[*num_spec_loops]=run->prev->min;
		(*num_spec_loops)++; }
	    }
	    if (ISMARKED(run->next->next) && (degree[run->next->end]>minimumdeg)
	        && (run->next->start != run->next->end))
	    { test=run->next->invers; 
	       if (tswitch || (test->next->next->invers != test->prev->prev))
		 { special_loop_makers[*num_spec_loops]=run->next->min;
		 (*num_spec_loops)++; }
	    }
	  }
        else MARK_V(run->start);
      }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x20(%rbp), %rax
movl $0x0, (%rax)
cmpl $0x2, -0xc(%rbp)
jge 0x2ff98
jmp 0x30389
movl 0xc0e6(%rip), %eax      # 0x3c084
addl $0x2, %eax
movl %eax, 0xc0dd(%rip)      # 0x3c084
cmpl $0x7530, %eax           # imm = 0x7530
jle 0x2ffee
movl $0x2, 0xc0cc(%rip)      # 0x3c084
movl $0x0, -0x3c(%rbp)
cmpl $0x1198, -0x3c(%rbp)    # imm = 0x1198
jge 0x2ffec
movslq -0x3c(%rbp), %rcx
leaq 0x22a65d(%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 0x2ffbf
jmp 0x2ffee
movl 0xc09c(%rip), %eax      # 0x3c090
addl $0x1, %eax
movl %eax, 0xc093(%rip)      # 0x3c090
cmpl $0x7530, %eax           # imm = 0x7530
jle 0x3003a
movl $0x1, 0xc082(%rip)      # 0x3c090
movl $0x0, -0x40(%rbp)
cmpl $0x40, -0x40(%rbp)
jge 0x30038
movslq -0x40(%rbp), %rcx
leaq 0x270c1a(%rip), %rax    # 0x2a0c40
movl $0x0, (%rax,%rcx,4)
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x30015
jmp 0x3003a
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x30389
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x30(%rbp)
movl 0xc021(%rip), %ecx      # 0x3c084
movq -0x30(%rbp), %rax
movl %ecx, 0x30(%rax)
movl 0xc014(%rip), %ecx      # 0x3c084
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
movl %ecx, 0x30(%rax)
movq -0x30(%rbp), %rax
movslq (%rax), %rcx
leaq 0x270bb7(%rip), %rax    # 0x2a0c40
movl (%rax,%rcx,4), %eax
cmpl 0xbffe(%rip), %eax      # 0x3c090
jne 0x30362
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rax
movl 0x30(%rax), %eax
cmpl 0xbfd7(%rip), %eax      # 0x3c084
jl 0x30147
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movslq 0x4(%rax), %rcx
leaq 0xdb3a(%rip), %rax      # 0x3dc00
movl (%rax,%rcx,4), %eax
cmpl 0xc0e9(%rip), %eax      # 0x3c1b8
jle 0x30147
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movl (%rax), %eax
movq -0x30(%rbp), %rcx
movq 0x10(%rcx), %rcx
cmpl 0x4(%rcx), %eax
je 0x30147
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x20(%rax), %rax
movq %rax, -0x38(%rbp)
cmpl $0x0, 0xbfb5(%rip)      # 0x3c0b4
jne 0x3011f
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x18(%rax), %rax
movq 0x20(%rax), %rax
movq -0x38(%rbp), %rcx
movq 0x10(%rcx), %rcx
cmpq 0x10(%rcx), %rax
je 0x30145
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x28(%rax), %rdx
movq -0x18(%rbp), %rax
movq -0x20(%rbp), %rcx
movslq (%rcx), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x20(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0x30147
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x18(%rax), %rax
movl 0x30(%rax), %eax
cmpl 0xbf28(%rip), %eax      # 0x3c084
jl 0x301f6
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movslq 0x4(%rax), %rcx
leaq 0xda8b(%rip), %rax      # 0x3dc00
movl (%rax,%rcx,4), %eax
cmpl 0xc03a(%rip), %eax      # 0x3c1b8
jle 0x301f6
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movl (%rax), %eax
movq -0x30(%rbp), %rcx
movq 0x18(%rcx), %rcx
cmpl 0x4(%rcx), %eax
je 0x301f6
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x20(%rax), %rax
movq %rax, -0x38(%rbp)
cmpl $0x0, 0xbf06(%rip)      # 0x3c0b4
jne 0x301ce
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x18(%rax), %rax
movq 0x20(%rax), %rax
movq -0x38(%rbp), %rcx
movq 0x10(%rcx), %rcx
cmpq 0x10(%rcx), %rax
je 0x301f4
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x28(%rax), %rdx
movq -0x18(%rbp), %rax
movq -0x20(%rbp), %rcx
movslq (%rcx), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x20(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0x301f6
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rax
movl 0x30(%rax), %eax
cmpl 0xbe6d(%rip), %eax      # 0x3c084
jl 0x302b1
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movslq 0x4(%rax), %rcx
leaq 0xd9d0(%rip), %rax      # 0x3dc00
movl (%rax,%rcx,4), %eax
cmpl 0xbf7f(%rip), %eax      # 0x3c1b8
jle 0x302b1
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movl (%rax), %eax
movq -0x30(%rbp), %rcx
movq 0x10(%rcx), %rcx
cmpl 0x4(%rcx), %eax
je 0x302b1
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x20(%rax), %rax
movq %rax, -0x38(%rbp)
cmpl $0x0, 0xbe4b(%rip)      # 0x3c0b4
jne 0x30289
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x18(%rax), %rax
movq 0x20(%rax), %rax
movq -0x38(%rbp), %rcx
movq 0x10(%rcx), %rcx
cmpq 0x10(%rcx), %rax
je 0x302af
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x28(%rax), %rdx
movq -0x18(%rbp), %rax
movq -0x20(%rbp), %rcx
movslq (%rcx), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x20(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0x302b1
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x18(%rax), %rax
movl 0x30(%rax), %eax
cmpl 0xbdbe(%rip), %eax      # 0x3c084
jl 0x30360
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movslq 0x4(%rax), %rcx
leaq 0xd921(%rip), %rax      # 0x3dc00
movl (%rax,%rcx,4), %eax
cmpl 0xbed0(%rip), %eax      # 0x3c1b8
jle 0x30360
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movl (%rax), %eax
movq -0x30(%rbp), %rcx
movq 0x18(%rcx), %rcx
cmpl 0x4(%rcx), %eax
je 0x30360
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x20(%rax), %rax
movq %rax, -0x38(%rbp)
cmpl $0x0, 0xbd9c(%rip)      # 0x3c0b4
jne 0x30338
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x18(%rax), %rax
movq 0x20(%rax), %rax
movq -0x38(%rbp), %rcx
movq 0x10(%rcx), %rcx
cmpq 0x10(%rcx), %rax
je 0x3035e
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x28(%rax), %rdx
movq -0x18(%rbp), %rax
movq -0x20(%rbp), %rcx
movslq (%rcx), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x20(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0x30360
jmp 0x30379
movl 0xbd28(%rip), %edx      # 0x3c090
movq -0x30(%rbp), %rax
movslq (%rax), %rcx
leaq 0x2708ca(%rip), %rax    # 0x2a0c40
movl %edx, (%rax,%rcx,4)
jmp 0x3037b
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x30041
popq %rbp
retq
nopl (%rax,%rax)