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

```asm
<crypto_aead_encrypt>:
  endbr64
  push   %r15
  push   %r14
  mov    %r8,%r14
  push   %r13
  push   %r12
  mov    %rdx,%r12
  push   %rbp
  push   %rbx
  mov    %r9,%rbx
  sub    $0x178,%rsp
  mov    %rdi,0x8(%rsp)
  lea    0x40(%rsp),%r15
  mov    0x1c0(%rsp),%rdi
  mov    %rsi,0x18(%rsp)
  mov    0x1b8(%rsp),%rsi
  mov    %r15,%rdx
  mov    %rcx,(%rsp)
  mov    %r9,0x10(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x168(%rsp)
  xor    %eax,%eax
  call   <acorn128_initialization@plt>
  test   %rbx,%rbx
  je     L22
  mov    0x10(%rsp),%rax
  lea    0x2f(%rsp),%rbx
  lea    0x2e(%rsp),%rbp
  lea    (%r14,%rax,1),%r13
  nopl   (%rax)
L11:
  movzbl (%r14),%esi
  mov    $0xff,%r9d
  mov    %rbx,%rcx
  mov    %rbp,%rdx
  mov    $0xff,%r8d
  mov    %r15,%rdi
  add    $0x1,%r14
  call   <acorn128_enc_onebyte@plt>
  cmp    %r14,%r13
  jne    L11
L72:
  xor    %r13d,%r13d
  nopw   0x0(%rax,%rax,1)
L9:
  cmp    $0x1f,%r13
  mov    $0xff,%r9d
  mov    %rbx,%rcx
  mov    %rbp,%rdx
  setbe  %r8b
  xor    %esi,%esi
  mov    %r15,%rdi
  neg    %r8d
  test   %r13,%r13
  sete   %sil
  movzbl %r8b,%r8d
  add    $0x1,%r13
  call   <acorn128_enc_onebyte@plt>
  cmp    $0x40,%r13
  jne    L9
  mov    (%rsp),%rax
  test   %rax,%rax
  je     L14
  mov    0x8(%rsp),%r14
  lea    (%r12,%rax,1),%r13
  nopl   0x0(%rax,%rax,1)
L45:
  movzbl (%r12),%esi
  mov    %r14,%rdx
  xor    %r9d,%r9d
  mov    %rbx,%rcx
  mov    $0xff,%r8d
  mov    %r15,%rdi
  add    $0x1,%r12
  add    $0x1,%r14
  call   <acorn128_enc_onebyte@plt>
  cmp    %r12,%r13
  jne    L45
L14:
  xor    %r12d,%r12d
  nopl   0x0(%rax)
L61:
  cmp    $0x1f,%r12
  mov    %rbx,%rcx
  mov    %rbp,%rdx
  mov    %r15,%rdi
  setbe  %r8b
  xor    %esi,%esi
  neg    %r8d
  test   %r12,%r12
  sete   %sil
  movzbl %r8b,%r8d
  xor    %r9d,%r9d
  add    $0x1,%r12
  call   <acorn128_enc_onebyte@plt>
  cmp    $0x40,%r12
  jne    L61
  mov    (%rsp),%rbx
  mov    0x10(%rsp),%rsi
  lea    0x30(%rsp),%rbp
  mov    %r15,%r8
  mov    $0x10,%edx
  mov    %rbp,%rcx
  mov    %rbx,%rdi
  call   <acorn128_tag_generation@plt>
  mov    0x18(%rsp),%rdx
  lea    0x10(%rbx),%rax
  mov    %rbp,%rsi
  mov    0x8(%rsp),%rdi
  mov    %rax,(%rdx)
  mov    $0x10,%edx
  add    %rbx,%rdi
  call   <memcpy@plt>
  mov    0x168(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L79
  add    $0x178,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L22:
  lea    0x2f(%rsp),%rbx
  lea    0x2e(%rsp),%rbp
  jmp    L72
L79:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int crypto_aead_encrypt(unsigned char *c, unsigned long long *clen, const unsigned char *m, unsigned long long mlen, const unsigned char *ad, unsigned long long adlen, const unsigned char *nsec, const unsigned char *npub, const unsigned char *k) {
  unsigned long i;
  unsigned char plaintextbyte, ciphertextbyte, ksbyte, mac[16];
  unsigned char state[293];
  unsigned char ca, cb;
  acorn128_initialization(k, npub, state);
  for (i = 0; i < adlen; i++) {
    acorn128_enc_onebyte(state, ad[i], &ciphertextbyte, &ksbyte, 0xff, 0xff);
  }
  for (i = 0; i < 512 / 8; i++) {
    if (i == 0)
      plaintextbyte = 1;
    else
      plaintextbyte = 0;
    if (i < 256 / 8)
      ca = 0xff;
    else
      ca = 0;
    cb = 0xff;
    acorn128_enc_onebyte(state, plaintextbyte, &ciphertextbyte, &ksbyte, ca, cb);
  }
  for (i = 0; i < mlen; i++) {
    acorn128_enc_onebyte(state, m[i], &c[i], &ksbyte, 0xff, 0);
  }
  for (i = 0; i < 512 / 8; i++) {
    if (i == 0)
      plaintextbyte = 1;
    else
      plaintextbyte = 0;
    if (i < 256 / 8)
      ca = 0xff;
    else
      ca = 0;
    cb = 0;
    acorn128_enc_onebyte(state, plaintextbyte, &ciphertextbyte, &ksbyte, ca, cb);
  }
  acorn128_tag_generation(mlen, adlen, 16, mac, state);
  *clen = mlen + 16;
  memcpy(c + mlen, mac, 16);
  return 0;
}
```