// File: manikandan5[P]Image-Matching-Stitching-Warping/./CImg.h
// Function: cimg_library::CImg<double>::save_imagemagick_external(char const*, unsigned int) const
const CImg<T>& save_imagemagick_external(const char *const filename, const unsigned int quality=100) const {
      if (!filename)
        throw CImgArgumentException(_cimg_instance
                                    "save_imagemagick_external(): Specified filename is (null).",
                                    cimg_instance);
      if (is_empty()) { cimg::fempty(0,filename); return *this; }

#ifdef cimg_use_png
#define _cimg_sie_ext1 "png"
#define _cimg_sie_ext2 "png"
#else
#define _cimg_sie_ext1 "pgm"
#define _cimg_sie_ext2 "ppm"
#endif
      char command[1024] = { 0 }, filetmp[512] = { 0 };
      std::FILE *file;
      do {
        cimg_snprintf(filetmp,sizeof(filetmp),"%s%c%s.%s",cimg::temporary_path(),
                      cimg_file_separator,cimg::filenamerand(),_spectrum==1?_cimg_sie_ext1:_cimg_sie_ext2);
        if ((file=std::fopen(filetmp,"rb"))!=0) cimg::fclose(file);
      } while (file);
#ifdef cimg_use_png
      save_png(filetmp);
#else
      save_pnm(filetmp);
#endif
      cimg_snprintf(command,sizeof(command),"%s -quality %u \"%s\" \"%s\"",
                    cimg::imagemagick_path(),quality,
                    CImg<charT>::string(filetmp)._system_strescape().data(),
                    CImg<charT>::string(filename)._system_strescape().data());
      cimg::system(command);
      file = std::fopen(filename,"rb");
      if (!file)
        throw CImgIOException(_cimg_instance
                              "save_imagemagick_external(): Failed to save file '%s' with external command 'convert'.",
                              cimg_instance,
                              filename);

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

// Assembly:
pushq %rbx
subq $0x770, %rsp            # imm = 0x770
movq %rdi, 0x760(%rsp)
movq %rsi, 0x758(%rsp)
movl %edx, 0x754(%rsp)
movq 0x760(%rsp), %rax
movq %rax, 0xf0(%rsp)
cmpq $0x0, 0x758(%rsp)
jne 0xb4a8a
movl $0x4008, %edi           # imm = 0x4008
callq 0x5240
movq %rax, %rcx
movq 0xf0(%rsp), %rax
movq %rcx, 0xc0(%rsp)
movl (%rax), %ecx
movl %ecx, 0xc8(%rsp)
movl 0x4(%rax), %ecx
movl %ecx, 0xcc(%rsp)
movl 0x8(%rax), %ecx
movl %ecx, 0xd0(%rsp)
movl 0xc(%rax), %ecx
movl %ecx, 0xd4(%rsp)
movq 0x18(%rax), %rcx
movq %rcx, 0xd8(%rsp)
movb 0x10(%rax), %dl
leaq 0x3400a(%rip), %rcx     # 0xe89d2
leaq 0x15112(%rip), %rax     # 0xc9ae1
testb $0x1, %dl
cmovneq %rcx, %rax
movq %rax, 0xe0(%rsp)
callq 0x118f0
movq %rax, 0xe8(%rsp)
jmp 0xb49ed
movl 0xd4(%rsp), %r9d
movl 0xd0(%rsp), %r8d
movl 0xcc(%rsp), %ecx
movl 0xc8(%rsp), %edx
movq 0xc0(%rsp), %rdi
movq 0xd8(%rsp), %rsi
movq 0xe0(%rsp), %r10
movq 0xe8(%rsp), %r11
movq %rsp, %rax
movq %r11, 0x10(%rax)
movq %r10, 0x8(%rax)
movq %rsi, (%rax)
leaq 0x38554(%rip), %rsi     # 0xecf94
xorl %eax, %eax
callq 0x12220
jmp 0xb4a49
movq 0xc0(%rsp), %rdi
leaq 0x4b108(%rip), %rsi     # 0xffb60
leaq -0xa25ff(%rip), %rdx    # 0x12460
callq 0x5920
movq 0xc0(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x748(%rsp)
movl %eax, 0x744(%rsp)
callq 0x53a0
jmp 0xb4ea3
movq 0xf0(%rsp), %rdi
callq 0x10320
testb $0x1, %al
jne 0xb4a9d
jmp 0xb4ac3
movq 0x758(%rsp), %rsi
xorl %eax, %eax
movl %eax, %edi
callq 0x9c310
movq 0xf0(%rsp), %rax
movq %rax, 0x768(%rsp)
jmp 0xb4e92
leaq 0x340(%rsp), %rdi
xorl %esi, %esi
movl $0x400, %edx            # imm = 0x400
callq 0x52a0
leaq 0x140(%rsp), %rdi
xorl %esi, %esi
movl $0x200, %edx            # imm = 0x200
callq 0x52a0
leaq 0x140(%rsp), %rax
movq %rax, 0xa8(%rsp)
xorl %eax, %eax
movl %eax, %edi
xorl %esi, %esi
callq 0x5c290
movq %rax, 0xb0(%rsp)
callq 0x5c7a0
movq %rax, %rcx
movq 0xf0(%rsp), %rax
movq %rcx, 0xb8(%rsp)
cmpl $0x1, 0xc(%rax)
jne 0xb4b3d
leaq 0x34557(%rip), %rax     # 0xe908a
movq %rax, 0xa0(%rsp)
jmp 0xb4b4e
leaq 0x3639e(%rip), %rax     # 0xeaee2
movq %rax, 0xa0(%rsp)
jmp 0xb4b4e
movq 0xb8(%rsp), %r9
movq 0xb0(%rsp), %rcx
movq 0xa8(%rsp), %rdi
movq 0xa0(%rsp), %rax
movl $0x200, %esi            # imm = 0x200
leaq 0x361b1(%rip), %rdx     # 0xead2b
movl $0x2f, %r8d
movq %rax, (%rsp)
movb $0x0, %al
callq 0x5890
leaq 0x140(%rsp), %rdi
leaq 0x345c4(%rip), %rsi     # 0xe915e
callq 0x55c0
movq %rax, 0x138(%rsp)
cmpq $0x0, %rax
je 0xb4bba
movq 0x138(%rsp), %rdi
callq 0x5c6f0
jmp 0xb4bbc
cmpq $0x0, 0x138(%rsp)
jne 0xb4aeb
movq 0xf0(%rsp), %rdi
leaq 0x140(%rsp), %rsi
movq %rsi, 0x70(%rsp)
xorl %edx, %edx
movl %edx, 0x7c(%rsp)
callq 0x99880
movl 0x7c(%rsp), %esi
leaq 0x340(%rsp), %rax
movq %rax, 0x68(%rsp)
movl %esi, %edi
callq 0x5be40
movq 0x70(%rsp), %rsi
movl 0x7c(%rsp), %ecx
movq %rax, 0x80(%rsp)
movl 0x754(%rsp), %eax
movl %eax, 0x8c(%rsp)
leaq 0x118(%rsp), %rdi
movq %rdi, 0x90(%rsp)
movl $0x1, %edx
callq 0x7ab40
movq 0x90(%rsp), %rdi
callq 0x7abe0
movq %rax, 0x98(%rsp)
jmp 0xb4c53
movq 0x98(%rsp), %rdi
callq 0x1a3e0
movq %rax, 0x60(%rsp)
movq 0x758(%rsp), %rsi
leaq 0xf8(%rsp), %rdi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x7ab40
jmp 0xb4c83
leaq 0xf8(%rsp), %rdi
callq 0x7abe0
movq %rax, 0x58(%rsp)
jmp 0xb4c97
movq 0x58(%rsp), %rdi
callq 0x1a3e0
movq 0x68(%rsp), %rdi
movq 0x80(%rsp), %rcx
movl 0x8c(%rsp), %r8d
movq 0x60(%rsp), %r9
movl $0x400, %esi            # imm = 0x400
leaq 0x38336(%rip), %rdx     # 0xecffd
movq %rax, (%rsp)
movb $0x0, %al
callq 0x5890
leaq 0xf8(%rsp), %rdi
callq 0x1a320
leaq 0x118(%rsp), %rdi
callq 0x1a320
leaq 0x340(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x66380
movq 0x758(%rsp), %rdi
leaq 0x34452(%rip), %rsi     # 0xe915e
callq 0x55c0
movq %rax, 0x138(%rsp)
cmpq $0x0, 0x138(%rsp)
jne 0xb4e5d
movl $0x4008, %edi           # imm = 0x4008
callq 0x5240
movq %rax, %rcx
movq 0xf0(%rsp), %rax
movq %rcx, 0x28(%rsp)
movl (%rax), %ecx
movl %ecx, 0x30(%rsp)
movl 0x4(%rax), %ecx
movl %ecx, 0x34(%rsp)
movl 0x8(%rax), %ecx
movl %ecx, 0x38(%rsp)
movl 0xc(%rax), %ecx
movl %ecx, 0x3c(%rsp)
movq 0x18(%rax), %rcx
movq %rcx, 0x40(%rsp)
movb 0x10(%rax), %dl
leaq 0x33c62(%rip), %rcx     # 0xe89d2
leaq 0x14d6a(%rip), %rax     # 0xc9ae1
testb $0x1, %dl
cmovneq %rcx, %rax
movq %rax, 0x48(%rsp)
callq 0x118f0
movq %rax, 0x50(%rsp)
jmp 0xb4d8f
movl 0x3c(%rsp), %r9d
movl 0x38(%rsp), %r8d
movl 0x34(%rsp), %ecx
movl 0x30(%rsp), %edx
movq 0x28(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %r10
movq 0x50(%rsp), %r11
movq 0x758(%rsp), %rbx
movq %rsp, %rax
movq %rbx, 0x18(%rax)
movq %r11, 0x10(%rax)
movq %r10, 0x8(%rax)
movq %rsi, (%rax)
leaq 0x38240(%rip), %rsi     # 0xed016
xorl %eax, %eax
callq 0x5c880
jmp 0xb4ddf
movq 0x28(%rsp), %rdi
leaq 0x4ae85(%rip), %rsi     # 0xffc70
leaq -0x58332(%rip), %rdx    # 0x5cac0
callq 0x5920
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x748(%rsp)
movl %eax, 0x744(%rsp)
jmp 0xb4e2e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x748(%rsp)
movl %eax, 0x744(%rsp)
leaq 0xf8(%rsp), %rdi
callq 0x1a320
leaq 0x118(%rsp), %rdi
callq 0x1a320
jmp 0xb4ea3
movq 0x28(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x748(%rsp)
movl %eax, 0x744(%rsp)
callq 0x53a0
jmp 0xb4ea3
cmpq $0x0, 0x138(%rsp)
je 0xb4e75
movq 0x138(%rsp), %rdi
callq 0x5c6f0
leaq 0x140(%rsp), %rdi
callq 0x59c0
movq 0xf0(%rsp), %rax
movq %rax, 0x768(%rsp)
movq 0x768(%rsp), %rax
addq $0x770, %rsp            # imm = 0x770
popq %rbx
retq
movq 0x748(%rsp), %rdi
callq 0x5970