// File: /workspace/github_cpp_makefile_star2_O1/manikandan5[P]Image-Matching-Stitching-Warping/./CImg.h
// Function: cimg_library::CImg<double>::_save_rgb(_IO_FILE*, char const*) const
const CImg<T>& _save_rgb(std::FILE *const file, const char *const filename) const {
      if (!file && !filename)
        throw CImgArgumentException(_cimg_instance
                                    "save_rgb(): Specified filename is (null).",
                                    cimg_instance);
      if (is_empty()) { cimg::fempty(file,filename); return *this; }
      if (_spectrum!=3)
        cimg::warn(_cimg_instance
                   "save_rgb(): image instance has not exactly 3 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[3*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;
      switch (_spectrum) {
      case 1 : { // Scalar image
        for (unsigned long k = 0; k<wh; ++k) {
          const unsigned char val = (unsigned char)*(ptr1++);
          *(nbuffer++) = val;
          *(nbuffer++) = val;
          *(nbuffer++) = val;
        }
      } break;
      case 2 : { // RG image
        for (unsigned long k = 0; k<wh; ++k) {
          *(nbuffer++) = (unsigned char)(*(ptr1++));
          *(nbuffer++) = (unsigned char)(*(ptr2++));
          *(nbuffer++) = 0;
        }
      } break;
      default : { // RGB image
        for (unsigned long k = 0; k<wh; ++k) {
          *(nbuffer++) = (unsigned char)(*(ptr1++));
          *(nbuffer++) = (unsigned char)(*(ptr2++));
          *(nbuffer++) = (unsigned char)(*(ptr3++));
        }
      }
      }
      cimg::fwrite(buffer,3*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 0x60891
movq %rdx, %r12
movq %rsi, %r13
movq 0x18(%r14), %r9
testq %r9, %r9
je 0x60751
movdqu (%r14), %xmm0
pxor %xmm1, %xmm1
pcmpeqd %xmm0, %xmm1
movmskps %xmm1, %eax
testb %al, %al
jne 0x60751
movl 0xc(%r14), %r8d
cmpl $0x3, %r8d
je 0x606b9
leaq 0x12cd5(%rip), %rax     # 0x73338
cmpb $0x0, 0x10(%r14)
leaq 0x140a3(%rip), %r10     # 0x74712
cmovneq %rax, %r10
testq %r12, %r12
leaq 0x33a64(%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 0x3354d(%rip), %rbx     # 0x93bef
leaq 0x36216(%rip), %rdi     # 0x968bf
xorl %eax, %eax
pushq %r11
pushq %rbx
pushq %r10
callq 0xbb52
addq $0x20, %rsp
movq %r13, %r15
movq %r13, 0x10(%rsp)
testq %r13, %r13
jne 0x606d8
leaq 0x33460(%rip), %rsi     # 0x93b2d
movq %r12, %rdi
callq 0x3ceb3
movq %rax, %r15
movl (%r14), %eax
movl 0x4(%r14), %r13d
imulq %rax, %r13
leaq (,%r13,2), %rbx
addq %r13, %rbx
movq %rbx, %rdi
callq 0x4040
movq %rax, %r12
movq 0x18(%r14), %rax
movl 0x8(%r14), %edx
movl 0xc(%r14), %edi
imulq %r13, %rdx
xorl %ecx, %ecx
cmpl $0x2, %edi
leaq (%rax,%rdx,8), %rsi
cmovaeq %rsi, %rcx
cmpl $0x1, %edi
je 0x60761
cmpl $0x2, %edi
jne 0x60789
testq %r13, %r13
je 0x607ca
xorl %edx, %edx
movq %r12, %rsi
cvttsd2si (%rax,%rdx,8), %edi
movb %dil, (%rsi)
cvttsd2si (%rcx,%rdx,8), %edi
movb %dil, 0x1(%rsi)
movb $0x0, 0x2(%rsi)
addq $0x3, %rsi
incq %rdx
cmpq %rdx, %r13
jne 0x6072e
jmp 0x607ca
movq %r13, %rdi
movq %r12, %rsi
callq 0x5f9f0
jmp 0x60849
testq %r13, %r13
je 0x607ca
xorl %ecx, %ecx
movq %r12, %rdx
cvttsd2si (%rax,%rcx,8), %esi
movb %sil, (%rdx)
movb %sil, 0x1(%rdx)
movb %sil, 0x2(%rdx)
addq $0x3, %rdx
incq %rcx
cmpq %rcx, %r13
jne 0x6076b
jmp 0x607ca
testq %r13, %r13
je 0x607ca
shlq $0x4, %rdx
addq %rax, %rdx
xorl %esi, %esi
cmpl $0x3, %edi
cmovbq %rsi, %rdx
movq %r12, %rdi
cvttsd2si (%rax,%rsi,8), %r8d
movb %r8b, (%rdi)
cvttsd2si (%rcx,%rsi,8), %r8d
movb %r8b, 0x1(%rdi)
cvttsd2si (%rdx,%rsi,8), %r8d
movb %r8b, 0x2(%rdi)
addq $0x3, %rdi
incq %rsi
cmpq %rsi, %r13
jne 0x607a1
testq %r15, %r15
je 0x608ed
testq %r13, %r13
je 0x60839
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 0x6081a
testq %rbx, %rbx
jne 0x607e9
testq %rbx, %rbx
movq 0x8(%rsp), %r14
movq (%rsp), %rdx
je 0x60839
leaq 0x35ea6(%rip), %rdi     # 0x966d5
movq %rbp, %rsi
xorl %eax, %eax
callq 0xbb52
cmpq $0x0, 0x10(%rsp)
je 0x6085b
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 0x4c746(%rip), %rax     # 0xacfa8
cmpq %r15, (%rax)
je 0x60841
movq 0x4c71a(%rip), %rax     # 0xacf88
cmpq %r15, (%rax)
je 0x60841
movq %r15, %rdi
callq 0x4540
testl %eax, %eax
je 0x60841
leaq 0x33246(%rip), %rdi     # 0x93acc
movl %eax, %esi
xorl %eax, %eax
callq 0xbb52
jmp 0x60841
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 0x12a83(%rip), %rax     # 0x73338
leaq 0x13e56(%rip), %r10     # 0x74712
cmpb $0x0, 0x10(%rbx)
cmovneq %rax, %r10
subq $0x8, %rsp
leaq 0x33320(%rip), %r11     # 0x93bef
leaq 0x35f91(%rip), %rsi     # 0x96867
movq %r14, %rdi
xorl %eax, %eax
pushq %r11
pushq %r10
pushq 0x18(%rbx)
callq 0xc196
addq $0x20, %rsp
jmp 0x60938
movl $0x4008, %edi           # imm = 0x4008
callq 0x4210
movq %rax, %r14
cmpq $0x2, %rbx
leaq 0x34afd(%rip), %rax     # 0x95402
leaq 0x12a2c(%rip), %r8      # 0x73338
cmovaeq %rax, %r8
subq $0x8, %rsp
leaq 0x35d6c(%rip), %rsi     # 0x96687
leaq 0x1e9b5(%rip), %rcx     # 0x7f2d7
movq %r14, %rdi
movq %rbx, %rdx
movq %r12, %r9
xorl %eax, %eax
pushq %r15
callq 0xc196
addq $0x10, %rsp
leaq 0x4c2e1(%rip), %rsi     # 0xacc20
movq 0x4c68a(%rip), %rdx     # 0xacfd0
movq %r14, %rdi
callq 0x4900
jmp 0x60950
movq %rax, %rbx
movq %r14, %rdi
callq 0x43b0
movq %rbx, %rdi
callq 0x4950
nop