user: 请将以下的汇编代码转换成C语言代码:

```asm
<try_name>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  lea    -0x20000(%rsp),%r11
L60:
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  cmp    %r11,%rsp
  jne    L60
  sub    $0x50,%rsp
  mov    %rdi,-0x20048(%rbp)
  mov    %esi,-0x2004c(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x20048(%rbp),%rdx
  lea    -0x20010(%rbp),%rax
  mov    %rdx,%rcx
  lea    D9(%rip),%rdx
  mov    $0x10000,%esi
  mov    %rax,%rdi
  call   <snprintf@plt>
  lea    -0x20010(%rbp),%rax
  mov    $0x0,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <open@plt>
  mov    %eax,-0x20034(%rbp)
  cmpl   $0x0,-0x20034(%rbp)
  js     L64
  lea    -0x10010(%rbp),%rcx
  mov    -0x20034(%rbp),%eax
  mov    $0x10000,%edx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <read@plt>
  mov    %eax,-0x20030(%rbp)
  mov    -0x20034(%rbp),%eax
  mov    %eax,%edi
  call   <close@plt>
  cmpl   $0x0,-0x20030(%rbp)
  jle    L107
  cmpl   $0x10000,-0x20030(%rbp)
  je     L107
  mov    -0x20030(%rbp),%eax
  sub    $0x1,%eax
  cltq
  movzbl -0x10010(%rbp,%rax,1),%eax
  cmp    $0xa,%al
  jne    L107
  mov    -0x20030(%rbp),%eax
  sub    $0x1,%eax
  cltq
  movb   $0x0,-0x10010(%rbp,%rax,1)
  lea    -0x20020(%rbp),%rcx
  lea    -0x10010(%rbp),%rax
  mov    $0xa,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strtoul@plt>
  mov    %eax,-0x2002c(%rbp)
  mov    -0x20020(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x3a,%al
  jne    L130
  mov    -0x20020(%rbp),%rax
  lea    0x1(%rax),%rcx
  lea    -0x20020(%rbp),%rax
  mov    $0xa,%edx
  mov    %rax,%rsi
  mov    %rcx,%rdi
  call   <strtoul@plt>
  mov    %eax,-0x20028(%rbp)
  mov    -0x20020(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L53
  mov    -0x20028(%rbp),%edx
  mov    -0x2002c(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <makedev@plt>
  mov    %rax,-0x20018(%rbp)
  cmpl   $0x0,-0x2004c(%rbp)
  jne    L221
  mov    -0x20018(%rbp),%rax
  jmp    L34
L221:
  mov    -0x20048(%rbp),%rdx
  lea    -0x20010(%rbp),%rax
  mov    %rdx,%rcx
  lea    D29(%rip),%rdx
  mov    $0x10000,%esi
  mov    %rax,%rdi
  call   <snprintf@plt>
  lea    -0x20010(%rbp),%rax
  mov    $0x0,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <open@plt>
  mov    %eax,-0x20034(%rbp)
  cmpl   $0x0,-0x20034(%rbp)
  js     L210
  lea    -0x10010(%rbp),%rcx
  mov    -0x20034(%rbp),%eax
  mov    $0x20,%edx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <read@plt>
  mov    %eax,-0x20030(%rbp)
  mov    -0x20034(%rbp),%eax
  mov    %eax,%edi
  call   <close@plt>
  cmpl   $0x0,-0x20030(%rbp)
  jle    L7
  cmpl   $0x20,-0x20030(%rbp)
  je     L7
  mov    -0x20030(%rbp),%eax
  sub    $0x1,%eax
  cltq
  movzbl -0x10010(%rbp,%rax,1),%eax
  cmp    $0xa,%al
  jne    L7
  mov    -0x20030(%rbp),%eax
  sub    $0x1,%eax
  cltq
  movb   $0x0,-0x10010(%rbp,%rax,1)
  lea    -0x20020(%rbp),%rcx
  lea    -0x10010(%rbp),%rax
  mov    $0xa,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strtoul@plt>
  mov    %eax,-0x20024(%rbp)
  mov    -0x20020(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L181
  mov    -0x2004c(%rbp),%eax
  cmp    -0x20024(%rbp),%eax
  jge    L216
  mov    -0x2004c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x20018(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,%rdi
  call   <bdevname@plt>
  mov    %rax,%rcx
  mov    -0x2004c(%rbp),%edx
  mov    -0x20048(%rbp),%rax
  mov    %rax,%rsi
  lea    D27(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    -0x2004c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x20018(%rbp),%rax
  add    %rdx,%rax
  jmp    L34
L64:
  nop
  jmp    L114
L107:
  nop
  jmp    L114
L130:
  nop
  jmp    L114
L53:
  nop
  jmp    L114
L210:
  nop
  jmp    L114
L7:
  nop
  jmp    L114
L181:
  nop
  jmp    L114
L216:
  nop
L114:
  mov    $0x0,%eax
L34:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L217
  call   <__stack_chk_fail@plt>
L217:
  leave
  ret
```

tool_calls: name: unpack_data
arguments: data_label: D9
type: string
name: unpack_data
arguments: data_label: D29
type: string
name: unpack_data
arguments: data_label: D27
type: string

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

tool: D29: /sys/block/%s/range

tool: D27: kinit: try_name %s,%d = %s


assistant: ```c
dev_t try_name(char *name, int part) {
  char path[65536];
  char buf[65536];
  int range;
  unsigned int major, minor;
  dev_t res;
  char *s;
  int len;
  int fd;
  snprintf(path, sizeof(path), "/sys/block/%s/dev", name);
  fd = open(path, 0, 0);
  if (fd < 0)
    goto fail;
  len = read(fd, buf, 65536);
  close(fd);
  if (len <= 0 || len == 65536 || buf[len - 1] != '\n')
    goto fail;
  buf[len - 1] = '\0';
  major = strtoul(buf, &s, 10);
  if (*s != ':')
    goto fail;
  minor = strtoul(s + 1, &s, 10);
  if (*s)
    goto fail;
  res = makedev(major, minor);
  if (!part)
    return res;
  snprintf(path, sizeof(path), "/sys/block/%s/range", name);
  fd = open(path, 0, 0);
  if (fd < 0)
    goto fail;
  len = read(fd, buf, 32);
  close(fd);
  if (len <= 0 || len == 32 || buf[len - 1] != '\n')
    goto fail;
  buf[len - 1] = '\0';
  range = strtoul(buf, &s, 10);
  if (*s)
    goto fail;
  if (part < range) {
    printf("kinit: try_name %s,%d = %s\n", name, part, bdevname(res + part));
    return res + part;
  }
fail:
  return (dev_t)0;
}
```