// File: /workspace/github_cpp_makefile_star2_O2/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 0x21980
movq %rsi, %rbx
leaq 0x11d65(%rip), %rax     # 0x33580
movslq (%rax,%rdx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movsd (%rbx), %xmm0
xorl %eax, %eax
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jbe 0x21a30
xorpd 0xe6d0(%rip), %xmm0     # 0x2ff10
movlpd %xmm0, (%rbx)
jmp 0x21a30
movsd (%rbx), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jbe 0x21989
leaq 0x11fa9(%rip), %rdi     # 0x3380b
jmp 0x219df
movsd (%rbx), %xmm0
movapd 0xc7ad(%rip), %xmm1     # 0x2e020
andpd %xmm0, %xmm1
ucomisd 0xe621(%rip), %xmm1     # 0x2fea0
jbe 0x2199c
leaq 0x11f41(%rip), %rdi     # 0x337cd
jmp 0x219df
movsd (%rbx), %xmm0
callq 0xc450
jmp 0x21a2a
fldt 0xe6bb(%rip)            # 0x2ff60
fmull (%rbx)
fdivs 0x11e9f(%rip)           # 0x3374c
fstpt (%rsp)
callq 0xb640
jmp 0x219d4
movsd (%rbx), %xmm0
movapd 0xc75a(%rip), %xmm1     # 0x2e020
andpd %xmm0, %xmm1
ucomisd 0xe5ce(%rip), %xmm1     # 0x2fea0
jbe 0x219b9
leaq 0x11ed0(%rip), %rdi     # 0x337af
jmp 0x219df
movsd (%rbx), %xmm0
callq 0xb170
jmp 0x21a2a
movsd (%rbx), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jae 0x219d8
callq 0xb8d0
jmp 0x21a2a
fldt 0xe64c(%rip)            # 0x2ff60
fmull (%rbx)
fdivs 0x11e30(%rip)           # 0x3374c
fstpt (%rsp)
callq 0xbdf0
jmp 0x219d4
movsd (%rbx), %xmm0
callq 0xc5a0
jmp 0x21a2a
fldt 0xe623(%rip)            # 0x2ff60
fmull (%rbx)
fdivs 0x11e07(%rip)           # 0x3374c
fstpt (%rsp)
callq 0xc140
jmp 0x219d4
movsd (%rbx), %xmm0
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %al
leaq 0xe636(%rip), %rcx      # 0x2ffa0
addsd (%rcx,%rax,8), %xmm0
cvttpd2dq %xmm0, %xmm0
cvtdq2pd %xmm0, %xmm0
movlpd %xmm0, (%rbx)
jmp 0x21a2e
leaq 0x11e12(%rip), %rdi     # 0x33799
jmp 0x219df
ucomisd %xmm1, %xmm0
jb 0x21a25
sqrtsd %xmm0, %xmm0
jmp 0x21a2a
callq 0xc3b0
mulsd 0xe537(%rip), %xmm0     # 0x2fee0
movsd %xmm0, -0x20(%rbp)
fldt 0xe5ac(%rip)            # 0x2ff60
fdivrl -0x20(%rbp)
jmp 0x219d4
callq 0xbab0
mulsd 0xe51a(%rip), %xmm0     # 0x2fee0
movsd %xmm0, -0x18(%rbp)
fldt 0xe58f(%rip)            # 0x2ff60
fdivrl -0x18(%rbp)
fstpl (%rbx)
jmp 0x21a2e
leaq 0x11e0c(%rip), %rdi     # 0x337eb
callq 0xb220
movq %r14, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0xb8e0
movq 0x1b568(%rip), %rbx     # 0x3cf60
leaq 0xc6d0(%rbx), %rdi
leaq 0x11cf2(%rip), %rsi     # 0x336f8
pushq $0x50
popq %rdx
callq 0xb940
andw $0x0, 0xc71f(%rbx)
movl $0x1, 0xd670(%rbx)
pushq $0x5
popq %rax
jmp 0x21a30
callq 0xb880
movsd %xmm0, (%rbx)
xorl %eax, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nopl (%rax)