// File: /workspace/github_cpp_makefile_star2_O3/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 $0x968, %rsp            # imm = 0x968
movq %rdi, %rbx
testq %rsi, %rsi
je 0x5bd76
movq %rsi, %r15
cmpq $0x0, 0x18(%rbx)
je 0x5b9d5
movdqu (%rbx), %xmm0
pxor %xmm1, %xmm1
pcmpeqd %xmm0, %xmm1
movmskps %xmm1, %eax
testb %al, %al
jne 0x5b9d5
movq %rdx, %r14
leaq 0x560(%rsp), %rdi
movl $0x400, %edx            # imm = 0x400
xorl %esi, %esi
callq 0x4290
leaq 0x160(%rsp), %rdi
movl $0x400, %edx            # imm = 0x400
xorl %esi, %esi
callq 0x4290
movq %r15, %rax
movq %rax, %r12
movq %rax, %rdi
movl $0x2e, %esi
callq 0x41a0
incq %rax
cmpq %r15, %rax
jae 0x5b914
cmpq %r15, %r12
jne 0x5b93f
movq %r15, %rdi
callq 0x41e0
movq %rax, %r12
addq %r15, %r12
movq %rsp, %rdi
movl $0x15c, %edx            # imm = 0x15C
xorl %esi, %esi
callq 0x4290
cmpb $0x0, (%r12)
jne 0x5b991
leaq 0x34942(%rip), %rdx     # 0x9029e
leaq 0x560(%rsp), %rdi
movl $0x400, %esi            # imm = 0x400
movq %r15, %rcx
xorl %eax, %eax
callq 0x4890
leaq 0x349aa(%rip), %rdx     # 0x90324
leaq 0x160(%rsp), %rdi
movl $0x400, %esi            # imm = 0x400
movq %r15, %rcx
xorl %eax, %eax
callq 0x4890
xorl %eax, %eax
leaq 0x34907(%rip), %rcx     # 0x902a1
movzbl (%r12,%rax), %edx
leal -0x5b(%rdx), %esi
leal 0x20(%rdx), %edi
cmpb $-0x1a, %sil
movzbl %dil, %esi
cmovbl %edx, %esi
movzbl (%rax,%rcx), %edx
leal -0x5b(%rdx), %edi
leal 0x20(%rdx), %r8d
cmpb $-0x1a, %dil
movzbl %r8b, %edi
cmovbl %edx, %edi
cmpb %dil, %sil
jne 0x5ba22
incq %rax
cmpl $0x3, %eax
jne 0x5b99a
jmp 0x5ba27
leaq 0x33681(%rip), %rsi     # 0x8f05d
movq %r15, %rdi
callq 0x3b111
testq %rax, %rax
je 0x5bbbc
movq 0x4c5b4(%rip), %rcx     # 0xa7fa8
cmpq %rax, (%rcx)
je 0x5bd61
movq 0x4c584(%rip), %rcx     # 0xa7f88
cmpq %rax, (%rcx)
je 0x5bd61
movq %rax, %rdi
callq 0x4550
testl %eax, %eax
je 0x5bd61
jmp 0x5bd51
cmpl $0x3, %eax
jne 0x5ba62
leaq 0x560(%rsp), %rdi
movq %r15, %rsi
callq 0x44e0
leaq 0x160(%rsp), %r13
movl $0x3ff, %edx            # imm = 0x3FF
movq %r13, %rdi
movq %r15, %rsi
callq 0x4240
movq %r13, %rdi
callq 0x41e0
movl $0x676d69, 0x15d(%rsp,%rax) # imm = 0x676D69
xorl %eax, %eax
leaq 0x348bc(%rip), %rcx     # 0x90327
movzbl (%r12,%rax), %edx
leal -0x5b(%rdx), %esi
leal 0x20(%rdx), %edi
cmpb $-0x1a, %sil
movzbl %dil, %esi
cmovbl %edx, %esi
movzbl (%rax,%rcx), %edx
leal -0x5b(%rdx), %edi
leal 0x20(%rdx), %r8d
cmpb $-0x1a, %dil
movzbl %r8b, %edi
cmovbl %edx, %edi
cmpb %dil, %sil
jne 0x5baa6
incq %rax
cmpl $0x3, %eax
jne 0x5ba6b
jmp 0x5baab
cmpl $0x3, %eax
jne 0x5bae6
leaq 0x560(%rsp), %rdi
movq %r15, %rsi
callq 0x44e0
leaq 0x160(%rsp), %r13
movl $0x3ff, %edx            # imm = 0x3FF
movq %r13, %rdi
movq %r15, %rsi
callq 0x4240
movq %r13, %rdi
callq 0x41e0
movl $0x726468, 0x55d(%rsp,%rax) # imm = 0x726468
xorl %eax, %eax
leaq 0x33775(%rip), %rcx     # 0x8f264
movzbl (%r12,%rax), %edx
leal -0x5b(%rdx), %esi
leal 0x20(%rdx), %edi
cmpb $-0x1a, %sil
movzbl %dil, %esi
cmovbl %edx, %esi
movzbl (%rax,%rcx), %edx
leal -0x5b(%rdx), %edi
leal 0x20(%rdx), %r8d
cmpb $-0x1a, %dil
movzbl %r8b, %edi
cmovbl %edx, %edi
cmpb %dil, %sil
jne 0x5bb2a
incq %rax
cmpl $0x3, %eax
jne 0x5baef
jmp 0x5bb2f
cmpl $0x3, %eax
jne 0x5bb4c
leaq 0x560(%rsp), %rdi
movl $0x3ff, %edx            # imm = 0x3FF
movq %r15, %rsi
callq 0x4240
movb $0x0, 0x160(%rsp)
movabsq $0x676d49430000015c, %rax # imm = 0x676D49430000015C
movq %rax, (%rsp)
movb $0x0, 0x8(%rsp)
movw $0x20, 0xe(%rsp)
movw $0x1000, 0x24(%rsp)     # imm = 0x1000
movb $0x72, 0x26(%rsp)
movw $0x4, 0x28(%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, 0x2a(%rsp)
movl $0x80040, 0x46(%rsp)    # imm = 0x80040
movl $0x3f800000, 0x70(%rsp) # imm = 0x3F800000
movl $0x0, 0x4c(%rsp)
testq %r14, %r14
je 0x5bbcf
movq (%r14), %xmm0
movss 0x8(%r14), %xmm1
jmp 0x5bbdf
leaq 0x3340f(%rip), %rdi     # 0x8efd2
xorl %eax, %eax
callq 0xbb10
jmp 0x5bd61
movdqa 0x12649(%rip), %xmm0    # 0x6e220
movss 0x126d1(%rip), %xmm1    # 0x6e2b0
movss %xmm1, 0x58(%rsp)
movq %xmm0, 0x50(%rsp)
cmpb $0x2d, 0x560(%rsp)
jne 0x5bc12
movzbl 0x561(%rsp), %eax
cmpl $0x2e, %eax
je 0x5bc06
testl %eax, %eax
jne 0x5bc12
movq 0x4c37b(%rip), %rax     # 0xa7f88
movq (%rax), %r14
jmp 0x5bc29
leaq 0x33444(%rip), %rsi     # 0x8f05d
leaq 0x560(%rsp), %rdi
callq 0x45d0
movq %rax, %r14
testq %r14, %r14
je 0x5bde3
movl $0x15c, %r13d           # imm = 0x15C
xorl %r15d, %r15d
movl $0x3f00000, %ebp        # imm = 0x3F00000
cmpq %rbp, %r13
movl $0x3f00000, %r12d       # imm = 0x3F00000
cmovbq %r13, %r12
leaq (%rsp,%r15), %rdi
movl $0x1, %esi
movq %r12, %rdx
movq %r14, %rcx
callq 0x4a80
addq %rax, %r15
subq %rax, %r13
cmpq %rax, %r12
jne 0x5bc71
testq %r13, %r13
jne 0x5bc40
testq %r13, %r13
je 0x5bc8c
leaq 0x35f88(%rip), %rdi     # 0x91c05
movl $0x15c, %edx            # imm = 0x15C
movq %r15, %rsi
xorl %eax, %eax
callq 0xbb10
cmpb $0x0, 0x160(%rsp)
je 0x5bd0a
movq 0x4c30b(%rip), %rax     # 0xa7fa8
movq 0x4c2e4(%rip), %r15     # 0xa7f88
cmpq %r14, (%rax)
je 0x5bcca
cmpq %r14, (%r15)
je 0x5bcca
movq %r14, %rdi
callq 0x4550
testl %eax, %eax
je 0x5bcca
leaq 0x3333b(%rip), %rdi     # 0x8effc
movl %eax, %esi
xorl %eax, %eax
callq 0xbb10
cmpb $0x2d, 0x160(%rsp)
jne 0x5bcea
movzbl 0x161(%rsp), %eax
cmpl $0x2e, %eax
je 0x5bce5
testl %eax, %eax
jne 0x5bcea
movq (%r15), %r14
jmp 0x5bd01
leaq 0x3336c(%rip), %rsi     # 0x8f05d
leaq 0x160(%rsp), %rdi
callq 0x45d0
movq %rax, %r14
testq %r14, %r14
je 0x5be12
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 0x5fea8
movq 0x4c274(%rip), %rax     # 0xa7fa8
cmpq %r14, (%rax)
je 0x5bd61
movq 0x4c248(%rip), %rax     # 0xa7f88
cmpq %r14, (%rax)
je 0x5bd61
movq %r14, %rdi
callq 0x4550
testl %eax, %eax
je 0x5bd61
leaq 0x332a4(%rip), %rdi     # 0x8effc
movl %eax, %esi
xorl %eax, %eax
callq 0xbb10
movq %rbx, %rax
addq $0x968, %rsp            # imm = 0x968
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 0x12ad1(%rip), %rax     # 0x6e868
leaq 0x13ea4(%rip), %r10     # 0x6fc42
cmpb $0x0, 0x10(%rbx)
cmovneq %rax, %r10
subq $0x8, %rsp
leaq 0x3336e(%rip), %r11     # 0x8f11f
leaq 0x36a2f(%rip), %rsi     # 0x927e7
movq %r14, %rdi
xorl %eax, %eax
pushq %r11
pushq %r10
pushq 0x18(%rbx)
callq 0xc16a
addq $0x20, %rsp
leaq 0x4be7c(%rip), %rsi     # 0xa7c50
movq 0x4c1f5(%rip), %rdx     # 0xa7fd0
movq %r14, %rdi
callq 0x4910
movl $0x4008, %edi           # imm = 0x4008
callq 0x4210
movq %rax, %rbx
leaq 0x3538b(%rip), %rsi     # 0x91182
leaq 0x3325f(%rip), %rcx     # 0x8f05d
leaq 0x560(%rsp), %rdx
movq %rax, %rdi
xorl %eax, %eax
callq 0x36908
jmp 0x5be3f
movl $0x4008, %edi           # imm = 0x4008
callq 0x4210
movq %rax, %rbx
leaq 0x3535c(%rip), %rsi     # 0x91182
leaq 0x33230(%rip), %rcx     # 0x8f05d
leaq 0x160(%rsp), %rdx
movq %rax, %rdi
xorl %eax, %eax
callq 0x36908
leaq 0x4beaa(%rip), %rsi     # 0xa7cf0
movq 0x4c183(%rip), %rdx     # 0xa7fd0
movq %rbx, %rdi
callq 0x4910
jmp 0x5be57
movq %rax, %r15
movq %rbx, %rdi
jmp 0x5be65
movq %rax, %r15
movq %r14, %rdi
callq 0x43c0
movq %r15, %rdi
callq 0x4960