// File: /workspace/github_cpp_makefile_star2_O1/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 $0x1c8, %rsp            # imm = 0x1C8
movq 0x6ac6(%rip), %rbx      # 0x10fc8
leaq 0x3077(%rip), %rsi      # 0xd580
movl $0x12, %edx
movq %rbx, %rdi
callq 0x31e0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x31b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3130
leaq 0x304f(%rip), %rsi      # 0xd593
movl $0x30, %edx
movq %rbx, %rdi
callq 0x31e0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x31b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3130
leaq 0x3045(%rip), %rsi      # 0xd5c4
movl $0x5, %edx
movq %rbx, %rdi
callq 0x31e0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x31b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3130
leaq -0x58(%rbp), %rcx
movq %rcx, -0x10(%rcx)
xorl %eax, %eax
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq -0x38(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
movq 0x6a00(%rip), %rbx      # 0x10fd8
leaq -0x48(%rbp), %r15
leaq -0x1f0(%rbp), %r12
leaq -0x68(%rbp), %r13
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x31b0
movsbl %al, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3300
movq %r12, %rdi
movq %r15, %rsi
movl $0x18, %edx
callq 0x3280
movq %r12, %rdi
movq %r13, %rsi
callq 0x3200
movq %r13, %rdi
leaq 0x2f9c(%rip), %rsi      # 0xd5ca
callq 0x3070
testl %eax, %eax
je 0xa665
movq %r13, %rdi
leaq 0x2f91(%rip), %rsi      # 0xd5d2
callq 0x3070
testl %eax, %eax
je 0xa672
movq %r13, %rdi
leaq 0x216e(%rip), %rsi      # 0xc7c2
callq 0x3070
testl %eax, %eax
jne 0xa67a
movl $0x1, %r14d
jmp 0xa67d
movl $0x3, %r14d
callq 0x9e2e
jmp 0xa67d
movq %r12, %rdi
callq 0x9e7c
xorl %r14d, %r14d
movq %r12, %rdi
movq 0x6919(%rip), %rsi      # 0x10fa0
callq 0x3150
leaq -0x170(%rbp), %rdi
callq 0x3090
testl %r14d, %r14d
je 0xa5e7
cmpl $0x3, %r14d
jne 0xa889
leaq 0x253076(%rip), %rdi    # 0x25d728
movl $0x80, %esi
callq 0x96f8
leaq 0x2e2f(%rip), %rdi      # 0xd4f2
leaq 0x252fc6(%rip), %rsi    # 0x25d690
callq 0x6de8
leaq 0x253052(%rip), %rdi    # 0x25d728
callq 0x9822
xorl %r14d, %r14d
leaq -0x48(%rbp), %r15
leaq -0x1f0(%rbp), %r12
leaq -0x68(%rbp), %r13
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x31b0
movsbl %al, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3300
movq %r12, %rdi
movq %r15, %rsi
movl $0x18, %edx
callq 0x3280
movq %r12, %rdi
movq %r13, %rsi
callq 0x3200
movq %r13, %rdi
leaq 0x2e96(%rip), %rsi      # 0xd5ca
callq 0x3070
testl %eax, %eax
je 0xa7fe
movq %r13, %rdi
leaq 0x2e91(%rip), %rsi      # 0xd5dc
callq 0x3070
testl %eax, %eax
je 0xa805
movq %r13, %rdi
leaq 0x2e85(%rip), %rsi      # 0xd5e7
callq 0x3070
testl %eax, %eax
je 0xa826
movq %r13, %rdi
leaq 0x2df1(%rip), %rsi      # 0xd56a
callq 0x3070
testl %eax, %eax
je 0xa830
movq %r13, %rdi
leaq 0x2e60(%rip), %rsi      # 0xd5f0
callq 0x3070
testl %eax, %eax
je 0xa83a
movq %r13, %rdi
leaq 0x2e51(%rip), %rsi      # 0xd5f8
callq 0x3070
testl %eax, %eax
je 0xa848
movq %r13, %rdi
leaq 0x2e38(%rip), %rsi      # 0xd5f6
callq 0x3070
testl %eax, %eax
je 0xa852
movq %r13, %rdi
leaq 0x2d98(%rip), %rsi      # 0xd56d
callq 0x3070
testl %eax, %eax
je 0xa85c
movq %r13, %rdi
leaq 0x1fda(%rip), %rsi      # 0xc7c2
callq 0x3070
testl %eax, %eax
movzbl %r14b, %r14d
movl $0x1, %eax
cmovel %eax, %r14d
jmp 0xa864
callq 0x9e2e
jmp 0xa864
leaq 0x2ce6(%rip), %rdi      # 0xd4f2
leaq 0x252e7d(%rip), %rsi    # 0x25d690
callq 0x6de8
leaq 0x252f09(%rip), %rdi    # 0x25d728
callq 0x9822
jmp 0xa864
movq %r12, %rdi
callq 0xa35b
jmp 0xa864
movq %r12, %rdi
callq 0xa067
jmp 0xa864
leaq 0x252e4f(%rip), %rdi    # 0x25d690
callq 0x73cb
jmp 0xa864
movq %r12, %rdi
callq 0x9a45
jmp 0xa864
movq %r12, %rdi
callq 0x9c24
jmp 0xa864
movq %r12, %rdi
callq 0xa27d
movq %r12, %rdi
movq 0x6732(%rip), %rsi      # 0x10fa0
callq 0x3150
leaq -0x170(%rbp), %rdi
callq 0x3090
testb $0x1, %r14b
je 0xa6ed
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0xa89b
callq 0x31a0
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0xa8ad
callq 0x31a0
addq $0x1c8, %rsp            # imm = 0x1C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xa8c9
jmp 0xa8c9
jmp 0xa8c9
jmp 0xa8ce
jmp 0xa8c9
movq %rax, %rbx
jmp 0xa8f0
movq %rax, %rbx
movq 0x66c8(%rip), %rsi      # 0x10fa0
leaq -0x1f0(%rbp), %rdi
callq 0x3150
leaq -0x170(%rbp), %rdi
callq 0x3090
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0xa902
callq 0x31a0
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0xa914
callq 0x31a0
movq %rbx, %rdi
callq 0x32d0