// File: 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 %rbp
movq %rsp, %rbp
subq $0x650, %rsp            # imm = 0x650
movb %sil, %al
movq %rdi, -0x8(%rbp)
andb $0x1, %al
movb %al, -0x9(%rbp)
testb $0x1, -0x9(%rbp)
je 0xccb8
movq 0x4374c(%rip), %rax     # 0x503e0
movq %rax, -0x638(%rbp)
cmpq $0x0, %rax
je 0xccad
movq -0x638(%rbp), %rdi
callq 0x4490
movq $0x0, 0x43728(%rip) # 0x503e0
cmpq $0x0, -0x8(%rbp)
je 0xcd07
cmpq $0x0, 0x43719(%rip)     # 0x503e0
jne 0xccda
movl $0x400, %edi            # imm = 0x400
callq 0x4040
movq %rax, 0x43706(%rip)     # 0x503e0
movq 0x436ff(%rip), %rdi     # 0x503e0
xorl %esi, %esi
movl $0x400, %edx            # imm = 0x400
callq 0x41c0
movq 0x436ec(%rip), %rdi     # 0x503e0
movq -0x8(%rbp), %rsi
movl $0x3ff, %edx            # imm = 0x3FF
callq 0x41a0
jmp 0xd080
cmpq $0x0, 0x436d1(%rip)     # 0x503e0
jne 0xd07e
movl $0x400, %edi            # imm = 0x400
callq 0x4040
movq %rax, 0x436ba(%rip)     # 0x503e0
movq 0x436b3(%rip), %rdi     # 0x503e0
xorl %esi, %esi
movl $0x400, %edx            # imm = 0x400
callq 0x41c0
movb $0x0, -0xa(%rbp)
leaq -0x410(%rbp), %rdi
xorl %esi, %esi
movl $0x400, %edx            # imm = 0x400
callq 0x41c0
leaq -0x610(%rbp), %rdi
xorl %esi, %esi
movl $0x200, %edx            # imm = 0x200
callq 0x41c0
movq $0x0, -0x618(%rbp)
leaq -0x610(%rbp), %rax
movq %rax, -0x640(%rbp)
callq 0xd260
movq -0x640(%rbp), %rdi
movq %rax, %rcx
movl $0x200, %esi            # imm = 0x200
leaq 0x35e83(%rip), %rdx     # 0x42c1a
movb $0x0, %al
callq 0x45b0
leaq 0x35e7c(%rip), %rdi     # 0x42c21
callq 0x4460
movq %rax, -0x620(%rbp)
cmpq $0x0, -0x620(%rbp)
jne 0xcdda
leaq 0x35e63(%rip), %rdi     # 0x42c25
callq 0x4460
movq %rax, -0x620(%rbp)
movq -0x620(%rbp), %rdi
callq 0xd130
cmpq $0x0, -0x620(%rbp)
je 0xce81
testb $0x1, -0xa(%rbp)
jne 0xce7f
movq 0x435e7(%rip), %rdi     # 0x503e0
movq -0x620(%rbp), %rcx
movl $0x400, %esi            # imm = 0x400
leaq 0x37915(%rip), %rdx     # 0x44721
movb $0x0, %al
callq 0x45b0
leaq -0x410(%rbp), %rdi
movq 0x435bf(%rip), %rcx     # 0x503e0
leaq -0x610(%rbp), %r9
movl $0x400, %esi            # imm = 0x400
leaq 0x35df6(%rip), %rdx     # 0x42c2a
movl $0x2f, %r8d
movb $0x0, %al
callq 0x45b0
leaq -0x410(%rbp), %rdi
leaq 0x35de2(%rip), %rsi     # 0x42c31
callq 0x4450
movq %rax, -0x618(%rbp)
cmpq $0x0, %rax
je 0xce7d
movq -0x618(%rbp), %rdi
callq 0xd0a0
leaq -0x410(%rbp), %rdi
callq 0x4650
movb $0x1, -0xa(%rbp)
jmp 0xce7f
jmp 0xce81
testb $0x1, -0xa(%rbp)
jne 0xcf18
movq 0x4354e(%rip), %rdi     # 0x503e0
movl $0x400, %esi            # imm = 0x400
leaq 0x37883(%rip), %rdx     # 0x44721
leaq 0x35d93(%rip), %rcx     # 0x42c38
movb $0x0, %al
callq 0x45b0
leaq -0x410(%rbp), %rdi
movq 0x43526(%rip), %rcx     # 0x503e0
leaq -0x610(%rbp), %r9
movl $0x400, %esi            # imm = 0x400
leaq 0x35d5d(%rip), %rdx     # 0x42c2a
movl $0x2f, %r8d
movb $0x0, %al
callq 0x45b0
leaq -0x410(%rbp), %rdi
leaq 0x35d49(%rip), %rsi     # 0x42c31
callq 0x4450
movq %rax, -0x618(%rbp)
cmpq $0x0, %rax
je 0xcf16
movq -0x618(%rbp), %rdi
callq 0xd0a0
leaq -0x410(%rbp), %rdi
callq 0x4650
movb $0x1, -0xa(%rbp)
jmp 0xcf18
testb $0x1, -0xa(%rbp)
jne 0xcfaf
movq 0x434b7(%rip), %rdi     # 0x503e0
movl $0x400, %esi            # imm = 0x400
leaq 0x377ec(%rip), %rdx     # 0x44721
leaq 0x35cf8(%rip), %rcx     # 0x42c34
movb $0x0, %al
callq 0x45b0
leaq -0x410(%rbp), %rdi
movq 0x4348f(%rip), %rcx     # 0x503e0
leaq -0x610(%rbp), %r9
movl $0x400, %esi            # imm = 0x400
leaq 0x35cc6(%rip), %rdx     # 0x42c2a
movl $0x2f, %r8d
movb $0x0, %al
callq 0x45b0
leaq -0x410(%rbp), %rdi
leaq 0x35cb2(%rip), %rsi     # 0x42c31
callq 0x4450
movq %rax, -0x618(%rbp)
cmpq $0x0, %rax
je 0xcfad
movq -0x618(%rbp), %rdi
callq 0xd0a0
leaq -0x410(%rbp), %rdi
callq 0x4650
movb $0x1, -0xa(%rbp)
jmp 0xcfaf
testb $0x1, -0xa(%rbp)
jne 0xd015
movq 0x43424(%rip), %rax     # 0x503e0
movb $0x0, (%rax)
leaq -0x410(%rbp), %rdi
leaq -0x610(%rbp), %rsi
movl $0x3ff, %edx            # imm = 0x3FF
callq 0x41a0
leaq -0x410(%rbp), %rdi
leaq 0x35c4c(%rip), %rsi     # 0x42c31
callq 0x4450
movq %rax, -0x618(%rbp)
cmpq $0x0, %rax
je 0xd013
movq -0x618(%rbp), %rdi
callq 0xd0a0
leaq -0x410(%rbp), %rdi
callq 0x4650
movb $0x1, -0xa(%rbp)
jmp 0xd015
testb $0x1, -0xa(%rbp)
jne 0xd07c
movl $0x4008, %edi           # imm = 0x4008
callq 0x4190
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x648(%rbp)
leaq 0x35c04(%rip), %rsi     # 0x42c3d
xorl %eax, %eax
callq 0xb3b0
jmp 0xd042
movq -0x648(%rbp), %rdi
leaq 0x42bb0(%rip), %rsi     # 0x4fc00
leaq -0x1b37(%rip), %rdx     # 0xb520
callq 0x4600
movq -0x648(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x628(%rbp)
movl %eax, -0x62c(%rbp)
callq 0x4270
jmp 0xd090
jmp 0xd07e
jmp 0xd080
movq 0x43359(%rip), %rax     # 0x503e0
addq $0x650, %rsp            # imm = 0x650
popq %rbp
retq
movq -0x628(%rbp), %rdi
callq 0x4620
nopl (%rax)