// File: /workspace/github_c_makefile_star2_O0/blakemcbride[P]LISP9/ls9.c
// Function: scanfix
cell scanfix(char *s, int r, int of) {
	int	v, g, i;
	char	*p;
	char	d[] = "0123456789abcdefghijklmnopqrstuvwxyz";

	g = 1;
	p = s;
	if ('+' == *p) {
		p++;
	}
	else if ('-' == *p) {
		p++;
		g = -1;
	}
	v = 0;
	while (*p) {
		i = pos(tolower(*p), d);
		if (i < 0 || i >= r) return NIL;
		if (	v > INT_MAX/r ||
			(v > 0 && add_ovfl(v*r, i)) ||
			(v < 0 && sub_ovfl(v*r, i)))
		{
			if (!of) return NIL;
			rderror("fixnum too big", mkstr(s, strlen(s)));
		}
		else if (v < 0)
			v = v*r - i;
		else
			v = v*r + i;
		p++;
		if (g) v *= g;
		g = 0;
	}
	if (g) return NIL;
	return mkfix(v);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
leaq -0x60(%rbp), %rdi
leaq 0x16393(%rip), %rsi     # 0x1c3b0
movl $0x25, %edx
callq 0x2150
movl $0x1, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movsbl (%rax), %ecx
movl $0x2b, %eax
cmpl %ecx, %eax
jne 0x6054
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x6079
movq -0x30(%rbp), %rax
movsbl (%rax), %ecx
movl $0x2d, %eax
cmpl %ecx, %eax
jne 0x6077
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movl $0xffffffff, -0x20(%rbp) # imm = 0xFFFFFFFF
jmp 0x6079
movl $0x0, -0x1c(%rbp)
movq -0x30(%rbp), %rax
cmpb $0x0, (%rax)
je 0x61d5
movq -0x30(%rbp), %rax
movsbl (%rax), %edi
callq 0x2160
movl %eax, %edi
leaq -0x60(%rbp), %rsi
callq 0x5fa0
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jl 0x60b5
movl -0x24(%rbp), %eax
cmpl -0x14(%rbp), %eax
jl 0x60c1
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x620a
movl -0x1c(%rbp), %eax
movl %eax, -0x64(%rbp)
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cltd
idivl -0x14(%rbp)
movl %eax, %ecx
movl -0x64(%rbp), %eax
cmpl %ecx, %eax
jg 0x614b
cmpl $0x0, -0x1c(%rbp)
jle 0x6111
cmpl $0x0, -0x24(%rbp)
jle 0x60f8
movl -0x1c(%rbp), %eax
imull -0x14(%rbp), %eax
movl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
subl -0x24(%rbp), %ecx
cmpl %ecx, %eax
jg 0x614b
cmpl $0x0, -0x24(%rbp)
jge 0x6111
movl -0x1c(%rbp), %eax
imull -0x14(%rbp), %eax
movl $0x80000000, %ecx       # imm = 0x80000000
subl -0x24(%rbp), %ecx
cmpl %ecx, %eax
jl 0x614b
cmpl $0x0, -0x1c(%rbp)
jge 0x6189
cmpl $0x0, -0x24(%rbp)
jge 0x6131
movl -0x1c(%rbp), %eax
imull -0x14(%rbp), %eax
movl -0x24(%rbp), %ecx
addl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpl %ecx, %eax
jg 0x614b
cmpl $0x0, -0x24(%rbp)
jle 0x6189
movl -0x1c(%rbp), %eax
imull -0x14(%rbp), %eax
movl -0x24(%rbp), %ecx
addl $0x80000000, %ecx       # imm = 0x80000000
cmpl %ecx, %eax
jge 0x6189
cmpl $0x0, -0x18(%rbp)
jne 0x615d
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x620a
movq -0x10(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2090
movq -0x70(%rbp), %rdi
movl %eax, %esi
callq 0x2880
movl %eax, %esi
leaq 0x153c9(%rip), %rdi     # 0x1b54b
callq 0x55a0
jmp 0x61ad
cmpl $0x0, -0x1c(%rbp)
jge 0x619e
movl -0x1c(%rbp), %eax
imull -0x14(%rbp), %eax
subl -0x24(%rbp), %eax
movl %eax, -0x1c(%rbp)
jmp 0x61ab
movl -0x1c(%rbp), %eax
imull -0x14(%rbp), %eax
addl -0x24(%rbp), %eax
movl %eax, -0x1c(%rbp)
jmp 0x61ad
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
cmpl $0x0, -0x20(%rbp)
je 0x61c9
movl -0x20(%rbp), %eax
imull -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
jmp 0x6080
cmpl $0x0, -0x20(%rbp)
je 0x61e4
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x620a
movl -0x1c(%rbp), %edi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl $0x1, %edx
callq 0x3990
movl %eax, %esi
movl $0xfffffff2, %edi       # imm = 0xFFFFFFF2
movl $0x1, %edx
callq 0x3990
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)