// File: /workspace/github_cpp_makefile_star2_O2/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
movsd %xmm4, -0x40(%rbp)
movsd %xmm3, -0x38(%rbp)
movsd %xmm1, -0x28(%rbp)
movsd %xmm0, -0x20(%rbp)
xorpd %xmm0, %xmm0
movsd %xmm5, -0x50(%rbp)
ucomisd %xmm5, %xmm0
jae 0x1abe9
movl %edx, %ebx
movq %rsi, %r14
movq 0x22432(%rip), %rax     # 0x3cf60
xorl %ecx, %ecx
cmpl $0x2, 0x1690(%rax)
sete %cl
leaq 0x180df(%rip), %rax     # 0x32c20
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x48(%rbp)
subsd -0x50(%rbp), %xmm2
ucomisd -0x40(%rbp), %xmm2
jbe 0x1abb3
movq %r14, %rsi
movl %ebx, %edx
movsd -0x20(%rbp), %xmm0
movsd -0x28(%rbp), %xmm1
movsd %xmm2, -0x30(%rbp)
movsd -0x30(%rbp), %xmm2
callq 0xb1a0
movq %r14, %rsi
movl %ebx, %edx
movsd -0x20(%rbp), %xmm0
movsd -0x28(%rbp), %xmm1
movsd -0x38(%rbp), %xmm2
callq 0xc270
movsd -0x48(%rbp), %xmm2
addsd -0x30(%rbp), %xmm2
movq %r14, %rsi
movl %ebx, %edx
movsd -0x20(%rbp), %xmm0
movsd -0x28(%rbp), %xmm1
callq 0xc270
movsd -0x30(%rbp), %xmm2
jmp 0x1ab4b
movq %r14, %rsi
movl %ebx, %edx
movsd -0x20(%rbp), %xmm0
movsd -0x28(%rbp), %xmm1
movsd -0x40(%rbp), %xmm2
callq 0xb1a0
movq %r14, %rsi
movl %ebx, %edx
movsd -0x20(%rbp), %xmm0
movsd -0x28(%rbp), %xmm1
movsd -0x38(%rbp), %xmm2
callq 0xc270
xorl %eax, %eax
jmp 0x1ac37
movq %rdi, %r15
leaq 0x1803d(%rip), %rdi     # 0x32c30
callq 0xb220
movq %r15, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0xb8e0
movq 0x22354(%rip), %rbx     # 0x3cf60
leaq 0xc6d0(%rbx), %rdi
leaq 0x18034(%rip), %rsi     # 0x32c4e
pushq $0x50
popq %rdx
callq 0xb940
andw $0x0, 0xc71f(%rbx)
movl $0x1, 0xd670(%rbx)
pushq $0x5
popq %rax
addq $0x38, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq