// File: /workspace/github_c_makefile_star2_O0/simh[P]simtools/crossassemblers/macro11/parse.c
// Function: get_symbol
char           *get_symbol(
    char *cp,
    char **endp,
    int *islocal)
{
    int             len;
    char           *symcp;
    int             digits = 0;

    cp = skipwhite(cp);                /* Skip leading whitespace */

    if (!issym((unsigned char)*cp))
        return NULL;

    digits = 0;
    if (isdigit((unsigned char)*cp))
        digits = 2;                    /* Think about digit count */

    for (symcp = cp + 1; issym((unsigned char)*symcp); symcp++) {
        if (!isdigit((unsigned char)*symcp)) /* Not a digit? */
            digits--;                  /* Make a note. */
    }

    if (digits == 2)
        return NULL;                   /* Not a symbol, it's a digit string */

    if (endp)
        *endp = symcp;

    len = (int) (symcp - cp);

    /* Now limit length */
    if (len > symbol_len)
        len = symbol_len;

    symcp = memcheck(malloc(len + 1));

    memcpy(symcp, cp, len);
    symcp[len] = 0;
    upcase(symcp);

    if (islocal) {
        *islocal = 0;

        /* Turn to local label format */
        if (digits == 1) {
            if (symcp[len - 1] == '$') {
                char           *newsym = memcheck(malloc(32));  /* Overkill */

                sprintf(newsym, "%ld$%d", strtol(symcp, NULL, 10), lsb);
                if (enabl_debug && lstfile) {
                    fprintf(lstfile, "lsb %d: %s -> %s\n",
                            lsb, symcp, newsym);
                }
                free(symcp);
                symcp = newsym;
                if (islocal)
                    *islocal = SYMBOLFLAG_LOCAL;
                lsb_used++;
            } else {
                free(symcp);
                return NULL;
            }
        }
    } else {
        /* disallow local label format */
        if (isdigit((unsigned char)*symcp)) {
            free(symcp);
            return NULL;
        }
    }

    return symcp;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl $0x0, -0x34(%rbp)
movq -0x10(%rbp), %rdi
callq 0xb9e0
movq %rax, -0x10(%rbp)
callq 0x22e0
movq (%rax), %rax
movq -0x10(%rbp), %rcx
movzbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
jne 0xc005
callq 0x22e0
movq (%rax), %rax
movq -0x10(%rbp), %rcx
movzbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
jne 0xc005
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x2e, %eax
je 0xc005
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x24, %eax
je 0xc005
leaq 0xf6b9(%rip), %rax      # 0x1b6a0
cmpl $0x0, (%rax)
je 0xbff8
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x5f, %eax
je 0xc005
movq $0x0, -0x8(%rbp)
jmp 0xc2fc
movl $0x0, -0x34(%rbp)
callq 0x22e0
movq (%rax), %rax
movq -0x10(%rbp), %rcx
movzbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
je 0xc033
movl $0x2, -0x34(%rbp)
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
callq 0x22e0
movq (%rax), %rax
movq -0x30(%rbp), %rcx
movzbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %ecx
andl $0x400, %ecx            # imm = 0x400
movb $0x1, %al
cmpl $0x0, %ecx
movb %al, -0x41(%rbp)
jne 0xc0d4
callq 0x22e0
movq (%rax), %rax
movq -0x30(%rbp), %rcx
movzbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %ecx
andl $0x800, %ecx            # imm = 0x800
movb $0x1, %al
cmpl $0x0, %ecx
movb %al, -0x41(%rbp)
jne 0xc0d4
movq -0x30(%rbp), %rax
movzbl (%rax), %ecx
movb $0x1, %al
cmpl $0x2e, %ecx
movb %al, -0x41(%rbp)
je 0xc0d4
movq -0x30(%rbp), %rax
movzbl (%rax), %ecx
movb $0x1, %al
cmpl $0x24, %ecx
movb %al, -0x41(%rbp)
je 0xc0d4
xorl %eax, %eax
leaq 0xf5ea(%rip), %rcx      # 0x1b6a0
cmpl $0x0, (%rcx)
movb %al, -0x42(%rbp)
je 0xc0ce
movq -0x30(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x5f, %eax
sete %al
movb %al, -0x42(%rbp)
movb -0x42(%rbp), %al
movb %al, -0x41(%rbp)
movb -0x41(%rbp), %al
testb $0x1, %al
jne 0xc0dd
jmp 0xc119
callq 0x22e0
movq (%rax), %rax
movq -0x30(%rbp), %rcx
movzbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
jne 0xc106
movl -0x34(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xc108
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0xc03f
cmpl $0x2, -0x34(%rbp)
jne 0xc12c
movq $0x0, -0x8(%rbp)
jmp 0xc2fc
cmpq $0x0, -0x18(%rbp)
je 0xc13e
movq -0x30(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x30(%rbp), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
leaq 0xd982(%rip), %rcx      # 0x19ad8
cmpl (%rcx), %eax
jle 0xc166
leaq 0xd977(%rip), %rax      # 0x19ad8
movl (%rax), %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdi
callq 0x2220
movq %rax, %rdi
callq 0x136a0
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rsi
movslq -0x24(%rbp), %rdx
callq 0x2200
movq -0x30(%rbp), %rax
movslq -0x24(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movq -0x30(%rbp), %rdi
callq 0x13720
cmpq $0x0, -0x20(%rbp)
je 0xc2bf
movq -0x20(%rbp), %rax
movl $0x0, (%rax)
cmpl $0x1, -0x34(%rbp)
jne 0xc2bd
movq -0x30(%rbp), %rax
movl -0x24(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x24, %eax
jne 0xc2a8
movl $0x20, %edi
callq 0x2220
movq %rax, %rdi
callq 0x136a0
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x30(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0xa, %edx
callq 0x21f0
movq -0x50(%rbp), %rdi
movq %rax, %rdx
leaq 0xd96b(%rip), %rax      # 0x19b88
movl (%rax), %ecx
leaq 0x94de(%rip), %rsi      # 0x15704
movb $0x0, %al
callq 0x22a0
leaq 0xd964(%rip), %rax      # 0x19b98
cmpl $0x0, (%rax)
je 0xc26f
leaq 0xf440(%rip), %rax      # 0x1b680
cmpq $0x0, (%rax)
je 0xc26f
leaq 0xf433(%rip), %rax      # 0x1b680
movq (%rax), %rdi
leaq 0xd931(%rip), %rax      # 0x19b88
movl (%rax), %edx
movq -0x30(%rbp), %rcx
movq -0x40(%rbp), %r8
leaq 0x94a3(%rip), %rsi      # 0x1570b
movb $0x0, %al
callq 0x21c0
movq -0x30(%rbp), %rdi
callq 0x2040
movq -0x40(%rbp), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0xc291
movq -0x20(%rbp), %rax
movl $0x20, (%rax)
leaq 0xd8f4(%rip), %rax      # 0x19b8c
movl (%rax), %ecx
addl $0x1, %ecx
leaq 0xd8e8(%rip), %rax      # 0x19b8c
movl %ecx, (%rax)
jmp 0xc2bb
movq -0x30(%rbp), %rdi
callq 0x2040
movq $0x0, -0x8(%rbp)
jmp 0xc2fc
jmp 0xc2bd
jmp 0xc2f4
callq 0x22e0
movq (%rax), %rax
movq -0x30(%rbp), %rcx
movzbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
je 0xc2f2
movq -0x30(%rbp), %rdi
callq 0x2040
movq $0x0, -0x8(%rbp)
jmp 0xc2fc
jmp 0xc2f4
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)