// File: /workspace/github_cpp_makefile_star2_O2/lvandeve[P]lodepng/pngdetail.cpp
// Function: loadWithErrorRecovery(Data&, Options const&, bool)
void loadWithErrorRecovery(Data& data, const Options& options, bool show_errors_mode) {
  (void)options;
  unsigned& error = data.error;
  lodepng::State& state = data.state;

  data.loadPixels();

  if(show_errors_mode) {
    if(!error) std::cout << "No errors or warnings" << std::endl;
    return;
  }

  // In case of checksum errors and some other ignorable errors, report it but ignore it and retry
  while(error) {
    // Not showing regular error here, is shown at end of program.
    unsigned error2 = error;
    if(error == 57) {
      showError(data, options);
      if(!show_errors_mode) std::cerr << "Ignoring the error: enabling ignore_crc" << std::endl;
      state.decoder.ignore_crc = 1;
      data.reloadPixels();
    } else if(error == 58) {
      showError(data, options);
      if(!show_errors_mode) std::cerr << "Ignoring the error: enabling ignore_adler32" << std::endl;
      state.decoder.zlibsettings.ignore_adler32 = 1;
      data.reloadPixels();
    } else if(error == 69) {
      showError(data, options);
      if(!show_errors_mode) std::cerr << "Ignoring the error: enabling ignore_critical" << std::endl;
      state.decoder.ignore_critical = 1;
      data.reloadPixels();
    } else if(error == 30 || error == 63) {
      showError(data, options);
      if(!show_errors_mode) std::cerr << "Ignoring the error: enabling ignore_end" << std::endl;
      state.decoder.ignore_end = 1;
      data.reloadPixels();
    } else {
      showError(data, options);
      if(!show_errors_mode) std::cerr << "This error is unrecoverable" << std::endl;
      break;  // other error that we cannot ignore
    }
    if(!show_errors_mode) if(error == 0) std::cerr << "Successfully ignored the error" << std::endl;
    if(error == error2) {
      if(!show_errors_mode) std::cerr << "Failed to ignore the error" << std::endl;
      break; // avoid infinite loop if ignoring did not fix the error code
    }
  }

  if(show_errors_mode) {
    if(!error) std::cout << "The error is recoverable" << std::endl;
    else std::cout << "The error is not recoverable" << std::endl;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
callq 0x19322
testl %ebp, %ebp
je 0x1530a
cmpl $0x0, 0x2d8(%r14)
je 0x15444
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl 0x2d8(%r14), %ebp
movq 0x11cd8(%rip), %r15     # 0x26ff0
leaq 0x9814(%rip), %r12      # 0x1eb33
leaq 0x9851(%rip), %r13      # 0x1eb77
cmpl $0x1e, %ebp
je 0x15379
cmpl $0x39, %ebp
je 0x153d0
cmpl $0x3a, %ebp
je 0x153a4
cmpl $0x3f, %ebp
je 0x15379
cmpl $0x45, %ebp
jne 0x15454
movq %r14, %rdi
movq %rbx, %rsi
callq 0x151c7
movq %r15, %rdi
leaq 0x97aa(%rip), %rsi      # 0x1eb06
callq 0x2210
movq %rax, %rdi
callq 0x2100
movl $0x1, 0x84(%r14)
jmp 0x153fd
movq %r14, %rdi
movq %rbx, %rsi
callq 0x151c7
movq %r15, %rdi
movq %r12, %rsi
callq 0x2210
movq %rax, %rdi
callq 0x2100
movl $0x1, 0x88(%r14)
jmp 0x153fd
movq %r14, %rdi
movq %rbx, %rsi
callq 0x151c7
movq %r15, %rdi
leaq 0x9721(%rip), %rsi      # 0x1eada
callq 0x2210
movq %rax, %rdi
callq 0x2100
movl $0x1, 0x58(%r14)
jmp 0x153fd
movq %r14, %rdi
movq %rbx, %rsi
callq 0x151c7
movq %r15, %rdi
leaq 0x96cd(%rip), %rsi      # 0x1eab2
callq 0x2210
movq %rax, %rdi
callq 0x2100
movl $0x1, 0x80(%r14)
movq %r14, %rdi
callq 0x19332
movl 0x2d8(%r14), %eax
testl %eax, %eax
jne 0x1542a
movq %r15, %rdi
movq %r13, %rsi
callq 0x2210
movq %rax, %rdi
callq 0x2100
movl 0x2d8(%r14), %eax
cmpl %ebp, %eax
movl %eax, %ebp
jne 0x15326
movq 0x11bb5(%rip), %rdi     # 0x26ff0
leaq 0x9754(%rip), %rsi      # 0x1eb96
jmp 0x15475
movq 0x11b85(%rip), %rdi     # 0x26fd0
leaq 0x964a(%rip), %rsi      # 0x1ea9c
jmp 0x15475
testl %ebp, %ebp
je 0x152fb
movq %r14, %rdi
movq %rbx, %rsi
callq 0x151c7
movq 0x11b82(%rip), %rdi     # 0x26ff0
leaq 0x96e6(%rip), %rsi      # 0x1eb5b
callq 0x2210
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2100