// File: /workspace/github_cpp_makefile_star2_O1/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 0x6a097(%rip), %rdi     # 0xa89b6
movl $0x4, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0xe8b0
movl 0x8(%r12), %edi
cmpl $0x3, %edi
je 0x3e965
cmpl $0x2, %edi
je 0x3e957
cmpl $0x1, %edi
jne 0x3eaf3
leaq 0x6a06b(%rip), %rdi     # 0xa89bb
movl $0x11, %esi
jmp 0x3e971
leaq 0x6a06f(%rip), %rdi     # 0xa89cd
movl $0x1d, %esi
jmp 0x3e971
leaq 0x6a07f(%rip), %rdi     # 0xa89eb
movl $0x20, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0xe8b0
cmpl $0x0, 0x20(%r12)
jle 0x3e9b3
leaq 0x6a0a8(%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 0x3e990
cmpl $0x0, 0x30(%r12)
jle 0x3e9e8
leaq 0x6a07f(%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 0x3e9c5
cmpl $0x0, 0x10(%r12)
jle 0x3eacc
leaq 0x6ab25(%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 0x6a032(%rip), %rsi     # 0xa8a4e
xorl %eax, %eax
callq 0xe670
cmpl $0x0, 0x10(%r14)
jle 0x3eab7
xorl %r12d, %r12d
movq 0x18(%r14), %rax
movq (%rax,%r12,8), %rbp
cmpl $0x0, 0x14(%rbp)
je 0x3ea72
movl $0xe, %esi
movl $0x1, %edx
leaq 0x6a00d(%rip), %rdi     # 0xa8a5d
movq %rbx, %rcx
callq 0xe8b0
movl 0x18(%rbp), %esi
movq %rbx, %rdi
callq 0x3eaf8
movl $0x20, %edi
movq %rbx, %rsi
callq 0xe5a0
jmp 0x3ea8b
movl $0x9, %esi
movl $0x1, %edx
leaq 0x69fe9(%rip), %rdi     # 0xa8a6c
movq %rbx, %rcx
callq 0xe8b0
movl 0x8(%rbp), %esi
movq %rbx, %rdi
callq 0x3eaf8
movq (%rbp), %rdx
movq %rbx, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0xe670
incq %r12
movslq 0x10(%r14), %rax
cmpq %rax, %r12
jl 0x3ea31
incq %r15
movq (%rsp), %r12
movslq 0x10(%r12), %rax
cmpq %rax, %r15
jl 0x3ea02
leaq 0x69fa3(%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 0xeb2b