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

```asm
<dir_info>:
  endbr64
  push   %r15
  xor    %r9d,%r9d
  xor    %r8d,%r8d
  xor    %ecx,%ecx
  push   %r14
  mov    %rsi,%r14
  xor    %edx,%edx
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %edi,%ebx
  mov    %r14,%rdi
  sub    $0x98,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x88(%rsp)
  xor    %eax,%eax
  lea    0x2c(%rsp),%rsi
  call   <open_master_conn@plt>
  test   %eax,%eax
  js     L13
  lea    0x30(%rsp),%rbp
  lea    0x40(%rsp),%r12
  mov    $0x1ce,%esi
  mov    %eax,%r13d
  mov    %rbp,%rdi
  mov    %r12,0x30(%rsp)
  call   <put32bit@plt>
  mov    $0x8,%esi
  mov    %rbp,%rdi
  call   <put32bit@plt>
  xor    %esi,%esi
  mov    %rbp,%rdi
  call   <put32bit@plt>
  mov    0x2c(%rsp),%esi
  mov    %rbp,%rdi
  call   <put32bit@plt>
  mov    $0x2710,%ecx
  mov    %r12,%rsi
  mov    %r13d,%edi
  mov    $0x10,%edx
  call   <tcptowrite@plt>
  cmp    $0x10,%eax
  jne    L148
  mov    $0x2710,%ecx
  mov    $0x8,%edx
  mov    %r12,%rsi
  mov    %r13d,%edi
  call   <tcptoread@plt>
  cmp    $0x8,%eax
  jne    L60
  lea    0x38(%rsp),%rbp
  mov    %r12,0x38(%rsp)
  mov    %rbp,%rdi
  call   <get32bit@plt>
  mov    %rbp,%rdi
  mov    %eax,%r12d
  call   <get32bit@plt>
  mov    %eax,%r15d
  cmp    $0x1cf,%r12d
  jne    L209
  mov    %eax,%edi
  call   <malloc@plt>
  mov    $0x2710,%ecx
  mov    %r15d,%edx
  mov    %r13d,%edi
  mov    %rax,%rsi
  mov    %rax,%r12
  call   <tcptoread@plt>
  cmp    %r15d,%eax
  jne    L324
  mov    %rbp,%rdi
  mov    %eax,0xc(%rsp)
  mov    %r12,0x38(%rsp)
  call   <get32bit@plt>
  mov    0xc(%rsp),%edx
  test   %eax,%eax
  mov    %eax,%r13d
  jne    L318
  lea    -0x4(%rdx),%r15d
  cmp    $0x5,%edx
  je     L52
  and    $0xffffffef,%edx
  cmp    $0x2c,%edx
  jne    L210
  xor    %edi,%edi
  call   <close_master_conn@plt>
  mov    %rbp,%rdi
  call   <get32bit@plt>
  mov    %rbp,%rdi
  mov    %eax,0xc(%rsp)
  call   <get32bit@plt>
  mov    %rbp,%rdi
  mov    %eax,0x10(%rsp)
  call   <get32bit@plt>
  mov    %eax,0x14(%rsp)
  cmp    $0x38,%r15d
  je     L244
  mov    %rbp,%rdi
  call   <get32bit@plt>
  mov    %eax,0x1c(%rsp)
L192:
  mov    %rbp,%rdi
  call   <get64bit@plt>
  mov    %rbp,%rdi
  mov    %eax,%r15d
  call   <get64bit@plt>
  mov    %rbp,%rdi
  mov    %eax,0x18(%rsp)
  call   <get64bit@plt>
  mov    %r12,%rdi
  mov    %eax,%ebp
  call   <free@plt>
  test   %ebx,%ebx
  je     L49
  test   $0x1,%bl
  jne    L205
  test   $0x2,%bl
  jne    L101
L37:
  test   $0x4,%bl
  jne    L43
L189:
  test   $0x8,%bl
  jne    L226
L169:
  test   $0x10,%bl
  jne    L284
L234:
  test   $0x20,%bl
  jne    L176
L161:
  and    $0x40,%ebx
  jne    L253
L107:
  mov    %r14,%rdi
  call   <puts@plt>
L241:
  mov    0x88(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L312
  add    $0x98,%rsp
  mov    %r13d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L244:
  mov    %rbp,%rdi
  addq   $0x20,0x38(%rsp)
  call   <get32bit@plt>
  addq   $0x20,0x38(%rsp)
  mov    %eax,0x1c(%rsp)
  jmp    L192
  nopl   (%rax)
L49:
  mov    %r14,%rsi
  lea    D119(%rip),%rdi
  xor    %eax,%eax
  xor    %r13d,%r13d
  call   <printf@plt>
  mov    0xc(%rsp),%edx
  xor    %r8d,%r8d
  xor    %ecx,%ecx
  lea    D78(%rip),%r12
  mov    $0x1,%r9d
  lea    D83(%rip),%rdi
  mov    %r12,%rsi
  call   <print_number@plt>
  mov    0x10(%rsp),%edx
  xor    %r8d,%r8d
  xor    %ecx,%ecx
  mov    $0x1,%r9d
  mov    %r12,%rsi
  lea    D89(%rip),%rdi
  call   <print_number@plt>
  mov    0x14(%rsp),%edx
  xor    %r8d,%r8d
  xor    %ecx,%ecx
  mov    $0x1,%r9d
  mov    %r12,%rsi
  lea    D60(%rip),%rdi
  call   <print_number@plt>
  mov    0x1c(%rsp),%edx
  xor    %r8d,%r8d
  xor    %ecx,%ecx
  mov    $0x1,%r9d
  mov    %r12,%rsi
  lea    D92(%rip),%rdi
  call   <print_number@plt>
  mov    $0x1,%r9d
  xor    %ecx,%ecx
  mov    %r15d,%edx
  mov    $0x1,%r8d
  mov    %r12,%rsi
  lea    D113(%rip),%rdi
  call   <print_number@plt>
  mov    0x18(%rsp),%edx
  xor    %ecx,%ecx
  mov    %r12,%rsi
  mov    $0x1,%r9d
  mov    $0x1,%r8d
  lea    D15(%rip),%rdi
  call   <print_number@plt>
  mov    $0x1,%r9d
  xor    %ecx,%ecx
  mov    %ebp,%edx
  mov    $0x1,%r8d
  mov    %r12,%rsi
  lea    D152(%rip),%rdi
  call   <print_number@plt>
  jmp    L241
  nopl   0x0(%rax,%rax,1)
L253:
  mov    %ebp,%edi
  mov    $0x1,%esi
  call   <print_number_only@plt>
  mov    $0x9,%edi
  call   <putchar@plt>
  jmp    L107
  nopl   0x0(%rax,%rax,1)
L205:
  mov    0xc(%rsp),%edi
  xor    %esi,%esi
  call   <print_number_only@plt>
  mov    $0x9,%edi
  call   <putchar@plt>
  test   $0x2,%bl
  je     L37
L101:
  mov    0x10(%rsp),%edi
  xor    %esi,%esi
  call   <print_number_only@plt>
  mov    $0x9,%edi
  call   <putchar@plt>
  test   $0x4,%bl
  je     L189
L43:
  mov    0x14(%rsp),%edi
  xor    %esi,%esi
  call   <print_number_only@plt>
  mov    $0x9,%edi
  call   <putchar@plt>
  test   $0x8,%bl
  je     L169
L226:
  mov    0x1c(%rsp),%edi
  xor    %esi,%esi
  call   <print_number_only@plt>
  mov    $0x9,%edi
  call   <putchar@plt>
  test   $0x10,%bl
  je     L234
L284:
  mov    %r15d,%edi
  mov    $0x1,%esi
  call   <print_number_only@plt>
  mov    $0x9,%edi
  call   <putchar@plt>
  test   $0x20,%bl
  je     L161
L176:
  mov    0x18(%rsp),%edi
  mov    $0x1,%esi
  call   <print_number_only@plt>
  mov    $0x9,%edi
  call   <putchar@plt>
  and    $0x40,%ebx
  je     L107
  jmp    L253
  xchg   %ax,%ax
L148:
  mov    %r14,%rsi
  lea    D38(%rip),%rdi
L26:
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0x1,%edi
  call   <close_master_conn@plt>
L13:
  mov    $0xffffffff,%r13d
  jmp    L241
  cs nopw 0x0(%rax,%rax,1)
L60:
  mov    %r14,%rsi
  lea    D80(%rip),%rdi
  jmp    L26
  nopl   0x0(%rax)
L209:
  mov    %r14,%rsi
  lea    D81(%rip),%rdi
  jmp    L26
  nopl   0x0(%rax)
L324:
  mov    %r14,%rsi
  lea    D80(%rip),%rdi
L263:
  xor    %eax,%eax
  call   <printf@plt>
L24:
  mov    %r12,%rdi
  mov    $0xffffffff,%r13d
  call   <free@plt>
  mov    $0x1,%edi
  call   <close_master_conn@plt>
  jmp    L241
L210:
  mov    %r14,%rsi
  lea    D135(%rip),%rdi
  jmp    L263
L318:
  mov    %r14,%rsi
  lea    D131(%rip),%rdi
  jmp    L263
L52:
  mov    0x38(%rsp),%rax
  mov    (%rax),%edi
  call   <mfsstrerr@plt>
  mov    %r14,%rsi
  lea    D50(%rip),%rdi
  mov    %rax,%rdx
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L24
L312:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: label: D119
type_guessed: string
name: extract_symbolic_data
arguments: label: D78
type_guessed: string
name: extract_symbolic_data
arguments: label: D83
type_guessed: string
name: extract_symbolic_data
arguments: label: D89
type_guessed: string
name: extract_symbolic_data
arguments: label: D60
type_guessed: string
name: extract_symbolic_data
arguments: label: D92
type_guessed: string
name: extract_symbolic_data
arguments: label: D113
type_guessed: string
name: extract_symbolic_data
arguments: label: D15
type_guessed: string
name: extract_symbolic_data
arguments: label: D152
type_guessed: string
name: extract_symbolic_data
arguments: label: D38
type_guessed: string
name: extract_symbolic_data
arguments: label: D80
type_guessed: string
name: extract_symbolic_data
arguments: label: D81
type_guessed: string
name: extract_symbolic_data
arguments: label: D135
type_guessed: string
name: extract_symbolic_data
arguments: label: D131
type_guessed: string
name: extract_symbolic_data
arguments: label: D50
type_guessed: string

tool: D119: %s:


tool: D78: 


tool: D83:  inodes:       

tool: D89:   directories: 

tool: D60:   files:       

tool: D92:  chunks:       

tool: D113:  length:       

tool: D15:  size:         

tool: D152:  realsize:     

tool: D38: %s: master query: send error


tool: D80: %s: master query: receive error


tool: D81: %s: master query: wrong answer (type)


tool: D135: %s: master query: wrong answer (leng)


tool: D131: %s: master query: wrong answer (queryid)


tool: D50: %s: %s


assistant: ```c
int dir_info(uint8_t dirinfomode, const char *fname) {
  uint8_t reqbuff[16], *wptr, *buff;
  const uint8_t *rptr;
  uint32_t cmd, leng, inode;
  uint32_t inodes, dirs, files, chunks;
  uint64_t length, size, realsize;
  int fd;
  fd = open_master_conn(fname, &inode, NULL, NULL, 0, 0);
  if (fd < 0) {
    return -1;
  }
  wptr = reqbuff;
  put32bit(&wptr, (0 + 462));
  put32bit(&wptr, 8);
  put32bit(&wptr, 0);
  put32bit(&wptr, inode);
  if (tcptowrite(fd, reqbuff, 16, 10000) != 16) {
    printf("%s: master query: send error\n", fname);
    close_master_conn(1);
    return -1;
  }
  if (tcptoread(fd, reqbuff, 8, 10000) != 8) {
    printf("%s: master query: receive error\n", fname);
    close_master_conn(1);
    return -1;
  }
  rptr = reqbuff;
  cmd = get32bit(&rptr);
  leng = get32bit(&rptr);
  if (cmd != (0 + 463)) {
    printf("%s: master query: wrong answer (type)\n", fname);
    close_master_conn(1);
    return -1;
  }
  buff = malloc(leng);
  if (tcptoread(fd, buff, leng, 10000) != (int32_t)leng) {
    printf("%s: master query: receive error\n", fname);
    free(buff);
    close_master_conn(1);
    return -1;
  }
  rptr = buff;
  cmd = get32bit(&rptr);
  if (cmd != 0) {
    printf("%s: master query: wrong answer (queryid)\n", fname);
    free(buff);
    close_master_conn(1);
    return -1;
  }
  leng -= 4;
  if (leng == 1) {
    printf("%s: %s\n", fname, mfsstrerr(*rptr));
    free(buff);
    close_master_conn(1);
    return -1;
  } else if (leng != 56 && leng != 40) {
    printf("%s: master query: wrong answer (leng)\n", fname);
    free(buff);
    close_master_conn(1);
    return -1;
  }
  close_master_conn(0);
  inodes = get32bit(&rptr);
  dirs = get32bit(&rptr);
  files = get32bit(&rptr);
  if (leng == 56) {
    rptr += 8;
  }
  chunks = get32bit(&rptr);
  if (leng == 56) {
    rptr += 8;
  }
  length = get64bit(&rptr);
  size = get64bit(&rptr);
  realsize = get64bit(&rptr);
  free(buff);
  if (dirinfomode == 0) {
    printf("%s:\n", fname);
    print_number(" inodes:       ", "\n", inodes, 0, 0, 1);
    print_number("  directories: ", "\n", dirs, 0, 0, 1);
    print_number("  files:       ", "\n", files, 0, 0, 1);
    print_number(" chunks:       ", "\n", chunks, 0, 0, 1);
    print_number(" length:       ", "\n", length, 0, 1, 1);
    print_number(" size:         ", "\n", size, 0, 1, 1);
    print_number(" realsize:     ", "\n", realsize, 0, 1, 1);
  } else {
    if (dirinfomode & 0x01) {
      print_number_only(inodes, 0);
      printf("\t");
    }
    if (dirinfomode & 0x02) {
      print_number_only(dirs, 0);
      printf("\t");
    }
    if (dirinfomode & 0x04) {
      print_number_only(files, 0);
      printf("\t");
    }
    if (dirinfomode & 0x08) {
      print_number_only(chunks, 0);
      printf("\t");
    }
    if (dirinfomode & 0x10) {
      print_number_only(length, 1);
      printf("\t");
    }
    if (dirinfomode & 0x20) {
      print_number_only(size, 1);
      printf("\t");
    }
    if (dirinfomode & 0x40) {
      print_number_only(realsize, 1);
      printf("\t");
    }
    printf("%s\n", fname);
  }
  return 0;
}
```