user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<window_calc>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0x1c(%rbp)
  movl   $0x0,-0x18(%rbp)
  movl   $0x0,-0x14(%rbp)
  movq   $0x0,-0x10(%rbp)
  jmp    L7
L156:
  movl   $0x0,-0x18(%rbp)
  movq   $0x0,-0x10(%rbp)
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isspace@plt>
  test   %rax,%rax
  je     L151
  addq   $0x1,-0x28(%rbp)
  jmp    L169
L151:
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x68,%al
  jne    L113
  addq   $0x1,-0x28(%rbp)
  mov    D14(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x18(%rbp)
  jmp    L169
L113:
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x77,%al
  jne    L2
  addq   $0x1,-0x28(%rbp)
  mov    D17(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x18(%rbp)
  jmp    L169
L2:
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isdigit@plt>
  test   %rax,%rax
  je     L204
  lea    -0x10(%rbp),%rcx
  mov    -0x28(%rbp),%rax
  mov    $0xa,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strtoul@plt>
  mov    %eax,-0x18(%rbp)
  mov    -0x10(%rbp),%rax
  mov    %rax,-0x28(%rbp)
  jmp    L169
L204:
  mov    -0x28(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x28(%rbp)
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,-0x14(%rbp)
  jmp    L7
L169:
  cmpl   $0x0,-0x14(%rbp)
  je     L148
  cmpl   $0x2f,-0x14(%rbp)
  je     L0
  cmpl   $0x2f,-0x14(%rbp)
  jg     L8
  cmpl   $0x2d,-0x14(%rbp)
  je     L114
  cmpl   $0x2d,-0x14(%rbp)
  jg     L8
  cmpl   $0x2a,-0x14(%rbp)
  je     L42
  cmpl   $0x2b,-0x14(%rbp)
  jne    L8
  mov    -0x18(%rbp),%eax
  add    %eax,-0x1c(%rbp)
  movl   $0x0,-0x14(%rbp)
  jmp    L7
L114:
  mov    -0x18(%rbp),%eax
  sub    %eax,-0x1c(%rbp)
  movl   $0x0,-0x14(%rbp)
  jmp    L7
L42:
  mov    -0x1c(%rbp),%eax
  imul   -0x18(%rbp),%eax
  mov    %eax,-0x1c(%rbp)
  movl   $0x0,-0x14(%rbp)
  jmp    L7
L0:
  mov    -0x1c(%rbp),%eax
  cltd
  idivl  -0x18(%rbp)
  mov    %eax,-0x1c(%rbp)
  movl   $0x0,-0x14(%rbp)
  jmp    L7
L8:
  mov    $0xffffffff,%eax
  jmp    L203
L148:
  cmpl   $0x0,-0x18(%rbp)
  je     L7
  mov    -0x18(%rbp),%eax
  mov    %eax,-0x1c(%rbp)
L7:
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L156
  mov    -0x1c(%rbp),%eax
L203:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L46
  call   <__stack_chk_fail@plt>
L46:
  leave
  ret
```

assistant: ```c
int window_calc(char *e) {
  int result = 0, tmp = 0, op = 0;
  char *s = NULL;
  while (*e != '\0') {
    tmp = 0;
    s = NULL;
    if (isspace(*e))
      e++;
    else if (*e == 'h') {
      e++;
      tmp = LINES;
    } else if (*e == 'w') {
      e++;
      tmp = COLS;
    } else if (isdigit(*e)) {
      tmp = strtoul(e, &s, 10);
      e = s;
    } else {
      op = *e++;
      continue;
    }
    if (op) {
      switch (op) {
      case '+':
        result += tmp;
        op = 0;
        break;
      case '-':
        result -= tmp;
        op = 0;
        break;
      case '*':
        result *= tmp;
        op = 0;
        break;
      case '/':
        result /= tmp;
        op = 0;
        break;
      default:
        return -1;
      }
    } else if (tmp)
      result = tmp;
  }
  return result;
}
```