// File: /workspace/github_cpp_makefile_star2_O2/lvandeve[P]lodepng/lodepng_unittest.cpp
// Function: testSbitChunk2(unsigned int, unsigned int, unsigned int, unsigned int, LodePNGColorType, unsigned int, LodePNGColorType, unsigned int, LodePNGColorType, unsigned int, int, bool)
void testSbitChunk2(unsigned r, unsigned g, unsigned b, unsigned a,
                   LodePNGColorType type_pixels, unsigned bitdepth_pixels,
                   LodePNGColorType type_raw, unsigned bitdepth_raw,
                   LodePNGColorType type_png, unsigned bitdepth_png,
                   int 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;

  if(auto_convert == 0 || auto_convert == 2) testSbitChunk(r, g, b, a, image.data, image.width, image.height, mode_raw, mode_png, false, expect_encoder_error);
  if(auto_convert == 1 || auto_convert == 2) testSbitChunk(r, g, b, a, image.data, image.width, image.height, mode_raw, mode_png, true, expect_encoder_error);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x188, %rsp            # imm = 0x188
movl %ecx, 0xc(%rsp)
movl %edx, %ebp
movl %esi, %r14d
movl %edi, %r15d
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rdi
movaps %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
movl %r8d, %esi
movl %r9d, %edx
xorl %ecx, %ecx
callq 0x13933
leaq 0x138(%rsp), %rdi
callq 0x4970
movl 0x1c8(%rsp), %eax
movl 0x1c0(%rsp), %ecx
movl %eax, 0x13c(%rsp)
movl %ecx, 0x138(%rsp)
leaq 0x160(%rsp), %rdi
callq 0x4970
movabsq $0x1000000006, %rax     # imm = 0x1000000006
movq %rax, 0x160(%rsp)
leaq 0x110(%rsp), %rdi
callq 0x4970
movl 0x1d8(%rsp), %eax
movl 0x1d0(%rsp), %ecx
movl %eax, 0x114(%rsp)
movl %ecx, 0x110(%rsp)
movl 0x28(%rsp), %ebx
movl 0x2c(%rsp), %r12d
leaq 0x138(%rsp), %rdi
callq 0x4b00
imull %ebx, %r12d
imull %eax, %r12d
addl $0x7, %r12d
shrl $0x3, %r12d
leaq 0xb0(%rsp), %rdx
movb $0x0, (%rdx)
leaq 0x38(%rsp), %rdi
leaq 0x90(%rsp), %rcx
movq %r12, %rsi
callq 0x5ab3a
movq 0x38(%rsp), %rdi
movq 0x10(%rsp), %rsi
movl 0x28(%rsp), %r8d
movl 0x2c(%rsp), %r9d
leaq 0x138(%rsp), %r13
leaq 0x160(%rsp), %rcx
movq %r13, %rdx
callq 0x5390
movl %eax, %r12d
leaq 0x1bd44(%rip), %rsi     # 0x601dd
leaq 0xf0(%rsp), %rdi
leaq 0xb(%rsp), %rdx
callq 0x20c0
leaq 0x1f03a(%rip), %rdx     # 0x634ec
leaq 0x90(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
callq 0x5a5df
leaq 0x1d0f8(%rip), %rsi     # 0x615c6
leaq 0xd0(%rsp), %rdi
leaq 0xa(%rsp), %rdx
callq 0x20c0
movq 0xd8(%rsp), %rbx
testq %rbx, %rbx
je 0x4451b
leaq 0x1d0d2(%rip), %rsi     # 0x615c6
leaq 0x50(%rsp), %rdi
leaq 0x9(%rsp), %rdx
callq 0x20c0
leaq 0x1f29b(%rip), %rsi     # 0x637a5
leaq 0x70(%rsp), %rdi
leaq 0x50(%rsp), %rdx
callq 0x5a8d9
jmp 0x44531
leaq 0x1d0a4(%rip), %rsi     # 0x615c6
leaq 0x70(%rsp), %rdi
leaq 0x50(%rsp), %rdx
callq 0x20c0
leaq 0xb0(%rsp), %rdi
leaq 0x90(%rsp), %rsi
leaq 0x70(%rsp), %rdx
callq 0x5a61f
leaq 0xb0(%rsp), %rsi
movl %r12d, %edi
callq 0x13352
leaq 0xb0(%rsp), %rdi
callq 0x2270
leaq 0x70(%rsp), %rdi
callq 0x2270
testq %rbx, %rbx
je 0x44581
leaq 0x50(%rsp), %rdi
callq 0x2270
leaq 0xd0(%rsp), %rdi
callq 0x2270
leaq 0x90(%rsp), %rdi
callq 0x2270
leaq 0xf0(%rsp), %rdi
callq 0x2270
leaq 0x10(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x12224
movl 0x1e0(%rsp), %r12d
movzbl 0x1e8(%rsp), %ebx
testl $0xfffffffd, %r12d      # imm = 0xFFFFFFFD
jne 0x44606
leaq 0x10(%rsp), %r8
movl 0x18(%r8), %r9d
movl 0x1c(%r8), %eax
subq $0x8, %rsp
movl %r15d, %edi
movl %r14d, %esi
movl %ebp, %edx
movl 0x14(%rsp), %ecx
pushq %rbx
pushq $0x0
leaq 0x128(%rsp), %r10
pushq %r10
pushq %r13
pushq %rax
callq 0x425be
addq $0x30, %rsp
decl %r12d
cmpl $0x1, %r12d
ja 0x44645
leaq 0x10(%rsp), %r8
movl 0x18(%r8), %r9d
movl 0x1c(%r8), %eax
subq $0x8, %rsp
movl %r15d, %edi
movl %r14d, %esi
movl %ebp, %edx
movl 0x14(%rsp), %ecx
pushq %rbx
pushq $0x1
leaq 0x128(%rsp), %r10
pushq %r10
pushq %r13
pushq %rax
callq 0x425be
addq $0x30, %rsp
leaq 0x38(%rsp), %rdi
callq 0xea7c
leaq 0x10(%rsp), %rdi
callq 0xea7c
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x44693
movq %rax, %r14
jmp 0x446b6
movq %rax, %r14
jmp 0x446b1
movq %rax, %r14
leaq 0xb0(%rsp), %rdi
callq 0x2270
jmp 0x446a7
jmp 0x446e9
jmp 0x446e9
jmp 0x446e9
jmp 0x446e9
jmp 0x446e9
movq %rax, %r14
jmp 0x446c0
jmp 0x446ee
movq %rax, %r14
jmp 0x446da
movq %rax, %r14
jmp 0x446cd
movq %rax, %r14
leaq 0x70(%rsp), %rdi
callq 0x2270
testq %rbx, %rbx
je 0x446c0
leaq 0x50(%rsp), %rdi
callq 0x2270
leaq 0xd0(%rsp), %rdi
callq 0x2270
leaq 0x90(%rsp), %rdi
callq 0x2270
leaq 0xf0(%rsp), %rdi
callq 0x2270
jmp 0x446f1
movq %rax, %r14
jmp 0x446fb
movq %rax, %r14
leaq 0x38(%rsp), %rdi
callq 0xea7c
leaq 0x10(%rsp), %rdi
callq 0xea7c
movq %r14, %rdi
callq 0x2380
movq %rax, %rdi
callq 0xe6cc