user: 请从给定的汇编指令推导出C源代码:

```asm
<kvp_mac_to_if_name>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  lea    D38(%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     L3
  lea    0x120(%rsp),%r14
  mov    %rbp,%rcx
  mov    $0x100,%esi
  lea    D36(%rip),%rdx
  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,%rax,1)
L11:
  mov    0x8(%rsp),%rdi
  call   <readdir@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L102
  mov    0x10(%rsp),%rax
  mov    %r14,%rdi
  movb   $0x0,(%rax)
  mov    (%r12),%rsi
  call   <strcat@plt>
  lea    D22(%rip),%rsi
  mov    %r14,%rdi
  call   <strcat@plt>
  lea    D27(%rip),%rsi
  mov    %r14,%rdi
  call   <fopen@plt>
  mov    %rax,%r13
  test   %rax,%rax
  je     L11
  lea    0x20(%rsp),%rdi
  mov    %rax,%rdx
  mov    $0x100,%esi
  call   <fgets@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  jne    L108
L73:
  mov    %r13,%rdi
  call   <fclose@plt>
  jmp    L11
  nopl   0x0(%rax)
L108:
  mov    $0xa,%esi
  mov    %rax,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  je     L72
  movb   $0x0,(%rax)
L72:
  xor    %ebx,%ebx
  jmp    L5
  nopl   0x0(%rax)
L79:
  mov    %ebx,%edx
  add    $0x1,%ebx
  lea    0x0(%rbp,%rdx,1),%r15
  movsbl (%r15),%edi
  call   <toupper@plt>
  mov    %al,(%r15)
L5:
  mov    %rbp,%rdi
  call   <strlen@plt>
  cmp    %ebx,%eax
  ja     L79
  mov    0x18(%rsp),%rsi
  mov    %rbp,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L73
  mov    (%r12),%rdi
  call   <strdup@plt>
  mov    %r13,%rdi
  mov    %rax,%r12
  call   <fclose@plt>
L102:
  mov    0x8(%rsp),%rdi
  call   <closedir@plt>
L12:
  mov    0x228(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L55
  add    $0x238,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L3:
  xor    %r12d,%r12d
  jmp    L12
L55:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D38
datatype: string
name: extract_symbolic_data
arguments: data_tag: D36
datatype: string
name: extract_symbolic_data
arguments: data_tag: D22
datatype: string
name: extract_symbolic_data
arguments: data_tag: D27
datatype: string

tool: D38: /sys/class/net/

tool: D36: %s

tool: D22: /address

tool: D27: 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), "%s", 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;
}
```