// File: /workspace/github_c_makefile_star2_O0/mishun[P]plantri/plantri.c
// Function: con_quad
static int
con_quad(void)

/* tests and returns the connectivity of a simple quadrangulation.
   Possible values are 2 and 3 */
{

  int i,othervertex;
  EDGE *start, *run, *end, *runend, *buffer;
  static EDGE *lastprob=NULL;
  static int lastdeg= -1;
  /* the last two remember edges or vertices where the last time there
     was a problem -- test these first */

  if (lastdeg>=0) { if (degree[lastdeg]==2)  return 2;}

  RESETMARKS;

  if ((lastprob != NULL) && (degree[lastprob->start]>3))
    { MARK(lastprob);
      buffer=lastprob->invers->prev;
      othervertex=buffer->end;
      if (degree[othervertex]>3)
	{
	  MARK(buffer->invers->prev);
	  runend=lastprob->prev;
	  run=lastprob->next->next;
	  while (run!=runend)
	    { if (run->invers->prev->end==othervertex) return 2;
	    run=run->next; }
	}
    }

  lastdeg= -1;
  lastprob=NULL;

  for (i=0;i<nv;i++) if (degree[i]==2) { lastdeg=i; return 2;}

  /* Note: edges on the other side of degree 3 vertices in a 
     quadrangle can be marked as non-starts. but this makes it
     much slower (doing it in the loop or doing it before. 
     Don't ask why... */

  for (i=0;i<nv-1;i++) /* the faces around nv are all tested from
			  the other side */
   { if (degree[i]>3)
      { start=end=firstedge[i]; /* checking face on the right */
      do
	{
	  if (!ISMARKED(start))
	    { MARK(start);
	      buffer=start->invers->prev;
	      othervertex=buffer->end;
	      if (degree[othervertex]>3)
		{
		  MARK(buffer->invers->prev);
		  runend=start->prev;
		  run=start->next->next;
		  while (run!=runend)
		    { if (run->invers->prev->end==othervertex) 
		      { lastprob=start; return 2; }
		      run=run->next; }
		}
	      /* Makes it slower... -- also outside the edge-loop
	      if (degree[i]==4) 
		{ MARK(start->next->next);
		MARK(start->prev->invers->next->invers);
		}
	      */
	    }
	  start=start->next;
	} while (start!=end);
      }
   }
      
  return 3;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
cmpl $0x0, 0x2df79(%rip)     # 0x3c094
jl 0xe13f
movslq 0x2df70(%rip), %rcx     # 0x3c094
leaq 0x2fad5(%rip), %rax     # 0x3dc00
cmpl $0x2, (%rax,%rcx,4)
jne 0xe13d
movl $0x2, -0x4(%rbp)
jmp 0xe403
jmp 0xe13f
movl 0x2df3f(%rip), %eax     # 0x3c084
addl $0x2, %eax
movl %eax, 0x2df36(%rip)     # 0x3c084
cmpl $0x7530, %eax           # imm = 0x7530
jle 0xe195
movl $0x2, 0x2df25(%rip)     # 0x3c084
movl $0x0, -0x3c(%rbp)
cmpl $0x1198, -0x3c(%rbp)    # imm = 0x1198
jge 0xe193
movslq -0x3c(%rbp), %rcx
leaq 0x24c4b6(%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 0xe166
jmp 0xe195
cmpq $0x0, 0x292ba3(%rip)    # 0x2a0d40
je 0xe26f
movq 0x292b96(%rip), %rax    # 0x2a0d40
movslq (%rax), %rcx
leaq 0x2fa4c(%rip), %rax     # 0x3dc00
cmpl $0x3, (%rax,%rcx,4)
jle 0xe26f
movl 0x2dec0(%rip), %ecx     # 0x3c084
movq 0x292b75(%rip), %rax    # 0x2a0d40
movl %ecx, 0x30(%rax)
movq 0x292b6b(%rip), %rax    # 0x2a0d40
movq 0x20(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0xc(%rbp)
movslq -0xc(%rbp), %rcx
leaq 0x2fa0a(%rip), %rax     # 0x3dc00
cmpl $0x3, (%rax,%rcx,4)
jle 0xe26d
movl 0x2de82(%rip), %ecx     # 0x3c084
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x10(%rax), %rax
movl %ecx, 0x30(%rax)
movq 0x292b28(%rip), %rax    # 0x2a0d40
movq 0x10(%rax), %rax
movq %rax, -0x30(%rbp)
movq 0x292b19(%rip), %rax    # 0x2a0d40
movq 0x18(%rax), %rax
movq 0x18(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x30(%rbp), %rax
je 0xe26b
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x10(%rax), %rax
movl 0x4(%rax), %eax
cmpl -0xc(%rbp), %eax
jne 0xe25d
movl $0x2, -0x4(%rbp)
jmp 0xe403
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0xe233
jmp 0xe26d
jmp 0xe26f
movl $0xffffffff, 0x2de1b(%rip) # imm = 0xFFFFFFFF
movq $0x0, 0x292abc(%rip) # 0x2a0d40
movl $0x0, -0x8(%rbp)
movl -0x8(%rbp), %eax
cmpl 0x24c38c(%rip), %eax    # 0x25a620
jge 0xe2c9
movslq -0x8(%rbp), %rcx
leaq 0x2f95f(%rip), %rax     # 0x3dc00
cmpl $0x2, (%rax,%rcx,4)
jne 0xe2bc
movl -0x8(%rbp), %eax
movl %eax, 0x2dde4(%rip)     # 0x3c094
movl $0x2, -0x4(%rbp)
jmp 0xe403
jmp 0xe2be
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0xe28b
movl $0x0, -0x8(%rbp)
movl -0x8(%rbp), %eax
movl 0x24c347(%rip), %ecx    # 0x25a620
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0xe3fc
movslq -0x8(%rbp), %rcx
leaq 0x2f911(%rip), %rax     # 0x3dc00
cmpl $0x3, (%rax,%rcx,4)
jle 0xe3ec
movslq -0x8(%rbp), %rcx
leaq 0x2f6fc(%rip), %rax     # 0x3da00
movq (%rax,%rcx,8), %rax
movq %rax, -0x28(%rbp)
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movl 0x30(%rax), %eax
cmpl 0x2dd67(%rip), %eax     # 0x3c084
jge 0xe3d0
movl 0x2dd5b(%rip), %ecx     # 0x3c084
movq -0x18(%rbp), %rax
movl %ecx, 0x30(%rax)
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0xc(%rbp)
movslq -0xc(%rbp), %rcx
leaq 0x2f8ab(%rip), %rax     # 0x3dc00
cmpl $0x3, (%rax,%rcx,4)
jle 0xe3ce
movl 0x2dd23(%rip), %ecx     # 0x3c084
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x10(%rax), %rax
movl %ecx, 0x30(%rax)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x18(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x30(%rbp), %rax
je 0xe3cc
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x10(%rax), %rax
movl 0x4(%rax), %eax
cmpl -0xc(%rbp), %eax
jne 0xe3be
movq -0x18(%rbp), %rax
movq %rax, 0x29298b(%rip)    # 0x2a0d40
movl $0x2, -0x4(%rbp)
jmp 0xe403
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0xe38c
jmp 0xe3ce
jmp 0xe3d0
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpq -0x28(%rbp), %rax
jne 0xe310
jmp 0xe3ec
jmp 0xe3ee
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0xe2d0
movl $0x3, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopl (%rax,%rax)