// File: /workspace/github_cpp_makefile_star2_O1/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 0x62710
movq %rdx, %r12
movq %rsi, %r14
movq 0x18(%r15), %r9
testq %r9, %r9
je 0x624ba
movdqu (%r15), %xmm0
pxor %xmm1, %xmm1
pcmpeqd %xmm0, %xmm1
movmskps %xmm1, %eax
testb %al, %al
jne 0x624ba
pshufd $0xee, %xmm0, %xmm1     # xmm1 = xmm0[2,3,2,3]
movd %xmm1, %ecx
cmpl $0x2, %ecx
jb 0x622e4
leaq 0x110a5(%rip), %rax     # 0x73338
leaq 0x12478(%rip), %r10     # 0x74712
cmpb $0x0, 0x10(%r15)
cmovneq %rax, %r10
testq %r12, %r12
leaq 0x31e34(%rip), %r11     # 0x940e1
cmovneq %r12, %r11
movl 0xc(%r15), %r8d
movd %xmm0, %esi
pshufd $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
movd %xmm0, %edx
subq $0x8, %rsp
leaq 0x31922(%rip), %rbx     # 0x93bef
leaq 0x34b91(%rip), %rdi     # 0x96e65
xorl %eax, %eax
pushq %r11
pushq %rbx
pushq %r10
callq 0xbb52
addq $0x20, %rsp
movl 0xc(%r15), %r8d
cmpl $0x4, %r8d
jb 0x62344
leaq 0x11043(%rip), %rax     # 0x73338
leaq 0x12416(%rip), %r10     # 0x74712
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 0x31dc3(%rip), %r11     # 0x940e1
cmovneq %r12, %r11
subq $0x8, %rsp
leaq 0x318c2(%rip), %rbx     # 0x93bef
leaq 0x34bb4(%rip), %rdi     # 0x96ee8
xorl %eax, %eax
pushq %r11
pushq %rbx
pushq %r10
callq 0xbb52
addq $0x20, %rsp
movq %r14, %rax
testq %r14, %r14
jne 0x6235b
leaq 0x317da(%rip), %rsi     # 0x93b2d
movq %r12, %rdi
callq 0x3ceb3
movq 0x18(%r15), %r13
movl (%r15), %ecx
movl 0x4(%r15), %r8d
movl 0x8(%r15), %esi
movl 0xc(%r15), %edi
movq %r8, %rdx
imulq %rcx, %rdx
imulq %rsi, %rdx
xorl %ebx, %ebx
leaq (,%rdx,8), %r12
addq %r13, %r12
cmpl $0x2, %edi
cmovbq %rbx, %r12
jbe 0x62399
shlq $0x4, %rdx
addq %r13, %rdx
movq %rdx, %rbx
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 0x34ba8(%rip), %rsi     # 0x96f7d
movq %rax, 0x8(%rsp)
movq %rax, %rdi
xorl %eax, %eax
callq 0x4740
movl 0xc(%r15), %eax
cmpl $0x2, %eax
movq %r14, 0x38(%rsp)
je 0x624ca
cmpl $0x1, %eax
jne 0x625b2
leaq 0x10(%rsp), %rdi
movl %ebp, %esi
movl $0x1, %edx
movl $0x1, %ecx
movl $0x1, %r8d
callq 0x1de54
movl (%r15), %eax
movl 0x4(%r15), %ebx
imulq %rax, %rbx
testq %rbx, %rbx
je 0x62497
movl %ebp, %r14d
cmpq %r14, %rbx
movq %r14, %r12
cmovbq %rbx, %r12
movq 0x28(%rsp), %rdi
cmpl $0x0, 0x4(%rsp)
je 0x62466
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 0x62448
subq %rax, %r13
cmpl $0x0, 0x4(%rsp)
je 0x62485
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 0x62471
movq %r12, %rsi
movq 0x8(%rsp), %rdx
callq 0x620c5
subq %r12, %rbx
jg 0x6242e
cmpb $0x0, 0x20(%rsp)
jne 0x626a7
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x626a7
callq 0x4680
jmp 0x626a7
movq %r14, %rdi
movq %r12, %rsi
callq 0x5f9f0
jmp 0x626b6
leaq 0x10(%rsp), %rdi
movl %ebp, %esi
movl $0x1, %edx
movl $0x1, %ecx
movl $0x1, %r8d
callq 0x1de54
movl (%r15), %eax
movq %r15, 0x30(%rsp)
movl 0x4(%r15), %ebx
imulq %rax, %rbx
testq %rbx, %rbx
je 0x62594
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 0x6255e
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 0x62530
cmpl $0x0, 0x4(%rsp)
je 0x6257d
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 0x62569
leal (%r14,%r14,2), %esi
movq 0x8(%rsp), %rdx
callq 0x620c5
subq %r14, %rbx
jg 0x6250f
cmpb $0x0, 0x20(%rsp)
jne 0x626a2
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x626a2
jmp 0x6269d
leaq 0x10(%rsp), %rdi
movl %ebp, %esi
movl $0x1, %edx
movl $0x1, %ecx
movl $0x1, %r8d
callq 0x1de54
movl (%r15), %eax
movq %r15, 0x30(%rsp)
movl 0x4(%r15), %r15d
imulq %rax, %r15
testq %r15, %r15
je 0x6268c
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 0x62651
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 0x62616
subq %rax, %rbx
subq %rax, %r12
subq %rax, %r13
cmpl $0x0, 0x4(%rsp)
je 0x62675
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 0x62661
leal (%rbp,%rbp,2), %esi
movq 0x8(%rsp), %rdx
callq 0x620c5
subq %rbp, %r15
jg 0x625fc
cmpb $0x0, 0x20(%rsp)
jne 0x626a2
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x626a2
callq 0x4680
movq 0x30(%rsp), %r15
movq 0x38(%rsp), %rax
testq %rax, %rax
movq 0x8(%rsp), %rdi
je 0x626c8
movq %r15, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testq %rdi, %rdi
je 0x62700
movq 0x4a8d4(%rip), %rax     # 0xacfa8
cmpq %rdi, (%rax)
je 0x626b6
movq 0x4a8a8(%rip), %rax     # 0xacf88
cmpq %rdi, (%rax)
je 0x626b6
callq 0x4540
testl %eax, %eax
je 0x626b6
leaq 0x313d7(%rip), %rdi     # 0x93acc
movl %eax, %esi
xorl %eax, %eax
callq 0xbb52
jmp 0x626b6
leaq 0x3139b(%rip), %rdi     # 0x93aa2
xorl %eax, %eax
callq 0xbb52
jmp 0x626b6
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 0x10c05(%rip), %rax     # 0x73338
leaq 0x11fd8(%rip), %r10     # 0x74712
cmpb $0x0, 0x10(%r15)
cmovneq %rax, %r10
subq $0x8, %rsp
leaq 0x314a1(%rip), %r11     # 0x93bef
leaq 0x346b8(%rip), %rsi     # 0x96e0d
movq %r14, %rdi
xorl %eax, %eax
pushq %r11
pushq %r10
pushq 0x18(%r15)
callq 0xc196
addq $0x20, %rsp
leaq 0x4a4ae(%rip), %rsi     # 0xacc20
movq 0x4a857(%rip), %rdx     # 0xacfd0
movq %r14, %rdi
callq 0x4900
movq %rax, %rbx
movq %r14, %rdi
callq 0x43b0
jmp 0x627d3
movq %rax, %rbx
cmpb $0x0, 0x20(%rsp)
jne 0x627d3
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x627d3
jmp 0x627ce
movq %rax, %rbx
cmpb $0x0, 0x20(%rsp)
jne 0x627d3
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x627d3
jmp 0x627ce
movq %rax, %rbx
cmpb $0x0, 0x20(%rsp)
jne 0x627d3
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x627d3
callq 0x4680
movq %rbx, %rdi
callq 0x4950
nop