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

      char command[1024] = { 0 }, filetmp[512] = { 0 }, body[512] = { 0 };
      std::FILE *file;
      do {
        cimg_snprintf(filetmp,sizeof(filetmp),"%s.hdr",cimg::filenamerand());
        if ((file=std::fopen(filetmp,"rb"))!=0) cimg::fclose(file);
      } while (file);
      save_analyze(filetmp);
      cimg_snprintf(command,sizeof(command),"%s -w -c dicom -o \"%s\" -f \"%s\"",
                    cimg::medcon_path(),
                    CImg<charT>::string(filename)._system_strescape().data(),
                    CImg<charT>::string(filetmp)._system_strescape().data());
      cimg::system(command);
      std::remove(filetmp);
      cimg::split_filename(filetmp,body);
      cimg_snprintf(filetmp,sizeof(filetmp),"%s.img",body);
      std::remove(filetmp);

      file = std::fopen(filename,"rb");
      if (!file) {
        cimg_snprintf(command,sizeof(command),"m000-%s",filename);
        file = std::fopen(command,"rb");
        if (!file) {
          cimg::fclose(cimg::fopen(filename,"r"));
          throw CImgIOException(_cimg_instance
                                "save_medcon_external(): Failed to save file '%s' with external command 'medcon'.",
                                cimg_instance,
                                filename);
        }
      }
      cimg::fclose(file);
      std::rename(command,filename);
      return *this;
    }

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x840, %rsp            # imm = 0x840
movq %rdi, %rbx
testq %rsi, %rsi
je 0x45490
movq %rsi, %r14
movq %rbx, %rdi
callq 0x8dc8
testb %al, %al
je 0x452be
xorl %edi, %edi
movq %r14, %rsi
callq 0x465c3
jmp 0x4547c
leaq 0x440(%rsp), %rdi
movl $0x400, %edx            # imm = 0x400
xorl %esi, %esi
callq 0x4280
leaq 0x40(%rsp), %r15
movl $0x200, %edx            # imm = 0x200
movq %r15, %rdi
xorl %esi, %esi
callq 0x4280
leaq 0x240(%rsp), %rdi
movl $0x200, %edx            # imm = 0x200
xorl %esi, %esi
callq 0x4280
leaq 0x30ef3(%rip), %r12     # 0x761f4
leaq 0x2ff33(%rip), %r13     # 0x7523b
callq 0x2a352
movl $0x200, %esi            # imm = 0x200
movq %r15, %rdi
movq %r12, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x4890
movq %r15, %rdi
movq %r13, %rsi
callq 0x45b0
testq %rax, %rax
je 0x4533c
movq %rax, %rdi
callq 0x2a2f8
jmp 0x45308
leaq 0x40(%rsp), %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x455b8
xorl %edi, %edi
xorl %esi, %esi
callq 0x29f2f
movq %rax, %r15
leaq 0x20(%rsp), %r12
pushq $0x1
popq %rdx
movq %r12, %rdi
movq %r14, %rsi
xorl %ecx, %ecx
callq 0x38750
movq %r12, %rdi
callq 0x387b0
movq 0x18(%rax), %r12
movq %rsp, %rdi
leaq 0x40(%rsp), %rsi
pushq $0x1
popq %rdx
xorl %ecx, %ecx
callq 0x38750
movq %rsp, %rdi
callq 0x387b0
movq 0x18(%rax), %r9
leaq 0x332fa(%rip), %rdx     # 0x78697
leaq 0x440(%rsp), %r13
movl $0x400, %esi            # imm = 0x400
movq %r13, %rdi
movq %r15, %rcx
movq %r12, %r8
xorl %eax, %eax
callq 0x4890
movq %rsp, %rdi
callq 0xdba4
leaq 0x20(%rsp), %rdi
callq 0xdba4
movq %r13, %rdi
xorl %esi, %esi
callq 0x2e487
leaq 0x40(%rsp), %r15
movq %r15, %rdi
callq 0x4990
leaq 0x240(%rsp), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x2cc28
leaq 0x30e7d(%rip), %rdx     # 0x7627a
movl $0x200, %esi            # imm = 0x200
movq %r15, %rdi
movq %r12, %rcx
xorl %eax, %eax
callq 0x4890
movq %r15, %rdi
callq 0x4990
leaq 0x2fe1d(%rip), %rsi     # 0x7523b
movq %r14, %rdi
callq 0x45b0
testq %rax, %rax
jne 0x45464
leaq 0x33284(%rip), %rdx     # 0x786b6
leaq 0x440(%rsp), %r15
movl $0x400, %esi            # imm = 0x400
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x4890
leaq 0x2fde8(%rip), %rsi     # 0x7523b
movq %r15, %rdi
callq 0x45b0
testq %rax, %rax
je 0x454fd
movq %rax, %rdi
callq 0x2a2f8
leaq 0x440(%rsp), %rdi
movq %r14, %rsi
callq 0x42d0
movq %rbx, %rax
addq $0x840, %rsp            # imm = 0x840
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
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 0xf337(%rip), %rax      # 0x547e8
leaq 0x1070a(%rip), %r10     # 0x55bc2
cmpb $0x0, 0x10(%rbx)
cmovneq %rax, %r10
subq $0x8, %rsp
leaq 0x2fbd4(%rip), %r11     # 0x7509f
leaq 0x33161(%rip), %rsi     # 0x78633
movq %r14, %rdi
xorl %eax, %eax
pushq %r11
pushq %r10
pushq 0x18(%rbx)
callq 0x9d52
addq $0x20, %rsp
leaq 0x4a772(%rip), %rsi     # 0x8fc60
movq 0x4aae3(%rip), %rdx     # 0x8ffd8
movq %r14, %rdi
callq 0x4910
leaq 0x1b28f(%rip), %rsi     # 0x60793
movq %r14, %rdi
callq 0x2dca5
movq %rax, %rdi
callq 0x2a2f8
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 0xf2b3(%rip), %rax      # 0x547e8
leaq 0x10686(%rip), %r10     # 0x55bc2
cmpb $0x0, 0x10(%rbx)
cmovneq %rax, %r10
leaq 0x2fb54(%rip), %r11     # 0x7509f
leaq 0x3316c(%rip), %rsi     # 0x786be
movq %r15, %rdi
xorl %eax, %eax
pushq %r14
pushq %r11
pushq %r10
pushq 0x18(%rbx)
callq 0x2a3de
addq $0x20, %rsp
leaq 0x4a790(%rip), %rsi     # 0x8fd00
movq 0x4aa61(%rip), %rdx     # 0x8ffd8
movq %r15, %rdi
callq 0x4910
movq %rax, %rbx
movq %r15, %rdi
jmp 0x455ab
movq %rax, %rbx
movq %rsp, %rdi
callq 0xdba4
jmp 0x45599
jmp 0x45596
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0xdba4
jmp 0x455b0
movq %rax, %rbx
movq %r14, %rdi
callq 0x4390
movq %rbx, %rdi
callq 0x4950