// File: /workspace/github_cpp_makefile_star2_O2/ncbi[P]amr/common.cpp
// Function: Common_sp::makeTempDir[abi:cxx11]()
string makeTempDir ()
{
  string tmpDir (getEnv ("TMPDIR"));
  if (tmpDir. empty ())
    tmpDir = "/tmp";

  string tmp = tmpDir + "/" + programName + ".XXXXXX";
  if (! mkdtemp (var_cast (tmp. c_str ())))
    throw runtime_error ("Error creating a temporary directory in " + tmpDir);
	if (tmp. empty ())
		throw runtime_error ("Cannot create a temporary directory in " + tmpDir);

  {
  	const string testFName (tmp + "/test");
    {
      ofstream f (testFName);
      f << "abc" << endl;
      if (! f. good ())
		    throw runtime_error (tmpDir + " is full, make space there or use environment variable TMPDIR to change location for temporary files");
    }
    removeFile (testFName);
  }

  return tmp;  
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x268, %rsp            # imm = 0x268
movq %rdi, %rbx
leaq 0x36187(%rip), %rsi     # 0x5bdb6
leaq 0x68(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x1b7b6
leaq 0x28(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x3c19a
leaq 0x68(%rsp), %rdi
callq 0xbb68
cmpq $0x0, 0x30(%rsp)
jne 0x25c70
leaq 0x36157(%rip), %rsi     # 0x5bdbd
leaq 0x28(%rsp), %rdi
callq 0xbad0
leaq 0x36664(%rip), %rdx     # 0x5c2db
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x1c88d
leaq 0x5ee2b(%rip), %rdx     # 0x84ab8
leaq 0x68(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x1cbaf
leaq 0x3611f(%rip), %rdx     # 0x5bdc2
leaq 0x68(%rsp), %rsi
movq %rbx, %rdi
callq 0x1b92d
leaq 0x68(%rsp), %rdi
callq 0xbb68
leaq 0x8(%rsp), %rdi
callq 0xbb68
movq (%rbx), %rdi
callq 0xba80
testq %rax, %rax
je 0x25d6f
cmpq $0x0, 0x8(%rbx)
je 0x25dbd
leaq 0x36134(%rip), %rdx     # 0x5be1b
leaq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0x1c88d
leaq 0x68(%rsp), %rdi
leaq 0x8(%rsp), %rsi
pushq $0x10
popq %rdx
callq 0xbae0
leaq 0x36114(%rip), %rsi     # 0x5be21
leaq 0x68(%rsp), %rdi
callq 0xb590
movq %rax, %rdi
callq 0xb2f0
movq 0x68(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x88(%rsp,%rax)
jne 0x25e08
leaq 0x68(%rsp), %rdi
callq 0xb860
leaq 0x8(%rsp), %rdi
callq 0x1d46a
leaq 0x8(%rsp), %rdi
callq 0xbb68
leaq 0x28(%rsp), %rdi
callq 0xbb68
movq %rbx, %rax
addq $0x268, %rsp            # imm = 0x268
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0xb300
movq %rax, %r15
leaq 0x36049(%rip), %rsi     # 0x5bdca
leaq 0x68(%rsp), %rdi
leaq 0x28(%rsp), %rdx
callq 0x1b8b7
movb $0x1, %bpl
leaq 0x68(%rsp), %rsi
movq %r15, %rdi
callq 0xb940
xorl %ebp, %ebp
movq 0x5e23f(%rip), %rsi     # 0x83fe8
movq 0x5e1b0(%rip), %rdx     # 0x83f60
movq %r15, %rdi
callq 0xb9d0
jmp 0x25e51
pushq $0x10
popq %rdi
callq 0xb300
movq %rax, %r15
leaq 0x36024(%rip), %rsi     # 0x5bdf3
leaq 0x68(%rsp), %rdi
leaq 0x28(%rsp), %rdx
callq 0x1b8b7
movb $0x1, %bpl
leaq 0x68(%rsp), %rsi
movq %r15, %rdi
callq 0xb940
xorl %ebp, %ebp
movq 0x5e1f1(%rip), %rsi     # 0x83fe8
movq 0x5e162(%rip), %rdx     # 0x83f60
movq %r15, %rdi
callq 0xb9d0
jmp 0x25e51
pushq $0x10
popq %rdi
callq 0xb300
movq %rax, %r15
leaq 0x3600b(%rip), %rdx     # 0x5be25
leaq 0x48(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x1c88d
movb $0x1, %bpl
leaq 0x48(%rsp), %rsi
movq %r15, %rdi
callq 0xb940
xorl %ebp, %ebp
movq 0x5e1a6(%rip), %rsi     # 0x83fe8
movq 0x5e117(%rip), %rdx     # 0x83f60
movq %r15, %rdi
callq 0xb9d0
jmp 0x25ebe
movq %rax, %r14
leaq 0x48(%rsp), %rdi
callq 0xbb68
testb %bpl, %bpl
jne 0x25e6a
jmp 0x25ed5
movq %rax, %r14
movq %r15, %rdi
callq 0xb470
jmp 0x25ed5
jmp 0x25e78
jmp 0x25e8c
movq %rax, %r14
leaq 0x68(%rsp), %rdi
callq 0xbb68
testb %bpl, %bpl
jne 0x25e8f
jmp 0x25ee9
movq %rax, %r14
movq %r15, %rdi
callq 0xb470
jmp 0x25ee9
jmp 0x25e9b
movq %rax, %r14
jmp 0x25edf
movq %rax, %r14
jmp 0x25ee9
movq %rax, %r14
leaq 0x68(%rsp), %rdi
callq 0xbb68
jmp 0x25eb7
movq %rax, %r14
leaq 0x8(%rsp), %rdi
jmp 0x25eec
movq %rax, %r14
jmp 0x25ef1
movq %rax, %r14
leaq 0x68(%rsp), %rdi
jmp 0x25ef6
movq %rax, %r14
jmp 0x25efb
movq %rax, %r14
leaq 0x68(%rsp), %rdi
callq 0xb860
leaq 0x8(%rsp), %rdi
callq 0xbb68
movq %rbx, %rdi
callq 0xbb68
leaq 0x28(%rsp), %rdi
callq 0xbb68
movq %r14, %rdi
callq 0xba30