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

```asm
<getword>:
  endbr64
  push   %r15
  push   %r14
  mov    %esi,%r14d
  push   %r13
  mov    %rdi,%r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  nopl   0x0(%rax,%rax,1)
L349:
  xor    %eax,%eax
  call   <getch@plt>
  mov    %eax,%edi
  mov    %rax,%rbx
  mov    %eax,%r12d
  call   <isspace@plt>
  test   %rax,%rax
  jne    L349
  mov    D7(%rip),%r15
  mov    %r13,%rbp
  cmp    %ebx,(%r15)
  je     L12
  mov    %bl,0x0(%r13)
  lea    0x1(%r13),%rbp
L12:
  mov    %r12d,%edi
  call   <isalpha@plt>
  test   %eax,%eax
  jne    L336
  cmp    $0x22,%r12d
  je     L285
  cmp    $0x5c,%r12d
  je     L219
  cmp    $0x23,%r12d
  je     L371
  cmp    $0x5f,%r12d
  je     L371
  movb   $0x0,0x0(%rbp)
  jmp    L173
  cs nopw 0x0(%rax,%rax,1)
L198:
  cmp    %eax,(%r15)
  je     L336
L285:
  xor    %eax,%eax
  call   <getch@plt>
  mov    %eax,%r12d
  cmp    $0x22,%eax
  jne    L198
  nopl   0x0(%rax)
L336:
  lea    -0x2(%r14),%eax
  lea    0x1(%rbp,%rax,1),%rbx
  cmp    $0x1,%r14d
  jle    L165
L334:
  xor    %eax,%eax
  call   <getch@plt>
  mov    %al,0x0(%rbp)
  movsbl %al,%edi
  call   <isalnum@plt>
  test   %eax,%eax
  jne    L57
  cmp    $0x22,%r12d
  je     L45
  cmp    $0x5c,%r12d
  je     L226
  cmp    $0x23,%r12d
  je     L57
  cmp    $0x5f,%r12d
  je     L57
  movsbl 0x0(%rbp),%edi
  call   <ungetch@plt>
L165:
  movb   $0x0,0x0(%rbp)
  movsbl 0x0(%r13),%r12d
L173:
  add    $0x8,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L226:
  xor    %eax,%eax
  call   <getch@plt>
  mov    %eax,%r12d
  cmp    $0x5c,%eax
  je     L405
  cmp    $0x2a,%eax
  je     L249
  nopl   0x0(%rax,%rax,1)
L57:
  add    $0x1,%rbp
  cmp    %rbx,%rbp
  jne    L334
  jmp    L165
  nop
L76:
  cmp    %eax,(%r15)
  je     L321
L45:
  xor    %eax,%eax
  call   <getch@plt>
  cmp    $0x22,%eax
  jne    L76
L321:
  movb   $0x0,0x0(%rbp)
  jmp    L165
L8:
  xor    %eax,%eax
  call   <getch@plt>
  mov    %eax,%r12d
  cmp    $0x5c,%eax
  je     L101
  movb   $0x0,0x0(%rbp)
  xchg   %ax,%ax
L249:
  xor    %eax,%eax
  call   <getch@plt>
  mov    %eax,%r12d
  cmp    %eax,(%r15)
  je     L57
  cmp    $0x2a,%eax
  je     L8
  movb   $0x0,0x0(%rbp)
  jmp    L249
  nopw   0x0(%rax,%rax,1)
L371:
  mov    %bl,0x0(%rbp)
  add    $0x1,%rbp
  jmp    L336
  nopl   0x0(%rax)
L309:
  cmp    %eax,(%r15)
  je     L321
L405:
  xor    %eax,%eax
  call   <getch@plt>
  cmp    $0xa,%eax
  jne    L309
  jmp    L321
  nopl   0x0(%rax,%rax,1)
L219:
  xor    %eax,%eax
  call   <getch@plt>
  mov    %eax,%r12d
  cmp    $0x5c,%eax
  je     L262
  cmp    $0x2a,%eax
  jne    L336
L341:
  xor    %eax,%eax
  call   <getch@plt>
  mov    %eax,%r12d
  cmp    %eax,(%r15)
  je     L336
  cmp    $0x2a,%eax
  jne    L341
  xor    %eax,%eax
  call   <getch@plt>
  mov    %eax,%r12d
  cmp    $0x5c,%eax
  je     L336
  jmp    L341
  nopl   (%rax)
L301:
  cmp    %eax,(%r15)
  je     L336
L262:
  xor    %eax,%eax
  call   <getch@plt>
  mov    %eax,%r12d
  cmp    $0xa,%eax
  jne    L301
  jmp    L336
L101:
  movb   $0x0,0x0(%rbp)
  jmp    L57
```

assistant: ```c
int getword(char *word, int lim) {
  int c = 0;
  char *w = word;
  while (isspace(c = getch()))
    ;
  if (c != EOF)
    *w++ = c;
  if (!isalpha(c)) {
    if (c == '"')
      while (((c = getch()) != '"') && (c != EOF))
        ;
    else if (c == '\\') {
      if ((c = getch()) == '\\') {
        while (((c = getch()) != '\n') && (c != EOF))
          ;
      } else if (c == '*') {
        while ((c = getch()) != EOF)
          if ((c == '*') && ((c = getch()) == '\\'))
            break;
          else
            continue;
      }
    } else if ((c == '#') || (c == '_'))
      *w++ = c;
    else {
      *w = '\0';
      return c;
    }
  }
  for (; --lim > 0; w++)
    if (!isalnum(*w = getch())) {
      if (c == '"') {
        while (((c = getch()) != '"') && (c != EOF))
          ;
        *w = '\0';
        break;
      } else if (c == '\\') {
        if ((c = getch()) == '\\') {
          while (((c = getch()) != '\n') && (c != EOF))
            ;
          *w = '\0';
          break;
        } else if (c == '*') {
          while ((c = getch()) != EOF)
            if ((c == '*') && ((c = getch()) == '\\')) {
              *w = '\0';
              break;
            } else {
              *w = '\0';
              continue;
            }
        }
      } else if ((c == '#') || (c == '_')) {
        continue;
      } else {
        ungetch(*w);
        break;
      }
    }
  *w = '\0';
  return word[0];
}
```