// File: /workspace/github_cpp_makefile_star2_O3/lvandeve[P]lodepng/lodepng_unittest.cpp
// Function: testColor(int, int, int, int)
void testColor(int r, int g, int b, int a) {
  std::cout << "codec test color " << r << " " << g << " " << b << " " << a << std::endl;
  Image image;
  image.width = 20;
  image.height = 20;
  image.colorType = LCT_RGBA;
  image.bitDepth = 8;
  image.data.resize(20 * 20 * 4);
  for(size_t y = 0; y < 20; y++)
  for(size_t x = 0; x < 20; x++) {
    image.data[20 * 4 * y + 4 * x + 0] = r;
    image.data[20 * 4 * y + 4 * x + 0] = g;
    image.data[20 * 4 * y + 4 * x + 0] = b;
    image.data[20 * 4 * y + 4 * x + 0] = a;
  }

  doCodecTest(image);

  Image image2 = image;
  image2.data[3] = 0; //one fully transparent pixel
  doCodecTest(image2);
  image2.data[3] = 128; //one semi transparent pixel
  doCodecTest(image2);

  Image image3 = image;
  // add 255 different colors
  for(size_t i = 0; i < 255; i++) {
    image.data[i * 4 + 0] = i;
    image.data[i * 4 + 1] = i;
    image.data[i * 4 + 2] = i;
    image.data[i * 4 + 3] = 255;
  }
  doCodecTest(image3);
  // a 256th color
  image.data[255 * 4 + 0] = 255;
  image.data[255 * 4 + 1] = 255;
  image.data[255 * 4 + 2] = 255;
  image.data[255 * 4 + 3] = 255;
  doCodecTest(image3);

  testSinglePixel(r, g, b, a);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movl %ecx, %ebx
movl %edx, %ebp
movl %esi, %r14d
movl %edi, %r15d
movq 0x979a6(%rip), %r12     # 0xb3fd8
leaq 0x5a025(%rip), %rsi     # 0x7665e
movl $0x11, %edx
movq %r12, %rdi
callq 0x2280
movq %r12, %rdi
movl %r15d, %esi
callq 0x23a0
movq %rax, %r13
leaq 0x5b10a(%rip), %r12     # 0x77765
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x2280
movq %r13, %rdi
movl %r14d, %esi
callq 0x23a0
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x2280
movq %r13, %rdi
movl %ebp, %esi
callq 0x23a0
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x2280
movq %r13, %rdi
movl %ebx, %esi
callq 0x23a0
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x2220
movsbl %al, %esi
movq %r12, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2170
xorps %xmm0, %xmm0
movq %rsp, %rdi
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movaps 0x59a8e(%rip), %xmm0    # 0x76180
movups %xmm0, 0x18(%rdi)
movl $0x640, %esi            # imm = 0x640
xorl %edx, %edx
callq 0x1078a
xorl %eax, %eax
xorl %ecx, %ecx
movl $0x14, %edx
movq %rax, %rsi
movq (%rsp), %rdi
movb %r15b, (%rdi,%rsi)
movq (%rsp), %rdi
movb %r14b, (%rdi,%rsi)
movq (%rsp), %rdi
movb %bpl, (%rdi,%rsi)
movq (%rsp), %rdi
movb %bl, (%rdi,%rsi)
addq $0x4, %rsi
decq %rdx
jne 0x1c70e
incq %rcx
addq $0x50, %rax
cmpq $0x14, %rcx
jne 0x1c706
movq %rsp, %rdi
callq 0x1ba21
movq (%rsp), %rsi
movq 0x8(%rsp), %rax
movq %rax, %r13
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
subq %rsi, %r13
je 0x1c78f
js 0x1c8fb
movq %r13, %rdi
callq 0x2240
movq %rax, %rcx
movq (%rsp), %rsi
movq 0x8(%rsp), %rax
movq %rax, %r12
subq %rsi, %r12
jmp 0x1c794
xorl %ecx, %ecx
movq %r13, %r12
movq %rcx, 0x30(%rsp)
movq %rcx, 0x38(%rsp)
addq %rcx, %r13
movq %r13, 0x40(%rsp)
cmpq %rsi, %rax
je 0x1c7bc
movq %rcx, %rdi
movq %r12, %rdx
movq %rcx, %r13
callq 0x2340
movq %r13, %rcx
addq %rcx, %r12
leaq 0x30(%rsp), %rdi
movq %r12, 0x8(%rdi)
leaq 0x18(%rsp), %rax
movups (%rax), %xmm0
movups %xmm0, 0x18(%rdi)
movb $0x0, 0x3(%rcx)
callq 0x1ba21
leaq 0x30(%rsp), %rdi
movq (%rdi), %rax
movb $-0x80, 0x3(%rax)
callq 0x1ba21
movq (%rsp), %rsi
movq 0x8(%rsp), %rax
movq %rax, %r13
subq %rsi, %r13
je 0x1c821
js 0x1c900
movq %r13, %rdi
callq 0x2240
movq %rax, %r12
movq (%rsp), %rsi
movq 0x8(%rsp), %rax
movq %rax, %rcx
subq %rsi, %rcx
jmp 0x1c827
xorl %r12d, %r12d
movq %r13, %rcx
movq %r12, 0x60(%rsp)
addq %r12, %r13
movq %r13, 0x70(%rsp)
cmpq %rsi, %rax
je 0x1c84a
movq %r12, %rdi
movq %rcx, %r13
movq %rcx, %rdx
callq 0x2340
movq %r13, %rcx
addq %rcx, %r12
movq %r12, 0x68(%rsp)
leaq 0x18(%rsp), %rax
movups (%rax), %xmm0
movups %xmm0, 0x78(%rsp)
xorl %eax, %eax
movq (%rsp), %rcx
movb %al, (%rcx,%rax,4)
movq (%rsp), %rcx
movb %al, 0x1(%rcx,%rax,4)
movq (%rsp), %rcx
movb %al, 0x2(%rcx,%rax,4)
movq (%rsp), %rcx
movb $-0x1, 0x3(%rcx,%rax,4)
incq %rax
cmpq $0xff, %rax
jne 0x1c861
leaq 0x60(%rsp), %rdi
callq 0x1ba21
movq (%rsp), %rax
movl $0xffffffff, 0x3fc(%rax) # imm = 0xFFFFFFFF
leaq 0x60(%rsp), %rdi
callq 0x1ba21
movl %r15d, %edi
movl %r14d, %esi
movl %ebp, %edx
movl %ebx, %ecx
callq 0x1c4c9
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x1c8cc
callq 0x2210
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x1c8db
callq 0x2210
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x1c8e9
callq 0x2210
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x20d0
callq 0x20d0
jmp 0x1c91d
jmp 0x1c931
movq %rax, %rbx
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x1c920
callq 0x2210
jmp 0x1c920
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x1c934
callq 0x2210
jmp 0x1c934
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x1c942
callq 0x2210
movq %rbx, %rdi
callq 0x23c0