// File: enferex[P]fnplot/cs.cc
// Function: loadSymbolsInFile(CSFile*, pos_t*, long)
static void loadSymbolsInFile(
    CSFile *file,
    pos_t  *pos,
    long    lineno)
{
    char line[1024], *c, mark;

    // Suck in only function calls or definitions for this lineno
    while (VALID(pos)) {
        // Skip <non-symbol text> and obtain:
        //
        // <optional mark><symbol text>
        // This will be <blank> if end of symbol data.
        getLine(pos, line, sizeof(line));
        if (strlen(line) == 0)
          break;

        c = line;

        // Skip spaces and not tabs
        while (*c == ' ')
          ++c;

        // <optional mark>
        mark = 0;
        if (c[0] == '\t' && isMark(c[1])) {
            mark = c[1];
            c += 2;
        }

        // Only accept function definitions or function calls
        if (!mark || (mark != CS_FN_DEF && mark != CS_FN_CALL))
          continue;

        // Skip lines only containing mark characters
        if (isMark(c[0]) && strlen(c+1) == 0)
          continue;

        if (mark == CS_FN_CALL) {
            CSFuncDef *fndef = file->getCurrentFunction();

            // This is probably a macro
            if (!fndef)
              continue;

            // We always allocate a new symbol
            // so the next pointer for a call will be used as a
            // list of all calls that the function defintiion makes.
            fndef->addCallee(new CSFuncCall(c, mark, lineno, file));
        }
        else if (mark == CS_FN_DEF) {
            // Add fn definition to file: Most recently defined is first
            file->addFunctionDef(new CSFuncDef(c, mark, lineno, file));
        }

        if (strlen(c) == 0)
          continue;

        // <non-symbol text>
        getLine(pos, line, sizeof(line));
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x470, %rsp            # imm = 0x470
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq -0x10(%rbp), %rcx
cmpq 0x8(%rcx), %rax
ja 0x3e06
movq -0x10(%rbp), %rdi
leaq -0x420(%rbp), %rsi
movl $0x400, %edx            # imm = 0x400
callq 0x3760
leaq -0x420(%rbp), %rdi
callq 0x2100
cmpq $0x0, %rax
jne 0x3bc8
jmp 0x3e06
leaq -0x420(%rbp), %rax
movq %rax, -0x428(%rbp)
movq -0x428(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x20, %eax
jne 0x3bf9
movq -0x428(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x428(%rbp)
jmp 0x3bd6
movb $0x0, -0x429(%rbp)
movq -0x428(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x9, %eax
jne 0x3c47
movq -0x428(%rbp), %rax
movsbl 0x1(%rax), %edi
callq 0x3e20
testb $0x1, %al
jne 0x3c25
jmp 0x3c47
movq -0x428(%rbp), %rax
movb 0x1(%rax), %al
movb %al, -0x429(%rbp)
movq -0x428(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x428(%rbp)
cmpb $0x0, -0x429(%rbp)
je 0x3c68
movsbl -0x429(%rbp), %eax
cmpl $0x24, %eax
je 0x3c6d
movsbl -0x429(%rbp), %eax
cmpl $0x60, %eax
je 0x3c6d
jmp 0x3b87
movq -0x428(%rbp), %rax
movsbl (%rax), %edi
callq 0x3e20
testb $0x1, %al
jne 0x3c82
jmp 0x3c9d
movq -0x428(%rbp), %rdi
addq $0x1, %rdi
callq 0x2100
cmpq $0x0, %rax
jne 0x3c9d
jmp 0x3b87
movsbl -0x429(%rbp), %eax
cmpl $0x60, %eax
jne 0x3d4e
movq -0x8(%rbp), %rdi
callq 0x7540
movq %rax, -0x438(%rbp)
cmpq $0x0, -0x438(%rbp)
jne 0x3ccc
jmp 0x3b87
movq -0x438(%rbp), %rax
movq %rax, -0x458(%rbp)
movl $0x78, %edi
callq 0x2230
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x450(%rbp)
movq -0x428(%rbp), %rsi
movsbl -0x429(%rbp), %edx
movq -0x18(%rbp), %rcx
movq -0x8(%rbp), %r8
callq 0x7640
jmp 0x3d0e
movq -0x450(%rbp), %rsi
movq -0x458(%rbp), %rdi
callq 0x7560
jmp 0x3dd5
movq -0x450(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x440(%rbp)
movl %eax, -0x444(%rbp)
movl $0x78, %esi
callq 0x2240
jmp 0x3e0f
movsbl -0x429(%rbp), %eax
cmpl $0x24, %eax
jne 0x3dd3
movq -0x8(%rbp), %rax
movq %rax, -0x468(%rbp)
movl $0xb0, %edi
callq 0x2230
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x460(%rbp)
movq -0x428(%rbp), %rsi
movsbl -0x429(%rbp), %edx
movq -0x18(%rbp), %rcx
movq -0x8(%rbp), %r8
callq 0x7790
jmp 0x3d99
movq -0x460(%rbp), %rsi
movq -0x468(%rbp), %rdi
callq 0x76a0
jmp 0x3dd3
movq -0x460(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x440(%rbp)
movl %eax, -0x444(%rbp)
movl $0xb0, %esi
callq 0x2240
jmp 0x3e0f
jmp 0x3dd5
movq -0x428(%rbp), %rdi
callq 0x2100
cmpq $0x0, %rax
jne 0x3dec
jmp 0x3b87
movq -0x10(%rbp), %rdi
leaq -0x420(%rbp), %rsi
movl $0x400, %edx            # imm = 0x400
callq 0x3760
jmp 0x3b87
addq $0x470, %rsp            # imm = 0x470
popq %rbp
retq
movq -0x440(%rbp), %rdi
callq 0x23e0
nopl (%rax,%rax)