// File: Rubenmp[P]Rubik/src/defineRubik.cpp
// Function: Rubik::logicErrors() const
int Rubik::logicErrors() const{
   int valid = 0;
   int vector[7] = {0};

   // Center
   ++vector[equivalentNumber(center[0].center)];
   ++vector[equivalentNumber(center[1].center)];
   ++vector[equivalentNumber(center[2].center)];
   ++vector[equivalentNumber(center[3].center)];
   ++vector[equivalentNumber(center[4].center)];
   ++vector[equivalentNumber(center[5].center)];
   for (int i=1; i<7; ++i){
      if (vector[i] != 1)
	      valid = -1;
   }

   // Edge
   if (valid != -1){
      ++vector[equivalentNumber(edge[0].up)];
      ++vector[equivalentNumber(edge[0].down)];
      ++vector[equivalentNumber(edge[1].up)];
      ++vector[equivalentNumber(edge[1].down)];
      ++vector[equivalentNumber(edge[2].up)];
      ++vector[equivalentNumber(edge[2].down)];
      ++vector[equivalentNumber(edge[3].up)];
      ++vector[equivalentNumber(edge[3].down)];
      ++vector[equivalentNumber(edge[4].up)];
      ++vector[equivalentNumber(edge[4].down)];
      ++vector[equivalentNumber(edge[5].up)];
      ++vector[equivalentNumber(edge[5].down)];
      ++vector[equivalentNumber(edge[6].up)];
      ++vector[equivalentNumber(edge[6].down)];
      ++vector[equivalentNumber(edge[7].up)];
      ++vector[equivalentNumber(edge[7].down)];
      ++vector[equivalentNumber(edge[8].up)];
      ++vector[equivalentNumber(edge[8].down)];
      ++vector[equivalentNumber(edge[9].up)];
      ++vector[equivalentNumber(edge[9].down)];
      ++vector[equivalentNumber(edge[10].up)];
      ++vector[equivalentNumber(edge[10].down)];
      ++vector[equivalentNumber(edge[11].up)];
      ++vector[equivalentNumber(edge[11].down)];
   
      for (int i=1; i<7; ++i){
        if (vector[i] != 5)
          valid = -2;
      }
   }
   
   // Corners
   if ( (valid != -1) && (valid != -2) ){
      ++vector[equivalentNumber(corner[0].left)];
      ++vector[equivalentNumber(corner[0].right)];
      ++vector[equivalentNumber(corner[0].up)];
      ++vector[equivalentNumber(corner[1].left)];
      ++vector[equivalentNumber(corner[1].right)];
      ++vector[equivalentNumber(corner[1].up)];
      ++vector[equivalentNumber(corner[2].left)];
      ++vector[equivalentNumber(corner[2].right)];
      ++vector[equivalentNumber(corner[2].up)];
      ++vector[equivalentNumber(corner[3].left)];
      ++vector[equivalentNumber(corner[3].right)];
      ++vector[equivalentNumber(corner[3].up)];
      ++vector[equivalentNumber(corner[4].left)];
      ++vector[equivalentNumber(corner[4].right)];
      ++vector[equivalentNumber(corner[4].up)];
      ++vector[equivalentNumber(corner[5].left)];
      ++vector[equivalentNumber(corner[5].right)];
      ++vector[equivalentNumber(corner[5].up)];
      ++vector[equivalentNumber(corner[6].left)];
      ++vector[equivalentNumber(corner[6].right)];
      ++vector[equivalentNumber(corner[6].up)];
      ++vector[equivalentNumber(corner[7].left)];
      ++vector[equivalentNumber(corner[7].right)];
      ++vector[equivalentNumber(corner[7].up)];
   
      for (int i=1; i<7; ++i){
        if (vector[i] != 9)
          valid = -3;
      }
   }
   
   return valid;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x48(%rbp)
movl $0x0, -0xc(%rbp)
leaq -0x30(%rbp), %rdi
xorl %esi, %esi
movl $0x1c, %edx
callq 0x2120
movq -0x48(%rbp), %rsi
movq %rsi, %rdi
callq 0x41f0
movq -0x48(%rbp), %rdi
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movq %rdi, %rsi
addq $0x1, %rsi
callq 0x41f0
movq -0x48(%rbp), %rdi
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movq %rdi, %rsi
addq $0x2, %rsi
callq 0x41f0
movq -0x48(%rbp), %rdi
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movq %rdi, %rsi
addq $0x3, %rsi
callq 0x41f0
movq -0x48(%rbp), %rdi
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movq %rdi, %rsi
addq $0x4, %rsi
callq 0x41f0
movq -0x48(%rbp), %rdi
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movq %rdi, %rsi
addq $0x5, %rsi
callq 0x41f0
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movl $0x1, -0x34(%rbp)
cmpl $0x7, -0x34(%rbp)
jge 0x12391
movslq -0x34(%rbp), %rax
cmpl $0x1, -0x30(%rbp,%rax,4)
je 0x12384
movl $0xffffffff, -0xc(%rbp) # imm = 0xFFFFFFFF
jmp 0x12386
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x1236c
cmpl $-0x1, -0xc(%rbp)
je 0x12709
movq -0x48(%rbp), %rdi
movq %rdi, %rsi
addq $0x6, %rsi
callq 0x41f0
movq -0x48(%rbp), %rdi
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movq %rdi, %rsi
addq $0x6, %rsi
addq $0x1, %rsi
callq 0x41f0
movq -0x48(%rbp), %rdi
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movq %rdi, %rsi
addq $0x6, %rsi
addq $0x2, %rsi
callq 0x41f0
movq -0x48(%rbp), %rdi
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movq %rdi, %rsi
addq $0x6, %rsi
addq $0x2, %rsi
addq $0x1, %rsi
callq 0x41f0
movq -0x48(%rbp), %rdi
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movq %rdi, %rsi
addq $0x6, %rsi
addq $0x4, %rsi
callq 0x41f0
movq -0x48(%rbp), %rdi
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movq %rdi, %rsi
addq $0x6, %rsi
addq $0x4, %rsi
addq $0x1, %rsi
callq 0x41f0
movq -0x48(%rbp), %rdi
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movq %rdi, %rsi
addq $0x6, %rsi
addq $0x6, %rsi
callq 0x41f0
movq -0x48(%rbp), %rdi
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movq %rdi, %rsi
addq $0x6, %rsi
addq $0x6, %rsi
addq $0x1, %rsi
callq 0x41f0
movq -0x48(%rbp), %rdi
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movq %rdi, %rsi
addq $0x6, %rsi
addq $0x8, %rsi
callq 0x41f0
movq -0x48(%rbp), %rdi
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movq %rdi, %rsi
addq $0x6, %rsi
addq $0x8, %rsi
addq $0x1, %rsi
callq 0x41f0
movq -0x48(%rbp), %rdi
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movq %rdi, %rsi
addq $0x6, %rsi
addq $0xa, %rsi
callq 0x41f0
movq -0x48(%rbp), %rdi
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movq %rdi, %rsi
addq $0x6, %rsi
addq $0xa, %rsi
addq $0x1, %rsi
callq 0x41f0
movq -0x48(%rbp), %rdi
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movq %rdi, %rsi
addq $0x6, %rsi
addq $0xc, %rsi
callq 0x41f0
movq -0x48(%rbp), %rdi
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movq %rdi, %rsi
addq $0x6, %rsi
addq $0xc, %rsi
addq $0x1, %rsi
callq 0x41f0
movq -0x48(%rbp), %rdi
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movq %rdi, %rsi
addq $0x6, %rsi
addq $0xe, %rsi
callq 0x41f0
movq -0x48(%rbp), %rdi
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movq %rdi, %rsi
addq $0x6, %rsi
addq $0xe, %rsi
addq $0x1, %rsi
callq 0x41f0
movq -0x48(%rbp), %rdi
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movq %rdi, %rsi
addq $0x6, %rsi
addq $0x10, %rsi
callq 0x41f0
movq -0x48(%rbp), %rdi
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movq %rdi, %rsi
addq $0x6, %rsi
addq $0x10, %rsi
addq $0x1, %rsi
callq 0x41f0
movq -0x48(%rbp), %rdi
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movq %rdi, %rsi
addq $0x6, %rsi
addq $0x12, %rsi
callq 0x41f0
movq -0x48(%rbp), %rdi
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movq %rdi, %rsi
addq $0x6, %rsi
addq $0x12, %rsi
addq $0x1, %rsi
callq 0x41f0
movq -0x48(%rbp), %rdi
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movq %rdi, %rsi
addq $0x6, %rsi
addq $0x14, %rsi
callq 0x41f0
movq -0x48(%rbp), %rdi
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movq %rdi, %rsi
addq $0x6, %rsi
addq $0x14, %rsi
addq $0x1, %rsi
callq 0x41f0
movq -0x48(%rbp), %rdi
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movq %rdi, %rsi
addq $0x6, %rsi
addq $0x16, %rsi
callq 0x41f0
movq -0x48(%rbp), %rdi
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movq %rdi, %rsi
addq $0x6, %rsi
addq $0x16, %rsi
addq $0x1, %rsi
callq 0x41f0
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movl $0x1, -0x38(%rbp)
cmpl $0x7, -0x38(%rbp)
jge 0x12707
movslq -0x38(%rbp), %rax
cmpl $0x5, -0x30(%rbp,%rax,4)
je 0x126fa
movl $0xfffffffe, -0xc(%rbp) # imm = 0xFFFFFFFE
jmp 0x126fc
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x126e2
jmp 0x12709
cmpl $-0x1, -0xc(%rbp)
je 0x12a97
cmpl $-0x2, -0xc(%rbp)
je 0x12a97
movq -0x48(%rbp), %rdi
movq %rdi, %rsi
addq $0x1e, %rsi
addq $0x1, %rsi
callq 0x41f0
movq -0x48(%rbp), %rdi
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movq %rdi, %rsi
addq $0x1e, %rsi
addq $0x2, %rsi
callq 0x41f0
movq -0x48(%rbp), %rdi
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movq %rdi, %rsi
addq $0x1e, %rsi
callq 0x41f0
movq -0x48(%rbp), %rdi
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movq %rdi, %rsi
addq $0x1e, %rsi
addq $0x3, %rsi
addq $0x1, %rsi
callq 0x41f0
movq -0x48(%rbp), %rdi
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movq %rdi, %rsi
addq $0x1e, %rsi
addq $0x3, %rsi
addq $0x2, %rsi
callq 0x41f0
movq -0x48(%rbp), %rdi
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movq %rdi, %rsi
addq $0x1e, %rsi
addq $0x3, %rsi
callq 0x41f0
movq -0x48(%rbp), %rdi
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movq %rdi, %rsi
addq $0x1e, %rsi
addq $0x6, %rsi
addq $0x1, %rsi
callq 0x41f0
movq -0x48(%rbp), %rdi
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movq %rdi, %rsi
addq $0x1e, %rsi
addq $0x6, %rsi
addq $0x2, %rsi
callq 0x41f0
movq -0x48(%rbp), %rdi
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movq %rdi, %rsi
addq $0x1e, %rsi
addq $0x6, %rsi
callq 0x41f0
movq -0x48(%rbp), %rdi
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movq %rdi, %rsi
addq $0x1e, %rsi
addq $0x9, %rsi
addq $0x1, %rsi
callq 0x41f0
movq -0x48(%rbp), %rdi
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movq %rdi, %rsi
addq $0x1e, %rsi
addq $0x9, %rsi
addq $0x2, %rsi
callq 0x41f0
movq -0x48(%rbp), %rdi
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movq %rdi, %rsi
addq $0x1e, %rsi
addq $0x9, %rsi
callq 0x41f0
movq -0x48(%rbp), %rdi
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movq %rdi, %rsi
addq $0x1e, %rsi
addq $0xc, %rsi
addq $0x1, %rsi
callq 0x41f0
movq -0x48(%rbp), %rdi
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movq %rdi, %rsi
addq $0x1e, %rsi
addq $0xc, %rsi
addq $0x2, %rsi
callq 0x41f0
movq -0x48(%rbp), %rdi
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movq %rdi, %rsi
addq $0x1e, %rsi
addq $0xc, %rsi
callq 0x41f0
movq -0x48(%rbp), %rdi
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movq %rdi, %rsi
addq $0x1e, %rsi
addq $0xf, %rsi
addq $0x1, %rsi
callq 0x41f0
movq -0x48(%rbp), %rdi
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movq %rdi, %rsi
addq $0x1e, %rsi
addq $0xf, %rsi
addq $0x2, %rsi
callq 0x41f0
movq -0x48(%rbp), %rdi
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movq %rdi, %rsi
addq $0x1e, %rsi
addq $0xf, %rsi
callq 0x41f0
movq -0x48(%rbp), %rdi
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movq %rdi, %rsi
addq $0x1e, %rsi
addq $0x12, %rsi
addq $0x1, %rsi
callq 0x41f0
movq -0x48(%rbp), %rdi
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movq %rdi, %rsi
addq $0x1e, %rsi
addq $0x12, %rsi
addq $0x2, %rsi
callq 0x41f0
movq -0x48(%rbp), %rdi
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movq %rdi, %rsi
addq $0x1e, %rsi
addq $0x12, %rsi
callq 0x41f0
movq -0x48(%rbp), %rdi
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movq %rdi, %rsi
addq $0x1e, %rsi
addq $0x15, %rsi
addq $0x1, %rsi
callq 0x41f0
movq -0x48(%rbp), %rdi
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movq %rdi, %rsi
addq $0x1e, %rsi
addq $0x15, %rsi
addq $0x2, %rsi
callq 0x41f0
movq -0x48(%rbp), %rdi
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movq %rdi, %rsi
addq $0x1e, %rsi
addq $0x15, %rsi
callq 0x41f0
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movl $0x1, -0x3c(%rbp)
cmpl $0x7, -0x3c(%rbp)
jge 0x12a95
movslq -0x3c(%rbp), %rax
cmpl $0x9, -0x30(%rbp,%rax,4)
je 0x12a88
movl $0xfffffffd, -0xc(%rbp) # imm = 0xFFFFFFFD
jmp 0x12a8a
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x12a70
jmp 0x12a97
movl -0xc(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq