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

#ifdef cimg_use_png
#define _cimg_sge_ext1 "png"
#define _cimg_sge_ext2 "png"
#else
#define _cimg_sge_ext1 "pgm"
#define _cimg_sge_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_sge_ext1:_cimg_sge_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 convert -quality %u \"%s\" \"%s\"",
                    cimg::graphicsmagick_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_graphicsmagick_external(): Failed to save file '%s' with external command 'gm'.",
                              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 0xb500a
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 0x33a8a(%rip), %rcx     # 0xe89d2
leaq 0x14b92(%rip), %rax     # 0xc9ae1
testb $0x1, %dl
cmovneq %rcx, %rax
movq %rax, 0xe0(%rsp)
callq 0x118f0
movq %rax, 0xe8(%rsp)
jmp 0xb4f6d
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 0x380db(%rip), %rsi     # 0xed09b
xorl %eax, %eax
callq 0x12220
jmp 0xb4fc9
movq 0xc0(%rsp), %rdi
leaq 0x4ab88(%rip), %rsi     # 0xffb60
leaq -0xa2b7f(%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 0xb5423
movq 0xf0(%rsp), %rdi
callq 0x10320
testb $0x1, %al
jne 0xb501d
jmp 0xb5043
movq 0x758(%rsp), %rsi
xorl %eax, %eax
movl %eax, %edi
callq 0x9c310
movq 0xf0(%rsp), %rax
movq %rax, 0x768(%rsp)
jmp 0xb5412
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 0xb50bd
leaq 0x33fd7(%rip), %rax     # 0xe908a
movq %rax, 0xa0(%rsp)
jmp 0xb50ce
leaq 0x35e1e(%rip), %rax     # 0xeaee2
movq %rax, 0xa0(%rsp)
jmp 0xb50ce
movq 0xb8(%rsp), %r9
movq 0xb0(%rsp), %rcx
movq 0xa8(%rsp), %rdi
movq 0xa0(%rsp), %rax
movl $0x200, %esi            # imm = 0x200
leaq 0x35c31(%rip), %rdx     # 0xead2b
movl $0x2f, %r8d
movq %rax, (%rsp)
movb $0x0, %al
callq 0x5890
leaq 0x140(%rsp), %rdi
leaq 0x34044(%rip), %rsi     # 0xe915e
callq 0x55c0
movq %rax, 0x138(%rsp)
cmpq $0x0, %rax
je 0xb513a
movq 0x138(%rsp), %rdi
callq 0x5c6f0
jmp 0xb513c
cmpq $0x0, 0x138(%rsp)
jne 0xb506b
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 0x5bfb0
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 0xb51d3
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 0xb5203
leaq 0xf8(%rsp), %rdi
callq 0x7abe0
movq %rax, 0x58(%rsp)
jmp 0xb5217
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 0x37ec0(%rip), %rdx     # 0xed107
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 0x33ed2(%rip), %rsi     # 0xe915e
callq 0x55c0
movq %rax, 0x138(%rsp)
cmpq $0x0, 0x138(%rsp)
jne 0xb53dd
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 0x336e2(%rip), %rcx     # 0xe89d2
leaq 0x147ea(%rip), %rax     # 0xc9ae1
testb $0x1, %dl
cmovneq %rcx, %rax
movq %rax, 0x48(%rsp)
callq 0x118f0
movq %rax, 0x50(%rsp)
jmp 0xb530f
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 0x37dd2(%rip), %rsi     # 0xed128
xorl %eax, %eax
callq 0x5c880
jmp 0xb535f
movq 0x28(%rsp), %rdi
leaq 0x4a905(%rip), %rsi     # 0xffc70
leaq -0x588b2(%rip), %rdx    # 0x5cac0
callq 0x5920
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x748(%rsp)
movl %eax, 0x744(%rsp)
jmp 0xb53ae
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 0xb5423
movq 0x28(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x748(%rsp)
movl %eax, 0x744(%rsp)
callq 0x53a0
jmp 0xb5423
cmpq $0x0, 0x138(%rsp)
je 0xb53f5
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