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

#ifdef cimg_use_magick
      double stmin, stmax = (double)max_min(stmin);
      if (_depth>1)
        cimg::warn(_cimg_instance
                   "save_magick(): Instance is volumetric, only the first slice will be saved in file '%s'.",
                   cimg_instance,
                   filename);

      if (_spectrum>3)
        cimg::warn(_cimg_instance
                   "save_magick(): Instance is multispectral, only the three first channels will be "
                   "saved in file '%s'.",
                   cimg_instance,
                   filename);

      if (stmin<0 || (bytes_per_pixel==1 && stmax>=256) || stmax>=65536)
        cimg::warn(_cimg_instance
                   "save_magick(): Instance has pixel values in [%g,%g], probable type overflow in file '%s'.",
                   cimg_instance,
                   filename,stmin,stmax);

      Magick::Image image(Magick::Geometry(_width,_height),"black");
      image.type(Magick::TrueColorType);
      image.depth(bytes_per_pixel?(8*bytes_per_pixel):(stmax>=256?16:8));
      const T
        *ptr_r = data(0,0,0,0),
        *ptr_g = _spectrum>1?data(0,0,0,1):0,
        *ptr_b = _spectrum>2?data(0,0,0,2):0;
      Magick::PixelPacket *pixels = image.getPixels(0,0,_width,_height);
      switch (_spectrum) {
      case 1 : // Scalar images
        for (unsigned long off = (unsigned long)_width*_height; off; --off) {
          pixels->red = pixels->green = pixels->blue = (Magick::Quantum)*(ptr_r++);
          ++pixels;
        }
        break;
      case 2 : // RG images
        for (unsigned long off = (unsigned long)_width*_height; off; --off) {
          pixels->red = (Magick::Quantum)*(ptr_r++);
          pixels->green = (Magick::Quantum)*(ptr_g++);
          pixels->blue = 0; ++pixels;
        }
        break;
      default : // RGB images
        for (unsigned long off = (unsigned long)_width*_height; off; --off) {
          pixels->red = (Magick::Quantum)*(ptr_r++);
          pixels->green = (Magick::Quantum)*(ptr_g++);
          pixels->blue = (Magick::Quantum)*(ptr_b++);
          ++pixels;
        }
      }
      image.syncPixels();
      image.write(filename);
      return *this;
#else
      cimg::unused(bytes_per_pixel);
      throw CImgIOException(_cimg_instance
                            "save_magick(): Unable to save file '%s' unless libMagick++ is enabled.",
                            cimg_instance,
                            filename);
#endif
    }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %r14
testq %rsi, %rsi
je 0x4b7db
movq %rsi, %r15
movq %r14, %rdi
callq 0x8dc8
testb %al, %al
je 0x4b83f
xorl %edi, %edi
movq %r15, %rsi
callq 0x465c3
movq %r14, %rax
popq %rbx
popq %r14
popq %r15
retq
movl $0x4008, %edi           # imm = 0x4008
callq 0x4210
movq %rax, %rbx
movl (%r14), %edx
movl 0x4(%r14), %ecx
movl 0x8(%r14), %r8d
movl 0xc(%r14), %r9d
leaq 0x8fea(%rip), %rax      # 0x547e8
leaq 0xa3bd(%rip), %r10      # 0x55bc2
cmpb $0x0, 0x10(%r14)
cmovneq %rax, %r10
subq $0x8, %rsp
leaq 0x29886(%rip), %r11     # 0x7509f
leaq 0x2d720(%rip), %rsi     # 0x78f40
movq %rbx, %rdi
xorl %eax, %eax
pushq %r11
pushq %r10
pushq 0x18(%r14)
callq 0x9d52
addq $0x20, %rsp
leaq 0x44423(%rip), %rsi     # 0x8fc60
jmp 0x4b89f
movl $0x4008, %edi           # imm = 0x4008
callq 0x4210
movq %rax, %rbx
movl (%r14), %edx
movl 0x4(%r14), %ecx
movl 0x8(%r14), %r8d
movl 0xc(%r14), %r9d
leaq 0x8f86(%rip), %rax      # 0x547e8
leaq 0xa359(%rip), %r10      # 0x55bc2
cmpb $0x0, 0x10(%r14)
cmovneq %rax, %r10
leaq 0x29826(%rip), %r11     # 0x7509f
leaq 0x2d71b(%rip), %rsi     # 0x78f9b
movq %rbx, %rdi
xorl %eax, %eax
pushq %r15
pushq %r11
pushq %r10
pushq 0x18(%r14)
callq 0x2a3de
addq $0x20, %rsp
leaq 0x44461(%rip), %rsi     # 0x8fd00
movq 0x44732(%rip), %rdx     # 0x8ffd8
movq %rbx, %rdi
callq 0x4910
jmp 0x4b8b0
movq %rax, %r14
movq %rbx, %rdi
callq 0x4390
movq %r14, %rdi
callq 0x4950
nop