// File: lvandeve[P]lodepng/lodepng_unittest.cpp
// Function: testFewColors()
void testFewColors() {
  std::cout << "codec test few colors " << std::endl;
  Image image;
  image.width = 4;
  image.height = 4;
  image.colorType = LCT_RGBA;
  image.bitDepth = 8;
  image.data.resize(image.width * image.height * 4);
  std::vector<unsigned char> colors;
  colors.push_back(0); colors.push_back(0); colors.push_back(0); colors.push_back(255); // black
  colors.push_back(255); colors.push_back(255); colors.push_back(255); colors.push_back(255); // white
  colors.push_back(128); colors.push_back(128); colors.push_back(128); colors.push_back(255); // gray
  colors.push_back(0); colors.push_back(0); colors.push_back(255); colors.push_back(255); // blue
  colors.push_back(255); colors.push_back(255); colors.push_back(255); colors.push_back(0); // transparent white
  colors.push_back(255); colors.push_back(255); colors.push_back(255); colors.push_back(1); // translucent white
  for(size_t i = 0; i < colors.size(); i += 4)
  for(size_t j = 0; j < colors.size(); j += 4)
  for(size_t k = 0; k < colors.size(); k += 4)
  for(size_t l = 0; l < colors.size(); l += 4) {
    for(unsigned y = 0; y < image.height; y++)
    for(unsigned x = 0; x < image.width; x++) {
      size_t a = (y * image.width + x) & 3;
      size_t b = (a == 0) ? i : ((a == 1) ? j : ((a == 2) ? k : l));
      for(size_t c = 0; c < 4; c++) {
        image.data[y * image.width * 4 + x * 4 + c] = colors[b + c];
      }
    }
    doCodecTest(image);
  }
  image.width = 20;
  image.height = 20;
  image.data.resize(image.width * image.height * 4);
  for(size_t i = 0; i < colors.size(); i += 4)
  for(size_t j = 0; j < colors.size(); j += 4)
  for(size_t k = 0; k < colors.size(); k += 4) {
    for(unsigned y = 0; y < image.height; y++)
    for(unsigned x = 0; x < image.width; x++) {
      size_t a = (y * image.width + x) % 3;
      size_t b = (a == 0) ? i : ((a == 1) ? j : k);
      for(size_t c = 0; c < 4; c++) {
        image.data[y * image.width * 4 + x * 4 + c] = colors[b + c];
      }
    }
    doCodecTest(image);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1b0, %rsp            # imm = 0x1B0
movq 0xc59b6(%rip), %rdi     # 0xf7fd8
leaq 0x80ddf(%rip), %rsi     # 0xb3408
callq 0x3230
movq %rax, %rdi
movq 0xc5988(%rip), %rsi     # 0xf7fc0
callq 0x3280
leaq -0x28(%rbp), %rdi
movq %rdi, -0xe8(%rbp)
callq 0xaaae0
movq -0xe8(%rbp), %rdi
movl $0x4, -0x10(%rbp)
movl $0x4, -0xc(%rbp)
movl $0x6, -0x8(%rbp)
movl $0x8, -0x4(%rbp)
movl -0x10(%rbp), %eax
movl -0xc(%rbp), %ecx
imull %ecx, %eax
shll $0x2, %eax
movl %eax, %esi
xorl %edx, %edx
callq 0x1a540
jmp 0x32687
leaq -0x50(%rbp), %rdi
callq 0x1a4a0
jmp 0x32692
movb $0x0, -0x51(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x51(%rbp), %rsi
callq 0x23860
jmp 0x326a5
movb $0x0, -0x52(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x52(%rbp), %rsi
callq 0x23860
jmp 0x326b8
movb $0x0, -0x53(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x53(%rbp), %rsi
callq 0x23860
jmp 0x326cb
movb $-0x1, -0x54(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x54(%rbp), %rsi
callq 0x23860
jmp 0x326de
movb $-0x1, -0x55(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x55(%rbp), %rsi
callq 0x23860
jmp 0x326f1
movb $-0x1, -0x56(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x56(%rbp), %rsi
callq 0x23860
jmp 0x32704
movb $-0x1, -0x57(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x57(%rbp), %rsi
callq 0x23860
jmp 0x32717
movb $-0x1, -0x58(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x23860
jmp 0x3272a
movb $-0x80, -0x59(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x59(%rbp), %rsi
callq 0x23860
jmp 0x3273d
movb $-0x80, -0x5a(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x5a(%rbp), %rsi
callq 0x23860
jmp 0x32750
movb $-0x80, -0x5b(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x5b(%rbp), %rsi
callq 0x23860
jmp 0x32763
movb $-0x1, -0x5c(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x5c(%rbp), %rsi
callq 0x23860
jmp 0x32776
movb $0x0, -0x5d(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x5d(%rbp), %rsi
callq 0x23860
jmp 0x32789
movb $0x0, -0x5e(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x5e(%rbp), %rsi
callq 0x23860
jmp 0x3279c
movb $-0x1, -0x5f(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x5f(%rbp), %rsi
callq 0x23860
jmp 0x327af
movb $-0x1, -0x60(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x23860
jmp 0x327c2
movb $-0x1, -0x61(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x61(%rbp), %rsi
callq 0x23860
jmp 0x327d5
movb $-0x1, -0x62(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x62(%rbp), %rsi
callq 0x23860
jmp 0x327e8
movb $-0x1, -0x63(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x63(%rbp), %rsi
callq 0x23860
jmp 0x327fb
movb $0x0, -0x64(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x64(%rbp), %rsi
callq 0x23860
jmp 0x3280e
movb $-0x1, -0x65(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x65(%rbp), %rsi
callq 0x23860
jmp 0x32821
movb $-0x1, -0x66(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x66(%rbp), %rsi
callq 0x23860
jmp 0x32834
movb $-0x1, -0x67(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x67(%rbp), %rsi
callq 0x23860
jmp 0x32847
movb $0x1, -0x68(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x23860
jmp 0x3285a
movq $0x0, -0x70(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0xf8(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x1a400
movq %rax, -0xf0(%rbp)
jmp 0x3287f
movq -0xf8(%rbp), %rax
movq -0xf0(%rbp), %rcx
cmpq %rcx, %rax
jae 0x32b7a
movq $0x0, -0x78(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0x108(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x1a400
movq %rax, -0x100(%rbp)
jmp 0x328bb
movq -0x108(%rbp), %rax
movq -0x100(%rbp), %rcx
cmpq %rcx, %rax
jae 0x32b67
movq $0x0, -0x80(%rbp)
movq -0x80(%rbp), %rax
movq %rax, -0x118(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x1a400
movq %rax, -0x110(%rbp)
jmp 0x328f7
movq -0x118(%rbp), %rax
movq -0x110(%rbp), %rcx
cmpq %rcx, %rax
jae 0x32b54
movq $0x0, -0x88(%rbp)
movq -0x88(%rbp), %rax
movq %rax, -0x128(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x1a400
movq %rax, -0x120(%rbp)
jmp 0x32939
movq -0x128(%rbp), %rax
movq -0x120(%rbp), %rcx
cmpq %rcx, %rax
jae 0x32b41
movl $0x0, -0x8c(%rbp)
movl -0x8c(%rbp), %eax
cmpl -0xc(%rbp), %eax
jae 0x32b1d
movl $0x0, -0x90(%rbp)
movl -0x90(%rbp), %eax
cmpl -0x10(%rbp), %eax
jae 0x32b07
movl -0x8c(%rbp), %eax
imull -0x10(%rbp), %eax
addl -0x90(%rbp), %eax
andl $0x3, %eax
movl %eax, %eax
movq %rax, -0x98(%rbp)
cmpq $0x0, -0x98(%rbp)
jne 0x329b5
movq -0x70(%rbp), %rax
movq %rax, -0x130(%rbp)
jmp 0x32a0d
cmpq $0x1, -0x98(%rbp)
jne 0x329cc
movq -0x78(%rbp), %rax
movq %rax, -0x138(%rbp)
jmp 0x329ff
cmpq $0x2, -0x98(%rbp)
jne 0x329e3
movq -0x80(%rbp), %rax
movq %rax, -0x140(%rbp)
jmp 0x329f1
movq -0x88(%rbp), %rax
movq %rax, -0x140(%rbp)
movq -0x140(%rbp), %rax
movq %rax, -0x138(%rbp)
movq -0x138(%rbp), %rax
movq %rax, -0x130(%rbp)
movq -0x130(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq $0x0, -0xa8(%rbp)
cmpq $0x4, -0xa8(%rbp)
jae 0x32af1
movq -0xa0(%rbp), %rsi
movq -0xa8(%rbp), %rax
addq %rax, %rsi
leaq -0x50(%rbp), %rdi
callq 0x1a5f0
movq %rax, -0x148(%rbp)
jmp 0x32a57
movq -0x148(%rbp), %rax
movb (%rax), %al
movb %al, -0x151(%rbp)
movl -0x8c(%rbp), %eax
movl -0x10(%rbp), %ecx
imull %ecx, %eax
movl -0x90(%rbp), %edx
shll $0x2, %edx
movl %eax, %ecx
movl %edx, %eax
leal (%rax,%rcx,4), %eax
movl %eax, %esi
movq -0xa8(%rbp), %rax
addq %rax, %rsi
leaq -0x28(%rbp), %rdi
callq 0x1a5f0
movq %rax, -0x150(%rbp)
jmp 0x32aa0
movq -0x150(%rbp), %rax
movb -0x151(%rbp), %cl
movb %cl, (%rax)
movq -0xa8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xa8(%rbp)
jmp 0x32a26
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x32e67
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x1a4c0
jmp 0x32e65
jmp 0x32af3
movl -0x90(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x90(%rbp)
jmp 0x32973
jmp 0x32b09
movl -0x8c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8c(%rbp)
jmp 0x3295a
leaq -0x28(%rbp), %rdi
callq 0x30ea0
jmp 0x32b28
jmp 0x32b2a
movq -0x88(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x88(%rbp)
jmp 0x32919
jmp 0x32b43
movq -0x80(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x80(%rbp)
jmp 0x328da
jmp 0x32b56
movq -0x78(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x78(%rbp)
jmp 0x3289e
jmp 0x32b69
movq -0x70(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x70(%rbp)
jmp 0x32862
movl $0x14, -0x10(%rbp)
movl $0x14, -0xc(%rbp)
movl -0x10(%rbp), %eax
movl -0xc(%rbp), %ecx
imull %ecx, %eax
shll $0x2, %eax
movl %eax, %esi
leaq -0x28(%rbp), %rdi
xorl %edx, %edx
callq 0x1a540
jmp 0x32ba3
movq $0x0, -0xb0(%rbp)
movq -0xb0(%rbp), %rax
movq %rax, -0x168(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x1a400
movq %rax, -0x160(%rbp)
jmp 0x32bce
movq -0x168(%rbp), %rax
movq -0x160(%rbp), %rcx
cmpq %rcx, %rax
jae 0x32e48
movq $0x0, -0xb8(%rbp)
movq -0xb8(%rbp), %rax
movq %rax, -0x178(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x1a400
movq %rax, -0x170(%rbp)
jmp 0x32c10
movq -0x178(%rbp), %rax
movq -0x170(%rbp), %rcx
cmpq %rcx, %rax
jae 0x32e2f
movq $0x0, -0xc0(%rbp)
movq -0xc0(%rbp), %rax
movq %rax, -0x188(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x1a400
movq %rax, -0x180(%rbp)
jmp 0x32c52
movq -0x188(%rbp), %rax
movq -0x180(%rbp), %rcx
cmpq %rcx, %rax
jae 0x32e16
movl $0x0, -0xc4(%rbp)
movl -0xc4(%rbp), %eax
cmpl -0xc(%rbp), %eax
jae 0x32df2
movl $0x0, -0xc8(%rbp)
movl -0xc8(%rbp), %eax
cmpl -0x10(%rbp), %eax
jae 0x32ddc
movl -0xc4(%rbp), %eax
imull -0x10(%rbp), %eax
addl -0xc8(%rbp), %eax
movl $0x3, %ecx
xorl %edx, %edx
divl %ecx
movl %edx, %eax
movq %rax, -0xd0(%rbp)
cmpq $0x0, -0xd0(%rbp)
jne 0x32cd7
movq -0xb0(%rbp), %rax
movq %rax, -0x190(%rbp)
jmp 0x32d0d
cmpq $0x1, -0xd0(%rbp)
jne 0x32cf1
movq -0xb8(%rbp), %rax
movq %rax, -0x198(%rbp)
jmp 0x32cff
movq -0xc0(%rbp), %rax
movq %rax, -0x198(%rbp)
movq -0x198(%rbp), %rax
movq %rax, -0x190(%rbp)
movq -0x190(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq $0x0, -0xe0(%rbp)
cmpq $0x4, -0xe0(%rbp)
jae 0x32dc6
movq -0xd8(%rbp), %rsi
movq -0xe0(%rbp), %rax
addq %rax, %rsi
leaq -0x50(%rbp), %rdi
callq 0x1a5f0
movq %rax, -0x1a0(%rbp)
jmp 0x32d57
movq -0x1a0(%rbp), %rax
movb (%rax), %al
movb %al, -0x1a9(%rbp)
movl -0xc4(%rbp), %eax
movl -0x10(%rbp), %ecx
imull %ecx, %eax
movl -0xc8(%rbp), %edx
shll $0x2, %edx
movl %eax, %ecx
movl %edx, %eax
leal (%rax,%rcx,4), %eax
movl %eax, %esi
movq -0xe0(%rbp), %rax
addq %rax, %rsi
leaq -0x28(%rbp), %rdi
callq 0x1a5f0
movq %rax, -0x1a8(%rbp)
jmp 0x32da0
movq -0x1a8(%rbp), %rax
movb -0x1a9(%rbp), %cl
movb %cl, (%rax)
movq -0xe0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xe0(%rbp)
jmp 0x32d26
jmp 0x32dc8
movl -0xc8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc8(%rbp)
jmp 0x32c8c
jmp 0x32dde
movl -0xc4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc4(%rbp)
jmp 0x32c73
leaq -0x28(%rbp), %rdi
callq 0x30ea0
jmp 0x32dfd
jmp 0x32dff
movq -0xc0(%rbp), %rax
addq $0x4, %rax
movq %rax, -0xc0(%rbp)
jmp 0x32c32
jmp 0x32e18
movq -0xb8(%rbp), %rax
addq $0x4, %rax
movq %rax, -0xb8(%rbp)
jmp 0x32bf0
jmp 0x32e31
movq -0xb0(%rbp), %rax
addq $0x4, %rax
movq %rax, -0xb0(%rbp)
jmp 0x32bae
leaq -0x50(%rbp), %rdi
callq 0x1a4c0
jmp 0x32e53
leaq -0x28(%rbp), %rdi
callq 0xaab00
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbp
retq
jmp 0x32e67
leaq -0x28(%rbp), %rdi
callq 0xaab00
jmp 0x32e72
jmp 0x32e74
movq -0x30(%rbp), %rdi
callq 0x3430
movq %rax, %rdi
callq 0x1a490
nopw %cs:(%rax,%rax)