// File: /workspace/github_cpp_makefile_star2_O2/sundale[P]gcode/rs274ngc/interp_arc.cc
// Function: Interp::arc_data_ijk(int, int, double, double, double, double, int, double, double, double*, double*, int*, double)
int Interp::arc_data_ijk(int move,       //!< either G_2 (cw arc) or G_3 (ccw arc)
                         int plane,
                        double current_x,       //!< first coordinate of current point
                        double current_y,       //!< second coordinate of current point
                        double end_x,   //!< first coordinate of arc end point
                        double end_y,   //!< second coordinate of arc end point
                        int ij_absolute,        //!<how to interpret i/j numbers
                        double i_number,        //!<first coordinate of center (abs or incr)
                        double j_number,        //!<second coordinate of center (abs or incr)
                        double *center_x,       //!< pointer to first coordinate of center of arc
                        double *center_y,       //!< pointer to second coordinate of center of arc
                        int *turn,      //!< pointer to no. of full or partial circles CCW
                        double tolerance)       //!< tolerance of differing radii
{
  double radius;                /* radius to current point */
  double radius2;               /* radius to end point     */
  double min_radius = 0.1 * tolerance;	/* smaller than this is treated as zero */
  char a = arc_axis1(plane), b = arc_axis2(plane);

  if ( ij_absolute ) {
    *center_x = (i_number);
    *center_y = (j_number);
  } else {
    *center_x = (current_x + i_number);
    *center_y = (current_y + j_number);
  }
  radius = hypot((*center_x - current_x), (*center_y - current_y));
  radius2 = hypot((*center_x - end_x), (*center_y - end_y));
  CHKS(((radius < min_radius) || (radius2 < min_radius)), NCE_ZERO_RADIUS_ARC);
  CHKS((fabs(radius - radius2) > tolerance),
      _("Radius to end of arc differs from radius to start: "
       "start=(%c%.4f,%c%.4f) center=(%c%.4f,%c%.4f) end=(%c%.4f,%c%.4f) r1=%.4f r2=%.4f"),
       a, current_x, b, current_y, 
       a, *center_x, b, *center_y, 
       a, end_x, b, end_y, radius, radius2);
  if (move == G_2)
    *turn = -1;
  else if (move == G_3)
    *turn = 1;
  else
    ERS(NCE_BUG_CODE_NOT_G2_OR_G3);
  return INTERP_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r9, %r15
movq %r8, %r12
movsd %xmm3, -0x50(%rbp)
movsd %xmm2, -0x48(%rbp)
movapd %xmm0, %xmm2
movl %edx, %r14d
movl %esi, %ebx
movq %rdi, -0x30(%rbp)
leal -0x1(%r14), %eax
cmpl $0x2, %eax
ja 0xcee2
addl $0x57, %r14d
movl %eax, %eax
leaq 0x21490(%rip), %rdx     # 0x2e36c
movl (%rdx,%rax,4), %r13d
jmp 0xcee9
pushq $0x21
popq %r14
movl %r14d, %r13d
movsd 0x2110f(%rip), %xmm0    # 0x2e000
mulsd %xmm6, %xmm0
testl %ecx, %ecx
movsd %xmm6, -0x68(%rbp)
movsd %xmm0, -0x38(%rbp)
jne 0xcf0b
addsd %xmm2, %xmm4
addsd %xmm1, %xmm5
movsd %xmm4, (%r12)
movsd %xmm5, (%r15)
movsd (%r12), %xmm0
movsd %xmm2, -0x58(%rbp)
subsd %xmm2, %xmm0
movsd %xmm1, -0x60(%rbp)
subsd %xmm1, %xmm5
movapd %xmm5, %xmm1
callq 0xb2c0
movsd %xmm0, -0x40(%rbp)
movsd (%r12), %xmm0
subsd -0x48(%rbp), %xmm0
movsd (%r15), %xmm1
subsd -0x50(%rbp), %xmm1
callq 0xb2c0
movsd -0x40(%rbp), %xmm1
movsd -0x38(%rbp), %xmm2
ucomisd %xmm1, %xmm2
ja 0xcfe3
ucomisd %xmm0, %xmm2
ja 0xcfe3
movapd %xmm1, %xmm2
subsd %xmm0, %xmm2
andpd 0x210a4(%rip), %xmm2    # 0x2e020
ucomisd -0x68(%rbp), %xmm2
jbe 0xd03e
leaq 0x2115f(%rip), %rdi     # 0x2e0ed
movsd %xmm0, -0x38(%rbp)
callq 0xb220
movsd (%r12), %xmm2
movsd (%r15), %xmm3
movq -0x30(%rbp), %rdi
movq %rax, %rsi
movl %r14d, %edx
movsd -0x58(%rbp), %xmm0
movl %r13d, %ecx
movsd -0x60(%rbp), %xmm1
movl %r14d, %r8d
movl %r13d, %r9d
movsd -0x48(%rbp), %xmm4
movsd -0x50(%rbp), %xmm5
movsd -0x40(%rbp), %xmm6
movsd -0x38(%rbp), %xmm7
movb $0x8, %al
pushq %r13
pushq %r14
callq 0xb8e0
popq %rax
popq %rcx
jmp 0xcffd
leaq 0x21066(%rip), %rdi     # 0x2e050
callq 0xb220
movq -0x30(%rbp), %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0xb8e0
movq 0x2ff5c(%rip), %rbx     # 0x3cf60
leaq 0xc6d0(%rbx), %rdi
leaq 0x21222(%rip), %rsi     # 0x2e234
pushq $0x50
popq %rdx
callq 0xb940
andw $0x0, 0xc71f(%rbx)
movl $0x1, 0xd670(%rbx)
pushq $0x5
popq %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x14, %ebx
je 0xd04c
cmpl $0x1e, %ebx
jne 0xd059
pushq $0x1
jmp 0xd04e
pushq $-0x1
popq %rax
movq 0x10(%rbp), %rcx
movl %eax, (%rcx)
xorl %eax, %eax
jmp 0xd02f
leaq 0x21140(%rip), %rdi     # 0x2e1a0
jmp 0xcfea
nop