// File: /workspace/github_cpp_makefile_star2_O2/lvandeve[P]lodepng/lodepng_unittest.cpp
// Function: doCodecTestC(Image&)
void doCodecTestC(Image& image) {
  unsigned char* encoded = 0;
  size_t encoded_size = 0;
  unsigned char* decoded = 0;
  unsigned decoded_w;
  unsigned decoded_h;

  struct OnExitScope {
    unsigned char** a;
    unsigned char** b;
    OnExitScope(unsigned char** ca, unsigned char** cb) : a(ca), b(cb) {}
    ~OnExitScope() { free(*a); free(*b); }
  } onExitScope(&encoded, &decoded);

  unsigned error_enc = lodepng_encode_memory(&encoded, &encoded_size, &image.data[0],
                                             image.width, image.height, image.colorType, image.bitDepth);

  if(error_enc != 0) std::cout << "Error: " << lodepng_error_text(error_enc) << std::endl;
  ASSERT_NO_PNG_ERROR_MSG(error_enc, "encoder error C");

  //if the image is large enough, compressing it should result in smaller size
  if(image.data.size() > 512) assertTrue(encoded_size < image.data.size(), "compressed size");

  unsigned error_dec = lodepng_decode_memory(&decoded, &decoded_w, &decoded_h,
                                             encoded, encoded_size, image.colorType, image.bitDepth);

  if(error_dec != 0) std::cout << "Error: " << lodepng_error_text(error_dec) << std::endl;
  ASSERT_NO_PNG_ERROR_MSG(error_dec, "decoder error C");

  ASSERT_EQUALS(image.width, decoded_w);
  ASSERT_EQUALS(image.height, decoded_h);
  assertPixels(image, decoded, "Pixels C");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
leaq 0xe0(%rsp), %rax
andq $0x0, (%rax)
leaq 0xc8(%rsp), %rsi
andq $0x0, (%rsi)
leaq 0xc0(%rsp), %rcx
andq $0x0, (%rcx)
movq %rdi, %rbx
movq %rax, 0xd0(%rsp)
movq %rcx, 0xd8(%rsp)
movq (%rdi), %rdx
movl 0x18(%rdi), %ecx
movl 0x1c(%rdi), %r8d
movl 0x20(%rdi), %r9d
movl 0x24(%rdi), %edi
movl %edi, (%rsp)
movq %rax, %rdi
callq 0xb4a0
movl %eax, %ebp
testl %eax, %eax
je 0x14031
movq 0x8efd0(%rip), %rdi     # 0xa2fd8
leaq 0x4c1c6(%rip), %rsi     # 0x601d5
callq 0x21f0
movq %rax, %r14
movl %ebp, %edi
callq 0xb5c9
movq %r14, %rdi
movq %rax, %rsi
callq 0x21f0
movq %rax, %rdi
callq 0x2100
leaq 0x4c1a5(%rip), %rsi     # 0x601dd
leaq 0xa0(%rsp), %rdi
leaq 0xe8(%rsp), %rdx
callq 0x20c0
leaq 0x4f249(%rip), %rdx     # 0x6329d
leaq 0x38(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0x5a5df
leaq 0x4c176(%rip), %rsi     # 0x601e3
leaq 0x80(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x20c0
movq 0x88(%rsp), %r14
testq %r14, %r14
je 0x140c0
leaq 0x4c150(%rip), %rsi     # 0x601e3
leaq 0x108(%rsp), %rdi
leaq 0x37(%rsp), %rdx
callq 0x20c0
leaq 0x4f6f9(%rip), %rsi     # 0x637a5
leaq 0x60(%rsp), %rdi
leaq 0x108(%rsp), %rdx
callq 0x5a8d9
jmp 0x140d9
leaq 0x4d4ff(%rip), %rsi     # 0x615c6
leaq 0x60(%rsp), %rdi
leaq 0x108(%rsp), %rdx
callq 0x20c0
leaq 0x10(%rsp), %rdi
leaq 0x38(%rsp), %rsi
leaq 0x60(%rsp), %rdx
callq 0x5a61f
leaq 0x10(%rsp), %rsi
movl %ebp, %edi
callq 0x13352
leaq 0x10(%rsp), %rdi
callq 0x2270
leaq 0x60(%rsp), %rdi
callq 0x2270
testq %r14, %r14
je 0x1411f
leaq 0x108(%rsp), %rdi
callq 0x2270
leaq 0x80(%rsp), %rdi
callq 0x2270
leaq 0x38(%rsp), %rdi
callq 0x2270
leaq 0xa0(%rsp), %rdi
callq 0x2270
movq 0x8(%rbx), %r14
subq (%rbx), %r14
cmpq $0x201, %r14            # imm = 0x201
jb 0x1418e
movq 0xc8(%rsp), %r15
leaq 0x4c091(%rip), %rsi     # 0x601f3
leaq 0x10(%rsp), %rdi
leaq 0x38(%rsp), %rdx
callq 0x20c0
xorl %edi, %edi
cmpq %r14, %r15
setb %dil
leaq 0x10(%rsp), %rsi
callq 0x1330f
leaq 0x10(%rsp), %rdi
callq 0x2270
movq 0xe0(%rsp), %rcx
movq 0xc8(%rsp), %r8
movl 0x20(%rbx), %r9d
movl 0x24(%rbx), %eax
movl %eax, (%rsp)
leaq 0xc0(%rsp), %rdi
leaq 0x5c(%rsp), %rsi
leaq 0x58(%rsp), %rdx
callq 0x8fce
movl %eax, %ebp
testl %eax, %eax
je 0x141f5
movq 0x8ee0c(%rip), %rdi     # 0xa2fd8
leaq 0x4c002(%rip), %rsi     # 0x601d5
callq 0x21f0
movq %rax, %r14
movl %ebp, %edi
callq 0xb5c9
movq %r14, %rdi
movq %rax, %rsi
callq 0x21f0
movq %rax, %rdi
callq 0x2100
leaq 0x4bfe1(%rip), %rsi     # 0x601dd
leaq 0xa0(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x20c0
leaq 0x4bfee(%rip), %rdx     # 0x60203
leaq 0x38(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0x5a5df
leaq 0x4bfd9(%rip), %rsi     # 0x60207
leaq 0x80(%rsp), %rdi
leaq 0x36(%rsp), %rdx
callq 0x20c0
movq 0x88(%rsp), %r14
testq %r14, %r14
je 0x14281
leaq 0x4bfb3(%rip), %rsi     # 0x60207
leaq 0xe8(%rsp), %rdi
leaq 0x35(%rsp), %rdx
callq 0x20c0
leaq 0x4f538(%rip), %rsi     # 0x637a5
leaq 0x60(%rsp), %rdi
leaq 0xe8(%rsp), %rdx
callq 0x5a8d9
jmp 0x1429a
leaq 0x4d33e(%rip), %rsi     # 0x615c6
leaq 0x60(%rsp), %rdi
leaq 0xe8(%rsp), %rdx
callq 0x20c0
leaq 0x10(%rsp), %rdi
leaq 0x38(%rsp), %rsi
leaq 0x60(%rsp), %rdx
callq 0x5a61f
leaq 0x10(%rsp), %rsi
movl %ebp, %edi
callq 0x13352
leaq 0x10(%rsp), %rdi
callq 0x2270
leaq 0x60(%rsp), %rdi
callq 0x2270
testq %r14, %r14
je 0x142e0
leaq 0xe8(%rsp), %rdi
callq 0x2270
leaq 0x80(%rsp), %rdi
callq 0x2270
leaq 0x38(%rsp), %rdi
callq 0x2270
leaq 0xa0(%rsp), %rdi
callq 0x2270
leaq 0x18(%rbx), %r14
movl (%r14), %eax
cmpl 0x5c(%rsp), %eax
jne 0x14375
leaq 0x1c(%rbx), %r14
movl (%r14), %eax
cmpl 0x58(%rsp), %eax
jne 0x144c6
movq 0xc0(%rsp), %r14
leaq 0x4bf24(%rip), %rsi     # 0x60255
leaq 0x10(%rsp), %rdi
leaq 0x38(%rsp), %rdx
callq 0x20c0
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x13e44
leaq 0x10(%rsp), %rdi
callq 0x2270
leaq 0xd0(%rsp), %rdi
callq 0x14854
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4be61(%rip), %rsi     # 0x601dd
leaq 0x80(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x20c0
leaq 0x4be82(%rip), %rdx     # 0x60217
leaq 0x60(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x5a5df
leaq 0x4f3f7(%rip), %rdx     # 0x637a5
leaq 0xa0(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x5a5df
leaq 0x4be54(%rip), %rdx     # 0x6021b
leaq 0x38(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0x5a5df
leaq 0x4be45(%rip), %rdx     # 0x60225
leaq 0x10(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x5a5df
movq 0x8ebe2(%rip), %rdi     # 0xa2fd8
leaq 0x10(%rsp), %rsi
callq 0x21d0
leaq 0x10(%rsp), %rdi
callq 0x2270
leaq 0x38(%rsp), %rdi
callq 0x2270
leaq 0xa0(%rsp), %rdi
callq 0x2270
leaq 0x60(%rsp), %rdi
callq 0x2270
leaq 0x80(%rsp), %rdi
callq 0x2270
movq 0x8eb99(%rip), %rdi     # 0xa2fd8
leaq 0x74ac7(%rip), %rsi     # 0x88f0d
callq 0x21f0
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
movq %r14, %rsi
callq 0x5a957
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x21d0
leaq 0x4bdce(%rip), %rsi     # 0x6023d
movq %rax, %rdi
callq 0x21f0
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
leaq 0x5c(%rsp), %rsi
callq 0x5a957
leaq 0x38(%rsp), %rsi
movq %rbx, %rdi
callq 0x21d0
leaq 0x4bc87(%rip), %rsi     # 0x60124
movq %rax, %rdi
callq 0x21f0
movq %rax, %rdi
callq 0x2100
leaq 0x38(%rsp), %rdi
callq 0x2270
leaq 0x10(%rsp), %rdi
callq 0x2270
jmp 0x14612
leaq 0x4bd10(%rip), %rsi     # 0x601dd
leaq 0x80(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x20c0
leaq 0x4bd61(%rip), %rdx     # 0x60247
leaq 0x60(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x5a5df
leaq 0x4f2a6(%rip), %rdx     # 0x637a5
leaq 0xa0(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x5a5df
leaq 0x4bd33(%rip), %rdx     # 0x6024b
leaq 0x38(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0x5a5df
leaq 0x4bcf4(%rip), %rdx     # 0x60225
leaq 0x10(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x5a5df
movq 0x8ea91(%rip), %rdi     # 0xa2fd8
leaq 0x10(%rsp), %rsi
callq 0x21d0
leaq 0x10(%rsp), %rdi
callq 0x2270
leaq 0x38(%rsp), %rdi
callq 0x2270
leaq 0xa0(%rsp), %rdi
callq 0x2270
leaq 0x60(%rsp), %rdi
callq 0x2270
leaq 0x80(%rsp), %rdi
callq 0x2270
movq 0x8ea48(%rip), %rdi     # 0xa2fd8
leaq 0x74976(%rip), %rsi     # 0x88f0d
callq 0x21f0
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
movq %r14, %rsi
callq 0x5a957
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x21d0
leaq 0x4bc7d(%rip), %rsi     # 0x6023d
movq %rax, %rdi
callq 0x21f0
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0x5a957
leaq 0x38(%rsp), %rsi
movq %rbx, %rdi
callq 0x21d0
leaq 0x4bb36(%rip), %rsi     # 0x60124
movq %rax, %rdi
callq 0x21f0
movq %rax, %rdi
callq 0x2100
leaq 0x38(%rsp), %rdi
callq 0x2270
leaq 0x10(%rsp), %rdi
callq 0x2270
callq 0x13280
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x2270
jmp 0x1463c
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x2270
jmp 0x1464e
jmp 0x14639
jmp 0x1464b
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x2270
jmp 0x14837
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x2270
jmp 0x14837
jmp 0x14834
jmp 0x14834
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x2270
jmp 0x14688
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x2270
jmp 0x14697
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x2270
jmp 0x146a6
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x2270
jmp 0x146b8
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
callq 0x2270
jmp 0x146ca
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
callq 0x2270
jmp 0x146d9
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x2270
jmp 0x146e8
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x2270
jmp 0x146fd
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x2270
jmp 0x14837
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x2270
jmp 0x14837
jmp 0x1477e
jmp 0x14783
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x2270
jmp 0x14837
jmp 0x14834
jmp 0x14834
movq %rax, %rbx
jmp 0x147ac
movq %rax, %rbx
jmp 0x147ff
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x2270
jmp 0x14837
movq %rax, %rbx
jmp 0x147a7
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x2270
jmp 0x1479d
jmp 0x14834
movq %rax, %rbx
jmp 0x147fa
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x2270
jmp 0x147f0
movq %rax, %rbx
jmp 0x147b9
movq %rax, %rbx
jmp 0x1480c
jmp 0x14834
movq %rax, %rbx
jmp 0x147d0
movq %rax, %rbx
jmp 0x147c6
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x2270
testq %r14, %r14
je 0x147b9
leaq 0xe8(%rsp), %rdi
callq 0x2270
leaq 0x80(%rsp), %rdi
callq 0x2270
leaq 0x38(%rsp), %rdi
callq 0x2270
leaq 0xa0(%rsp), %rdi
callq 0x2270
jmp 0x14837
jmp 0x14834
jmp 0x14834
movq %rax, %rbx
jmp 0x14823
movq %rax, %rbx
jmp 0x14819
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x2270
testq %r14, %r14
je 0x1480c
leaq 0x108(%rsp), %rdi
callq 0x2270
leaq 0x80(%rsp), %rdi
callq 0x2270
leaq 0x38(%rsp), %rdi
callq 0x2270
leaq 0xa0(%rsp), %rdi
callq 0x2270
jmp 0x14837
jmp 0x14834
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0x14854
movq %rbx, %rdi
callq 0x2380
movq %rax, %rdi
callq 0xe6cc