// File: /workspace/github_c_makefile_star2_O0/afi-lambda[P]a_little_smalltalk/src/unixio.c
// Function: imageRead
void imageRead(FILE *fp)
{
    short i, size;
    //object *mBlockAlloc();

    fr(fp, (char *) &symbols, sizeof(object));
    i = 0;

    while (fr(fp, (char *) &dummyObject, sizeof(dummyObject)))
    {
        i = dummyObject.di;

        if ((i < 0) || (i > ObjectTableMax))
            sysError("reading index out of range", "");
        objectTable[i].STclass = dummyObject.cl;
        if ((objectTable[i].STclass < 0) || ((objectTable[i].STclass >> 1)
                                             > ObjectTableMax))
        {
            fprintf(stderr, "index %d\n", dummyObject.cl);
            sysError("class out of range", "imageRead");
        }
        objectTable[i].size = size = dummyObject.ds;
        if (size < 0)
            size = ((-size) + 1) / 2;
        if (size != 0)
        {
            objectTable[i].memory = mBlockAlloc((int) size);
            fr(fp, (char *) objectTable[i].memory, sizeof(object)
               * (int) size);
        }
        else
            objectTable[i].memory = (object *) 0;
    }

    /* now restore ref counts, getting rid of unneeded junk */
    visit(symbols);
    /* toss out the old free lists, build new ones */
    setFreeLists();

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
leaq 0x1e47d(%rip), %rsi     # 0x298b4
movl $0x2, %edx
callq 0xb600
movw $0x0, -0xa(%rbp)
movq -0x8(%rbp), %rdi
leaq 0x20c9e(%rip), %rsi     # 0x2c0f0
movl $0x8, %edx
callq 0xb600
cmpl $0x0, %eax
je 0xb5da
movl 0x20c85(%rip), %eax     # 0x2c0f0
movw %ax, -0xa(%rbp)
movswl -0xa(%rbp), %eax
cmpl $0x0, %eax
jl 0xb483
movswl -0xa(%rbp), %eax
cmpl $0x1964, %eax           # imm = 0x1964
jle 0xb496
leaq 0x1742(%rip), %rdi      # 0xcbcc
leaq 0x1224(%rip), %rsi      # 0xc6b5
callq 0x63f0
movw 0x20c57(%rip), %cx      # 0x2c0f4
movswq -0xa(%rbp), %rdx
leaq 0x4db7(%rip), %rax      # 0x10260
shlq $0x4, %rdx
addq %rdx, %rax
movw %cx, (%rax)
movswq -0xa(%rbp), %rcx
leaq 0x4da1(%rip), %rax      # 0x10260
shlq $0x4, %rcx
addq %rcx, %rax
movswl (%rax), %eax
cmpl $0x0, %eax
jl 0xb4ed
movswq -0xa(%rbp), %rcx
leaq 0x4d86(%rip), %rax      # 0x10260
shlq $0x4, %rcx
addq %rcx, %rax
movswl (%rax), %eax
sarl %eax
cmpl $0x1964, %eax           # imm = 0x1964
jle 0xb51f
movq 0x3b04(%rip), %rax      # 0xeff8
movq (%rax), %rdi
movswl 0x20bf6(%rip), %edx     # 0x2c0f4
leaq 0x16e2(%rip), %rsi      # 0xcbe7
movb $0x0, %al
callq 0x2170
leaq 0x16de(%rip), %rdi      # 0xcbf1
leaq 0x16ea(%rip), %rsi      # 0xcc04
callq 0x63f0
movw 0x20bd0(%rip), %cx      # 0x2c0f6
movw %cx, -0xc(%rbp)
movswq -0xa(%rbp), %rdx
leaq 0x4d2a(%rip), %rax      # 0x10260
shlq $0x4, %rdx
addq %rdx, %rax
movw %cx, 0x4(%rax)
movswl -0xc(%rbp), %eax
cmpl $0x0, %eax
jge 0xb561
movswl -0xc(%rbp), %ecx
xorl %eax, %eax
subl %ecx, %eax
addl $0x1, %eax
movl $0x2, %ecx
cltd
idivl %ecx
movw %ax, -0xc(%rbp)
movswl -0xc(%rbp), %eax
cmpl $0x0, %eax
je 0xb5ba
movswl -0xc(%rbp), %edi
callq 0x2b80
movq %rax, %rcx
movswq -0xa(%rbp), %rdx
leaq 0x4cde(%rip), %rax      # 0x10260
shlq $0x4, %rdx
addq %rdx, %rax
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rdi
movswq -0xa(%rbp), %rcx
leaq 0x4cc3(%rip), %rax      # 0x10260
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rsi
movswl -0xc(%rbp), %eax
cltq
shlq %rax
movl %eax, %edx
callq 0xb600
jmp 0xb5d5
movswq -0xa(%rbp), %rcx
leaq 0x4c9a(%rip), %rax      # 0x10260
shlq $0x4, %rcx
addq %rcx, %rax
movq $0x0, 0x8(%rax)
jmp 0xb447
leaq 0x1e2d3(%rip), %rax     # 0x298b4
movswl (%rax), %edi
callq 0x3310
movb $0x0, %al
callq 0x2aa0
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)