user: What is the c source code of the assembly code below?

```asm
<pocl_mkstemp>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  call   <getpid@plt>
  movzbl 0x0(%rbp),%edi
  mov    %eax,%edx
  test   %dil,%dil
  je     L64
  mov    %rbp,%rcx
  xor    %eax,%eax
  xor    %r8d,%r8d
  jmp    L314
  nopl   0x0(%rax,%rax,1)
L323:
  mov    %r15,%rcx
  mov    %esi,%edi
L314:
  movzbl 0x1(%rcx),%esi
  add    $0x1,%eax
  cmp    $0x58,%dil
  lea    0x1(%rcx),%r15
  cmovne %r8d,%eax
  test   %sil,%sil
  jne    L323
  movzbl D104(%rip),%esi
  cmp    $0x58,%dil
  je     L16
L97:
  mov    %rcx,%rbx
  nopl   0x0(%rax)
L45:
  cmp    $0x7a,%sil
  je     L4
  add    $0x1,%esi
  mov    %sil,D97(%rip)
L185:
  cmp    %rbx,%rbp
  jb     L52
  jmp    L250
  nopl   0x0(%rax,%rax,1)
L86:
  sub    $0x1,%rbx
  cmp    %rbx,%rbp
  je     L250
L52:
  cmpb   $0x2f,(%rbx)
  jne    L86
  movb   $0x0,(%rbx)
  lea    0x4(%rsp),%rsi
  mov    %rbp,%rdi
  call   <stat@plt>
  test   %rax,%rax
  jne    L256
  mov    0x4(%rsp),%edi
  call   <S_ISDIR@plt>
  test   %eax,%eax
  je     L133
  movb   $0x2f,(%rbx)
L250:
  mov    D97(%rip),%r14
  mov    D50(%rip),%r13
  mov    D35(%rip),%r12
L239:
  mov    (%r14),%esi
  mov    $0x180,%edx
  or     0x0(%r13),%esi
  mov    %rbp,%rdi
  or     (%r12),%esi
  call   <open@plt>
  test   %eax,%eax
  jns    L23
  mov    D28(%rip),%rax
  mov    D135(%rip),%rdx
  mov    (%rax),%rax
  cmp    %rax,(%rdx)
  jne    L284
  movzbl (%r15),%edi
  test   %dil,%dil
  je     L256
  mov    %r15,%rbx
  jmp    L107
  nopl   0x0(%rax)
L195:
  movzbl 0x1(%rbx),%edi
  add    $0x1,%rbx
  movb   $0x61,-0x1(%rbx)
  test   %dil,%dil
  je     L256
L107:
  cmp    $0x7a,%dil
  je     L195
  call   <isdigit@plt>
  mov    %rax,%r8
  mov    $0x61,%eax
  test   %r8,%r8
  je     L62
  mov    %al,(%rbx)
  jmp    L239
  nopl   (%rax)
L256:
  xor    %eax,%eax
L23:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L205
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L62:
  movzbl (%rbx),%eax
  add    $0x1,%eax
  mov    %al,(%rbx)
  jmp    L239
  nopl   (%rax)
L4:
  movzbl D100(%rip),%edx
  movb   $0x61,D97(%rip)
  lea    0x1(%rdx),%eax
  cmp    $0x7a,%dl
  mov    $0x61,%edx
  cmove  %edx,%eax
  mov    %al,D134(%rip)
  jmp    L185
  nopw   0x0(%rax,%rax,1)
L16:
  mov    %sil,-0x1(%r15)
  cmp    $0x6,%eax
  jle    L71
  cmpb   $0x58,-0x2(%r15)
  jne    L201
  movzbl D134(%rip),%eax
  sub    $0x1,%rcx
  lea    -0x3(%r15),%rbx
  mov    %al,-0x2(%r15)
  movzbl -0x3(%r15),%eax
L283:
  cmp    $0x58,%al
  jne    L231
  nopl   0x0(%rax,%rax,1)
L137:
  movslq %edx,%rax
  mov    %edx,%ecx
  mov    %rbx,%r15
  sub    $0x1,%rbx
  imul   $0x66666667,%rax,%rax
  sar    $0x1f,%ecx
  sar    $0x22,%rax
  sub    %ecx,%eax
  lea    (%rax,%rax,4),%ecx
  add    %ecx,%ecx
  sub    %ecx,%edx
  add    $0x30,%edx
  mov    %dl,0x1(%rbx)
  cmpb   $0x58,(%rbx)
  mov    %eax,%edx
  je     L137
  jmp    L45
  nopl   (%rax)
L64:
  cmpb   $0x58,-0x1(%rbp)
  movzbl D97(%rip),%esi
  lea    -0x1(%rbp),%rcx
  mov    %rbp,%r15
  jne    L97
  mov    %sil,-0x1(%rbp)
L71:
  movzbl -0x2(%r15),%eax
  lea    -0x1(%rcx),%rbx
  jmp    L283
L133:
  mov    D134(%rip),%rdx
  mov    (%rdx),%rcx
  mov    D135(%rip),%rdx
  mov    %rcx,(%rdx)
  jmp    L23
L284:
  mov    $0xffffffff,%eax
  jmp    L23
L205:
  call   <__stack_chk_fail@plt>
L231:
  mov    %rcx,%r15
  jmp    L45
L201:
  mov    %rcx,%r15
  sub    $0x1,%rcx
  jmp    L97
```

assistant: ```c
int pocl_mkstemp(char *path) {
  int fd;
  char *start, *trv;
  struct stat sbuf;
  pid_t pid;
  static char xtra[2] = "aa";
  int xcnt = 0;
  pid = getpid();
  for (trv = path; *trv; ++trv)
    if (*trv == 'X')
      xcnt++;
    else
      xcnt = 0;
  if (*(trv - 1) == 'X')
    *--trv = xtra[0];
  if (xcnt > 6 && *(trv - 1) == 'X')
    *--trv = xtra[1];
  while (*--trv == 'X') {
    *trv = (pid % 10) + '0';
    pid /= 10;
  }
  if (xtra[0] != 'z')
    xtra[0]++;
  else {
    xtra[0] = 'a';
    if (xtra[1] != 'z')
      xtra[1]++;
    else
      xtra[1] = 'a';
  }
  for (start = trv + 1;; --trv) {
    if (trv <= path)
      break;
    if (*trv == '/') {
      *trv = '\0';
      if (stat(path, &sbuf))
        return (0);
      if (!S_ISDIR(sbuf.st_mode)) {
        errno = ENOTDIR;
        return (0);
      }
      *trv = '/';
      break;
    }
  }
  for (;;) {
    if ((fd = open(path, O_CREAT | O_EXCL | O_RDWR | 0, 0600)) >= 0)
      return (fd);
    if (errno != EEXIST)
      return -1;
    for (trv = start;;) {
      if (!*trv)
        return (0);
      if (*trv == 'z')
        *trv++ = 'a';
      else {
        if (isdigit((unsigned char)*trv))
          *trv = 'a';
        else
          ++*trv;
        break;
      }
    }
  }
}
```