// File: /workspace/github_cpp_makefile_star2_O2/NathanWine[P]2048-AI-Solvers/src/Game.cpp
// Function: Game::compressUp(bool)
void Game::compressUp(bool peak) {
    for (int col = 0; col < DIM; ++col) {
        std::vector<int> compressed_column;
        if (state[0][col] == state[1][col]) {
            compressed_column.push_back(state[0][col] * 2);
            score += state[0][col] * 2;
            if (state[2][col] == state[3][col]) {
                compressed_column.push_back(state[2][col] * 2);
                score += state[2][col] * 2;
            }
            else {
                compressed_column.push_back(state[2][col]);
                compressed_column.push_back(state[3][col]);
            }
        }
        else if (state[1][col] == state[2][col]) {
            compressed_column.push_back(state[0][col]);
            compressed_column.push_back(state[1][col] * 2);
            compressed_column.push_back(state[3][col]);
            score += state[1][col] * 2;
        }
        else if (state[2][col] == state[3][col]) {
            compressed_column.push_back(state[0][col]);
            compressed_column.push_back(state[1][col]);
            compressed_column.push_back(state[2][col] * 2);
            score += state[2][col] * 2;
        }
        else {
            compressed_column.push_back(state[0][col]);
            compressed_column.push_back(state[1][col]);
            compressed_column.push_back(state[2][col]);
            compressed_column.push_back(state[3][col]);
        }
        while(compressed_column.size() < DIM) {
            compressed_column.push_back(0);
        }
        for (int i = 0; i < DIM; ++i) {
            state[i][col] = compressed_column[i];
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
xorl %r13d, %r13d
leaq 0x10(%rsp), %r14
leaq 0xc(%rsp), %r15
pushq $0x30
popq %rbp
cmpq $0x4, %r13
je 0x5f60
andq $0x0, 0x20(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq 0x8(%rbx), %rax
movq (%rax), %rdx
movq 0x18(%rax), %rcx
movl (%rdx,%r13,4), %esi
movl (%rcx,%r13,4), %ecx
cmpl %ecx, %esi
jne 0x5e0a
addl %esi, %esi
movl %esi, 0xc(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x7016
movq 0x8(%rbx), %rcx
movq (%rcx), %rax
movl (%rax,%r13,4), %eax
addl %eax, %eax
addl %eax, (%rbx)
movq 0x30(%rcx), %rax
movq 0x48(%rcx), %rdx
movl (%rax,%r13,4), %ecx
cmpl (%rdx,%r13,4), %ecx
jne 0x5eb8
addl %ecx, %ecx
movl %ecx, 0xc(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x7016
jmp 0x5ea3
leaq (%rdx,%r13,4), %rsi
movq 0x30(%rax), %rdx
movl (%rdx,%r13,4), %edx
cmpl %edx, %ecx
jne 0x5e5c
movq %r14, %rdi
callq 0x2c1c
movq 0x8(%rbx), %rax
movq 0x18(%rax), %rax
movl (%rax,%r13,4), %eax
addl %eax, %eax
movl %eax, 0xc(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x7016
movq 0x8(%rbx), %rax
leaq (,%r13,4), %rsi
addq 0x48(%rax), %rsi
movq %r14, %rdi
callq 0x2c1c
pushq $0x18
popq %rax
jmp 0x5ea6
movq 0x48(%rax), %rax
cmpl (%rax,%r13,4), %edx
jne 0x5ebe
movq %r14, %rdi
callq 0x2c1c
movq 0x8(%rbx), %rax
leaq (,%r13,4), %rsi
addq 0x18(%rax), %rsi
movq %r14, %rdi
callq 0x2c1c
movq 0x8(%rbx), %rax
movq 0x30(%rax), %rax
movl (%rax,%r13,4), %eax
addl %eax, %eax
movl %eax, 0xc(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x7016
movq %rbp, %rax
movq 0x8(%rbx), %rcx
movq (%rcx,%rax), %rax
movl (%rax,%r13,4), %eax
addl %eax, %eax
addl %eax, (%rbx)
jmp 0x5f0c
leaq (%rax,%r13,4), %r12
jmp 0x5ee9
movq %r14, %rdi
callq 0x2c1c
movq 0x8(%rbx), %rax
leaq (,%r13,4), %r12
movq 0x18(%rax), %rsi
addq %r12, %rsi
movq %r14, %rdi
callq 0x2c1c
movq 0x8(%rbx), %rax
addq 0x30(%rax), %r12
movq %r14, %rdi
movq %r12, %rsi
callq 0x2c1c
movq 0x8(%rbx), %rax
leaq (,%r13,4), %rsi
addq 0x48(%rax), %rsi
movq %r14, %rdi
callq 0x2c1c
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
subq %rax, %rcx
cmpq $0x10, %rcx
jae 0x5f31
andl $0x0, 0xc(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x7016
jmp 0x5f0c
movq 0x8(%rbx), %rcx
xorl %edx, %edx
cmpq $0x4, %rdx
je 0x5f50
movl (%rax,%rdx,4), %esi
movq (%rcx), %rdi
movl %esi, (%rdi,%r13,4)
incq %rdx
addq $0x18, %rcx
jmp 0x5f37
movq %r14, %rdi
callq 0x2e28
incq %r13
jmp 0x5d8f
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5f79
jmp 0x5f79
jmp 0x5f79
jmp 0x5f79
jmp 0x5f79
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x2e28
movq %rbx, %rdi
callq 0x22c0