// File: /workspace/github_cpp_makefile_star2_O1/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 0x1bc07
movq %rdi, %r12
leaq 0x1e2b0(%rip), %rdi     # 0x39e5f
callq 0xa1f0
movq %r12, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0xa850
movq 0x28398(%rip), %rbx     # 0x43f60
movl $0x0, 0xd670(%rbx)
leaq 0xc6d0(%rbx), %rdi
leaq 0x1e29a(%rip), %rsi     # 0x39e7a
movl $0x50, %edx
callq 0xa8a0
movw $0x0, 0xc71f(%rbx)
movl $0x1, 0xd670(%rbx)
movl $0x5, %eax
jmp 0x1bd36
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 0x1bc8d
callq 0xaba0
jmp 0x1bc92
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 0x1bd2f
callq 0xaba0
jmp 0x1bd34
callq 0xaf20
xorl %eax, %eax
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop