// File: /workspace/github_cpp_makefile_star2_O3/sundale[P]gcode/rs274ngc/interp_read.cc
// Function: Interp::read_operation_unary(char*, int*, int*)
int Interp::read_operation_unary(char *line,     //!< string: line of RS274/NGC code being processed
                                int *counter,   //!< pointer to a counter for position on the line 
                                int *operation) //!< pointer to operation to be read               
{
  char c;

  c = line[*counter];
  *counter = (*counter + 1);
  switch (c) {
  case 'a':
    if ((line[*counter] == 'b') && (line[(*counter) + 1] == 's')) {
      *operation = ABS;
      *counter = (*counter + 2);
    } else if (strncmp((line + *counter), "cos", 3) == 0) {
      *operation = ACOS;
      *counter = (*counter + 3);
    } else if (strncmp((line + *counter), "sin", 3) == 0) {
      *operation = ASIN;
      *counter = (*counter + 3);
    } else if (strncmp((line + *counter), "tan", 3) == 0) {
      *operation = ATAN;
      *counter = (*counter + 3);
    } else
      ERS(NCE_UNKNOWN_WORD_STARTING_WITH_A);
    break;
  case 'c':
    if ((line[*counter] == 'o') && (line[(*counter) + 1] == 's')) {
      *operation = COS;
      *counter = (*counter + 2);
    } else
      ERS(NCE_UNKNOWN_WORD_STARTING_WITH_C);
    break;
  case 'e':
    if ((line[*counter] == 'x') && (line[(*counter) + 1] == 'p')) {
      *operation = EXP;
      *counter = (*counter + 2);
    } else
      ERS(NCE_UNKNOWN_WORD_STARTING_WITH_E);
    break;
  case 'f':
    if ((line[*counter] == 'i') && (line[(*counter) + 1] == 'x')) {
      *operation = FIX;
      *counter = (*counter + 2);
    } else if ((line[*counter] == 'u') && (line[(*counter) + 1] == 'p')) {
      *operation = FUP;
      *counter = (*counter + 2);
    } else
      ERS(NCE_UNKNOWN_WORD_STARTING_WITH_F);
    break;
  case 'l':
    if (line[*counter] == 'n') {
      *operation = LN;
      *counter = (*counter + 1);
    } else
      ERS(NCE_UNKNOWN_WORD_STARTING_WITH_L);
    break;
  case 'r':
    if (strncmp((line + *counter), "ound", 4) == 0) {
      *operation = ROUND;
      *counter = (*counter + 4);
    } else
      ERS(NCE_UNKNOWN_WORD_STARTING_WITH_R);
    break;
  case 's':
    if ((line[*counter] == 'i') && (line[(*counter) + 1] == 'n')) {
      *operation = SIN;
      *counter = (*counter + 2);
    } else if (strncmp((line + *counter), "qrt", 3) == 0) {
      *operation = SQRT;
      *counter = (*counter + 3);
    } else
      ERS(NCE_UNKNOWN_WORD_STARTING_WITH_S);
    break;
  case 't':
    if ((line[*counter] == 'a') && (line[(*counter) + 1] == 'n')) {
      *operation = TAN;
      *counter = (*counter + 2);
    } else
      ERS(NCE_UNKNOWN_WORD_STARTING_WITH_T);
    break;
  default:
    ERS(NCE_UNKNOWN_WORD_WHERE_UNARY_OPERATION_COULD_BE);
  }
  return INTERP_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rcx, %r15
movq %rdx, %r14
movq %rdi, %rbx
movslq (%rdx), %rcx
movzbl (%rsi,%rcx), %edx
leaq 0x1(%rcx), %rax
movl %eax, (%r14)
addl $-0x61, %edx
cmpl $0x13, %edx
ja 0x28c9e
leaq 0xf2ec(%rip), %rdi      # 0x37f40
movslq (%rdi,%rdx,4), %rdx
addq %rdi, %rdx
jmpq *%rdx
movzbl (%rsi,%rax), %edx
cmpl $0x72, %edx
jg 0x28dc0
cmpl $0x62, %edx
je 0x28e40
cmpl $0x63, %edx
jne 0x28e71
cmpb $0x6f, 0x1(%rsi,%rax)
jne 0x28e71
cmpb $0x73, 0x2(%rsi,%rax)
jne 0x28e71
movl $0x2, (%r15)
jmp 0x28e6b
leaq 0x107b6(%rip), %rdi     # 0x3945b
jmp 0x28e78
cltq
addq %rax, %rsi
leaq 0xeedc(%rip), %rax      # 0x37b92
movl $0x4, %edx
movq %rsi, %rdi
movq %rax, %rsi
callq 0xa4e0
testl %eax, %eax
je 0x28dfa
leaq 0x1072f(%rip), %rdi     # 0x39404
jmp 0x28e78
cmpb $0x6f, (%rsi,%rax)
jne 0x28d9c
cmpb $0x73, 0x2(%rsi,%rcx)
jne 0x28d9c
movl $0x5, (%r15)
jmp 0x28e4e
movzbl (%rsi,%rax), %edx
cmpl $0x71, %edx
je 0x28e07
cmpl $0x69, %edx
jne 0x28e1e
cmpb $0x6e, 0x2(%rsi,%rcx)
jne 0x28e1e
movl $0xb, (%r15)
jmp 0x28e4e
cmpb $0x61, (%rsi,%rax)
jne 0x28da8
cmpb $0x6e, 0x2(%rsi,%rcx)
jne 0x28da8
movl $0xd, (%r15)
jmp 0x28e4e
cmpb $0x78, (%rsi,%rax)
jne 0x28db4
cmpb $0x70, 0x2(%rsi,%rcx)
jne 0x28db4
movl $0x6, (%r15)
jmp 0x28e4e
movzbl (%rsi,%rax), %edx
cmpl $0x75, %edx
je 0x28e27
cmpl $0x69, %edx
jne 0x28e37
cmpb $0x78, 0x2(%rsi,%rcx)
jne 0x28e37
movl $0x7, (%r15)
jmp 0x28e4e
cmpb $0x6e, (%rsi,%rax)
jne 0x28df1
movl $0x9, (%r15)
incl (%r14)
jmp 0x28e52
leaq 0x105ed(%rip), %rdi     # 0x39390
jmp 0x28e78
leaq 0x1068f(%rip), %rdi     # 0x3943e
jmp 0x28e78
leaq 0x105f2(%rip), %rdi     # 0x393ad
jmp 0x28e78
cmpl $0x73, %edx
je 0x28e56
cmpl $0x74, %edx
jne 0x28e71
cmpb $0x61, 0x1(%rsi,%rax)
jne 0x28e71
cmpb $0x6e, 0x2(%rsi,%rax)
jne 0x28e71
movl $0x4, (%r15)
jmp 0x28e6b
leaq 0x105ef(%rip), %rdi     # 0x393e7
jmp 0x28e78
movl $0xa, (%r15)
addl $0x4, (%r14)
jmp 0x28e52
cmpb $0x72, 0x1(%rsi,%rax)
jne 0x28e1e
cmpb $0x74, 0x2(%rsi,%rax)
jne 0x28e1e
movl $0xc, (%r15)
jmp 0x28e6b
leaq 0x105fc(%rip), %rdi     # 0x39421
jmp 0x28e78
cmpb $0x70, 0x1(%rsi,%rax)
jne 0x28e37
movl $0x8, (%r15)
jmp 0x28e4e
leaq 0x1058c(%rip), %rdi     # 0x393ca
jmp 0x28e78
cmpb $0x73, 0x2(%rsi,%rcx)
jne 0x28e71
movl $0x1, (%r15)
addl $0x2, (%r14)
xorl %eax, %eax
jmp 0x28ec1
cmpb $0x69, 0x1(%rsi,%rax)
jne 0x28e71
cmpb $0x6e, 0x2(%rsi,%rax)
jne 0x28e71
movl $0x3, (%r15)
addl $0x3, (%r14)
jmp 0x28e52
leaq 0x104fb(%rip), %rdi     # 0x39373
callq 0xa1f0
movq %rbx, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0xa850
movq 0x180cf(%rip), %rbx     # 0x40f60
leaq 0xc6d0(%rbx), %rdi
leaq 0xf8da(%rip), %rsi      # 0x38779
movl $0x50, %edx
callq 0xa8a0
movw $0x0, 0xc71f(%rbx)
movl $0x1, 0xd670(%rbx)
movl $0x5, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq