// File: /workspace/github_cpp_makefile_star2_O3/sundale[P]gcode/rs274ngc/interp_cycles.cc
// Function: Interp::convert_cycle_g87(block_struct*, int, double, double, double, double, double, double, double, double, int)
int Interp::convert_cycle_g87(block_pointer block,
                              CANON_PLANE plane, //!< selected plane                     
                              double x,  //!< x-value where cycle is executed    
                              double offset_x,   //!< x-axis offset position             
                              double y,  //!< y-value where cycle is executed    
                              double offset_y,   //!< y-axis offset position             
                              double r,  //!< z_value of r_plane                 
                              double clear_z,    //!< z-value of clearance plane         
                              double middle_z,   //!< z-value of top of back bore        
                              double bottom_z,   //!< value of z at bottom of cycle      
                              CANON_DIRECTION direction) //!< direction spindle turning at outset
{
  CHKS(((direction != CANON_CLOCKWISE) &&
       (direction != CANON_COUNTERCLOCKWISE)),
      NCE_SPINDLE_NOT_TURNING_IN_G87);

  cycle_traverse(block, plane, offset_x, offset_y, r);
  STOP_SPINDLE_TURNING();
  ORIENT_SPINDLE(0.0, direction);
  cycle_traverse(block, plane, offset_x, offset_y, bottom_z);
  cycle_traverse(block, plane, x, y, bottom_z);
  if (direction == CANON_CLOCKWISE)
    START_SPINDLE_CLOCKWISE();
  else
    START_SPINDLE_COUNTERCLOCKWISE();
  cycle_feed(block, plane, x, y, middle_z);
  cycle_feed(block, plane, x, y, bottom_z);
  STOP_SPINDLE_TURNING();
  ORIENT_SPINDLE(0.0, direction);
  cycle_traverse(block, plane, offset_x, offset_y, bottom_z);
  cycle_traverse(block, plane, offset_x, offset_y, clear_z);
  cycle_traverse(block, plane, x, y, clear_z);
  if (direction == CANON_CLOCKWISE)
    START_SPINDLE_CLOCKWISE();
  else
    START_SPINDLE_COUNTERCLOCKWISE();

  return INTERP_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x40, %rsp
movl %ecx, %ebx
leal -0x4(%rbx), %eax
cmpl $-0x3, %eax
ja 0x1ad91
movq %rdi, %r12
leaq 0x1c114(%rip), %rdi     # 0x36e57
callq 0xa1f0
movq %r12, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0xa850
movq 0x26204(%rip), %rbx     # 0x40f60
leaq 0xc6d0(%rbx), %rdi
leaq 0x1c108(%rip), %rsi     # 0x36e72
movl $0x50, %edx
callq 0xa8a0
movw $0x0, 0xc71f(%rbx)
movl $0x1, 0xd670(%rbx)
movl $0x5, %eax
jmp 0x1aec0
movl %edx, %r14d
movq %rsi, %r15
movsd %xmm6, -0x58(%rbp)
movsd %xmm5, -0x50(%rbp)
movsd %xmm0, -0x30(%rbp)
movaps %xmm1, %xmm0
movsd %xmm1, -0x40(%rbp)
movaps %xmm3, %xmm1
movsd %xmm2, -0x38(%rbp)
movaps %xmm4, %xmm2
movsd %xmm3, -0x48(%rbp)
movsd %xmm7, -0x28(%rbp)
callq 0xb120
callq 0xabb0
xorps %xmm0, %xmm0
movl %ebx, %edi
callq 0xb100
movq %r15, %rsi
movl %r14d, %edx
movsd -0x40(%rbp), %xmm0
movsd -0x48(%rbp), %xmm1
movsd -0x28(%rbp), %xmm2
callq 0xb120
movq %r15, %rsi
movl %r14d, %edx
movsd -0x30(%rbp), %xmm0
movsd -0x38(%rbp), %xmm1
movsd -0x28(%rbp), %xmm2
callq 0xb120
cmpl $0x2, %ebx
jne 0x1ae17
callq 0xaba0
jmp 0x1ae1c
callq 0xaf20
movq %r15, %rsi
movl %r14d, %edx
movsd -0x30(%rbp), %xmm0
movsd -0x38(%rbp), %xmm1
movsd -0x58(%rbp), %xmm2
callq 0xa180
movq %r15, %rsi
movl %r14d, %edx
movsd -0x30(%rbp), %xmm0
movsd -0x38(%rbp), %xmm1
movsd -0x28(%rbp), %xmm2
callq 0xa180
callq 0xabb0
xorps %xmm0, %xmm0
movl %ebx, %edi
callq 0xb100
movq %r15, %rsi
movl %r14d, %edx
movsd -0x40(%rbp), %xmm0
movsd -0x48(%rbp), %xmm1
movsd -0x28(%rbp), %xmm2
callq 0xb120
movq %r15, %rsi
movl %r14d, %edx
movsd -0x40(%rbp), %xmm0
movsd -0x48(%rbp), %xmm1
movsd -0x50(%rbp), %xmm2
callq 0xb120
movq %r15, %rsi
movl %r14d, %edx
movsd -0x30(%rbp), %xmm0
movsd -0x38(%rbp), %xmm1
movsd -0x50(%rbp), %xmm2
callq 0xb120
cmpl $0x2, %ebx
jne 0x1aeb9
callq 0xaba0
jmp 0x1aebe
callq 0xaf20
xorl %eax, %eax
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop