// File: /workspace/github_cpp_makefile_star2_O2/lvandeve[P]lodepng/lodepng_unittest.cpp
// Function: testFuzzing()
void testFuzzing() {
  std::cout << "testFuzzing" << std::endl;
  std::vector<unsigned char> png;
  createComplexPNG(png);
  std::vector<unsigned char> broken = png;
  std::vector<unsigned char> result;
  std::map<unsigned, unsigned> errors;
  unsigned w, h;
  lodepng::State state;
  state.decoder.ignore_crc = 1;
  state.decoder.zlibsettings.ignore_adler32 = 1;
  for(size_t i = 0; i < png.size(); i++) {
    result.clear();
    broken[i] = ~png[i];
    errors[lodepng::decode(result, w, h, state, broken)]++;
    broken[i] = 0;
    errors[lodepng::decode(result, w, h, state, broken)]++;
    for(int j = 0; j < 8; j++) {
      broken[i] = flipBit(png[i], j);
      errors[lodepng::decode(result, w, h, state, broken)]++;
    }
    broken[i] = 255;
    errors[lodepng::decode(result, w, h, state, broken)]++;
    broken[i] = png[i]; //fix it again for the next test
  }
  std::cout << "testFuzzing shrinking" << std::endl;
  broken = png;
  while(broken.size() > 0) {
    broken.resize(broken.size() - 1);
    errors[lodepng::decode(result, w, h, state, broken)]++;
  }

  //For fun, print the number of each error
  std::cout << "Fuzzing error code counts: ";
  for(std::map<unsigned, unsigned>::iterator it = errors.begin(); it != errors.end(); ++it) {
    std::cout << it->first << ":" << it->second << ", ";
  }
  std::cout << std::endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x308, %rsp            # imm = 0x308
movq 0x7bc42(%rip), %rdi     # 0xa2fd8
leaq 0x3a1e7(%rip), %rsi     # 0x61584
callq 0x21f0
movq %rax, %rdi
callq 0x2100
xorps %xmm0, %xmm0
leaq 0x40(%rsp), %rdi
movaps %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
callq 0x1bf63
leaq 0x8(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x127e2
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
andq $0x0, 0x30(%rsp)
leaq 0x60(%rsp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
leaq 0x88(%rsp), %rdi
callq 0xb84c
pushq $0x1
popq %rax
leaq 0x88(%rsp), %rcx
movl %eax, 0x28(%rcx)
movl %eax, (%rcx)
xorl %r15d, %r15d
leaq 0x3c(%rsp), %r12
leaq 0x8(%rsp), %r13
leaq 0x58(%rsp), %rbp
movq %rsp, %rbx
movq 0x40(%rsp), %rax
movq 0x48(%rsp), %rcx
subq %rax, %rcx
cmpq %rcx, %r15
jae 0x27568
movq 0x20(%rsp), %rcx
cmpq %rcx, 0x28(%rsp)
je 0x2744f
movq %rcx, 0x28(%rsp)
movb (%rax,%r15), %al
notb %al
movq 0x8(%rsp), %rcx
movb %al, (%rcx,%r15)
leaq 0x20(%rsp), %rdi
leaq 0x4(%rsp), %rsi
movq %r12, %rdx
leaq 0x88(%rsp), %rcx
movq %r13, %r8
callq 0xb9ef
movl %eax, (%rsp)
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x5af32
incl (%rax)
movq 0x8(%rsp), %rax
movb $0x0, (%rax,%r15)
leaq 0x20(%rsp), %rdi
leaq 0x4(%rsp), %rsi
movq %r12, %rdx
leaq 0x88(%rsp), %rcx
movq %r13, %r8
callq 0xb9ef
movl %eax, (%rsp)
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x5af32
incl (%rax)
xorl %r14d, %r14d
cmpl $0x8, %r14d
je 0x27517
movq 0x40(%rsp), %rax
pushq $0x1
popq %rdx
movl %r14d, %ecx
shll %cl, %edx
xorb (%rax,%r15), %dl
movq 0x8(%rsp), %rax
movb %dl, (%rax,%r15)
leaq 0x20(%rsp), %rdi
leaq 0x4(%rsp), %rsi
movq %r12, %rdx
leaq 0x88(%rsp), %rcx
movq %r13, %r8
callq 0xb9ef
movl %eax, (%rsp)
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x5af32
incl (%rax)
incl %r14d
jmp 0x274c5
movq 0x8(%rsp), %rax
movb $-0x1, (%rax,%r15)
leaq 0x20(%rsp), %rdi
leaq 0x4(%rsp), %rsi
movq %r12, %rdx
leaq 0x88(%rsp), %rcx
movq %r13, %r8
callq 0xb9ef
movl %eax, (%rsp)
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x5af32
incl (%rax)
movq 0x40(%rsp), %rax
movb (%rax,%r15), %al
movq 0x8(%rsp), %rcx
movb %al, (%rcx,%r15)
incq %r15
jmp 0x27428
movq 0x7ba69(%rip), %rdi     # 0xa2fd8
leaq 0x3a01a(%rip), %rsi     # 0x61590
callq 0x21f0
movq %rax, %rdi
callq 0x2100
leaq 0x8(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x12224
leaq 0x8(%rsp), %rbx
leaq 0x4(%rsp), %r15
leaq 0x3c(%rsp), %r12
leaq 0x88(%rsp), %r13
leaq 0x58(%rsp), %rbp
movq %rsp, %r14
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rax
cmpq %rsi, %rax
je 0x275f8
notq %rsi
addq %rax, %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0xe6d8
leaq 0x20(%rsp), %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %r13, %rcx
movq %rbx, %r8
callq 0xb9ef
movl %eax, (%rsp)
movq %rbp, %rdi
movq %r14, %rsi
callq 0x5af32
incl (%rax)
jmp 0x275b1
movq 0x7b9d9(%rip), %rdi     # 0xa2fd8
leaq 0x39fa0(%rip), %rsi     # 0x615a6
callq 0x21f0
movq 0x70(%rsp), %r12
movq 0x7b9c1(%rip), %rbx     # 0xa2fd8
leaq 0x39fa4(%rip), %r14     # 0x615c2
leaq 0x39f9f(%rip), %r15     # 0x615c4
leaq 0x60(%rsp), %r13
cmpq %r13, %r12
je 0x2766c
movl 0x20(%r12), %esi
movq %rbx, %rdi
callq 0x2140
movq %rax, %rdi
movq %r14, %rsi
callq 0x21f0
movl 0x24(%r12), %esi
movq %rax, %rdi
callq 0x2140
movq %rax, %rdi
movq %r15, %rsi
callq 0x21f0
movq %r12, %rdi
callq 0x2150
movq %rax, %r12
jmp 0x2762a
movq 0x7b965(%rip), %rdi     # 0xa2fd8
callq 0x2100
leaq 0x88(%rsp), %rdi
callq 0xb874
leaq 0x58(%rsp), %rdi
callq 0x5b15a
leaq 0x20(%rsp), %rdi
callq 0xea7c
leaq 0x8(%rsp), %rdi
callq 0xea7c
leaq 0x40(%rsp), %rdi
callq 0xea7c
addq $0x308, %rsp            # imm = 0x308
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x27707
movq %rax, %rbx
jmp 0x276fd
jmp 0x276cb
movq %rax, %rbx
jmp 0x27711
movq %rax, %rbx
jmp 0x276f3
jmp 0x276e3
jmp 0x276e3
jmp 0x276e3
jmp 0x276e3
jmp 0x276e3
jmp 0x276e3
jmp 0x276e3
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0xb874
leaq 0x58(%rsp), %rdi
callq 0x5b15a
leaq 0x20(%rsp), %rdi
callq 0xea7c
leaq 0x8(%rsp), %rdi
callq 0xea7c
leaq 0x40(%rsp), %rdi
callq 0xea7c
movq %rbx, %rdi
callq 0x2380
movq %rax, %rdi
callq 0xe6cc