// File: /workspace/github_cpp_makefile_star2_O3/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 0x5fbc4
movq %rdx, %r12
movq %rsi, %r14
movq 0x18(%r15), %r9
testq %r9, %r9
sete %al
movl (%r15), %esi
movl 0x4(%r15), %edx
testl %esi, %esi
sete %dil
orb %al, %dil
testl %edx, %edx
sete %al
movl 0x8(%r15), %ecx
testl %ecx, %ecx
sete %r10b
orb %al, %r10b
orb %dil, %r10b
movl 0xc(%r15), %r8d
testl %r8d, %r8d
sete %al
orb %r10b, %al
cmpb $0x1, %al
jne 0x5f759
movq %r14, %rdi
movq %r12, %rsi
callq 0x5ce0e
jmp 0x5fb6a
cmpl $0x2, %ecx
jb 0x5f7a9
leaq 0xf103(%rip), %rax      # 0x6e868
leaq 0x104d6(%rip), %r10     # 0x6fc42
cmpb $0x0, 0x10(%r15)
cmovneq %rax, %r10
testq %r12, %r12
leaq 0x2fe92(%rip), %r11     # 0x8f611
cmovneq %r12, %r11
subq $0x8, %rsp
leaq 0x2f991(%rip), %rbx     # 0x8f11f
leaq 0x32c00(%rip), %rdi     # 0x92395
xorl %eax, %eax
pushq %r11
pushq %rbx
pushq %r10
callq 0xbb10
addq $0x20, %rsp
movl 0xc(%r15), %r8d
cmpl $0x4, %r8d
jb 0x5f805
leaq 0xf0b2(%rip), %rax      # 0x6e868
leaq 0x10485(%rip), %r10     # 0x6fc42
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 0x2fe32(%rip), %r11     # 0x8f611
cmovneq %r12, %r11
subq $0x8, %rsp
leaq 0x2f931(%rip), %rbx     # 0x8f11f
leaq 0x32c23(%rip), %rdi     # 0x92418
xorl %eax, %eax
pushq %r11
pushq %rbx
pushq %r10
callq 0xbb10
addq $0x20, %rsp
movq %r14, %rax
testq %r14, %r14
jne 0x5f81c
leaq 0x2f849(%rip), %rsi     # 0x8f05d
movq %r12, %rdi
callq 0x3b111
movq 0x18(%r15), %r13
movl (%r15), %ecx
movl 0x4(%r15), %r8d
movl 0xc(%r15), %edi
cmpl $0x2, %edi
jb 0x5f858
movl 0x8(%r15), %edx
movq %r8, %rbx
imulq %rcx, %rbx
imulq %rdx, %rbx
leaq (,%rbx,8), %r12
addq %r13, %r12
cmpl $0x2, %edi
je 0x5f85b
shlq $0x4, %rbx
addq %r13, %rbx
jmp 0x5f85d
xorl %r12d, %r12d
xorl %ebx, %ebx
movl %r8d, %r9d
imull %ecx, %r9d
xorl %edx, %edx
xorl %esi, %esi
cmpl $0x1, %edi
sete %dl
setne %sil
leal 0x1(,%rsi,2), %ebp
movl %r9d, 0x4(%rsp)
imull %r9d, %ebp
movl $0x100000, %esi         # imm = 0x100000
cmpl %esi, %ebp
cmovael %esi, %ebp
shll $0x5, %edx
orl $0x46, %edx
leaq 0x32c14(%rip), %rsi     # 0x924ad
movq %rax, 0x8(%rsp)
movq %rax, %rdi
xorl %eax, %eax
callq 0x4750
movl 0xc(%r15), %eax
cmpl $0x2, %eax
movq %r14, 0x38(%rsp)
je 0x5f97e
cmpl $0x1, %eax
jne 0x5fa66
leaq 0x10(%rsp), %rdi
movl %ebp, %esi
movl $0x1, %edx
movl $0x1, %ecx
movl $0x1, %r8d
callq 0x1de60
movl (%r15), %eax
movl 0x4(%r15), %ebx
imulq %rax, %rbx
testq %rbx, %rbx
je 0x5f95b
movl %ebp, %r14d
cmpq %r14, %rbx
movq %r14, %r12
cmovbq %rbx, %r12
movq 0x28(%rsp), %rdi
cmpl $0x0, 0x4(%rsp)
je 0x5f949
xorl %eax, %eax
xorl %ecx, %ecx
xorps %xmm0, %xmm0
cvtsd2ss (%r13,%rcx,8), %xmm0
movss %xmm0, (%rdi,%rcx,4)
incq %rcx
addq $-0x8, %rax
cmpq %rcx, %r12
jne 0x5f90c
subq %rax, %r13
cmpl $0x0, 0x4(%rsp)
je 0x5f949
leaq (%rdi,%r14,4), %rax
movl -0x4(%rax), %ecx
bswapl %ecx
movl %ecx, -0x4(%rax)
leaq -0x4(%rax), %rcx
movq %rcx, %rax
cmpq %rdi, %rcx
ja 0x5f935
movq %r12, %rsi
movq 0x8(%rsp), %rdx
callq 0x5f576
subq %r12, %rbx
jg 0x5f8f2
cmpb $0x0, 0x20(%rsp)
jne 0x5fb5b
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x5fb5b
callq 0x4690
jmp 0x5fb5b
leaq 0x10(%rsp), %rdi
movl %ebp, %esi
movl $0x1, %edx
movl $0x1, %ecx
movl $0x1, %r8d
callq 0x1de60
movl (%r15), %eax
movq %r15, 0x30(%rsp)
movl 0x4(%r15), %ebx
imulq %rax, %rbx
testq %rbx, %rbx
je 0x5fa48
movl %ebp, %r15d
movl $0xaaaaaaab, %ebp       # imm = 0xAAAAAAAB
imulq %r15, %rbp
shrq $0x21, %rbp
cmpl %ebp, %ebx
movl %ebp, %r14d
cmovbl %ebx, %r14d
movq 0x28(%rsp), %rdi
testl %r14d, %r14d
je 0x5fa12
leaq (,%r14,4), %rax
leaq (%rax,%rax,2), %rax
xorl %ecx, %ecx
movsd (%r13), %xmm0
movhpd (%r12), %xmm0           # xmm0 = xmm0[0],mem[0]
addq $0x8, %r13
addq $0x8, %r12
cvtpd2ps %xmm0, %xmm0
movlpd %xmm0, (%rdi,%rcx)
movl $0x0, 0x8(%rdi,%rcx)
addq $0xc, %rcx
cmpq %rcx, %rax
jne 0x5f9e4
cmpl $0x0, 0x4(%rsp)
je 0x5fa31
leaq (%rdi,%r15,4), %rax
movl -0x4(%rax), %ecx
bswapl %ecx
movl %ecx, -0x4(%rax)
leaq -0x4(%rax), %rcx
movq %rcx, %rax
cmpq %rdi, %rcx
ja 0x5fa1d
leal (%r14,%r14,2), %esi
movq 0x8(%rsp), %rdx
callq 0x5f576
subq %r14, %rbx
jg 0x5f9c3
cmpb $0x0, 0x20(%rsp)
jne 0x5fb56
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x5fb56
jmp 0x5fb51
leaq 0x10(%rsp), %rdi
movl %ebp, %esi
movl $0x1, %edx
movl $0x1, %ecx
movl $0x1, %r8d
callq 0x1de60
movl (%r15), %eax
movq %r15, 0x30(%rsp)
movl 0x4(%r15), %r15d
imulq %rax, %r15
testq %r15, %r15
je 0x5fb40
movl %ebp, %ecx
movl $0xaaaaaaab, %r14d      # imm = 0xAAAAAAAB
movq %rcx, 0x40(%rsp)
imulq %rcx, %r14
shrq $0x21, %r14
cmpl %r14d, %r15d
movl %r14d, %ebp
cmovbl %r15d, %ebp
movq 0x28(%rsp), %rdi
testl %ebp, %ebp
je 0x5fb05
xorl %eax, %eax
xorl %ecx, %ecx
movq %rdi, %rdx
movsd (%r13,%rcx,8), %xmm0
movhpd (%r12,%rcx,8), %xmm0    # xmm0 = xmm0[0],mem[0]
cvtpd2ps %xmm0, %xmm0
movlpd %xmm0, (%rdx)
xorps %xmm0, %xmm0
cvtsd2ss (%rbx,%rcx,8), %xmm0
movss %xmm0, 0x8(%rdx)
incq %rcx
addq $-0x8, %rax
addq $0xc, %rdx
cmpq %rcx, %rbp
jne 0x5faca
subq %rax, %rbx
subq %rax, %r12
subq %rax, %r13
cmpl $0x0, 0x4(%rsp)
je 0x5fb29
movq 0x40(%rsp), %rax
leaq (%rdi,%rax,4), %rax
movl -0x4(%rax), %ecx
bswapl %ecx
movl %ecx, -0x4(%rax)
leaq -0x4(%rax), %rcx
movq %rcx, %rax
cmpq %rdi, %rcx
ja 0x5fb15
leal (%rbp,%rbp,2), %esi
movq 0x8(%rsp), %rdx
callq 0x5f576
subq %rbp, %r15
jg 0x5fab0
cmpb $0x0, 0x20(%rsp)
jne 0x5fb56
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x5fb56
callq 0x4690
movq 0x30(%rsp), %r15
movq 0x38(%rsp), %rax
testq %rax, %rax
movq 0x8(%rsp), %rdi
je 0x5fb7c
movq %r15, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testq %rdi, %rdi
je 0x5fbb4
movq 0x48420(%rip), %rax     # 0xa7fa8
cmpq %rdi, (%rax)
je 0x5fb6a
movq 0x483f4(%rip), %rax     # 0xa7f88
cmpq %rdi, (%rax)
je 0x5fb6a
callq 0x4550
testl %eax, %eax
je 0x5fb6a
leaq 0x2f453(%rip), %rdi     # 0x8effc
movl %eax, %esi
xorl %eax, %eax
callq 0xbb10
jmp 0x5fb6a
leaq 0x2f417(%rip), %rdi     # 0x8efd2
xorl %eax, %eax
callq 0xbb10
jmp 0x5fb6a
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 0xec81(%rip), %rax      # 0x6e868
leaq 0x10054(%rip), %r10     # 0x6fc42
cmpb $0x0, 0x10(%r15)
cmovneq %rax, %r10
subq $0x8, %rsp
leaq 0x2f51d(%rip), %r11     # 0x8f11f
leaq 0x32734(%rip), %rsi     # 0x9233d
movq %r14, %rdi
xorl %eax, %eax
pushq %r11
pushq %r10
pushq 0x18(%r15)
callq 0xc16a
addq $0x20, %rsp
leaq 0x4802a(%rip), %rsi     # 0xa7c50
movq 0x483a3(%rip), %rdx     # 0xa7fd0
movq %r14, %rdi
callq 0x4910
movq %rax, %rbx
movq %r14, %rdi
callq 0x43c0
jmp 0x5fc87
movq %rax, %rbx
cmpb $0x0, 0x20(%rsp)
jne 0x5fc87
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x5fc87
jmp 0x5fc82
movq %rax, %rbx
cmpb $0x0, 0x20(%rsp)
jne 0x5fc87
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x5fc87
jmp 0x5fc82
movq %rax, %rbx
cmpb $0x0, 0x20(%rsp)
jne 0x5fc87
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x5fc87
callq 0x4690
movq %rbx, %rdi
callq 0x4960
nop