// File: /workspace/github_cpp_makefile_star2_O1/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, %r15d
xorps %xmm0, %xmm0
leaq 0x30(%rsp), %rdi
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movl %r8d, %esi
movl %r9d, %edx
xorl %ecx, %ecx
callq 0x16bd5
leaq 0xb0(%rsp), %rdi
callq 0x528f
movl 0x1c8(%rsp), %eax
movl 0x1c0(%rsp), %ecx
movl %eax, 0xb4(%rsp)
movl %ecx, 0xb0(%rsp)
leaq 0x160(%rsp), %rdi
callq 0x528f
movabsq $0x1000000006, %rax     # imm = 0x1000000006
movq %rax, 0x160(%rsp)
leaq 0x138(%rsp), %rdi
callq 0x528f
movl 0x1d8(%rsp), %eax
movl 0x1d0(%rsp), %ecx
movl %eax, 0x13c(%rsp)
movl %ecx, 0x138(%rsp)
movl 0x48(%rsp), %ebx
movl 0x4c(%rsp), %r12d
leaq 0xb0(%rsp), %rdi
callq 0x5452
imull %ebx, %r12d
imull %eax, %r12d
addl $0x7, %r12d
shrl $0x3, %r12d
leaq 0x118(%rsp), %rdx
movb $0x0, (%rdx)
leaq 0x58(%rsp), %rdi
leaq 0x10(%rsp), %rcx
movq %r12, %rsi
callq 0x70602
movq 0x58(%rsp), %rdi
movq 0x30(%rsp), %rsi
movl 0x48(%rsp), %r8d
movl 0x4c(%rsp), %r9d
leaq 0xb0(%rsp), %rdx
leaq 0x160(%rsp), %rcx
callq 0x5e9a
movl %eax, %r12d
leaq 0xa0(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x21085(%rip), %rsi     # 0x7615d
leaq 0x21083(%rip), %rdx     # 0x76162
leaq 0x90(%rsp), %rdi
callq 0x1517a
leaq 0x20(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq 0x90(%rsp), %rsi
movq 0x98(%rsp), %rdx
addq %rsi, %rdx
leaq 0x10(%rsp), %rdi
callq 0x15390
leaq 0x24353(%rip), %rsi     # 0x7946c
leaq 0x10(%rsp), %rdi
callq 0x23d0
leaq 0x108(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x22410(%rip), %rdx     # 0x77546
leaq 0xf8(%rsp), %rdi
movq %rdx, %rsi
callq 0x1517a
movq 0x100(%rsp), %rbp
testq %rbp, %rbp
setne %bl
je 0x55194
leaq 0xe8(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x223dd(%rip), %rdx     # 0x77546
leaq 0xd8(%rsp), %rdi
movq %rdx, %rsi
callq 0x1517a
leaq 0x245a5(%rip), %rsi     # 0x79725
leaq 0x70(%rsp), %rdi
leaq 0xd8(%rsp), %rdx
callq 0x702b8
jmp 0x551b4
leaq 0x80(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x2239f(%rip), %rdx     # 0x77546
leaq 0x70(%rsp), %rdi
movq %rdx, %rsi
callq 0x1517a
leaq 0x118(%rsp), %rdi
leaq 0x10(%rsp), %rsi
leaq 0x70(%rsp), %rdx
callq 0x6feec
leaq 0x118(%rsp), %rsi
movl %r12d, %edi
callq 0x16534
leaq 0x128(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x551f1
callq 0x2200
leaq 0x80(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x55207
callq 0x2200
testq %rbp, %rbp
leaq 0x20(%rsp), %rbx
je 0x55227
leaq 0xe8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x55227
callq 0x2200
movq 0xf8(%rsp), %rdi
cmpq %r13, %rdi
je 0x55239
callq 0x2200
movq 0x10(%rsp), %rdi
cmpq %rbx, %rdi
je 0x55248
callq 0x2200
movq 0x90(%rsp), %rdi
cmpq %r14, %rdi
je 0x5525a
callq 0x2200
leaq 0x30(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0x15008
movb 0x1e8(%rsp), %bl
movl 0x1e0(%rsp), %ebp
testl $0xfffffffd, %ebp       # imm = 0xFFFFFFFD
jne 0x552c5
leaq 0x30(%rsp), %r8
movl 0x18(%r8), %r9d
movl 0x1c(%r8), %eax
subq $0x8, %rsp
movzbl %bl, %r10d
movl %r15d, %edi
movl 0xc(%rsp), %esi
movl 0x10(%rsp), %edx
movl 0x14(%rsp), %ecx
pushq %r10
pushq $0x0
leaq 0x150(%rsp), %r10
pushq %r10
leaq 0xd0(%rsp), %r10
pushq %r10
pushq %rax
callq 0x5295c
addq $0x30, %rsp
decl %ebp
cmpl $0x1, %ebp
ja 0x55312
leaq 0x30(%rsp), %r8
movl 0x18(%r8), %r9d
movl 0x1c(%r8), %eax
subq $0x8, %rsp
movzbl %bl, %r10d
movl %r15d, %edi
movl 0xc(%rsp), %esi
movl 0x10(%rsp), %edx
movl 0x14(%rsp), %ecx
pushq %r10
pushq $0x1
leaq 0x150(%rsp), %r10
pushq %r10
leaq 0xd0(%rsp), %r10
pushq %r10
pushq %rax
callq 0x5295c
addq $0x30, %rsp
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x55321
callq 0x2200
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x55330
callq 0x2200
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r15
jmp 0x553a5
movq %rax, %r15
movb $0x1, %bl
jmp 0x55389
movq %rax, %r15
movb $0x1, %bl
jmp 0x553a3
movq %rax, %r15
leaq 0x128(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x55373
callq 0x2200
jmp 0x55373
movq %rax, %r15
leaq 0x80(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x55389
callq 0x2200
testb %bl, %bl
je 0x553a3
leaq 0xe8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x553a3
callq 0x2200
testb %bl, %bl
movq 0xf8(%rsp), %rdi
cmpq %r13, %rdi
je 0x553bc
callq 0x2200
jmp 0x553bc
movq %rax, %r15
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x553e4
callq 0x2200
jmp 0x553e4
movq %rax, %r15
movq 0x10(%rsp), %rdi
cmpq %rbx, %rdi
je 0x553e4
jmp 0x553cb
movq %rax, %r15
movq 0x90(%rsp), %rdi
cmpq %r14, %rdi
je 0x5540c
callq 0x2200
jmp 0x5540c
jmp 0x55409
jmp 0x55404
jmp 0x55404
jmp 0x55404
jmp 0x55404
jmp 0x55404
movq %rax, %r15
jmp 0x5541b
movq %rax, %r15
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x5541b
callq 0x2200
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x5542a
callq 0x2200
movq %r15, %rdi
callq 0x23b0