// File: /workspace/github_c_makefile_star2_O3/dalnefre[P]kernel_abe/kernel.c
// Function: read_sexpr
CONS*
read_sexpr(SOURCE* src)
{
	CONS* x;
	int c;

	DBUG_ENTER("read_sexpr");
	for (;;) {	/* skip whitespace */
		c = MK_INT((src->get)(src));
		if (c == ';') {
			(src->next)(src);
			for (;;) {  /* skip comment */
				c = MK_INT((src->get)(src));
				if ((c == '\n') || (c == '\r') || (c == EOF)) {
					break;
				}
				(src->next)(src);
			}
		}
		if (!isspace(c)) {
			break;
		}
		(src->next)(src);
	}
	if (c == EOF) {
		x = NUMBER(EOF);
	} else if (c == '(') {
		CONS* y = NIL;

		(src->next)(src);
		for (;;) {
			x = read_sexpr(src);
			if (actorp(x)) {
				DBUG_PRINT("actor", ("x=%s", cons_to_str(x)));
				y = pr(x, y);
				DBUG_PRINT("actor", ("y=%s", cons_to_str(y)));
			} else if (nilp(x) || is_pr(x)) {
				x = (nilp(x) ? a_nil : hd(x));
				DBUG_PRINT("close", ("x=%s", cons_to_str(x)));
				DBUG_PRINT("close", ("y=%s", cons_to_str(y)));
				while (is_pr(y)) {
					x = ACTOR(pair_type, pr(hd(y), x));
					y = tl(y);
				}
				DBUG_PRINT("close", ("x=%s", cons_to_str(x)));
				break;
			} else {
				DBUG_PRINT("error", ("x=%s", cons_to_str(x)));
				break;
			}
		}
	} else if (c == ')') {
		(src->next)(src);
		x = NIL;
	} else if (c == '.') {
		CONS* y;
		
		(src->next)(src);
		x = read_sexpr(src);
		DBUG_PRINT("dot", ("x=%s", cons_to_str(x)));
		y = read_sexpr(src);
		DBUG_PRINT("dot", ("y=%s", cons_to_str(y)));
		if (nilp(y)) {
			x = pr(x, y);
		} else {
			x = NUMBER(')');  /* missing ')' */
		}
	} else if (c == '"') {
		x = NUMBER(c);  /* FIXME: implement string literals */
	} else if (ispunct(c) && ONE_OF(c, "'`,[]{}|")) {
		x = NUMBER(c);  /* illegal lexeme */
	} else if (isdigit(c)) {
		x = NUMBER(0);
		do {
			x = NUMBER((MK_INT(x) * 10) + (c - '0'));
			(src->next)(src);
			c = MK_INT((src->get)(src));
		} while (isdigit(c));
		if ((c == EOF) || isspace(c) || ONE_OF(c, "\"()")) {
			x = get_const(x);
		} else {
			x = NUMBER(c);  /* malformed number */
		}
	} else {
		BOOL sharp = ((c == '#') ? TRUE : FALSE);

		x = NIL;
		do {
			x = ATOM_X(x, tolower(c));  /* forced lowercase */
			(src->next)(src);
			c = MK_INT((src->get)(src));
		} while (isgraph(c) && !ONE_OF(c, "\"()"));
		if (sharp == TRUE) {
			if (x == ATOM("#inert")) {
				x = a_inert;
			} else if (x == ATOM("#t")) {
				x = a_true;
			} else if (x == ATOM("#f")) {
				x = a_false;
			} else if (x == ATOM("#ignore")) {
				x = a_ignore;
			} else {
				x = get_symbol(x);
			}
		} else {
			x = get_symbol(x);
		}
	}
	DBUG_PRINT("x", ("%s", cons_to_str(x)));
	DBUG_RETURN x;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %r14
leaq 0x18cde(%rip), %rax     # 0x1c12e
movq %rsp, %rdi
movq %rax, (%rdi)
leaq 0x1fed3(%rip), %rax     # 0x23330
movq (%rax), %rax
movq 0x50(%rax), %rax
movl 0x8(%rax), %ecx
movl %ecx, 0x8(%rdi)
movl $0xaa1, 0xc(%rdi)       # imm = 0xAA1
leaq 0x18ed2(%rip), %rcx     # 0x1c34a
movq %rcx, 0x10(%rdi)
leaq 0x1fccd(%rip), %rcx     # 0x23150
movq %rcx, 0x18(%rdi)
movq %rax, 0x20(%rdi)
callq 0x1ba26
movl $0x4801, %ebx           # imm = 0x4801
movq %r14, %rdi
callq *0x10(%r14)
movq %rax, %r15
shrq $0x2, %r15
cmpl $0x3b, %r15d
jne 0x34cc
movq %r14, %rdi
callq *0x18(%r14)
movq %r14, %rdi
callq *0x10(%r14)
movq %rax, %r15
shrq $0x2, %r15
leal 0x1(%r15), %eax
cmpl $0xe, %eax
ja 0x34a9
btl %eax, %ebx
jae 0x34a9
callq 0x2260
movq %rax, %r12
movq (%rax), %rax
movslq %r15d, %r13
movzwl (%rax,%r13,2), %ebp
btl $0xd, %ebp
jae 0x34ee
movq %r14, %rdi
callq *0x18(%r14)
jmp 0x3495
cmpl $0x27, %r15d
jle 0x3683
cmpl $0x2e, %r15d
je 0x36a8
cmpl $0x29, %r15d
je 0x379c
cmpl $0x28, %r15d
jne 0x37af
movq %r14, %rdi
callq *0x18(%r14)
movq %r14, %rdi
callq 0x3438
movq %rax, %rbx
andl $0x3, %eax
leaq 0x1fd6e(%rip), %r15     # 0x232a0
cmpq $0x1, %rax
jne 0x3619
leaq 0x203ed(%rip), %r13     # 0x23930
leaq 0x1a6db(%rip), %r12     # 0x1dc25
leaq 0x18be8(%rip), %rbp     # 0x1c139
cmpl $0x0, (%r13)
je 0x35a0
leaq 0x1fdd1(%rip), %rax     # 0x23330
movq (%rax), %rax
movq 0x50(%rax), %rax
movq %r12, 0x10(%rax)
movq %r12, %rdi
callq 0x1b188
testl %eax, %eax
je 0x35a0
leaq 0x1fdb3(%rip), %rax     # 0x23330
movq (%rax), %rax
movq 0x50(%rax), %rax
movl $0xabc, 0xc(%rax)       # imm = 0xABC
movq %rbx, %rdi
callq 0x13c40
movq %rbp, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0x1ba97
movq %rbx, %rdi
movq %r15, %rsi
callq 0x19c50
movq %rax, %r15
cmpl $0x0, (%r13)
je 0x3601
leaq 0x1fd74(%rip), %rax     # 0x23330
movq (%rax), %rax
movq 0x50(%rax), %rax
movq %r12, 0x10(%rax)
movq %r12, %rdi
callq 0x1b188
testl %eax, %eax
je 0x3601
leaq 0x1fd56(%rip), %rax     # 0x23330
movq (%rax), %rax
movq 0x50(%rax), %rax
movl $0xabe, 0xc(%rax)       # imm = 0xABE
movq %r15, %rdi
callq 0x13c40
leaq 0x18b47(%rip), %rdi     # 0x1c13e
movq %rax, %rsi
xorl %eax, %eax
callq 0x1ba97
movq %r14, %rdi
callq 0x3438
movq %rax, %rbx
andl $0x3, %eax
cmpq $0x1, %rax
je 0x3551
cmpq 0x1f9a0(%rip), %rbx     # 0x22fc0
je 0x38b2
testq %rbx, %rbx
sete %cl
testq %rax, %rax
setne %al
orb %cl, %al
je 0x3952
leaq 0x202ef(%rip), %rax     # 0x23930
cmpl $0x0, (%rax)
je 0x3b53
leaq 0x1fcdf(%rip), %r14     # 0x23330
movq (%r14), %rax
movq 0x50(%rax), %rax
leaq 0x18aea(%rip), %rdi     # 0x1c149
movq %rdi, 0x10(%rax)
callq 0x1b188
testl %eax, %eax
je 0x3afe
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0xaca, 0xc(%rax)       # imm = 0xACA
jmp 0x3ab7
movq $-0x1, %rbx
cmpl $-0x1, %r15d
je 0x3afe
cmpl $0x22, %r15d
jne 0x37af
movl $0x8b, %ebx
jmp 0x3afe
movq %r14, %rdi
callq *0x18(%r14)
movq %r14, %rdi
callq 0x3438
movq %rax, %r15
leaq 0x2026f(%rip), %rbx     # 0x23930
cmpl $0x0, (%rbx)
je 0x3716
leaq 0x1fc63(%rip), %rax     # 0x23330
movq (%rax), %rax
movq 0x50(%rax), %rax
leaq 0x18a74(%rip), %rdi     # 0x1c14f
movq %rdi, 0x10(%rax)
callq 0x1b188
testl %eax, %eax
je 0x3716
leaq 0x1fc41(%rip), %rax     # 0x23330
movq (%rax), %rax
movq 0x50(%rax), %rax
movl $0xad6, 0xc(%rax)       # imm = 0xAD6
movq %r15, %rdi
callq 0x13c40
leaq 0x18a2d(%rip), %rdi     # 0x1c139
movq %rax, %rsi
xorl %eax, %eax
callq 0x1ba97
movq %r14, %rdi
callq 0x3438
movq %rax, %r14
cmpl $0x0, (%rbx)
je 0x3776
leaq 0x1fc03(%rip), %rax     # 0x23330
movq (%rax), %rax
movq 0x50(%rax), %rax
leaq 0x18a14(%rip), %rdi     # 0x1c14f
movq %rdi, 0x10(%rax)
callq 0x1b188
testl %eax, %eax
je 0x3776
leaq 0x1fbe1(%rip), %rax     # 0x23330
movq (%rax), %rax
movq 0x50(%rax), %rax
movl $0xad8, 0xc(%rax)       # imm = 0xAD8
movq %r14, %rdi
callq 0x13c40
leaq 0x189d2(%rip), %rdi     # 0x1c13e
movq %rax, %rsi
xorl %eax, %eax
callq 0x1ba97
movl $0xa7, %ebx
cmpq 0x1f83e(%rip), %r14     # 0x22fc0
jne 0x3afe
leaq 0x1fb11(%rip), %rsi     # 0x232a0
movq %r15, %rdi
callq 0x19c50
jmp 0x394a
movq %r14, %rdi
callq *0x18(%r14)
leaq 0x1faf6(%rip), %rbx     # 0x232a0
jmp 0x3afe
testl %r15d, %r15d
je 0x37e1
movl %ebp, %eax
andl $0x4, %eax
je 0x37e1
leaq 0x18991(%rip), %rdi     # 0x1c153
movl $0x9, %edx
movl %r15d, %esi
callq 0x2150
testq %rax, %rax
je 0x37e1
leaq 0x3(,%r13,4), %rbx
jmp 0x3afe
btl $0xb, %ebp
jb 0x38be
leaq 0x1faae(%rip), %rbx     # 0x232a0
leaq 0x18963(%rip), %r13     # 0x1c15c
movl %r15d, %ebp
movl %ebp, %edi
callq 0x21a0
movq %rbx, %rdi
movl %eax, %esi
callq 0x16fb6
movq %rax, %rbx
movq %r14, %rdi
callq *0x18(%r14)
movq %r14, %rdi
callq *0x10(%r14)
movq %rax, %rbp
shrq $0x2, %rbp
movq (%r12), %rax
movslq %ebp, %rcx
cmpw $0x0, (%rax,%rcx,2)
jns 0x384b
testl %ebp, %ebp
je 0x37fc
movl $0x4, %edx
movq %r13, %rdi
movl %ebp, %esi
callq 0x2150
testq %rax, %rax
je 0x37fc
cmpl $0x23, %r15d
jne 0x38a5
leaq 0x18908(%rip), %rdi     # 0x1c160
callq 0x170ff
cmpq %rax, %rbx
je 0x3adc
leaq 0x188fa(%rip), %rdi     # 0x1c167
callq 0x170ff
cmpq %rax, %rbx
je 0x3ae5
leaq 0x188e8(%rip), %rdi     # 0x1c16a
callq 0x170ff
cmpq %rax, %rbx
je 0x3aee
leaq 0x188d6(%rip), %rdi     # 0x1c16d
callq 0x170ff
cmpq %rax, %rbx
je 0x3af7
movq %rbx, %rdi
callq 0x3fe8
jmp 0x394a
movq 0x1fadf(%rip), %rbx     # 0x23398
jmp 0x395d
movl $0x3, %r13d
shrq $0x2, %r13
leal (%r13,%r13,4), %eax
leal (%r15,%rax,2), %eax
addl $-0x30, %eax
cltq
leaq 0x3(,%rax,4), %r13
movq %r14, %rdi
callq *0x18(%r14)
movq %r14, %rdi
callq *0x10(%r14)
movq %rax, %r15
shrq $0x2, %r15
movq (%r12), %rax
movq %r15, %rbx
shlq $0x20, %rbx
movq %rbx, %rcx
sarq $0x1f, %rcx
movzwl (%rax,%rcx), %eax
btl $0xb, %eax
jb 0x38c4
cmpl $-0x1, %r15d
je 0x3942
andl $0x2000, %eax           # imm = 0x2000
jne 0x3942
testl %r15d, %r15d
je 0x3ad2
leaq 0x18830(%rip), %rdi     # 0x1c15c
movl $0x4, %edx
movl %r15d, %esi
callq 0x2150
testq %rax, %rax
je 0x3ad2
movq %r13, %rdi
callq 0x3e71
movq %rax, %rbx
jmp 0x3afe
movq %rbx, %rdi
callq 0x19c72
movq %rax, %rbx
leaq 0x1ffcc(%rip), %r13     # 0x23930
cmpl $0x0, (%r13)
je 0x3a10
leaq 0x1f9ba(%rip), %r12     # 0x23330
movq (%r12), %rax
movq 0x50(%rax), %rax
leaq 0x187be(%rip), %r14     # 0x1c143
movq %r14, 0x10(%rax)
movq %r14, %rdi
callq 0x1b188
testl %eax, %eax
je 0x39bd
movq (%r12), %rax
movq 0x50(%rax), %rax
movl $0xac1, 0xc(%rax)       # imm = 0xAC1
movq %rbx, %rdi
callq 0x13c40
leaq 0x18786(%rip), %rdi     # 0x1c139
movq %rax, %rsi
xorl %eax, %eax
callq 0x1ba97
cmpl $0x0, (%r13)
je 0x3a10
leaq 0x1f965(%rip), %rax     # 0x23330
movq (%rax), %rax
movq 0x50(%rax), %rax
movq %r14, 0x10(%rax)
movq %r14, %rdi
callq 0x1b188
testl %eax, %eax
je 0x3a10
leaq 0x1f947(%rip), %rax     # 0x23330
movq (%rax), %rax
movq 0x50(%rax), %rax
movl $0xac2, 0xc(%rax)       # imm = 0xAC2
movq %r15, %rdi
callq 0x13c40
leaq 0x18738(%rip), %rdi     # 0x1c13e
movq %rax, %rsi
xorl %eax, %eax
callq 0x1ba97
cmpq 0x1f5a9(%rip), %r15     # 0x22fc0
je 0x3a7c
testq %r15, %r15
je 0x3a7c
movl %r15d, %eax
andl $0x3, %eax
jne 0x3a7c
leaq 0x147(%rip), %r14       # 0x3b74
leaq 0x1f86c(%rip), %rbp     # 0x232a0
movq 0x1f965(%rip), %r12     # 0x233a0
movq %r15, %rdi
callq 0x19c72
movq %rax, %rdi
movq %rbx, %rsi
callq 0x19c50
movq %r12, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x128be
movq %rax, %rbx
movq %r15, %rdi
callq 0x19d11
cmpq %rbp, %rax
je 0x3a7c
movq %rax, %r15
testq %rax, %rax
je 0x3a7c
movl %r15d, %eax
andl $0x3, %eax
je 0x3a34
cmpl $0x0, (%r13)
je 0x3b53
leaq 0x1f8a2(%rip), %r14     # 0x23330
movq (%r14), %rax
movq 0x50(%rax), %rax
leaq 0x186a7(%rip), %rdi     # 0x1c143
movq %rdi, 0x10(%rax)
callq 0x1b188
testl %eax, %eax
je 0x3afe
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0xac7, 0xc(%rax)       # imm = 0xAC7
movq %rbx, %rdi
callq 0x13c40
leaq 0x18673(%rip), %rdi     # 0x1c139
movq %rax, %rsi
xorl %eax, %eax
callq 0x1ba97
jmp 0x3afe
sarq $0x1e, %rbx
orq $0x3, %rbx
jmp 0x3afe
movq 0x1f8c5(%rip), %rbx     # 0x233a8
jmp 0x3afe
movq 0x1f89c(%rip), %rbx     # 0x23388
jmp 0x3afe
movq 0x1f88b(%rip), %rbx     # 0x23380
jmp 0x3afe
movq 0x1f8b2(%rip), %rbx     # 0x233b0
leaq 0x1fe2b(%rip), %rax     # 0x23930
cmpl $0x0, (%rax)
je 0x3b53
leaq 0x1f81f(%rip), %r14     # 0x23330
movq (%r14), %rax
movq 0x50(%rax), %rax
leaq 0x1a207(%rip), %rdi     # 0x1dd26
movq %rdi, 0x10(%rax)
callq 0x1b188
testl %eax, %eax
je 0x3b53
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0xb07, 0xc(%rax)       # imm = 0xB07
movq %rbx, %rdi
callq 0x13c40
leaq 0x19a0b(%rip), %rdi     # 0x1d554
movq %rax, %rsi
xorl %eax, %eax
callq 0x1ba97
movq %rsp, %rdi
movl $0xb08, 0xc(%rdi)       # imm = 0xB08
callq 0x1bbab
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq