user: Converte this assembly snippet into its equivalent C code:

```asm
<getop>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  movl   $0x0,-0xc(%rbp)
  nop
L51:
  mov    $0x0,%eax
  call   <getch@plt>
  mov    %eax,-0x8(%rbp)
  mov    -0x8(%rbp),%eax
  mov    %eax,%edx
  mov    -0x18(%rbp),%rax
  mov    %dl,(%rax)
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x20,%al
  je     L51
  cmpl   $0x9,-0x8(%rbp)
  je     L51
  mov    -0x18(%rbp),%rax
  add    $0x1,%rax
  movb   $0x0,(%rax)
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x60,%al
  jle    L27
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x7a,%al
  jg     L27
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  jmp    L107
L27:
  mov    -0x8(%rbp),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L160
  cmpl   $0x2e,-0x8(%rbp)
  je     L160
  cmpl   $0x2d,-0x8(%rbp)
  je     L160
  mov    -0x8(%rbp),%eax
  jmp    L107
L160:
  cmpl   $0x2d,-0x8(%rbp)
  jne    L62
  mov    $0x0,%eax
  call   <getch@plt>
  mov    %eax,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L58
  cmpl   $0x2e,-0x4(%rbp)
  je     L58
  mov    -0x8(%rbp),%eax
  jmp    L107
L58:
  mov    -0x4(%rbp),%eax
  mov    %eax,-0x8(%rbp)
  jmp    L172
L62:
  mov    $0x0,%eax
  call   <getch@plt>
  mov    %eax,-0x8(%rbp)
  jmp    L172
L38:
  mov    $0x0,%eax
  call   <getch@plt>
  mov    %eax,-0x8(%rbp)
L172:
  addl   $0x1,-0xc(%rbp)
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    -0x8(%rbp),%edx
  mov    %dl,(%rax)
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L38
  cmpl   $0x2e,-0x8(%rbp)
  jne    L72
  nop
L136:
  mov    $0x0,%eax
  call   <getch@plt>
  mov    %eax,-0x8(%rbp)
  addl   $0x1,-0xc(%rbp)
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    -0x8(%rbp),%edx
  mov    %dl,(%rax)
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L136
L72:
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  mov    D0(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x8(%rbp)
  je     L90
  mov    -0x8(%rbp),%eax
  mov    %eax,%edi
  call   <ungetch@plt>
L90:
  mov    $0x30,%eax
L107:
  leave
  ret
```

assistant: ```c
int getop(char s[]) {
  int i = 0;
  int c, next;
  while ((s[0] = c = getch()) == ' ' || c == '\t') {
  }
  s[1] = '\0';
  if (s[i] >= 'a' && s[i] <= 'z') {
    return s[i];
  }
  if (!isdigit(c) && c != '.' && c != '-') {
    return c;
  }
  if (c == '-') {
    next = getch();
    if (!isdigit(next) && next != '.') {
      return c;
    } else {
      c = next;
    }
  } else {
    c = getch();
  }
  while (isdigit(s[++i] = c)) {
    c = getch();
  }
  if (c == '.') {
    while (isdigit(s[++i] = c = getch())) {
    }
  }
  s[i] = '\0';
  if (c != EOF) {
    ungetch(c);
  }
  return '0';
}
```