// File: /workspace/github_c_makefile_star2_O2/BernardTatin[P]s7sh/s7.c
// Function: read_sharp
static token_t read_sharp(s7_scheme *sc, s7_pointer pt)
                {
                    int32_t c;
                    /* inchar can return EOF, so it can't be used directly as an index into the digits array */
                    c = inchar(pt);
                    switch (c)
                    {
                        case EOF:
                            s7_error(sc, sc->read_error_symbol, set_elist_1(sc, wrap_string(sc, "unexpected '#' at end of input", 30)));
                            break;

                        case '(':
                            sc->w = small_int(1);
                            return(TOKEN_VECTOR);

                        case 'i':
                            if (read_sharp(sc, pt) == TOKEN_VECTOR)
                                return(TOKEN_INT_VECTOR);
                            backchar('i', pt);
                            break;

                        case 'r':
                            if (read_sharp(sc, pt) == TOKEN_VECTOR)
                                return(TOKEN_FLOAT_VECTOR);
                            backchar('r', pt);
                            break;

                        case 'u':
                            if (s7_peek_char(sc, pt) == chars['8']) /* backwards compatibility: #u8(...) == #u(...) */
                            {
                                int32_t bc;
                                bc = inchar(pt);
                                if (s7_peek_char(sc, pt) == chars['('])
                                {
                                    inchar(pt);
                                    sc->w = small_int(1);
                                    return(TOKEN_BYTE_VECTOR);
                                }
                                backchar(bc, pt);
                            }
                            if (read_sharp(sc, pt) == TOKEN_VECTOR)
                                return(TOKEN_BYTE_VECTOR);
                            backchar('u', pt);
                            break;

                        case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9':
                            {
                                /* here we can get an overflow: #1231231231231232131D() */
                                s7_int dims;
                                int32_t d, loc = 0;
                                sc->strbuf[loc++] = (unsigned char)c;
                                dims = digits[c];

                                while (true)
                                {
                                    s7_int dig;
                                    d = inchar(pt);
                                    if (d == EOF)
                                        s7_error(sc, sc->read_error_symbol,
                                                set_elist_1(sc, wrap_string(sc, "unexpected end of input while reading #n...", 43)));

                                    dig = digits[d];
                                    if (dig >= 10) break;
                                    dims = dig + (dims * 10);
                                    if ((dims <= 0) ||
                                            (dims > S7_SHORT_MAX))
                                        s7_error(sc, sc->read_error_symbol,
                                                set_elist_2(sc, wrap_string(sc, "overflow while reading #nD: ~A", 30), wrap_integer1(sc, dims)));
                                    sc->strbuf[loc++] = (unsigned char)d;
                                }
                                sc->strbuf[loc++] = d;
                                if ((d == 'd') || (d == 'i') || (d == 'r') || (d == 'u'))
                                {
                                    int32_t e;
                                    e = inchar(pt);
                                    if (e == EOF)
                                        s7_error(sc, sc->read_error_symbol,
                                                set_elist_1(sc, wrap_string(sc, "unexpected end of input while reading #n()", 42)));
                                    sc->strbuf[loc++] = (unsigned char)e;
                                    if (e == '(')
                                    {
                                        sc->w = make_integer(sc, dims);
                                        if (d == 'd') return(TOKEN_VECTOR);
                                        if (d == 'r') return(TOKEN_FLOAT_VECTOR);
                                        if (d == 'u') return(TOKEN_BYTE_VECTOR);
                                        return(TOKEN_INT_VECTOR);
                                    }
                                }
                                /* try to back out */
                                for (d = loc - 1; d > 0; d--)
                                    backchar(sc->strbuf[d], pt);
                            }
                            break;

                        case ':':  /* turn #: into : -- this is for compatibility with Guile, sigh.
                                    *   I just noticed that Rick is using this -- I'll just leave it alone.
                                    *   but that means : readers need to handle this case specially.
                                    * I don't think #! is special anymore -- maybe remove that code?
                                    */
                            sc->strbuf[0] = ':';
                            return(TOKEN_ATOM);

                            /* block comments in #! ... !# */
                            /* this is needed when an input file is treated as a script:
#!/home/bil/cl/snd
!#
(format #t "a test~%")
(exit)
                             * but very often the closing !# is omitted which is too bad
                             */
                        case '!':
                            {
                                char last_char;
                                s7_pointer reader;

                                /* make it possible to override #! handling */
                                for (reader = slot_value(sc->sharp_readers); is_pair(reader); reader = cdr(reader))
                                    if (s7_character(caar(reader)) == '!')
                                    {
                                        sc->strbuf[0] = (unsigned char)c;
                                        return(TOKEN_SHARP_CONST); /* next stage notices any errors */
                                    }

                                /* not #! as block comment (for Guile I guess) */
                                last_char = ' ';
                                while ((c = inchar(pt)) != EOF)
                                {
                                    if ((c == '#') &&
                                            (last_char == '!'))
                                        break;
                                    last_char = c;
                                }
                                if (c == EOF)
                                    s7_error(sc, sc->read_error_symbol,
                                            set_elist_1(sc, wrap_string(sc, "unexpected end of input while reading #!", 40)));
                                return(token(sc));
                            }

                            /* block comments in #| ... |#
                             *   since we ignore everything until the |#, internal semicolon comments are ignored,
                             *   meaning that ;|# is as effective as |#
                             */
                        case '|':
                            {
                                if (is_file_port(pt))
                                {
                                    char last_char;
                                    last_char = ' ';
                                    while (true)
                                    {
                                        c = fgetc(port_file(pt));
                                        if (c == EOF)
                                            s7_error(sc, sc->read_error_symbol,
                                                    set_elist_1(sc, wrap_string(sc, "unexpected end of input while reading #|", 40)));
                                        if ((c == '#') &&
                                                (last_char == '|'))
                                            break;
                                        last_char = c;
                                        if (c == '\n')
                                            port_line_number(pt)++;
                                    }
                                    return(token(sc));
                                }
                                else
                                {
                                    const char *str, *orig_str, *p, *pend;

                                    orig_str = (const char *)(port_data(pt) + port_position(pt));
                                    pend = (const char *)(port_data(pt) + port_data_size(pt));
                                    str = orig_str;

                                    while (true)
                                    {
                                        p = strchr(str, (int)'|');
                                        if ((!p) || (p >= pend))
                                        {
                                            port_position(pt) = port_data_size(pt);
                                            s7_error(sc, sc->read_error_symbol,
                                                    set_elist_1(sc, wrap_string(sc, "unexpected end of input while reading #|", 40)));
                                        }
                                        if (p[1] == '#')
                                            break;
                                        str = (const char *)(p + 1);
                                    }
                                    port_position(pt) += (p - orig_str + 2);

                                    /* now count newline inside the comment */
                                    str = (const char *)orig_str;
                                    pend = p;
                                    while (true)
                                    {
                                        p = strchr(str, (int)'\n');
                                        if ((p) && (p < pend))
                                        {
                                            port_line_number(pt)++;
                                            str = (char *)(p + 1);
                                        }
                                        else break;
                                    }
                                    return(token(sc));
                                }
                            }
                    }
                    sc->strbuf[0] = (unsigned char)c;
                    return(TOKEN_SHARP_CONST); /* next stage notices any errors */
                }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r12
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x74d4a
movl %eax, %r13d
leal -0x21(%r13), %eax
cmpl $0x19, %eax
movq %r12, 0x8(%rsp)
ja 0x748e0
leaq 0x5f820(%rip), %rcx     # 0xd3f00
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x4b0(%rbx), %rax
movb %r13b, (%rax)
movq %r13, 0x10(%rsp)
movl %r13d, %eax
leaq 0xaff5e(%rip), %rbp     # 0x124660
movslq (%rbp,%rax,4), %r13
pushq $0x1
popq %r15
movq $-0x8000, %r14          # imm = 0x8000
movq 0x8(%rsp), %rdi
callq 0x74d4a
movl %eax, %r12d
cmpl $-0x1, %eax
jne 0x74775
movq 0x1908(%rbx), %rsi
movq 0x820(%rbx), %rax
movslq 0x7dc(%rbx), %rcx
movq (%rax,%rcx,8), %rax
incl %ecx
andl $0x7, %ecx
movl %ecx, 0x7dc(%rbx)
leaq 0x6e0c7(%rip), %rcx     # 0xe2816
movq %rcx, 0x10(%rax)
movq $0x2b, 0x8(%rax)
movq 0x6d8(%rbx), %rcx
movq %rax, 0x8(%rcx)
movq 0x6d8(%rbx), %rdx
movq %rbx, %rdi
callq 0x2cdc0
movslq %r12d, %rax
movslq (%rbp,%rax,4), %rax
cmpq $0x9, %rax
jg 0x7481c
imulq $0xa, %r13, %r13
addq %rax, %r13
leaq (%r14,%r13), %rax
cmpq %r14, %rax
ja 0x74809
movq 0x1908(%rbx), %rsi
movq 0x820(%rbx), %rax
movslq 0x7dc(%rbx), %rcx
movq (%rax,%rcx,8), %rax
incl %ecx
andl $0x7, %ecx
movl %ecx, 0x7dc(%rbx)
leaq 0x6e080(%rip), %rcx     # 0xe2842
movq %rcx, 0x10(%rax)
movq $0x1e, 0x8(%rax)
movq 0x1f00(%rbx), %rcx
movq %r13, 0x8(%rcx)
movq 0x1f00(%rbx), %rcx
movq 0x6e0(%rbx), %rdx
movq %rax, 0x8(%rdx)
movq 0x6e0(%rbx), %rax
movq 0x10(%rax), %rax
movq %rcx, 0x8(%rax)
movq 0x6e0(%rbx), %rdx
movq %rbx, %rdi
callq 0x2cdc0
movq 0x4b0(%rbx), %rax
movb %r12b, (%rax,%r15)
incq %r15
jmp 0x74712
movq 0x4b0(%rbx), %rax
leaq 0x1(%r15), %r14
movl %r15d, %ecx
movb %r12b, (%rax,%rcx)
leal -0x64(%r12), %eax
cmpl $0x11, %eax
ja 0x7496f
movl $0x24021, %ecx          # imm = 0x24021
btl %eax, %ecx
jae 0x7496f
movq 0x8(%rsp), %rdi
callq 0x74d4a
movl %eax, %ebp
cmpl $-0x1, %eax
jne 0x748ac
movq 0x1908(%rbx), %rsi
movq 0x820(%rbx), %rax
movslq 0x7dc(%rbx), %rcx
movq (%rax,%rcx,8), %rax
incl %ecx
andl $0x7, %ecx
movl %ecx, 0x7dc(%rbx)
leaq 0x6dfdb(%rip), %rcx     # 0xe2861
movq %rcx, 0x10(%rax)
movq $0x2a, 0x8(%rax)
movq 0x6d8(%rbx), %rcx
movq %rax, 0x8(%rcx)
movq 0x6d8(%rbx), %rdx
movq %rbx, %rdi
callq 0x2cdc0
movq 0x4b0(%rbx), %rax
movl %r14d, %ecx
movb %bpl, (%rax,%rcx)
cmpl $0x28, %ebp
jne 0x74968
cmpq $0x7ff, %r13            # imm = 0x7FF
ja 0x749a0
leaq 0xa1079(%rip), %rax     # 0x115950
movq (%rax,%r13,8), %rax
jmp 0x749d9
cmpl $0x7c, %r13d
je 0x74af3
cmpl $0x69, %r13d
je 0x74a52
cmpl $0x72, %r13d
je 0x74ad8
cmpl $0x75, %r13d
je 0x74a6d
cmpl $-0x1, %r13d
jne 0x74c1b
movq 0x1908(%rbx), %rsi
movq 0x820(%rbx), %rax
movslq 0x7dc(%rbx), %rcx
movq (%rax,%rcx,8), %rax
incl %ecx
andl $0x7, %ecx
movl %ecx, 0x7dc(%rbx)
leaq 0x6deba(%rip), %rcx     # 0xe27f7
movq %rcx, 0x10(%rax)
movq $0x1e, 0x8(%rax)
movq 0x6d8(%rbx), %rcx
movq %rax, 0x8(%rcx)
movq 0x6d8(%rbx), %rdx
movq %rbx, %rdi
callq 0x2cdc0
jmp 0x74c1b
addq $0x2, %r15
movl %r15d, %r14d
movl %r14d, %r14d
movq 0x8(%rsp), %r15
movq 0x10(%rsp), %r13
cmpl $0x2, %r14d
jl 0x74c1b
movq 0x4b0(%rbx), %rax
movsbl -0x1(%rax,%r14), %edi
decq %r14
movq %r15, %rsi
callq 0xdf3a
jmp 0x7497c
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x749bf
movq %rbx, %rdi
callq 0x9c27
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rax
movq $0xb, (%rax)
movq %r13, 0x8(%rax)
movq %rax, 0x4d8(%rbx)
cmpl $0x64, %r12d
je 0x74a1a
cmpl $0x75, %r12d
je 0x74d43
cmpl $0x72, %r12d
jne 0x74a66
jmp 0x74aec
movq 0x4b0(%rbx), %rax
movb $0x3a, (%rax)
pushq $0x4
jmp 0x74c27
movq 0xa0f45(%rip), %rax     # 0x115958
movq %rax, 0x4d8(%rbx)
pushq $0xb
jmp 0x74c27
movq 0x1e0(%rbx), %rax
movq 0x10(%rax), %rax
cmpb $0x1, (%rax)
jne 0x74be1
movq 0x8(%rax), %rcx
movq 0x8(%rcx), %rcx
cmpb $0x21, 0x8(%rcx)
jne 0x74a28
movq 0x4b0(%rbx), %rax
movb $0x21, (%rax)
jmp 0x74c25
movq %rbx, %rdi
movq %r12, %rsi
callq 0x746a8
cmpl $0xb, %eax
jne 0x74c0c
pushq $0xd
jmp 0x74c27
movq %rbx, %rdi
movq %r12, %rsi
callq 0xdec8
movq 0xa4fd9(%rip), %rcx     # 0x119a58
cmpq 0x1c0(%rcx), %rax
jne 0x74abd
movq %r12, %rdi
callq 0x74d4a
movl %eax, %ebp
movq %rbx, %rdi
movq %r12, %rsi
callq 0xdec8
movq 0xa4fb4(%rip), %rcx     # 0x119a58
cmpq 0x140(%rcx), %rax
je 0x74d2d
movsbl %bpl, %edi
movq %r12, %rsi
callq 0xdf3a
movq %rbx, %rdi
movq %r12, %rsi
callq 0x746a8
cmpl $0xb, %eax
je 0x74d43
pushq $0x75
jmp 0x74c12
movq %rbx, %rdi
movq %r12, %rsi
callq 0x746a8
cmpl $0xb, %eax
jne 0x74c10
pushq $0xe
jmp 0x74c27
movq 0x8(%r12), %rax
cmpl $0x0, 0x4(%rax)
je 0x74c37
movq 0x10(%r12), %r14
movq 0x20(%r12), %r15
addq %r14, %r15
addq 0x18(%r12), %r14
pushq $0x7c
popq %rbp
leaq 0x6dd97(%rip), %r13     # 0xe28b5
movq %r15, %rdi
movl %ebp, %esi
callq 0x81d0
movq %rax, %r12
testq %rax, %rax
je 0x74b35
cmpq %r14, %r12
jb 0x74b8c
movq 0x8(%rsp), %rcx
movq 0x18(%rcx), %rax
movq %rax, 0x20(%rcx)
movq 0x1908(%rbx), %rsi
movq 0x820(%rbx), %rax
movslq 0x7dc(%rbx), %rcx
movq (%rax,%rcx,8), %rax
incl %ecx
andl $0x7, %ecx
movl %ecx, 0x7dc(%rbx)
movq %r13, 0x10(%rax)
movq $0x28, 0x8(%rax)
movq 0x6d8(%rbx), %rcx
movq %rax, 0x8(%rcx)
movq 0x6d8(%rbx), %rdx
movq %rbx, %rdi
callq 0x2cdc0
leaq 0x1(%r12), %rdi
cmpb $0x23, 0x1(%r12)
jne 0x74b21
movq 0x8(%rsp), %r14
movq 0x20(%r14), %rax
movq %r12, %rcx
subq %r15, %rcx
addq %rcx, %rax
addq $0x2, %rax
movq %rax, 0x20(%r14)
pushq $0xa
popq %rbp
movq %r15, %rdi
movl %ebp, %esi
callq 0x81d0
testq %rax, %rax
je 0x74d17
movq %rax, %r15
cmpq %r12, %rax
jae 0x74d17
movq 0x8(%r14), %rax
incl 0x20(%rax)
incq %r15
jmp 0x74bb6
pushq $0x20
popq %rbp
movq %r12, %rdi
callq 0x74d4a
cmpl $-0x1, %eax
je 0x74cc6
movl %eax, %ecx
xorl $0x23, %ecx
movzbl %bpl, %edx
xorl $0x21, %edx
orl %ecx, %edx
movl %eax, %ebp
jne 0x74be4
jmp 0x74d17
pushq $0x69
jmp 0x74c12
pushq $0x72
popq %rdi
movq %r12, %rsi
callq 0xdf3a
movq 0x4b0(%rbx), %rax
movb %r13b, (%rax)
pushq $0xa
popq %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x20
popq %r15
leaq 0x6dc73(%rip), %r14     # 0xe28b5
movq 0x8(%rax), %rdi
callq 0x8290
movl %eax, %ebp
cmpl $-0x1, %eax
jne 0x74c9c
movq 0x1908(%rbx), %rsi
movq 0x820(%rbx), %rax
movslq 0x7dc(%rbx), %rcx
movq (%rax,%rcx,8), %rax
incl %ecx
andl $0x7, %ecx
movl %ecx, 0x7dc(%rbx)
movq %r14, 0x10(%rax)
movq $0x28, 0x8(%rax)
movq 0x6d8(%rbx), %rcx
movq %rax, 0x8(%rcx)
movq 0x6d8(%rbx), %rdx
movq %rbx, %rdi
callq 0x2cdc0
movl %ebp, %eax
xorl $0x23, %eax
movzbl %r15b, %ecx
xorl $0x7c, %ecx
orl %eax, %ecx
je 0x74d17
cmpl $0xa, %ebp
jne 0x74cb9
movq 0x8(%r12), %rax
incl 0x20(%rax)
movq 0x8(%r12), %rax
movl %ebp, %r15d
jmp 0x74c42
movq 0x1908(%rbx), %rsi
movq 0x820(%rbx), %rax
movslq 0x7dc(%rbx), %rcx
movq (%rax,%rcx,8), %rax
incl %ecx
andl $0x7, %ecx
movl %ecx, 0x7dc(%rbx)
leaq 0x6db9b(%rip), %rcx     # 0xe288c
movq %rcx, 0x10(%rax)
movq $0x28, 0x8(%rax)
movq 0x6d8(%rbx), %rcx
movq %rax, 0x8(%rcx)
movq 0x6d8(%rbx), %rdx
movq %rbx, %rdi
callq 0x2cdc0
movq %rbx, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x7456a
movq %r12, %rdi
callq 0x74d4a
movq 0xa0c1c(%rip), %rax     # 0x115958
movq %rax, 0x4d8(%rbx)
pushq $0xc
jmp 0x74c27