// File: tomfunkhouser[P]gaps/pkgs/R3Shapes/ply.cpp
// Function: ply_describe_other_properties
void ply_describe_other_properties(
  PlyFile *plyfile,
  PlyOtherProp *other,
  int offset
)
{
  int i;
  PlyElement *elem;
  PlyProperty *prop;

  /* look for appropriate element */
  elem = find_element (plyfile, other->name);
  if (elem == NULL) {
    fprintf(stderr, "ply_describe_other_properties: can't find element '%s'\n",
            other->name);
    return;
  }

  /* create room for other properties */

  if (elem->nprops == 0) {
    elem->props = (PlyProperty **)
                  myalloc (sizeof (PlyProperty *) * other->nprops);
    elem->store_prop = (char *) myalloc (sizeof (char) * other->nprops);
    elem->nprops = 0;
  }
  else {
    int newsize;
    newsize = elem->nprops + other->nprops;
    elem->props = (PlyProperty **)
                  realloc (elem->props, sizeof (PlyProperty *) * newsize);
    elem->store_prop = (char *)
                  realloc (elem->store_prop, sizeof (char) * newsize);
  }

  /* copy the other properties */

  for (i = 0; i < other->nprops; i++) {
    prop = (PlyProperty *) myalloc (sizeof (PlyProperty));
    copy_property (prop, other->props[i]);
    elem->props[elem->nprops] = prop;
    elem->store_prop[elem->nprops] = OTHER_PROP;
    elem->nprops++;
  }

  /* save other info about other properties */
  elem->other_size = other->size;
  elem->other_offset = offset;
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movq %rsi, 0x28(%rsp)
movl %edx, 0x24(%rsp)
movq 0x30(%rsp), %rdi
movq 0x28(%rsp), %rax
movq (%rax), %rsi
callq 0x71970
movq %rax, 0x18(%rsp)
cmpq $0x0, 0x18(%rsp)
jne 0x71c76
movq 0xfd370(%rip), %rax     # 0x16efc8
movq (%rax), %rdi
movq 0x28(%rsp), %rax
movq (%rax), %rdx
leaq 0xc36ec(%rip), %rsi     # 0x135356
movb $0x0, %al
callq 0xf730
jmp 0x71dfd
movq 0x18(%rsp), %rax
cmpl $0x0, 0x10(%rax)
jne 0x71ce7
movq 0x28(%rsp), %rax
movslq 0xc(%rax), %rax
shlq $0x3, %rax
movl %eax, %edi
movl $0x17d, %esi            # imm = 0x17D
leaq 0xc3653(%rip), %rdx     # 0x1352ef
callq 0x71630
movq %rax, %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x18(%rax)
movq 0x28(%rsp), %rax
movslq 0xc(%rax), %rax
shlq $0x0, %rax
movl %eax, %edi
movl $0x17e, %esi            # imm = 0x17E
leaq 0xc3627(%rip), %rdx     # 0x1352ef
callq 0x71630
movq %rax, %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x20(%rax)
movq 0x18(%rsp), %rax
movl $0x0, 0x10(%rax)
jmp 0x71d41
movq 0x18(%rsp), %rax
movl 0x10(%rax), %eax
movq 0x28(%rsp), %rcx
addl 0xc(%rcx), %eax
movl %eax, 0xc(%rsp)
movq 0x18(%rsp), %rax
movq 0x18(%rax), %rdi
movslq 0xc(%rsp), %rsi
shlq $0x3, %rsi
callq 0xf850
movq %rax, %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x18(%rax)
movq 0x18(%rsp), %rax
movq 0x20(%rax), %rdi
movslq 0xc(%rsp), %rsi
shlq $0x0, %rsi
callq 0xf850
movq %rax, %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x20(%rax)
movl $0x0, 0x20(%rsp)
movl 0x20(%rsp), %eax
movq 0x28(%rsp), %rcx
cmpl 0xc(%rcx), %eax
jge 0x71de1
movl $0x28, %edi
movl $0x18d, %esi            # imm = 0x18D
leaq 0xc3583(%rip), %rdx     # 0x1352ef
callq 0x71630
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rdi
movq 0x28(%rsp), %rax
movq 0x10(%rax), %rax
movslq 0x20(%rsp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x71a00
movq 0x10(%rsp), %rdx
movq 0x18(%rsp), %rax
movq 0x18(%rax), %rax
movq 0x18(%rsp), %rcx
movslq 0x10(%rcx), %rcx
movq %rdx, (%rax,%rcx,8)
movq 0x18(%rsp), %rax
movq 0x20(%rax), %rax
movq 0x18(%rsp), %rcx
movslq 0x10(%rcx), %rcx
movb $0x0, (%rax,%rcx)
movq 0x18(%rsp), %rax
movl 0x10(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x10(%rax)
movl 0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x20(%rsp)
jmp 0x71d49
movq 0x28(%rsp), %rax
movl 0x8(%rax), %ecx
movq 0x18(%rsp), %rax
movl %ecx, 0x2c(%rax)
movl 0x24(%rsp), %ecx
movq 0x18(%rsp), %rax
movl %ecx, 0x28(%rax)
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)