user: Converte this assembly snippet into its equivalent C code:

```asm
<show_short_lun_info>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xb28,%rsp
  mov    %esi,%r8d
  mov    %edx,%r9d
  mov    %ecx,%r13d
  mov    %fs:0x28,%rax
  mov    %rax,0xb18(%rsp)
  xor    %eax,%eax
  movl   $0x0,0x8(%rsp)
  movl   $0x0,0xc(%rsp)
  lea    0x310(%rsp),%rax
  sub    $0x8,%rsp
  push   %rcx
  mov    %edi,%ecx
  lea    D29(%rip),%rdx
  mov    $0x400,%esi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <snprintf@plt>
  add    $0x10,%rsp
  cmp    $0x3ff,%eax
  jbe    L109
L86:
  mov    0xb18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L51
  add    $0xb28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L109:
  lea    0x210(%rsp),%rdx
  lea    0x310(%rsp),%rbx
  mov    $0x100,%ecx
  lea    D54(%rip),%rsi
  mov    %rbx,%rdi
  call   <sa_sys_read_line@plt>
  lea    0x110(%rsp),%rdx
  mov    $0x100,%ecx
  lea    D66(%rip),%rsi
  mov    %rbx,%rdi
  call   <sa_sys_read_line@plt>
  lea    0x10(%rsp),%rdx
  mov    $0x100,%ecx
  lea    D68(%rip),%rsi
  mov    %rbx,%rdi
  call   <sa_sys_read_line@plt>
  mov    %rbx,%rdi
  call   <strlen@plt>
  mov    $0x3ff,%edx
  sub    %eax,%edx
  lea    D92(%rip),%rsi
  mov    %rbx,%rdi
  call   <strncat@plt>
  mov    %rbx,%rdi
  call   <opendir@plt>
  mov    %rax,%rbp
  lea    D76(%rip),%r12
  lea    D98(%rip),%r14
  lea    D83(%rip),%r15
  test   %rax,%rax
  je     L86
L35:
  mov    %rbp,%rdi
  call   <readdir@plt>
  test   %rax,%rax
  je     L16
  mov    (%rax),%rbx
  cmpb   $0x2e,(%rbx)
  jne    L5
  movzbl 0x1(%rbx),%eax
  test   %al,%al
  je     L35
  cmp    $0x2e,%al
  je     L64
L5:
  lea    0x310(%rsp),%rcx
  lea    0x710(%rsp),%rdi
  mov    %rbx,%r8
  mov    %r14,%rdx
  mov    $0x400,%esi
  mov    $0x0,%eax
  call   <snprintf@plt>
  mov    %rbx,%r12
  cmp    $0x3ff,%eax
  ja     L35
  lea    0xc(%rsp),%rdx
  lea    0x710(%rsp),%r12
  mov    %r15,%rsi
  mov    %r12,%rdi
  call   <sa_sys_read_u64@plt>
  lea    0x310(%rsp),%rcx
  mov    %rbx,%r8
  lea    D73(%rip),%rdx
  mov    $0x400,%esi
  mov    %r12,%rdi
  mov    $0x0,%eax
  call   <snprintf@plt>
  mov    %rbx,%r12
  cmp    $0x3ff,%eax
  ja     L35
  lea    0x8(%rsp),%rdx
  lea    0x710(%rsp),%rdi
  lea    D23(%rip),%rsi
  call   <sa_sys_read_u32@plt>
  jmp    L35
L64:
  cmpb   $0x0,0x2(%rbx)
  jne    L5
  jmp    L35
L16:
  mov    %rbp,%rdi
  call   <closedir@plt>
  mov    0x8(%rsp),%esi
  mov    0xc(%rsp),%edi
  call   <format_capstr@plt>
  mov    %rax,%rbx
  lea    0x210(%rsp),%rax
  push   %rax
  lea    0x118(%rsp),%rax
  push   %rax
  lea    0x20(%rsp),%r9
  mov    0x18(%rsp),%r8d
  mov    %rbx,%rcx
  mov    %r12,%rdx
  mov    %r13d,%esi
  lea    D50(%rip),%rdi
  call   <printf@plt>
  mov    %rbx,%rdi
  call   <free@plt>
  add    $0x10,%rsp
  jmp    L86
L51:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: tag: D29
type_guessed: string
name: retrieve_data
arguments: tag: D54
type_guessed: string
name: retrieve_data
arguments: tag: D66
type_guessed: string
name: retrieve_data
arguments: tag: D68
type_guessed: string
name: retrieve_data
arguments: tag: D92
type_guessed: string
name: retrieve_data
arguments: tag: D76
type_guessed: string
name: retrieve_data
arguments: tag: D98
type_guessed: string
name: retrieve_data
arguments: tag: D83
type_guessed: string
name: retrieve_data
arguments: tag: D73
type_guessed: string
name: retrieve_data
arguments: tag: D23
type_guessed: string
name: retrieve_data
arguments: tag: D50
type_guessed: string

tool: D29: /sys/class/scsi_device/%u:%u:%u:%u/device/

tool: D54: rev

tool: D66: model

tool: D68: vendor

tool: D92: block

tool: D76: Unknown

tool: D98: %s/%s/

tool: D83: size

tool: D73: %s/%s/queue/

tool: D23: hw_sector_size

tool: D50: %10d  %-11s  %10s  %7d     %s %s (rev %s)


assistant: ```c
void show_short_lun_info(unsigned int hba, unsigned int port, unsigned int tgt, unsigned int lun) {
  struct dirent *dp;
  char vendor[256];
  char path[1024];
  char npath[1024];
  char model[256];
  char rev[256];
  DIR *dir;
  uint32_t blksize = 0;
  char *capstr = "Unknown";
  char *osname = "Unknown";
  uint64_t size = 0;
  int rc;
  rc = snprintf(path, sizeof(path), "/sys/class/scsi_device/%u:%u:%u:%u/device/", hba, port, tgt, lun);
  if (rc < 0 || (size_t)rc >= sizeof(path))
    return;
  sa_sys_read_line(path, "rev", rev, sizeof(rev));
  sa_sys_read_line(path, "model", model, sizeof(model));
  sa_sys_read_line(path, "vendor", vendor, sizeof(vendor));
  strncat(path, "block", sizeof(path) - strlen(path) - 1);
  dir = opendir(path);
  if (!dir)
    return;
  while ((dp = readdir(dir)) != NULL) {
    if (dp->d_name[0] == '.' && (dp->d_name[1] == '\0' || (dp->d_name[1] == '.' && dp->d_name[2] == '\0')))
      continue;
    osname = dp->d_name;
    rc = snprintf(npath, sizeof(npath), "%s/%s/", path, osname);
    if (rc < 0 || (size_t)rc >= sizeof(npath))
      continue;
    sa_sys_read_u64(npath, "size", &size);
    rc = snprintf(npath, sizeof(npath), "%s/%s/queue/", path, osname);
    if (rc < 0 || (size_t)rc >= sizeof(npath))
      continue;
    sa_sys_read_u32(npath, "hw_sector_size", &blksize);
  }
  closedir(dir);
  capstr = format_capstr(size, blksize);
  printf("%10d  %-11s  %10s  %7d     %s %s (rev %s)\n", lun, osname, capstr, blksize, vendor, model, rev);
  free(capstr);
  return;
}
```