// File: manikandan5[P]Image-Matching-Stitching-Warping/./CImg.h
// Function: int cimg_library::cimg::fread<short>(short*, unsigned long, _IO_FILE*)
inline int fread(T *const ptr, const unsigned long nmemb, std::FILE *stream) {
      if (!ptr || nmemb<=0 || !stream)
        throw CImgArgumentException("cimg::fread(): Invalid reading request of %u %s%s from file %p to buffer %p.",
                                    nmemb,cimg::type<T>::string(),nmemb>1?"s":"",stream,ptr);

      const unsigned long wlimitT = 63*1024*1024, wlimit = wlimitT/sizeof(T);
      unsigned long to_read = nmemb, al_read = 0, l_to_read = 0, l_al_read = 0;
      do {
        l_to_read = (to_read*sizeof(T))<wlimitT?to_read:wlimit;
        l_al_read = (unsigned long)std::fread((void*)(ptr+al_read),sizeof(T),l_to_read,stream);
        al_read+=l_al_read;
        to_read-=l_al_read;
      } while (l_to_read==l_al_read && to_read>0);
      if (to_read>0)
        warn("cimg::fread(): Only %u/%u elements could be read from file.",
             al_read,nmemb);
      return al_read;
    }

// Assembly:
subq $0x88, %rsp
movq %rdi, 0x80(%rsp)
movq %rsi, 0x78(%rsp)
movq %rdx, 0x70(%rsp)
cmpq $0x0, 0x80(%rsp)
je 0x7f1a8
cmpq $0x0, 0x78(%rsp)
jbe 0x7f1a8
cmpq $0x0, 0x70(%rsp)
jne 0x7f24f
movl $0x4008, %edi           # imm = 0x4008
callq 0x5240
movq %rax, 0x18(%rsp)
movq 0x78(%rsp), %rax
movq %rax, 0x20(%rsp)
callq 0x7f740
movq %rax, 0x28(%rsp)
jmp 0x7f1cd
movq 0x28(%rsp), %rcx
movq 0x20(%rsp), %rdx
movq 0x18(%rsp), %rdi
movq 0x78(%rsp), %rax
subq $0x2, %rax
leaq 0x6b5c1(%rip), %rax     # 0xea7ad
leaq 0x697df(%rip), %r8      # 0xe89d2
cmovaeq %rax, %r8
movq 0x70(%rsp), %r9
movq 0x80(%rsp), %rsi
movq %rsp, %rax
movq %rsi, (%rax)
leaq 0x6a4d5(%rip), %rsi     # 0xe96e6
xorl %eax, %eax
callq 0x12220
jmp 0x7f21a
movq 0x18(%rsp), %rdi
leaq 0x8093a(%rip), %rsi     # 0xffb60
leaq -0x6cdcd(%rip), %rdx    # 0x12460
callq 0x5920
movq 0x18(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x68(%rsp)
movl %eax, 0x64(%rsp)
callq 0x53a0
jmp 0x7f35d
movq $0x3f00000, 0x58(%rsp)  # imm = 0x3F00000
movq $0x1f80000, 0x50(%rsp)  # imm = 0x1F80000
movq 0x78(%rsp), %rax
movq %rax, 0x48(%rsp)
movq $0x0, 0x40(%rsp)
movq $0x0, 0x38(%rsp)
movq $0x0, 0x30(%rsp)
movq 0x48(%rsp), %rax
shlq %rax
cmpq $0x3f00000, %rax        # imm = 0x3F00000
jae 0x7f2a2
movq 0x48(%rsp), %rax
movq %rax, 0x10(%rsp)
jmp 0x7f2ae
movl $0x1f80000, %eax        # imm = 0x1F80000
movq %rax, 0x10(%rsp)
jmp 0x7f2ae
movq 0x10(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0x80(%rsp), %rdi
movq 0x40(%rsp), %rax
shlq %rax
addq %rax, %rdi
movq 0x38(%rsp), %rdx
movq 0x70(%rsp), %rcx
movl $0x2, %esi
callq 0x57d0
movq %rax, 0x30(%rsp)
movq 0x30(%rsp), %rax
addq 0x40(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x30(%rsp), %rcx
movq 0x48(%rsp), %rax
subq %rcx, %rax
movq %rax, 0x48(%rsp)
movq 0x38(%rsp), %rcx
xorl %eax, %eax
cmpq 0x30(%rsp), %rcx
movb %al, 0xf(%rsp)
jne 0x7f324
cmpq $0x0, 0x48(%rsp)
seta %al
movb %al, 0xf(%rsp)
movb 0xf(%rsp), %al
testb $0x1, %al
jne 0x7f286
cmpq $0x0, 0x48(%rsp)
jbe 0x7f350
movq 0x40(%rsp), %rsi
movq 0x78(%rsp), %rdx
leaq 0x6a3ea(%rip), %rdi     # 0xe9733
movb $0x0, %al
callq 0x117e0
movq 0x40(%rsp), %rax
addq $0x88, %rsp
retq
movq 0x68(%rsp), %rdi
callq 0x5970
nopw (%rax,%rax)