// File: /workspace/github_cpp_makefile_star2_O2/lvandeve[P]lodepng/lodepng_unittest.cpp
// Function: testChrmToSrgb()
void testChrmToSrgb() {
  std::cout << "testChrmToSrgb" << std::endl;
  // srgb gamma approximation and chromaticities defined as standard by png (multiplied by 100000)
  unsigned sg = 45455; // srgb gamma approximation
  unsigned swx = 31270;
  unsigned swy = 32900;
  unsigned srx = 64000;
  unsigned sry = 33000;
  unsigned sgx = 30000;
  unsigned sgy = 60000;
  unsigned sbx = 15000;
  unsigned sby = 6000;

  testChrmToSrgb(sg, swx, swy, srx, sry, sgx, sgy, sbx, sby, 0, 0, 0, 0, 0, 0);
  testChrmToSrgb(sg, swx, swy, srx, sry, sgx, sgy, sbx, sby, 255, 255, 255, 255, 255, 255);

  testChrmToSrgb(0, swx, swy, srx, sry, sgx, sgy, sbx, sby, 50, 50, 50, 50, 50, 50);
  testChrmToSrgb(0, swx, swy, srx, sry, sgx, sgy, sbx, sby, 128, 128, 128, 128, 128, 128);
  testChrmToSrgb(0, swx, swy, srx, sry, sgx, sgy, sbx, sby, 200, 200, 200, 200, 200, 200);

  testChrmToSrgb(0, swx, swy, srx, sry, sgx, sgy, sbx, sby, 255, 0, 0, 255, 0, 0);
  testChrmToSrgb(0, swx, swy, srx, sry, sgx, sgy, sbx, sby, 0, 255, 0, 0, 255, 0);
  testChrmToSrgb(0, swx, swy, srx, sry, sgx, sgy, sbx, sby, 0, 0, 255, 0, 0, 255);

  // swap red and green chromaticities
  testChrmToSrgb(0, swx, swy, sgx, sgy, srx, sry, sbx, sby, 255, 0, 0, 0, 255, 0);
  testChrmToSrgb(0, swx, swy, sgx, sgy, srx, sry, sbx, sby, 0, 255, 0, 255, 0, 0);
  testChrmToSrgb(0, swx, swy, sgx, sgy, srx, sry, sbx, sby, 0, 0, 255, 0, 0, 255);

  // swap red/green/blue chromaticities
  testChrmToSrgb(0, swx, swy, sgx, sgy, sbx, sby, srx, sry, 255, 0, 0, 0, 255, 0);
  testChrmToSrgb(0, swx, swy, sgx, sgy, sbx, sby, srx, sry, 0, 255, 0, 0, 0, 255);
  testChrmToSrgb(0, swx, swy, sgx, sgy, sbx, sby, srx, sry, 0, 0, 255, 255, 0, 0);

  // different whitepoint does not affect white or gray, due to the relative rendering intent (adaptation)
  testChrmToSrgb(0, 35000, 25000, srx, sry, sgx, sgy, sbx, sby, 0, 0, 0, 0, 0, 0);
  testChrmToSrgb(0, 35000, 25000, srx, sry, sgx, sgy, sbx, sby, 50, 50, 50, 50, 50, 50);
  testChrmToSrgb(0, 35000, 25000, srx, sry, sgx, sgy, sbx, sby, 128, 128, 128, 128, 128, 128);
  testChrmToSrgb(0, 35000, 25000, srx, sry, sgx, sgy, sbx, sby, 200, 200, 200, 200, 200, 200);
  testChrmToSrgb(0, 35000, 25000, srx, sry, sgx, sgy, sbx, sby, 255, 255, 255, 255, 255, 255);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq 0x5b7ee(%rip), %rdi     # 0xa2fd8
leaq 0x1c03c(%rip), %rsi     # 0x6382d
callq 0x21f0
movq %rax, %rdi
callq 0x2100
movl $0x1770, %r15d          # imm = 0x1770
movl $0x3a98, %r10d          # imm = 0x3A98
movl $0xea60, %eax           # imm = 0xEA60
movl $0xb18f, %edi           # imm = 0xB18F
movl $0x7a26, %esi           # imm = 0x7A26
movl $0x8084, %edx           # imm = 0x8084
movl $0xfa00, %ecx           # imm = 0xFA00
movl $0x80e8, %r8d           # imm = 0x80E8
movl $0x7530, %r9d           # imm = 0x7530
pushq $0x0
pushq $0x0
pushq $0x0
pushq $0x0
pushq $0x0
pushq $0x0
pushq $0x0
pushq %r15
pushq %r10
movl $0x3a98, %r14d          # imm = 0x3A98
pushq %rax
movl $0xea60, %r13d          # imm = 0xEA60
callq 0x4590e
addq $0x50, %rsp
movl $0xff, %r12d
movl $0xb18f, %edi           # imm = 0xB18F
movl $0x7a26, %esi           # imm = 0x7A26
movl $0x8084, %edx           # imm = 0x8084
movl $0xfa00, %ecx           # imm = 0xFA00
movl $0x80e8, %r8d           # imm = 0x80E8
movl $0x7530, %r9d           # imm = 0x7530
pushq $0x0
pushq %r12
pushq %r12
pushq %r12
pushq %r12
pushq %r12
pushq %r12
pushq %r15
pushq %r14
pushq %r13
callq 0x4590e
pushq $0x32
popq %rbx
movl %ebx, 0x40(%rsp)
movl %ebx, 0x38(%rsp)
movl %ebx, 0x30(%rsp)
movl %ebx, 0x28(%rsp)
movl %ebx, 0x20(%rsp)
movl %ebx, 0x18(%rsp)
movl %r15d, 0x10(%rsp)
andl $0x0, 0x48(%rsp)
movl %r14d, 0x8(%rsp)
movl $0x3a98, %r14d          # imm = 0x3A98
movl %r13d, (%rsp)
movl $0xea60, %ebp           # imm = 0xEA60
xorl %edi, %edi
movl $0x7a26, %esi           # imm = 0x7A26
movl $0x8084, %edx           # imm = 0x8084
movl $0xfa00, %ecx           # imm = 0xFA00
movl $0x80e8, %r8d           # imm = 0x80E8
movl $0x7530, %r9d           # imm = 0x7530
callq 0x4590e
addq $0x50, %rsp
movl $0x80, %eax
xorl %edi, %edi
movl $0x7a26, %esi           # imm = 0x7A26
movl $0x8084, %edx           # imm = 0x8084
movl $0xfa00, %ecx           # imm = 0xFA00
movl $0x80e8, %r8d           # imm = 0x80E8
movl $0x7530, %r9d           # imm = 0x7530
pushq $0x0
pushq %rax
pushq %rax
pushq %rax
pushq %rax
pushq %rax
pushq %rax
pushq %r15
pushq %r14
movl $0x3a98, %r13d          # imm = 0x3A98
pushq %rbp
movl $0xea60, %r14d          # imm = 0xEA60
callq 0x4590e
addq $0x50, %rsp
movl $0xc8, %eax
xorl %edi, %edi
movl $0x7a26, %esi           # imm = 0x7A26
movl $0x8084, %edx           # imm = 0x8084
movl $0xfa00, %ecx           # imm = 0xFA00
movl $0x80e8, %r8d           # imm = 0x80E8
movl $0x7530, %r9d           # imm = 0x7530
pushq $0x0
pushq %rax
pushq %rax
pushq %rax
pushq %rax
pushq %rax
pushq %rax
pushq %r15
pushq %r13
movl $0x3a98, %r13d          # imm = 0x3A98
pushq %r14
callq 0x4590e
addq $0x50, %rsp
xorl %edi, %edi
movl $0x7a26, %esi           # imm = 0x7A26
movl $0x8084, %edx           # imm = 0x8084
movl $0xfa00, %ecx           # imm = 0xFA00
movl $0x80e8, %r8d           # imm = 0x80E8
movl $0x7530, %r9d           # imm = 0x7530
pushq $0x0
pushq $0x0
pushq $0x0
pushq %r12
pushq $0x0
pushq $0x0
pushq %r12
pushq %r15
pushq %r13
movl $0x3a98, %r13d          # imm = 0x3A98
pushq %r14
callq 0x4590e
addq $0x50, %rsp
xorl %edi, %edi
movl $0x7a26, %esi           # imm = 0x7A26
movl $0x8084, %edx           # imm = 0x8084
movl $0xfa00, %ecx           # imm = 0xFA00
movl $0x80e8, %r8d           # imm = 0x80E8
movl $0x7530, %r9d           # imm = 0x7530
pushq $0x0
pushq $0x0
pushq %r12
pushq $0x0
pushq $0x0
pushq %r12
pushq $0x0
pushq %r15
pushq %r13
movl $0x3a98, %r13d          # imm = 0x3A98
pushq %r14
callq 0x4590e
addq $0x50, %rsp
xorl %edi, %edi
movl $0x7a26, %esi           # imm = 0x7A26
movl $0x8084, %edx           # imm = 0x8084
movl $0xfa00, %ecx           # imm = 0xFA00
movl $0x80e8, %r8d           # imm = 0x80E8
movl $0x7530, %r9d           # imm = 0x7530
pushq $0x0
pushq %r12
pushq $0x0
pushq $0x0
pushq %r12
pushq $0x0
pushq $0x0
pushq %r15
pushq %r13
movl $0x3a98, %r13d          # imm = 0x3A98
pushq %r14
callq 0x4590e
addq $0x50, %rsp
xorl %edi, %edi
movl $0x7a26, %esi           # imm = 0x7A26
movl $0x8084, %edx           # imm = 0x8084
movl $0x7530, %ecx           # imm = 0x7530
movl $0xea60, %r8d           # imm = 0xEA60
movl $0xfa00, %r9d           # imm = 0xFA00
pushq $0x0
pushq $0x0
pushq %r12
pushq $0x0
pushq $0x0
pushq $0x0
pushq %r12
pushq %r15
pushq %r13
movl $0x3a98, %r13d          # imm = 0x3A98
movl $0x80e8, %r14d          # imm = 0x80E8
pushq %r14
callq 0x4590e
addq $0x50, %rsp
xorl %edi, %edi
movl $0x7a26, %esi           # imm = 0x7A26
movl $0x8084, %edx           # imm = 0x8084
movl $0x7530, %ecx           # imm = 0x7530
movl $0xea60, %r8d           # imm = 0xEA60
movl $0xfa00, %r9d           # imm = 0xFA00
pushq $0x0
pushq $0x0
pushq $0x0
pushq %r12
pushq $0x0
pushq %r12
pushq $0x0
pushq %r15
pushq %r13
movl $0x3a98, %ebp           # imm = 0x3A98
pushq %r14
movl $0x80e8, %r13d          # imm = 0x80E8
callq 0x4590e
addq $0x50, %rsp
xorl %edi, %edi
movl $0x7a26, %esi           # imm = 0x7A26
movl $0x8084, %edx           # imm = 0x8084
movl $0x7530, %ecx           # imm = 0x7530
movl $0xea60, %r8d           # imm = 0xEA60
movl $0xfa00, %r9d           # imm = 0xFA00
pushq $0x0
pushq %r12
pushq $0x0
pushq $0x0
pushq %r12
pushq $0x0
pushq $0x0
pushq %r15
pushq %rbp
movl $0x3a98, %ebp           # imm = 0x3A98
pushq %r13
callq 0x4590e
addq $0x50, %rsp
xorl %edi, %edi
movl $0x7a26, %esi           # imm = 0x7A26
movl $0x8084, %edx           # imm = 0x8084
movl $0x7530, %ecx           # imm = 0x7530
movl $0xea60, %r8d           # imm = 0xEA60
movl $0x3a98, %r9d           # imm = 0x3A98
pushq $0x0
pushq $0x0
pushq %r12
pushq $0x0
pushq $0x0
pushq $0x0
pushq %r12
pushq %r13
movl $0xfa00, %r14d          # imm = 0xFA00
pushq %r14
pushq %r15
callq 0x4590e
addq $0x50, %rsp
xorl %edi, %edi
movl $0x7a26, %esi           # imm = 0x7A26
movl $0x8084, %edx           # imm = 0x8084
movl $0x7530, %ecx           # imm = 0x7530
movl $0xea60, %r8d           # imm = 0xEA60
movl $0x3a98, %r9d           # imm = 0x3A98
pushq $0x0
pushq %r12
pushq $0x0
pushq $0x0
pushq $0x0
pushq %r12
pushq $0x0
pushq %r13
pushq %r14
movl $0xfa00, %r14d          # imm = 0xFA00
pushq %r15
callq 0x4590e
addq $0x50, %rsp
xorl %edi, %edi
movl $0x7a26, %esi           # imm = 0x7A26
movl $0x8084, %edx           # imm = 0x8084
movl $0x7530, %ecx           # imm = 0x7530
movl $0xea60, %r8d           # imm = 0xEA60
movl $0x3a98, %r9d           # imm = 0x3A98
pushq $0x0
pushq $0x0
pushq $0x0
pushq %r12
pushq %r12
pushq $0x0
pushq $0x0
pushq %r13
pushq %r14
pushq %r15
callq 0x4590e
addq $0x50, %rsp
xorl %edi, %edi
movl $0x88b8, %esi           # imm = 0x88B8
movl $0x61a8, %edx           # imm = 0x61A8
movl $0xfa00, %ecx           # imm = 0xFA00
movl $0x80e8, %r8d           # imm = 0x80E8
movl $0x7530, %r9d           # imm = 0x7530
pushq $0x0
pushq $0x0
pushq $0x0
pushq $0x0
pushq $0x0
pushq $0x0
pushq $0x0
pushq %r15
pushq %rbp
movl $0xea60, %r14d          # imm = 0xEA60
pushq %r14
callq 0x4590e
addq $0x50, %rsp
xorl %edi, %edi
movl $0x88b8, %esi           # imm = 0x88B8
movl $0x61a8, %edx           # imm = 0x61A8
movl $0xfa00, %ecx           # imm = 0xFA00
movl $0x80e8, %r8d           # imm = 0x80E8
movl $0x7530, %r9d           # imm = 0x7530
pushq $0x0
pushq %rbx
pushq %rbx
pushq %rbx
pushq %rbx
pushq %rbx
pushq %rbx
pushq %r15
pushq %rbp
pushq %r14
movl $0xea60, %ebx           # imm = 0xEA60
callq 0x4590e
addq $0x50, %rsp
xorl %edi, %edi
movl $0x88b8, %esi           # imm = 0x88B8
movl $0x61a8, %edx           # imm = 0x61A8
movl $0xfa00, %ecx           # imm = 0xFA00
movl $0x80e8, %r8d           # imm = 0x80E8
movl $0x7530, %r9d           # imm = 0x7530
pushq $0x0
movl $0x80, %eax
pushq %rax
pushq %rax
pushq %rax
pushq %rax
pushq %rax
movl $0x80, %eax
pushq %rax
pushq %r15
pushq %rbp
pushq %rbx
callq 0x4590e
addq $0x50, %rsp
xorl %edi, %edi
movl $0x88b8, %esi           # imm = 0x88B8
movl $0x61a8, %edx           # imm = 0x61A8
movl $0xfa00, %ecx           # imm = 0xFA00
movl $0x80e8, %r8d           # imm = 0x80E8
movl $0x7530, %r9d           # imm = 0x7530
pushq $0x0
movl $0xc8, %eax
pushq %rax
pushq %rax
pushq %rax
pushq %rax
pushq %rax
movl $0xc8, %eax
pushq %rax
pushq %r15
pushq %rbp
pushq %rbx
callq 0x4590e
addq $0x50, %rsp
xorl %edi, %edi
movl $0x88b8, %esi           # imm = 0x88B8
movl $0x61a8, %edx           # imm = 0x61A8
movl $0xfa00, %ecx           # imm = 0xFA00
movl $0x80e8, %r8d           # imm = 0x80E8
movl $0x7530, %r9d           # imm = 0x7530
pushq $0x0
pushq %r12
pushq %r12
pushq %r12
pushq %r12
pushq %r12
pushq %r12
pushq %r15
pushq %rbp
pushq %rbx
callq 0x4590e
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq