// File: /workspace/github_c_makefile_star2_O3/hughbarney[P]zepl/lisp.c
// Function: readNumberOrSymbol
Object *readNumberOrSymbol(Stream * stream, GC_PARAM)
{
	size_t offset = stream->offset;
	int ch = streamPeek(stream);

	// skip optional leading sign
	if (ch == '+' || ch == '-') {
		streamGetc(stream);
		ch = streamPeek(stream);
	}
	// try to read a number in integer or decimal format
	if (ch == '.' || isdigit(ch)) {
		if (isdigit(ch))
			ch = readWhile(stream, isdigit);
		if (!isSymbolChar(ch))
			return newNumber(strtol(stream->buffer + offset, NULL, 10), GC_ROOTS);
		if (ch == '.') {
			ch = streamGetc(stream);
			if (isdigit(streamPeek(stream))) {
				ch = readWhile(stream, isdigit);
				if (!isSymbolChar(ch))
					return newNumber(strtod(stream->buffer + offset, NULL), GC_ROOTS);
			}
		}
	}
	// non-numeric character encountered, read a symbol
	readWhile(stream, isSymbolChar);
	return newSymbolWithLength(stream->buffer + offset, stream->offset - offset, GC_ROOTS);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r15
movq 0x28(%rdi), %r14
callq 0x4dbb
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
cmpl $-0x1, %eax
je 0x53ba
movq 0x28(%r15), %rcx
leaq -0x1(%rcx), %rdx
xorl %esi, %esi
cmpq $0x2, %rcx
cmovgeq %rdx, %rsi
movq %rsi, 0x28(%r15)
cmpl $0x2d, %eax
je 0x5377
cmpl $0x2b, %eax
jne 0x53a2
movq %r15, %rdi
callq 0x4dbb
movq %r15, %rdi
callq 0x4dbb
cmpl $-0x1, %eax
je 0x53ba
movq 0x28(%r15), %rcx
leaq -0x1(%rcx), %rdx
xorl %esi, %esi
cmpq $0x2, %rcx
cmovgeq %rdx, %rsi
movq %rsi, 0x28(%r15)
movl %eax, %r12d
cmpl $0x2e, %eax
jne 0x53ba
movl $0x2e, %r12d
callq 0x2340
movq %rax, %r13
jmp 0x53d3
callq 0x2340
movq %rax, %r13
movq (%rax), %rax
movslq %r12d, %rcx
testb $0x8, 0x1(%rax,%rcx,2)
je 0x54ce
movq (%r13), %rax
movslq %r12d, %rcx
testb $0x8, 0x1(%rax,%rcx,2)
je 0x542f
movq %r15, %rdi
callq 0x4dbb
cmpl $-0x1, %eax
je 0x5429
movl %eax, %r12d
xorl %ebp, %ebp
movq 0x28(%r15), %rax
leaq -0x1(%rax), %rcx
cmpq $0x2, %rax
cmovlq %rbp, %rcx
movq %rcx, 0x28(%r15)
leal -0x3a(%r12), %eax
cmpl $-0xa, %eax
jb 0x542f
movq %r15, %rdi
callq 0x4dbb
movq %r15, %rdi
callq 0x4dbb
movl %eax, %r12d
cmpl $-0x1, %eax
jne 0x53f3
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
movl %r12d, %edi
callq 0x52f9
testl %eax, %eax
je 0x5501
cmpl $0x2e, %r12d
jne 0x54ce
movq %r15, %rdi
callq 0x4dbb
movq (%r13), %r12
movq %r15, %rdi
callq 0x4dbb
cmpl $-0x1, %eax
je 0x5478
movq 0x28(%r15), %rcx
leaq -0x1(%rcx), %rdx
xorl %esi, %esi
cmpq $0x2, %rcx
cmovgeq %rdx, %rsi
movq %rsi, 0x28(%r15)
cltq
testb $0x8, 0x1(%r12,%rax,2)
je 0x54ce
movq %r15, %rdi
callq 0x4dbb
cmpl $-0x1, %eax
je 0x54c3
xorl %r12d, %r12d
movq 0x28(%r15), %rcx
leaq -0x1(%rcx), %rdx
cmpq $0x2, %rcx
cmovlq %r12, %rdx
movq %rdx, 0x28(%r15)
leal -0x3a(%rax), %ecx
cmpl $-0xa, %ecx
jb 0x54c3
movq %r15, %rdi
callq 0x4dbb
movq %r15, %rdi
callq 0x4dbb
cmpl $-0x1, %eax
jne 0x5492
movl %eax, %edi
callq 0x52f9
testl %eax, %eax
je 0x5546
leaq -0x1dc(%rip), %rsi      # 0x52f9
movq %r15, %rdi
callq 0x5043
movq 0x8(%r15), %rdi
addq %r14, %rdi
movq 0x28(%r15), %rsi
subq %r14, %rsi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4ac2
addq 0x8(%r15), %r14
movq %r14, %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x21d0
cvtsi2sd %rax, %xmm0
movsd %xmm0, (%rsp)
movl $0x28, %esi
xorl %edi, %edi
movq %rbx, %rdx
callq 0x4814
movsd (%rsp), %xmm0
movsd %xmm0, 0x10(%rax)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
addq 0x8(%r15), %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x2090
jmp 0x5519