// File: /workspace/github_cpp_makefile_star2_O3/SethKasmann[P]clever-girl/src/uci.cpp
// Function: uci()
void uci()
{
    State root(Start_fen);
    std::string command, token;

    std::setvbuf(stdin, NULL, _IONBF, 0);

    while (1)
    {
        std::getline(std::cin, command);
        std::istringstream is(command);
        is >> std::skipws >> token;

        if (token == "quit")
            break;
        else if (token == "isready")
            std::cout << "readyok" << std::endl;
        else if (token == "uci")
        {
            std::cout << "id name Clever Girl" << std::endl
                      << "id author Seth Kasmann" << std::endl
                      << "option name Hash type spin default 1 min 1 max 128" << std::endl;
            std::cout << "uciok" << std::endl;
        }
        else if (token == "setoption")
        {
            std::string name, value;

            is >> token;
            while (is >> token && token != "value")
                name += token;
            while (is >> token)
                value += token;

            set_option(name, value);
        }
        else if (token == "position")
            position(is, root);
        else if (token == "go")
            go(is, root);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x708, %rsp            # imm = 0x708
leaq 0x14b29c(%rip), %rsi    # 0x164e20
leaq 0x200(%rsp), %rdi
callq 0x1655c
leaq 0x70(%rsp), %rax
movq %rax, -0x10(%rax)
xorl %ecx, %ecx
movq %rcx, -0x8(%rax)
movb %cl, (%rax)
leaq 0x30(%rsp), %rax
movq %rax, -0x10(%rax)
movq %rcx, -0x8(%rax)
movb %cl, (%rax)
movq 0xb3d0(%rip), %rax      # 0x24f88
movq (%rax), %rdi
xorl %esi, %esi
movl $0x2, %edx
xorl %ecx, %ecx
callq 0x4030
movq 0xb410(%rip), %r15      # 0x24fe0
leaq 0x80(%rsp), %r13
leaq 0x20(%rsp), %rbp
movq 0xb3bc(%rip), %rbx      # 0x24fa0
leaq 0x40(%rsp), %r14
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x4230
leaq 0x60(%rsp), %r12
movsbl %al, %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0x43d0
movq %r13, %rdi
movq %r12, %rsi
movl $0x8, %edx
callq 0x4370
movq 0x80(%rsp), %rax
movq -0x18(%rax), %rax
orl $0x1000, 0x98(%rsp,%rax) # imm = 0x1000
movq %r13, %rdi
movq %rbp, %rsi
callq 0x42b0
movq %rbp, %rdi
leaq 0x45f4(%rip), %rsi      # 0x1e240
callq 0x4090
testl %eax, %eax
je 0x19f01
movq %rbp, %rdi
leaq 0x67f8(%rip), %rsi      # 0x2045b
callq 0x4090
testl %eax, %eax
je 0x19cd9
movq %rbp, %rdi
leaq 0x67f5(%rip), %rsi      # 0x2046b
callq 0x4090
testl %eax, %eax
je 0x19ceb
movq %rbp, %rdi
leaq 0x684a(%rip), %rsi      # 0x204d3
callq 0x4090
testl %eax, %eax
je 0x19e04
movq %rbp, %rdi
leaq 0x6843(%rip), %rsi      # 0x204e3
callq 0x4090
testl %eax, %eax
je 0x19eec
movq %rbp, %rdi
leaq 0x6756(%rip), %rsi      # 0x2040d
callq 0x4090
testl %eax, %eax
jne 0x19de3
movq %r13, %rdi
leaq 0x200(%rsp), %rsi
callq 0x19385
jmp 0x19de3
movl $0x7, %r12d
leaq 0x677d(%rip), %rsi      # 0x20463
jmp 0x19db1
movl $0x13, %edx
movq %rbx, %rdi
leaq 0x6775(%rip), %rsi      # 0x2046f
callq 0x4290
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4230
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4170
movq %rax, %r12
movl $0x16, %edx
movq %rax, %rdi
leaq 0x674b(%rip), %rsi      # 0x20483
callq 0x4290
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x4230
movsbl %al, %esi
movq %r12, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4170
movq %rax, %r12
movl $0x32, %edx
movq %rax, %rdi
leaq 0x6723(%rip), %rsi      # 0x2049a
callq 0x4290
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x4230
movsbl %al, %esi
movq %r12, %rdi
callq 0x4040
movl $0x5, %r12d
movq %rax, %rdi
callq 0x4170
leaq 0x671c(%rip), %rsi      # 0x204cd
movq %rbx, %rdi
movq %r12, %rdx
callq 0x4290
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4230
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4170
movq %r13, %rdi
movq 0xb1ab(%rip), %rsi      # 0x24f98
callq 0x42f0
leaq 0xf8(%rsp), %rdi
callq 0x40c0
jmp 0x19be9
leaq 0x10(%rsp), %rax
movq %rax, (%rsp)
xorl %ecx, %ecx
movq %rcx, 0x8(%rsp)
movb %cl, 0x10(%rsp)
leaq 0x50(%rsp), %rax
movq %rax, 0x40(%rsp)
movq %rcx, 0x48(%rsp)
movb %cl, 0x50(%rsp)
movq %r13, %rdi
movq %rbp, %rsi
callq 0x42b0
movq %r13, %rdi
movq %rbp, %rsi
callq 0x42b0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x19e88
movq %rbp, %rdi
leaq 0x6684(%rip), %rsi      # 0x204dd
callq 0x4090
testl %eax, %eax
je 0x19e88
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq %rsp, %rdi
callq 0x40b0
jmp 0x19e36
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq %r14, %rdi
callq 0x40b0
movq %r13, %rdi
movq %rbp, %rsi
callq 0x42b0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
je 0x19e76
movq %rsp, %rdi
movq %r14, %rsi
callq 0x19a7c
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x19ec8
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x4250
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x19de3
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x4250
jmp 0x19de3
movq %r13, %rdi
leaq 0x200(%rsp), %rsi
callq 0x19741
jmp 0x19de3
movq 0xb090(%rip), %rsi      # 0x24f98
leaq 0x80(%rsp), %rdi
callq 0x42f0
leaq 0xf8(%rsp), %rdi
callq 0x40c0
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x19f3e
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x4250
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x19f5a
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x4250
addq $0x708, %rsp            # imm = 0x708
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x19f7c
jmp 0x19f70
movq %rax, %rbx
jmp 0x19fd7
jmp 0x19f7c
movq %rax, %rbx
jmp 0x19fb6
movq %rax, %rbx
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x19f9b
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x4250
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x19fb6
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x4250
movq 0xafdb(%rip), %rsi      # 0x24f98
leaq 0x80(%rsp), %rdi
callq 0x42f0
leaq 0xf8(%rsp), %rdi
callq 0x40c0
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x19ff3
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x4250
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x1a00f
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x4250
movq %rbx, %rdi
callq 0x43b0
nop