user: 请从给定的汇编指令推导出C源代码:

```asm
<dinfo_get_dev_from_blockdev>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  movl   $0x0,-0x20(%rbp)
  movq   $0x0,-0x10(%rbp)
  movq   $0x0,-0x18(%rbp)
  movl   $0x50,-0x1c(%rbp)
  mov    -0x1c(%rbp),%eax
  mov    %eax,%edi
  call   <dinfo_malloc@plt>
  mov    %rax,-0x10(%rbp)
  cmpq   $0x0,-0x10(%rbp)
  jne    L95
  mov    $0xffffffff,%eax
  jmp    L0
L95:
  mov    -0x28(%rbp),%rdx
  mov    -0x10(%rbp),%rax
  lea    D21(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <sprintf@plt>
  mov    -0x1c(%rbp),%eax
  mov    %eax,%edi
  call   <dinfo_malloc@plt>
  mov    %rax,-0x18(%rbp)
  cmpq   $0x0,-0x18(%rbp)
  jne    L83
  lea    D1(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0xffffffff,%eax
  jmp    L0
L83:
  mov    -0x10(%rbp),%rax
  lea    D20(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <fopen@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  jne    L82
  mov    $0xffffffff,%eax
  jmp    L0
L92:
  addl   $0x4f,-0x20(%rbp)
  mov    -0x20(%rbp),%eax
  add    $0x4f,%eax
  cmp    %eax,-0x1c(%rbp)
  jg     L82
  mov    -0x1c(%rbp),%eax
  lea    0x4f(%rax),%edx
  mov    -0x18(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <realloc@plt>
  mov    %rax,-0x18(%rbp)
  addl   $0x4f,-0x1c(%rbp)
L82:
  mov    -0x20(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdx
  mov    $0x50,%esi
  mov    %rcx,%rdi
  call   <fgets@plt>
  test   %rax,%rax
  je     L35
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cltq
  lea    -0x1(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0xa,%al
  jne    L92
L35:
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  mov    -0x1c(%rbp),%edx
  mov    -0x18(%rbp),%rcx
  mov    -0x30(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <dinfo_extract_dev@plt>
  test   %rax,%rax
  je     L25
  mov    $0xffffffff,%eax
  jmp    L0
L25:
  mov    $0x0,%eax
L0:
  leave
  ret
```

tool_calls: name: parse_data
arguments: label: D21
type_infered: string
name: parse_data
arguments: label: D1
type_infered: string
name: parse_data
arguments: label: D20
type_infered: string

tool: D21: /sys/block/%s/dev

tool: D1: Error: Not enough memory to allocate readbuffer


tool: D20: r

assistant: ```c
int dinfo_get_dev_from_blockdev(char *blockdev, dev_t *dev) {
  FILE *dasddev;
  int offset = 0;
  char *devfile = NULL;
  char *readbuf = NULL;
  int readbuflen = 80;
  if ((devfile = dinfo_malloc(readbuflen)) == NULL)
    return -1;
  sprintf(devfile, "/sys/block/%s/dev", blockdev);
  if ((readbuf = dinfo_malloc(readbuflen)) == NULL) {
    printf("Error: Not enough memory to allocate readbuffer\n");
    return -1;
  }
  if ((dasddev = fopen(devfile, "r")) == NULL)
    return -1;
  while (fgets(readbuf + offset, 80, dasddev) && readbuf[strlen(readbuf) - 1] != '\n') {
    offset += 80 - 1;
    if (offset + 80 - 1 >= readbuflen) {
      readbuf = realloc(readbuf, readbuflen + 80 - 1);
      readbuflen += 80 - 1;
    }
  }
  fclose(dasddev);
  if (dinfo_extract_dev(dev, readbuf, readbuflen) != 0)
    return -1;
  return 0;
}
```