// File: /workspace/github_cpp_makefile_star2_O3/orbitcowboy[P]gnuplot-cpp/./gnuplot_i.hpp
// Function: Gnuplot::init()
void Gnuplot::init(void)
{
    // char * getenv ( const char * name );  get value of environment variable
    // Retrieves a C string containing the value of the environment variable
    // whose name is specified as argument.  If the requested variable is not
    // part of the environment list, the function returns a NULL pointer.
#if ( defined(unix) || defined(__unix) || defined(__unix__) ) && !defined(__APPLE__)
    if (getenv("DISPLAY") == nullptr)
    {
        valid = false;
        throw GnuplotException("Can't find DISPLAY variable");
    }
#endif

    // if gnuplot not available
    if (!Gnuplot::get_program_path())
    {
        valid = false;
        throw GnuplotException("Can't find gnuplot");
    }

    // open pipe
    std::string tmp = Gnuplot::m_sGNUPlotPath + "/" +
                      Gnuplot::m_sGNUPlotFileName;

    // FILE *popen(const char *command, const char *mode);
    // The popen() function shall execute the command specified by the string
    // command, create a pipe between the calling program and the executed
    // command, and return a pointer to a stream that can be used to either read
    // from or write to the pipe.
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__)
    gnucmd = _popen(tmp.c_str(), "w");
#elif defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__)
    gnucmd = popen(tmp.c_str(), "w");
#endif

    // popen() shall return a pointer to an open stream that can be used to read
    // or write to the pipe.  Otherwise, it shall return a null pointer and may
    // set errno to indicate the error.
    if (!gnucmd)
    {
        valid = false;
        throw GnuplotException("Couldn't open connection to gnuplot");
    }

    nplots = 0;
    valid = true;
    smooth.clear();

    //set terminal type
    showonscreen();

    return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x40, %rsp
movq %rdi, %rbx
leaq 0x6ca2(%rip), %rdi      # 0xd134
callq 0x3280
testq %rax, %rax
je 0x65b7
callq 0x670a
leaq 0x30(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0xadba(%rip), %rsi      # 0x11270
movq 0xadbb(%rip), %rdx      # 0x11278
addq %rsi, %rdx
leaq 0x20(%rsp), %r14
movq %r14, %rdi
callq 0xc66a
leaq 0x6c5a(%rip), %rsi      # 0xd12e
movq %r14, %rdi
callq 0x3420
movq 0xad6d(%rip), %rsi      # 0x11250
movq 0xad6e(%rip), %rdx      # 0x11258
leaq 0x20(%rsp), %rdi
callq 0x30a0
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdi
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdi
je 0x651a
movq %rdi, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0x6524
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq %r15, %rdi
movq 0x8(%rax), %rdx
movq %rdx, 0x8(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x20(%rsp), %rax
cmpq %r12, %rax
je 0x655a
movq 0x30(%rsp), %rsi
incq %rsi
movq %rax, %rdi
callq 0x3210
movq (%rsp), %rdi
leaq 0x6e01(%rip), %rsi      # 0xd362
callq 0x3090
movq %rax, (%rbx)
testq %rax, %rax
je 0x6619
movl $0x0, 0xc(%rbx)
movb $0x1, 0x8(%rbx)
movq $0x0, 0x38(%rbx)
movq 0x30(%rbx), %rax
movb $0x0, (%rax)
movq %rbx, %rdi
callq 0x3ba8
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x65aa
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3210
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movb $0x0, 0x8(%rbx)
movl $0x10, %edi
callq 0x3120
movq %rax, %r14
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x6b64(%rip), %rsi      # 0xd13c
leaq 0x6b78(%rip), %rdx      # 0xd157
movq %rsp, %rdi
callq 0xc700
movb $0x1, %bpl
movq %rsp, %rsi
movq %r14, %rdi
callq 0x32a0
leaq 0xa764(%rip), %rax      # 0x10d60
movq %rax, (%r14)
xorl %ebp, %ebp
leaq 0xa730(%rip), %rsi      # 0x10d38
movq 0xa9a9(%rip), %rdx      # 0x10fb8
movq %r14, %rdi
callq 0x33c0
jmp 0x6677
movb $0x0, 0x8(%rbx)
movl $0x10, %edi
callq 0x3120
movq %rax, %r14
leaq 0x20(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x6d2b(%rip), %rsi      # 0xd364
leaq 0x6d47(%rip), %rdx      # 0xd387
callq 0xc700
movb $0x1, %bpl
leaq 0x20(%rsp), %rsi
movq %r14, %rdi
callq 0x32a0
leaq 0xa704(%rip), %rax      # 0x10d60
movq %rax, (%r14)
xorl %ebp, %ebp
leaq 0xa6d0(%rip), %rsi      # 0x10d38
movq 0xa949(%rip), %rdx      # 0x10fb8
movq %r14, %rdi
callq 0x33c0
movq %rax, %rbx
movq 0x20(%rsp), %rdi
cmpq %r12, %rdi
je 0x6691
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x3210
testb %bpl, %bpl
jne 0x669b
jmp 0x66d5
movq %rax, %rbx
movq %r14, %rdi
callq 0x3190
jmp 0x66d5
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x66be
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3210
testb %bpl, %bpl
jne 0x66c8
jmp 0x6701
movq %rax, %rbx
movq %r14, %rdi
callq 0x3190
jmp 0x6701
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x6701
movq 0x10(%rsp), %rsi
jmp 0x66f9
jmp 0x66e7
movq %rax, %rbx
movq 0x20(%rsp), %rdi
cmpq %r12, %rdi
je 0x6701
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x3210
movq %rbx, %rdi
callq 0x33f0
nop