// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x8(%rbp), %rdi
callq 0x7360
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %eax
movq %rax, -0x38(%rbp)
subq $0x5, %rax
ja 0x6b36
movq -0x38(%rbp), %rax
leaq 0x39a0(%rip), %rcx      # 0xa34c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x3ad4(%rip), %rdi      # 0xa490
xorl %eax, %eax
movl %eax, %esi
callq 0x56d0
movq -0x8(%rbp), %rdi
callq 0x7360
movl %eax, -0x10(%rbp)
movl -0x10(%rbp), %edi
callq 0x6650
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdx
movq 0x43198(%rip), %rax     # 0x49b80
movl 0x431a2(%rip), %ecx     # 0x49b90
movl %ecx, %esi
addl $0x1, %esi
movl %esi, 0x43197(%rip)     # 0x49b90
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x8(%rbp), %rdi
callq 0x6970
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x10(%rbp), %eax
jge 0x6a47
movq -0x8(%rbp), %rdi
callq 0x6970
movq %rax, %rdx
movq -0x20(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq %rdx, 0x10(%rax,%rcx,8)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x6a1b
jmp 0x6b36
movq -0x8(%rbp), %rcx
leaq -0x2c(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x20c0
movslq -0x2c(%rbp), %rax
shlq %rax
orq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x6b36
movq -0x8(%rbp), %rdi
callq 0x7360
movl %eax, -0x10(%rbp)
movl -0x10(%rbp), %edi
callq 0x66c0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdx
movq 0x430e6(%rip), %rax     # 0x49b80
movl 0x430f0(%rip), %ecx     # 0x49b90
movl %ecx, %esi
addl $0x1, %esi
movl %esi, 0x430e5(%rip)     # 0x49b90
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x20(%rbp), %rax
movq %rax, -0x28(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x10(%rbp), %eax
jge 0x6af1
movq -0x8(%rbp), %rdi
callq 0x7360
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %eax
movb %al, %dl
movq -0x28(%rbp), %rax
movslq -0x14(%rbp), %rcx
movb %dl, 0x10(%rax,%rcx)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x6ac1
movq -0x8(%rbp), %rdi
callq 0x6970
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x8(%rax)
jmp 0x6b36
movq -0x8(%rbp), %rdi
callq 0x7360
movl %eax, -0x10(%rbp)
movq 0x43066(%rip), %rax     # 0x49b80
movslq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x20(%rbp)
jmp 0x6b36
movq 0x43051(%rip), %rax     # 0x49b80
movq (%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq