// File: ATOMIC-LICHESS[P]ATOMKRAFT/uci.cpp
// Function: (anonymous namespace)::go(Position&, std::__cxx11::basic_istringstream<char, std::char_traits<char>, std::allocator<char>>&)
bool go(Position& pos, UCIParser& up) {

    string token;
    SearchLimits limits;
    Move searchMoves[MAX_MOVES], *cur = searchMoves;
    int time[] = { 0, 0 }, inc[] = { 0, 0 };

    while (up >> token)
    {
        if (token == "infinite")
            limits.infinite = true;
        else if (token == "ponder")
            limits.ponder = true;
        else if (token == "wtime")
            up >> time[WHITE];
        else if (token == "btime")
            up >> time[BLACK];
        else if (token == "winc")
            up >> inc[WHITE];
        else if (token == "binc")
            up >> inc[BLACK];
        else if (token == "movestogo")
            up >> limits.movesToGo;
        else if (token == "depth")
            up >> limits.maxDepth;
        else if (token == "nodes")
            up >> limits.maxNodes;
        else if (token == "movetime")
            up >> limits.maxTime;
        else if (token == "searchmoves")
            while (up >> token)
                *cur++ = move_from_uci(pos, token);
    }

    *cur = MOVE_NONE;
    limits.time = time[pos.side_to_move()];
    limits.increment = inc[pos.side_to_move()];

    assert(pos.is_ok());
    NEW Move NEW_bestMove, NEW_ponderMove;
    return think(pos, limits, searchMoves, NEW_bestMove, NEW_ponderMove);
  }

