// File: /workspace/github_cpp_makefile_star2_O2/cpirc[P]Monochrome/src/uci.cpp
// Function: UCI::listen()
void listen() {
    std::cout << "id name Monochrome" << std::endl;
    std::cout << "id author flok Gikoskos kz04px mkchan ZirconiumX"
              << std::endl;
    std::cout << "uciok" << std::endl;

    std::string word;
    std::string line;
    while (true) {
        std::getline(std::cin, line);
        std::stringstream ss{line};
        ss >> word;

        if (word == "isready") {
            isready();
            break;
        } else if (word == "setoption") {
            setoption(ss);
        } else if (word == "quit") {
            return;
        }
    }

    tt_create(&sc.tt, 128);
    ucinewgame();

    bool quit = false;
    while (!quit) {
        std::getline(std::cin, line);
        std::stringstream ss{line};
        ss >> word;

        if (word == "isready") {
            isready();
        } else if (word == "ucinewgame") {
            ucinewgame();
        } else if (word == "position") {
            position(ss);
        } else if (word == "go") {
            go(ss);
        } else if (word == "print") {
            Extension::print();
        } else if (word == "perft") {
            Extension::perft(ss);
        } else if (word == "ttperft") {
            Extension::ttperft(ss);
        } else if (word == "moves") {
            moves(ss);
        } else if (word == "quit") {
            quit = true;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1d8, %rsp            # imm = 0x1D8
movq 0x7031(%rip), %rbx      # 0xefc0
leaq 0x34ca(%rip), %rsi      # 0xb460
movq %rbx, %rdi
callq 0x2190
movq %rax, %rdi
callq 0x20c0
leaq 0x34c6(%rip), %rsi      # 0xb473
movq %rbx, %rdi
callq 0x2190
movq %rax, %rdi
callq 0x20c0
leaq 0x34e0(%rip), %rsi      # 0xb4a4
movq %rbx, %rdi
callq 0x2190
movq %rax, %rdi
callq 0x20c0
leaq -0x60(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
xorl %ecx, %ecx
movb %cl, (%rax)
leaq -0x40(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %cl, (%rax)
leaq -0x50(%rbp), %r14
leaq -0x1f8(%rbp), %r15
pushq $0x18
popq %r12
leaq -0x70(%rbp), %r13
leaq 0x349c(%rip), %rbx      # 0xb4aa
movq 0x6fbb(%rip), %rdi      # 0xefd0
movq %r14, %rsi
callq 0x2050
movq %r15, %rdi
movq %r14, %rsi
movl %r12d, %edx
callq 0x2240
movq %r15, %rdi
movq %r13, %rsi
callq 0x21d0
movq %r13, %rdi
movq %rbx, %rsi
callq 0x3977
testb %al, %al
jne 0x8083
movq %r13, %rdi
leaq 0x3463(%rip), %rsi      # 0xb4b2
callq 0x3977
testb %al, %al
je 0x8062
movq %r15, %rdi
callq 0x79d2
jmp 0x8079
movq %r13, %rdi
leaq 0x2656(%rip), %rsi      # 0xa6c2
callq 0x3977
testb %al, %al
jne 0x8201
movq %r15, %rdi
callq 0x2140
jmp 0x800e
callq 0x79b2
leaq -0x1f8(%rbp), %rdi
callq 0x2140
leaq 0x25366d(%rip), %rdi    # 0x25b708
movl $0x80, %esi
callq 0x7394
callq 0x798e
leaq -0x50(%rbp), %r14
leaq -0x1f8(%rbp), %r15
pushq $0x18
popq %r12
leaq -0x70(%rbp), %r13
leaq 0x33e6(%rip), %rbx      # 0xb4aa
movq 0x6f05(%rip), %rdi      # 0xefd0
movq %r14, %rsi
callq 0x2050
movq %r15, %rdi
movq %r14, %rsi
movl %r12d, %edx
callq 0x2240
movq %r15, %rdi
movq %r13, %rsi
callq 0x21d0
movq %r13, %rdi
movq %rbx, %rsi
callq 0x3977
testb %al, %al
je 0x8105
callq 0x79b2
jmp 0x81ce
movq %r13, %rdi
leaq 0x33ad(%rip), %rsi      # 0xb4bc
callq 0x3977
testb %al, %al
je 0x8122
callq 0x798e
jmp 0x81ce
movq %r13, %rdi
leaq 0x339b(%rip), %rsi      # 0xb4c7
callq 0x3977
testb %al, %al
je 0x8142
movq %r15, %rdi
callq 0x7e2f
jmp 0x81ce
movq %r13, %rdi
leaq 0x32fe(%rip), %rsi      # 0xb44a
callq 0x3977
testb %al, %al
je 0x815f
movq %r15, %rdi
callq 0x7b6e
jmp 0x81ce
movq %r13, %rdi
leaq 0x3367(%rip), %rsi      # 0xb4d0
callq 0x3977
testb %al, %al
je 0x8179
callq 0x7698
jmp 0x81ce
movq %r13, %rdi
leaq 0x3355(%rip), %rsi      # 0xb4d8
callq 0x3977
testb %al, %al
je 0x8196
movq %r15, %rdi
callq 0x76a9
jmp 0x81ce
movq %r13, %rdi
leaq 0x3336(%rip), %rsi      # 0xb4d6
callq 0x3977
testb %al, %al
je 0x81b3
movq %r15, %rdi
callq 0x781a
jmp 0x81ce
movq %r13, %rdi
leaq 0x3290(%rip), %rsi      # 0xb44d
callq 0x3977
testb %al, %al
je 0x81db
movq %r15, %rdi
callq 0x7d6c
movq %r15, %rdi
callq 0x2140
jmp 0x80c4
movq %r13, %rdi
leaq 0x24dd(%rip), %rsi      # 0xa6c2
callq 0x3977
movb %al, -0x29(%rbp)
movq %r15, %rdi
callq 0x2140
cmpb $0x0, -0x29(%rbp)
je 0x80c4
jmp 0x820d
leaq -0x1f8(%rbp), %rdi
callq 0x2140
leaq -0x50(%rbp), %rdi
callq 0x20a0
leaq -0x70(%rbp), %rdi
callq 0x20a0
addq $0x1d8, %rsp            # imm = 0x1D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x8242
jmp 0x823d
jmp 0x823d
jmp 0x823d
jmp 0x8242
jmp 0x823d
movq %rax, %rbx
jmp 0x8251
movq %rax, %rbx
leaq -0x1f8(%rbp), %rdi
callq 0x2140
leaq -0x50(%rbp), %rdi
callq 0x20a0
leaq -0x70(%rbp), %rdi
callq 0x20a0
movq %rbx, %rdi
callq 0x2290
nop