user: Translate the below assembly code into C programming language:

```asm
<translate_mac>:
  endbr64
  push   %r15
  lea    D9(%rip),%r15
  mov    $0x4,%edx
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  mov    %r15,%rdi
  push   %rbx
  sub    $0x148,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x138(%rsp)
  xor    %eax,%eax
  movq   $0x0,0x18(%rsp)
  movq   $0x0,0x20(%rsp)
  call   <memcpy@plt>
  xor    %edi,%edi
  call   <debugfs_mount@plt>
  test   %rax,%rax
  je     L8
  lea    0x30(%rsp),%r12
  mov    $0x101,%ecx
  mov    %rbp,%rsi
  mov    %r12,%rdx
  lea    D0(%rip),%rdi
  call   <debugfs_make_path@plt>
  mov    %r12,%rdi
  lea    D59(%rip),%rsi
  call   <fopen@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L8
  lea    0x18(%rsp),%r14
  lea    0x20(%rsp),%r13
  lea    D32(%rip),%rbp
  lea    0x28(%rsp),%rbx
  xchg   %ax,%ax
L123:
  mov    %r12,%rdx
  mov    %r14,%rsi
  mov    %r13,%rdi
  call   <getline@plt>
  cmp    $0xffffffff,%eax
  je     L56
  mov    0x20(%rsp),%rdi
  mov    %rbx,%rdx
  mov    %rbp,%rsi
  call   <strtok_r@plt>
  test   %rax,%rax
  je     L123
  cmpb   $0x2a,(%rax)
  jne    L123
  cmpb   $0x0,0x1(%rax)
  jne    L123
  xor    %edi,%edi
  mov    %rbx,%rdx
  mov    %rbp,%rsi
  call   <strtok_r@plt>
  mov    %rax,%rdi
  test   %rax,%rax
  je     L123
  call   <ether_aton@plt>
  mov    %rax,%rdi
  test   %rax,%rax
  je     L123
  mov    $0x4,%edx
  mov    %r15,%rsi
  call   <memcmp@plt>
  test   %eax,%eax
  jne    L123
L142:
  xor    %edi,%edi
  mov    %rbx,%rdx
  mov    %rbp,%rsi
  call   <strtok_r@plt>
  mov    %rax,%rdi
  test   %rax,%rax
  je     L123
  lea    D28(%rip),%rsi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L142
  xor    %edi,%edi
  mov    %rbx,%rdx
  mov    %rbp,%rsi
  call   <strtok_r@plt>
  mov    %rax,%rdi
  test   %rax,%rax
  je     L123
  call   <ether_aton@plt>
  mov    %rax,%r8
  test   %rax,%rax
  je     L123
L51:
  mov    %r12,%rdi
  mov    %r8,0x8(%rsp)
  call   <fclose@plt>
  mov    0x8(%rsp),%r8
L99:
  mov    0x20(%rsp),%rdi
  mov    %r8,0x8(%rsp)
  call   <free@plt>
  mov    0x8(%rsp),%r8
  mov    0x138(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L158
  add    $0x148,%rsp
  mov    %r8,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L8:
  lea    D9(%rip),%r8
  jmp    L99
L56:
  lea    D9(%rip),%r8
  jmp    L51
L158:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: label: D0
type_guessed: string
name: unpack_data
arguments: label: D59
type_guessed: string
name: unpack_data
arguments: label: D32
type_guessed: string
name: unpack_data
arguments: label: D28
type_guessed: string

tool: D0: %s/batman_adv/%s/transtable_global

tool: D59: r

tool: D32:  	

tool: D28: via

assistant: ```c
struct ether_addr *translate_mac(const char *mesh_iface, struct ether_addr *mac) {
  enum {
    tg_start,
    tg_mac,
    tg_via,
    tg_originator,
  } pos;
  char full_path[256 + 1];
  char *debugfs_mnt;
  static struct ether_addr in_mac;
  struct ether_addr *mac_result, *mac_tmp;
  FILE *f = NULL;
  size_t len = 0;
  char *line = NULL;
  char *input, *saveptr, *token;
  int line_invalid;
  memcpy(&in_mac, mac, sizeof(in_mac));
  mac_result = &in_mac;
  debugfs_mnt = debugfs_mount(NULL);
  if (!debugfs_mnt)
    goto out;
  debugfs_make_path("%s/batman_adv/%s"
                    "/"
                    "transtable_global",
                    mesh_iface, full_path, sizeof(full_path));
  f = fopen(full_path, "r");
  if (!f)
    goto out;
  while (getline(&line, &len, f) != -1) {
    line_invalid = 0;
    pos = tg_start;
    input = line;
    while ((token = strtok_r(input, " \t", &saveptr))) {
      input = NULL;
      switch (pos) {
      case tg_start:
        if (strcmp(token, "*") != 0)
          line_invalid = 1;
        else
          pos = tg_mac;
        break;
      case tg_mac:
        mac_tmp = ether_aton(token);
        if (!mac_tmp || memcmp(mac_tmp, &in_mac, sizeof(in_mac)) != 0)
          line_invalid = 1;
        else
          pos = tg_via;
        break;
      case tg_via:
        if (strcmp(token, "via") == 0)
          pos = tg_originator;
        break;
      case tg_originator:
        mac_tmp = ether_aton(token);
        if (!mac_tmp) {
          line_invalid = 1;
        } else {
          mac_result = mac_tmp;
          goto out;
        }
        break;
      }
      if (line_invalid)
        break;
    }
  }
out:
  if (f)
    fclose(f);
  free(line);
  return mac_result;
}
```