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

```asm
<ether_line>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,%r12
  mov    %rsi,%r15
  mov    %rdx,0x8(%rsp)
  mov    $0x0,%r13d
  jmp    L41
L3:
  lea    0x1(%r12),%r14
  cmp    $0x5,%r13
  jne    L176
  test   %bpl,%bpl
  jne    L115
L176:
  mov    (%r15),%rax
  mov    %bl,(%rax,%r13,1)
  mov    %r14,%r12
  test   %bpl,%bpl
  je     L1
L58:
  lea    0x1(%r14),%r12
L1:
  add    $0x1,%r13
  cmp    $0x6,%r13
  je     L124
L41:
  movsbl (%r12),%edi
  call   <_tolower@plt>
  lea    -0x30(%rax),%edx
  cmp    $0x9,%dl
  jbe    L175
  lea    -0x61(%rax),%edx
  cmp    $0x5,%dl
  ja     L252
L175:
  movsbl %al,%ebx
  mov    %ebx,%edi
  call   <isdigit@plt>
  mov    %rax,%rdx
  lea    -0x30(%rbx),%eax
  sub    $0x57,%ebx
  test   %rdx,%rdx
  cmovne %eax,%ebx
  movsbl 0x1(%r12),%edi
  call   <_tolower@plt>
  mov    %eax,%ebp
  cmp    $0x4,%r13
  setbe  0x7(%rsp)
  movzbl 0x7(%rsp),%eax
  cmp    $0x3a,%bpl
  je     L3
  test   %al,%al
  je     L3
L218:
  lea    0x2(%r12),%r14
  lea    -0x30(%rbp),%eax
  cmp    $0x9,%al
  jbe    L117
  lea    -0x61(%rbp),%eax
  cmp    $0x5,%al
  ja     L5
L117:
  shl    $0x4,%ebx
  movsbl %bpl,%ebp
  mov    %ebp,%edi
  call   <isdigit@plt>
  mov    %rax,%rdx
  lea    -0x30(%rbp),%eax
  sub    $0x57,%ebp
  test   %rdx,%rdx
  cmovne %eax,%ebp
  add    %ebp,%ebx
  movzbl 0x2(%r12),%ebp
  cmp    $0x3a,%bpl
  je     L176
  cmpb   $0x0,0x7(%rsp)
  je     L176
  mov    $0xffffffff,%eax
  jmp    L121
L115:
  movsbl %bpl,%edi
  call   <isspace@plt>
  test   %rax,%rax
  je     L218
  mov    (%r15),%rax
  mov    %bl,0x5(%rax)
  jmp    L58
L124:
  mov    $0x23,%esi
  mov    %r12,%rdi
  call   <strchr@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L249
L123:
  cmp    %rbx,%r12
  jae    L130
L102:
  movsbl -0x1(%rbx),%edi
  call   <isspace@plt>
  test   %rax,%rax
  je     L130
  sub    $0x1,%rbx
  cmp    %rbx,%r12
  jne    L102
  mov    $0xffffffff,%eax
  jmp    L121
L249:
  mov    %r12,%rdi
  call   <strlen@plt>
  movslq %eax,%rbx
  add    %r12,%rbx
  jmp    L123
L130:
  cmp    %rbx,%r12
  je     L197
  sub    %r12,%rbx
  mov    %ebx,%edx
  mov    %r12,%rsi
  mov    0x8(%rsp),%r15
  mov    %r15,%rdi
  call   <memcpy@plt>
  movb   $0x0,(%r15,%rbx,1)
  mov    $0x0,%eax
L121:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L252:
  mov    $0xffffffff,%eax
  jmp    L121
L5:
  mov    $0xffffffff,%eax
  jmp    L121
L197:
  mov    $0xffffffff,%eax
  jmp    L121
```

assistant: ```c
int ether_line(const char *line, struct ether_addr *addr, char *hostname) {
  size_t cnt;
  char *cp;
  for (cnt = 0; cnt < 6; ++cnt) {
    unsigned int number;
    char ch;
    ch = _tolower(*line++);
    if ((ch < '0' || ch > '9') && (ch < 'a' || ch > 'f'))
      return -1;
    number = isdigit(ch) ? (ch - '0') : (ch - 'a' + 10);
    ch = _tolower(*line);
    if ((cnt < 5 && ch != ':') || (cnt == 5 && ch != '\0' && !isspace(ch))) {
      ++line;
      if ((ch < '0' || ch > '9') && (ch < 'a' || ch > 'f'))
        return -1;
      number <<= 4;
      number += isdigit(ch) ? (ch - '0') : (ch - 'a' + 10);
      ch = *line;
      if (cnt < 5 && ch != ':')
        return -1;
    }
    addr->ether_addr_octet[cnt] = (unsigned char)number;
    if (ch != '\0')
      ++line;
  }
  cp = strchr(line, '#');
  if (cp == NULL)
    cp = line + strlen(line);
  while (cp > line && isspace(cp[-1]))
    --cp;
  if (cp == line)
    return -1;
  memcpy(hostname, line, cp - line);
  hostname[cp - line] = '\0';
  return 0;
}
```