// Assembly:
subq $0x4b8, %rsp            # imm = 0x4B8
movq %rdi, 0x4b0(%rsp)
movq %rsi, 0x4a8(%rsp)
leaq 0x488(%rsp), %rdi
callq 0x6730
leaq 0x46c(%rsp), %rdi
callq 0x11c00
jmp 0x52cc3
leaq 0x50(%rsp), %rax
movq %rax, 0x48(%rsp)
leaq 0x40(%rsp), %rdi
xorl %esi, %esi
movl $0x8, %edx
callq 0x6280
leaq 0x38(%rsp), %rdi
xorl %esi, %esi
movl $0x8, %edx
callq 0x6280
movq 0x4a8(%rsp), %rdi
leaq 0x488(%rsp), %rsi
callq 0x6680
movq %rax, 0x28(%rsp)
jmp 0x52d0b
movq 0x28(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x6670
movb %al, 0x27(%rsp)
jmp 0x52d25
movb 0x27(%rsp), %al
testb $0x1, %al
jne 0x52d32
jmp 0x53063
leaq 0x9158(%rip), %rsi      # 0x5be91
leaq 0x488(%rsp), %rdi
callq 0x28180
movb %al, 0x26(%rsp)
jmp 0x52d4c
movb 0x26(%rsp), %al
testb $0x1, %al
jne 0x52d56
jmp 0x52d89
movb $0x1, 0x484(%rsp)
jmp 0x5305e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x460(%rsp)
movl %eax, 0x45c(%rsp)
leaq 0x488(%rsp), %rdi
callq 0x6a78
jmp 0x530e7
leaq 0x910a(%rip), %rsi      # 0x5be9a
leaq 0x488(%rsp), %rdi
callq 0x28180
movb %al, 0x25(%rsp)
jmp 0x52da3
movb 0x25(%rsp), %al
testb $0x1, %al
jne 0x52dad
jmp 0x52dba
movb $0x1, 0x485(%rsp)
jmp 0x5305c
leaq 0x90e0(%rip), %rsi      # 0x5bea1
leaq 0x488(%rsp), %rdi
callq 0x28180
movb %al, 0x24(%rsp)
jmp 0x52dd4
movb 0x24(%rsp), %al
testb $0x1, %al
jne 0x52dde
jmp 0x52df7
movq 0x4a8(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x62c0
jmp 0x52df2
jmp 0x5305a
leaq 0x90a9(%rip), %rsi      # 0x5bea7
leaq 0x488(%rsp), %rdi
callq 0x28180
movb %al, 0x23(%rsp)
jmp 0x52e11
movb 0x23(%rsp), %al
testb $0x1, %al
jne 0x52e1b
jmp 0x52e34
movq 0x4a8(%rsp), %rdi
leaq 0x44(%rsp), %rsi
callq 0x62c0
jmp 0x52e2f
jmp 0x53058
leaq 0x9072(%rip), %rsi      # 0x5bead
leaq 0x488(%rsp), %rdi
callq 0x28180
movb %al, 0x22(%rsp)
jmp 0x52e4e
movb 0x22(%rsp), %al
testb $0x1, %al
jne 0x52e58
jmp 0x52e71
movq 0x4a8(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x62c0
jmp 0x52e6c
jmp 0x53056
leaq 0x903a(%rip), %rsi      # 0x5beb2
leaq 0x488(%rsp), %rdi
callq 0x28180
movb %al, 0x21(%rsp)
jmp 0x52e8b
movb 0x21(%rsp), %al
testb $0x1, %al
jne 0x52e95
jmp 0x52eae
movq 0x4a8(%rsp), %rdi
leaq 0x3c(%rsp), %rsi
callq 0x62c0
jmp 0x52ea9
jmp 0x53054
leaq 0x9002(%rip), %rsi      # 0x5beb7
leaq 0x488(%rsp), %rdi
callq 0x28180
movb %al, 0x20(%rsp)
jmp 0x52ec8
movb 0x20(%rsp), %al
testb $0x1, %al
jne 0x52ed2
jmp 0x52eee
movq 0x4a8(%rsp), %rdi
leaq 0x474(%rsp), %rsi
callq 0x62c0
jmp 0x52ee9
jmp 0x53052
leaq 0x8fcc(%rip), %rsi      # 0x5bec1
leaq 0x488(%rsp), %rdi
callq 0x28180
movb %al, 0x1f(%rsp)
jmp 0x52f08
movb 0x1f(%rsp), %al
testb $0x1, %al
jne 0x52f12
jmp 0x52f2e
movq 0x4a8(%rsp), %rdi
leaq 0x47c(%rsp), %rsi
callq 0x62c0
jmp 0x52f29
jmp 0x53050
leaq 0x8f92(%rip), %rsi      # 0x5bec7
leaq 0x488(%rsp), %rdi
callq 0x28180
movb %al, 0x1e(%rsp)
jmp 0x52f48
movb 0x1e(%rsp), %al
testb $0x1, %al
jne 0x52f52
jmp 0x52f6e
movq 0x4a8(%rsp), %rdi
leaq 0x480(%rsp), %rsi
callq 0x62c0
jmp 0x52f69
jmp 0x5304e
leaq 0x8f58(%rip), %rsi      # 0x5becd
leaq 0x488(%rsp), %rdi
callq 0x28180
movb %al, 0x1d(%rsp)
jmp 0x52f88
movb 0x1d(%rsp), %al
testb $0x1, %al
jne 0x52f92
jmp 0x52fae
movq 0x4a8(%rsp), %rdi
leaq 0x478(%rsp), %rsi
callq 0x62c0
jmp 0x52fa9
jmp 0x5304c
leaq 0x8f21(%rip), %rsi      # 0x5bed6
leaq 0x488(%rsp), %rdi
callq 0x28180
movb %al, 0x1c(%rsp)
jmp 0x52fc8
movb 0x1c(%rsp), %al
testb $0x1, %al
jne 0x52fd2
jmp 0x5304a
jmp 0x52fd4
movq 0x4a8(%rsp), %rdi
leaq 0x488(%rsp), %rsi
callq 0x6680
movq %rax, 0x10(%rsp)
jmp 0x52ff0
movq 0x10(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x6670
movb %al, 0xf(%rsp)
jmp 0x5300a
movb 0xf(%rsp), %al
testb $0x1, %al
jne 0x53014
jmp 0x53048
movq 0x4b0(%rsp), %rdi
leaq 0x488(%rsp), %rsi
callq 0x2cdf0
movl %eax, 0x8(%rsp)
jmp 0x5302f
movl 0x8(%rsp), %ecx
movq 0x48(%rsp), %rax
movq %rax, %rdx
addq $0x4, %rdx
movq %rdx, 0x48(%rsp)
movl %ecx, (%rax)
jmp 0x52fd4
jmp 0x5304a
jmp 0x5304c
jmp 0x5304e
jmp 0x53050
jmp 0x53052
jmp 0x53054
jmp 0x53056
jmp 0x53058
jmp 0x5305a
jmp 0x5305c
jmp 0x5305e
jmp 0x52cef
movq 0x48(%rsp), %rax
movl $0x0, (%rax)
movq 0x4b0(%rsp), %rdi
callq 0xf5d0
movl %eax, %eax
movl 0x40(%rsp,%rax,4), %eax
movl %eax, 0x46c(%rsp)
movq 0x4b0(%rsp), %rdi
callq 0xf5d0
movl %eax, %eax
movl 0x38(%rsp,%rax,4), %eax
movl %eax, 0x470(%rsp)
movq 0x4b0(%rsp), %rdi
leaq 0x46c(%rsp), %rsi
leaq 0x50(%rsp), %rdx
leaq 0x34(%rsp), %rcx
leaq 0x30(%rsp), %r8
callq 0x40bb0
movb %al, 0x7(%rsp)
jmp 0x530cc
leaq 0x488(%rsp), %rdi
callq 0x6a78
movb 0x7(%rsp), %al
andb $0x1, %al
addq $0x4b8, %rsp            # imm = 0x4B8
retq
movq 0x460(%rsp), %rdi
callq 0x6970
nopw %cs:(%rax,%rax)