// File: /workspace/github_cpp_makefile_star2_O2/manikandan5[P]Image-Matching-Stitching-Warping/./CImg.h
// Function: cimg_library::CImg<double>::_save_pfm(_IO_FILE*, char const*) const
const CImg<T>& _save_pfm(std::FILE *const file, const char *const filename) const {
      if (!file && !filename)
        throw CImgArgumentException(_cimg_instance
                                    "save_pfm(): Specified filename is (null).",
                                    cimg_instance);
      if (is_empty()) { cimg::fempty(file,filename); return *this; }
      if (_depth>1)
        cimg::warn(_cimg_instance
                   "save_pfm(): Instance is volumetric, only the first slice will be saved in file '%s'.",
                   cimg_instance,
                   filename?filename:"(FILE*)");
      if (_spectrum>3)
        cimg::warn(_cimg_instance
                   "save_pfm(): image instance is multispectral, only the three first channels will be saved "
                   "in file '%s'.",
                   cimg_instance,
                   filename?filename:"(FILE*)");

      std::FILE *const nfile = file?file:cimg::fopen(filename,"wb");
      const T
        *ptr_r = data(0,0,0,0),
        *ptr_g = (_spectrum>=2)?data(0,0,0,1):0,
        *ptr_b = (_spectrum>=3)?data(0,0,0,2):0;
      const unsigned int buf_size = cimg::min(1024*1024U,_width*_height*(_spectrum==1?1:3));

      std::fprintf(nfile,"P%c\n%u %u\n1.0\n",
                   (_spectrum==1?'f':'F'),_width,_height);

      switch (_spectrum) {
      case 1 : { // Scalar image
        CImg<floatT> buf(buf_size);
        for (long to_write = (long)_width*_height; to_write>0; ) {
          const unsigned long N = cimg::min((unsigned long)to_write,buf_size);
          float *ptrd = buf._data;
          for (unsigned long i = N; i>0; --i) *(ptrd++) = (float)*(ptr_r++);
          if (!cimg::endianness()) cimg::invert_endianness(buf._data,buf_size);
          cimg::fwrite(buf._data,N,nfile);
          to_write-=N;
        }
      } break;
      case 2 : { // RG image
        CImg<floatT> buf(buf_size);
        for (long to_write = (long)_width*_height; to_write>0; ) {
          const unsigned int N = cimg::min((unsigned int)to_write,buf_size/3);
          float *ptrd = buf._data;
          for (unsigned long i = N; i>0; --i) {
            *(ptrd++) = (float)*(ptr_r++);
            *(ptrd++) = (float)*(ptr_g++);
            *(ptrd++) = 0;
          }
          if (!cimg::endianness()) cimg::invert_endianness(buf._data,buf_size);
          cimg::fwrite(buf._data,3*N,nfile);
          to_write-=N;
        }
      } break;
      default : { // RGB image
        CImg<floatT> buf(buf_size);
        for (long to_write = (long)_width*_height; to_write>0; ) {
          const unsigned int N = cimg::min((unsigned int)to_write,buf_size/3);
          float *ptrd = buf._data;
          for (unsigned long i = N; i>0; --i) {
            *(ptrd++) = (float)*(ptr_r++);
            *(ptrd++) = (float)*(ptr_g++);
            *(ptrd++) = (float)*(ptr_b++);
          }
          if (!cimg::endianness()) cimg::invert_endianness(buf._data,buf_size);
          cimg::fwrite(buf._data,3*N,nfile);
          to_write-=N;
        }
      }
      }
      if (!file) cimg::fclose(nfile);
      return *this;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %r15
movq %rsi, %rax
orq %rdx, %rax
je 0x4874c
movq %rdx, %r12
movq %rsi, %r13
movq %r15, %rdi
callq 0x8dc8
testb %al, %al
je 0x483dd
movq %r13, %rdi
movq %r12, %rsi
callq 0x465c3
jmp 0x4873a
movl 0x8(%r15), %ecx
cmpl $0x2, %ecx
jb 0x4843c
leaq 0xc3fb(%rip), %rax      # 0x547e8
leaq 0xd7ce(%rip), %r10      # 0x55bc2
cmpb $0x0, 0x10(%r15)
cmovneq %rax, %r10
testq %r12, %r12
movl (%r15), %esi
movl 0x4(%r15), %edx
movl 0xc(%r15), %r8d
movq 0x18(%r15), %r9
leaq 0x2d151(%rip), %r11     # 0x75567
cmovneq %r12, %r11
subq $0x8, %rsp
leaq 0x2cc7a(%rip), %rbx     # 0x7509f
leaq 0x2febf(%rip), %rdi     # 0x782eb
xorl %eax, %eax
pushq %r11
pushq %rbx
pushq %r10
callq 0x97a7
addq $0x20, %rsp
movl 0xc(%r15), %r8d
cmpl $0x4, %r8d
jb 0x4849c
leaq 0xc39b(%rip), %rax      # 0x547e8
leaq 0xd76e(%rip), %r10      # 0x55bc2
cmpb $0x0, 0x10(%r15)
cmovneq %rax, %r10
testq %r12, %r12
movl (%r15), %esi
movl 0x4(%r15), %edx
movl 0x8(%r15), %ecx
movq 0x18(%r15), %r9
leaq 0x2d0f1(%rip), %r11     # 0x75567
cmovneq %r12, %r11
subq $0x8, %rsp
leaq 0x2cc1a(%rip), %rbx     # 0x7509f
leaq 0x2fee2(%rip), %rdi     # 0x7836e
xorl %eax, %eax
pushq %r11
pushq %rbx
pushq %r10
callq 0x97a7
addq $0x20, %rsp
movq %r13, 0x8(%rsp)
testq %r13, %r13
jne 0x484ba
leaq 0x2cb30(%rip), %rsi     # 0x74fdd
movq %r12, %rdi
callq 0x2dca5
movq %rax, 0x8(%rsp)
movq 0x18(%r15), %r14
movl (%r15), %ecx
movl 0x4(%r15), %r8d
movl 0xc(%r15), %eax
cmpl $0x2, %eax
movq %r13, 0x38(%rsp)
jb 0x484f4
movl 0x8(%r15), %edx
movq %r8, %rbp
imulq %rcx, %rbp
imulq %rdx, %rbp
leaq (%r14,%rbp,8), %rbx
cmpl $0x2, %eax
je 0x484f6
shlq $0x4, %rbp
addq %r14, %rbp
jmp 0x484f8
xorl %ebx, %ebx
xorl %ebp, %ebp
movl %r8d, %esi
imull %ecx, %esi
xorl %edx, %edx
xorl %edi, %edi
cmpl $0x1, %eax
sete %dl
setne %dil
leal 0x1(,%rdi,2), %r13d
imull %esi, %r13d
movl $0x100000, %eax         # imm = 0x100000
cmpl %eax, %r13d
cmovael %eax, %r13d
shll $0x5, %edx
orl $0x46, %edx
leaq 0x2fed2(%rip), %rsi     # 0x78403
movq 0x8(%rsp), %rdi
xorl %eax, %eax
callq 0x4750
movl 0xc(%r15), %eax
cmpl $0x2, %eax
je 0x485c3
cmpl $0x1, %eax
jne 0x48660
leaq 0x18(%rsp), %rdi
pushq $0x1
popq %rcx
movl %r13d, %esi
movl %ecx, %edx
movl %ecx, %r8d
callq 0x17dbc
movl (%r15), %eax
movl 0x4(%r15), %ebx
imulq %rax, %rbx
movl %r13d, %r12d
testq %rbx, %rbx
jle 0x4870b
cmpq %r12, %rbx
movq %r12, %r13
cmovbq %rbx, %r13
movq 0x30(%rsp), %rdi
xorl %eax, %eax
cmpq %rax, %r13
je 0x485a4
cvtsd2ss (%r14), %xmm0
addq $0x8, %r14
movss %xmm0, (%rdi,%rax,4)
incq %rax
jmp 0x4858c
movq %r12, %rsi
callq 0x38732
movq 0x30(%rsp), %rdi
movq %r13, %rsi
movq 0x8(%rsp), %rdx
callq 0x48243
subq %r13, %rbx
jmp 0x48572
leaq 0x18(%rsp), %rdi
pushq $0x1
popq %rcx
movl %r13d, %esi
movl %ecx, %edx
movl %ecx, %r8d
callq 0x17dbc
movl (%r15), %eax
movq %r15, 0x10(%rsp)
movl 0x4(%r15), %r15d
imulq %rax, %r15
pushq $0x3
popq %rcx
movl %r13d, %eax
xorl %edx, %edx
divl %ecx
movl %eax, %r12d
movl %r13d, %r13d
testq %r15, %r15
jle 0x48717
cmpl %r12d, %r15d
movl %r12d, %ebp
cmovbl %r15d, %ebp
movq 0x30(%rsp), %rdi
imulq $0xc, %rbp, %rax
xorl %ecx, %ecx
cmpq %rcx, %rax
je 0x48640
movsd (%r14), %xmm0
addq $0x8, %r14
movhpd (%rbx), %xmm0           # xmm0 = xmm0[0],mem[0]
addq $0x8, %rbx
cvtpd2ps %xmm0, %xmm0
movlpd %xmm0, (%rdi,%rcx)
andl $0x0, 0x8(%rdi,%rcx)
addq $0xc, %rcx
jmp 0x48616
movq %r13, %rsi
callq 0x38732
movq 0x30(%rsp), %rdi
leal (%rbp,%rbp,2), %esi
movq 0x8(%rsp), %rdx
callq 0x48243
subq %rbp, %r15
jmp 0x485f8
leaq 0x18(%rsp), %rdi
pushq $0x1
popq %rcx
movl %r13d, %esi
movl %ecx, %edx
movl %ecx, %r8d
callq 0x17dbc
movl (%r15), %eax
movq %r15, 0x10(%rsp)
movl 0x4(%r15), %r15d
imulq %rax, %r15
pushq $0x3
popq %rcx
movl %r13d, %eax
xorl %edx, %edx
divl %ecx
movl %eax, %r12d
movl %r13d, %eax
movq %rax, 0x40(%rsp)
testq %r15, %r15
jle 0x48719
cmpl %r12d, %r15d
movl %r12d, %r13d
cmovbl %r15d, %r13d
movq 0x30(%rsp), %rdi
imulq $0xc, %r13, %rax
xorl %ecx, %ecx
cmpq %rcx, %rax
je 0x486e8
movsd (%r14), %xmm0
addq $0x8, %r14
movhpd (%rbx), %xmm0           # xmm0 = xmm0[0],mem[0]
cvtpd2ps %xmm0, %xmm0
movlpd %xmm0, (%rdi,%rcx)
cvtsd2ss (%rbp), %xmm0
addq $0x8, %rbx
addq $0x8, %rbp
movss %xmm0, 0x8(%rdi,%rcx)
addq $0xc, %rcx
jmp 0x486b4
movq 0x40(%rsp), %rsi
callq 0x38732
movq 0x30(%rsp), %rdi
leal (%r13,%r13,2), %esi
movq 0x8(%rsp), %rdx
callq 0x48243
subq %r13, %r15
jmp 0x4869a
leaq 0x18(%rsp), %rdi
callq 0x17c20
jmp 0x48728
jmp 0x48719
leaq 0x18(%rsp), %rdi
callq 0x17c20
movq 0x10(%rsp), %r15
cmpq $0x0, 0x38(%rsp)
jne 0x4873a
movq 0x8(%rsp), %rdi
callq 0x2a2f8
movq %r15, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x4008, %edi           # imm = 0x4008
callq 0x4210
movq %rax, %r14
movl (%r15), %edx
movl 0x4(%r15), %ecx
movl 0x8(%r15), %r8d
movl 0xc(%r15), %r9d
leaq 0xc079(%rip), %rax      # 0x547e8
leaq 0xd44c(%rip), %r10      # 0x55bc2
cmpb $0x0, 0x10(%r15)
cmovneq %rax, %r10
subq $0x8, %rsp
leaq 0x2c915(%rip), %r11     # 0x7509f
leaq 0x2fb02(%rip), %rsi     # 0x78293
movq %r14, %rdi
xorl %eax, %eax
pushq %r11
pushq %r10
pushq 0x18(%r15)
callq 0x9d52
addq $0x20, %rsp
leaq 0x474b2(%rip), %rsi     # 0x8fc60
movq 0x47823(%rip), %rdx     # 0x8ffd8
movq %r14, %rdi
callq 0x4910
movq %rax, %rbx
movq %r14, %rdi
callq 0x4390
jmp 0x487db
jmp 0x487ce
jmp 0x487ce
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x17c20
movq %rbx, %rdi
callq 0x4950
nop