// File: Kei18[P]pibt/./src/solver/tp.cpp
// Function: TP::getExecutableTask(Agent*, int)
std::vector<Task*> TP::getExecutableTask(Agent* a, int timestep) {
  std::vector<Task*> tasks;
  Nodes gs;
  bool notContained;
  Node* v = a->getNode();
  Node* u;

  for (auto tau : P->getT()) {
    notContained = true;
    for (auto path : paths) {
      u = path[path.size() - 1];  // end of the path
      if (u == v) continue;
      gs = tau->getG();
      notContained &= std::none_of(gs.begin(), gs.end(),
                                   [u] (Node* k) { return u == k; });
      if (!notContained) break;
    }
    if (notContained) tasks.push_back(tau);
  }

  return tasks;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %rdi, -0x120(%rbp)
movq %rdi, %rax
movq %rax, -0x118(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x110(%rbp)
movb $0x0, -0x1d(%rbp)
callq 0xdb20
leaq -0x38(%rbp), %rdi
callq 0x3e880
movq -0x18(%rbp), %rdi
callq 0x51cb0
movq %rax, -0x108(%rbp)
jmp 0xa0eda
movq -0x110(%rbp), %rax
movq -0x108(%rbp), %rcx
movq %rcx, -0x48(%rbp)
movq 0x10(%rax), %rsi
leaq -0x80(%rbp), %rdi
callq 0x8bb10
jmp 0xa0efb
leaq -0x80(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rdi
callq 0x3a140
movq %rax, -0x88(%rbp)
movq -0x68(%rbp), %rdi
callq 0x39fd0
movq %rax, -0x90(%rbp)
leaq -0x88(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x51e40
testb $0x1, %al
jne 0xa0f63
movl $0x2, -0x94(%rbp)
leaq -0x80(%rbp), %rdi
callq 0xdd90
jmp 0xa11a6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0xa11c5
leaq -0x88(%rbp), %rdi
callq 0x51e80
movq %rax, %rcx
movq -0x110(%rbp), %rax
movq (%rcx), %rcx
movq %rcx, -0xa0(%rbp)
movb $0x1, -0x39(%rbp)
addq $0x88, %rax
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rdi
callq 0x377e0
movq %rax, -0xb0(%rbp)
movq -0xa8(%rbp), %rdi
callq 0x37500
movq %rax, -0xb8(%rbp)
leaq -0xb0(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x4e640
testb $0x1, %al
jne 0xa0fd6
jmp 0xa116b
leaq -0xb0(%rbp), %rdi
callq 0x37d00
movq %rax, %rsi
leaq -0xd0(%rbp), %rdi
callq 0x3aff0
jmp 0xa0ff3
leaq -0xd0(%rbp), %rdi
callq 0x3b0e0
movq %rax, %rsi
subq $0x1, %rsi
leaq -0xd0(%rbp), %rdi
callq 0xda90
movq (%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
cmpq -0x48(%rbp), %rax
jne 0xa1043
movl $0x5, -0x94(%rbp)
jmp 0xa112b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0xa119b
movq -0xa0(%rbp), %rsi
leaq -0xe8(%rbp), %rdi
callq 0x51d30
jmp 0xa1058
leaq -0x38(%rbp), %rdi
movq %rdi, -0x130(%rbp)
leaq -0xe8(%rbp), %rsi
movq %rsi, -0x138(%rbp)
callq 0x3f230
movq -0x138(%rbp), %rdi
callq 0xd7d0
movq -0x130(%rbp), %rdi
callq 0x3b730
movq -0x130(%rbp), %rdi
movq %rax, -0xf0(%rbp)
callq 0x3b760
movq %rax, -0xf8(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x100(%rbp)
movq -0xf0(%rbp), %rdi
movq -0xf8(%rbp), %rsi
movq -0x100(%rbp), %rdx
callq 0xa3d10
movb %al, -0x121(%rbp)
jmp 0xa10d5
movb -0x121(%rbp), %al
andb $0x1, %al
movzbl %al, %ecx
movb -0x39(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
andl %ecx, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, -0x39(%rbp)
testb $0x1, -0x39(%rbp)
jne 0xa1121
movl $0x4, -0x94(%rbp)
jmp 0xa112b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0xd7d0
jmp 0xa119b
movl $0x0, -0x94(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0xd7d0
movl -0x94(%rbp), %eax
movl %eax, -0x13c(%rbp)
testl %eax, %eax
je 0xa1158
jmp 0xa1149
movl -0x13c(%rbp), %eax
subl $0x4, %eax
je 0xa116b
jmp 0xa1156
jmp 0xa115a
jmp 0xa115a
leaq -0xb0(%rbp), %rdi
callq 0x4e750
jmp 0xa0fba
testb $0x1, -0x39(%rbp)
je 0xa1188
movq -0x120(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0xdb40
jmp 0xa1186
jmp 0xa1188
jmp 0xa118a
leaq -0x88(%rbp), %rdi
callq 0x51ea0
jmp 0xa0f23
leaq -0x80(%rbp), %rdi
callq 0xdd90
jmp 0xa11c5
movb $0x1, -0x1d(%rbp)
movl $0x1, -0x94(%rbp)
leaq -0x38(%rbp), %rdi
callq 0xd7d0
testb $0x1, -0x1d(%rbp)
jne 0xa11e8
jmp 0xa11dc
leaq -0x38(%rbp), %rdi
callq 0xd7d0
movq -0x120(%rbp), %rdi
callq 0xdd90
jmp 0xa11f8
movq -0x120(%rbp), %rdi
callq 0xdd90
movq -0x118(%rbp), %rax
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
movq -0x50(%rbp), %rdi
callq 0x8880
nopw %cs:(%rax,%rax)