// File: tomfunkhouser[P]gaps/apps/msh2prp/msh2prp.cpp
// Function: ComputeCoordinateProperties(gaps::R3Mesh*)
static R3MeshPropertySet *
ComputeCoordinateProperties(R3Mesh *mesh)
{
  // Start statistics
  RNTime start_time;
  start_time.Read();
  if (print_verbose) {
    printf("Computing coordinate properties ...\n");
    fflush(stdout);
  }

  // Allocate property set
  R3MeshPropertySet *properties = new R3MeshPropertySet(mesh);
  if (!properties) {
    RNFail("Unable to allocate property set.\n");
    return NULL;
  }

  // Allocate properites
  R3MeshProperty *xposition = new R3MeshProperty(mesh, "XPosition");
  R3MeshProperty *yposition = new R3MeshProperty(mesh, "YPosition");
  R3MeshProperty *zposition = new R3MeshProperty(mesh, "ZPosition");
  R3MeshProperty *xnormal = new R3MeshProperty(mesh, "XNormal");
  R3MeshProperty *ynormal = new R3MeshProperty(mesh, "YNormal");
  R3MeshProperty *znormal = new R3MeshProperty(mesh, "ZNormal");

  // Compute properties
  for (int i = 0; i < mesh->NVertices(); i++) {
    R3MeshVertex *vertex = mesh->Vertex(i);
    const R3Point& position = mesh->VertexPosition(vertex);
    const R3Vector& normal = mesh->VertexNormal(vertex);
    xposition->SetVertexValue(i, position.X());
    yposition->SetVertexValue(i, position.Y());
    zposition->SetVertexValue(i, position.Z());
    xnormal->SetVertexValue(i, normal.X());
    ynormal->SetVertexValue(i, normal.Y());
    znormal->SetVertexValue(i, normal.Z());
  }

  // Insert properties at multiple scales
  InsertProperty(properties, xposition);
  InsertProperty(properties, yposition);
  InsertProperty(properties, zposition);
  InsertProperty(properties, xnormal);
  InsertProperty(properties, ynormal);
  InsertProperty(properties, znormal);

  // Print statistics
  if (print_verbose) {
    printf("  Time = %.2f seconds\n", start_time.Elapsed());
    printf("  # Properties = %d\n", properties->NProperties());
    fflush(stdout);
  }

  // Return property set
  return properties;
}

