// File: lvandeve[P]lodepng/lodepng_util.cpp
// Function: lodepng::getChunkInfo(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>&, std::vector<unsigned long, std::allocator<unsigned long>>&, std::vector<unsigned char, std::allocator<unsigned char>> const&)
unsigned getChunkInfo(std::vector<std::string>& names, std::vector<size_t>& sizes,
                      const std::vector<unsigned char>& png) {
  // Listing chunks is based on the original file, not the decoded png info.
  const unsigned char *chunk, *end;
  end = &png.back() + 1;
  chunk = &png.front() + 8;

  while(chunk < end && end - chunk >= 8) {
    char type[5];
    lodepng_chunk_type(type, chunk);
    if(std::string(type).size() != 4) return 1;

    unsigned length = lodepng_chunk_length(chunk);
    names.push_back(type);
    sizes.push_back(length);
    chunk = lodepng_chunk_next_const(chunk, end);
  }
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0x23160
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rdi
callq 0x231a0
addq $0x8, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rcx
xorl %eax, %eax
cmpq -0x30(%rbp), %rcx
movb %al, -0xa1(%rbp)
jae 0x1c243
movq -0x30(%rbp), %rax
movq -0x28(%rbp), %rcx
subq %rcx, %rax
cmpq $0x8, %rax
setge %al
movb %al, -0xa1(%rbp)
movb -0xa1(%rbp), %al
testb $0x1, %al
jne 0x1c252
jmp 0x1c3f0
movq -0x28(%rbp), %rsi
leaq -0x35(%rbp), %rdi
movq %rdi, -0xb8(%rbp)
callq 0x4de0
leaq -0x59(%rbp), %rdi
movq %rdi, -0xb0(%rbp)
callq 0x3440
movq -0xb8(%rbp), %rsi
movq -0xb0(%rbp), %rdx
leaq -0x58(%rbp), %rdi
callq 0x3340
jmp 0x1c28f
leaq -0x58(%rbp), %rdi
callq 0x3190
movq %rax, -0xc0(%rbp)
jmp 0x1c2a1
movq -0xc0(%rbp), %rax
subq $0x4, %rax
setne %al
movb %al, -0xc1(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x34a8
jmp 0x1c2c0
leaq -0x59(%rbp), %rdi
callq 0x3290
movb -0xc1(%rbp), %al
testb $0x1, %al
jne 0x1c2d5
jmp 0x1c316
movl $0x1, -0x4(%rbp)
jmp 0x1c3f7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x1c308
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x34a8
jmp 0x1c306
jmp 0x1c308
leaq -0x59(%rbp), %rdi
callq 0x3290
jmp 0x1c403
movq -0x28(%rbp), %rdi
callq 0x4d80
movl %eax, -0x70(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xd8(%rbp)
leaq -0x91(%rbp), %rdi
movq %rdi, -0xd0(%rbp)
callq 0x3440
movq -0xd0(%rbp), %rdx
leaq -0x90(%rbp), %rdi
leaq -0x35(%rbp), %rsi
callq 0x3340
jmp 0x1c359
movq -0xd8(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x231d0
jmp 0x1c36e
leaq -0x90(%rbp), %rdi
callq 0x34a8
jmp 0x1c37c
leaq -0x91(%rbp), %rdi
callq 0x3290
movq -0x18(%rbp), %rdi
movl -0x70(%rbp), %eax
movq %rax, -0xa0(%rbp)
leaq -0xa0(%rbp), %rsi
callq 0x23240
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x51c0
movq %rax, -0x28(%rbp)
jmp 0x1c219
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x1c3e2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x34a8
jmp 0x1c3e0
jmp 0x1c3e2
leaq -0x91(%rbp), %rdi
callq 0x3290
jmp 0x1c403
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xe0, %rsp
popq %rbp
retq
movq -0x68(%rbp), %rdi
callq 0x3430
movq %rax, %rdi
callq 0x1a490
nopw %cs:(%rax,%rax)