// File: /workspace/github_cpp_makefile_star2_O1/sundale[P]gcode/rs274ngc/interp_convert.cc
// Function: Interp::convert_arc2(int, block_struct*, setup_struct*, double*, double*, double*, double, double, double, double, double, double, double, double, double, double, double)
int Interp::convert_arc2(int move,       //!< either G_2 (cw arc) or G_3 (ccw arc)    
                        block_pointer block,    //!< pointer to a block of RS274 instructions
                        setup_pointer settings, //!< pointer to machine settings             
                        double *current1,       //!< pointer to current value of coordinate 1
                        double *current2,       //!< pointer to current value of coordinate 2
                        double *current3,       //!< pointer to current value of coordinate 3
                        double end1,    //!< coordinate 1 value at end of arc        
                        double end2,    //!< coordinate 2 value at end of arc        
                        double end3,    //!< coordinate 3 value at end of arc        
                        double AA_end,  //!< a-value at end of arc                   
                        double BB_end,  //!< b-value at end of arc                   
                        double CC_end,  //!< c-value at end of arc                   
                         double u, double v, double w, //!< values at end of arc
                        double offset1, //!< center, either abs or offset from current
                        double offset2)
{
  double center1;
  double center2;
  double tolerance;             /* tolerance for difference of radii          */
  int turn;                     /* number of full or partial turns CCW in arc */
  int plane = settings->plane;

  tolerance = (settings->length_units == CANON_UNITS_INCHES) ?
    TOLERANCE_INCH : TOLERANCE_MM;

  if (block->r_flag) {
      CHP(arc_data_r(move, plane, *current1, *current2, end1, end2,
                   block->r_number, &center1, &center2, &turn, tolerance));
  } else {
      CHP(arc_data_ijk(move, plane, *current1, *current2, end1, end2,
                       (settings->ijk_distance_mode == MODE_ABSOLUTE),
                       offset1, offset2,
                       &center1, &center2, &turn, tolerance));
  }
  inverse_time_rate_arc(*current1, *current2, *current3, center1, center2,
                        turn, end1, end2, end3, block, settings);

  ARC_FEED(block->line_number, end1, end2, center1, center2, turn, end3,
           AA_end, BB_end, CC_end, u, v, w);
  *current1 = end1;
  *current2 = end2;
  *current3 = end3;
  settings->AA_current = AA_end;
  settings->BB_current = BB_end;
  settings->CC_current = CC_end;
  settings->u_current = u;
  settings->v_current = v;
  settings->w_current = w;
  
  return INTERP_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movsd %xmm7, -0x80(%rbp)
movsd %xmm6, -0x78(%rbp)
movsd %xmm5, -0x70(%rbp)
movsd %xmm4, -0x68(%rbp)
movsd %xmm3, -0x60(%rbp)
movsd %xmm2, -0x48(%rbp)
movaps %xmm1, %xmm3
movaps %xmm0, %xmm2
movq %r8, %r15
movq %rcx, %rbx
movq %rdx, %r12
movq %rdi, %r14
xorl %eax, %eax
cmpl $0x1, 0x1690(%rcx)
movl 0xc67c(%rcx), %edx
sete %al
leaq 0x28ffc(%rip), %rcx     # 0x36f20
movsd (%rcx,%rax,8), %xmm6
movsd (%r8), %xmm0
movq %r9, -0x88(%rbp)
movsd (%r9), %xmm1
cmpb $0x1, 0x229(%r12)
movsd %xmm3, -0x40(%rbp)
movsd %xmm2, -0x38(%rbp)
jne 0xdf72
movsd 0x230(%r12), %xmm4
leaq -0x58(%rbp), %rcx
leaq -0x50(%rbp), %r8
leaq -0x2c(%rbp), %r9
movq %r14, %rdi
movaps %xmm6, %xmm5
callq 0xac60
jmp 0xdfa0
movsd 0x28(%rbp), %xmm5
movsd 0x20(%rbp), %xmm4
xorl %ecx, %ecx
cmpl $0x0, 0x66c(%rbx)
sete %cl
leaq -0x2c(%rbp), %rax
movq %rax, (%rsp)
leaq -0x58(%rbp), %r8
leaq -0x50(%rbp), %r9
movq %r14, %rdi
callq 0xad50
testl %eax, %eax
je 0xe00f
movl %eax, %r13d
movq 0x35fb2(%rip), %rbx     # 0x43f60
movslq 0xd670(%rbx), %rax
cmpq $0x30, %rax
jg 0xe10f
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq (%rbx,%rax), %rdi
addq $0xc6d0, %rdi           # imm = 0xC6D0
leaq 0x2a072(%rip), %rsi     # 0x3804b
movl $0x50, %edx
callq 0xa8a0
movslq 0xd670(%rbx), %rax
leaq (%rax,%rax,4), %rcx
shlq $0x4, %rcx
xorl %edx, %edx
movb %dl, 0xc71f(%rbx,%rcx)
incl %eax
movl %eax, 0xd670(%rbx)
movb %dl, 0xc720(%rbx,%rcx)
jmp 0xe10f
movq 0x10(%rbp), %rax
movsd (%r15), %xmm0
movq -0x88(%rbp), %r13
movsd (%r13), %xmm1
movsd (%rax), %xmm2
movsd -0x58(%rbp), %xmm3
movsd -0x50(%rbp), %xmm4
movl -0x2c(%rbp), %esi
movq %r14, %rdi
movsd -0x38(%rbp), %xmm5
movsd -0x40(%rbp), %xmm6
movsd -0x48(%rbp), %xmm7
movq %r12, %rdx
movq %rbx, %rcx
callq 0xac30
movl 0x1d0(%r12), %edi
movsd -0x58(%rbp), %xmm2
movsd -0x50(%rbp), %xmm3
movl -0x2c(%rbp), %esi
movsd 0x18(%rbp), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd -0x80(%rbp), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd -0x78(%rbp), %xmm0
movsd %xmm0, (%rsp)
movsd -0x38(%rbp), %xmm0
movsd -0x40(%rbp), %xmm1
movsd -0x48(%rbp), %xmm4
movsd -0x60(%rbp), %xmm5
movsd -0x68(%rbp), %xmm6
movsd -0x70(%rbp), %xmm7
callq 0xb520
movsd -0x38(%rbp), %xmm0
movsd %xmm0, (%r15)
movsd -0x40(%rbp), %xmm0
movsd %xmm0, (%r13)
movq 0x10(%rbp), %rax
movsd -0x48(%rbp), %xmm0
movsd %xmm0, (%rax)
movsd -0x60(%rbp), %xmm0
movsd %xmm0, 0x8(%rbx)
movsd -0x68(%rbp), %xmm0
movsd %xmm0, 0x20(%rbx)
movsd -0x70(%rbp), %xmm0
movsd %xmm0, 0x38(%rbx)
movsd -0x78(%rbp), %xmm0
movsd %xmm0, 0x50(%rbx)
movsd -0x80(%rbp), %xmm0
movsd %xmm0, 0x68(%rbx)
movsd 0x18(%rbp), %xmm0
movsd %xmm0, 0x80(%rbx)
xorl %r13d, %r13d
movl %r13d, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop