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

```asm
<try_name>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  lea    -0x20000(%rsp),%r11
L152:
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  cmp    %r11,%rsp
  jne    L152
  sub    $0x38,%rsp
  lea    D14(%rip),%rdx
  mov    %esi,0xc(%rsp)
  lea    0x20(%rsp),%r14
  mov    %rdi,%rcx
  mov    %rdi,%r12
  mov    $0x10000,%esi
  mov    %r14,%rdi
  mov    %fs:0x28,%rax
  mov    %rax,0x20028(%rsp)
  xor    %eax,%eax
  call   <snprintf@plt>
  xor    %edx,%edx
  xor    %esi,%esi
  mov    %r14,%rdi
  call   <open@plt>
  test   %eax,%eax
  js     L138
  lea    0x10020(%rsp),%r13
  mov    %eax,%edi
  mov    $0x10000,%edx
  mov    %eax,%ebp
  mov    %r13,%rsi
  call   <read@plt>
  mov    %ebp,%edi
  mov    %eax,%ebx
  call   <close@plt>
  test   %ebx,%ebx
  jle    L138
  cmp    $0x10000,%ebx
  je     L138
  sub    $0x1,%ebx
  movslq %ebx,%rbx
  cmpb   $0xa,0x10020(%rsp,%rbx,1)
  je     L68
L138:
  xor    %r15d,%r15d
L151:
  mov    0x20028(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L131
  add    $0x20038,%rsp
  mov    %r15,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  xchg   %ax,%ax
L68:
  lea    0x18(%rsp),%rbp
  mov    %r13,%rdi
  mov    $0xa,%edx
  movb   $0x0,0x10020(%rsp,%rbx,1)
  mov    %rbp,%rsi
  call   <strtoul@plt>
  mov    0x18(%rsp),%rdi
  mov    %rax,%rbx
  cmpb   $0x3a,(%rdi)
  jne    L138
  add    $0x1,%rdi
  mov    $0xa,%edx
  mov    %rbp,%rsi
  call   <strtoul@plt>
  mov    0x18(%rsp),%rdx
  cmpb   $0x0,(%rdx)
  jne    L138
  mov    %eax,%esi
  mov    %ebx,%edi
  call   <makedev@plt>
  mov    %rax,%r15
  mov    0xc(%rsp),%eax
  test   %eax,%eax
  je     L151
  mov    %r12,%rcx
  lea    D4(%rip),%rdx
  mov    $0x10000,%esi
  mov    %r14,%rdi
  call   <snprintf@plt>
  xor    %edx,%edx
  xor    %esi,%esi
  mov    %r14,%rdi
  call   <open@plt>
  mov    %eax,%r12d
  test   %eax,%eax
  js     L138
  mov    %eax,%edi
  mov    $0x20,%edx
  mov    %r13,%rsi
  call   <read@plt>
  mov    %r12d,%edi
  mov    %eax,%ebx
  call   <close@plt>
  test   %ebx,%ebx
  jle    L138
  cmp    $0x20,%ebx
  je     L138
  lea    -0x1(%rbx),%eax
  cltq
  cmpb   $0xa,0x10020(%rsp,%rax,1)
  jne    L138
  mov    $0xa,%edx
  mov    %rbp,%rsi
  mov    %r13,%rdi
  movb   $0x0,0x10020(%rsp,%rax,1)
  call   <strtoul@plt>
  mov    0x18(%rsp),%rdx
  cmpb   $0x0,(%rdx)
  jne    L138
  cmp    %eax,0xc(%rsp)
  jge    L138
  movslq 0xc(%rsp),%r13
  add    %r13,%r15
  jmp    L151
L131:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: data_tag: D14
datatype: string
name: unpack_data
arguments: data_tag: D4
datatype: string

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

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

assistant: ```c
dev_t try_name(char *name, int part) {
  char path[65536];
  char buf[65536];
  int range;
  unsigned int major_num, minor_num;
  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_num = strtoul(buf, &s, 10);
  if (*s != ':')
    goto fail;
  minor_num = strtoul(s + 1, &s, 10);
  if (*s)
    goto fail;
  res = makedev(major_num, minor_num);
  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) {
    ((void)0);
    return res + part;
  }
fail:
  return (dev_t)0;
}
```