// File: lvandeve[P]lodepng/lodepng_unittest.cpp
// Function: testPNGCodec()
void testPNGCodec() {
  codecTest(1, 1);
  codecTest(2, 2);
  codecTest(1, 1, LCT_GREY, 1);
  codecTest(7, 7, LCT_GREY, 1);
#ifndef DISABLE_SLOW
  codecTest(127, 127);
  codecTest(127, 127, LCT_GREY, 1);
  codecTest(320, 320);
  codecTest(1, 10000);
  codecTest(10000, 1);

  testOtherPattern1();
  testOtherPattern2();
#endif // DISABLE_SLOW

  testColor(255, 255, 255, 255);
  testColor(0, 0, 0, 255);
  testColor(1, 2, 3, 255);
  testColor(255, 0, 0, 255);
  testColor(0, 255, 0, 255);
  testColor(0, 0, 255, 255);
  testColor(0, 0, 0, 255);
  testColor(1, 1, 1, 255);
  testColor(1, 1, 1, 1);
  testColor(0, 0, 0, 128);
  testColor(255, 0, 0, 128);
  testColor(127, 127, 127, 255);
  testColor(128, 128, 128, 255);
  testColor(127, 127, 127, 128);
  testColor(128, 128, 128, 128);
  //transparent single pixels
  testColor(0, 0, 0, 0);
  testColor(255, 0, 0, 0);
  testColor(1, 2, 3, 0);
  testColor(255, 255, 255, 0);
  testColor(254, 254, 254, 0);

  // This is mainly to test the Adam7 interlacing
  for(unsigned h = 1; h < 12; h++)
  for(unsigned w = 1; w < 12; w++) {
    testSize(w, h);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl $0x1, %esi
movl $0x6, %edx
movl $0x8, %ecx
movl %esi, %edi
callq 0x30ee0
movl $0x2, %esi
movl $0x6, %edx
movl $0x8, %ecx
movl %esi, %edi
callq 0x30ee0
movl $0x1, %ecx
xorl %edx, %edx
movl %ecx, %edi
movl %ecx, %esi
callq 0x30ee0
movl $0x7, %esi
xorl %edx, %edx
movl $0x1, %ecx
movl %esi, %edi
callq 0x30ee0
movl $0x7f, %esi
movl $0x6, %edx
movl $0x8, %ecx
movl %esi, %edi
callq 0x30ee0
movl $0x7f, %esi
xorl %edx, %edx
movl $0x1, %ecx
movl %esi, %edi
callq 0x30ee0
movl $0x140, %esi            # imm = 0x140
movl $0x6, %edx
movl $0x8, %ecx
movl %esi, %edi
callq 0x30ee0
movl $0x1, %edi
movl $0x2710, %esi           # imm = 0x2710
movl $0x6, %edx
movl $0x8, %ecx
callq 0x30ee0
movl $0x2710, %edi           # imm = 0x2710
movl $0x1, %esi
movl $0x6, %edx
movl $0x8, %ecx
callq 0x30ee0
callq 0x31900
callq 0x31d60
movl $0xff, %ecx
movl %ecx, %edi
movl %ecx, %esi
movl %ecx, %edx
callq 0x32120
xorl %edx, %edx
movl $0xff, %ecx
movl %edx, %edi
movl %edx, %esi
callq 0x32120
movl $0x1, %edi
movl $0x2, %esi
movl $0x3, %edx
movl $0xff, %ecx
callq 0x32120
movl $0xff, %ecx
xorl %edx, %edx
movl %ecx, %edi
movl %edx, %esi
callq 0x32120
xorl %edx, %edx
movl $0xff, %ecx
movl %edx, %edi
movl %ecx, %esi
callq 0x32120
xorl %esi, %esi
movl $0xff, %ecx
movl %esi, %edi
movl %ecx, %edx
callq 0x32120
xorl %edx, %edx
movl $0xff, %ecx
movl %edx, %edi
movl %edx, %esi
callq 0x32120
movl $0x1, %edx
movl $0xff, %ecx
movl %edx, %edi
movl %edx, %esi
callq 0x32120
movl $0x1, %ecx
movl %ecx, %edi
movl %ecx, %esi
movl %ecx, %edx
callq 0x32120
xorl %edx, %edx
movl $0x80, %ecx
movl %edx, %edi
movl %edx, %esi
callq 0x32120
movl $0xff, %edi
xorl %edx, %edx
movl $0x80, %ecx
movl %edx, %esi
callq 0x32120
movl $0x7f, %edx
movl $0xff, %ecx
movl %edx, %edi
movl %edx, %esi
callq 0x32120
movl $0x80, %edx
movl $0xff, %ecx
movl %edx, %edi
movl %edx, %esi
callq 0x32120
movl $0x7f, %edx
movl $0x80, %ecx
movl %edx, %edi
movl %edx, %esi
callq 0x32120
movl $0x80, %ecx
movl %ecx, %edi
movl %ecx, %esi
movl %ecx, %edx
callq 0x32120
xorl %ecx, %ecx
movl %ecx, %edi
movl %ecx, %esi
movl %ecx, %edx
callq 0x32120
movl $0xff, %edi
xorl %ecx, %ecx
movl %ecx, %esi
movl %ecx, %edx
callq 0x32120
movl $0x1, %edi
movl $0x2, %esi
movl $0x3, %edx
xorl %ecx, %ecx
callq 0x32120
movl $0xff, %edx
xorl %ecx, %ecx
movl %edx, %edi
movl %edx, %esi
callq 0x32120
movl $0xfe, %edx
xorl %ecx, %ecx
movl %edx, %edi
movl %edx, %esi
callq 0x32120
movl $0x1, -0x4(%rbp)
cmpl $0xc, -0x4(%rbp)
jae 0x332fa
movl $0x1, -0x8(%rbp)
cmpl $0xc, -0x8(%rbp)
jae 0x332ed
movl -0x8(%rbp), %edi
movl -0x4(%rbp), %esi
callq 0x32e90
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x332d1
jmp 0x332ef
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x332c4
addq $0x10, %rsp
popq %rbp
retq