LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/NathanWine[P]2048-AI-Solvers/include/Game.hpp
// Function: Game::Game()
Game() : score(0), state{{0, 0, 0, 0}, 
                                 {0, 0, 0, 0}, 
                                 {0, 0, 0, 0}, 
                                 {0, 0, 0, 0}} {
            addNew();
            addNew();
        }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0xb0, %rsp
movq %rdi, %rbx
andl $0x0, (%rdi)
xorps %xmm0, %xmm0
leaq 0xa0(%rsp), %rsi
movaps %xmm0, (%rsi)
leaq 0x10(%rsp), %r14
pushq $0x4
popq %rdx
leaq 0xf(%rsp), %rcx
movq %r14, %rdi
callq 0x2a54
leaq 0x28(%rsp), %r15
leaq 0x90(%rsp), %rsi
xorps %xmm0, %xmm0
movaps %xmm0, (%rsi)
pushq $0x4
popq %rdx
leaq 0xe(%rsp), %rcx
movq %r15, %rdi
callq 0x2a54
leaq 0x40(%rsp), %r15
xorps %xmm0, %xmm0
leaq 0x80(%rsp), %rsi
movaps %xmm0, (%rsi)
pushq $0x4
popq %rdx
leaq 0xd(%rsp), %rcx
movq %r15, %rdi
callq 0x2a54
leaq 0x58(%rsp), %r15
leaq 0x70(%rsp), %rsi
xorps %xmm0, %xmm0
movaps %xmm0, (%rsi)
pushq $0x4
popq %rdx
leaq 0xc(%rsp), %rcx
movq %r15, %rdi
callq 0x2a54
leaq 0x8(%rbx), %r14
leaq 0x10(%rsp), %rsi
pushq $0x4
popq %rdx
leaq 0xb(%rsp), %rcx
movq %r14, %rdi
callq 0x2c3a
pushq $0x48
popq %r15
leaq (%rsp,%r15), %rdi
addq $0x10, %rdi
callq 0x2e28
addq $-0x18, %r15
cmpq $-0x18, %r15
jne 0x2b96
movq %rbx, %rdi
callq 0x559e
movq %rbx, %rdi
callq 0x559e
addq $0xb0, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
pushq $0x48
popq %r14
leaq (%rsp,%r14), %rdi
addq $0x10, %rdi
callq 0x2e28
addq $-0x18, %r14
cmpq $-0x18, %r14
jne 0x2bd1
jmp 0x2c14
jmp 0x2bee
jmp 0x2bee
movq %rax, %rbx
addq $-0x18, %r15
movq %r15, %rdi
callq 0x2e28
cmpq %r14, %r15
jne 0x2bf1
jmp 0x2c14
movq %rax, %rbx
jmp 0x2c14
movq %rax, %rbx
movq %r14, %rdi
callq 0x2abc
movq %rbx, %rdi
callq 0x22c0
// File: /workspace/github_cpp_makefile_star2_O2/NathanWine[P]2048-AI-Solvers/src/Minimax.cpp
// Function: minimaxSolve(int, int, int, std::vector<int, std::allocator<int>>&, std::vector<int, std::allocator<int>>&)
int minimaxSolve(int n, int depth, int display_level, 
    std::vector<int> &scores, std::vector<int> &highest_tiles) {

    int successes = 0;
    for (int i = 0; i < n; ++i) {
        std::pair<int, int> result = minimaxSearch(depth, display_level, Game());
        if (result.first >= WIN) {
            successes++;
        }
        highest_tiles.push_back(result.first);
        scores.push_back(result.second);
    }
    return successes;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r8, 0x10(%rsp)
movq %rcx, %r15
movl %edx, %ebp
movl %esi, %r12d
movl %edi, %r13d
xorl %r14d, %r14d
testl %edi, %edi
cmovlel %r14d, %r13d
leaq 0x18(%rsp), %rbx
subl $0x1, %r13d
jb 0x39a3
movq %rbx, %rdi
callq 0x2ade
movl %r12d, %edi
movl %ebp, %esi
movq %rbx, %rdx
callq 0x35b1
movq %rax, 0x8(%rsp)
leaq 0x20(%rsp), %rdi
callq 0x2abc
xorl %eax, %eax
cmpl $0x800, 0x8(%rsp)       # imm = 0x800
setge %al
addl %eax, %r14d
movq 0x10(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x2c1c
movq %r15, %rdi
leaq 0xc(%rsp), %rsi
callq 0x2c1c
jmp 0x394b
movl %r14d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x2abc
movq %rbx, %rdi
callq 0x22c0
// File: /workspace/github_cpp_makefile_star2_O2/NathanWine[P]2048-AI-Solvers/src/Main.cpp
// Function: CmdParser::getCmdOption(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) const
const std::string& getCmdOption(const std::string &opt) const {
            std::vector<std::string>::const_iterator itr;
            itr =  std::find(cmds.begin(), cmds.end(), opt);
            if (itr != cmds.end() && ++itr != cmds.end()){
                return *itr;
            }
            static const std::string empty_string("");
            return empty_string;
        }

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rdx
movq %rdi, %r14
movq (%rdi), %rdi
movq 0x8(%r14), %rsi
callq 0x4c8d
movq %rax, %rbx
movq 0x8(%r14), %rax
cmpq %rax, %rbx
setne %cl
addq $0x20, %rbx
cmpq %rax, %rbx
setne %al
testb %al, %cl
jne 0x4942
movb 0x8891(%rip), %al       # 0xd1c8
leaq 0x886a(%rip), %rbx      # 0xd1a8
testb %al, %al
je 0x494d
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x8874(%rip), %rdi      # 0xd1c8
callq 0x22e0
testl %eax, %eax
je 0x4942
leaq 0x8844(%rip), %rbx      # 0xd1a8
leaq 0x3720(%rip), %rsi      # 0x808b
leaq 0x7(%rsp), %rdx
movq %rbx, %rdi
callq 0x48c4
movq 0x8641(%rip), %rdi      # 0xcfc0
leaq 0x880a(%rip), %rdx      # 0xd190
movq %rbx, %rsi
callq 0x2180
leaq 0x8833(%rip), %rdi      # 0xd1c8
callq 0x2110
jmp 0x4942
movq %rax, %rbx
leaq 0x8822(%rip), %rdi      # 0xd1c8
callq 0x2100
movq %rbx, %rdi
callq 0x22c0
// File: /workspace/github_cpp_makefile_star2_O2/NathanWine[P]2048-AI-Solvers/src/Game.cpp
// Function: print_vec(std::vector<std::vector<int, std::allocator<int>>, std::allocator<std::vector<int, std::allocator<int>>>>)
void print_vec(board v) {
    for (int i = 0; i < (int) v.size(); ++i) {
        for (int j = 0; j < (int) v[i].size(); ++j) {
            std::cout << v[i][j] << " ";
        }
        std::cout << std::endl;
    }
    std::cout << std::endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r12d, %r12d
movq 0x7b10(%rip), %r14      # 0xcfd0
leaq 0x2c7a(%rip), %r15      # 0x8141
movq (%rbx), %rcx
movq 0x8(%rbx), %rax
subq %rcx, %rax
cqto
pushq $0x18
popq %rsi
idivq %rsi
cltq
cmpq %rax, %r12
jge 0x552b
imulq $0x18, %r12, %rbp
xorl %r13d, %r13d
movq (%rcx,%rbp), %rax
movq 0x8(%rcx,%rbp), %rcx
subq %rax, %rcx
shrq $0x2, %rcx
movslq %ecx, %rcx
cmpq %rcx, %r13
jge 0x551e
movl (%rax,%r13,4), %esi
movq %r14, %rdi
callq 0x22b0
movq %rax, %rdi
movq %r15, %rsi
callq 0x21b0
incq %r13
movq (%rbx), %rcx
jmp 0x54e7
movq %r14, %rdi
callq 0x20d0
incq %r12
jmp 0x54c7
movq 0x7a9e(%rip), %rdi      # 0xcfd0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x20d0
// File: /workspace/github_cpp_makefile_star2_O2/NathanWine[P]2048-AI-Solvers/src/Game.cpp
// Function: numDigits(int)
int numDigits(int32_t x)
{
    if (x >= 10000) {
        if (x >= 10000000) {
            if (x >= 100000000) {
                if (x >= 1000000000)
                    return 10;
                return 9;
            }
            return 8;
        }
        if (x >= 100000) {
            if (x >= 1000000)
                return 7;
            return 6;
        }
        return 5;
    }
    if (x >= 100) {
        if (x >= 1000)
            return 4;
        return 3;
    }
    if (x >= 10)
        return 2;
    return 1;
}

// Assembly:
cmpl $0x2710, %edi           # imm = 0x2710
jl 0x5567
cmpl $0x989680, %edi         # imm = 0x989680
jb 0x5576
cmpl $0x5f5e100, %edi        # imm = 0x5F5E100
jb 0x5596
cmpl $0x3b9aca00, %edi       # imm = 0x3B9ACA00
pushq $0x9
jmp 0x5586
cmpl $0x64, %edi
jl 0x558b
cmpl $0x3e8, %edi            # imm = 0x3E8
pushq $0x3
jmp 0x5586
cmpl $0x186a0, %edi          # imm = 0x186A0
jb 0x559a
cmpl $0xf4240, %edi          # imm = 0xF4240
pushq $0x6
popq %rax
sbbl $-0x1, %eax
retq
xorl %eax, %eax
cmpl $0xa, %edi
setge %al
incl %eax
retq
pushq $0x8
jmp 0x559c
pushq $0x5
popq %rax
retq
// File: /workspace/github_cpp_makefile_star2_O2/NathanWine[P]2048-AI-Solvers/src/Game.cpp
// Function: Game::addNew()
void Game::addNew() {
    // Create vector of empty tiles
    std::vector<std::pair<int, int>> empty_tiles;
    for (int i = 0; i < DIM; ++i) {
        for (int j = 0; j < DIM; ++j) {
            if (state[i][j] == 0) {
                empty_tiles.push_back(std::pair<int, int>(i, j));
            }
        }
    }

    int size = empty_tiles.size();
    if (size > 0) {
        // Get random empty tile coordinates
        std::pair<int, int> choice = empty_tiles[DISTS[size-1](rng)];

        // Generating a random value of 2 or 4 (weighted probability)
        if (DISTS[9](rng) > 0) {
            state[choice.first][choice.second] = 2;
        }
        else {
            state[choice.first][choice.second] = 4;
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
leaq 0x10(%rsp), %r14
andq $0x0, 0x10(%r14)
xorps %xmm0, %xmm0
movaps %xmm0, (%r14)
xorl %r12d, %r12d
leaq 0x8(%rsp), %r15
cmpq $0x4, %r12
je 0x5606
imulq $0x18, %r12, %r13
xorl %ebp, %ebp
cmpq $0x4, %rbp
je 0x5601
movq 0x8(%rbx), %rax
movq (%rax,%r13), %rax
cmpl $0x0, (%rax,%rbp,4)
jne 0x55fc
movl %r12d, 0x8(%rsp)
movl %ebp, 0xc(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x6810
incq %rbp
jmp 0x55d4
incq %r12
jmp 0x55c8
movq 0x18(%rsp), %rax
subq 0x10(%rsp), %rax
sarq $0x3, %rax
testl %eax, %eax
jle 0x5672
decl %eax
leaq 0xa2cf(%rip), %rcx      # 0xf8f0
leaq (%rcx,%rax,8), %rdi
leaq 0x8f34(%rip), %rsi      # 0xe560
callq 0x2ab4
cltq
movq 0x10(%rsp), %rcx
movslq (%rcx,%rax,8), %r15
movslq 0x4(%rcx,%rax,8), %r14
leaq 0xa2f0(%rip), %rdi      # 0xf938
leaq 0x8f11(%rip), %rsi      # 0xe560
callq 0x2ab4
xorl %ecx, %ecx
testl %eax, %eax
setle %cl
movq 0x8(%rbx), %rax
imulq $0x18, %r15, %rdx
movq (%rax,%rdx), %rax
leal 0x2(,%rcx,2), %ecx
movl %ecx, (%rax,%r14,4)
leaq 0x10(%rsp), %rdi
callq 0x67dc
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x568d
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x67dc
movq %rbx, %rdi
callq 0x22c0
// File: /workspace/github_cpp_makefile_star2_O2/NathanWine[P]2048-AI-Solvers/src/Game.cpp
// Function: Game::canContinue() const
bool Game::canContinue() const {
    for (int i = 0; i < DIM; ++i) {
        for (int j = 0; j < DIM; ++j) {
            if (state[i][j] == 0)
                return true;
            if ((i < (DIM-1) && state[i][j] == state[i + 1][j]) || 
                (j < (DIM-1) && state[i][j] == state[i][j + 1]))    // If adj. hor/ver match
                return true;
        }
    }
    return false;
}

// Assembly:
movq 0x8(%rdi), %rax
leaq 0x18(%rax), %rdx
xorl %ecx, %ecx
cmpq $0x4, %rcx
je 0x56f5
imulq $0x18, %rcx, %rsi
movq (%rax,%rsi), %rdi
addq %rdx, %rsi
xorl %r8d, %r8d
cmpq $0x4, %r8
je 0x56f0
movl (%rdi,%r8,4), %r9d
testl %r9d, %r9d
je 0x56f5
cmpq $0x3, %rcx
je 0x56de
movq (%rsi), %r10
cmpl (%r10,%r8,4), %r9d
je 0x56f5
cmpq $0x3, %r8
je 0x56eb
cmpl 0x4(%rdi,%r8,4), %r9d
je 0x56f5
incq %r8
jmp 0x56c0
incq %rcx
jmp 0x56ac
cmpq $0x4, %rcx
setb %al
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/NathanWine[P]2048-AI-Solvers/src/Game.cpp
// Function: Game::up(bool)
void Game::up(bool peak) {
    board prev_state = state;
    mergeUp();
    compressUp(peak);
    if (state != prev_state && !peak) {
        addNew();
    }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movl %esi, %ebp
movq %rdi, %rbx
leaq 0x8(%rdi), %r14
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x29fa
movq %rbx, %rdi
callq 0x5c98
movq %rbx, %rdi
xorl %esi, %esi
callq 0x5d6e
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x647a
xorb $0x1, %al
orb %bpl, %al
jne 0x5990
movq %rbx, %rdi
callq 0x559e
leaq 0x8(%rsp), %rdi
callq 0x2abc
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x2abc
movq %rbx, %rdi
callq 0x22c0
// File: /workspace/github_cpp_makefile_star2_O2/NathanWine[P]2048-AI-Solvers/src/Game.cpp
// Function: Game::mergeUp()
void Game::mergeUp() {
    for (int col = 0; col < DIM; ++col) {
        std::vector<int> merged_column;
        for (int i = 0; i < DIM; ++i) {
            if (state[i][col] != 0) {
                merged_column.push_back(state[i][col]);
            }            
        }
        while (merged_column.size() < DIM) {
            merged_column.push_back(0);
        }
        for (int i = 0; i < DIM; ++i) {
            state[i][col] = merged_column[i];
        }
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x30, %rsp
movq %rdi, %rbx
xorl %r12d, %r12d
leaq 0x10(%rsp), %r14
leaq 0xc(%rsp), %r15
cmpq $0x4, %r12
je 0x5d49
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
andq $0x0, 0x20(%rsp)
xorl %r13d, %r13d
cmpq $0x60, %r13
je 0x5d07
movq 0x8(%rbx), %rax
movq (%rax,%r13), %rax
cmpl $0x0, (%rax,%r12,4)
je 0x5cf1
leaq (%rax,%r12,4), %rsi
movq %r14, %rdi
callq 0x2c1c
addq $0x18, %r13
jmp 0x5cd0
andl $0x0, 0xc(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x7016
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
subq %rax, %rcx
cmpq $0x10, %rcx
jb 0x5cf7
movq 0x8(%rbx), %rcx
xorl %edx, %edx
cmpq $0x4, %rdx
je 0x5d39
movl (%rax,%rdx,4), %esi
movq (%rcx), %rdi
movl %esi, (%rdi,%r12,4)
incq %rdx
addq $0x18, %rcx
jmp 0x5d20
movq %r14, %rdi
callq 0x2e28
incq %r12
jmp 0x5cb5
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
jmp 0x5d59
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x2e28
movq %rbx, %rdi
callq 0x22c0
// File: /workspace/github_cpp_makefile_star2_O2/NathanWine[P]2048-AI-Solvers/src/Game.cpp
// Function: Game::hamburgerFlip()
void Game::hamburgerFlip() {
    board flipped_state = {{}, {}, {}, {}};
    for (int row = (DIM-1), i = 0; row >= 0; --row, ++i) {
        flipped_state[i] = state[row];
    }
    state = flipped_state;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x80, %rsp
movq %rdi, %rbx
xorps %xmm0, %xmm0
leaq 0x20(%rsp), %rsi
movaps %xmm0, 0x50(%rsi)
movaps %xmm0, 0x40(%rsi)
movaps %xmm0, 0x30(%rsi)
movaps %xmm0, 0x20(%rsi)
movaps %xmm0, 0x10(%rsi)
movaps %xmm0, (%rsi)
leaq 0x8(%rsp), %rdi
pushq $0x4
popq %rdx
leaq 0x7(%rsp), %rcx
callq 0x2c3a
pushq $0x48
popq %r14
leaq (%rsp,%r14), %rdi
addq $0x20, %rdi
callq 0x2e28
addq $-0x18, %r14
cmpq $-0x18, %r14
jne 0x5fd1
addq $0x8, %rbx
pushq $0x3
popq %rbp
xorl %r14d, %r14d
cmpq $0x60, %r14
je 0x6016
movl %ebp, %eax
imulq $0x18, %rax, %rsi
addq (%rbx), %rsi
movq 0x8(%rsp), %rdi
addq %r14, %rdi
callq 0x64e6
decl %ebp
addq $0x18, %r14
jmp 0x5ff2
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x65b0
leaq 0x8(%rsp), %rdi
callq 0x2abc
addq $0x80, %rsp
popq %rbx
popq %r14
popq %rbp
retq
jmp 0x605b
movq %rax, %rbx
pushq $0x48
popq %r14
leaq (%rsp,%r14), %rdi
addq $0x20, %rdi
callq 0x2e28
addq $-0x18, %r14
cmpq $-0x18, %r14
jne 0x6042
jmp 0x6068
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x2abc
movq %rbx, %rdi
callq 0x22c0
// File: /workspace/github_cpp_makefile_star2_O2/NathanWine[P]2048-AI-Solvers/src/Game.cpp
// Function: Game::transpose()
void Game::transpose() {
    board transposed_state = {{0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,0,0,0}};
    for (int i = 0; i < DIM; ++i) {
        for (int j = 0; j < DIM; ++j) {
            transposed_state[i][j] = state[j][i];
        }
    }
    state = transposed_state;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0xc0, %rsp
movq %rdi, %rbx
xorps %xmm0, %xmm0
leaq 0xb0(%rsp), %rsi
movaps %xmm0, (%rsi)
leaq 0x20(%rsp), %r14
pushq $0x4
popq %rdx
leaq 0x7(%rsp), %rcx
movq %r14, %rdi
callq 0x2a54
leaq 0x38(%rsp), %r15
leaq 0xa0(%rsp), %rsi
xorps %xmm0, %xmm0
movaps %xmm0, (%rsi)
pushq $0x4
popq %rdx
leaq 0x6(%rsp), %rcx
movq %r15, %rdi
callq 0x2a54
leaq 0x50(%rsp), %r15
xorps %xmm0, %xmm0
leaq 0x90(%rsp), %rsi
movaps %xmm0, (%rsi)
pushq $0x4
popq %rdx
leaq 0x5(%rsp), %rcx
movq %r15, %rdi
callq 0x2a54
leaq 0x68(%rsp), %r15
leaq 0x80(%rsp), %rsi
xorps %xmm0, %xmm0
movaps %xmm0, (%rsi)
pushq $0x4
popq %rdx
leaq 0x4(%rsp), %rcx
movq %r15, %rdi
callq 0x2a54
leaq 0x8(%rsp), %rdi
leaq 0x20(%rsp), %rsi
pushq $0x4
popq %rdx
leaq 0x3(%rsp), %rcx
callq 0x2c3a
pushq $0x48
popq %r14
leaq (%rsp,%r14), %rdi
addq $0x20, %rdi
callq 0x2e28
addq $-0x18, %r14
cmpq $-0x18, %r14
jne 0x6126
movq 0x8(%rbx), %rax
addq $0x8, %rbx
movq 0x8(%rsp), %rcx
xorl %edx, %edx
cmpq $0x4, %rdx
je 0x617f
imulq $0x18, %rdx, %rsi
movq (%rcx,%rsi), %rsi
movq %rax, %rdi
xorl %r8d, %r8d
cmpq $0x4, %r8
je 0x617a
movq (%rdi), %r9
movl (%r9,%rdx,4), %r9d
movl %r9d, (%rsi,%r8,4)
incq %r8
addq $0x18, %rdi
jmp 0x6160
incq %rdx
jmp 0x614c
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x65b0
leaq 0x8(%rsp), %rdi
callq 0x2abc
addq $0xc0, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x2abc
jmp 0x61ef
movq %rax, %rbx
pushq $0x48
popq %r14
leaq (%rsp,%r14), %rdi
addq $0x20, %rdi
callq 0x2e28
addq $-0x18, %r14
cmpq $-0x18, %r14
jne 0x61b9
jmp 0x61ef
jmp 0x61d6
jmp 0x61d6
movq %rax, %rbx
addq $-0x18, %r15
movq %r15, %rdi
callq 0x2e28
cmpq %r14, %r15
jne 0x61d9
jmp 0x61ef
movq %rax, %rbx
movq %rbx, %rdi
callq 0x22c0
nop
// File: /workspace/github_cpp_makefile_star2_O2/NathanWine[P]2048-AI-Solvers/src/Game.cpp
// Function: Game::getHighestTile() const
int Game::getHighestTile() const {
    int highest_tile = 2;
    for (int i = 0; i < DIM; ++i) {
        for (int j = 0; j < DIM; ++j) {
            if (state[i][j] > highest_tile) {
                highest_tile = state[i][j];
            }
        }
    }
    return highest_tile;
}

// Assembly:
movq 0x8(%rdi), %rcx
pushq $0x2
popq %rax
xorl %edx, %edx
cmpq $0x4, %rdx
je 0x622c
imulq $0x18, %rdx, %rsi
movq (%rcx,%rsi), %rsi
xorl %edi, %edi
cmpq $0x4, %rdi
je 0x6227
movl (%rsi,%rdi,4), %r8d
cmpl %eax, %r8d
cmovgl %r8d, %eax
incq %rdi
jmp 0x6211
incq %rdx
jmp 0x6201
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/NathanWine[P]2048-AI-Solvers/src/Game.cpp
// Function: Game::getNumberEmpty(std::vector<std::vector<int, std::allocator<int>>, std::allocator<std::vector<int, std::allocator<int>>>> const&)
int Game::getNumberEmpty(const board &game_state) {
    int sum = 0;
    for (int i = 0; i < DIM; ++i) {
        for (int j = 0; j < DIM; ++j) {
            if (game_state[i][j] == 0) {
                sum += 1;
            }
        }
    }
    return sum;
}

// Assembly:
movq (%rdi), %rcx
xorl %edx, %edx
xorl %eax, %eax
cmpq $0x4, %rdx
je 0x625c
imulq $0x18, %rdx, %rsi
movq (%rcx,%rsi), %rsi
xorl %edi, %edi
cmpq $0x4, %rdi
je 0x6257
cmpl $0x1, (%rsi,%rdi,4)
adcl $0x0, %eax
incq %rdi
jmp 0x6245
incq %rdx
jmp 0x6235
retq
// File: /workspace/github_cpp_makefile_star2_O2/NathanWine[P]2048-AI-Solvers/src/Game.cpp
// Function: operator<<(std::ostream&, Game const&)
std::ostream& operator<<(std::ostream &stream, const Game &game) {
    int max_len = numDigits(game.getHighestTile());
    std::string str = "";
    for (int i = 0; i < DIM; ++i) {
        for (int j = 0; j < DIM; ++j) {
            int number_of_spaces = max_len - numDigits(game.state[i][j]) + 1;
            str += std::to_string(game.state[i][j]);
            for (int k = 0; k < number_of_spaces; ++k) {
                str += " ";
            }
        }
        str += "\n";
    }
    return stream << "Score: " + std::to_string(game.score) << std::endl << str;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdi, 0x10(%rsp)
movq %rsi, 0x8(%rsp)
movq %rsi, %rdi
callq 0x61f8
movl %eax, %edi
callq 0x5545
movl %eax, 0x4(%rsp)
leaq 0x1df9(%rip), %rsi      # 0x808b
leaq 0x68(%rsp), %r15
leaq 0x28(%rsp), %r12
movq %r15, %rdi
movq %r12, %rdx
callq 0x48c4
xorl %eax, %eax
leaq 0x1e91(%rip), %rbx      # 0x8141
cmpq $0x4, %rax
je 0x6350
movq %rax, 0x18(%rsp)
imulq $0x18, %rax, %rax
movq %rax, 0x20(%rsp)
xorl %ebp, %ebp
cmpq $0x4, %rbp
je 0x6334
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x20(%rsp), %rcx
movq (%rax,%rcx), %rax
movl (%rax,%rbp,4), %r14d
movl %r14d, %edi
callq 0x5545
movl %eax, %r13d
movq %r12, %rdi
movl %r14d, %esi
callq 0x668e
movq %r15, %rdi
movq %r12, %rsi
callq 0x2300
movl 0x4(%rsp), %r14d
subl %r13d, %r14d
movq %r12, %rdi
callq 0x2318
xorl %r13d, %r13d
cmpl %r14d, %r13d
jg 0x632f
movq %r15, %rdi
movq %rbx, %rsi
callq 0x22f0
incl %r13d
jmp 0x631a
incq %rbp
jmp 0x62ca
movq %r15, %rdi
leaq 0x1d4c(%rip), %rsi      # 0x808a
callq 0x22f0
movq 0x18(%rsp), %rax
incq %rax
jmp 0x62b0
movq 0x8(%rsp), %rax
movl (%rax), %esi
leaq 0x48(%rsp), %rdi
callq 0x668e
leaq 0x21d8(%rip), %rsi      # 0x8540
leaq 0x28(%rsp), %rdi
leaq 0x48(%rsp), %rdx
callq 0x66e7
leaq 0x28(%rsp), %rsi
movq 0x10(%rsp), %rdi
callq 0x2190
movq %rax, %rdi
callq 0x20d0
leaq 0x68(%rsp), %rsi
movq %rax, %rdi
callq 0x2190
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x2318
leaq 0x48(%rsp), %rdi
callq 0x2318
leaq 0x68(%rsp), %rdi
callq 0x2318
movq %rbx, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x63e5
jmp 0x63ff
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x2318
leaq 0x48(%rsp), %rdi
jmp 0x63f8
jmp 0x63ff
jmp 0x63ff
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x2318
jmp 0x6402
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x2318
movq %rbx, %rdi
callq 0x22c0
// File: /workspace/github_cpp_makefile_star2_O2/NathanWine[P]2048-AI-Solvers/src/Expectimax.cpp
// Function: expectimaxSolve(int, int, int, std::vector<int, std::allocator<int>>*, std::vector<int, std::allocator<int>>*)
int expectimaxSolve(int n, int depth, int display_level, 
    std::vector<int> *scores, std::vector<int> *highest_tiles) {

    int successes = 0;
    for (int i = 0; i < n; ++i) {
        std::pair<int, int> result = expectimaxSearch(depth, display_level, Game());
        if (result.first >= WIN) {
            successes++;
        }
        (*highest_tiles).push_back(result.first);
        (*scores).push_back(result.second);
    }
    return successes;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r8, 0x10(%rsp)
movq %rcx, %r15
movl %edx, %ebp
movl %esi, %r12d
movl %edi, %r13d
xorl %r14d, %r14d
testl %edi, %edi
cmovlel %r14d, %r13d
leaq 0x18(%rsp), %rbx
subl $0x1, %r13d
jb 0x7b53
movq %rbx, %rdi
callq 0x2ade
movl %r12d, %edi
movl %ebp, %esi
movq %rbx, %rdx
callq 0x770c
movq %rax, 0x8(%rsp)
leaq 0x20(%rsp), %rdi
callq 0x2abc
xorl %eax, %eax
cmpl $0x800, 0x8(%rsp)       # imm = 0x800
setge %al
addl %eax, %r14d
movq 0x10(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x2c1c
movq %r15, %rdi
leaq 0xc(%rsp), %rsi
callq 0x2c1c
jmp 0x7afb
movl %r14d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x2abc
movq %rbx, %rdi
callq 0x22c0
// File: /workspace/github_cpp_makefile_star2_O2/NathanWine[P]2048-AI-Solvers/src/Heuristics.cpp
// Function: Heuristics::get_snake(std::vector<std::vector<int, std::allocator<int>>, std::allocator<std::vector<int, std::allocator<int>>>> const&)
float Heuristics::get_snake(const board &state) {        // Perhaps this should be normalized and multiplied by a weight instead? Becomes the only factor at high value tiles
    float snake_total = 0.0;
    for (int i = 0; i < DIM; ++i) {
        for (int j = 0; j < DIM; ++j) {
            snake_total += state[i][j] * snake_weights[i][j];
        }
    }
    return snake_total;
}

// Assembly:
movq (%rdi), %rax
xorps %xmm0, %xmm0
leaq 0x9df(%rip), %rcx       # 0x8670
xorl %edx, %edx
cmpq $0x4, %rdx
je 0x7cc5
imulq $0x18, %rdx, %rsi
movq (%rax,%rsi), %rsi
xorl %edi, %edi
cmpq $0x4, %rdi
je 0x7cbc
cvtsi2ssl (%rsi,%rdi,4), %xmm1
mulss (%rcx,%rdi,4), %xmm1
addss %xmm1, %xmm0
incq %rdi
jmp 0x7ca3
incq %rdx
addq $0x10, %rcx
jmp 0x7c93
retq
// File: /workspace/github_cpp_makefile_star2_O2/mh0fm4[P]SCDC/test/units/redirect/redirect_cli.c
// Function: test_hash
void test_hash()
{
  rdint_t in_n = 250 * 1000 * 1000;
  double *in_v = malloc(in_n * sizeof(*in_v));
  vector_init(in_v, in_n, 1, 1.0, NAN);

  rdint_t size = in_n * sizeof(*in_v);

  double t = z_time_wtime();
  redirect_call_hash_param_array_double(in_v, in_n);
  t = z_time_wtime() - t;

  printf("test_hash: size: %" rdint_fmt ", time: %f, rate: %f\n", size, t, (double) size / t * 1e-6);

  free(in_v);
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movl $0x77359400, %edi       # imm = 0x77359400
callq 0xb720
movq %rax, %rbx
pushq $0x1
popq %rdx
movsd 0x43def(%rip), %xmm0    # 0x50008
movsd 0x43def(%rip), %xmm1    # 0x50010
movl $0xee6b280, %esi        # imm = 0xEE6B280
movq %rax, %rdi
callq 0xd144
callq 0xd113
movsd %xmm0, 0x8(%rsp)
movl $0xee6b280, %esi        # imm = 0xEE6B280
movq %rbx, %rdi
callq 0x10a00
callq 0xd113
subsd 0x8(%rsp), %xmm0
movsd 0x43dbf(%rip), %xmm1    # 0x50018
divsd %xmm0, %xmm1
mulsd 0x43dbb(%rip), %xmm1    # 0x50020
leaq 0x43ddc(%rip), %rdi     # 0x50048
movl $0x77359400, %esi       # imm = 0x77359400
movb $0x2, %al
callq 0xb070
movq %rbx, %rdi
addq $0x10, %rsp
popq %rbx
jmp 0xb670
// File: /workspace/github_cpp_makefile_star2_O2/mh0fm4[P]SCDC/test/units/redirect/redirect_cli.c
// Function: test_result
void test_result(const char *uri)
{
  redirect_call_t rc;

  redirect_call_create_scdc(&rc, "result", uri);

  redirect_call_execute(&rc);

  TRACE_F("result: '%s'", redirect_call_get_result_str(&rc, NULL, 0));

  redirect_call_destroy_scdc(&rc);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0xbb0, %rsp            # imm = 0xBB0
movq %rdi, %rdx
leaq 0x472fd(%rip), %rsi     # 0x53598
movq %rsp, %rbx
movq %rbx, %rdi
callq 0xed28
movq %rbx, %rdi
callq 0xee69
movq 0x68d03(%rip), %r15     # 0x74fb8
movq (%r15), %rdi
leaq 0x43db3(%rip), %rsi     # 0x50072
leaq 0x43dbf(%rip), %rdx     # 0x50085
xorl %eax, %eax
callq 0xb7c0
movq (%r15), %r14
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0xfc63
leaq 0x4446e(%rip), %rsi     # 0x50751
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xb7c0
movq (%r15), %rsi
pushq $0xa
popq %rdi
callq 0xb6b0
movq %rbx, %rdi
callq 0xede5
addq $0xbb0, %rsp            # imm = 0xBB0
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/mh0fm4[P]SCDC/test/units/redirect/redirect_cli.c
// Function: test_param_matrix
void test_param_matrix(const char *uri)
{
  redirect_call_t rc;

  redirect_call_create_scdc(&rc, "param_matrix", uri);

  /* double ohne/mit stride */

  redirect_call_execute(&rc);

  TRACE_F("result: '%s'", redirect_call_get_result_str(&rc, NULL, 0));

  redirect_call_destroy_scdc(&rc);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0xbb0, %rsp            # imm = 0xBB0
movq %rdi, %rdx
leaq 0x435a6(%rip), %rsi     # 0x50562
movq %rsp, %rbx
movq %rbx, %rdi
callq 0xed28
movq %rbx, %rdi
callq 0xee69
movq 0x67fe2(%rip), %r15     # 0x74fb8
movq (%r15), %rdi
leaq 0x43092(%rip), %rsi     # 0x50072
leaq 0x43382(%rip), %rdx     # 0x50369
xorl %eax, %eax
callq 0xb7c0
movq (%r15), %r14
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0xfc63
leaq 0x4374d(%rip), %rsi     # 0x50751
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xb7c0
movq (%r15), %rsi
pushq $0xa
popq %rdi
callq 0xb6b0
movq %rbx, %rdi
callq 0xede5
addq $0xbb0, %rsp            # imm = 0xBB0
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/mh0fm4[P]SCDC/test/units/redirect/redirect_cli.c
// Function: main
int main(int argc, char *argv[])
{
  scdc_init(SCDC_INIT_DEFAULT);

  TRACE_F("dataprov open");
  scdc_dataprov_t dp = scdc_dataprov_open(REDIRECT_TEST_SCDC_PATH, "hook", &redirect_test_hook);

#if 1
  const char *uri = "scdc:/" REDIRECT_TEST_SCDC_PATH;
#else
  const char *uri = "scdc+uds://redirect/" REDIRECT_TEST_SCDC_PATH;
#endif

#if TEST_HASH
  test_hash();
#endif

#if TEST_RESULT
  test_result(uri);
#endif

#if TEST_CONF
  test_conf(uri);
#endif

#if TEST_CACHE && REDIRECT_CALL_PARAMS_CACHE
  test_cache(uri);
#endif

#if TEST_PARAM_ARRAY
  test_param_array(uri);
#endif

#if TEST_PARAM_VECTOR
  test_param_vector(uri);
#endif

#if TEST_PARAM_MATRIX
  test_param_matrix(uri);
#endif

  TRACE_F("dataprov close");
  scdc_dataprov_close(dp);

  scdc_release();

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x4547a(%rip), %rdi     # 0x524bd
xorl %eax, %eax
callq 0x17c61
movq 0x67f67(%rip), %r13     # 0x74fb8
movq (%r13), %rdi
leaq 0x43016(%rip), %rbx     # 0x50072
leaq 0x43318(%rip), %r14     # 0x5037b
movq %rbx, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0xb7c0
movq (%r13), %rcx
leaq 0x43305(%rip), %rdi     # 0x50380
pushq $0xd
popq %rsi
pushq $0x1
popq %r15
movq %r15, %rdx
callq 0xba80
movq (%r13), %rsi
pushq $0xa
popq %rbp
movl %ebp, %edi
callq 0xb6b0
leaq 0x432f5(%rip), %rdi     # 0x50394
leaq 0x467fa(%rip), %rsi     # 0x538a0
leaq 0x65a83(%rip), %rdx     # 0x72b30
xorl %eax, %eax
callq 0x17fbc
movq %rax, %r12
leaq 0x432d0(%rip), %rdi     # 0x5038e
callq 0xca9d
movq (%r13), %rdi
movq %rbx, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0xb7c0
movq (%r13), %rcx
leaq 0x432be(%rip), %rdi     # 0x5039d
pushq $0xe
popq %rsi
movq %r15, %rdx
callq 0xba80
movq (%r13), %rsi
movl %ebp, %edi
callq 0xb6b0
movq %r12, %rdi
callq 0x1807a
callq 0x17d76
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/mh0fm4[P]SCDC/test/units/redirect/redirect_common.c
// Function: vector_init
void vector_init(double *v, rdint_t n, rdint_t inc, double xv, double xn)
{
  int i, j;

  for (i = 0; i < n; ++i)
  {
    v[i * inc + 0] = xv;
    if (i + 1 == n) break;
    for (j = 1; j < inc; ++j) v[i * inc + j] = xn;
  }
}

// Assembly:
xorl %eax, %eax
testq %rsi, %rsi
movl $0x0, %ecx
cmovgq %rsi, %rcx
leaq (,%rdx,8), %r8
pushq $0x1
popq %r9
movq %rdi, %r10
cmpq %rcx, %rax
je 0xd193
movq %rax, %r11
imulq %rdx, %r11
movsd %xmm0, (%rdi,%r11,8)
incq %rax
cmpq %rsi, %rax
je 0xd193
movq %r9, %r11
cmpq %rdx, %r11
jge 0xd18e
movsd %xmm1, (%r10,%r11,8)
incq %r11
jmp 0xd17e
addq %r8, %r10
jmp 0xd161
retq
// File: /workspace/github_cpp_makefile_star2_O2/mh0fm4[P]SCDC/test/units/redirect/redirect_test.c
// Function: redirect_test_open
void *redirect_test_open(const char *conf, va_list ap)
{
  TRACE_F("conf: '%s'", conf);

  redirect_call_t *rc = malloc(sizeof(redirect_call_t)
#if REDIRECT_CALL_PARAMS_CACHE
    + sizeof(redirect_cache_t)
#endif
    );

#if REDIRECT_CALL_PARAMS_CACHE
  redirect_cache_t *rch = (redirect_cache_t *) (rc + 1);

  redirect_cache_init(rch);
#endif

  TRACE_F("return: %p", rc);

  return rc;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %r15
movq 0x67e12(%rip), %r12     # 0x74fb8
movq (%r12), %rdi
leaq 0x4321f(%rip), %rbx     # 0x503d0
leaq 0x4322c(%rip), %r14     # 0x503e4
movq %rbx, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0xb7c0
movq (%r12), %rdi
leaq 0x43227(%rip), %rsi     # 0x503f7
movq %r15, %rdx
xorl %eax, %eax
callq 0xb7c0
movq (%r12), %rsi
pushq $0xa
popq %rbp
movl %ebp, %edi
callq 0xb6b0
movl $0x1050, %edi           # imm = 0x1050
callq 0xb720
movq %rax, %r15
leaq 0xbb0(%rax), %rdi
callq 0xe743
movq (%r12), %rdi
movq %rbx, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0xb7c0
movq (%r12), %rdi
leaq 0x431e5(%rip), %rsi     # 0x50402
movq %r15, %rdx
xorl %eax, %eax
callq 0xb7c0
movq (%r12), %rsi
movl %ebp, %edi
callq 0xb6b0
movq %r15, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/mh0fm4[P]SCDC/test/units/redirect/redirect_test.c
// Function: redirect_test_close
scdcint_t redirect_test_close(void *dataprov)
{
  TRACE_F("dataprov: %p", dataprov);

  redirect_call_t *rc = dataprov;

#if REDIRECT_CALL_PARAMS_CACHE
  redirect_cache_t *rch = (redirect_cache_t *) (rc + 1);

  redirect_cache_release(rch);
#endif

  free(rc);

  TRACE_F("return");

  return SCDC_SUCCESS;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %r15
movq 0x67d68(%rip), %r12     # 0x74fb8
movq (%r12), %rdi
leaq 0x43175(%rip), %rbx     # 0x503d0
leaq 0x431ab(%rip), %r14     # 0x5040d
movq %rbx, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0xb7c0
movq (%r12), %rdi
leaq 0x431a7(%rip), %rsi     # 0x50421
movq %r15, %rdx
xorl %eax, %eax
callq 0xb7c0
movq (%r12), %rsi
pushq $0xa
popq %rbp
movl %ebp, %edi
callq 0xb6b0
leaq 0xbb0(%r15), %rdi
callq 0xe799
movq %r15, %rdi
callq 0xb670
movq (%r12), %rdi
movq %rbx, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0xb7c0
movq (%r12), %rcx
leaq 0x4316c(%rip), %rdi     # 0x5042e
pushq $0x6
popq %rsi
pushq $0x1
popq %rbx
movq %rbx, %rdx
callq 0xba80
movq (%r12), %rsi
movl %ebp, %edi
callq 0xb6b0
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/mh0fm4[P]SCDC/src/lib/redirect/redirect/redirect_cache.cc
// Function: redirect_cache_create
void redirect_cache_create(redirect_cache_t *rch)
{
  TRACE_F(" ");

  rch->client = 1;

  redirect_cache_reset_params(rch);

  rch->nentries = 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x66e2e(%rip), %r14     # 0x74fb8
movq (%r14), %rdi
leaq 0x423db(%rip), %rsi     # 0x5056f
leaq 0x423e9(%rip), %rdx     # 0x50584
xorl %eax, %eax
callq 0xb7c0
movq (%r14), %rsi
pushq $0x20
popq %rdi
callq 0xb6b0
movq (%r14), %rsi
pushq $0xa
popq %rdi
callq 0xb6b0
movl $0x1, (%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rbx)
andq $0x0, 0x298(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/mh0fm4[P]SCDC/src/lib/redirect/redirect/redirect_cache.cc
// Function: redirect_cache_register_param_dense
void redirect_cache_register_param_dense(redirect_cache_t *rch, const char *id, int type, redirect_param_dense_t *param)
{
  TRACE_F("id: %s, type: %d, size: %" rdint_fmt, id, type, param->size);

  if (rch->nparams < REDIRECT_CACHE_PARAMS_MAX)
  {
    rch->params[rch->nparams].type = type;
    rch->params[rch->nparams].size = param->size;
    rch->params[rch->nparams].buf = param->buf;
    rch->params[rch->nparams].hash = 0;

    ++rch->nparams;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rcx, %r14
movl %edx, %ebp
movq %rsi, %r15
movq %rdi, %rbx
movq 0x66d07(%rip), %r12     # 0x74fb8
movq (%r12), %rdi
leaq 0x422b3(%rip), %rsi     # 0x5056f
leaq 0x422ee(%rip), %rdx     # 0x505b1
xorl %eax, %eax
callq 0xb7c0
movq (%r12), %rdi
movq 0x8(%r14), %r8
leaq 0x422fc(%rip), %rsi     # 0x505d5
movq %r15, %rdx
movl %ebp, %ecx
xorl %eax, %eax
callq 0xb7c0
movq (%r12), %rsi
pushq $0xa
popq %rdi
callq 0xb6b0
movq 0x8(%rbx), %rax
cmpq $0xf, %rax
jg 0xe320
imulq $0x28, %rax, %rcx
movl %ebp, 0x18(%rbx,%rcx)
movq 0x8(%r14), %rdx
movq %rdx, 0x20(%rbx,%rcx)
movq (%r14), %rdx
movq %rdx, 0x28(%rbx,%rcx)
andl $0x0, 0x30(%rbx,%rcx)
incq %rax
movq %rax, 0x8(%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/mh0fm4[P]SCDC/src/lib/redirect/redirect/redirect_cache.cc
// Function: redirect_cache_init
void redirect_cache_init(redirect_cache_t *rch)
{
  TRACE_F(" ");

  rch->client = 0;

  redirect_cache_reset_params(rch);

  rch->nentries = 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x66867(%rip), %r14     # 0x74fb8
movq (%r14), %rdi
leaq 0x41e14(%rip), %rsi     # 0x5056f
leaq 0x41f71(%rip), %rdx     # 0x506d3
xorl %eax, %eax
callq 0xb7c0
movq (%r14), %rsi
pushq $0x20
popq %rdi
callq 0xb6b0
movq (%r14), %rsi
pushq $0xa
popq %rdi
callq 0xb6b0
andl $0x0, (%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rbx)
andq $0x0, 0x298(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/mh0fm4[P]SCDC/src/lib/redirect/redirect/redirect_cache.cc
// Function: redirect_cache_find_entries
rdint_t redirect_cache_find_entries(redirect_cache_t *rch, int type, rdint_t size, rdint_t *entries)
{
  rdint_t nentries = 0;

  rdint_t i;
  for (i = 0; i < rch->nentries; ++i)
  {
    if (rch->entries[i].type != type || rch->entries[i].size != size) continue;

    entries[nentries] = i;
    ++nentries;

    if (nentries >= REDIRECT_CACHE_FIND_ENTRIES_MAX) break;
  }
  
  return nentries;
}

// Assembly:
leaq 0x2a8(%rdi), %r8
xorl %r9d, %r9d
xorl %r10d, %r10d
cmpq 0x298(%rdi), %r10
jge 0xea6e
cmpl %esi, -0x8(%r8)
jne 0xea65
cmpq %rdx, (%r8)
jne 0xea65
movq %r10, (%rcx,%r9,8)
leaq 0x1(%r9), %rax
cmpq $0xe, %r9
movq %rax, %r9
jg 0xea71
incq %r10
addq $0x20, %r8
jmp 0xea40
movq %r9, %rax
retq
// File: /workspace/github_cpp_makefile_star2_O2/mh0fm4[P]SCDC/src/lib/redirect/redirect/redirect_cache.cc
// Function: redirect_cache_get_entry_hash
redirect_param_hash_t redirect_cache_get_entry_hash(redirect_cache_t *rch, rdint_t entry)
{
  if (!rch->entries[entry].hash_set)
  {
    redirect_param_dense_t p;
    p.buf = rch->entries[entry].buf;
    p.size = rch->entries[entry].size;
    rch->entries[entry].hash = redirect_param_hash_dense(&p);
    rch->entries[entry].hash_set = 1;
  }

  return rch->entries[entry].hash;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
shlq $0x5, %rsi
leaq (%rdi,%rsi), %rbx
addq $0x2a0, %rbx            # imm = 0x2A0
cmpl $0x0, 0x18(%rbx)
je 0xea91
movl 0x1c(%rbx), %eax
jmp 0xeab2
movq 0x10(%rbx), %rax
movq %rsp, %rdi
movq %rax, (%rdi)
movq 0x8(%rbx), %rax
movq %rax, 0x8(%rdi)
callq 0x17bd8
movl %eax, 0x1c(%rbx)
movl $0x1, 0x18(%rbx)
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/mh0fm4[P]SCDC/src/lib/redirect/redirect/redirect_cache.cc
// Function: redirect_cache_check_state
void redirect_cache_check_state(redirect_cache_t *rch, const char *state, rdint_t state_size)
{
  TRACE_F("state: '%.*s'", static_cast<int>(state_size), state);

  const char *s = state;

  rdint_t i;
  for (i = 0; i < rch->nparams; ++i)
  {
    sscanf(s, "%" rdint_fmt ":", &rch->params[i].entry_index);
    s = strchr(s, ':') + 1;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movq 0x664e5(%rip), %r12     # 0x74fb8
movq (%r12), %rdi
leaq 0x41a91(%rip), %rsi     # 0x5056f
leaq 0x41c79(%rip), %rdx     # 0x5075e
xorl %eax, %eax
callq 0xb7c0
movq (%r12), %rdi
leaq 0x41bce(%rip), %rsi     # 0x506c5
movl %r15d, %edx
movq %r14, %rcx
xorl %eax, %eax
callq 0xb7c0
movq (%r12), %rsi
pushq $0xa
popq %rdi
callq 0xb6b0
leaq 0x38(%rbx), %r15
leaq 0x41b07(%rip), %r12     # 0x50622
pushq $0x3a
popq %rbp
xorl %r13d, %r13d
cmpq 0x8(%rbx), %r13
jge 0xeb50
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0xb510
movq %r14, %rdi
movl %ebp, %esi
callq 0xb1e0
movq %rax, %r14
incq %r14
incq %r13
addq $0x28, %r15
jmp 0xeb21
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/mh0fm4[P]SCDC/src/lib/redirect/redirect/redirect_cache.cc
// Function: redirect_cache_put_entry
rdint_t redirect_cache_put_entry(redirect_cache_t *rch, int type, rdint_t size, const void *buf)
{
  rdint_t entry_index = redirect_cache_find_entry(rch, type, size, buf);

  if (entry_index >= 0)
  {
    TRACE_F("entry [%d,%" rdint_fmt ",%p] / %" rdint_fmt " already in cache", type, size, buf, entry_index);
    redirect_cache_update_entry(rch, entry_index);
    return entry_index;
  }

  if (rch->nentries >= REDIRECT_CACHE_ENTRIES_MAX)
  {
    TRACE_F("max. number of entries %" rdint_fmt " in cache", rch->nentries);
    // FIXME: cache replacement strategy: FIFO, LRU, LFU
    return -1;
  }

  entry_index = rch->nentries;

  rch->entries[entry_index].type = type;
  rch->entries[entry_index].size = size;
  rch->entries[entry_index].buf = const_cast<void *>(buf);
  rch->entries[entry_index].hash_set = 0;

  ++rch->nentries;

  return entry_index;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r15
movq %rdx, %r12
movl %esi, %ebp
movq %rdi, %rbx
callq 0xec77
testq %rax, %rax
js 0xebdf
movq %rax, %r14
movq 0x6642f(%rip), %r13     # 0x74fb8
movq (%r13), %rdi
leaq 0x419db(%rip), %rsi     # 0x5056f
leaq 0x41bde(%rip), %rdx     # 0x50779
xorl %eax, %eax
callq 0xb7c0
movq (%r13), %rdi
leaq 0x41be5(%rip), %rsi     # 0x50792
movl %ebp, %edx
movq %r12, %rcx
movq %r15, %r8
movq %r14, %r9
xorl %eax, %eax
callq 0xb7c0
movq (%r13), %rsi
pushq $0xa
popq %rdi
callq 0xb6b0
movq %r14, %rax
shlq $0x5, %rax
andl $0x0, 0x2b8(%rbx,%rax)
jmp 0xec65
movq 0x298(%rbx), %r14
cmpq $0x10, %r14
jl 0xec34
movq 0x663c5(%rip), %r14     # 0x74fb8
movq (%r14), %rdi
leaq 0x41972(%rip), %rsi     # 0x5056f
leaq 0x41b75(%rip), %rdx     # 0x50779
xorl %eax, %eax
callq 0xb7c0
movq (%r14), %rdi
movq 0x298(%rbx), %rdx
leaq 0x41b9f(%rip), %rsi     # 0x507bb
xorl %eax, %eax
callq 0xb7c0
movq (%r14), %rsi
pushq $0xa
popq %rdi
callq 0xb6b0
pushq $-0x1
popq %r14
jmp 0xec65
movq %r14, %rax
shlq $0x5, %rax
movl %ebp, 0x2a0(%rbx,%rax)
movq %r12, 0x2a8(%rbx,%rax)
movq %r15, 0x2b0(%rbx,%rax)
andl $0x0, 0x2b8(%rbx,%rax)
leaq 0x1(%r14), %rax
movq %rax, 0x298(%rbx)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/mh0fm4[P]SCDC/src/lib/redirect/redirect/redirect_cache.cc
// Function: redirect_cache_find_entry
rdint_t redirect_cache_find_entry(redirect_cache_t *rch, int type, rdint_t size, const void *buf)
{
  rdint_t i;
  for (i = 0; i < rch->nentries; ++i)
  {
    if (rch->entries[i].type != type || rch->entries[i].size != size || rch->entries[i].buf != buf) continue;

    return i;
  }
  
  return -1;
}

// Assembly:
movq 0x298(%rdi), %r9
xorl %r8d, %r8d
testq %r9, %r9
cmovleq %r8, %r9
addq $0x2b0, %rdi            # imm = 0x2B0
pushq $-0x1
popq %rax
cmpq %r8, %r9
je 0xecb3
cmpl %esi, -0x10(%rdi)
jne 0xeca7
cmpq %rdx, -0x8(%rdi)
jne 0xeca7
cmpq %rcx, (%rdi)
je 0xecb0
incq %r8
addq $0x20, %rdi
jmp 0xec92
movq %r8, %rax
retq
// File: /workspace/github_cpp_makefile_star2_O2/mh0fm4[P]SCDC/src/lib/redirect/redirect/redirect_call.cc
// Function: redirect_call_create_scdc
int redirect_call_create_scdc(redirect_call_t *rc, const char *op, const char *uri)
{
  rc->client = 1;

  strncpy(rc->op, op, sizeof(rc->op));
  if (uri) strncpy(rc->uri, uri, sizeof(rc->uri));
  else rc->uri[0] = '\0';

  rc->dataset = SCDC_DATASET_NULL;

  rc->input_conf_n = 0;
  rc->input_conf[0] = '\0';

  rc->output_conf_put_n = rc->output_conf_get_n = 0;
  rc->output_conf_put[0] = rc->output_conf_get[0] = '\0';

  rc->result_str[0] = '\0';

#if REDIRECT_CALL_PARAMS_NEW
  rc->nparams = 0;
#else
  rc->dense_nparams = 0;
#endif

  rc->input_offset = rc->output_offset = 0;
  rc->input = static_cast<scdc_dataset_input_t *>(malloc(sizeof(scdc_dataset_input_t) + sizeof(scdc_dataset_output_t)));
  rc->output = rc->input + 1;
  scdc_dataset_input_unset(rc->input);
  scdc_dataset_output_unset(rc->output);

  rc->free_nbufs = 0;

#if REDIRECT_CALL_PARAMS_CACHE
  rc->cache = 0;
#endif

  return 1;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdx, %r14
movq %rdi, %rbx
movl $0x1, (%rdi)
addq $0x4, %rdi
pushq $0x40
popq %rdx
callq 0xb2c0
leaq 0x44(%rbx), %rdi
testq %r14, %r14
je 0xed5c
movl $0x100, %edx            # imm = 0x100
movq %r14, %rsi
callq 0xb2c0
jmp 0xed5f
movb $0x0, (%rdi)
xorl %ebp, %ebp
movb %bpl, 0x568(%rbx)
movb %bpl, 0x368(%rbx)
movb %bpl, 0x768(%rbx)
andq $0x0, 0x868(%rbx)
andq $0x0, 0xb00(%rbx)
movl $0xb0, %edi
callq 0xb720
xorps %xmm0, %xmm0
movups %xmm0, 0x148(%rbx)
movups %xmm0, 0x158(%rbx)
movb %bpl, 0x168(%rbx)
movq %rax, 0xb08(%rbx)
leaq 0x58(%rax), %rcx
movq %rcx, 0xb10(%rbx)
movq %rax, %rdi
callq 0x24cb8
movq 0xb10(%rbx), %rdi
callq 0x24cd8
andl $0x0, 0xb20(%rbx)
andq $0x0, 0xba8(%rbx)
pushq $0x1
popq %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/mh0fm4[P]SCDC/src/lib/redirect/redirect/redirect_call.cc
// Function: redirect_call_free_bufs(_redirect_call_t*)
static void redirect_call_free_bufs(redirect_call_t *rc)
{
#if 1
  while (rc->free_nbufs > 0) redirect_call_free_buf(rc, rc->free_nbufs - 1);
#else
  rdint_t i;
  for (i = 0; i < rc->free_nbufs; ++i) free(rc->free_bufs[i]);
  rc->free_nbufs = 0;
#endif
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movl 0xb20(%rdi), %r14d
testl %r14d, %r14d
jle 0xee63
leal -0x1(%r14), %r15d
movq 0xb28(%rbx,%r15,8), %rdi
callq 0xb670
movslq 0xb20(%rbx), %rax
leal -0x1(%rax), %ecx
movl %ecx, 0xb20(%rbx)
cmpl %r14d, %eax
movl %ecx, %r14d
je 0xee20
movq 0xb20(%rbx,%rax,8), %rax
movq %rax, 0xb28(%rbx,%r15,8)
movl %ecx, %r14d
jmp 0xee20
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/mh0fm4[P]SCDC/src/lib/redirect/redirect/redirect_call.cc
// Function: redirect_call_get_inout_conf_str(char const*, char const*, char*, long*)
static rdint_t redirect_call_get_inout_conf_str(const char *conf, const char *id, char *x, rdint_t *n)
{
  rdint_t _n = 0;

  if (!n) n = &_n;

  const char *s = strchr(conf, ':');
  sscanf(s + 1, "%" rdint_fmt ":", n);

  s = strchr(s + 1, ':');
  strncpy(x, s + 1, *n);
  x[*n] = '\0';

  return s + 1 + *n + 1 - conf;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdx, %rbx
movq %rsi, %r15
leaq 0x8(%rsp), %rax
andq $0x0, (%rax)
movq %rdi, %r14
testq %rdx, %rdx
cmoveq %rax, %rbx
pushq $0x3a
popq %rbp
movl %ebp, %esi
callq 0xb1e0
leaq 0x1(%rax), %r12
leaq 0x411e8(%rip), %rsi     # 0x50622
movq %r12, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0xb510
movq %r12, %rdi
movl %ebp, %esi
callq 0xb1e0
movq %rax, %r12
incq %r12
movq (%rbx), %rdx
movq %r15, %rdi
movq %r12, %rsi
callq 0xb2c0
movq (%rbx), %rax
movb $0x0, (%r15,%rax)
addq (%rbx), %r12
subq %r14, %r12
incq %r12
movq %r12, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/mh0fm4[P]SCDC/src/lib/redirect/redirect/redirect_call.cc
// Function: redirect_call_release_scdc
void redirect_call_release_scdc(redirect_call_t *rc)
{
  if (rc->input)
  {
    /* consume remaining input */
    while (rc->input->next) rc->input->next(rc->input, 0);
  }

  if (rc->result)
  {
    /* prepare result with result_str and output_conf_put */
    char *s = SCDC_RESULT_STR(rc->result);
    rdint_t n = 0;
    n += redirect_call_put_inout_conf_str(s + n, "result", rc->result_str, -1);
    n += redirect_call_put_inout_conf_str(s + n, "oconf", rc->output_conf_put, rc->output_conf_put_n);

    ASSERT(n < SCDC_RESULT_SIZE(rc->result));
  }

  if (rc->output)
  {
    /* prepare parameter output */
    rc->output->next = release_scdc_output_next;
    rc->output->data = rc;
#if REDIRECT_CALL_PARAMS_NEW
    rc->params_state[0] = rc->params_state[1] = 0;
#else
    rc->output_state = 0;
#endif

    /* set first paramter to output */
    rc->output->next(rc->output, 0);
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0xb08(%rdi), %rdi
testq %rdi, %rdi
je 0xf5ff
movq 0x38(%rdi), %rax
testq %rax, %rax
je 0xf5ff
xorl %esi, %esi
callq *%rax
movq 0xb08(%rbx), %rdi
jmp 0xf5e9
movq 0xb18(%rbx), %r15
testq %r15, %r15
je 0xf659
leaq 0x8(%r15), %rdi
leaq 0x768(%rbx), %rdx
leaq 0x43f7b(%rip), %rsi     # 0x53598
pushq $-0x1
popq %rcx
callq 0xf135
movq %rax, %r14
leaq (%r15,%rax), %rdi
addq $0x8, %rdi
leaq 0x368(%rbx), %rdx
movq 0x158(%rbx), %rcx
leaq 0x4120d(%rip), %rsi     # 0x50852
callq 0xf135
addq %r14, %rax
movq 0xb18(%rbx), %rcx
cmpq (%rcx), %rax
jge 0xf68b
movq 0xb10(%rbx), %rdi
testq %rdi, %rdi
je 0xf685
leaq 0x3d(%rip), %rax        # 0xf6a9
movq %rax, 0x38(%rdi)
movq %rbx, 0x40(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x870(%rbx)
popq %rbx
popq %r14
popq %r15
jmp 0xf6a9
popq %rbx
popq %r14
popq %r15
retq
movq 0x65946(%rip), %rax     # 0x74fd8
movq (%rax), %rcx
leaq 0x411d2(%rip), %rdi     # 0x5086e
pushq $0x33
popq %rsi
pushq $0x1
popq %rdx
callq 0xba80
jmp 0xf659