user: 请将以下的汇编代码转换成C语言代码：

```asm
<_gettemp>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %edx,-0x44(%rbp)
  mov    %ecx,-0x48(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  cmpq   $0x0,-0x40(%rbp)
  je     L503
  cmpl   $0x0,-0x44(%rbp)
  je     L503
  mov    D33(%rip),%rax
  mov    (%rax),%rdx
  mov    D10(%rip),%rax
  mov    %rdx,(%rax)
  mov    $0x0,%eax
  jmp    L231
L503:
  mov    -0x38(%rbp),%rax
  mov    %rax,-0x20(%rbp)
  jmp    L208
L27:
  addq   $0x1,-0x20(%rbp)
L208:
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L27
  mov    -0x48(%rbp),%eax
  cltq
  neg    %rax
  add    %rax,-0x20(%rbp)
  mov    -0x20(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  subq   $0x1,-0x20(%rbp)
  mov    -0x20(%rbp),%rax
  cmp    -0x38(%rbp),%rax
  jae    L395
  mov    D33(%rip),%rax
  mov    (%rax),%rdx
  mov    D10(%rip),%rax
  mov    %rdx,(%rax)
  mov    $0x0,%eax
  jmp    L231
L395:
  mov    $0x0,%eax
  call   <getpid@plt>
  mov    %eax,-0x28(%rbp)
  jmp    L513
L185:
  mov    -0x28(%rbp),%edx
  movslq %edx,%rax
  imul   $0x66666667,%rax,%rax
  shr    $0x20,%rax
  sar    $0x2,%eax
  mov    %edx,%esi
  sar    $0x1f,%esi
  sub    %esi,%eax
  mov    %eax,%ecx
  mov    %ecx,%eax
  shl    $0x2,%eax
  add    %ecx,%eax
  add    %eax,%eax
  mov    %edx,%ecx
  sub    %eax,%ecx
  mov    %ecx,%eax
  lea    0x30(%rax),%ecx
  mov    -0x20(%rbp),%rax
  lea    -0x1(%rax),%rdx
  mov    %rdx,-0x20(%rbp)
  mov    %ecx,%edx
  mov    %dl,(%rax)
  mov    -0x28(%rbp),%eax
  movslq %eax,%rdx
  imul   $0x66666667,%rdx,%rdx
  shr    $0x20,%rdx
  sar    $0x2,%edx
  sar    $0x1f,%eax
  mov    %eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  mov    %eax,-0x28(%rbp)
L513:
  mov    -0x20(%rbp),%rax
  cmp    -0x38(%rbp),%rax
  jb     L150
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x58,%al
  jne    L150
  cmpl   $0x0,-0x28(%rbp)
  jne    L185
  jmp    L150
L11:
  mov    $0x0,%eax
  call   <arc4random@plt>
  movzwl %ax,%eax
  movslq %eax,%rdx
  imul   $0x4ec4ec4f,%rdx,%rdx
  shr    $0x20,%rdx
  sar    $0x4,%edx
  mov    %eax,%ecx
  sar    $0x1f,%ecx
  sub    %ecx,%edx
  mov    %edx,-0x28(%rbp)
  mov    -0x28(%rbp),%edx
  imul   $0x34,%edx,%edx
  sub    %edx,%eax
  mov    %eax,-0x28(%rbp)
  cmpl   $0x19,-0x28(%rbp)
  jg     L267
  mov    -0x28(%rbp),%eax
  add    $0x41,%eax
  mov    %al,-0x2d(%rbp)
  jmp    L186
L267:
  mov    -0x28(%rbp),%eax
  add    $0x47,%eax
  mov    %al,-0x2d(%rbp)
L186:
  mov    -0x20(%rbp),%rax
  lea    -0x1(%rax),%rdx
  mov    %rdx,-0x20(%rbp)
  movzbl -0x2d(%rbp),%edx
  mov    %dl,(%rax)
L150:
  mov    -0x20(%rbp),%rax
  cmp    -0x38(%rbp),%rax
  jb     L307
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x58,%al
  je     L11
L307:
  mov    -0x20(%rbp),%rax
  add    $0x1,%rax
  mov    %rax,-0x10(%rbp)
  cmpq   $0x0,-0x40(%rbp)
  jne    L100
  cmpl   $0x0,-0x44(%rbp)
  je     L401
L100:
  mov    -0x20(%rbp),%rax
  cmp    -0x38(%rbp),%rax
  jbe    L317
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jne    L253
  mov    -0x20(%rbp),%rax
  movb   $0x0,(%rax)
  lea    -0x2c(%rbp),%rdx
  mov    -0x38(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <stat@plt>
  mov    %eax,-0x24(%rbp)
  mov    -0x20(%rbp),%rax
  movb   $0x2f,(%rax)
  cmpl   $0x0,-0x24(%rbp)
  je     L137
  mov    $0x0,%eax
  jmp    L231
L137:
  mov    -0x2c(%rbp),%eax
  mov    %eax,%edi
  call   <S_ISDIR@plt>
  test   %eax,%eax
  jne    L103
  mov    D115(%rip),%rax
  mov    (%rax),%rdx
  mov    D10(%rip),%rax
  mov    %rdx,(%rax)
  mov    $0x0,%eax
  jmp    L231
L253:
  subq   $0x1,-0x20(%rbp)
  jmp    L100
L317:
  nop
  jmp    L401
L103:
  nop
L401:
  cmpq   $0x0,-0x40(%rbp)
  je     L128
  mov    D23(%rip),%rax
  mov    (%rax),%edx
  mov    D106(%rip),%rax
  mov    (%rax),%eax
  or     %eax,%edx
  mov    D135(%rip),%rax
  mov    (%rax),%eax
  mov    %edx,%ecx
  or     %eax,%ecx
  mov    -0x38(%rbp),%rax
  mov    $0x180,%edx
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <open@plt>
  mov    -0x40(%rbp),%rdx
  mov    %eax,(%rdx)
  mov    -0x40(%rbp),%rax
  mov    (%rax),%eax
  test   %eax,%eax
  js     L438
  mov    $0x1,%eax
  jmp    L231
L438:
  mov    D10(%rip),%rax
  mov    (%rax),%rdx
  mov    D86(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,%rdx
  je     L241
  mov    $0x0,%eax
  jmp    L231
L128:
  cmpl   $0x0,-0x44(%rbp)
  je     L416
  mov    -0x38(%rbp),%rax
  mov    $0x1c0,%esi
  mov    %rax,%rdi
  call   <mkdir@plt>
  test   %rax,%rax
  jne    L375
  mov    $0x1,%eax
  jmp    L231
L375:
  mov    D10(%rip),%rax
  mov    (%rax),%rdx
  mov    D86(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,%rdx
  je     L241
  mov    $0x0,%eax
  jmp    L231
L416:
  lea    -0x2c(%rbp),%rdx
  mov    -0x38(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <lstat@plt>
  test   %rax,%rax
  je     L241
  mov    D10(%rip),%rax
  mov    (%rax),%rdx
  mov    D124(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,%rdx
  sete   %al
  movzbl %al,%eax
  jmp    L231
L241:
  mov    -0x10(%rbp),%rax
  mov    %rax,-0x20(%rbp)
L119:
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L140
  mov    $0x0,%eax
  jmp    L231
L140:
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x5a,%al
  jne    L330
  mov    -0x20(%rbp),%rax
  cmp    -0x18(%rbp),%rax
  jne    L360
  mov    $0x0,%eax
  jmp    L231
L360:
  mov    -0x20(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x20(%rbp)
  movb   $0x61,(%rax)
  jmp    L119
L330:
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isdigit@plt>
  test   %rax,%rax
  je     L44
  mov    -0x20(%rbp),%rax
  movb   $0x61,(%rax)
  jmp    L56
L44:
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x7a,%al
  jne    L319
  mov    -0x20(%rbp),%rax
  movb   $0x41,(%rax)
  jmp    L56
L319:
  mov    -0x20(%rbp),%rax
  cmp    -0x18(%rbp),%rax
  jne    L451
  mov    $0x0,%eax
  jmp    L231
L451:
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  add    $0x1,%eax
  mov    %eax,%edx
  mov    -0x20(%rbp),%rax
  mov    %dl,(%rax)
L56:
  jmp    L401
L231:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L346
  call   <__stack_chk_fail@plt>
L346:
  leave
  ret
```

