// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Shapes/ply.cpp
// Function: ply_header_complete
void ply_header_complete(PlyFile *plyfile)
{
  int i,j;
  FILE *fp = plyfile->fp;
  PlyElement *elem;
  PlyProperty *prop;

  fprintf (fp, "ply\n");

  switch (plyfile->file_type) {
    case PLY_ASCII:
      fprintf (fp, "format ascii 1.0\n");
      break;
    case PLY_BINARY_BE:
      fprintf (fp, "format binary_big_endian 1.0\n");
      break;
    case PLY_BINARY_LE:
      fprintf (fp, "format binary_little_endian 1.0\n");
      break;
    default:
      fprintf (stderr, "ply_header_complete: bad file type = %d\n",
               plyfile->file_type);
      exit (-1);
  }

  /* write out the comments */

  for (i = 0; i < plyfile->num_comments; i++)
    fprintf (fp, "comment %s\n", plyfile->comments[i]);

  /* write out object information */

  for (i = 0; i < plyfile->num_obj_info; i++)
    fprintf (fp, "obj_info %s\n", plyfile->obj_info[i]);

  /* write out information about each element */

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

    elem = plyfile->elems[i];
    fprintf (fp, "element %s %d\n", elem->name, elem->num);

    /* write out each property */
    for (j = 0; j < elem->nprops; j++) {
      prop = elem->props[j];
      if (prop->is_list) {
        fprintf (fp, "property list ");
        write_scalar_type (fp, prop->count_external);
        fprintf (fp, " ");
        write_scalar_type (fp, prop->external_type);
        fprintf (fp, " %s\n", prop->name);
      }
      else {
        fprintf (fp, "property ");
        write_scalar_type (fp, prop->external_type);
        fprintf (fp, " %s\n", prop->name);
      }
    }
  }

  fprintf (fp, "end_header\n");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r12
movq (%rdi), %rbx
leaq 0x6a5ee(%rip), %rdi     # 0xa89b6
movl $0x4, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0xe8b0
movl 0x8(%r12), %edi
cmpl $0x3, %edi
je 0x3e40e
cmpl $0x2, %edi
je 0x3e400
cmpl $0x1, %edi
jne 0x3e59c
leaq 0x6a5c2(%rip), %rdi     # 0xa89bb
movl $0x11, %esi
jmp 0x3e41a
leaq 0x6a5c6(%rip), %rdi     # 0xa89cd
movl $0x1d, %esi
jmp 0x3e41a
leaq 0x6a5d6(%rip), %rdi     # 0xa89eb
movl $0x20, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0xe8b0
cmpl $0x0, 0x20(%r12)
jle 0x3e45c
leaq 0x6a5ff(%rip), %r15     # 0xa8a35
xorl %r14d, %r14d
movq 0x28(%r12), %rax
movq (%rax,%r14,8), %rdx
movq %rbx, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0xe670
incq %r14
movslq 0x20(%r12), %rax
cmpq %rax, %r14
jl 0x3e439
cmpl $0x0, 0x30(%r12)
jle 0x3e491
leaq 0x6a5d6(%rip), %r15     # 0xa8a41
xorl %r14d, %r14d
movq 0x38(%r12), %rax
movq (%rax,%r14,8), %rdx
movq %rbx, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0xe670
incq %r14
movslq 0x30(%r12), %rax
cmpq %rax, %r14
jl 0x3e46e
cmpl $0x0, 0x10(%r12)
jle 0x3e575
leaq 0x6b07c(%rip), %r13     # 0xa9520
xorl %r15d, %r15d
movq %r12, (%rsp)
movq 0x18(%r12), %rax
movq (%rax,%r15,8), %r14
movq (%r14), %rdx
movl 0x8(%r14), %ecx
movq %rbx, %rdi
leaq 0x6a589(%rip), %rsi     # 0xa8a4e
xorl %eax, %eax
callq 0xe670
cmpl $0x0, 0x10(%r14)
jle 0x3e560
xorl %r12d, %r12d
movq 0x18(%r14), %rax
movq (%rax,%r12,8), %rbp
cmpl $0x0, 0x14(%rbp)
je 0x3e51b
movl $0xe, %esi
movl $0x1, %edx
leaq 0x6a564(%rip), %rdi     # 0xa8a5d
movq %rbx, %rcx
callq 0xe8b0
movl 0x18(%rbp), %esi
movq %rbx, %rdi
callq 0x3e5a1
movl $0x20, %edi
movq %rbx, %rsi
callq 0xe5a0
jmp 0x3e534
movl $0x9, %esi
movl $0x1, %edx
leaq 0x6a540(%rip), %rdi     # 0xa8a6c
movq %rbx, %rcx
callq 0xe8b0
movl 0x8(%rbp), %esi
movq %rbx, %rdi
callq 0x3e5a1
movq (%rbp), %rdx
movq %rbx, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0xe670
incq %r12
movslq 0x10(%r14), %rax
cmpq %rax, %r12
jl 0x3e4da
incq %r15
movq (%rsp), %r12
movslq 0x10(%r12), %rax
cmpq %rax, %r15
jl 0x3e4ab
leaq 0x6a4fa(%rip), %rdi     # 0xa8a76
movl $0xb, %esi
movl $0x1, %edx
movq %rbx, %rcx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xe8b0
callq 0xeb0d