// File: Kei18[P]pibt/./src/solver/winpibt.cpp
// Function: winPIBT::checkValidPath(int, std::vector<Node*, std::allocator<Node*>>&, int, int)
bool winPIBT::checkValidPath(int id, Nodes &path, int t1, int t2) {
  int k;
  Node *v1, *v2;

  for (int j = 1; j < path.size(); ++j) {
    v1 = path[j-1];
    v2 = path[j];
    for (int i = 0; i < A.size(); ++i) {
      if (id == i) continue;

      k = ell(i);
      for (int _t = j + t1 + 1; _t <= t2; ++_t) {
        if (k < _t) break;
        if (PATHS[i][_t] == v2) {  // vertex collision
          return false;
        }
      }

      if (PATHS[i].size() - 1 < j + t1) continue;
      if (PATHS[i][j + t1] == v2) {  // collision
        return false;
      }
      if (v1 == PATHS[i][j + t1] && v2 == PATHS[i][j + t1 - 1]) {
        return false;
      }

    }
  }

  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movl %r8d, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x58(%rbp)
movl $0x1, -0x44(%rbp)
movslq -0x44(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x20(%rbp), %rdi
callq 0x3b0e0
movq %rax, %rcx
movq -0x60(%rbp), %rax
cmpq %rcx, %rax
jae 0xaf625
movq -0x20(%rbp), %rdi
movl -0x44(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0xda90
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rdi
movslq -0x44(%rbp), %rsi
callq 0xda90
movq (%rax), %rax
movq %rax, -0x40(%rbp)
movl $0x0, -0x48(%rbp)
movq -0x58(%rbp), %rdi
movslq -0x48(%rbp), %rax
movq %rax, -0x68(%rbp)
addq $0x20, %rdi
callq 0x383b0
movq %rax, %rcx
movq -0x68(%rbp), %rax
cmpq %rcx, %rax
jae 0xaf615
movl -0x14(%rbp), %eax
cmpl -0x48(%rbp), %eax
jne 0xaf4c3
jmp 0xaf607
movq -0x58(%rbp), %rdi
movl -0x48(%rbp), %esi
callq 0xadc30
movl %eax, -0x2c(%rbp)
movl -0x44(%rbp), %eax
addl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x28(%rbp), %eax
jg 0xaf52c
movl -0x2c(%rbp), %eax
cmpl -0x4c(%rbp), %eax
jge 0xaf4f0
jmp 0xaf52c
movq -0x58(%rbp), %rdi
addq $0x70, %rdi
movslq -0x48(%rbp), %rsi
callq 0xda70
movq %rax, %rdi
movslq -0x4c(%rbp), %rsi
callq 0xda90
movq (%rax), %rax
cmpq -0x40(%rbp), %rax
jne 0xaf51f
movb $0x0, -0x1(%rbp)
jmp 0xaf629
jmp 0xaf521
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0xaf4de
movq -0x58(%rbp), %rdi
addq $0x70, %rdi
movslq -0x48(%rbp), %rsi
callq 0xda70
movq %rax, %rdi
callq 0x3b0e0
subq $0x1, %rax
movl -0x44(%rbp), %ecx
addl -0x24(%rbp), %ecx
movslq %ecx, %rcx
cmpq %rcx, %rax
jae 0xaf55c
jmp 0xaf607
movq -0x58(%rbp), %rdi
addq $0x70, %rdi
movslq -0x48(%rbp), %rsi
callq 0xda70
movq %rax, %rdi
movl -0x44(%rbp), %eax
addl -0x24(%rbp), %eax
movslq %eax, %rsi
callq 0xda90
movq (%rax), %rax
cmpq -0x40(%rbp), %rax
jne 0xaf590
movb $0x0, -0x1(%rbp)
jmp 0xaf629
movq -0x58(%rbp), %rdi
movq -0x38(%rbp), %rax
movq %rax, -0x70(%rbp)
addq $0x70, %rdi
movslq -0x48(%rbp), %rsi
callq 0xda70
movq %rax, %rdi
movl -0x44(%rbp), %eax
addl -0x24(%rbp), %eax
movslq %eax, %rsi
callq 0xda90
movq %rax, %rcx
movq -0x70(%rbp), %rax
cmpq (%rcx), %rax
jne 0xaf605
movq -0x58(%rbp), %rdi
movq -0x40(%rbp), %rax
movq %rax, -0x78(%rbp)
addq $0x70, %rdi
movslq -0x48(%rbp), %rsi
callq 0xda70
movq %rax, %rdi
movl -0x44(%rbp), %eax
addl -0x24(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0xda90
movq %rax, %rcx
movq -0x78(%rbp), %rax
cmpq (%rcx), %rax
jne 0xaf605
movb $0x0, -0x1(%rbp)
jmp 0xaf629
jmp 0xaf607
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0xaf491
jmp 0xaf617
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0xaf43c
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x80, %rsp
popq %rbp
retq
nopw (%rax,%rax)