// File: /workspace/github_cpp_makefile_star2_O3/sundale[P]gcode/rs274ngc/interp_cycles.cc
// Function: Interp::convert_cycle_g83(block_struct*, int, double, double, double, double, double, double)
int Interp::convert_cycle_g83(block_pointer block,
                              CANON_PLANE plane, //!< selected plane                  
                              double x,  //!< x-value where cycle is executed 
                              double y,  //!< y-value where cycle is executed 
                              double r,  //!< initial z-value                 
                              double clear_z,    //!< z-value of clearance plane      
                              double bottom_z,   //!< value of z at bottom of cycle   
                              double delta)      //!< size of z-axis feed increment   
{
  double current_depth;
  double rapid_delta;

  /* Moved the check for negative Q values here as a sign
     may be used with user defined M functions
     Thanks to Billy Singleton for pointing it out... */
  CHKS((delta <= 0.0), NCE_NEGATIVE_OR_ZERO_Q_VALUE_USED);

  rapid_delta = G83_RAPID_DELTA;
  if (_setup.length_units == CANON_UNITS_MM)
    rapid_delta = (rapid_delta * 25.4);

  for (current_depth = (r - delta);
       current_depth > bottom_z; current_depth = (current_depth - delta)) {
    cycle_feed(block, plane, x, y, current_depth);
    cycle_traverse(block, plane, x, y, clear_z);
    cycle_traverse(block, plane, x, y, current_depth + rapid_delta);
  }
  cycle_feed(block, plane, x, y, bottom_z);
  cycle_traverse(block, plane, x, y, clear_z);

  return INTERP_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x38, %rsp
xorpd %xmm6, %xmm6
ucomisd %xmm5, %xmm6
jae 0x1a9ec
movl %edx, %ebx
movq %rsi, %r14
movq 0x26653(%rip), %rcx     # 0x40f60
xorl %eax, %eax
cmpl $0x2, 0x1690(%rcx)
sete %cl
subsd %xmm5, %xmm2
ucomisd %xmm4, %xmm2
movsd %xmm3, -0x30(%rbp)
movsd %xmm1, -0x20(%rbp)
movsd %xmm0, -0x28(%rbp)
jbe 0x1a9c1
movb %cl, %al
leaq 0x1c2e1(%rip), %rcx     # 0x36c20
movsd (%rcx,%rax,8), %xmm3
movsd %xmm3, -0x40(%rbp)
movsd %xmm4, -0x50(%rbp)
movsd %xmm5, -0x48(%rbp)
movsd %xmm2, -0x38(%rbp)
movq %r14, %rsi
movl %ebx, %edx
movsd -0x20(%rbp), %xmm1
callq 0xa180
movq %r14, %rsi
movl %ebx, %edx
movsd -0x28(%rbp), %xmm0
movsd -0x20(%rbp), %xmm1
movsd -0x30(%rbp), %xmm2
callq 0xb120
movsd -0x40(%rbp), %xmm2
addsd -0x38(%rbp), %xmm2
movq %r14, %rsi
movl %ebx, %edx
movsd -0x28(%rbp), %xmm0
movsd -0x20(%rbp), %xmm1
callq 0xb120
movsd -0x38(%rbp), %xmm2
movsd -0x48(%rbp), %xmm5
movsd -0x50(%rbp), %xmm4
movsd -0x28(%rbp), %xmm0
movsd -0x20(%rbp), %xmm1
subsd %xmm5, %xmm2
ucomisd %xmm4, %xmm2
ja 0x1a953
movq %r14, %rsi
movl %ebx, %edx
movapd %xmm4, %xmm2
callq 0xa180
movq %r14, %rsi
movl %ebx, %edx
movsd -0x28(%rbp), %xmm0
movsd -0x20(%rbp), %xmm1
movsd -0x30(%rbp), %xmm2
callq 0xb120
xorl %eax, %eax
jmp 0x1aa3f
movq %rdi, %r15
leaq 0x1c23a(%rip), %rdi     # 0x36c30
callq 0xa1f0
movq %r15, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0xa850
movq 0x26551(%rip), %rbx     # 0x40f60
leaq 0xc6d0(%rbx), %rdi
leaq 0x1c231(%rip), %rsi     # 0x36c4e
movl $0x50, %edx
callq 0xa8a0
movw $0x0, 0xc71f(%rbx)
movl $0x1, 0xd670(%rbx)
movl $0x5, %eax
addq $0x38, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq