user: Translate the below assembly code into C programming language:

```asm
<do_mkdir>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x48,%rsp
  mov    %rdi,-0x68(%rbp)
  mov    %esi,-0x6c(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  mov    %rsp,%rax
  mov    %rax,%rbx
  mov    -0x68(%rbp),%rax
  mov    %rax,%rdi
  call   <assert@plt>
  mov    -0x68(%rbp),%rax
  mov    %rax,-0x50(%rbp)
  movl   $0x0,-0x54(%rbp)
  mov    -0x68(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  add    $0x1,%eax
  movslq %eax,%rdx
  sub    $0x1,%rdx
  mov    %rdx,-0x48(%rbp)
  movslq %eax,%rdx
  mov    %rdx,%r14
  mov    $0x0,%r15d
  movslq %eax,%rdx
  mov    %rdx,%r12
  mov    $0x0,%r13d
  cltq
  mov    $0x10,%edx
  sub    $0x1,%rdx
  add    %rdx,%rax
  mov    $0x10,%esi
  mov    $0x0,%edx
  div    %rsi
  imul   $0x10,%rax,%rax
  mov    %rax,%rcx
  and    $0xfffffffffffff000,%rcx
  mov    %rsp,%rdx
  sub    %rcx,%rdx
L62:
  cmp    %rdx,%rsp
  je     L125
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L62
L125:
  mov    %rax,%rdx
  and    $0xfff,%edx
  sub    %rdx,%rsp
  mov    %rax,%rdx
  and    $0xfff,%edx
  test   %rdx,%rdx
  je     L112
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L112:
  mov    %rsp,%rax
  add    $0x0,%rax
  mov    %rax,-0x40(%rbp)
  jmp    L56
L103:
  mov    -0x50(%rbp),%rax
  sub    -0x68(%rbp),%rax
  mov    %eax,-0x54(%rbp)
  cmpl   $0x0,-0x54(%rbp)
  jle    L22
  mov    -0x54(%rbp),%edx
  mov    -0x68(%rbp),%rcx
  mov    -0x40(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    -0x40(%rbp),%rdx
  mov    -0x54(%rbp),%eax
  cltq
  movb   $0x0,(%rdx,%rax,1)
  mov    -0x6c(%rbp),%edx
  mov    -0x40(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <mkdir@plt>
  test   %rax,%rax
  jns    L22
  mov    D31(%rip),%rax
  mov    (%rax),%rdx
  mov    D14(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,%rdx
  je     L22
  mov    $0x0,%eax
  call   <mq_errno@plt>
  jmp    L60
L22:
  addq   $0x1,-0x50(%rbp)
L56:
  mov    -0x50(%rbp),%rax
  mov    $0x2f,%esi
  mov    %rax,%rdi
  call   <strchr@plt>
  mov    %rax,-0x50(%rbp)
  cmpq   $0x0,-0x50(%rbp)
  jne    L103
  mov    -0x6c(%rbp),%edx
  mov    -0x68(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <mkdir@plt>
  test   %rax,%rax
  jns    L9
  mov    D31(%rip),%rax
  mov    (%rax),%rdx
  mov    D14(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,%rdx
  je     L9
  mov    $0x0,%eax
  call   <mq_errno@plt>
  jmp    L60
L9:
  mov    $0x0,%eax
L60:
  mov    %rbx,%rsp
  mov    -0x38(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L69
  call   <__stack_chk_fail@plt>
L69:
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
```

assistant: ```c
int do_mkdir(const char *dir, mode_t mode) {
  assert(dir);
  const char *p = dir;
  int len = 0;
  char tmp[strlen(dir) + 1];
  while ((p = strchr(p, '/')) != NULL) {
    len = p - dir;
    if (len > 0) {
      memcpy(tmp, dir, len);
      tmp[len] = '\0';
      if ((mkdir(tmp, mode) < 0) && (errno != EEXIST)) {
        return mq_errno();
      }
    }
    p += 1;
  }
  if ((mkdir(dir, mode) < 0) && (errno != EEXIST)) {
    return mq_errno();
  }
  return 0;
}
```