user: 请将以下的汇编代码转换成C语言代码:

```asm
<expectedmsgrcd>:
  endbr64
  push   %r13
  push   %r12
  mov    %rsi,%r12
  xor    %esi,%esi
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  mov    %edx,%ebx
  mov    $0x4,%edx
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  lea    0x4(%rsp),%r13
  mov    %r13,%rdi
  call   <memset@plt>
  cmp    $0xa0,%ebx
  jg     L195
  cmp    $0x7f,%ebx
  jg     L369
  cmp    $0x40,%ebx
  je     L140
  jle    L211
  cmp    $0x60,%ebx
  jne    L336
L305:
  mov    0x4(%rbp),%ecx
  mov    %ecx,%esi
  test   %ecx,%ecx
  je     L379
  cmp    $0x60,%ecx
  je     L379
L345:
  lea    -0xb8(%rsi),%eax
  cmp    $0xa0,%esi
  ja     L383
L353:
  cmp    $0x7f,%esi
  ja     L139
  cmp    $0x40,%esi
  je     L104
  ja     L35
  test   %esi,%esi
  je     L218
  cmp    $0x20,%esi
  jne    L68
L104:
  lea    D0(%rip),%rsi
  mov    %r13,%rdi
  call   <strcat@plt>
L132:
  mov    0x28(%rbp),%esi
  mov    0x4(%rbp),%ecx
L229:
  mov    %ebx,%r8d
  mov    %r12,%rdx
  lea    D13(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    %r13,%rsi
  lea    D51(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  xor    %eax,%eax
  jmp    L144
  nopw   0x0(%rax,%rax,1)
L211:
  test   %ebx,%ebx
  je     L305
  cmp    $0x20,%ebx
  jne    L336
L140:
  mov    0x4(%rbp),%ecx
  lea    -0x20(%rcx),%eax
  mov    %ecx,%esi
  and    $0xffffffdf,%eax
  jne    L345
L379:
  mov    0x28(%rbp),%eax
  mov    %rax,%rsi
  cmp    %r12,%rax
  jne    L229
  mov    $0x1,%eax
L144:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L123
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   (%rax)
L369:
  movabs $0x100000101,%rdx
  lea    -0x80(%rbx),%eax
  bt     %rax,%rdx
  jb     L264
L336:
  mov    %ebx,%esi
  lea    D58(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x4(%rbp),%esi
  lea    -0xb8(%rsi),%eax
  cmp    $0xa0,%esi
  jbe    L353
L383:
  cmp    $0x28,%eax
  ja     L68
  movabs $0x10001000101,%rdx
  bt     %rax,%rdx
  jae    L68
  lea    D46(%rip),%rsi
  mov    %r13,%rdi
  call   <strcat@plt>
  jmp    L132
  nopl   (%rax)
L195:
  lea    -0xb8(%rbx),%eax
  cmp    $0x28,%eax
  ja     L336
  movabs $0x10001000101,%rdx
  bt     %rax,%rdx
  jae    L336
  mov    0x4(%rbp),%esi
  lea    -0xb8(%rsi),%eax
  mov    %esi,%ecx
  cmp    $0x28,%eax
  ja     L378
  movabs $0xfffffefffefffefe,%rdx
  bt     %rax,%rdx
  jae    L379
  jmp    L383
  nopl   (%rax)
L35:
  cmp    $0x60,%esi
  jne    L68
L218:
  lea    D56(%rip),%rsi
  mov    %r13,%rdi
  call   <strcat@plt>
  jmp    L132
  nopl   0x0(%rax)
L139:
  movabs $0x100000101,%rdx
  lea    -0x80(%rsi),%eax
  bt     %rax,%rdx
  jb     L182
L68:
  lea    D17(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L132
  cs nopw 0x0(%rax,%rax,1)
L264:
  mov    0x4(%rbp),%ecx
  mov    %ecx,%eax
  mov    %ecx,%esi
  and    $0xfffffff7,%eax
  cmp    $0x80,%eax
  je     L379
  cmp    $0xa0,%ecx
  je     L379
  jmp    L345
  cs nopw 0x0(%rax,%rax,1)
L378:
  cmp    $0xa0,%esi
  jbe    L353
  jmp    L68
  xchg   %ax,%ax
L182:
  lea    D14(%rip),%rsi
  mov    %r13,%rdi
  call   <strcat@plt>
  jmp    L132
L123:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: tag: D0
datatype: string
name: unpack_data
arguments: tag: D13
datatype: string
name: unpack_data
arguments: tag: D51
datatype: string
name: unpack_data
arguments: tag: D58
datatype: string
name: unpack_data
arguments: tag: D46
datatype: string
name: unpack_data
arguments: tag: D56
datatype: string
name: unpack_data
arguments: tag: D17
datatype: string
name: unpack_data
arguments: tag: D14
datatype: string

tool: D0: BK

tool: D13: 
expectedmsgrcd no match: rmsg[10] %u expect type %lu rmsg[1] as tos 0x%x expect tos 0x%x


tool: D51: expectedmsgrcd::rcv %s as repeate pkt for previous state


tool: D58: 
expectedmsgrcd not know tos=0x%x


tool: D46: VO

tool: D56: BE

tool: D17: 
expectedmsgrcd check unexpected TOS:not know rmsg[1]=0x%x


tool: D14: VI

assistant: ```c
int expectedmsgrcd(unsigned int *rmsg, unsigned long type, int tos) {
  char type_ok = 0, acBuf[4];
  char tos_ok = 0;
  int r = 0;
  memset(acBuf, 0, 4);
  switch (tos) {
  case 0xE0:
  case 0xD0:
  case 0xC0:
  case 0xB8:
    if (rmsg[1] == 0xE0 || rmsg[1] == 0xD0 || rmsg[1] == 0xC0 || rmsg[1] == 0xB8) {
      tos_ok = 1;
    }
    break;
  case 0xA0:
  case 0x80:
  case 0x88:
    if (rmsg[1] == 0xA0 || rmsg[1] == 0x80 || rmsg[1] == 0x88) {
      tos_ok = 1;
    }
    break;
  case 0x00:
  case 0x60:
    if (rmsg[1] == 0x00 || rmsg[1] == 0x60) {
      tos_ok = 1;
    }
    break;
  case 0x20:
  case 0x40:
    if (rmsg[1] == 0x20 || rmsg[1] == 0x40) {
      tos_ok = 1;
    }
    break;
  default:
    printf("\nexpectedmsgrcd not know tos=0x%x\n", tos);
  }
  if (tos_ok == 0) {
    switch (rmsg[1]) {
    case 0xE0:
    case 0xD0:
    case 0xC0:
    case 0xB8:
      strcat(acBuf, "VO");
      break;
    case 0xA0:
    case 0x80:
    case 0x88:
      strcat(acBuf, "VI");
      break;
    case 0x00:
    case 0x60:
      strcat(acBuf, "BE");
      break;
    case 0x20:
    case 0x40:
      strcat(acBuf, "BK");
      break;
    default:
      printf("\nexpectedmsgrcd check unexpected TOS:not know rmsg[1]=0x%x\n", rmsg[1]);
    }
  }
  type_ok = ((rmsg[10] == type) ? 1 : 0);
  r = (type_ok && tos_ok);
  if (!r) {
    printf("\nexpectedmsgrcd no match: rmsg[10] %u expect type %lu rmsg[1] as tos 0x%x expect tos 0x%x\n", rmsg[10], type, rmsg[1], tos);
    printf("expectedmsgrcd::rcv %s as repeate pkt for previous state\n", acBuf);
  }
  return r;
}
```