// File: /workspace/github_c_makefile_star2_O0/mishun[P]plantri/plantri.c
// Function: legal_P3_reduction
static int
legal_P3_reduction(EDGE *e)

/* checks whether the edge corresponds to a legal P3 reduction.
   Returns 1 if it is a legal reduction, 0 else. 

   Again it is assumed (necessary or not) that P1 has higher priority
   -- the nonexistence of a P1 reduction forces some subconfiguration.

   Furthermore it is assumed that the graph inspected is not the cube.
*/

{
  EDGE *run, *last;
  int v1,v2;

  if (degree[e->next->end]!=3) return 0;
  run=e->invers->prev;
  if (degree[run->end]!=3) return 0;
  run=run->prev->invers->prev;  
  if (degree[run->end]!=3) return 0;
  v1=run->start;
   run=run->prev->invers->prev;  
  if (degree[run->end]!=3) return 0;
  v2=run->start;
 
  /* OK -- we have an "inserted square" on the right hand side */

  /* Test whether opposite vertices share a face */

  last=e->prev;
  run=e->next->next->next;
  while (run!=last)
    { if (run->invers->prev->end==v1) return 0;
    run=run->next; }

  e=e->invers;
  last=e->prev->prev->prev;
  run=e->next;
  while (run!=last)
    { if (run->invers->prev->end==v2) return 0;
    run=run->next; }

  return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movslq 0x4(%rax), %rcx
leaq 0x280c5(%rip), %rax     # 0x3dc00
cmpl $0x3, (%rax,%rcx,4)
je 0x15b4d
movl $0x0, -0x4(%rbp)
jmp 0x15cb7
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movslq 0x4(%rax), %rcx
leaq 0x28094(%rip), %rax     # 0x3dc00
cmpl $0x3, (%rax,%rcx,4)
je 0x15b7e
movl $0x0, -0x4(%rbp)
jmp 0x15cb7
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x20(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movslq 0x4(%rax), %rcx
leaq 0x2805f(%rip), %rax     # 0x3dc00
cmpl $0x3, (%rax,%rcx,4)
je 0x15bb3
movl $0x0, -0x4(%rbp)
jmp 0x15cb7
movq -0x18(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x24(%rbp)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x20(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movslq 0x4(%rax), %rcx
leaq 0x28021(%rip), %rax     # 0x3dc00
cmpl $0x3, (%rax,%rcx,4)
je 0x15bf1
movl $0x0, -0x4(%rbp)
jmp 0x15cb7
movq -0x18(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x18(%rax), %rax
movq 0x18(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpq -0x20(%rbp), %rax
je 0x15c4f
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x10(%rax), %rax
movl 0x4(%rax), %eax
cmpl -0x24(%rbp), %eax
jne 0x15c41
movl $0x0, -0x4(%rbp)
jmp 0x15cb7
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x18(%rbp)
jmp 0x15c1a
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpq -0x20(%rbp), %rax
je 0x15cb0
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x10(%rax), %rax
movl 0x4(%rax), %eax
cmpl -0x28(%rbp), %eax
jne 0x15ca2
movl $0x0, -0x4(%rbp)
jmp 0x15cb7
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x18(%rbp)
jmp 0x15c7b
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopl (%rax)