// File: /workspace/github_c_makefile_star2_O0/GregorR[P]lstg/source/memory.c
// Function: objectWrite
static void objectWrite(FILE * fp, struct object *obj)
{
  int             i,
                  size;

  if(obj == 0)
  {
    sysError("writing out a null object", 0);
  }

  if(IS_SMALLINT(obj))
  {                             /* SmallInt */
    int             val;

    writeWord(fp, 2);
    val = HTONL(integerValue(obj));
    (void) fwrite(&val, sizeof(val), 1, fp);
    return;
  }

  /*
     see if already written 
   */
  for(i = 0; i < indirtop; i++)
  {
    if(obj == indirArray[i])
    {
      if(i == 0)
      {
        writeWord(fp, 5);
      }
      else
      {
        writeWord(fp, 4);
        writeWord(fp, i);
      }
      return;
    }
  }

  /*
     not written, do it now 
   */
  indirArray[indirtop++] = obj;

  /*
     byte objects 
   */
  if(obj->size & FLAG_BIN)
  {
    struct byteObject *bobj = (struct byteObject *) obj;

    size = SIZE(obj);
    writeWord(fp, 3);
    writeWord(fp, size);
    for(i = 0; i < size; i++)
      writeWord(fp, bobj->bytes[i]);
    objectWrite(fp, obj->class);
    return;
  }

  /*
     ordinary objects 
   */
  size = SIZE(obj);
  writeWord(fp, 1);
  writeWord(fp, size);
  objectWrite(fp, obj->class);
  for(i = 0; i < size; i++)
  {
    objectWrite(fp, obj->data[i]);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x6d17
leaq 0x37c2(%rip), %rdi      # 0xa4d0
xorl %eax, %eax
movl %eax, %esi
callq 0x56d0
movq -0x10(%rbp), %rax
andq $0x1, %rax
cmpq $0x0, %rax
je 0x6d59
movq -0x8(%rbp), %rdi
movl $0x2, %esi
callq 0x73c0
movq -0x10(%rbp), %rax
sarq %rax
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rcx
leaq -0x1c(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x2350
jmp 0x6ecb
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl 0x42e27(%rip), %eax     # 0x49b90
jge 0x6dc2
movq -0x10(%rbp), %rax
movq 0x42e0a(%rip), %rcx     # 0x49b80
movslq -0x14(%rbp), %rdx
cmpq (%rcx,%rdx,8), %rax
jne 0x6db5
cmpl $0x0, -0x14(%rbp)
jne 0x6d96
movq -0x8(%rbp), %rdi
movl $0x5, %esi
callq 0x73c0
jmp 0x6db0
movq -0x8(%rbp), %rdi
movl $0x4, %esi
callq 0x73c0
movq -0x8(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x73c0
jmp 0x6ecb
jmp 0x6db7
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x6d60
movq -0x10(%rbp), %rdx
movq 0x42db3(%rip), %rax     # 0x49b80
movl 0x42dbd(%rip), %ecx     # 0x49b90
movl %ecx, %esi
addl $0x1, %esi
movl %esi, 0x42db2(%rip)     # 0x49b90
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x10(%rbp), %rax
movl (%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x6e64
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
shrl $0x2, %eax
movl %eax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movl $0x3, %esi
callq 0x73c0
movq -0x8(%rbp), %rdi
movl -0x18(%rbp), %esi
callq 0x73c0
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0x6e51
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rax
movslq -0x14(%rbp), %rcx
movzbl 0x10(%rax,%rcx), %esi
callq 0x73c0
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x6e28
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x6cf0
jmp 0x6ecb
movq -0x10(%rbp), %rax
movl (%rax), %eax
shrl $0x2, %eax
movl %eax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x73c0
movq -0x8(%rbp), %rdi
movl -0x18(%rbp), %esi
callq 0x73c0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x6cf0
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0x6ecb
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq 0x10(%rax,%rcx,8), %rsi
callq 0x6cf0
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x6ea2
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)