// File: /workspace/github_c_makefile_star2_O1/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 %r12
pushq %rbx
subq $0x58, %rsp
movq %rdi, %rbx
movl $0x3, %eax
leaq 0x30(%rsp), %rcx
movl %eax, (%rcx)
xorl %r12d, %r12d
movq %r12, 0x8(%rcx)
movq 0x7bf5(%rip), %rdx      # 0xd208
movq %rdx, 0x10(%rcx)
movq %rsi, 0x18(%rcx)
leaq 0x8(%rsp), %r14
movl %eax, (%r14)
movq %r12, 0x8(%r14)
movq %rdx, 0x10(%r14)
movq %rcx, 0x18(%r14)
movq %rbx, %rdi
callq 0x5006
cmpl $0x29, %eax
je 0x56d3
cmpl $0x2e, %eax
je 0x564f
cmpl $-0x1, %eax
jne 0x567f
jmp 0x57dc
movq %rbx, %rdi
callq 0x4df3
cmpl $-0x1, %eax
je 0x5670
movq 0x28(%rbx), %rcx
leaq -0x1(%rcx), %rdx
cmpq $0x2, %rcx
cmovlq %r12, %rdx
movq %rdx, 0x28(%rbx)
movl %eax, %edi
callq 0x534d
testl %eax, %eax
je 0x5708
movq 0x28(%rbx), %rax
leaq -0x1(%rax), %rcx
cmpq $0x2, %rax
cmovlq %r12, %rcx
movq %rcx, 0x28(%rbx)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x51d2
movq %rax, 0x18(%rsp)
movl $0x28, %esi
movl $0x3, %edi
movq %r14, %rdx
callq 0x481c
movq 0x18(%rsp), %rcx
movq %rcx, 0x10(%rax)
movq 0x40(%rsp), %rcx
movq %rcx, 0x18(%rax)
movq %rax, 0x40(%rsp)
movb $0x1, %al
jmp 0x57c5
movq 0x40(%rsp), %rax
movq 0x7b29(%rip), %r15      # 0xd208
cmpq %rax, %r15
je 0x57c3
movq %r15, %rcx
movq %rcx, %rdx
movq %rax, %rcx
movq 0x18(%rax), %rax
movq %rdx, 0x18(%rcx)
cmpq %r15, %rax
jne 0x56eb
xorl %eax, %eax
movq %rcx, %r15
jmp 0x57c5
movq 0x18(%rsp), %rax
cmpq 0x7af4(%rip), %rax      # 0xd208
je 0x57f7
movq %rbx, %rdi
callq 0x5006
cmpl $-0x1, %eax
je 0x5744
movq 0x28(%rbx), %rcx
leaq -0x1(%rcx), %rdx
cmpq $0x2, %rcx
cmovlq %r12, %rdx
movq %rdx, 0x28(%rbx)
cmpl $0x29, %eax
je 0x5800
movq %rbx, %rdi
movq %r14, %rsi
callq 0x51d2
movq %rax, 0x18(%rsp)
testq %rax, %rax
je 0x57ee
movq %rbx, %rdi
callq 0x5006
cmpl $-0x1, %eax
je 0x57e5
movq 0x28(%rbx), %rcx
leaq -0x1(%rcx), %rdx
cmpq $0x2, %rcx
cmovlq %r12, %rdx
movq %rdx, 0x28(%rbx)
cmpl $0x29, %eax
jne 0x57e5
movq %rbx, %rdi
callq 0x5006
movq 0x40(%rsp), %rax
movq 0x7a71(%rip), %rcx      # 0xd208
cmpq %rax, %rcx
je 0x57b7
movq %rax, %rdx
movq %rcx, %rsi
movq %rdx, %r15
movq 0x18(%rdx), %rdx
movq %rsi, 0x18(%r15)
movq %r15, %rsi
cmpq %rcx, %rdx
jne 0x57a2
jmp 0x57ba
movq %rcx, %r15
movq 0x18(%rsp), %rcx
movq %rcx, 0x18(%rax)
xorl %eax, %eax
testb %al, %al
jne 0x562f
movq %r15, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x2e00(%rip), %rsi      # 0x85e3
jmp 0x5807
leaq 0x2e60(%rip), %rsi      # 0x864c
jmp 0x5807
leaq 0x2e2f(%rip), %rsi      # 0x8624
jmp 0x5807
leaq 0x2e06(%rip), %rsi      # 0x8604
jmp 0x5807
leaq 0x2e47(%rip), %rsi      # 0x864e
xorl %edi, %edi
xorl %eax, %eax
callq 0x4388