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

```asm
<WildCompare>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %rdx,-0x38(%rbp)
  mov    %rcx,-0x40(%rbp)
  cmpq   $0x0,-0x30(%rbp)
  setne  %al
  movzbl %al,%eax
  mov    %eax,%edi
  call   <assert@plt>
  cmpq   $0x0,-0x40(%rbp)
  setne  %al
  movzbl %al,%eax
  mov    %eax,%edi
  call   <assert@plt>
  movq   $0x0,-0x20(%rbp)
  movq   $0x0,-0x18(%rbp)
  movq   $0x0,-0x10(%rbp)
  movq   $0x0,-0x8(%rbp)
  jmp    L110
L140:
  mov    -0x18(%rbp),%rax
  cmp    -0x38(%rbp),%rax
  jae    L41
  mov    -0x40(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L131
L41:
  cmpq   $0x0,-0x8(%rbp)
  jne    L145
  mov    $0x0,%eax
  jmp    L111
L145:
  mov    -0x8(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x10(%rbp),%rax
  mov    %rax,-0x20(%rbp)
  addq   $0x1,-0x10(%rbp)
  jmp    L110
L131:
  mov    -0x40(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x2a,%al
  jne    L210
  addq   $0x1,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x20(%rbp),%rax
  add    $0x1,%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x18(%rbp),%rax
  cmp    -0x38(%rbp),%rax
  je     L105
  mov    -0x40(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L110
L105:
  mov    $0x1,%eax
  jmp    L111
L210:
  mov    -0x40(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%edx
  mov    -0x30(%rbp),%rcx
  mov    -0x20(%rbp),%rax
  add    %rcx,%rax
  movzbl (%rax),%eax
  cmp    %al,%dl
  je     L143
  mov    -0x40(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x3f,%al
  jne    L58
L143:
  addq   $0x1,-0x20(%rbp)
  addq   $0x1,-0x18(%rbp)
  jmp    L110
L58:
  mov    -0x8(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x10(%rbp),%rax
  mov    %rax,-0x20(%rbp)
  addq   $0x1,-0x10(%rbp)
L110:
  mov    -0x20(%rbp),%rax
  cmp    -0x28(%rbp),%rax
  jae    L191
  mov    -0x30(%rbp),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L140
  jmp    L191
L103:
  addq   $0x1,-0x18(%rbp)
L191:
  mov    -0x18(%rbp),%rax
  cmp    -0x38(%rbp),%rax
  jae    L170
  mov    -0x40(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x2a,%al
  je     L103
L170:
  mov    -0x20(%rbp),%rax
  cmp    -0x28(%rbp),%rax
  je     L71
  mov    -0x30(%rbp),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L151
L71:
  mov    -0x18(%rbp),%rax
  cmp    -0x38(%rbp),%rax
  je     L179
  mov    -0x40(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L151
L179:
  mov    $0x1,%eax
  jmp    L111
L151:
  mov    $0x0,%eax
L111:
  leave
  ret
```

assistant: ```c
bool WildCompare(int32_t ref_length, const char *ref, int32_t wild_length, const char *wild) {
  assert(ref != NULL);
  assert(wild != NULL);
  int32_t r = 0;
  int32_t w = 0;
  int32_t r_save = 0;
  int32_t w_save = 0;
  while (r < ref_length && ref[r] != '\0') {
    if (w >= wild_length || wild[w] == '\0') {
      if (w_save <= 0) {
        return false;
      }
      w = w_save;
      r = r_save;
      ++r_save;
    } else if (wild[w] == '*') {
      ++w;
      w_save = w;
      r_save = r + 1;
      if (w == wild_length || wild[w] == '\0') {
        return true;
      }
    } else if (wild[w] == ref[r] || wild[w] == '?') {
      ++r;
      ++w;
    } else {
      w = w_save;
      r = r_save;
      ++r_save;
    }
  }
  while (w < wild_length && wild[w] == '*') {
    ++w;
  }
  return (r == ref_length || ref[r] == '\0') && (w == wild_length || wild[w] == '\0');
}
```