// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Shapes/ply.cpp
// Function: ply_get_other_properties
PlyOtherProp *ply_get_other_properties(
  PlyFile *plyfile,
  char *elem_name,
  int offset
)
{
  int i;
  PlyElement *elem;
  PlyOtherProp *other;
  PlyProperty *prop;
  int nprops;

  /* find information about the element */
  elem = find_element (plyfile, elem_name);
  if (elem == NULL) {
    fprintf (stderr, "ply_get_other_properties: Can't find element '%s'\n",
             elem_name);
    return (NULL);
  }

  /* remember that this is the "current" element */
  plyfile->which_elem = elem;

  /* save the offset to where to store the other_props */
  elem->other_offset = offset;

  /* place the appropriate pointers, etc. in the element's property list */
  setup_other_props (elem);

  /* create structure for describing other_props */
  other = (PlyOtherProp *) myalloc (sizeof (PlyOtherProp));
  other->name = my_strdup (elem_name);
#if 0
  if (elem->other_offset == NO_OTHER_PROPS) {
    other->size = 0;
    other->props = NULL;
    other->nprops = 0;
    return (other);
  }
#endif
  other->size = elem->other_size;
  other->props = (PlyProperty **) myalloc (sizeof(PlyProperty) * elem->nprops);
  
  /* save descriptions of each "other" property */
  nprops = 0;
  for (i = 0; i < elem->nprops; i++) {
    if (elem->store_prop[i])
      continue;
    prop = (PlyProperty *) myalloc (sizeof (PlyProperty));
    copy_property (prop, elem->props[i]);
    other->props[nprops] = prop;
    nprops++;
  }
  other->nprops = nprops;

#if 1
  /* set other_offset pointer appropriately if there are NO other properties */
  if (other->nprops == 0) {
    elem->other_offset = NO_OTHER_PROPS;
  }
#endif
  
  /* return structure */
  return (other);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %r15
movq %rdi, %r14
callq 0x3e0ee
testq %rax, %rax
je 0x3fcb8
movq %rax, %rbx
movq %rax, 0x40(%r14)
movl %ebp, 0x28(%rax)
movq %rax, %rdi
callq 0x3fb1b
leaq 0x68d06(%rip), %r12     # 0xa88eb
movl $0x18, %edi
movl $0x4b4, %esi            # imm = 0x4B4
movq %r12, %rdx
callq 0x3deec
movq %rax, %r13
movq %r15, %rdi
callq 0x3df2c
movq %rax, (%r13)
movl 0x2c(%rbx), %eax
movl %eax, 0x8(%r13)
movl 0x10(%rbx), %eax
shll $0x3, %eax
leal (%rax,%rax,4), %edi
movl $0x4bf, %esi            # imm = 0x4BF
movq %r12, %rdx
callq 0x3deec
movq %rax, %r15
movq %rax, 0x10(%r13)
movl 0x10(%rbx), %eax
testl %eax, %eax
jle 0x3fc97
movq %r13, (%rsp)
xorl %ebp, %ebp
leaq 0x68cad(%rip), %r12     # 0xa88eb
xorl %r14d, %r14d
movq 0x20(%rbx), %rcx
cmpb $0x0, (%rcx,%rbp)
jne 0x3fc7d
movl $0x28, %edi
movl $0x4c6, %esi            # imm = 0x4C6
movq %r12, %rdx
callq 0x3deec
movq %rax, %r13
movq 0x18(%rbx), %rax
movq (%rax,%rbp,8), %rsi
movq %r13, %rdi
callq 0x3e133
movslq %r14d, %r14
movq %r13, (%r15,%r14,8)
incl %r14d
movl 0x10(%rbx), %eax
incq %rbp
movslq %eax, %rcx
cmpq %rcx, %rbp
jl 0x3fc41
movq (%rsp), %r13
movl %r14d, 0xc(%r13)
testl %r14d, %r14d
jne 0x3fca6
jmp 0x3fc9f
movl $0x0, 0xc(%r13)
movl $0xffffffff, 0x28(%rbx) # imm = 0xFFFFFFFF
movq %r13, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xa52f9(%rip), %rax     # 0xe4fb8
movq (%rax), %rdi
leaq 0x68f1c(%rip), %rsi     # 0xa8be5
xorl %r13d, %r13d
movq %r15, %rdx
xorl %eax, %eax
callq 0xe670
jmp 0x3fca6