user: What would the C source look like for the assembly code provided here:

```asm
<kvp_mac_to_if_name>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  lea    D12(%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     L86
  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)
L31:
  mov    0x8(%rsp),%rdi
  call   <readdir@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L19
  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    D6(%rip),%rsi
  mov    %r14,%rdi
  call   <fopen@plt>
  mov    %rax,%r13
  test   %rax,%rax
  je     L31
  lea    0x20(%rsp),%rdi
  mov    %rax,%rdx
  mov    $0x100,%esi
  call   <fgets@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  jne    L37
L21:
  mov    %r13,%rdi
  call   <fclose@plt>
  jmp    L31
  nopl   0x0(%rax)
L37:
  mov    $0xa,%esi
  mov    %rax,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  je     L24
  movb   $0x0,(%rax)
L24:
  xor    %ebx,%ebx
  jmp    L36
  nopl   0x0(%rax)
L106:
  mov    %ebx,%edx
  add    $0x1,%ebx
  lea    0x0(%rbp,%rdx,1),%r15
  movsbl (%r15),%edi
  call   <toupper@plt>
  mov    %al,(%r15)
L36:
  mov    %rbp,%rdi
  call   <strlen@plt>
  cmp    %ebx,%eax
  ja     L106
  mov    0x18(%rsp),%rsi
  mov    %rbp,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L21
  mov    (%r12),%rdi
  call   <strdup@plt>
  mov    %r13,%rdi
  mov    %rax,%r12
  call   <fclose@plt>
L19:
  mov    0x8(%rsp),%rdi
  call   <closedir@plt>
L54:
  mov    0x228(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L15
  add    $0x238,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L86:
  xor    %r12d,%r12d
  jmp    L54
L15:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: label: D12
datatype: string
name: unpack_data
arguments: label: D17
datatype: string
name: unpack_data
arguments: label: D6
datatype: string

tool: D12: /sys/class/net/

tool: D17: /address

tool: D6: 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;
}
```