// File: lvandeve[P]lodepng/lodepng_unittest.cpp
// Function: testBkgdChunk(unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, LodePNGColorType, unsigned int, LodePNGColorType, unsigned int, LodePNGColorType, unsigned int, bool, bool)
void testBkgdChunk(unsigned r, unsigned g, unsigned b,
                   unsigned r2, unsigned g2, unsigned b2,
                   LodePNGColorType type_pixels, unsigned bitdepth_pixels,
                   LodePNGColorType type_raw, unsigned bitdepth_raw,
                   LodePNGColorType type_png, unsigned bitdepth_png,
                   bool auto_convert, bool expect_encoder_error = false) {
  unsigned error;
  Image image;
  generateTestImageRequiringColorType16(image, type_pixels, bitdepth_pixels, false);

  LodePNGColorMode mode_raw; lodepng_color_mode_init(&mode_raw); mode_raw.bitdepth = bitdepth_raw; mode_raw.colortype = type_raw;
  LodePNGColorMode mode_test; lodepng_color_mode_init(&mode_test); mode_test.bitdepth = 16; mode_test.colortype = LCT_RGBA;
  LodePNGColorMode mode_png; lodepng_color_mode_init(&mode_png); mode_png.bitdepth = bitdepth_png; mode_png.colortype = type_png;
  std::vector<unsigned char> temp((image.width * image.height * lodepng_get_bpp(&mode_raw) + 7) / 8);
  error = lodepng_convert(temp.data(), image.data.data(), &mode_raw, &mode_test, image.width, image.height);
  ASSERT_NO_PNG_ERROR(error);
  image.data = temp;

  testBkgdChunk(r, g, b, r2, g2, b2,
                image.data, image.width, image.height,
                mode_raw, mode_png, auto_convert, expect_encoder_error);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x280, %rsp            # imm = 0x280
movl %ecx, -0x1ec(%rbp)
movl %edx, %eax
movl -0x1ec(%rbp), %edx
movl %eax, -0x1e8(%rbp)
movl %esi, %eax
movl -0x1e8(%rbp), %esi
movl %eax, -0x1e4(%rbp)
movl %edi, %r10d
movl -0x1e4(%rbp), %edi
movb 0x48(%rbp), %al
movb 0x40(%rbp), %cl
movl 0x38(%rbp), %r11d
movl 0x30(%rbp), %r11d
movl 0x28(%rbp), %r11d
movl 0x20(%rbp), %r11d
movl 0x18(%rbp), %r11d
movl 0x10(%rbp), %r11d
movl %r10d, -0x14(%rbp)
movl %edi, -0x18(%rbp)
movl %esi, -0x1c(%rbp)
movl %edx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movl %r9d, -0x28(%rbp)
andb $0x1, %cl
movb %cl, -0x29(%rbp)
andb $0x1, %al
movb %al, -0x2a(%rbp)
leaq -0x58(%rbp), %rdi
movq %rdi, -0x1e0(%rbp)
callq 0xaaae0
movq -0x1e0(%rbp), %rdi
movl 0x10(%rbp), %esi
movl 0x18(%rbp), %edx
xorl %ecx, %ecx
callq 0x29b10
jmp 0x798cd
leaq -0x90(%rbp), %rdi
callq 0x56a0
jmp 0x798db
movl 0x28(%rbp), %eax
movl %eax, -0x8c(%rbp)
movl 0x20(%rbp), %eax
movl %eax, -0x90(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x56a0
jmp 0x798fb
movl $0x10, -0xb4(%rbp)
movl $0x6, -0xb8(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x56a0
jmp 0x7991d
movl 0x38(%rbp), %eax
movl %eax, -0xdc(%rbp)
movl 0x30(%rbp), %eax
movl %eax, -0xe0(%rbp)
movl -0x40(%rbp), %eax
movl -0x3c(%rbp), %ecx
imull %ecx, %eax
movl %eax, -0x1f4(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x5a60
movl %eax, -0x1f0(%rbp)
jmp 0x79952
movl -0x1f0(%rbp), %ecx
movl -0x1f4(%rbp), %eax
imull %ecx, %eax
addl $0x7, %eax
shrl $0x3, %eax
movq %rax, -0x208(%rbp)
movb $0x0, -0xf9(%rbp)
leaq -0xfa(%rbp), %rdi
movq %rdi, -0x200(%rbp)
callq 0x1bfa0
movq -0x208(%rbp), %rsi
movq -0x200(%rbp), %rcx
leaq -0xf8(%rbp), %rdi
leaq -0xf9(%rbp), %rdx
callq 0xaab60
jmp 0x799ab
leaq -0xfa(%rbp), %rdi
callq 0x1bff0
leaq -0xf8(%rbp), %rdi
callq 0xab120
movq %rax, -0x210(%rbp)
jmp 0x799cc
leaq -0x58(%rbp), %rdi
callq 0xab120
movq %rax, -0x218(%rbp)
jmp 0x799de
movq -0x218(%rbp), %rsi
movq -0x210(%rbp), %rdi
movl -0x40(%rbp), %r8d
movl -0x3c(%rbp), %r9d
leaq -0x90(%rbp), %rdx
leaq -0xb8(%rbp), %rcx
callq 0x6d60
movl %eax, -0x21c(%rbp)
jmp 0x79a0f
movl -0x21c(%rbp), %eax
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %eax
movl %eax, -0x22c(%rbp)
leaq -0x161(%rbp), %rdi
movq %rdi, -0x228(%rbp)
callq 0x3440
movq -0x228(%rbp), %rdx
leaq 0x396d3(%rip), %rsi     # 0xb3115
leaq -0x160(%rbp), %rdi
callq 0x3340
jmp 0x79a50
leaq 0x3c86f(%rip), %rdx     # 0xb62c6
leaq -0x140(%rbp), %rdi
leaq -0x160(%rbp), %rsi
callq 0xaa1b0
jmp 0x79a6c
leaq -0x1a9(%rbp), %rdi
movq %rdi, -0x238(%rbp)
callq 0x3440
movq -0x238(%rbp), %rdx
movb $0x0, -0x1ab(%rbp)
movb $0x0, -0x1d2(%rbp)
movb $0x0, -0x1d3(%rbp)
leaq 0x3aa62(%rip), %rsi     # 0xb4504
leaq -0x1a8(%rbp), %rdi
callq 0x3340
jmp 0x79ab0
leaq -0x1a8(%rbp), %rdi
callq 0x33f0
movb %al, -0x239(%rbp)
jmp 0x79ac4
movb -0x239(%rbp), %al
testb $0x1, %al
jne 0x79ad0
jmp 0x79b08
leaq -0x1aa(%rbp), %rdi
movq %rdi, -0x248(%rbp)
callq 0x3440
movq -0x248(%rbp), %rdx
movb $0x1, -0x1ab(%rbp)
leaq 0x3aa0c(%rip), %rsi     # 0xb4504
leaq -0x188(%rbp), %rdi
callq 0x3340
jmp 0x79b06
jmp 0x79b63
leaq -0x1d1(%rbp), %rdi
movq %rdi, -0x250(%rbp)
callq 0x3440
movq -0x250(%rbp), %rdx
movb $0x1, -0x1d2(%rbp)
leaq 0x3a9d4(%rip), %rsi     # 0xb4504
leaq -0x1d0(%rbp), %rdi
callq 0x3340
jmp 0x79b3e
movb $0x1, -0x1d3(%rbp)
leaq 0x3cb97(%rip), %rsi     # 0xb66e3
leaq -0x188(%rbp), %rdi
leaq -0x1d0(%rbp), %rdx
callq 0xaa6d0
jmp 0x79b61
jmp 0x79b63
leaq -0x120(%rbp), %rdi
leaq -0x140(%rbp), %rsi
leaq -0x188(%rbp), %rdx
callq 0xaa240
jmp 0x79b7f
movl -0x22c(%rbp), %edi
leaq -0x120(%rbp), %rsi
callq 0x28d30
jmp 0x79b93
leaq -0x120(%rbp), %rdi
callq 0x34a8
jmp 0x79ba1
leaq -0x188(%rbp), %rdi
callq 0x34a8
jmp 0x79baf
testb $0x1, -0x1d3(%rbp)
jne 0x79bba
jmp 0x79bca
leaq -0x1d0(%rbp), %rdi
callq 0x34a8
jmp 0x79bc8
jmp 0x79bca
testb $0x1, -0x1d2(%rbp)
jne 0x79bd5
jmp 0x79be1
leaq -0x1d1(%rbp), %rdi
callq 0x3290
testb $0x1, -0x1ab(%rbp)
jne 0x79bec
jmp 0x79bf8
leaq -0x1aa(%rbp), %rdi
callq 0x3290
leaq -0x1a8(%rbp), %rdi
callq 0x34a8
jmp 0x79c06
leaq -0x1a9(%rbp), %rdi
callq 0x3290
leaq -0x140(%rbp), %rdi
callq 0x34a8
jmp 0x79c20
leaq -0x160(%rbp), %rdi
callq 0x34a8
jmp 0x79c2e
leaq -0x161(%rbp), %rdi
callq 0x3290
leaq -0x58(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0x23520
jmp 0x79c4c
movl -0x14(%rbp), %edi
movl -0x18(%rbp), %esi
movl -0x1c(%rbp), %edx
movl -0x20(%rbp), %ecx
movl -0x24(%rbp), %r8d
movl -0x28(%rbp), %r9d
movl -0x40(%rbp), %r10d
movl -0x3c(%rbp), %r11d
movzbl -0x29(%rbp), %ebx
movzbl -0x2a(%rbp), %r14d
andl $0x1, %r14d
movq %rsp, %rax
movl %r14d, 0x30(%rax)
andl $0x1, %ebx
movl %ebx, 0x28(%rax)
leaq -0xe0(%rbp), %rbx
movq %rbx, 0x20(%rax)
leaq -0x90(%rbp), %rbx
movq %rbx, 0x18(%rax)
movl %r11d, 0x10(%rax)
movl %r10d, 0x8(%rax)
leaq -0x58(%rbp), %r10
movq %r10, (%rax)
callq 0x76ad0
jmp 0x79cae
leaq -0xf8(%rbp), %rdi
callq 0x1a4c0
jmp 0x79cbc
leaq -0x58(%rbp), %rdi
callq 0xaab00
addq $0x280, %rsp            # imm = 0x280
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x79e62
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0xfa(%rbp), %rdi
callq 0x1bff0
jmp 0x79e62
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x79e52
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x79e46
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x79e36
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x79e1a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x79e0a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x79df1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x79dd8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x79dbb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x79dab
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x120(%rbp), %rdi
callq 0x34a8
jmp 0x79da9
jmp 0x79dab
leaq -0x188(%rbp), %rdi
callq 0x34a8
jmp 0x79db9
jmp 0x79dbb
testb $0x1, -0x1d3(%rbp)
jne 0x79dc6
jmp 0x79dd6
leaq -0x1d0(%rbp), %rdi
callq 0x34a8
jmp 0x79dd4
jmp 0x79dd6
jmp 0x79dd8
testb $0x1, -0x1d2(%rbp)
jne 0x79de3
jmp 0x79def
leaq -0x1d1(%rbp), %rdi
callq 0x3290
jmp 0x79df1
testb $0x1, -0x1ab(%rbp)
jne 0x79dfc
jmp 0x79e08
leaq -0x1aa(%rbp), %rdi
callq 0x3290
jmp 0x79e0a
leaq -0x1a8(%rbp), %rdi
callq 0x34a8
jmp 0x79e18
jmp 0x79e1a
leaq -0x1a9(%rbp), %rdi
callq 0x3290
leaq -0x140(%rbp), %rdi
callq 0x34a8
jmp 0x79e34
jmp 0x79e36
leaq -0x160(%rbp), %rdi
callq 0x34a8
jmp 0x79e44
jmp 0x79e46
leaq -0x161(%rbp), %rdi
callq 0x3290
leaq -0xf8(%rbp), %rdi
callq 0x1a4c0
jmp 0x79e60
jmp 0x79e62
leaq -0x58(%rbp), %rdi
callq 0xaab00
jmp 0x79e6d
jmp 0x79e6f
movq -0x60(%rbp), %rdi
callq 0x3430
movq %rax, %rdi
callq 0x1a490