// File: /workspace/github_cpp_makefile_star2_O3/manikandan5[P]Image-Matching-Stitching-Warping/./CImg.h
// Function: cimg_library::CImg<double>::_save_rgba(_IO_FILE*, char const*) const
const CImg<T>& _save_rgba(std::FILE *const file, const char *const filename) const {
      if (!file && !filename)
        throw CImgArgumentException(_cimg_instance
                                    "save_rgba(): Specified filename is (null).",
                                    cimg_instance);
      if (is_empty()) { cimg::fempty(file,filename); return *this; }
      if (_spectrum!=4)
        cimg::warn(_cimg_instance
                   "save_rgba(): image instance has not exactly 4 channels, for file '%s'.",
                   cimg_instance,
                   filename?filename:"(FILE*)");

      std::FILE *const nfile = file?file:cimg::fopen(filename,"wb");
      const unsigned long wh = (unsigned long)_width*_height;
      unsigned char *const buffer = new unsigned char[4*wh], *nbuffer = buffer;
      const T
        *ptr1 = data(0,0,0,0),
        *ptr2 = _spectrum>1?data(0,0,0,1):0,
        *ptr3 = _spectrum>2?data(0,0,0,2):0,
        *ptr4 = _spectrum>3?data(0,0,0,3):0;
      switch (_spectrum) {
      case 1 : { // Scalar images
        for (unsigned long k = 0; k<wh; ++k) {
          const unsigned char val = (unsigned char)*(ptr1++);
          *(nbuffer++) = val;
          *(nbuffer++) = val;
          *(nbuffer++) = val;
          *(nbuffer++) = 255;
        }
      } break;
      case 2 : { // RG images
        for (unsigned long k = 0; k<wh; ++k) {
          *(nbuffer++) = (unsigned char)(*(ptr1++));
          *(nbuffer++) = (unsigned char)(*(ptr2++));
          *(nbuffer++) = 0;
          *(nbuffer++) = 255;
        }
      } break;
      case 3 : { // RGB images
        for (unsigned long k = 0; k<wh; ++k) {
          *(nbuffer++) = (unsigned char)(*(ptr1++));
          *(nbuffer++) = (unsigned char)(*(ptr2++));
          *(nbuffer++) = (unsigned char)(*(ptr3++));
          *(nbuffer++) = 255;
        }
      } break;
      default : { // RGBA images
        for (unsigned long k = 0; k<wh; ++k) {
          *(nbuffer++) = (unsigned char)(*(ptr1++));
          *(nbuffer++) = (unsigned char)(*(ptr2++));
          *(nbuffer++) = (unsigned char)(*(ptr3++));
          *(nbuffer++) = (unsigned char)(*(ptr4++));
        }
      }
      }
      cimg::fwrite(buffer,4*wh,nfile);
      if (!file) cimg::fclose(nfile);
      delete[] buffer;
      return *this;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r14
movq %rsi, %rax
orq %rdx, %rax
je 0x5e085
movq %rdx, %r15
movq %rsi, %rbp
movq 0x18(%r14), %r9
testq %r9, %r9
sete %al
movl (%r14), %esi
movl 0x4(%r14), %edx
testl %esi, %esi
sete %dil
orb %al, %dil
testl %edx, %edx
sete %al
movl 0x8(%r14), %ecx
testl %ecx, %ecx
sete %r10b
orb %al, %r10b
orb %dil, %r10b
movl 0xc(%r14), %r8d
testl %r8d, %r8d
sete %al
orb %r10b, %al
cmpb $0x1, %al
jne 0x5de15
movq %rbp, %rdi
movq %r15, %rsi
callq 0x5ce0e
jmp 0x5e03d
cmpl $0x4, %r8d
je 0x5de62
leaq 0x10a46(%rip), %rax     # 0x6e868
leaq 0x11e19(%rip), %r10     # 0x6fc42
cmpb $0x0, 0x10(%r14)
cmovneq %rax, %r10
testq %r15, %r15
leaq 0x317d5(%rip), %r11     # 0x8f611
cmovneq %r15, %r11
subq $0x8, %rsp
leaq 0x312d4(%rip), %rbx     # 0x8f11f
leaq 0x3406a(%rip), %rdi     # 0x91ebc
xorl %eax, %eax
pushq %r11
pushq %rbx
pushq %r10
callq 0xbb10
addq $0x20, %rsp
movq %rbp, %r12
testq %rbp, %rbp
jne 0x5de7c
leaq 0x311ec(%rip), %rsi     # 0x8f05d
movq %r15, %rdi
callq 0x3b111
movq %rax, %r12
movl (%r14), %eax
movl 0x4(%r14), %r13d
imulq %rax, %r13
leaq (,%r13,4), %rbx
movq %rbx, %rdi
callq 0x4040
movq %rax, %r15
movq 0x18(%r14), %rax
movl 0xc(%r14), %edi
cmpl $0x2, %edi
movq %rbp, 0x10(%rsp)
jb 0x5def4
movl 0x8(%r14), %esi
imulq %r13, %rsi
leaq (%rax,%rsi,8), %rcx
cmpl $0x2, %edi
jne 0x5df70
testq %r13, %r13
je 0x5dfbe
xorl %edx, %edx
cvttsd2si (%rax,%rdx,8), %esi
movb %sil, (%r15,%rdx,4)
cvttsd2si (%rcx,%rdx,8), %esi
movb %sil, 0x1(%r15,%rdx,4)
movw $0xff00, 0x2(%r15,%rdx,4) # imm = 0xFF00
incq %rdx
cmpq %rdx, %r13
jne 0x5decc
jmp 0x5dfbe
xorl %edx, %edx
xorl %ecx, %ecx
xorl %esi, %esi
cmpl $0x1, %edi
jne 0x5df30
testq %r13, %r13
je 0x5dfbe
xorl %ecx, %ecx
cvttsd2si (%rax,%rcx,8), %edx
movb %dl, (%r15,%rcx,4)
movb %dl, 0x1(%r15,%rcx,4)
movb %dl, 0x2(%r15,%rcx,4)
movb $-0x1, 0x3(%r15,%rcx,4)
incq %rcx
cmpq %rcx, %r13
jne 0x5df0a
jmp 0x5dfbe
testq %r13, %r13
je 0x5dfbe
xorl %edi, %edi
cvttsd2si (%rax,%rdi,8), %r8d
movb %r8b, (%r15,%rdi,4)
cvttsd2si (%rcx,%rdi,8), %r8d
movb %r8b, 0x1(%r15,%rdi,4)
cvttsd2si (%rdx,%rdi,8), %r8d
movb %r8b, 0x2(%r15,%rdi,4)
cvttsd2si (%rsi,%rdi,8), %r8d
movb %r8b, 0x3(%r15,%rdi,4)
incq %rdi
cmpq %rdi, %r13
jne 0x5df3b
jmp 0x5dfbe
movq %rsi, %rdx
shlq $0x4, %rdx
addq %rax, %rdx
cmpl $0x4, %edi
jb 0x5df8c
leaq (%rsi,%rsi,2), %rsi
leaq (%rax,%rsi,8), %rsi
jmp 0x5defa
testq %r13, %r13
je 0x5dfbe
xorl %esi, %esi
cvttsd2si (%rax,%rsi,8), %edi
movb %dil, (%r15,%rsi,4)
cvttsd2si (%rcx,%rsi,8), %edi
movb %dil, 0x1(%r15,%rsi,4)
cvttsd2si (%rdx,%rsi,8), %edi
movb %dil, 0x2(%r15,%rsi,4)
movb $-0x1, 0x3(%r15,%rsi,4)
incq %rsi
cmpq %rsi, %r13
jne 0x5df93
testq %r12, %r12
je 0x5e0e1
testq %rbx, %rbx
je 0x5e02d
movq %r14, 0x8(%rsp)
xorl %ebp, %ebp
movl $0x3f00000, %r14d       # imm = 0x3F00000
movq %rbx, (%rsp)
cmpq %r14, %rbx
movl $0x3f00000, %r13d       # imm = 0x3F00000
cmovbq %rbx, %r13
leaq (%r15,%rbp), %rdi
movl $0x1, %esi
movq %r13, %rdx
movq %r12, %rcx
callq 0x4a80
addq %rax, %rbp
subq %rax, %rbx
cmpq %rax, %r13
jne 0x5e00e
testq %rbx, %rbx
jne 0x5dfdd
testq %rbx, %rbx
movq 0x8(%rsp), %r14
movq (%rsp), %rdx
je 0x5e02d
leaq 0x33be2(%rip), %rdi     # 0x91c05
movq %rbp, %rsi
xorl %eax, %eax
callq 0xbb10
cmpq $0x0, 0x10(%rsp)
je 0x5e04f
movq %r15, %rdi
callq 0x4690
movq %r14, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x49f52(%rip), %rax     # 0xa7fa8
cmpq %r12, (%rax)
je 0x5e035
movq 0x49f26(%rip), %rax     # 0xa7f88
cmpq %r12, (%rax)
je 0x5e035
movq %r12, %rdi
callq 0x4550
testl %eax, %eax
je 0x5e035
leaq 0x30f82(%rip), %rdi     # 0x8effc
movl %eax, %esi
xorl %eax, %eax
callq 0xbb10
jmp 0x5e035
movl $0x4008, %edi           # imm = 0x4008
callq 0x4210
movq %r14, %rbx
movq %rax, %r14
movl (%rbx), %edx
movl 0x4(%rbx), %ecx
movl 0x8(%rbx), %r8d
movl 0xc(%rbx), %r9d
leaq 0x107bf(%rip), %rax     # 0x6e868
leaq 0x11b92(%rip), %r10     # 0x6fc42
cmpb $0x0, 0x10(%rbx)
cmovneq %rax, %r10
subq $0x8, %rsp
leaq 0x3105c(%rip), %r11     # 0x8f11f
leaq 0x33d99(%rip), %rsi     # 0x91e63
movq %r14, %rdi
xorl %eax, %eax
pushq %r11
pushq %r10
pushq 0x18(%rbx)
callq 0xc16a
addq $0x20, %rsp
jmp 0x5e12b
movl $0x4008, %edi           # imm = 0x4008
callq 0x4210
movq %rax, %r14
testq %rbx, %rbx
leaq 0x10770(%rip), %rax     # 0x6e868
leaq 0x32833(%rip), %r8      # 0x90932
cmoveq %rax, %r8
subq $0x8, %rsp
leaq 0x33aa9(%rip), %rsi     # 0x91bb7
leaq 0x1c6f2(%rip), %rcx     # 0x7a807
movq %r14, %rdi
movq %rbx, %rdx
movq %r15, %r9
xorl %eax, %eax
pushq $0x0
callq 0xc16a
addq $0x10, %rsp
leaq 0x49b1e(%rip), %rsi     # 0xa7c50
movq 0x49e97(%rip), %rdx     # 0xa7fd0
movq %r14, %rdi
callq 0x4910
jmp 0x5e143
movq %rax, %rbx
movq %r14, %rdi
callq 0x43c0
movq %rbx, %rdi
callq 0x4960