// File: /workspace/github_cpp_makefile_star2_O3/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, 0x8(%rsp)
movl %esi, 0x4(%rsp)
movl %edi, (%rsp)
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rdi
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movl %r8d, %esi
movl %r9d, %edx
xorl %ecx, %ecx
callq 0x169a0
leaq 0xd0(%rsp), %rdi
callq 0x5861
movl 0x1c8(%rsp), %eax
movl 0x1c0(%rsp), %ecx
movl %eax, 0xd4(%rsp)
movl %ecx, 0xd0(%rsp)
leaq 0x160(%rsp), %rdi
callq 0x5861
movabsq $0x1000000006, %rax     # imm = 0x1000000006
movq %rax, 0x160(%rsp)
leaq 0x138(%rsp), %rdi
callq 0x5861
movl 0x1d8(%rsp), %eax
movl 0x1d0(%rsp), %ecx
movl %eax, 0x13c(%rsp)
movl %ecx, 0x138(%rsp)
movl 0x28(%rsp), %ebx
movl 0x2c(%rsp), %r12d
leaq 0xd0(%rsp), %rdi
callq 0x5a2a
imull %ebx, %r12d
imull %eax, %r12d
addl $0x7, %r12d
shrl $0x3, %r12d
leaq 0x118(%rsp), %rdx
movb $0x0, (%rdx)
leaq 0x58(%rsp), %rdi
leaq 0x38(%rsp), %rcx
movq %r12, %rsi
callq 0x7076e
movq 0x58(%rsp), %rdi
movq 0x10(%rsp), %rsi
movl 0x28(%rsp), %r8d
movl 0x2c(%rsp), %r9d
leaq 0xd0(%rsp), %rdx
leaq 0x160(%rsp), %rcx
callq 0x642f
movl %eax, %r12d
leaq 0xc0(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x2117d(%rip), %rsi     # 0x7637d
leaq 0x2117b(%rip), %rdx     # 0x76382
leaq 0xb0(%rsp), %rdi
callq 0x14f6e
leaq 0x48(%rsp), %r13
movq %r13, -0x10(%r13)
movq 0xb0(%rsp), %rsi
movq 0xb8(%rsp), %rdx
addq %rsi, %rdx
leaq 0x38(%rsp), %rdi
callq 0x1518a
leaq 0x2444b(%rip), %rsi     # 0x7968c
leaq 0x38(%rsp), %rdi
callq 0x23e0
leaq 0x108(%rsp), %rbx
movq %rbx, -0x10(%rbx)
leaq 0x22508(%rip), %rdx     # 0x77766
leaq 0xf8(%rsp), %rdi
movq %rdx, %rsi
callq 0x14f6e
movq 0x100(%rsp), %rbp
testq %rbp, %rbp
je 0x552b6
leaq 0x80(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x224d8(%rip), %rdx     # 0x77766
leaq 0x70(%rsp), %rdi
movq %rdx, %rsi
callq 0x14f6e
leaq 0x246a3(%rip), %rsi     # 0x79945
leaq 0x90(%rsp), %rdi
leaq 0x70(%rsp), %rdx
callq 0x70423
jmp 0x552d9
leaq 0xa0(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x2249d(%rip), %rdx     # 0x77766
leaq 0x90(%rsp), %rdi
movq %rdx, %rsi
callq 0x14f6e
leaq 0x118(%rsp), %rdi
leaq 0x38(%rsp), %rsi
leaq 0x90(%rsp), %rdx
callq 0x70057
leaq 0x118(%rsp), %rsi
movl %r12d, %edi
callq 0x16314
leaq 0x128(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x55319
callq 0x2210
leaq 0xa0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x5532f
callq 0x2210
testq %rbp, %rbp
je 0x5534a
leaq 0x80(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x5534a
callq 0x2210
movq 0xf8(%rsp), %rdi
cmpq %rbx, %rdi
je 0x5535c
callq 0x2210
movq 0x38(%rsp), %rdi
cmpq %r13, %rdi
je 0x5536b
callq 0x2210
movq 0xb0(%rsp), %rdi
cmpq %r15, %rdi
je 0x5537d
callq 0x2210
leaq 0x10(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0x14de6
movb 0x1e8(%rsp), %bl
movl 0x1e0(%rsp), %ebp
testl $0xfffffffd, %ebp       # imm = 0xFFFFFFFD
jne 0x553e9
leaq 0x10(%rsp), %r8
movl 0x18(%r8), %r9d
movl 0x1c(%r8), %eax
subq $0x8, %rsp
movzbl %bl, %r10d
movl 0x8(%rsp), %edi
movl 0xc(%rsp), %esi
movl 0x10(%rsp), %edx
movl 0x14(%rsp), %ecx
pushq %r10
pushq $0x0
leaq 0x150(%rsp), %r10
pushq %r10
leaq 0xf0(%rsp), %r10
pushq %r10
pushq %rax
callq 0x52a38
addq $0x30, %rsp
decl %ebp
cmpl $0x1, %ebp
ja 0x55437
leaq 0x10(%rsp), %r8
movl 0x18(%r8), %r9d
movl 0x1c(%r8), %eax
subq $0x8, %rsp
movzbl %bl, %r10d
movl 0x8(%rsp), %edi
movl 0xc(%rsp), %esi
movl 0x10(%rsp), %edx
movl 0x14(%rsp), %ecx
pushq %r10
pushq $0x1
leaq 0x150(%rsp), %r10
pushq %r10
leaq 0xf0(%rsp), %r10
pushq %r10
pushq %rax
callq 0x52a38
addq $0x30, %rsp
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x55446
callq 0x2210
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x55455
callq 0x2210
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x55478
movq %rax, %r12
movq 0x70(%rsp), %rdi
cmpq %r14, %rdi
je 0x554cc
jmp 0x554c7
movq %rax, %r12
jmp 0x554cc
movq %rax, %r12
leaq 0x128(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x5549b
callq 0x2210
jmp 0x5549b
movq %rax, %r12
leaq 0xa0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x554b1
callq 0x2210
testq %rbp, %rbp
je 0x554cc
leaq 0x80(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x554cc
callq 0x2210
movq 0xf8(%rsp), %rdi
cmpq %rbx, %rdi
je 0x554e3
callq 0x2210
jmp 0x554e3
movq %rax, %r12
movq 0x38(%rsp), %rdi
cmpq %r13, %rdi
je 0x55506
callq 0x2210
jmp 0x55506
movq %rax, %r12
movq 0x38(%rsp), %rdi
cmpq %r13, %rdi
je 0x55506
jmp 0x554ed
movq %rax, %r12
movq 0xb0(%rsp), %rdi
cmpq %r15, %rdi
je 0x5552e
callq 0x2210
jmp 0x5552e
jmp 0x5552b
jmp 0x55526
jmp 0x55526
jmp 0x55526
jmp 0x55526
jmp 0x55526
movq %rax, %r12
jmp 0x5553d
movq %rax, %r12
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x5553d
callq 0x2210
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x5554c
callq 0x2210
movq %r12, %rdi
callq 0x23c0