// File: lvandeve[P]lodepng/lodepng_unittest.cpp
// Function: testPaletteToPaletteConvert()
void testPaletteToPaletteConvert() {
  std::cout << "testPaletteToPaletteConvert" << std::endl;
  unsigned error;
  unsigned w = 16, h = 16;
  std::vector<unsigned char> image(w * h);
  for(size_t i = 0; i < w * h; i++) image[i] = i % 256;
  lodepng::State state;
  LodePNGInfo& info = state.info_png;
  info.color.colortype = state.info_raw.colortype = LCT_PALETTE;
  info.color.bitdepth = state.info_raw.bitdepth = 8;
  ASSERT_EQUALS(true, state.encoder.auto_convert);
  for(size_t i = 0; i < 256; i++) {
    lodepng_palette_add(&info.color, i, i, i, i);
  }
  std::vector<unsigned char> png;
  for(size_t i = 0; i < 256; i++) {
    lodepng_palette_add(&state.info_raw, i, i, i, i);
  }
  error = lodepng::encode(png, &image[0], w, h, state);
  ASSERT_NO_PNG_ERROR(error);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x550, %rsp            # imm = 0x550
movq 0xb0c46(%rip), %rdi     # 0xf7fd8
leaq 0x6cf1a(%rip), %rsi     # 0xb42b3
callq 0x3230
movq %rax, %rdi
movq 0xb0c18(%rip), %rsi     # 0xf7fc0
callq 0x3280
movl $0x10, -0x8(%rbp)
movl $0x10, -0xc(%rbp)
movl -0x8(%rbp), %eax
movl -0xc(%rbp), %ecx
imull %ecx, %eax
movq %rax, -0x4d0(%rbp)
movb $0x0, -0x29(%rbp)
leaq -0x2a(%rbp), %rdi
movq %rdi, -0x4c8(%rbp)
callq 0x1bfa0
movq -0x4d0(%rbp), %rsi
movq -0x4c8(%rbp), %rcx
leaq -0x28(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0xaab60
jmp 0x473fc
leaq -0x2a(%rbp), %rdi
callq 0x1bff0
movq $0x0, -0x48(%rbp)
movq -0x48(%rbp), %rax
movl -0x8(%rbp), %ecx
imull -0xc(%rbp), %ecx
movl %ecx, %ecx
cmpq %rcx, %rax
jae 0x47486
movq -0x48(%rbp), %rsi
movb %sil, %al
movb %al, -0x4d9(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x1a5f0
movq %rax, -0x4d8(%rbp)
jmp 0x4743e
movq -0x4d8(%rbp), %rax
movb -0x4d9(%rbp), %cl
movb %cl, (%rax)
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x4740d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x2a(%rbp), %rdi
callq 0x1bff0
jmp 0x47cb0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x47ca3
leaq -0x2c8(%rbp), %rdi
callq 0x11ad0
jmp 0x47494
leaq -0x2c8(%rbp), %rax
addq $0xd0, %rax
movq %rax, -0x2d0(%rbp)
movl $0x3, -0x220(%rbp)
movq -0x2d0(%rbp), %rax
movl $0x3, 0x10(%rax)
movl $0x8, -0x21c(%rbp)
movq -0x2d0(%rbp), %rax
movl $0x8, 0x14(%rax)
movl $0x1, %eax
cmpl -0x248(%rbp), %eax
je 0x477ed
leaq -0x371(%rbp), %rdi
movq %rdi, -0x4e8(%rbp)
callq 0x3440
movq -0x4e8(%rbp), %rdx
leaq 0x6bc0b(%rip), %rsi     # 0xb3115
leaq -0x370(%rbp), %rdi
callq 0x3340
jmp 0x47518
leaq 0x6cdb0(%rip), %rdx     # 0xb42cf
leaq -0x350(%rbp), %rdi
leaq -0x370(%rbp), %rsi
callq 0xaa1b0
jmp 0x47534
leaq 0x6f1a8(%rip), %rdx     # 0xb66e3
leaq -0x330(%rbp), %rdi
leaq -0x350(%rbp), %rsi
callq 0xaa1b0
jmp 0x47550
leaq 0x6cd7d(%rip), %rdx     # 0xb42d4
leaq -0x310(%rbp), %rdi
leaq -0x330(%rbp), %rsi
callq 0xaa1b0
jmp 0x4756c
leaq 0x6bbea(%rip), %rdx     # 0xb315d
leaq -0x2f0(%rbp), %rdi
leaq -0x310(%rbp), %rsi
callq 0xaa1b0
jmp 0x47588
movq 0xb0a49(%rip), %rdi     # 0xf7fd8
leaq -0x2f0(%rbp), %rsi
callq 0x3200
jmp 0x4759d
leaq -0x2f0(%rbp), %rdi
callq 0x34a8
jmp 0x475ab
leaq -0x310(%rbp), %rdi
callq 0x34a8
jmp 0x475b9
leaq -0x330(%rbp), %rdi
callq 0x34a8
jmp 0x475c7
leaq -0x350(%rbp), %rdi
callq 0x34a8
jmp 0x475d5
leaq -0x370(%rbp), %rdi
callq 0x34a8
jmp 0x475e3
leaq -0x371(%rbp), %rdi
callq 0x3290
movq 0xb09e2(%rip), %rdi     # 0xf7fd8
leaq 0x9484e(%rip), %rsi     # 0xdbe4b
callq 0x3230
movq %rax, -0x4f0(%rbp)
jmp 0x4760b
movb $0x1, -0x399(%rbp)
leaq -0x398(%rbp), %rdi
leaq -0x399(%rbp), %rsi
callq 0xab1f0
jmp 0x47627
movq -0x4f0(%rbp), %rdi
leaq -0x398(%rbp), %rsi
callq 0x3200
movq %rax, -0x4f8(%rbp)
jmp 0x47643
movq -0x4f8(%rbp), %rdi
leaq 0x6bb24(%rip), %rsi     # 0xb3175
callq 0x3230
movq %rax, -0x500(%rbp)
jmp 0x4765f
leaq -0x248(%rbp), %rsi
leaq -0x3c0(%rbp), %rdi
callq 0xaa7f0
jmp 0x47674
movq -0x500(%rbp), %rdi
leaq -0x3c0(%rbp), %rsi
callq 0x3200
movq %rax, -0x508(%rbp)
jmp 0x47690
movq -0x508(%rbp), %rdi
leaq 0x6b9be(%rip), %rsi     # 0xb305c
callq 0x3230
movq %rax, -0x510(%rbp)
jmp 0x476ac
movq -0x510(%rbp), %rdi
movq 0xb0906(%rip), %rsi     # 0xf7fc0
callq 0x3280
jmp 0x476c1
leaq -0x3c0(%rbp), %rdi
callq 0x34a8
jmp 0x476cf
leaq -0x398(%rbp), %rdi
callq 0x34a8
jmp 0x476dd
callq 0x28bd0
jmp 0x476e4
jmp 0x477ed
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x4778e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x4777e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x4776e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x4775e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x4774e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x2f0(%rbp), %rdi
callq 0x34a8
jmp 0x4774c
jmp 0x4774e
leaq -0x310(%rbp), %rdi
callq 0x34a8
jmp 0x4775c
jmp 0x4775e
leaq -0x330(%rbp), %rdi
callq 0x34a8
jmp 0x4776c
jmp 0x4776e
leaq -0x350(%rbp), %rdi
callq 0x34a8
jmp 0x4777c
jmp 0x4777e
leaq -0x370(%rbp), %rdi
callq 0x34a8
jmp 0x4778c
jmp 0x4778e
leaq -0x371(%rbp), %rdi
callq 0x3290
jmp 0x47c93
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x47c93
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x477da
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x3c0(%rbp), %rdi
callq 0x34a8
jmp 0x477d8
jmp 0x477da
leaq -0x398(%rbp), %rdi
callq 0x34a8
jmp 0x477e8
jmp 0x47c93
movq $0x0, -0x3c8(%rbp)
cmpq $0x100, -0x3c8(%rbp) # imm = 0x100
jae 0x4783e
movq -0x2d0(%rbp), %rdi
addq $0x10, %rdi
movzbl -0x3c8(%rbp), %r8d
movl %r8d, %esi
movl %r8d, %edx
movl %r8d, %ecx
callq 0x58b0
jmp 0x47828
jmp 0x4782a
movq -0x3c8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x3c8(%rbp)
jmp 0x477f8
leaq -0x3e0(%rbp), %rdi
callq 0x1a4a0
jmp 0x4784c
movq $0x0, -0x3e8(%rbp)
cmpq $0x100, -0x3e8(%rbp) # imm = 0x100
jae 0x478aa
leaq -0x220(%rbp), %rdi
movzbl -0x3e8(%rbp), %r8d
movl %r8d, %esi
movl %r8d, %edx
movl %r8d, %ecx
callq 0x58b0
jmp 0x47883
jmp 0x47885
movq -0x3e8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x3e8(%rbp)
jmp 0x47857
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x47c83
xorl %eax, %eax
movl %eax, %esi
leaq -0x28(%rbp), %rdi
callq 0x1a5f0
movq %rax, -0x518(%rbp)
jmp 0x478c0
movq -0x518(%rbp), %rsi
movl -0x8(%rbp), %edx
movl -0xc(%rbp), %ecx
leaq -0x3e0(%rbp), %rdi
leaq -0x2c8(%rbp), %r8
callq 0x120f0
movl %eax, -0x51c(%rbp)
jmp 0x478e8
movl -0x51c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
movl %eax, -0x52c(%rbp)
leaq -0x449(%rbp), %rdi
movq %rdi, -0x528(%rbp)
callq 0x3440
movq -0x528(%rbp), %rdx
leaq 0x6b7fa(%rip), %rsi     # 0xb3115
leaq -0x448(%rbp), %rdi
callq 0x3340
jmp 0x47929
leaq 0x6c9bf(%rip), %rdx     # 0xb42ef
leaq -0x428(%rbp), %rdi
leaq -0x448(%rbp), %rsi
callq 0xaa1b0
jmp 0x47945
leaq -0x491(%rbp), %rdi
movq %rdi, -0x538(%rbp)
callq 0x3440
movq -0x538(%rbp), %rdx
movb $0x0, -0x493(%rbp)
movb $0x0, -0x4ba(%rbp)
movb $0x0, -0x4bb(%rbp)
leaq 0x6cb89(%rip), %rsi     # 0xb4504
leaq -0x490(%rbp), %rdi
callq 0x3340
jmp 0x47989
leaq -0x490(%rbp), %rdi
callq 0x33f0
movb %al, -0x539(%rbp)
jmp 0x4799d
movb -0x539(%rbp), %al
testb $0x1, %al
jne 0x479a9
jmp 0x479e1
leaq -0x492(%rbp), %rdi
movq %rdi, -0x548(%rbp)
callq 0x3440
movq -0x548(%rbp), %rdx
movb $0x1, -0x493(%rbp)
leaq 0x6cb33(%rip), %rsi     # 0xb4504
leaq -0x470(%rbp), %rdi
callq 0x3340
jmp 0x479df
jmp 0x47a3c
leaq -0x4b9(%rbp), %rdi
movq %rdi, -0x550(%rbp)
callq 0x3440
movq -0x550(%rbp), %rdx
movb $0x1, -0x4ba(%rbp)
leaq 0x6cafb(%rip), %rsi     # 0xb4504
leaq -0x4b8(%rbp), %rdi
callq 0x3340
jmp 0x47a17
movb $0x1, -0x4bb(%rbp)
leaq 0x6ecbe(%rip), %rsi     # 0xb66e3
leaq -0x470(%rbp), %rdi
leaq -0x4b8(%rbp), %rdx
callq 0xaa6d0
jmp 0x47a3a
jmp 0x47a3c
leaq -0x408(%rbp), %rdi
leaq -0x428(%rbp), %rsi
leaq -0x470(%rbp), %rdx
callq 0xaa240
jmp 0x47a58
movl -0x52c(%rbp), %edi
leaq -0x408(%rbp), %rsi
callq 0x28d30
jmp 0x47a6c
leaq -0x408(%rbp), %rdi
callq 0x34a8
jmp 0x47a7a
leaq -0x470(%rbp), %rdi
callq 0x34a8
jmp 0x47a88
testb $0x1, -0x4bb(%rbp)
jne 0x47a93
jmp 0x47aa3
leaq -0x4b8(%rbp), %rdi
callq 0x34a8
jmp 0x47aa1
jmp 0x47aa3
testb $0x1, -0x4ba(%rbp)
jne 0x47aae
jmp 0x47aba
leaq -0x4b9(%rbp), %rdi
callq 0x3290
testb $0x1, -0x493(%rbp)
jne 0x47ac5
jmp 0x47ad1
leaq -0x492(%rbp), %rdi
callq 0x3290
leaq -0x490(%rbp), %rdi
callq 0x34a8
jmp 0x47adf
leaq -0x491(%rbp), %rdi
callq 0x3290
leaq -0x428(%rbp), %rdi
callq 0x34a8
jmp 0x47af9
leaq -0x448(%rbp), %rdi
callq 0x34a8
jmp 0x47b07
leaq -0x449(%rbp), %rdi
callq 0x3290
leaq -0x3e0(%rbp), %rdi
callq 0x1a4c0
jmp 0x47b21
leaq -0x2c8(%rbp), %rdi
callq 0x11b20
jmp 0x47b2f
leaq -0x28(%rbp), %rdi
callq 0x1a4c0
addq $0x550, %rsp            # imm = 0x550
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x47c77
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x47c67
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x47c4b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x47c3b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x47c22
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x47c09
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x47bec
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x47bdc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x408(%rbp), %rdi
callq 0x34a8
jmp 0x47bda
jmp 0x47bdc
leaq -0x470(%rbp), %rdi
callq 0x34a8
jmp 0x47bea
jmp 0x47bec
testb $0x1, -0x4bb(%rbp)
jne 0x47bf7
jmp 0x47c07
leaq -0x4b8(%rbp), %rdi
callq 0x34a8
jmp 0x47c05
jmp 0x47c07
jmp 0x47c09
testb $0x1, -0x4ba(%rbp)
jne 0x47c14
jmp 0x47c20
leaq -0x4b9(%rbp), %rdi
callq 0x3290
jmp 0x47c22
testb $0x1, -0x493(%rbp)
jne 0x47c2d
jmp 0x47c39
leaq -0x492(%rbp), %rdi
callq 0x3290
jmp 0x47c3b
leaq -0x490(%rbp), %rdi
callq 0x34a8
jmp 0x47c49
jmp 0x47c4b
leaq -0x491(%rbp), %rdi
callq 0x3290
leaq -0x428(%rbp), %rdi
callq 0x34a8
jmp 0x47c65
jmp 0x47c67
leaq -0x448(%rbp), %rdi
callq 0x34a8
jmp 0x47c75
jmp 0x47c77
leaq -0x449(%rbp), %rdi
callq 0x3290
leaq -0x3e0(%rbp), %rdi
callq 0x1a4c0
jmp 0x47c91
jmp 0x47c93
leaq -0x2c8(%rbp), %rdi
callq 0x11b20
jmp 0x47ca1
jmp 0x47ca3
leaq -0x28(%rbp), %rdi
callq 0x1a4c0
jmp 0x47cae
jmp 0x47cb0
movq -0x38(%rbp), %rdi
callq 0x3430
movq %rax, %rdi
callq 0x1a490
nopw %cs:(%rax,%rax)