user: What would the C source look like for the assembly code provided here:

```asm
<calculator>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  movl   $0x0,-0x14(%rbp)
  movl   $0x0,-0x10(%rbp)
  movl   $0x0,-0xc(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  jmp    L164
L51:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isdigit@plt>
  test   %rax,%rax
  je     L121
  mov    -0x10(%rbp),%edx
  mov    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  add    %eax,%eax
  mov    %eax,%edx
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  add    %edx,%eax
  sub    $0x30,%eax
  mov    %eax,-0x10(%rbp)
  jmp    L158
L121:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2a,%al
  jne    L170
  cmpl   $0x4,-0xc(%rbp)
  ja     L62
  mov    -0xc(%rbp),%eax
  lea    0x0(,%rax,4),%rdx
  lea    D28(%rip),%rax
  mov    (%rdx,%rax,1),%eax
  cltq
  lea    D28(%rip),%rdx
  add    %rdx,%rax
  notrack jmp *%rax
  mov    -0x10(%rbp),%eax
  mov    %eax,-0x14(%rbp)
  movl   $0x0,-0x10(%rbp)
  jmp    L62
  mov    -0x10(%rbp),%eax
  add    %eax,-0x14(%rbp)
  movl   $0x0,-0x10(%rbp)
  jmp    L62
  mov    -0x10(%rbp),%eax
  sub    %eax,-0x14(%rbp)
  movl   $0x0,-0x10(%rbp)
  jmp    L62
  mov    -0x14(%rbp),%eax
  imul   -0x10(%rbp),%eax
  mov    %eax,-0x14(%rbp)
  movl   $0x0,-0x10(%rbp)
  jmp    L62
  mov    -0x14(%rbp),%eax
  cltd
  idivl  -0x10(%rbp)
  mov    %eax,-0x14(%rbp)
  movl   $0x0,-0x10(%rbp)
  nop
L62:
  movl   $0x3,-0xc(%rbp)
  jmp    L158
L170:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x41,%al
  je     L189
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x61,%al
  jne    L96
L189:
  cmpl   $0x4,-0xc(%rbp)
  ja     L76
  mov    -0xc(%rbp),%eax
  lea    0x0(,%rax,4),%rdx
  lea    D49(%rip),%rax
  mov    (%rdx,%rax,1),%eax
  cltq
  lea    D49(%rip),%rdx
  add    %rdx,%rax
  notrack jmp *%rax
  mov    -0x10(%rbp),%eax
  mov    %eax,-0x14(%rbp)
  movl   $0x0,-0x10(%rbp)
  jmp    L76
  mov    -0x10(%rbp),%eax
  add    %eax,-0x14(%rbp)
  movl   $0x0,-0x10(%rbp)
  jmp    L76
  mov    -0x10(%rbp),%eax
  sub    %eax,-0x14(%rbp)
  movl   $0x0,-0x10(%rbp)
  jmp    L76
  mov    -0x14(%rbp),%eax
  imul   -0x10(%rbp),%eax
  mov    %eax,-0x14(%rbp)
  movl   $0x0,-0x10(%rbp)
  jmp    L76
  mov    -0x14(%rbp),%eax
  cltd
  idivl  -0x10(%rbp)
  mov    %eax,-0x14(%rbp)
  movl   $0x0,-0x10(%rbp)
  nop
L76:
  movl   $0x1,-0xc(%rbp)
  jmp    L158
L96:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x23,%al
  jne    L158
  cmpl   $0x4,-0xc(%rbp)
  ja     L238
  mov    -0xc(%rbp),%eax
  lea    0x0(,%rax,4),%rdx
  lea    D59(%rip),%rax
  mov    (%rdx,%rax,1),%eax
  cltq
  lea    D59(%rip),%rdx
  add    %rdx,%rax
  notrack jmp *%rax
  mov    -0x10(%rbp),%eax
  mov    %eax,-0x14(%rbp)
  movl   $0x0,-0x10(%rbp)
  jmp    L238
  mov    -0x10(%rbp),%eax
  add    %eax,-0x14(%rbp)
  movl   $0x0,-0x10(%rbp)
  jmp    L238
  mov    -0x10(%rbp),%eax
  sub    %eax,-0x14(%rbp)
  movl   $0x0,-0x10(%rbp)
  jmp    L238
  mov    -0x14(%rbp),%eax
  imul   -0x10(%rbp),%eax
  mov    %eax,-0x14(%rbp)
  movl   $0x0,-0x10(%rbp)
  jmp    L238
  mov    -0x14(%rbp),%eax
  cltd
  idivl  -0x10(%rbp)
  mov    %eax,-0x14(%rbp)
  movl   $0x0,-0x10(%rbp)
  nop
L238:
  mov    -0x14(%rbp),%eax
  jmp    L25
L158:
  addq   $0x1,-0x8(%rbp)
L164:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L51
  mov    -0x14(%rbp),%eax
L25:
  leave
  ret
```

assistant: ```c
int calculator(char *str) {
  int result;
  int num;
  enum { NONE, ADD, SUB, MUL, DIV } lastop;
  char *p;
  result = 0;
  num = 0;
  lastop = NONE;
  for (p = str; *p != '\0'; p++) {
    if (isdigit(*p)) {
      num = num * 10 + *p - '0';
    } else if (*p == '*') {
      switch (lastop) {
      case NONE:
        result = num;
        num = 0;
        break;
      case ADD:
        result += num;
        num = 0;
        break;
      case SUB:
        result -= num;
        num = 0;
        break;
      case MUL:
        result *= num;
        num = 0;
        break;
      case DIV:
        result /= num;
        num = 0;
        break;
      };
      lastop = MUL;
    } else if (*p == 'A' || *p == 'a') {
      switch (lastop) {
      case NONE:
        result = num;
        num = 0;
        break;
      case ADD:
        result += num;
        num = 0;
        break;
      case SUB:
        result -= num;
        num = 0;
        break;
      case MUL:
        result *= num;
        num = 0;
        break;
      case DIV:
        result /= num;
        num = 0;
        break;
      };
      lastop = ADD;
    } else if (*p == '#') {
      switch (lastop) {
      case NONE:
        result = num;
        num = 0;
        break;
      case ADD:
        result += num;
        num = 0;
        break;
      case SUB:
        result -= num;
        num = 0;
        break;
      case MUL:
        result *= num;
        num = 0;
        break;
      case DIV:
        result /= num;
        num = 0;
        break;
      };
      return (result);
    }
  }
  return (result);
}
```