// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/png/png.c
// Function: png_check_cHRM_fixed
int /* PRIVATE */
png_check_cHRM_fixed(png_structp png_ptr,
   png_fixed_point white_x, png_fixed_point white_y, png_fixed_point red_x,
   png_fixed_point red_y, png_fixed_point green_x, png_fixed_point green_y,
   png_fixed_point blue_x, png_fixed_point blue_y)
{
   int ret = 1;
   unsigned long xy_hi,xy_lo,yx_hi,yx_lo;

   png_debug(1, "in function png_check_cHRM_fixed");

   if (png_ptr == NULL)
      return 0;

   if (white_x < 0 || white_y <= 0 ||
         red_x < 0 ||   red_y <  0 ||
       green_x < 0 || green_y <  0 ||
        blue_x < 0 ||  blue_y <  0)
   {
      png_warning(png_ptr,
        "Ignoring attempt to set negative chromaticity value");
      ret = 0;
   }
   if (white_x > (png_fixed_point) PNG_UINT_31_MAX ||
       white_y > (png_fixed_point) PNG_UINT_31_MAX ||
         red_x > (png_fixed_point) PNG_UINT_31_MAX ||
         red_y > (png_fixed_point) PNG_UINT_31_MAX ||
       green_x > (png_fixed_point) PNG_UINT_31_MAX ||
       green_y > (png_fixed_point) PNG_UINT_31_MAX ||
        blue_x > (png_fixed_point) PNG_UINT_31_MAX ||
        blue_y > (png_fixed_point) PNG_UINT_31_MAX )
   {
      png_warning(png_ptr,
        "Ignoring attempt to set chromaticity value exceeding 21474.83");
      ret = 0;
   }
   if (white_x > 100000L - white_y)
   {
      png_warning(png_ptr, "Invalid cHRM white point");
      ret = 0;
   }
   if (red_x > 100000L - red_y)
   {
      png_warning(png_ptr, "Invalid cHRM red point");
      ret = 0;
   }
   if (green_x > 100000L - green_y)
   {
      png_warning(png_ptr, "Invalid cHRM green point");
      ret = 0;
   }
   if (blue_x > 100000L - blue_y)
   {
      png_warning(png_ptr, "Invalid cHRM blue point");
      ret = 0;
   }

   png_64bit_product(green_x - red_x, blue_y - red_y, &xy_hi, &xy_lo);
   png_64bit_product(green_y - red_y, blue_x - red_x, &yx_hi, &yx_lo);

   if (xy_hi == yx_hi && xy_lo == yx_lo)
   {
      png_warning(png_ptr,
         "Ignoring attempt to set cHRM RGB triangle with zero area");
      ret = 0;
   }

   return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %ecx, 0xc(%rsp)
xorl %eax, %eax
movq %rdi, 0x10(%rsp)
testq %rdi, %rdi
je 0x87733
movl %r9d, %r15d
movl %edx, %r12d
movl %esi, %r13d
movl 0x60(%rsp), %r14d
movl 0x58(%rsp), %ebp
movl 0x50(%rsp), %ebx
testl %edx, %edx
movl %r8d, 0x8(%rsp)
jle 0x875c0
movl 0xc(%rsp), %eax
orl %r13d, %eax
movl %r8d, %ecx
orl %r15d, %ecx
orl %eax, %ecx
orl %ebx, %ecx
movl %ebp, %eax
orl %r14d, %eax
orl %ecx, %eax
movl $0x1, %eax
jns 0x875d8
leaq 0x24bad(%rip), %rsi     # 0xac174
movq 0x10(%rsp), %rdi
callq 0x9214d
movl 0x8(%rsp), %r8d
xorl %eax, %eax
movslq %r13d, %rcx
movslq %r12d, %rdx
movl $0x186a0, %r12d         # imm = 0x186A0
movl $0x186a0, %esi          # imm = 0x186A0
subq %rdx, %rsi
cmpq %rcx, %rsi
movq 0x10(%rsp), %r13
jge 0x8760c
leaq 0x24bab(%rip), %rsi     # 0xac1a8
movq %r13, %rdi
callq 0x9214d
movl 0x8(%rsp), %r8d
xorl %eax, %eax
movslq 0xc(%rsp), %rcx
movslq %r8d, %rdx
subq %rdx, %r12
cmpq %rcx, %r12
jge 0x8762d
leaq 0x24b9e(%rip), %rsi     # 0xac1c1
movq %r13, %rdi
callq 0x9214d
xorl %eax, %eax
movslq %r15d, %rcx
movslq %ebx, %rdx
movl $0x186a0, %r12d         # imm = 0x186A0
movl $0x186a0, %esi          # imm = 0x186A0
subq %rdx, %rsi
cmpq %rcx, %rsi
jge 0x87657
leaq 0x24b8b(%rip), %rsi     # 0xac1d8
movq %r13, %rdi
callq 0x9214d
xorl %eax, %eax
movslq %ebp, %rcx
movslq %r14d, %rdx
subq %rdx, %r12
cmpq %rcx, %r12
jge 0x87676
leaq 0x24b85(%rip), %rsi     # 0xac1f1
movq %r13, %rdi
callq 0x9214d
xorl %eax, %eax
movl 0xc(%rsp), %r10d
subl %r10d, %r15d
movl 0x8(%rsp), %r11d
subl %r11d, %r14d
movl %r15d, %r8d
shrl $0x10, %r8d
movl $0xffff, %ecx           # imm = 0xFFFF
andl %ecx, %r15d
movl %r14d, %edi
shrl $0x10, %edi
andl %ecx, %r14d
movl %r14d, %esi
imull %r15d, %esi
imull %r8d, %r14d
imull %edi, %r15d
addl %r14d, %r15d
movl %esi, %edx
shrl $0x10, %edx
addq %r15, %rdx
movq %rdx, %r9
shrq $0x10, %r9
imull %r8d, %edi
addq %r9, %rdi
subl %r11d, %ebx
subl %r10d, %ebp
movl %ebx, %r10d
shrl $0x10, %r10d
andl %ecx, %ebx
movl %ebp, %r11d
shrl $0x10, %r11d
andl %ecx, %ebp
movl %ebp, %r8d
imull %ebx, %r8d
imull %r10d, %ebp
imull %r11d, %ebx
addl %ebp, %ebx
movl %r8d, %r9d
shrl $0x10, %r9d
addq %rbx, %r9
movq %r9, %rbx
shrq $0x10, %rbx
imull %r10d, %r11d
addq %rbx, %r11
cmpq %r11, %rdi
jne 0x87733
andl %ecx, %esi
shll $0x10, %edx
orl %esi, %edx
andl %ecx, %r8d
shll $0x10, %r9d
orl %r8d, %r9d
cmpl %r9d, %edx
jne 0x87733
leaq 0x24ae0(%rip), %rsi     # 0xac209
movq %r13, %rdi
callq 0x9214d
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq