// File: kallaballa[P]PixelStencil/./CImg.h
// Function: cimg_library::CImg<unsigned char>::load_imagemagick_external(char const*)
CImg<T>& load_imagemagick_external(const char *const filename) {
      if (!filename)
        throw CImgArgumentException(_cimg_instance
                                    "load_imagemagick_external(): Specified filename is (null).",
                                    cimg_instance);
      std::fclose(cimg::fopen(filename,"rb"));            // Check if file exists.
      char command[1024] = { 0 }, filetmp[512] = { 0 };
      std::FILE *file = 0;
      const CImg<charT> s_filename = CImg<charT>::string(filename)._system_strescape();
#if cimg_OS==1
      cimg_snprintf(command,sizeof(command),"%s \"%s\" pnm:-",
                    cimg::imagemagick_path(),s_filename.data());
      file = popen(command,"r");
      if (file) {
        const unsigned int omode = cimg::exception_mode();
        cimg::exception_mode() = 0;
        try { load_pnm(file); } catch (...) {
          pclose(file);
          cimg::exception_mode() = omode;
          throw CImgIOException(_cimg_instance
                                "load_imagemagick_external(): Failed to load file '%s' with external command 'convert'.",
                                cimg_instance,
                                filename);
        }
        pclose(file);
        return *this;
      }
#endif
      do {
        cimg_snprintf(filetmp,sizeof(filetmp),"%s%c%s.pnm",cimg::temporary_path(),cimg_file_separator,cimg::filenamerand());
        if ((file=std::fopen(filetmp,"rb"))!=0) cimg::fclose(file);
      } while (file);
      cimg_snprintf(command,sizeof(command),"%s \"%s\" \"%s\"",
                    cimg::imagemagick_path(),s_filename.data(),CImg<charT>::string(filetmp)._system_strescape().data());
      cimg::system(command,cimg::imagemagick_path());
      if (!(file = std::fopen(filetmp,"rb"))) {
        cimg::fclose(cimg::fopen(filename,"r"));
        throw CImgIOException(_cimg_instance
                              "load_imagemagick_external(): Failed to load file '%s' with external command 'convert'.",
                              cimg_instance,
                              filename);

      } else cimg::fclose(file);
      load_pnm(filetmp);
      std::remove(filetmp);
      return *this;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x808, %rsp            # imm = 0x808
movq %rdi, -0x18(%rbp)
movq %rsi, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x6a8(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x3c45b
movl $0x4008, %edi           # imm = 0x4008
callq 0x4190
movq %rax, %rcx
movq -0x6a8(%rbp), %rax
movq %rcx, -0x6d8(%rbp)
movl (%rax), %ecx
movl %ecx, -0x6d0(%rbp)
movl 0x4(%rax), %ecx
movl %ecx, -0x6cc(%rbp)
movl 0x8(%rax), %ecx
movl %ecx, -0x6c8(%rbp)
movl 0xc(%rax), %ecx
movl %ecx, -0x6c4(%rbp)
movq 0x18(%rax), %rcx
movq %rcx, -0x6c0(%rbp)
movb 0x10(%rax), %dl
leaq 0x63b3(%rip), %rcx      # 0x42760
leaq 0x6165(%rip), %rax      # 0x42519
testb $0x1, %dl
cmovneq %rcx, %rax
movq %rax, -0x6b8(%rbp)
callq 0x8cc0
movq %rax, -0x6b0(%rbp)
jmp 0x3c3d0
movl -0x6c4(%rbp), %r9d
movl -0x6c8(%rbp), %r8d
movl -0x6cc(%rbp), %ecx
movl -0x6d0(%rbp), %edx
movq -0x6d8(%rbp), %rdi
movq -0x6c0(%rbp), %rsi
movq -0x6b8(%rbp), %r10
movq -0x6b0(%rbp), %r11
movq %rsp, %rax
movq %r11, 0x10(%rax)
movq %r10, 0x8(%rax)
movq %rsi, (%rax)
leaq 0x8ddf(%rip), %rsi      # 0x451fa
xorl %eax, %eax
callq 0x8cd0
jmp 0x3c424
movq -0x6d8(%rbp), %rdi
leaq 0x137b6(%rip), %rsi     # 0x4fbe8
leaq -0x335f9(%rip), %rdx    # 0x8e40
callq 0x4600
movq -0x6d8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
callq 0x4270
jmp 0x3cb1d
movq -0x20(%rbp), %rdi
leaq 0x61bc(%rip), %rsi      # 0x42622
callq 0xb540
movq %rax, %rdi
callq 0x4360
leaq -0x430(%rbp), %rdi
xorl %esi, %esi
movl %esi, -0x6ec(%rbp)
movl $0x400, %edx            # imm = 0x400
callq 0x41c0
movl -0x6ec(%rbp), %esi
leaq -0x630(%rbp), %rdi
movl $0x200, %edx            # imm = 0x200
callq 0x41c0
movq $0x0, -0x638(%rbp)
movq -0x20(%rbp), %rsi
leaq -0x678(%rbp), %rdi
movq %rdi, -0x6e8(%rbp)
movl $0x1, %edx
callq 0x227e0
movq -0x6e8(%rbp), %rdi
callq 0x22870
movq %rax, -0x6e0(%rbp)
jmp 0x3c4df
movq -0x6e0(%rbp), %rsi
leaq -0x658(%rbp), %rdi
callq 0x22f80
jmp 0x3c4f4
leaq -0x678(%rbp), %rdi
callq 0x23230
leaq -0x430(%rbp), %rax
movq %rax, -0x700(%rbp)
xorl %esi, %esi
movl %esi, %edi
callq 0xc880
movq %rax, -0x6f8(%rbp)
jmp 0x3c520
leaq -0x658(%rbp), %rdi
callq 0x233c0
movq -0x700(%rbp), %rdi
movq -0x6f8(%rbp), %rcx
movq %rax, %r8
leaq 0x8d1f(%rip), %rdx      # 0x45263
xorl %eax, %eax
movl $0x400, %esi            # imm = 0x400
callq 0x45b0
leaq 0x6189(%rip), %rsi      # 0x426e0
leaq -0x430(%rbp), %rdi
callq 0x40f0
movq %rax, -0x708(%rbp)
jmp 0x3c56c
movq -0x708(%rbp), %rax
movq %rax, -0x638(%rbp)
cmpq $0x0, -0x638(%rbp)
je 0x3c79f
callq 0x9520
movq %rax, -0x710(%rbp)
jmp 0x3c596
movq -0x710(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x67c(%rbp)
callq 0x9520
movq %rax, -0x718(%rbp)
jmp 0x3c5b3
movq -0x6a8(%rbp), %rdi
movq -0x718(%rbp), %rax
movl $0x0, (%rax)
movq -0x638(%rbp), %rsi
callq 0x233e0
jmp 0x3c5d5
jmp 0x3c777
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x678(%rbp), %rdi
callq 0x23230
jmp 0x3cb1d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x3cb11
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
movq -0x28(%rbp), %rdi
callq 0x4130
movq -0x638(%rbp), %rdi
callq 0x44e0
jmp 0x3c62b
movl -0x67c(%rbp), %eax
movl %eax, -0x724(%rbp)
callq 0x9520
movq %rax, -0x720(%rbp)
jmp 0x3c645
movq -0x720(%rbp), %rax
movl -0x724(%rbp), %ecx
movl %ecx, (%rax)
movl $0x4008, %edi           # imm = 0x4008
callq 0x4190
movq %rax, %rcx
movq -0x6a8(%rbp), %rax
movq %rcx, -0x758(%rbp)
movl (%rax), %ecx
movl %ecx, -0x750(%rbp)
movl 0x4(%rax), %ecx
movl %ecx, -0x74c(%rbp)
movl 0x8(%rax), %ecx
movl %ecx, -0x748(%rbp)
movl 0xc(%rax), %ecx
movl %ecx, -0x744(%rbp)
movq 0x18(%rax), %rcx
movq %rcx, -0x740(%rbp)
movb 0x10(%rax), %dl
leaq 0x60b9(%rip), %rcx      # 0x42760
leaq 0x5e6b(%rip), %rax      # 0x42519
testb $0x1, %dl
cmovneq %rcx, %rax
movq %rax, -0x738(%rbp)
callq 0x8cc0
movq %rax, -0x730(%rbp)
jmp 0x3c6ca
movl -0x744(%rbp), %r9d
movl -0x748(%rbp), %r8d
movl -0x74c(%rbp), %ecx
movl -0x750(%rbp), %edx
movq -0x758(%rbp), %rdi
movq -0x740(%rbp), %rsi
movq -0x738(%rbp), %r10
movq -0x730(%rbp), %r11
movq -0x20(%rbp), %rbx
movq %rsp, %rax
movq %rbx, 0x18(%rax)
movq %r11, 0x10(%rax)
movq %r10, 0x8(%rax)
movq %rsi, (%rax)
leaq 0x8b54(%rip), %rsi      # 0x45271
xorl %eax, %eax
callq 0xb3b0
jmp 0x3c726
movq -0x758(%rbp), %rdi
leaq 0x134cc(%rip), %rsi     # 0x4fc00
leaq -0x3121b(%rip), %rdx    # 0xb520
callq 0x4600
jmp 0x3cb2e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x3c76b
movq -0x758(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
callq 0x4270
callq 0x45f0
jmp 0x3c772
jmp 0x3cb11
movq -0x638(%rbp), %rdi
callq 0x44e0
jmp 0x3c785
movq -0x6a8(%rbp), %rax
movq %rax, -0x10(%rbp)
movl $0x1, -0x680(%rbp)
jmp 0x3caf7
jmp 0x3c7a1
leaq -0x630(%rbp), %rax
movq %rax, -0x768(%rbp)
xorl %esi, %esi
movl %esi, %edi
callq 0xcc70
movq %rax, -0x760(%rbp)
jmp 0x3c7c1
callq 0xd260
movq %rax, -0x770(%rbp)
jmp 0x3c7cf
movq -0x770(%rbp), %r9
movq -0x760(%rbp), %rcx
movq -0x768(%rbp), %rdi
leaq 0x8b0b(%rip), %rdx      # 0x452f6
xorl %eax, %eax
movl $0x200, %esi            # imm = 0x200
movl $0x2f, %r8d
callq 0x45b0
leaq 0x5e1e(%rip), %rsi      # 0x42622
leaq -0x630(%rbp), %rdi
callq 0x4450
movq %rax, -0x778(%rbp)
jmp 0x3c819
movq -0x778(%rbp), %rax
movq %rax, -0x638(%rbp)
cmpq $0x0, %rax
je 0x3c83d
movq -0x638(%rbp), %rdi
callq 0xd0a0
jmp 0x3c83b
jmp 0x3c83d
jmp 0x3c83f
cmpq $0x0, -0x638(%rbp)
jne 0x3c7a1
leaq -0x430(%rbp), %rax
movq %rax, -0x788(%rbp)
xorl %esi, %esi
movl %esi, %edi
callq 0xc880
movq %rax, -0x780(%rbp)
jmp 0x3c86d
leaq -0x658(%rbp), %rdi
callq 0x233c0
movq %rax, -0x790(%rbp)
leaq -0x6a0(%rbp), %rdi
leaq -0x630(%rbp), %rsi
movl $0x1, %edx
callq 0x227e0
jmp 0x3c89a
leaq -0x6a0(%rbp), %rdi
callq 0x22870
movq %rax, -0x798(%rbp)
jmp 0x3c8af
movq -0x798(%rbp), %rdi
callq 0x23410
movq -0x788(%rbp), %rdi
movq -0x780(%rbp), %rcx
movq -0x790(%rbp), %r8
movq %rax, %r9
leaq 0x8a27(%rip), %rdx      # 0x45301
xorl %eax, %eax
movl %eax, -0x7ac(%rbp)
movl $0x400, %esi            # imm = 0x400
callq 0x45b0
leaq -0x6a0(%rbp), %rdi
callq 0x23230
movl -0x7ac(%rbp), %esi
leaq -0x430(%rbp), %rax
movq %rax, -0x7a8(%rbp)
movl %esi, %edi
callq 0xc880
movq %rax, -0x7a0(%rbp)
jmp 0x3c91c
movq -0x7a0(%rbp), %rsi
movq -0x7a8(%rbp), %rdi
callq 0xd530
jmp 0x3c931
leaq 0x5cea(%rip), %rsi      # 0x42622
leaq -0x630(%rbp), %rdi
callq 0x4450
movq %rax, -0x7b8(%rbp)
jmp 0x3c94d
movq -0x7b8(%rbp), %rax
movq %rax, -0x638(%rbp)
cmpq $0x0, %rax
jne 0x3cab1
movq -0x20(%rbp), %rdi
leaq 0x5d70(%rip), %rsi      # 0x426e0
callq 0xb540
movq %rax, -0x7c0(%rbp)
jmp 0x3c97e
movq -0x7c0(%rbp), %rdi
callq 0xd0a0
jmp 0x3c98c
movl $0x4008, %edi           # imm = 0x4008
callq 0x4190
movq %rax, %rcx
movq -0x6a8(%rbp), %rax
movq %rcx, -0x7f0(%rbp)
movl (%rax), %ecx
movl %ecx, -0x7e8(%rbp)
movl 0x4(%rax), %ecx
movl %ecx, -0x7e4(%rbp)
movl 0x8(%rax), %ecx
movl %ecx, -0x7e0(%rbp)
movl 0xc(%rax), %ecx
movl %ecx, -0x7dc(%rbp)
movq 0x18(%rax), %rcx
movq %rcx, -0x7d8(%rbp)
movb 0x10(%rax), %dl
leaq 0x5d81(%rip), %rcx      # 0x42760
leaq 0x5b33(%rip), %rax      # 0x42519
testb $0x1, %dl
cmovneq %rcx, %rax
movq %rax, -0x7d0(%rbp)
callq 0x8cc0
movq %rax, -0x7c8(%rbp)
jmp 0x3ca02
movl -0x7dc(%rbp), %r9d
movl -0x7e0(%rbp), %r8d
movl -0x7e4(%rbp), %ecx
movl -0x7e8(%rbp), %edx
movq -0x7f0(%rbp), %rdi
movq -0x7d8(%rbp), %rsi
movq -0x7d0(%rbp), %r10
movq -0x7c8(%rbp), %r11
movq -0x20(%rbp), %rbx
movq %rsp, %rax
movq %rbx, 0x18(%rax)
movq %r11, 0x10(%rax)
movq %r10, 0x8(%rax)
movq %rsi, (%rax)
leaq 0x881c(%rip), %rsi      # 0x45271
xorl %eax, %eax
callq 0xb3b0
jmp 0x3ca5e
movq -0x7f0(%rbp), %rdi
leaq 0x13194(%rip), %rsi     # 0x4fc00
leaq -0x31553(%rip), %rdx    # 0xb520
callq 0x4600
jmp 0x3cb2e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x6a0(%rbp), %rdi
callq 0x23230
jmp 0x3cb11
movq -0x7f0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
callq 0x4270
jmp 0x3cb11
movq -0x638(%rbp), %rdi
callq 0xd0a0
jmp 0x3cabf
jmp 0x3cac1
movq -0x6a8(%rbp), %rdi
leaq -0x630(%rbp), %rsi
callq 0x96b0
jmp 0x3cad6
leaq -0x630(%rbp), %rdi
callq 0x4650
movq -0x6a8(%rbp), %rax
movq %rax, -0x10(%rbp)
movl $0x1, -0x680(%rbp)
leaq -0x658(%rbp), %rdi
callq 0x23230
movq -0x10(%rbp), %rax
addq $0x808, %rsp            # imm = 0x808
popq %rbx
popq %rbp
retq
leaq -0x658(%rbp), %rdi
callq 0x23230
movq -0x28(%rbp), %rdi
callq 0x4620
movq %rax, %rdi
callq 0x5f80
nop