// File: /workspace/github_cpp_makefile_star2_O2/kallaballa[P]PixelStencil/./CImg.h
// Function: cimg_library::cimg::temporary_path(char const*, bool)
inline const char* temporary_path(const char *const user_path=0, const bool reinit_path=false) {
#define _cimg_test_temporary_path(p) \
      if (!path_found) { \
        cimg_snprintf(st_path,1024,"%s",p); \
        cimg_snprintf(tmp,sizeof(tmp),"%s%c%s",st_path,cimg_file_separator,filetmp); \
        if ((file=std::fopen(tmp,"wb"))!=0) { cimg::fclose(file); std::remove(tmp); path_found = true; } \
      }
      static char *st_path = 0;
      if (reinit_path) { delete[] st_path; st_path = 0; }
      if (user_path) {
        if (!st_path) st_path = new char[1024];
        std::memset(st_path,0,1024);
        std::strncpy(st_path,user_path,1023);
      } else if (!st_path) {
        st_path = new char[1024];
        std::memset(st_path,0,1024);
        bool path_found = false;
        char tmp[1024] = { 0 }, filetmp[512] = { 0 };
        std::FILE *file = 0;
        cimg_snprintf(filetmp,sizeof(filetmp),"%s.tmp",cimg::filenamerand());
        char *tmpPath = std::getenv("TMP");
        if (!tmpPath) { tmpPath = std::getenv("TEMP"); winformat_string(tmpPath); }
        if (tmpPath) _cimg_test_temporary_path(tmpPath);
#if cimg_OS==2
        _cimg_test_temporary_path("C:\\WINNT\\Temp");
        _cimg_test_temporary_path("C:\\WINDOWS\\Temp");
        _cimg_test_temporary_path("C:\\Temp");
        _cimg_test_temporary_path("C:");
        _cimg_test_temporary_path("D:\\WINNT\\Temp");
        _cimg_test_temporary_path("D:\\WINDOWS\\Temp");
        _cimg_test_temporary_path("D:\\Temp");
        _cimg_test_temporary_path("D:");
#else
        _cimg_test_temporary_path("/tmp");
        _cimg_test_temporary_path("/var/tmp");
#endif
        if (!path_found) {
          *st_path = 0;
          std::strncpy(tmp,filetmp,sizeof(tmp)-1);
          if ((file=std::fopen(tmp,"wb"))!=0) { cimg::fclose(file); std::remove(tmp); path_found = true; }
        }
        if (!path_found)
          throw CImgIOException("cimg::temporary_path(): Failed to locate path for writing temporary files.\n");
      }
      return st_path;
    }

