// File: /workspace/github_cpp_makefile_star2_O3/SethKasmann[P]clever-girl/src/uci.cpp
// Function: go(std::__cxx11::basic_istringstream<char, std::char_traits<char>, std::allocator<char>>&, State&)
void go(std::istringstream & is, State & s)
{
    std::string token;
    SearchInfo search_info;
    Move m;

    while (is >> token)
    {
        if (token == "searchmoves")
        {
            while (is >> token)
            {
                m = get_uci_move(token, s);
                if (m != nullMove)
                    search_info.sm.push_back(m);
                else
                {
                    std::cout << "illegal move found: " << token << '\n';
                    return;
                }
            }
        }
        else if (token == "ponder")
            search_info.ponder = true;
        else if (token == "wtime")
            is >> search_info.time[white];
        else if (token == "btime")
            is >> search_info.time[black];
        else if (token == "winc")
            is >> search_info.inc[white];
        else if (token == "binc")
            is >> search_info.inc[black];
        else if (token == "movestogo")
            is >> search_info.moves_to_go;
        else if (token == "depth")
            is >> search_info.depth;
        else if (token == "nodes")
            is >> search_info.max_nodes;
        else if (token == "mate")
            is >> search_info.mate;
        else if (token == "movetime")
            is >> search_info.moveTime;
        else if (token == "infinite")
            search_info.infinite = true;
    }

    search_info.clock.set();
    if (!search_info.moveTime)
        search_info.moveTime = allocate_time(search_info.time[s.getOurColor()], 
                                              history.size() / 2, 
                                              search_info.moves_to_go);
    setup_search(s, search_info);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x78(%rsp), %rcx
movq %rcx, -0x10(%rcx)
xorl %eax, %eax
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x24(%rsp), %rdx
xorps %xmm0, %xmm0
movaps %xmm0, -0x14(%rdx)
movabsq $0x3200000000, %rcx     # imm = 0x3200000000
movq %rcx, -0x4(%rdx)
leaq 0x20(%rsp), %rcx
movq %rax, 0xc(%rcx)
leaq 0x38(%rsp), %rcx
movb %al, 0x12(%rcx)
leaq 0x50(%rsp), %r12
movaps %xmm0, (%r12)
movq %rax, 0x10(%r12)
movups %xmm0, -0x18(%r12)
movb %al, -0x8(%r12)
leaq 0x68(%rsp), %r13
leaq 0x6fca(%rip), %rbp      # 0x203c8
leaq 0xc(%rsp), %r15
movq %r14, %rdi
movq %r13, %rsi
callq 0x42b0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x1966b
movq %r13, %rdi
movq %rbp, %rsi
callq 0x4090
testl %eax, %eax
je 0x1959c
movq %r13, %rdi
leaq 0x6fac(%rip), %rsi      # 0x203e9
callq 0x4090
testl %eax, %eax
je 0x195c7
movq %r13, %rdi
leaq 0x6f9c(%rip), %rsi      # 0x203f0
callq 0x4090
leaq 0x10(%rsp), %rsi
testl %eax, %eax
je 0x195ba
movq %r13, %rdi
leaq 0x6f86(%rip), %rsi      # 0x203f6
callq 0x4090
leaq 0x14(%rsp), %rsi
testl %eax, %eax
je 0x195ba
movq %r13, %rdi
leaq 0x6f70(%rip), %rsi      # 0x203fc
callq 0x4090
leaq 0x18(%rsp), %rsi
testl %eax, %eax
je 0x195ba
movq %r13, %rdi
leaq 0x6f59(%rip), %rsi      # 0x20401
callq 0x4090
leaq 0x1c(%rsp), %rsi
testl %eax, %eax
je 0x195ba
movq %r13, %rdi
leaq 0x6f42(%rip), %rsi      # 0x20406
callq 0x4090
leaq 0x20(%rsp), %rsi
testl %eax, %eax
je 0x195ba
movq %r13, %rdi
leaq 0x6f30(%rip), %rsi      # 0x20410
callq 0x4090
leaq 0x24(%rsp), %rsi
testl %eax, %eax
je 0x195ba
movq %r13, %rdi
leaq 0x6f1a(%rip), %rsi      # 0x20416
callq 0x4090
leaq 0x28(%rsp), %rsi
testl %eax, %eax
je 0x195ba
movq %r13, %rdi
leaq 0x6f04(%rip), %rsi      # 0x2041c
callq 0x4090
leaq 0x34(%rsp), %rsi
testl %eax, %eax
je 0x195ba
movq %r13, %rdi
leaq 0x6eed(%rip), %rsi      # 0x20421
callq 0x4090
testl %eax, %eax
je 0x195d1
movq %r13, %rdi
leaq 0x6edf(%rip), %rsi      # 0x2042a
callq 0x4090
testl %eax, %eax
jne 0x19403
movb $0x1, 0x48(%rsp)
jmp 0x19403
movq %r13, %rdi
movq %rbx, %rsi
callq 0x19254
movw %ax, 0xc(%rsp)
testw %ax, %ax
je 0x195e3
movq 0x58(%rsp), %rsi
cmpq 0x60(%rsp), %rsi
je 0x19591
movw %ax, (%rsi)
addq $0x2, %rsi
movq %rsi, 0x58(%rsp)
jmp 0x1959c
movq %r12, %rdi
movq %r15, %rdx
callq 0x1a1d8
movq %r14, %rdi
movq %r13, %rsi
callq 0x42b0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
je 0x19562
jmp 0x19403
movq %r14, %rdi
callq 0x4140
jmp 0x19403
movb $0x1, 0x49(%rsp)
jmp 0x19403
movq %r14, %rdi
leaq 0x38(%rsp), %rsi
callq 0x4260
jmp 0x19403
movq 0xb9b6(%rip), %rdi      # 0x24fa0
leaq 0x6de3(%rip), %rsi      # 0x203d4
movl $0x14, %edx
callq 0x4290
movq 0x68(%rsp), %rsi
movq 0x70(%rsp), %rdx
movq 0xb994(%rip), %rdi      # 0x24fa0
callq 0x4290
leaq 0xf(%rsp), %rsi
movb $0xa, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x4290
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x1963d
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x4250
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x19659
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x4250
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x4060
movq %rax, 0x40(%rsp)
cmpq $0x0, 0x38(%rsp)
jne 0x196ed
movl (%rbx), %eax
leaq 0x14101a(%rip), %rcx    # 0x15a6a0
movq 0x8(%rcx), %rdx
subq (%rcx), %rdx
shrq $0x5, %rdx
movl 0x20(%rsp), %ecx
cmpl $0xa, %edx
movl $0xa, %esi
cmovll %edx, %esi
xorps %xmm0, %xmm0
cvtsi2sd %esi, %xmm0
divsd 0x6d09(%rip), %xmm0     # 0x203b8
addsd 0x6d09(%rip), %xmm0     # 0x203c0
cvtsd2ss %xmm0, %xmm0
testl %ecx, %ecx
movl $0x1e, %esi
cmovnel %ecx, %esi
movl 0x10(%rsp,%rax,4), %eax
cltd
idivl %esi
cvtsi2ss %eax, %xmm1
mulss %xmm0, %xmm1
cvttss2si %xmm1, %rax
cmpq $0x1f5, %rax            # imm = 0x1F5
movl $0x1f4, %ecx            # imm = 0x1F4
cmovgeq %rax, %rcx
movq %rcx, 0x38(%rsp)
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x16234
jmp 0x19626
jmp 0x19703
jmp 0x19703
movq %rax, %rbx
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x1971d
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x4250
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x19739
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x4250
movq %rbx, %rdi
callq 0x43b0