// File: /workspace/github_cpp_makefile_star2_O2/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 0xe9f(%rip), %rsi       # 0x739e
leaq 0x48(%rsp), %r13
leaq 0x28(%rsp), %rdx
movq %r13, %rdi
callq 0x26c4
leaq 0x18(%r14), %rax
movq %rax, 0x10(%rsp)
leaq 0x1b0(%r14), %rax
movq %rax, 0x18(%rsp)
leaq 0xfe4(%rip), %rbp       # 0x7511
pushq $0xa
popq %r12
movq %r15, %rdi
movq %r13, %rsi
callq 0x21a0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x67c2
movq %r13, %rdi
movq %rbp, %rsi
callq 0x5634
testb %al, %al
je 0x657a
movq %r15, %rdi
movq %r13, %rsi
callq 0x21a0
movq %r13, %rdi
xorl %esi, %esi
movl %r12d, %edx
callq 0x6c92
movl %eax, (%r14)
jmp 0x6531
movq %r13, %rdi
leaq 0xf93(%rip), %rsi       # 0x7517
callq 0x5634
testb %al, %al
je 0x65ab
movq %r15, %rdi
movq %r13, %rsi
callq 0x21a0
movq %r13, %rdi
xorl %esi, %esi
movl %r12d, %edx
callq 0x6c92
movl %eax, 0x4(%r14)
jmp 0x6531
movq %r13, %rdi
leaq 0xf68(%rip), %rsi       # 0x751d
callq 0x5634
testb %al, %al
je 0x65df
movq %r15, %rdi
movq %r13, %rsi
callq 0x21a0
movq %r13, %rdi
xorl %esi, %esi
movl %r12d, %edx
callq 0x6c92
movl %eax, 0x8(%r14)
jmp 0x6531
movq %r13, %rdi
leaq 0xf39(%rip), %rsi       # 0x7522
callq 0x5634
testb %al, %al
je 0x6613
movq %r15, %rdi
movq %r13, %rsi
callq 0x21a0
movq %r13, %rdi
xorl %esi, %esi
movl %r12d, %edx
callq 0x6c92
movl %eax, 0xc(%r14)
jmp 0x6531
movq %r13, %rdi
leaq 0xf0a(%rip), %rsi       # 0x7527
callq 0x5634
testb %al, %al
je 0x6647
movq %r15, %rdi
movq %r13, %rsi
callq 0x21a0
movq %r13, %rdi
xorl %esi, %esi
movl %r12d, %edx
callq 0x6c92
movl %eax, 0x10(%r14)
jmp 0x6531
movq %r13, %rdi
leaq 0xedc(%rip), %rsi       # 0x752d
callq 0x5634
testb %al, %al
je 0x667b
movq %r15, %rdi
movq %r13, %rsi
callq 0x21a0
movq %r13, %rdi
xorl %esi, %esi
movl %r12d, %edx
callq 0x6c92
movl %eax, 0x14(%r14)
jmp 0x6531
movq %r13, %rdi
leaq 0xeb1(%rip), %rsi       # 0x7536
callq 0x5634
testb %al, %al
je 0x6531
movq %r15, %rdi
movq %r13, %rsi
callq 0x21a0
movq 0x490c(%rip), %rdi      # 0xafb0
leaq 0xe91(%rip), %rsi       # 0x753c
callq 0x2170
callq 0x20f0
movq %rax, 0x20(%rsp)
pushq $0x5
popq %rdi
movq 0x10(%rsp), %rsi
callq 0x5a87
movq %rax, 0x8(%rsp)
callq 0x20f0
movq %rax, %rbx
movq 0x18(%rsp), %rdi
leaq 0xe10(%rip), %rsi       # 0x74f0
pushq $0x1
popq %rdx
callq 0x2040
movq 0x48c1(%rip), %rdi      # 0xafb0
leaq 0xe5b(%rip), %rsi       # 0x7551
callq 0x2170
movq %rax, %rdi
movq 0x8(%rsp), %rsi
callq 0x2100
movq %rax, %rdi
leaq 0xe48(%rip), %rsi       # 0x755a
callq 0x2170
subq 0x20(%rsp), %rbx
cvtsi2ss %rbx, %xmm0
divss 0xd37(%rip), %xmm0      # 0x7460
movq %rax, %rdi
movss %xmm0, 0x20(%rsp)
callq 0x2120
movq %rax, %rdi
callq 0x20d0
movq 0x486a(%rip), %rdi      # 0xafb0
leaq 0xe18(%rip), %rsi       # 0x7565
callq 0x2170
movq 0x198(%r14), %rsi
movq %rax, %rdi
callq 0x2100
movq %rax, %rdi
leaq 0xc32(%rip), %rsi       # 0x739d
callq 0x2170
movq 0x18(%rsp), %rdi
leaq 0xdd5(%rip), %rsi       # 0x7551
callq 0x2170
movq %rax, %rdi
movq 0x8(%rsp), %rsi
callq 0x2100
movq %rax, %rdi
leaq 0xdc2(%rip), %rsi       # 0x755a
callq 0x2170
movq %rax, %rdi
movss 0x20(%rsp), %xmm0
callq 0x2120
movq %rax, %rdi
callq 0x20d0
movq 0x18(%rsp), %rdi
callq 0x21c0
jmp 0x6531
andq $0x0, 0x198(%r14)
callq 0x20f0
movq %rax, %rbx
movq 0x10(%rsp), %rdi
callq 0x5b52
movq 0x18(%rsp), %r13
callq 0x20f0
movq %rax, %r15
movq 0x47c0(%rip), %rdi      # 0xafb0
leaq 0xd7c(%rip), %rsi       # 0x7573
callq 0x2170
movq %rax, %r12
movl 0x1a8(%r14), %edx
leaq 0x28(%rsp), %rdi
callq 0x6b32
leaq 0x28(%rsp), %rsi
movq %r12, %rdi
callq 0x2160
leaq 0xb79(%rip), %rsi       # 0x739d
movq %rax, %rdi
callq 0x2170
leaq 0x28(%rsp), %rdi
callq 0x2288
movq 0x4773(%rip), %rdi      # 0xafb0
leaq 0xd0d(%rip), %rsi       # 0x7551
callq 0x2170
movq 0x198(%r14), %rsi
movq %rax, %rdi
callq 0x2100
leaq 0xcfb(%rip), %rsi       # 0x755a
movq %rax, %rdi
callq 0x2170
subq %rbx, %r15
cvtsi2ss %r15, %xmm0
divss 0xbe9(%rip), %xmm0      # 0x7460
movq %rax, %rdi
movss %xmm0, 0x10(%rsp)
callq 0x2120
movq %rax, %rdi
callq 0x20d0
movq 0x198(%r14), %rcx
movq 0x1a0(%r14), %rax
testq %rcx, %rcx
js 0x68a7
cvtsi2ss %rcx, %xmm0
jmp 0x68bc
movq %rcx, %rdx
shrq %rdx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
movss %xmm0, 0x8(%rsp)
movl 0x44(%rax), %ecx
addl 0x40(%rax), %ecx
leaq 0xea201(%rip), %rax     # 0xf0ad0
xorl %ebx, %ebx
cmpl (%rax), %ecx
setl %r15b
movq 0x46d2(%rip), %rdi      # 0xafb0
leaq 0xc98(%rip), %rsi       # 0x757d
callq 0x2170
leaq 0xea07f(%rip), %r12     # 0xf0970
movl (%r12), %esi
movq %rax, %rdi
callq 0x2220
leaq 0xc88(%rip), %rsi       # 0x758c
movq %rax, %rdi
callq 0x2170
movq 0x198(%r14), %rsi
movq %rax, %rdi
callq 0x2100
leaq 0xc72(%rip), %rsi       # 0x7594
movq %rax, %rdi
callq 0x2170
movss 0x8(%rsp), %xmm0
divss 0x10(%rsp), %xmm0
cvttss2si %xmm0, %ebp
movq %rax, %rdi
movl %ebp, %esi
callq 0x2220
leaq 0xc4f(%rip), %rsi       # 0x759a
movq %rax, %rdi
callq 0x2170
movb %r15b, %bl
movq %rax, %rdi
movl %ebx, %esi
callq 0x2220
leaq 0xa36(%rip), %rsi       # 0x739d
movq %rax, %rdi
callq 0x2170
movq 0x1a0(%r14), %rsi
callq 0x6c40
movl %eax, %r15d
movq 0x462b(%rip), %rdi      # 0xafb0
leaq 0xc17(%rip), %rsi       # 0x75a3
callq 0x2170
movq %rax, %rdi
movl %r15d, %esi
callq 0x2220
leaq 0x9fa(%rip), %rsi       # 0x739d
movq %rax, %rdi
callq 0x2170
leaq 0xb3e(%rip), %rsi       # 0x74f0
pushq $0x1
popq %rdx
movq %r13, %rdi
callq 0x2040
leaq 0xbb9(%rip), %rsi       # 0x757d
movq %r13, %rdi
callq 0x2170
movl (%r12), %esi
movq %rax, %rdi
callq 0x2220
leaq 0xbad(%rip), %rsi       # 0x758c
movq %rax, %rdi
callq 0x2170
movq 0x198(%r14), %rsi
movq %rax, %rdi
callq 0x2100
leaq 0xb97(%rip), %rsi       # 0x7594
movq %rax, %rdi
callq 0x2170
movq %rax, %rdi
movl %ebp, %esi
callq 0x2220
leaq 0xb84(%rip), %rsi       # 0x759a
movq %rax, %rdi
callq 0x2170
movq %rax, %rdi
movl %ebx, %esi
callq 0x2220
leaq 0xb74(%rip), %rsi       # 0x75a3
movq %rax, %rdi
callq 0x2170
movq %rax, %rdi
movl %r15d, %esi
callq 0x2220
leaq 0x954(%rip), %rsi       # 0x739d
movq %rax, %rdi
callq 0x2170
leaq 0xb5a(%rip), %rsi       # 0x75b2
movq %r13, %rdi
callq 0x2170
movq %r13, %rdi
callq 0x21c0
leaq 0x48(%rsp), %rdi
callq 0x2288
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x6a9a
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x2288
jmp 0x6a9d
jmp 0x6a9a
jmp 0x6a9a
jmp 0x6a9a
jmp 0x6a9a
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x2288
movq %rbx, %rdi
callq 0x2230
nop