user: Converte this assembly snippet into its equivalent C code:

```asm
<E512>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xb08,%rsp
  mov    %rsi,(%rsp)
  mov    %rcx,%rsi
  mov    %fs:0x28,%rax
  mov    %rax,0xaf8(%rsp)
  xor    %eax,%eax
L38:
  mov    (%rdi,%rax,1),%ecx
  mov    %ecx,0x30(%rsp,%rax,1)
  add    $0x4,%rax
  cmp    $0x40,%rax
  jne    L38
  mov    $0x0,%eax
L39:
  mov    (%rdx,%rax,1),%ecx
  mov    %ecx,0x70(%rsp,%rax,1)
  add    $0x4,%rax
  cmp    $0x80,%rax
  jne    L39
  lea    0x70(%rsp),%r13
  mov    %r8,%rdx
  mov    %r13,%rdi
  call   <MessageExpansion512@plt>
  lea    0x770(%rsp),%rax
  mov    %rax,0x8(%rsp)
  lea    0x20(%rsp),%r14
  lea    0x10(%rsp),%r15
  lea    0x40(%rsp),%r12
  jmp    L83
L96:
  sub    $0xffffffffffffff80,%r13
  cmp    %r13,0x8(%rsp)
  je     L68
L83:
  mov    0x40(%rsp),%eax
  mov    %eax,0x10(%rsp)
  mov    0x44(%rsp),%eax
  mov    %eax,0x14(%rsp)
  mov    0x48(%rsp),%eax
  mov    %eax,0x18(%rsp)
  mov    0x4c(%rsp),%eax
  mov    %eax,0x1c(%rsp)
  mov    %r13,%rdx
  mov    %r14,%rsi
  mov    %r15,%rdi
  call   <roundAESkeyfirst@plt>
  mov    0x20(%rsp),%eax
  mov    %eax,0x10(%rsp)
  mov    0x24(%rsp),%eax
  mov    %eax,0x14(%rsp)
  mov    0x28(%rsp),%eax
  mov    %eax,0x18(%rsp)
  mov    0x2c(%rsp),%eax
  mov    %eax,0x1c(%rsp)
  lea    0x10(%r13),%rdx
  mov    %r14,%rsi
  mov    %r15,%rdi
  call   <roundAESkeyfirst@plt>
  mov    0x20(%rsp),%eax
  mov    %eax,0x10(%rsp)
  mov    0x24(%rsp),%eax
  mov    %eax,0x14(%rsp)
  mov    0x28(%rsp),%eax
  mov    %eax,0x18(%rsp)
  mov    0x2c(%rsp),%eax
  mov    %eax,0x1c(%rsp)
  lea    0x20(%r13),%rdx
  mov    %r14,%rsi
  mov    %r15,%rdi
  call   <roundAESkeyfirst@plt>
  mov    0x20(%rsp),%eax
  mov    %eax,0x10(%rsp)
  mov    0x24(%rsp),%eax
  mov    %eax,0x14(%rsp)
  mov    0x28(%rsp),%eax
  mov    %eax,0x18(%rsp)
  mov    0x2c(%rsp),%eax
  mov    %eax,0x1c(%rsp)
  lea    0x30(%r13),%rdx
  mov    %r14,%rsi
  mov    %r15,%rdi
  call   <roundAESkeyfirst@plt>
  lea    0x30(%rsp),%rbx
  mov    %r14,%rbp
  mov    %r14,%rdx
  mov    %rbx,%rax
L13:
  mov    (%rdx),%ecx
  xor    %ecx,(%rax)
  add    $0x4,%rax
  add    $0x4,%rdx
  cmp    %r12,%rax
  jne    L13
  mov    0x60(%rsp),%eax
  mov    %eax,0x10(%rsp)
  mov    0x64(%rsp),%eax
  mov    %eax,0x14(%rsp)
  mov    0x68(%rsp),%eax
  mov    %eax,0x18(%rsp)
  mov    0x6c(%rsp),%eax
  mov    %eax,0x1c(%rsp)
  lea    0x40(%r13),%rdx
  mov    %r14,%rsi
  mov    %r15,%rdi
  call   <roundAESkeyfirst@plt>
  mov    0x20(%rsp),%eax
  mov    %eax,0x10(%rsp)
  mov    0x24(%rsp),%eax
  mov    %eax,0x14(%rsp)
  mov    0x28(%rsp),%eax
  mov    %eax,0x18(%rsp)
  mov    0x2c(%rsp),%eax
  mov    %eax,0x1c(%rsp)
  lea    0x50(%r13),%rdx
  mov    %r14,%rsi
  mov    %r15,%rdi
  call   <roundAESkeyfirst@plt>
  mov    0x20(%rsp),%eax
  mov    %eax,0x10(%rsp)
  mov    0x24(%rsp),%eax
  mov    %eax,0x14(%rsp)
  mov    0x28(%rsp),%eax
  mov    %eax,0x18(%rsp)
  mov    0x2c(%rsp),%eax
  mov    %eax,0x1c(%rsp)
  lea    0x60(%r13),%rdx
  mov    %r14,%rsi
  mov    %r15,%rdi
  call   <roundAESkeyfirst@plt>
  mov    0x20(%rsp),%eax
  mov    %eax,0x10(%rsp)
  mov    0x24(%rsp),%eax
  mov    %eax,0x14(%rsp)
  mov    0x28(%rsp),%eax
  mov    %eax,0x18(%rsp)
  mov    0x2c(%rsp),%eax
  mov    %eax,0x1c(%rsp)
  lea    0x70(%r13),%rdx
  mov    %r14,%rsi
  mov    %r15,%rdi
  call   <roundAESkeyfirst@plt>
  mov    %rbx,%rax
L98:
  mov    0x0(%rbp),%edx
  xor    %edx,0x20(%rax)
  add    $0x4,%rax
  add    $0x4,%rbp
  cmp    %r12,%rax
  jne    L98
L23:
  mov    (%rbx),%eax
  mov    0x10(%rbx),%edx
  mov    %edx,(%rbx)
  mov    0x20(%rbx),%edx
  mov    %edx,0x10(%rbx)
  mov    0x30(%rbx),%edx
  mov    %edx,0x20(%rbx)
  mov    %eax,0x30(%rbx)
  add    $0x4,%rbx
  cmp    %r12,%rbx
  jne    L23
  jmp    L96
L68:
  mov    $0x0,%eax
L36:
  mov    0x30(%rsp,%rax,1),%edx
  mov    (%rsp),%rsi
  mov    %edx,(%rsi,%rax,1)
  add    $0x4,%rax
  cmp    $0x40,%rax
  jne    L36
  mov    0xaf8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L2
  add    $0xb08,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L2:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void E512(uint32_t pt[16], uint32_t ct[16], uint32_t message[32], uint32_t salt[16], uint32_t counter[4]) {
  uint32_t state[16], i, j;
  uint32_t input[4], output[4], temp;
  uint32_t rk[(14 * 4 * (4) * 3)];
  for (i = 0; i < 16; i++)
    state[i] = pt[i];
  for (i = 0; i < 32; i++)
    rk[i] = message[i];
  MessageExpansion512(rk, salt, counter);
  for (i = 0; i < 14; i++) {
    for (j = 0; j < 4; j++)
      input[j] = state[4 + j];
    roundAESkeyfirst(input, output, rk + 32 * i);
    for (j = 0; j < 4; j++)
      input[j] = output[j];
    roundAESkeyfirst(input, output, rk + 32 * i + 4);
    for (j = 0; j < 4; j++)
      input[j] = output[j];
    roundAESkeyfirst(input, output, rk + 32 * i + 8);
    for (j = 0; j < 4; j++)
      input[j] = output[j];
    roundAESkeyfirst(input, output, rk + 32 * i + 12);
    for (j = 0; j < 4; j++)
      state[j] ^= output[j];
    for (j = 0; j < 4; j++)
      input[j] = state[12 + j];
    roundAESkeyfirst(input, output, rk + 32 * i + 16);
    for (j = 0; j < 4; j++)
      input[j] = output[j];
    roundAESkeyfirst(input, output, rk + 32 * i + 20);
    for (j = 0; j < 4; j++)
      input[j] = output[j];
    roundAESkeyfirst(input, output, rk + 32 * i + 24);
    for (j = 0; j < 4; j++)
      input[j] = output[j];
    roundAESkeyfirst(input, output, rk + 32 * i + 28);
    for (j = 0; j < 4; j++)
      state[8 + j] ^= output[j];
    for (j = 0; j < 4; j++) {
      temp = state[j];
      state[j] = state[j + 4];
      state[j + 4] = state[j + 8];
      state[j + 8] = state[j + 12];
      state[j + 12] = temp;
    }
  }
  for (i = 0; i < 16; i++)
    ct[i] = state[i];
  return;
}
```