// File: manikandan5[P]Image-Matching-Stitching-Warping/./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(s_path,1024,"%s",p); \
        cimg_snprintf(tmp,sizeof(tmp),"%s%c%s",s_path,cimg_file_separator,filetmp); \
        if ((file=std::fopen(tmp,"wb"))!=0) { cimg::fclose(file); std::remove(tmp); path_found = true; } \
      }
      static char *s_path = 0;
      cimg::mutex(7);
      if (reinit_path) { delete[] s_path; s_path = 0; }
      if (user_path) {
        if (!s_path) s_path = new char[1024];
        std::memset(s_path,0,1024);
        std::strncpy(s_path,user_path,1023);
      } else if (!s_path) {
        s_path = new char[1024];
        std::memset(s_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) {
          *s_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) {
          cimg::mutex(7,0);
          throw CImgIOException("cimg::temporary_path(): Failed to locate path for writing temporary files.\n");
        }
      }
      cimg::mutex(7,0);
      return s_path;
    }

// Assembly:
subq $0x658, %rsp            # imm = 0x658
movb %sil, %al
movq %rdi, 0x650(%rsp)
andb $0x1, %al
movb %al, 0x64f(%rsp)
movl $0x7, %edi
movl $0x1, %esi
callq 0x12d30
testb $0x1, 0x64f(%rsp)
je 0x5c2eb
movq 0xa6ae5(%rip), %rax     # 0x102db0
movq %rax, 0x18(%rsp)
cmpq $0x0, %rax
je 0x5c2e0
movq 0x18(%rsp), %rdi
callq 0x5680
movq $0x0, 0xa6ac5(%rip) # 0x102db0
cmpq $0x0, 0x650(%rsp)
je 0x5c342
cmpq $0x0, 0xa6ab2(%rip)     # 0x102db0
jne 0x5c311
movl $0x400, %edi            # imm = 0x400
callq 0x5040
movq %rax, 0xa6a9f(%rip)     # 0x102db0
movq 0xa6a98(%rip), %rdi     # 0x102db0
xorl %esi, %esi
movl $0x400, %edx            # imm = 0x400
callq 0x52a0
movq 0xa6a85(%rip), %rdi     # 0x102db0
movq 0x650(%rsp), %rsi
movl $0x3ff, %edx            # imm = 0x3FF
callq 0x5270
jmp 0x5c6ca
cmpq $0x0, 0xa6a66(%rip)     # 0x102db0
jne 0x5c6c8
movl $0x400, %edi            # imm = 0x400
callq 0x5040
movq %rax, 0xa6a4f(%rip)     # 0x102db0
movq 0xa6a48(%rip), %rdi     # 0x102db0
xorl %esi, %esi
movl $0x400, %edx            # imm = 0x400
callq 0x52a0
movb $0x0, 0x64e(%rsp)
leaq 0x240(%rsp), %rdi
xorl %esi, %esi
movl $0x400, %edx            # imm = 0x400
callq 0x52a0
leaq 0x40(%rsp), %rdi
xorl %esi, %esi
movl $0x200, %edx            # imm = 0x200
callq 0x52a0
movq $0x0, 0x38(%rsp)
leaq 0x40(%rsp), %rax
movq %rax, 0x10(%rsp)
callq 0x5c7a0
movq 0x10(%rsp), %rdi
movq %rax, %rcx
movl $0x200, %esi            # imm = 0x200
leaq 0x8cb1c(%rip), %rdx     # 0xe8ee9
movb $0x0, %al
callq 0x5890
leaq 0x8cb15(%rip), %rdi     # 0xe8ef0
callq 0x55e0
movq %rax, 0x30(%rsp)
cmpq $0x0, 0x30(%rsp)
jne 0x5c408
leaq 0x8cb00(%rip), %rdi     # 0xe8ef4
callq 0x55e0
movq %rax, 0x30(%rsp)
movq 0x30(%rsp), %rdi
callq 0x5c780
cmpq $0x0, 0x30(%rsp)
je 0x5c4b0
testb $0x1, 0x64e(%rsp)
jne 0x5c4ae
movq 0xa6987(%rip), %rdi     # 0x102db0
movq 0x30(%rsp), %rcx
movl $0x400, %esi            # imm = 0x400
leaq 0x8e372(%rip), %rdx     # 0xea7ac
movb $0x0, %al
callq 0x5890
leaq 0x240(%rsp), %rdi
movq 0xa6960(%rip), %rcx     # 0x102db0
leaq 0x40(%rsp), %r9
movl $0x400, %esi            # imm = 0x400
leaq 0x8ca98(%rip), %rdx     # 0xe8ef9
movl $0x2f, %r8d
movb $0x0, %al
callq 0x5890
leaq 0x240(%rsp), %rdi
leaq 0x8ca83(%rip), %rsi     # 0xe8f00
callq 0x55c0
movq %rax, 0x38(%rsp)
cmpq $0x0, %rax
je 0x5c4ac
movq 0x38(%rsp), %rdi
callq 0x5c6f0
leaq 0x240(%rsp), %rdi
callq 0x59c0
movb $0x1, 0x64e(%rsp)
jmp 0x5c4ae
jmp 0x5c4b0
testb $0x1, 0x64e(%rsp)
jne 0x5c54c
movq 0xa68eb(%rip), %rdi     # 0x102db0
movl $0x400, %esi            # imm = 0x400
leaq 0x8e2db(%rip), %rdx     # 0xea7ac
leaq 0x8ca2f(%rip), %rcx     # 0xe8f07
movb $0x0, %al
callq 0x5890
leaq 0x240(%rsp), %rdi
movq 0xa68c2(%rip), %rcx     # 0x102db0
leaq 0x40(%rsp), %r9
movl $0x400, %esi            # imm = 0x400
leaq 0x8c9fa(%rip), %rdx     # 0xe8ef9
movl $0x2f, %r8d
movb $0x0, %al
callq 0x5890
leaq 0x240(%rsp), %rdi
leaq 0x8c9e5(%rip), %rsi     # 0xe8f00
callq 0x55c0
movq %rax, 0x38(%rsp)
cmpq $0x0, %rax
je 0x5c54a
movq 0x38(%rsp), %rdi
callq 0x5c6f0
leaq 0x240(%rsp), %rdi
callq 0x59c0
movb $0x1, 0x64e(%rsp)
jmp 0x5c54c
testb $0x1, 0x64e(%rsp)
jne 0x5c5e8
movq 0xa684f(%rip), %rdi     # 0x102db0
movl $0x400, %esi            # imm = 0x400
leaq 0x8e23f(%rip), %rdx     # 0xea7ac
leaq 0x8c98f(%rip), %rcx     # 0xe8f03
movb $0x0, %al
callq 0x5890
leaq 0x240(%rsp), %rdi
movq 0xa6826(%rip), %rcx     # 0x102db0
leaq 0x40(%rsp), %r9
movl $0x400, %esi            # imm = 0x400
leaq 0x8c95e(%rip), %rdx     # 0xe8ef9
movl $0x2f, %r8d
movb $0x0, %al
callq 0x5890
leaq 0x240(%rsp), %rdi
leaq 0x8c949(%rip), %rsi     # 0xe8f00
callq 0x55c0
movq %rax, 0x38(%rsp)
cmpq $0x0, %rax
je 0x5c5e6
movq 0x38(%rsp), %rdi
callq 0x5c6f0
leaq 0x240(%rsp), %rdi
callq 0x59c0
movb $0x1, 0x64e(%rsp)
jmp 0x5c5e8
testb $0x1, 0x64e(%rsp)
jne 0x5c653
movq 0xa67b7(%rip), %rax     # 0x102db0
movb $0x0, (%rax)
leaq 0x240(%rsp), %rdi
leaq 0x40(%rsp), %rsi
movl $0x3ff, %edx            # imm = 0x3FF
callq 0x5270
leaq 0x240(%rsp), %rdi
leaq 0x8c8de(%rip), %rsi     # 0xe8f00
callq 0x55c0
movq %rax, 0x38(%rsp)
cmpq $0x0, %rax
je 0x5c651
movq 0x38(%rsp), %rdi
callq 0x5c6f0
leaq 0x240(%rsp), %rdi
callq 0x59c0
movb $0x1, 0x64e(%rsp)
jmp 0x5c653
testb $0x1, 0x64e(%rsp)
jne 0x5c6c6
movl $0x7, %edi
xorl %esi, %esi
movl %esi, 0x4(%rsp)
callq 0x12d30
movl $0x4008, %edi           # imm = 0x4008
callq 0x5240
movq %rax, %rdi
movl 0x4(%rsp), %eax
movq %rdi, %rcx
movq %rcx, 0x8(%rsp)
leaq 0x8c87f(%rip), %rsi     # 0xe8f0c
callq 0x5c880
jmp 0x5c694
movq 0x8(%rsp), %rdi
leaq 0xa35d0(%rip), %rsi     # 0xffc70
leaq 0x419(%rip), %rdx       # 0x5cac0
callq 0x5920
movq 0x8(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x28(%rsp)
movl %eax, 0x24(%rsp)
callq 0x53a0
jmp 0x5c6e5
jmp 0x5c6c8
jmp 0x5c6ca
movl $0x7, %edi
xorl %esi, %esi
callq 0x12d30
movq 0xa66d3(%rip), %rax     # 0x102db0
addq $0x658, %rsp            # imm = 0x658
retq
movq 0x28(%rsp), %rdi
callq 0x5970
nop