// File: /workspace/github_cpp_makefile_star2_O3/lvandeve[P]lodepng/lodepng_unittest.cpp
// Function: testRGBToPaletteConvert()
void testRGBToPaletteConvert() {
  unsigned char palette1[4] = {1,2,3,4};
  doRGBAToPaletteTest(palette1, 1);
  unsigned char palette2[8] = {1,2,3,4, 5,6,7,8};
  doRGBAToPaletteTest(palette2, 2);
  unsigned char palette3[12] = {1,1,1,255, 20,20,20,255, 20,20,21,255};
  doRGBAToPaletteTest(palette3, 3);

  std::vector<unsigned char> palette;
  for(int i = 0; i < 256; i++) {
    palette.push_back(i);
    palette.push_back(5);
    palette.push_back(6);
    palette.push_back(128);
  }
  doRGBAToPaletteTest(&palette[0], 256);
  palette.push_back(5);
  palette.push_back(6);
  palette.push_back(7);
  palette.push_back(8);
  doRGBAToPaletteTest(&palette[0], 257, LCT_RGBA);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x40, %rsp
leaq 0x34(%rsp), %rdi
movl $0x4030201, (%rdi)      # imm = 0x4030201
movl $0x1, %esi
movl $0x3, %edx
callq 0x2a5f6
movabsq $0x807060504030201, %rax # imm = 0x807060504030201
leaq 0x38(%rsp), %rdi
movq %rax, (%rdi)
movl $0x2, %esi
movl $0x3, %edx
callq 0x2a5f6
leaq 0x739d1(%rip), %rdi     # 0x9f374
movl $0x3, %esi
movl $0x3, %edx
callq 0x2a5f6
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rbx
movaps %xmm0, (%rbx)
movq $0x0, 0x10(%rbx)
xorl %ebp, %ebp
leaq 0xf(%rsp), %r14
movb %bpl, 0xf(%rsp)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x2b9ef
movb %bpl, (%rsi)
movq 0x18(%rsp), %rsi
incq %rsi
movq %rsi, 0x18(%rsp)
jmp 0x2b9ff
movq %rbx, %rdi
movq %r14, %rdx
callq 0x16120
movq 0x18(%rsp), %rsi
movb $0x5, 0xf(%rsp)
cmpq 0x20(%rsp), %rsi
je 0x2ba1d
movb $0x5, (%rsi)
movq 0x18(%rsp), %rsi
incq %rsi
movq %rsi, 0x18(%rsp)
jmp 0x2ba2d
movq %rbx, %rdi
movq %r14, %rdx
callq 0x16120
movq 0x18(%rsp), %rsi
movb $0x6, 0xf(%rsp)
cmpq 0x20(%rsp), %rsi
je 0x2ba4b
movb $0x6, (%rsi)
movq 0x18(%rsp), %rsi
incq %rsi
movq %rsi, 0x18(%rsp)
jmp 0x2ba5b
movq %rbx, %rdi
movq %r14, %rdx
callq 0x16120
movq 0x18(%rsp), %rsi
movb $-0x80, 0xf(%rsp)
cmpq 0x20(%rsp), %rsi
je 0x2ba71
movb $-0x80, (%rsi)
incq 0x18(%rsp)
jmp 0x2ba7c
movq %rbx, %rdi
movq %r14, %rdx
callq 0x16120
incl %ebp
cmpl $0x100, %ebp            # imm = 0x100
jne 0x2b9cc
movq 0x10(%rsp), %rdi
movl $0x100, %esi            # imm = 0x100
movl $0x3, %edx
callq 0x2a5f6
movb $0x5, 0xf(%rsp)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x2bac1
movb $0x5, (%rsi)
movq 0x18(%rsp), %rsi
incq %rsi
movq %rsi, 0x18(%rsp)
jmp 0x2bad5
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x16120
movq 0x18(%rsp), %rsi
movb $0x6, 0xf(%rsp)
cmpq 0x20(%rsp), %rsi
je 0x2baf3
movb $0x6, (%rsi)
movq 0x18(%rsp), %rsi
incq %rsi
movq %rsi, 0x18(%rsp)
jmp 0x2bb07
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x16120
movq 0x18(%rsp), %rsi
movb $0x7, 0xf(%rsp)
cmpq 0x20(%rsp), %rsi
je 0x2bb25
movb $0x7, (%rsi)
movq 0x18(%rsp), %rsi
incq %rsi
movq %rsi, 0x18(%rsp)
jmp 0x2bb39
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x16120
movq 0x18(%rsp), %rsi
movb $0x8, 0xf(%rsp)
cmpq 0x20(%rsp), %rsi
je 0x2bb4f
movb $0x8, (%rsi)
incq 0x18(%rsp)
jmp 0x2bb5e
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x16120
movq 0x10(%rsp), %rdi
movl $0x101, %esi            # imm = 0x101
movl $0x6, %edx
callq 0x2a5f6
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x2bb81
callq 0x2210
addq $0x40, %rsp
popq %rbx
popq %r14
popq %rbp
retq
jmp 0x2bb9a
jmp 0x2bb9a
jmp 0x2bb9a
jmp 0x2bb9a
jmp 0x2bb9a
jmp 0x2bb9a
jmp 0x2bb9a
jmp 0x2bb9a
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x2bbac
callq 0x2210
movq %rbx, %rdi
callq 0x23c0