LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/ply.cpp
// Function: ply_write
PlyFile *ply_write(
  FILE *fp,
  int nelems,
  char **elem_names,
  int file_type
)
{
  int i;
  PlyFile *plyfile;
  PlyElement *elem;

  /* check for NULL file pointer */
  if (fp == NULL)
    return (NULL);

  if (native_binary_type == -1)
     get_native_binary_type();
  if (!types_checked)
     check_types();
  
  /* create a record for this object */

  plyfile = (PlyFile *) myalloc (sizeof (PlyFile));
  if (file_type == PLY_BINARY_NATIVE)
     plyfile->file_type = native_binary_type;
  else
     plyfile->file_type = file_type;
  plyfile->num_comments = 0;
  plyfile->num_obj_info = 0;
  plyfile->nelems = nelems;
  plyfile->version = 1.0;
  plyfile->fp = fp;
  plyfile->other_elems = NULL;

  /* tuck aside the names of the elements */

  plyfile->elems = (PlyElement **) myalloc (sizeof (PlyElement *) * nelems);
  for (i = 0; i < nelems; i++) {
    elem = (PlyElement *) myalloc (sizeof (PlyElement));
    plyfile->elems[i] = elem;
    elem->name = my_strdup (elem_names[i]);
    elem->num = 0;
    elem->nprops = 0;
  }

  /* return pointer to the file descriptor */
  return (plyfile);
}

// Assembly:
testq %rdi, %rdi
je 0x38eea
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %ebp
movq %rdx, %rbx
movl %esi, %r14d
movq %rdi, %r13
cmpb $0x0, 0x4a2d6e(%rip)    # 0x4dbb78
jne 0x38e13
movb $0x1, 0x4a2d65(%rip)    # 0x4dbb78
cmpb $0x0, 0x4a2d62(%rip)    # 0x4dbb7c
jne 0x38e21
callq 0x38ef5
leaq 0x60a73(%rip), %r12     # 0x9989b
pushq $0x50
popq %rdi
movl $0xad, %esi
movq %r12, %rdx
callq 0x38f69
movq %rax, %r15
movzbl 0x4a2d36(%rip), %eax    # 0x4dbb78
decl %eax
orl $0x3, %eax
cmpl $0x4, %ebp
cmovnel %ebp, %eax
movl %eax, 0x8(%r15)
andl $0x0, 0x20(%r15)
andl $0x0, 0x30(%r15)
movl %r14d, 0x10(%r15)
movl $0x3f800000, 0xc(%r15)  # imm = 0x3F800000
movq %r13, (%r15)
andq $0x0, 0x48(%r15)
leal (,%r14,8), %edi
movl $0xbb, %esi
movq %r12, %rdx
callq 0x38f69
movq %rax, %r13
movq %r15, (%rsp)
movq %rax, 0x18(%r15)
xorl %r12d, %r12d
testl %r14d, %r14d
cmovlel %r12d, %r14d
pushq $0x30
popq %rbp
cmpq %r12, %r14
je 0x38ed7
movl %ebp, %edi
movl $0xbd, %esi
leaq 0x609ec(%rip), %rdx     # 0x9989b
callq 0x38f69
movq %rax, %r15
movq %rax, (%r13,%r12,8)
movq (%rbx,%r12,8), %rdi
callq 0x38fa9
movq %rax, (%r15)
andl $0x0, 0x8(%r15)
andl $0x0, 0x10(%r15)
incq %r12
jmp 0x38e9c
movq (%rsp), %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/ply.cpp
// Function: check_types()
void check_types()
{
    if ((ply_type_size[PLY_CHAR] != sizeof(char)) ||
	(ply_type_size[PLY_SHORT] != sizeof(short)) ||	
	(ply_type_size[PLY_INT] != sizeof(int)) ||	
	(ply_type_size[PLY_UCHAR] != sizeof(unsigned char)) ||	
	(ply_type_size[PLY_USHORT] != sizeof(unsigned short)) ||	
	(ply_type_size[PLY_UINT] != sizeof(unsigned int)) ||	
	(ply_type_size[PLY_FLOAT] != sizeof(float)) ||	
	(ply_type_size[PLY_DOUBLE] != sizeof(double)))
    {
	fprintf(stderr, "ply: Type sizes do not match built-in types\n");
	fprintf(stderr, "ply: Exiting...\n");
	exit(1);
    }
    
    types_checked = 1;
}

