// File: /workspace/github_cpp_makefile_star2_O2/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 $0x28, %rsp
movl %r8d, (%rsp)
movl %ecx, 0x4(%rsp)
xorl %r12d, %r12d
testq %rdi, %rdi
je 0x7aaaa
movl %r9d, %r15d
movl %edx, %r13d
movl %esi, %ebx
movq %rdi, %r14
movl 0x70(%rsp), %ebp
movl 0x68(%rsp), %edx
testl %r13d, %r13d
jle 0x7a989
movl 0x4(%rsp), %eax
orl %ebx, %eax
movl (%rsp), %ecx
orl %r15d, %ecx
orl %eax, %ecx
orl 0x60(%rsp), %ecx
movl %edx, %eax
orl %ebp, %eax
orl %ecx, %eax
js 0x7a989
pushq $0x1
popq %r12
jmp 0x7a99b
leaq 0x22504(%rip), %rsi     # 0x9ce94
movq %r14, %rdi
callq 0x84a53
xorl %r12d, %r12d
movslq %ebx, %rax
movslq %r13d, %rcx
movl $0x186a0, %ebx          # imm = 0x186A0
movl $0x186a0, %edx          # imm = 0x186A0
subq %rcx, %rdx
cmpq %rax, %rdx
movq %r14, %r13
jge 0x7a9c8
leaq 0x2250b(%rip), %rsi     # 0x9cec8
movq %r13, %rdi
callq 0x84a53
xorl %r12d, %r12d
movl 0x4(%rsp), %r14d
movslq %r14d, %rax
movslq (%rsp), %rcx
subq %rcx, %rbx
cmpq %rax, %rbx
jge 0x7a9ee
leaq 0x224fe(%rip), %rsi     # 0x9cee1
movq %r13, %rdi
callq 0x84a53
xorl %r12d, %r12d
movslq %r15d, %rax
movslq 0x60(%rsp), %rcx
movl $0x186a0, %ebx          # imm = 0x186A0
movl $0x186a0, %edx          # imm = 0x186A0
subq %rcx, %rdx
cmpq %rax, %rdx
jge 0x7aa1a
leaq 0x224e9(%rip), %rsi     # 0x9cef8
movq %r13, %rdi
callq 0x84a53
xorl %r12d, %r12d
movslq 0x68(%rsp), %rax
movslq %ebp, %rcx
subq %rcx, %rbx
cmpq %rax, %rbx
jge 0x7aa3c
leaq 0x224e0(%rip), %rsi     # 0x9cf11
movq %r13, %rdi
callq 0x84a53
xorl %r12d, %r12d
subl %r14d, %r15d
movslq %r15d, %rdi
movl (%rsp), %r15d
subl %r15d, %ebp
movslq %ebp, %rsi
leaq 0x20(%rsp), %rbx
leaq 0x10(%rsp), %rcx
movq %rbx, %rdx
callq 0x7a8e1
movl 0x60(%rsp), %eax
subl %r15d, %eax
movslq %eax, %rdi
movl 0x68(%rsp), %eax
subl %r14d, %eax
movslq %eax, %rsi
leaq 0x18(%rsp), %r14
leaq 0x8(%rsp), %rcx
movq %r14, %rdx
callq 0x7a8e1
movq (%rbx), %rax
cmpq (%r14), %rax
jne 0x7aaaa
movq 0x10(%rsp), %rax
cmpq 0x8(%rsp), %rax
jne 0x7aaaa
leaq 0x2248a(%rip), %rsi     # 0x9cf29
movq %r13, %rdi
callq 0x84a53
xorl %r12d, %r12d
movl %r12d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq