// File: cpirc[P]Monochrome/src/uci.cpp
// Function: UCI::go(std::__cxx11::basic_stringstream<char, std::char_traits<char>, std::allocator<char>>&)
void go(std::stringstream& ss) {
    sc.max_depth = MAX_PLY;
    sc.moves_per_session = 0;
    sc.increment = 0;
    sc.search_start_time = 0;
    sc.search_end_time = 0;
    sc.movetime = 0;

    int wtime = -1;
    int btime = -1;
    int winc = -1;
    int binc = -1;

    std::string word;
    while (ss >> word) {
        if (word == "wtime") {
            ss >> wtime;
        } else if (word == "btime") {
            ss >> btime;
        } else if (word == "winc") {
            ss >> winc;
        } else if (word == "binc") {
            ss >> binc;
        } else if (word == "depth") {
            ss >> sc.max_depth;
        } else if (word == "movetime") {
            ss >> sc.movetime;
        } else if (word == "movestogo") {
            ss >> sc.moves_per_session;
        }
    }

    if (sc.pos.flipped) {
        sc.our_clock = btime;
        sc.increment = binc;
    } else {
        sc.our_clock = wtime;
        sc.increment = winc;
    }

    std::thread search(start_search, std::ref(sc));
    search.detach();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movl $0x40, 0x257a52(%rip)   # 0x267928
movl $0x0, 0x257a4c(%rip)    # 0x26792c
movq $0x0, 0x257a45(%rip) # 0x267930
movq $0x0, 0x257a42(%rip) # 0x267938
movq $0x0, 0x257a3f(%rip) # 0x267940
movq $0x0, 0x257a44(%rip) # 0x267950
movl $0xffffffff, -0xc(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x10(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x14(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x18(%rbp) # imm = 0xFFFFFFFF
leaq -0x38(%rbp), %rdi
callq 0x3290
movq -0x8(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x3240
movq %rax, -0x60(%rbp)
jmp 0xff44
movq -0x60(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x3230
movb %al, -0x61(%rbp)
jmp 0xff5c
movb -0x61(%rbp), %al
testb $0x1, %al
jne 0xff68
jmp 0x100e8
leaq 0x46df(%rip), %rsi      # 0x1464e
leaq -0x38(%rbp), %rdi
callq 0x58d0
movb %al, -0x62(%rbp)
jmp 0xff7d
movb -0x62(%rbp), %al
testb $0x1, %al
jne 0xff86
jmp 0xffab
movq -0x8(%rbp), %rdi
leaq -0xc(%rbp), %rsi
callq 0x3110
jmp 0xff95
jmp 0x100e3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x1017d
leaq 0x46a2(%rip), %rsi      # 0x14654
leaq -0x38(%rbp), %rdi
callq 0x58d0
movb %al, -0x63(%rbp)
jmp 0xffc0
movb -0x63(%rbp), %al
testb $0x1, %al
jne 0xffc9
jmp 0xffdd
movq -0x8(%rbp), %rdi
leaq -0x10(%rbp), %rsi
callq 0x3110
jmp 0xffd8
jmp 0x100e1
leaq 0x4676(%rip), %rsi      # 0x1465a
leaq -0x38(%rbp), %rdi
callq 0x58d0
movb %al, -0x64(%rbp)
jmp 0xfff2
movb -0x64(%rbp), %al
testb $0x1, %al
jne 0xfffb
jmp 0x1000f
movq -0x8(%rbp), %rdi
leaq -0x14(%rbp), %rsi
callq 0x3110
jmp 0x1000a
jmp 0x100df
leaq 0x4649(%rip), %rsi      # 0x1465f
leaq -0x38(%rbp), %rdi
callq 0x58d0
movb %al, -0x65(%rbp)
jmp 0x10024
movb -0x65(%rbp), %al
testb $0x1, %al
jne 0x1002d
jmp 0x10041
movq -0x8(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0x3110
jmp 0x1003c
jmp 0x100dd
leaq 0x461c(%rip), %rsi      # 0x14664
leaq -0x38(%rbp), %rdi
callq 0x58d0
movb %al, -0x66(%rbp)
jmp 0x10056
movb -0x66(%rbp), %al
testb $0x1, %al
jne 0x1005f
jmp 0x10073
movq -0x8(%rbp), %rdi
leaq 0x2578be(%rip), %rsi    # 0x267928
callq 0x3050
jmp 0x10071
jmp 0x100db
leaq 0x45f0(%rip), %rsi      # 0x1466a
leaq -0x38(%rbp), %rdi
callq 0x58d0
movb %al, -0x67(%rbp)
jmp 0x10088
movb -0x67(%rbp), %al
testb $0x1, %al
jne 0x10091
jmp 0x100a5
movq -0x8(%rbp), %rdi
leaq 0x2578b4(%rip), %rsi    # 0x267950
callq 0x3100
jmp 0x100a3
jmp 0x100d9
leaq 0x45c7(%rip), %rsi      # 0x14673
leaq -0x38(%rbp), %rdi
callq 0x58d0
movb %al, -0x68(%rbp)
jmp 0x100ba
movb -0x68(%rbp), %al
testb $0x1, %al
jne 0x100c3
jmp 0x100d7
movq -0x8(%rbp), %rdi
leaq 0x25785e(%rip), %rsi    # 0x26792c
callq 0x3050
jmp 0x100d5
jmp 0x100d7
jmp 0x100d9
jmp 0x100db
jmp 0x100dd
jmp 0x100df
jmp 0x100e1
jmp 0x100e3
jmp 0xff31
testb $0x1, 0x257812(%rip)    # 0x267901
je 0x10109
movslq -0x10(%rbp), %rax
movq %rax, 0x25784c(%rip)    # 0x267948
movslq -0x18(%rbp), %rax
movq %rax, 0x257829(%rip)    # 0x267930
jmp 0x1011f
movslq -0xc(%rbp), %rax
movq %rax, 0x257834(%rip)    # 0x267948
movslq -0x14(%rbp), %rax
movq %rax, 0x257811(%rip)    # 0x267930
leaq 0x25779a(%rip), %rdi    # 0x2678c0
callq 0x10a50
movq %rax, -0x58(%rbp)
leaq -0x4ab6(%rip), %rsi     # 0xb680
leaq -0x50(%rbp), %rdi
leaq -0x58(%rbp), %rdx
callq 0x10a80
jmp 0x10145
leaq -0x50(%rbp), %rdi
callq 0x3340
jmp 0x10150
leaq -0x50(%rbp), %rdi
callq 0x10b40
leaq -0x38(%rbp), %rdi
callq 0x3120
addq $0x70, %rsp
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x10b40
leaq -0x38(%rbp), %rdi
callq 0x3120
movq -0x40(%rbp), %rdi
callq 0x3350
nop