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

```asm
<getop>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  nop
L116:
  mov    $0x0,%eax
  call   <getch@plt>
  mov    %eax,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  mov    %eax,%edx
  mov    -0x18(%rbp),%rax
  mov    %dl,(%rax)
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x20,%al
  je     L116
  cmpl   $0x9,-0x4(%rbp)
  je     L116
  mov    -0x18(%rbp),%rax
  add    $0x1,%rax
  movb   $0x0,(%rax)
  cmpl   $0x2d,-0x4(%rbp)
  je     L86
  mov    -0x4(%rbp),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L86
  cmpl   $0x2e,-0x4(%rbp)
  je     L86
  mov    -0x4(%rbp),%eax
  jmp    L97
L86:
  movl   $0x0,-0x8(%rbp)
  cmpl   $0x2d,-0x4(%rbp)
  jne    L7
  mov    -0x8(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x8(%rbp)
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    -0x4(%rbp),%edx
  mov    %dl,(%rax)
  mov    $0x0,%eax
  call   <getch@plt>
  mov    %eax,-0x4(%rbp)
L7:
  mov    -0x4(%rbp),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isdigit@plt>
  test   %rax,%rax
  je     L125
  mov    -0x8(%rbp),%eax
  cltq
  lea    -0x1(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x2d,%al
  jne    L152
  mov    -0x8(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    -0x4(%rbp),%edx
  mov    %dl,(%rax)
L152:
  nop
L106:
  mov    $0x0,%eax
  call   <getch@plt>
  mov    %eax,-0x4(%rbp)
  addl   $0x1,-0x8(%rbp)
  mov    -0x8(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    -0x4(%rbp),%edx
  mov    %dl,(%rax)
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L106
L125:
  cmpl   $0x2e,-0x4(%rbp)
  jne    L149
  nop
L23:
  mov    $0x0,%eax
  call   <getch@plt>
  mov    %eax,-0x4(%rbp)
  addl   $0x1,-0x8(%rbp)
  mov    -0x8(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    -0x4(%rbp),%edx
  mov    %dl,(%rax)
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L23
L149:
  mov    -0x8(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  mov    D8(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x4(%rbp)
  je     L57
  mov    -0x4(%rbp),%eax
  mov    %eax,%edi
  call   <ungetch@plt>
L57:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2d,%al
  jne    L82
  mov    -0x18(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L82
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  jmp    L97
L82:
  mov    $0x30,%eax
L97:
  leave
  ret
```

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