user: Translate the below assembly code into C programming language:

```asm
<eb_recv_data>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xf8,%rsp
  mov    %rdi,%r15
  mov    %rsi,%r14
  mov    %fs:0x28,%rax
  mov    %rax,0xe8(%rsp)
  xor    %eax,%eax
  lea    0x80(%rsp),%rdi
  mov    $0x64,%edx
  mov    $0x0,%esi
  call   <memset@plt>
  mov    $0x0,%r12d
  mov    $0x0,%r13d
  lea    0x10(%rsp),%rbp
L134:
  mov    $0x64,%edx
  mov    $0x0,%esi
  mov    %rbp,%rdi
  call   <memset@plt>
  movl   $0x64,0xc(%rsp)
  lea    0xc(%rsp),%rsi
  mov    %rbp,%rdi
  call   <eb_serial_recv@plt>
  test   %eax,%eax
  js     L157
  mov    0xc(%rsp),%edi
  test   %edi,%edi
  jle    L134
  cmpl   $0x0,(%r14)
  jg     L53
L123:
  mov    %r13d,%ebx
  mov    $0x0,%eax
  movslq %r13d,%r13
  lea    0x80(%rsp,%r13,1),%rsi
  jmp    L130
L53:
  lea    0x80(%rsp),%rbx
  mov    %edi,%edx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <memcpy@plt>
  mov    0xc(%rsp),%r13d
  mov    $0x64,%edx
  mov    $0x0,%esi
  mov    %rbp,%rdi
  call   <memset@plt>
  mov    (%r14),%edx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  call   <memcpy@plt>
  mov    (%r14),%eax
  mov    %eax,0xc(%rsp)
  movl   $0x0,(%r14)
  cltq
  lea    0x0(%rbp,%rax,1),%rdi
  mov    %r13d,%edx
  mov    %rbx,%rsi
  call   <memcpy@plt>
  add    %r13d,0xc(%rsp)
  mov    $0x64,%edx
  mov    $0x0,%esi
  mov    %rbx,%rdi
  call   <memset@plt>
  mov    0xc(%rsp),%edi
  test   %edi,%edi
  jle    L16
  mov    $0x0,%r13d
  jmp    L123
L103:
  cmpb   $0xaa,0x1(%rsi,%rax,1)
  je     L65
  cmp    $0x10,%dl
  ja     L65
  add    $0x1,%rax
  cmp    %eax,%edi
  jle    L67
L130:
  movzbl (%rax,%rbp,1),%ecx
  mov    %cl,(%rsi,%rax,1)
  mov    %ebx,%r13d
  add    $0x1,%ebx
  movzbl 0x80(%rsp),%edx
  cmp    $0xaa,%dl
  je     L170
  cmp    $0x1,%ebx
  jle    L103
  cmp    $0xa9,%cl
  sete   %cl
  movzbl %cl,%ecx
  add    %ecx,%r12d
  movzbl %dl,%ecx
  lea    0x2(%r12,%rcx,1),%ecx
  cmp    %ebx,%ecx
  jne    L103
  mov    %ebx,(%r14)
  mov    $0x8,%edx
  mov    $0x0,%esi
  mov    %r15,%rdi
  call   <memset@plt>
  mov    $0x0,%ebp
L197:
  mov    $0x0,%eax
L180:
  movzbl 0x80(%rsp,%rax,1),%edx
  mov    %dl,(%r15,%rax,1)
  add    $0x1,%rax
  lea    -0x1(%rax),%edx
  cmp    %edx,%r13d
  jg     L180
  jmp    L94
L67:
  mov    %ebx,%r13d
  jmp    L134
L16:
  mov    $0x0,%r13d
  jmp    L134
L157:
  mov    $0xffffffff,%ebp
L94:
  mov    0xe8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L68
  mov    %ebp,%eax
  add    $0xf8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L170:
  mov    $0xfffffffe,%ebp
  jmp    L50
L65:
  mov    $0xfffffffd,%ebp
L50:
  mov    %ebx,(%r14)
  mov    $0x8,%edx
  mov    $0x0,%esi
  mov    %r15,%rdi
  call   <memset@plt>
  test   %ebx,%ebx
  jle    L94
  jmp    L197
L68:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int eb_recv_data(unsigned char *buf, int *buflen) {
  unsigned char tmp[100], msg[100];
  int tmplen, msglen, ret, i, esc, found;
  memset(msg, '\0', sizeof(msg));
  msglen = 0;
  esc = 0;
  found = 99;
  do {
    memset(tmp, '\0', sizeof(tmp));
    tmplen = sizeof(tmp);
    ret = eb_serial_recv(tmp, &tmplen);
    if (ret < 0)
      return -1;
    if (tmplen > 0) {
      if (*buflen > 0) {
        memcpy(msg, tmp, tmplen);
        msglen = tmplen;
        memset(tmp, '\0', sizeof(tmp));
        memcpy(tmp, buf, *buflen);
        tmplen = *buflen;
        *buflen = 0;
        memcpy(&tmp[tmplen], msg, msglen);
        tmplen += msglen;
        memset(msg, '\0', sizeof(msg));
        msglen = 0;
      }
      i = 0;
      while (i < tmplen) {
        msg[msglen] = tmp[i];
        msglen++;
        if (msg[0] == 0xAA) {
          found = -2;
          break;
        }
        if (msglen > 1) {
          if (msg[msglen - 1] == 0xA9)
            esc++;
          if (msglen == (2 + msg[0] + esc)) {
            found = 0;
            break;
          }
        }
        if (msg[msglen] == 0xAA || msg[0] > 16) {
          found = -3;
          break;
        }
        i++;
      }
    }
  } while (found == 99);
  *buflen = msglen;
  memset(buf, '\0', sizeof(buf));
  for (i = 0; i < msglen; i++)
    buf[i] = msg[i];
  return found;
}
```