// File: /workspace/github_cpp_makefile_star2_O2/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 0x1af6c
movq %rdi, %r12
leaq 0x17f34(%rip), %rdi     # 0x32e57
callq 0xb220
movq %r12, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0xb8e0
movq 0x22024(%rip), %rbx     # 0x3cf60
leaq 0xc6d0(%rbx), %rdi
leaq 0x17f28(%rip), %rsi     # 0x32e72
pushq $0x50
popq %rdx
callq 0xb940
andw $0x0, 0xc71f(%rbx)
movl $0x1, 0xd670(%rbx)
pushq $0x5
popq %rax
jmp 0x1b09b
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 0xc270
callq 0xbca0
xorps %xmm0, %xmm0
movl %ebx, %edi
callq 0xc250
movq %r15, %rsi
movl %r14d, %edx
movsd -0x40(%rbp), %xmm0
movsd -0x48(%rbp), %xmm1
movsd -0x28(%rbp), %xmm2
callq 0xc270
movq %r15, %rsi
movl %r14d, %edx
movsd -0x30(%rbp), %xmm0
movsd -0x38(%rbp), %xmm1
movsd -0x28(%rbp), %xmm2
callq 0xc270
cmpl $0x2, %ebx
jne 0x1aff2
callq 0xbc90
jmp 0x1aff7
callq 0xc050
movq %r15, %rsi
movl %r14d, %edx
movsd -0x30(%rbp), %xmm0
movsd -0x38(%rbp), %xmm1
movsd -0x58(%rbp), %xmm2
callq 0xb1a0
movq %r15, %rsi
movl %r14d, %edx
movsd -0x30(%rbp), %xmm0
movsd -0x38(%rbp), %xmm1
movsd -0x28(%rbp), %xmm2
callq 0xb1a0
callq 0xbca0
xorps %xmm0, %xmm0
movl %ebx, %edi
callq 0xc250
movq %r15, %rsi
movl %r14d, %edx
movsd -0x40(%rbp), %xmm0
movsd -0x48(%rbp), %xmm1
movsd -0x28(%rbp), %xmm2
callq 0xc270
movq %r15, %rsi
movl %r14d, %edx
movsd -0x40(%rbp), %xmm0
movsd -0x48(%rbp), %xmm1
movsd -0x50(%rbp), %xmm2
callq 0xc270
movq %r15, %rsi
movl %r14d, %edx
movsd -0x30(%rbp), %xmm0
movsd -0x38(%rbp), %xmm1
movsd -0x50(%rbp), %xmm2
callq 0xc270
cmpl $0x2, %ebx
jne 0x1b094
callq 0xbc90
jmp 0x1b099
callq 0xc050
xorl %eax, %eax
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq