// File: lvandeve[P]lodepng/lodepng_unittest.cpp
// Function: assertPixels(Image&, unsigned char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void assertPixels(Image& image, const unsigned char* decoded, const std::string& message) {
  for(size_t i = 0; i < image.data.size(); i++) {
    int byte_expected = image.data[i];
    int byte_actual = decoded[i];

    //last byte is special due to possible random padding bits which need not to be equal
    if(i == image.data.size() - 1) {
      size_t numbits = getNumColorChannels(image.colorType) * image.bitDepth * image.width * image.height;
      size_t padding = 8u - (numbits - 8u * (numbits / 8u));
      if(padding != 8u) {
        //set all padding bits of both to 0
        for(size_t j = 0; j < padding; j++) {
          byte_expected = (byte_expected & (~(1 << j))) % 256;
          byte_actual = (byte_actual & (~(1 << j))) % 256;
        }
      }
    }

    assertEquals(byte_expected, byte_actual, message + " " + valtostr(i));
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1a400
movq %rax, %rcx
movq -0xb8(%rbp), %rax
cmpq %rcx, %rax
jae 0x2a95d
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x1a5f0
movzbl (%rax), %eax
movl %eax, -0x24(%rbp)
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1a400
movq %rax, %rcx
movq -0xc0(%rbp), %rax
subq $0x1, %rcx
cmpq %rcx, %rax
jne 0x2a877
movq -0x8(%rbp), %rax
movl 0x20(%rax), %edi
callq 0x299d0
movq -0x8(%rbp), %rcx
imull 0x24(%rcx), %eax
movq -0x8(%rbp), %rcx
imull 0x18(%rcx), %eax
movq -0x8(%rbp), %rcx
imull 0x1c(%rcx), %eax
movl %eax, %eax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rcx
movq -0x30(%rbp), %rax
shrq $0x3, %rax
shlq $0x3, %rax
subq %rax, %rcx
movl $0x8, %eax
subq %rcx, %rax
movq %rax, -0x38(%rbp)
cmpq $0x8, -0x38(%rbp)
je 0x2a875
movq $0x0, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0x2a873
movl -0x24(%rbp), %eax
movq -0x40(%rbp), %rcx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
xorl $-0x1, %ecx
andl %ecx, %eax
movl $0x100, %ecx            # imm = 0x100
cltd
idivl %ecx
movl %edx, -0x24(%rbp)
movl -0x28(%rbp), %eax
movq -0x40(%rbp), %rcx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
xorl $-0x1, %ecx
andl %ecx, %eax
movl $0x100, %ecx            # imm = 0x100
cltd
idivl %ecx
movl %edx, -0x28(%rbp)
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x2a81b
jmp 0x2a875
jmp 0x2a877
movq -0x18(%rbp), %rsi
leaq 0x89c81(%rip), %rdx     # 0xb4503
leaq -0x80(%rbp), %rdi
callq 0xaa1b0
leaq -0xa0(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0xaa610
jmp 0x2a89d
leaq -0x60(%rbp), %rdi
leaq -0x80(%rbp), %rsi
leaq -0xa0(%rbp), %rdx
callq 0xaa240
jmp 0x2a8b3
leaq -0x24(%rbp), %rdi
leaq -0x28(%rbp), %rsi
leaq -0x60(%rbp), %rdx
callq 0xaa480
jmp 0x2a8c6
leaq -0x60(%rbp), %rdi
callq 0x34a8
jmp 0x2a8d1
leaq -0xa0(%rbp), %rdi
callq 0x34a8
jmp 0x2a8df
leaq -0x80(%rbp), %rdi
callq 0x34a8
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x2a74f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0x2a950
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0x2a940
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x34a8
jmp 0x2a93e
jmp 0x2a940
leaq -0xa0(%rbp), %rdi
callq 0x34a8
jmp 0x2a94e
jmp 0x2a950
leaq -0x80(%rbp), %rdi
callq 0x34a8
jmp 0x2a95b
jmp 0x2a966
addq $0xc0, %rsp
popq %rbp
retq
movq -0xa8(%rbp), %rdi
callq 0x3430
movq %rax, %rdi
callq 0x1a490
nopw (%rax,%rax)