// File: /workspace/github_cpp_makefile_star2_O2/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:
pushq %r14
pushq %rbx
subq $0x1008, %rsp           # imm = 0x1008
movq %rsi, %rbx
cmpl $0x1, %edx
je 0x1bac1
cmpl $0x2, %edx
jne 0x1baf9
pushq $0x8
popq %rax
leaq 0xe(%rsp), %rcx
xorl %edx, %edx
cmpl $0xff, %eax
ja 0x1bb72
movl %eax, %esi
shll $0x8, %esi
movw $0x800, %di             # imm = 0x800
movq %rdx, %r8
xorl %r9d, %r9d
cmpl $0x100, %r9d            # imm = 0x100
je 0x1bab1
movq %r8, -0xe(%rcx,%r9)
movw %si, -0x2(%rcx,%r9)
movw %si, -0x6(%rcx,%r9)
movw %di, -0x4(%rcx,%r9)
movb $0x7, (%rcx,%r9)
addq $0x10, %r9
incq %r8
addl $0x1000, %edi           # imm = 0x1000
jmp 0x1ba7d
addl $0x10, %eax
addq $0x100, %rcx            # imm = 0x100
addq $0x10, %rdx
jmp 0x1ba63
leaq 0xe(%rsp), %rax
xorl %ecx, %ecx
xorl %edx, %edx
cmpq $0x100, %rdx            # imm = 0x100
je 0x1bb72
movq %rdx, -0xe(%rax)
movw %cx, -0x2(%rax)
movw %cx, -0x4(%rax)
movw %cx, -0x6(%rax)
movb $0x7, (%rax)
incq %rdx
addl $0x100, %ecx            # imm = 0x100
addq $0x10, %rax
jmp 0x1baca
pushq $0x10
popq %rax
xorl %edx, %edx
movl %eax, %ecx
cmpl $0xff, %ecx
ja 0x1bb72
movl %ecx, %esi
shll $0x8, %esi
movl %eax, %edi
cmpl $0xff, %edi
ja 0x1bb6d
movl %edi, %r8d
shll $0x8, %r8d
leal 0x4(%rdx), %r9d
movl $0xffff0000, %r10d      # imm = 0xFFFF0000
testl %r10d, %r10d
je 0x1bb65
movl %edx, %r11d
movq %r11, %r14
shlq $0x4, %r14
movq %r11, (%rsp,%r14)
movw %si, 0x8(%rsp,%r14)
movw %r8w, 0xa(%rsp,%r14)
leal 0x2000(%r10), %r11d
movw %r11w, 0xc(%rsp,%r14)
incl %edx
movb $0x7, 0xe(%rsp,%r14)
addl $0x4000, %r10d          # imm = 0x4000
jmp 0x1bb28
addl $0x20, %edi
movl %r9d, %edx
jmp 0x1bb0f
addl $0x20, %ecx
jmp 0x1bb00
callq 0x1a004
movq 0x2068(%rax), %rdi
movq (%rbx), %rsi
movq %rsp, %rdx
movl $0x100, %ecx            # imm = 0x100
callq 0x43d0
addq $0x1008, %rsp           # imm = 0x1008
popq %rbx
popq %r14
retq
nop