// File: /workspace/github_c_makefile_star2_O1/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 0x18ce5(%rip), %rax     # 0x1c12e
movq %rsp, %rdi
movq %rax, (%rdi)
leaq 0x1feda(%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 0x18ed9(%rip), %rcx     # 0x1c34a
movq %rcx, 0x10(%rdi)
leaq 0x1fcd4(%rip), %rcx     # 0x23150
movq %rcx, 0x18(%rdi)
movq %rax, 0x20(%rdi)
callq 0x1b912
movl $0x4801, %ebx           # imm = 0x4801
movq %r14, %rdi
callq *0x10(%r14)
movq %rax, %r15
shrq $0x2, %r15
cmpl $0x3b, %r15d
jne 0x34c5
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 0x34a2
btl %eax, %ebx
jae 0x34a2
callq 0x2260
movq %rax, %r12
movq (%rax), %rax
movslq %r15d, %r13
movzwl (%rax,%r13,2), %ebp
btl $0xd, %ebp
jae 0x34e7
movq %r14, %rdi
callq *0x18(%r14)
jmp 0x348e
cmpl $0x27, %r15d
jle 0x367c
cmpl $0x2e, %r15d
je 0x36a1
cmpl $0x29, %r15d
je 0x3791
cmpl $0x28, %r15d
jne 0x37a4
movq %r14, %rdi
callq *0x18(%r14)
movq %r14, %rdi
callq 0x3431
movq %rax, %rbx
andl $0x3, %eax
leaq 0x1fd75(%rip), %r15     # 0x232a0
cmpq $0x1, %rax
jne 0x3612
leaq 0x203f4(%rip), %r13     # 0x23930
leaq 0x1a6e2(%rip), %r12     # 0x1dc25
leaq 0x18bef(%rip), %rbp     # 0x1c139
cmpl $0x0, (%r13)
je 0x3599
leaq 0x1fdd8(%rip), %rax     # 0x23330
movq (%rax), %rax
movq 0x50(%rax), %rax
movq %r12, 0x10(%rax)
movq %r12, %rdi
callq 0x1b084
testl %eax, %eax
je 0x3599
leaq 0x1fdba(%rip), %rax     # 0x23330
movq (%rax), %rax
movq 0x50(%rax), %rax
movl $0xabc, 0xc(%rax)       # imm = 0xABC
movq %rbx, %rdi
callq 0x13b9c
movq %rbp, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0x1b983
movq %rbx, %rdi
movq %r15, %rsi
callq 0x19b84
movq %rax, %r15
cmpl $0x0, (%r13)
je 0x35fa
leaq 0x1fd7b(%rip), %rax     # 0x23330
movq (%rax), %rax
movq 0x50(%rax), %rax
movq %r12, 0x10(%rax)
movq %r12, %rdi
callq 0x1b084
testl %eax, %eax
je 0x35fa
leaq 0x1fd5d(%rip), %rax     # 0x23330
movq (%rax), %rax
movq 0x50(%rax), %rax
movl $0xabe, 0xc(%rax)       # imm = 0xABE
movq %r15, %rdi
callq 0x13b9c
leaq 0x18b4e(%rip), %rdi     # 0x1c13e
movq %rax, %rsi
xorl %eax, %eax
callq 0x1b983
movq %r14, %rdi
callq 0x3431
movq %rax, %rbx
andl $0x3, %eax
cmpq $0x1, %rax
je 0x354a
cmpq 0x1f9a7(%rip), %rbx     # 0x22fc0
je 0x38a7
testq %rbx, %rbx
sete %cl
testq %rax, %rax
setne %al
orb %cl, %al
leaq 0x1fcfc(%rip), %r14     # 0x23330
je 0x394e
leaq 0x202ef(%rip), %rax     # 0x23930
cmpl $0x0, (%rax)
je 0x3adc
movq (%r14), %rax
movq 0x50(%rax), %rax
leaq 0x18af1(%rip), %rdi     # 0x1c149
movq %rdi, 0x10(%rax)
callq 0x1b084
testl %eax, %eax
je 0x3adc
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0xaca, 0xc(%rax)       # imm = 0xACA
jmp 0x3a95
movq $-0x1, %rbx
cmpl $-0x1, %r15d
je 0x3adc
cmpl $0x22, %r15d
jne 0x37a4
movl $0x8b, %ebx
jmp 0x3adc
movq %r14, %rdi
callq *0x18(%r14)
movq %r14, %rdi
callq 0x3431
movq %rax, %r15
leaq 0x20276(%rip), %rbx     # 0x23930
cmpl $0x0, (%rbx)
je 0x370f
leaq 0x1fc6a(%rip), %rax     # 0x23330
movq (%rax), %rax
movq 0x50(%rax), %rax
leaq 0x18a7b(%rip), %rdi     # 0x1c14f
movq %rdi, 0x10(%rax)
callq 0x1b084
testl %eax, %eax
je 0x370f
leaq 0x1fc48(%rip), %rax     # 0x23330
movq (%rax), %rax
movq 0x50(%rax), %rax
movl $0xad6, 0xc(%rax)       # imm = 0xAD6
movq %r15, %rdi
callq 0x13b9c
leaq 0x18a34(%rip), %rdi     # 0x1c139
movq %rax, %rsi
xorl %eax, %eax
callq 0x1b983
movq %r14, %rdi
callq 0x3431
movq %rax, %r14
cmpl $0x0, (%rbx)
je 0x376f
leaq 0x1fc0a(%rip), %rax     # 0x23330
movq (%rax), %rax
movq 0x50(%rax), %rax
leaq 0x18a1b(%rip), %rdi     # 0x1c14f
movq %rdi, 0x10(%rax)
callq 0x1b084
testl %eax, %eax
je 0x376f
leaq 0x1fbe8(%rip), %rax     # 0x23330
movq (%rax), %rax
movq 0x50(%rax), %rax
movl $0xad8, 0xc(%rax)       # imm = 0xAD8
movq %r14, %rdi
callq 0x13b9c
leaq 0x189d9(%rip), %rdi     # 0x1c13e
movq %rax, %rsi
xorl %eax, %eax
callq 0x1b983
movl $0xa7, %ebx
cmpq 0x1f845(%rip), %r14     # 0x22fc0
jne 0x3adc
movq %r15, %rdi
movq %r14, %rsi
callq 0x19b84
jmp 0x3946
movq %r14, %rdi
callq *0x18(%r14)
leaq 0x1fb01(%rip), %rbx     # 0x232a0
jmp 0x3adc
testl %r15d, %r15d
je 0x37d6
movl %ebp, %eax
andl $0x4, %eax
je 0x37d6
leaq 0x1899c(%rip), %rdi     # 0x1c153
movl $0x9, %edx
movl %r15d, %esi
callq 0x2150
testq %rax, %rax
je 0x37d6
leaq 0x3(,%r13,4), %rbx
jmp 0x3adc
btl $0xb, %ebp
jb 0x38ba
leaq 0x1fab9(%rip), %rbx     # 0x232a0
leaq 0x1896e(%rip), %r13     # 0x1c15c
movl %r15d, %ebp
movl %ebp, %edi
callq 0x21a0
movq %rbx, %rdi
movl %eax, %esi
callq 0x16f2e
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 0x3840
testl %ebp, %ebp
je 0x37f1
movl $0x4, %edx
movq %r13, %rdi
movl %ebp, %esi
callq 0x2150
testq %rax, %rax
je 0x37f1
cmpl $0x23, %r15d
jne 0x389a
leaq 0x18913(%rip), %rdi     # 0x1c160
callq 0x1707c
cmpq %rax, %rbx
je 0x3aba
leaq 0x18905(%rip), %rdi     # 0x1c167
callq 0x1707c
cmpq %rax, %rbx
je 0x3ac3
leaq 0x188f3(%rip), %rdi     # 0x1c16a
callq 0x1707c
cmpq %rax, %rbx
je 0x3acc
leaq 0x188e1(%rip), %rdi     # 0x1c16d
callq 0x1707c
cmpq %rax, %rbx
je 0x3ad5
movq %rbx, %rdi
callq 0x3fcf
jmp 0x3946
movq 0x1faea(%rip), %rbx     # 0x23398
leaq 0x1fa7b(%rip), %r14     # 0x23330
jmp 0x3959
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 0x38c0
cmpl $-0x1, %r15d
je 0x393e
andl $0x2000, %eax           # imm = 0x2000
jne 0x393e
testl %r15d, %r15d
je 0x3ab0
leaq 0x18834(%rip), %rdi     # 0x1c15c
movl $0x4, %edx
movl %r15d, %esi
callq 0x2150
testq %rax, %rax
je 0x3ab0
movq %r13, %rdi
callq 0x3e58
movq %rax, %rbx
jmp 0x3adc
movq %rbx, %rdi
callq 0x19ba6
movq %rax, %rbx
leaq 0x1ffd0(%rip), %r13     # 0x23930
cmpl $0x0, (%r13)
je 0x39a9
movq (%r14), %rax
movq 0x50(%rax), %rax
leaq 0x187ce(%rip), %rdi     # 0x1c143
movq %rdi, 0x10(%rax)
callq 0x1b084
testl %eax, %eax
je 0x39a9
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0xac1, 0xc(%rax)       # imm = 0xAC1
movq %rbx, %rdi
callq 0x13b9c
leaq 0x1879a(%rip), %rdi     # 0x1c139
movq %rax, %rsi
xorl %eax, %eax
callq 0x1b983
cmpl $0x0, (%r13)
je 0x39f2
movq (%r14), %rax
movq 0x50(%rax), %rax
leaq 0x18785(%rip), %rdi     # 0x1c143
movq %rdi, 0x10(%rax)
callq 0x1b084
testl %eax, %eax
je 0x39f2
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0xac2, 0xc(%rax)       # imm = 0xAC2
movq %r15, %rdi
callq 0x13b9c
leaq 0x18756(%rip), %rdi     # 0x1c13e
movq %rax, %rsi
xorl %eax, %eax
callq 0x1b983
cmpq 0x1f5c7(%rip), %r15     # 0x22fc0
je 0x3a5e
testq %r15, %r15
je 0x3a5e
movl %r15d, %eax
andl $0x3, %eax
jne 0x3a5e
leaq 0x143(%rip), %r14       # 0x3b52
leaq 0x1f88a(%rip), %rbp     # 0x232a0
movq 0x1f983(%rip), %r12     # 0x233a0
movq %r15, %rdi
callq 0x19ba6
movq %rax, %rdi
movq %rbx, %rsi
callq 0x19b84
movq %r12, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x1283a
movq %rax, %rbx
movq %r15, %rdi
callq 0x19c45
cmpq %rbp, %rax
je 0x3a5e
movq %rax, %r15
testq %rax, %rax
je 0x3a5e
movl %r15d, %eax
andl $0x3, %eax
je 0x3a16
cmpl $0x0, (%r13)
je 0x3adc
leaq 0x1f8c4(%rip), %r14     # 0x23330
movq (%r14), %rax
movq 0x50(%rax), %rax
leaq 0x186c9(%rip), %rdi     # 0x1c143
movq %rdi, 0x10(%rax)
callq 0x1b084
testl %eax, %eax
je 0x3adc
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0xac7, 0xc(%rax)       # imm = 0xAC7
movq %rbx, %rdi
callq 0x13b9c
leaq 0x18695(%rip), %rdi     # 0x1c139
movq %rax, %rsi
xorl %eax, %eax
callq 0x1b983
jmp 0x3adc
sarq $0x1e, %rbx
orq $0x3, %rbx
jmp 0x3adc
movq 0x1f8e7(%rip), %rbx     # 0x233a8
jmp 0x3adc
movq 0x1f8be(%rip), %rbx     # 0x23388
jmp 0x3adc
movq 0x1f8ad(%rip), %rbx     # 0x23380
jmp 0x3adc
movq 0x1f8d4(%rip), %rbx     # 0x233b0
leaq 0x1fe4d(%rip), %rax     # 0x23930
cmpl $0x0, (%rax)
leaq 0x1f843(%rip), %r14     # 0x23330
je 0x3b31
movq (%r14), %rax
movq 0x50(%rax), %rax
leaq 0x1a229(%rip), %rdi     # 0x1dd26
movq %rdi, 0x10(%rax)
callq 0x1b084
testl %eax, %eax
je 0x3b31
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0xb07, 0xc(%rax)       # imm = 0xB07
movq %rbx, %rdi
callq 0x13b9c
leaq 0x19a2d(%rip), %rdi     # 0x1d554
movq %rax, %rsi
xorl %eax, %eax
callq 0x1b983
movq %rsp, %rdi
movl $0xb08, 0xc(%rdi)       # imm = 0xB08
callq 0x1ba97
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq