user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<dos_unix_sort>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    -0x28(%rbp),%rax
  mov    (%rax),%rax
  mov    (%rax),%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x30(%rbp),%rax
  mov    (%rax),%rax
  mov    (%rax),%rax
  mov    %rax,-0x8(%rbp)
L242:
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <dos_valid_char@plt>
  mov    %al,-0x12(%rbp)
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <dos_valid_char@plt>
  mov    %al,-0x11(%rbp)
  cmpb   $0x0,-0x12(%rbp)
  je     L63
  movzbl -0x12(%rbp),%eax
  cmp    -0x11(%rbp),%al
  je     L21
L63:
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L264
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%edx
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  cmp    %al,%dl
  je     L247
L264:
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L43
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L43
  mov    -0x30(%rbp),%rax
  mov    (%rax),%rax
  mov    (%rax),%rdx
  mov    -0x28(%rbp),%rax
  mov    (%rax),%rax
  mov    (%rax),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcmp@plt>
  jmp    L230
L43:
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L26
  mov    $0xffffffff,%eax
  jmp    L230
L26:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L215
  mov    $0x1,%eax
  jmp    L230
L215:
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2e,%al
  jne    L29
  mov    $0xffffffff,%eax
  jmp    L230
L29:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2e,%al
  jne    L55
  mov    $0x1,%eax
  jmp    L230
L55:
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x7e,%al
  jne    L185
  mov    $0xffffffff,%eax
  jmp    L230
L185:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x7e,%al
  jne    L123
  mov    $0x1,%eax
  jmp    L230
L123:
  cmpb   $0x0,-0x12(%rbp)
  jne    L14
  cmpb   $0x0,-0x11(%rbp)
  jne    L14
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%edx
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  jmp    L230
L14:
  cmpb   $0x0,-0x12(%rbp)
  jne    L183
  mov    $0x1,%eax
  jmp    L230
L183:
  cmpb   $0x0,-0x11(%rbp)
  jne    L157
  mov    $0xffffffff,%eax
  jmp    L230
L157:
  movsbl -0x12(%rbp),%eax
  movsbl -0x11(%rbp),%edx
  sub    %edx,%eax
  jmp    L230
L21:
  nop
  jmp    L79
L247:
  nop
L79:
  addq   $0x1,-0x10(%rbp)
  addq   $0x1,-0x8(%rbp)
  jmp    L242
L230:
  leave
  ret
```

assistant: ```c
int dos_unix_sort(const struct dirent **s1, const struct dirent **s2) {
  const char *n1 = (*s1)->d_name;
  const char *n2 = (*s2)->d_name;
  for (;; n1++, n2++) {
    char c1 = dos_valid_char(*n1);
    char c2 = dos_valid_char(*n2);
    if (c1 && c1 == c2)
      continue;
    if (*n1 && *n1 == *n2)
      continue;
    if (!*n1 && !*n2) {
      return strcmp((*s1)->d_name, (*s2)->d_name);
    }
    if (!*n1)
      return -1;
    if (!*n2)
      return 1;
    if (*n1 == '.')
      return -1;
    if (*n2 == '.')
      return 1;
    if (*n1 == '~')
      return -1;
    if (*n2 == '~')
      return 1;
    if (!c1 && !c2)
      return *n1 - *n2;
    if (!c1)
      return 1;
    if (!c2)
      return -1;
    return c1 - c2;
  }
}
```