// File: /workspace/github_cpp_makefile_star2_O3/bjohnsonfl[P]Overhead-Chess-Engine-/UCI.cpp
// Function: UCI::parseGo(std::__cxx11::basic_istringstream<char, std::char_traits<char>, std::allocator<char>>&)
void UCI::parseGo(std::istringstream &stream)
{
    std::string token = "";
    while(stream >> token){
    
        if(token == "wtime") {
            stream >> token;
            wTime = std::stoi(token);
        }
        else if (token == "btime"){
            stream >> token;
            bTime = std::stoi(token);
        }
        else if (token == "winc"){
            stream >> token;
            wInc = std::stoi(token);
        }
        else if (token == "binc"){
            stream >> token;
            bInc = std::stoi(token);
        }
        else if (token == "depth"){
            stream >> token;
            depth = std::stoi(token);
        }
        else if (token == "movetime"){
            stream >> token;
            moveTime = std::stoi(token);
        }
        else if (token == "perft"){
            stream >> token;
            bitboard nodes = 0;
            clock_t t;
            std::cout <<"Starting Perft... \n\n";
            t = clock();
            nodes= perftDivide(5, pos);
            t = clock() - t;
            logFile.open("log.txt",std::ofstream::app);
            std::cout << "nodes = " << nodes << " seconds: " << float(t)/CLOCKS_PER_SEC << std::endl;
            std::cout << "totalNodes = " << pos.get_nodes() << "\n";
            logFile << "nodes = " << nodes << " seconds: " << float(t)/CLOCKS_PER_SEC << std::endl;
            logFile.close();
            
        }
    }
    
    //search
    pos.reset_nodes();
    clock_t t;
    t= clock();
    rootSearch(pos);
    t = clock() - t;
    std::cout << "bestmove " << moveToString(pos.bestMove) << "\n";
   std::cout << "nodes = " << pos.get_nodes() << " seconds: " << float(t)/CLOCKS_PER_SEC << std::endl;
    int nps = pos.get_nodes() / (float(t)/CLOCKS_PER_SEC);
    int k = 1;
    if( (pos.get_material(white) + pos.get_material(black)) >= gamePhaseCutoff) k = 0;
    std::cout << "info score cp "<<valueee<<" nodes " << pos.get_nodes() << " nps " << nps << " string " << k << "\n";
   ;
    
    int totalstates = totalState(pos.get_returnState());
    std::cout << " totalstates: " <<totalstates << "\n";
    
    
    logFile.open("log.txt" , std::ofstream::app);
    logFile << "info score cp "<<valueee<<" nodes " << pos.get_nodes() << " nps " << nps << " string " << k << " totalstates: " <<totalstates <<"\n";
    logFile << "/////////////////////// \n";
    
    
    logFile.close();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rsi, %r15
movq %rdi, %r14
leaq 0x50(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x170a(%rip), %rdx      # 0x840a
leaq 0x40(%rsp), %r13
movq %r13, %rdi
movq %rdx, %rsi
callq 0x4592
leaq 0x18(%r14), %rax
movq %rax, 0x18(%rsp)
leaq 0x1b0(%r14), %rax
movq %rax, 0x8(%rsp)
movq %r15, %rdi
movq %r13, %rsi
callq 0x2190
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x7233
movq %r13, %rdi
leaq 0x1865(%rip), %rsi      # 0x85b1
callq 0x2070
testl %eax, %eax
je 0x6f8e
movq %r13, %rdi
leaq 0x1854(%rip), %rsi      # 0x85b7
callq 0x2070
testl %eax, %eax
je 0x6ffe
movq %r13, %rdi
leaq 0x1843(%rip), %rsi      # 0x85bd
callq 0x2070
testl %eax, %eax
je 0x706f
movq %r13, %rdi
leaq 0x1831(%rip), %rsi      # 0x85c2
callq 0x2070
testl %eax, %eax
je 0x70e0
movq %r13, %rdi
leaq 0x181f(%rip), %rsi      # 0x85c7
callq 0x2070
testl %eax, %eax
je 0x7151
movq %r13, %rdi
leaq 0x180e(%rip), %rsi      # 0x85cd
callq 0x2070
testl %eax, %eax
je 0x71c2
movq %r13, %rdi
leaq 0x1800(%rip), %rsi      # 0x85d6
callq 0x2070
testl %eax, %eax
jne 0x6d25
movq %r15, %rdi
movq %r13, %rsi
callq 0x2190
movl $0x14, %edx
movq 0x41c6(%rip), %rdi      # 0xafc0
leaq 0x17db(%rip), %rsi      # 0x85dc
callq 0x2180
callq 0x20c0
movq %rax, %rbx
movl $0x5, %edi
movq 0x18(%rsp), %rsi
callq 0x6008
movq %rax, 0x10(%rsp)
callq 0x20c0
movq %rax, %r12
movq 0x8(%rsp), %rdi
leaq 0x175a(%rip), %rsi      # 0x8590
movl $0x1, %edx
callq 0x2050
movl $0x8, %edx
movq 0x4174(%rip), %rdi      # 0xafc0
leaq 0x179e(%rip), %rsi      # 0x85f1
callq 0x2180
movq 0x4161(%rip), %rdi      # 0xafc0
movq 0x10(%rsp), %rsi
callq 0x20d0
movq %rax, %rbp
movl $0xa, %edx
movq %rax, %rdi
leaq 0x177f(%rip), %rsi      # 0x85fa
callq 0x2180
subq %rbx, %r12
cvtsi2ss %r12, %xmm0
divss 0x1670(%rip), %xmm0     # 0x8500
cvtss2sd %xmm0, %xmm0
movq %rbp, %rdi
movsd %xmm0, 0x60(%rsp)
callq 0x21f0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2140
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
movl $0xd, %edx
movq 0x40e8(%rip), %rdi      # 0xafc0
leaq 0x1726(%rip), %rsi      # 0x8605
callq 0x2180
movq 0x198(%r14), %rsi
movq 0x40ce(%rip), %rdi      # 0xafc0
callq 0x20d0
movl $0x1, %edx
movq %rax, %rdi
leaq 0x1503(%rip), %rsi      # 0x8409
callq 0x2180
movl $0x8, %edx
movq 0x8(%rsp), %rdi
leaq 0x16d5(%rip), %rsi      # 0x85f1
callq 0x2180
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0x20d0
movq %rax, %rbx
movl $0xa, %edx
movq %rax, %rdi
leaq 0x16b8(%rip), %rsi      # 0x85fa
callq 0x2180
movq %rbx, %rdi
movsd 0x60(%rsp), %xmm0
callq 0x21f0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2140
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
movq 0x8(%rsp), %rdi
callq 0x21b0
jmp 0x6d25
movq %r15, %rdi
movq %r13, %rsi
callq 0x2190
movq 0x40(%rsp), %r12
callq 0x2040
movq %rax, %rbx
movl (%rax), %ebp
movl $0x0, (%rax)
movq %r12, %rdi
leaq 0x20(%rsp), %rsi
movl $0xa, %edx
callq 0x21a0
cmpq %r12, 0x20(%rsp)
je 0x75d8
leaq -0x80000000(%rax), %rcx
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
cmpq %rdx, %rcx
jb 0x75e4
movl (%rbx), %ecx
cmpl $0x22, %ecx
je 0x75e4
testl %ecx, %ecx
jne 0x6ff6
movl %ebp, (%rbx)
movl %eax, (%r14)
jmp 0x6d25
movq %r15, %rdi
movq %r13, %rsi
callq 0x2190
movq 0x40(%rsp), %r12
callq 0x2040
movq %rax, %rbx
movl (%rax), %ebp
movl $0x0, (%rax)
movq %r12, %rdi
leaq 0x20(%rsp), %rsi
movl $0xa, %edx
callq 0x21a0
cmpq %r12, 0x20(%rsp)
je 0x75f0
leaq -0x80000000(%rax), %rcx
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
cmpq %rdx, %rcx
jb 0x75fc
movl (%rbx), %ecx
cmpl $0x22, %ecx
je 0x75fc
testl %ecx, %ecx
jne 0x7066
movl %ebp, (%rbx)
movl %eax, 0x4(%r14)
jmp 0x6d25
movq %r15, %rdi
movq %r13, %rsi
callq 0x2190
movq 0x40(%rsp), %r12
callq 0x2040
movq %rax, %rbx
movl (%rax), %ebp
movl $0x0, (%rax)
movq %r12, %rdi
leaq 0x20(%rsp), %rsi
movl $0xa, %edx
callq 0x21a0
cmpq %r12, 0x20(%rsp)
je 0x7614
leaq -0x80000000(%rax), %rcx
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
cmpq %rdx, %rcx
jb 0x7608
movl (%rbx), %ecx
cmpl $0x22, %ecx
je 0x7608
testl %ecx, %ecx
jne 0x70d7
movl %ebp, (%rbx)
movl %eax, 0x8(%r14)
jmp 0x6d25
movq %r15, %rdi
movq %r13, %rsi
callq 0x2190
movq 0x40(%rsp), %r12
callq 0x2040
movq %rax, %rbx
movl (%rax), %ebp
movl $0x0, (%rax)
movq %r12, %rdi
leaq 0x20(%rsp), %rsi
movl $0xa, %edx
callq 0x21a0
cmpq %r12, 0x20(%rsp)
je 0x762c
leaq -0x80000000(%rax), %rcx
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
cmpq %rdx, %rcx
jb 0x7620
movl (%rbx), %ecx
cmpl $0x22, %ecx
je 0x7620
testl %ecx, %ecx
jne 0x7148
movl %ebp, (%rbx)
movl %eax, 0xc(%r14)
jmp 0x6d25
movq %r15, %rdi
movq %r13, %rsi
callq 0x2190
movq 0x40(%rsp), %r12
callq 0x2040
movq %rax, %rbx
movl (%rax), %ebp
movl $0x0, (%rax)
movq %r12, %rdi
leaq 0x20(%rsp), %rsi
movl $0xa, %edx
callq 0x21a0
cmpq %r12, 0x20(%rsp)
je 0x7638
leaq -0x80000000(%rax), %rcx
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
cmpq %rdx, %rcx
jb 0x7644
movl (%rbx), %ecx
cmpl $0x22, %ecx
je 0x7644
testl %ecx, %ecx
jne 0x71b9
movl %ebp, (%rbx)
movl %eax, 0x10(%r14)
jmp 0x6d25
movq %r15, %rdi
movq %r13, %rsi
callq 0x2190
movq 0x40(%rsp), %r12
callq 0x2040
movq %rax, %rbx
movl (%rax), %ebp
movl $0x0, (%rax)
movq %r12, %rdi
leaq 0x20(%rsp), %rsi
movl $0xa, %edx
callq 0x21a0
cmpq %r12, 0x20(%rsp)
je 0x765c
leaq -0x80000000(%rax), %rcx
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
cmpq %rdx, %rcx
jb 0x7650
movl (%rbx), %ecx
cmpl $0x22, %ecx
je 0x7650
testl %ecx, %ecx
jne 0x722a
movl %ebp, (%rbx)
movl %eax, 0x14(%r14)
jmp 0x6d25
movq $0x0, 0x198(%r14)
callq 0x20c0
movq %rax, %rbx
movq 0x18(%rsp), %rdi
callq 0x60d3
callq 0x20c0
movq %rax, %r15
movq 0x3d61(%rip), %rdi      # 0xafc0
leaq 0x13ad(%rip), %rsi      # 0x8613
movl $0x9, %edx
callq 0x2180
movl 0x1a8(%r14), %edx
leaq 0x20(%rsp), %rdi
callq 0x779c
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq 0x3d2e(%rip), %rdi      # 0xafc0
callq 0x2180
leaq 0x116b(%rip), %rsi      # 0x8409
movl $0x1, %edx
movq %rax, %rdi
callq 0x2180
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x72c6
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x2160
movq 0x3cf3(%rip), %rdi      # 0xafc0
leaq 0x131d(%rip), %rsi      # 0x85f1
movl $0x8, %edx
callq 0x2180
movq 0x198(%r14), %rsi
movq 0x3cd4(%rip), %rdi      # 0xafc0
callq 0x20d0
movq %rax, %r12
leaq 0x12ff(%rip), %rsi      # 0x85fa
movl $0xa, %edx
movq %rax, %rdi
callq 0x2180
subq %rbx, %r15
cvtsi2ss %r15, %xmm0
divss 0x11e8(%rip), %xmm0     # 0x8500
movss %xmm0, 0x18(%rsp)
cvtss2sd %xmm0, %xmm0
movq %r12, %rdi
callq 0x21f0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2140
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
movq 0x198(%r14), %rcx
movq 0x1a0(%r14), %rax
testq %rcx, %rcx
js 0x7371
xorps %xmm0, %xmm0
cvtsi2ss %rcx, %xmm0
jmp 0x7389
movq %rcx, %rdx
shrq %rdx
andl $0x1, %ecx
orq %rdx, %rcx
xorps %xmm0, %xmm0
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
movss %xmm0, 0x10(%rsp)
movl 0x44(%rax), %ecx
addl 0x40(%rax), %ecx
leaq 0xe9734(%rip), %rax     # 0xf0ad0
xorl %ebx, %ebx
cmpl (%rax), %ecx
setl %r13b
movq 0x3c15(%rip), %rdi      # 0xafc0
leaq 0x126b(%rip), %rsi      # 0x861d
movl $0xe, %edx
callq 0x2180
leaq 0xe95ad(%rip), %r12     # 0xf0970
movl (%r12), %esi
movq 0x3bf2(%rip), %rdi      # 0xafc0
callq 0x2220
movq %rax, %r15
leaq 0x124f(%rip), %rsi      # 0x862c
movl $0x7, %edx
movq %rax, %rdi
callq 0x2180
movq 0x198(%r14), %rsi
movq %r15, %rdi
callq 0x20d0
movq %rax, %r15
leaq 0x1231(%rip), %rsi      # 0x8634
movl $0x5, %edx
movq %rax, %rdi
callq 0x2180
movss 0x10(%rsp), %xmm0
divss 0x18(%rsp), %xmm0
cvttss2si %xmm0, %ebp
movq %r15, %rdi
movl %ebp, %esi
callq 0x2220
movq %rax, %r15
leaq 0x1206(%rip), %rsi      # 0x863a
movl $0x8, %edx
movq %rax, %rdi
callq 0x2180
movb %r13b, %bl
movq %r15, %rdi
movl %ebx, %esi
callq 0x2220
leaq 0xfb4(%rip), %rsi       # 0x8409
movl $0x1, %edx
movq %rax, %rdi
callq 0x2180
movq 0x1a0(%r14), %rax
xorl %r15d, %r15d
testq %rax, %rax
je 0x747a
movq 0x18(%rax), %rax
incl %r15d
jmp 0x746c
movq 0x3b3f(%rip), %rdi      # 0xafc0
leaq 0x11bb(%rip), %rsi      # 0x8643
movl $0xe, %edx
callq 0x2180
movq 0x3b27(%rip), %rdi      # 0xafc0
movl %r15d, %esi
callq 0x2220
leaq 0xf61(%rip), %rsi       # 0x8409
movl $0x1, %edx
movq %rax, %rdi
callq 0x2180
leaq 0x10d4(%rip), %rsi      # 0x8590
movq 0x8(%rsp), %rdi
movl $0x1, %edx
callq 0x2050
leaq 0x114b(%rip), %rsi      # 0x861d
movl $0xe, %edx
movq 0x8(%rsp), %rdi
callq 0x2180
movl (%r12), %esi
movq 0x8(%rsp), %rdi
callq 0x2220
movq %rax, %r12
leaq 0x1133(%rip), %rsi      # 0x862c
movl $0x7, %edx
movq %rax, %rdi
callq 0x2180
movq 0x198(%r14), %rsi
movq %r12, %rdi
callq 0x20d0
movq %rax, %r14
leaq 0x1115(%rip), %rsi      # 0x8634
movl $0x5, %edx
movq %rax, %rdi
callq 0x2180
movq %r14, %rdi
movl %ebp, %esi
callq 0x2220
movq %rax, %r14
leaq 0x10fa(%rip), %rsi      # 0x863a
movl $0x8, %edx
movq %rax, %rdi
callq 0x2180
movq %r14, %rdi
movl %ebx, %esi
callq 0x2220
movq %rax, %rbx
leaq 0x10e2(%rip), %rsi      # 0x8643
movl $0xe, %edx
movq %rax, %rdi
callq 0x2180
movq %rbx, %rdi
movl %r15d, %esi
callq 0x2220
leaq 0xe89(%rip), %rsi       # 0x8409
movl $0x1, %edx
movq %rax, %rdi
callq 0x2180
leaq 0x10be(%rip), %rsi      # 0x8652
movl $0x19, %edx
movq 0x8(%rsp), %rdi
callq 0x2180
movq 0x8(%rsp), %rdi
callq 0x21b0
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x75c9
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x2160
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1098(%rip), %rdi      # 0x8677
callq 0x20b0
leaq 0x108c(%rip), %rdi      # 0x8677
callq 0x21d0
leaq 0x1080(%rip), %rdi      # 0x8677
callq 0x20b0
leaq 0x1074(%rip), %rdi      # 0x8677
callq 0x21d0
leaq 0x1068(%rip), %rdi      # 0x8677
callq 0x21d0
leaq 0x105c(%rip), %rdi      # 0x8677
callq 0x20b0
leaq 0x1050(%rip), %rdi      # 0x8677
callq 0x21d0
leaq 0x1044(%rip), %rdi      # 0x8677
callq 0x20b0
leaq 0x1038(%rip), %rdi      # 0x8677
callq 0x20b0
leaq 0x102c(%rip), %rdi      # 0x8677
callq 0x21d0
leaq 0x1020(%rip), %rdi      # 0x8677
callq 0x21d0
leaq 0x1014(%rip), %rdi      # 0x8677
callq 0x20b0
jmp 0x76a8
movq %rax, %r14
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x76ab
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x2160
jmp 0x76ab
jmp 0x769c
jmp 0x769c
jmp 0x769c
jmp 0x76a8
jmp 0x76a8
jmp 0x769c
jmp 0x769c
jmp 0x76a8
jmp 0x76a8
movq %rax, %r14
cmpl $0x0, (%rbx)
jne 0x76ab
movl %ebp, (%rbx)
jmp 0x76ab
movq %rax, %r14
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x76c7
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x2160
movq %r14, %rdi
callq 0x2230
nop