// Assembly:
subq $0x128, %rsp            # imm = 0x128
movq %rdi, 0x118(%rsp)
leaq 0x108(%rsp), %rdi
callq 0xe98e0
leaq 0x108(%rsp), %rdi
callq 0x1f280
cmpl $0x0, 0x1b48f0(%rip)    # 0x1ca740
je 0x15e6f
leaq 0x15e473(%rip), %rdi    # 0x1742cc
movb $0x0, %al
callq 0x11090
movq 0x1ab129(%rip), %rax    # 0x1c0f90
movq (%rax), %rdi
callq 0x117f0
movl $0x18, %edi
callq 0x11680
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0x98(%rsp)
movq 0x118(%rsp), %rsi
callq 0x24ce0
jmp 0x15e96
movq 0x98(%rsp), %rax
movq %rax, 0x100(%rsp)
cmpq $0x0, 0x100(%rsp)
jne 0x15efb
leaq 0x15e39e(%rip), %rdi    # 0x174256
movb $0x0, %al
callq 0xedb00
movq $0x0, 0x120(%rsp)
jmp 0x16427
movq 0x98(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xf8(%rsp)
movl %eax, 0xf4(%rsp)
movl $0x18, %esi
callq 0x11690
jmp 0x16437
movl $0x448, %edi            # imm = 0x448
callq 0x11680
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0x90(%rsp)
movq 0x118(%rsp), %rsi
leaq 0x15e3cf(%rip), %rdx    # 0x1742f1
xorl %eax, %eax
movl %eax, %ecx
callq 0x27ef0
jmp 0x15f2d
movq 0x90(%rsp), %rax
movq %rax, 0xe8(%rsp)
movl $0x448, %edi            # imm = 0x448
callq 0x11680
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0x88(%rsp)
movq 0x118(%rsp), %rsi
leaq 0x15e397(%rip), %rdx    # 0x1742fb
xorl %eax, %eax
movl %eax, %ecx
callq 0x27ef0
jmp 0x15f6f
movq 0x88(%rsp), %rax
movq %rax, 0xe0(%rsp)
movl $0x448, %edi            # imm = 0x448
callq 0x11680
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0x80(%rsp)
movq 0x118(%rsp), %rsi
leaq 0x15e35f(%rip), %rdx    # 0x174305
xorl %eax, %eax
movl %eax, %ecx
callq 0x27ef0
jmp 0x15fb1
movq 0x80(%rsp), %rax
movq %rax, 0xd8(%rsp)
movl $0x448, %edi            # imm = 0x448
callq 0x11680
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0x78(%rsp)
movq 0x118(%rsp), %rsi
leaq 0x15e32a(%rip), %rdx    # 0x17430f
xorl %eax, %eax
movl %eax, %ecx
callq 0x27ef0
jmp 0x15ff0
movq 0x78(%rsp), %rax
movq %rax, 0xd0(%rsp)
movl $0x448, %edi            # imm = 0x448
callq 0x11680
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0x70(%rsp)
movq 0x118(%rsp), %rsi
leaq 0x15e2f6(%rip), %rdx    # 0x174317
xorl %eax, %eax
movl %eax, %ecx
callq 0x27ef0
jmp 0x1602c
movq 0x70(%rsp), %rax
movq %rax, 0xc8(%rsp)
movl $0x448, %edi            # imm = 0x448
callq 0x11680
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0x68(%rsp)
movq 0x118(%rsp), %rsi
leaq 0x15e2c2(%rip), %rdx    # 0x17431f
xorl %eax, %eax
movl %eax, %ecx
callq 0x27ef0
jmp 0x16068
movq 0x68(%rsp), %rax
movq %rax, 0xc0(%rsp)
movl $0x0, 0xbc(%rsp)
movl 0xbc(%rsp), %eax
movl %eax, 0x64(%rsp)
movq 0x118(%rsp), %rdi
callq 0x1f2e0
movl %eax, %ecx
movl 0x64(%rsp), %eax
cmpl %ecx, %eax
jge 0x1633d
movq 0x118(%rsp), %rdi
movl 0xbc(%rsp), %esi
callq 0x1f380
movq %rax, 0xb0(%rsp)
movq 0x118(%rsp), %rdi
movq 0xb0(%rsp), %rsi
callq 0x1f4b0
movq %rax, 0xa8(%rsp)
movq 0x118(%rsp), %rdi
movq 0xb0(%rsp), %rsi
callq 0x1f4d0
movq %rax, 0xa0(%rsp)
movq 0xe8(%rsp), %rax
movq %rax, 0x8(%rsp)
movl 0xbc(%rsp), %eax
movl %eax, 0x14(%rsp)
movq 0xa8(%rsp), %rdi
callq 0x1f540
movq 0x8(%rsp), %rdi
movl 0x14(%rsp), %esi
callq 0x2ae50
movq 0xe0(%rsp), %rax
movq %rax, 0x18(%rsp)
movl 0xbc(%rsp), %eax
movl %eax, 0x24(%rsp)
movq 0xa8(%rsp), %rdi
callq 0x1f550
movq 0x18(%rsp), %rdi
movl 0x24(%rsp), %esi
callq 0x2ae50
movq 0xd8(%rsp), %rax
movq %rax, 0x28(%rsp)
movl 0xbc(%rsp), %eax
movl %eax, 0x34(%rsp)
movq 0xa8(%rsp), %rdi
callq 0x1f560
movq 0x28(%rsp), %rdi
movl 0x34(%rsp), %esi
callq 0x2ae50
movq 0xd0(%rsp), %rax
movq %rax, 0x38(%rsp)
movl 0xbc(%rsp), %eax
movl %eax, 0x44(%rsp)
movq 0xa0(%rsp), %rdi
callq 0x1f570
movq 0x38(%rsp), %rdi
movl 0x44(%rsp), %esi
callq 0x2ae50
movq 0xc8(%rsp), %rax
movq %rax, 0x48(%rsp)
movl 0xbc(%rsp), %eax
movl %eax, 0x54(%rsp)
movq 0xa0(%rsp), %rdi
callq 0x1f580
movq 0x48(%rsp), %rdi
movl 0x54(%rsp), %esi
callq 0x2ae50
movq 0xc0(%rsp), %rax
movq %rax, 0x58(%rsp)
movl 0xbc(%rsp), %eax
movl %eax, 0x60(%rsp)
movq 0xa0(%rsp), %rdi
callq 0x1f590
movq 0x58(%rsp), %rdi
movl 0x60(%rsp), %esi
callq 0x2ae50
movl 0xbc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xbc(%rsp)
jmp 0x16080
movq 0x90(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xf8(%rsp)
movl %eax, 0xf4(%rsp)
movl $0x448, %esi            # imm = 0x448
callq 0x11690
jmp 0x16437
movq 0x88(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xf8(%rsp)
movl %eax, 0xf4(%rsp)
movl $0x448, %esi            # imm = 0x448
callq 0x11690
jmp 0x16437
movq 0x80(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xf8(%rsp)
movl %eax, 0xf4(%rsp)
movl $0x448, %esi            # imm = 0x448
callq 0x11690
jmp 0x16437
movq 0x78(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xf8(%rsp)
movl %eax, 0xf4(%rsp)
movl $0x448, %esi            # imm = 0x448
callq 0x11690
jmp 0x16437
movq 0x70(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xf8(%rsp)
movl %eax, 0xf4(%rsp)
movl $0x448, %esi            # imm = 0x448
callq 0x11690
jmp 0x16437
movq 0x68(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xf8(%rsp)
movl %eax, 0xf4(%rsp)
movl $0x448, %esi            # imm = 0x448
callq 0x11690
jmp 0x16437
movq 0x100(%rsp), %rdi
movq 0xe8(%rsp), %rsi
xorl %edx, %edx
callq 0x148a0
movq 0x100(%rsp), %rdi
movq 0xe0(%rsp), %rsi
xorl %edx, %edx
callq 0x148a0
movq 0x100(%rsp), %rdi
movq 0xd8(%rsp), %rsi
xorl %edx, %edx
callq 0x148a0
movq 0x100(%rsp), %rdi
movq 0xd0(%rsp), %rsi
xorl %edx, %edx
callq 0x148a0
movq 0x100(%rsp), %rdi
movq 0xc8(%rsp), %rsi
xorl %edx, %edx
callq 0x148a0
movq 0x100(%rsp), %rdi
movq 0xc0(%rsp), %rsi
xorl %edx, %edx
callq 0x148a0
cmpl $0x0, 0x1b4372(%rip)    # 0x1ca740
je 0x16417
leaq 0x108(%rsp), %rdi
callq 0xe99a0
leaq 0x15de28(%rip), %rdi    # 0x17420c
movb $0x1, %al
callq 0x11090
movq 0x100(%rsp), %rdi
callq 0x1f400
movl %eax, %esi
leaq 0x15deb6(%rip), %rdi    # 0x1742b7
movb $0x0, %al
callq 0x11090
movq 0x1aab81(%rip), %rax    # 0x1c0f90
movq (%rax), %rdi
callq 0x117f0
movq 0x100(%rsp), %rax
movq %rax, 0x120(%rsp)
movq 0x120(%rsp), %rax
addq $0x128, %rsp            # imm = 0x128
retq
movq 0xf8(%rsp), %rdi
callq 0x11bb0
nopw %cs:(%rax,%rax)