// File: /workspace/github_cpp_makefile_star2_O3/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 0x112e2
movl %eax, %ebp
testl %eax, %eax
jne 0x11895
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
subq %rax, %rcx
cmpq $0x18, %rcx
jne 0x117dc
movq 0x10(%rbx), %rcx
movups (%rax), %xmm0
movups (%rbx), %xmm1
movups %xmm0, (%rbx)
movq 0x10(%rax), %rdx
movq %rdx, 0x10(%rbx)
movups %xmm1, (%rax)
movq %rcx, 0x10(%rax)
jmp 0x11893
leaq 0x30(%rsp), %rdi
callq 0xd3c8
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 0x8215
cmpl $0x2, 0xc(%rsp)
leaq 0x648ea(%rip), %rax     # 0x76100
leaq 0x648c3(%rip), %r14     # 0x760e0
cmovaeq %rax, %r14
leaq 0x64918(%rip), %rax     # 0x76140
leaq 0x648f1(%rip), %r15     # 0x76120
cmovaeq %rax, %r15
cmpl $0x0, 0x8(%rsp)
je 0x11889
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 0x11875
movb (%rdx), %al
movb %al, (%rsi)
incq 0x8(%rbx)
jmp 0x1187d
movq %rbx, %rdi
callq 0x16120
incq %r12
movl 0x8(%rsp), %eax
cmpq %rax, %r12
jb 0x1183d
leaq 0x30(%rsp), %rdi
callq 0xd3f0
xorl %ebp, %ebp
leaq 0x10(%rsp), %rdi
callq 0x14f28
movl %ebp, %eax
addq $0x2b0, %rsp            # imm = 0x2B0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x118ba
jmp 0x118b5
movq %rax, %rbx
jmp 0x118c7
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0xd3f0
leaq 0x10(%rsp), %rdi
callq 0x14f28
movq %rbx, %rdi
callq 0x23c0
movq %rax, %rdi
callq 0x14d36