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

```asm
<kvp_mac_to_if_name>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  lea    D26(%rip),%rbp
  push   %rbx
  sub    $0x238,%rsp
  mov    %rdi,0x18(%rsp)
  mov    %rbp,%rdi
  mov    %fs:0x28,%rax
  mov    %rax,0x228(%rsp)
  xor    %eax,%eax
  call   <opendir@plt>
  mov    %rax,0x8(%rsp)
  test   %rax,%rax
  je     L58
  lea    0x120(%rsp),%r14
  mov    %rbp,%rdx
  mov    $0x100,%esi
  mov    %r14,%rdi
  call   <snprintf@plt>
  mov    %rbp,%rdi
  call   <strlen@plt>
  mov    %eax,%eax
  add    %r14,%rax
  mov    %rax,0x10(%rsp)
  nopl   0x0(%rax)
L59:
  mov    0x8(%rsp),%rdi
  call   <readdir@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L67
  mov    0x10(%rsp),%rax
  mov    %r14,%rdi
  movb   $0x0,(%rax)
  mov    (%r12),%rsi
  call   <strcat@plt>
  lea    D17(%rip),%rsi
  mov    %r14,%rdi
  call   <strcat@plt>
  lea    D10(%rip),%rsi
  mov    %r14,%rdi
  call   <fopen@plt>
  mov    %rax,%r13
  test   %rax,%rax
  je     L59
  lea    0x20(%rsp),%rdi
  mov    %rax,%rdx
  mov    $0x100,%esi
  call   <fgets@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  jne    L26
L61:
  mov    %r13,%rdi
  call   <fclose@plt>
  jmp    L59
  nopl   0x0(%rax)
L26:
  mov    $0xa,%esi
  mov    %rax,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  je     L74
  movb   $0x0,(%rax)
L74:
  xor    %ebx,%ebx
  jmp    L64
  nopl   0x0(%rax)
L90:
  mov    %ebx,%edx
  add    $0x1,%ebx
  lea    0x0(%rbp,%rdx,1),%r15
  movsbl (%r15),%edi
  call   <toupper@plt>
  mov    %al,(%r15)
L64:
  mov    %rbp,%rdi
  call   <strlen@plt>
  cmp    %ebx,%eax
  ja     L90
  mov    0x18(%rsp),%rsi
  mov    %rbp,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L61
  mov    (%r12),%rdi
  call   <strdup@plt>
  mov    %r13,%rdi
  mov    %rax,%r12
  call   <fclose@plt>
L67:
  mov    0x8(%rsp),%rdi
  call   <closedir@plt>
L23:
  mov    0x228(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L82
  add    $0x238,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L58:
  xor    %r12d,%r12d
  jmp    L23
L82:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: label: D26
type_infered: string
name: extract_symbolic_data
arguments: label: D17
type_infered: string
name: extract_symbolic_data
arguments: label: D10
type_infered: string

tool: D26: /sys/class/net/

tool: D17: /address

tool: D10: r

assistant: ```c
char *kvp_mac_to_if_name(char *mac) {
  DIR *dir;
  struct dirent *entry;
  FILE *file;
  char *p, *q, *x;
  char *if_name = NULL;
  char buf[256];
  char *kvp_net_dir = "/sys/class/net/";
  char dev_id[256];
  unsigned int i;
  dir = opendir(kvp_net_dir);
  if (dir == NULL)
    return NULL;
  snprintf(dev_id, sizeof(dev_id), kvp_net_dir);
  q = dev_id + strlen(kvp_net_dir);
  while ((entry = readdir(dir)) != NULL) {
    *q = '\0';
    strcat(dev_id, entry->d_name);
    strcat(dev_id, "/address");
    file = fopen(dev_id, "r");
    if (file == NULL)
      continue;
    p = fgets(buf, sizeof(buf), file);
    if (p) {
      x = strchr(p, '\n');
      if (x)
        *x = '\0';
      for (i = 0; i < strlen(p); i++)
        p[i] = toupper(p[i]);
      if (!strcmp(p, mac)) {
        if_name = strdup(entry->d_name);
        fclose(file);
        break;
      }
    }
    fclose(file);
  }
  closedir(dir);
  return if_name;
}
```