// File: /workspace/github_cpp_makefile_star2_O2/orbitcowboy[P]gnuplot-cpp/./gnuplot_i.hpp
// Function: Gnuplot::create_tmpfile[abi:cxx11](std::basic_ofstream<char, std::char_traits<char>>&)
std::string Gnuplot::create_tmpfile(std::ofstream &tmp)
{
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__)
    char name[15] = {'g', 'n', 'u', 'p', 'l', 'o', 't', 'i', 'X', 'X', 'X', 'X', 'X', 'X', '\0'}; //tmp file in working directory
#elif defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__)
    char name[20] = {'/', 't', 'm', 'p', '/', 'g', 'n', 'u', 'p', 'l', 'o', 't', 'i', 'X', 'X', 'X', 'X', 'X', 'X', '\0'}; // tmp file in /tmp
#endif

    //
    // check if maximum number of temporary files reached
    //
    if (Gnuplot::tmpfile_num == GP_MAX_TMP_FILES - 1)
    {
        std::ostringstream except;
        except << "Maximum number of temporary files reached ("
               << GP_MAX_TMP_FILES << "): cannot open more files" << std::endl;

        throw GnuplotException( except.str() );
    }

    // int mkstemp(char *name);
    // shall replace the contents of the string pointed to by "name" by a unique
    // filename, and return a file descriptor for the file open for reading and
    // writing.  Otherwise, -1 shall be returned if no suitable file could be
    // created.  The string in template should look like a filename with six
    // trailing 'X' s; mkstemp() replaces each 'X' with a character from the
    // portable filename character set.  The characters are chosen such that the
    // resulting name does not duplicate the name of an existing file at the
    // time of a call to mkstemp()


    //
    // open temporary files for output
    //
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__)
    if (_mktemp(name) == nullptr)
#elif defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__)
    int tmpfd;
    if ((tmpfd = mkstemp(name)) == -1)
#endif
    {
        std::ostringstream except;
        except << "Cannot create temporary file \"" << name << "\"";
        throw GnuplotException(except.str());
    }
#if defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__)
    (void)close(tmpfd);
#endif

    tmp.open(name);
    if (tmp.bad())
    {
        std::ostringstream except;
        except << "Cannot create temporary file \"" << name << "\"";
        throw GnuplotException(except.str());
    }

    //
    // Save the temporary filename
    //
    tmpfile_list.push_back(name);
    Gnuplot::tmpfile_num++;

    return name;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x1b8, %rsp            # imm = 0x1B8
movaps 0x566c(%rip), %xmm0     # 0xaa20
movaps %xmm0, (%rsp)
movl $0x585858, 0x10(%rsp)   # imm = 0x585858
cmpl $0x3f, 0x9e85(%rip)     # 0xf24c
je 0x5463
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movq %rsp, %rdi
callq 0x30a0
cmpl $-0x1, %eax
je 0x54e8
movl %eax, %edi
callq 0x3420
movq %rsp, %rsi
pushq $0x10
popq %rdx
movq %r15, %rdi
callq 0x3030
movq (%r15), %rax
movq -0x18(%rax), %rax
testb $0x1, 0x20(%r15,%rax)
jne 0x5562
leaq 0x40(%rsp), %rdi
movq %rsp, %rsi
leaq 0x20(%rsp), %rdx
callq 0x7cca
addq $0x50, %r14
leaq 0x40(%rsp), %rsi
movq %r14, %rdi
callq 0x8f2c
leaq 0x40(%rsp), %rdi
callq 0x3448
incl 0x9e0a(%rip)            # 0xf24c
movq %rsp, %rsi
leaq 0x40(%rsp), %rdx
movq %rbx, %rdi
callq 0x7cca
movq %rbx, %rax
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x40(%rsp), %rbx
movq %rbx, %rdi
callq 0x32a0
leaq 0x4f2e(%rip), %rsi      # 0xa3a5
movq %rbx, %rdi
callq 0x31f0
pushq $0x40
popq %rsi
movq %rax, %rdi
callq 0x33a0
leaq 0x4f40(%rip), %rsi      # 0xa3d1
movq %rax, %rdi
callq 0x31f0
movq %rax, %rdi
callq 0x3100
pushq $0x10
popq %rdi
callq 0x3110
movq %rax, %r14
leaq 0x48(%rsp), %rsi
leaq 0x20(%rsp), %rdi
callq 0x3320
movb $0x1, %bpl
leaq 0x20(%rsp), %rsi
movq %r14, %rdi
callq 0x7d5c
xorl %ebp, %ebp
leaq 0x9874(%rip), %rsi      # 0xed48
movq 0x9add(%rip), %rdx      # 0xefb8
movq %r14, %rdi
callq 0x3390
jmp 0x55da
leaq 0x40(%rsp), %rbx
movq %rbx, %rdi
callq 0x32a0
leaq 0x4eef(%rip), %rsi      # 0xa3eb
movq %rbx, %rdi
callq 0x31f0
movq %rsp, %rsi
movq %rax, %rdi
callq 0x31f0
leaq 0x4e7c(%rip), %rsi      # 0xa392
movq %rax, %rdi
callq 0x31f0
pushq $0x10
popq %rdi
callq 0x3110
movq %rax, %r14
leaq 0x48(%rsp), %rsi
leaq 0x20(%rsp), %rdi
callq 0x3320
movb $0x1, %bpl
leaq 0x20(%rsp), %rsi
movq %r14, %rdi
callq 0x7d5c
xorl %ebp, %ebp
leaq 0x97f7(%rip), %rsi      # 0xed48
movq 0x9a60(%rip), %rdx      # 0xefb8
movq %r14, %rdi
callq 0x3390
jmp 0x55da
leaq 0x40(%rsp), %rbx
movq %rbx, %rdi
callq 0x32a0
leaq 0x4e75(%rip), %rsi      # 0xa3eb
movq %rbx, %rdi
callq 0x31f0
movq %rsp, %rsi
movq %rax, %rdi
callq 0x31f0
leaq 0x4e02(%rip), %rsi      # 0xa392
movq %rax, %rdi
callq 0x31f0
pushq $0x10
popq %rdi
callq 0x3110
movq %rax, %r14
leaq 0x48(%rsp), %rsi
leaq 0x20(%rsp), %rdi
callq 0x3320
movb $0x1, %bpl
leaq 0x20(%rsp), %rsi
movq %r14, %rdi
callq 0x7d5c
xorl %ebp, %ebp
leaq 0x977d(%rip), %rsi      # 0xed48
movq 0x99e6(%rip), %rdx      # 0xefb8
movq %r14, %rdi
callq 0x3390
jmp 0x55e2
jmp 0x55f6
jmp 0x55e2
jmp 0x55f6
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x3448
testb %bpl, %bpl
jne 0x55f9
jmp 0x560a
movq %rax, %rbx
movq %r14, %rdi
callq 0x3190
jmp 0x560a
jmp 0x5607
jmp 0x5607
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x3070
jmp 0x5628
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x3448
jmp 0x5628
movq %rax, %rbx
movq %rbx, %rdi
callq 0x33b0