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

```asm
<_utils_searchexp>:
  endbr64
  test   %rsi,%rsi
  je     L93
  push   %r14
  push   %r13
  push   %r12
  mov    %edx,%r12d
  push   %rbp
  mov    %rdi,%rbp
  mov    %rsi,%rdi
  push   %rbx
  movzbl (%rsi),%eax
  mov    %rcx,%rbx
  test   %al,%al
  setne  %r13b
  test   %rbp,%rbp
  setne  %dl
  and    %dl,%r13b
  je     L247
  nopl   0x0(%rax)
L35:
  mov    %rbp,%r10
  cmp    $0x5e,%al
  jne    L63
  movzbl 0x1(%rdi),%eax
  xor    %r10d,%r10d
  add    $0x1,%rdi
L63:
  movzbl 0x0(%rbp),%edx
  mov    %rbp,%r8
  mov    %rdi,%r11
  xor    %r9d,%r9d
  jmp    L277
  nopl   0x0(%rax)
L298:
  test   %cl,%cl
  je     L234
  mov    %ecx,%esi
  cmp    $0x5a,%dl
  jg     L234
L14:
  add    $0x20,%edx
  mov    %r13d,%esi
L234:
  test   %r10,%r10
  je     L169
L320:
  lea    -0x41(%rax),%ecx
  cmp    $0x19,%cl
  ja     L110
  test   %sil,%sil
  jne    L288
L110:
  test   %dl,%dl
  je     L124
  cmp    %al,%dl
  jne    L124
L56:
  movzbl 0x1(%rdi),%eax
  mov    %rdi,%r11
  xor    %r10d,%r10d
  add    $0x1,%rdi
L321:
  mov    %eax,%edx
  add    $0x1,%r9d
  and    $0xfffffff7,%edx
  cmp    $0x24,%dl
  je     L11
L283:
  test   %al,%al
  je     L11
  movzbl 0x1(%r8),%edx
  add    $0x1,%r8
  test   %dl,%dl
  je     L57
L277:
  test   %r12d,%r12d
  setne  %sil
  cmp    $0x40,%dl
  setg   %cl
  and    %esi,%ecx
  cmp    $0x2a,%al
  jne    L298
  lea    0x1(%rdi),%r14
  movzbl 0x1(%rdi),%eax
  mov    %r8,%r10
  mov    %r14,%rdi
  test   %cl,%cl
  je     L320
  mov    %ecx,%esi
  cmp    $0x5a,%dl
  jg     L320
  jmp    L14
  nopl   0x0(%rax)
L169:
  lea    -0x41(%rax),%ecx
  cmp    $0x19,%cl
  ja     L113
  lea    0x20(%rax),%ecx
  test   %sil,%sil
  cmovne %ecx,%eax
L113:
  cmp    %al,%dl
  jne    L399
  movzbl 0x1(%rdi),%eax
  add    $0x1,%r9d
  add    $0x1,%rdi
  mov    %eax,%edx
  and    $0xfffffff7,%edx
  cmp    $0x24,%dl
  jne    L283
  nopl   0x0(%rax,%rax,1)
L11:
  xor    %edx,%edx
L1:
  cmp    $0x2a,%al
  je     L47
  cmp    $0x24,%al
  je     L105
L201:
  test   %edx,%edx
  jne    L245
L7:
  movzbl (%rdi),%eax
  cmp    $0x2c,%al
  je     L258
  test   %al,%al
  je     L258
  cmp    $0x24,%al
  je     L87
L245:
  mov    $0x2c,%esi
  call   <strchr@plt>
  test   %rax,%rax
  je     L247
L108:
  lea    0x1(%rax),%rdi
  movzbl 0x1(%rax),%eax
  jmp    L35
  nopl   0x0(%rax)
L124:
  mov    %rdi,%r11
  jmp    L321
  nopl   0x0(%rax,%rax,1)
L288:
  lea    0x20(%rax),%ecx
  cmp    %dl,%cl
  jne    L70
  test   %dl,%dl
  jne    L56
L70:
  movzbl 0x1(%r8),%edx
  add    $0x1,%r8
  add    $0x1,%r9d
  mov    %rdi,%r11
  test   %dl,%dl
  jne    L277
  nopw   0x0(%rax,%rax,1)
L57:
  cmp    $0x2a,%al
  jne    L7
  xor    %edx,%edx
L47:
  movzbl 0x1(%rdi),%eax
  add    $0x1,%rdi
  cmp    $0x24,%al
  jne    L201
L105:
  movslq %r9d,%r9
  add    $0x1,%rdi
  cmpb   $0x0,0x0(%rbp,%r9,1)
  je     L201
  mov    $0x2c,%esi
  call   <strchr@plt>
  test   %rax,%rax
  jne    L108
L247:
  pop    %rbx
  mov    $0xfffffffc,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L399:
  movzbl (%r11),%eax
  mov    %r11,%rdi
  mov    $0xfffffffc,%edx
  jmp    L1
L258:
  test   %rbx,%rbx
  setne  %cl
  test   %r10,%r10
  setne  %dl
  test   %dl,%cl
  je     L87
  cmp    $0x24,%al
  jne    L158
L87:
  pop    %rbx
  xor    %eax,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L158:
  mov    %r10,(%rbx)
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L93:
  mov    $0xfffffffc,%eax
  ret
```

assistant: ```c
int _utils_searchexp(const char *haystack, const char *needleslist, int ignore_case, const char **rest) {
  int ret = -4;
  if (needleslist == NULL || needleslist[0] == '\0')
    return ret;
  if (haystack != NULL) {
    int i = -1;
    const char *needle = needleslist;
    while (needle != NULL) {
      i = 0;
      ret = -2;
      const char *wildcard = &(haystack[i]);
      if (*needle == '^') {
        wildcard = NULL;
        needle++;
      }
      const char *needle_entry = needle;
      do {
        ;
        char hay = haystack[i];
        if (*needle == '*') {
          wildcard = &(haystack[i]);
          needle++;
        }
        if (ignore_case && hay > 0x40 && hay < 0x5b)
          hay += 0x20;
        if (wildcard == NULL) {
          char lneedle = *needle;
          if (ignore_case && lneedle > 0x40 && lneedle < 0x5b)
            lneedle += 0x20;
          if (lneedle != hay) {
            ;
            needle = needle_entry;
            ret = -4;
            break;
          } else if (lneedle == hay) {
            ret = 0;
          }
          needle++;
        } else {
          char lneedle = *needle;
          if (ignore_case && lneedle > 0x40 && lneedle < 0x5b)
            lneedle += 0x20;
          needle_entry = needle;
          ret = 0;
          if (hay != '\0' && lneedle == hay) {
            wildcard = NULL;
            needle++;
          }
        }
        i++;
        if (*needle == ',' || *needle == '\0' || *needle == '$') {
          ;
          break;
        }
      } while (haystack[i] != '\0');
      if (*needle == '*')
        needle++;
      if (*needle == '$') {
        if (haystack[i] != '\0')
          ret = -4;
        needle++;
      };
      if (ret == 0) {
        if (*needle == ',' || *needle == '\0' || *needle == '$') {
          if (wildcard && (*needle != '$') && (rest != NULL))
            *rest = wildcard;
          break;
        } else
          ret = -4;
      }
      needle = strchr(needle, ',');
      if (needle != NULL)
        needle++;
      wildcard = 0;
    }
  }
  return ret;
}
```