// File: /workspace/github_cpp_makefile_star2_O3/renzibei[P]TSProxy/aes.cpp
// Function: aes(char*, char const*)
void aes(char *p, const char *key){

	int pArray[4][4];
	int i;

	extendKey(key);//扩展密钥

    // 开始加密
    strToArray(p, pArray);
    addKey(pArray, 0);//一开始的轮密钥加

    // 中间九轮
    for(i = 1; i < 10; i++){
        subBytes(pArray);//字节代换
        shiftRows(pArray);//行移位
        mixColumns(pArray);//列混合
        addKey(pArray, i);
    }

    // 最后一轮
    subBytes(pArray);//字节代换
    shiftRows(pArray);//行移位
    addKey(pArray, 10);

    arrayToStr(pArray, p);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rdi, 0x18(%rsp)
xorl %ecx, %ecx
leaq 0xb6c21(%rip), %rax     # 0xbcce0
movl (%rsi,%rcx), %edx
bswapl %edx
movl %edx, (%rcx,%rax)
addq $0x4, %rcx
cmpq $0x10, %rcx
jne 0x60bf
xorl %ecx, %ecx
movl $0x4, %edx
movl $0xff, %esi
leaq 0x1e7c(%rip), %rbx      # 0x7f60
leaq 0x2275(%rip), %rdi      # 0x8360
movl -0x10(%rax,%rdx,4), %r8d
movl -0x4(%rax,%rdx,4), %r9d
testb $0x3, %dl
je 0x6106
xorl %r8d, %r9d
movl %r9d, (%rax,%rdx,4)
jmp 0x619a
movl %r9d, %r10d
shrl $0x18, %r10d
movl %r10d, 0x2c(%rsp)
movl %r9d, %r10d
shrl $0x10, %r10d
andl %esi, %r10d
movl %r10d, 0x20(%rsp)
movl %r9d, %r10d
shrl $0x8, %r10d
andl %esi, %r10d
movl %r10d, 0x24(%rsp)
andl %esi, %r9d
movl %r9d, 0x28(%rsp)
xorl %r9d, %r9d
movl 0x20(%rsp,%r9,4), %r10d
movl %r10d, %r11d
andl $0xf, %r11d
andl $0xf0, %r10d
leaq (%rbx,%r10,4), %r10
movl (%r10,%r11,4), %r10d
movl %r10d, 0x20(%rsp,%r9,4)
incq %r9
cmpq $0x4, %r9
jne 0x613b
movl 0x20(%rsp), %r9d
movl 0x24(%rsp), %r10d
shll $0x18, %r9d
shll $0x10, %r10d
orl %r9d, %r10d
movl 0x28(%rsp), %r9d
shll $0x8, %r9d
orl %r10d, %r9d
orl 0x2c(%rsp), %r9d
movslq %ecx, %rcx
xorl (%rdi,%rcx,4), %r9d
xorl %r8d, %r9d
movl %r9d, (%rax,%rdx,4)
incl %ecx
incq %rdx
cmpq $0x2c, %rdx
jne 0x60eb
leaq 0x70(%rsp), %rax
xorl %ecx, %ecx
movq 0x18(%rsp), %rdx
movq %rax, %rsi
xorl %edi, %edi
movzbl (%rdx,%rdi), %r8d
movl %r8d, (%rsi)
incq %rdi
addq $0x10, %rsi
cmpq $0x4, %rdi
jne 0x61b8
incq %rcx
addq $0x4, %rax
addq $0x4, %rdx
cmpq $0x4, %rcx
jne 0x61b3
leaq 0x70(%rsp), %r12
movq %r12, %rdi
xorl %esi, %esi
callq 0x6433
movl $0x1, %ebp
leaq 0x80(%rsp), %r8
movq %r12, %rax
xorl %ecx, %ecx
xorl %edx, %edx
movl (%rax,%rdx,4), %esi
movl %esi, %edi
andl $0xf, %edi
andl $0xf0, %esi
leaq (%rbx,%rsi,4), %rsi
movl (%rsi,%rdi,4), %esi
movl %esi, (%rax,%rdx,4)
incq %rdx
cmpq $0x4, %rdx
jne 0x6201
incq %rcx
addq $0x10, %rax
cmpq $0x4, %rcx
jne 0x61ff
movl $0x1, %eax
movq %r8, %rcx
xorl %edx, %edx
movq %rdx, %rsi
shlq $0x4, %rsi
movaps (%r8,%rsi), %xmm0
movaps %xmm0, 0x20(%rsp)
xorl %esi, %esi
leal (%rax,%rsi), %edi
andl $0x3, %edi
movl 0x20(%rsp,%rdi,4), %edi
movl %edi, (%rcx,%rsi,4)
incq %rsi
cmpq $0x4, %rsi
jne 0x624c
incq %rax
incq %rdx
addq $0x10, %rcx
cmpq $0x3, %rdx
jne 0x6239
movl %ebp, 0xc(%rsp)
movaps 0x70(%rsp), %xmm0
movaps 0x80(%rsp), %xmm1
movaps 0x90(%rsp), %xmm2
movaps 0xa0(%rsp), %xmm3
movaps %xmm3, 0x50(%rsp)
movaps %xmm2, 0x40(%rsp)
movaps %xmm1, 0x30(%rsp)
movaps %xmm0, 0x20(%rsp)
xorl %eax, %eax
movq %rax, 0x68(%rsp)
shlq $0x4, %rax
leaq 0x20d7(%rip), %rcx      # 0x8390
movl (%rax,%rcx), %esi
movl %esi, 0x14(%rsp)
movl 0x4(%rax,%rcx), %esi
movl %esi, 0x10(%rsp)
movl 0x8(%rax,%rcx), %r13d
movl 0xc(%rax,%rcx), %r14d
xorl %r15d, %r15d
movl 0x20(%rsp,%r15,4), %esi
movl 0x14(%rsp), %edi
callq 0x6d3d
movl %eax, %ebp
movl 0x30(%rsp,%r15,4), %esi
movl 0x10(%rsp), %edi
callq 0x6d3d
movl %eax, %ebx
xorl %ebp, %ebx
movl 0x40(%rsp,%r15,4), %esi
movl %r13d, %edi
callq 0x6d3d
movl %eax, %ebp
movl 0x50(%rsp,%r15,4), %esi
movl %r14d, %edi
callq 0x6d3d
xorl %ebp, %eax
xorl %ebx, %eax
movl %eax, (%r12,%r15,4)
incq %r15
cmpq $0x4, %r15
jne 0x62d5
movq 0x68(%rsp), %rax
incq %rax
addq $0x10, %r12
cmpq $0x4, %rax
jne 0x62a9
leaq 0x70(%rsp), %r12
movq %r12, %rdi
movl 0xc(%rsp), %ebp
movl %ebp, %esi
callq 0x6433
incl %ebp
cmpl $0xa, %ebp
leaq 0x1c07(%rip), %rbx      # 0x7f60
leaq 0x80(%rsp), %r8
jne 0x61fa
leaq 0x70(%rsp), %rax
xorl %ecx, %ecx
xorl %edx, %edx
movl (%rax,%rdx,4), %esi
movl %esi, %edi
andl $0xf, %edi
andl $0xf0, %esi
leaq (%rbx,%rsi,4), %rsi
movl (%rsi,%rdi,4), %esi
movl %esi, (%rax,%rdx,4)
incq %rdx
cmpq $0x4, %rdx
jne 0x6370
incq %rcx
addq $0x10, %rax
cmpq $0x4, %rcx
jne 0x636e
movl $0x1, %eax
leaq 0x80(%rsp), %rcx
xorl %edx, %edx
movq %rdx, %rsi
shlq $0x4, %rsi
movaps (%r8,%rsi), %xmm0
movaps %xmm0, 0x20(%rsp)
xorl %esi, %esi
leal (%rax,%rsi), %edi
andl $0x3, %edi
movl 0x20(%rsp,%rdi,4), %edi
movl %edi, (%rcx,%rsi,4)
incq %rsi
cmpq $0x4, %rsi
jne 0x63c0
incq %rax
incq %rdx
addq $0x10, %rcx
cmpq $0x3, %rdx
jne 0x63ad
leaq 0x70(%rsp), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x6433
xorl %eax, %eax
movq 0x18(%rsp), %rsi
xorl %ecx, %ecx
movb (%r14,%rcx), %dl
movb %dl, (%rsi)
incq %rsi
addq $0x10, %rcx
cmpq $0x40, %rcx
jne 0x6401
incq %rax
addq $0x4, %r14
cmpq $0x4, %rax
jne 0x63ff
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq