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

```asm
<mode>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %ecx,%eax
  mov    %edi,%ecx
  mov    %cl,-0x14(%rbp)
  mov    %esi,%ecx
  mov    %cl,-0x18(%rbp)
  mov    %dl,-0x1c(%rbp)
  mov    %al,-0x20(%rbp)
  mov    %r8d,%eax
  mov    %al,-0x24(%rbp)
  movsbl -0x18(%rbp),%eax
  mov    %eax,%edi
  call   <stox@plt>
  and    $0x4,%eax
  mov    %eax,-0xc(%rbp)
  movsbl -0x18(%rbp),%eax
  mov    %eax,%edi
  call   <stox@plt>
  and    $0x1,%eax
  mov    %eax,-0x8(%rbp)
  movsbl -0x1c(%rbp),%eax
  mov    %eax,%edi
  call   <stox@plt>
  mov    %al,-0x1c(%rbp)
  movsbl -0x24(%rbp),%eax
  mov    %eax,%edi
  call   <stox@plt>
  mov    %al,-0x24(%rbp)
  movsbl -0x14(%rbp),%eax
  mov    %eax,%edi
  call   <stox@plt>
  mov    %eax,-0x4(%rbp)
  movsbl -0x20(%rbp),%eax
  mov    %eax,%edi
  call   <stox@plt>
  mov    %al,-0x20(%rbp)
  cmpl   $0x5,-0x4(%rbp)
  ja     L400
  mov    -0x4(%rbp),%eax
  lea    0x0(,%rax,4),%rdx
  lea    D191(%rip),%rax
  mov    (%rdx,%rax,1),%eax
  cltq
  lea    D191(%rip),%rdx
  add    %rdx,%rax
  notrack jmp *%rax
  cmpl   $0x0,-0xc(%rbp)
  je     L370
  lea    D46(%rip),%rax
  jmp    L356
L370:
  lea    D9(%rip),%rax
  jmp    L356
  lea    D94(%rip),%rax
  jmp    L356
  lea    D10(%rip),%rax
  jmp    L356
  cmpl   $0x0,-0xc(%rbp)
  je     L116
  movsbl -0x24(%rbp),%eax
  cmp    $0x6,%eax
  je     L349
  cmp    $0x6,%eax
  jg     L6
  cmp    $0x4,%eax
  je     L174
  cmp    $0x4,%eax
  jg     L6
  test   %eax,%eax
  je     L387
  cmp    $0x2,%eax
  je     L113
  jmp    L6
L387:
  lea    D22(%rip),%rax
  jmp    L356
L113:
  lea    D227(%rip),%rax
  jmp    L356
L174:
  lea    D173(%rip),%rax
  jmp    L356
L349:
  lea    D72(%rip),%rax
  jmp    L356
L6:
  lea    D99(%rip),%rax
  jmp    L356
L116:
  movsbl -0x24(%rbp),%eax
  cmp    $0x6,%eax
  je     L31
  cmp    $0x6,%eax
  jg     L204
  cmp    $0x4,%eax
  je     L374
  cmp    $0x4,%eax
  jg     L204
  test   %eax,%eax
  je     L16
  cmp    $0x2,%eax
  je     L351
  jmp    L204
L16:
  lea    D118(%rip),%rax
  jmp    L356
L351:
  lea    D24(%rip),%rax
  jmp    L356
L374:
  lea    D29(%rip),%rax
  jmp    L356
L31:
  lea    D169(%rip),%rax
  jmp    L356
L204:
  lea    D140(%rip),%rax
  jmp    L356
  movsbl -0x1c(%rbp),%eax
  and    $0x8,%eax
  test   %eax,%eax
  je     L91
  lea    D78(%rip),%rax
  jmp    L356
L91:
  lea    D43(%rip),%rax
  jmp    L356
  cmpb   $0x4,-0x20(%rbp)
  jne    L364
  lea    D1(%rip),%rax
  jmp    L356
L364:
  cmpb   $0x5,-0x20(%rbp)
  jne    L361
  lea    D148(%rip),%rax
  jmp    L356
L361:
  cmpb   $0x6,-0x20(%rbp)
  jne    L59
  lea    D2(%rip),%rax
  jmp    L356
L59:
  lea    D4(%rip),%rax
  jmp    L356
L400:
  lea    D181(%rip),%rax
L356:
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: tag: D46
data_type: string
name: retrieve_data
arguments: tag: D9
data_type: string
name: retrieve_data
arguments: tag: D94
data_type: string
name: retrieve_data
arguments: tag: D10
data_type: string
name: retrieve_data
arguments: tag: D22
data_type: string
name: retrieve_data
arguments: tag: D227
data_type: string
name: retrieve_data
arguments: tag: D173
data_type: string
name: retrieve_data
arguments: tag: D72
data_type: string
name: retrieve_data
arguments: tag: D99
data_type: string
name: retrieve_data
arguments: tag: D118
data_type: string
name: retrieve_data
arguments: tag: D24
data_type: string
name: retrieve_data
arguments: tag: D29
data_type: string
name: retrieve_data
arguments: tag: D169
data_type: string
name: retrieve_data
arguments: tag: D140
data_type: string
name: retrieve_data
arguments: tag: D78
data_type: string
name: retrieve_data
arguments: tag: D43
data_type: string
name: retrieve_data
arguments: tag: D1
data_type: string
name: retrieve_data
arguments: tag: D148
data_type: string
name: retrieve_data
arguments: tag: D2
data_type: string
name: retrieve_data
arguments: tag: D4
data_type: string
name: retrieve_data
arguments: tag: D181
data_type: string

tool: D46: CW REV

tool: D9: CW

tool: D94: LSB

tool: D10: USB

tool: D22: DATA REV, data A

tool: D227: DATA REV, afsk A

tool: D173: DATA REV, fsk D

tool: D72: DATA REV, psk D

tool: D99: DATA REV, ???

tool: D118: DATA, data A

tool: D24: DATA, afsk A

tool: D29: DATA, fsk D

tool: D169: DATA, psk D

tool: D140: DATA, ???

tool: D78: AM-S

tool: D43: AM

tool: D1: FM

tool: D148: FM+

tool: D2: FM-

tool: D4: FM?

tool: D181: ?

assistant: ```c
const char *mode(char modeChar, char altChar, char flags7, char fmInfo, char dataMode) {
  int modeByte, revCw, revMode;
  revCw = stox(altChar) & 0x4;
  revMode = stox(altChar) & 0x1;
  flags7 = stox(flags7);
  dataMode = stox(dataMode);
  modeByte = stox(modeChar);
  fmInfo = stox(fmInfo);
  switch (modeByte) {
  case 0:
    return revCw ? "CW REV" : "CW";
  case 1:
    return "LSB";
  case 2:
    return "USB";
  case 3:
    if (revCw)
      switch (dataMode) {
      case 0:
        return "DATA REV, data A";
      case 2:
        return "DATA REV, afsk A";
      case 4:
        return "DATA REV, fsk D";
      case 6:
        return "DATA REV, psk D";
      default:
        return "DATA REV, ???";
      }
    else
      switch (dataMode) {
      case 0:
        return "DATA, data A";
      case 2:
        return "DATA, afsk A";
      case 4:
        return "DATA, fsk D";
      case 6:
        return "DATA, psk D";
      default:
        return "DATA, ???";
      }
  case 4:
    return flags7 & 0x8 ? "AM-S" : "AM";
  case 5:
    if (fmInfo == 0x04)
      return "FM";
    else if (fmInfo == 0x05)
      return "FM+";
    else if (fmInfo == 0x06)
      return "FM-";
    else {
      return "FM?";
    }
  default:
    return "?";
  }
}
```