// File: tomfunkhouser[P]gaps/pkgs/R3Shapes/ply.cpp
// Function: setup_other_props(PlyElement*)
void setup_other_props(PlyElement *elem)
{
  int i;
  PlyProperty *prop;
  int size = 0;
  int type_size;

  /* Examine each property in decreasing order of size. */
  /* We do this so that all data types will be aligned by */
  /* word, half-word, or whatever within the structure. */

  for (type_size = 8; type_size > 0; type_size /= 2) {

    /* add up the space taken by each property, and save this information */
    /* away in the property descriptor */

    for (i = 0; i < elem->nprops; i++) {

      /* don't bother with properties we've been asked to store explicitly */
      if (elem->store_prop[i])
        continue;

      prop = elem->props[i];

      /* internal types will be same as external */
      prop->internal_type = prop->external_type;
      prop->count_internal = prop->count_external;

      /* check list case */
      if (prop->is_list) {

        /* pointer to list */
        if (type_size == sizeof (void *)) {
          prop->offset = size;
          size += sizeof (void *);    /* always use size of a pointer here */
        }

        /* count of number of list elements */
        if (type_size == ply_type_size[prop->count_external]) {
          prop->count_offset = size;
          size += ply_type_size[prop->count_external];
        }
      }
      /* not list */
      else if (type_size == ply_type_size[prop->external_type]) {
        prop->offset = size;
        size += ply_type_size[prop->external_type];
      }
    }

  }

  /* save the size for the other_props structure */
  elem->other_size = size;
}

// Assembly:
movq %rdi, -0x8(%rsp)
movl $0x0, -0x1c(%rsp)
movl $0x8, -0x20(%rsp)
cmpl $0x0, -0x20(%rsp)
jle 0x74776
movl $0x0, -0xc(%rsp)
movl -0xc(%rsp), %eax
movq -0x8(%rsp), %rcx
cmpl 0x10(%rcx), %eax
jge 0x7475f
movq -0x8(%rsp), %rax
movq 0x20(%rax), %rax
movslq -0xc(%rsp), %rcx
cmpb $0x0, (%rax,%rcx)
je 0x74663
jmp 0x7474f
movq -0x8(%rsp), %rax
movq 0x18(%rax), %rax
movslq -0xc(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x18(%rsp)
movq -0x18(%rsp), %rax
movl 0x8(%rax), %ecx
movq -0x18(%rsp), %rax
movl %ecx, 0xc(%rax)
movq -0x18(%rsp), %rax
movl 0x18(%rax), %ecx
movq -0x18(%rsp), %rax
movl %ecx, 0x1c(%rax)
movq -0x18(%rsp), %rax
cmpl $0x0, 0x14(%rax)
je 0x7470b
movslq -0x20(%rsp), %rax
cmpq $0x8, %rax
jne 0x746c9
movl -0x1c(%rsp), %ecx
movq -0x18(%rsp), %rax
movl %ecx, 0x10(%rax)
movslq -0x1c(%rsp), %rax
addq $0x8, %rax
movl %eax, -0x1c(%rsp)
movl -0x20(%rsp), %eax
movq -0x18(%rsp), %rcx
movslq 0x18(%rcx), %rdx
leaq 0x103c03(%rip), %rcx    # 0x1782e0
cmpl (%rcx,%rdx,4), %eax
jne 0x74709
movl -0x1c(%rsp), %ecx
movq -0x18(%rsp), %rax
movl %ecx, 0x20(%rax)
movq -0x18(%rsp), %rax
movslq 0x18(%rax), %rcx
leaq 0x103be2(%rip), %rax    # 0x1782e0
movl (%rax,%rcx,4), %eax
addl -0x1c(%rsp), %eax
movl %eax, -0x1c(%rsp)
jmp 0x7474d
movl -0x20(%rsp), %eax
movq -0x18(%rsp), %rcx
movslq 0x8(%rcx), %rdx
leaq 0x103bc1(%rip), %rcx    # 0x1782e0
cmpl (%rcx,%rdx,4), %eax
jne 0x7474b
movl -0x1c(%rsp), %ecx
movq -0x18(%rsp), %rax
movl %ecx, 0x10(%rax)
movq -0x18(%rsp), %rax
movslq 0x8(%rax), %rcx
leaq 0x103ba0(%rip), %rax    # 0x1782e0
movl (%rax,%rcx,4), %eax
addl -0x1c(%rsp), %eax
movl %eax, -0x1c(%rsp)
jmp 0x7474d
jmp 0x7474f
movl -0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rsp)
jmp 0x74638
jmp 0x74761
movl -0x20(%rsp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, -0x20(%rsp)
jmp 0x74625
movl -0x1c(%rsp), %ecx
movq -0x8(%rsp), %rax
movl %ecx, 0x2c(%rax)
retq
nopw %cs:(%rax,%rax)