user: 请将以下的汇编代码转换成C语言代码:

```asm
<fpattern_isvalid>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  cmpq   $0x0,-0x18(%rbp)
  jne    L106
  mov    $0x0,%eax
  jmp    L110
L106:
  movl   $0x0,-0x4(%rbp)
  jmp    L145
L292:
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  cmp    $0x7b,%eax
  je     L72
  cmp    $0x7b,%eax
  jg     L61
  cmp    $0x5c,%eax
  je     L230
  cmp    $0x5c,%eax
  jg     L61
  cmp    $0x21,%eax
  je     L309
  cmp    $0x5b,%eax
  jne    L61
L72:
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x5b,%al
  jne    L221
  mov    $0x5d,%eax
  jmp    L256
L221:
  mov    $0x7d,%eax
L256:
  mov    %al,-0x5(%rbp)
  addl   $0x1,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x21,%al
  jne    L187
  addl   $0x1,-0x4(%rbp)
  jmp    L187
L66:
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x5c,%al
  jne    L262
  addl   $0x1,-0x4(%rbp)
L262:
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L226
  mov    $0x0,%eax
  jmp    L110
L226:
  addl   $0x1,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x2d,%al
  jne    L301
  addl   $0x1,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x5c,%al
  jne    L179
  addl   $0x1,-0x4(%rbp)
L179:
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L203
  mov    $0x0,%eax
  jmp    L110
L203:
  addl   $0x1,-0x4(%rbp)
L301:
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L187
  mov    $0x0,%eax
  jmp    L110
L187:
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    %al,-0x5(%rbp)
  jne    L66
  jmp    L77
L230:
  addl   $0x1,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L135
  mov    $0x0,%eax
  jmp    L110
L309:
  addl   $0x1,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L118
  mov    $0x0,%eax
  jmp    L110
L61:
  nop
  jmp    L77
L135:
  nop
  jmp    L77
L118:
  nop
L77:
  addl   $0x1,-0x4(%rbp)
L145:
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L292
  mov    $0x1,%eax
L110:
  pop    %rbp
  ret
```

assistant: ```c
int fpattern_isvalid(const char *pat) {
  int len;
  char close;
  if (pat == ((void *)0))
    return (0);
  for (len = 0; pat[len] != '\0'; len++) {
    switch (pat[len]) {
    case '[':
    case '{':
      close = (char)((pat[len] == '[') ? ']' : '}');
      len++;
      if (pat[len] == '!')
        len++;
      while (pat[len] != close) {
        if (pat[len] == '\\')
          len++;
        if (pat[len] == '\0')
          return (0);
        len++;
        if (pat[len] == '-') {
          len++;
          if (pat[len] == '\\')
            len++;
          if (pat[len] == '\0')
            return (0);
          len++;
        }
        if (pat[len] == '\0')
          return (0);
      }
      break;
    case '\\':
      len++;
      if (pat[len] == '\0')
        return (0);
      break;
    case '!':
      len++;
      if (pat[len] == '\0')
        return (0);
      break;
    default:
      break;
    }
  }
  return (1);
}
```