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

  for (n = *counter;; n++) {
    c = line[n];
    if ((c < 48) || (c > 57))
      break;
  }
  CHKS((n == *counter), NCE_BAD_FORMAT_UNSIGNED_INTEGER);
  if (sscanf(line + *counter, "%d", integer_ptr) == 0)
    ERS(NCE_SSCANF_FAILED);
  *counter = n;
  return INTERP_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x2c(%rbp)
movq -0x18(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movb (%rax,%rcx), %al
movb %al, -0x2d(%rbp)
movsbl -0x2d(%rbp), %eax
cmpl $0x30, %eax
jl 0x5fd99
movsbl -0x2d(%rbp), %eax
cmpl $0x39, %eax
jle 0x5fd9b
jmp 0x5fda8
jmp 0x5fd9d
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x5fd79
jmp 0x5fdaa
movl -0x2c(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl (%rcx), %eax
jne 0x5fe8e
jmp 0x5fdbb
leaq 0x1d973(%rip), %rdi     # 0x7d735
callq 0x10380
movq -0x38(%rbp), %rdi
movq %rax, %rsi
movb $0x0, %al
callq 0x10df0
movq 0x27184(%rip), %rax     # 0x86f60
movl $0x0, 0xd670(%rax)
movq 0x27173(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rax
movq 0x27165(%rip), %rdi     # 0x86f60
addq $0xc6d0, %rdi           # imm = 0xC6D0
imulq $0x50, %rax, %rax
addq %rax, %rdi
leaq 0x1d941(%rip), %rsi     # 0x7d751
movl $0x50, %edx
callq 0x10840
movq 0x2713f(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x27131(%rip), %rax     # 0x86f60
addq $0xc6d0, %rax           # imm = 0xC6D0
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x0, 0x4f(%rax)
movq 0x27119(%rip), %rax     # 0x86f60
movl 0xd670(%rax), %ecx
addl $0x1, %ecx
movq 0x27109(%rip), %rax     # 0x86f60
movl %ecx, 0xd670(%rax)
movq 0x270fc(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x270ee(%rip), %rax     # 0x86f60
addq $0xc6d0, %rax           # imm = 0xC6D0
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x0, (%rax)
movl $0x5, -0x4(%rbp)
jmp 0x5ff9b
jmp 0x5fe90
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rax
movslq (%rax), %rax
addq %rax, %rdi
movq -0x28(%rbp), %rdx
leaq 0x1ea40(%rip), %rsi     # 0x7e8e9
movb $0x0, %al
callq 0x11130
cmpl $0x0, %eax
jne 0x5ff8b
jmp 0x5febb
leaq 0x1d8c7(%rip), %rdi     # 0x7d789
callq 0x10380
movq -0x38(%rbp), %rdi
movq %rax, %rsi
movb $0x0, %al
callq 0x10df0
movq 0x27084(%rip), %rax     # 0x86f60
movl $0x0, 0xd670(%rax)
movq 0x27073(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rax
movq 0x27065(%rip), %rdi     # 0x86f60
addq $0xc6d0, %rdi           # imm = 0xC6D0
imulq $0x50, %rax, %rax
addq %rax, %rdi
leaq 0x1d841(%rip), %rsi     # 0x7d751
movl $0x50, %edx
callq 0x10840
movq 0x2703f(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x27031(%rip), %rax     # 0x86f60
addq $0xc6d0, %rax           # imm = 0xC6D0
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x0, 0x4f(%rax)
movq 0x27019(%rip), %rax     # 0x86f60
movl 0xd670(%rax), %ecx
addl $0x1, %ecx
movq 0x27009(%rip), %rax     # 0x86f60
movl %ecx, 0xd670(%rax)
movq 0x26ffc(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x26fee(%rip), %rax     # 0x86f60
addq $0xc6d0, %rax           # imm = 0xC6D0
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x0, (%rax)
movl $0x5, -0x4(%rbp)
jmp 0x5ff9b
movl -0x2c(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)