// File: manikandan5[P]Image-Matching-Stitching-Warping/./CImg.h
// Function: cimg_library::CImg<double>::save_exr(char const*) const
const CImg<T>& save_exr(const char *const filename) const {
      if (!filename)
        throw CImgArgumentException(_cimg_instance
                                    "save_exr(): Specified filename is (null).",
                                    cimg_instance);
      if (is_empty()) { cimg::fempty(0,filename); return *this; }
      if (_depth>1)
        cimg::warn(_cimg_instance
                   "save_exr(): Instance is volumetric, only the first slice will be saved in file '%s'.",
                   cimg_instance,
                   filename);

#ifndef cimg_use_openexr
      return save_other(filename);
#else
      Imf::Rgba *const ptrd0 = new Imf::Rgba[(unsigned long)_width*_height], *ptrd = ptrd0, rgba;
      switch (_spectrum) {
      case 1 : { // Grayscale image.
        for (const T *ptr_r = data(), *const ptr_e = ptr_r + (unsigned long)_width*_height; ptr_r<ptr_e;) {
          rgba.r = rgba.g = rgba.b = (half)(*(ptr_r++));
          rgba.a = (half)1;
          *(ptrd++) = rgba;
        }
      } break;
      case 2 : { // RG image.
        for (const T *ptr_r = data(), *ptr_g = data(0,0,0,1),
               *const ptr_e = ptr_r + (unsigned long)_width*_height; ptr_r<ptr_e; ) {
          rgba.r = (half)(*(ptr_r++));
          rgba.g = (half)(*(ptr_g++));
          rgba.b = (half)0;
          rgba.a = (half)1;
          *(ptrd++) = rgba;
        }
      } break;
      case 3 : { // RGB image.
        for (const T *ptr_r = data(), *ptr_g = data(0,0,0,1), *ptr_b = data(0,0,0,2),
               *const ptr_e = ptr_r + (unsigned long)_width*_height; ptr_r<ptr_e;) {
          rgba.r = (half)(*(ptr_r++));
          rgba.g = (half)(*(ptr_g++));
          rgba.b = (half)(*(ptr_b++));
          rgba.a = (half)1;
          *(ptrd++) = rgba;
        }
      } break;
      default : { // RGBA image.
        for (const T *ptr_r = data(), *ptr_g = data(0,0,0,1), *ptr_b = data(0,0,0,2), *ptr_a = data(0,0,0,3),
               *const ptr_e = ptr_r + (unsigned long)_width*_height; ptr_r<ptr_e;) {
          rgba.r = (half)(*(ptr_r++));
          rgba.g = (half)(*(ptr_g++));
          rgba.b = (half)(*(ptr_b++));
          rgba.a = (half)(*(ptr_a++));
          *(ptrd++) = rgba;
        }
      } break;
      }
      Imf::RgbaOutputFile outFile(filename,_width,_height,
                                  _spectrum==1?Imf::WRITE_Y:_spectrum==2?Imf::WRITE_YA:_spectrum==3?
                                  Imf::WRITE_RGB:Imf::WRITE_RGBA);
      outFile.setFrameBuffer(ptrd0,1,_width);
      outFile.writePixels(_height);
      delete[] ptrd0;
      return *this;
#endif
    }

// Assembly:
subq $0x98, %rsp
movq %rdi, 0x88(%rsp)
movq %rsi, 0x80(%rsp)
movq 0x88(%rsp), %rax
movq %rax, 0x68(%rsp)
cmpq $0x0, 0x80(%rsp)
jne 0x99a70
movl $0x4008, %edi           # imm = 0x4008
callq 0x5240
movq %rax, %rcx
movq 0x68(%rsp), %rax
movq %rcx, 0x38(%rsp)
movl (%rax), %ecx
movl %ecx, 0x40(%rsp)
movl 0x4(%rax), %ecx
movl %ecx, 0x44(%rsp)
movl 0x8(%rax), %ecx
movl %ecx, 0x48(%rsp)
movl 0xc(%rax), %ecx
movl %ecx, 0x4c(%rsp)
movq 0x18(%rax), %rcx
movq %rcx, 0x50(%rsp)
movb 0x10(%rax), %dl
leaq 0x4effa(%rip), %rcx     # 0xe89d2
leaq 0x30102(%rip), %rax     # 0xc9ae1
testb $0x1, %dl
cmovneq %rcx, %rax
movq %rax, 0x58(%rsp)
callq 0x118f0
movq %rax, 0x60(%rsp)
jmp 0x999f7
movl 0x4c(%rsp), %r9d
movl 0x48(%rsp), %r8d
movl 0x44(%rsp), %ecx
movl 0x40(%rsp), %edx
movq 0x38(%rsp), %rdi
movq 0x50(%rsp), %rsi
movq 0x58(%rsp), %r10
movq 0x60(%rsp), %r11
movq %rsp, %rax
movq %r11, 0x10(%rax)
movq %r10, 0x8(%rax)
movq %rsi, (%rax)
leaq 0x52945(%rip), %rsi     # 0xec377
xorl %eax, %eax
callq 0x12220
jmp 0x99a3b
movq 0x38(%rsp), %rdi
leaq 0x66119(%rip), %rsi     # 0xffb60
leaq -0x875ee(%rip), %rdx    # 0x12460
callq 0x5920
movq 0x38(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x78(%rsp)
movl %eax, 0x74(%rsp)
callq 0x53a0
jmp 0x99b6e
movq 0x68(%rsp), %rdi
callq 0x10320
testb $0x1, %al
jne 0x99a80
jmp 0x99aa3
movq 0x80(%rsp), %rsi
xorl %eax, %eax
movl %eax, %edi
callq 0x9c310
movq 0x68(%rsp), %rax
movq %rax, 0x90(%rsp)
jmp 0x99b5e
movq 0x68(%rsp), %rax
cmpl $0x1, 0x8(%rax)
jbe 0x99b3f
movq 0x68(%rsp), %rax
movl (%rax), %ecx
movl %ecx, 0x18(%rsp)
movl 0x4(%rax), %ecx
movl %ecx, 0x1c(%rsp)
movl 0x8(%rax), %ecx
movl %ecx, 0x20(%rsp)
movl 0xc(%rax), %ecx
movl %ecx, 0x24(%rsp)
movq 0x18(%rax), %rcx
movq %rcx, 0x28(%rsp)
movb 0x10(%rax), %dl
leaq 0x2fffc(%rip), %rax     # 0xc9ae1
leaq 0x4eee6(%rip), %rcx     # 0xe89d2
testb $0x1, %dl
cmovneq %rcx, %rax
movq %rax, 0x30(%rsp)
callq 0x118f0
movl 0x18(%rsp), %esi
movl 0x1c(%rsp), %edx
movl 0x20(%rsp), %ecx
movl 0x24(%rsp), %r8d
movq 0x28(%rsp), %r9
movq 0x30(%rsp), %r11
movq %rax, %r10
movq 0x80(%rsp), %rax
leaq 0x528a5(%rip), %rdi     # 0xec3cf
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
movb $0x0, %al
callq 0x117e0
movq 0x68(%rsp), %rdi
movq 0x80(%rsp), %rsi
movl $0x64, %edx
callq 0x9b6b0
movq %rax, 0x90(%rsp)
movq 0x90(%rsp), %rax
addq $0x98, %rsp
retq
movq 0x78(%rsp), %rdi
callq 0x5970
nopl (%rax,%rax)