LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/lmclaramunt[P]AES-Crypto/Block.cpp
// Function: Block::~Block()
Block::~Block() {
    try {
        sequenceVct.clear();
        sequenceVct.shrink_to_fit();
    } catch (...) {
        cout<<"Could not clear the vector from memory!"<<endl;
    }
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rax
cmpq %rax, 0x8(%rdi)
je 0x317d
movq %rax, 0x8(%rbx)
movq %rbx, %rdi
callq 0x340e
movq %rbx, %rdi
popq %rbx
jmp 0x3276
// File: /workspace/github_cpp_makefile_star2_O2/lmclaramunt[P]AES-Crypto/Block.cpp
// Function: operator<<(std::ostream&, Block const&)
ostream& operator<<(ostream& os, const Block& block) {
    for (Sequence sq: block.sequenceVct) {
        for (int i = 0; i < sq.getSize(); i++) {
            os << hex << (int)sq.getSequence()[i]<<" ";
        }
        os << endl;
    }
    return os;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq (%rsi), %r12
movq 0x8(%rsi), %r13
movq %rsp, %r14
leaq 0x4059(%rip), %r15      # 0x720d
cmpq %r13, %r12
je 0x321d
movups (%r12), %xmm0
movaps %xmm0, (%rsp)
xorl %ebp, %ebp
movq %r14, %rdi
callq 0x2eb8
cltq
cmpq %rax, %rbp
jge 0x320f
movq (%rbx), %rax
movq -0x18(%rax), %rax
movl 0x18(%rbx,%rax), %ecx
andl $-0x4b, %ecx
orl $0x8, %ecx
movl %ecx, 0x18(%rbx,%rax)
movq %r14, %rdi
callq 0x2eb4
movq (%rax), %rax
movzbl (%rax,%rbp), %esi
movq %rbx, %rdi
callq 0x23b0
movq %rax, %rdi
movq %r15, %rsi
callq 0x21f0
incq %rbp
jmp 0x31c4
movq %rbx, %rdi
callq 0x20f0
addq $0x10, %r12
jmp 0x31b4
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/lmclaramunt[P]AES-Crypto/State.cpp
// Function: State::State(Sequence*)
State::State(Sequence* sq): s(new unsigned char*[4]) {
    for (int i=0; i < 4; i++) {
        s[i] = new unsigned char[4];
    }
    for (int i=0; i < 4; i++) {
        for (int j=0; j < 4; j++) {
            s[i][j] = sq->getSequence()[i + 4*j];
        }
    }
}

/*
 * Destructor for cleanup
 */
State::~State() {
    try {
        for (int i=0; i < 4; i++) 
            for (int j=0; j < 4; j++) s[i][j] = 0;
    } catch (...) {
        throw "Failed to override the used State!\n";
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
pushq $0x20
popq %rdi
callq 0x2030
movq %rax, (%r14)
xorl %r12d, %r12d
pushq $0x4
popq %r15
cmpq $0x4, %r12
je 0x36d6
movq %r15, %rdi
callq 0x2030
movq (%r14), %rcx
movq %rax, (%rcx,%r12,8)
incq %r12
jmp 0x36bc
xorl %r15d, %r15d
cmpq $0x4, %r15
je 0x370f
xorl %r12d, %r12d
cmpq $0x4, %r12
je 0x370a
movq %rbx, %rdi
callq 0x2eb4
movq (%rax), %rax
addq %r15, %rax
movb (%rax,%r12,4), %al
movq (%r14), %rcx
movq (%rcx,%r15,8), %rcx
movb %al, (%rcx,%r12)
incq %r12
jmp 0x36e2
incq %r15
jmp 0x36d9
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/lmclaramunt[P]AES-Crypto/State.cpp
// Function: State::toSequence() const
Sequence State::toSequence() const {
    Sequence sq(16);
    for(int column = 0; column < 4; column++) {
        for(int row = 0; row < 4; row++){    
            sq.getSequence()[row + 4*column] = s[row][column];
        }
    }
    return sq;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq 0x8(%rsp), %r14
pushq $0x10
popq %rsi
movq %r14, %rdi
callq 0x2ea0
xorl %r15d, %r15d
xorl %r12d, %r12d
cmpq $0x4, %r12
je 0x37a8
xorl %r13d, %r13d
cmpq $0x4, %r13
je 0x379f
movq (%rbx), %rax
movq (%rax,%r13,8), %rax
movb (%rax,%r12), %bpl
movq %r14, %rdi
callq 0x2eb4
movq (%rax), %rax
addq %r15, %rax
movb %bpl, (%r13,%rax)
incq %r13
jmp 0x3776
incq %r12
addq $0x4, %r15
jmp 0x376d
movq 0x8(%rsp), %rax
movl 0x10(%rsp), %edx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/lmclaramunt[P]AES-Crypto/State.cpp
// Function: operator<<(std::ostream&, State const&)
ostream& operator<<(ostream& os, const State& state) {
    for (int i=0; i < 4; i++) {
        for (int j=0; j < 4; j++) {
            os << hex <<(int)state.s[i][j] << ' ';
        }
        os << endl;
    }
    return os;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
xorl %r15d, %r15d
pushq $0x20
popq %rbp
cmpq $0x4, %r15
je 0x382c
xorl %r12d, %r12d
cmpq $0x4, %r12
je 0x381f
movq (%rbx), %rax
movq -0x18(%rax), %rax
movl 0x18(%rbx,%rax), %ecx
andl $-0x4b, %ecx
orl $0x8, %ecx
movl %ecx, 0x18(%rbx,%rax)
movq (%r14), %rax
movq (%rax,%r15,8), %rax
movzbl (%rax,%r12), %esi
movq %rbx, %rdi
callq 0x23b0
movq %rax, %rdi
movl %ebp, %esi
callq 0x2230
incq %r12
jmp 0x37e1
movq %rbx, %rdi
callq 0x20f0
incq %r15
jmp 0x37d8
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/lmclaramunt[P]AES-Crypto/State.cpp
// Function: operator^(State&, State&)
State& operator^(State& a, State& b) {
    for (int i=0; i < 4; i++) {
        for (int j=0; j < 4; j++) {
            a.s[i][j] ^= b.s[i][j];
        }
    }
    return a;
}

// Assembly:
movq %rdi, %rax
xorl %ecx, %ecx
cmpq $0x4, %rcx
je 0x386b
xorl %edx, %edx
cmpq $0x4, %rdx
je 0x3866
movq (%rsi), %rdi
movq (%rdi,%rcx,8), %rdi
movb (%rdi,%rdx), %dil
movq (%rax), %r8
movq (%r8,%rcx,8), %r8
xorb %dil, (%r8,%rdx)
incq %rdx
jmp 0x3845
incq %rcx
jmp 0x383d
retq
// File: /workspace/github_cpp_makefile_star2_O2/lmclaramunt[P]AES-Crypto/Cipher.cpp
// Function: Cipher::Cipher(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, int*, bool, bool)
Cipher::Cipher(string* _textPath, int* keyLength, bool padding, bool encrypt): 
        textPath(_textPath) {
    try {
        if(!fileExists(textPath)) throw "File given in path '-p' wasn't found\n";
        cryptoDir();
        setBlockRoundCombinations(keyLength, true);
        getKey(encrypt, &aesKeyPath, &aesKeyExp);
        getKey(encrypt, &macKeyPath, &macKeyExp);
        vector<unsigned char> inpVct;
        readText(&inpVct);
        inputBlock = new Block(&inpVct, padding);
    } catch(const char* str) {
        throw str;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r8d, %r12d
movl %ecx, %ebp
movq %rdx, %r13
movq %rdi, %rbx
movq %rsi, 0x28(%rdi)
leaq 0x40(%rdi), %rax
movq %rax, 0x30(%rdi)
andq $0x0, 0x38(%rdi)
xorl %eax, %eax
movb %al, 0x40(%rdi)
leaq 0x50(%rdi), %r14
leaq 0x60(%rdi), %rcx
movq %rcx, 0x50(%rdi)
andq $0x0, 0x58(%rdi)
movb %al, 0x60(%rdi)
leaq 0x70(%rdi), %r15
leaq 0x80(%rdi), %rcx
movq %rcx, 0x70(%rdi)
andq $0x0, 0x78(%rdi)
movb %al, 0x80(%rdi)
callq 0x3a04
testb %al, %al
je 0x395e
movq %rbx, %rdi
callq 0x3a26
pushq $0x1
popq %rdx
movq %rbx, %rdi
movq %r13, %rsi
callq 0x3a94
movzbl %r12b, %r12d
movq %rbx, %rdi
movl %r12d, %esi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x3c34
leaq 0x8(%rbx), %rcx
movq %rbx, %rdi
movl %r12d, %esi
movq %r15, %rdx
callq 0x3c34
xorps %xmm0, %xmm0
movq %rsp, %rsi
movaps %xmm0, (%rsi)
andq $0x0, 0x10(%rsi)
movq %rbx, %rdi
callq 0x3ddc
pushq $0x18
popq %rdi
callq 0x2200
movq %rax, %r13
movzbl %bpl, %edx
movq %rsp, %rsi
movq %rax, %rdi
callq 0x3018
movq %r13, 0x10(%rbx)
movq %rsp, %rdi
callq 0x59f4
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x8
popq %rdi
callq 0x2100
leaq 0x3d2d(%rip), %rcx      # 0x769a
movq %rcx, (%rax)
movq 0x7651(%rip), %rsi      # 0xafc8
movq %rax, %rdi
xorl %edx, %edx
callq 0x23a0
jmp 0x39d8
movq %rdx, %rbp
movq %rax, %r12
pushq $0x18
popq %rsi
movq %r13, %rdi
callq 0x2210
jmp 0x399c
movq %rdx, %rbp
movq %rax, %r12
movq %rsp, %rdi
callq 0x59f4
jmp 0x39ac
movq %rdx, %rbp
movq %rax, %r12
cmpl $0x1, %ebp
jne 0x39e0
movq %r12, %rdi
callq 0x20a0
movq %rax, %r12
pushq $0x8
popq %rdi
callq 0x2100
movq %r12, (%rax)
movq 0x75fa(%rip), %rsi      # 0xafc8
movq %rax, %rdi
xorl %edx, %edx
callq 0x23a0
movq %rax, %r12
callq 0x2370
addq $0x30, %rbx
movq %r15, %rdi
callq 0x20c0
movq %r14, %rdi
callq 0x20c0
movq %rbx, %rdi
callq 0x20c0
movq %r12, %rdi
callq 0x23d0
// File: /workspace/github_cpp_makefile_star2_O2/lmclaramunt[P]AES-Crypto/Cipher.cpp
// Function: Cipher::cryptoDir()
void Cipher::cryptoDir() {
    struct stat info;
    home = getenv("HOME");
    home += "/.crypto";
    char *pathname = &home[0];
    if(stat(pathname, &info) != 0) {
        mkdir(pathname, 0770);
    }
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x98, %rsp
movq %rdi, %rbx
leaq 0x3cf4(%rip), %rdi      # 0x772e
callq 0x2250
leaq 0x30(%rbx), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x2410
leaq 0x3cde(%rip), %rsi      # 0x7733
movq %r14, %rdi
callq 0x2400
movq 0x30(%rbx), %rbx
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x21c0
testl %eax, %eax
je 0x3a89
movq %rbx, %rdi
movl $0x1f8, %esi            # imm = 0x1F8
addq $0x98, %rsp
popq %rbx
popq %r14
jmp 0x20d0
addq $0x98, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/lmclaramunt[P]AES-Crypto/Cipher.cpp
// Function: Cipher::setBlockRoundCombinations(int*, bool)
void Cipher::setBlockRoundCombinations(int* keyLength, bool setKeyPath) {
    switch (*keyLength) {
    case 128:
        Nk = 4, Nr = 10;
        break;
    case 192:
        Nk = 6, Nr = 12;
        break;
    case 256:
        Nk = 8, Nr = 14;
        break;
    default: 
        throw "Invalid Key Length -- Valid: 128, 192, 256"; 
        break;
    }
    if(setKeyPath){ 
        string length = to_string(*keyLength);              //Default AES and MAC keys location
        aesKeyPath = home + "/.AES-" + length + ".aes";
        macKeyPath = home + "/.MAC-" + length + ".aes";   
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x80, %rsp
movq %rdi, %rbx
movl (%rsi), %eax
cmpl $0x80, %eax
je 0x3ad2
cmpl $0x100, %eax            # imm = 0x100
je 0x3ac8
cmpl $0xc0, %eax
jne 0x3bda
movsd 0x39aa(%rip), %xmm0     # 0x7470
jmp 0x3ada
movsd 0x3990(%rip), %xmm0     # 0x7460
jmp 0x3ada
movsd 0x3976(%rip), %xmm0     # 0x7450
movlps %xmm0, 0x18(%rbx)
testb %dl, %dl
je 0x3bcd
movl (%rsi), %esi
leaq 0x40(%rsp), %rdi
callq 0x56c2
leaq 0x30(%rbx), %r14
leaq 0x3c6a(%rip), %rdx      # 0x7767
movq %rsp, %rdi
movq %r14, %rsi
callq 0x5759
leaq 0x20(%rsp), %rdi
movq %rsp, %rsi
leaq 0x40(%rsp), %rdx
callq 0x573a
leaq 0x3c4d(%rip), %rdx      # 0x776e
leaq 0x60(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x571b
leaq 0x50(%rbx), %rdi
leaq 0x60(%rsp), %r15
movq %r15, %rsi
callq 0x2260
movq %r15, %rdi
callq 0x20c0
leaq 0x20(%rsp), %rdi
callq 0x20c0
movq %rsp, %rdi
callq 0x20c0
leaq 0x3c11(%rip), %rdx      # 0x7773
movq %rsp, %rdi
movq %r14, %rsi
callq 0x5759
leaq 0x20(%rsp), %rdi
movq %rsp, %rsi
leaq 0x40(%rsp), %rdx
callq 0x573a
leaq 0x3be8(%rip), %rdx      # 0x776e
leaq 0x60(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x571b
addq $0x70, %rbx
leaq 0x60(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2260
movq %r14, %rdi
callq 0x20c0
leaq 0x20(%rsp), %rdi
callq 0x20c0
movq %rsp, %rdi
callq 0x20c0
leaq 0x40(%rsp), %rdi
callq 0x20c0
addq $0x80, %rsp
popq %rbx
popq %r14
popq %r15
retq
pushq $0x8
popq %rdi
callq 0x2100
leaq 0x3b53(%rip), %rcx      # 0x773c
movq %rcx, (%rax)
movq 0x73d5(%rip), %rsi      # 0xafc8
movq %rax, %rdi
xorl %edx, %edx
callq 0x23a0
jmp 0x3c03
jmp 0x3c12
jmp 0x3c1f
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x20c0
jmp 0x3c15
movq %rax, %rbx
movq %rsp, %rdi
callq 0x20c0
jmp 0x3c22
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x20c0
movq %rbx, %rdi
callq 0x23d0
// File: /workspace/github_cpp_makefile_star2_O2/lmclaramunt[P]AES-Crypto/Cipher.cpp
// Function: Cipher::getKey(bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, unsigned char***)
void Cipher::getKey(bool encrypt, string* keyPath, unsigned char*** keyExpanded){
    unsigned char* key = new unsigned char[4*Nk];
    ifstream input(*keyPath, ios::binary);
    if(input.is_open()){        //Read key, given path to it
        for(int i=0; i < 4*Nk; i++)
            key[i] = input.get();
        input.close(); 
    } else if(encrypt) {          //Create new key if we are encrypting
        generateKey(key, Nk);
        ofstream keyFile;
        keyFile.open(*keyPath, ios::binary);
        keyFile.write((const char*)key, 4*Nk);
        keyFile.close();       
    } else {
        throw "Missing key for decryption\n";   //User should have key to decrypt
    }

    /* MEM53-CPP. Explicitly construct and destruct objects when 
       manually managing object lifetime */
    *keyExpanded = new unsigned char*[4*(Nr+1)];    //Expand the key   
    for(int j=0; j<4*(Nr+1); j++)
        (*keyExpanded)[j] = new unsigned char[4];
    keyExpansion(key, *keyExpanded);
    
    delete[] key;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x408, %rsp            # imm = 0x408
movq %rcx, %rbx
movq %rdx, %r12
movl %esi, %ebp
movq %rdi, %r14
movslq 0x18(%rdi), %rdi
shlq $0x2, %rdi
callq 0x2030
movq %rax, %r15
leaq 0x200(%rsp), %rdi
pushq $0x4
popq %rdx
movq %r12, %rsi
callq 0x2350
leaq 0x278(%rsp), %rdi
callq 0x2050
testb %al, %al
je 0x3cad
xorl %r13d, %r13d
leaq 0x200(%rsp), %r12
movslq 0x18(%r14), %rax
shlq $0x2, %rax
cmpq %rax, %r13
jge 0x3cfd
movq %r12, %rdi
callq 0x2240
movb %al, (%r15,%r13)
incq %r13
jmp 0x3c8f
testb %bpl, %bpl
je 0x3d8d
movl 0x18(%r14), %edx
movq %r15, %rsi
callq 0x438e
movq %rsp, %rdi
callq 0x2390
movq %rsp, %rdi
pushq $0x4
popq %rdx
movq %r12, %rsi
callq 0x20e0
movslq 0x18(%r14), %rdx
shlq $0x2, %rdx
movq %rsp, %rdi
movq %r15, %rsi
callq 0x2290
movq %rsp, %rdi
callq 0x22d0
movq %rsp, %rdi
callq 0x22f0
jmp 0x3d0a
leaq 0x200(%rsp), %rdi
callq 0x2040
movl 0x1c(%r14), %eax
leal 0x4(,%rax,4), %r13d
movslq %r13d, %rax
leaq (,%rax,8), %rcx
testl %eax, %eax
pushq $-0x1
popq %rdi
cmovnsq %rcx, %rdi
callq 0x2030
movq %rax, (%rbx)
xorl %ebp, %ebp
testl %r13d, %r13d
cmovlel %ebp, %r13d
pushq $0x4
popq %r12
cmpq %rbp, %r13
je 0x3d58
movq %r12, %rdi
callq 0x2030
movq (%rbx), %rcx
movq %rax, (%rcx,%rbp,8)
incq %rbp
jmp 0x3d3f
movq (%rbx), %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x456e
movq %r15, %rdi
callq 0x2270
leaq 0x200(%rsp), %rdi
callq 0x2060
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x8
popq %rdi
callq 0x2100
leaq 0x39de(%rip), %rcx      # 0x777a
movq %rcx, (%rax)
movq 0x7222(%rip), %rsi      # 0xafc8
movq %rax, %rdi
xorl %edx, %edx
callq 0x23a0
jmp 0x3dc3
movq %rax, %rbx
movq %rsp, %rdi
callq 0x22f0
jmp 0x3dc6
jmp 0x3dc3
jmp 0x3dc3
movq %rax, %rbx
leaq 0x200(%rsp), %rdi
callq 0x2060
movq %rbx, %rdi
callq 0x23d0
nop
// File: /workspace/github_cpp_makefile_star2_O2/lmclaramunt[P]AES-Crypto/Cipher.cpp
// Function: Cipher::readText(std::vector<unsigned char, std::allocator<unsigned char>>*)
void Cipher::readText(vector<unsigned char>* inpVct) {
    ifstream input(*textPath, ios::binary);
    streampos textSize;             //Size of the file
    input.seekg(0, ios::end);
    textSize = input.tellg();
    input.seekg(0, ios::beg);
    inpVct->reserve(textSize);      //The vector will have enough space for all elements
    inpVct->insert(inpVct->begin(), 
        (istreambuf_iterator<char>(input)),
        (istreambuf_iterator<char>()));
    input.close();
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x208, %rsp            # imm = 0x208
movq %rsi, %rbx
movq 0x28(%rdi), %rsi
movq %rsp, %r14
pushq $0x4
popq %rdx
movq %r14, %rdi
callq 0x2350
pushq $0x2
popq %rdx
movq %r14, %rdi
xorl %esi, %esi
callq 0x22a0
movq %rsp, %rdi
callq 0x23c0
movq %rax, %r14
movq %rsp, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x22a0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5792
movq (%rbx), %rsi
movq (%rsp), %rax
movq -0x18(%rax), %rax
movq 0xe8(%rsp,%rax), %rdx
pushq $-0x1
popq %rcx
movq %rbx, %rdi
xorl %r8d, %r8d
movl %ecx, %r9d
callq 0x581c
movq %rsp, %rdi
callq 0x2040
movq %rsp, %rdi
callq 0x2060
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r14
retq
jmp 0x3e6d
jmp 0x3e6d
movq %rax, %rbx
movq %rsp, %rdi
callq 0x2060
movq %rbx, %rdi
callq 0x23d0
// File: /workspace/github_cpp_makefile_star2_O2/lmclaramunt[P]AES-Crypto/Cipher.cpp
// Function: Cipher::getKeySize(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*)
int Cipher::getKeySize(string* aesKey, string* macKey){
    ifstream aes(*aesKey, ios::binary);
    aes.seekg(0, ios::end);
    int aes_size = aes.tellg();
    ifstream mac(*macKey, ios::binary);
    mac.seekg(0, ios::end);
    int mac_size = mac.tellg();
    if(aes_size != mac_size)
        throw "AES and MAC key must be of the same size\n";
    return aes_size*8;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x418, %rsp            # imm = 0x418
movq %rdx, %r14
leaq 0x210(%rsp), %rbx
pushq $0x4
popq %rdx
movq %rbx, %rdi
callq 0x2350
pushq $0x2
popq %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x22a0
leaq 0x210(%rsp), %rdi
callq 0x23c0
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
pushq $0x4
popq %rdx
movq %r14, %rsi
callq 0x2350
leaq 0x8(%rsp), %rdi
pushq $0x2
popq %rdx
xorl %esi, %esi
callq 0x22a0
leaq 0x8(%rsp), %rdi
callq 0x23c0
cmpl %eax, %ebx
jne 0x40f7
shll $0x3, %ebx
leaq 0x8(%rsp), %rdi
callq 0x2060
leaq 0x210(%rsp), %rdi
callq 0x2060
movl %ebx, %eax
addq $0x418, %rsp            # imm = 0x418
popq %rbx
popq %r14
retq
pushq $0x8
popq %rdi
callq 0x2100
leaq 0x35fe(%rip), %rcx      # 0x7704
movq %rcx, (%rax)
movq 0x6eb8(%rip), %rsi      # 0xafc8
movq %rax, %rdi
xorl %edx, %edx
callq 0x23a0
jmp 0x411e
jmp 0x411e
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x2060
jmp 0x4134
jmp 0x4131
jmp 0x4131
movq %rax, %rbx
leaq 0x210(%rsp), %rdi
callq 0x2060
movq %rbx, %rdi
callq 0x23d0
nop
// File: /workspace/github_cpp_makefile_star2_O2/lmclaramunt[P]AES-Crypto/Cipher.cpp
// Function: Cipher::Cipher(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, int*, bool, bool)
Cipher::Cipher(string* _textPath, string* _aesKeyPath, string* _macKeyPath, 
    int* keyLength, bool padding, bool encrypt): 
    textPath(_textPath), aesKeyPath(*_aesKeyPath), macKeyPath(*_macKeyPath){
    try {
        if(!fileExists(textPath)) throw "File given in path '-p' wasn't found\n";
        cryptoDir();
        setBlockRoundCombinations(keyLength, false);
        getKey(encrypt, &aesKeyPath, &aesKeyExp);
        getKey(encrypt, &macKeyPath, &macKeyExp);
        vector<unsigned char> inpVct;
        readText(&inpVct);
        inputBlock = new Block(&inpVct, padding);
    } catch(const char* str) {
        throw str;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r9d, %ebp
movq %r8, %r12
movq %rdi, %rbx
movq %rsi, 0x28(%rdi)
leaq 0x40(%rdi), %rax
movq %rax, 0x30(%rdi)
andq $0x0, 0x38(%rdi)
movq %rcx, %r13
movb $0x0, 0x40(%rdi)
leaq 0x50(%rdi), %r14
movq %r14, %rdi
movq %rdx, %rsi
callq 0x22b0
leaq 0x70(%rbx), %r15
movq %r15, %rdi
movq %r13, %rsi
callq 0x22b0
movq 0x28(%rbx), %rsi
callq 0x3a04
testb %al, %al
je 0x4231
movq %rbx, %rdi
callq 0x3a26
movq %rbx, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x3a94
movzbl 0x50(%rsp), %r12d
movq %rbx, %rdi
movl %r12d, %esi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x3c34
leaq 0x8(%rbx), %rcx
movq %rbx, %rdi
movl %r12d, %esi
movq %r15, %rdx
callq 0x3c34
xorps %xmm0, %xmm0
movq %rsp, %rsi
movaps %xmm0, (%rsi)
andq $0x0, 0x10(%rsi)
movq %rbx, %rdi
callq 0x3ddc
pushq $0x18
popq %rdi
callq 0x2200
movq %rax, %r13
movzbl %bpl, %edx
movq %rsp, %rsi
movq %rax, %rdi
callq 0x3018
movq %r13, 0x10(%rbx)
movq %rsp, %rdi
callq 0x59f4
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x8
popq %rdi
callq 0x2100
leaq 0x345a(%rip), %rcx      # 0x769a
movq %rcx, (%rax)
movq 0x6d7e(%rip), %rsi      # 0xafc8
movq %rax, %rdi
xorl %edx, %edx
callq 0x23a0
jmp 0x42b5
movq %rdx, %rbp
movq %rax, %r12
pushq $0x18
popq %rsi
movq %r13, %rdi
callq 0x2210
jmp 0x4279
movq %rax, %r12
jmp 0x42c5
movq %rax, %r12
jmp 0x42cd
movq %rdx, %rbp
movq %rax, %r12
movq %rsp, %rdi
callq 0x59f4
jmp 0x4289
movq %rdx, %rbp
movq %rax, %r12
cmpl $0x1, %ebp
jne 0x42bd
movq %r12, %rdi
callq 0x20a0
movq %rax, %r12
pushq $0x8
popq %rdi
callq 0x2100
movq %r12, (%rax)
movq 0x6d1d(%rip), %rsi      # 0xafc8
movq %rax, %rdi
xorl %edx, %edx
callq 0x23a0
movq %rax, %r12
callq 0x2370
movq %r15, %rdi
callq 0x20c0
movq %r14, %rdi
callq 0x20c0
addq $0x30, %rbx
movq %rbx, %rdi
callq 0x20c0
movq %r12, %rdi
callq 0x23d0
nop
// File: /workspace/github_cpp_makefile_star2_O2/lmclaramunt[P]AES-Crypto/Cipher.cpp
// Function: Cipher::~Cipher()
Cipher::~Cipher() {
    try {
        inputBlock->~Block();
        for(int j=0; j<4*(Nr+1); j++) {
            std::fill_n(aesKeyExp[j], 4, 0);
            delete[] aesKeyExp[j];
            std::fill_n(macKeyExp[j], 4, 0);
            delete[] macKeyExp[j];
        }
        delete[] aesKeyExp, macKeyExp;
    } catch (...) {
        cout<<"Could not clear the keyExpansion from memory!"<<endl;
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x10(%rdi), %rdi
callq 0x316c
xorl %r14d, %r14d
movl 0x1c(%rbx), %eax
leal 0x4(,%rax,4), %eax
cltq
movq (%rbx), %rdi
cmpq %rax, %r14
jge 0x435f
movq (%rdi,%r14,8), %rax
xorl %ecx, %ecx
cmpq $0x4, %rcx
je 0x431e
movb $0x0, (%rax,%rcx)
incq %rcx
jmp 0x430f
movq (%rbx), %rax
movq (%rax,%r14,8), %rdi
testq %rdi, %rdi
je 0x432f
callq 0x2270
movq 0x8(%rbx), %rax
movq (%rax,%r14,8), %rax
xorl %ecx, %ecx
cmpq $0x4, %rcx
je 0x4348
movb $0x0, (%rax,%rcx)
incq %rcx
jmp 0x4339
movq 0x8(%rbx), %rax
movq (%rax,%r14,8), %rdi
testq %rdi, %rdi
je 0x435a
callq 0x2270
incq %r14
jmp 0x42f5
testq %rdi, %rdi
je 0x4369
callq 0x2270
leaq 0x70(%rbx), %rdi
callq 0x20c0
leaq 0x50(%rbx), %rdi
callq 0x20c0
addq $0x30, %rbx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x20c0
// File: /workspace/github_cpp_makefile_star2_O2/lmclaramunt[P]AES-Crypto/Cipher.cpp
// Function: Cipher::keyExpansion(unsigned char*, unsigned char**)
void Cipher::keyExpansion(unsigned char* key, unsigned char** keyExpanded) {
    unsigned char temp[4];
    int i = 0;
    
    while(i < Nk) {
        for(int j=0; j<4; j++) keyExpanded[i][j] = key[4*i+j];
        i++;
    }
    i = Nk;
    while (i < 4*(Nr+1)) {
        for(int j=0; j<4; j++) temp[j] = keyExpanded[i-1][j];
        if (i % Nk == 0) {
            unsigned char rcon[4];
            Rcon(i/Nk, rcon);
            RotWord(temp);
            subWord(temp);
            for(int j=0; j<4; j++) temp[j] ^= rcon[j];
        } else if (Nk > 6 && i % Nk == 4) {
            subWord(temp);
        }
        for(int j=0; j<4; j++) 
            keyExpanded[i][j] = keyExpanded[i-Nk][j] ^ temp[j];
        i++;
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdx, %rbx
movq %rdi, %r14
xorl %eax, %eax
movslq 0x18(%r14), %r15
cmpq %r15, %rax
jge 0x45b4
leal (,%rax,4), %ecx
addq %rsi, %rcx
xorl %edx, %edx
cmpq $0x4, %rdx
je 0x45af
movb (%rcx,%rdx), %dil
movq (%rbx,%rax,8), %r8
movb %dil, (%r8,%rdx)
incq %rdx
jmp 0x4598
incq %rax
jmp 0x4583
leaq 0x30d5(%rip), %r13      # 0x7690
leaq 0x8(%rsp), %r12
movl 0x1c(%r14), %eax
leal 0x4(,%rax,4), %eax
cltq
cmpq %rax, %r15
jge 0x468e
movq -0x8(%rbx,%r15,8), %rax
xorl %ecx, %ecx
cmpq $0x4, %rcx
je 0x45ef
movb (%rax,%rcx), %dl
movb %dl, 0x8(%rsp,%rcx)
incq %rcx
jmp 0x45dd
movl 0x18(%r14), %ecx
movl %r15d, %eax
cltd
idivl %ecx
testl %edx, %edx
je 0x463d
cmpl $0x7, %ecx
jl 0x460f
cmpl $0x4, %edx
jne 0x460f
movq %r12, %rsi
callq 0x469c
xorl %eax, %eax
cmpq $0x4, %rax
je 0x4638
movslq 0x18(%r14), %rcx
movq %r15, %rdx
subq %rcx, %rdx
movq (%rbx,%rdx,8), %rcx
movb 0x8(%rsp,%rax), %dl
xorb (%rcx,%rax), %dl
movq (%rbx,%r15,8), %rcx
movb %dl, (%rcx,%rax)
incq %rax
jmp 0x4611
incq %r15
jmp 0x45c0
cltq
movb -0x1(%rax,%r13), %al
movb %al, 0xc(%rsp)
movb $0x0, 0xf(%rsp)
andw $0x0, 0xd(%rsp)
movd 0x8(%rsp), %xmm0
movdqa %xmm0, %xmm1
psrld $0x8, %xmm1
pslld $0x18, %xmm0
por %xmm1, %xmm0
movd %xmm0, 0x8(%rsp)
movq %r12, %rsi
callq 0x469c
xorl %eax, %eax
cmpq $0x4, %rax
je 0x460f
movb 0xc(%rsp,%rax), %cl
xorb %cl, 0x8(%rsp,%rax)
incq %rax
jmp 0x467b
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/lmclaramunt[P]AES-Crypto/Cipher.cpp
// Function: Cipher::shiftColumnsByOne(unsigned char**, int*, bool)
void Cipher::shiftColumnsByOne(unsigned char** st, int* row, bool leftDir) {
    if(leftDir) {
        for(int column = 0; column < 3; column++) {
            unsigned char temp = st[*row][column];
            int next = (column + 1) % 4;
            st[*row][column] = st[*row][next];
            st[*row][next] = temp;
        }
    } else {
        for(int column = 3; column > 0; column--) {
            unsigned char temp = st[*row][column];
            int next = (column + 1) % 4;
            st[*row][column] = st[*row][next];
            st[*row][next] = temp;
        }
    }
}

// Assembly:
testl %ecx, %ecx
je 0x471e
pushq $0x1
popq %rax
cmpq $0x4, %rax
je 0x4753
movslq (%rdx), %rcx
movq (%rsi,%rcx,8), %rcx
movb -0x1(%rcx,%rax), %dil
movb (%rcx,%rax), %r8b
movb %r8b, -0x1(%rcx,%rax)
movslq (%rdx), %rcx
movq (%rsi,%rcx,8), %rcx
movb %dil, (%rcx,%rax)
incq %rax
jmp 0x46f3
pushq $0x4
popq %rax
cmpq $0x1, %rax
je 0x4753
movslq (%rdx), %rcx
movq (%rsi,%rcx,8), %rcx
movb -0x1(%rcx,%rax), %dil
movl %eax, %r8d
andl $0x3, %r8d
movb (%rcx,%r8), %r9b
movb %r9b, -0x1(%rcx,%rax)
movslq (%rdx), %rcx
movq (%rsi,%rcx,8), %rcx
movb %dil, (%rcx,%r8)
decq %rax
jmp 0x4721
retq
// File: /workspace/github_cpp_makefile_star2_O2/lmclaramunt[P]AES-Crypto/Cipher.cpp
// Function: Cipher::shiftColumnsByTwo(unsigned char**, int*)
void Cipher::shiftColumnsByTwo(unsigned char** st, int* row) {
    for(int column = 0; column < 2; column++) {
        unsigned char temp = st[*row][column];
        st[*row][column] = st[*row][column+2];
        st[*row][column+2] = temp;
    }
}

// Assembly:
xorl %eax, %eax
cmpq $0x2, %rax
je 0x4781
movslq (%rdx), %rcx
movq (%rsi,%rcx,8), %rcx
movb (%rcx,%rax), %dil
movb 0x2(%rcx,%rax), %r8b
movb %r8b, (%rcx,%rax)
movslq (%rdx), %rcx
movq (%rsi,%rcx,8), %rcx
movb %dil, 0x2(%rcx,%rax)
incq %rax
jmp 0x4756
retq
// File: /workspace/github_cpp_makefile_star2_O2/lmclaramunt[P]AES-Crypto/Cipher.cpp
// Function: Cipher::shiftRows(unsigned char**)
void Cipher::shiftRows(unsigned char** st) {
    int row = 1;
    shiftColumnsByOne(st, &row, true);
    shiftColumnsByTwo(st, &(++row));
    shiftColumnsByOne(st, &(++row), false);   //Shift to the right by 1 is equivalent to shift to the left by 3
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
leaq 0x4(%rsp), %r14
movl $0x1, (%r14)
pushq $0x1
popq %rcx
movq %r14, %rdx
callq 0x46ec
movl $0x2, (%r14)
movq %rbx, %rsi
movq %r14, %rdx
callq 0x4754
movl $0x3, (%r14)
movq %rbx, %rsi
movq %r14, %rdx
xorl %ecx, %ecx
callq 0x46ec
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/lmclaramunt[P]AES-Crypto/Cipher.cpp
// Function: Cipher::gFMultiply(unsigned char, unsigned char)
unsigned char Cipher::gFMultiply(unsigned char matrixValue, unsigned char st) {
    unsigned char mul = 0x00;
    if (matrixValue%0x02) {
        mul = st;
        matrixValue -= 0x01;
    }
    while (matrixValue) {
        unsigned char xt = st;
        for (int i=0; i < (int)log2(matrixValue); i++){
            xt = xTime(xt);
        }
        mul ^= xt;
        matrixValue %= (unsigned)(int)pow(2, (int)log2(matrixValue));
    }
    return mul;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edx, %ebx
movl %esi, %edx
andb $-0x2, %dl
xorl %ebp, %ebp
testb $0x1, %sil
cmovnel %ebx, %ebp
testb %dl, %dl
je 0x485c
movzbl %dl, %r14d
movl %ebx, %r15d
xorl %r12d, %r12d
movl %r14d, %edi
callq 0x583c
cvttsd2si %xmm0, %eax
cmpl %eax, %r12d
jge 0x4830
leal (%r15,%r15), %eax
movzbl %al, %ecx
xorb $0x1b, %al
testb %r15b, %r15b
movzbl %al, %r15d
cmovnsl %ecx, %r15d
incl %r12d
jmp 0x4806
xorb %bpl, %r15b
movl %r14d, %edi
callq 0x583c
cvttsd2si %xmm0, %edi
movsd 0x2c39(%rip), %xmm0     # 0x7480
callq 0x2320
cvttsd2si %xmm0, %ecx
movl %r14d, %eax
xorl %edx, %edx
divl %ecx
movl %r15d, %ebp
jmp 0x47f8
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/lmclaramunt[P]AES-Crypto/Cipher.cpp
// Function: Cipher::mixColumns(unsigned char**, unsigned char**)
void Cipher::mixColumns(unsigned char** st, unsigned char** s2){
    unsigned char matrixValues[4] = {0x02, 0x03, 0x01, 0x01};
    for (int i=0; i < 4; i++) {
        for (unsigned int j=0; j < 4; j++) {
            if (i==0) {
                s2[j] = new unsigned char[4];
            }
            unsigned int temp = 0;
            for (unsigned int k=0; k < 4; k++) {
                temp ^= gFMultiply(matrixValues[(k-j)%4], st[k][i]);
            }
            s2[j][i] = temp;
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, 0x8(%rsp)
movq %rsi, %r14
xorl %r12d, %r12d
leaq 0x2f8c(%rip), %r13      # 0x7814
cmpq $0x4, %r12
je 0x48fe
xorl %ebp, %ebp
xorl %ebx, %ebx
cmpq $0x4, %rbx
je 0x48f9
testq %r12, %r12
jne 0x48ae
pushq $0x4
popq %rdi
callq 0x2030
movq 0x8(%rsp), %rcx
movq %rax, (%rcx,%rbx,8)
movq %rbx, 0x10(%rsp)
xorl %ebx, %ebx
xorl %r15d, %r15d
cmpq $0x4, %rbx
je 0x48df
leal (%rbx,%rbp), %eax
andl $0x3, %eax
movzbl (%rax,%r13), %esi
movq (%r14,%rbx,8), %rax
movzbl (%rax,%r12), %edx
callq 0x47e0
xorb %al, %r15b
incq %rbx
jmp 0x48b8
movq 0x8(%rsp), %rax
movq 0x10(%rsp), %rbx
movq (%rax,%rbx,8), %rax
movb %r15b, (%rax,%r12)
incq %rbx
decq %rbp
jmp 0x4892
incq %r12
jmp 0x4888
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/lmclaramunt[P]AES-Crypto/Cipher.cpp
// Function: Cipher::encrypt(Sequence*, unsigned char**)
void Cipher::encrypt(Sequence* input, unsigned char** key) {
    State state(input);
    addRoudKey(0, key, state.getStateArray());
    
    for (int i=1; i < Nr; i++) {
        unsigned char** s2 = new unsigned char*[4];
        subBytes(state.getStateArray());
        shiftRows(state.getStateArray());
        mixColumns(state.getStateArray(), s2);
        state.setStateArray(s2);
        addRoudKey(i, key, state.getStateArray());
    }

    subBytes(state.getStateArray());
    shiftRows(state.getStateArray());
    addRoudKey(Nr, key, state.getStateArray());
    input->updateSequence(state.toSequence());

    /* State cleanup as it can leave traces in memory */
    state.~State();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r14
movq %rdi, %r15
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
movq %rsi, 0x10(%rsp)
callq 0x369c
movq %rbx, %rdi
callq 0x3742
xorl %esi, %esi
movq %r14, %rdx
movq %rax, %rcx
callq 0x4944
pushq $0x1
popq %rbp
pushq $0x20
popq %r12
leaq 0x8(%rsp), %r13
cmpl 0x1c(%r15), %ebp
jge 0x4a33
movq %r12, %rdi
callq 0x2030
movq %rax, %rbx
movq %r13, %rdi
callq 0x3742
movq %rax, %rsi
callq 0x46c6
movq %r13, %rdi
callq 0x3742
movq %rax, %rsi
callq 0x4782
movq %r13, %rdi
callq 0x3742
movq %rax, %rsi
movq %rbx, %rdx
callq 0x4868
movq %r13, %rdi
movq %rbx, %rsi
callq 0x37c0
movq %r13, %rdi
callq 0x3742
movl %ebp, %esi
movq %r14, %rdx
movq %rax, %rcx
callq 0x4944
incl %ebp
jmp 0x49cb
leaq 0x8(%rsp), %rdi
callq 0x3742
movq %rax, %rsi
callq 0x46c6
leaq 0x8(%rsp), %rdi
callq 0x3742
movq %rax, %rsi
callq 0x4782
movl 0x1c(%r15), %ebx
leaq 0x8(%rsp), %rdi
callq 0x3742
movl %ebx, %esi
movq %r14, %rdx
movq %rax, %rcx
callq 0x4944
leaq 0x8(%rsp), %rdi
callq 0x3746
movq 0x10(%rsp), %rdi
movq %rax, %rsi
callq 0x2f3c
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x371c
movq %rbx, %rdi
callq 0x371c
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4aaf
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x371c
movq %rbx, %rdi
callq 0x23d0
// File: /workspace/github_cpp_makefile_star2_O2/lmclaramunt[P]AES-Crypto/Cipher.cpp
// Function: Cipher::invShiftRows(unsigned char**)
void Cipher::invShiftRows(unsigned char** st) {
    int row = 1;
    shiftColumnsByOne(st, &row, false);
    shiftColumnsByTwo(st, &(++row));
    shiftColumnsByOne(st, &(++row), true);   //Shift to the left by 1 is equivalent to shift to the right by 3
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
leaq 0x4(%rsp), %r14
movl $0x1, (%r14)
movq %r14, %rdx
xorl %ecx, %ecx
callq 0x46ec
movl $0x2, (%r14)
movq %rbx, %rsi
movq %r14, %rdx
callq 0x4754
movl $0x3, (%r14)
pushq $0x1
popq %rcx
movq %rbx, %rsi
movq %r14, %rdx
callq 0x46ec
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/lmclaramunt[P]AES-Crypto/Cipher.cpp
// Function: Cipher::invSubBytes(unsigned char**)
void Cipher::invSubBytes(unsigned char** st) {
    for(int i = 0; i < 4; i++) {
        for(int j=0; j < 4; j++) {
            int k = (int)st[i][j];
            st[i][j] = sboxInv[k/16][k%16];
        }
    }
}

// Assembly:
xorl %eax, %eax
leaq 0x2a77(%rip), %rcx      # 0x7590
cmpq $0x4, %rax
je 0x4b50
xorl %edx, %edx
cmpq $0x4, %rdx
je 0x4b4b
movq (%rsi,%rax,8), %rdi
movzbl (%rdi,%rdx), %r8d
movl %r8d, %r9d
andl $0xf, %r9d
andl $-0x10, %r8d
addq %rcx, %r8
movb (%r9,%r8), %r8b
movb %r8b, (%rdi,%rdx)
incq %rdx
jmp 0x4b21
incq %rax
jmp 0x4b19
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/lmclaramunt[P]AES-Crypto/Cipher.cpp
// Function: Cipher::invMixColumns(unsigned char**, unsigned char**)
void Cipher::invMixColumns(unsigned char** st, unsigned char** s2) {
    unsigned char matrixValues[4] = {0x0e, 0x0b, 0x0d, 0x09};
    for (int i=0; i < 4; i++) {
        for (unsigned int j=0; j < 4; j++) {
            if (i==0) {
                s2[j] = new unsigned char[4];
            }
            unsigned int temp = 0;
            for (unsigned int k=0; k < 4; k++) {
                temp ^= gFMultiply(matrixValues[(k-j)%4], st[k][i]);
            }
            s2[j][i] = temp;
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, 0x8(%rsp)
movq %rsi, %r14
xorl %r12d, %r12d
leaq 0x2ca6(%rip), %r13      # 0x7818
cmpq $0x4, %r12
je 0x4be8
xorl %ebp, %ebp
xorl %ebx, %ebx
cmpq $0x4, %rbx
je 0x4be3
testq %r12, %r12
jne 0x4b98
pushq $0x4
popq %rdi
callq 0x2030
movq 0x8(%rsp), %rcx
movq %rax, (%rcx,%rbx,8)
movq %rbx, 0x10(%rsp)
xorl %ebx, %ebx
xorl %r15d, %r15d
cmpq $0x4, %rbx
je 0x4bc9
leal (%rbx,%rbp), %eax
andl $0x3, %eax
movzbl (%rax,%r13), %esi
movq (%r14,%rbx,8), %rax
movzbl (%rax,%r12), %edx
callq 0x47e0
xorb %al, %r15b
incq %rbx
jmp 0x4ba2
movq 0x8(%rsp), %rax
movq 0x10(%rsp), %rbx
movq (%rax,%rbx,8), %rax
movb %r15b, (%rax,%r12)
incq %rbx
decq %rbp
jmp 0x4b7c
incq %r12
jmp 0x4b72
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/lmclaramunt[P]AES-Crypto/Cipher.cpp
// Function: Cipher::decrypt(Sequence*, unsigned char**)
void Cipher::decrypt(Sequence* input, unsigned char** key){
    State state(input);
    addRoudKey(Nr, key, state.getStateArray());

    for (int i=Nr-1; i > 0; i--) {
        unsigned char** s2 = new unsigned char*[4];
        invShiftRows(state.getStateArray());
        invSubBytes(state.getStateArray());
        addRoudKey(i, key, state.getStateArray());
        invMixColumns(state.getStateArray(), s2);
        state.setStateArray(s2);
    }

    invShiftRows(state.getStateArray());
    invSubBytes(state.getStateArray());
    addRoudKey(0, key, state.getStateArray());
    input->updateSequence(state.toSequence());

    /* State cleanup as it can leave traces in memory */
    state.~State();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r15
movq %rsp, %r12
movq %r12, %rdi
callq 0x369c
movl 0x1c(%r15), %ebp
movq %r12, %rdi
callq 0x3742
movl %ebp, %esi
movq %r14, %rdx
movq %rax, %rcx
callq 0x4944
movl 0x1c(%r15), %ebp
pushq $0x20
popq %r15
movq %rsp, %r12
cmpl $0x1, %ebp
jle 0x4ca2
movq %r15, %rdi
callq 0x2030
movq %rax, %r13
movq %r12, %rdi
callq 0x3742
movq %rax, %rsi
callq 0x4ac4
movq %r12, %rdi
callq 0x3742
movq %rax, %rsi
callq 0x4b10
movq %r12, %rdi
callq 0x3742
decl %ebp
movl %ebp, %esi
movq %r14, %rdx
movq %rax, %rcx
callq 0x4944
movq %r12, %rdi
callq 0x3742
movq %rax, %rsi
movq %r13, %rdx
callq 0x4b52
movq %r12, %rdi
movq %r13, %rsi
callq 0x37c0
jmp 0x4c3b
movq %rsp, %rdi
callq 0x3742
movq %rax, %rsi
callq 0x4ac4
movq %rsp, %rdi
callq 0x3742
movq %rax, %rsi
callq 0x4b10
movq %rsp, %rdi
callq 0x3742
xorl %esi, %esi
movq %r14, %rdx
movq %rax, %rcx
callq 0x4944
movq %rsp, %rdi
callq 0x3746
movq %rbx, %rdi
movq %rax, %rsi
callq 0x2f3c
movq %rsp, %rbx
movq %rbx, %rdi
callq 0x371c
movq %rbx, %rdi
callq 0x371c
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4d0e
movq %rax, %rbx
movq %rsp, %rdi
callq 0x371c
movq %rbx, %rdi
callq 0x23d0
nop
// File: /workspace/github_cpp_makefile_star2_O2/lmclaramunt[P]AES-Crypto/Cipher.cpp
// Function: Cipher::CBC_MAC(Block, bool, bool)
Sequence Cipher::CBC_MAC(Block block, bool encrypting, bool padding){
    Sequence tag(16);
    unsigned char* mssgLength;
    getMessageLength(&mssgLength, encrypting, padding);
    tag.setSequence(mssgLength);
    encrypt(&tag, macKeyExp);
    int i = -1;
    for(Sequence sq: block.getSequenceVector()){
        i++;
        if(!encrypting && (i < 1)) continue;    //First block of ciphertext contains MAC Tag, so ommit it
        tag = tag ^ sq;
        encrypt(&tag, macKeyExp);               //Using a different key than authorization!!
    }
    return tag;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %ecx, %ebp
movl %edx, %ebx
movq %rsi, %r12
movq %rdi, %r14
movq %rsp, %r15
pushq $0x10
popq %rsi
movq %r15, %rdi
callq 0x2ea0
leaq 0x20(%rsp), %r13
movq %r14, %rdi
movq %r13, %rsi
movl %ebx, %edx
movl %ebp, %ecx
callq 0x4df0
movq (%r13), %rsi
movq %r15, %rdi
callq 0x2ebc
movq 0x8(%r14), %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x4984
movq %r12, %rdi
callq 0x318e
movq (%rax), %r13
movq 0x8(%rax), %rbp
pushq $-0x1
popq %r12
cmpq %rbp, %r13
je 0x4dd8
movups (%r13), %xmm0
movaps %xmm0, 0x10(%rsp)
testl %r12d, %r12d
setns %al
orb %bl, %al
cmpb $0x1, %al
jne 0x4dcf
movq %r15, %rdi
leaq 0x10(%rsp), %rsi
callq 0x2fe8
movq (%rax), %rcx
movq %rcx, (%rsp)
movl 0x8(%rax), %eax
movl %eax, 0x8(%rsp)
movq 0x8(%r14), %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x4984
addq $0x10, %r13
incl %r12d
jmp 0x4d8a
movq (%rsp), %rax
movl 0x8(%rsp), %edx
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/lmclaramunt[P]AES-Crypto/Cipher.cpp
// Function: Cipher::getMessageLength(unsigned char**, bool, bool)
void Cipher::getMessageLength(unsigned char** s, bool encrypting, bool padding){
    *s = new  unsigned char[16];
    ifstream text(*textPath, ios::binary);
    text.seekg(0, ios::end);
    int length = text.tellg();                     //Get the file's length
    if(encrypting){                                //Length will be the ciphertext length
        length += 32;                              //Add IV and MAC's Tag length
        if(padding) 
            length += (length%16 == 0) ? 16 : (length%16);
    }
    unsigned char bytes[sizeof length];
    std::copy(static_cast<const unsigned char*>(static_cast<const void*>(&length)),
          static_cast<const unsigned char*>(static_cast<const void*>(&length)) + sizeof length,
          bytes);
    for(int i = 0; i < sizeof length; i++)      //First 4 bytes will have length values
        (*s)[i] = bytes[i];
    for(int i = sizeof length; i < 16; i++)     //The remained will be initialzed to zero
        (*s)[i] = 0x00;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x218, %rsp            # imm = 0x218
movl %ecx, %ebp
movl %edx, %r14d
movq %rsi, %rbx
movq %rdi, %r15
pushq $0x10
popq %rdi
callq 0x2030
movq %rax, (%rbx)
movq 0x28(%r15), %rsi
leaq 0x10(%rsp), %r15
pushq $0x4
popq %rdx
movq %r15, %rdi
callq 0x2350
pushq $0x2
popq %rdx
movq %r15, %rdi
xorl %esi, %esi
callq 0x22a0
leaq 0x10(%rsp), %rdi
callq 0x23c0
movq %rax, %rcx
testb %r14b, %r14b
je 0x4e5f
addl $0x20, %ecx
testb %bpl, %bpl
je 0x4e5f
pushq $0x10
popq %rsi
movl %ecx, %eax
cltd
idivl %esi
testl %edx, %edx
cmovel %esi, %edx
addl %ecx, %edx
movl %edx, %ecx
movl %ecx, 0xc(%rsp)
xorl %eax, %eax
cmpq $0x4, %rax
je 0x4e7a
movb 0xc(%rsp,%rax), %cl
movq (%rbx), %rdx
movb %cl, (%rdx,%rax)
incq %rax
jmp 0x4e65
pushq $0x4
popq %rax
cmpq $0x10, %rax
je 0x4e8f
movq (%rbx), %rcx
movb $0x0, (%rcx,%rax)
incq %rax
jmp 0x4e7d
leaq 0x10(%rsp), %rdi
callq 0x2060
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4ea9
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x2060
movq %rbx, %rdi
callq 0x23d0
// File: /workspace/github_cpp_makefile_star2_O2/lmclaramunt[P]AES-Crypto/Cipher.cpp
// Function: Cipher::authenticateSequences(Sequence*, Sequence*)
bool Cipher::authenticateSequences(Sequence* first, Sequence* second){
    bool same = true;
    for(int i=0; i < 16; i++){
        if(first->getSequence()[i] != second->getSequence()[i]){
            same = false;
            break;
        }
    }
    return same;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
xorl %eax, %eax
movq %rax, %r15
cmpq $0x10, %rax
je 0x4efa
movq %r14, %rdi
callq 0x2eb4
movq (%rax), %rax
movb (%rax,%r15), %bpl
movq %rbx, %rdi
callq 0x2eb4
movq (%rax), %rcx
leaq 0x1(%r15), %rax
cmpb (%rcx,%r15), %bpl
je 0x4ecd
cmpq $0x10, %r15
setae %al
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/lmclaramunt[P]AES-Crypto/Cipher.cpp
// Function: Cipher::removePadding(Sequence*)
void Cipher::removePadding(Sequence* lastPlainText) { 
    int paddingValue = lastPlainText->getSequence()[15];    //Last byte tells how many bytes to remove      
    bool error = false;
    for(int i = 15; i > 16-paddingValue; i--){
        if(lastPlainText->getSequence()[i] != paddingValue){
            error = true;
            break;
        }
    }
    if(!error){
        lastPlainText->setSize(16-paddingValue);
    }else
        throw "Padding error!\n";   //Error if the last block doesn't containt `10` in its last bytes
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rsi, %rdi
callq 0x2eb4
movq (%rax), %rax
movzbl 0xf(%rax), %r15d
pushq $0x10
popq %r14
subq %r15, %r14
pushq $0xf
popq %r12
cmpq %r14, %r12
jle 0x4f73
movq %rbx, %rdi
callq 0x2eb4
movq (%rax), %rax
leaq -0x1(%r12), %rcx
cmpb %r15b, (%rax,%r12)
movq %rcx, %r12
je 0x4f32
pushq $0x8
popq %rdi
callq 0x2100
leaq 0x2844(%rip), %rcx      # 0x77a3
movq %rcx, (%rax)
movq 0x605f(%rip), %rsi      # 0xafc8
movq %rax, %rdi
xorl %edx, %edx
callq 0x23a0
movq %rbx, %rdi
movl %r14d, %esi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x2ec0
nop
// File: /workspace/github_cpp_makefile_star2_O2/lmclaramunt[P]AES-Crypto/Cipher.cpp
// Function: Cipher::writePlainText()
void Cipher::writePlainText(){
    ofstream plaintext;
    plaintext.open(*textPath, ios::binary);
    int i = -1;
    for(Sequence sq: inputBlock->getSequenceVector()){
        i++;
        if(i <= 1) continue;           //Don't write neither IV nor MAC Tag in Plaintext
        plaintext.write((const char*)sq.getSequence(), sq.getSize());
    }
    plaintext.close();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x218, %rsp            # imm = 0x218
movq %rdi, %rbx
leaq 0x18(%rsp), %r14
movq %r14, %rdi
callq 0x2390
movq 0x28(%rbx), %rsi
pushq $0x4
popq %rdx
movq %r14, %rdi
callq 0x20e0
movq 0x10(%rbx), %rdi
callq 0x318e
movq (%rax), %r12
movq 0x8(%rax), %r13
pushq $-0x1
popq %rbp
movq %rsp, %rbx
leaq 0x18(%rsp), %r14
cmpq %r13, %r12
je 0x5010
movups (%r12), %xmm0
movaps %xmm0, (%rsp)
testl %ebp, %ebp
jle 0x5008
movq %rbx, %rdi
callq 0x2eb4
movq (%rax), %r15
movq %rbx, %rdi
callq 0x2eb8
movslq %eax, %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2290
addq $0x10, %r12
incl %ebp
jmp 0x4fd5
leaq 0x18(%rsp), %rdi
callq 0x22d0
leaq 0x18(%rsp), %rdi
callq 0x22f0
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x503c
jmp 0x503c
jmp 0x503c
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x22f0
movq %rbx, %rdi
callq 0x23d0
nop
// File: /workspace/github_cpp_makefile_star2_O2/lmclaramunt[P]AES-Crypto/Cipher.cpp
// Function: Cipher::writeCipherText(Sequence*)
void Cipher::writeCipherText(Sequence* tag){
    ofstream ciphertext;
    ciphertext.open(*textPath, ios::binary);
    ciphertext.write((const char*)tag->getSequence(), tag->getSize());
    for(Sequence sq: inputBlock->getSequenceVector()){
    ciphertext.write((const char*)sq.getSequence(), sq.getSize());
    }
    ciphertext.close();
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x210, %rsp            # imm = 0x210
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x10(%rsp), %r15
movq %r15, %rdi
callq 0x2390
movq 0x28(%rbx), %rsi
pushq $0x4
popq %rdx
movq %r15, %rdi
callq 0x20e0
movq %r14, %rdi
callq 0x2eb4
movq (%rax), %r15
movq %r14, %rdi
callq 0x2eb8
movslq %eax, %rdx
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
callq 0x2290
movq 0x10(%rbx), %rdi
callq 0x318e
movq (%rax), %r12
movq 0x8(%rax), %r13
movq %rsp, %rbx
leaq 0x10(%rsp), %r14
cmpq %r13, %r12
je 0x50f4
movups (%r12), %xmm0
movaps %xmm0, (%rsp)
movq %rbx, %rdi
callq 0x2eb4
movq (%rax), %r15
movq %rbx, %rdi
callq 0x2eb8
movslq %eax, %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2290
addq $0x10, %r12
jmp 0x50bf
leaq 0x10(%rsp), %rdi
callq 0x22d0
leaq 0x10(%rsp), %rdi
callq 0x22f0
addq $0x210, %rsp            # imm = 0x210
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
jmp 0x511d
jmp 0x511d
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x22f0
movq %rbx, %rdi
callq 0x23d0
// File: /workspace/github_cpp_makefile_star2_O2/lmclaramunt[P]AES-Crypto/Cipher.cpp
// Function: Cipher::CBC_encrypt()
void Cipher::CBC_encrypt(){
    Sequence ivSq(16), ivOriginal(16);      //ivOriginal keeps track of IV, to write it in ciphertext
    generateKey(ivSq.getSequence(), 4);
    ivOriginal.updateSequence(ivSq);
    
    //Encrypt
    for(Sequence sq: inputBlock->getSequenceVector()){  
        ivSq = sq ^ ivSq;
        encrypt(&ivSq, aesKeyExp);
    }

    //Authenticate
    inputBlock->getSequenceVector().
        insert(inputBlock->getSequenceVector().begin(), ivOriginal);    //Append IV to Ciphertext
    Sequence tag = CBC_MAC(*inputBlock, true, true);    // both bool true since we are encrypting with padding
    
    //Write ciphertext after encryption and authentication
    writeCipherText(&tag);
    /* Sequence cleanup as it can leave traces in memory */
    ivSq.~Sequence();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
leaq 0x10(%rsp), %r14
pushq $0x10
popq %rbp
movq %r14, %rdi
movl %ebp, %esi
callq 0x2ea0
leaq 0x38(%rsp), %r15
movq %r15, %rdi
movl %ebp, %esi
callq 0x2ea0
movq %r14, %rdi
callq 0x2eb4
movq (%rax), %rsi
pushq $0x4
popq %rdx
callq 0x438e
movq (%r14), %rsi
movl 0x8(%r14), %edx
movq %r15, %rdi
callq 0x2f3c
movq 0x10(%rbx), %rdi
callq 0x318e
movq (%rax), %r12
movq 0x8(%rax), %r13
movq %rsp, %r15
cmpq %r13, %r12
je 0x51d5
movups (%r12), %xmm0
movaps %xmm0, (%rsp)
movq %r15, %rdi
movq %r14, %rsi
callq 0x2fe8
movq (%rax), %rcx
movq %rcx, 0x10(%rsp)
movl 0x8(%rax), %eax
movl %eax, 0x18(%rsp)
movq (%rbx), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4984
addq $0x10, %r12
jmp 0x5199
movq 0x10(%rbx), %rdi
callq 0x318e
movq %rax, %r14
movq 0x10(%rbx), %rdi
callq 0x318e
movq (%rax), %rsi
leaq 0x38(%rsp), %rdx
movq %r14, %rdi
callq 0x5856
movq 0x10(%rbx), %rsi
leaq 0x20(%rsp), %r14
movq %r14, %rdi
callq 0x597a
pushq $0x1
popq %rcx
movq %rbx, %rdi
movq %r14, %rsi
movl %ecx, %edx
callq 0x4d22
movq %rsp, %r14
movq %rax, (%r14)
movl %edx, 0x8(%r14)
leaq 0x20(%rsp), %rdi
callq 0x316c
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5052
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x316c
movq %rbx, %rdi
callq 0x23d0