// File: /workspace/github_cpp_makefile_star2_O3/lvandeve[P]lodepng/lodepng_util.cpp
// Function: lodepng::convertToXYZ_chrm(float*, unsigned int, unsigned int, LodePNGInfo const*, unsigned int, lodepng::LodePNGICC const*, float*)
static unsigned convertToXYZ_chrm(float* im, unsigned w, unsigned h,
                                  const LodePNGInfo* info, unsigned use_icc, const LodePNGICC* icc,
                                  float whitepoint[3]) {
  unsigned error = 0;
  size_t i, n;
  float m[9]; /* XYZ to linear RGB matrix */
  if(lodepng_mulofl((size_t)w, (size_t)h, &n)) return 92;

  /* Must be called even for grayscale, to get the correct whitepoint to output */
  error = getChrm(m, whitepoint, use_icc, icc, info);
  if(error) return error;

  /* Note: no whitepoint adaptation done to m here, because we only do the
  adaptation in convertFromXYZ (we only whitepoint adapt when going to the
  target RGB space, but here we're going from the source RGB space to XYZ) */

  /* Apply the above computed linear-RGB-to-XYZ matrix to the pixels.
  Skip the transform if it's the unit matrix (which is the case if grayscale profile) */
  if(!use_icc || icc->inputspace == 2) {
    for(i = 0; i < n; i++) {
      size_t j = i * 4;
      mulMatrix(&im[j + 0], &im[j + 1], &im[j + 2], m, im[j + 0], im[j + 1], im[j + 2]);
    }
  }

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x30, %rsp
movq %r9, %r14
movl %r8d, %ebp
movq %rcx, %r8
movl %edx, %r15d
movl %esi, %r12d
movq %rdi, %rbx
movq 0x60(%rsp), %rsi
movq %rsp, %rdi
movl %ebp, %edx
movq %r9, %rcx
callq 0x14051
movl %eax, %ecx
movl $0x1, %eax
testl %ecx, %ecx
jne 0x129c3
movl %r12d, %ecx
movl %r15d, %eax
imulq %rcx, %rax
testl %ebp, %ebp
je 0x128e1
cmpl $0x2, (%r14)
sete %cl
testq %rax, %rax
setne %dl
testb %dl, %cl
jne 0x128ea
jmp 0x129c1
testq %rax, %rax
je 0x129c1
movaps (%rsp), %xmm0
movups 0x4(%rsp), %xmm1
movups 0x8(%rsp), %xmm2
movss 0xc(%rsp), %xmm3
movlhps %xmm0, %xmm3            # xmm3 = xmm3[0],xmm0[0]
shufps $0xe2, %xmm0, %xmm3     # xmm3 = xmm3[2,0],xmm0[2,3]
cvtps2pd %xmm3, %xmm0
movss 0x10(%rsp), %xmm3
movlhps %xmm1, %xmm3            # xmm3 = xmm3[0],xmm1[0]
shufps $0xe2, %xmm1, %xmm3     # xmm3 = xmm3[2,0],xmm1[2,3]
cvtps2pd %xmm3, %xmm1
movss 0x14(%rsp), %xmm3
movlhps %xmm2, %xmm3            # xmm3 = xmm3[0],xmm2[0]
shufps $0xe2, %xmm2, %xmm3     # xmm3 = xmm3[2,0],xmm2[2,3]
cvtps2pd %xmm3, %xmm2
xorps %xmm3, %xmm3
cvtss2sd 0x18(%rsp), %xmm3
cvtss2sd 0x1c(%rsp), %xmm4
cvtss2sd 0x20(%rsp), %xmm5
addq $0x8, %rbx
xorps %xmm6, %xmm6
cvtss2sd -0x8(%rbx), %xmm6
xorps %xmm7, %xmm7
cvtss2sd -0x4(%rbx), %xmm7
xorps %xmm8, %xmm8
cvtss2sd (%rbx), %xmm8
movaps %xmm7, %xmm9
movlhps %xmm7, %xmm9            # xmm9 = xmm9[0],xmm7[0]
mulpd %xmm1, %xmm9
movaps %xmm6, %xmm10
movlhps %xmm6, %xmm10           # xmm10 = xmm10[0],xmm6[0]
mulpd %xmm0, %xmm10
addpd %xmm9, %xmm10
movaps %xmm8, %xmm9
movlhps %xmm8, %xmm9            # xmm9 = xmm9[0],xmm8[0]
mulpd %xmm2, %xmm9
addpd %xmm10, %xmm9
cvtpd2ps %xmm9, %xmm9
mulsd %xmm4, %xmm7
mulsd %xmm3, %xmm6
addsd %xmm7, %xmm6
mulsd %xmm5, %xmm8
addsd %xmm6, %xmm8
xorps %xmm6, %xmm6
cvtsd2ss %xmm8, %xmm6
movlpd %xmm9, -0x8(%rbx)
movss %xmm6, (%rbx)
addq $0x10, %rbx
decq %rax
jne 0x12941
xorl %eax, %eax
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq