// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/core/fa.c
// Function: gt_xtmpfp_generic_func
FILE* gt_xtmpfp_generic_func(GtStr *template_arg, enum tmpfp_flags flags,
                             const char *src_file, int src_line)
{
  FILE *fp;
  GtStr *template;
  gt_assert(fa);
  if (flags & GT_TMPFP_USETEMPLATE)
  {
    gt_assert(template_arg);
    template = template_arg;
  }
  else
  {
    if (template_arg)
      template = template_arg;
    else
      template = gt_str_new();
    {
      const char *tmpdir = NULL;
      if (!tmpdir)
        tmpdir = gt_fa_try_tmpdir(getenv("TMPDIR"));
      if (!tmpdir)
        tmpdir = gt_fa_try_tmpdir(getenv("TMP"));
      if (!tmpdir)
        tmpdir = gt_fa_try_tmpdir(P_tmpdir);
      if (!tmpdir)
        tmpdir = gt_fa_try_tmpdir("/tmp");
      if (!tmpdir)
        tmpdir = gt_fa_try_tmpdir("/var/tmp");
      if (!tmpdir)
        tmpdir = gt_fa_try_tmpdir("/usr/tmp");
      if (!tmpdir)
        tmpdir = gt_fa_try_tmpdir(".");
      gt_assert(tmpdir);
      gt_str_set(template, tmpdir);
    }
    gt_str_append_cstr(template, genometools_tmptemplate);
  }
  {
    int fd = gt_mkstemp(gt_str_get(template));
    char mode[] = { 'w', '+', flags & GT_TMPFP_OPENBINARY?'b':'\0', '\0' };
    fp = gt_xfdopen(fd, mode);
  }
  gt_assert(fp);
  if (flags & GT_TMPFP_AUTOREMOVE)
  {
    gt_xremove(gt_str_get(template));
  }
  {
    FAFileInfo *fileinfo;
    fileinfo = gt_malloc(sizeof (FAFileInfo));
    fileinfo->src_file = src_file;
    fileinfo->src_line = src_line;
    gt_mutex_lock(fa->file_mutex);
    gt_hashmap_add(fa->file_pointer, fp, fileinfo);
    gt_mutex_unlock(fa->file_mutex);
  }
  if (!template_arg)
    gt_str_delete(template);
  return fp;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpq $0x0, 0xdd8df(%rip)     # 0x12fbc0
je 0x52482
movl %ecx, %ebp
movq %rdx, %r15
movl %esi, %r12d
movq %rdi, %rbx
movq %rdi, %r14
testb $0x2, %r12b
jne 0x523b3
testq %rbx, %rbx
jne 0x5230c
callq 0x13d5c
movq %rax, %r14
leaq 0x87667(%rip), %rdi     # 0xd997a
callq 0xb7c0
movq %rax, %rdi
callq 0x52544
testq %rax, %rax
jne 0x52397
leaq 0x87655(%rip), %rdi     # 0xd9981
callq 0xb7c0
movq %rax, %rdi
callq 0x52544
testq %rax, %rax
jne 0x52397
leaq 0x87644(%rip), %rdi     # 0xd9989
callq 0x52544
testq %rax, %rax
jne 0x52397
leaq 0x87633(%rip), %rdi     # 0xd9989
callq 0x52544
testq %rax, %rax
jne 0x52397
leaq 0x8761e(%rip), %rdi     # 0xd9985
callq 0x52544
testq %rax, %rax
jne 0x52397
leaq 0x87616(%rip), %rdi     # 0xd998e
callq 0x52544
testq %rax, %rax
jne 0x52397
leaq 0x81075(%rip), %rdi     # 0xd33fe
callq 0x52544
testq %rax, %rax
je 0x52516
movq %r14, %rdi
movq %rax, %rsi
callq 0x13e63
leaq 0x87a67(%rip), %rsi     # 0xd9e10
movq %r14, %rdi
callq 0x13dd3
jmp 0x523bc
testq %rbx, %rbx
je 0x524de
movq %r14, %rdi
callq 0x143d2
movq %rax, %rdi
callq 0x838a8
leaq 0x4(%rsp), %rsi
movw $0x2b77, (%rsi)         # imm = 0x2B77
movl %r12d, %ecx
andl $0x4, %ecx
pushq $0x62
popq %rdx
cmovel %ecx, %edx
movb %dl, 0x2(%rsi)
movb $0x0, 0x3(%rsi)
movl %eax, %edi
callq 0x6234c
testq %rax, %rax
je 0x524b0
movq %rax, %r13
testb $0x1, %r12b
je 0x52412
movq %r14, %rdi
callq 0x143d2
movq %rax, %rdi
callq 0x165e9
leaq 0x8741c(%rip), %rsi     # 0xd9835
pushq $0x10
popq %rdi
movl $0x173, %edx            # imm = 0x173
callq 0xccb0
movq %rax, %r12
movq %r15, (%rax)
movl %ebp, 0x8(%rax)
movq 0xdd78a(%rip), %rax     # 0x12fbc0
movq (%rax), %rdi
callq 0x16028
movq 0xdd77b(%rip), %rax     # 0x12fbc0
movq 0x10(%rax), %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x55f31
movq 0xdd765(%rip), %rax     # 0x12fbc0
movq (%rax), %rdi
callq 0x1609f
testq %rbx, %rbx
jne 0x52470
movq %r14, %rdi
callq 0x152db
movq %r13, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xdbb2f(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x77bd3(%rip), %rsi     # 0xca066
leaq 0x8738d(%rip), %rdx     # 0xd9827
leaq 0x874b5(%rip), %rcx     # 0xd9956
leaq 0x8738d(%rip), %r8      # 0xd9835
movl $0x146, %r9d            # imm = 0x146
jmp 0x5250a
movq 0xdbb01(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x77ba5(%rip), %rsi     # 0xca066
leaq 0x914f9(%rip), %rdx     # 0xe39c1
leaq 0x87487(%rip), %rcx     # 0xd9956
leaq 0x8735f(%rip), %r8      # 0xd9835
movl $0x16c, %r9d            # imm = 0x16C
jmp 0x5250a
movq 0xdbad3(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x77b77(%rip), %rsi     # 0xca066
leaq 0x87477(%rip), %rdx     # 0xd996d
leaq 0x87459(%rip), %rcx     # 0xd9956
leaq 0x87331(%rip), %r8      # 0xd9835
movl $0x149, %r9d            # imm = 0x149
xorl %eax, %eax
callq 0xb8c0
callq 0xb300
movq 0xdba9b(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x77b3f(%rip), %rsi     # 0xca066
leaq 0x87469(%rip), %rdx     # 0xd9997
leaq 0x87421(%rip), %rcx     # 0xd9956
leaq 0x872f9(%rip), %r8      # 0xd9835
movl $0x162, %r9d            # imm = 0x162
jmp 0x5250a