// File: /workspace/github_cpp_makefile_star2_O1/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 0x26c9e
movq %rsi, %rbx
leaq 0x13a4f(%rip), %rax     # 0x3a588
movslq (%rax,%rdx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movsd (%rbx), %xmm0
xorl %eax, %eax
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jbe 0x26d5d
xorpd 0x103b2(%rip), %xmm0    # 0x36f10
movlpd %xmm0, (%rbx)
jmp 0x26d5d
movsd (%rbx), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jbe 0x26ca7
leaq 0x13c93(%rip), %rdi     # 0x3a813
jmp 0x26cfd
movsd (%rbx), %xmm0
movapd 0xe48f(%rip), %xmm1     # 0x35020
andpd %xmm0, %xmm1
ucomisd 0x10303(%rip), %xmm1    # 0x36ea0
jbe 0x26cba
leaq 0x13c2b(%rip), %rdi     # 0x3a7d5
jmp 0x26cfd
movsd (%rbx), %xmm0
callq 0xb2f0
jmp 0x26d57
fldt 0x1039d(%rip)           # 0x36f60
fmull (%rbx)
fdivs 0x13b89(%rip)           # 0x3a754
fstpt (%rsp)
callq 0xa600
jmp 0x26cf2
movsd (%rbx), %xmm0
movapd 0xe43c(%rip), %xmm1     # 0x35020
andpd %xmm0, %xmm1
ucomisd 0x102b0(%rip), %xmm1    # 0x36ea0
jbe 0x26cd7
leaq 0x13bba(%rip), %rdi     # 0x3a7b7
jmp 0x26cfd
movsd (%rbx), %xmm0
callq 0xa160
jmp 0x26d57
movsd (%rbx), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jae 0x26cf6
callq 0xa840
jmp 0x26d57
fldt 0x1032e(%rip)           # 0x36f60
fmull (%rbx)
fdivs 0x13b1a(%rip)           # 0x3a754
fstpt (%rsp)
callq 0xad00
jmp 0x26cf2
movsd (%rbx), %xmm0
callq 0xb430
jmp 0x26d57
fldt 0x10305(%rip)           # 0x36f60
fmull (%rbx)
fdivs 0x13af1(%rip)           # 0x3a754
fstpt (%rsp)
callq 0xb010
jmp 0x26cf2
movsd (%rbx), %xmm0
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %al
leaq 0x10318(%rip), %rcx     # 0x36fa0
addsd (%rcx,%rax,8), %xmm0
cvttpd2dq %xmm0, %xmm0
cvtdq2pd %xmm0, %xmm0
movlpd %xmm0, (%rbx)
jmp 0x26d5b
leaq 0x13afc(%rip), %rdi     # 0x3a7a1
jmp 0x26cfd
ucomisd %xmm1, %xmm0
jb 0x26d52
sqrtsd %xmm0, %xmm0
jmp 0x26d57
callq 0xb250
mulsd 0x10211(%rip), %xmm0    # 0x36ed8
movsd %xmm0, -0x20(%rbp)
fldt 0x1028e(%rip)           # 0x36f60
fdivrl -0x20(%rbp)
jmp 0x26cf2
callq 0xaa00
mulsd 0x101f4(%rip), %xmm0    # 0x36ed8
movsd %xmm0, -0x18(%rbp)
fldt 0x10271(%rip)           # 0x36f60
fdivrl -0x18(%rbp)
fstpl (%rbx)
jmp 0x26d5b
leaq 0x13af6(%rip), %rdi     # 0x3a7f3
callq 0xa1f0
movq %r14, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0xa850
movq 0x1d24a(%rip), %rbx     # 0x43f60
movl $0x0, 0xd670(%rbx)
leaq 0xc6d0(%rbx), %rdi
leaq 0x139d2(%rip), %rsi     # 0x3a700
movl $0x50, %edx
callq 0xa8a0
movw $0x0, 0xc71f(%rbx)
movl $0x1, 0xd670(%rbx)
movl $0x5, %eax
jmp 0x26d5d
callq 0xa810
movsd %xmm0, (%rbx)
xorl %eax, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nop