LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/JacobLCarter[P]2D-Portal/worldMap.cpp
// Function: World_Map::World_Map()
World_Map::World_Map()
{
    setRows(5);
    setColumns(5);
    cake = new Item("Cake", "Delicious birthday cake -- eating restores 5 turns.",
                    '+');
    portalGun = new Item("Portal Gun", "Spacial Manipulation Device allowing for"
                         " instantaneous traversal of great distance.", '%');
    companionCube = new Item("Companion Cube", "A very heavy metal cube that is"
                             " emblazoned with a large heart.", '#');
    makeNewMap();
}

// Assembly:
pushq %r14
pushq %rbx
subq $0xc8, %rsp
movq %rdi, %r14
movabsq $0x500000005, %rax      # imm = 0x500000005
movq %rax, (%rdi)
pushq $0x48
popq %rdi
callq 0x21a0
movq %rax, %rbx
leaq 0x34bb(%rip), %rsi      # 0x779f
leaq 0xa8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x385c
leaq 0x34a7(%rip), %rsi      # 0x77a4
leaq 0x88(%rsp), %rdi
leaq 0x6(%rsp), %rdx
callq 0x385c
leaq 0xa8(%rsp), %rsi
leaq 0x88(%rsp), %rdx
pushq $0x2b
popq %rcx
movq %rbx, %rdi
callq 0x3c06
movq %rbx, 0x10(%r14)
leaq 0x88(%rsp), %rdi
callq 0x20d0
leaq 0xa8(%rsp), %rdi
callq 0x20d0
pushq $0x48
popq %rdi
callq 0x21a0
movq %rax, %rbx
leaq 0x347e(%rip), %rsi      # 0x77d8
leaq 0x68(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x385c
leaq 0x3473(%rip), %rsi      # 0x77e3
leaq 0x48(%rsp), %rdi
leaq 0x6(%rsp), %rdx
callq 0x385c
leaq 0x68(%rsp), %rsi
leaq 0x48(%rsp), %rdx
pushq $0x25
popq %rcx
movq %rbx, %rdi
callq 0x3c06
movq %rbx, 0x18(%r14)
leaq 0x48(%rsp), %rdi
callq 0x20d0
leaq 0x68(%rsp), %rdi
callq 0x20d0
pushq $0x48
popq %rdi
callq 0x21a0
movq %rax, %rbx
leaq 0x3479(%rip), %rsi      # 0x7837
leaq 0x28(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x385c
leaq 0x3472(%rip), %rsi      # 0x7846
leaq 0x8(%rsp), %rdi
leaq 0x6(%rsp), %rdx
callq 0x385c
leaq 0x28(%rsp), %rsi
leaq 0x8(%rsp), %rdx
pushq $0x23
popq %rcx
movq %rbx, %rdi
callq 0x3c06
movq %rbx, 0x20(%r14)
leaq 0x8(%rsp), %rdi
callq 0x20d0
leaq 0x28(%rsp), %rdi
callq 0x20d0
movq %r14, %rdi
callq 0x449c
addq $0xc8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0x20d0
jmp 0x4435
movq %rax, %r14
leaq 0x28(%rsp), %rdi
jmp 0x4476
jmp 0x447d
movq %rax, %r14
leaq 0x48(%rsp), %rdi
callq 0x20d0
jmp 0x4450
movq %rax, %r14
leaq 0x68(%rsp), %rdi
jmp 0x4476
jmp 0x447d
movq %rax, %r14
leaq 0x88(%rsp), %rdi
callq 0x20d0
jmp 0x446e
movq %rax, %r14
leaq 0xa8(%rsp), %rdi
callq 0x20d0
jmp 0x4480
movq %rax, %r14
pushq $0x48
popq %rsi
movq %rbx, %rdi
callq 0x21b0
movq %r14, %rdi
callq 0x2280
nop
// File: /workspace/github_cpp_makefile_star2_O2/JacobLCarter[P]2D-Portal/worldMap.cpp
// Function: World_Map::makeNewMap()
void World_Map::makeNewMap()
{
     
    testChamberMap = new Space**[rows];
    for (int i = 0; i < rows; i++)
    {
        testChamberMap[i] = new Space*[columns];

        for (int j = 0; j < columns; j++)
        {
            testChamberMap[i][j] = new Floor;
        }
    }
   
    //add all special-type spaces
    initializeSpecialSpaces();
    //link all rooms together
    linkRooms();
    //add all items the map
    initializeItems();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movslq (%rdi), %r15
leaq (,%r15,8), %rdi
testq %r15, %r15
pushq $-0x1
popq %r12
cmovsq %r12, %rdi
callq 0x2030
movq %rax, 0x8(%rbx)
xorl %r13d, %r13d
pushq $0x38
popq %r14
movslq %r15d, %rax
cmpq %rax, %r13
jge 0x4532
movslq 0x4(%rbx), %r15
leaq (,%r15,8), %rdi
testq %r15, %r15
cmovsq %r12, %rdi
callq 0x2030
movq 0x8(%rbx), %rcx
movq %rax, (%rcx,%r13,8)
xorl %ebp, %ebp
movslq %r15d, %rax
cmpq %rax, %rbp
jge 0x452a
movq %r14, %rdi
callq 0x21a0
movq %rax, %r15
movq %rax, %rdi
callq 0x39dc
movq 0x8(%rbx), %rax
movq (%rax,%r13,8), %rax
movq %r15, (%rax,%rbp,8)
incq %rbp
movl 0x4(%rbx), %r15d
jmp 0x44fa
incq %r13
movl (%rbx), %r15d
jmp 0x44d0
movq %rbx, %rdi
callq 0x4b04
movq %rbx, %rdi
callq 0x4bce
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4c8c
movq %rax, %rbx
pushq $0x38
popq %rsi
movq %r15, %rdi
callq 0x21b0
movq %rbx, %rdi
callq 0x2280
// File: /workspace/github_cpp_makefile_star2_O2/JacobLCarter[P]2D-Portal/worldMap.cpp
// Function: World_Map::~World_Map()
World_Map::~World_Map()
{
    for (int i = 0; i < rows; i++)
    {
        for (int j = 0; j < columns; j++)
        {
            delete testChamberMap[i][j];
        }
        delete [] testChamberMap[i];
    }
    delete [] testChamberMap;
    testChamberMap = NULL;

    delete cake;
    delete portalGun;
    delete companionCube;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
xorl %r14d, %r14d
movslq (%rbx), %rax
cmpq %rax, %r14
jge 0x45b8
xorl %r15d, %r15d
movslq 0x4(%rbx), %rax
movq 0x8(%rbx), %rcx
movq (%rcx,%r14,8), %rdi
cmpq %rax, %r15
jge 0x45a9
movq (%rdi,%r15,8), %rdi
testq %rdi, %rdi
je 0x45a4
movq (%rdi), %rax
callq *0x8(%rax)
incq %r15
jmp 0x4584
testq %rdi, %rdi
je 0x45b3
callq 0x2210
incq %r14
jmp 0x4579
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x45c6
callq 0x2210
andq $0x0, 0x8(%rbx)
movq 0x10(%rbx), %r14
testq %r14, %r14
je 0x45dc
movq %r14, %rdi
callq 0x3c74
pushq $0x48
popq %rsi
movq %r14, %rdi
callq 0x21b0
movq 0x18(%rbx), %r14
testq %r14, %r14
je 0x45f8
movq %r14, %rdi
callq 0x3c74
pushq $0x48
popq %rsi
movq %r14, %rdi
callq 0x21b0
movq 0x20(%rbx), %rbx
testq %rbx, %rbx
je 0x4614
movq %rbx, %rdi
callq 0x3c74
pushq $0x48
popq %rsi
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x21b0
// File: /workspace/github_cpp_makefile_star2_O2/JacobLCarter[P]2D-Portal/worldMap.cpp
// Function: World_Map::getItem(int)
Item* World_Map::getItem(int itemToGet)
{
    //switch based on item specified
    switch (itemToGet)
    {
        case 1: return cake;
                break;
        case 2: return portalGun;
                break;
        case 3: return companionCube;
                break;
    }

    return NULL;
}

// Assembly:
cmpl $0x3, %esi
je 0x464b
cmpl $0x2, %esi
je 0x4646
cmpl $0x1, %esi
jne 0x4650
movq 0x10(%rdi), %rax
retq
movq 0x18(%rdi), %rax
retq
movq 0x20(%rdi), %rax
retq
xorl %eax, %eax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/JacobLCarter[P]2D-Portal/worldMap.cpp
// Function: World_Map::initializeSpecialSpaces()
void World_Map::initializeSpecialSpaces()
{
    addButton(1, 1);
    addDoor(1, 3);
    addChamberlock(1, 4);
    addToxic_Waste(4, 3);
    addToxic_Waste(3, 4);
    addToxic_Waste(1, 2);
    addWall(0, 1);
    addWall(0, 3);
    addWall(0, 4);
    addWall(2, 0);
    addWall(2, 3);
    addWall(2, 4);
    addWall(3, 1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
pushq $0x1
popq %rbp
movl %ebp, %esi
movl %ebp, %edx
callq 0x4cce
pushq $0x3
popq %r14
movq %rbx, %rdi
movl %ebp, %esi
movl %r14d, %edx
callq 0x4d38
pushq $0x4
popq %r15
movq %rbx, %rdi
movl %ebp, %esi
movl %r15d, %edx
callq 0x4da2
movq %rbx, %rdi
movl %r15d, %esi
movl %r14d, %edx
callq 0x4e0c
movq %rbx, %rdi
movl %r14d, %esi
movl %r15d, %edx
callq 0x4e0c
pushq $0x2
popq %r12
movq %rbx, %rdi
movl %ebp, %esi
movl %r12d, %edx
callq 0x4e0c
movq %rbx, %rdi
xorl %esi, %esi
movl %ebp, %edx
callq 0x4e76
movq %rbx, %rdi
xorl %esi, %esi
movl %r14d, %edx
callq 0x4e76
movq %rbx, %rdi
xorl %esi, %esi
movl %r15d, %edx
callq 0x4e76
movq %rbx, %rdi
movl %r12d, %esi
xorl %edx, %edx
callq 0x4e76
movq %rbx, %rdi
movl %r12d, %esi
movl %r14d, %edx
callq 0x4e76
movq %rbx, %rdi
movl %r12d, %esi
movl %r15d, %edx
callq 0x4e76
movq %rbx, %rdi
movl %r14d, %esi
movl %ebp, %edx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x4e76
// File: /workspace/github_cpp_makefile_star2_O2/JacobLCarter[P]2D-Portal/worldMap.cpp
// Function: World_Map::linkRooms()
void World_Map::linkRooms()
{
    for (int i = 0; i < rows; i++)
    {
        for (int j = 0; j < columns; j++)
        {
            //if not an edge, link to room above
            if (i > 0)
            {
                testChamberMap[i][j]->setSpaceUp(testChamberMap[i - 1][j]);
            }
            //if not an edge, link to room left
            if (j > 0)
            {
                testChamberMap[i][j]->setSpaceLeft(testChamberMap[i][j - 1]);
            }
            //if not an edge, link to room below
            if (i < rows - 1)
            {
                testChamberMap[i][j]->setSpaceBottom(testChamberMap[i + 1][j]);
            }
            //if not an edge, link to room right
            if (j < columns - 1)
            {
                testChamberMap[i][j]->setSpaceRight(testChamberMap[i][j + 1]);
            }
        }
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
xorl %r14d, %r14d
movslq (%rbx), %rax
cmpq %rax, %r14
jge 0x4c86
xorl %r15d, %r15d
movslq 0x4(%rbx), %rax
cmpq %rax, %r15
jge 0x4c7e
testq %r14, %r14
je 0x4c14
movq 0x8(%rbx), %rax
movq -0x8(%rax,%r14,8), %rcx
movq (%rax,%r14,8), %rax
movq (%rax,%r15,8), %rdi
movq (%rcx,%r15,8), %rsi
callq 0x37d6
testq %r15, %r15
je 0x4c2f
movq 0x8(%rbx), %rax
movq (%rax,%r14,8), %rax
movq -0x8(%rax,%r15,8), %rsi
movq (%rax,%r15,8), %rdi
callq 0x37e2
movslq (%rbx), %rax
decq %rax
cmpq %rax, %r14
jge 0x4c54
movq 0x8(%rbx), %rax
movq (%rax,%r14,8), %rcx
movq 0x8(%rax,%r14,8), %rax
movq (%rcx,%r15,8), %rdi
movq (%rax,%r15,8), %rsi
callq 0x37dc
movslq 0x4(%rbx), %rax
decq %rax
cmpq %rax, %r15
jge 0x4c76
movq 0x8(%rbx), %rax
movq (%rax,%r14,8), %rax
movq (%rax,%r15,8), %rdi
movq 0x8(%rax,%r15,8), %rsi
callq 0x37e8
incq %r15
jmp 0x4be8
incq %r14
jmp 0x4bd9
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/JacobLCarter[P]2D-Portal/utils.cpp
// Function: getString[abi:cxx11](bool)
std::string getString(bool prompt)
{
    std::string input;
  
    if (prompt == true)
    {
        std::cout << "Enter a word or phrase: ";
    }

    //get the user's input
    std::getline(std::cin, input);

    //remprompt if input is empty std::string
    while (input == "")
    {
        std::cout << "Empty string -- enter at least one character: "
            << std::endl;
        std::getline(std::cin, input);
    }
    
    return input;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
leaq 0x10(%rdi), %rax
movq %rax, (%rdi)
andq $0x0, 0x8(%rdi)
movb $0x0, 0x10(%rdi)
testl %esi, %esi
je 0x5147
movq 0x5e95(%rip), %rdi      # 0xafd0
leaq 0x277c(%rip), %rsi      # 0x78be
callq 0x2190
movq 0x5e92(%rip), %rdi      # 0xafe0
movq %rbx, %rsi
callq 0x2040
leaq 0x1476(%rip), %r14      # 0x65d3
movq 0x5e6c(%rip), %r15      # 0xafd0
leaq 0x276c(%rip), %r12      # 0x78d7
movq 0x5e6e(%rip), %r13      # 0xafe0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5ada
testb %al, %al
je 0x51a1
movq %r15, %rdi
movq %r12, %rsi
callq 0x2190
movq %rax, %rdi
callq 0x20e0
movq %r13, %rdi
movq %rbx, %rsi
callq 0x2040
jmp 0x5172
movq %rbx, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
jmp 0x51b0
movq %rax, %r14
movq %rbx, %rdi
callq 0x20d0
movq %r14, %rdi
callq 0x2280
// File: /workspace/github_cpp_makefile_star2_O2/JacobLCarter[P]2D-Portal/utils.cpp
// Function: mainMenu()
void fillArray(int *array, std::string filename)
{
    std::ifstream fins;
    fins.open(filename.c_str());
    
    std::string line;
    
    while (std::getline(fins, line))
    {
        line.erase(std::remove_if(line.begin(), line.end(), isspace), line.end());

        for (unsigned int i = 0; i < line.size(); i++)
        {
            int j = line[i] - '0'; 
            array[i] = j;
        }
    }
    fins.close();
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x28, %rsp
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x214d(%rip), %rsi      # 0x79c9
leaq 0x8(%rsp), %rdi
callq 0x22b0
leaq 0x2157(%rip), %rsi      # 0x79e4
leaq 0x8(%rsp), %rdi
callq 0x22a0
leaq 0x2165(%rip), %rsi      # 0x7a03
leaq 0x8(%rsp), %rdi
callq 0x22a0
leaq 0x2176(%rip), %rsi      # 0x7a25
leaq 0x8(%rsp), %rdi
callq 0x22a0
leaq 0x2189(%rip), %rsi      # 0x7a49
leaq 0x8(%rsp), %rdi
callq 0x22a0
leaq 0x219e(%rip), %rsi      # 0x7a6f
leaq 0x8(%rsp), %rdi
callq 0x22a0
leaq 0x21b5(%rip), %rsi      # 0x7a97
leaq 0x8(%rsp), %rdi
callq 0x22a0
leaq 0x21cc(%rip), %rsi      # 0x7abf
leaq 0x8(%rsp), %rdi
callq 0x22a0
leaq 0x21e4(%rip), %rsi      # 0x7ae8
leaq 0x8(%rsp), %rdi
callq 0x22a0
leaq 0x21fc(%rip), %rsi      # 0x7b11
leaq 0x8(%rsp), %rdi
callq 0x22a0
leaq 0x2214(%rip), %rsi      # 0x7b3a
leaq 0x8(%rsp), %rdi
callq 0x22a0
leaq 0x222c(%rip), %rsi      # 0x7b63
leaq 0x8(%rsp), %rdi
callq 0x22a0
leaq 0x2244(%rip), %rsi      # 0x7b8c
leaq 0x8(%rsp), %rdi
callq 0x22a0
leaq 0x225b(%rip), %rsi      # 0x7bb4
leaq 0x8(%rsp), %rdi
callq 0x22a0
leaq 0x2271(%rip), %rsi      # 0x7bdb
leaq 0x8(%rsp), %rdi
callq 0x22a0
leaq 0x2287(%rip), %rsi      # 0x7c02
leaq 0x8(%rsp), %rdi
callq 0x22a0
leaq 0x229c(%rip), %rsi      # 0x7c28
leaq 0x8(%rsp), %rdi
callq 0x22a0
leaq 0x22af(%rip), %rsi      # 0x7c4c
leaq 0x8(%rsp), %rdi
callq 0x22a0
leaq 0x22c0(%rip), %rsi      # 0x7c6e
leaq 0x8(%rsp), %rdi
callq 0x22a0
leaq 0x22cf(%rip), %rsi      # 0x7c8e
leaq 0x8(%rsp), %rdi
callq 0x22a0
movq 0x5600(%rip), %rbx      # 0xafd0
leaq 0x8(%rsp), %r14
leaq 0x22ce(%rip), %r15      # 0x7caa
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2180
movq %rax, %rdi
callq 0x20e0
movq %rax, %rdi
callq 0x20e0
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2190
xorl %edi, %edi
callq 0x51c3
movl %eax, %r12d
movq %rbx, %rdi
callq 0x20e0
leal -0x1(%r12), %eax
cmpl $0x1, %eax
ja 0x59dc
leaq 0x8(%rsp), %rdi
callq 0x20d0
movl %r12d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x5a39
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x20d0
movq %rbx, %rdi
callq 0x2280
// File: /workspace/github_cpp_makefile_star2_O2/JacobLCarter[P]2D-Portal/utils.cpp
// Function: printArray(int*, int)
void printArray(int *array, int s)
{
    int i = 0;
    
    while (i < s)
    {
        std::cout << array[i] << " ";
        i++;
    }
    std::cout << std::endl;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
xorl %r13d, %r13d
testl %esi, %esi
cmovlel %r13d, %ebx
movq 0x57b4(%rip), %r15      # 0xafd0
leaq 0x1210(%rip), %r12      # 0x6a33
cmpq %r13, %rbx
je 0x5844
movl (%r14,%r13,4), %esi
movq %r15, %rdi
callq 0x2270
movq %rax, %rdi
movq %r12, %rsi
callq 0x2190
incq %r13
jmp 0x5823
movq 0x5785(%rip), %rdi      # 0xafd0
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x20e0
// File: /workspace/github_cpp_makefile_star2_O2/JacobLCarter[P]2D-Portal/utils.cpp
// Function: replay()
char replay()
{
    char choice;

    do
    {
        std::cout << std::endl;
        std::cout << "Would you like to play again? (y/n)" << std::endl;
        choice = getMenuChar();
    }
    while (choice != 'y' && choice !='n');

    return choice;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq 0x5577(%rip), %rbx      # 0xafd0
leaq 0x2266(%rip), %r14      # 0x7cc6
movq %rbx, %rdi
callq 0x20e0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2190
movq %rax, %rdi
callq 0x20e0
callq 0x5618
cmpb $0x79, %al
je 0x5a8c
movzbl %al, %ecx
cmpl $0x6e, %ecx
jne 0x5a60
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/JacobLCarter[P]2D-Portal/utils.cpp
// Function: selectionYN()
char selectionYN()
{
    char choice;

    do
    {
        std::cout << std::endl;
        std::cout << "Please enter yes or no? (y/n)" << std::endl;
        choice = getMenuChar();
    }
    while (choice != 'y' && choice != 'n');

    return choice;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq 0x5531(%rip), %rbx      # 0xafd0
leaq 0x2244(%rip), %r14      # 0x7cea
movq %rbx, %rdi
callq 0x20e0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2190
movq %rax, %rdi
callq 0x20e0
callq 0x5618
cmpb $0x79, %al
je 0x5ad2
movzbl %al, %ecx
cmpl $0x6e, %ecx
jne 0x5aa6
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/JacobLCarter[P]2D-Portal/main.cpp
// Function: main
int main()
{
    //get user's choice at the main menu
    int menuChoice = mainMenu();

    //executes if the user chooses to play
    if (menuChoice == 1)
    {
        //loop repeats until the user chooses not to replay
        do
        {
            //make a new game
            Game *currentGame = new Game;
      
            //show the introduction and wait for the user to press enter to continue
            std::cout << currentGame->gameIntroduction();
            std::cin.get();

            //show the starting map
            currentGame->getMap()->showMap();

            //show the map legend
            std::cout << currentGame->getMap()->getMapLegend();

            //display the game's controls
            std::cout << currentGame->displayHelpMenu();

            //play another round while it is not true that the game is over
            while (!currentGame->getGameOver())
            {
                currentGame->playRound();
            }
           
            //free memory allocated for the game
            delete currentGame;
        }
        while (replay() != 'n');
    }
    else
    {
        std::cout << "Exiting the program" << std::endl;
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x20, %rsp
callq 0x5859
cmpl $0x1, %eax
jne 0x5cfd
pushq $0x20
popq %rbx
movq %rsp, %r14
movq 0x539c(%rip), %r15      # 0xafd0
movq 0x53a5(%rip), %r12      # 0xafe0
movq %rbx, %rdi
callq 0x21a0
movq %rax, %r13
movq %rax, %rdi
callq 0x252c
movq %r14, %rdi
movq %r13, %rsi
callq 0x2694
movq %r15, %rdi
movq %r14, %rsi
callq 0x2180
movq %r14, %rdi
callq 0x20d0
movq %r12, %rdi
callq 0x21f0
movq %r13, %rdi
callq 0x2680
movq %rax, %rdi
callq 0x4f78
movq %r13, %rdi
callq 0x2680
movq %r14, %rdi
movq %rax, %rsi
callq 0x4654
movq %r15, %rdi
movq %r14, %rsi
callq 0x2180
movq %r14, %rdi
callq 0x20d0
movq %r14, %rdi
movq %r13, %rsi
callq 0x2ed8
movq %r15, %rdi
movq %r14, %rsi
callq 0x2180
movq %r14, %rdi
callq 0x20d0
movq %r13, %rdi
callq 0x268c
movq %r13, %rdi
testb %al, %al
jne 0x5cde
callq 0x36f4
jmp 0x5cc8
callq 0x25ea
movq %r13, %rdi
movq %rbx, %rsi
callq 0x21b0
callq 0x5a4e
cmpb $0x6e, %al
jne 0x5c3b
jmp 0x5d18
movq 0x52cc(%rip), %rdi      # 0xafd0
leaq 0x1ffd(%rip), %rsi      # 0x7d08
callq 0x2190
movq %rax, %rdi
callq 0x20e0
xorl %eax, %eax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %rax, %rbx
pushq $0x20
popq %rsi
movq %r13, %rdi
callq 0x21b0
jmp 0x5d47
jmp 0x5d3c
jmp 0x5d3c
movq %rax, %rbx
movq %rsp, %rdi
callq 0x20d0
movq %rbx, %rdi
callq 0x2280
// File: /workspace/github_cpp_makefile_star2_O2/vjeux[P]jspp/example/scope.cpp
// Function: main::$_4::operator()(Object, Object)
_(function (var $) {
	var global = "local";

	std::cout << "Inside:      $ = " << $ << std::endl;
	std::cout << "Inside: global = " << global << std::endl;

	// Inside:      $ = jQuery
	// Inside: global = local

	return undefined;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x50, %rsp
movq %rcx, %r14
movq %rdi, %rbx
leaq 0x20c5(%rip), %rsi      # 0x924f
leaq 0x8(%rsp), %rdi
callq 0x588e
movq 0x5e3d(%rip), %rdi      # 0xcfd8
leaq 0x20b3(%rip), %rsi      # 0x9255
callq 0x2190
movq %rax, %r15
movq (%r14), %rax
leaq 0x38(%rsp), %rsi
movq %rax, (%rsi)
movq %rsi, 0x8(%rsi)
movq 0x10(%r14), %rax
movq %rax, 0x10(%rsi)
incl (%rax)
movq %r15, %rdi
callq 0x243c
movq %r15, %rdi
callq 0x20d0
leaq 0x38(%rsp), %rdi
callq 0x731a
movq 0x5df4(%rip), %rdi      # 0xcfd8
leaq 0x207c(%rip), %rsi      # 0x9267
callq 0x2190
movq %rax, %r14
movq 0x8(%rsp), %rax
movq 0x18(%rsp), %rcx
leaq 0x20(%rsp), %rsi
movq %rax, (%rsi)
movq %rsi, 0x8(%rsi)
movq %rcx, 0x10(%rsi)
incl (%rcx)
movq %r14, %rdi
callq 0x243c
movq %r14, %rdi
callq 0x20d0
leaq 0x20(%rsp), %rdi
callq 0x731a
movq 0x5f68(%rip), %rax      # 0xd198
movq %rax, (%rbx)
movq %rbx, 0x8(%rbx)
movq 0x5f6a(%rip), %rax      # 0xd1a8
movq %rax, 0x10(%rbx)
incl (%rax)
leaq 0x8(%rsp), %rdi
callq 0x731a
movq %rbx, %rax
addq $0x50, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
jmp 0x7272
movq %rax, %rbx
jmp 0x7277
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x731a
leaq 0x8(%rsp), %rdi
callq 0x731a
movq %rbx, %rdi
callq 0x2280
nop
// File: /workspace/github_cpp_makefile_star2_O2/cpirc[P]Monochrome/src/eval.cpp
// Function: int evaluate_mobility<(Piece)4>(Position const&)
int evaluate_mobility<QUEEN>(const Position& pos) {
    int score = 0;
    uint64_t pieces = get_piece(pos, QUEEN, US);

    while (pieces) {
        score += popcnt(attacks<QUEEN>(lsb(pieces), get_occupancy(pos))) *
                 mobility_weights[QUEEN];

        pieces &= pieces - 1;
    }

    return score;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x30(%rdi), %r14
andq 0x20(%rdi), %r14
xorl %r15d, %r15d
movabsq $0x3333333333333333, %r13 # imm = 0x3333333333333333
movabsq $0x101010101010101, %r12 # imm = 0x101010101010101
testq %r14, %r14
je 0x27cb
movq %r14, %rdi
callq 0x2939
movq 0x38(%rbx), %rsi
orq 0x30(%rbx), %rsi
movzbl %al, %edi
callq 0x28d5
movq %rax, %rcx
shrq %rcx
movabsq $0x5555555555555555, %rdx # imm = 0x5555555555555555
andq %rdx, %rcx
subq %rcx, %rax
movq %rax, %rcx
andq %r13, %rcx
shrq $0x2, %rax
andq %r13, %rax
addq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
addq %rax, %rcx
movabsq $0xf0f0f0f0f0f0f0f, %rax # imm = 0xF0F0F0F0F0F0F0F
andq %rax, %rcx
imulq %r12, %rcx
shrq $0x38, %rcx
leal (%r15,%rcx,4), %r15d
leaq -0x1(%r14), %rax
andq %rax, %r14
jmp 0x275c
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/cpirc[P]Monochrome/src/eval.cpp
// Function: evaluate(Position&)
int evaluate(Position& pos) {
    int opening = 0, endgame = 0;
    int phase = material_phase<>(pos);
    Colour side;

    for (side = US; side <= THEM; ++side) {
        // material + PST
        opening += evaluate_material<>(pos) + evaluate_pst<OPENING>(pos);
        endgame += evaluate_material<>(pos) + evaluate_pst<ENDGAME>(pos);

        // King safety
        opening += king_safety(pos);

        opening += evaluate_mobility<>(pos);
        endgame += evaluate_mobility<>(pos);

        // Passed pawns
        opening += evaluate_passers(pos);
        endgame += evaluate_passers(pos);

        opening = -opening;
        endgame = -endgame;
        flip_position(pos);
    }

    int score = ((phase * opening) + ((24 - phase) * endgame)) / 24;

    return score;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r14
callq 0x2d1b
movl %eax, -0x30(%rbp)
xorl %r15d, %r15d
movb $0x2, %al
xorl %ebx, %ebx
subb $0x1, %al
jb 0x289c
movq %r14, %rdi
movb %al, -0x29(%rbp)
callq 0x2964
movl %eax, %r12d
movq %r14, %rdi
callq 0x29db
movl %eax, %r13d
addl %r12d, %r13d
movq %r14, %rdi
callq 0x2964
movl %eax, -0x34(%rbp)
movq %r14, %rdi
callq 0x2a2b
movl %ebx, %r12d
movl %eax, %ebx
addl -0x34(%rbp), %ebx
movq %r14, %rdi
callq 0x2a7f
addl %eax, %r12d
addl %r13d, %r12d
movq %r14, %rdi
callq 0x2b0a
movl %eax, %r13d
movq %r14, %rdi
callq 0x2b0a
addl %eax, %r15d
addl %ebx, %r15d
movq %r14, %rdi
callq 0x2bc3
movl %eax, %ebx
addl %r13d, %ebx
addl %r12d, %ebx
movq %r14, %rdi
callq 0x2bc3
movl %eax, %r12d
addl %r15d, %r12d
negl %ebx
negl %r12d
movq %r14, %rdi
callq 0x2c63
movb -0x29(%rbp), %al
movl %r12d, %r15d
jmp 0x2800
movl -0x30(%rbp), %edx
imull %edx, %ebx
pushq $0x18
popq %rcx
movl %ecx, %eax
subl %edx, %eax
imull %eax, %r15d
addl %ebx, %r15d
movl %r15d, %eax
cltd
idivl %ecx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/cpirc[P]Monochrome/src/eval.cpp
// Function: int evaluate_pst<(Phase)0, (Piece)0>(Position const&)
inline int evaluate_pst(const Position& pos) {
    int score = 0;
    uint64_t pieces = get_piece(pos, p, US);

    while (pieces) {
        score += pst[p][ph][lsb(pieces)];

        pieces &= pieces - 1;
    }

    return score + evaluate_pst<ph, p + 1>(pos);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movq 0x30(%rdi), %r14
andq (%rdi), %r14
xorl %r15d, %r15d
leaq 0x6656(%rip), %r12      # 0x9050
testq %r14, %r14
je 0x2a17
movq %r14, %rdi
callq 0x2939
movzbl %al, %eax
addl (%r12,%rax,4), %r15d
leaq -0x1(%r14), %rax
andq %rax, %r14
jmp 0x29fa
movq %rbx, %rdi
callq 0x304e
addl %r15d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/cpirc[P]Monochrome/src/eval.cpp
// Function: king_safety(Position const&)
inline int king_safety(const Position& pos) {
    std::uint64_t king_bb = get_piece(pos, KING, US);
    Square king_sq = lsb(king_bb);
    std::uint64_t surrounding = attacks<KING>(king_sq, (std::uint64_t)0);

    int score = 0;

    // Nearby friendly pieces
    score += 5 * popcnt(surrounding & get_colour(pos, US));

    // Nearby unfriendly pieces
    // score -= 5*popcnt(surrounding & get_colour(pos, THEM));

    return score;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x30(%rdi), %rdi
andq 0x28(%rbx), %rdi
callq 0x2939
movzbl %al, %eax
leaq 0xcd01(%rip), %rcx      # 0xf7a0
movq 0x30(%rbx), %rdx
andq (%rcx,%rax,8), %rdx
movq %rdx, %rax
shrq %rax
movabsq $0x5555555555555555, %rcx # imm = 0x5555555555555555
andq %rax, %rcx
subq %rcx, %rdx
movabsq $0x3333333333333333, %rax # imm = 0x3333333333333333
movq %rdx, %rcx
andq %rax, %rcx
shrq $0x2, %rdx
andq %rax, %rdx
addq %rcx, %rdx
movq %rdx, %rax
shrq $0x4, %rax
addq %rdx, %rax
movabsq $0xf0f0f0f0f0f0f0f, %rcx # imm = 0xF0F0F0F0F0F0F0F
andq %rax, %rcx
movabsq $0x101010101010101, %rax # imm = 0x101010101010101
imulq %rcx, %rax
shrq $0x38, %rax
leal (%rax,%rax,4), %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/cpirc[P]Monochrome/src/eval.cpp
// Function: int evaluate_mobility<(Piece)2>(Position const&)
int evaluate_mobility(const Position& pos) {
    int score = 0;
    uint64_t pieces = get_piece(pos, p, US);

    while (pieces) {
        score += popcnt(attacks<p>(lsb(pieces), get_occupancy(pos))) *
                 mobility_weights[p];

        pieces &= pieces - 1;
    }

    return score + evaluate_mobility<p + 1>(pos);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x30(%rdi), %r14
andq 0x10(%rdi), %r14
xorl %r15d, %r15d
movabsq $0x3333333333333333, %r13 # imm = 0x3333333333333333
movabsq $0x101010101010101, %r12 # imm = 0x101010101010101
testq %r14, %r14
je 0x342b
movq %r14, %rdi
callq 0x2939
movq 0x38(%rbx), %rsi
orq 0x30(%rbx), %rsi
movzbl %al, %edi
callq 0x3445
movq %rax, %rcx
shrq %rcx
movabsq $0x5555555555555555, %rdx # imm = 0x5555555555555555
andq %rdx, %rcx
subq %rcx, %rax
movq %rax, %rcx
andq %r13, %rcx
shrq $0x2, %rax
andq %r13, %rax
addq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
addq %rax, %rcx
movabsq $0xf0f0f0f0f0f0f0f, %rax # imm = 0xF0F0F0F0F0F0F0F
andq %rax, %rcx
imulq %r12, %rcx
shrq $0x38, %rcx
leal (%r15,%rcx,4), %r15d
leaq -0x1(%r14), %rax
andq %rax, %r14
jmp 0x33bc
movq %rbx, %rdi
callq 0x347b
addl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/cpirc[P]Monochrome/src/eval.cpp
// Function: evaluate_passers(Position const&)
inline int evaluate_passers(const Position& pos) {
    int score = 0;
    std::uint64_t pawns = get_piece(pos, PAWN, US);

    while (pawns) {
        int sq = lsb(pawns);
        int rank = sq >> 3;
        int file = sq & 7;  // Do we have a macro for this?

        std::uint64_t mask = 0;

        mask |= 0x0101010101010101ULL << (sq + 8);

        if (file >= 1) {
            mask |= 0x0101010101010101ULL << (sq + 7);
        }

        if (file <= 6) {
            mask |= 0x0101010101010101ULL << (sq + 9);
        }

        if (!(mask & get_piece(pos, PAWN, THEM))) {
            score += passed_pawn_bonus[rank];
        }

        pawns &= pawns - 1;
    }

    return score;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x30(%rdi), %r14
andq (%rdi), %r14
movabsq $0x101010101010101, %r12 # imm = 0x101010101010101
xorl %r13d, %r13d
xorl %r15d, %r15d
testq %r14, %r14
je 0x2c51
movq %r14, %rdi
callq 0x2939
movzbl %al, %eax
leal 0x8(%rax), %ecx
movq %r12, %rdx
shlq %cl, %rdx
movl %eax, %esi
leal 0x7(%rax), %ecx
movq %r12, %rdi
shlq %cl, %rdi
andl $0x7, %esi
testl %esi, %esi
cmoveq %r13, %rdi
orq %rdx, %rdi
leal 0x9(%rax), %ecx
movq %r12, %rdx
shlq %cl, %rdx
cmpl $0x7, %esi
cmoveq %r13, %rdx
orq %rdi, %rdx
movq 0x38(%rbx), %rcx
andq (%rbx), %rcx
testq %rdx, %rcx
jne 0x2c48
shrl $0x3, %eax
leaq 0x703c(%rip), %rcx      # 0x9c80
addl (%rcx,%rax,4), %r15d
leaq -0x1(%r14), %rax
andq %rax, %r14
jmp 0x2beb
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/cpirc[P]Monochrome/src/position.h
// Function: flip_position(Position&)
inline void flip_position(Position& pos) {
    // Flip piece bitboards
    std::uint64_t* curr;
    for (curr = pos.pieces; curr < pos.pieces + 6; ++curr) *curr = bswap(*curr);

    // Reverse colour bitboards
    std::uint64_t tmp = pos.colours[1];
    pos.colours[1] = pos.colours[0];
    pos.colours[0] = tmp;

    // Flip colour bitboards
    for (curr = pos.colours; curr < pos.colours + 2; ++curr)
        *curr = bswap(*curr);

    // Flip epsq
    if (pos.epsq != INVALID_SQUARE) pos.epsq = Square(int(pos.epsq) ^ 56);

    // Flip castling rights
    std::uint8_t tmp2 = (pos.castle & 3) << 2;
    pos.castle >>= 2;
    pos.castle ^= tmp2;

    // Flip flipped
    pos.flipped = !pos.flipped;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
xorl %eax, %eax
cmpq $0x2f, %rax
ja 0x2c80
movq (%rdi,%rax), %rcx
bswapq %rcx
movq %rcx, (%rdi,%rax)
addq $0x8, %rax
jmp 0x2c69
movq 0x30(%rdi), %rax
movq 0x38(%rdi), %rcx
movq %rax, 0x38(%rdi)
movq %rcx, 0x30(%rdi)
movabsq $0x30, %rax
cmpq $0x3f, %rax
ja 0x2cb1
movq (%rdi,%rax), %rcx
bswapq %rcx
movq %rcx, (%rdi,%rax)
addq $0x8, %rax
jmp 0x2c9a
movb 0x42(%rdi), %al
cmpb $0x40, %al
je 0x2cbd
xorb $0x38, %al
movb %al, 0x42(%rdi)
movb 0x40(%rdi), %al
leal (,%rax,4), %ecx
andb $0xc, %cl
shrb $0x2, %al
xorb %cl, %al
movb %al, 0x40(%rdi)
xorb $0x1, 0x41(%rdi)
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/cpirc[P]Monochrome/src/eval.cpp
// Function: int evaluate_pst<(Phase)0, (Piece)5>(Position const&)
inline int evaluate_pst<OPENING, KING>(const Position& pos) {
    int score = 0;
    uint64_t pieces = get_piece(pos, KING, US);

    while (pieces) {
        score += pst[KING][OPENING][lsb(pieces)];

        pieces &= pieces - 1;
    }

    return score;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq 0x30(%rdi), %rbx
andq 0x28(%rdi), %rbx
xorl %r14d, %r14d
leaq 0x5e92(%rip), %r15      # 0x9050
testq %rbx, %rbx
je 0x31df
movq %rbx, %rdi
callq 0x2939
movzbl %al, %eax
addl 0xa00(%r15,%rax,4), %r14d
leaq -0x1(%rbx), %rax
andq %rax, %rbx
jmp 0x31be
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/cpirc[P]Monochrome/src/eval.cpp
// Function: int evaluate_pst<(Phase)1, (Piece)5>(Position const&)
inline int evaluate_pst<ENDGAME, KING>(const Position& pos) {
    int score = 0;
    uint64_t pieces = get_piece(pos, KING, US);

    while (pieces) {
        score += pst[KING][ENDGAME][lsb(pieces)];

        pieces &= pieces - 1;
    }

    return score;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq 0x30(%rdi), %rbx
andq 0x28(%rdi), %rbx
xorl %r14d, %r14d
leaq 0x5cf3(%rip), %r15      # 0x9050
testq %rbx, %rbx
je 0x337e
movq %rbx, %rdi
callq 0x2939
movzbl %al, %eax
addl 0xb00(%r15,%rax,4), %r14d
leaq -0x1(%rbx), %rax
andq %rax, %rbx
jmp 0x335d
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/cpirc[P]Monochrome/src/main.cpp
// Function: main
int main() {
    seed_rng(17594872);
    init_keys();
    init_bitboards();

    std::setbuf(stdout, NULL);
    std::setbuf(stdin, NULL);

    std::string line;
    while (true) {
        std::getline(std::cin, line);
        if (line == "uci") {
            UCI::listen();
            break;
        } else if (line == "xboard") {
            std::cout << "Protocol not supported" << std::endl;
        } else if (line == "quit") {
            break;
        } else {
            std::cout << "Unknown protocol" << std::endl;
        }
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl $0x10c79f8, %edi        # imm = 0x10C79F8
callq 0x3964
callq 0x5200
callq 0x24fc
movq 0xb708(%rip), %rax      # 0xef90
movq (%rax), %rdi
xorl %esi, %esi
callq 0x2200
movq 0xb71f(%rip), %rax      # 0xefb8
movq (%rax), %rdi
xorl %esi, %esi
callq 0x2200
leaq -0x38(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq -0x48(%rbp), %r14
leaq 0x6de2(%rip), %r15      # 0xa6a0
leaq 0x6ddf(%rip), %r12      # 0xa6a4
leaq 0x6ddf(%rip), %rbx      # 0xa6ab
movq 0xb6ed(%rip), %r13      # 0xefc0
movq 0xb6f6(%rip), %rdi      # 0xefd0
movq %r14, %rsi
callq 0x2050
movq %r14, %rdi
movq %r15, %rsi
callq 0x3977
testb %al, %al
jne 0x392f
movq %r14, %rdi
movq %r12, %rsi
callq 0x3977
movq %rbx, %rsi
testb %al, %al
jne 0x391d
movq %r14, %rdi
leaq 0x6db5(%rip), %rsi      # 0xa6c2
callq 0x3977
leaq 0x6dae(%rip), %rsi      # 0xa6c7
testb %al, %al
jne 0x3934
movq %r13, %rdi
callq 0x2190
movq %rax, %rdi
callq 0x20c0
jmp 0x38d3
callq 0x7f74
leaq -0x48(%rbp), %rdi
callq 0x20a0
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3950
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
callq 0x20a0
movq %rbx, %rdi
callq 0x2290
// File: /workspace/github_cpp_makefile_star2_O2/cpirc[P]Monochrome/src/move.cpp
// Function: move_to_lan(char*, unsigned int)
void move_to_lan(char* lan_str, const Move move) {
    assert(lan_str);

    Square from = from_square(move), to = to_square(move);

    lan_str[0] = square_str[(std::size_t)from][0];
    lan_str[1] = square_str[(std::size_t)from][1];

    lan_str[2] = square_str[(std::size_t)to][0];
    lan_str[3] = square_str[(std::size_t)to][1];

    if (promotion_type(move)) {
        switch (promotion_type(move)) {
            case KNIGHT:
                lan_str[4] = 'n';
                break;
            case BISHOP:
                lan_str[4] = 'b';
                break;
            case ROOK:
                lan_str[4] = 'r';
                break;
            case QUEEN:
                lan_str[4] = 'q';
                break;
            default:
                break;
        }
        lan_str[5] = '\0';
    } else
        lan_str[4] = '\0';
}

// Assembly:
testq %rdi, %rdi
je 0x3c20
movl %esi, %eax
andl $0x3f, %eax
leaq 0xaf85(%rip), %rcx      # 0xeb40
movq (%rcx,%rax,8), %rax
movb (%rax), %dl
movb %dl, (%rdi)
movb 0x1(%rax), %al
movb %al, 0x1(%rdi)
movl %esi, %eax
shrl $0x3, %eax
andl $0x1f8, %eax            # imm = 0x1F8
movq (%rax,%rcx), %rax
movb (%rax), %cl
movb %cl, 0x2(%rdi)
movb 0x1(%rax), %al
movb %al, 0x3(%rdi)
shrl $0xf, %esi
movl %esi, %ecx
andb $0x7, %cl
pushq $0x5
popq %rax
cmpb $0x4, %cl
ja 0x3c1b
andl $0x7, %esi
leaq 0x6b04(%rip), %rcx      # 0xa700
movslq (%rcx,%rsi,4), %rdx
addq %rcx, %rdx
jmpq *%rdx
pushq $0x4
popq %rax
jmp 0x3c1b
movb $0x71, %cl
jmp 0x3c18
movb $0x62, %cl
jmp 0x3c18
movb $0x72, %cl
jmp 0x3c18
movb $0x6e, %cl
movb %cl, 0x4(%rdi)
movb $0x0, (%rdi,%rax)
retq
pushq %rbp
movq %rsp, %rbp
leaq 0x6b65(%rip), %rdi      # 0xa790
leaq 0x6b66(%rip), %rsi      # 0xa798
leaq 0x6b6c(%rip), %rcx      # 0xa7a5
pushq $0x7a
popq %rdx
callq 0x2110
// File: /workspace/github_cpp_makefile_star2_O2/cpirc[P]Monochrome/src/move.cpp
// Function: run_move_to_lan_tests()
void run_move_to_lan_tests(void) {
    char str[6];

    move_to_lan(str, get_move(H2, H1, PROMOTION, TO_ROOK));
    printf("%s\n", str);
    move_to_lan(str, get_move(A5, C7, NORMAL));
    printf("%s\n", str);
    move_to_lan(str, get_move(G7, G8, PROMOTION, TO_BISHOP));
    printf("%s\n", str);
    move_to_lan(str, get_move(E7, E8, PROMOTION, TO_QUEEN));
    printf("%s\n", str);
    move_to_lan(str, get_move(F2, F1, PROMOTION, TO_KNIGHT));
    printf("%s\n", str);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq -0xe(%rbp), %rbx
movl $0x31683268, (%rbx)     # imm = 0x31683268
movw $0x72, 0x4(%rbx)
movq %rbx, %rdi
callq 0x2230
movl $0x37633561, (%rbx)     # imm = 0x37633561
movb $0x0, 0x4(%rbx)
movq %rbx, %rdi
callq 0x2230
movl $0x38673767, (%rbx)     # imm = 0x38673767
movw $0x62, 0x4(%rbx)
movq %rbx, %rdi
callq 0x2230
movl $0x38653765, (%rbx)     # imm = 0x38653765
movw $0x71, 0x4(%rbx)
movq %rbx, %rdi
callq 0x2230
movl $0x31663266, (%rbx)     # imm = 0x31663266
movw $0x6e, 0x4(%rbx)
movq %rbx, %rdi
callq 0x2230
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/cpirc[P]Monochrome/src/move.cpp
// Function: lan_to_move(Position const&, char const*, unsigned int&)
bool lan_to_move(const Position& pos, const char* lan_str, Move& move) {
    assert(lan_str);

    Square from = (Square)((lan_str[0] - 'a') + ((lan_str[1] - '1') * 8)),
           to = (Square)((lan_str[2] - 'a') + ((lan_str[3] - '1') * 8));
    Piece promo = NO_PIECE;

    switch (lan_str[4]) {
        case '\0':
            break;
        case 'n':
            promo = KNIGHT;
            break;
        case 'b':
            promo = BISHOP;
            break;
        case 'r':
            promo = ROOK;
            break;
        case 'q':
            promo = QUEEN;
            break;
        default:
            break;
    }

    SearchStack ss[1];
    clear_ss(ss, 1);

    int movecount;
    movecount = generate(pos, ss->ml);

    Move current_move;
    while ((current_move = next_move(ss, movecount))) {
        if (pos.flipped) {
            current_move = flip_move(current_move);
        }

        if (from_square(current_move) == from &&
            to_square(current_move) == to) {
            // FIX ME: This is very ugly
            if (promo != NO_PIECE && promotion_type(current_move) != promo) {
                continue;
            }
            move = current_move;
            return true;
        }
    }

    return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x838, %rsp            # imm = 0x838
testq %rsi, %rsi
je 0x3dcc
movq %rdi, %r14
movb 0x1(%rsi), %r13b
movb 0x3(%rsi), %bl
shlb $0x3, %r13b
addb (%rsi), %r13b
shlb $0x3, %bl
addb 0x2(%rsi), %bl
movzbl 0x4(%rsi), %eax
cmpl $0x62, %eax
movq %rdx, -0x38(%rbp)
je 0x3d14
cmpl $0x72, %eax
je 0x3d0c
cmpl $0x71, %eax
je 0x3d10
cmpl $0x6e, %eax
jne 0x3dbc
pushq $0x1
jmp 0x3d16
pushq $0x3
jmp 0x3d16
pushq $0x4
jmp 0x3d16
pushq $0x2
popq %rax
movl %eax, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
addb $0x17, %r13b
addb $0x17, %bl
leaq -0x860(%rbp), %r15
pushq $0x1
popq %rsi
movq %r15, %rdi
callq 0x61c7
leaq -0x85c(%rbp), %rsi
movq %r14, %rdi
callq 0x49ae
leaq -0x3c(%rbp), %r12
movl %eax, (%r12)
movq %r15, %rdi
movq %r12, %rsi
callq 0x5fa6
testl %eax, %eax
je 0x3da5
movl %eax, %ecx
andl $0x3ffff, %ecx          # imm = 0x3FFFF
xorl $0xe38, %ecx            # imm = 0xE38
cmpb $0x0, 0x41(%r14)
cmovel %eax, %ecx
movl %ecx, %edx
andb $0x3f, %dl
cmpb %r13b, %dl
jne 0x3d51
movl %ecx, %edx
shrl $0x6, %edx
andb $0x3f, %dl
cmpb %bl, %dl
jne 0x3d51
cmpb $0x0, -0x30(%rbp)
jne 0x3d9f
movl %ecx, %edx
shrl $0xf, %edx
andl $0x7, %edx
cmpl %edx, -0x2c(%rbp)
jne 0x3d51
movq -0x38(%rbp), %rdx
movl %ecx, (%rdx)
testl %eax, %eax
setne %al
addq $0x838, %rsp            # imm = 0x838
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x6
popq %rax
movl %eax, -0x2c(%rbp)
movb $0x1, %al
movl %eax, -0x30(%rbp)
jmp 0x3d21
leaq 0x69bd(%rip), %rdi      # 0xa790
leaq 0x69be(%rip), %rsi      # 0xa798
leaq 0x69e9(%rip), %rcx      # 0xa7ca
movl $0xaa, %edx
callq 0x2110
// File: /workspace/github_cpp_makefile_star2_O2/cpirc[P]Monochrome/src/move.cpp
// Function: pv_verify(Position const&, std::vector<unsigned int, std::allocator<unsigned int>>&)
bool pv_verify(const Position& pos, PV& pv) {
    Position npos = pos;
    Move moves[256];

    for (const auto& pv_move : pv) {
        bool found = false;

        int movecount = generate(npos, moves);
        for (int i = 0; i < movecount; i++) {
            if (pv_move == moves[i]) {
                make_move(npos, pv_move);
                found = true;
                break;
            }
        }

        if (!found) {
            return false;
        }
    }

    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x468, %rsp            # imm = 0x468
movq %rsi, %r14
movq %rdi, %rsi
leaq -0x90(%rbp), %rbx
movq %rbx, %rdi
callq 0x40d2
movq (%r14), %r15
movq 0x8(%r14), %r12
leaq -0x490(%rbp), %r14
xorl %r13d, %r13d
cmpq %r12, %r15
je 0x3e63
movq %rbx, %rdi
movq %r14, %rsi
callq 0x49ae
testl %eax, %eax
cmovlel %r13d, %eax
xorl %ecx, %ecx
cmpq %rcx, %rax
je 0x3e63
movl (%r15), %esi
leaq 0x1(%rcx), %rdx
cmpl -0x490(%rbp,%rcx,4), %esi
movq %rdx, %rcx
jne 0x3e3d
movq %rbx, %rdi
callq 0x3988
addq $0x4, %r15
jmp 0x3e25
cmpq %r12, %r15
sete %bl
leaq -0x40(%rbp), %rdi
callq 0x41a8
movl %ebx, %eax
addq $0x468, %rsp            # imm = 0x468
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3e88
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
callq 0x41a8
movq %rbx, %rdi
callq 0x2290
// File: /workspace/github_cpp_makefile_star2_O2/cpirc[P]Monochrome/src/position.h
// Function: move_piece(Position&, Square, Square, Piece, Colour)
inline void move_piece(Position& pos, const Square from, const Square to,
                       const Piece piece, const Colour colour) {
    assert(from != to);
    std::uint64_t from_to = (1ULL << from) ^ (1ULL << to);
    pos.pieces[piece] ^= from_to;
    pos.colours[colour] ^= from_to;
}

// Assembly:
cmpb %dl, %sil
je 0x4070
movl %ecx, %eax
pushq $0x1
popq %r9
movl %edx, %ecx
shlq %cl, %r9
btcq %rsi, %r9
movzbl %al, %eax
xorq %r9, (%rdi,%rax,8)
movzbl %r8b, %eax
xorq %r9, 0x30(%rdi,%rax,8)
retq
pushq %rbp
movq %rsp, %rbp
leaq 0x6818(%rip), %rdi      # 0xa893
leaq 0x681c(%rip), %rsi      # 0xa89e
leaq 0x6824(%rip), %rcx      # 0xa8ad
pushq $0x77
popq %rdx
callq 0x2110
// File: /workspace/github_cpp_makefile_star2_O2/cpirc[P]Monochrome/src/position.h
// Function: is_checked(Position const&, Colour)
inline bool is_checked(const Position& pos, const Colour c) {
    Colour by = (c == US ? THEM : US);
    return (attacks_to(pos, lsb(get_piece(pos, KING, c)), get_occupancy(pos),
                       c) &
            get_colour(pos, by)) > std::uint64_t(0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %r14d
movq %rdi, %rbx
xorl %r15d, %r15d
testl %esi, %esi
sete %r15b
movl %esi, %eax
movq 0x30(%rdi,%rax,8), %rdi
andq 0x28(%rbx), %rdi
callq 0x2939
movq 0x38(%rbx), %rdx
orq 0x30(%rbx), %rdx
movzbl %al, %esi
movq %rbx, %rdi
movl %r14d, %ecx
callq 0x422c
testq %rax, 0x30(%rbx,%r15,8)
setne %al
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/cpirc[P]Monochrome/src/move_gen.cpp
// Function: void add_moves<false, (Piece)5>(Position const&, unsigned int*, int&)
void add_moves<false, KING>(const Position& pos, Move* ml, int& idx) {
    std::uint64_t occ = get_occupancy(pos);

    Square from = lsb(get_piece(pos, KING, US));

    std::uint64_t attack_bb = attacks<KING>(from, occ) & ~occ;

    while (attack_bb) {
        Square dest = lsb(attack_bb);

        ml[idx] = get_move(from, dest, NORMAL);
        idx++;

        attack_bb &= attack_bb - 1;
    }

    if (!is_checked(pos, US)) {
        if (pos.castle & US_OO && !(occ & oo_castle_mask) &&
            !(attacks_to<>(pos, F1, occ, US) & get_colour(pos, THEM)) &&
            !(attacks_to<>(pos, G1, occ, US) & get_colour(pos, THEM))) {
            ml[idx] = get_move(E1, G1, CASTLE);
            idx++;
        }

        if (pos.castle & US_OOO && !(occ & ooo_castle_mask) &&
            !(attacks_to<>(pos, D1, occ, US) & get_colour(pos, THEM)) &&
            !(attacks_to<>(pos, C1, occ, US) & get_colour(pos, THEM))) {
            ml[idx] = get_move(E1, C1, CASTLE);
            idx++;
        }
    }

    // No tail call to end template recursion.
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq 0x30(%rdi), %rdi
movq 0x38(%r15), %r13
orq %rdi, %r13
andq 0x28(%r15), %rdi
callq 0x2939
movzbl %al, %r12d
leaq 0xaf42(%rip), %rax      # 0xf7a0
movq %r13, -0x30(%rbp)
notq %r13
andq (%rax,%r12,8), %r13
testq %r13, %r13
je 0x4891
movq %r13, %rdi
callq 0x2939
movzbl %al, %eax
shll $0x6, %eax
orl %r12d, %eax
movslq (%rbx), %rcx
movl %eax, (%r14,%rcx,4)
incl (%rbx)
leaq -0x1(%r13), %rax
andq %rax, %r13
jmp 0x4869
movq %r15, %rdi
xorl %esi, %esi
callq 0x40fd
testb %al, %al
movq -0x30(%rbp), %r12
jne 0x4935
testb $0x60, %r12b
jne 0x48ee
movb 0x40(%r15), %al
andb $0x1, %al
je 0x48ee
pushq $0x5
popq %rsi
movq %r15, %rdi
movq %r12, %rdx
xorl %ecx, %ecx
callq 0x422c
testq %rax, 0x38(%r15)
jne 0x48ee
pushq $0x6
popq %rsi
movq %r15, %rdi
movq %r12, %rdx
xorl %ecx, %ecx
callq 0x422c
testq %rax, 0x38(%r15)
jne 0x48ee
movslq (%rbx), %rax
movl $0x1184, (%r14,%rax,4)  # imm = 0x1184
incl (%rbx)
testb $0xe, %r12b
jne 0x4935
movb 0x40(%r15), %al
andb $0x2, %al
je 0x4935
pushq $0x3
popq %rsi
movq %r15, %rdi
movq %r12, %rdx
xorl %ecx, %ecx
callq 0x422c
testq %rax, 0x38(%r15)
jne 0x4935
pushq $0x2
popq %rsi
movq %r15, %rdi
movq %r12, %rdx
xorl %ecx, %ecx
callq 0x422c
testq %rax, 0x38(%r15)
jne 0x4935
movslq (%rbx), %rax
movl $0x1084, (%r14,%rax,4)  # imm = 0x1084
incl (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/cpirc[P]Monochrome/src/move_gen.cpp
// Function: void add_moves<true, (Piece)5>(Position const&, unsigned int*, int&)
void add_moves<true, KING>(const Position& pos, Move* ml, int& idx) {
    std::uint64_t occ = get_colour(pos, US) | get_colour(pos, THEM);

    Square from = lsb(get_piece(pos, KING, US));

    std::uint64_t attack_bb = attacks<KING>(from, occ) & get_colour(pos, THEM);

    while (attack_bb) {
        Square dest = lsb(attack_bb);

        ml[idx] = get_move(from, dest, CAPTURE);
        idx++;

        attack_bb &= attack_bb - 1;
    }

    // No tail call to end template recursion.
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq 0x28(%rdi), %rdi
andq 0x30(%r15), %rdi
callq 0x2939
movzbl %al, %r12d
leaq 0xae30(%rip), %rax      # 0xf7a0
movq 0x38(%r15), %r15
andq (%rax,%r12,8), %r15
testq %r15, %r15
je 0x49a5
movq %r15, %rdi
callq 0x2939
movzbl %al, %eax
shll $0x6, %eax
orl %r12d, %eax
orl $0x2000, %eax           # imm = 0x2000
movslq (%rbx), %rcx
movl %eax, (%r14,%rcx,4)
incl (%rbx)
leaq -0x1(%r15), %rax
andq %rax, %r15
jmp 0x4978
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/cpirc[P]Monochrome/src/move_gen.cpp
// Function: generate(Position const&, unsigned int*)
int generate(const Position& pos, Move* ml) {
    int idx = 0;

    add_moves<true>(pos, ml, idx);
    add_moves<false>(pos, ml, idx);

    return idx;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
leaq -0x1c(%rbp), %r15
andl $0x0, (%r15)
movq %r15, %rdx
callq 0x45fe
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x44bc
movl (%r15), %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq