user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<io_read>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x2,-0x28(%rbp)
  lea    -0x28(%rbp),%rax
  mov    %rax,%rsi
  lea    D8(%rip),%rax
  mov    %rax,%rdi
  call   <getfileparam@plt>
  mov    %rax,-0x18(%rbp)
  mov    -0x28(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x28(%rbp)
  mov    $0x0,%edx
  lea    D21(%rip),%rcx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <luaL_opt_lstr@plt>
  mov    %rax,-0x20(%rbp)
L95:
  mov    $0x0,%eax
  call   <luaL_resetbuffer@plt>
  mov    -0x20(%rbp),%rax
  lea    D15(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <luaL_findstring@plt>
  cmp    $0x4,%eax
  je     L106
  cmp    $0x4,%eax
  jg     L179
  cmp    $0x3,%eax
  jg     L179
  cmp    $0x2,%eax
  jge    L131
  test   %eax,%eax
  je     L32
  cmp    $0x1,%eax
  je     L68
  jmp    L179
L32:
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <read_number@plt>
  test   %eax,%eax
  jne    L138
  jmp    L5
L68:
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <read_line@plt>
  mov    %eax,-0x24(%rbp)
  jmp    L44
L131:
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <read_file@plt>
  movl   $0x1,-0x24(%rbp)
  jmp    L44
L106:
  mov    -0x18(%rbp),%rax
  lea    D12(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <read_pattern@plt>
  mov    %eax,-0x24(%rbp)
  jmp    L44
L179:
  mov    -0x20(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <read_pattern@plt>
  mov    %eax,-0x24(%rbp)
L44:
  mov    $0x0,%eax
  call   <luaL_getsize@plt>
  mov    %rax,-0x10(%rbp)
  cmpl   $0x0,-0x24(%rbp)
  jne    L176
  cmpq   $0x0,-0x10(%rbp)
  je     L125
L176:
  mov    $0x0,%eax
  call   <luaL_buffer@plt>
  mov    %eax,%edx
  mov    -0x10(%rbp),%rax
  mov    %rax,%rsi
  mov    %edx,%edi
  call   <lua_pushlstring@plt>
  jmp    L136
L138:
  nop
L136:
  mov    -0x28(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x28(%rbp)
  mov    $0x0,%edx
  mov    $0x0,%esi
  mov    %eax,%edi
  call   <luaL_opt_lstr@plt>
  mov    %rax,-0x20(%rbp)
  cmpq   $0x0,-0x20(%rbp)
  jne    L95
  jmp    L5
L125:
  nop
L5:
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L31
  call   <__stack_chk_fail@plt>
L31:
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: label: D8
type: string
name: retrieve_data
arguments: label: D21
type: string
name: retrieve_data
arguments: label: D12
type: string

tool: D8: _INPUT

tool: D21: *l

tool: D12: {%s*}%S+

assistant: ```c
void io_read(void) {
  static char *options[] = {"*n", "*l", "*a", ".*", "*w", NULL};
  int arg = 2;
  FILE *f = getfileparam("_INPUT", &arg);
  char *p = (luaL_opt_lstr((arg++), ("*l"), NULL));
  do {
    long l;
    int success;
    luaL_resetbuffer();
    switch (luaL_findstring(p, options)) {
    case 0:
      if (!read_number(f))
        return;
      continue;
    case 1:
      success = read_line(f);
      break;
    case 2:
    case 3:
      read_file(f);
      success = 1;
      break;
    case 4:
      success = read_pattern(f, "{%s*}%S+");
      break;
    default:
      success = read_pattern(f, p);
    }
    l = luaL_getsize();
    if (!success && l == 0)
      return;
    lua_pushlstring(luaL_buffer(), l);
  } while ((p = (luaL_opt_lstr((arg++), (NULL), NULL))) != NULL);
}
```