// File: /workspace/github_cpp_makefile_star2_O1/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 0x97712(%rip), %r12     # 0xb3fd8
leaq 0x59b71(%rip), %rsi     # 0x7643e
movl $0x11, %edx
movq %r12, %rdi
callq 0x2270
movq %r12, %rdi
movl %r15d, %esi
callq 0x2390
movq %rax, %r13
leaq 0x5ac56(%rip), %r12     # 0x77545
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x2270
movq %r13, %rdi
movl %r14d, %esi
callq 0x2390
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x2270
movq %r13, %rdi
movl %ebp, %esi
callq 0x2390
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x2270
movq %r13, %rdi
movl %ebx, %esi
callq 0x2390
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x2210
movsbl %al, %esi
movq %r12, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2160
xorps %xmm0, %xmm0
movq %rsp, %rdi
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movaps 0x5960a(%rip), %xmm0    # 0x75f90
movups %xmm0, 0x18(%rdi)
movl $0x640, %esi            # imm = 0x640
xorl %edx, %edx
callq 0x10b40
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 0x1c9a2
incq %rcx
addq $0x50, %rax
cmpq $0x14, %rcx
jne 0x1c99a
movq %rsp, %rdi
callq 0x1bcb8
movq 0x8(%rsp), %r13
xorps %xmm0, %xmm0
movaps %xmm0, 0x60(%rsp)
movq $0x0, 0x70(%rsp)
subq (%rsp), %r13
je 0x1ca0e
js 0x1cb7e
movq %r13, %rdi
callq 0x2230
movq %rax, %r12
jmp 0x1ca11
xorl %r12d, %r12d
movq %r12, 0x60(%rsp)
movq %r12, 0x68(%rsp)
addq %r12, %r13
movq %r13, 0x70(%rsp)
movq (%rsp), %rsi
movq 0x8(%rsp), %r13
subq %rsi, %r13
je 0x1ca3c
movq %r12, %rdi
movq %r13, %rdx
callq 0x2330
addq %r12, %r13
leaq 0x60(%rsp), %rdi
movq %r13, 0x8(%rdi)
leaq 0x18(%rsp), %rax
movups (%rax), %xmm0
movups %xmm0, 0x18(%rdi)
movb $0x0, 0x3(%r12)
callq 0x1bcb8
leaq 0x60(%rsp), %rdi
movq (%rdi), %rax
movb $-0x80, 0x3(%rax)
callq 0x1bcb8
movq 0x8(%rsp), %r12
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
subq (%rsp), %r12
je 0x1ca9f
js 0x1cb83
movq %r12, %rdi
callq 0x2230
movq %rax, %r13
jmp 0x1caa2
xorl %r13d, %r13d
movq %r13, 0x30(%rsp)
movq %r13, 0x38(%rsp)
addq %r13, %r12
movq %r12, 0x40(%rsp)
movq (%rsp), %rsi
movq 0x8(%rsp), %r12
subq %rsi, %r12
je 0x1cacd
movq %r13, %rdi
movq %r12, %rdx
callq 0x2330
addq %r12, %r13
movq %r13, 0x38(%rsp)
leaq 0x18(%rsp), %rax
movups (%rax), %xmm0
movups %xmm0, 0x48(%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 0x1cae4
leaq 0x30(%rsp), %rdi
callq 0x1bcb8
movq (%rsp), %rax
movl $0xffffffff, 0x3fc(%rax) # imm = 0xFFFFFFFF
leaq 0x30(%rsp), %rdi
callq 0x1bcb8
movl %r15d, %edi
movl %r14d, %esi
movl %ebp, %edx
movl %ebx, %ecx
callq 0x1c75d
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x1cb4f
callq 0x2200
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x1cb5e
callq 0x2200
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x1cb6c
callq 0x2200
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x20d0
callq 0x20d0
jmp 0x1cba0
jmp 0x1cbb4
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x1cba3
callq 0x2200
jmp 0x1cba3
movq %rax, %rbx
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x1cbb7
callq 0x2200
jmp 0x1cbb7
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x1cbc5
callq 0x2200
movq %rbx, %rdi
callq 0x23b0