// File: /workspace/github_cpp_makefile_star2_O1/lvandeve[P]lodepng/lodepng_util.cpp
// Function: lodepng::getFilterTypes(std::vector<unsigned char, std::allocator<unsigned char>>&, std::vector<unsigned char, std::allocator<unsigned char>> const&)
unsigned getFilterTypes(std::vector<unsigned char>& filterTypes, const std::vector<unsigned char>& png) {
  std::vector<std::vector<unsigned char> > passes;
  unsigned error = getFilterTypesInterlaced(passes, png);
  if(error) return error;

  if(passes.size() == 1) {
    filterTypes.swap(passes[0]);
  } else {
    // Simplify interlaced filter types to get a single filter value per scanline:
    // put pass 6 and 7 alternating in the one vector, these filters
    // correspond to the closest to what it would be for non-interlaced
    // image. If the image is only 1 pixel wide, pass 6 doesn't exist so the
    // alternative values column0 are used. The shift values are to match
    // the y position in the interlaced sub-images.
    // NOTE: the values 0-6 match Adam7's passes 1-7.
    const unsigned column0[8] = {0, 6, 4, 6, 2, 6, 4, 6};
    const unsigned column1[8] = {5, 6, 5, 6, 5, 6, 5, 6};
    const unsigned shift0[8] = {3, 1, 2, 1, 3, 1, 2, 1};
    const unsigned shift1[8] = {1, 1, 1, 1, 1, 1, 1, 1};
    lodepng::State state;
    unsigned w, h;
    lodepng_inspect(&w, &h, &state, png.empty() ? NULL : &png[0], png.size());
    const unsigned* column = w > 1 ? column1 : column0;
    const unsigned* shift = w > 1 ? shift1 : shift0;
    for(size_t i = 0; i < h; i++) {
      filterTypes.push_back(passes[column[i & 7u]][i >> shift[i & 7u]]);
    }
  }
  return 0; /* OK */
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x2b0, %rsp            # imm = 0x2B0
movq %rsi, %r14
movq %rdi, %rbx
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rdi
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
callq 0x11666
movl %eax, %ebp
testl %eax, %eax
jne 0x11c09
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
subq %rax, %rcx
cmpq $0x18, %rcx
jne 0x11b50
movups (%rbx), %xmm0
movq 0x10(%rbx), %rcx
movq (%rax), %rdx
movq %rdx, (%rbx)
movq 0x8(%rax), %rdx
movq %rdx, 0x8(%rbx)
movq 0x10(%rax), %rdx
movq %rdx, 0x10(%rbx)
movups %xmm0, (%rax)
movq %rcx, 0x10(%rax)
jmp 0x11c07
leaq 0x30(%rsp), %rdi
callq 0xd1a0
movq (%r14), %rax
movq 0x8(%r14), %r8
xorl %ecx, %ecx
subq %rax, %r8
cmovneq %rax, %rcx
leaq 0xc(%rsp), %rdi
leaq 0x8(%rsp), %rsi
leaq 0x30(%rsp), %rdx
callq 0x7c69
cmpl $0x2, 0xc(%rsp)
leaq 0x64386(%rip), %rax     # 0x75f10
leaq 0x6435f(%rip), %r14     # 0x75ef0
cmovaeq %rax, %r14
leaq 0x643b4(%rip), %rax     # 0x75f50
leaq 0x6438d(%rip), %r15     # 0x75f30
cmovaeq %rax, %r15
cmpl $0x0, 0x8(%rsp)
je 0x11bfd
xorl %r12d, %r12d
movl %r12d, %eax
andl $0x7, %eax
shll $0x2, %eax
movl (%r14,%rax), %esi
movb (%r15,%rax), %cl
movq %r12, %rdx
shrq %cl, %rdx
movq 0x10(%rsp), %rax
leaq (%rsi,%rsi,2), %rcx
addq (%rax,%rcx,8), %rdx
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x11be9
movb (%rdx), %al
movb %al, (%rsi)
incq 0x8(%rbx)
jmp 0x11bf1
movq %rbx, %rdi
callq 0x16342
incq %r12
movl 0x8(%rsp), %eax
cmpq %rax, %r12
jb 0x11bb1
leaq 0x30(%rsp), %rdi
callq 0xd1c8
xorl %ebp, %ebp
leaq 0x10(%rsp), %rdi
callq 0x1513a
movl %ebp, %eax
addq $0x2b0, %rsp            # imm = 0x2B0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x11c2e
jmp 0x11c29
movq %rax, %rbx
jmp 0x11c3b
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0xd1c8
leaq 0x10(%rsp), %rdi
callq 0x1513a
movq %rbx, %rdi
callq 0x23b0
movq %rax, %rdi
callq 0x14f59