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

```asm
<getnum>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,%r13
  mov    %esi,%ebp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    (%rdi),%rdi
  mov    %rdi,(%rsp)
  call   <skipspace@plt>
  mov    %rax,(%rsp)
  movzbl (%rax),%edx
  cmp    $0x2b,%dl
  je     L675
  cmp    $0x2d,%dl
  je     L435
  cmp    $0x7e,%dl
  je     L249
  cmp    $0x28,%dl
  je     L368
  sub    $0x30,%edx
  cmp    $0x9,%dl
  jbe    L293
L649:
  mov    $0x80000001,%ebx
L205:
  mov    (%rsp),%rdi
  call   <skipspace@plt>
  mov    %rax,0x0(%r13)
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L65
  mov    %ebx,%eax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L675:
  lea    0x1(%rax),%rdi
  call   <skipspace@plt>
  mov    %rax,(%rsp)
  mov    %rsp,%rdi
  mov    $0x0,%esi
  call   <getnum>
  mov    %eax,%ebx
L154:
  cmp    $0x80000001,%ebx
  je     L205
  mov    %rsp,%r12
  jmp    L381
L435:
  lea    0x1(%rax),%rdi
  call   <skipspace@plt>
  mov    %rax,(%rsp)
  mov    %rsp,%rdi
  mov    $0x0,%esi
  call   <getnum>
  mov    %eax,%ebx
  cmp    $0x80000001,%eax
  je     L649
  neg    %ebx
  jmp    L154
L249:
  lea    0x1(%rax),%rdi
  call   <skipspace@plt>
  mov    %rax,(%rsp)
  mov    %rsp,%rdi
  mov    $0x0,%esi
  call   <getnum>
  mov    %eax,%ebx
  cmp    $0x80000001,%eax
  je     L649
  not    %ebx
  jmp    L154
L368:
  lea    0x1(%rax),%rdi
  call   <skipspace@plt>
  mov    %rax,(%rsp)
  mov    %rsp,%rdi
  mov    $0x9,%esi
  call   <getnum>
  mov    %eax,%ebx
  mov    (%rsp),%rax
  cmpb   $0x29,(%rax)
  jne    L649
  lea    0x1(%rax),%rdi
  call   <skipspace@plt>
  mov    %rax,(%rsp)
  jmp    L154
L293:
  mov    %rsp,%rsi
  mov    $0x0,%edx
  mov    %rax,%rdi
  call   <strtol@plt>
  mov    %eax,%ebx
  jmp    L154
L485:
  lea    0x1(%rax),%rdi
  call   <skipspace@plt>
  mov    %rax,(%rsp)
  mov    $0x2,%esi
  mov    %r12,%rdi
  call   <getnum>
  cmp    $0x80000001,%eax
  je     L582
  add    %eax,%ebx
  jmp    L708
L126:
  lea    0x1(%rax),%rdi
  call   <skipspace@plt>
  mov    %rax,(%rsp)
  mov    $0x2,%esi
  mov    %r12,%rdi
  call   <getnum>
  cmp    $0x80000001,%eax
  je     L283
  sub    %eax,%ebx
  jmp    L708
L469:
  lea    0x1(%rax),%rdi
  call   <skipspace@plt>
  mov    %rax,(%rsp)
  mov    $0x1,%esi
  mov    %r12,%rdi
  call   <getnum>
  cmp    $0x80000001,%eax
  je     L415
  imul   %eax,%ebx
  jmp    L708
L145:
  lea    0x1(%rax),%rdi
  call   <skipspace@plt>
  mov    %rax,(%rsp)
  mov    $0x1,%esi
  mov    %r12,%rdi
  call   <getnum>
  mov    %eax,%ecx
  cmp    $0x80000001,%eax
  je     L102
  test   %eax,%eax
  je     L102
  mov    %ebx,%eax
  cltd
  idiv   %ecx
  mov    %eax,%ebx
  jmp    L708
L1:
  lea    0x1(%rax),%rdi
  call   <skipspace@plt>
  mov    %rax,(%rsp)
  mov    $0x1,%esi
  mov    %r12,%rdi
  call   <getnum>
  mov    %eax,%esi
  cmp    $0x80000001,%eax
  je     L545
  test   %eax,%eax
  je     L545
  mov    %ebx,%eax
  cltd
  idiv   %esi
  mov    %edx,%ebx
  jmp    L708
L354:
  cmpb   $0x3c,0x1(%rax)
  jne    L278
  cmp    $0x3,%ebp
  jg     L307
L278:
  cmp    $0x5,%ebp
  jle    L616
  cmp    $0x5e,%dl
  je     L200
L616:
  cmp    $0x6,%ebp
  jle    L205
  cmp    $0x7c,%dl
  jne    L205
  lea    0x1(%rax),%rdi
  call   <skipspace@plt>
  mov    %rax,(%rsp)
  mov    $0x6,%esi
  mov    %r12,%rdi
  call   <getnum>
  cmp    $0x80000001,%eax
  je     L342
  or     %eax,%ebx
L708:
  cmp    $0x80000001,%ebx
  je     L205
L381:
  mov    (%rsp),%rdi
  call   <skipspace@plt>
  mov    %rax,(%rsp)
  movzbl (%rax),%edx
  cmp    $0x2,%ebp
  setg   %cl
  cmp    $0x2b,%dl
  jne    L442
  test   %cl,%cl
  jne    L485
L442:
  cmp    $0x2d,%dl
  jne    L93
  test   %cl,%cl
  jne    L126
L93:
  cmp    $0x1,%ebp
  setg   %cl
  cmp    $0x2a,%dl
  jne    L625
  test   %cl,%cl
  jne    L469
L625:
  cmp    $0x2f,%dl
  jne    L634
  test   %cl,%cl
  jne    L145
L634:
  cmp    $0x25,%dl
  jne    L474
  test   %cl,%cl
  jne    L1
L474:
  cmp    $0x3c,%dl
  je     L354
  cmp    $0x3e,%dl
  je     L177
  cmp    $0x4,%ebp
  jle    L278
  cmp    $0x26,%dl
  jne    L278
  lea    0x1(%rax),%rdi
  call   <skipspace@plt>
  mov    %rax,(%rsp)
  mov    $0x4,%esi
  mov    %r12,%rdi
  call   <getnum>
  cmp    $0x80000001,%eax
  je     L296
  and    %eax,%ebx
  jmp    L708
L307:
  lea    0x2(%rax),%rdi
  call   <skipspace@plt>
  mov    %rax,(%rsp)
  mov    $0x3,%esi
  mov    %r12,%rdi
  call   <getnum>
  mov    %eax,%ecx
  cmp    $0x80000001,%eax
  je     L379
  test   %eax,%eax
  je     L379
  shl    %cl,%ebx
  jmp    L708
L177:
  cmpb   $0x3e,0x1(%rax)
  jne    L616
  cmp    $0x3,%ebp
  jle    L616
  lea    0x2(%rax),%rdi
  call   <skipspace@plt>
  mov    %rax,(%rsp)
  mov    $0x3,%esi
  mov    %r12,%rdi
  call   <getnum>
  cmp    $0x80000001,%eax
  je     L22
  test   %eax,%eax
  je     L22
  mov    %eax,%ecx
  sar    %cl,%ebx
  jmp    L381
L200:
  lea    0x1(%rax),%rdi
  call   <skipspace@plt>
  mov    %rax,(%rsp)
  mov    $0x5,%esi
  mov    %r12,%rdi
  call   <getnum>
  cmp    $0x80000001,%eax
  je     L61
  xor    %eax,%ebx
  jmp    L708
L582:
  mov    %eax,%ebx
  jmp    L205
L283:
  mov    %eax,%ebx
  jmp    L205
L415:
  mov    %eax,%ebx
  jmp    L205
L102:
  mov    $0x80000001,%ebx
  jmp    L205
L545:
  mov    $0x80000001,%ebx
  jmp    L205
L379:
  mov    $0x80000001,%ebx
  jmp    L205
L22:
  mov    $0x80000001,%ebx
  jmp    L205
L296:
  mov    %eax,%ebx
  jmp    L205
L61:
  mov    %eax,%ebx
  jmp    L205
L342:
  mov    %eax,%ebx
  jmp    L205
L65:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int getnum(char **pp, int priority) {
  char *p = *pp;
  int i = -0x7fffffff, j;
  p = skipspace(p);
  if (*p == '+') {
    p = skipspace(p + 1);
    i = getnum(&p, 0);
  } else if (*p == '-') {
    p = skipspace(p + 1);
    i = getnum(&p, 0);
    if (i != -0x7fffffff) {
      i = -i;
    }
  } else if (*p == '~') {
    p = skipspace(p + 1);
    i = getnum(&p, 0);
    if (i != -0x7fffffff) {
      i = ~i;
    }
  } else if (*p == '(') {
    p = skipspace(p + 1);
    i = getnum(&p, 9);
    if (*p == ')') {
      p = skipspace(p + 1);
    } else {
      i = -0x7fffffff;
    }
  } else if ('0' <= *p && *p <= '9') {
    i = strtol(p, &p, 0);
  } else {
    i = -0x7fffffff;
  }
  for (;;) {
    if (i == -0x7fffffff) {
      break;
    }
    p = skipspace(p);
    if (*p == '+' && priority > 2) {
      p = skipspace(p + 1);
      j = getnum(&p, 2);
      if (j != -0x7fffffff) {
        i += j;
      } else {
        i = -0x7fffffff;
      }
    } else if (*p == '-' && priority > 2) {
      p = skipspace(p + 1);
      j = getnum(&p, 2);
      if (j != -0x7fffffff) {
        i -= j;
      } else {
        i = -0x7fffffff;
      }
    } else if (*p == '*' && priority > 1) {
      p = skipspace(p + 1);
      j = getnum(&p, 1);
      if (j != -0x7fffffff) {
        i *= j;
      } else {
        i = -0x7fffffff;
      }
    } else if (*p == '/' && priority > 1) {
      p = skipspace(p + 1);
      j = getnum(&p, 1);
      if (j != -0x7fffffff && j != 0) {
        i /= j;
      } else {
        i = -0x7fffffff;
      }
    } else if (*p == '%' && priority > 1) {
      p = skipspace(p + 1);
      j = getnum(&p, 1);
      if (j != -0x7fffffff && j != 0) {
        i %= j;
      } else {
        i = -0x7fffffff;
      }
    } else if (*p == '<' && p[1] == '<' && priority > 3) {
      p = skipspace(p + 2);
      j = getnum(&p, 3);
      if (j != -0x7fffffff && j != 0) {
        i <<= j;
      } else {
        i = -0x7fffffff;
      }
    } else if (*p == '>' && p[1] == '>' && priority > 3) {
      p = skipspace(p + 2);
      j = getnum(&p, 3);
      if (j != -0x7fffffff && j != 0) {
        i >>= j;
      } else {
        i = -0x7fffffff;
      }
    } else if (*p == '&' && priority > 4) {
      p = skipspace(p + 1);
      j = getnum(&p, 4);
      if (j != -0x7fffffff) {
        i &= j;
      } else {
        i = -0x7fffffff;
      }
    } else if (*p == '^' && priority > 5) {
      p = skipspace(p + 1);
      j = getnum(&p, 5);
      if (j != -0x7fffffff) {
        i ^= j;
      } else {
        i = -0x7fffffff;
      }
    } else if (*p == '|' && priority > 6) {
      p = skipspace(p + 1);
      j = getnum(&p, 6);
      if (j != -0x7fffffff) {
        i |= j;
      } else {
        i = -0x7fffffff;
      }
    } else {
      break;
    }
  }
  p = skipspace(p);
  *pp = p;
  return i;
}
```