user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<MAC_GEN>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xc8,%rsp
  mov    %rdi,0x8(%rsp)
  mov    %rsi,%r14
  mov    %rdx,0x20(%rsp)
  mov    %rcx,%r15
  mov    %r8,0x28(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0xb8(%rsp)
  xor    %eax,%eax
  mov    %rdx,%rax
  shr    $0x5,%rax
  mov    %rax,%rdi
  mov    %edx,%eax
  and    $0x1f,%eax
  mov    %eax,0x1c(%rsp)
  jne    L158
  test   %rdx,%rdx
  je     L158
L95:
  lea    0x90(%rsp),%r13
  lea    0xb0(%rsp),%rbp
  mov    %r13,%rax
L74:
  movb   $0x0,(%rax)
  add    $0x1,%rax
  cmp    %rbp,%rax
  jne    L74
  lea    0x43(%rsp),%rax
  lea    0x50(%rsp),%rdx
L111:
  movb   $0x0,(%rax)
  add    $0x1,%rax
  cmp    %rdx,%rax
  jne    L111
  mov    %r14,%r12
  mov    $0x1,%esi
  lea    0x43(%rsp),%rax
  mov    %rax,0x10(%rsp)
  cmp    $0x1,%rdi
  jbe    L166
  mov    %r14,0x30(%rsp)
  mov    %rsi,%r14
  mov    %r15,0x38(%rsp)
  mov    %rdi,%r15
L98:
  mov    $0x0,%eax
L21:
  movzbl (%r12,%rax,1),%edx
  mov    %dl,0x50(%rsp,%rax,1)
  add    $0x1,%rax
  cmp    $0x20,%rax
  jne    L21
  sub    $0x8,%rsp
  lea    0x78(%rsp),%rbx
  push   %rbx
  lea    0x60(%rsp),%r9
  mov    $0x0,%r8d
  mov    %r14,%rcx
  mov    0x20(%rsp),%rdx
  mov    $0x80,%esi
  mov    0x18(%rsp),%rdi
  call   <TEM_ENC@plt>
  add    $0x10,%rsp
  mov    %r13,%rax
L31:
  movzbl (%rbx),%edx
  xor    %dl,(%rax)
  add    $0x1,%rax
  add    $0x1,%rbx
  cmp    %rbp,%rax
  jne    L31
  lea    0x1(%r14),%rsi
  add    $0x20,%r12
  cmp    %rsi,%r15
  je     L29
  mov    %rsi,%r14
  jmp    L98
L158:
  mov    %rdi,%rax
  add    $0x1,%rax
  mov    %rax,%rdi
  jmp    L95
L29:
  mov    %r14,%rax
  mov    0x30(%rsp),%r14
  mov    0x38(%rsp),%r15
  shl    $0x5,%rax
  add    %rax,%r14
L166:
  mov    0x1c(%rsp),%ebx
  test   %ebx,%ebx
  sete   %dil
  cmpq   $0x0,0x20(%rsp)
  setne  %al
  and    %al,%dil
  jne    L216
  mov    %ebx,%ecx
  mov    $0x0,%eax
  test   %ebx,%ebx
  jle    L143
L117:
  movzbl (%r14,%rax,1),%edx
  mov    %dl,0x50(%rsp,%rax,1)
  add    $0x1,%rax
  cmp    %rax,%rcx
  jne    L117
L143:
  mov    0x1c(%rsp),%ecx
  movslq %ecx,%rax
  movb   $0x80,0x50(%rsp,%rax,1)
  lea    0x1(%rcx),%eax
  cmp    $0x1f,%eax
  jg     L86
  cltq
L168:
  movb   $0x0,0x50(%rsp,%rax,1)
  add    $0x1,%rax
  cmp    $0x1f,%eax
  jle    L168
  jmp    L86
L216:
  mov    $0x0,%eax
L18:
  movzbl (%r14,%rax,1),%edx
  mov    %dl,0x50(%rsp,%rax,1)
  add    $0x1,%rax
  cmp    $0x20,%rax
  jne    L18
L86:
  lea    0x50(%rsp),%rax
  lea    0x70(%rsp),%rcx
L179:
  movzbl 0x0(%r13),%edx
  xor    %dl,(%rax)
  add    $0x1,%rax
  add    $0x1,%r13
  cmp    %rax,%rcx
  jne    L179
  test   %dil,%dil
  je     L203
  lea    -0x1(%rsi),%rcx
  lea    0x43(%rsp),%rdx
  sub    $0x8,%rsp
  lea    0x78(%rsp),%rax
  push   %rax
  lea    0x60(%rsp),%r9
  mov    $0x1,%r8d
  mov    $0x80,%esi
  mov    0x18(%rsp),%rdi
  call   <TEM_ENC@plt>
  add    $0x10,%rsp
L68:
  mov    $0x0,%eax
L52:
  movzbl 0x70(%rsp,%rax,1),%edx
  mov    %dl,(%r15,%rax,1)
  add    $0x1,%rax
  cmp    $0x10,%rax
  jne    L52
  mov    0x28(%rsp),%rax
  movq   $0x10,(%rax)
  mov    0xb8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L139
  mov    $0x0,%eax
  add    $0xc8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L203:
  lea    -0x1(%rsi),%rcx
  lea    0x43(%rsp),%rdx
  sub    $0x8,%rsp
  lea    0x78(%rsp),%rax
  push   %rax
  lea    0x60(%rsp),%r9
  mov    $0x2,%r8d
  mov    $0x80,%esi
  mov    0x18(%rsp),%rdi
  call   <TEM_ENC@plt>
  add    $0x10,%rsp
  jmp    L68
L139:
  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;
}
```