// File: 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 %r14
pushq %rbx
subq $0xa68, %rsp            # imm = 0xA68
movq %rdi, 0xa58(%rsp)
movq %rsi, 0xa50(%rsp)
movq %rdx, 0xa48(%rsp)
movq 0xa58(%rsp), %rax
movq %rax, 0xb0(%rsp)
cmpq $0x0, 0xa50(%rsp)
jne 0x9a4dd
movl $0x4008, %edi           # imm = 0x4008
callq 0x5240
movq %rax, %rcx
movq 0xb0(%rsp), %rax
movq %rcx, 0x80(%rsp)
movl (%rax), %ecx
movl %ecx, 0x88(%rsp)
movl 0x4(%rax), %ecx
movl %ecx, 0x8c(%rsp)
movl 0x8(%rax), %ecx
movl %ecx, 0x90(%rsp)
movl 0xc(%rax), %ecx
movl %ecx, 0x94(%rsp)
movq 0x18(%rax), %rcx
movq %rcx, 0x98(%rsp)
movb 0x10(%rax), %dl
leaq 0x4e5b7(%rip), %rcx     # 0xe89d2
leaq 0x2f6bf(%rip), %rax     # 0xc9ae1
testb $0x1, %dl
cmovneq %rcx, %rax
movq %rax, 0xa0(%rsp)
callq 0x118f0
movq %rax, 0xa8(%rsp)
jmp 0x9a440
movl 0x94(%rsp), %r9d
movl 0x90(%rsp), %r8d
movl 0x8c(%rsp), %ecx
movl 0x88(%rsp), %edx
movq 0x80(%rsp), %rdi
movq 0x98(%rsp), %rsi
movq 0xa0(%rsp), %r10
movq 0xa8(%rsp), %r11
movq %rsp, %rax
movq %r11, 0x10(%rax)
movq %r10, 0x8(%rax)
movq %rsi, (%rax)
leaq 0x52229(%rip), %rsi     # 0xec6bc
xorl %eax, %eax
callq 0x12220
jmp 0x9a49c
movq 0x80(%rsp), %rdi
leaq 0x656b5(%rip), %rsi     # 0xffb60
leaq -0x88052(%rip), %rdx    # 0x12460
callq 0x5920
movq 0x80(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xa40(%rsp)
movl %eax, 0xa3c(%rsp)
callq 0x53a0
jmp 0x9abd0
movq 0xb0(%rsp), %rdi
callq 0x10320
testb $0x1, %al
jne 0x9a4f0
jmp 0x9a516
movq 0xa50(%rsp), %rsi
xorl %eax, %eax
movl %eax, %edi
callq 0x9c310
movq 0xb0(%rsp), %rax
movq %rax, 0xa60(%rsp)
jmp 0x9abbd
leaq 0x8d0(%rsp), %rdi
xorl %esi, %esi
movl $0x15c, %edx            # imm = 0x15C
callq 0x52a0
leaq 0x4d0(%rsp), %rdi
xorl %esi, %esi
movl $0x400, %edx            # imm = 0x400
callq 0x52a0
leaq 0xd0(%rsp), %rdi
xorl %esi, %esi
movl $0x400, %edx            # imm = 0x400
callq 0x52a0
movq 0xa50(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x63280
movq %rax, 0xc8(%rsp)
movw $0xffff, 0xc6(%rsp)     # imm = 0xFFFF
leaq 0x8d0(%rsp), %rdi
xorl %esi, %esi
movl $0x15c, %edx            # imm = 0x15C
callq 0x52a0
movq 0xc8(%rsp), %rax
cmpb $0x0, (%rax)
jne 0x9a5dc
leaq 0x4d0(%rsp), %rdi
movq 0xa50(%rsp), %rcx
movl $0x400, %esi            # imm = 0x400
leaq 0x4fb67(%rip), %rdx     # 0xea119
movb $0x0, %al
callq 0x5890
leaq 0xd0(%rsp), %rdi
movq 0xa50(%rsp), %rcx
movl $0x400, %esi            # imm = 0x400
leaq 0x4fbca(%rip), %rdx     # 0xea19f
movb $0x0, %al
callq 0x5890
movq 0xc8(%rsp), %rdi
leaq 0x4fb31(%rip), %rsi     # 0xea11c
movl $0x3, %edx
callq 0x3afa0
cmpl $0x0, %eax
jne 0x9a65d
leaq 0x4d0(%rsp), %rdi
movq 0xa50(%rsp), %rsi
callq 0x54d0
leaq 0xd0(%rsp), %rdi
movq 0xa50(%rsp), %rsi
movl $0x3ff, %edx            # imm = 0x3FF
callq 0x5270
leaq 0xd0(%rsp), %rax
movq %rax, 0x78(%rsp)
leaq 0xd0(%rsp), %rdi
callq 0x5210
movq 0x78(%rsp), %rdi
addq %rax, %rdi
addq $-0x3, %rdi
leaq 0x4fb4c(%rip), %rsi     # 0xea1a2
movb $0x0, %al
callq 0x50a0
movq 0xc8(%rsp), %rdi
leaq 0x4fb36(%rip), %rsi     # 0xea1a2
movl $0x3, %edx
callq 0x3afa0
cmpl $0x0, %eax
jne 0x9a6de
leaq 0x4d0(%rsp), %rdi
movq 0xa50(%rsp), %rsi
callq 0x54d0
leaq 0xd0(%rsp), %rdi
movq 0xa50(%rsp), %rsi
movl $0x3ff, %edx            # imm = 0x3FF
callq 0x5270
leaq 0x4d0(%rsp), %rax
movq %rax, 0x70(%rsp)
leaq 0xd0(%rsp), %rdi
callq 0x5210
movq 0x70(%rsp), %rdi
addq %rax, %rdi
addq $-0x3, %rdi
leaq 0x4fa45(%rip), %rsi     # 0xea11c
movb $0x0, %al
callq 0x50a0
movq 0xc8(%rsp), %rdi
leaq 0x4e9f0(%rip), %rsi     # 0xe90dd
movl $0x3, %edx
callq 0x3afa0
cmpl $0x0, %eax
jne 0x9a71e
leaq 0x4d0(%rsp), %rdi
movq 0xa50(%rsp), %rsi
movl $0x3ff, %edx            # imm = 0x3FF
callq 0x5270
movb $0x0, 0xd0(%rsp)
leaq 0x8d0(%rsp), %rax
movq %rax, 0xb8(%rsp)
movq 0xb8(%rsp), %rax
movl $0x15c, (%rax)          # imm = 0x15C
leaq 0x8d0(%rsp), %rdi
addq $0x4, %rdi
leaq 0x4dfde(%rip), %rsi     # 0xe872d
callq 0x54d0
leaq 0x8d0(%rsp), %rdi
addq $0xe, %rdi
leaq 0x51168(%rip), %rsi     # 0xeb8cf
callq 0x54d0
movq 0xb0(%rsp), %rax
movw $0x1000, 0x8f4(%rsp)    # imm = 0x1000
movb $0x72, 0x8f6(%rsp)
movw $0x4, 0x8f8(%rsp)
movl (%rax), %ecx
movw %cx, 0x8fa(%rsp)
movl 0x4(%rax), %ecx
movw %cx, 0x8fc(%rsp)
movl 0x8(%rax), %ecx
movw %cx, 0x8fe(%rsp)
movl 0xc(%rax), %eax
movw %ax, 0x900(%rsp)
callq 0x118f0
movq %rax, %rdi
leaq 0x5035b(%rip), %rsi     # 0xeab25
callq 0x633b0
cmpl $0x0, %eax
jne 0x9a7de
movw $0x2, 0xc6(%rsp)
callq 0x118f0
movq %rax, %rdi
leaq 0x39eb9(%rip), %rsi     # 0xd46a6
callq 0x633b0
cmpl $0x0, %eax
jne 0x9a801
movw $0x2, 0xc6(%rsp)
callq 0x118f0
movq %rax, %rdi
leaq 0x39e9f(%rip), %rsi     # 0xd46af
callq 0x633b0
cmpl $0x0, %eax
jne 0x9a824
movw $0x2, 0xc6(%rsp)
callq 0x118f0
movq %rax, %rdi
leaq 0x4f347(%rip), %rsi     # 0xe9b7a
callq 0x633b0
cmpl $0x0, %eax
jne 0x9a847
movw $0x4, 0xc6(%rsp)
callq 0x118f0
movq %rax, %rdi
leaq 0x4f32d(%rip), %rsi     # 0xe9b83
callq 0x633b0
cmpl $0x0, %eax
jne 0x9a86a
movw $0x4, 0xc6(%rsp)
callq 0x118f0
movq %rax, %rdi
leaq 0x4dbf7(%rip), %rsi     # 0xe8470
callq 0x633b0
cmpl $0x0, %eax
jne 0x9a88d
movw $0x8, 0xc6(%rsp)
callq 0x118f0
movq %rax, %rdi
leaq 0x4dbdd(%rip), %rsi     # 0xe8479
callq 0x633b0
cmpl $0x0, %eax
jne 0x9a8b0
movw $0x8, 0xc6(%rsp)
callq 0x118f0
movq %rax, %rdi
leaq 0x4db9d(%rip), %rsi     # 0xe845c
callq 0x633b0
cmpl $0x0, %eax
jne 0x9a8d3
movw $0x8, 0xc6(%rsp)
callq 0x118f0
movq %rax, %rdi
leaq 0x4db83(%rip), %rsi     # 0xe8465
callq 0x633b0
cmpl $0x0, %eax
jne 0x9a8f6
movw $0x8, 0xc6(%rsp)
callq 0x118f0
movq %rax, %rdi
leaq 0x4db65(%rip), %rsi     # 0xe846a
callq 0x633b0
cmpl $0x0, %eax
jne 0x9a919
movw $0x10, 0xc6(%rsp)
callq 0x118f0
movq %rax, %rdi
leaq 0x4e69a(%rip), %rsi     # 0xe8fc2
callq 0x633b0
cmpl $0x0, %eax
jne 0x9a93c
movw $0x40, 0xc6(%rsp)
movswl 0xc6(%rsp), %eax
cmpl $0x0, %eax
jge 0x9aa54
movl $0x4008, %edi           # imm = 0x4008
callq 0x5240
movq %rax, %rcx
movq 0xb0(%rsp), %rax
movq %rcx, 0x40(%rsp)
movl (%rax), %ecx
movl %ecx, 0x48(%rsp)
movl 0x4(%rax), %ecx
movl %ecx, 0x4c(%rsp)
movl 0x8(%rax), %ecx
movl %ecx, 0x50(%rsp)
movl 0xc(%rax), %ecx
movl %ecx, 0x54(%rsp)
movq 0x18(%rax), %rcx
movq %rcx, 0x58(%rsp)
movb 0x10(%rax), %dl
leaq 0x4e03d(%rip), %rcx     # 0xe89d2
leaq 0x2f145(%rip), %rax     # 0xc9ae1
testb $0x1, %dl
cmovneq %rcx, %rax
movq %rax, 0x60(%rsp)
callq 0x118f0
movq %rax, 0x68(%rsp)
jmp 0x9a9b4
callq 0x118f0
movq %rax, 0x38(%rsp)
jmp 0x9a9c0
movl 0x54(%rsp), %r9d
movl 0x50(%rsp), %r8d
movl 0x4c(%rsp), %ecx
movl 0x48(%rsp), %edx
movq 0x40(%rsp), %rdi
movq 0x58(%rsp), %rsi
movq 0x60(%rsp), %r10
movq 0x68(%rsp), %r11
movq 0x38(%rsp), %rbx
movq 0xa50(%rsp), %r14
movq %rsp, %rax
movq %r14, 0x20(%rax)
movq %rbx, 0x18(%rax)
movq %r11, 0x10(%rax)
movq %r10, 0x8(%rax)
movq %rsi, (%rax)
leaq 0x51d08(%rip), %rsi     # 0xec718
xorl %eax, %eax
callq 0x5c880
jmp 0x9aa19
movq 0x40(%rsp), %rdi
leaq 0x6524b(%rip), %rsi     # 0xffc70
leaq -0x3df6c(%rip), %rdx    # 0x5cac0
callq 0x5920
movq 0x40(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xa40(%rsp)
movl %eax, 0xa3c(%rsp)
callq 0x53a0
jmp 0x9abd0
movw 0xc6(%rsp), %ax
movw %ax, 0x916(%rsp)
movw $0x8, 0x918(%rsp)
movss 0x2d6aa(%rip), %xmm0    # 0xc8120
movss %xmm0, 0x940(%rsp)
xorps %xmm0, %xmm0
movss %xmm0, 0x91c(%rsp)
cmpq $0x0, 0xa48(%rsp)
je 0x9aad9
movq 0xa48(%rsp), %rax
movss (%rax), %xmm0
movss %xmm0, 0x920(%rsp)
movq 0xa48(%rsp), %rax
movss 0x4(%rax), %xmm0
movss %xmm0, 0x924(%rsp)
movq 0xa48(%rsp), %rax
movss 0x8(%rax), %xmm0
movss %xmm0, 0x928(%rsp)
jmp 0x9ab0c
movss 0x2d63f(%rip), %xmm0    # 0xc8120
movss %xmm0, 0x928(%rsp)
movss 0x2d62e(%rip), %xmm0    # 0xc8120
movss %xmm0, 0x924(%rsp)
movss 0x2d61d(%rip), %xmm0    # 0xc8120
movss %xmm0, 0x920(%rsp)
leaq 0x4d0(%rsp), %rdi
leaq 0x4e3e5(%rip), %rsi     # 0xe8f00
callq 0x654a0
movq %rax, 0xa30(%rsp)
leaq 0x8d0(%rsp), %rdi
movq 0xa30(%rsp), %rdx
movl $0x15c, %esi            # imm = 0x15C
callq 0xa28b0
cmpb $0x0, 0xd0(%rsp)
je 0x9ab75
movq 0xa30(%rsp), %rdi
callq 0x5c6f0
leaq 0xd0(%rsp), %rdi
leaq 0x4e398(%rip), %rsi     # 0xe8f00
callq 0x654a0
movq %rax, 0xa30(%rsp)
movq 0xb0(%rsp), %rdi
movq 0x18(%rdi), %rax
movq %rax, 0x30(%rsp)
callq 0x117b0
movq 0x30(%rsp), %rdi
movq %rax, %rsi
movq 0xa30(%rsp), %rdx
callq 0xa2680
movq 0xa30(%rsp), %rdi
callq 0x5c6f0
movq 0xb0(%rsp), %rax
movq %rax, 0xa60(%rsp)
movq 0xa60(%rsp), %rax
addq $0xa68, %rsp            # imm = 0xA68
popq %rbx
popq %r14
retq
movq 0xa40(%rsp), %rdi
callq 0x5970
nopl (%rax)