user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<get_slot_info>:
  endbr64
  push   %r15
  mov    %edi,%r15d
  push   %r14
  mov    %esi,%r14d
  push   %r13
  push   %r12
  lea    D33(%rip),%r12
  push   %rbp
  mov    %r12,%rdi
  push   %rbx
  mov    %rdx,%rbx
  lea    D82(%rip),%rdx
  sub    $0x38,%rsp
  mov    %rcx,0x8(%rsp)
  mov    %esi,%ecx
  mov    $0x400,%esi
  mov    %r8,0x10(%rsp)
  mov    %r9,(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  call   <snprintf@plt>
  test   %eax,%eax
  js     L20
  mov    %eax,%edx
  mov    %r12,%rsi
  mov    %r15d,%edi
  mov    %eax,%r13d
  call   <write@plt>
  test   %eax,%eax
  js     L117
  cmp    %eax,%r13d
  jne    L20
  mov    $0x400,%edx
  mov    %r12,%rsi
  mov    %r15d,%edi
  call   <read@plt>
  mov    %eax,0x1c(%rsp)
  test   %eax,%eax
  js     L19
  lea    0x20(%rsp),%r13
  lea    D48(%rip),%rbp
  mov    %r12,0x20(%rsp)
  mov    %r13,%rdi
  mov    %rbp,%rsi
  call   <strsep@plt>
  mov    %rax,%rdi
  test   %rax,%rax
  je     L31
  call   <atoi@plt>
  cmp    %r14d,%eax
  jne    L31
  mov    %rbp,%rsi
  mov    %r13,%rdi
  call   <strsep@plt>
  mov    %rax,%r14
  test   %rax,%rax
  je     L31
  mov    %rbp,%rsi
  mov    %r13,%rdi
  call   <strsep@plt>
  mov    %rax,%r15
  test   %rax,%rax
  je     L31
  mov    %r13,%rdi
  mov    %rbp,%rsi
  call   <strsep@plt>
  mov    %rax,%r13
  test   %rax,%rax
  je     L31
  mov    (%rsp),%rdx
  mov    0x20(%rsp),%rdi
  lea    D72(%rip),%rsi
  call   <sscanf@plt>
  cmp    $0x1,%eax
  jne    L31
  mov    0x20(%rsp),%rdi
  test   %rdi,%rdi
  je     L191
  mov    $0x7e,%esi
  call   <strchr@plt>
  test   %rax,%rax
  jne    L31
L191:
  mov    %r14,%rdi
  call   <strdup@plt>
  mov    %rax,(%rbx)
  test   %rax,%rax
  je     L58
  mov    %r15,%rdi
  call   <strdup@plt>
  mov    0x8(%rsp),%r15
  mov    %rax,(%r15)
  test   %rax,%rax
  je     L58
  mov    %r13,%rdi
  call   <strdup@plt>
  mov    0x10(%rsp),%rcx
  mov    %rax,(%rcx)
  test   %rax,%rax
  je     L58
  cmpq   $0x0,(%rbx)
  je     L58
  cmpq   $0x0,(%r15)
  je     L58
  xor    %eax,%eax
L160:
  mov    0x28(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L162
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L31:
  mov    0x1c(%rsp),%edx
  mov    %r12,%rcx
  lea    D10(%rip),%rsi
  xor    %edi,%edi
  xor    %eax,%eax
  call   <warnc@plt>
  mov    $0xffffffff,%eax
  jmp    L160
  xchg   %ax,%ax
L20:
  lea    D26(%rip),%rsi
  xor    %edi,%edi
  xor    %eax,%eax
  call   <warnc@plt>
  mov    $0xffffffff,%eax
  jmp    L160
L19:
  lea    D89(%rip),%rdi
  call   <warn@plt>
  mov    $0xffffffff,%eax
  jmp    L160
L58:
  lea    D86(%rip),%rdi
  call   <warn@plt>
  mov    $0xffffffff,%eax
  jmp    L160
L117:
  lea    D26(%rip),%rdi
  call   <warn@plt>
  mov    $0xffffffff,%eax
  jmp    L160
L162:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_label: D82
type_guessed: string
name: parse_data
arguments: data_label: D48
type_guessed: string
name: parse_data
arguments: data_label: D72
type_guessed: string
name: parse_data
arguments: data_label: D10
type_guessed: string
name: parse_data
arguments: data_label: D26
type_guessed: string
name: parse_data
arguments: data_label: D89
type_guessed: string
name: parse_data
arguments: data_label: D86
type_guessed: string

tool: D82: N%d

tool: D48: ~

tool: D72: %1d

tool: D10: Invalid response: %*s

tool: D26: write

tool: D89: read

tool: D86: strdup

assistant: ```c
int get_slot_info(int so, int slot, char **manuf, char **version, char **device, int *state) {
  int rc = -1;
  int rv;
  static char buf[1024];
  int slen;
  char *s;
  char *sl;
  char *_manuf;
  char *_version;
  char *_device;
  if ((slen = snprintf(buf, sizeof buf, "N%d", slot)) < 0) {
    warnc(0, "write");
    goto err;
  }
  if ((rv = write(so, buf, slen)) < 0) {
    warn("write");
    goto err;
  } else if (rv != slen) {
    warnc(0, "write");
    goto err;
  }
  if ((rv = read(so, buf, sizeof buf)) < 0) {
    warn("read");
    goto err;
  }
  s = buf;
  if ((sl = strsep(&s, "~")) == NULL)
    goto parse_err;
  if (atoi(sl) != slot)
    goto parse_err;
  if ((_manuf = strsep(&s, "~")) == NULL)
    goto parse_err;
  if ((_version = strsep(&s, "~")) == NULL)
    goto parse_err;
  if ((_device = strsep(&s, "~")) == NULL)
    goto parse_err;
  if (sscanf(s, "%1d", state) != 1)
    goto parse_err;
  if (s != NULL && strchr(s, '~') != NULL)
    goto parse_err;
  if ((*manuf = strdup(_manuf)) == NULL) {
    warn("strdup");
    goto err;
  }
  if ((*version = strdup(_version)) == NULL) {
    warn("strdup");
    goto err;
  }
  if ((*device = strdup(_device)) == NULL) {
    warn("strdup");
    goto err;
  }
  if (*manuf == NULL || *version == NULL || *device == NULL) {
    warn("strdup");
    goto err;
  }
  rc = 0;
err:
  return rc;
parse_err:
  warnc(0, "Invalid response: %*s", rv, buf);
  return rc;
}
```