// File: /workspace/github_cpp_makefile_star2_O1/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 0x5e90a
movq %rsi, %r14
cmpq $0x0, 0x18(%rbx)
je 0x5e70d
movdqu (%rbx), %xmm0
pxor %xmm1, %xmm1
pcmpeqd %xmm0, %xmm1
movmskps %xmm1, %eax
testb %al, %al
jne 0x5e70d
movq %rdx, %r15
movq %rsp, %rdi
movl $0x15c, %edx            # imm = 0x15C
xorl %esi, %esi
callq 0x4290
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 %r14, %rax
movq %rax, %r12
movq %rax, %rdi
movl $0x2e, %esi
callq 0x41a0
incq %rax
cmpq %r14, %rax
jae 0x5e465
cmpq %r14, %r12
jne 0x5e490
movq %r14, %rdi
callq 0x41e0
movq %rax, %r12
addq %r14, %r12
movq %rsp, %rdi
movl $0x15c, %edx            # imm = 0x15C
xorl %esi, %esi
callq 0x4290
cmpb $0x0, (%r12)
jne 0x5e4e2
leaq 0x368c1(%rip), %rdx     # 0x94d6e
leaq 0x560(%rsp), %rdi
movl $0x400, %esi            # imm = 0x400
movq %r14, %rcx
xorl %eax, %eax
callq 0x4880
leaq 0x36929(%rip), %rdx     # 0x94df4
leaq 0x160(%rsp), %rdi
movl $0x400, %esi            # imm = 0x400
movq %r14, %rcx
xorl %eax, %eax
callq 0x4880
xorl %eax, %eax
leaq 0x36886(%rip), %rcx     # 0x94d71
movzbl (%r12,%rax), %esi
leal -0x5b(%rsi), %edx
leal 0x20(%rsi), %edi
cmpb $-0x1a, %dl
movzbl %dil, %edx
cmovbl %esi, %edx
movzbl (%rax,%rcx), %edi
leal -0x5b(%rdi), %esi
leal 0x20(%rdi), %r8d
cmpb $-0x1a, %sil
movzbl %r8b, %esi
cmovbl %edi, %esi
cmpb %sil, %dl
jne 0x5e528
incq %rax
cmpl $0x3, %eax
jne 0x5e4eb
movl $0x3, %eax
cmpl $0x3, %eax
setne %al
cmpb %sil, %dl
setne %cl
testb %al, %cl
jne 0x5e573
leaq 0x560(%rsp), %rdi
movq %r14, %rsi
callq 0x44d0
leaq 0x160(%rsp), %r13
movl $0x3ff, %edx            # imm = 0x3FF
movq %r13, %rdi
movq %r14, %rsi
callq 0x4240
movq %r13, %rdi
callq 0x41e0
movl $0x676d69, 0x15d(%rsp,%rax) # imm = 0x676D69
xorl %eax, %eax
leaq 0x3687b(%rip), %rcx     # 0x94df7
movzbl (%r12,%rax), %esi
leal -0x5b(%rsi), %edx
leal 0x20(%rsi), %edi
cmpb $-0x1a, %dl
movzbl %dil, %edx
cmovbl %esi, %edx
movzbl (%rax,%rcx), %edi
leal -0x5b(%rdi), %esi
leal 0x20(%rdi), %r8d
cmpb $-0x1a, %sil
movzbl %r8b, %esi
cmovbl %edi, %esi
cmpb %sil, %dl
jne 0x5e5b9
incq %rax
cmpl $0x3, %eax
jne 0x5e57c
movl $0x3, %eax
cmpl $0x3, %eax
setne %al
cmpb %sil, %dl
setne %cl
testb %al, %cl
jne 0x5e604
leaq 0x560(%rsp), %rdi
movq %r14, %rsi
callq 0x44d0
leaq 0x160(%rsp), %r13
movl $0x3ff, %edx            # imm = 0x3FF
movq %r13, %rdi
movq %r14, %rsi
callq 0x4240
movq %r13, %rdi
callq 0x41e0
movl $0x726468, 0x55d(%rsp,%rax) # imm = 0x726468
xorl %eax, %eax
leaq 0x35727(%rip), %rcx     # 0x93d34
movzbl (%r12,%rax), %esi
leal -0x5b(%rsi), %edx
leal 0x20(%rsi), %edi
cmpb $-0x1a, %dl
movzbl %dil, %edx
cmovbl %esi, %edx
movzbl (%rax,%rcx), %edi
leal -0x5b(%rdi), %esi
leal 0x20(%rdi), %r8d
cmpb $-0x1a, %sil
movzbl %r8b, %esi
cmovbl %edi, %esi
cmpb %sil, %dl
jne 0x5e64a
incq %rax
cmpl $0x3, %eax
jne 0x5e60d
movl $0x3, %eax
cmpl $0x3, %eax
setne %al
cmpb %sil, %dl
setne %cl
testb %al, %cl
jne 0x5e677
leaq 0x560(%rsp), %rdi
movl $0x3ff, %edx            # imm = 0x3FF
movq %r14, %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)
xorl %eax, %eax
xorl %ecx, %ecx
testb %al, %al
jne 0x5e6cd
incq %rcx
cmpl $0x7, %ecx
jne 0x5e6c1
movb $0x1, %al
testb %al, %al
je 0x5e96d
movl $0x80040, 0x46(%rsp)    # imm = 0x80040
movl $0x3f800000, 0x70(%rsp) # imm = 0x3F800000
movl $0x0, 0x4c(%rsp)
testq %r15, %r15
je 0x5e769
movsd (%r15), %xmm0
movsd %xmm0, 0x50(%rsp)
movd 0x8(%r15), %xmm0
movd %xmm0, 0x58(%rsp)
jmp 0x5e77f
leaq 0x35419(%rip), %rsi     # 0x93b2d
movq %r14, %rdi
callq 0x3ceb3
testq %rax, %rax
je 0x5e756
movq 0x4e880(%rip), %rcx     # 0xacfa8
cmpq %rax, (%rcx)
je 0x5e8f5
movq 0x4e850(%rip), %rcx     # 0xacf88
cmpq %rax, (%rcx)
je 0x5e8f5
movq %rax, %rdi
callq 0x4540
testl %eax, %eax
je 0x5e8f5
jmp 0x5e8e5
leaq 0x35345(%rip), %rdi     # 0x93aa2
xorl %eax, %eax
callq 0xbb52
jmp 0x5e8f5
movl $0x3f800000, 0x58(%rsp) # imm = 0x3F800000
movq 0x12a97(%rip), %xmm0    # 0x71210
movq %xmm0, 0x50(%rsp)
cmpb $0x2d, 0x560(%rsp)
jne 0x5e7a6
movzbl 0x561(%rsp), %eax
cmpl $0x2e, %eax
je 0x5e79a
testl %eax, %eax
jne 0x5e7a6
movq 0x4e7e7(%rip), %rax     # 0xacf88
movq (%rax), %r14
jmp 0x5e7bd
leaq 0x35380(%rip), %rsi     # 0x93b2d
leaq 0x560(%rsp), %rdi
callq 0x45c0
movq %rax, %r14
testq %r14, %r14
je 0x5e9de
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 0x4a70
addq %rax, %r15
subq %rax, %r13
cmpq %rax, %r12
jne 0x5e805
testq %r13, %r13
jne 0x5e7d4
testq %r13, %r13
je 0x5e820
leaq 0x37ec4(%rip), %rdi     # 0x966d5
movl $0x15c, %edx            # imm = 0x15C
movq %r15, %rsi
xorl %eax, %eax
callq 0xbb52
cmpb $0x0, 0x160(%rsp)
je 0x5e89e
movq 0x4e777(%rip), %rax     # 0xacfa8
movq 0x4e750(%rip), %r15     # 0xacf88
cmpq %r14, (%rax)
je 0x5e85e
cmpq %r14, (%r15)
je 0x5e85e
movq %r14, %rdi
callq 0x4540
testl %eax, %eax
je 0x5e85e
leaq 0x35277(%rip), %rdi     # 0x93acc
movl %eax, %esi
xorl %eax, %eax
callq 0xbb52
cmpb $0x2d, 0x160(%rsp)
jne 0x5e87e
movzbl 0x161(%rsp), %eax
cmpl $0x2e, %eax
je 0x5e879
testl %eax, %eax
jne 0x5e87e
movq (%r15), %r14
jmp 0x5e895
leaq 0x352a8(%rip), %rsi     # 0x93b2d
leaq 0x160(%rsp), %rdi
callq 0x45c0
movq %rax, %r14
testq %r14, %r14
je 0x5ea0d
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 0x629f4
movq 0x4e6e0(%rip), %rax     # 0xacfa8
cmpq %r14, (%rax)
je 0x5e8f5
movq 0x4e6b4(%rip), %rax     # 0xacf88
cmpq %r14, (%rax)
je 0x5e8f5
movq %r14, %rdi
callq 0x4540
testl %eax, %eax
je 0x5e8f5
leaq 0x351e0(%rip), %rdi     # 0x93acc
movl %eax, %esi
xorl %eax, %eax
callq 0xbb52
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 0x14a0d(%rip), %rax     # 0x73338
leaq 0x15de0(%rip), %r10     # 0x74712
cmpb $0x0, 0x10(%rbx)
cmovneq %rax, %r10
subq $0x8, %rsp
leaq 0x352aa(%rip), %r11     # 0x93bef
leaq 0x3896b(%rip), %rsi     # 0x972b7
movq %r14, %rdi
xorl %eax, %eax
pushq %r11
pushq %r10
pushq 0x18(%rbx)
callq 0xc196
addq $0x20, %rsp
leaq 0x4e2b8(%rip), %rsi     # 0xacc20
jmp 0x5ea41
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 0x149aa(%rip), %rax     # 0x73338
leaq 0x15d7d(%rip), %r10     # 0x74712
cmpb $0x0, 0x10(%rbx)
cmovneq %rax, %r10
subq $0x8, %rsp
leaq 0x35247(%rip), %r11     # 0x93bef
leaq 0x38964(%rip), %rsi     # 0x97313
movq %r15, %rdi
xorl %eax, %eax
pushq %r14
pushq %r11
pushq %r11
pushq %r10
pushq 0x18(%rbx)
callq 0x385b4
addq $0x30, %rsp
leaq 0x4e321(%rip), %rsi     # 0xaccf0
movq 0x4e5fa(%rip), %rdx     # 0xacfd0
movq %r15, %rdi
callq 0x4900
movl $0x4008, %edi           # imm = 0x4008
callq 0x4210
movq %rax, %r14
leaq 0x37260(%rip), %rsi     # 0x95c52
leaq 0x35134(%rip), %rcx     # 0x93b2d
leaq 0x560(%rsp), %rdx
movq %rax, %rdi
xorl %eax, %eax
callq 0x385b4
jmp 0x5ea3a
movl $0x4008, %edi           # imm = 0x4008
callq 0x4210
movq %rax, %r14
leaq 0x37231(%rip), %rsi     # 0x95c52
leaq 0x35105(%rip), %rcx     # 0x93b2d
leaq 0x160(%rsp), %rdx
movq %rax, %rdi
xorl %eax, %eax
callq 0x385b4
leaq 0x4e2af(%rip), %rsi     # 0xaccf0
movq 0x4e588(%rip), %rdx     # 0xacfd0
movq %r14, %rdi
callq 0x4900
jmp 0x5ea5c
jmp 0x5ea5c
movq %rax, %rbx
movq %r15, %rdi
jmp 0x5ea62
movq %rax, %rbx
movq %r14, %rdi
callq 0x43b0
movq %rbx, %rdi
callq 0x4950
nop