// File: dgboy2000[P]compress/compress.cpp
// Function: DATCompression::compression(std::vector<int, std::allocator<int>>)
vector <int> DATCompression::compression(vector<int> data)
{
    vector <int> compressed = data;
    int i, n=30;
  
    // // Simple compression stack
    // compressed = diff_compress(data);
    // compressed = huffman_compress(compressed);

    // bzip-inspired compression stack (but simpler)
    compressed = diff_compress(compressed);
    compressed = run_length_encode(compressed);
    compressed = burrows_wheeler_encode(compressed);
    compressed = run_length_encode(compressed);
    compressed = golomb_compress(compressed);
    compressed = huffman_compress(compressed);

    return compressed;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1a0, %rsp            # imm = 0x1A0
movq %rdx, -0x178(%rbp)
movq %rsi, %rax
movq -0x178(%rbp), %rsi
movq %rdi, -0x160(%rbp)
movq %rdi, %rcx
movq %rcx, -0x170(%rbp)
movq %rdi, -0x8(%rbp)
movq %rax, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x168(%rbp)
movb $0x0, -0x19(%rbp)
callq 0x8f80
movq -0x160(%rbp), %rsi
movl $0x1e, -0x24(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x8f80
jmp 0x28a6
movq -0x168(%rbp), %rsi
leaq -0x40(%rbp), %rdi
leaq -0x58(%rbp), %rdx
callq 0x2bc0
jmp 0x28bc
movq -0x160(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movq %rsi, -0x180(%rbp)
callq 0x9070
movq -0x180(%rbp), %rdi
callq 0x8f20
leaq -0x58(%rbp), %rdi
callq 0x8f20
movq -0x160(%rbp), %rsi
leaq -0x98(%rbp), %rdi
callq 0x8f80
jmp 0x28fd
movq -0x168(%rbp), %rsi
leaq -0x80(%rbp), %rdi
leaq -0x98(%rbp), %rdx
callq 0x2e70
jmp 0x2916
movq -0x160(%rbp), %rdi
leaq -0x80(%rbp), %rsi
movq %rsi, -0x188(%rbp)
callq 0x9070
movq -0x188(%rbp), %rdi
callq 0x8f20
leaq -0x98(%rbp), %rdi
callq 0x8f20
movq -0x160(%rbp), %rsi
leaq -0xc8(%rbp), %rdi
callq 0x8f80
jmp 0x295a
movq -0x168(%rbp), %rsi
leaq -0xb0(%rbp), %rdi
leaq -0xc8(%rbp), %rdx
callq 0x2ff0
jmp 0x2976
movq -0x160(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
movq %rsi, -0x190(%rbp)
callq 0x9070
movq -0x190(%rbp), %rdi
callq 0x8f20
leaq -0xc8(%rbp), %rdi
callq 0x8f20
movq -0x160(%rbp), %rsi
leaq -0xf8(%rbp), %rdi
callq 0x8f80
jmp 0x29bd
movq -0x168(%rbp), %rsi
leaq -0xe0(%rbp), %rdi
leaq -0xf8(%rbp), %rdx
callq 0x2e70
jmp 0x29d9
movq -0x160(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
movq %rsi, -0x198(%rbp)
callq 0x9070
movq -0x198(%rbp), %rdi
callq 0x8f20
leaq -0xf8(%rbp), %rdi
callq 0x8f20
movq -0x160(%rbp), %rsi
leaq -0x128(%rbp), %rdi
callq 0x8f80
jmp 0x2a20
movq -0x168(%rbp), %rsi
leaq -0x110(%rbp), %rdi
leaq -0x128(%rbp), %rdx
callq 0x3290
jmp 0x2a3c
movq -0x160(%rbp), %rdi
leaq -0x110(%rbp), %rsi
movq %rsi, -0x1a0(%rbp)
callq 0x9070
movq -0x1a0(%rbp), %rdi
callq 0x8f20
leaq -0x128(%rbp), %rdi
callq 0x8f20
movq -0x160(%rbp), %rsi
leaq -0x158(%rbp), %rdi
callq 0x8f80
jmp 0x2a83
movq -0x168(%rbp), %rsi
leaq -0x140(%rbp), %rdi
leaq -0x158(%rbp), %rdx
callq 0x3560
jmp 0x2a9f
movq -0x160(%rbp), %rdi
leaq -0x140(%rbp), %rsi
callq 0x9070
leaq -0x140(%rbp), %rdi
callq 0x8f20
leaq -0x158(%rbp), %rdi
callq 0x8f20
movb $0x1, -0x19(%rbp)
testb $0x1, -0x19(%rbp)
jne 0x2b99
jmp 0x2b8d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x2ba9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x8f20
jmp 0x2ba9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x8f20
jmp 0x2ba9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x8f20
jmp 0x2ba9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x8f20
jmp 0x2ba9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x128(%rbp), %rdi
callq 0x8f20
jmp 0x2ba9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x158(%rbp), %rdi
callq 0x8f20
jmp 0x2ba9
movq -0x160(%rbp), %rdi
callq 0x8f20
movq -0x170(%rbp), %rax
addq $0x1a0, %rsp            # imm = 0x1A0
popq %rbp
retq
movq -0x160(%rbp), %rdi
callq 0x8f20
movq -0x60(%rbp), %rdi
callq 0x2380
nop