assistant: ```c
int _gettemp(char *path, int *doopen, int domkdir, int slen) {
  char *start, *trv, *suffp;
  struct stat sbuf;
  int rval;
  pid_t pid;
  if (doopen && domkdir) {
    errno = EINVAL;
    return (0);
  }
  for (trv = path; *trv; ++trv)
    ;
  trv -= slen;
  suffp = trv;
  --trv;
  if (trv < path) {
    errno = EINVAL;
    return (0);
  }
  pid = getpid();
  while (trv >= path && *trv == 'X' && pid != 0) {
    *trv-- = (pid % 10) + '0';
    pid /= 10;
  }
  while (trv >= path && *trv == 'X') {
    char c;
    pid = (arc4random() & 0xffff) % (26 + 26);
    if (pid < 26)
      c = pid + 'A';
    else
      c = (pid - 26) + 'a';
    *trv-- = c;
  }
  start = trv + 1;
  if (doopen || domkdir) {
    for (;; --trv) {
      if (trv <= path)
        break;
      if (*trv == '/') {
        *trv = '\0';
        rval = stat(path, &sbuf);
        *trv = '/';
        if (rval != 0)
          return (0);
        if (!S_ISDIR(sbuf.st_mode)) {
          errno = ENOTDIR;
          return (0);
        }
        break;
      }
    }
  }
  for (;;) {
    if (doopen) {
      if ((*doopen = open(path, O_CREAT | O_EXCL | O_RDWR, 0600)) >= 0)
        return (1);
      if (errno != EEXIST)
        return (0);
    } else if (domkdir) {
      if (mkdir(path, 0700) == 0)
        return (1);
      if (errno != EEXIST)
        return (0);
    } else if (lstat(path, &sbuf))
      return (errno == ENOENT ? 1 : 0);
    for (trv = start;;) {
      if (!*trv)
        return (0);
      if (*trv == 'Z') {
        if (trv == suffp)
          return (0);
        *trv++ = 'a';
      } else {
        if (isdigit(*trv))
          *trv = 'a';
        else if (*trv == 'z')
          *trv = 'A';
        else {
          if (trv == suffp)
            return (0);
          ++*trv;
        }
        break;
      }
    }
  }
}
```