// File: ryuichiueda[P]GlueLang/src/Feeder.cc
// Function: Feeder::positiveInt(long*)
bool Feeder::positiveInt(long *pos)
{
	if(outOfRange())
		return false;

	string *p = &m_lines[m_cur_line];
	int i = m_cur_char;

	if(! isNum(p->at(i)))
		return false;

	i++;
	for(;i < (int)p->length();i++){
		if(! isNum(p->at(i)) )
			break;
	}

	string str = string(p->c_str()+m_cur_char,i-m_cur_char);
	char *e = NULL;
	*pos = strtol(str.c_str(), &e, 10);

	if(errno != ERANGE && *e != '\0'){
		m_error_msg = "Invalid number";
		throw this;
	}
	else if (*pos == LONG_MAX){
		m_error_msg = "Too large number";
		throw this;
	}

	m_cur_char = i;
	checkEol(p);
	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x70(%rbp)
callq 0x163e0
testb $0x1, %al
jne 0x16cd6
jmp 0x16cdf
movb $0x0, -0x1(%rbp)
jmp 0x16efe
movq -0x70(%rbp), %rax
movq %rax, %rdi
addq $0x8, %rdi
movslq 0x20(%rax), %rsi
callq 0xb680
movq %rax, %rcx
movq -0x70(%rbp), %rax
movq %rcx, -0x20(%rbp)
movl 0x24(%rax), %eax
movl %eax, -0x24(%rbp)
movq -0x20(%rbp), %rdi
movslq -0x24(%rbp), %rsi
callq 0x6770
movq -0x70(%rbp), %rdi
movsbl (%rax), %esi
callq 0x16470
testb $0x1, %al
jne 0x16d2a
movb $0x0, -0x1(%rbp)
jmp 0x16efe
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x74(%rbp)
movq -0x20(%rbp), %rdi
callq 0x6620
movq %rax, %rcx
movl -0x74(%rbp), %eax
cmpl %ecx, %eax
jge 0x16d78
movq -0x20(%rbp), %rdi
movslq -0x24(%rbp), %rsi
callq 0x6770
movq -0x70(%rbp), %rdi
movsbl (%rax), %esi
callq 0x16470
testb $0x1, %al
jne 0x16d6b
jmp 0x16d78
jmp 0x16d6d
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x16d33
movq -0x20(%rbp), %rdi
callq 0x6190
movq -0x70(%rbp), %rcx
movslq 0x24(%rcx), %rdx
movl %edx, %ecx
addq %rdx, %rax
movq %rax, -0x90(%rbp)
movl -0x24(%rbp), %eax
subl %ecx, %eax
cltq
movq %rax, -0x88(%rbp)
leaq -0x49(%rbp), %rdi
movq %rdi, -0x80(%rbp)
callq 0x6710
movq -0x90(%rbp), %rsi
movq -0x88(%rbp), %rdx
movq -0x80(%rbp), %rcx
leaq -0x48(%rbp), %rdi
callq 0x64c0
jmp 0x16dcd
leaq -0x49(%rbp), %rdi
callq 0x6480
movq $0x0, -0x68(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x6190
movq %rax, %rdi
leaq -0x68(%rbp), %rsi
movl $0xa, %edx
callq 0x65c0
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
callq 0x6080
cmpl $0x22, (%rax)
je 0x16e8b
movq -0x68(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x16e8b
movq -0x70(%rbp), %rdi
addq $0x28, %rdi
leaq 0x67bf(%rip), %rsi      # 0x1d5e6
callq 0x6580
jmp 0x16e2e
movl $0x8, %edi
callq 0x6200
movq %rax, %rdi
movq -0x70(%rbp), %rax
movq %rax, (%rdi)
leaq 0x113d7(%rip), %rsi     # 0x28220
xorl %eax, %eax
movl %eax, %edx
callq 0x66d0
jmp 0x16f15
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x49(%rbp), %rdi
callq 0x6480
jmp 0x16f0c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x6280
jmp 0x16f0c
movq -0x18(%rbp), %rax
movabsq $0x7fffffffffffffff, %rcx # imm = 0x7FFFFFFFFFFFFFFF
cmpq %rcx, (%rax)
jne 0x16eda
movq -0x70(%rbp), %rdi
addq $0x28, %rdi
leaq 0x6748(%rip), %rsi      # 0x1d5f5
callq 0x6580
jmp 0x16eb4
movl $0x8, %edi
callq 0x6200
movq %rax, %rdi
movq -0x70(%rbp), %rax
movq %rax, (%rdi)
leaq 0x11351(%rip), %rsi     # 0x28220
xorl %eax, %eax
movl %eax, %edx
callq 0x66d0
jmp 0x16f15
jmp 0x16edc
movq -0x70(%rbp), %rdi
movl -0x24(%rbp), %eax
movl %eax, 0x24(%rdi)
movq -0x20(%rbp), %rsi
callq 0x165b0
jmp 0x16ef1
movb $0x1, -0x1(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x6280
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x90, %rsp
popq %rbp
retq
movq -0x58(%rbp), %rdi
callq 0x6700
nopw %cs:(%rax,%rax)