user: Please show me the C implementation that matches the assembly code listed below:

```asm
<getmac>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %esi,-0x2c(%rbp)
  mov    %rdx,-0x38(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  cmpq   $0x0,-0x28(%rbp)
  jne    L21
  mov    $0x1,%eax
  jmp    L24
L21:
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cmp    $0xb,%eax
  jg     L8
  mov    $0x1,%eax
  jmp    L24
L8:
  mov    -0x38(%rbp),%rax
  mov    $0x6,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  movb   $0x0,-0x9(%rbp)
  movl   $0x0,-0x10(%rbp)
  mov    -0x10(%rbp),%eax
  mov    %eax,-0x14(%rbp)
  jmp    L198
L131:
  mov    -0x14(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    %al,-0xb(%rbp)
  mov    -0x14(%rbp),%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    %al,-0xa(%rbp)
  lea    -0x18(%rbp),%rdx
  lea    -0xb(%rbp),%rax
  lea    D5(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <sscanf@plt>
  cmp    $0x1,%eax
  je     L74
  lea    -0xb(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cmp    $0x2,%eax
  jne    L74
  mov    $0x1,%eax
  jmp    L24
L74:
  movzbl -0xa(%rbp),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <hexCharToInt@plt>
  test   %rax,%rax
  jns    L91
  mov    $0x1,%eax
  jmp    L24
L91:
  mov    -0x18(%rbp),%edx
  mov    -0x10(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x38(%rbp),%rax
  add    %rcx,%rax
  mov    %dl,(%rax)
  addl   $0x2,-0x14(%rbp)
  addl   $0x1,-0x10(%rbp)
  mov    -0x14(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x3a,%al
  je     L36
  mov    -0x14(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x2d,%al
  je     L36
  mov    -0x14(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x5f,%al
  jne    L198
L36:
  addl   $0x1,-0x14(%rbp)
L198:
  mov    -0x14(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L131
  cmpl   $0x0,-0x2c(%rbp)
  je     L28
  cmpl   $0x6,-0x10(%rbp)
  jne    L172
L28:
  cmpl   $0x0,-0x2c(%rbp)
  jne    L58
  cmpl   $0x6,-0x10(%rbp)
  jle    L58
L172:
  mov    $0x1,%eax
  jmp    L24
L58:
  mov    $0x0,%eax
L24:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L185
  call   <__stack_chk_fail@plt>
L185:
  leave
  ret
```

tool_calls: name: parse_data
arguments: data_label: D5
type: string

tool: D5: %x

assistant: ```c
int getmac(char *macAddress, int strict, unsigned char *mac) {
  char byte[3];
  int i, nbElem, n;
  if (macAddress == NULL)
    return 1;
  if ((int)strlen(macAddress) < 12)
    return 1;
  memset(mac, 0, 6);
  byte[2] = 0;
  i = nbElem = 0;
  while (macAddress[i] != 0) {
    byte[0] = macAddress[i];
    byte[1] = macAddress[i + 1];
    if (sscanf(byte, "%x", &n) != 1 && strlen(byte) == 2)
      return 1;
    if (hexCharToInt(byte[1]) < 0)
      return 1;
    mac[nbElem] = n;
    i += 2;
    nbElem++;
    if (macAddress[i] == ':' || macAddress[i] == '-' || macAddress[i] == '_')
      i++;
  }
  if ((strict && nbElem != 6) || (!strict && nbElem > 6))
    return 1;
  return 0;
}
```