// File: /workspace/github_cpp_makefile_star2_O3/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 0x6d7a(%rip), %rbx      # 0x10fc8
leaq 0x326b(%rip), %rsi      # 0xd4c0
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 0x3243(%rip), %rsi      # 0xd4d3
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 0x3239(%rip), %rsi      # 0xd504
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 -0x60(%rbp), %rcx
movq %rcx, -0x10(%rcx)
xorl %eax, %eax
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq -0x40(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
movq 0x6cb4(%rip), %rbx      # 0x10fd8
leaq -0x50(%rbp), %r15
leaq -0x1f8(%rbp), %r12
leaq -0x70(%rbp), %r13
leaq 0x31d0(%rip), %r14      # 0xd50a
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
movq %r14, %rsi
callq 0x3070
testl %eax, %eax
je 0xa3d9
movq %r13, %rdi
leaq 0x3182(%rip), %rsi      # 0xd512
callq 0x3070
testl %eax, %eax
je 0xa3b1
movq %r13, %rdi
leaq 0x231f(%rip), %rsi      # 0xc6c2
callq 0x3070
testl %eax, %eax
jne 0xa3b9
jmp 0xa5f2
movq %r12, %rdi
callq 0x9bce
movq %r12, %rdi
movq 0x6bdd(%rip), %rsi      # 0x10fa0
callq 0x3150
leaq -0x178(%rbp), %rdi
callq 0x3090
jmp 0xa33a
callq 0x9b80
movq 0x6bbb(%rip), %rsi      # 0x10fa0
leaq -0x1f8(%rbp), %rdi
callq 0x3150
leaq -0x178(%rbp), %rdi
callq 0x3090
leaq 0x2496dc(%rip), %rdi    # 0x253ae0
movl $0x80, %esi
callq 0x9464
leaq 0x301d(%rip), %rdi      # 0xd432
leaq 0x24962c(%rip), %rsi    # 0x253a48
callq 0x6afa
leaq 0x2496b8(%rip), %rdi    # 0x253ae0
callq 0x958e
leaq -0x50(%rbp), %r15
leaq -0x1f8(%rbp), %r12
leaq -0x70(%rbp), %r13
movq 0x6b5d(%rip), %r14      # 0x10fa0
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 0x3080(%rip), %rsi      # 0xd50a
callq 0x3070
testl %eax, %eax
je 0xa570
movq %r13, %rdi
leaq 0x307b(%rip), %rsi      # 0xd51c
callq 0x3070
testl %eax, %eax
je 0xa577
movq %r13, %rdi
leaq 0x306f(%rip), %rsi      # 0xd527
callq 0x3070
testl %eax, %eax
je 0xa598
movq %r13, %rdi
leaq 0x2fdb(%rip), %rsi      # 0xd4aa
callq 0x3070
testl %eax, %eax
je 0xa5a2
movq %r13, %rdi
leaq 0x304a(%rip), %rsi      # 0xd530
callq 0x3070
testl %eax, %eax
je 0xa5ac
movq %r13, %rdi
leaq 0x303b(%rip), %rsi      # 0xd538
callq 0x3070
testl %eax, %eax
je 0xa5ba
movq %r13, %rdi
leaq 0x3022(%rip), %rsi      # 0xd536
callq 0x3070
testl %eax, %eax
je 0xa5c4
movq %r13, %rdi
leaq 0x2f82(%rip), %rsi      # 0xd4ad
callq 0x3070
testl %eax, %eax
je 0xa5ce
movq %r13, %rdi
leaq 0x2180(%rip), %rsi      # 0xc6c2
callq 0x3070
movl %eax, -0x2c(%rbp)
movq %r12, %rdi
movq %r14, %rsi
callq 0x3150
leaq -0x178(%rbp), %rdi
callq 0x3090
cmpl $0x0, -0x2c(%rbp)
jne 0xa443
jmp 0xa611
callq 0x9b80
jmp 0xa5d6
leaq 0x2eb4(%rip), %rdi      # 0xd432
leaq 0x2494c3(%rip), %rsi    # 0x253a48
callq 0x6afa
leaq 0x24954f(%rip), %rdi    # 0x253ae0
callq 0x958e
jmp 0xa5d6
movq %r12, %rdi
callq 0xa0a7
jmp 0xa5d6
movq %r12, %rdi
callq 0x9db9
jmp 0xa5d6
leaq 0x249495(%rip), %rdi    # 0x253a48
callq 0x7137
jmp 0xa5d6
movq %r12, %rdi
callq 0x97b1
jmp 0xa5d6
movq %r12, %rdi
callq 0x9983
jmp 0xa5d6
movq %r12, %rdi
callq 0x9fcf
movq %r12, %rdi
movq %r14, %rsi
callq 0x3150
leaq -0x178(%rbp), %rdi
callq 0x3090
jmp 0xa443
movq 0x69a7(%rip), %rsi      # 0x10fa0
leaq -0x1f8(%rbp), %rdi
callq 0x3150
leaq -0x178(%rbp), %rdi
callq 0x3090
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0xa623
callq 0x31a0
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0xa635
callq 0x31a0
addq $0x1d8, %rsp            # imm = 0x1D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xa658
jmp 0xa653
jmp 0xa653
jmp 0xa658
jmp 0xa653
jmp 0xa653
movq %rax, %rbx
jmp 0xa67a
movq %rax, %rbx
movq 0x693e(%rip), %rsi      # 0x10fa0
leaq -0x1f8(%rbp), %rdi
callq 0x3150
leaq -0x178(%rbp), %rdi
callq 0x3090
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0xa68c
callq 0x31a0
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0xa69e
callq 0x31a0
movq %rbx, %rdi
callq 0x32d0