// File: /workspace/github_cpp_makefile_star2_O2/skyleaworlder[P]AES/src/main.cpp
// Function: aes(std::bitset<128ul>, std::bitset<128ul>, unsigned long)
vector<byte> aes(
    std::bitset<128> input,
    std::bitset<128> key,
    size_t round
) {
    vector<vector<byte>> key_expan { Key_Expansion(byte_to_vector(key), round) };
    vector<byte> vec { byte_to_vector(input) };
    assert(key_expan.size() == round+1);

    vec = AddRoundKey(vec, key_expan[0]);

    size_t index;
    for (index = 1; index < round; ++index) {
        vec = SubBytes(vec);
        vec = ShiftRows(vec);
        vec = MixColumns(vec);
        vec = AddRoundKey(vec, key_expan[index]);
    }

    vec = SubBytes(vec);
    vec = ShiftRows(vec);
    vec = AddRoundKey(vec, key_expan[index]);
    return vec;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x168, %rsp            # imm = 0x168
movq %r9, %r13
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
leaq -0x118(%rbp), %r12
movq %r12, %rdi
movq %rcx, %rsi
movq %r8, %rdx
callq 0x2f8c
leaq -0x70(%rbp), %rdi
movq %r12, %rsi
movq %r13, -0x40(%rbp)
movq %r13, %rdx
callq 0x26c4
leaq -0x118(%rbp), %rdi
callq 0x24ee
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x2f8c
movq -0x68(%rbp), %rax
subq -0x70(%rbp), %rax
pushq $0x18
popq %rcx
cqto
movq %rcx, -0x38(%rbp)
idivq %rcx
movq -0x40(%rbp), %rcx
incq %rcx
cmpq %rcx, %rax
jne 0x39a6
leaq -0x100(%rbp), %rdi
movq %rbx, %rsi
callq 0x296a
movq -0x70(%rbp), %rsi
leaq -0xe8(%rbp), %rdi
movq %rbx, -0x30(%rbp)
callq 0x296a
leaq -0x58(%rbp), %rdi
leaq -0x100(%rbp), %rsi
leaq -0xe8(%rbp), %rdx
callq 0x241c
leaq -0x58(%rbp), %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0x3d22
movq %r12, %rdi
callq 0x24ee
leaq -0xe8(%rbp), %rdi
callq 0x24ee
leaq -0x100(%rbp), %rdi
callq 0x24ee
pushq $0x1
popq %r15
leaq -0x190(%rbp), %r13
cmpq -0x40(%rbp), %r15
jae 0x389b
movq %r13, %rdi
movq -0x30(%rbp), %rbx
movq %rbx, %rsi
callq 0x296a
movq %r12, %rdi
movq %r13, %rsi
callq 0x35e8
movq %rbx, %rdi
movq %r12, %rsi
callq 0x3d22
movq %r12, %rdi
callq 0x24ee
movq %r13, %r14
movq %r13, %rdi
callq 0x24ee
leaq -0x178(%rbp), %r13
movq %r13, %rdi
movq %rbx, %rsi
callq 0x296a
movq %r12, %rdi
movq %r13, %rsi
callq 0x3538
movq %rbx, %rdi
movq %r12, %rsi
callq 0x3d22
movq %r12, %rdi
callq 0x24ee
movq %r13, %rdi
callq 0x24ee
leaq -0x160(%rbp), %r13
movq %r13, %rdi
movq %rbx, %rsi
callq 0x296a
movq %r12, %rdi
movq %r13, %rsi
callq 0x3362
movq %rbx, %rdi
movq %r12, %rsi
callq 0x3d22
movq %r12, %rdi
callq 0x24ee
movq %r13, %rdi
callq 0x24ee
leaq -0x148(%rbp), %r13
movq %r13, %rdi
movq %rbx, %rsi
callq 0x296a
movq -0x70(%rbp), %rsi
addq -0x38(%rbp), %rsi
leaq -0x130(%rbp), %rbx
movq %rbx, %rdi
callq 0x296a
movq %r12, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x241c
movq -0x30(%rbp), %rdi
movq %r12, %rsi
callq 0x3d22
movq %r12, %rdi
callq 0x24ee
movq %rbx, %rdi
callq 0x24ee
movq %r13, %rdi
callq 0x24ee
incq %r15
addq $0x18, -0x38(%rbp)
movq %r14, %r13
jmp 0x377e
leaq -0xd0(%rbp), %rdi
movq -0x30(%rbp), %rbx
movq %rbx, %rsi
callq 0x296a
leaq -0x58(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x35e8
leaq -0x58(%rbp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3d22
movq %r15, %rdi
callq 0x24ee
leaq -0xd0(%rbp), %rdi
callq 0x24ee
leaq -0xb8(%rbp), %rdi
movq %rbx, %rsi
callq 0x296a
leaq -0x58(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x3538
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3d22
movq %r15, %rdi
callq 0x24ee
leaq -0xb8(%rbp), %rdi
callq 0x24ee
leaq -0xa0(%rbp), %rdi
movq %rbx, %rsi
callq 0x296a
movq -0x38(%rbp), %rsi
addq -0x70(%rbp), %rsi
leaq -0x88(%rbp), %rdi
callq 0x296a
leaq -0x58(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
leaq -0x88(%rbp), %rdx
callq 0x241c
leaq -0x58(%rbp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3d22
movq %r14, %rdi
callq 0x24ee
leaq -0x88(%rbp), %rdi
callq 0x24ee
leaq -0xa0(%rbp), %rdi
callq 0x24ee
leaq -0x70(%rbp), %rdi
callq 0x29f4
movq %rbx, %rax
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x115b(%rip), %rdi      # 0x4b08
leaq 0x1170(%rip), %rsi      # 0x4b24
leaq 0x1176(%rip), %rcx      # 0x4b31
pushq $0x11
popq %rdx
callq 0x20d0
movq %rax, %r14
leaq -0x88(%rbp), %rdi
callq 0x24ee
jmp 0x39d7
movq %rax, %r14
leaq -0xa0(%rbp), %rdi
jmp 0x3a70
jmp 0x3a94
movq %rax, %r14
leaq -0xb8(%rbp), %rdi
jmp 0x3a8d
jmp 0x3a9d
movq %rax, %r14
leaq -0xd0(%rbp), %rdi
jmp 0x3a8d
jmp 0x3a9d
movq %rax, %r14
leaq -0xe8(%rbp), %rdi
callq 0x24ee
jmp 0x3a24
movq %rax, %r14
leaq -0x100(%rbp), %rdi
jmp 0x3a70
jmp 0x3a9d
movq %rax, %r14
jmp 0x3aa8
movq %rax, %r14
leaq -0x118(%rbp), %rdi
callq 0x24ee
jmp 0x3ab1
jmp 0x3a9d
jmp 0x3a9d
movq %rax, %r14
leaq -0x178(%rbp), %rdi
jmp 0x3a8d
movq %rax, %r14
leaq -0x130(%rbp), %rdi
callq 0x24ee
jmp 0x3a69
movq %rax, %r14
leaq -0x148(%rbp), %rdi
callq 0x24ee
jmp 0x3a97
movq %rax, %r14
leaq -0x190(%rbp), %rdi
jmp 0x3a8d
movq %rax, %r14
leaq -0x160(%rbp), %rdi
callq 0x24ee
jmp 0x3aa0
movq %rax, %r14
movq -0x30(%rbp), %rbx
jmp 0x3aa0
movq %rax, %r14
movq %rbx, %rdi
callq 0x24ee
leaq -0x70(%rbp), %rdi
callq 0x29f4
movq %r14, %rdi
callq 0x21e0