// File: /workspace/github_cpp_makefile_star2_O2/manikandan5[P]Image-Matching-Stitching-Warping/./CImg.h
// Function: cimg_library::CImg<double>::save_analyze(char const*, float const*) const
const CImg<T>& save_analyze(const char *const filename, const float *const voxel_size=0) const {
      if (!filename)
        throw CImgArgumentException(_cimg_instance
                                    "save_analyze(): Specified filename is (null).",
                                    cimg_instance);
      if (is_empty()) { cimg::fempty(0,filename); return *this; }

      std::FILE *file;
      char header[348] = { 0 }, hname[1024] = { 0 }, iname[1024] = { 0 };
      const char *const ext = cimg::split_filename(filename);
      short datatype=-1;
      std::memset(header,0,348);
      if (!*ext) {
        cimg_snprintf(hname,sizeof(hname),"%s.hdr",filename);
        cimg_snprintf(iname,sizeof(iname),"%s.img",filename);
      }
      if (!cimg::strncasecmp(ext,"hdr",3)) {
        std::strcpy(hname,filename);
        std::strncpy(iname,filename,sizeof(iname)-1);
        std::sprintf(iname + std::strlen(iname)-3,"img");
      }
      if (!cimg::strncasecmp(ext,"img",3)) {
        std::strcpy(hname,filename);
        std::strncpy(iname,filename,sizeof(iname)-1);
        std::sprintf(hname + std::strlen(iname)-3,"hdr");
      }
      if (!cimg::strncasecmp(ext,"nii",3)) {
        std::strncpy(hname,filename,sizeof(hname)-1); *iname = 0;
      }
      int *const iheader = (int*)header;
      *iheader = 348;
      std::strcpy(header + 4,"CImg");
      std::strcpy(header + 14," ");
      ((short*)(header + 36))[0] = 4096;
      ((char*)(header + 38))[0] = 114;
      ((short*)(header + 40))[0] = 4;
      ((short*)(header + 40))[1] = _width;
      ((short*)(header + 40))[2] = _height;
      ((short*)(header + 40))[3] = _depth;
      ((short*)(header + 40))[4] = _spectrum;
      if (!cimg::strcasecmp(pixel_type(),"bool")) datatype = 2;
      if (!cimg::strcasecmp(pixel_type(),"unsigned char")) datatype = 2;
      if (!cimg::strcasecmp(pixel_type(),"char")) datatype = 2;
      if (!cimg::strcasecmp(pixel_type(),"unsigned short")) datatype = 4;
      if (!cimg::strcasecmp(pixel_type(),"short")) datatype = 4;
      if (!cimg::strcasecmp(pixel_type(),"unsigned int")) datatype = 8;
      if (!cimg::strcasecmp(pixel_type(),"int")) datatype = 8;
      if (!cimg::strcasecmp(pixel_type(),"unsigned long")) datatype = 8;
      if (!cimg::strcasecmp(pixel_type(),"long")) datatype = 8;
      if (!cimg::strcasecmp(pixel_type(),"float")) datatype = 16;
      if (!cimg::strcasecmp(pixel_type(),"double")) datatype = 64;
      if (datatype<0)
        throw CImgIOException(_cimg_instance
                              "save_analyze(): Unsupported pixel type '%s' for file '%s'.",
                              cimg_instance,
                              pixel_type(),filename);

      ((short*)(header+70))[0] = datatype;
      ((short*)(header+72))[0] = sizeof(T);
      ((float*)(header+112))[0] = 1;
      ((float*)(header+76))[0] = 0;
      if (voxel_size) {
        ((float*)(header+76))[1] = voxel_size[0];
        ((float*)(header+76))[2] = voxel_size[1];
        ((float*)(header+76))[3] = voxel_size[2];
      } else ((float*)(header+76))[1] = ((float*)(header+76))[2] = ((float*)(header+76))[3] = 1;
      file = cimg::fopen(hname,"wb");
      cimg::fwrite(header,348,file);
      if (*iname) { cimg::fclose(file); file = cimg::fopen(iname,"wb"); }
      cimg::fwrite(_data,size(),file);
      cimg::fclose(file);
      return *this;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x978, %rsp            # imm = 0x978
movq %rdi, %rbx
testq %rsi, %rsi
je 0x4599e
movq %rdx, %r15
movq %rsi, %r14
movq %rbx, %rdi
callq 0x8dc8
testb %al, %al
je 0x455f6
xorl %edi, %edi
movq %r14, %rsi
callq 0x465c3
jmp 0x45989
leaq 0x570(%rsp), %rdi
movl $0x400, %edx            # imm = 0x400
xorl %esi, %esi
callq 0x4280
leaq 0x170(%rsp), %rdi
movl $0x400, %edx            # imm = 0x400
xorl %esi, %esi
callq 0x4280
movq %r14, %rdi
xorl %esi, %esi
callq 0x2cc28
movq %rax, %r12
leaq 0x10(%rsp), %rdi
movl $0x15c, %edx            # imm = 0x15C
xorl %esi, %esi
callq 0x4280
cmpb $0x0, (%r12)
jne 0x4567f
leaq 0x30baa(%rip), %rdx     # 0x761f4
leaq 0x570(%rsp), %rdi
movl $0x400, %esi            # imm = 0x400
movq %r14, %rcx
xorl %eax, %eax
callq 0x4890
leaq 0x30c12(%rip), %rdx     # 0x7627a
leaq 0x170(%rsp), %rdi
movl $0x400, %esi            # imm = 0x400
movq %r14, %rcx
xorl %eax, %eax
callq 0x4890
leaq 0x30b71(%rip), %rsi     # 0x761f7
pushq $0x3
popq %rdx
movq %r12, %rdi
callq 0x1b5ab
testl %eax, %eax
jne 0x456d0
leaq 0x570(%rsp), %rdi
movq %r14, %rsi
callq 0x44c0
leaq 0x170(%rsp), %r13
movl $0x3ff, %edx            # imm = 0x3FF
movq %r13, %rdi
movq %r14, %rsi
callq 0x4240
movq %r13, %rdi
callq 0x41e0
movl $0x676d69, 0x16d(%rsp,%rax) # imm = 0x676D69
leaq 0x30ba6(%rip), %rsi     # 0x7627d
pushq $0x3
popq %rdx
movq %r12, %rdi
callq 0x1b5ab
testl %eax, %eax
jne 0x45721
leaq 0x570(%rsp), %rdi
movq %r14, %rsi
callq 0x44c0
leaq 0x170(%rsp), %r13
movl $0x3ff, %edx            # imm = 0x3FF
movq %r13, %rdi
movq %r14, %rsi
callq 0x4240
movq %r13, %rdi
callq 0x41e0
movl $0x726468, 0x56d(%rsp,%rax) # imm = 0x726468
movq %r15, 0x8(%rsp)
leaq 0x2fa8d(%rip), %rsi     # 0x751ba
pushq $0x3
popq %rdx
movq %r12, %rdi
callq 0x1b5ab
testl %eax, %eax
jne 0x45759
leaq 0x570(%rsp), %rdi
movl $0x3ff, %edx            # imm = 0x3FF
movq %r14, %rsi
callq 0x4240
movb $0x0, 0x170(%rsp)
movq %r14, (%rsp)
movabsq $0x676d49430000015c, %rax # imm = 0x676D49430000015C
movq %rax, 0x10(%rsp)
movb $0x0, 0x18(%rsp)
movw $0x20, 0x1e(%rsp)
movw $0x1000, 0x34(%rsp)     # imm = 0x1000
movb $0x72, 0x36(%rsp)
movw $0x4, 0x38(%rsp)
movdqu (%rbx), %xmm0
pshuflw $0xe8, %xmm0, %xmm0     # xmm0 = xmm0[0,2,2,3,4,5,6,7]
pshufhw $0xe8, %xmm0, %xmm0     # xmm0 = xmm0[0,1,2,3,4,6,6,7]
pshufd $0xe8, %xmm0, %xmm0     # xmm0 = xmm0[0,2,2,3]
movq %xmm0, 0x3a(%rsp)
leaq 0x2f8f4(%rip), %r12     # 0x7509f
leaq 0x3144e(%rip), %rsi     # 0x76c00
movq %r12, %rdi
callq 0x2ccbe
testl %eax, %eax
setne %bpl
leaq 0x1afc0(%rip), %rsi     # 0x60787
movq %r12, %rdi
callq 0x2ccbe
testl %eax, %eax
setne %r14b
andb %bpl, %r14b
leaq 0x1afb1(%rip), %rsi     # 0x60790
movq %r12, %rdi
callq 0x2ccbe
testl %eax, %eax
setne %al
andb %r14b, %al
movzbl %al, %r14d
negl %r14d
orl $0x2, %r14d
leaq 0x30456(%rip), %rsi     # 0x75c57
movq %r12, %rdi
callq 0x2ccbe
movl %eax, %ebp
leaq 0x3044e(%rip), %rsi     # 0x75c60
movq %r12, %rdi
callq 0x2ccbe
testl %eax, %eax
pushq $0x4
popq %rax
cmovel %eax, %r14d
testl %ebp, %ebp
cmovel %eax, %r14d
leaq 0x2ed21(%rip), %rsi     # 0x74551
movq %r12, %rdi
callq 0x2ccbe
movl %eax, %ebp
leaq 0x2ed19(%rip), %rsi     # 0x7455a
movq %r12, %rdi
callq 0x2ccbe
movl %eax, %r13d
leaq 0x2ecea(%rip), %rsi     # 0x7453d
movq %r12, %rdi
callq 0x2ccbe
movl %eax, %r15d
leaq 0x2ece1(%rip), %rsi     # 0x74546
movq %r12, %rdi
callq 0x2ccbe
testl %r13d, %r13d
pushq $0x8
popq %rcx
cmovel %ecx, %r14d
testl %ebp, %ebp
cmovel %ecx, %r14d
testl %r15d, %r15d
cmovel %ecx, %r14d
testl %eax, %eax
cmovel %ecx, %r14d
leaq 0x2ecba(%rip), %rsi     # 0x7454b
movq %r12, %rdi
callq 0x2ccbe
testl %eax, %eax
pushq $0x10
popq %rbp
cmovnel %r14d, %ebp
movq %r12, %rdi
movq %r12, %rsi
callq 0x2ccbe
testl %eax, %eax
pushq $0x40
popq %rax
cmovnel %ebp, %eax
testw %ax, %ax
js 0x45a0b
movw %ax, 0x56(%rsp)
movw $0x8, 0x58(%rsp)
movl $0x3f800000, 0x80(%rsp) # imm = 0x3F800000
andl $0x0, 0x5c(%rsp)
movq 0x8(%rsp), %rax
testq %rax, %rax
je 0x458ef
movsd (%rax), %xmm0
movss 0x8(%rax), %xmm1
jmp 0x458fe
movaps 0xe89a(%rip), %xmm0     # 0x54190
movss 0xe922(%rip), %xmm1     # 0x54220
leaq 0x10(%rsp), %r15
movss %xmm1, 0x58(%r15)
movlps %xmm0, 0x50(%r15)
leaq 0x2f6c8(%rip), %rsi     # 0x74fdd
leaq 0x570(%rsp), %rdi
callq 0x2dca5
movq %rax, %r14
movl $0x15c, %esi            # imm = 0x15C
movq %r15, %rdi
movq %rax, %rdx
callq 0x48aef
cmpb $0x0, 0x170(%rsp)
je 0x4595e
movq %r14, %rdi
callq 0x2a2f8
leaq 0x2f68f(%rip), %rsi     # 0x74fdd
leaq 0x170(%rsp), %rdi
callq 0x2dca5
movq %rax, %r14
movq 0x18(%rbx), %rdi
movl (%rbx), %eax
movl 0x4(%rbx), %ecx
imulq %rax, %rcx
movl 0x8(%rbx), %eax
movl 0xc(%rbx), %esi
imulq %rax, %rsi
imulq %rcx, %rsi
movq %r14, %rdx
callq 0x489e9
movq %r14, %rdi
callq 0x2a2f8
movq %rbx, %rax
addq $0x978, %rsp            # imm = 0x978
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x4008, %edi           # imm = 0x4008
callq 0x4210
movq %rax, %r14
movl (%rbx), %edx
movl 0x4(%rbx), %ecx
movl 0x8(%rbx), %r8d
movl 0xc(%rbx), %r9d
leaq 0xee29(%rip), %rax      # 0x547e8
leaq 0x101fc(%rip), %r10     # 0x55bc2
cmpb $0x0, 0x10(%rbx)
cmovneq %rax, %r10
subq $0x8, %rsp
leaq 0x2f6c6(%rip), %r11     # 0x7509f
leaq 0x32d5d(%rip), %rsi     # 0x7873d
movq %r14, %rdi
xorl %eax, %eax
pushq %r11
pushq %r10
pushq 0x18(%rbx)
callq 0x9d52
addq $0x20, %rsp
leaq 0x4a264(%rip), %rsi     # 0x8fc60
movq 0x4a5d5(%rip), %rdx     # 0x8ffd8
movq %r14, %rdi
callq 0x4910
movl $0x4008, %edi           # imm = 0x4008
callq 0x4210
movq %rax, %r15
movl (%rbx), %edx
movl 0x4(%rbx), %ecx
movl 0x8(%rbx), %r8d
movl 0xc(%rbx), %r9d
leaq 0xedbc(%rip), %rax      # 0x547e8
leaq 0x1018f(%rip), %r10     # 0x55bc2
cmpb $0x0, 0x10(%rbx)
cmovneq %rax, %r10
subq $0x8, %rsp
leaq 0x32d53(%rip), %rsi     # 0x78799
movq %r15, %rdi
xorl %eax, %eax
pushq 0x8(%rsp)
pushq %r12
pushq %r12
pushq %r10
pushq 0x18(%rbx)
callq 0x2a3de
addq $0x30, %rsp
leaq 0x4a298(%rip), %rsi     # 0x8fd00
movq 0x4a569(%rip), %rdx     # 0x8ffd8
movq %r15, %rdi
callq 0x4910
movq %rax, %rbx
movq %r15, %rdi
jmp 0x45a85
movq %rax, %rbx
movq %r14, %rdi
callq 0x4390
movq %rbx, %rdi
callq 0x4950