// File: lvandeve[P]lodepng/lodepng_unittest.cpp
// Function: testPredefinedFilters()
void testPredefinedFilters() {
  size_t w = 32, h = 32;
  std::cout << "testPredefinedFilters" << std::endl;
  Image image;
  generateTestImage(image, w, h, LCT_RGBA, 8);

  // everything to filter type '3'
  std::vector<unsigned char> predefined(h, 3);
  lodepng::State state;
  state.encoder.filter_strategy = LFS_PREDEFINED;
  state.encoder.filter_palette_zero = 0;
  state.encoder.predefined_filters = &predefined[0];

  std::vector<unsigned char> png;
  unsigned error = lodepng::encode(png, &image.data[0], w, h, state);
  assertNoError(error);

  std::vector<unsigned char> outfilters;
  error = lodepng::getFilterTypes(outfilters, png);
  assertNoError(error);

  ASSERT_EQUALS(outfilters.size(), h);
  for(size_t i = 0; i < h; i++) ASSERT_EQUALS(3, outfilters[i]);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x5c0, %rsp            # imm = 0x5C0
movq $0x20, -0x8(%rbp)
movq $0x20, -0x10(%rbp)
movq 0xa18b6(%rip), %rdi     # 0xf7fd8
leaq 0x5e2b6(%rip), %rsi     # 0xb49df
callq 0x3230
movq %rax, %rdi
movq 0xa1888(%rip), %rsi     # 0xf7fc0
callq 0x3280
leaq -0x38(%rbp), %rdi
movq %rdi, -0x510(%rbp)
callq 0xaaae0
movq -0x510(%rbp), %rdi
movl -0x8(%rbp), %esi
movl -0x10(%rbp), %edx
movl $0x6, %ecx
movl $0x8, %r8d
callq 0x29a40
jmp 0x5676c
movq -0x10(%rbp), %rax
movq %rax, -0x520(%rbp)
movb $0x3, -0x61(%rbp)
leaq -0x62(%rbp), %rdi
movq %rdi, -0x518(%rbp)
callq 0x1bfa0
movq -0x520(%rbp), %rsi
movq -0x518(%rbp), %rcx
leaq -0x60(%rbp), %rdi
leaq -0x61(%rbp), %rdx
callq 0xaab60
jmp 0x567a8
leaq -0x62(%rbp), %rdi
callq 0x1bff0
leaq -0x2e8(%rbp), %rdi
callq 0x11ad0
jmp 0x567bf
movl $0x8, -0x260(%rbp)
movl $0x0, -0x264(%rbp)
xorl %eax, %eax
movl %eax, %esi
leaq -0x60(%rbp), %rdi
callq 0x1a5f0
movq %rax, -0x528(%rbp)
jmp 0x567e9
movq -0x528(%rbp), %rax
movq %rax, -0x258(%rbp)
leaq -0x300(%rbp), %rdi
callq 0x1a4a0
jmp 0x56805
xorl %eax, %eax
movl %eax, %esi
leaq -0x38(%rbp), %rdi
callq 0x1a5f0
movq %rax, -0x530(%rbp)
jmp 0x5681b
movq -0x530(%rbp), %rsi
movl -0x8(%rbp), %edx
movl -0x10(%rbp), %ecx
leaq -0x300(%rbp), %rdi
leaq -0x2e8(%rbp), %r8
callq 0x120f0
movl %eax, -0x534(%rbp)
jmp 0x56843
movl -0x534(%rbp), %eax
movl %eax, -0x304(%rbp)
movl -0x304(%rbp), %edi
callq 0x28fb0
jmp 0x5685c
leaq -0x320(%rbp), %rdi
callq 0x1a4a0
jmp 0x5686a
leaq -0x320(%rbp), %rdi
leaq -0x300(%rbp), %rsi
callq 0x1daa0
movl %eax, -0x538(%rbp)
jmp 0x56885
movl -0x538(%rbp), %eax
movl %eax, -0x304(%rbp)
movl -0x304(%rbp), %edi
callq 0x28fb0
jmp 0x5689e
leaq -0x320(%rbp), %rdi
callq 0x1a400
movq %rax, -0x540(%rbp)
jmp 0x568b3
movq -0x540(%rbp), %rax
cmpq -0x10(%rbp), %rax
je 0x56c3f
leaq -0x3c1(%rbp), %rdi
movq %rdi, -0x548(%rbp)
callq 0x3440
movq -0x548(%rbp), %rdx
leaq 0x5c830(%rip), %rsi     # 0xb3115
leaq -0x3c0(%rbp), %rdi
callq 0x3340
jmp 0x568f3
leaq 0x5e0fb(%rip), %rdx     # 0xb49f5
leaq -0x3a0(%rbp), %rdi
leaq -0x3c0(%rbp), %rsi
callq 0xaa1b0
jmp 0x5690f
leaq 0x5fdcd(%rip), %rdx     # 0xb66e3
leaq -0x380(%rbp), %rdi
leaq -0x3a0(%rbp), %rsi
callq 0xaa1b0
jmp 0x5692b
leaq 0x5c859(%rip), %rdx     # 0xb318b
leaq -0x360(%rbp), %rdi
leaq -0x380(%rbp), %rsi
callq 0xaa1b0
jmp 0x56947
leaq 0x5c80f(%rip), %rdx     # 0xb315d
leaq -0x340(%rbp), %rdi
leaq -0x360(%rbp), %rsi
callq 0xaa1b0
jmp 0x56963
movq 0xa166e(%rip), %rdi     # 0xf7fd8
leaq -0x340(%rbp), %rsi
callq 0x3200
jmp 0x56978
leaq -0x340(%rbp), %rdi
callq 0x34a8
jmp 0x56986
leaq -0x360(%rbp), %rdi
callq 0x34a8
jmp 0x56994
leaq -0x380(%rbp), %rdi
callq 0x34a8
jmp 0x569a2
leaq -0x3a0(%rbp), %rdi
callq 0x34a8
jmp 0x569b0
leaq -0x3c0(%rbp), %rdi
callq 0x34a8
jmp 0x569be
leaq -0x3c1(%rbp), %rdi
callq 0x3290
movq 0xa1607(%rip), %rdi     # 0xf7fd8
leaq 0x85473(%rip), %rsi     # 0xdbe4b
callq 0x3230
movq %rax, -0x550(%rbp)
jmp 0x569e6
leaq -0x320(%rbp), %rdi
callq 0x1a400
movq %rax, -0x558(%rbp)
jmp 0x569fb
movq -0x558(%rbp), %rax
movq %rax, -0x3f0(%rbp)
leaq -0x3e8(%rbp), %rdi
leaq -0x3f0(%rbp), %rsi
callq 0xaa610
jmp 0x56a1e
movq -0x550(%rbp), %rdi
leaq -0x3e8(%rbp), %rsi
callq 0x3200
movq %rax, -0x560(%rbp)
jmp 0x56a3a
movq -0x560(%rbp), %rdi
leaq 0x5c72d(%rip), %rsi     # 0xb3175
callq 0x3230
movq %rax, -0x568(%rbp)
jmp 0x56a56
leaq -0x410(%rbp), %rdi
leaq -0x10(%rbp), %rsi
callq 0xaa610
jmp 0x56a68
movq -0x568(%rbp), %rdi
leaq -0x410(%rbp), %rsi
callq 0x3200
movq %rax, -0x570(%rbp)
jmp 0x56a84
movq -0x570(%rbp), %rdi
leaq 0x5c5ca(%rip), %rsi     # 0xb305c
callq 0x3230
movq %rax, -0x578(%rbp)
jmp 0x56aa0
movq -0x578(%rbp), %rdi
movq 0xa1512(%rip), %rsi     # 0xf7fc0
callq 0x3280
jmp 0x56ab5
leaq -0x410(%rbp), %rdi
callq 0x34a8
jmp 0x56ac3
leaq -0x3e8(%rbp), %rdi
callq 0x34a8
jmp 0x56ad1
callq 0x28bd0
jmp 0x56ad8
jmp 0x56c3f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x5703a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x62(%rbp), %rdi
callq 0x1bff0
jmp 0x5703a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x5702d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x5701d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x5700d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x56ffd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x56bf1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x56be1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x56bd1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x56bc1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x56bb1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x340(%rbp), %rdi
callq 0x34a8
jmp 0x56baf
jmp 0x56bb1
leaq -0x360(%rbp), %rdi
callq 0x34a8
jmp 0x56bbf
jmp 0x56bc1
leaq -0x380(%rbp), %rdi
callq 0x34a8
jmp 0x56bcf
jmp 0x56bd1
leaq -0x3a0(%rbp), %rdi
callq 0x34a8
jmp 0x56bdf
jmp 0x56be1
leaq -0x3c0(%rbp), %rdi
callq 0x34a8
jmp 0x56bef
jmp 0x56bf1
leaq -0x3c1(%rbp), %rdi
callq 0x3290
jmp 0x56ffd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x56c2c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x410(%rbp), %rdi
callq 0x34a8
jmp 0x56c2a
jmp 0x56c2c
leaq -0x3e8(%rbp), %rdi
callq 0x34a8
jmp 0x56c3a
jmp 0x56ffd
movq $0x0, -0x418(%rbp)
movq -0x418(%rbp), %rax
cmpq -0x10(%rbp), %rax
jae 0x56fb6
movq -0x418(%rbp), %rsi
leaq -0x320(%rbp), %rdi
callq 0x1a5f0
movq %rax, -0x580(%rbp)
jmp 0x56c77
movq -0x580(%rbp), %rax
movzbl (%rax), %ecx
movl $0x3, %eax
cmpl %ecx, %eax
je 0x56f9d
leaq -0x4b9(%rbp), %rdi
movq %rdi, -0x588(%rbp)
callq 0x3440
movq -0x588(%rbp), %rdx
leaq 0x5c466(%rip), %rsi     # 0xb3115
leaq -0x4b8(%rbp), %rdi
callq 0x3340
jmp 0x56cbd
leaq 0x5dd36(%rip), %rdx     # 0xb49fa
leaq -0x498(%rbp), %rdi
leaq -0x4b8(%rbp), %rsi
callq 0xaa1b0
jmp 0x56cd9
leaq 0x5fa03(%rip), %rdx     # 0xb66e3
leaq -0x478(%rbp), %rdi
leaq -0x498(%rbp), %rsi
callq 0xaa1b0
jmp 0x56cf5
leaq 0x5dd03(%rip), %rdx     # 0xb49ff
leaq -0x458(%rbp), %rdi
leaq -0x478(%rbp), %rsi
callq 0xaa1b0
jmp 0x56d11
leaq 0x5c445(%rip), %rdx     # 0xb315d
leaq -0x438(%rbp), %rdi
leaq -0x458(%rbp), %rsi
callq 0xaa1b0
jmp 0x56d2d
movq 0xa12a4(%rip), %rdi     # 0xf7fd8
leaq -0x438(%rbp), %rsi
callq 0x3200
jmp 0x56d42
leaq -0x438(%rbp), %rdi
callq 0x34a8
jmp 0x56d50
leaq -0x458(%rbp), %rdi
callq 0x34a8
jmp 0x56d5e
leaq -0x478(%rbp), %rdi
callq 0x34a8
jmp 0x56d6c
leaq -0x498(%rbp), %rdi
callq 0x34a8
jmp 0x56d7a
leaq -0x4b8(%rbp), %rdi
callq 0x34a8
jmp 0x56d88
leaq -0x4b9(%rbp), %rdi
callq 0x3290
movq 0xa123d(%rip), %rdi     # 0xf7fd8
leaq 0x850a9(%rip), %rsi     # 0xdbe4b
callq 0x3230
movq %rax, -0x590(%rbp)
jmp 0x56db0
movl $0x3, -0x4e4(%rbp)
leaq -0x4e0(%rbp), %rdi
leaq -0x4e4(%rbp), %rsi
callq 0xaaa20
jmp 0x56dcf
movq -0x590(%rbp), %rdi
leaq -0x4e0(%rbp), %rsi
callq 0x3200
movq %rax, -0x598(%rbp)
jmp 0x56deb
movq -0x598(%rbp), %rdi
leaq 0x5c37c(%rip), %rsi     # 0xb3175
callq 0x3230
movq %rax, -0x5a0(%rbp)
jmp 0x56e07
movq -0x418(%rbp), %rsi
leaq -0x320(%rbp), %rdi
callq 0x1a5f0
movq %rax, -0x5a8(%rbp)
jmp 0x56e23
movq -0x5a8(%rbp), %rsi
leaq -0x508(%rbp), %rdi
callq 0x28c00
jmp 0x56e38
movq -0x5a0(%rbp), %rdi
leaq -0x508(%rbp), %rsi
callq 0x3200
movq %rax, -0x5b0(%rbp)
jmp 0x56e54
movq -0x5b0(%rbp), %rdi
leaq 0x5c1fa(%rip), %rsi     # 0xb305c
callq 0x3230
movq %rax, -0x5b8(%rbp)
jmp 0x56e70
movq -0x5b8(%rbp), %rdi
movq 0xa1142(%rip), %rsi     # 0xf7fc0
callq 0x3280
jmp 0x56e85
leaq -0x508(%rbp), %rdi
callq 0x34a8
jmp 0x56e93
leaq -0x4e0(%rbp), %rdi
callq 0x34a8
jmp 0x56ea1
callq 0x28bd0
jmp 0x56ea8
jmp 0x56f9d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x56f52
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x56f42
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x56f32
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x56f22
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x56f12
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x438(%rbp), %rdi
callq 0x34a8
jmp 0x56f10
jmp 0x56f12
leaq -0x458(%rbp), %rdi
callq 0x34a8
jmp 0x56f20
jmp 0x56f22
leaq -0x478(%rbp), %rdi
callq 0x34a8
jmp 0x56f30
jmp 0x56f32
leaq -0x498(%rbp), %rdi
callq 0x34a8
jmp 0x56f40
jmp 0x56f42
leaq -0x4b8(%rbp), %rdi
callq 0x34a8
jmp 0x56f50
jmp 0x56f52
leaq -0x4b9(%rbp), %rdi
callq 0x3290
jmp 0x56ffd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x56f8d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x508(%rbp), %rdi
callq 0x34a8
jmp 0x56f8b
jmp 0x56f8d
leaq -0x4e0(%rbp), %rdi
callq 0x34a8
jmp 0x56f9b
jmp 0x56ffd
jmp 0x56f9f
movq -0x418(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x418(%rbp)
jmp 0x56c4a
leaq -0x320(%rbp), %rdi
callq 0x1a4c0
jmp 0x56fc4
leaq -0x300(%rbp), %rdi
callq 0x1a4c0
jmp 0x56fd2
leaq -0x2e8(%rbp), %rdi
callq 0x11b20
jmp 0x56fe0
leaq -0x60(%rbp), %rdi
callq 0x1a4c0
jmp 0x56feb
leaq -0x38(%rbp), %rdi
callq 0xaab00
addq $0x5c0, %rsp            # imm = 0x5C0
popq %rbp
retq
leaq -0x320(%rbp), %rdi
callq 0x1a4c0
jmp 0x5700b
jmp 0x5700d
leaq -0x300(%rbp), %rdi
callq 0x1a4c0
jmp 0x5701b
jmp 0x5701d
leaq -0x2e8(%rbp), %rdi
callq 0x11b20
jmp 0x5702b
jmp 0x5702d
leaq -0x60(%rbp), %rdi
callq 0x1a4c0
jmp 0x57038
jmp 0x5703a
leaq -0x38(%rbp), %rdi
callq 0xaab00
jmp 0x57045
jmp 0x57047
movq -0x40(%rbp), %rdi
callq 0x3430
movq %rax, %rdi
callq 0x1a490
nopl (%rax,%rax)