// File: /workspace/github_cpp_makefile_star2_O3/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 0x5dccf
movq %rdx, %r15
movq %rsi, %r13
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 0x5dabf
movq %r13, %rdi
movq %r15, %rsi
callq 0x5ce0e
jmp 0x5dc87
cmpl $0x3, %r8d
je 0x5db0c
leaq 0x10d9c(%rip), %rax     # 0x6e868
leaq 0x1216f(%rip), %r10     # 0x6fc42
cmpb $0x0, 0x10(%r14)
cmovneq %rax, %r10
testq %r15, %r15
leaq 0x31b2b(%rip), %r11     # 0x8f611
cmovneq %r15, %r11
subq $0x8, %rsp
leaq 0x3162a(%rip), %rbx     # 0x8f11f
leaq 0x342f3(%rip), %rdi     # 0x91def
xorl %eax, %eax
pushq %r11
pushq %rbx
pushq %r10
callq 0xbb10
addq $0x20, %rsp
movq %r13, %r12
movq %r13, 0x10(%rsp)
testq %r13, %r13
jne 0x5db2b
leaq 0x3153d(%rip), %rsi     # 0x8f05d
movq %r15, %rdi
callq 0x3b111
movq %rax, %r12
movl (%r14), %eax
movl 0x4(%r14), %r13d
imulq %rax, %r13
leaq (,%r13,2), %rbx
addq %r13, %rbx
movq %rbx, %rdi
callq 0x4040
movq %rax, %r15
movq 0x18(%r14), %rax
movl 0xc(%r14), %esi
cmpl $0x2, %esi
jb 0x5db9b
movl 0x8(%r14), %edx
imulq %r13, %rdx
leaq (%rax,%rdx,8), %rcx
cmpl $0x2, %esi
jne 0x5dba1
testq %r13, %r13
je 0x5dc08
xorl %edx, %edx
movq %r15, %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 0x5db78
jmp 0x5dc08
xorl %ecx, %ecx
xorl %edx, %edx
jmp 0x5dba8
shlq $0x4, %rdx
addq %rax, %rdx
cmpl $0x1, %esi
jne 0x5dbd5
testq %r13, %r13
je 0x5dc08
xorl %ecx, %ecx
movq %r15, %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 0x5dbb7
jmp 0x5dc08
testq %r13, %r13
je 0x5dc08
xorl %esi, %esi
movq %r15, %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 0x5dbdf
testq %r12, %r12
je 0x5dd2b
testq %r13, %r13
je 0x5dc77
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 0x5dc58
testq %rbx, %rbx
jne 0x5dc27
testq %rbx, %rbx
movq 0x8(%rsp), %r14
movq (%rsp), %rdx
je 0x5dc77
leaq 0x33f98(%rip), %rdi     # 0x91c05
movq %rbp, %rsi
xorl %eax, %eax
callq 0xbb10
cmpq $0x0, 0x10(%rsp)
je 0x5dc99
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 0x4a308(%rip), %rax     # 0xa7fa8
cmpq %r12, (%rax)
je 0x5dc7f
movq 0x4a2dc(%rip), %rax     # 0xa7f88
cmpq %r12, (%rax)
je 0x5dc7f
movq %r12, %rdi
callq 0x4550
testl %eax, %eax
je 0x5dc7f
leaq 0x31338(%rip), %rdi     # 0x8effc
movl %eax, %esi
xorl %eax, %eax
callq 0xbb10
jmp 0x5dc7f
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 0x10b75(%rip), %rax     # 0x6e868
leaq 0x11f48(%rip), %r10     # 0x6fc42
cmpb $0x0, 0x10(%rbx)
cmovneq %rax, %r10
subq $0x8, %rsp
leaq 0x31412(%rip), %r11     # 0x8f11f
leaq 0x34083(%rip), %rsi     # 0x91d97
movq %r14, %rdi
xorl %eax, %eax
pushq %r11
pushq %r10
pushq 0x18(%rbx)
callq 0xc16a
addq $0x20, %rsp
jmp 0x5dd76
movl $0x4008, %edi           # imm = 0x4008
callq 0x4210
movq %rax, %r14
cmpq $0x2, %rbx
leaq 0x32bef(%rip), %rax     # 0x90932
leaq 0x10b1e(%rip), %r8      # 0x6e868
cmovaeq %rax, %r8
subq $0x8, %rsp
leaq 0x33e5e(%rip), %rsi     # 0x91bb7
leaq 0x1caa7(%rip), %rcx     # 0x7a807
movq %r14, %rdi
movq %rbx, %rdx
movq %r15, %r9
xorl %eax, %eax
pushq $0x0
callq 0xc16a
addq $0x10, %rsp
leaq 0x49ed3(%rip), %rsi     # 0xa7c50
movq 0x4a24c(%rip), %rdx     # 0xa7fd0
movq %r14, %rdi
callq 0x4910
jmp 0x5dd8e
movq %rax, %rbx
movq %r14, %rdi
callq 0x43c0
movq %rbx, %rdi
callq 0x4960
nop