// File: lvandeve[P]lodepng/lodepng_unittest.cpp
// Function: colorConvertTest(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, LodePNGColorType, unsigned int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, LodePNGColorType, unsigned int)
void colorConvertTest(const std::string& bits_in, LodePNGColorType colorType_in, unsigned bitDepth_in,
                      const std::string& bits_out, LodePNGColorType colorType_out, unsigned bitDepth_out) {
  std::cout << "color convert test " << bits_in << " - " << bits_out << std::endl;

  std::vector<unsigned char> expected, actual, image;
  bitStringToBytes(expected, bits_out);
  actual.resize(expected.size());
  bitStringToBytes(image, bits_in);
  LodePNGColorMode mode_in, mode_out;
  lodepng_color_mode_init(&mode_in);
  lodepng_color_mode_init(&mode_out);
  mode_in.colortype = colorType_in;
  mode_in.bitdepth = bitDepth_in;
  mode_out.colortype = colorType_out;
  mode_out.bitdepth = bitDepth_out;
  unsigned error = lodepng_convert(&actual[0], &image[0], &mode_out, &mode_in, 1, 1);

  ASSERT_NO_PNG_ERROR_MSG(error, "convert error");

  for(size_t i = 0; i < expected.size(); i++) {
    assertEquals((int)expected[i], (int)actual[i], "byte " + valtostr(i));
  }

  lodepng_color_mode_cleanup(&mode_in);
  lodepng_color_mode_cleanup(&mode_out);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x270, %rsp            # imm = 0x270
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq %rcx, -0x18(%rbp)
movl %r8d, -0x1c(%rbp)
movl %r9d, -0x20(%rbp)
movq 0xc6d90(%rip), %rdi     # 0xf7fd8
leaq 0x8213b(%rip), %rsi     # 0xb338a
callq 0x3230
movq %rax, %rdi
movq -0x8(%rbp), %rsi
callq 0x3200
movq %rax, %rdi
leaq 0x82134(%rip), %rsi     # 0xb339e
callq 0x3230
movq %rax, %rdi
movq -0x18(%rbp), %rsi
callq 0x3200
movq %rax, %rdi
movq 0xc6d3b(%rip), %rsi     # 0xf7fc0
callq 0x3280
leaq -0x38(%rbp), %rdi
callq 0x1a4a0
leaq -0x50(%rbp), %rdi
callq 0x1a4a0
jmp 0x3129e
leaq -0x78(%rbp), %rdi
callq 0x1a4a0
jmp 0x312a9
movq -0x18(%rbp), %rsi
leaq -0x38(%rbp), %rdi
callq 0x310a0
jmp 0x312b8
leaq -0x38(%rbp), %rdi
callq 0x1a400
movq %rax, -0x200(%rbp)
jmp 0x312ca
movq -0x200(%rbp), %rsi
leaq -0x50(%rbp), %rdi
xorl %edx, %edx
callq 0x1a540
jmp 0x312de
movq -0x8(%rbp), %rsi
leaq -0x78(%rbp), %rdi
callq 0x310a0
jmp 0x312ed
leaq -0xa0(%rbp), %rdi
callq 0x56a0
jmp 0x312fb
leaq -0xc8(%rbp), %rdi
callq 0x56a0
jmp 0x31309
movl -0xc(%rbp), %eax
movl %eax, -0xa0(%rbp)
movl -0x10(%rbp), %eax
movl %eax, -0x9c(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0xc8(%rbp)
movl -0x20(%rbp), %eax
movl %eax, -0xc4(%rbp)
xorl %eax, %eax
movl %eax, %esi
leaq -0x50(%rbp), %rdi
callq 0x1a5f0
movq %rax, -0x208(%rbp)
jmp 0x31343
xorl %eax, %eax
movl %eax, %esi
leaq -0x78(%rbp), %rdi
callq 0x1a5f0
movq %rax, -0x210(%rbp)
jmp 0x31359
movq -0x210(%rbp), %rsi
movq -0x208(%rbp), %rdi
leaq -0xc8(%rbp), %rdx
leaq -0xa0(%rbp), %rcx
movl $0x1, %r9d
movl %r9d, %r8d
callq 0x6d60
movl %eax, -0x214(%rbp)
jmp 0x3138b
movl -0x214(%rbp), %eax
movl %eax, -0xcc(%rbp)
movl -0xcc(%rbp), %eax
movl %eax, -0x224(%rbp)
leaq -0x131(%rbp), %rdi
movq %rdi, -0x220(%rbp)
callq 0x3440
movq -0x220(%rbp), %rdx
leaq 0x81d51(%rip), %rsi     # 0xb3115
leaq -0x130(%rbp), %rdi
callq 0x3340
jmp 0x313d2
leaq 0x84fac(%rip), %rdx     # 0xb6385
leaq -0x110(%rbp), %rdi
leaq -0x130(%rbp), %rsi
callq 0xaa1b0
jmp 0x313ee
leaq -0x179(%rbp), %rdi
movq %rdi, -0x230(%rbp)
callq 0x3440
movq -0x230(%rbp), %rdx
movb $0x0, -0x17b(%rbp)
movb $0x0, -0x1a2(%rbp)
movb $0x0, -0x1a3(%rbp)
leaq 0x81f7e(%rip), %rsi     # 0xb33a2
leaq -0x178(%rbp), %rdi
callq 0x3340
jmp 0x31432
leaq -0x178(%rbp), %rdi
callq 0x33f0
movb %al, -0x231(%rbp)
jmp 0x31446
movb -0x231(%rbp), %al
testb $0x1, %al
jne 0x31452
jmp 0x3148a
leaq -0x17a(%rbp), %rdi
movq %rdi, -0x240(%rbp)
callq 0x3440
movq -0x240(%rbp), %rdx
movb $0x1, -0x17b(%rbp)
leaq 0x8308a(%rip), %rsi     # 0xb4504
leaq -0x158(%rbp), %rdi
callq 0x3340
jmp 0x31488
jmp 0x314e5
leaq -0x1a1(%rbp), %rdi
movq %rdi, -0x248(%rbp)
callq 0x3440
movq -0x248(%rbp), %rdx
movb $0x1, -0x1a2(%rbp)
leaq 0x81ef0(%rip), %rsi     # 0xb33a2
leaq -0x1a0(%rbp), %rdi
callq 0x3340
jmp 0x314c0
movb $0x1, -0x1a3(%rbp)
leaq 0x85215(%rip), %rsi     # 0xb66e3
leaq -0x158(%rbp), %rdi
leaq -0x1a0(%rbp), %rdx
callq 0xaa6d0
jmp 0x314e3
jmp 0x314e5
leaq -0xf0(%rbp), %rdi
leaq -0x110(%rbp), %rsi
leaq -0x158(%rbp), %rdx
callq 0xaa240
jmp 0x31501
movl -0x224(%rbp), %edi
leaq -0xf0(%rbp), %rsi
callq 0x28d30
jmp 0x31515
leaq -0xf0(%rbp), %rdi
callq 0x34a8
jmp 0x31523
leaq -0x158(%rbp), %rdi
callq 0x34a8
jmp 0x31531
testb $0x1, -0x1a3(%rbp)
jne 0x3153c
jmp 0x3154c
leaq -0x1a0(%rbp), %rdi
callq 0x34a8
jmp 0x3154a
jmp 0x3154c
testb $0x1, -0x1a2(%rbp)
jne 0x31557
jmp 0x31563
leaq -0x1a1(%rbp), %rdi
callq 0x3290
testb $0x1, -0x17b(%rbp)
jne 0x3156e
jmp 0x3157a
leaq -0x17a(%rbp), %rdi
callq 0x3290
leaq -0x178(%rbp), %rdi
callq 0x34a8
jmp 0x31588
leaq -0x179(%rbp), %rdi
callq 0x3290
leaq -0x110(%rbp), %rdi
callq 0x34a8
jmp 0x315a2
leaq -0x130(%rbp), %rdi
callq 0x34a8
jmp 0x315b0
leaq -0x131(%rbp), %rdi
callq 0x3290
movq $0x0, -0x1b0(%rbp)
movq -0x1b0(%rbp), %rax
movq %rax, -0x258(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x1a400
movq %rax, -0x250(%rbp)
jmp 0x315e7
movq -0x258(%rbp), %rax
movq -0x250(%rbp), %rcx
cmpq %rcx, %rax
jae 0x31883
movq -0x1b0(%rbp), %rsi
leaq -0x38(%rbp), %rdi
callq 0x1a5f0
movq %rax, -0x260(%rbp)
jmp 0x31617
movq -0x260(%rbp), %rax
movzbl (%rax), %eax
movl %eax, -0x1b4(%rbp)
movq -0x1b0(%rbp), %rsi
leaq -0x50(%rbp), %rdi
callq 0x1a5f0
movq %rax, -0x268(%rbp)
jmp 0x31640
movq -0x268(%rbp), %rax
movzbl (%rax), %eax
movl %eax, -0x1b8(%rbp)
leaq -0x1f8(%rbp), %rdi
leaq -0x1b0(%rbp), %rsi
callq 0xaa610
jmp 0x31665
leaq 0x81d44(%rip), %rsi     # 0xb33b0
leaq -0x1d8(%rbp), %rdi
leaq -0x1f8(%rbp), %rdx
callq 0xaa6d0
jmp 0x31681
leaq -0x1b4(%rbp), %rdi
leaq -0x1b8(%rbp), %rsi
leaq -0x1d8(%rbp), %rdx
callq 0xaa480
jmp 0x3169d
leaq -0x1d8(%rbp), %rdi
callq 0x34a8
jmp 0x316ab
leaq -0x1f8(%rbp), %rdi
callq 0x34a8
jmp 0x316b9
jmp 0x316bb
movq -0x1b0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x1b0(%rbp)
jmp 0x315c7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x318e1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x318d4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x318c7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x3183b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x3182b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x3180f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x317ff
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x317e6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x317cd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x317b0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x317a0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0xf0(%rbp), %rdi
callq 0x34a8
jmp 0x3179e
jmp 0x317a0
leaq -0x158(%rbp), %rdi
callq 0x34a8
jmp 0x317ae
jmp 0x317b0
testb $0x1, -0x1a3(%rbp)
jne 0x317bb
jmp 0x317cb
leaq -0x1a0(%rbp), %rdi
callq 0x34a8
jmp 0x317c9
jmp 0x317cb
jmp 0x317cd
testb $0x1, -0x1a2(%rbp)
jne 0x317d8
jmp 0x317e4
leaq -0x1a1(%rbp), %rdi
callq 0x3290
jmp 0x317e6
testb $0x1, -0x17b(%rbp)
jne 0x317f1
jmp 0x317fd
leaq -0x17a(%rbp), %rdi
callq 0x3290
jmp 0x317ff
leaq -0x178(%rbp), %rdi
callq 0x34a8
jmp 0x3180d
jmp 0x3180f
leaq -0x179(%rbp), %rdi
callq 0x3290
leaq -0x110(%rbp), %rdi
callq 0x34a8
jmp 0x31829
jmp 0x3182b
leaq -0x130(%rbp), %rdi
callq 0x34a8
jmp 0x31839
jmp 0x3183b
leaq -0x131(%rbp), %rdi
callq 0x3290
jmp 0x318c7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x31873
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x1d8(%rbp), %rdi
callq 0x34a8
jmp 0x31871
jmp 0x31873
leaq -0x1f8(%rbp), %rdi
callq 0x34a8
jmp 0x31881
jmp 0x318c7
leaq -0xa0(%rbp), %rdi
callq 0x5710
jmp 0x31891
leaq -0xc8(%rbp), %rdi
callq 0x5710
jmp 0x3189f
leaq -0x78(%rbp), %rdi
callq 0x1a4c0
jmp 0x318aa
leaq -0x50(%rbp), %rdi
callq 0x1a4c0
jmp 0x318b5
leaq -0x38(%rbp), %rdi
callq 0x1a4c0
addq $0x270, %rsp            # imm = 0x270
popq %rbp
retq
leaq -0x78(%rbp), %rdi
callq 0x1a4c0
jmp 0x318d2
jmp 0x318d4
leaq -0x50(%rbp), %rdi
callq 0x1a4c0
jmp 0x318df
jmp 0x318e1
leaq -0x38(%rbp), %rdi
callq 0x1a4c0
jmp 0x318ec
jmp 0x318ee
movq -0x58(%rbp), %rdi
callq 0x3430
movq %rax, %rdi
callq 0x1a490
nop