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

  CHP(read_real_value(line, counter, &float_value, parameters));
  *integer_ptr = (int) floor(float_value);
  if ((float_value - *integer_ptr) > 0.9999) {
    *integer_ptr = (int) ceil(float_value);
  } else if ((float_value - *integer_ptr) > 0.0001)
    ERS(NCE_NON_INTEGER_VALUE_FOR_INTEGER);
  return INTERP_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %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, -0x48(%rbp)
movq -0x48(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x30(%rbp), %r8
leaq -0x38(%rbp), %rcx
callq 0x118a0
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
je 0x5f8c7
jmp 0x5f80c
movq 0x2774d(%rip), %rax     # 0x86f60
cmpl $0x31, 0xd670(%rax)
jge 0x5f8bc
movq 0x27739(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rax
movq 0x2772b(%rip), %rdi     # 0x86f60
addq $0xc6d0, %rdi           # imm = 0xC6D0
imulq $0x50, %rax, %rax
addq %rax, %rdi
leaq 0x1df4d(%rip), %rsi     # 0x7d797
movl $0x50, %edx
callq 0x10840
movq 0x27705(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x276f7(%rip), %rax     # 0x86f60
addq $0xc6d0, %rax           # imm = 0xC6D0
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x0, 0x4f(%rax)
movq 0x276df(%rip), %rax     # 0x86f60
movl 0xd670(%rax), %ecx
addl $0x1, %ecx
movq 0x276cf(%rip), %rax     # 0x86f60
movl %ecx, 0xd670(%rax)
movq 0x276c2(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x276b4(%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 0x5fa13
jmp 0x5f8c9
movsd -0x38(%rbp), %xmm0
callq 0x11e50
cvttsd2si %xmm0, %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movsd -0x38(%rbp), %xmm0
movq -0x28(%rbp), %rax
cvtsi2sdl (%rax), %xmm1
subsd %xmm1, %xmm0
movsd 0x1d76a(%rip), %xmm1    # 0x7d060
ucomisd %xmm1, %xmm0
jbe 0x5f915
movsd -0x38(%rbp), %xmm0
callq 0x10250
cvttsd2si %xmm0, %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
jmp 0x5fa0c
movsd -0x38(%rbp), %xmm0
movq -0x28(%rbp), %rax
cvtsi2sdl (%rax), %xmm1
subsd %xmm1, %xmm0
movsd 0x18f22(%rip), %xmm1    # 0x78850
ucomisd %xmm1, %xmm0
jbe 0x5fa0a
jmp 0x5f93a
leaq 0x1de95(%rip), %rdi     # 0x7d7d6
callq 0x10380
movq -0x48(%rbp), %rdi
movq %rax, %rsi
movb $0x0, %al
callq 0x10df0
movq 0x27605(%rip), %rax     # 0x86f60
movl $0x0, 0xd670(%rax)
movq 0x275f4(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rax
movq 0x275e6(%rip), %rdi     # 0x86f60
addq $0xc6d0, %rdi           # imm = 0xC6D0
imulq $0x50, %rax, %rax
addq %rax, %rdi
leaq 0x1de08(%rip), %rsi     # 0x7d797
movl $0x50, %edx
callq 0x10840
movq 0x275c0(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x275b2(%rip), %rax     # 0x86f60
addq $0xc6d0, %rax           # imm = 0xC6D0
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x0, 0x4f(%rax)
movq 0x2759a(%rip), %rax     # 0x86f60
movl 0xd670(%rax), %ecx
addl $0x1, %ecx
movq 0x2758a(%rip), %rax     # 0x86f60
movl %ecx, 0xd670(%rax)
movq 0x2757d(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x2756f(%rip), %rax     # 0x86f60
addq $0xc6d0, %rax           # imm = 0xC6D0
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x0, (%rax)
movl $0x5, -0x4(%rbp)
jmp 0x5fa13
jmp 0x5fa0c
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)