// File: /workspace/github_c_makefile_star2_O1/GregorR[P]lstg/source/memory.c
// Function: objectRead
static struct object *objectRead(FILE * fp)
{
  int             type,
                  size,
                  i;
  struct object  *newObj = 0;
  struct byteObject *bnewObj;

  type = readWord(fp);

  switch (type)
  {
    case 0:                    /* nil obj */
      sysError("read in a null object", 0);

    case 1:                    /* ordinary object */
      size = readWord(fp);
      newObj = staticAllocate(size);
      indirArray[indirtop++] = newObj;
      newObj->class = objectRead(fp);
      for(i = 0; i < size; i++)
        newObj->data[i] = objectRead(fp);
      break;

    case 2:                    /* integer */
    {
      int             val;

      (void) fread(&val, sizeof(val), 1, fp);
      newObj = newInteger(NTOHS(val));
    }
      break;

    case 3:                    /* byte arrays */
      size = readWord(fp);
      newObj = staticIAllocate(size);
      indirArray[indirtop++] = newObj;
      bnewObj = (struct byteObject *) newObj;
      for(i = 0; i < size; i++)
      {
        type = readWord(fp);
        bnewObj->bytes[i] = type;
      }
      bnewObj->class = objectRead(fp);
      break;

    case 4:                    /* previous object */
      size = readWord(fp);
      newObj = indirArray[size];
      break;

    case 5:                    /* object 0 (nil object) */
      newObj = indirArray[0];
      break;
  }
  return newObj;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
callq 0x56ee
cmpl $0x5, %eax
ja 0x50fb
movl %eax, %eax
leaq 0x2372(%rip), %rcx      # 0x732c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x24a6(%rip), %rdi      # 0x7470
xorl %esi, %esi
callq 0x4340
movq %rbx, %rdi
callq 0x56ee
movl %eax, %ebp
movl %eax, %edi
callq 0x4d75
movq %rax, %r14
movq 0x41b94(%rip), %rax     # 0x46b80
movslq 0x41b9d(%rip), %rcx     # 0x46b90
leal 0x1(%rcx), %edx
movl %edx, 0x41b94(%rip)     # 0x46b90
movq %r14, (%rax,%rcx,8)
movq %rbx, %rdi
callq 0x4f94
movq %rax, 0x8(%r14)
testl %ebp, %ebp
jle 0x50fe
movl %ebp, %r15d
xorl %r12d, %r12d
movq %rbx, %rdi
callq 0x4f94
movq %rax, 0x10(%r14,%r12,8)
incq %r12
cmpq %r12, %r15
jne 0x501a
jmp 0x50fe
movq %rbx, %rdi
callq 0x56ee
movq 0x41b3d(%rip), %rcx     # 0x46b80
cltq
movq (%rcx,%rax,8), %r14
jmp 0x50fe
leaq 0xc(%rsp), %r14
movl $0x4, %esi
movl $0x1, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x20c0
movslq (%r14), %rax
leaq 0x1(,%rax,2), %r14
jmp 0x50fe
movq %rbx, %rdi
callq 0x56ee
movl %eax, %r15d
leal 0x7(%r15), %eax
leal 0xe(%r15), %edi
testl %eax, %eax
cmovnsl %eax, %edi
sarl $0x3, %edi
callq 0x4d75
movq %rax, %r14
leal 0x2(,%r15,4), %eax
movl %eax, (%r14)
movq 0x41ad3(%rip), %rax     # 0x46b80
movslq 0x41adc(%rip), %rcx     # 0x46b90
leal 0x1(%rcx), %edx
movl %edx, 0x41ad3(%rip)     # 0x46b90
movq %r14, (%rax,%rcx,8)
testl %r15d, %r15d
jle 0x50e1
movl %r15d, %r15d
xorl %r12d, %r12d
movq %rbx, %rdi
callq 0x56ee
movb %al, 0x10(%r14,%r12)
incq %r12
cmpq %r12, %r15
jne 0x50cc
movq %rbx, %rdi
callq 0x4f94
movq %rax, 0x8(%r14)
jmp 0x50fe
movq 0x41a8a(%rip), %rax     # 0x46b80
movq (%rax), %r14
jmp 0x50fe
xorl %r14d, %r14d
movq %r14, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq