// File: /workspace/github_cpp_makefile_star2_O3/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 %rbx
subq $0x1000, %rsp           # imm = 0x1000
movq %rsi, %rbx
cmpl $0x1, %edx
je 0x237e4
cmpl $0x2, %edx
jne 0x23818
movl $0x8, %edx
leaq 0xe(%rsp), %rax
xorl %ecx, %ecx
movl %edx, %esi
shll $0x8, %esi
movw $0x800, %di             # imm = 0x800
movq %rcx, %r8
xorl %r9d, %r9d
movq %r8, -0xe(%rax,%r9)
movw %si, -0x2(%rax,%r9)
movw %si, -0x6(%rax,%r9)
movw %di, -0x4(%rax,%r9)
movb $0x7, (%rax,%r9)
addl $0x1000, %edi           # imm = 0x1000
addq $0x10, %r9
incq %r8
cmpl $0x100, %r9d            # imm = 0x100
jne 0x23796
leal 0x10(%rdx), %esi
addq $0x100, %rax            # imm = 0x100
addq $0x10, %rcx
cmpl $0xf0, %edx
movl %esi, %edx
jb 0x23787
jmp 0x2388c
leaq 0xe(%rsp), %rax
xorl %ecx, %ecx
xorl %edx, %edx
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
cmpq $0x100, %rdx            # imm = 0x100
jne 0x237ed
jmp 0x2388c
xorl %ecx, %ecx
movl $0x10, %eax
movl %eax, %edx
shll $0x8, %edx
movl $0x10, %esi
movl %ecx, %edi
movl %esi, %r8d
shll $0x8, %r8d
leal 0x4(%rdi), %ecx
movl $0xffff0000, %r9d       # imm = 0xFFFF0000
movl %edi, %r10d
movq %r10, %r11
shlq $0x4, %r11
movq %r10, (%rsp,%r11)
movw %dx, 0x8(%rsp,%r11)
movw %r8w, 0xa(%rsp,%r11)
leal 0x2000(%r9), %r10d
movw %r10w, 0xc(%rsp,%r11)
incl %edi
movb $0x7, 0xe(%rsp,%r11)
addl $0x4000, %r9d           # imm = 0x4000
jne 0x2383b
leal 0x20(%rsi), %edi
cmpl $0xe0, %esi
movl %edi, %esi
jb 0x23829
leal 0x20(%rax), %edx
cmpl $0xe0, %eax
movl %edx, %eax
jb 0x2381f
movb 0x8746e(%rip), %al      # 0xaad00
testb %al, %al
je 0x238b6
movq 0x87453(%rip), %rdi     # 0xaacf0
movq (%rbx), %rsi
movq %rsp, %rdx
movl $0x100, %ecx            # imm = 0x100
callq 0x4400
addq $0x1000, %rsp           # imm = 0x1000
popq %rbx
retq
leaq 0x87443(%rip), %rdi     # 0xaad00
callq 0x49c0
testl %eax, %eax
je 0x23896
leaq 0x853bb(%rip), %rdi     # 0xa8c88
callq 0x211ec
leaq -0x26af(%rip), %rdi     # 0x2122a
leaq 0x853a8(%rip), %rsi     # 0xa8c88
leaq 0x84c79(%rip), %rdx     # 0xa8560
callq 0x44c0
leaq 0x8740d(%rip), %rdi     # 0xaad00
callq 0x4330
jmp 0x23896
movq %rax, %rbx
leaq 0x873fc(%rip), %rdi     # 0xaad00
callq 0x4310
movq %rbx, %rdi
callq 0x4960
nop