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

```asm
<expectedmsgrcd>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %edx,-0x34(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movb   $0x0,-0x11(%rbp)
  movb   $0x0,-0x12(%rbp)
  movl   $0x0,-0x10(%rbp)
  lea    -0xc(%rbp),%rax
  mov    $0x4,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  cmpl   $0xe0,-0x34(%rbp)
  jg     L301
  cmpl   $0xb8,-0x34(%rbp)
  jge    L253
  cmpl   $0xa0,-0x34(%rbp)
  jg     L301
  cmpl   $0x80,-0x34(%rbp)
  jge    L562
  cmpl   $0x60,-0x34(%rbp)
  je     L177
  cmpl   $0x60,-0x34(%rbp)
  jg     L301
  cmpl   $0x40,-0x34(%rbp)
  je     L537
  cmpl   $0x40,-0x34(%rbp)
  jg     L301
  cmpl   $0x0,-0x34(%rbp)
  je     L177
  cmpl   $0x20,-0x34(%rbp)
  je     L537
  jmp    L301
L253:
  mov    -0x34(%rbp),%eax
  sub    $0xb8,%eax
  movabs $0x10001000101,%rdx
  mov    %eax,%ecx
  shr    %cl,%rdx
  mov    %rdx,%rax
  and    $0x1,%eax
  test   %rax,%rax
  setne  %al
  test   %al,%al
  jne    L504
  jmp    L301
L562:
  mov    -0x34(%rbp),%eax
  add    $0xffffff80,%eax
  movabs $0x100000101,%rdx
  mov    %eax,%ecx
  shr    %cl,%rdx
  mov    %rdx,%rax
  and    $0x1,%eax
  test   %rax,%rax
  setne  %al
  test   %al,%al
  jne    L16
  jmp    L301
L504:
  mov    -0x28(%rbp),%rax
  add    $0x4,%rax
  mov    (%rax),%eax
  cmp    $0xe0,%eax
  je     L539
  mov    -0x28(%rbp),%rax
  add    $0x4,%rax
  mov    (%rax),%eax
  cmp    $0xd0,%eax
  je     L539
  mov    -0x28(%rbp),%rax
  add    $0x4,%rax
  mov    (%rax),%eax
  cmp    $0xc0,%eax
  je     L539
  mov    -0x28(%rbp),%rax
  add    $0x4,%rax
  mov    (%rax),%eax
  cmp    $0xb8,%eax
  jne    L95
L539:
  movb   $0x1,-0x12(%rbp)
  jmp    L95
L16:
  mov    -0x28(%rbp),%rax
  add    $0x4,%rax
  mov    (%rax),%eax
  cmp    $0xa0,%eax
  je     L308
  mov    -0x28(%rbp),%rax
  add    $0x4,%rax
  mov    (%rax),%eax
  cmp    $0x80,%eax
  je     L308
  mov    -0x28(%rbp),%rax
  add    $0x4,%rax
  mov    (%rax),%eax
  cmp    $0x88,%eax
  jne    L15
L308:
  movb   $0x1,-0x12(%rbp)
  jmp    L15
L177:
  mov    -0x28(%rbp),%rax
  add    $0x4,%rax
  mov    (%rax),%eax
  test   %eax,%eax
  je     L127
  mov    -0x28(%rbp),%rax
  add    $0x4,%rax
  mov    (%rax),%eax
  cmp    $0x60,%eax
  jne    L305
L127:
  movb   $0x1,-0x12(%rbp)
  jmp    L305
L537:
  mov    -0x28(%rbp),%rax
  add    $0x4,%rax
  mov    (%rax),%eax
  cmp    $0x20,%eax
  je     L237
  mov    -0x28(%rbp),%rax
  add    $0x4,%rax
  mov    (%rax),%eax
  cmp    $0x40,%eax
  jne    L500
L237:
  movb   $0x1,-0x12(%rbp)
  jmp    L500
L301:
  mov    -0x34(%rbp),%eax
  mov    %eax,%esi
  lea    D55(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L393
L95:
  nop
  jmp    L393
L15:
  nop
  jmp    L393
L305:
  nop
  jmp    L393
L500:
  nop
L393:
  cmpb   $0x0,-0x12(%rbp)
  jne    L55
  mov    -0x28(%rbp),%rax
  add    $0x4,%rax
  mov    (%rax),%eax
  cmp    $0xe0,%eax
  ja     L278
  cmp    $0xb8,%eax
  jae    L159
  cmp    $0xa0,%eax
  ja     L278
  cmp    $0x80,%eax
  jae    L142
  cmp    $0x60,%eax
  je     L404
  cmp    $0x60,%eax
  ja     L278
  cmp    $0x40,%eax
  je     L452
  cmp    $0x40,%eax
  ja     L278
  test   %eax,%eax
  je     L404
  cmp    $0x20,%eax
  je     L452
  jmp    L278
L159:
  sub    $0xb8,%eax
  movabs $0x10001000101,%rdx
  mov    %eax,%ecx
  shr    %cl,%rdx
  mov    %rdx,%rax
  and    $0x1,%eax
  test   %rax,%rax
  setne  %al
  test   %al,%al
  jne    L540
  jmp    L278
L142:
  add    $0xffffff80,%eax
  movabs $0x100000101,%rdx
  mov    %eax,%ecx
  shr    %cl,%rdx
  mov    %rdx,%rax
  and    $0x1,%eax
  test   %rax,%rax
  setne  %al
  test   %al,%al
  jne    L491
  jmp    L278
L540:
  lea    -0xc(%rbp),%rax
  lea    D28(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  jmp    L55
L491:
  lea    -0xc(%rbp),%rax
  lea    D77(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  jmp    L55
L404:
  lea    -0xc(%rbp),%rax
  lea    D56(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  jmp    L55
L452:
  lea    -0xc(%rbp),%rax
  lea    D29(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  jmp    L55
L278:
  mov    -0x28(%rbp),%rax
  add    $0x4,%rax
  mov    (%rax),%eax
  mov    %eax,%esi
  lea    D3(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L55:
  mov    -0x28(%rbp),%rax
  add    $0x28,%rax
  mov    (%rax),%eax
  mov    %eax,%eax
  cmp    %rax,-0x30(%rbp)
  sete   %al
  mov    %al,-0x11(%rbp)
  cmpb   $0x0,-0x11(%rbp)
  je     L66
  cmpb   $0x0,-0x12(%rbp)
  je     L66
  mov    $0x1,%eax
  jmp    L39
L66:
  mov    $0x0,%eax
L39:
  mov    %eax,-0x10(%rbp)
  cmpl   $0x0,-0x10(%rbp)
  jne    L197
  mov    -0x28(%rbp),%rax
  add    $0x4,%rax
  mov    (%rax),%ecx
  mov    -0x28(%rbp),%rax
  add    $0x28,%rax
  mov    (%rax),%eax
  mov    -0x34(%rbp),%esi
  mov    -0x30(%rbp),%rdx
  mov    %esi,%r8d
  mov    %eax,%esi
  lea    D24(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    -0xc(%rbp),%rax
  mov    %rax,%rsi
  lea    D14(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L197:
  mov    -0x10(%rbp),%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L585
  call   <__stack_chk_fail@plt>
L585:
  leave
  ret
```

tool_calls: name: parse_data
arguments: data_tag: D55
type_guessed: string
name: parse_data
arguments: data_tag: D28
type_guessed: string
name: parse_data
arguments: data_tag: D77
type_guessed: string
name: parse_data
arguments: data_tag: D56
type_guessed: string
name: parse_data
arguments: data_tag: D29
type_guessed: string
name: parse_data
arguments: data_tag: D3
type_guessed: string
name: parse_data
arguments: data_tag: D24
type_guessed: string
name: parse_data
arguments: data_tag: D14
type_guessed: string

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


tool: D28: VO

tool: D77: VI

tool: D56: BE

tool: D29: BK

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


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


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


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;
}
```