// File: /workspace/github_cpp_makefile_star2_O1/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 0x1698(%rip), %rdx      # 0x8372
leaq 0x40(%rsp), %r13
movq %r13, %rdi
movq %rdx, %rsi
callq 0x44f4
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 0x720d
movq %r13, %rdi
leaq 0x17bf(%rip), %rsi      # 0x84e5
callq 0x2070
testl %eax, %eax
je 0x6f68
movq %r13, %rdi
leaq 0x17ae(%rip), %rsi      # 0x84eb
callq 0x2070
testl %eax, %eax
je 0x6fd8
movq %r13, %rdi
leaq 0x179d(%rip), %rsi      # 0x84f1
callq 0x2070
testl %eax, %eax
je 0x7049
movq %r13, %rdi
leaq 0x178b(%rip), %rsi      # 0x84f6
callq 0x2070
testl %eax, %eax
je 0x70ba
movq %r13, %rdi
leaq 0x1779(%rip), %rsi      # 0x84fb
callq 0x2070
testl %eax, %eax
je 0x712b
movq %r13, %rdi
leaq 0x1768(%rip), %rsi      # 0x8501
callq 0x2070
testl %eax, %eax
je 0x719c
movq %r13, %rdi
leaq 0x175a(%rip), %rsi      # 0x850a
callq 0x2070
testl %eax, %eax
jne 0x6cff
movq %r15, %rdi
movq %r13, %rsi
callq 0x2190
movl $0x14, %edx
movq 0x41ec(%rip), %rdi      # 0xafc0
leaq 0x1735(%rip), %rsi      # 0x8510
callq 0x2180
callq 0x20c0
movq %rax, %rbx
movl $0x5, %edi
movq 0x18(%rsp), %rsi
callq 0x5fc2
movq %rax, 0x10(%rsp)
callq 0x20c0
movq %rax, %r12
movq 0x8(%rsp), %rdi
leaq 0x16b4(%rip), %rsi      # 0x84c4
movl $0x1, %edx
callq 0x2050
movl $0x8, %edx
movq 0x419a(%rip), %rdi      # 0xafc0
leaq 0x16f8(%rip), %rsi      # 0x8525
callq 0x2180
movq 0x4187(%rip), %rdi      # 0xafc0
movq 0x10(%rsp), %rsi
callq 0x20d0
movq %rax, %rbp
movl $0xa, %edx
movq %rax, %rdi
leaq 0x16d9(%rip), %rsi      # 0x852e
callq 0x2180
subq %rbx, %r12
cvtsi2ss %r12, %xmm0
divss 0x15ca(%rip), %xmm0     # 0x8434
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 0x410e(%rip), %rdi      # 0xafc0
leaq 0x1680(%rip), %rsi      # 0x8539
callq 0x2180
movq 0x198(%r14), %rsi
movq 0x40f4(%rip), %rdi      # 0xafc0
callq 0x20d0
movl $0x1, %edx
movq %rax, %rdi
leaq 0x1491(%rip), %rsi      # 0x8371
callq 0x2180
movl $0x8, %edx
movq 0x8(%rsp), %rdi
leaq 0x162f(%rip), %rsi      # 0x8525
callq 0x2180
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0x20d0
movq %rax, %rbx
movl $0xa, %edx
movq %rax, %rdi
leaq 0x1612(%rip), %rsi      # 0x852e
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 0x6cff
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 0x75ac
leaq -0x80000000(%rax), %rcx
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
cmpq %rdx, %rcx
jb 0x75b8
movl (%rbx), %ecx
cmpl $0x22, %ecx
je 0x75b8
testl %ecx, %ecx
jne 0x6fd0
movl %ebp, (%rbx)
movl %eax, (%r14)
jmp 0x6cff
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 0x75c4
leaq -0x80000000(%rax), %rcx
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
cmpq %rdx, %rcx
jb 0x75d0
movl (%rbx), %ecx
cmpl $0x22, %ecx
je 0x75d0
testl %ecx, %ecx
jne 0x7040
movl %ebp, (%rbx)
movl %eax, 0x4(%r14)
jmp 0x6cff
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 0x75e8
leaq -0x80000000(%rax), %rcx
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
cmpq %rdx, %rcx
jb 0x75dc
movl (%rbx), %ecx
cmpl $0x22, %ecx
je 0x75dc
testl %ecx, %ecx
jne 0x70b1
movl %ebp, (%rbx)
movl %eax, 0x8(%r14)
jmp 0x6cff
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 0x7600
leaq -0x80000000(%rax), %rcx
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
cmpq %rdx, %rcx
jb 0x75f4
movl (%rbx), %ecx
cmpl $0x22, %ecx
je 0x75f4
testl %ecx, %ecx
jne 0x7122
movl %ebp, (%rbx)
movl %eax, 0xc(%r14)
jmp 0x6cff
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 0x760c
leaq -0x80000000(%rax), %rcx
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
cmpq %rdx, %rcx
jb 0x7618
movl (%rbx), %ecx
cmpl $0x22, %ecx
je 0x7618
testl %ecx, %ecx
jne 0x7193
movl %ebp, (%rbx)
movl %eax, 0x10(%r14)
jmp 0x6cff
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 0x7630
leaq -0x80000000(%rax), %rcx
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
cmpq %rdx, %rcx
jb 0x7624
movl (%rbx), %ecx
cmpl $0x22, %ecx
je 0x7624
testl %ecx, %ecx
jne 0x7204
movl %ebp, (%rbx)
movl %eax, 0x14(%r14)
jmp 0x6cff
movq $0x0, 0x198(%r14)
callq 0x20c0
movq %rax, %rbx
movq 0x18(%rsp), %rdi
callq 0x609f
callq 0x20c0
movq %rax, %r15
movq 0x3d87(%rip), %rdi      # 0xafc0
leaq 0x1307(%rip), %rsi      # 0x8547
movl $0x9, %edx
callq 0x2180
movl 0x1a8(%r14), %edx
leaq 0x20(%rsp), %rdi
callq 0x7760
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq 0x3d54(%rip), %rdi      # 0xafc0
callq 0x2180
leaq 0x10f9(%rip), %rsi      # 0x8371
movl $0x1, %edx
movq %rax, %rdi
callq 0x2180
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x72a0
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x2160
movq 0x3d19(%rip), %rdi      # 0xafc0
leaq 0x1277(%rip), %rsi      # 0x8525
movl $0x8, %edx
callq 0x2180
movq 0x198(%r14), %rsi
movq 0x3cfa(%rip), %rdi      # 0xafc0
callq 0x20d0
movq %rax, %r12
leaq 0x1259(%rip), %rsi      # 0x852e
movl $0xa, %edx
movq %rax, %rdi
callq 0x2180
subq %rbx, %r15
cvtsi2ss %r15, %xmm0
divss 0x1142(%rip), %xmm0     # 0x8434
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 0x734b
xorps %xmm0, %xmm0
cvtsi2ss %rcx, %xmm0
jmp 0x7363
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 0xe975a(%rip), %rax     # 0xf0ad0
xorl %ebx, %ebx
cmpl (%rax), %ecx
setl %r13b
movq 0x3c3b(%rip), %rdi      # 0xafc0
leaq 0x11c5(%rip), %rsi      # 0x8551
movl $0xe, %edx
callq 0x2180
leaq 0xe95d3(%rip), %r12     # 0xf0970
movl (%r12), %esi
movq 0x3c18(%rip), %rdi      # 0xafc0
callq 0x2220
movq %rax, %r15
leaq 0x11a9(%rip), %rsi      # 0x8560
movl $0x7, %edx
movq %rax, %rdi
callq 0x2180
movq 0x198(%r14), %rsi
movq %r15, %rdi
callq 0x20d0
movq %rax, %r15
leaq 0x118b(%rip), %rsi      # 0x8568
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 0x1160(%rip), %rsi      # 0x856e
movl $0x8, %edx
movq %rax, %rdi
callq 0x2180
movb %r13b, %bl
movq %r15, %rdi
movl %ebx, %esi
callq 0x2220
leaq 0xf42(%rip), %rsi       # 0x8371
movl $0x1, %edx
movq %rax, %rdi
callq 0x2180
movq 0x1a0(%r14), %rsi
movq %r14, %rdi
callq 0x78be
movl %eax, %r15d
movq 0x3b6b(%rip), %rdi      # 0xafc0
leaq 0x111b(%rip), %rsi      # 0x8577
movl $0xe, %edx
callq 0x2180
movq 0x3b53(%rip), %rdi      # 0xafc0
movl %r15d, %esi
callq 0x2220
leaq 0xef5(%rip), %rsi       # 0x8371
movl $0x1, %edx
movq %rax, %rdi
callq 0x2180
leaq 0x1034(%rip), %rsi      # 0x84c4
movq 0x8(%rsp), %rdi
movl $0x1, %edx
callq 0x2050
leaq 0x10ab(%rip), %rsi      # 0x8551
movl $0xe, %edx
movq 0x8(%rsp), %rdi
callq 0x2180
movl (%r12), %esi
movq 0x8(%rsp), %rdi
callq 0x2220
movq %rax, %r12
leaq 0x1093(%rip), %rsi      # 0x8560
movl $0x7, %edx
movq %rax, %rdi
callq 0x2180
movq 0x198(%r14), %rsi
movq %r12, %rdi
callq 0x20d0
movq %rax, %r14
leaq 0x1075(%rip), %rsi      # 0x8568
movl $0x5, %edx
movq %rax, %rdi
callq 0x2180
movq %r14, %rdi
movl %ebp, %esi
callq 0x2220
movq %rax, %r14
leaq 0x105a(%rip), %rsi      # 0x856e
movl $0x8, %edx
movq %rax, %rdi
callq 0x2180
movq %r14, %rdi
movl %ebx, %esi
callq 0x2220
movq %rax, %rbx
leaq 0x1042(%rip), %rsi      # 0x8577
movl $0xe, %edx
movq %rax, %rdi
callq 0x2180
movq %rbx, %rdi
movl %r15d, %esi
callq 0x2220
leaq 0xe1d(%rip), %rsi       # 0x8371
movl $0x1, %edx
movq %rax, %rdi
callq 0x2180
leaq 0x101e(%rip), %rsi      # 0x8586
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 0x759d
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 0xff8(%rip), %rdi       # 0x85ab
callq 0x20b0
leaq 0xfec(%rip), %rdi       # 0x85ab
callq 0x21d0
leaq 0xfe0(%rip), %rdi       # 0x85ab
callq 0x20b0
leaq 0xfd4(%rip), %rdi       # 0x85ab
callq 0x21d0
leaq 0xfc8(%rip), %rdi       # 0x85ab
callq 0x21d0
leaq 0xfbc(%rip), %rdi       # 0x85ab
callq 0x20b0
leaq 0xfb0(%rip), %rdi       # 0x85ab
callq 0x21d0
leaq 0xfa4(%rip), %rdi       # 0x85ab
callq 0x20b0
leaq 0xf98(%rip), %rdi       # 0x85ab
callq 0x20b0
leaq 0xf8c(%rip), %rdi       # 0x85ab
callq 0x21d0
leaq 0xf80(%rip), %rdi       # 0x85ab
callq 0x21d0
leaq 0xf74(%rip), %rdi       # 0x85ab
callq 0x20b0
jmp 0x767c
movq %rax, %r14
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x767f
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x2160
jmp 0x767f
jmp 0x7670
jmp 0x7670
jmp 0x7670
jmp 0x767c
jmp 0x767c
jmp 0x7670
jmp 0x7670
jmp 0x767c
jmp 0x767c
movq %rax, %r14
cmpl $0x0, (%rbx)
jne 0x767f
movl %ebp, (%rbx)
jmp 0x767f
movq %rax, %r14
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x769b
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x2160
movq %r14, %rdi
callq 0x2230
nop