user: Converte this assembly snippet into its equivalent C code:

```asm
<glob>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x150,%rsp
  mov    %rdi,-0x138(%rbp)
  mov    %rsi,-0x140(%rbp)
  mov    %edx,-0x144(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  cmpq   $0x0,-0x138(%rbp)
  je     L254
  cmpq   $0x0,-0x140(%rbp)
  jne    L611
L254:
  mov    $0x0,%eax
  jmp    L318
L611:
  mov    -0x140(%rbp),%rax
  mov    %rax,-0x120(%rbp)
  jmp    L50
L245:
  movsbl -0x12f(%rbp),%eax
  cmp    $0x5c,%eax
  je     L401
  cmp    $0x5c,%eax
  jg     L125
  cmp    $0x5b,%eax
  je     L462
  cmp    $0x5b,%eax
  jg     L125
  cmp    $0x2a,%eax
  je     L787
  cmp    $0x3f,%eax
  je     L481
  jmp    L125
L401:
  mov    -0x138(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x138(%rbp)
  movzbl (%rax),%eax
  mov    %al,-0x12f(%rbp)
L125:
  mov    -0x140(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x140(%rbp)
  movzbl (%rax),%eax
  cmp    %al,-0x12f(%rbp)
  je     L50
  mov    $0x0,%eax
  jmp    L318
L481:
  mov    -0x140(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L385
  cmpl   $0x0,-0x144(%rbp)
  je     L91
  mov    -0x140(%rbp),%rax
  cmp    -0x120(%rbp),%rax
  jne    L91
  mov    -0x140(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2e,%al
  jne    L91
L385:
  mov    $0x0,%eax
  jmp    L318
L91:
  addq   $0x1,-0x140(%rbp)
  jmp    L50
L787:
  cmpl   $0x0,-0x144(%rbp)
  je     L181
  mov    -0x140(%rbp),%rax
  cmp    -0x120(%rbp),%rax
  jne    L181
  mov    -0x140(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2e,%al
  jne    L181
  mov    $0x0,%eax
  jmp    L318
L408:
  cmpb   $0x3f,-0x12f(%rbp)
  jne    L181
  mov    -0x140(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x140(%rbp)
  movzbl (%rax),%eax
  test   %al,%al
  jne    L181
  mov    $0x0,%eax
  jmp    L318
L181:
  mov    -0x138(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x138(%rbp)
  movzbl (%rax),%eax
  mov    %al,-0x12f(%rbp)
  cmpb   $0x2a,-0x12f(%rbp)
  je     L408
  cmpb   $0x3f,-0x12f(%rbp)
  je     L408
  cmpb   $0x0,-0x12f(%rbp)
  jne    L808
  mov    $0x1,%eax
  jmp    L318
L808:
  cmpb   $0x5c,-0x12f(%rbp)
  jne    L207
  mov    -0x138(%rbp),%rax
  movzbl (%rax),%eax
  jmp    L78
L207:
  movzbl -0x12f(%rbp),%eax
L78:
  mov    %al,-0x129(%rbp)
L549:
  cmpb   $0x5b,-0x12f(%rbp)
  je     L350
  mov    -0x140(%rbp),%rax
  movzbl (%rax),%eax
  cmp    %al,-0x129(%rbp)
  jne    L239
L350:
  subq   $0x1,-0x138(%rbp)
  mov    -0x140(%rbp),%rcx
  mov    -0x138(%rbp),%rax
  mov    $0x0,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <glob>
  test   %eax,%eax
  je     L239
  mov    $0x1,%eax
  jmp    L318
L239:
  mov    -0x140(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x140(%rbp)
  movzbl (%rax),%eax
  test   %al,%al
  jne    L549
  mov    $0x0,%eax
  jmp    L318
L462:
  mov    -0x140(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L301
  mov    $0x0,%eax
  jmp    L318
L301:
  mov    -0x140(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x140(%rbp)
  movzbl (%rax),%eax
  mov    %al,-0x12b(%rbp)
  mov    -0x138(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x21,%al
  je     L723
  movb   $0xff,-0x12e(%rbp)
  lea    -0x110(%rbp),%rax
  mov    $0x0,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  jmp    L639
L723:
  movb   $0x0,-0x12e(%rbp)
  lea    -0x110(%rbp),%rax
  mov    $0x0,%edx
  mov    $0xff,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  movb   $0x0,-0x110(%rbp)
  addq   $0x1,-0x138(%rbp)
L639:
  movl   $0x0,-0x128(%rbp)
  movl   $0x0,-0x124(%rbp)
  jmp    L530
L815:
  cmpl   $0x0,-0x124(%rbp)
  je     L151
  movl   $0x0,-0x124(%rbp)
  cmpb   $0x0,-0x12e(%rbp)
  je     L242
  movzbl -0x12a(%rbp),%eax
  cmp    -0x12b(%rbp),%al
  je     L590
L242:
  mov    -0x128(%rbp),%eax
  cltq
  movzbl -0x12a(%rbp),%edx
  mov    %dl,-0x112(%rbp,%rax,1)
  movzbl -0x12a(%rbp),%eax
  cltq
  movzbl -0x12e(%rbp),%edx
  mov    %dl,-0x110(%rbp,%rax,1)
  cmpl   $0x1,-0x128(%rbp)
  jne    L530
  movl   $0x2,-0x128(%rbp)
  jmp    L530
L151:
  movzbl -0x12a(%rbp),%eax
  cmp    $0x2d,%eax
  je     L52
  cmp    $0x5c,%eax
  je     L273
  cmpb   $0x0,-0x12e(%rbp)
  je     L773
  movzbl -0x12a(%rbp),%eax
  cmp    -0x12b(%rbp),%al
  je     L276
L773:
  mov    -0x128(%rbp),%eax
  cltq
  movzbl -0x12a(%rbp),%edx
  mov    %dl,-0x112(%rbp,%rax,1)
  movzbl -0x12a(%rbp),%eax
  cltq
  movzbl -0x12e(%rbp),%edx
  mov    %dl,-0x110(%rbp,%rax,1)
  cmpl   $0x1,-0x128(%rbp)
  jne    L447
  movl   $0x2,-0x128(%rbp)
  jmp    L447
L273:
  movl   $0x1,-0x124(%rbp)
  jmp    L791
L52:
  cmpl   $0x1,-0x128(%rbp)
  jne    L501
  mov    $0xffffffff,%eax
  jmp    L318
L501:
  movl   $0x1,-0x128(%rbp)
  jmp    L791
L447:
  nop
L791:
  cmpl   $0x2,-0x128(%rbp)
  jne    L530
  cmpl   $0x0,-0x124(%rbp)
  jne    L530
  movl   $0x0,-0x128(%rbp)
  movzbl -0x112(%rbp),%eax
  mov    %al,-0x12d(%rbp)
  movzbl -0x111(%rbp),%eax
  mov    %al,-0x12c(%rbp)
  movzbl -0x12d(%rbp),%eax
  cmp    -0x12c(%rbp),%al
  jbe    L309
  movzbl -0x12c(%rbp),%eax
  mov    %al,-0x12d(%rbp)
  movzbl -0x112(%rbp),%eax
  mov    %al,-0x12c(%rbp)
L309:
  cmpb   $0x0,-0x12e(%rbp)
  je     L580
  movzbl -0x12d(%rbp),%eax
  cmp    -0x12b(%rbp),%al
  ja     L580
  movzbl -0x12b(%rbp),%eax
  cmp    -0x12c(%rbp),%al
  jbe    L440
L580:
  movzbl -0x12c(%rbp),%eax
  movzbl -0x12d(%rbp),%edx
  sub    %edx,%eax
  cmp    $0x1,%eax
  jle    L530
  movzbl -0x12c(%rbp),%eax
  sub    -0x12d(%rbp),%al
  sub    $0x1,%eax
  movzbl %al,%edx
  movzbl -0x12e(%rbp),%eax
  movzbl -0x12d(%rbp),%ecx
  lea    0x1(%rcx),%rsi
  lea    -0x110(%rbp),%rcx
  add    %rsi,%rcx
  mov    %eax,%esi
  mov    %rcx,%rdi
  call   <memset@plt>
L530:
  mov    -0x138(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x138(%rbp)
  movzbl (%rax),%eax
  mov    %al,-0x12a(%rbp)
  cmpb   $0x0,-0x12a(%rbp)
  je     L217
  cmpb   $0x5d,-0x12a(%rbp)
  jne    L815
L217:
  mov    -0x138(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L518
  mov    $0xffffffff,%eax
  jmp    L318
L518:
  movzbl -0x12b(%rbp),%eax
  cltq
  movzbl -0x110(%rbp,%rax,1),%eax
  test   %al,%al
  jne    L190
  mov    $0x0,%eax
  jmp    L318
L590:
  nop
  jmp    L337
L276:
  nop
  jmp    L337
L440:
  nop
L337:
  movl   $0x0,-0x124(%rbp)
  jmp    L645
L363:
  cmpl   $0x0,-0x124(%rbp)
  je     L415
  movl   $0x0,-0x124(%rbp)
  jmp    L645
L415:
  cmpb   $0x5c,-0x12a(%rbp)
  jne    L10
  movl   $0x1,-0x124(%rbp)
  jmp    L645
L10:
  cmpb   $0x2d,-0x12a(%rbp)
  jne    L645
  mov    -0x138(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2d,%al
  jne    L645
  mov    $0xffffffff,%eax
  jmp    L318
L645:
  mov    -0x138(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x138(%rbp)
  movzbl (%rax),%eax
  mov    %al,-0x12a(%rbp)
  cmpb   $0x0,-0x12a(%rbp)
  je     L158
  cmpb   $0x5d,-0x12a(%rbp)
  jne    L363
  jmp    L158
L190:
  nop
  jmp    L50
L158:
  nop
L50:
  mov    -0x138(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x138(%rbp)
  movzbl (%rax),%eax
  mov    %al,-0x12f(%rbp)
  cmpb   $0x0,-0x12f(%rbp)
  jne    L245
  mov    -0x140(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  sete   %al
  movzbl %al,%eax
L318:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L630
  call   <__stack_chk_fail@plt>
L630:
  leave
  ret
```

