// File: /workspace/github_cpp_makefile_star2_O1/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 0x60c4c
movq %rdx, %r12
movq %rsi, %rbp
movq 0x18(%r14), %r9
testq %r9, %r9
je 0x60ad1
movdqu (%r14), %xmm0
pxor %xmm1, %xmm1
pcmpeqd %xmm0, %xmm1
movmskps %xmm1, %eax
testb %al, %al
jne 0x60ad1
movl 0xc(%r14), %r8d
cmpl $0x4, %r8d
je 0x60a13
leaq 0x1297b(%rip), %rax     # 0x73338
cmpb $0x0, 0x10(%r14)
leaq 0x13d49(%rip), %r10     # 0x74712
cmovneq %rax, %r10
testq %r12, %r12
leaq 0x3370a(%rip), %r11     # 0x940e1
cmovneq %r12, %r11
movd %xmm0, %esi
pshufd $0x55, %xmm0, %xmm1     # xmm1 = xmm0[1,1,1,1]
movd %xmm1, %edx
pshufd $0xee, %xmm0, %xmm0     # xmm0 = xmm0[2,3,2,3]
movd %xmm0, %ecx
subq $0x8, %rsp
leaq 0x331f3(%rip), %rbx     # 0x93bef
leaq 0x35f89(%rip), %rdi     # 0x9698c
xorl %eax, %eax
pushq %r11
pushq %rbx
pushq %r10
callq 0xbb52
addq $0x20, %rsp
movq %rbp, %r15
testq %rbp, %rbp
jne 0x60a2d
leaq 0x3310b(%rip), %rsi     # 0x93b2d
movq %r12, %rdi
callq 0x3ceb3
movq %rax, %r15
movl (%r14), %eax
movl 0x4(%r14), %r13d
imulq %rax, %r13
leaq (,%r13,4), %rbx
movq %rbx, %rdi
callq 0x4040
movq 0x18(%r14), %rcx
movl 0x8(%r14), %esi
movl 0xc(%r14), %edi
imulq %r13, %rsi
xorl %r8d, %r8d
cmpl $0x2, %edi
leaq (%rcx,%rsi,8), %rdx
cmovbq %r8, %rdx
movq %rax, %r12
movq %rsi, %rax
shlq $0x4, %rax
addq %rcx, %rax
cmpl $0x3, %edi
cmovbq %r8, %rax
cmpl $0x1, %edi
movq %rbp, 0x10(%rsp)
je 0x60b11
cmpl $0x2, %edi
je 0x60ae1
cmpl $0x3, %edi
jne 0x60b3b
testq %r13, %r13
je 0x60b85
xorl %esi, %esi
cvttsd2si (%rcx,%rsi,8), %edi
movb %dil, (%r12,%rsi,4)
cvttsd2si (%rdx,%rsi,8), %edi
movb %dil, 0x1(%r12,%rsi,4)
cvttsd2si (%rax,%rsi,8), %edi
movb %dil, 0x2(%r12,%rsi,4)
movb $-0x1, 0x3(%r12,%rsi,4)
incq %rsi
cmpq %rsi, %r13
jne 0x60aa1
jmp 0x60b85
movq %rbp, %rdi
movq %r12, %rsi
callq 0x5f9f0
jmp 0x60c04
testq %r13, %r13
je 0x60b85
xorl %eax, %eax
cvttsd2si (%rcx,%rax,8), %esi
movb %sil, (%r12,%rax,4)
cvttsd2si (%rdx,%rax,8), %esi
movb %sil, 0x1(%r12,%rax,4)
movw $0xff00, 0x2(%r12,%rax,4) # imm = 0xFF00
incq %rax
cmpq %rax, %r13
jne 0x60aec
jmp 0x60b85
testq %r13, %r13
je 0x60b85
xorl %eax, %eax
cvttsd2si (%rcx,%rax,8), %edx
movb %dl, (%r12,%rax,4)
movb %dl, 0x1(%r12,%rax,4)
movb %dl, 0x2(%r12,%rax,4)
movb $-0x1, 0x3(%r12,%rax,4)
incq %rax
cmpq %rax, %r13
jne 0x60b18
jmp 0x60b85
testq %r13, %r13
je 0x60b85
xorl %r8d, %r8d
cmpl $0x4, %edi
leaq (%rsi,%rsi,2), %rsi
leaq (%rcx,%rsi,8), %rsi
cmovbq %r8, %rsi
cvttsd2si (%rcx,%r8,8), %edi
movb %dil, (%r12,%r8,4)
cvttsd2si (%rdx,%r8,8), %edi
movb %dil, 0x1(%r12,%r8,4)
cvttsd2si (%rax,%r8,8), %edi
movb %dil, 0x2(%r12,%r8,4)
cvttsd2si (%rsi,%r8,8), %edi
movb %dil, 0x3(%r12,%r8,4)
incq %r8
cmpq %r8, %r13
jne 0x60b52
testq %r15, %r15
je 0x60ca8
testq %rbx, %rbx
je 0x60bf4
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 (%r12,%rbp), %rdi
movl $0x1, %esi
movq %r13, %rdx
movq %r15, %rcx
callq 0x4a70
addq %rax, %rbp
subq %rax, %rbx
cmpq %rax, %r13
jne 0x60bd5
testq %rbx, %rbx
jne 0x60ba4
testq %rbx, %rbx
movq 0x8(%rsp), %r14
movq (%rsp), %rdx
je 0x60bf4
leaq 0x35aeb(%rip), %rdi     # 0x966d5
movq %rbp, %rsi
xorl %eax, %eax
callq 0xbb52
cmpq $0x0, 0x10(%rsp)
je 0x60c16
movq %r12, %rdi
callq 0x4680
movq %r14, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x4c38b(%rip), %rax     # 0xacfa8
cmpq %r15, (%rax)
je 0x60bfc
movq 0x4c35f(%rip), %rax     # 0xacf88
cmpq %r15, (%rax)
je 0x60bfc
movq %r15, %rdi
callq 0x4540
testl %eax, %eax
je 0x60bfc
leaq 0x32e8b(%rip), %rdi     # 0x93acc
movl %eax, %esi
xorl %eax, %eax
callq 0xbb52
jmp 0x60bfc
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 0x126c8(%rip), %rax     # 0x73338
leaq 0x13a9b(%rip), %r10     # 0x74712
cmpb $0x0, 0x10(%rbx)
cmovneq %rax, %r10
subq $0x8, %rsp
leaq 0x32f65(%rip), %r11     # 0x93bef
leaq 0x35ca2(%rip), %rsi     # 0x96933
movq %r14, %rdi
xorl %eax, %eax
pushq %r11
pushq %r10
pushq 0x18(%rbx)
callq 0xc196
addq $0x20, %rsp
jmp 0x60cf2
movl $0x4008, %edi           # imm = 0x4008
callq 0x4210
movq %rax, %r14
testq %rbx, %rbx
leaq 0x12679(%rip), %rax     # 0x73338
leaq 0x3473c(%rip), %r8      # 0x95402
cmoveq %rax, %r8
subq $0x8, %rsp
leaq 0x359b2(%rip), %rsi     # 0x96687
leaq 0x1e5fb(%rip), %rcx     # 0x7f2d7
movq %r14, %rdi
movq %rbx, %rdx
movq %r12, %r9
xorl %eax, %eax
pushq %r15
callq 0xc196
addq $0x10, %rsp
leaq 0x4bf27(%rip), %rsi     # 0xacc20
movq 0x4c2d0(%rip), %rdx     # 0xacfd0
movq %r14, %rdi
callq 0x4900
jmp 0x60d0a
movq %rax, %rbx
movq %r14, %rdi
callq 0x43b0
movq %rbx, %rdi
callq 0x4950
nop