// File: /workspace/github_cpp_makefile_star2_O2/SimpleButNotNaive[P]AES/encryptor.cpp
// Function: aes_encryptor::encryption(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>>)
vector<vector<uint8>> aes_encryptor::encryption(string p_text, string key, string init_vector) {
    string total_plain_text = padding(p_text);
    vector<vector<uint8>> text_vector = split(total_plain_text);

    vector<vector<uint8>> cipher;

    uint8 key_array[16];
    for(int i = 0;i < key.size();i++){
        key_array[i] = key[i];
    }

    generate_roundkey(key_array);

    uint8 y[16];
    for(int i = 0;i < 16;i++){
        y[i] = init_vector[i];
    }

    uint8 x[16];
    for(auto group : text_vector){
        for(int i = 0;i < group.size();i++){
            x[i] = group[i];
        }
        xor_group(x, y);
        encrypt_one_group(x);

        for(int i = 0; i < 16;i++){
            y[i] = x[i];
        }
        
        vector<uint8> one_group;
        for(int i = 0;i < 16;i++){
            one_group.push_back(y[i]);
        }
        cipher.push_back(one_group);
    }
    return cipher;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %r8, %rbx
movq %rcx, %r14
movq %rsi, %r12
movq %rdi, -0x30(%rbp)
leaq -0x120(%rbp), %r15
movq %r15, %rdi
movq %rdx, %rsi
callq 0x10f0
leaq -0x90(%rbp), %rdi
movq %r15, %rdx
callq 0x1f6a
leaq -0x120(%rbp), %rdi
callq 0x1188
leaq -0x100(%rbp), %rdi
leaq -0x90(%rbp), %r15
movq %r15, %rsi
callq 0x10f0
leaq -0x70(%rbp), %rdi
leaq -0x100(%rbp), %rdx
callq 0x1fbe
leaq -0x100(%rbp), %rdi
callq 0x1188
movq -0x30(%rbp), %rax
andq $0x0, 0x10(%rax)
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq 0x8(%r14), %rax
xorl %ecx, %ecx
cmpq %rcx, %rax
je 0x1dbc
movq (%r14), %rdx
movb (%rdx,%rcx), %dl
movb %dl, -0xe0(%rbp,%rcx)
incq %rcx
jmp 0x1da5
leaq -0xe0(%rbp), %rsi
movq %r12, %rdi
callq 0x1582
movq (%rbx), %rax
xorl %ecx, %ecx
cmpq $0x10, %rcx
je 0x1de2
movb (%rax,%rcx), %dl
movb %dl, -0x50(%rbp,%rcx)
incq %rcx
jmp 0x1dd0
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rax
movq %rax, -0x58(%rbp)
leaq -0xc8(%rbp), %rbx
leaq -0x40(%rbp), %r13
leaq -0xb0(%rbp), %r14
cmpq -0x58(%rbp), %rsi
je 0x1ecb
movq %rbx, %rdi
movq %rsi, %r15
callq 0x1b3c
movq -0xc8(%rbp), %rax
movq -0xc0(%rbp), %rcx
subq %rax, %rcx
xorl %edx, %edx
cmpq %rdx, %rcx
je 0x1e3b
movb (%rax,%rdx), %sil
movb %sil, -0x40(%rbp,%rdx)
incq %rdx
jmp 0x1e28
movq %r12, %rdi
movq %r13, %rsi
leaq -0x50(%rbp), %rdx
callq 0x160e
movq %r12, %rdi
movq %r13, %rsi
callq 0x209a
xorl %eax, %eax
cmpq $0x10, %rax
je 0x1e6a
movb -0x40(%rbp,%rax), %cl
movb %cl, -0x50(%rbp,%rax)
incq %rax
jmp 0x1e57
movq %rbx, %r13
xorps %xmm0, %xmm0
movaps %xmm0, -0xb0(%rbp)
andq $0x0, -0xa0(%rbp)
xorl %ebx, %ebx
cmpq $0x10, %rbx
je 0x1e9c
leaq (%rbx,%rbp), %rsi
addq $-0x50, %rsi
movq %r14, %rdi
callq 0x2138
incq %rbx
jmp 0x1e81
movq -0x30(%rbp), %rdi
movq %r14, %rsi
callq 0x215a
movq %r14, %rdi
callq 0x1b9e
movq %r13, %rbx
movq %r13, %rdi
callq 0x1b9e
movq %r15, %rsi
addq $0x18, %rsi
leaq -0x40(%rbp), %r13
jmp 0x1e00
leaq -0x70(%rbp), %rdi
callq 0x2196
leaq -0x90(%rbp), %rdi
callq 0x1188
movq -0x30(%rbp), %rax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x1f48
movq %rax, %rbx
leaq -0x100(%rbp), %rdi
callq 0x1188
jmp 0x1f5a
jmp 0x1f0e
movq %rax, %rbx
jmp 0x1f5a
jmp 0x1f26
movq %rax, %rbx
leaq -0x90(%rbp), %r15
jmp 0x1f48
movq %rax, %rbx
jmp 0x1f35
movq %rax, %rbx
leaq -0xb0(%rbp), %rdi
callq 0x1b9e
leaq -0x90(%rbp), %r15
leaq -0xc8(%rbp), %rdi
callq 0x1b9e
movq -0x30(%rbp), %rdi
callq 0x2196
leaq -0x70(%rbp), %rdi
callq 0x2196
movq %r15, %rdi
callq 0x1188
movq %rbx, %rdi
callq 0x1150