// File: hantaoyin[P]ffxiv-crafting-mcts/ffxiv-crafting-mcts.C
// Function: State::CanExecuteAction(Action) const
bool CanExecuteAction(Action ac) const {
    if (!IsActionSupported(ac)) {
      return false;
    }
    const ActionParams& ac_effect = ALL_ACTIONS[Action2ID(ac)];
    if (cp + ac_effect.d_cp < 0) {
      return false;
    }
    // Action specific checks.
    switch (ac) {
    case Action::TricksOfTheTrade:
    case Action::PreciseTouch:
    case Action::IntensiveSynthesis:
      return condition == Condition::Good || condition == Condition::Excellent;
    case Action::ByregotsBlessing:
      return inner_quiet > 1;
    case Action::FinalAppraisal:
      return buff[Buff2ID(Buff::FinalAppraisal)] == 0;
    case Action::InnerQuiet:
      return inner_quiet == 0;
    case Action::Innovation:
      return buff[Buff2ID(Buff::Innovation)] == 0;
    case Action::MuscleMemory:
    case Action::Reflect:
      return buff[Buff2ID(Buff::FirstStep)] > 0;
    case Action::PrudentTouch:
      return buff[Buff2ID(Buff::WasteNot)] == 0;
    default:
      return true;
    }
  }

// Assembly:
subq $0x58, %rsp
movb %sil, %al
movq %rdi, 0x48(%rsp)
movb %al, 0x47(%rsp)
movq 0x48(%rsp), %rdi
movq %rdi, 0x30(%rsp)
movzbl 0x47(%rsp), %esi
callq 0xbe30
testb $0x1, %al
jne 0xaf72
movb $0x0, 0x57(%rsp)
jmp 0xb129
movzbl 0x47(%rsp), %edi
callq 0x2740
movzbl %al, %eax
movl %eax, %esi
leaq 0x10b38(%rip), %rdi     # 0x1bac0
callq 0x2710
movq %rax, %rcx
movq 0x30(%rsp), %rax
movq %rcx, 0x38(%rsp)
movswl (%rax), %eax
movq 0x38(%rsp), %rcx
movsbl 0x8(%rcx), %ecx
addl %ecx, %eax
cmpl $0x0, %eax
jge 0xafb7
movb $0x0, 0x57(%rsp)
jmp 0xb129
movb 0x47(%rsp), %al
addb $-0x2, %al
movzbl %al, %ecx
movq %rcx, 0x28(%rsp)
subb $0x18, %al
ja 0xb124
movq 0x28(%rsp), %rax
leaq 0x8193(%rip), %rcx      # 0x1316c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x30(%rsp), %rcx
movb $0x1, %al
cmpb $0x1, 0x9(%rcx)
movb %al, 0x27(%rsp)
je 0xb003
movq 0x30(%rsp), %rax
cmpb $0x2, 0x9(%rax)
sete %al
movb %al, 0x27(%rsp)
movb 0x27(%rsp), %al
andb $0x1, %al
movb %al, 0x57(%rsp)
jmp 0xb129
movq 0x30(%rsp), %rax
movzbl 0x8(%rax), %eax
cmpl $0x1, %eax
setg %al
andb $0x1, %al
movb %al, 0x57(%rsp)
jmp 0xb129
movq 0x30(%rsp), %rax
addq $0xa, %rax
movq %rax, 0x18(%rsp)
movl $0x8, %edi
callq 0x6b30
movq 0x18(%rsp), %rdi
movzbl %al, %eax
movl %eax, %esi
callq 0xb600
movzbl (%rax), %eax
cmpl $0x0, %eax
sete %al
andb $0x1, %al
movb %al, 0x57(%rsp)
jmp 0xb129
movq 0x30(%rsp), %rax
movzbl 0x8(%rax), %eax
cmpl $0x0, %eax
sete %al
andb $0x1, %al
movb %al, 0x57(%rsp)
jmp 0xb129
movq 0x30(%rsp), %rax
addq $0xa, %rax
movq %rax, 0x10(%rsp)
movl $0x2, %edi
callq 0x6b30
movq 0x10(%rsp), %rdi
movzbl %al, %eax
movl %eax, %esi
callq 0xb600
movzbl (%rax), %eax
cmpl $0x0, %eax
sete %al
andb $0x1, %al
movb %al, 0x57(%rsp)
jmp 0xb129
movq 0x30(%rsp), %rax
addq $0xa, %rax
movq %rax, 0x8(%rsp)
xorl %edi, %edi
callq 0x6b30
movq 0x8(%rsp), %rdi
movzbl %al, %eax
movl %eax, %esi
callq 0xb600
movzbl (%rax), %eax
cmpl $0x0, %eax
setg %al
andb $0x1, %al
movb %al, 0x57(%rsp)
jmp 0xb129
movq 0x30(%rsp), %rax
addq $0xa, %rax
movq %rax, (%rsp)
movl $0x5, %edi
callq 0x6b30
movq (%rsp), %rdi
movzbl %al, %eax
movl %eax, %esi
callq 0xb600
movzbl (%rax), %eax
cmpl $0x0, %eax
sete %al
andb $0x1, %al
movb %al, 0x57(%rsp)
jmp 0xb129
movb $0x1, 0x57(%rsp)
movb 0x57(%rsp), %al
andb $0x1, %al
addq $0x58, %rsp
retq
nopw %cs:(%rax,%rax)
nop