// File: lvandeve[P]lodepng/pngdetail.cpp
// Function: displayColorsHex(std::vector<unsigned char, std::allocator<unsigned char>> const&, unsigned int, unsigned int, bool)
void displayColorsHex(const std::vector<unsigned char>& image, unsigned w, unsigned h, bool sixteen) {
  std::ios_base::fmtflags flags = std::cout.flags();

  if(w > 0 && h > 0) {
    std::cout << "Colors (CSS RGBA hex format):" << std::endl;

    for(unsigned y = 0; y < h; y++) {
      std::cout.flags(flags); //print line numbers in hex or dec whatever it originally was
      std::cout << y << ":";
      for(unsigned x = 0; x < w; x++) {
        size_t index = y * w * 8 + x * 8;
        if (sixteen) {
          int r = image[index + 0] * 256 + image[index + 1];
          int g = image[index + 2] * 256 + image[index + 3];
          int b = image[index + 4] * 256 + image[index + 5];
          int a = image[index + 6] * 256 + image[index + 7];
          std::cout << std::hex << std::setfill('0') << " #" << std::setw(4) << r << std::setw(4) << g << std::setw(4) << b << std::setw(4) << a;
        } else {
          int r = image[index + 0];
          int g = image[index + 2];
          int b = image[index + 4];
          int a = image[index + 6];
          std::cout << std::hex << std::setfill('0') << " #" << std::setw(2) << r << std::setw(2) << g << std::setw(2) << b << std::setw(2) << a;
        }
      }
      std::cout << std::endl;
    }
  }

  std::cout.flags(flags);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movb %cl, %al
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
andb $0x1, %al
movb %al, -0x11(%rbp)
movq 0x1d2ad(%rip), %rax     # 0x46fd0
movq (%rax), %rax
movq 0x1d2a3(%rip), %rdi     # 0x46fd0
addq -0x18(%rax), %rdi
callq 0x32230
movl %eax, -0x18(%rbp)
cmpl $0x0, -0xc(%rbp)
jbe 0x2a172
cmpl $0x0, -0x10(%rbp)
jbe 0x2a172
movq 0x1d27c(%rip), %rdi     # 0x46fd0
leaq 0x107c1(%rip), %rsi     # 0x3a51c
callq 0x2250
movq %rax, %rdi
movq 0x1d256(%rip), %rsi     # 0x46fc0
callq 0x22a0
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x10(%rbp), %eax
jae 0x2a170
movq 0x1d247(%rip), %rax     # 0x46fd0
movq (%rax), %rax
movq 0x1d23d(%rip), %rdi     # 0x46fd0
addq -0x18(%rax), %rdi
movl -0x18(%rbp), %esi
callq 0x32250
movl -0x1c(%rbp), %esi
movq 0x1d227(%rip), %rdi     # 0x46fd0
callq 0x2340
movq %rax, %rdi
leaq 0x107bf(%rip), %rsi     # 0x3a577
callq 0x2250
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0xc(%rbp), %eax
jae 0x2a14f
movl -0x1c(%rbp), %eax
imull -0xc(%rbp), %eax
shll $0x3, %eax
movl -0x20(%rbp), %ecx
shll $0x3, %ecx
addl %ecx, %eax
movl %eax, %eax
movq %rax, -0x28(%rbp)
testb $0x1, -0x11(%rbp)
je 0x29fe5
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
addq $0x0, %rsi
callq 0x19350
movzbl (%rax), %eax
shll $0x8, %eax
movl %eax, -0xa8(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
addq $0x1, %rsi
callq 0x19350
movq %rax, %rcx
movl -0xa8(%rbp), %eax
movzbl (%rcx), %ecx
addl %ecx, %eax
movl %eax, -0x2c(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
addq $0x2, %rsi
callq 0x19350
movzbl (%rax), %eax
shll $0x8, %eax
movl %eax, -0xa4(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
addq $0x3, %rsi
callq 0x19350
movq %rax, %rcx
movl -0xa4(%rbp), %eax
movzbl (%rcx), %ecx
addl %ecx, %eax
movl %eax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
addq $0x4, %rsi
callq 0x19350
movzbl (%rax), %eax
shll $0x8, %eax
movl %eax, -0xa0(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
addq $0x5, %rsi
callq 0x19350
movq %rax, %rcx
movl -0xa0(%rbp), %eax
movzbl (%rcx), %ecx
addl %ecx, %eax
movl %eax, -0x34(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
addq $0x6, %rsi
callq 0x19350
movzbl (%rax), %eax
shll $0x8, %eax
movl %eax, -0x9c(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
addq $0x7, %rsi
callq 0x19350
movq %rax, %rcx
movl -0x9c(%rbp), %eax
movzbl (%rcx), %ecx
addl %ecx, %eax
movl %eax, -0x38(%rbp)
movq 0x1d0db(%rip), %rdi     # 0x46fd0
leaq 0x7d54(%rip), %rsi      # 0x31c50
callq 0x20b0
movq %rax, -0x98(%rbp)
movl $0x30, %edi
callq 0x32270
movq -0x98(%rbp), %rdi
movb %al, -0x39(%rbp)
movzbl -0x39(%rbp), %esi
callq 0x23c0
movq %rax, %rdi
leaq 0x1060b(%rip), %rsi     # 0x3a53a
callq 0x2250
movq %rax, -0x90(%rbp)
movl $0x4, %edi
callq 0x32290
movq -0x90(%rbp), %rdi
movl %eax, -0x40(%rbp)
movl -0x40(%rbp), %esi
callq 0x22e0
movq %rax, %rdi
movl -0x2c(%rbp), %esi
callq 0x2420
movq %rax, -0x88(%rbp)
movl $0x4, %edi
callq 0x32290
movq -0x88(%rbp), %rdi
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %esi
callq 0x22e0
movq %rax, %rdi
movl -0x30(%rbp), %esi
callq 0x2420
movq %rax, -0x80(%rbp)
movl $0x4, %edi
callq 0x32290
movq -0x80(%rbp), %rdi
movl %eax, -0x48(%rbp)
movl -0x48(%rbp), %esi
callq 0x22e0
movq %rax, %rdi
movl -0x34(%rbp), %esi
callq 0x2420
movq %rax, -0x78(%rbp)
movl $0x4, %edi
callq 0x32290
movq -0x78(%rbp), %rdi
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %esi
callq 0x22e0
movq %rax, %rdi
movl -0x38(%rbp), %esi
callq 0x2420
jmp 0x2a13f
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
addq $0x0, %rsi
callq 0x19350
movzbl (%rax), %eax
movl %eax, -0x50(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
addq $0x2, %rsi
callq 0x19350
movzbl (%rax), %eax
movl %eax, -0x54(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
addq $0x4, %rsi
callq 0x19350
movzbl (%rax), %eax
movl %eax, -0x58(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
addq $0x6, %rsi
callq 0x19350
movzbl (%rax), %eax
movl %eax, -0x5c(%rbp)
movq 0x1cf88(%rip), %rdi     # 0x46fd0
leaq 0x7c01(%rip), %rsi      # 0x31c50
callq 0x20b0
movq %rax, -0xd0(%rbp)
movl $0x30, %edi
callq 0x32270
movq -0xd0(%rbp), %rdi
movb %al, -0x5d(%rbp)
movzbl -0x5d(%rbp), %esi
callq 0x23c0
movq %rax, %rdi
leaq 0x104b8(%rip), %rsi     # 0x3a53a
callq 0x2250
movq %rax, -0xc8(%rbp)
movl $0x2, %edi
callq 0x32290
movq -0xc8(%rbp), %rdi
movl %eax, -0x64(%rbp)
movl -0x64(%rbp), %esi
callq 0x22e0
movq %rax, %rdi
movl -0x50(%rbp), %esi
callq 0x2420
movq %rax, -0xc0(%rbp)
movl $0x2, %edi
callq 0x32290
movq -0xc0(%rbp), %rdi
movl %eax, -0x68(%rbp)
movl -0x68(%rbp), %esi
callq 0x22e0
movq %rax, %rdi
movl -0x54(%rbp), %esi
callq 0x2420
movq %rax, -0xb8(%rbp)
movl $0x2, %edi
callq 0x32290
movq -0xb8(%rbp), %rdi
movl %eax, -0x6c(%rbp)
movl -0x6c(%rbp), %esi
callq 0x22e0
movq %rax, %rdi
movl -0x58(%rbp), %esi
callq 0x2420
movq %rax, -0xb0(%rbp)
movl $0x2, %edi
callq 0x32290
movq -0xb0(%rbp), %rdi
movl %eax, -0x70(%rbp)
movl -0x70(%rbp), %esi
callq 0x22e0
movq %rax, %rdi
movl -0x5c(%rbp), %esi
callq 0x2420
jmp 0x2a141
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x29dc4
movq 0x1ce7a(%rip), %rdi     # 0x46fd0
movq 0x1ce63(%rip), %rsi     # 0x46fc0
callq 0x22a0
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x29d76
jmp 0x2a172
movq 0x1ce57(%rip), %rax     # 0x46fd0
movq (%rax), %rax
movq 0x1ce4d(%rip), %rdi     # 0x46fd0
addq -0x18(%rax), %rdi
movl -0x18(%rbp), %esi
callq 0x32250
addq $0xd0, %rsp
popq %rbp
retq
nopl (%rax,%rax)