// File: /workspace/github_c_makefile_star2_O2/eiselekd[P]MinimalLisp/./l1.c
// Function: scan
v *
scan(ctx *cctx, char *m) {
    unsigned long scanquote = 0, scaneval = 0; int nextquote, quote = 0;
    char *lft;
    int c; v *cl = mkCons(0,0), *v, *n, *r;
    long val;
    while((c = *m)) {
        nextquote = scanquote & 1;
        switch (c) {
        case '.':
            break;
        case '(':
            cl = mkCons(0,cl);
            scanquote <<= 1;
	    scaneval <<= 1;
            scanquote |= quote; nextquote = quote;
            break;
        case ')':
            v = car(cl);
            cl = cdr(cl);
            r = nreverse(v);
            rplaca_q(cl,mkCons(r,car(cl)),quote && !(scaneval&1));
            quote = !(scaneval&1);
	    scaneval >>= 1;
	    scanquote >>= 1;
	    nextquote = scanquote & 1;
            break;
        case '0': case '1': case '2': case '3': case '4': case '5':
        case '6': case '7': case '8': case '9': 
        num:
            val = strtol(m, &m, 0); m--;
            rplaca_q(cl,mkCons(mkInt(val),car(cl)),quote);
            break;
        case ' ': case '\n': case '\t': 
            break;
        case '\'':
            nextquote = 1;
            break;
        case ',':
            nextquote = 0;
            break;
        case '+': case '-': 
            if (!isdigit(m[1])) {
                goto sym;
            } else {
                goto num;
            }
            break;
        default:
#           define SPECIAL "<=!>"
            if (isalpha(c) || strchr(SPECIAL,c)) {
            sym:
                lft = m;
                while (isalnum(c = *++m) || strchr(SPECIAL,c));
                v = unique(cctx, lft, m-lft); m--;
                rplaca_q(cl,mkCons(v,car(cl)),quote);
            } else {
                error("Invalid char '%c'\n", c);
            }
            break;
        }
	scaneval |= (quote?0:1);
        quote = nextquote;
        m++;
    }
    v = sreverse(car(cl));
    return v;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %rbx
movq %rdi, -0x50(%rbp)
leaq -0x40(%rbp), %rax
movq %rsi, (%rax)
xorl %edi, %edi
xorl %esi, %esi
callq 0x1322
xorl %r13d, %r13d
movq %rax, -0x30(%rbp)
xorl %edx, %edx
movq $0x0, -0x38(%rbp)
movsbl (%rbx), %r14d
testl %r14d, %r14d
je 0x269f
movq -0x38(%rbp), %rax
movl %eax, %r15d
andl $0x1, %r15d
movzbl %r14b, %eax
addl $-0x9, %eax
cmpl $0x30, %eax
ja 0x2510
leaq 0x7bc8(%rip), %rcx      # 0xa024
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %rdx, %r12
movq %rbx, %rdi
leaq -0x40(%rbp), %rsi
xorl %edx, %edx
callq 0x10c0
movq -0x40(%rbp), %rbx
decq %rbx
movq %rbx, -0x40(%rbp)
movq %rax, %rdi
callq 0x1343
movq -0x30(%rbp), %r14
testq %r14, %r14
je 0x2498
movq 0x8(%r14), %rsi
jmp 0x249a
xorl %esi, %esi
movq %rax, %rdi
callq 0x1322
testq %r14, %r14
je 0x24ab
movq %rax, 0x8(%r14)
testl %r13d, %r13d
movq %r12, %rdx
je 0x24be
orb $-0x80, (%rax)
pushq $0x1
popq %rax
movl %eax, %r13d
jmp 0x24f2
xorl %r13d, %r13d
jmp 0x24f2
movq %rdx, %r14
callq 0x1180
movq %r14, %rdx
movq %rax, %r12
movq (%rax), %rax
movsbq 0x1(%rbx), %rcx
testb $0x8, 0x1(%rax,%rcx,2)
jne 0x2465
jmp 0x25a3
xorl %r15d, %r15d
jmp 0x24ee
pushq $0x1
popq %r15
movq -0x30(%rbp), %r14
movq %r14, -0x30(%rbp)
xorl %eax, %eax
testl %r13d, %r13d
sete %al
orq %rax, %rdx
incq %rbx
movq %rbx, -0x40(%rbp)
movl %r15d, %r13d
jmp 0x242d
movq %r13, -0x48(%rbp)
movq %rdx, %r13
callq 0x1180
movq %rax, %r12
movq (%rax), %rax
movslq %r14d, %rcx
testb $0x4, 0x1(%rax,%rcx,2)
jne 0x259c
leaq 0x7c3a(%rip), %rdi      # 0xa16d
movl %r14d, %esi
pushq $0x5
popq %rdx
callq 0x1090
testq %rax, %rax
movq %r13, %rdx
movq -0x48(%rbp), %r13
jne 0x25a3
jmp 0x26c3
xorl %edi, %edi
movq %rdx, %r14
movq -0x30(%rbp), %rsi
callq 0x1322
movq %r14, %rdx
movq %rax, %r14
movq -0x38(%rbp), %rcx
addq %rcx, %rcx
addq %rdx, %rdx
movl %r13d, %eax
orq %rax, %rcx
movq %rcx, -0x38(%rbp)
movl %r13d, %r15d
jmp 0x24f2
movq -0x30(%rbp), %r15
movq %rdx, %r12
testq %r15, %r15
je 0x2638
movq 0x8(%r15), %r14
movq 0x10(%r15), %r15
jmp 0x263e
movq %r13, %rdx
movq -0x48(%rbp), %r13
movq %r13, -0x48(%rbp)
movq %rdx, -0x58(%rbp)
movq (%r12), %r13
leaq 0x1(%rbx), %r12
pushq $0x1
popq %r14
movsbq (%r12), %rsi
testb $0x8, (%r13,%rsi,2)
jne 0x25d8
leaq 0x7ba2(%rip), %rdi      # 0xa16d
pushq $0x5
popq %rdx
callq 0x1090
testq %rax, %rax
je 0x25e0
incq %r12
incl %r14d
jmp 0x25b7
movq %r12, -0x40(%rbp)
movq -0x50(%rbp), %rdi
movq %rbx, %rsi
movl %r14d, %edx
callq 0x2260
movq -0x30(%rbp), %r14
testq %r14, %r14
je 0x2602
movq 0x8(%r14), %rsi
jmp 0x2604
xorl %esi, %esi
movq %rax, %rdi
callq 0x1322
testq %r14, %r14
je 0x2615
movq %rax, 0x8(%r14)
decq %r12
cmpl $0x0, -0x48(%rbp)
movq -0x58(%rbp), %rdx
je 0x262d
orb $-0x80, (%rax)
movq %r12, %rbx
jmp 0x24b6
xorl %r13d, %r13d
movq %r12, %rbx
jmp 0x24f2
xorl %r14d, %r14d
xorl %r15d, %r15d
movq %r14, %rdi
callq 0x234f
testq %r15, %r15
je 0x2651
movq 0x8(%r15), %rsi
jmp 0x2653
xorl %esi, %esi
movq %r14, %rdi
callq 0x1322
testl %r13d, %r13d
sete %cl
testq %r15, %r15
movq %r15, %r14
je 0x266d
movq %rax, 0x8(%r14)
movq %r12, %rdx
orb %dl, %cl
testb $0x1, %cl
jne 0x267a
orb $-0x80, (%rax)
movl %edx, %r13d
andl $0x1, %r13d
xorl $0x1, %r13d
shrq %rdx
movq -0x38(%rbp), %rcx
shrq %rcx
movq %rcx, -0x38(%rbp)
movl %ecx, %r15d
andl $0x1, %r15d
jmp 0x24f2
movq -0x30(%rbp), %rax
testq %rax, %rax
je 0x26ae
movq 0x8(%rax), %rdi
jmp 0x26b0
xorl %edi, %edi
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x23d1
leaq 0x7aa8(%rip), %rdi      # 0xa172
movl %r14d, %esi
xorl %eax, %eax
callq 0x128c