user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<AES_CMAC>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0xa0,%rsp
  mov    %rdi,-0x88(%rbp)
  mov    %rsi,-0x90(%rbp)
  mov    %edx,-0x94(%rbp)
  mov    %rcx,-0xa0(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0x20(%rbp),%rdx
  lea    -0x30(%rbp),%rcx
  mov    -0x88(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <generate_subkey@plt>
  mov    -0x94(%rbp),%eax
  add    $0xf,%eax
  lea    0xf(%rax),%edx
  test   %eax,%eax
  cmovs  %edx,%eax
  sar    $0x4,%eax
  mov    %eax,-0x7c(%rbp)
  cmpl   $0x0,-0x7c(%rbp)
  jne    L50
  movl   $0x1,-0x7c(%rbp)
  movl   $0x0,-0x74(%rbp)
  jmp    L26
L50:
  mov    -0x94(%rbp),%eax
  and    $0xf,%eax
  test   %eax,%eax
  jne    L7
  movl   $0x1,-0x74(%rbp)
  jmp    L26
L7:
  movl   $0x0,-0x74(%rbp)
L26:
  cmpl   $0x0,-0x74(%rbp)
  je     L53
  mov    -0x7c(%rbp),%eax
  sub    $0x1,%eax
  shl    $0x4,%eax
  movslq %eax,%rdx
  mov    -0x90(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  lea    -0x50(%rbp),%rdx
  lea    -0x30(%rbp),%rax
  mov    %rax,%rsi
  mov    %rcx,%rdi
  call   <xor_128@plt>
  jmp    L27
L53:
  mov    -0x94(%rbp),%eax
  cltd
  shr    $0x1c,%edx
  add    %edx,%eax
  and    $0xf,%eax
  sub    %edx,%eax
  mov    %eax,%edx
  mov    -0x7c(%rbp),%eax
  sub    $0x1,%eax
  shl    $0x4,%eax
  movslq %eax,%rcx
  mov    -0x90(%rbp),%rax
  add    %rax,%rcx
  lea    -0x40(%rbp),%rax
  mov    %rax,%rsi
  mov    %rcx,%rdi
  call   <padding@plt>
  lea    -0x50(%rbp),%rdx
  lea    -0x20(%rbp),%rcx
  lea    -0x40(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <xor_128@plt>
L27:
  lea    -0x70(%rbp),%rax
  mov    $0x10,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  movl   $0x0,-0x78(%rbp)
  jmp    L61
L32:
  mov    -0x78(%rbp),%eax
  shl    $0x4,%eax
  movslq %eax,%rdx
  mov    -0x90(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  lea    -0x60(%rbp),%rdx
  lea    -0x70(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <xor_128@plt>
  lea    -0x70(%rbp),%rdx
  lea    -0x60(%rbp),%rcx
  mov    -0x88(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <AES_128_ENC@plt>
  addl   $0x1,-0x78(%rbp)
L61:
  mov    -0x7c(%rbp),%eax
  sub    $0x1,%eax
  cmp    %eax,-0x78(%rbp)
  jl     L32
  lea    -0x60(%rbp),%rdx
  lea    -0x50(%rbp),%rcx
  lea    -0x70(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <xor_128@plt>
  lea    -0x70(%rbp),%rdx
  lea    -0x60(%rbp),%rcx
  mov    -0x88(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <AES_128_ENC@plt>
  lea    -0x70(%rbp),%rcx
  mov    -0xa0(%rbp),%rax
  mov    $0x10,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L25
  call   <__stack_chk_fail@plt>
L25:
  leave
  ret
```

assistant: ```c
void AES_CMAC(const unsigned char *key, const unsigned char *input, int length, unsigned char *mac) {
  unsigned char X[16], Y[16], M_last[16], padded[16];
  unsigned char K1[16], K2[16];
  int n, i, flag;
  generate_subkey(key, K1, K2);
  n = (length + (16 - 1)) / 16;
  if (n == 0) {
    n = 1;
    flag = 0;
  } else {
    if ((length % 16) == 0) {
      flag = 1;
    } else {
      flag = 0;
    }
  }
  if (flag) {
    xor_128(&input[16 * (n - 1)], K1, M_last);
  } else {
    padding(&input[16 * (n - 1)], padded, length % 16);
    xor_128(padded, K2, M_last);
  }
  memset(X, 0, 16);
  for (i = 0; i < n - 1; i++) {
    xor_128(X, &input[16 * i], Y);
    AES_128_ENC(key, Y, X);
  }
  xor_128(X, M_last, Y);
  AES_128_ENC(key, Y, X);
  memcpy(mac, X, 16);
}
```