// File: /workspace/github_cpp_makefile_star2_O2/lvandeve[P]lodepng/lodepng_unittest.cpp
// Function: testCustomZlibDecompress()
void testCustomZlibDecompress() {
  std::cout << "testCustomZlibDecompress" << std::endl;
  Image image;
  generateTestImage(image, 5, 5, LCT_RGBA, 8);

  std::vector<unsigned char> encoded;

  unsigned error_enc = lodepng::encode(encoded, image.data, image.width, image.height,
                                   image.colorType, image.bitDepth);
  ASSERT_NO_PNG_ERROR_MSG(error_enc, "encoder error not expected");


  std::vector<unsigned char> decoded;
  unsigned w, h;
  int customcontext = 5;

  struct TestFun {
    static unsigned custom_zlib(unsigned char**, size_t*,
                          const unsigned char*, size_t,
                          const LodePNGDecompressSettings* settings) {
      ASSERT_EQUALS(5, *(int*)(settings->custom_context));
      custom_proof = 1;
      return 5555; // return a custom error code, which will be converted to an error known to lodepng.
    }
  };

  lodepng::State state;
  state.decoder.zlibsettings.custom_zlib = TestFun::custom_zlib;
  state.decoder.zlibsettings.custom_context = &customcontext;
  state.decoder.zlibsettings.ignore_adler32 = 0;
  state.decoder.ignore_crc = 0;
  custom_proof = 0;
  unsigned error = lodepng::decode(decoded, w, h, state, encoded);
  ASSERT_EQUALS(1, custom_proof); // check that the custom zlib was called

  ASSERT_EQUALS(110, error);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x3b8, %rsp            # imm = 0x3B8
movq 0x7a2e2(%rip), %rdi     # 0xa2fd8
leaq 0x38940(%rip), %rsi     # 0x6163d
callq 0x21f0
movq %rax, %rdi
callq 0x2100
xorps %xmm0, %xmm0
leaq 0x110(%rsp), %rdi
movaps %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
pushq $0x5
popq %rdx
pushq $0x6
popq %rcx
pushq $0x8
popq %r8
movl %edx, %esi
callq 0x138c7
leaq 0xd0(%rsp), %rdi
xorps %xmm0, %xmm0
movaps %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
leaq 0x110(%rsp), %rsi
movl 0x18(%rsi), %edx
movl 0x1c(%rsi), %ecx
movl 0x20(%rsi), %r8d
movl 0x24(%rsi), %r9d
callq 0xbafa
movl %eax, %ebx
leaq 0x37478(%rip), %rsi     # 0x601dd
leaq 0x8(%rsp), %rdi
leaq 0x90(%rsp), %rdx
callq 0x20c0
leaq 0x388d8(%rip), %rdx     # 0x61656
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x5a5df
leaq 0x388c7(%rip), %rsi     # 0x6165b
leaq 0x70(%rsp), %rdi
leaq 0xb0(%rsp), %rdx
callq 0x20c0
movq 0x78(%rsp), %r14
testq %r14, %r14
je 0x28de4
leaq 0x388a4(%rip), %rsi     # 0x6165b
leaq 0xf0(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x20c0
leaq 0x3a9d5(%rip), %rsi     # 0x637a5
leaq 0x50(%rsp), %rdi
leaq 0xf0(%rsp), %rdx
callq 0x5a8d9
jmp 0x28dfd
leaq 0x387db(%rip), %rsi     # 0x615c6
leaq 0x50(%rsp), %rdi
leaq 0xf0(%rsp), %rdx
callq 0x20c0
leaq 0x138(%rsp), %rdi
leaq 0x28(%rsp), %rsi
leaq 0x50(%rsp), %rdx
callq 0x5a61f
leaq 0x138(%rsp), %rsi
movl %ebx, %edi
callq 0x13352
leaq 0x138(%rsp), %rdi
callq 0x2270
leaq 0x50(%rsp), %rdi
callq 0x2270
testq %r14, %r14
je 0x28e4c
leaq 0xf0(%rsp), %rdi
callq 0x2270
leaq 0x70(%rsp), %rdi
callq 0x2270
leaq 0x28(%rsp), %rdi
callq 0x2270
leaq 0x8(%rsp), %rdi
callq 0x2270
xorps %xmm0, %xmm0
movaps %xmm0, 0xb0(%rsp)
andq $0x0, 0xc0(%rsp)
movl $0x5, 0x4c(%rsp)
leaq 0x138(%rsp), %rdi
callq 0xb84c
leaq 0x4fe(%rip), %rax       # 0x29398
leaq 0x138(%rsp), %rcx
movq %rax, 0x10(%rcx)
leaq 0x4c(%rsp), %rax
movq %rax, 0x20(%rcx)
andl $0x0, (%rcx)
andl $0x0, 0x28(%rcx)
andl $0x0, 0x7a383(%rip)     # 0xa3240
leaq 0xb0(%rsp), %rdi
leaq 0xcc(%rsp), %rsi
leaq 0xc8(%rsp), %rdx
leaq 0xd0(%rsp), %r8
callq 0xb9ef
movl %eax, 0x48(%rsp)
cmpl $0x1, 0x7a353(%rip)     # 0xa3240
jne 0x28f37
cmpl $0x6e, %eax
jne 0x29089
leaq 0x138(%rsp), %rdi
callq 0xb874
leaq 0xb0(%rsp), %rdi
callq 0xea7c
leaq 0xd0(%rsp), %rdi
callq 0xea7c
leaq 0x110(%rsp), %rdi
callq 0xea7c
addq $0x3b8, %rsp            # imm = 0x3B8
popq %rbx
popq %r14
retq
leaq 0x3729f(%rip), %rsi     # 0x601dd
leaq 0x90(%rsp), %rdi
leaq 0x6(%rsp), %rdx
callq 0x20c0
leaq 0x3871f(%rip), %rdx     # 0x61676
leaq 0x70(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x5a5df
leaq 0x3a835(%rip), %rdx     # 0x637a5
leaq 0x50(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x5a5df
leaq 0x3865d(%rip), %rdx     # 0x615e3
leaq 0x8(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x5a5df
leaq 0x37289(%rip), %rdx     # 0x60225
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x5a5df
movq 0x7a026(%rip), %rdi     # 0xa2fd8
leaq 0x28(%rsp), %rsi
callq 0x21d0
leaq 0x28(%rsp), %rdi
callq 0x2270
leaq 0x8(%rsp), %rdi
callq 0x2270
leaq 0x50(%rsp), %rdi
callq 0x2270
leaq 0x70(%rsp), %rdi
callq 0x2270
leaq 0x90(%rsp), %rdi
callq 0x2270
movq 0x79fe0(%rip), %rdi     # 0xa2fd8
leaq 0x5ff0e(%rip), %rsi     # 0x88f0d
callq 0x21f0
movq %rax, %rbx
leaq 0x50(%rsp), %rsi
movl $0x1, (%rsi)
leaq 0x28(%rsp), %rdi
callq 0x5aaac
leaq 0x28(%rsp), %rsi
movq %rbx, %rdi
callq 0x21d0
leaq 0x3720d(%rip), %rsi     # 0x6023d
movq %rax, %rdi
callq 0x21f0
movq %rax, %rbx
leaq 0x7a1fe(%rip), %rsi     # 0xa3240
leaq 0x8(%rsp), %rdi
callq 0x5aaac
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x21d0
leaq 0x370c4(%rip), %rsi     # 0x60124
movq %rax, %rdi
callq 0x21f0
movq %rax, %rdi
callq 0x2100
leaq 0x8(%rsp), %rdi
callq 0x2270
leaq 0x28(%rsp), %rdi
callq 0x2270
jmp 0x291d4
leaq 0x3714d(%rip), %rsi     # 0x601dd
leaq 0x90(%rsp), %rdi
leaq 0x6(%rsp), %rdx
callq 0x20c0
leaq 0x385d2(%rip), %rdx     # 0x6167b
leaq 0x70(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x5a5df
leaq 0x3a6e3(%rip), %rdx     # 0x637a5
leaq 0x50(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x5a5df
leaq 0x37065(%rip), %rdx     # 0x6013d
leaq 0x8(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x5a5df
leaq 0x37137(%rip), %rdx     # 0x60225
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x5a5df
movq 0x79ed4(%rip), %rdi     # 0xa2fd8
leaq 0x28(%rsp), %rsi
callq 0x21d0
leaq 0x28(%rsp), %rdi
callq 0x2270
leaq 0x8(%rsp), %rdi
callq 0x2270
leaq 0x50(%rsp), %rdi
callq 0x2270
leaq 0x70(%rsp), %rdi
callq 0x2270
leaq 0x90(%rsp), %rdi
callq 0x2270
movq 0x79e8e(%rip), %rdi     # 0xa2fd8
leaq 0x5fdbc(%rip), %rsi     # 0x88f0d
callq 0x21f0
movq %rax, %rbx
leaq 0x50(%rsp), %rsi
movl $0x6e, (%rsi)
leaq 0x28(%rsp), %rdi
callq 0x5aaac
leaq 0x28(%rsp), %rsi
movq %rbx, %rdi
callq 0x21d0
leaq 0x370bb(%rip), %rsi     # 0x6023d
movq %rax, %rdi
callq 0x21f0
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x5a957
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x21d0
leaq 0x36f74(%rip), %rsi     # 0x60124
movq %rax, %rdi
callq 0x21f0
movq %rax, %rdi
callq 0x2100
leaq 0x8(%rsp), %rdi
callq 0x2270
leaq 0x28(%rsp), %rdi
callq 0x2270
callq 0x13280
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x2270
jmp 0x291fe
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x2270
jmp 0x29210
jmp 0x291fb
jmp 0x2920d
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x2270
jmp 0x292fb
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x2270
jmp 0x292fb
jmp 0x292f8
jmp 0x292f8
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x2270
jmp 0x2924a
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x2270
jmp 0x29259
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x2270
jmp 0x29268
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x2270
jmp 0x29277
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x2270
jmp 0x29286
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x2270
jmp 0x29295
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x2270
jmp 0x292a4
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x2270
jmp 0x292b6
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x2270
jmp 0x292fb
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x2270
jmp 0x292fb
jmp 0x2930a
jmp 0x292f8
jmp 0x292f8
movq %rax, %rbx
jmp 0x29338
jmp 0x292f0
jmp 0x2935b
movq %rax, %rbx
jmp 0x29333
movq %rax, %rbx
leaq 0x138(%rsp), %rdi
callq 0x2270
jmp 0x29329
jmp 0x2935b
movq %rax, %rbx
jmp 0x2937a
movq %rax, %rbx
leaq 0x138(%rsp), %rdi
callq 0xb874
jmp 0x29312
movq %rax, %rbx
jmp 0x29345
movq %rax, %rbx
leaq 0xb0(%rsp), %rdi
callq 0xea7c
jmp 0x2936d
movq %rax, %rbx
jmp 0x2934f
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x2270
testq %r14, %r14
je 0x29345
leaq 0xf0(%rsp), %rdi
callq 0x2270
leaq 0x70(%rsp), %rdi
callq 0x2270
leaq 0x28(%rsp), %rdi
callq 0x2270
jmp 0x29363
movq %rax, %rbx
jmp 0x2936d
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x2270
leaq 0xd0(%rsp), %rdi
callq 0xea7c
leaq 0x110(%rsp), %rdi
callq 0xea7c
movq %rbx, %rdi
callq 0x2380
movq %rax, %rdi
callq 0xe6cc
nop