// File: manikandan5[P]Image-Matching-Stitching-Warping/./CImg.h
// Function: cimg_library::CImg<double>::load_imagemagick_external(char const*)
CImg<T>& load_imagemagick_external(const char *const filename) {
      if (!filename)
        throw CImgArgumentException(_cimg_instance
                                    "load_imagemagick_external(): Specified filename is (null).",
                                    cimg_instance);
      std::fclose(cimg::fopen(filename,"rb"));            // Check if file exists.
      char command[1024] = { 0 }, filetmp[512] = { 0 };
      std::FILE *file = 0;
      const CImg<charT> s_filename = CImg<charT>::string(filename)._system_strescape();
#if cimg_OS==1
      cimg_snprintf(command,sizeof(command),"%s%s \"%s\" pnm:-",
                    cimg::imagemagick_path(),
                    !cimg::strcasecmp(cimg::split_filename(filename),"pdf")?" -density 400x400":"",
                    s_filename.data());
      file = popen(command,"r");
      if (file) {
        const unsigned int omode = cimg::exception_mode();
        cimg::exception_mode() = 0;
        try { load_pnm(file); } catch (...) {
          pclose(file);
          cimg::exception_mode() = omode;
          throw CImgIOException(_cimg_instance
                                "load_imagemagick_external(): Failed to load file '%s' with "
                                "external command 'convert'.",
                                cimg_instance,
                                filename);
        }
        pclose(file);
        return *this;
      }
#endif
      do {
        cimg_snprintf(filetmp,sizeof(filetmp),"%s%c%s.pnm",
                      cimg::temporary_path(),cimg_file_separator,cimg::filenamerand());
        if ((file=std::fopen(filetmp,"rb"))!=0) cimg::fclose(file);
      } while (file);
      cimg_snprintf(command,sizeof(command),"%s%s \"%s\" \"%s\"",
                    cimg::imagemagick_path(),
                    !cimg::strcasecmp(cimg::split_filename(filename),"pdf")?" -density 400x400":"",
                    s_filename.data(),CImg<charT>::string(filetmp)._system_strescape().data());
      cimg::system(command,cimg::imagemagick_path());
      if (!(file = std::fopen(filetmp,"rb"))) {
        cimg::fclose(cimg::fopen(filename,"r"));
        throw CImgIOException(_cimg_instance
                              "load_imagemagick_external(): Failed to load file '%s' with external command 'convert'.",
                              cimg_instance,
                              filename);

      } else cimg::fclose(file);
      load_pnm(filetmp);
      std::remove(filetmp);
      return *this;
    }