assistant: ```c
int glob(const char *pat, const char *str, int isdotspecial) {
  char c, cnext;
  const char *str0;
  if (!pat || !str)
    return (0);
  str0 = str;
  while ((c = *pat++)) {
    switch (c) {
    case '\\':
      c = *pat++;
    default:
      if (c != *str++)
        return (0);
      break;
    case '?':
      if (!(*str) || (isdotspecial && str == str0 && *str == '.'))
        return (0);
      str++;
      break;
    case '*':
      if (isdotspecial && str == str0 && *str == '.')
        return (0);
      while ((c = *pat++) == '*' || c == '?')
        if (c == '?' && !(*str++))
          return (0);
      if (c == '\0')
        return (1);
      cnext = (c == '\\') ? *pat : c;
      while (1) {
        if ((c == '[' || *str == cnext) && glob(--pat, str, 0))
          return (1);
        if (!(*str++))
          return (0);
      }
      break;
    case '[':
      if (!(*str))
        return (0);
      else {
        unsigned char c_endpoints[2], mark, targets[256], uc, us;
        int flip_flop, isliteral;
        us = (unsigned char)(*str++);
        if (*pat != '!') {
          mark = 0xff;
          memset(targets, 0x00, sizeof(targets));
        } else {
          mark = 0x00;
          memset(targets, 0xff, sizeof(targets));
          targets[0] = 0x00;
          pat++;
        }
        flip_flop = 0;
        isliteral = 0;
        while ((uc = *pat++) && uc != ']') {
          if (isliteral) {
            isliteral = 0;
            if (mark && uc == us)
              goto hyperspace_bypass;
            c_endpoints[flip_flop] = uc;
            targets[uc] = mark;
            if (flip_flop == 1)
              flip_flop = 2;
          } else {
            switch (uc) {
            default:
              if (mark && uc == us)
                goto hyperspace_bypass;
              c_endpoints[flip_flop] = uc;
              targets[uc] = mark;
              if (flip_flop == 1)
                flip_flop = 2;
              break;
            case '\\':
              isliteral = 1;
              break;
            case '-':
              if (flip_flop == 1)
                return (-1);
              flip_flop = 1;
              break;
            }
            if (flip_flop == 2 && !isliteral) {
              unsigned char c1, c2;
              flip_flop = 0;
              c1 = c_endpoints[0];
              c2 = c_endpoints[1];
              if (c1 > c2) {
                c1 = c2;
                c2 = c_endpoints[0];
              }
              if (mark && (c1 <= us && us <= c2))
                goto hyperspace_bypass;
              if ((c2 - c1) > 1)
                memset(targets + c1 + 1, mark, (c2 - c1) - 1);
            }
          }
        }
        if (!(*pat))
          return (-1);
        if (!targets[us])
          return (0);
        break;
      hyperspace_bypass:
        isliteral = 0;
        while ((uc = *pat++) && uc != ']') {
          if (isliteral)
            isliteral = 0;
          else if (uc == '\\')
            isliteral = 1;
          else if (uc == '-' && *pat == '-')
            return (-1);
        }
        break;
      }
      break;
    }
  }
  return (!(*str) ? 1 : 0);
}
```