// Assembly:
movdqu 0xa1b97(%rip), %xmm0    # 0xdaa94
movdqu 0xa1b7f(%rip), %xmm1    # 0xdaa84
pcmpeqd 0x60863(%rip), %xmm0    # 0x99770
pcmpeqd 0x6086b(%rip), %xmm1    # 0x99780
pand %xmm0, %xmm1
movmskps %xmm1, %eax
xorl $0xf, %eax
jne 0x38f29
movb $0x1, 0x4a2c54(%rip)    # 0x4dbb7c
retq
pushq %r14
pushq %rbx
pushq %rax
movq 0xa108c(%rip), %r14     # 0xd9fc0
movq (%r14), %rcx
leaq 0x60d91(%rip), %rdi     # 0x99ccf
pushq $0x2c
popq %rsi
pushq $0x1
popq %rbx
movq %rbx, %rdx
callq 0xe8e0
movq (%r14), %rcx
leaq 0x60d68(%rip), %rdi     # 0x99cbe
pushq $0x10
popq %rsi
movq %rbx, %rdx
callq 0xe8e0
pushq $0x1
popq %rdi
callq 0xe570
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/ply.cpp
// Function: my_alloc(int, int, char*)
char *my_alloc(int size, int lnum, char *fname)
{
  char *ptr;

  ptr = (char *) malloc (size);

  if (ptr == 0) {
    fprintf(stderr, "Memory allocation bombed on line %d in %s\n", lnum, fname);
  }

  return (ptr);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdx, %rbx
movl %esi, %ebp
movslq %edi, %rdi
callq 0xe600
movq %rax, %r14
testq %rax, %rax
je 0x38f8a
movq %r14, %rax
popq %rbx
popq %r14
popq %rbp
retq
movq 0xa102f(%rip), %rax     # 0xd9fc0
movq (%rax), %rdi
leaq 0x60e77(%rip), %rsi     # 0x99e12
movl %ebp, %edx
movq %rbx, %rcx
xorl %eax, %eax
callq 0xe6a0
jmp 0x38f82
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/ply.cpp
// Function: my_strdup(char*)
char *my_strdup(char *str)
{
  // Copy a string (strdup is not part of standard)
  size_t len = strlen(str) + 1;
  void *output = malloc(len);
  if (output == NULL) return NULL;
  return (char *) memcpy (output, str, len);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0xe1e0
movq %rax, %r14
incq %r14
movq %r14, %rdi
callq 0xe600
testq %rax, %rax
je 0x38fdd
movq %rax, %rdi
movq %rbx, %rsi
movq %r14, %rdx
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xe380
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/ply.cpp
// Function: ply_open_for_writing
PlyFile *ply_open_for_writing(
  char *filename,
  int nelems,
  char **elem_names,
  int file_type,
  float *version
)
{
  PlyFile *plyfile;
  char *name;
  FILE *fp;

  /* tack on the extension .ply, if necessary */

  name = (char *) myalloc (sizeof (char) * (strlen (filename) + 5));
  strcpy (name, filename);
  if (strlen (name) < 4 ||
      strcmp (name + strlen (name) - 4, ".ply") != 0)
      strcat (name, ".ply");

  /* open the file for writing */

  fp = fopen (name, "w");
  if (fp == NULL) {
    return (NULL);
  }

  /* create the actual PlyFile structure */

  plyfile = ply_write (fp, nelems, elem_names, file_type);
  if (plyfile == NULL)
    return (NULL);

  /* say what PLY file version number we're writing */
  *version = plyfile->version;

  /* return pointer to the file descriptor */
  return (plyfile);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %rbx
movl %ecx, %ebp
movq %rdx, %r14
movl %esi, %r15d
movq %rdi, %r13
callq 0xe1e0
leal 0x5(%rax), %edi
leaq 0x6088e(%rip), %rdx     # 0x9989b
movl $0xe5, %esi
callq 0x38f69
movq %rax, %r12
movq %rax, %rdi
movq %r13, %rsi
callq 0xe3e0
movq %r12, %rdi
callq 0xe1e0
cmpq $0x4, %rax
jb 0x3904b
leaq (%r12,%rax), %rdi
addq $-0x4, %rdi
leaq 0x5a2da(%rip), %rsi     # 0x9331c
callq 0xe670
testl %eax, %eax
je 0x39061
movq %r12, %rdi
callq 0xe1e0
movl $0x796c702e, (%r12,%rax) # imm = 0x796C702E
movb $0x0, 0x4(%r12,%rax)
leaq 0x5f701(%rip), %rsi     # 0x98769
movq %r12, %rdi
callq 0xe550
testq %rax, %rax
je 0x39095
movq %rax, %rdi
movl %r15d, %esi
movq %r14, %rdx
movl %ebp, %ecx
callq 0x38de4
testq %rax, %rax
je 0x39095
movss 0xc(%rax), %xmm0
movss %xmm0, (%rbx)
jmp 0x39097
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/ply.cpp
// Function: ply_describe_element
void ply_describe_element(
  PlyFile *plyfile,
  char *elem_name,
  int nelems,
  int nprops,
  PlyProperty *prop_list
)
{
  int i;
  PlyElement *elem;
  PlyProperty *prop;

  /* look for appropriate element */
  elem = find_element (plyfile, elem_name);
  if (elem == NULL) {
    fprintf(stderr,"ply_describe_element: can't find element '%s'\n",elem_name);
    exit (-1);
  }

  elem->num = nelems;

  /* copy the list of properties */

  elem->nprops = nprops;
  elem->props = (PlyProperty **) myalloc (sizeof (PlyProperty *) * nprops);
  elem->store_prop = (char *) myalloc (sizeof (char) * nprops);

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %rbx
movl %ecx, %r14d
movl %edx, %ebp
movq %rsi, %r12
callq 0x39180
testq %rax, %rax
je 0x3915d
movq %rax, %r15
movl %ebp, 0x8(%rax)
movl %r14d, 0x10(%rax)
leal (,%r14,8), %edi
leaq 0x607b8(%rip), %r12     # 0x9989b
movl $0x124, %esi            # imm = 0x124
movq %r12, %rdx
callq 0x38f69
movq %rax, 0x18(%r15)
movl %r14d, %edi
movl $0x125, %esi            # imm = 0x125
movq %r12, %rdx
callq 0x38f69
movq %rax, 0x20(%r15)
xorl %r13d, %r13d
testl %r14d, %r14d
cmovlel %r13d, %r14d
pushq $0x28
popq %rbp
cmpq %r13, %r14
je 0x3914e
movl %ebp, %edi
movl $0x128, %esi            # imm = 0x128
movq %r12, %rdx
callq 0x38f69
movq 0x18(%r15), %rcx
movq %rax, (%rcx,%r13,8)
movq 0x20(%r15), %rcx
movb $0x1, (%rcx,%r13)
movq %rax, %rdi
movq %rbx, %rsi
callq 0x391ce
incq %r13
addq $0x28, %rbx
jmp 0x39115
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xa0e5c(%rip), %rax     # 0xd9fc0
movq (%rax), %rdi
leaq 0x60735(%rip), %rsi     # 0x998a3
movq %r12, %rdx
xorl %eax, %eax
callq 0xe6a0
pushq $-0x1
popq %rdi
callq 0xe570
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/ply.cpp
// Function: find_element(PlyFile*, char*)
PlyElement *find_element(PlyFile *plyfile, char *element)
{
  int i;

  for (i = 0; i < plyfile->nelems; i++)
    if (equal_strings (element, plyfile->elems[i]->name))
      return (plyfile->elems[i]);

  return (NULL);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movl 0x10(%rdi), %r12d
xorl %r13d, %r13d
testl %r12d, %r12d
cmovlel %r13d, %r12d
cmpq %r13, %r12
je 0x391be
movq 0x18(%r14), %rax
movq (%rax,%r13,8), %r15
movq (%r15), %rsi
movq %rbx, %rdi
callq 0x3a099
incq %r13
testl %eax, %eax
je 0x3919d
jmp 0x391c1
xorl %r15d, %r15d
movq %r15, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/ply.cpp
// Function: copy_property(PlyProperty*, PlyProperty*)
void copy_property(PlyProperty *dest, PlyProperty *src)
{
  dest->name = my_strdup (src->name);
  dest->external_type = src->external_type;
  dest->internal_type = src->internal_type;
  dest->offset = src->offset;

  dest->is_list = src->is_list;
  dest->count_external = src->count_external;
  dest->count_internal = src->count_internal;
  dest->count_offset = src->count_offset;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq (%rsi), %rdi
callq 0x38fa9
movq %rax, (%r14)
movups 0x8(%rbx), %xmm0
movups %xmm0, 0x8(%r14)
movq 0x18(%rbx), %rax
movq %rax, 0x18(%r14)
movl 0x20(%rbx), %eax
movl %eax, 0x20(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/ply.cpp
// Function: ply_describe_property
void ply_describe_property(
  PlyFile *plyfile,
  char *elem_name,
  PlyProperty *prop
)
{
  PlyElement *elem;
  PlyProperty *elem_prop;

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

  /* create room for new property */

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

  /* copy the new property */

  elem_prop = (PlyProperty *) myalloc (sizeof (PlyProperty));
  elem->props[elem->nprops - 1] = elem_prop;
  elem->store_prop[elem->nprops - 1] = NAMED_PROP;
  copy_property (elem_prop, prop);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r15
callq 0x39180
testq %rax, %rax
je 0x392c9
movq %rax, %r14
movslq 0x10(%rax), %rax
testq %rax, %rax
je 0x39258
leaq 0x1(%rax), %rcx
movl %ecx, 0x10(%r14)
movq 0x18(%r14), %rdi
leaq 0x8(,%rax,8), %rsi
callq 0xe7d0
movq %rax, 0x18(%r14)
movq 0x20(%r14), %rdi
movslq 0x10(%r14), %rsi
callq 0xe7d0
movq %rax, 0x20(%r14)
jmp 0x3928f
leaq 0x6063c(%rip), %r15     # 0x9989b
pushq $0x8
popq %rdi
movl $0x14d, %esi            # imm = 0x14D
movq %r15, %rdx
callq 0x38f69
movq %rax, 0x18(%r14)
pushq $0x1
popq %rdi
movl $0x14e, %esi            # imm = 0x14E
movq %r15, %rdx
callq 0x38f69
movq %rax, 0x20(%r14)
movl $0x1, 0x10(%r14)
leaq 0x60605(%rip), %rdx     # 0x9989b
pushq $0x28
popq %rdi
movl $0x15b, %esi            # imm = 0x15B
callq 0x38f69
movq 0x18(%r14), %rcx
movslq 0x10(%r14), %rdx
movq %rax, -0x8(%rcx,%rdx,8)
movq 0x20(%r14), %rcx
movb $0x1, -0x1(%rcx,%rdx)
movq %rax, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x391ce
movq 0xa0cf0(%rip), %rax     # 0xd9fc0
movq (%rax), %rdi
leaq 0x605f8(%rip), %rsi     # 0x998d2
movq %r15, %rdx
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
jmp 0xe6a0
// File: /workspace/github_cpp_makefile_star2_O2/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rsi, %r14
movq (%rsi), %r12
movq %r12, %rsi
callq 0x39180
testq %rax, %rax
je 0x393f6
movq %rax, %r15
movl 0x10(%rax), %eax
movl 0xc(%r14), %edi
testl %eax, %eax
movl %ebx, 0x4(%rsp)
je 0x3934e
addl %eax, %edi
movq 0x18(%r15), %rax
movslq %edi, %r12
leaq (,%r12,8), %rsi
movq %rax, %rdi
callq 0xe7d0
movq %rax, 0x18(%r15)
movq 0x20(%r15), %rdi
movq %r12, %rsi
callq 0xe7d0
movq %rax, 0x20(%r15)
jmp 0x39383
shll $0x3, %edi
leaq 0x60543(%rip), %r12     # 0x9989b
movl $0x17d, %esi            # imm = 0x17D
movq %r12, %rdx
callq 0x38f69
movq %rax, 0x18(%r15)
movl 0xc(%r14), %edi
movl $0x17e, %esi            # imm = 0x17E
movq %r12, %rdx
callq 0x38f69
movq %rax, 0x20(%r15)
andl $0x0, 0x10(%r15)
xorl %ebx, %ebx
leaq 0x6050f(%rip), %r12     # 0x9989b
pushq $0x28
popq %rbp
movslq 0xc(%r14), %rax
cmpq %rax, %rbx
jge 0x393d7
movl %ebp, %edi
movl $0x18d, %esi            # imm = 0x18D
movq %r12, %rdx
callq 0x38f69
movq %rax, %r13
movq 0x10(%r14), %rax
movq (%rax,%rbx,8), %rsi
movq %r13, %rdi
callq 0x391ce
movq 0x18(%r15), %rax
movslq 0x10(%r15), %rcx
movq %r13, (%rax,%rcx,8)
movq 0x20(%r15), %rax
movb $0x0, (%rax,%rcx)
incl 0x10(%r15)
incq %rbx
jmp 0x3938f
movl 0x8(%r14), %eax
movl %eax, 0x2c(%r15)
movl 0x4(%rsp), %eax
movl %eax, 0x28(%r15)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xa0bc3(%rip), %rax     # 0xd9fc0
movq (%rax), %rdi
leaq 0x604fb(%rip), %rsi     # 0x99902
movq %r12, %rdx
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xe6a0
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/ply.cpp
// Function: ply_element_count
void ply_element_count(
  PlyFile *plyfile,
  char *elem_name,
  int nelems
)
{
  PlyElement *elem;

  /* look for appropriate element */
  elem = find_element (plyfile, elem_name);
  if (elem == NULL) {
    fprintf(stderr,"ply_element_count: can't find element '%s'\n",elem_name);
    exit (-1);
  }

  elem->num = nelems;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %rbx
callq 0x39180
testq %rax, %rax
je 0x3943b
movl %ebp, 0x8(%rax)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movq 0xa0b7e(%rip), %rax     # 0xd9fc0
movq (%rax), %rdi
leaq 0x604ee(%rip), %rsi     # 0x9993a
movq %rbx, %rdx
xorl %eax, %eax
callq 0xe6a0
pushq $-0x1
popq %rdi
callq 0xe570
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/ply.cpp
// Function: write_scalar_type(_IO_FILE*, int)
void write_scalar_type (FILE *fp, int code)
{
  /* make sure this is a valid code */

  if (code <= PLY_START_TYPE || code >= PLY_END_TYPE) {
    fprintf (stderr, "write_scalar_type: bad data code = %d\n", code);
    exit (-1);
  }

  /* write the code to a file */

  fprintf (fp, "%s", type_names[code]);
}

// Assembly:
movl %esi, %edx
leal -0x9(%rdx), %eax
cmpl $-0x9, %eax
jbe 0x39661
movq %rdi, %rsi
movl %edx, %eax
leaq 0xa13d8(%rip), %rcx     # 0xdaa30
movq (%rcx,%rax,8), %rdi
jmp 0xe530
pushq %rax
movq 0xa0957(%rip), %rax     # 0xd9fc0
movq (%rax), %rdi
leaq 0x60624(%rip), %rsi     # 0x99c97
xorl %eax, %eax
callq 0xe6a0
pushq $-0x1
popq %rdi
callq 0xe570
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/ply.cpp
// Function: ply_put_element_setup
void ply_put_element_setup(PlyFile *plyfile, char *elem_name)
{
  PlyElement *elem;

  elem = find_element (plyfile, elem_name);
  if (elem == NULL) {
    fprintf(stderr, "ply_elements_setup: can't find element '%s'\n", elem_name);
    exit (-1);
  }

  plyfile->which_elem = elem;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
callq 0x39180
testq %rax, %rax
je 0x396a2
movq %rax, 0x40(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq 0xa0917(%rip), %rax     # 0xd9fc0
movq (%rax), %rdi
leaq 0x6037f(%rip), %rsi     # 0x99a32
movq %rbx, %rdx
xorl %eax, %eax
callq 0xe6a0
pushq $-0x1
popq %rdi
callq 0xe570
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/ply.cpp
// Function: get_stored_item(void*, int, int*, unsigned int*, double*)
void get_stored_item(
  void *ptr,
  int type,
  int *int_val,
  unsigned int *uint_val,
  double *double_val
)
{
  switch (type) {
    case PLY_CHAR:
      *int_val = *((char *) ptr);
      *uint_val = *int_val;
      *double_val = *int_val;
      break;
    case PLY_UCHAR:
      *uint_val = *((unsigned char *) ptr);
      *int_val = *uint_val;
      *double_val = *uint_val;
      break;
    case PLY_SHORT:
      *int_val = *((short int *) ptr);
      *uint_val = (*int_val >= 0) ? *int_val : 0;
      *double_val = *int_val;
      break;
    case PLY_USHORT:
      *uint_val = *((unsigned short int *) ptr);
      *int_val = *uint_val;
      *double_val = *uint_val;
      break;
    case PLY_INT:
      *int_val = *((int *) ptr);
      *uint_val = (*int_val >= 0) ? *int_val : 0;
      *double_val = *int_val;
      break;
    case PLY_UINT:
      *uint_val = *((unsigned int *) ptr);
      *int_val = *uint_val;
      *double_val = *uint_val;
      break;
    case PLY_FLOAT:
      *double_val = *((float *) ptr);
      *int_val = (int) *double_val;
      *uint_val = (*double_val >= 0) ? (unsigned int) *double_val : 0;
      break;
    case PLY_DOUBLE:
      *double_val = *((double *) ptr);
      *int_val = (int) *double_val;
      *uint_val = (*double_val >= 0) ? (unsigned int) *double_val : 0;
      break;
    default:
      fprintf (stderr, "get_stored_item: bad type = %d\n", type);
      exit (-1);
  }
}

// Assembly:
movl %esi, %eax
leal -0x1(%rax), %esi
cmpl $0x7, %esi
ja 0x39a31
leaq 0x5fdef(%rip), %rax     # 0x99790
movslq (%rax,%rsi,4), %rsi
addq %rax, %rsi
jmpq *%rsi
movsbl (%rdi), %eax
movl %eax, (%rdx)
movl %eax, (%rcx)
jmp 0x399f6
movzwl (%rdi), %eax
jmp 0x399fe
movl (%rdi), %eax
movl %eax, (%rdx)
xorl %esi, %esi
testl %eax, %eax
cmovgl %eax, %esi
jmp 0x399f4
movzbl (%rdi), %eax
jmp 0x399fe
movsd (%rdi), %xmm0
movsd %xmm0, (%r8)
cvttsd2si %xmm0, %eax
movl %eax, (%rdx)
xorpd %xmm1, %xmm1
maxsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
jmp 0x39a2e
movswl (%rdi), %eax
xorl %esi, %esi
testl %eax, %eax
movl %eax, (%rdx)
cmovnsl %eax, %esi
movl %esi, (%rcx)
cvtsi2sdl (%rdx), %xmm0
jmp 0x39a09
movl (%rdi), %eax
movl %eax, (%rcx)
movl %eax, (%rdx)
movl (%rcx), %eax
cvtsi2sd %rax, %xmm0
movsd %xmm0, (%r8)
retq
movss (%rdi), %xmm0
cvtss2sd %xmm0, %xmm1
movsd %xmm1, (%r8)
cvttss2si %xmm0, %eax
movl %eax, (%rdx)
xorps %xmm1, %xmm1
maxss %xmm1, %xmm0
cvttss2si %xmm0, %rax
movl %eax, (%rcx)
retq
pushq %rax
movq 0xa0587(%rip), %rcx     # 0xd9fc0
movq (%rcx), %rdi
leaq 0x60327(%rip), %rsi     # 0x99d6a
movl %eax, %edx
xorl %eax, %eax
callq 0xe6a0
pushq $-0x1
popq %rdi
callq 0xe570
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/ply.cpp
// Function: write_ascii_item(_IO_FILE*, int, unsigned int, double, int)
void write_ascii_item(
  FILE *fp,
  int int_val,
  unsigned int uint_val,
  double double_val,
  int type
)
{
  switch (type) {
    case PLY_CHAR:
    case PLY_SHORT:
    case PLY_INT:
      fprintf (fp, "%d ", int_val);
      break;
    case PLY_UCHAR:
    case PLY_USHORT:
    case PLY_UINT:
      fprintf (fp, "%u ", uint_val);
      break;
    case PLY_FLOAT:
    case PLY_DOUBLE:
      fprintf (fp, "%g ", double_val);
      break;
    default:
      fprintf (stderr, "write_ascii_item: bad type = %d\n", type);
      exit (-1);
  }
}

// Assembly:
cmpl $0x8, %ecx
ja 0x39a9c
movl %esi, %eax
pushq $0xe
popq %rsi
btl %ecx, %esi
jb 0x39a74
pushq $0x70
popq %rax
btl %ecx, %eax
jae 0x39a84
leaq 0x602cf(%rip), %rsi     # 0x99d41
jmp 0x39a7d
leaq 0x602c2(%rip), %rsi     # 0x99d3d
movl %eax, %edx
xorl %eax, %eax
jmp 0xe6a0
movl $0x180, %eax            # imm = 0x180
btl %ecx, %eax
jae 0x39a9c
leaq 0x5fa5e(%rip), %rsi     # 0x994f3
movb $0x1, %al
jmp 0xe6a0
pushq %rax
movq 0xa051c(%rip), %rax     # 0xd9fc0
movq (%rax), %rdi
leaq 0x6029b(%rip), %rsi     # 0x99d49
movl %ecx, %edx
xorl %eax, %eax
callq 0xe6a0
pushq $-0x1
popq %rdi
callq 0xe570
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/ply.cpp
// Function: write_binary_item(_IO_FILE*, int, int, unsigned int, double, int)
void write_binary_item(
  FILE *fp,
  int file_type,
  int int_val,
  unsigned int uint_val,
  double double_val,
  int type
)
{
  unsigned char uchar_val;
  char char_val;
  unsigned short ushort_val;
  short short_val;
  float float_val;
  void  *value;
  
  switch (type) {
    case PLY_CHAR:
      char_val = int_val;
      value = &char_val;
      break;
    case PLY_SHORT:
      short_val = int_val;
      value = &short_val;
      break;
    case PLY_INT:
      value = &int_val;
      break;
    case PLY_UCHAR:
      uchar_val = uint_val;
      value = &uchar_val;
      break;
    case PLY_USHORT:
      ushort_val = uint_val;
      value = &ushort_val;
      break;
    case PLY_UINT:
      value = &uint_val;
      break;
    case PLY_FLOAT:
      float_val = double_val;
      value = &float_val;
      break;
    case PLY_DOUBLE:
      value = &double_val;
      break;
    default:
      fprintf (stderr, "write_binary_item: bad type = %d\n", type);
      exit (-1);
  }

  if ((file_type != native_binary_type) && (ply_type_size[type] > 1))
     swap_bytes((char *)value, ply_type_size[type]);
  
  fwrite (value, ply_type_size[type], 1, fp);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movl %edx, 0x14(%rsp)
movl %ecx, 0x10(%rsp)
movsd %xmm0, 0x18(%rsp)
leal -0x1(%r8), %eax
cmpl $0x7, %eax
ja 0x39b94
movq %rdi, %rbx
leaq 0x5fcc3(%rip), %rdi     # 0x997b0
movslq (%rdi,%rax,4), %rax
addq %rdi, %rax
jmpq *%rax
leaq 0xc(%rsp), %r14
movb %dl, (%r14)
jmp 0x39b43
leaq 0xc(%rsp), %r14
movw %cx, (%r14)
jmp 0x39b43
leaq 0x14(%rsp), %r14
jmp 0x39b43
leaq 0xc(%rsp), %r14
movb %cl, (%r14)
jmp 0x39b43
leaq 0x18(%rsp), %r14
jmp 0x39b43
leaq 0xc(%rsp), %r14
movw %dx, (%r14)
jmp 0x39b43
leaq 0x10(%rsp), %r14
jmp 0x39b43
cvtsd2ss %xmm0, %xmm0
leaq 0xc(%rsp), %r14
movss %xmm0, (%r14)
movzbl 0x4a202e(%rip), %eax    # 0x4dbb78
decl %eax
orl $0x3, %eax
cmpl %esi, %eax
setne %al
movl %r8d, %ecx
leaq 0xa0f22(%rip), %rdx     # 0xdaa80
movl (%rdx,%rcx,4), %esi
movslq %esi, %r15
cmpl $0x2, %esi
setge %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x39b79
movq %r14, %rdi
callq 0x3b1a7
pushq $0x1
popq %rdx
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rcx
callq 0xe8e0
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq 0xa0425(%rip), %rax     # 0xd9fc0
movq (%rax), %rdi
leaq 0x60176(%rip), %rsi     # 0x99d1b
movl %r8d, %edx
xorl %eax, %eax
callq 0xe6a0
pushq $-0x1
popq %rdi
callq 0xe570
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/ply.cpp
// Function: ply_put_comment
void ply_put_comment(PlyFile *plyfile, char *comment)
{
  /* (re)allocate space for new comment */
  if (plyfile->num_comments == 0)
    plyfile->comments = (char **) myalloc (sizeof (char *));
  else
    plyfile->comments = (char **) realloc (plyfile->comments,
                         sizeof (char *) * (plyfile->num_comments + 1));

  /* add comment to list */
  plyfile->comments[plyfile->num_comments] = my_strdup (comment);
  plyfile->num_comments++;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movslq 0x20(%rdi), %rax
testq %rax, %rax
je 0x39bdd
movq 0x28(%rbx), %rdi
leaq 0x8(,%rax,8), %rsi
callq 0xe7d0
jmp 0x39bf1
leaq 0x5fcb7(%rip), %rdx     # 0x9989b
pushq $0x8
popq %rdi
movl $0x294, %esi            # imm = 0x294
callq 0x38f69
movq %rax, 0x28(%rbx)
movq %r14, %rdi
callq 0x38fa9
movq 0x28(%rbx), %rcx
movslq 0x20(%rbx), %rdx
movq %rax, (%rcx,%rdx,8)
leal 0x1(%rdx), %eax
movl %eax, 0x20(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/ply.cpp
// Function: ply_put_obj_info
void ply_put_obj_info(PlyFile *plyfile, char *obj_info)
{
  /* (re)allocate space for new info */
  if (plyfile->num_obj_info == 0)
    plyfile->obj_info = (char **) myalloc (sizeof (char *));
  else
    plyfile->obj_info = (char **) realloc (plyfile->obj_info,
                         sizeof (char *) * (plyfile->num_obj_info + 1));

  /* add info to list */
  plyfile->obj_info[plyfile->num_obj_info] = my_strdup (obj_info);
  plyfile->num_obj_info++;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movslq 0x30(%rdi), %rax
testq %rax, %rax
je 0x39c3d
movq 0x38(%rbx), %rdi
leaq 0x8(,%rax,8), %rsi
callq 0xe7d0
jmp 0x39c51
leaq 0x5fc57(%rip), %rdx     # 0x9989b
pushq $0x8
popq %rdi
movl $0x2ac, %esi            # imm = 0x2AC
callq 0x38f69
movq %rax, 0x38(%rbx)
movq %r14, %rdi
callq 0x38fa9
movq 0x38(%rbx), %rcx
movslq 0x30(%rbx), %rdx
movq %rax, (%rcx,%rdx,8)
leal 0x1(%rdx), %eax
movl %eax, 0x30(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/ply.cpp
// Function: equal_strings
int equal_strings(const char *s1, const char *s2)
{

  while (*s1 && *s2)
    if (*s1++ != *s2++)
      return (0);

  if (*s1 != *s2)
    return (0);
  else
    return (1);
}

// Assembly:
xorl %eax, %eax
movb (%rdi,%rax), %cl
movb (%rsi,%rax), %dl
testb %cl, %cl
je 0x3a0b3
testb %dl, %dl
je 0x3a0b3
incq %rax
cmpb %dl, %cl
je 0x3a09b
xorl %eax, %eax
retq
xorl %eax, %eax
cmpb %dl, %cl
sete %al
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/ply.cpp
// Function: add_element(PlyFile*, char**)
void add_element (PlyFile *plyfile, char **words)
{
  PlyElement *elem;

  /* create the new element */
  elem = (PlyElement *) myalloc (sizeof (PlyElement));
  elem->name = my_strdup (words[1]);
  elem->num = atoi (words[2]);
  elem->nprops = 0;

  /* make room for new element in the object's list of elements */
  if (plyfile->nelems == 0)
    plyfile->elems = (PlyElement **) myalloc (sizeof (PlyElement *));
  else
    plyfile->elems = (PlyElement **) realloc (plyfile->elems,
                     sizeof (PlyElement *) * (plyfile->nelems + 1));

  /* add the new element to the object's list */
  plyfile->elems[plyfile->nelems] = elem;
  plyfile->nelems++;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x5f7ce(%rip), %rdx     # 0x9989b
pushq $0x30
popq %rdi
movl $0xa00, %esi            # imm = 0xA00
callq 0x38f69
movq %rax, %r14
movq 0x8(%r15), %rdi
callq 0x38fa9
movq %rax, (%r14)
movq 0x10(%r15), %rdi
callq 0xe730
movl %eax, 0x8(%r14)
andl $0x0, 0x10(%r14)
movslq 0x10(%rbx), %rax
testq %rax, %rax
je 0x3a117
movq 0x18(%rbx), %rdi
leaq 0x8(,%rax,8), %rsi
callq 0xe7d0
jmp 0x3a12b
leaq 0x5f77d(%rip), %rdx     # 0x9989b
pushq $0x8
popq %rdi
movl $0xa07, %esi            # imm = 0xA07
callq 0x38f69
movq %rax, 0x18(%rbx)
movslq 0x10(%rbx), %rcx
movq %r14, (%rax,%rcx,8)
leal 0x1(%rcx), %eax
movl %eax, 0x10(%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/ply.cpp
// Function: add_property(PlyFile*, char**)
void add_property (PlyFile *plyfile, char **words)
{
  PlyProperty *prop;
  PlyElement *elem;

  /* create the new property */

  prop = (PlyProperty *) myalloc (sizeof (PlyProperty));

  if (equal_strings (words[1], "list")) {       /* is a list */
    prop->count_external = get_prop_type (words[2]);
    prop->external_type = get_prop_type (words[3]);
    prop->name = my_strdup (words[4]);
    prop->is_list = 1;
  }
  else {                                        /* not a list */
    prop->external_type = get_prop_type (words[1]);
    prop->name = my_strdup (words[2]);
    prop->is_list = 0;
  }

  /* add this property to the list of properties of the current element */

  elem = plyfile->elems[plyfile->nelems - 1];

  if (elem->nprops == 0)
    elem->props = (PlyProperty **) myalloc (sizeof (PlyProperty *));
  else
    elem->props = (PlyProperty **) realloc (elem->props,
                  sizeof (PlyProperty *) * (elem->nprops + 1));

  elem->props[elem->nprops] = prop;
  elem->nprops++;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %r14
leaq 0x5f740(%rip), %rdx     # 0x9989b
pushq $0x28
popq %rdi
movl $0xa44, %esi            # imm = 0xA44
callq 0x38f69
movq %rax, %rbx
movq 0x8(%r15), %r12
leaq 0x5fc97(%rip), %rsi     # 0x99e0d
movq %r12, %rdi
callq 0x3a099
testl %eax, %eax
je 0x3a199
movq 0x10(%r15), %rdi
callq 0x3b2e8
movl %eax, 0x18(%rbx)
movq 0x18(%r15), %r12
pushq $0x1
popq %rbp
pushq $0x20
jmp 0x3a19d
xorl %ebp, %ebp
pushq $0x10
popq %r13
movq %r12, %rdi
callq 0x3b2e8
movl %eax, 0x8(%rbx)
movq (%r15,%r13), %rdi
callq 0x38fa9
movq %rax, (%rbx)
movl %ebp, 0x14(%rbx)
movq 0x18(%r14), %rax
movslq 0x10(%r14), %rcx
movq -0x8(%rax,%rcx,8), %r14
movslq 0x10(%r14), %rax
testq %rax, %rax
je 0x3a1e2
movq 0x18(%r14), %rdi
leaq 0x8(,%rax,8), %rsi
callq 0xe7d0
jmp 0x3a1f6
leaq 0x5f6b2(%rip), %rdx     # 0x9989b
pushq $0x8
popq %rdi
movl $0xa57, %esi            # imm = 0xA57
callq 0x38f69
movq %rax, 0x18(%r14)
movslq 0x10(%r14), %rcx
movq %rbx, (%rax,%rcx,8)
leal 0x1(%rcx), %eax
movl %eax, 0x10(%r14)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/ply.cpp
// Function: ply_open_for_reading
PlyFile *ply_open_for_reading(
  char *filename,
  int *nelems,
  char ***elem_names,
  int *file_type,
  float *version
)
{
  FILE *fp;
  PlyFile *plyfile;
  char *name;

  /* tack on the extension .ply, if necessary */

  name = (char *) myalloc (sizeof (char) * (strlen (filename) + 5));
  strcpy (name, filename);
  if (strlen (name) < 4 ||
      strcmp (name + strlen (name) - 4, ".ply") != 0)
      strcat (name, ".ply");

  /* open the file for reading */

  fp = fopen (name, "r");
  if (fp == NULL)
    return (NULL);

  /* create the PlyFile data structure */

  plyfile = ply_read (fp, nelems, elem_names);

  /* determine the file type and version */

  *file_type = plyfile->file_type;
  *version = plyfile->version;

  /* return a pointer to the file's information */

  return (plyfile);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %rbx
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %rbp
callq 0xe1e0
leal 0x5(%rax), %edi
leaq 0x5f626(%rip), %rdx     # 0x9989b
movl $0x365, %esi            # imm = 0x365
callq 0x38f69
movq %rax, %r13
movq %rax, %rdi
movq %rbp, %rsi
callq 0xe3e0
movq %r13, %rdi
callq 0xe1e0
cmpq $0x4, %rax
jb 0x3a2b3
leaq (%rax,%r13), %rdi
addq $-0x4, %rdi
leaq 0x59072(%rip), %rsi     # 0x9331c
callq 0xe670
testl %eax, %eax
je 0x3a2ca
movq %r13, %rdi
callq 0xe1e0
movl $0x796c702e, (%r13,%rax) # imm = 0x796C702E
movb $0x0, 0x4(%r13,%rax)
leaq 0x62822(%rip), %rsi     # 0x9caf3
movq %r13, %rdi
callq 0xe550
testq %rax, %rax
je 0x3a2fd
movq %rax, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x39c77
movl 0x8(%rax), %ecx
movl %ecx, (%r14)
movss 0xc(%rax), %xmm0
movss %xmm0, (%rbx)
jmp 0x3a2ff
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/ply.cpp
// Function: ply_get_element_description
PlyProperty **ply_get_element_description(
  PlyFile *plyfile,
  char *elem_name,
  int *nelems,
  int *nprops
)
{
  int i;
  PlyElement *elem;
  PlyProperty *prop;
  PlyProperty **prop_list;

  /* find information about the element */
  elem = find_element (plyfile, elem_name);
  if (elem == NULL)
    return (NULL);

  *nelems = elem->num;
  *nprops = elem->nprops;

  /* make a copy of the element's property list */
  prop_list = (PlyProperty **) myalloc (sizeof (PlyProperty *) * elem->nprops);
  for (i = 0; i < elem->nprops; i++) {
    prop = (PlyProperty *) myalloc (sizeof (PlyProperty));
    copy_property (prop, elem->props[i]);
    prop_list[i] = prop;
  }

  /* return this duplicate property list */
  return (prop_list);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r14
movq %rdx, %r15
callq 0x39180
testq %rax, %rax
je 0x3a38c
movq %rax, %rbx
movl 0x8(%rax), %eax
movl %eax, (%r15)
movl 0x10(%rbx), %edi
movl %edi, (%r14)
shll $0x3, %edi
leaq 0x5f559(%rip), %r15     # 0x9989b
movl $0x3a2, %esi            # imm = 0x3A2
movq %r15, %rdx
callq 0x38f69
movq %rax, %r14
xorl %r13d, %r13d
pushq $0x28
popq %rbp
movslq 0x10(%rbx), %rax
cmpq %rax, %r13
jge 0x3a38f
movl %ebp, %edi
movl $0x3a4, %esi            # imm = 0x3A4
movq %r15, %rdx
callq 0x38f69
movq %rax, %r12
movq 0x18(%rbx), %rax
movq (%rax,%r13,8), %rsi
movq %r12, %rdi
callq 0x391ce
movq %r12, (%r14,%r13,8)
incq %r13
jmp 0x3a358
xorl %r14d, %r14d
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/ply.cpp
// Function: ply_get_element_setup
void ply_get_element_setup(
  PlyFile *plyfile,
  char *elem_name,
  int nprops,
  PlyProperty *prop_list
)
{
  int i;
  PlyElement *elem;
  PlyProperty *prop;
  int index;

  /* find information about the element */
  elem = find_element (plyfile, elem_name);
  plyfile->which_elem = elem;

  /* deposit the property information into the element's description */
  for (i = 0; i < nprops; i++) {

    /* look for actual property */
    prop = find_property (elem, prop_list[i].name, &index);
    if (prop == NULL) {
      fprintf (stderr, "Warning:  Can't find property '%s' in element '%s'\n",
               prop_list[i].name, elem_name);
      continue;
    }

    /* store its description */
    prop->internal_type = prop_list[i].internal_type;
    prop->offset = prop_list[i].offset;
    prop->count_internal = prop_list[i].count_internal;
    prop->count_offset = prop_list[i].count_offset;

    /* specify that the user wants this property */
    elem->store_prop[index] = STORE_PROP;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, %rbx
movl %edx, %r12d
movq %rdi, %r13
movq %rsi, 0x10(%rsp)
callq 0x39180
movq %rax, %r15
movq %rax, 0x40(%r13)
xorl %eax, %eax
testl %r12d, %r12d
cmovlel %eax, %r12d
imulq $0x28, %r12, %r13
leaq 0xc(%rsp), %r12
xorl %r14d, %r14d
cmpq %r14, %r13
je 0x3a441
movq (%rbx,%r14), %rbp
movq %r15, %rdi
movq %rbp, %rsi
movq %r12, %rdx
callq 0x3a450
testq %rax, %rax
je 0x3a41f
movq 0xc(%rbx,%r14), %rcx
movq %rcx, 0xc(%rax)
movq 0x1c(%rbx,%r14), %rcx
movq %rcx, 0x1c(%rax)
movq 0x20(%r15), %rax
movslq 0xc(%rsp), %rcx
movb $0x1, (%rax,%rcx)
addq $0x28, %r14
jmp 0x3a3de
movq 0x9fb9a(%rip), %rax     # 0xd9fc0
movq (%rax), %rdi
leaq 0x5f731(%rip), %rsi     # 0x99b61
movq %rbp, %rdx
movq 0x10(%rsp), %rcx
xorl %eax, %eax
callq 0xe6a0
jmp 0x3a419
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/ply.cpp
// Function: find_property(PlyElement*, char*, int*)
PlyProperty *find_property(PlyElement *elem, char *prop_name, int *index)
{
  int i;

  for (i = 0; i < elem->nprops; i++)
    if (equal_strings (prop_name, elem->props[i]->name)) {
      *index = i;
      return (elem->props[i]);
    }

  *index = -1;
  return (NULL);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, (%rsp)
movq %rsi, %r14
movq %rdi, %r15
movl 0x10(%rdi), %ebx
xorl %r13d, %r13d
testl %ebx, %ebx
cmovlel %r13d, %ebx
pushq $-0x1
popq %rbp
cmpq %r13, %rbx
je 0x3a496
movq 0x18(%r15), %rax
movq (%rax,%r13,8), %r12
movq (%r12), %rsi
movq %r14, %rdi
callq 0x3a099
testl %eax, %eax
jne 0x3a49b
incq %r13
jmp 0x3a474
xorl %r12d, %r12d
jmp 0x3a49e
movl %r13d, %ebp
movq (%rsp), %rax
movl %ebp, (%rax)
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/ply.cpp
// Function: ply_get_property
void ply_get_property(
  PlyFile *plyfile,
  char *elem_name,
  PlyProperty *prop
)
{
  PlyElement *elem;
  PlyProperty *prop_ptr;
  int index;

  /* find information about the element */
  elem = find_element (plyfile, elem_name);
  plyfile->which_elem = elem;

  /* deposit the property information into the element's description */

  prop_ptr = find_property (elem, prop->name, &index);
  if (prop_ptr == NULL) {
    fprintf (stderr, "Warning:  Can't find property '%s' in element '%s'\n",
             prop->name, elem_name);
    return;
  }
  prop_ptr->internal_type  = prop->internal_type;
  prop_ptr->offset         = prop->offset;
  prop_ptr->count_internal = prop->count_internal;
  prop_ptr->count_offset   = prop->count_offset;

  /* specify that the user wants this property */
  elem->store_prop[index] = STORE_PROP;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r12
callq 0x39180
movq %rax, %r15
movq %rax, 0x40(%r12)
movq (%r14), %r12
leaq 0x4(%rsp), %rdx
movq %rax, %rdi
movq %r12, %rsi
callq 0x3a450
testq %rax, %rax
je 0x3a515
movq 0xc(%r14), %rcx
movq %rcx, 0xc(%rax)
movq 0x1c(%r14), %rcx
movq %rcx, 0x1c(%rax)
movq 0x20(%r15), %rax
movslq 0x4(%rsp), %rcx
movb $0x1, (%rax,%rcx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq 0x9faa4(%rip), %rax     # 0xd9fc0
movq (%rax), %rdi
leaq 0x5f63b(%rip), %rsi     # 0x99b61
movq %r12, %rdx
movq %rbx, %rcx
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0xe6a0
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/ply.cpp
// Function: ply_describe_other_elements
void ply_describe_other_elements (
  PlyFile *plyfile,
  PlyOtherElems *other_elems
)
{
  int i;
  OtherElem *other;
  PlyElement *elem;
  
  /* ignore this call if there is no other element */
  if (other_elems == NULL)
    return;

  /* save pointer to this information */
  plyfile->other_elems = other_elems;

  /* describe the other properties of this element */
  /* store them in the main element list as elements with
     only other properties */
  
  REALLOCN(plyfile->elems, PlyElement *,
	   plyfile->nelems, plyfile->nelems + other_elems->num_elems);
  for (i = 0; i < other_elems->num_elems; i++) {
      other = &(other_elems->other_list[i]);
      elem = (PlyElement *) myalloc (sizeof (PlyElement));
      plyfile->elems[plyfile->nelems++] = elem;
      elem->name = my_strdup (other->elem_name);
      elem->num = other->elem_count;
      elem->nprops = 0;
      ply_describe_other_properties (plyfile, other->other_props,
				     offsetof(OtherData,other_props));
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rsi, %rsi
je 0x3ae2e
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, 0x48(%rdi)
movslq 0x10(%rdi), %rax
testq %rax, %rax
je 0x3ad51
movq 0x18(%r14), %rdi
movslq (%rbx), %rsi
addq %rax, %rsi
shlq $0x3, %rsi
callq 0xe7d0
movq %rax, 0x18(%r14)
testq %rax, %rax
je 0x3ad91
movl (%rbx), %r15d
jmp 0x3ada1
movl (%rbx), %r15d
pushq $0x8
popq %rsi
movq %r15, %rdi
callq 0xe300
movq %rax, 0x18(%r14)
testq %rax, %rax
jne 0x3adbc
movq 0x9f251(%rip), %rax     # 0xd9fc0
movq (%rax), %rdi
leaq 0x5ee7f(%rip), %rsi     # 0x99bf8
leaq 0x5eb1b(%rip), %rcx     # 0x9989b
movl $0x54c, %edx            # imm = 0x54C
xorl %eax, %eax
callq 0xe6a0
jmp 0x3ae7a
movl (%rbx), %r15d
movl 0x10(%r14), %ecx
addl %r15d, %ecx
jne 0x3ae3d
testl %r15d, %r15d
jle 0x3adbc
movslq 0x10(%r14), %rcx
leaq (%rax,%rcx,8), %rdi
movl %r15d, %edx
shlq $0x3, %rdx
xorl %esi, %esi
callq 0xe270
xorl %r13d, %r13d
xorl %r12d, %r12d
movslq %r15d, %rax
cmpq %rax, %r12
jge 0x3ae2e
movq 0x8(%rbx), %rbp
pushq $0x30
popq %rdi
movl $0x54f, %esi            # imm = 0x54F
leaq 0x5eabe(%rip), %rdx     # 0x9989b
callq 0x38f69
movq %rax, %r15
movq 0x18(%r14), %rax
movslq 0x10(%r14), %rcx
leal 0x1(%rcx), %edx
movl %edx, 0x10(%r14)
movq %r15, (%rax,%rcx,8)
movq (%rbp,%r13), %rdi
callq 0x38fa9
movq %rax, (%r15)
movl 0x8(%rbp,%r13), %eax
movl %eax, 0x8(%r15)
andl $0x0, 0x10(%r15)
movq 0x18(%rbp,%r13), %rsi
movq %r14, %rdi
xorl %edx, %edx
callq 0x392e9
incq %r12
movl (%rbx), %r15d
addq $0x20, %r13
jmp 0x3adc2
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x9f17c(%rip), %r15     # 0xd9fc0
movq (%r15), %rdi
leaq 0x5edd5(%rip), %rsi     # 0x99c23
leaq 0x5ea46(%rip), %rcx     # 0x9989b
movl $0x54c, %edx            # imm = 0x54C
xorl %eax, %eax
callq 0xe6a0
movq (%r15), %rdi
movl 0x10(%r14), %edx
movl (%rbx), %ecx
addl %edx, %ecx
leaq 0x5eddd(%rip), %rsi     # 0x99c50
xorl %eax, %eax
callq 0xe6a0
pushq $-0x1
popq %rdi
callq 0xe570
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/ply.cpp
// Function: ply_put_other_elements
void ply_put_other_elements (PlyFile *plyfile)
{
  int i,j;
  OtherElem *other;

  /* make sure we have other elements to write */
  if (plyfile->other_elems == NULL)
    return;

  /* write out the data for each "other" element */

  for (i = 0; i < plyfile->other_elems->num_elems; i++) {

    other = &(plyfile->other_elems->other_list[i]);
    ply_put_element_setup (plyfile, other->elem_name);

    /* write out each instance of the current element */
    for (j = 0; j < other->elem_count; j++)
      ply_put_element (plyfile, (void *) other->other_data[j]);
  }
}

// Assembly:
movq 0x48(%rdi), %rax
testq %rax, %rax
je 0x3aef1
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r14d, %r14d
movslq (%rax), %rcx
cmpq %rcx, %r14
jge 0x3aee6
movq 0x8(%rax), %rax
movq %r14, %rcx
shlq $0x5, %rcx
leaq (%rax,%rcx), %r15
movq (%rax,%rcx), %rsi
movq %rbx, %rdi
callq 0x39682
xorl %r12d, %r12d
movslq 0x8(%r15), %rax
cmpq %rax, %r12
jge 0x3aedd
movq 0x10(%r15), %rax
movq (%rax,%r12,8), %rsi
movq %rbx, %rdi
callq 0x396c5
incq %r12
jmp 0x3aebf
incq %r14
movq 0x48(%rbx), %rax
jmp 0x3ae99
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/ply.cpp
// Function: get_ascii_item(char*, int, int*, unsigned int*, double*)
void get_ascii_item(
  char *word,
  int type,
  int *int_val,
  unsigned int *uint_val,
  double *double_val
)
{
  switch (type) {
    case PLY_CHAR:
    case PLY_UCHAR:
    case PLY_SHORT:
    case PLY_USHORT:
    case PLY_INT:
      *int_val = atoi (word);
      *uint_val = (*int_val >= 0) ? (unsigned int) *int_val : 0;
      *double_val = (double) *int_val;
      break;

    case PLY_UINT:
      *uint_val = strtol (word, (char **) NULL, 10);
      *int_val = (int) *uint_val;
      *double_val = (double) *uint_val;
      break;

    case PLY_FLOAT:
    case PLY_DOUBLE:
      *double_val = atof (word);
      *int_val = (int) *double_val;
      *uint_val = (*double_val >= 0) ? (unsigned int) *double_val : 0;
      break;

    default:
      fprintf (stderr, "get_ascii_item: bad type = %d\n", type);
      exit (-1);
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %r8, %r14
movq %rcx, %rbx
movq %rdx, %r15
movl %esi, %edx
leal -0x1(%rdx), %eax
cmpl $0x5, %eax
jae 0x3af55
callq 0xe730
movl %eax, (%r15)
xorl %ecx, %ecx
testl %eax, %eax
cmovgl %eax, %ecx
movl %ecx, (%rbx)
cvtsi2sdl (%r15), %xmm0
movsd %xmm0, (%r14)
jmp 0x3af7d
leal -0x7(%rdx), %eax
cmpl $0x2, %eax
jae 0x3af83
callq 0xe5a0
movsd %xmm0, (%r14)
cvttsd2si %xmm0, %eax
movl %eax, (%r15)
xorpd %xmm1, %xmm1
maxsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
movl %eax, (%rbx)
popq %rbx
popq %r14
popq %r15
retq
cmpl $0x6, %edx
jne 0x3afa0
pushq $0xa
popq %rdx
xorl %esi, %esi
callq 0xe680
movl %eax, (%rbx)
movl %eax, (%r15)
movl (%rbx), %eax
cvtsi2sd %rax, %xmm0
jmp 0x3af4e
movq 0x9f019(%rip), %rax     # 0xd9fc0
movq (%rax), %rdi
leaq 0x5ee1c(%rip), %rsi     # 0x99dcd
xorl %eax, %eax
callq 0xe6a0
pushq $-0x1
popq %rdi
callq 0xe570
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/ply.cpp
// Function: swap_bytes(char*, int)
void swap_bytes(char *bytes, int num_bytes)
{
    int i;
    char temp;
    
    for (i=0; i < num_bytes/2; i++)
    {
	temp = bytes[i];
	bytes[i] = bytes[(num_bytes-1)-i];
	bytes[(num_bytes-1)-i] = temp;
    }
}

// Assembly:
pushq $0x2
popq %rcx
movl %esi, %eax
cltd
idivl %ecx
cltq
decl %esi
xorl %ecx, %ecx
cmpq %rax, %rcx
jge 0x3b1d2
movb (%rdi,%rcx), %dl
movslq %esi, %rsi
movb (%rdi,%rsi), %r8b
movb %r8b, (%rdi,%rcx)
movb %dl, (%rdi,%rsi)
incq %rcx
decl %esi
jmp 0x3b1b5
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/ply.cpp
// Function: get_prop_type(char*)
int get_prop_type(char *type_name)
{
  int i;

  for (i = PLY_START_TYPE + 1; i < PLY_END_TYPE; i++)
    if (equal_strings (type_name, type_names[i]))
      return (i);

  static char *new_type_names[] = {
    "invalid",
    "int8", "int16", "int32",
    "uint8", "uint16", "uint32",
    "float32", "float64",
  };

  for (i = PLY_START_TYPE + 1; i < PLY_END_TYPE; i++)
    if (equal_strings (type_name, new_type_names[i]))
      return (i);

  /* if we get here, we didn't find the type */
  return (0);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %r14
pushq $0x1
popq %rbx
leaq 0x9f736(%rip), %r15     # 0xdaa30
cmpq $0x9, %rbx
je 0x3b315
movq (%r15,%rbx,8), %rsi
movq %r14, %rdi
callq 0x3a099
testl %eax, %eax
jne 0x3b33f
incq %rbx
jmp 0x3b2fa
pushq $0x1
popq %rbx
leaq 0x5e531(%rip), %r15     # 0x99850
cmpq $0x9, %rbx
je 0x3b33d
movslq (%r15,%rbx,4), %rsi
addq %r15, %rsi
movq %r14, %rdi
callq 0x3a099
testl %eax, %eax
jne 0x3b33f
incq %rbx
jmp 0x3b31f
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
nop