// File: /workspace/github_cpp_makefile_star2_O2/lvandeve[P]lodepng/lodepng_unittest.cpp
// Function: testCustomInflate()
void testCustomInflate() {
  std::cout << "testCustomInflate" << 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_inflate(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_inflate = TestFun::custom_inflate;
  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 0x79a2a(%rip), %rdi     # 0xa2fd8
leaq 0x380cb(%rip), %rsi     # 0x61680
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 0x36bc0(%rip), %rsi     # 0x601dd
leaq 0x8(%rsp), %rdi
leaq 0x90(%rsp), %rdx
callq 0x20c0
leaq 0x3805c(%rip), %rdx     # 0x61692
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x5a5df
leaq 0x3800f(%rip), %rsi     # 0x6165b
leaq 0x70(%rsp), %rdi
leaq 0xb0(%rsp), %rdx
callq 0x20c0
movq 0x78(%rsp), %r14
testq %r14, %r14
je 0x2969c
leaq 0x37fec(%rip), %rsi     # 0x6165b
leaq 0xf0(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x20c0
leaq 0x3a11d(%rip), %rsi     # 0x637a5
leaq 0x50(%rsp), %rdi
leaq 0xf0(%rsp), %rdx
callq 0x5a8d9
jmp 0x296b5
leaq 0x37f23(%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 0x29704
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       # 0x29c50
leaq 0x138(%rsp), %rcx
movq %rax, 0x18(%rcx)
leaq 0x4c(%rsp), %rax
movq %rax, 0x20(%rcx)
andl $0x0, (%rcx)
andl $0x0, 0x28(%rcx)
andl $0x0, 0x79acb(%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, 0x79a9b(%rip)     # 0xa3240
jne 0x297ef
cmpl $0x6e, %eax
jne 0x29941
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 0x369e7(%rip), %rsi     # 0x601dd
leaq 0x90(%rsp), %rdi
leaq 0x6(%rsp), %rdx
callq 0x20c0
leaq 0x37e88(%rip), %rdx     # 0x61697
leaq 0x70(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x5a5df
leaq 0x39f7d(%rip), %rdx     # 0x637a5
leaq 0x50(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x5a5df
leaq 0x37da5(%rip), %rdx     # 0x615e3
leaq 0x8(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x5a5df
leaq 0x369d1(%rip), %rdx     # 0x60225
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x5a5df
movq 0x7976e(%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 0x79728(%rip), %rdi     # 0xa2fd8
leaq 0x5f656(%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 0x36955(%rip), %rsi     # 0x6023d
movq %rax, %rdi
callq 0x21f0
movq %rax, %rbx
leaq 0x79946(%rip), %rsi     # 0xa3240
leaq 0x8(%rsp), %rdi
callq 0x5aaac
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x21d0
leaq 0x3680c(%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 0x29a8c
leaq 0x36895(%rip), %rsi     # 0x601dd
leaq 0x90(%rsp), %rdi
leaq 0x6(%rsp), %rdx
callq 0x20c0
leaq 0x37d3b(%rip), %rdx     # 0x6169c
leaq 0x70(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x5a5df
leaq 0x39e2b(%rip), %rdx     # 0x637a5
leaq 0x50(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x5a5df
leaq 0x367ad(%rip), %rdx     # 0x6013d
leaq 0x8(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x5a5df
leaq 0x3687f(%rip), %rdx     # 0x60225
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x5a5df
movq 0x7961c(%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 0x795d6(%rip), %rdi     # 0xa2fd8
leaq 0x5f504(%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 0x36803(%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 0x366bc(%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 0x29ab6
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x2270
jmp 0x29ac8
jmp 0x29ab3
jmp 0x29ac5
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x2270
jmp 0x29bb3
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x2270
jmp 0x29bb3
jmp 0x29bb0
jmp 0x29bb0
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x2270
jmp 0x29b02
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x2270
jmp 0x29b11
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x2270
jmp 0x29b20
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x2270
jmp 0x29b2f
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x2270
jmp 0x29b3e
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x2270
jmp 0x29b4d
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x2270
jmp 0x29b5c
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x2270
jmp 0x29b6e
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x2270
jmp 0x29bb3
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x2270
jmp 0x29bb3
jmp 0x29bc2
jmp 0x29bb0
jmp 0x29bb0
movq %rax, %rbx
jmp 0x29bf0
jmp 0x29ba8
jmp 0x29c13
movq %rax, %rbx
jmp 0x29beb
movq %rax, %rbx
leaq 0x138(%rsp), %rdi
callq 0x2270
jmp 0x29be1
jmp 0x29c13
movq %rax, %rbx
jmp 0x29c32
movq %rax, %rbx
leaq 0x138(%rsp), %rdi
callq 0xb874
jmp 0x29bca
movq %rax, %rbx
jmp 0x29bfd
movq %rax, %rbx
leaq 0xb0(%rsp), %rdi
callq 0xea7c
jmp 0x29c25
movq %rax, %rbx
jmp 0x29c07
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x2270
testq %r14, %r14
je 0x29bfd
leaq 0xf0(%rsp), %rdi
callq 0x2270
leaq 0x70(%rsp), %rdi
callq 0x2270
leaq 0x28(%rsp), %rdi
callq 0x2270
jmp 0x29c1b
movq %rax, %rbx
jmp 0x29c25
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