user: Please show me the C implementation that matches the assembly code listed below:

```asm
<readMx>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdi,%r15
  mov    %rsi,%rbx
  mov    %rdx,0x8(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  cmpb   $0x5b,(%rsi)
  sete   %al
  movzbl %al,%eax
  add    %rax,%rbx
  cmpb   $0x0,(%rbx)
  je     L121
  mov    %ecx,%r12d
  mov    %rdx,%r14
  mov    $0x0,%ebp
  mov    $0x0,%r13d
  jmp    L235
L19:
  cmp    $0xc,%r12d
  jne    L166
  mov    %r14,%rdx
  lea    D28(%rip),%rsi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <sscanf@plt>
  mov    %eax,%r13d
L62:
  test   %r13d,%r13d
  je     L167
  movzbl (%rbx),%eax
  cmp    $0x5d,%al
  je     L246
  lea    -0x2d(%rax),%edx
  cmp    $0x1,%dl
  jbe    L94
  lea    -0x30(%rax),%edx
  cmp    $0x9,%dl
  ja     L118
L94:
  add    $0x1,%rbx
  movzbl (%rbx),%eax
  lea    -0x30(%rax),%edx
  cmp    $0x9,%dl
  jbe    L94
  lea    -0x2d(%rax),%edx
  cmp    $0x1,%dl
  jbe    L94
L118:
  cmp    $0x2c,%al
  je     L227
  cmp    $0x20,%al
  je     L227
L53:
  mov    0x4(%rsp),%eax
  add    $0x1,%eax
  mov    %eax,(%rsp)
  add    $0x1,%rbp
  add    $0x4,%r14
  cmpb   $0x0,(%rbx)
  je     L165
L235:
  mov    %ebp,0x4(%rsp)
  mov    %ebp,(%rsp)
  cmp    %ebp,(%r15)
  jle    L167
  cmp    $0x7,%r12d
  je     L137
  jg     L19
  cmp    $0x3,%r12d
  je     L142
  cmp    $0x6,%r12d
  jne    L166
  mov    0x8(%rsp),%rax
  lea    (%rax,%rbp,8),%rdx
  lea    D6(%rip),%rsi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <sscanf@plt>
  mov    %eax,%r13d
  jmp    L62
L137:
  mov    %r14,%rdx
  lea    D9(%rip),%rsi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <sscanf@plt>
  mov    %eax,%r13d
  jmp    L62
L142:
  lea    0x14(%rsp),%rdx
  lea    D28(%rip),%rsi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <sscanf@plt>
  mov    %eax,%r13d
  mov    0x14(%rsp),%eax
  mov    0x8(%rsp),%rcx
  mov    %al,(%rcx,%rbp,1)
  jmp    L62
L166:
  lea    D17(%rip),%rdi
  call   <ERROR@plt>
  jmp    L62
L227:
  add    $0x1,%rbx
  jmp    L53
L167:
  mov    %rbx,%rax
  cmpb   $0x5d,(%rbx)
  je     L246
L35:
  mov    (%rsp),%ecx
  mov    %ecx,(%r15)
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L203
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L246:
  lea    0x1(%rbx),%rax
  jmp    L35
L121:
  movl   $0x0,(%rsp)
L165:
  mov    %rbx,%rax
  jmp    L35
L203:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: label: D28
type: string
name: retrieve_data
arguments: label: D6
type: string
name: retrieve_data
arguments: label: D9
type: string
name: retrieve_data
arguments: label: D17
type: string

tool: D28: %d

tool: D6: %lf

tool: D9: %f

tool: D17: Unsupported data type

assistant: ```c
char *readMx(int *numel, char *datstr, void *data, int dtype) {
  char *cp = datstr;
  int i, nch = 0, tmp;
  if (*cp == '[')
    cp++;
  for (i = 0; *cp != 0 && i < *numel; i++) {
    switch (dtype) {
    case 12:
      nch = sscanf(cp, "%d", ((int *)data) + i);
      break;
    case 6:
      nch = sscanf(cp, "%lf", ((double *)data) + i);
      break;
    case 7:
      nch = sscanf(cp, "%f", ((float *)data) + i);
      break;
    case 3:
      nch = sscanf(cp, "%d", &tmp);
      ((char *)data)[i] = (char)tmp;
      break;
    default:
      ERROR("Unsupported data type");
    }
    if (nch == 0 || *cp == ']')
      break;
    for (; (*cp >= '0' && *cp <= '9') || *cp == '.' || *cp == '-'; cp++)
      ;
    if (*cp == ',' || *cp == ' ')
      cp++;
  }
  if (*cp == ']')
    cp++;
  *numel = i;
  return cp;
}
```