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

```asm
<check_dir>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x450,%rsp
  mov    %rdi,-0x438(%rbp)
  mov    %rsi,-0x440(%rbp)
  mov    %rdx,-0x448(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0x410(%rbp),%rax
  mov    $0x400,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  mov    -0x438(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x418(%rbp)
  movl   $0x0,-0x424(%rbp)
  movl   $0x0,-0x420(%rbp)
  movl   $0x0,-0x41c(%rbp)
  jmp    L180
L131:
  mov    -0x424(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x438(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    %al,-0x427(%rbp)
  cmpb   $0x5c,-0x427(%rbp)
  je     L7
  cmpb   $0x2f,-0x427(%rbp)
  jne    L164
L7:
  addl   $0x1,-0x420(%rbp)
  movl   $0x0,-0x41c(%rbp)
  jmp    L50
L164:
  cmpb   $0x2e,-0x427(%rbp)
  jne    L188
  mov    -0x424(%rbp),%eax
  add    $0x1,%eax
  cmp    %eax,-0x418(%rbp)
  jle    L188
  mov    -0x424(%rbp),%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x438(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    %al,-0x426(%rbp)
  cmpb   $0x2e,-0x426(%rbp)
  je     L188
  cmpl   $0x0,-0x424(%rbp)
  jle    L188
  mov    -0x424(%rbp),%eax
  cltq
  lea    -0x1(%rax),%rdx
  mov    -0x438(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    %al,-0x425(%rbp)
  cmpb   $0x2e,-0x425(%rbp)
  jne    L22
L188:
  cmpl   $0x1f,-0x41c(%rbp)
  jle    L196
  mov    $0x2,%eax
  jmp    L144
L196:
  mov    -0x41c(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x41c(%rbp)
  movslq %eax,%rdx
  mov    -0x420(%rbp),%eax
  cltq
  shl    $0x5,%rax
  add    %rbp,%rax
  add    %rdx,%rax
  lea    -0x410(%rax),%rdx
  movzbl -0x427(%rbp),%eax
  mov    %al,(%rdx)
L50:
  addl   $0x1,-0x424(%rbp)
L180:
  mov    -0x424(%rbp),%eax
  cmp    -0x418(%rbp),%eax
  jl     L131
  jmp    L28
L22:
  nop
L28:
  movl   $0x0,-0x424(%rbp)
  movl   $0x0,-0x41c(%rbp)
  jmp    L81
L98:
  lea    -0x410(%rbp),%rdx
  mov    -0x424(%rbp),%eax
  cltq
  shl    $0x5,%rax
  add    %rdx,%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x418(%rbp)
  lea    -0x410(%rbp),%rdx
  mov    -0x424(%rbp),%eax
  cltq
  shl    $0x5,%rax
  lea    (%rdx,%rax,1),%rsi
  mov    -0x41c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x440(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x418(%rbp),%eax
  mov    %eax,%edx
  mov    %rcx,%rdi
  call   <memcpy@plt>
  mov    -0x418(%rbp),%eax
  add    %eax,-0x41c(%rbp)
  mov    -0x41c(%rbp),%edx
  mov    -0x440(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <check_and_create_dir_@plt>
  mov    %eax,-0x414(%rbp)
  cmpl   $0x0,-0x414(%rbp)
  je     L5
  cmpl   $0x1,-0x414(%rbp)
  jne    L62
L5:
  mov    -0x424(%rbp),%eax
  cmp    -0x420(%rbp),%eax
  jge    L21
  mov    -0x41c(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x41c(%rbp)
  movslq %eax,%rdx
  mov    -0x440(%rbp),%rax
  add    %rdx,%rax
  movb   $0x2f,(%rax)
  jmp    L21
L62:
  mov    -0x414(%rbp),%eax
  jmp    L144
L21:
  nop
  addl   $0x1,-0x424(%rbp)
L81:
  mov    -0x424(%rbp),%eax
  cmp    -0x420(%rbp),%eax
  jle    L98
  mov    -0x448(%rbp),%rax
  mov    -0x41c(%rbp),%edx
  mov    %edx,(%rax)
  mov    $0x0,%eax
L144:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L189
  call   <__stack_chk_fail@plt>
L189:
  leave
  ret
```

assistant: ```c
int check_dir(const char *path, char *basepath, int *sz) {
  char dir[32][32];
  memset(dir, 0, 32 * 32);
  int len = strlen(path);
  int i = 0, j = 0, k = 0;
  for (; i < len; i++) {
    char t = path[i];
    if (t == '\\' || t == '/') {
      j++;
      k = 0;
      continue;
    }
    if (t == '.') {
      if (i + 1 < len) {
        char n1 = path[i + 1];
        if (n1 != '.') {
          if (i > 0) {
            char n2 = path[i - 1];
            if (n2 != '.')
              break;
          }
        }
      }
    }
    if (k >= 32) {
      return 2;
    }
    dir[j][k++] = t;
  }
  for (i = 0, k = 0; i <= j; i++) {
    len = strlen(dir[i]);
    memcpy(basepath + k, dir[i], len);
    k += len;
    int err = check_and_create_dir_(basepath, k);
    if (err == 0 || err == 1) {
      if (i < j)
        basepath[k++] = '/';
      continue;
    }
    return err;
  }
  *sz = k;
  return 0;
}
```