// File: /workspace/github_c_makefile_star2_O0/afi-lambda[P]a_little_smalltalk/src/filein.c
// Function: readMethods
static void readMethods(FILE *fd, boolean printit)
{
    object classObj, methTable, theMethod, selector;
# define LINEBUFFERSIZE 512
    char *cp, *eoftest, lineBuffer[LINEBUFFERSIZE];

    if (nextToken() != nameconst)
        sysError("missing name", "following Method keyword");
    classObj = findClass(tokenString);
    setInstanceVariables(classObj);
    if (printit)
        cp = charPtr(basicAt(classObj, nameInClass));

    /* now find or create a method table */
    methTable = basicAt(classObj, methodsInClass);
    if (methTable == nilobj)   /* must make */
    {
        methTable = newDictionary(MethodTableSize);
        basicAtPut(classObj, methodsInClass, methTable);
    }

    /* now go read the methods */
    do
    {
        if (lineBuffer[0] == '|') /* get any left over text */
            strcpy(textBuffer, &lineBuffer[1]);
        else
            textBuffer[0] = '\0';
        while ((eoftest = fgets(lineBuffer, LINEBUFFERSIZE, fd)) != NULL)
        {
            if ((lineBuffer[0] == '|') || (lineBuffer[0] == ']'))
                break;
            strcat(textBuffer, lineBuffer);
        }
        if (eoftest == NULL)
        {
            sysError("unexpected end of file", "while reading method");
            break;
        }

        /* now we have a method */
        theMethod = newMethod();
        if (parse(theMethod, textBuffer, savetext))
        {
            selector = basicAt(theMethod, messageInMethod);
            basicAtPut(theMethod, methodClassInMethod, classObj);
            if (printit)
                dspMethod(cp, charPtr(selector));
            nameTableInsert(methTable, (int) selector, selector, theMethod);
        }
        else
        {
            /* get rid of unwanted method */
            incr(theMethod);
            decr(theMethod);
            givepause();
        }

    }
    while (lineBuffer[0] != ']');
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x250, %rsp            # imm = 0x250
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
callq 0x8710
cmpl $0x1, %eax
je 0x814f
leaq 0x46d5(%rip), %rdi      # 0xc818
leaq 0x46db(%rip), %rsi      # 0xc825
callq 0x63f0
leaq 0x2239a(%rip), %rdi     # 0x2a4f0
callq 0x8640
movw %ax, -0xe(%rbp)
movswl -0xe(%rbp), %edi
callq 0x9150
cmpl $0x0, -0xc(%rbp)
je 0x8204
movswl -0xe(%rbp), %eax
sarl %eax
movslq %eax, %rcx
leaq 0x80de(%rip), %rax      # 0x10260
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movw (%rax), %ax
leaq 0x21719(%rip), %rcx     # 0x298b0
movw %ax, (%rcx)
movswl %ax, %edi
callq 0x2fb0
cmpl $0x0, %eax
je 0x81d1
leaq 0x21702(%rip), %rax     # 0x298b0
movswl (%rax), %eax
sarl %eax
movslq %eax, %rcx
leaq 0x80a3(%rip), %rax      # 0x10260
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq %rax, -0x238(%rbp)
jmp 0x81f9
leaq 0x216d8(%rip), %rax     # 0x298b0
movswl (%rax), %eax
sarl %eax
movslq %eax, %rcx
leaq 0x8079(%rip), %rax      # 0x10260
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq %rax, -0x238(%rbp)
movq -0x238(%rbp), %rax
movq %rax, -0x20(%rbp)
movswl -0xe(%rbp), %eax
sarl %eax
movslq %eax, %rcx
leaq 0x804c(%rip), %rax      # 0x10260
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movw 0x4(%rax), %ax
movw %ax, -0x10(%rbp)
movswl -0x10(%rbp), %eax
cmpl $0x0, %eax
jne 0x8269
movl $0x27, %edi
callq 0x42a0
movw %ax, -0x10(%rbp)
movw -0x10(%rbp), %ax
movswl -0xe(%rbp), %ecx
sarl %ecx
movslq %ecx, %rdx
leaq 0x800e(%rip), %rcx      # 0x10260
shlq $0x4, %rdx
addq %rdx, %rcx
movq 0x8(%rcx), %rcx
movw %ax, 0x4(%rcx)
movswl %ax, %edi
callq 0x2fd0
jmp 0x826b
movsbl -0x230(%rbp), %eax
cmpl $0x7c, %eax
jne 0x8290
leaq -0x230(%rbp), %rsi
addq $0x1, %rsi
leaq 0x21e47(%rip), %rdi     # 0x2a0d0
callq 0x2050
jmp 0x8297
movb $0x0, 0x21e39(%rip)     # 0x2a0d0
jmp 0x8299
leaq -0x230(%rbp), %rdi
movq -0x8(%rbp), %rdx
movl $0x200, %esi            # imm = 0x200
callq 0x2110
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
je 0x82e7
movsbl -0x230(%rbp), %eax
cmpl $0x7c, %eax
je 0x82d0
movsbl -0x230(%rbp), %eax
cmpl $0x5d, %eax
jne 0x82d2
jmp 0x82e7
leaq -0x230(%rbp), %rsi
leaq 0x21df0(%rip), %rdi     # 0x2a0d0
callq 0x21c0
jmp 0x8299
cmpq $0x0, -0x28(%rbp)
jne 0x8306
leaq 0x4549(%rip), %rdi      # 0xc83e
leaq 0x4559(%rip), %rsi      # 0xc855
callq 0x63f0
jmp 0x845e
movb $0x0, %al
callq 0x4570
movw %ax, -0x12(%rbp)
movw -0x12(%rbp), %ax
movl 0x6f4d(%rip), %edx      # 0xf268
leaq 0x21dae(%rip), %rsi     # 0x2a0d0
movswl %ax, %edi
callq 0x92c0
cmpl $0x0, %eax
je 0x8433
movswl -0x12(%rbp), %eax
sarl %eax
movslq %eax, %rcx
leaq 0x7f1d(%rip), %rax      # 0x10260
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movw 0x2(%rax), %ax
movw %ax, -0x14(%rbp)
movw -0xe(%rbp), %ax
movswl -0x12(%rbp), %ecx
sarl %ecx
movslq %ecx, %rdx
leaq 0x7ef6(%rip), %rcx      # 0x10260
shlq $0x4, %rdx
addq %rdx, %rcx
movq 0x8(%rcx), %rcx
movw %ax, 0xc(%rcx)
movswl %ax, %edi
callq 0x2fd0
cmpl $0x0, -0xc(%rbp)
je 0x8416
movq -0x20(%rbp), %rax
movq %rax, -0x240(%rbp)
movw -0x14(%rbp), %ax
leaq 0x2150f(%rip), %rcx     # 0x298b0
movw %ax, (%rcx)
movswl %ax, %edi
callq 0x2fb0
cmpl $0x0, %eax
je 0x83db
leaq 0x214f8(%rip), %rax     # 0x298b0
movswl (%rax), %eax
sarl %eax
movslq %eax, %rcx
leaq 0x7e99(%rip), %rax      # 0x10260
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq %rax, -0x248(%rbp)
jmp 0x8403
leaq 0x214ce(%rip), %rax     # 0x298b0
movswl (%rax), %eax
sarl %eax
movslq %eax, %rcx
leaq 0x7e6f(%rip), %rax      # 0x10260
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq %rax, -0x248(%rbp)
movq -0x240(%rbp), %rdi
movq -0x248(%rbp), %rsi
callq 0x6500
movw -0x10(%rbp), %cx
movswl -0x14(%rbp), %esi
movw -0x14(%rbp), %ax
movswl %cx, %edi
movswl %ax, %edx
movswl -0x12(%rbp), %ecx
callq 0x34d0
jmp 0x844c
movswl -0x12(%rbp), %edi
callq 0x2fd0
movswl -0x12(%rbp), %edi
callq 0x3020
movb $0x0, %al
callq 0x6510
jmp 0x844e
movsbl -0x230(%rbp), %eax
cmpl $0x5d, %eax
jne 0x826b
addq $0x250, %rsp            # imm = 0x250
popq %rbp
retq
nopw (%rax,%rax)