// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/png/pngwutil.c
// Function: png_write_cHRM
void /* PRIVATE */
png_write_cHRM(png_structp png_ptr, double white_x, double white_y,
   double red_x, double red_y, double green_x, double green_y,
   double blue_x, double blue_y)
{
   PNG_cHRM;
   png_byte buf[32];

   png_fixed_point int_white_x, int_white_y, int_red_x, int_red_y,
      int_green_x, int_green_y, int_blue_x, int_blue_y;

   png_debug(1, "in png_write_cHRM");

   int_white_x = (png_uint_32)(white_x * 100000.0 + 0.5);
   int_white_y = (png_uint_32)(white_y * 100000.0 + 0.5);
   int_red_x   = (png_uint_32)(red_x   * 100000.0 + 0.5);
   int_red_y   = (png_uint_32)(red_y   * 100000.0 + 0.5);
   int_green_x = (png_uint_32)(green_x * 100000.0 + 0.5);
   int_green_y = (png_uint_32)(green_y * 100000.0 + 0.5);
   int_blue_x  = (png_uint_32)(blue_x  * 100000.0 + 0.5);
   int_blue_y  = (png_uint_32)(blue_y  * 100000.0 + 0.5);

#ifdef PNG_CHECK_cHRM_SUPPORTED
   if (png_check_cHRM_fixed(png_ptr, int_white_x, int_white_y,
      int_red_x, int_red_y, int_green_x, int_green_y, int_blue_x, int_blue_y))
#endif
   {
      /* Each value is saved in 1/100,000ths */

      png_save_uint_32(buf, int_white_x);
      png_save_uint_32(buf + 4, int_white_y);

      png_save_uint_32(buf + 8, int_red_x);
      png_save_uint_32(buf + 12, int_red_y);

      png_save_uint_32(buf + 16, int_green_x);
      png_save_uint_32(buf + 20, int_green_y);

      png_save_uint_32(buf + 24, int_blue_x);
      png_save_uint_32(buf + 28, int_blue_y);

      png_write_chunk(png_ptr, (png_bytep)png_cHRM, buf, (png_size_t)32);
   }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movb $0x0, 0xc(%rsp)
movl $0x4d524863, 0x8(%rsp)  # imm = 0x4D524863
movsd 0xd0b7(%rip), %xmm8     # 0xac4f8
mulsd %xmm8, %xmm0
movsd 0x2be1(%rip), %xmm9     # 0xa2030
addsd %xmm9, %xmm0
cvttsd2si %xmm0, %rsi
mulsd %xmm8, %xmm1
addsd %xmm9, %xmm1
cvttsd2si %xmm1, %rdx
mulsd %xmm8, %xmm2
addsd %xmm9, %xmm2
cvttsd2si %xmm2, %rcx
mulsd %xmm8, %xmm3
addsd %xmm9, %xmm3
mulsd %xmm8, %xmm4
addsd %xmm9, %xmm4
mulsd %xmm8, %xmm5
addsd %xmm9, %xmm5
mulsd %xmm8, %xmm6
addsd %xmm9, %xmm6
mulsd %xmm8, %xmm7
addsd %xmm9, %xmm7
cvttsd2si %xmm3, %rbx
cvttsd2si %xmm4, %r9
cvttsd2si %xmm5, %r11
cvttsd2si %xmm6, %r10
cvttsd2si %xmm7, %rax
subq $0x8, %rsp
movq %rdi, 0x48(%rsp)
movq %rsi, %r12
movq %rdx, %r14
movq %rcx, %rbp
movl %ebx, %r8d
movq %r9, %r15
movq %rax, 0x40(%rsp)
pushq %rax
movq %r10, 0x40(%rsp)
pushq %r10
movq %r11, %r13
pushq %r11
callq 0x88344
addq $0x20, %rsp
testl %eax, %eax
je 0x9f5e6
movq %r12, %rcx
movl %ecx, %eax
shrl $0x18, %eax
leaq 0x10(%rsp), %rdx
movb %al, (%rdx)
movl %ecx, %eax
shrl $0x10, %eax
movb %al, 0x1(%rdx)
movb %ch, 0x12(%rsp)
movb %cl, 0x3(%rdx)
movq %r14, %rcx
movl %ecx, %eax
shrl $0x18, %eax
movb %al, 0x4(%rdx)
movl %ecx, %eax
shrl $0x10, %eax
movb %al, 0x5(%rdx)
movb %ch, 0x16(%rsp)
movb %cl, 0x7(%rdx)
movq %rbp, %rcx
movl %ebp, %eax
shrl $0x18, %eax
movb %al, 0x8(%rdx)
movl %ebp, %eax
shrl $0x10, %eax
movb %al, 0x9(%rdx)
movb %ch, 0x1a(%rsp)
movb %cl, 0xb(%rdx)
movl %ebx, %eax
shrl $0x18, %eax
movb %al, 0xc(%rdx)
movl %ebx, %eax
shrl $0x10, %eax
movb %al, 0xd(%rdx)
movb %bh, 0x1e(%rsp)
movb %bl, 0xf(%rdx)
movq %r15, %rcx
movl %ecx, %eax
shrl $0x18, %eax
movb %al, 0x10(%rdx)
movl %ecx, %eax
shrl $0x10, %eax
movb %al, 0x11(%rdx)
movb %ch, 0x22(%rsp)
movb %cl, 0x13(%rdx)
movq %r13, %rcx
movl %ecx, %eax
shrl $0x18, %eax
movb %al, 0x14(%rdx)
movl %ecx, %eax
shrl $0x10, %eax
movb %al, 0x15(%rdx)
movb %ch, 0x26(%rsp)
movb %cl, 0x17(%rdx)
movq 0x30(%rsp), %rcx
movl %ecx, %eax
shrl $0x18, %eax
movb %al, 0x18(%rdx)
movl %ecx, %eax
shrl $0x10, %eax
movb %al, 0x19(%rdx)
movb %ch, 0x2a(%rsp)
movb %cl, 0x1b(%rdx)
movq 0x38(%rsp), %rcx
movl %ecx, %eax
shrl $0x18, %eax
movb %al, 0x1c(%rdx)
movl %ecx, %eax
shrl $0x10, %eax
movb %al, 0x1d(%rdx)
movb %ch, 0x2e(%rsp)
movb %cl, 0x1f(%rdx)
leaq 0x8(%rsp), %rsi
movl $0x20, %ecx
movq 0x40(%rsp), %rdi
callq 0x9e2b1
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq