// File: /workspace/github_c_makefile_star2_O2/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 0x191b0(%rip), %rax     # 0x1c12e
movq %rsp, %rdi
movq %rax, (%rdi)
leaq 0x213a5(%rip), %rax     # 0x24330
movq (%rax), %rax
movq 0x50(%rax), %rax
movl 0x8(%rax), %ecx
movl %ecx, 0x8(%rdi)
movl $0xaa1, 0xc(%rdi)       # imm = 0xAA1
leaq 0x193a4(%rip), %rcx     # 0x1c34a
movq %rcx, 0x10(%rdi)
leaq 0x2119f(%rip), %rcx     # 0x24150
movq %rcx, 0x18(%rdi)
movq %rax, 0x20(%rdi)
callq 0x1b079
movl $0x4801, %ebx           # imm = 0x4801
movq %r14, %rdi
callq *0x10(%r14)
movq %rax, %r15
shrq $0x2, %r15
cmpl $0x3b, %r15d
jne 0x2ffa
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 0x2fd7
btl %eax, %ebx
jae 0x2fd7
callq 0x2270
movq %rax, %r12
movq (%rax), %rax
movslq %r15d, %r13
movzwl (%rax,%r13,2), %ebp
btl $0xd, %ebp
jae 0x301c
movq %r14, %rdi
callq *0x18(%r14)
jmp 0x2fc3
cmpl $-0x1, %r15d
je 0x32f0
cmpl $0x22, %r15d
je 0x3142
cmpl $0x2e, %r15d
je 0x315f
cmpl $0x29, %r15d
je 0x314c
cmpl $0x28, %r15d
jne 0x3253
movq %r14, %rdi
callq *0x18(%r14)
leaq 0x21244(%rip), %r15     # 0x242a0
leaq 0x218cd(%rip), %r13     # 0x24930
leaq 0x1ab9b(%rip), %r12     # 0x1dc05
leaq 0x190c8(%rip), %rbp     # 0x1c139
movq %r14, %rdi
callq 0x2f66
movq %rax, %rbx
andl $0x3, %eax
cmpq $0x1, %rax
jne 0x328b
cmpl $0x0, (%r13)
je 0x30d8
leaq 0x21299(%rip), %rax     # 0x24330
movq (%rax), %rax
movq 0x50(%rax), %rax
movq %r12, 0x10(%rax)
movq %r12, %rdi
callq 0x1a7f4
testl %eax, %eax
je 0x30d8
leaq 0x2127b(%rip), %rax     # 0x24330
movq (%rax), %rax
movq 0x50(%rax), %rax
movl $0xabc, 0xc(%rax)       # imm = 0xABC
movq %rbx, %rdi
callq 0x13708
movq %rbp, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0x1b0f0
movq %rbx, %rdi
movq %r15, %rsi
callq 0x19164
movq %rax, %r15
cmpl $0x0, (%r13)
je 0x3071
leaq 0x2123c(%rip), %rax     # 0x24330
movq (%rax), %rax
movq 0x50(%rax), %rax
movq %r12, 0x10(%rax)
movq %r12, %rdi
callq 0x1a7f4
testl %eax, %eax
je 0x3071
leaq 0x2121a(%rip), %rax     # 0x24330
movq (%rax), %rax
movq 0x50(%rax), %rax
movl $0xabe, 0xc(%rax)       # imm = 0xABE
movq %r15, %rdi
callq 0x13708
leaq 0x1900b(%rip), %rdi     # 0x1c13e
movq %rax, %rsi
xorl %eax, %eax
callq 0x1b0f0
jmp 0x3071
movl $0x8b, %ebx
jmp 0x35f5
movq %r14, %rdi
callq *0x18(%r14)
leaq 0x21146(%rip), %rbx     # 0x242a0
jmp 0x35f5
movq %r14, %rdi
callq *0x18(%r14)
movq %r14, %rdi
callq 0x2f66
movq %rax, %r15
leaq 0x217b8(%rip), %rbx     # 0x24930
cmpl $0x0, (%rbx)
je 0x31cd
leaq 0x211ac(%rip), %rax     # 0x24330
movq (%rax), %rax
movq 0x50(%rax), %rax
leaq 0x18fbd(%rip), %rdi     # 0x1c14f
movq %rdi, 0x10(%rax)
callq 0x1a7f4
testl %eax, %eax
je 0x31cd
leaq 0x2118a(%rip), %rax     # 0x24330
movq (%rax), %rax
movq 0x50(%rax), %rax
movl $0xad6, 0xc(%rax)       # imm = 0xAD6
movq %r15, %rdi
callq 0x13708
leaq 0x18f76(%rip), %rdi     # 0x1c139
movq %rax, %rsi
xorl %eax, %eax
callq 0x1b0f0
movq %r14, %rdi
callq 0x2f66
movq %rax, %r14
cmpl $0x0, (%rbx)
je 0x322d
leaq 0x2114c(%rip), %rax     # 0x24330
movq (%rax), %rax
movq 0x50(%rax), %rax
leaq 0x18f5d(%rip), %rdi     # 0x1c14f
movq %rdi, 0x10(%rax)
callq 0x1a7f4
testl %eax, %eax
je 0x322d
leaq 0x2112a(%rip), %rax     # 0x24330
movq (%rax), %rax
movq 0x50(%rax), %rax
movl $0xad8, 0xc(%rax)       # imm = 0xAD8
movq %r14, %rdi
callq 0x13708
leaq 0x18f1b(%rip), %rdi     # 0x1c13e
movq %rax, %rsi
xorl %eax, %eax
callq 0x1b0f0
movl $0xa7, %ebx
cmpq 0x20d87(%rip), %r14     # 0x23fc0
jne 0x35f5
leaq 0x2105a(%rip), %rsi     # 0x242a0
movq %r15, %rdi
callq 0x19164
jmp 0x345c
testl %r15d, %r15d
je 0x32f8
movl %ebp, %eax
andl $0x4, %eax
je 0x32f8
leaq 0x18ee5(%rip), %rdi     # 0x1c153
pushq $0x9
popq %rdx
movl %r15d, %esi
callq 0x2150
testq %rax, %rax
je 0x32f8
leaq 0x3(,%r13,4), %rbx
jmp 0x35f5
cmpq 0x20d2e(%rip), %rbx     # 0x23fc0
je 0x33ca
testq %rbx, %rbx
sete %cl
testq %rax, %rax
setne %al
orb %cl, %al
je 0x3464
cmpl $0x0, (%r13)
je 0x364a
leaq 0x21072(%rip), %r14     # 0x24330
movq (%r14), %rax
movq 0x50(%rax), %rax
leaq 0x18e7d(%rip), %rdi     # 0x1c149
movq %rdi, 0x10(%rax)
callq 0x1a7f4
testl %eax, %eax
je 0x35f5
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0xaca, 0xc(%rax)       # imm = 0xACA
jmp 0x35ae
pushq $-0x1
popq %rbx
jmp 0x35f5
btl $0xb, %ebp
jb 0x33d6
leaq 0x20f97(%rip), %rbx     # 0x242a0
pushq $0x4
popq %rbp
movl %r15d, %r13d
movl %r13d, %edi
callq 0x21a0
movq %rbx, %rdi
movl %eax, %esi
callq 0x167fe
movq %rax, %rbx
movq %r14, %rdi
callq *0x18(%r14)
movq %r14, %rdi
callq *0x10(%r14)
movq %rax, %r13
shrq $0x2, %r13
movq (%r12), %rax
movslq %r13d, %rcx
cmpw $0x0, (%rax,%rcx,2)
jns 0x3363
testl %r13d, %r13d
je 0x330f
leaq 0x18e09(%rip), %rdi     # 0x1c15c
movl %r13d, %esi
movq %rbp, %rdx
callq 0x2150
testq %rax, %rax
je 0x330f
cmpl $0x23, %r15d
jne 0x33bd
leaq 0x18df0(%rip), %rdi     # 0x1c160
callq 0x1691f
cmpq %rax, %rbx
je 0x35d3
leaq 0x18de2(%rip), %rdi     # 0x1c167
callq 0x1691f
cmpq %rax, %rbx
je 0x35dc
leaq 0x18dd0(%rip), %rdi     # 0x1c16a
callq 0x1691f
cmpq %rax, %rbx
je 0x35e5
leaq 0x18dbe(%rip), %rdi     # 0x1c16d
callq 0x1691f
cmpq %rax, %rbx
je 0x35ee
movq %rbx, %rdi
callq 0x3adf
jmp 0x345c
movq 0x20fc7(%rip), %rbx     # 0x24398
jmp 0x346f
pushq $0x3
popq %r13
shrq $0x2, %r13
imull $0xa, %r13d, %eax
addl %r15d, %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 0x33da
cmpl $-0x1, %r15d
je 0x3454
andl $0x2000, %eax           # imm = 0x2000
jne 0x3454
testl %r15d, %r15d
je 0x35c9
leaq 0x18d1c(%rip), %rdi     # 0x1c15c
pushq $0x4
popq %rdx
movl %r15d, %esi
callq 0x2150
testq %rax, %rax
je 0x35c9
movq %r13, %rdi
callq 0x3968
movq %rax, %rbx
jmp 0x35f5
movq %rbx, %rdi
callq 0x191fb
movq %rax, %rbx
cmpl $0x0, (%r13)
je 0x351b
leaq 0x20eaf(%rip), %r12     # 0x24330
movq (%r12), %rax
movq 0x50(%rax), %rax
leaq 0x18cb3(%rip), %r14     # 0x1c143
movq %r14, 0x10(%rax)
movq %r14, %rdi
callq 0x1a7f4
testl %eax, %eax
je 0x34c8
movq (%r12), %rax
movq 0x50(%rax), %rax
movl $0xac1, 0xc(%rax)       # imm = 0xAC1
movq %rbx, %rdi
callq 0x13708
leaq 0x18c7b(%rip), %rdi     # 0x1c139
movq %rax, %rsi
xorl %eax, %eax
callq 0x1b0f0
cmpl $0x0, (%r13)
je 0x351b
leaq 0x20e5a(%rip), %rax     # 0x24330
movq (%rax), %rax
movq 0x50(%rax), %rax
movq %r14, 0x10(%rax)
movq %r14, %rdi
callq 0x1a7f4
testl %eax, %eax
je 0x351b
leaq 0x20e3c(%rip), %rax     # 0x24330
movq (%rax), %rax
movq 0x50(%rax), %rax
movl $0xac2, 0xc(%rax)       # imm = 0xAC2
movq %r15, %rdi
callq 0x13708
leaq 0x18c2d(%rip), %rdi     # 0x1c13e
movq %rax, %rsi
xorl %eax, %eax
callq 0x1b0f0
leaq 0x20d7e(%rip), %rbp     # 0x242a0
leaq 0x142(%rip), %r14       # 0x366b
cmpq %rbp, %r15
je 0x3573
testq %r15, %r15
je 0x3573
movl %r15d, %eax
andl $0x3, %eax
jne 0x3573
movq 0x20e5e(%rip), %r12     # 0x243a0
movq %r15, %rdi
callq 0x191fb
movq %rax, %rdi
movq %rbx, %rsi
callq 0x19164
movq %r12, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x123b7
movq %rax, %rbx
movq %r15, %rdi
callq 0x19306
movq %rax, %r15
jmp 0x3529
cmpl $0x0, (%r13)
je 0x364a
leaq 0x20dab(%rip), %r14     # 0x24330
movq (%r14), %rax
movq 0x50(%rax), %rax
leaq 0x18bb0(%rip), %rdi     # 0x1c143
movq %rdi, 0x10(%rax)
callq 0x1a7f4
testl %eax, %eax
je 0x35f5
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0xac7, 0xc(%rax)       # imm = 0xAC7
movq %rbx, %rdi
callq 0x13708
leaq 0x18b7c(%rip), %rdi     # 0x1c139
movq %rax, %rsi
xorl %eax, %eax
callq 0x1b0f0
jmp 0x35f5
sarq $0x1e, %rbx
orq $0x3, %rbx
jmp 0x35f5
movq 0x20dce(%rip), %rbx     # 0x243a8
jmp 0x35f5
movq 0x20da5(%rip), %rbx     # 0x24388
jmp 0x35f5
movq 0x20d94(%rip), %rbx     # 0x24380
jmp 0x35f5
movq 0x20dbb(%rip), %rbx     # 0x243b0
leaq 0x21334(%rip), %rax     # 0x24930
cmpl $0x0, (%rax)
je 0x364a
leaq 0x20d28(%rip), %r14     # 0x24330
movq (%r14), %rax
movq 0x50(%rax), %rax
leaq 0x1a6f0(%rip), %rdi     # 0x1dd06
movq %rdi, 0x10(%rax)
callq 0x1a7f4
testl %eax, %eax
je 0x364a
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0xb07, 0xc(%rax)       # imm = 0xB07
movq %rbx, %rdi
callq 0x13708
leaq 0x19ef4(%rip), %rdi     # 0x1d534
movq %rax, %rsi
xorl %eax, %eax
callq 0x1b0f0
movq %rsp, %rdi
movl $0xb08, 0xc(%rdi)       # imm = 0xB08
callq 0x1b1f2
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq