// File: manikandan5[P]Image-Matching-Stitching-Warping/./CImg.h
// Function: cimg_library::CImgDisplay::_set_colormap(unsigned long&, unsigned int)
void _set_colormap(Colormap& _colormap, const unsigned int dim) {
      XColor colormap[256];
      switch (dim) {
      case 1 : { // colormap for greyscale images
        for (unsigned int index = 0; index<256; ++index) {
          colormap[index].pixel = index;
          colormap[index].red = colormap[index].green = colormap[index].blue = (unsigned short)(index<<8);
          colormap[index].flags = DoRed | DoGreen | DoBlue;
        }
      } break;
      case 2 : { // colormap for RG images
        for (unsigned int index = 0, r = 8; r<256; r+=16)
          for (unsigned int g = 8; g<256; g+=16) {
            colormap[index].pixel = index;
            colormap[index].red = colormap[index].blue = (unsigned short)(r<<8);
            colormap[index].green = (unsigned short)(g<<8);
            colormap[index++].flags = DoRed | DoGreen | DoBlue;
          }
      } break;
      default : { // colormap for RGB images
        for (unsigned int index = 0, r = 16; r<256; r+=32)
          for (unsigned int g = 16; g<256; g+=32)
            for (unsigned int b = 32; b<256; b+=64) {
              colormap[index].pixel = index;
              colormap[index].red = (unsigned short)(r<<8);
              colormap[index].green = (unsigned short)(g<<8);
              colormap[index].blue = (unsigned short)(b<<8);
              colormap[index++].flags = DoRed | DoGreen | DoBlue;
            }
      }
      }
      XStoreColors(cimg::X11_attr().display,_colormap,colormap,256);
    }

// Assembly:
subq $0x1048, %rsp           # imm = 0x1048
movq %rdi, 0x1040(%rsp)
movq %rsi, 0x1038(%rsp)
movl %edx, 0x1034(%rsp)
movl 0x1034(%rsp), %eax
movl %eax, 0xc(%rsp)
subl $0x1, %eax
je 0x3b852
jmp 0x3b840
movl 0xc(%rsp), %eax
subl $0x2, %eax
je 0x3b8fa
jmp 0x3b9e7
movl $0x0, 0x2c(%rsp)
cmpl $0x100, 0x2c(%rsp)      # imm = 0x100
jae 0x3b8f5
movl 0x2c(%rsp), %eax
movl %eax, %ecx
movl 0x2c(%rsp), %eax
movl %eax, %edx
leaq 0x30(%rsp), %rax
shlq $0x4, %rdx
addq %rdx, %rax
movq %rcx, (%rax)
movl 0x2c(%rsp), %eax
shll $0x8, %eax
movw %ax, %cx
movl 0x2c(%rsp), %eax
movl %eax, %edx
leaq 0x30(%rsp), %rax
shlq $0x4, %rdx
addq %rdx, %rax
movw %cx, 0xc(%rax)
movl 0x2c(%rsp), %eax
movl %eax, %edx
leaq 0x30(%rsp), %rax
shlq $0x4, %rdx
addq %rdx, %rax
movw %cx, 0xa(%rax)
movl 0x2c(%rsp), %eax
movl %eax, %edx
leaq 0x30(%rsp), %rax
shlq $0x4, %rdx
addq %rdx, %rax
movw %cx, 0x8(%rax)
movl 0x2c(%rsp), %eax
movl %eax, %ecx
leaq 0x30(%rsp), %rax
shlq $0x4, %rcx
addq %rcx, %rax
movb $0x7, 0xe(%rax)
movl 0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
jmp 0x3b85a
jmp 0x3bb03
movl $0x0, 0x28(%rsp)
movl $0x8, 0x24(%rsp)
cmpl $0x100, 0x24(%rsp)      # imm = 0x100
jae 0x3b9e2
movl $0x8, 0x20(%rsp)
cmpl $0x100, 0x20(%rsp)      # imm = 0x100
jae 0x3b9d0
movl 0x28(%rsp), %eax
movl %eax, %ecx
movl 0x28(%rsp), %eax
movl %eax, %edx
leaq 0x30(%rsp), %rax
shlq $0x4, %rdx
addq %rdx, %rax
movq %rcx, (%rax)
movl 0x24(%rsp), %eax
shll $0x8, %eax
movw %ax, %cx
movl 0x28(%rsp), %eax
movl %eax, %edx
leaq 0x30(%rsp), %rax
shlq $0x4, %rdx
addq %rdx, %rax
movw %cx, 0xc(%rax)
movl 0x28(%rsp), %eax
movl %eax, %edx
leaq 0x30(%rsp), %rax
shlq $0x4, %rdx
addq %rdx, %rax
movw %cx, 0x8(%rax)
movl 0x20(%rsp), %eax
shll $0x8, %eax
movw %ax, %cx
movl 0x28(%rsp), %eax
movl %eax, %edx
leaq 0x30(%rsp), %rax
shlq $0x4, %rdx
addq %rdx, %rax
movw %cx, 0xa(%rax)
movl 0x28(%rsp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, 0x28(%rsp)
movl %eax, %eax
movl %eax, %ecx
leaq 0x30(%rsp), %rax
shlq $0x4, %rcx
addq %rcx, %rax
movb $0x7, 0xe(%rax)
movl 0x20(%rsp), %eax
addl $0x10, %eax
movl %eax, 0x20(%rsp)
jmp 0x3b920
jmp 0x3b9d2
movl 0x24(%rsp), %eax
addl $0x10, %eax
movl %eax, 0x24(%rsp)
jmp 0x3b90a
jmp 0x3bb03
movl $0x0, 0x1c(%rsp)
movl $0x10, 0x18(%rsp)
cmpl $0x100, 0x18(%rsp)      # imm = 0x100
jae 0x3bb01
movl $0x10, 0x14(%rsp)
cmpl $0x100, 0x14(%rsp)      # imm = 0x100
jae 0x3baef
movl $0x20, 0x10(%rsp)
cmpl $0x100, 0x10(%rsp)      # imm = 0x100
jae 0x3badd
movl 0x1c(%rsp), %eax
movl %eax, %ecx
movl 0x1c(%rsp), %eax
movl %eax, %edx
leaq 0x30(%rsp), %rax
shlq $0x4, %rdx
addq %rdx, %rax
movq %rcx, (%rax)
movl 0x18(%rsp), %eax
shll $0x8, %eax
movw %ax, %cx
movl 0x1c(%rsp), %eax
movl %eax, %edx
leaq 0x30(%rsp), %rax
shlq $0x4, %rdx
addq %rdx, %rax
movw %cx, 0x8(%rax)
movl 0x14(%rsp), %eax
shll $0x8, %eax
movw %ax, %cx
movl 0x1c(%rsp), %eax
movl %eax, %edx
leaq 0x30(%rsp), %rax
shlq $0x4, %rdx
addq %rdx, %rax
movw %cx, 0xa(%rax)
movl 0x10(%rsp), %eax
shll $0x8, %eax
movw %ax, %cx
movl 0x1c(%rsp), %eax
movl %eax, %edx
leaq 0x30(%rsp), %rax
shlq $0x4, %rdx
addq %rdx, %rax
movw %cx, 0xc(%rax)
movl 0x1c(%rsp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, 0x1c(%rsp)
movl %eax, %eax
movl %eax, %ecx
leaq 0x30(%rsp), %rax
shlq $0x4, %rcx
addq %rcx, %rax
movb $0x7, 0xe(%rax)
movl 0x10(%rsp), %eax
addl $0x40, %eax
movl %eax, 0x10(%rsp)
jmp 0x3ba23
jmp 0x3badf
movl 0x14(%rsp), %eax
addl $0x20, %eax
movl %eax, 0x14(%rsp)
jmp 0x3ba0d
jmp 0x3baf1
movl 0x18(%rsp), %eax
addl $0x20, %eax
movl %eax, 0x18(%rsp)
jmp 0x3b9f7
jmp 0x3bb03
callq 0x37200
movq 0x2068(%rax), %rdi
movq 0x1038(%rsp), %rax
movq (%rax), %rsi
leaq 0x30(%rsp), %rdx
movl $0x100, %ecx            # imm = 0x100
callq 0x53e0
addq $0x1048, %rsp           # imm = 0x1048
retq
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)