// File: /workspace/github_cpp_makefile_star2_O1/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 0x23731
xorl %eax, %eax
cmpl $0x2, %edx
jne 0x23765
movl $0x8, %ecx
movl %ecx, %edx
shll $0x8, %edx
movl $0xffff0000, %esi       # imm = 0xFFFF0000
movl %eax, %edi
movq %rdi, %r8
shlq $0x4, %r8
movq %rdi, (%rsp,%r8)
movw %dx, 0xc(%rsp,%r8)
movw %dx, 0x8(%rsp,%r8)
leal 0x800(%rsi), %edi
movw %di, 0xa(%rsp,%r8)
incl %eax
movb $0x7, 0xe(%rsp,%r8)
addl $0x1000, %esi           # imm = 0x1000
jne 0x236ea
leal 0x10(%rcx), %edx
cmpl $0xf0, %ecx
movl %edx, %ecx
jb 0x236e0
jmp 0x237d1
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 0x2373a
jmp 0x237d1
movl $0x10, %ecx
movl %ecx, %edx
shll $0x8, %edx
movl $0x10, %esi
movl %esi, %edi
shll $0x8, %edi
movl $0xffff0000, %r8d       # imm = 0xFFFF0000
movl %eax, %r9d
movq %r9, %r10
shlq $0x4, %r10
movq %r9, (%rsp,%r10)
movw %dx, 0x8(%rsp,%r10)
movw %di, 0xa(%rsp,%r10)
leal 0x2000(%r8), %r9d
movw %r9w, 0xc(%rsp,%r10)
incl %eax
movb $0x7, 0xe(%rsp,%r10)
addl $0x4000, %r8d           # imm = 0x4000
jne 0x2377f
leal 0x20(%rsi), %edi
cmpl $0xe0, %esi
movl %edi, %esi
jb 0x23774
leal 0x20(%rcx), %edx
cmpl $0xe0, %ecx
movl %edx, %ecx
jb 0x2376a
movb 0x8c519(%rip), %al      # 0xafcf0
testb %al, %al
je 0x237fb
movq 0x8c4fe(%rip), %rdi     # 0xafce0
movq (%rbx), %rsi
movq %rsp, %rdx
movl $0x100, %ecx            # imm = 0x100
callq 0x43f0
addq $0x1000, %rsp           # imm = 0x1000
popq %rbx
retq
leaq 0x8c4ee(%rip), %rdi     # 0xafcf0
callq 0x49b0
testl %eax, %eax
je 0x237db
leaq 0x8a466(%rip), %rdi     # 0xadc78
callq 0x21188
leaq -0x2658(%rip), %rdi     # 0x211c6
leaq 0x8a453(%rip), %rsi     # 0xadc78
leaq 0x89d2c(%rip), %rdx     # 0xad558
callq 0x44b0
leaq 0x8c4b8(%rip), %rdi     # 0xafcf0
callq 0x4330
jmp 0x237db
movq %rax, %rbx
leaq 0x8c4a7(%rip), %rdi     # 0xafcf0
callq 0x4310
movq %rbx, %rdi
callq 0x4950