user: What would the C source look like for the assembly code provided here:

```asm
<__gettemp>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    %rdi,%r13
  push   %r12
  push   %rbp
  mov    %edx,%ebp
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  test   %rdi,%rdi
  setne  %dil
  movzbl %dil,%edi
  call   <_DIAGASSERT@plt>
  xor    %eax,%eax
  call   <getpid@plt>
  movzbl 0x0(%r13),%ecx
  mov    %eax,%edx
  test   %cl,%cl
  je     L291
  mov    %r13,%rdi
  xor    %eax,%eax
  xor    %esi,%esi
  jmp    L281
  nopl   0x0(%rax)
L372:
  mov    %r15,%rdi
L281:
  add    $0x1,%eax
  cmp    $0x58,%cl
  movzbl 0x1(%rdi),%ecx
  lea    0x1(%rdi),%r15
  cmovne %esi,%eax
  test   %cl,%cl
  jne    L372
  cmpb   $0x58,-0x1(%r15)
  movzbl D40(%rip),%esi
  je     L27
L307:
  mov    %rdi,%r12
  nopl   (%rax)
L104:
  cmp    $0x7a,%sil
  je     L36
  add    $0x1,%esi
  mov    %sil,D41(%rip)
L304:
  cmp    %r12,%r13
  jb     L379
  jmp    L134
  nopl   0x0(%rax,%rax,1)
L102:
  sub    $0x1,%r12
  cmp    %r12,%r13
  je     L134
L379:
  cmpb   $0x2f,(%r12)
  jne    L102
  movb   $0x0,(%r12)
  lea    0x4(%rsp),%rsi
  mov    %r13,%rdi
  call   <stat@plt>
  movb   $0x2f,(%r12)
  cmp    $0xffffffff,%eax
  je     L375
  mov    0x4(%rsp),%edi
  call   <S_ISDIR@plt>
  test   %eax,%eax
  je     L109
L134:
  lea    0x4(%rsp),%r14
  test   %rbx,%rbx
  je     L100
L336:
  mov    D41(%rip),%rax
  mov    $0x180,%edx
  mov    %r13,%rdi
  mov    (%rax),%esi
  mov    D133(%rip),%rax
  or     (%rax),%esi
  mov    D5(%rip),%rax
  or     (%rax),%esi
  call   <open@plt>
  mov    %eax,(%rbx)
  test   %eax,%eax
  jns    L217
L256:
  mov    D53(%rip),%rax
  mov    D63(%rip),%rdx
  mov    (%rax),%rax
  cmp    %rax,(%rdx)
  jne    L108
L57:
  movzbl (%r15),%edi
  test   %dil,%dil
  je     L108
  mov    %r15,%r12
  jmp    L136
  nopl   0x0(%rax)
L303:
  movzbl 0x1(%r12),%edi
  add    $0x1,%r12
  movb   $0x61,-0x1(%r12)
  test   %dil,%dil
  je     L108
L136:
  cmp    $0x7a,%dil
  je     L303
  call   <isdigit@plt>
  mov    %rax,%r8
  mov    $0x61,%eax
  test   %r8,%r8
  je     L43
  mov    %al,(%r12)
L201:
  test   %rbx,%rbx
  jne    L336
L100:
  test   %ebp,%ebp
  je     L192
  mov    $0x1c0,%esi
  mov    %r13,%rdi
  call   <mkdir@plt>
  test   %rax,%rax
  js     L256
L217:
  mov    $0x1,%eax
  jmp    L42
  nop
L108:
  xor    %eax,%eax
L42:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L34
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L43:
  movzbl (%r12),%eax
  add    $0x1,%eax
  mov    %al,(%r12)
  jmp    L201
  cs nopw 0x0(%rax,%rax,1)
L192:
  mov    %r14,%rsi
  mov    %r13,%rdi
  call   <lstat@plt>
  test   %rax,%rax
  je     L57
  mov    D63(%rip),%rdx
  mov    D86(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,(%rdx)
  sete   %al
  movzbl %al,%eax
  jmp    L42
L36:
  movzbl D48(%rip),%edx
  movb   $0x61,D41(%rip)
  lea    0x1(%rdx),%eax
  cmp    $0x7a,%dl
  mov    $0x61,%edx
  cmove  %edx,%eax
  mov    %al,D27(%rip)
  jmp    L304
  nopw   0x0(%rax,%rax,1)
L27:
  mov    %sil,-0x1(%r15)
  cmp    $0x6,%eax
  jle    L255
  cmpb   $0x58,-0x2(%r15)
  jne    L41
  movzbl D27(%rip),%eax
  sub    $0x1,%rdi
  lea    -0x3(%r15),%r12
  mov    %al,-0x2(%r15)
  movzbl -0x3(%r15),%eax
L215:
  cmp    $0x58,%al
  jne    L137
  nopl   0x0(%rax,%rax,1)
L121:
  movslq %edx,%rax
  mov    %edx,%ecx
  mov    %r12,%r15
  sub    $0x1,%r12
  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(%r12)
  cmpb   $0x58,(%r12)
  mov    %eax,%edx
  je     L121
  jmp    L104
L109:
  mov    D27(%rip),%rax
  mov    (%rax),%rdx
  mov    D63(%rip),%rax
  mov    %rdx,(%rax)
L375:
  test   %rbx,%rbx
  sete   %dl
  xor    %eax,%eax
  test   %ebp,%ebp
  sete   %al
  and    %edx,%eax
  jmp    L42
L291:
  cmpb   $0x58,-0x1(%r13)
  movzbl D41(%rip),%esi
  lea    -0x1(%r13),%rdi
  mov    %r13,%r15
  jne    L307
  mov    %sil,-0x1(%r13)
L255:
  movzbl -0x2(%r15),%eax
  lea    -0x1(%rdi),%r12
  jmp    L215
L137:
  mov    %rdi,%r15
  jmp    L104
L41:
  mov    %rdi,%r15
  sub    $0x1,%rdi
  jmp    L307
L34:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int __gettemp(char *path, int *doopen, int domkdir) {
  char *start, *trv;
  struct stat sbuf;
  u_int pid;
  static char xtra[2] = "aa";
  int xcnt = 0;
  _DIAGASSERT(path != NULL);
  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 == '/') {
      int e;
      *trv = '\0';
      e = stat(path, &sbuf);
      *trv = '/';
      if (e == -1)
        return doopen == NULL && !domkdir;
      if (!S_ISDIR(sbuf.st_mode)) {
        errno = ENOTDIR;
        return doopen == NULL && !domkdir;
      }
      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')
        *trv++ = 'a';
      else {
        if (isdigit((unsigned char)*trv))
          *trv = 'a';
        else
          ++*trv;
        break;
      }
    }
  }
}
```