// File: /workspace/github_cpp_makefile_star2_O2/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), %rax
movzbl (%rsi,%rax), %edx
leaq 0x1(%rax), %rcx
movl %ecx, (%r14)
addl $-0x61, %edx
cmpl $0x13, %edx
ja 0x262fe
leaq 0xdc8a(%rip), %rdi      # 0x33f40
movslq (%rdi,%rdx,4), %rdx
addq %rdi, %rdx
jmpq *%rdx
movzbl (%rsi,%rcx), %edx
cmpl $0x74, %edx
je 0x264a2
cmpl $0x63, %edx
je 0x26474
cmpl $0x73, %edx
je 0x2648b
cmpl $0x62, %edx
jne 0x264bd
cmpb $0x73, 0x2(%rsi,%rax)
jne 0x264bd
movl $0x1, (%r15)
jmp 0x26460
leaq 0xf156(%rip), %rdi      # 0x3545b
jmp 0x264c4
movslq %ecx, %rax
addq %rax, %rsi
leaq 0xd87b(%rip), %rax      # 0x33b92
pushq $0x4
popq %rdx
movq %rsi, %rdi
movq %rax, %rsi
callq 0xb520
testl %eax, %eax
je 0x26425
leaq 0xf0d0(%rip), %rdi      # 0x35404
jmp 0x264c4
cmpb $0x6f, (%rsi,%rcx)
jne 0x263f5
cmpb $0x73, 0x2(%rsi,%rax)
jne 0x263f5
movl $0x5, (%r15)
jmp 0x26460
movzbl (%rsi,%rcx), %edx
cmpl $0x71, %edx
je 0x26432
cmpl $0x69, %edx
jne 0x26449
cmpb $0x6e, 0x2(%rsi,%rax)
jne 0x26449
movl $0xb, (%r15)
jmp 0x26460
cmpb $0x61, (%rsi,%rcx)
jne 0x26401
cmpb $0x6e, 0x2(%rsi,%rax)
jne 0x26401
movl $0xd, (%r15)
jmp 0x26460
cmpb $0x78, (%rsi,%rcx)
jne 0x2640d
cmpb $0x70, 0x2(%rsi,%rax)
jne 0x2640d
movl $0x6, (%r15)
jmp 0x26460
movzbl (%rsi,%rcx), %edx
cmpl $0x75, %edx
je 0x26452
cmpl $0x69, %edx
jne 0x2646b
cmpb $0x78, 0x2(%rsi,%rax)
jne 0x2646b
movl $0x7, (%r15)
jmp 0x26460
cmpb $0x6e, (%rsi,%rcx)
jne 0x26419
movl $0x9, (%r15)
incl (%r14)
jmp 0x26464
leaq 0xef94(%rip), %rdi      # 0x35390
jmp 0x264c4
leaq 0xf036(%rip), %rdi      # 0x3543e
jmp 0x264c4
leaq 0xef99(%rip), %rdi      # 0x353ad
jmp 0x264c4
leaq 0xefc7(%rip), %rdi      # 0x353e7
jmp 0x264c4
movl $0xa, (%r15)
addl $0x4, (%r14)
jmp 0x26464
cmpb $0x72, 0x1(%rsi,%rcx)
jne 0x26449
cmpb $0x74, 0x2(%rsi,%rcx)
jne 0x26449
movl $0xc, (%r15)
jmp 0x264b7
leaq 0xefd1(%rip), %rdi      # 0x35421
jmp 0x264c4
cmpb $0x70, 0x1(%rsi,%rcx)
jne 0x2646b
movl $0x8, (%r15)
addl $0x2, (%r14)
xorl %eax, %eax
jmp 0x26508
leaq 0xef58(%rip), %rdi      # 0x353ca
jmp 0x264c4
cmpb $0x6f, 0x1(%rsi,%rcx)
jne 0x264bd
cmpb $0x73, 0x2(%rsi,%rcx)
jne 0x264bd
movl $0x2, (%r15)
jmp 0x264b7
cmpb $0x69, 0x1(%rsi,%rcx)
jne 0x264bd
cmpb $0x6e, 0x2(%rsi,%rcx)
jne 0x264bd
movl $0x3, (%r15)
jmp 0x264b7
cmpb $0x61, 0x1(%rsi,%rcx)
jne 0x264bd
cmpb $0x6e, 0x2(%rsi,%rcx)
jne 0x264bd
movl $0x4, (%r15)
addl $0x3, (%r14)
jmp 0x26464
leaq 0xeeaf(%rip), %rdi      # 0x35373
callq 0xb220
movq %rbx, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0xb8e0
movq 0x16a83(%rip), %rbx     # 0x3cf60
leaq 0xc6d0(%rbx), %rdi
leaq 0xe28e(%rip), %rsi      # 0x34779
pushq $0x50
popq %rdx
callq 0xb940
andw $0x0, 0xc71f(%rbx)
movl $0x1, 0xd670(%rbx)
pushq $0x5
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop