// File: sundale[P]gcode/rs274ngc/interp_read.cc
// Function: Interp::read_atan(char*, int*, double*, double*)
int Interp::read_atan(char *line,        //!< string: line of RS274/NGC code being processed
                     int *counter,      //!< pointer to a counter for position on line     
                     double *double_ptr,        //!< pointer to double to be read                  
                     double *parameters)        //!< array of system parameters                    
{
  double argument2;

  CHKS((line[*counter] != '/'), NCE_SLASH_MISSING_AFTER_FIRST_ATAN_ARGUMENT);
  *counter = (*counter + 1);
  CHKS((line[*counter] != '['),
      NCE_LEFT_BRACKET_MISSING_AFTER_SLASH_WITH_ATAN);
  CHP(read_real_expression(line, counter, &argument2, parameters));
  *double_ptr = atan2(*double_ptr, argument2);  /* value in radians */
  *double_ptr = ((*double_ptr * 180.0) / M_PIl);   /* convert to degrees */
  return INTERP_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rax
movq -0x20(%rbp), %rcx
movslq (%rcx), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x2f, %eax
je 0x5cee1
jmp 0x5ce0e
leaq 0x204df(%rip), %rdi     # 0x7d2f4
callq 0x10380
movq -0x58(%rbp), %rdi
movq %rax, %rsi
movb $0x0, %al
callq 0x10df0
movq 0x2a131(%rip), %rax     # 0x86f60
movl $0x0, 0xd670(%rax)
movq 0x2a120(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rax
movq 0x2a112(%rip), %rdi     # 0x86f60
addq $0xc6d0, %rdi           # imm = 0xC6D0
imulq $0x50, %rax, %rax
addq %rax, %rdi
leaq 0x204b9(%rip), %rsi     # 0x7d31c
movl $0x50, %edx
callq 0x10840
movq 0x2a0ec(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x2a0de(%rip), %rax     # 0x86f60
addq $0xc6d0, %rax           # imm = 0xC6D0
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x0, 0x4f(%rax)
movq 0x2a0c6(%rip), %rax     # 0x86f60
movl 0xd670(%rax), %ecx
addl $0x1, %ecx
movq 0x2a0b6(%rip), %rax     # 0x86f60
movl %ecx, 0xd670(%rax)
movq 0x2a0a9(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x2a09b(%rip), %rax     # 0x86f60
addq $0xc6d0, %rax           # imm = 0xC6D0
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x0, (%rax)
movl $0x5, -0x4(%rbp)
jmp 0x5d11a
jmp 0x5cee3
movq -0x20(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movq -0x18(%rbp), %rax
movq -0x20(%rbp), %rcx
movslq (%rcx), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x5b, %eax
je 0x5cfdf
jmp 0x5cf0c
leaq 0x20442(%rip), %rdi     # 0x7d355
callq 0x10380
movq -0x58(%rbp), %rdi
movq %rax, %rsi
movb $0x0, %al
callq 0x10df0
movq 0x2a033(%rip), %rax     # 0x86f60
movl $0x0, 0xd670(%rax)
movq 0x2a022(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rax
movq 0x2a014(%rip), %rdi     # 0x86f60
addq $0xc6d0, %rdi           # imm = 0xC6D0
imulq $0x50, %rax, %rax
addq %rax, %rdi
leaq 0x203bb(%rip), %rsi     # 0x7d31c
movl $0x50, %edx
callq 0x10840
movq 0x29fee(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x29fe0(%rip), %rax     # 0x86f60
addq $0xc6d0, %rax           # imm = 0xC6D0
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x0, 0x4f(%rax)
movq 0x29fc8(%rip), %rax     # 0x86f60
movl 0xd670(%rax), %ecx
addl $0x1, %ecx
movq 0x29fb8(%rip), %rax     # 0x86f60
movl %ecx, 0xd670(%rax)
movq 0x29fab(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x29f9d(%rip), %rax     # 0x86f60
addq $0xc6d0, %rax           # imm = 0xC6D0
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x0, (%rax)
movl $0x5, -0x4(%rbp)
jmp 0x5d11a
jmp 0x5cfe1
jmp 0x5cfe3
movq -0x58(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x30(%rbp), %r8
leaq -0x38(%rbp), %rcx
callq 0x119e0
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
je 0x5d0c3
jmp 0x5d00b
movq 0x29f4e(%rip), %rax     # 0x86f60
cmpl $0x31, 0xd670(%rax)
jge 0x5d0bb
movq 0x29f3a(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rax
movq 0x29f2c(%rip), %rdi     # 0x86f60
addq $0xc6d0, %rdi           # imm = 0xC6D0
imulq $0x50, %rax, %rax
addq %rax, %rdi
leaq 0x202d3(%rip), %rsi     # 0x7d31c
movl $0x50, %edx
callq 0x10840
movq 0x29f06(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x29ef8(%rip), %rax     # 0x86f60
addq $0xc6d0, %rax           # imm = 0xC6D0
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x0, 0x4f(%rax)
movq 0x29ee0(%rip), %rax     # 0x86f60
movl 0xd670(%rax), %ecx
addl $0x1, %ecx
movq 0x29ed0(%rip), %rax     # 0x86f60
movl %ecx, 0xd670(%rax)
movq 0x29ec3(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x29eb5(%rip), %rax     # 0x86f60
addq $0xc6d0, %rax           # imm = 0xC6D0
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x0, (%rax)
movl -0x3c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x5d11a
jmp 0x5d0c5
movq -0x28(%rbp), %rax
movsd (%rax), %xmm0
movsd -0x38(%rbp), %xmm1
callq 0x101d0
movq -0x28(%rbp), %rax
movsd %xmm0, (%rax)
movq -0x28(%rbp), %rax
movsd (%rax), %xmm0
movsd 0x1bd61(%rip), %xmm1    # 0x78e50
mulsd %xmm1, %xmm0
movsd %xmm0, -0x48(%rbp)
fldl -0x48(%rbp)
fldt 0x1bdbf(%rip)           # 0x78ec0
fdivrp %st, %st(1)
fstpl -0x50(%rbp)
movsd -0x50(%rbp), %xmm0
movq -0x28(%rbp), %rax
movsd %xmm0, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)