// File: /workspace/github_cpp_makefile_star2_O3/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 %r12
pushq %rbx
subq $0x1b0, %rsp            # imm = 0x1B0
movaps 0x79a8(%rip), %xmm0     # 0xdad0
movaps %xmm0, (%rsp)
movl $0x585858, 0x10(%rsp)   # imm = 0x585858
cmpl $0x3f, 0xb111(%rip)     # 0x1124c
je 0x620d
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movq %rsp, %rdi
callq 0x30b0
cmpl $-0x1, %eax
je 0x62af
movl %eax, %edi
callq 0x3430
movq %rsp, %rsi
movq %r15, %rdi
movl $0x10, %edx
callq 0x3040
movq (%r15), %rax
movq -0x18(%rax), %rax
testb $0x1, 0x20(%r15,%rax)
jne 0x6354
leaq 0x48(%rsp), %r12
movq %r12, -0x10(%r12)
movq %rsp, %r15
movq %r15, %rdi
callq 0x3100
leaq (%rsp,%rax), %rdx
leaq 0x38(%rsp), %rdi
movq %r15, %rsi
callq 0xc700
addq $0x50, %r14
leaq 0x38(%rsp), %rsi
movq %r14, %rdi
callq 0xc796
movq 0x38(%rsp), %rdi
cmpq %r12, %rdi
je 0x61d3
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x3210
incl 0xb073(%rip)            # 0x1124c
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
movq %rsp, %r14
movq %r14, %rdi
callq 0x3100
leaq (%rsp,%rax), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0xc700
movq %rbx, %rax
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x38(%rsp), %rbx
movq %rbx, %rdi
callq 0x32b0
leaq 0x7234(%rip), %rsi      # 0xd455
movl $0x2b, %edx
movq %rbx, %rdi
callq 0x3250
leaq 0x38(%rsp), %rdi
movl $0x40, %esi
callq 0x33d0
movq %rax, %rbx
leaq 0x723a(%rip), %rsi      # 0xd481
movl $0x19, %edx
movq %rax, %rdi
callq 0x3250
movq %rbx, %rdi
callq 0x3110
movl $0x10, %edi
callq 0x3120
movq %rax, %r14
leaq 0x40(%rsp), %rsi
leaq 0x18(%rsp), %rdi
callq 0x3340
movb $0x1, %bpl
leaq 0x18(%rsp), %rsi
movq %r14, %rdi
callq 0x32a0
leaq 0xaad1(%rip), %rax      # 0x10d60
movq %rax, (%r14)
xorl %ebp, %ebp
leaq 0xaa9d(%rip), %rsi      # 0x10d38
movq 0xad16(%rip), %rdx      # 0x10fb8
movq %r14, %rdi
callq 0x33c0
jmp 0x63f4
leaq 0x38(%rsp), %rbx
movq %rbx, %rdi
callq 0x32b0
leaq 0x71d8(%rip), %rsi      # 0xd49b
movl $0x1e, %edx
movq %rbx, %rdi
callq 0x3250
movq %rsp, %rbx
movq %rbx, %rdi
callq 0x3100
leaq 0x38(%rsp), %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x3250
leaq 0x7150(%rip), %rsi      # 0xd442
leaq 0x38(%rsp), %rdi
movl $0x1, %edx
callq 0x3250
movl $0x10, %edi
callq 0x3120
movq %rax, %r14
leaq 0x40(%rsp), %rsi
leaq 0x18(%rsp), %rdi
callq 0x3340
movb $0x1, %bpl
leaq 0x18(%rsp), %rsi
movq %r14, %rdi
callq 0x32a0
leaq 0xaa2c(%rip), %rax      # 0x10d60
movq %rax, (%r14)
xorl %ebp, %ebp
leaq 0xa9f8(%rip), %rsi      # 0x10d38
movq 0xac71(%rip), %rdx      # 0x10fb8
movq %r14, %rdi
callq 0x33c0
jmp 0x63f4
leaq 0x38(%rsp), %rbx
movq %rbx, %rdi
callq 0x32b0
leaq 0x7133(%rip), %rsi      # 0xd49b
movl $0x1e, %edx
movq %rbx, %rdi
callq 0x3250
movq %rsp, %rbx
movq %rbx, %rdi
callq 0x3100
leaq 0x38(%rsp), %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x3250
leaq 0x70ab(%rip), %rsi      # 0xd442
leaq 0x38(%rsp), %rdi
movl $0x1, %edx
callq 0x3250
movl $0x10, %edi
callq 0x3120
movq %rax, %r14
leaq 0x40(%rsp), %rsi
leaq 0x18(%rsp), %rdi
callq 0x3340
movb $0x1, %bpl
leaq 0x18(%rsp), %rsi
movq %r14, %rdi
callq 0x32a0
leaq 0xa987(%rip), %rax      # 0x10d60
movq %rax, (%r14)
xorl %ebp, %ebp
leaq 0xa953(%rip), %rsi      # 0x10d38
movq 0xabcc(%rip), %rdx      # 0x10fb8
movq %r14, %rdi
callq 0x33c0
jmp 0x63fc
jmp 0x6421
jmp 0x63fc
jmp 0x6421
movq %rax, %rbx
leaq 0x28(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x641a
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x3210
testb %bpl, %bpl
jne 0x6424
jmp 0x6435
movq %rax, %rbx
movq %r14, %rdi
callq 0x3190
jmp 0x6435
jmp 0x6432
jmp 0x6432
movq %rax, %rbx
movq 0xab74(%rip), %rsi      # 0x10fb0
leaq 0x38(%rsp), %rdi
callq 0x3140
leaq 0xa8(%rsp), %rdi
callq 0x30c0
jmp 0x6474
movq %rax, %rbx
movq 0x38(%rsp), %rdi
cmpq %r12, %rdi
je 0x6474
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x3210
jmp 0x6474
movq %rax, %rbx
movq %rbx, %rdi
callq 0x33f0