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

```asm
<zrpc_util_str2mac>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x58,%rsp
  mov    %rsi,0x8(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x48(%rsp)
  xor    %eax,%eax
  test   %rdi,%rdi
  je     L220
  xor    %ebx,%ebx
  cmpb   $0x3a,(%rdi)
  mov    %rdi,%rbp
  je     L270
L139:
  lea    0x30(%rsp),%rax
  mov    %rax,0x10(%rsp)
L289:
  mov    $0x3a,%esi
  mov    %rbp,%rdi
  movl   $0x0,0x2c(%rsp)
  call   <strchr@plt>
  mov    %rax,0x18(%rsp)
  test   %rax,%rax
  je     L231
  mov    %rax,%r12
  sub    %rbp,%r12
  sar    $0x2,%r12
L193:
  cmp    $0x5,%r12
  ja     L149
  mov    0x10(%rsp),%r15
  mov    %r12,%rdx
  mov    %rbp,%rsi
  mov    %r15,%rdi
  call   <memcpy@plt>
  test   %r12,%r12
  je     L290
  cmpq   $0x0,0x8(%rsp)
  je     L59
  mov    $0x2,%ebp
  lea    0x2c(%rsp),%r13
  jmp    L285
  nopl   0x0(%rax,%rax,1)
L276:
  shl    $0x4,%eax
  mov    %al,(%r14)
  lea    -0x1(%rbp),%rax
  cmp    %rax,%r12
  je     L220
  lea    0x4(%r15),%rdi
  mov    %r13,%rsi
  call   <zrpc_util_convertchartohexa@plt>
  mov    0x2c(%rsp),%edx
  test   %edx,%edx
  jne    L220
  and    $0xf,%eax
  add    $0x1,%ebx
  or     %al,(%r14)
  cmp    %rbp,%r12
  jbe    L207
  add    $0x8,%r15
  add    $0x2,%rbp
  cmp    $0x6,%ebx
  je     L220
L285:
  mov    0x8(%rsp),%rax
  mov    %ebx,%edx
  mov    %r13,%rsi
  mov    %r15,%rdi
  lea    (%rax,%rdx,1),%r14
  movb   $0x0,(%r14)
  call   <zrpc_util_convertchartohexa@plt>
  mov    0x2c(%rsp),%ecx
  test   %ecx,%ecx
  je     L276
  nopl   0x0(%rax)
L220:
  xor    %eax,%eax
L192:
  mov    0x48(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L173
  add    $0x58,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L231:
  cmp    $0x5,%ebx
  jne    L149
  mov    %rbp,%rdi
  call   <strlen@plt>
  mov    %rax,%r12
  jmp    L193
  nopl   0x0(%rax)
L270:
  cmpb   $0x0,0x1(%rdi)
  jne    L139
L32:
  mov    $0x1,%eax
  jmp    L192
  nopl   0x0(%rax)
L59:
  mov    0x10(%rsp),%r15
  mov    $0x2,%ebp
  lea    0x2c(%rsp),%r13
  jmp    L43
  nopl   0x0(%rax)
L258:
  lea    -0x1(%rbp),%rax
  cmp    %rax,%r12
  je     L220
  mov    %r13,%rsi
  lea    0x4(%r15),%rdi
  call   <zrpc_util_convertchartohexa@plt>
  mov    0x2c(%rsp),%esi
  test   %esi,%esi
  jne    L220
  add    $0x1,%ebx
  cmp    %rbp,%r12
  jbe    L207
  add    $0x8,%r15
  add    $0x2,%rbp
  cmp    $0x6,%ebx
  je     L220
L43:
  mov    %r15,%rdi
  mov    %r13,%rsi
  call   <zrpc_util_convertchartohexa@plt>
  mov    0x2c(%rsp),%edi
  test   %edi,%edi
  je     L258
  jmp    L220
  xchg   %ax,%ax
L207:
  mov    0x18(%rsp),%rax
  test   %rax,%rax
  je     L32
  add    $0x4,%rax
  mov    %rax,%rbp
  cmp    $0x6,%ebx
  jne    L289
  jmp    L32
L149:
  mov    0x8(%rsp),%rsi
  lea    D0(%rip),%rdi
  xor    %eax,%eax
  call   <zrpc_log@plt>
  jmp    L220
L290:
  cmpq   $0x0,0x18(%rsp)
  je     L32
  mov    0x18(%rsp),%rbp
  add    $0x4,%rbp
  jmp    L289
L173:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: data_tag: D0
type_infered: string

tool: D0: [%s]: format non recognized

assistant: ```c
int zrpc_util_str2mac(const char *str, char *mac) {
  unsigned int k = 0, i, j;
  uint8_t *ptr, *ptr2;
  size_t len;
  uint8_t car;
  if (!str)
    return 0;
  if (str[0] == ':' && str[1] == '\0')
    return 1;
  i = 0;
  ptr = (uint8_t *)str;
  while (i < 6) {
    uint8_t temp[5];
    int error = 0;
    ptr2 = (uint8_t *)strchr((const char *)ptr, ':');
    if (ptr2 == NULL) {
      if (i != 5) {
        zrpc_log("[%s]: format non recognized", mac);
        return 0;
      }
      len = strlen((char *)ptr);
    } else {
      len = ptr2 - ptr;
    }
    if (len > 5) {
      zrpc_log("[%s]: format non recognized", mac);
      return 0;
    }
    memcpy(temp, ptr, len);
    for (j = 0; j < len; j++) {
      if (k >= 6)
        return 0;
      if (mac)
        mac[k] = 0;
      car = zrpc_util_convertchartohexa(&temp[j], &error);
      if (error)
        return 0;
      if (mac)
        mac[k] = car << 4;
      j++;
      if (j == len)
        return 0;
      car = zrpc_util_convertchartohexa(&temp[j], &error) & 0xf;
      if (error)
        return 0;
      if (mac)
        mac[k] |= car & 0xf;
      k++;
      i++;
    }
    ptr = ptr2;
    if (ptr == NULL)
      break;
    ptr++;
  }
  if (mac && 0) {
    zrpc_log("leave correct : %02x:%02x:%02x:%02x:%02x:%02x", mac[0] & 0xff, mac[1] & 0xff, mac[2] & 0xff, mac[3] & 0xff, mac[4] & 0xff, mac[5] & 0xff);
  }
  return 1;
}
```