// File: /workspace/github_c_makefile_star2_O3/hughbarney[P]zepl/lisp.c
// Function: readList
Object *readList(Stream * stream, GC_PARAM)
{
	GC_TRACE(gcList, nil);
	GC_TRACE(gcLast, nil);

	for (;;) {
		int ch = readNext(stream);
		if (ch == EOF)
			exception("unexpected end of stream in list");
		else if (ch == ')')
			return reverseList(*gcList);
		else if (ch == '.' && !isSymbolChar(streamPeek(stream))) {
			if (*gcLast == nil)
				exception("unexpected dot at start of list");
			if ((ch = peekNext(stream)) == ')')
				exception("expected object at end of dotted list");
			if (!(*gcLast = readExpr(stream, GC_ROOTS)))
				exception("unexpected end of stream in dotted list");
			if ((ch = peekNext(stream)) != ')')
				exception("unexpected object at end of dotted list");
			readNext(stream);
			Object *list = reverseList(*gcList);
			(*gcList)->cdr = *gcLast;

			return list;
		} else {
			*gcLast = readExpr(streamSeek(stream, -1), GC_ROOTS);
			*gcList = newCons(gcLast, gcList, GC_ROOTS);
		}
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x50, %rsp
movq %rdi, %rbx
movl $0x3, %eax
leaq 0x28(%rsp), %rcx
movl %eax, (%rcx)
xorl %r15d, %r15d
movq %r15, 0x8(%rcx)
movq 0x7c65(%rip), %rdx      # 0xd208
movq %rdx, 0x10(%rcx)
movq %rsi, 0x18(%rcx)
movq %rsp, %r14
movl %eax, (%r14)
movq %r15, 0x8(%r14)
movq %rdx, 0x10(%r14)
movq %rcx, 0x18(%r14)
movq %rbx, %rdi
callq 0x4fd9
cmpl $0x2e, %eax
je 0x55dd
cmpl $0x29, %eax
je 0x565f
cmpl $-0x1, %eax
jne 0x560d
jmp 0x575f
movq %rbx, %rdi
callq 0x4dbb
cmpl $-0x1, %eax
je 0x55fe
movq 0x28(%rbx), %rcx
leaq -0x1(%rcx), %rdx
cmpq $0x2, %rcx
cmovlq %r15, %rdx
movq %rdx, 0x28(%rbx)
movl %eax, %edi
callq 0x52f9
testl %eax, %eax
je 0x568f
movq 0x28(%rbx), %rax
leaq -0x1(%rax), %rcx
cmpq $0x2, %rax
cmovlq %r15, %rcx
movq %rcx, 0x28(%rbx)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x518b
movq %rax, 0x10(%rsp)
movl $0x28, %esi
movl $0x3, %edi
movq %r14, %rdx
callq 0x4814
movq 0x10(%rsp), %rcx
movq %rcx, 0x10(%rax)
movq 0x38(%rsp), %rcx
movq %rcx, 0x18(%rax)
movq %rax, 0x38(%rsp)
jmp 0x55bd
movq 0x38(%rsp), %rdx
movq 0x7b9d(%rip), %rcx      # 0xd208
cmpq %rdx, %rcx
je 0x5744
movq %rcx, %rsi
movq %rdx, %rax
movq 0x18(%rdx), %rdx
movq %rsi, 0x18(%rax)
movq %rax, %rsi
cmpq %rcx, %rdx
jne 0x5677
jmp 0x5755
movq 0x10(%rsp), %rax
cmpq 0x7b6d(%rip), %rax      # 0xd208
je 0x5778
movq %rbx, %rdi
callq 0x4fd9
cmpl $-0x1, %eax
je 0x56cd
movq 0x28(%rbx), %rcx
leaq -0x1(%rcx), %rdx
xorl %esi, %esi
cmpq $0x2, %rcx
cmovgeq %rdx, %rsi
movq %rsi, 0x28(%rbx)
cmpl $0x29, %eax
je 0x578a
movq %rsp, %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x518b
movq %rax, 0x10(%r14)
testq %rax, %rax
je 0x5781
movq %rbx, %rdi
callq 0x4fd9
cmpl $-0x1, %eax
je 0x576f
movq 0x28(%rbx), %rcx
leaq -0x1(%rcx), %rdx
xorl %esi, %esi
cmpq $0x2, %rcx
cmovgeq %rdx, %rsi
movq %rsi, 0x28(%rbx)
cmpl $0x29, %eax
jne 0x576f
movq %rbx, %rdi
callq 0x4fd9
movq 0x38(%rsp), %rcx
movq 0x7ae4(%rip), %rdx      # 0xd208
cmpq %rcx, %rdx
je 0x5749
movq %rcx, %rsi
movq %rdx, %rdi
movq %rsi, %rax
movq 0x18(%rsi), %rsi
movq %rdi, 0x18(%rax)
movq %rax, %rdi
cmpq %rdx, %rsi
jne 0x572f
jmp 0x574c
movq %rcx, %rax
jmp 0x5755
movq %rdx, %rax
movq 0x10(%rsp), %rdx
movq %rdx, 0x18(%rcx)
addq $0x50, %rsp
popq %rbx
popq %r14
popq %r15
retq
leaq 0x2e7d(%rip), %rsi      # 0x85e3
xorl %edi, %edi
xorl %eax, %eax
callq 0x4380
leaq 0x2ed6(%rip), %rsi      # 0x864c
jmp 0x5766
leaq 0x2e85(%rip), %rsi      # 0x8604
jmp 0x5766
leaq 0x2e9c(%rip), %rsi      # 0x8624
jmp 0x5766
leaq 0x2ebd(%rip), %rsi      # 0x864e
jmp 0x5766