// File: /workspace/github_cpp_makefile_star2_O1/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 0x3e644
testq %rax, %rax
je 0x40206
movq %rax, %rbx
movq %rax, 0x40(%r14)
movl %ebp, 0x28(%rax)
movq %rax, %rdi
callq 0x40074
leaq 0x687ad(%rip), %r12     # 0xa88eb
movl $0x18, %edi
movl $0x4b4, %esi            # imm = 0x4B4
movq %r12, %rdx
callq 0x3e440
movq %rax, %r14
movq %r15, %rdi
callq 0x3e480
movq %rax, (%r14)
movl 0x2c(%rbx), %eax
movl %eax, 0x8(%r14)
movl 0x10(%rbx), %eax
shll $0x3, %eax
leal (%rax,%rax,4), %edi
movl $0x4bf, %esi            # imm = 0x4BF
movq %r12, %rdx
callq 0x3e440
movq %r14, (%rsp)
movq %rax, 0x10(%r14)
cmpl $0x0, 0x10(%rbx)
jle 0x401df
movq %rax, %r15
xorl %r14d, %r14d
leaq 0x68755(%rip), %r12     # 0xa88eb
xorl %ebp, %ebp
movq 0x20(%rbx), %rax
cmpb $0x0, (%rax,%r14)
jne 0x401d1
movl $0x28, %edi
movl $0x4c6, %esi            # imm = 0x4C6
movq %r12, %rdx
callq 0x3e440
movq %rax, %r13
movq 0x18(%rbx), %rax
movq (%rax,%r14,8), %rsi
movq %r13, %rdi
callq 0x3e68a
movslq %ebp, %rbp
movq %r13, (%r15,%rbp,8)
incl %ebp
incq %r14
movslq 0x10(%rbx), %rax
cmpq %rax, %r14
jl 0x40198
jmp 0x401e1
xorl %ebp, %ebp
movq (%rsp), %r14
movl %ebp, 0xc(%r14)
testl %ebp, %ebp
jne 0x401f4
movl $0xffffffff, 0x28(%rbx) # imm = 0xFFFFFFFF
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xa4dab(%rip), %rax     # 0xe4fb8
movq (%rax), %rdi
leaq 0x689ce(%rip), %rsi     # 0xa8be5
xorl %r14d, %r14d
movq %r15, %rdx
xorl %eax, %eax
callq 0xe670
jmp 0x401f4