// File: cristian-bicheru[P]arith/codec.cpp
// Function: main
int main(int argc, char* argv[]) {
    if (argc != 6) {
        print_help();
    } else if (strcmp(argv[1], "--algorithm") != 0) {
        print_help();
    } else {
        if (strcmp(argv[3], "--encode") == 0) {
            if (strcmp(argv[2], "arith") == 0) {
                arith::CompressFile(std::string(argv[4]), std::string(argv[5]));
            } else if (strcmp(argv[2], "huffman") == 0) {
                huffman::CompressFile(std::string(argv[4]), std::string(argv[5]));
            } else {
                print_help();
            }
        } else {
            if (strcmp(argv[2], "arith") == 0) {
                arith::UncompressFile(std::string(argv[4]), std::string(argv[5]));
            } else if (strcmp(argv[2], "huffman") == 0) {
                huffman::UncompressFile(std::string(argv[4]), std::string(argv[5]));
            } else {
                print_help();
            }
        }
    }
    exit(0);
}

// Assembly:
subq $0x1e8, %rsp            # imm = 0x1E8
movl $0x0, 0x1e4(%rsp)
movl %edi, 0x1e0(%rsp)
movq %rsi, 0x1d8(%rsp)
cmpl $0x6, 0x1e0(%rsp)
je 0x4335
callq 0x4250
jmp 0x491b
movq 0x1d8(%rsp), %rax
movq 0x8(%rax), %rdi
leaq 0x13e67(%rip), %rsi     # 0x181af
callq 0x2270
cmpl $0x0, %eax
je 0x435c
callq 0x4250
jmp 0x4919
movq 0x1d8(%rsp), %rax
movq 0x18(%rax), %rdi
leaq 0x13e4c(%rip), %rsi     # 0x181bb
callq 0x2270
cmpl $0x0, %eax
jne 0x4650
movq 0x1d8(%rsp), %rax
movq 0x10(%rax), %rdi
leaq 0x13e34(%rip), %rsi     # 0x181c4
callq 0x2270
cmpl $0x0, %eax
jne 0x44e5
movq 0x1d8(%rsp), %rax
movq 0x20(%rax), %rax
movq %rax, 0x78(%rsp)
leaq 0x1b7(%rsp), %rdi
movq %rdi, 0x80(%rsp)
callq 0x2320
movq 0x78(%rsp), %rsi
movq 0x80(%rsp), %rdx
leaq 0x1b8(%rsp), %rdi
callq 0x2260
jmp 0x43e0
movq 0x1d8(%rsp), %rax
movq 0x28(%rax), %rax
movq %rax, 0x68(%rsp)
leaq 0x17f(%rsp), %rdi
movq %rdi, 0x70(%rsp)
callq 0x2320
movq 0x68(%rsp), %rsi
movq 0x70(%rsp), %rdx
leaq 0x180(%rsp), %rdi
callq 0x2260
jmp 0x441c
leaq 0x1b8(%rsp), %rdi
leaq 0x180(%rsp), %rsi
callq 0x3a70
jmp 0x4433
leaq 0x180(%rsp), %rdi
callq 0x2358
leaq 0x17f(%rsp), %rdi
callq 0x21e0
leaq 0x1b8(%rsp), %rdi
callq 0x2358
leaq 0x1b7(%rsp), %rdi
callq 0x21e0
jmp 0x464b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1a8(%rsp)
movl %eax, 0x1a4(%rsp)
jmp 0x44d3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1a8(%rsp)
movl %eax, 0x1a4(%rsp)
jmp 0x44b9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1a8(%rsp)
movl %eax, 0x1a4(%rsp)
leaq 0x180(%rsp), %rdi
callq 0x2358
leaq 0x17f(%rsp), %rdi
callq 0x21e0
leaq 0x1b8(%rsp), %rdi
callq 0x2358
leaq 0x1b7(%rsp), %rdi
callq 0x21e0
jmp 0x4922
movq 0x1d8(%rsp), %rax
movq 0x10(%rax), %rdi
leaq 0x13cd2(%rip), %rsi     # 0x181ca
callq 0x2270
cmpl $0x0, %eax
jne 0x4644
movq 0x1d8(%rsp), %rax
movq 0x20(%rax), %rax
movq %rax, 0x58(%rsp)
leaq 0x157(%rsp), %rdi
movq %rdi, 0x60(%rsp)
callq 0x2320
movq 0x58(%rsp), %rsi
movq 0x60(%rsp), %rdx
leaq 0x158(%rsp), %rdi
callq 0x2260
jmp 0x4542
movq 0x1d8(%rsp), %rax
movq 0x28(%rax), %rax
movq %rax, 0x48(%rsp)
leaq 0x12f(%rsp), %rdi
movq %rdi, 0x50(%rsp)
callq 0x2320
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rdx
leaq 0x130(%rsp), %rdi
callq 0x2260
jmp 0x457e
leaq 0x158(%rsp), %rdi
leaq 0x130(%rsp), %rsi
callq 0x3e80
jmp 0x4595
leaq 0x130(%rsp), %rdi
callq 0x2358
leaq 0x12f(%rsp), %rdi
callq 0x21e0
leaq 0x158(%rsp), %rdi
callq 0x2358
leaq 0x157(%rsp), %rdi
callq 0x21e0
jmp 0x4649
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1a8(%rsp)
movl %eax, 0x1a4(%rsp)
jmp 0x4632
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1a8(%rsp)
movl %eax, 0x1a4(%rsp)
jmp 0x4618
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1a8(%rsp)
movl %eax, 0x1a4(%rsp)
leaq 0x130(%rsp), %rdi
callq 0x2358
leaq 0x12f(%rsp), %rdi
callq 0x21e0
leaq 0x158(%rsp), %rdi
callq 0x2358
leaq 0x157(%rsp), %rdi
callq 0x21e0
jmp 0x4922
callq 0x4250
jmp 0x464b
jmp 0x4917
movq 0x1d8(%rsp), %rax
movq 0x10(%rax), %rdi
leaq 0x13b61(%rip), %rsi     # 0x181c4
callq 0x2270
cmpl $0x0, %eax
jne 0x47b2
movq 0x1d8(%rsp), %rax
movq 0x20(%rax), %rax
movq %rax, 0x38(%rsp)
leaq 0x107(%rsp), %rdi
movq %rdi, 0x40(%rsp)
callq 0x2320
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rdx
leaq 0x108(%rsp), %rdi
callq 0x2260
jmp 0x46ad
movq 0x1d8(%rsp), %rax
movq 0x28(%rax), %rax
movq %rax, 0x28(%rsp)
leaq 0xdf(%rsp), %rdi
movq %rdi, 0x30(%rsp)
callq 0x2320
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
leaq 0xe0(%rsp), %rdi
callq 0x2260
jmp 0x46e9
leaq 0x108(%rsp), %rdi
leaq 0xe0(%rsp), %rsi
callq 0x3c10
jmp 0x4700
leaq 0xe0(%rsp), %rdi
callq 0x2358
leaq 0xdf(%rsp), %rdi
callq 0x21e0
leaq 0x108(%rsp), %rdi
callq 0x2358
leaq 0x107(%rsp), %rdi
callq 0x21e0
jmp 0x4915
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1a8(%rsp)
movl %eax, 0x1a4(%rsp)
jmp 0x47a0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1a8(%rsp)
movl %eax, 0x1a4(%rsp)
jmp 0x4786
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1a8(%rsp)
movl %eax, 0x1a4(%rsp)
leaq 0xe0(%rsp), %rdi
callq 0x2358
leaq 0xdf(%rsp), %rdi
callq 0x21e0
leaq 0x108(%rsp), %rdi
callq 0x2358
leaq 0x107(%rsp), %rdi
callq 0x21e0
jmp 0x4922
movq 0x1d8(%rsp), %rax
movq 0x10(%rax), %rdi
leaq 0x13a05(%rip), %rsi     # 0x181ca
callq 0x2270
cmpl $0x0, %eax
jne 0x490e
movq 0x1d8(%rsp), %rax
movq 0x20(%rax), %rax
movq %rax, 0x18(%rsp)
leaq 0xb7(%rsp), %rdi
movq %rdi, 0x20(%rsp)
callq 0x2320
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdx
leaq 0xb8(%rsp), %rdi
callq 0x2260
jmp 0x480f
movq 0x1d8(%rsp), %rax
movq 0x28(%rax), %rax
movq %rax, 0x8(%rsp)
leaq 0x8f(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0x2320
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
leaq 0x90(%rsp), %rdi
callq 0x2260
jmp 0x484b
leaq 0xb8(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x4020
jmp 0x4862
leaq 0x90(%rsp), %rdi
callq 0x2358
leaq 0x8f(%rsp), %rdi
callq 0x21e0
leaq 0xb8(%rsp), %rdi
callq 0x2358
leaq 0xb7(%rsp), %rdi
callq 0x21e0
jmp 0x4913
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1a8(%rsp)
movl %eax, 0x1a4(%rsp)
jmp 0x48ff
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1a8(%rsp)
movl %eax, 0x1a4(%rsp)
jmp 0x48e5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1a8(%rsp)
movl %eax, 0x1a4(%rsp)
leaq 0x90(%rsp), %rdi
callq 0x2358
leaq 0x8f(%rsp), %rdi
callq 0x21e0
leaq 0xb8(%rsp), %rdi
callq 0x2358
leaq 0xb7(%rsp), %rdi
callq 0x21e0
jmp 0x4922
callq 0x4250
jmp 0x4915
jmp 0x4917
jmp 0x4919
jmp 0x491b
xorl %edi, %edi
callq 0x2220
movq 0x1a8(%rsp), %rdi
callq 0x2310
nop