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

```asm
<MAC_GEN>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    %rdi,%r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xb8,%rsp
  mov    %rsi,0x10(%rsp)
  mov    %rdx,0x28(%rsp)
  mov    %rcx,0x18(%rsp)
  mov    %r8,0x20(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0xa8(%rsp)
  mov    %rdx,%rax
  shr    $0x5,%rax
  mov    %rax,(%rsp)
  mov    %edx,%eax
  and    $0x1f,%eax
  mov    %eax,0xc(%rsp)
  jne    L280
  test   %rdx,%rdx
  je     L280
  pxor   %xmm0,%xmm0
  cmpq   $0x1,(%rsp)
  movq   $0x0,0x33(%rsp)
  movl   $0x0,0x3b(%rsp)
  movb   $0x0,0x3f(%rsp)
  movaps %xmm0,0x80(%rsp)
  movaps %xmm0,0x90(%rsp)
  jbe    L227
L247:
  lea    0x33(%rsp),%r14
  lea    0x40(%rsp),%r15
  mov    0x10(%rsp),%r12
  mov    $0x1,%ebx
  lea    0x60(%rsp),%rbp
  mov    %r14,%rax
  mov    %rbp,%r14
  mov    %r15,%rbp
  mov    %rax,%r15
  nopw   0x0(%rax,%rax,1)
L180:
  movdqu (%r12),%xmm2
  sub    $0x8,%rsp
  mov    %rbx,%rcx
  mov    %rbp,%r9
  movdqu 0x10(%r12),%xmm3
  xor    %r8d,%r8d
  mov    %r15,%rdx
  mov    %r13,%rdi
  movaps %xmm2,0x48(%rsp)
  mov    $0x80,%esi
  add    $0x20,%r12
  movaps %xmm3,0x58(%rsp)
  push   %r14
  call   <TEM_ENC@plt>
  mov    %rbx,%rcx
  lea    0x1(%rbx),%rbx
  movdqa 0x90(%rsp),%xmm0
  pxor   0x70(%rsp),%xmm0
  movaps %xmm0,0x90(%rsp)
  movdqa 0xa0(%rsp),%xmm0
  pxor   0x80(%rsp),%xmm0
  movaps %xmm0,0xa0(%rsp)
  pop    %r10
  pop    %r11
  cmp    %rbx,(%rsp)
  jne    L180
  mov    %r15,%rax
  mov    %rbp,%r15
  mov    %r14,%rbp
  mov    %rax,%r14
  mov    %rcx,%rax
  shl    $0x5,%rax
  add    %rax,0x10(%rsp)
L315:
  mov    0xc(%rsp),%r9d
  test   %r9d,%r9d
  jne    L84
  cmpq   $0x0,0x28(%rsp)
  je     L147
L141:
  mov    0x10(%rsp),%rax
  sub    $0x8,%rsp
  mov    %r15,%r9
  mov    $0x1,%r8d
  movdqu (%rax),%xmm1
  movdqu 0x10(%rax),%xmm0
  pxor   0x88(%rsp),%xmm1
  pxor   0x98(%rsp),%xmm0
  movaps %xmm1,0x48(%rsp)
  movaps %xmm0,0x58(%rsp)
  push   %rbp
L0:
  mov    %r14,%rdx
  mov    $0x80,%esi
  mov    %r13,%rdi
  call   <TEM_ENC@plt>
  pop    %rax
  pop    %rdx
  mov    0x18(%rsp),%rax
  movdqa 0x60(%rsp),%xmm4
  movups %xmm4,(%rax)
  mov    0x20(%rsp),%rax
  movq   $0x10,(%rax)
  mov    0xa8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L118
  add    $0xb8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L280:
  addq   $0x1,(%rsp)
  mov    (%rsp),%rax
  pxor   %xmm0,%xmm0
  movq   $0x0,0x33(%rsp)
  movl   $0x0,0x3b(%rsp)
  movb   $0x0,0x3f(%rsp)
  movaps %xmm0,0x80(%rsp)
  movaps %xmm0,0x90(%rsp)
  cmp    $0x1,%rax
  ja     L247
  xor    %ecx,%ecx
  lea    0x40(%rsp),%r15
  lea    0x33(%rsp),%r14
  lea    0x60(%rsp),%rbp
  jmp    L315
L147:
  mov    0xc(%rsp),%r8d
  test   %r8d,%r8d
  je     L39
L84:
  mov    0x10(%rsp),%rdi
  mov    0xc(%rsp),%esi
  mov    %r15,%r8
  mov    %rdi,%rax
  cmp    $0x8,%esi
  jae    L63
L233:
  xor    %esi,%esi
  testb  $0x4,0xc(%rsp)
  jne    L229
  testb  $0x2,0xc(%rsp)
  jne    L202
L265:
  testb  $0x1,0xc(%rsp)
  jne    L22
L39:
  mov    0xc(%rsp),%edi
  movslq %edi,%rax
  lea    0x1(%rdi),%esi
  movb   $0x80,0x40(%rsp,%rax,1)
  cmp    $0x1f,%edi
  je     L36
  mov    $0x1f,%eax
  movslq %esi,%rsi
  sub    0xc(%rsp),%eax
  xor    %r10d,%r10d
  add    %r15,%rsi
  cmp    $0x8,%eax
  jae    L26
  test   $0x4,%al
  jne    L86
  test   %eax,%eax
  jne    L215
L36:
  movdqa 0x40(%rsp),%xmm0
  sub    $0x8,%rsp
  mov    %r15,%r9
  pxor   0x88(%rsp),%xmm0
  mov    $0x2,%r8d
  movaps %xmm0,0x48(%rsp)
  movdqa 0x58(%rsp),%xmm0
  pxor   0x98(%rsp),%xmm0
  movaps %xmm0,0x58(%rsp)
  push   %rbp
  jmp    L0
L26:
  mov    %eax,%r8d
  movq   $0x0,(%rsi)
  movq   $0x0,-0x8(%rsi,%r8,1)
  lea    0x8(%rsi),%r8
  and    $0xfffffffffffffff8,%r8
  sub    %r8,%rsi
  add    %esi,%eax
  and    $0xfffffff8,%eax
  cmp    $0x8,%eax
  jb     L36
  and    $0xfffffff8,%eax
  xor    %esi,%esi
L218:
  mov    %esi,%edx
  add    $0x8,%esi
  mov    %r10,(%r8,%rdx,1)
  cmp    %eax,%esi
  jb     L218
  jmp    L36
L22:
  movzbl (%rax,%rsi,1),%eax
  mov    %al,(%r8,%rsi,1)
  jmp    L39
L202:
  movzwl (%rax,%rsi,1),%r10d
  mov    %r10w,(%r8,%rsi,1)
  add    $0x2,%rsi
  testb  $0x1,0xc(%rsp)
  je     L39
  jmp    L22
L229:
  mov    (%rax),%esi
  mov    %esi,(%r8)
  mov    $0x4,%esi
  testb  $0x2,0xc(%rsp)
  je     L265
  jmp    L202
L215:
  movb   $0x0,(%rsi)
  test   $0x2,%al
  je     L36
  xor    %edi,%edi
  mov    %di,-0x2(%rsi,%rax,1)
  jmp    L36
L227:
  xor    %ecx,%ecx
  lea    0x40(%rsp),%r15
  lea    0x33(%rsp),%r14
  lea    0x60(%rsp),%rbp
  jmp    L141
L63:
  and    $0xfffffff8,%esi
  xor    %eax,%eax
  mov    %esi,%r10d
L213:
  mov    %eax,%edx
  add    $0x8,%eax
  mov    (%rdi,%rdx,1),%rsi
  mov    %rsi,(%r15,%rdx,1)
  cmp    %r10d,%eax
  jb     L213
  lea    (%r15,%rax,1),%r8
  add    0x10(%rsp),%rax
  jmp    L233
L86:
  movl   $0x0,(%rsi)
  movl   $0x0,-0x4(%rsi,%rax,1)
  jmp    L36
L118:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int MAC_GEN(const unsigned char *_K, const unsigned char *_M, unsigned long long _mlen, unsigned char *C_, unsigned long long *clen_) {
  int d, pad;
  unsigned long long i, blocknum;
  const unsigned char *mp;
  unsigned char *cp, in[32], out[32], t[32], zero[13];
  i = 1;
  mp = _M;
  cp = C_;
  pad = _mlen % 32;
  blocknum = _mlen / 32;
  if ((pad != 0) || (_mlen == 0))
    blocknum += 1;
  do {
    int u;
    for (u = 0; u < 32; u++)
      (t)[u] = 0x00;
  } while (0);
  do {
    int u;
    for (u = 0; u < 13; u++)
      (zero)[u] = 0x00;
  } while (0);
  while (blocknum > 1) {
    do {
      int u;
      for (u = 0; u < 32; u++)
        (in)[u] = (mp)[u];
    } while (0);
    TEM_ENC(_K, 0x80, zero, i, 0, in, out);
    do {
      int u;
      for (u = 0; u < 32; u++)
        (t)[u] ^= (out)[u];
    } while (0);
    i++;
    blocknum--;
    mp += 32;
  }
  if ((pad == 0) && (_mlen != 0)) {
    do {
      int u;
      for (u = 0; u < 32; u++)
        (in)[u] = (mp)[u];
    } while (0);
  } else {
    do {
      int u;
      for (u = 0; u < pad; u++)
        (in)[u] = (mp)[u];
    } while (0);
    in[pad] = 0x80;
    for (d = pad + 1; d < 32; d++)
      in[d] = 0x00;
  }
  do {
    int u;
    for (u = 0; u < 32; u++)
      (in)[u] ^= (t)[u];
  } while (0);
  if ((pad == 0) && (_mlen != 0)) {
    TEM_ENC(_K, 0x80, zero, i - 1, 1, in, out);
  } else {
    TEM_ENC(_K, 0x80, zero, i - 1, 2, in, out);
  }
  do {
    int u;
    for (u = 0; u < 16; u++)
      (cp)[u] = (out)[u];
  } while (0);
  *clen_ = 16;
  return 0;
}
```