// Assembly:
pushq %r14
pushq %rbx
subq $0x608, %rsp            # imm = 0x608
movq %rdi, %rbx
testl %esi, %esi
je 0x76f7
movq 0x28c4b(%rip), %rdi     # 0x30330
testq %rdi, %rdi
je 0x76ef
callq 0x3370
andq $0x0, 0x28c39(%rip)     # 0x30330
movq 0x28c32(%rip), %r14     # 0x30330
testq %rbx, %rbx
je 0x7745
testq %r14, %r14
jne 0x771c
movl $0x400, %edi            # imm = 0x400
callq 0x3040
movq %rax, %r14
movq %rax, 0x28c14(%rip)     # 0x30330
movl $0x400, %edx            # imm = 0x400
movq %r14, %rdi
xorl %esi, %esi
callq 0x3150
movl $0x3ff, %edx            # imm = 0x3FF
movq %r14, %rdi
movq %rbx, %rsi
addq $0x608, %rsp            # imm = 0x608
popq %rbx
popq %r14
jmp 0x3120
testq %r14, %r14
jne 0x792d
movl $0x400, %edi            # imm = 0x400
callq 0x3040
movq %rax, 0x28bd1(%rip)     # 0x30330
movl $0x400, %edx            # imm = 0x400
movq %rax, %rdi
xorl %esi, %esi
callq 0x3150
leaq 0x200(%rsp), %rdi
movl $0x400, %edx            # imm = 0x400
xorl %esi, %esi
callq 0x3150
movq %rsp, %rbx
movl $0x200, %edx            # imm = 0x200
movq %rbx, %rdi
xorl %esi, %esi
callq 0x3150
callq 0x7ac2
leaq 0x1b42c(%rip), %rdx     # 0x22bcc
movl $0x200, %esi            # imm = 0x200
movq %rbx, %rdi
movq %rax, %rcx
xorl %eax, %eax
callq 0x3490
leaq 0x1b41a(%rip), %rdi     # 0x22bd3
callq 0x3350
testq %rax, %rax
jne 0x77d4
leaq 0x1b40d(%rip), %rdi     # 0x22bd7
callq 0x3350
testq %rax, %rax
je 0x7835
movq 0x28b55(%rip), %rdi     # 0x30330
leaq 0x1ceef(%rip), %rdx     # 0x246d1
movl $0x400, %esi            # imm = 0x400
movq %rax, %rcx
xorl %eax, %eax
callq 0x3490
movq 0x28b38(%rip), %rcx     # 0x30330
leaq 0x1b3dd(%rip), %rdx     # 0x22bdc
leaq 0x200(%rsp), %rbx
pushq $0x2f
popq %r8
movq %rsp, %r9
movl $0x400, %esi            # imm = 0x400
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3490
leaq 0x1b3bf(%rip), %rsi     # 0x22be3
movq %rbx, %rdi
callq 0x3340
testq %rax, %rax
jne 0x7911
movq 0x28af4(%rip), %rax     # 0x30330
movb $0x0, 0x4(%rax)
movl $0x706d742f, (%rax)     # imm = 0x706D742F
movq 0x28ae3(%rip), %rcx     # 0x30330
leaq 0x1b388(%rip), %rdx     # 0x22bdc
leaq 0x200(%rsp), %rbx
pushq $0x2f
popq %r8
movq %rsp, %r9
movl $0x400, %esi            # imm = 0x400
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3490
leaq 0x1b36a(%rip), %rsi     # 0x22be3
movq %rbx, %rdi
callq 0x3340
testq %rax, %rax
jne 0x7911
movq 0x28a9f(%rip), %rcx     # 0x30330
movabsq $0x706d742f7261762f, %rax # imm = 0x706D742F7261762F
movq %rax, (%rcx)
movb $0x0, 0x8(%rcx)
leaq 0x1b333(%rip), %rdx     # 0x22bdc
leaq 0x200(%rsp), %rbx
pushq $0x2f
popq %r8
movq %rsp, %r9
movl $0x400, %esi            # imm = 0x400
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3490
leaq 0x1b315(%rip), %rsi     # 0x22be3
movq %rbx, %rdi
callq 0x3340
testq %rax, %rax
jne 0x7911
movq 0x28a4e(%rip), %rax     # 0x30330
movb $0x0, (%rax)
leaq 0x200(%rsp), %rbx
movq %rsp, %rsi
movl $0x3ff, %edx            # imm = 0x3FF
movq %rbx, %rdi
callq 0x3120
leaq 0x1b2df(%rip), %rsi     # 0x22be3
movq %rbx, %rdi
callq 0x3340
testq %rax, %rax
je 0x793b
movq %rax, %rdi
callq 0x7982
leaq 0x200(%rsp), %rdi
callq 0x3520
movq 0x28a03(%rip), %r14     # 0x30330
movq %r14, %rax
addq $0x608, %rsp            # imm = 0x608
popq %rbx
popq %r14
retq
movl $0x4008, %edi           # imm = 0x4008
callq 0x3110
movq %rax, %rbx
leaq 0x1b2a0(%rip), %rsi     # 0x22bef
movq %rax, %rdi
xorl %eax, %eax
callq 0x6806
leaq 0x28380(%rip), %rsi     # 0x2fce0
movq 0x28671(%rip), %rdx     # 0x2ffd8
movq %rbx, %rdi
callq 0x34e0
movq %rax, %r14
movq %rbx, %rdi
callq 0x31d0
movq %r14, %rdi
callq 0x3500