// Assembly:
pushq %rbx
subq $0x830, %rsp            # imm = 0x830
movq %rdi, 0x820(%rsp)
movq %rsi, 0x818(%rsp)
movq 0x820(%rsp), %rax
movq %rax, 0x188(%rsp)
cmpq $0x0, 0x818(%rsp)
jne 0x923d3
movl $0x4008, %edi           # imm = 0x4008
callq 0x5240
movq %rax, %rcx
movq 0x188(%rsp), %rax
movq %rcx, 0x158(%rsp)
movl (%rax), %ecx
movl %ecx, 0x160(%rsp)
movl 0x4(%rax), %ecx
movl %ecx, 0x164(%rsp)
movl 0x8(%rax), %ecx
movl %ecx, 0x168(%rsp)
movl 0xc(%rax), %ecx
movl %ecx, 0x16c(%rsp)
movq 0x18(%rax), %rcx
movq %rcx, 0x170(%rsp)
movb 0x10(%rax), %dl
leaq 0x566c1(%rip), %rcx     # 0xe89d2
leaq 0x377c9(%rip), %rax     # 0xc9ae1
testb $0x1, %dl
cmovneq %rcx, %rax
movq %rax, 0x178(%rsp)
callq 0x118f0
movq %rax, 0x180(%rsp)
jmp 0x92336
movl 0x16c(%rsp), %r9d
movl 0x168(%rsp), %r8d
movl 0x164(%rsp), %ecx
movl 0x160(%rsp), %edx
movq 0x158(%rsp), %rdi
movq 0x170(%rsp), %rsi
movq 0x178(%rsp), %r10
movq 0x180(%rsp), %r11
movq %rsp, %rax
movq %r11, 0x10(%rax)
movq %r10, 0x8(%rax)
movq %rsi, (%rax)
leaq 0x58ee9(%rip), %rsi     # 0xeb272
xorl %eax, %eax
callq 0x12220
jmp 0x92392
movq 0x158(%rsp), %rdi
leaq 0x6d7bf(%rip), %rsi     # 0xffb60
leaq -0x7ff48(%rip), %rdx    # 0x12460
callq 0x5920
movq 0x158(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x810(%rsp)
movl %eax, 0x80c(%rsp)
callq 0x53a0
jmp 0x92bc7
movq 0x818(%rsp), %rdi
leaq 0x56d7c(%rip), %rsi     # 0xe915e
callq 0x654a0
movq %rax, %rdi
callq 0x5530
leaq 0x400(%rsp), %rdi
xorl %esi, %esi
movl %esi, 0x144(%rsp)
movl $0x400, %edx            # imm = 0x400
callq 0x52a0
movl 0x144(%rsp), %esi
leaq 0x200(%rsp), %rdi
movl $0x200, %edx            # imm = 0x200
callq 0x52a0
movl 0x144(%rsp), %ecx
movq $0x0, 0x1f8(%rsp)
movq 0x818(%rsp), %rsi
leaq 0x1b8(%rsp), %rdi
movq %rdi, 0x148(%rsp)
movl $0x1, %edx
callq 0x7ab40
movq 0x148(%rsp), %rdi
callq 0x7abe0
movq %rax, 0x150(%rsp)
jmp 0x9246f
movq 0x150(%rsp), %rsi
leaq 0x1d8(%rsp), %rdi
callq 0x7b450
jmp 0x92486
leaq 0x1b8(%rsp), %rdi
callq 0x1a320
leaq 0x400(%rsp), %rax
movq %rax, 0x130(%rsp)
xorl %esi, %esi
movl %esi, %edi
callq 0x5be40
movq %rax, 0x138(%rsp)
jmp 0x924b6
movq 0x818(%rsp), %rdi
xorl %eax, %eax
movl %eax, 0x124(%rsp)
movl %eax, %esi
callq 0x63280
movq %rax, %rdi
leaq 0x58e13(%rip), %rsi     # 0xeb2eb
callq 0x633b0
testl %eax, %eax
leaq 0x564ec(%rip), %rcx     # 0xe89d2
leaq 0x58e02(%rip), %rax     # 0xeb2ef
cmovneq %rcx, %rax
movq %rax, 0x118(%rsp)
leaq 0x1d8(%rsp), %rdi
callq 0x7b900
movq 0x130(%rsp), %rdi
movq 0x138(%rsp), %rcx
movq 0x118(%rsp), %r8
movq %rax, %r9
movl 0x124(%rsp), %eax
leaq 0x58dac(%rip), %rdx     # 0xeb2db
movl $0x400, %esi            # imm = 0x400
callq 0x5890
leaq 0x42172(%rip), %rsi     # 0xd46b2
leaq 0x400(%rsp), %rdi
callq 0x5180
movq %rax, 0x128(%rsp)
jmp 0x92557
movq 0x128(%rsp), %rax
movq %rax, 0x1f8(%rsp)
cmpq $0x0, 0x1f8(%rsp)
je 0x927e5
callq 0x124b0
movq %rax, 0x110(%rsp)
jmp 0x92585
movq 0x110(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x1b4(%rsp)
callq 0x124b0
movq %rax, 0x108(%rsp)
jmp 0x925a5
movq 0x188(%rsp), %rdi
movq 0x108(%rsp), %rax
movl $0x0, (%rax)
movq 0x1f8(%rsp), %rsi
callq 0x7b910
jmp 0x925ca
jmp 0x927b6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x810(%rsp)
movl %eax, 0x80c(%rsp)
leaq 0x1b8(%rsp), %rdi
callq 0x1a320
jmp 0x92bc7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x810(%rsp)
movl %eax, 0x80c(%rsp)
jmp 0x92bba
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x810(%rsp)
movl %eax, 0x80c(%rsp)
movq 0x810(%rsp), %rdi
callq 0x51e0
movq 0x1f8(%rsp), %rdi
callq 0x5740
jmp 0x9263e
movl 0x1b4(%rsp), %eax
movl %eax, 0xfc(%rsp)
callq 0x124b0
movq %rax, 0x100(%rsp)
jmp 0x9265b
movq 0x100(%rsp), %rax
movl 0xfc(%rsp), %ecx
movl %ecx, (%rax)
movl $0x4008, %edi           # imm = 0x4008
callq 0x5240
movq %rax, %rcx
movq 0x188(%rsp), %rax
movq %rcx, 0xc8(%rsp)
movl (%rax), %ecx
movl %ecx, 0xd0(%rsp)
movl 0x4(%rax), %ecx
movl %ecx, 0xd4(%rsp)
movl 0x8(%rax), %ecx
movl %ecx, 0xd8(%rsp)
movl 0xc(%rax), %ecx
movl %ecx, 0xdc(%rsp)
movq 0x18(%rax), %rcx
movq %rcx, 0xe0(%rsp)
movb 0x10(%rax), %dl
leaq 0x5630c(%rip), %rcx     # 0xe89d2
leaq 0x37414(%rip), %rax     # 0xc9ae1
testb $0x1, %dl
cmovneq %rcx, %rax
movq %rax, 0xe8(%rsp)
callq 0x118f0
movq %rax, 0xf0(%rsp)
jmp 0x926eb
movl 0xdc(%rsp), %r9d
movl 0xd8(%rsp), %r8d
movl 0xd4(%rsp), %ecx
movl 0xd0(%rsp), %edx
movq 0xc8(%rsp), %rdi
movq 0xe0(%rsp), %rsi
movq 0xe8(%rsp), %r10
movq 0xf0(%rsp), %r11
movq 0x818(%rsp), %rbx
movq %rsp, %rax
movq %rbx, 0x18(%rax)
movq %r11, 0x10(%rax)
movq %r10, 0x8(%rax)
movq %rsi, (%rax)
leaq 0x58bb7(%rip), %rsi     # 0xeb301
xorl %eax, %eax
callq 0x5c880
jmp 0x92753
movq 0xc8(%rsp), %rdi
leaq 0x6d50e(%rip), %rsi     # 0xffc70
leaq -0x35ca9(%rip), %rdx    # 0x5cac0
callq 0x5920
jmp 0x92bdc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x810(%rsp)
movl %eax, 0x80c(%rsp)
jmp 0x927aa
movq 0xc8(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x810(%rsp)
movl %eax, 0x80c(%rsp)
callq 0x53a0
callq 0x58d0
jmp 0x927b1
jmp 0x92bba
movq 0x1f8(%rsp), %rdi
callq 0x5740
jmp 0x927c5
movq 0x188(%rsp), %rax
movq %rax, 0x828(%rsp)
movl $0x1, 0x1b0(%rsp)
jmp 0x92b9c
jmp 0x927e7
leaq 0x200(%rsp), %rax
movq %rax, 0xb8(%rsp)
xorl %esi, %esi
movl %esi, %edi
callq 0x5c290
movq %rax, 0xc0(%rsp)
jmp 0x9280a
callq 0x5c7a0
movq %rax, 0xb0(%rsp)
jmp 0x92819
movq 0xb0(%rsp), %r9
movq 0xc0(%rsp), %rcx
movq 0xb8(%rsp), %rdi
leaq 0x58b4e(%rip), %rdx     # 0xeb386
xorl %eax, %eax
movl $0x200, %esi            # imm = 0x200
movl $0x2f, %r8d
callq 0x5890
leaq 0x5690d(%rip), %rsi     # 0xe915e
leaq 0x200(%rsp), %rdi
callq 0x55c0
movq %rax, 0xa8(%rsp)
jmp 0x92868
movq 0xa8(%rsp), %rax
movq %rax, 0x1f8(%rsp)
cmpq $0x0, %rax
je 0x9288f
movq 0x1f8(%rsp), %rdi
callq 0x5c6f0
jmp 0x9288d
jmp 0x9288f
jmp 0x92891
cmpq $0x0, 0x1f8(%rsp)
jne 0x927e7
leaq 0x400(%rsp), %rax
movq %rax, 0x98(%rsp)
xorl %esi, %esi
movl %esi, %edi
callq 0x5be40
movq %rax, 0xa0(%rsp)
jmp 0x928c3
movq 0x818(%rsp), %rdi
xorl %eax, %eax
movl %eax, 0x8c(%rsp)
movl %eax, %esi
callq 0x63280
movq %rax, %rdi
leaq 0x58a06(%rip), %rsi     # 0xeb2eb
callq 0x633b0
testl %eax, %eax
leaq 0x560df(%rip), %rcx     # 0xe89d2
leaq 0x589f5(%rip), %rax     # 0xeb2ef
cmovneq %rcx, %rax
movq %rax, 0x80(%rsp)
leaq 0x1d8(%rsp), %rdi
callq 0x7b900
movl 0x8c(%rsp), %ecx
movq %rax, 0x90(%rsp)
leaq 0x190(%rsp), %rdi
leaq 0x200(%rsp), %rsi
movl $0x1, %edx
callq 0x7ab40
jmp 0x9293e
leaq 0x190(%rsp), %rdi
callq 0x7abe0
movq %rax, 0x78(%rsp)
jmp 0x92952
movq 0x78(%rsp), %rdi
callq 0x1a3e0
movq 0x98(%rsp), %rdi
movq 0xa0(%rsp), %rcx
movq 0x80(%rsp), %r8
movq 0x90(%rsp), %r9
movq %rax, %rdx
movq %rsp, %rax
movq %rdx, (%rax)
leaq 0x58a05(%rip), %rdx     # 0xeb391
xorl %eax, %eax
movl %eax, 0x64(%rsp)
movl $0x400, %esi            # imm = 0x400
callq 0x5890
leaq 0x190(%rsp), %rdi
callq 0x1a320
movl 0x64(%rsp), %esi
leaq 0x400(%rsp), %rax
movq %rax, 0x68(%rsp)
movl %esi, %edi
callq 0x5be40
movq %rax, 0x70(%rsp)
jmp 0x929c8
movq 0x70(%rsp), %rsi
movq 0x68(%rsp), %rdi
callq 0x66380
jmp 0x929d9
leaq 0x5677e(%rip), %rsi     # 0xe915e
leaq 0x200(%rsp), %rdi
callq 0x55c0
movq %rax, 0x58(%rsp)
jmp 0x929f4
movq 0x58(%rsp), %rax
movq %rax, 0x1f8(%rsp)
cmpq $0x0, %rax
jne 0x92b4c
movq 0x818(%rsp), %rdi
leaq 0x41c98(%rip), %rsi     # 0xd46b2
callq 0x654a0
movq %rax, 0x50(%rsp)
jmp 0x92a26
movq 0x50(%rsp), %rdi
callq 0x5c6f0
jmp 0x92a32
movl $0x4008, %edi           # imm = 0x4008
callq 0x5240
movq %rax, %rcx
movq 0x188(%rsp), %rax
movq %rcx, 0x20(%rsp)
movl (%rax), %ecx
movl %ecx, 0x28(%rsp)
movl 0x4(%rax), %ecx
movl %ecx, 0x2c(%rsp)
movl 0x8(%rax), %ecx
movl %ecx, 0x30(%rsp)
movl 0xc(%rax), %ecx
movl %ecx, 0x34(%rsp)
movq 0x18(%rax), %rcx
movq %rcx, 0x38(%rsp)
movb 0x10(%rax), %dl
leaq 0x55f58(%rip), %rcx     # 0xe89d2
leaq 0x37060(%rip), %rax     # 0xc9ae1
testb $0x1, %dl
cmovneq %rcx, %rax
movq %rax, 0x40(%rsp)
callq 0x118f0
movq %rax, 0x48(%rsp)
jmp 0x92a99
movl 0x34(%rsp), %r9d
movl 0x30(%rsp), %r8d
movl 0x2c(%rsp), %ecx
movl 0x28(%rsp), %edx
movq 0x20(%rsp), %rdi
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %r10
movq 0x48(%rsp), %r11
movq 0x818(%rsp), %rbx
movq %rsp, %rax
movq %rbx, 0x18(%rax)
movq %r11, 0x10(%rax)
movq %r10, 0x8(%rax)
movq %rsi, (%rax)
leaq 0x58821(%rip), %rsi     # 0xeb301
xorl %eax, %eax
callq 0x5c880
jmp 0x92ae9
movq 0x20(%rsp), %rdi
leaq 0x6d17b(%rip), %rsi     # 0xffc70
leaq -0x3603c(%rip), %rdx    # 0x5cac0
callq 0x5920
jmp 0x92bdc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x810(%rsp)
movl %eax, 0x80c(%rsp)
leaq 0x190(%rsp), %rdi
callq 0x1a320
jmp 0x92bba
movq 0x20(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x810(%rsp)
movl %eax, 0x80c(%rsp)
callq 0x53a0
jmp 0x92bba
movq 0x1f8(%rsp), %rdi
callq 0x5c6f0
jmp 0x92b5b
jmp 0x92b5d
movq 0x188(%rsp), %rdi
leaq 0x200(%rsp), %rsi
callq 0x63540
jmp 0x92b74
leaq 0x200(%rsp), %rdi
callq 0x59c0
movq 0x188(%rsp), %rax
movq %rax, 0x828(%rsp)
movl $0x1, 0x1b0(%rsp)
leaq 0x1d8(%rsp), %rdi
callq 0x1a320
movq 0x828(%rsp), %rax
addq $0x830, %rsp            # imm = 0x830
popq %rbx
retq
leaq 0x1d8(%rsp), %rdi
callq 0x1a320
movq 0x810(%rsp), %rdi
callq 0x5970
movq %rax, %rdi
callq 0xcb20
nopl (%rax)