// File: /workspace/github_cpp_makefile_star2_O3/sundale[P]gcode/rs274ngc/interp_execute.cc
// Function: Interp::execute_unary(double*, int)
int Interp::execute_unary(double *double_ptr,    //!< pointer to the operand         
                         int operation) //!< integer code for the operation 
{
  switch (operation) {
  case ABS:
    if (*double_ptr < 0.0)
      *double_ptr = (-1.0 * *double_ptr);
    break;
  case ACOS:
    CHKS(((*double_ptr < -1.0) || (*double_ptr > 1.0)),
        NCE_ARGUMENT_TO_ACOS_OUT_OF_RANGE);
    *double_ptr = acos(*double_ptr);
    *double_ptr = ((*double_ptr * 180.0) / M_PIl);
    break;
  case ASIN:
    CHKS(((*double_ptr < -1.0) || (*double_ptr > 1.0)),
        NCE_ARGUMENT_TO_ASIN_OUT_OF_RANGE);
    *double_ptr = asin(*double_ptr);
    *double_ptr = ((*double_ptr * 180.0) / M_PIl);
    break;
  case COS:
    *double_ptr = cos((*double_ptr * M_PIl) / 180.0);
    break;
  case EXP:
    *double_ptr = exp(*double_ptr);
    break;
  case FIX:
    *double_ptr = floor(*double_ptr);
    break;
  case FUP:
    *double_ptr = ceil(*double_ptr);
    break;
  case LN:
    CHKS((*double_ptr <= 0.0), NCE_ZERO_OR_NEGATIVE_ARGUMENT_TO_LN);
    *double_ptr = log(*double_ptr);
    break;
  case ROUND:
    *double_ptr = (double)
      ((int) (*double_ptr + ((*double_ptr < 0.0) ? -0.5 : 0.5)));
    break;
  case SIN:
    *double_ptr = sin((*double_ptr * M_PIl) / 180.0);
    break;
  case SQRT:
    CHKS((*double_ptr < 0.0), NCE_NEGATIVE_ARGUMENT_TO_SQRT);
    *double_ptr = sqrt(*double_ptr);
    break;
  case TAN:
    *double_ptr = tan((*double_ptr * M_PIl) / 180.0);
    break;
  default:
    ERS(NCE_BUG_UNKNOWN_OPERATION);
  }
  return INTERP_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rdi, %r14
decl %edx
cmpl $0xc, %edx
ja 0x240a4
movq %rsi, %rbx
leaq 0x13641(%rip), %rax     # 0x37580
movslq (%rax,%rdx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movsd (%rbx), %xmm0
xorl %eax, %eax
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jbe 0x24159
xorpd 0xffac(%rip), %xmm0     # 0x33f10
movlpd %xmm0, (%rbx)
jmp 0x24159
movsd (%rbx), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jbe 0x240ad
leaq 0x13885(%rip), %rdi     # 0x3780b
jmp 0x24103
movsd (%rbx), %xmm0
movapd 0xe089(%rip), %xmm1     # 0x32020
andpd %xmm0, %xmm1
ucomisd 0xfefd(%rip), %xmm1     # 0x33ea0
jbe 0x240c0
leaq 0x1381d(%rip), %rdi     # 0x377cd
jmp 0x24103
movsd (%rbx), %xmm0
callq 0xb2f0
jmp 0x24153
fldt 0xff97(%rip)            # 0x33f60
fmull (%rbx)
fdivs 0x1377b(%rip)           # 0x3774c
fstpt (%rsp)
callq 0xa600
jmp 0x240f8
movsd (%rbx), %xmm0
movapd 0xe036(%rip), %xmm1     # 0x32020
andpd %xmm0, %xmm1
ucomisd 0xfeaa(%rip), %xmm1     # 0x33ea0
jbe 0x240dd
leaq 0x137ac(%rip), %rdi     # 0x377af
jmp 0x24103
movsd (%rbx), %xmm0
callq 0xa160
jmp 0x24153
movsd (%rbx), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jae 0x240fc
callq 0xa840
jmp 0x24153
fldt 0xff28(%rip)            # 0x33f60
fmull (%rbx)
fdivs 0x1370c(%rip)           # 0x3774c
fstpt (%rsp)
callq 0xad00
jmp 0x240f8
movsd (%rbx), %xmm0
callq 0xb430
jmp 0x24153
fldt 0xfeff(%rip)            # 0x33f60
fmull (%rbx)
fdivs 0x136e3(%rip)           # 0x3774c
fstpt (%rsp)
callq 0xb010
jmp 0x240f8
movsd (%rbx), %xmm0
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %al
leaq 0xff12(%rip), %rcx      # 0x33fa0
addsd (%rcx,%rax,8), %xmm0
cvttpd2dq %xmm0, %xmm0
cvtdq2pd %xmm0, %xmm0
movlpd %xmm0, (%rbx)
jmp 0x24157
leaq 0x136ee(%rip), %rdi     # 0x37799
jmp 0x24103
ucomisd %xmm1, %xmm0
jb 0x2414e
sqrtsd %xmm0, %xmm0
jmp 0x24153
callq 0xb250
mulsd 0xfe13(%rip), %xmm0     # 0x33ee0
movsd %xmm0, -0x20(%rbp)
fldt 0xfe88(%rip)            # 0x33f60
fdivrl -0x20(%rbp)
jmp 0x240f8
callq 0xaa00
mulsd 0xfdf6(%rip), %xmm0     # 0x33ee0
movsd %xmm0, -0x18(%rbp)
fldt 0xfe6b(%rip)            # 0x33f60
fdivrl -0x18(%rbp)
fstpl (%rbx)
jmp 0x24157
leaq 0x136e8(%rip), %rdi     # 0x377eb
callq 0xa1f0
movq %r14, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0xa850
movq 0x1ce44(%rip), %rbx     # 0x40f60
leaq 0xc6d0(%rbx), %rdi
leaq 0x135ce(%rip), %rsi     # 0x376f8
movl $0x50, %edx
callq 0xa8a0
movw $0x0, 0xc71f(%rbx)
movl $0x1, 0xd670(%rbx)
movl $0x5, %eax
jmp 0x24159
callq 0xa810
movsd %xmm0, (%rbx)
xorl %eax, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nop