// File: /workspace/github_cpp_makefile_star2_O2/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, %r12
movq %rdi, %r14
callq 0x39180
testq %rax, %rax
je 0x3abb5
movq %rax, %rbx
movq %rax, 0x40(%r14)
movl %ebp, 0x28(%rax)
movq %rax, %rdi
callq 0x3aa25
leaq 0x5ed9c(%rip), %r15     # 0x9989b
pushq $0x18
popq %rdi
movl $0x4b4, %esi            # imm = 0x4B4
movq %r15, %rdx
callq 0x38f69
movq %rax, %r14
movq %r12, %rdi
callq 0x38fa9
movq %rax, (%r14)
movl 0x2c(%rbx), %eax
movl %eax, 0x8(%r14)
imull $0x28, 0x10(%rbx), %edi
movl $0x4bf, %esi            # imm = 0x4BF
movq %r15, %rdx
callq 0x38f69
movq %rax, %r12
movq %r14, (%rsp)
movq %rax, 0x10(%r14)
xorl %r14d, %r14d
pushq $0x28
popq %rbp
xorl %r15d, %r15d
movslq 0x10(%rbx), %rax
cmpq %rax, %r14
jge 0x3ab92
movq 0x20(%rbx), %rax
cmpb $0x0, (%rax,%r14)
jne 0x3ab8d
movl %ebp, %edi
movl $0x4c6, %esi            # imm = 0x4C6
leaq 0x5ed30(%rip), %rdx     # 0x9989b
callq 0x38f69
movq %rax, %r13
movq 0x18(%rbx), %rax
movq (%rax,%r14,8), %rsi
movq %r13, %rdi
callq 0x391ce
movslq %r15d, %rax
movq %r13, (%r12,%rax,8)
incl %r15d
incq %r14
jmp 0x3ab49
movq (%rsp), %r14
movl %r15d, 0xc(%r14)
testl %r15d, %r15d
jne 0x3aba3
orl $-0x1, 0x28(%rbx)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x9f404(%rip), %rax     # 0xd9fc0
movq (%rax), %rdi
leaq 0x5efcf(%rip), %rsi     # 0x99b95
xorl %r14d, %r14d
movq %r12, %rdx
xorl %eax, %eax
callq 0xe6a0
jmp 0x3aba3