// File: kobanium[P]Ray/src/util/Command.cpp
// Function: AnalyzeCommand(int, char**)
void
AnalyzeCommand( int argc, char **argv )
{
  int n, size;
  
  for (int i = 1; i < argc; i++){
    n = COMMAND_MAX + 1;
    for (int j = 0; j < COMMAND_MAX; j++){
      if (!strcmp(argv[i], command[j].c_str())){
        n = j;
      }
    }

    switch (n) {
      case COMMAND_PLAYOUT:
        // プレイアウト数固定の探索の設定
        SetPlayout(atoi(argv[++i]));
        SetSearchSetting(SearchTimeStrategy::ConstantPlayoutMode);
        break;
      case COMMAND_TIME:
        // 持ち時間の設定
        SetTime(atof(argv[++i]));
        SetSearchSetting(SearchTimeStrategy::TimeControlMode);
        break;
      case COMMAND_SIZE:
        // 碁盤の大きさの設定
        size = atoi(argv[++i]);
        if (pure_board_size != size &&
            size > 0 && size <= PURE_BOARD_SIZE) {
          SetBoardSize(size);
          SetParameter();
        }
        break;
      case COMMAND_CONST_TIME:
        // 1手あたりの思考時間を固定した探索の設定
        SetConstThinkingTime(atof(argv[++i]));
        SetSearchSetting(SearchTimeStrategy::ConstantTimeMode);
        break;
      case COMMAND_THREAD:
        // 探索スレッド数の設定
        SetThread(atoi(argv[++i]));
        break;
      case COMMAND_KOMI:
        // コミの設定
        SetKomi(atof(argv[++i]));
        break;
      case COMMAND_HANDICAP:
        // 置き石の個数の設定
        SetConstHandicapNum(atoi(argv[++i]));
        SetHandicapNum(0);
        break;
      case COMMAND_REUSE_SUBTREE:
        // 探索結果の再利用の設定
        SetReuseSubtree(true);
        break;
      case COMMAND_PONDERING :
        // 予測読みの設定
        SetReuseSubtree(true);
        SetPonderingMode(true);
        break;
      case COMMAND_TREE_SIZE:
        // UCTのノードの個数の設定
        SetHashSize(static_cast<unsigned int>(atoi(argv[++i])));
        break;
      case COMMAND_SUPERKO:
        // 超劫のh判定の設定
        SetSuperKo(true);
        break;
      case COMMAND_RESIGN_THRESHOLD:
        SetResignThreshold(atof(argv[++i]));
        break;
      case COMMAND_CGOS_MODE:
        SetCaptureAllMode(true);
        break;
      case COMMAND_NO_DEBUG:
        // デバッグメッセージを出力しない設定
        SetDebugMessageMode(false);
        break;
      default:
        for (int j = 0; j < COMMAND_MAX; j++){
          fprintf(stderr, "%-22s : %s\n", command[j].c_str(), errmessage[j].c_str());
        }
        exit(1);
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x1, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x4(%rbp), %eax
jge 0x2cc2f
movl $0xf, -0x14(%rbp)
movl $0x0, -0x20(%rbp)
cmpl $0xe, -0x20(%rbp)
jge 0x2c991
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x38(%rbp)
movslq -0x20(%rbp), %rax
leaq 0xbbbef(%rip), %rdi     # 0xe8550
shlq $0x5, %rax
addq %rax, %rdi
callq 0x71d0
movq -0x38(%rbp), %rdi
movq %rax, %rsi
callq 0x77a0
cmpl $0x0, %eax
jne 0x2c984
movl -0x20(%rbp), %eax
movl %eax, -0x14(%rbp)
jmp 0x2c986
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x2c940
movl -0x14(%rbp), %eax
movq %rax, -0x40(%rbp)
subq $0xd, %rax
ja 0x2cba4
movq -0x40(%rbp), %rax
leaq 0x8039f(%rip), %rcx     # 0xacd4c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x10(%rbp), %rax
movl -0x1c(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, -0x1c(%rbp)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
callq 0x7840
movl %eax, %edi
callq 0x8f080
movl $0x0, -0x24(%rbp)
leaq -0x24(%rbp), %rdi
callq 0x8f040
jmp 0x2cc1f
movq -0x10(%rbp), %rax
movl -0x1c(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, -0x1c(%rbp)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
callq 0x76d0
callq 0x8f120
movl $0x2, -0x28(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x8f040
jmp 0x2cc1f
movq -0x10(%rbp), %rax
movl -0x1c(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, -0x1c(%rbp)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
callq 0x7840
movl %eax, -0x18(%rbp)
leaq 0xbb003(%rip), %rax     # 0xe7a44
movl (%rax), %eax
cmpl -0x18(%rbp), %eax
je 0x2ca61
cmpl $0x0, -0x18(%rbp)
jle 0x2ca61
cmpl $0x13, -0x18(%rbp)
jg 0x2ca61
movl -0x18(%rbp), %edi
callq 0x9b560
callq 0x88eb0
jmp 0x2cc1f
movq -0x10(%rbp), %rax
movl -0x1c(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, -0x1c(%rbp)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
callq 0x76d0
callq 0x8f140
movl $0x1, -0x2c(%rbp)
leaq -0x2c(%rbp), %rdi
callq 0x8f040
jmp 0x2cc1f
movq -0x10(%rbp), %rax
movl -0x1c(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, -0x1c(%rbp)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
callq 0x7840
movl %eax, %edi
callq 0x88e70
jmp 0x2cc1f
movq -0x10(%rbp), %rax
movl -0x1c(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, -0x1c(%rbp)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
callq 0x76d0
callq 0x9bc10
jmp 0x2cc1f
movq -0x10(%rbp), %rax
movl -0x1c(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, -0x1c(%rbp)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
callq 0x7840
movl %eax, %edi
callq 0x9fdc0
xorl %edi, %edi
callq 0x9fde0
jmp 0x2cc1f
movl $0x1, %edi
callq 0x88e90
jmp 0x2cc1f
movl $0x1, %edi
callq 0x88e90
movl $0x1, %edi
callq 0x88e50
jmp 0x2cc1f
movq -0x10(%rbp), %rax
movl -0x1c(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, -0x1c(%rbp)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
callq 0x7840
movl %eax, %edi
callq 0x9f370
jmp 0x2cc1f
movl $0x1, %edi
callq 0x9b540
jmp 0x2cc1f
movq -0x10(%rbp), %rax
movl -0x1c(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, -0x1c(%rbp)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
callq 0x76d0
callq 0x8ec70
jmp 0x2cc1f
movl $0x1, %edi
callq 0x8ec50
jmp 0x2cc1f
xorl %edi, %edi
callq 0x20410
jmp 0x2cc1f
movl $0x0, -0x30(%rbp)
cmpl $0xe, -0x30(%rbp)
jge 0x2cc15
movq 0xba400(%rip), %rax     # 0xe6fb8
movq (%rax), %rax
movq %rax, -0x50(%rbp)
movslq -0x30(%rbp), %rax
leaq 0xbb986(%rip), %rdi     # 0xe8550
shlq $0x5, %rax
addq %rax, %rdi
callq 0x71d0
movq %rax, -0x48(%rbp)
movslq -0x30(%rbp), %rax
leaq 0xbbb2b(%rip), %rdi     # 0xe8710
shlq $0x5, %rax
addq %rax, %rdi
callq 0x71d0
movq -0x50(%rbp), %rdi
movq -0x48(%rbp), %rdx
movq %rax, %rcx
leaq 0x8037f(%rip), %rsi     # 0xacf82
movb $0x0, %al
callq 0x77d0
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x2cbab
movl $0x1, %edi
callq 0x76a0
jmp 0x2cc21
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x2c926
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop