// File: tomfunkhouser[P]gaps/apps/msh2prp/msh2prp.cpp
// Function: ComputeSolidTextureProperties(gaps::R3Mesh*)
static R3MeshPropertySet *
ComputeSolidTextureProperties(R3Mesh *mesh)
{
  // Start statistics
  RNTime start_time;
  start_time.Read();
  if (print_verbose) {
    printf("Computing solid texture 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 *sine1 = new R3MeshProperty(mesh, "Sine1");
  R3MeshProperty *sine2 = new R3MeshProperty(mesh, "Sine2");
  R3MeshProperty *sine4 = new R3MeshProperty(mesh, "Sine4");
  R3MeshProperty *sine8 = new R3MeshProperty(mesh, "Sine8");
  R3MeshProperty *sine16 = new R3MeshProperty(mesh, "Sine16");
  R3MeshProperty *sine32 = new R3MeshProperty(mesh, "Sine32");
  R3MeshProperty *sine64 = new R3MeshProperty(mesh, "Sine64");

  // Read map file and compute distance to each correspondence
  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);
    int dim = normal.MaxDimension();

    // Compute sine properties from vertex coordinates 
    sine1->SetVertexValue(i, sin(1*position[(dim+1)%3]) * sin(1*position[(dim+2)%3]));
    sine2->SetVertexValue(i, sin(2*position[(dim+1)%3]) * sin(2*position[(dim+2)%3]));
    sine4->SetVertexValue(i, sin(4*position[(dim+1)%3]) * sin(4*position[(dim+2)%3]));
    sine8->SetVertexValue(i, sin(8*position[(dim+1)%3]) * sin(8*position[(dim+2)%3]));
    sine16->SetVertexValue(i, sin(16*position[(dim+1)%3]) * sin(16*position[(dim+2)%3]));
    sine32->SetVertexValue(i, sin(32*position[(dim+1)%3]) * sin(32*position[(dim+2)%3]));
    sine64->SetVertexValue(i, sin(64*position[(dim+1)%3]) * sin(64*position[(dim+2)%3]));
  }

  // Insert properties
  InsertProperty(properties, sine1);
  InsertProperty(properties, sine2);
  InsertProperty(properties, sine4);
  InsertProperty(properties, sine8);
  InsertProperty(properties, sine16);
  InsertProperty(properties, sine32);
  InsertProperty(properties, sine64);

  // 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 $0x188, %rsp            # imm = 0x188
movq %rdi, 0x178(%rsp)
leaq 0x168(%rsp), %rdi
callq 0xe98e0
leaq 0x168(%rsp), %rdi
callq 0x1f280
cmpl $0x0, 0x1aefa0(%rip)    # 0x1ca740
je 0x1b7bf
leaq 0x1590c6(%rip), %rdi    # 0x17486f
movb $0x0, %al
callq 0x11090
movq 0x1a57d9(%rip), %rax    # 0x1c0f90
movq (%rax), %rdi
callq 0x117f0
movl $0x18, %edi
callq 0x11680
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0xe8(%rsp)
movq 0x178(%rsp), %rsi
callq 0x24ce0
jmp 0x1b7e6
movq 0xe8(%rsp), %rax
movq %rax, 0x160(%rsp)
cmpq $0x0, 0x160(%rsp)
jne 0x1b84b
leaq 0x158a4e(%rip), %rdi    # 0x174256
movb $0x0, %al
callq 0xedb00
movq $0x0, 0x180(%rsp)
jmp 0x1c18f
movq 0xe8(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x158(%rsp)
movl %eax, 0x154(%rsp)
movl $0x18, %esi
callq 0x11690
jmp 0x1c19f
movl $0x448, %edi            # imm = 0x448
callq 0x11680
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0xe0(%rsp)
movq 0x178(%rsp), %rsi
leaq 0x159025(%rip), %rdx    # 0x174897
xorl %eax, %eax
movl %eax, %ecx
callq 0x27ef0
jmp 0x1b87d
movq 0xe0(%rsp), %rax
movq %rax, 0x148(%rsp)
movl $0x448, %edi            # imm = 0x448
callq 0x11680
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0xd8(%rsp)
movq 0x178(%rsp), %rsi
leaq 0x158fe9(%rip), %rdx    # 0x17489d
xorl %eax, %eax
movl %eax, %ecx
callq 0x27ef0
jmp 0x1b8bf
movq 0xd8(%rsp), %rax
movq %rax, 0x140(%rsp)
movl $0x448, %edi            # imm = 0x448
callq 0x11680
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0xd0(%rsp)
movq 0x178(%rsp), %rsi
leaq 0x158fad(%rip), %rdx    # 0x1748a3
xorl %eax, %eax
movl %eax, %ecx
callq 0x27ef0
jmp 0x1b901
movq 0xd0(%rsp), %rax
movq %rax, 0x138(%rsp)
movl $0x448, %edi            # imm = 0x448
callq 0x11680
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0xc8(%rsp)
movq 0x178(%rsp), %rsi
leaq 0x158f71(%rip), %rdx    # 0x1748a9
xorl %eax, %eax
movl %eax, %ecx
callq 0x27ef0
jmp 0x1b943
movq 0xc8(%rsp), %rax
movq %rax, 0x130(%rsp)
movl $0x448, %edi            # imm = 0x448
callq 0x11680
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0xc0(%rsp)
movq 0x178(%rsp), %rsi
leaq 0x158f35(%rip), %rdx    # 0x1748af
xorl %eax, %eax
movl %eax, %ecx
callq 0x27ef0
jmp 0x1b985
movq 0xc0(%rsp), %rax
movq %rax, 0x128(%rsp)
movl $0x448, %edi            # imm = 0x448
callq 0x11680
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0xb8(%rsp)
movq 0x178(%rsp), %rsi
leaq 0x158efa(%rip), %rdx    # 0x1748b6
xorl %eax, %eax
movl %eax, %ecx
callq 0x27ef0
jmp 0x1b9c7
movq 0xb8(%rsp), %rax
movq %rax, 0x120(%rsp)
movl $0x448, %edi            # imm = 0x448
callq 0x11680
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0xb0(%rsp)
movq 0x178(%rsp), %rsi
leaq 0x158ebf(%rip), %rdx    # 0x1748bd
xorl %eax, %eax
movl %eax, %ecx
callq 0x27ef0
jmp 0x1ba09
movq 0xb0(%rsp), %rax
movq %rax, 0x118(%rsp)
movl $0x0, 0x114(%rsp)
movl 0x114(%rsp), %eax
movl %eax, 0xac(%rsp)
movq 0x178(%rsp), %rdi
callq 0x1f2e0
movl %eax, %ecx
movl 0xac(%rsp), %eax
cmpl %ecx, %eax
jge 0x1c08e
movq 0x178(%rsp), %rdi
movl 0x114(%rsp), %esi
callq 0x1f380
movq %rax, 0x108(%rsp)
movq 0x178(%rsp), %rdi
movq 0x108(%rsp), %rsi
callq 0x1f4b0
movq %rax, 0x100(%rsp)
movq 0x178(%rsp), %rdi
movq 0x108(%rsp), %rsi
callq 0x1f4d0
movq %rax, 0xf8(%rsp)
movq 0xf8(%rsp), %rdi
callq 0x89760
movl %eax, 0xf4(%rsp)
movq 0x148(%rsp), %rax
movq %rax, (%rsp)
movl 0x114(%rsp), %eax
movl %eax, 0xc(%rsp)
movq 0x100(%rsp), %rdi
movl 0xf4(%rsp), %eax
addl $0x1, %eax
movl $0x3, %ecx
cltd
idivl %ecx
movl %edx, %esi
callq 0x1fc50
movaps %xmm0, %xmm1
movsd 0x15851b(%rip), %xmm0   # 0x174018
mulsd %xmm1, %xmm0
callq 0x11140
movsd %xmm0, 0x10(%rsp)
movq 0x100(%rsp), %rdi
movl 0xf4(%rsp), %eax
addl $0x2, %eax
movl $0x3, %ecx
cltd
idivl %ecx
movl %edx, %esi
callq 0x1fc50
movaps %xmm0, %xmm1
movsd 0x1584e0(%rip), %xmm0   # 0x174018
mulsd %xmm1, %xmm0
callq 0x11140
movq (%rsp), %rdi
movl 0xc(%rsp), %esi
movaps %xmm0, %xmm1
movsd 0x10(%rsp), %xmm0
mulsd %xmm1, %xmm0
callq 0x2ae50
movq 0x140(%rsp), %rax
movq %rax, 0x18(%rsp)
movl 0x114(%rsp), %eax
movl %eax, 0x24(%rsp)
movq 0x100(%rsp), %rdi
movl 0xf4(%rsp), %eax
addl $0x1, %eax
movl $0x3, %ecx
cltd
idivl %ecx
movl %edx, %esi
callq 0x1fc50
movaps %xmm0, %xmm1
movsd 0x158471(%rip), %xmm0   # 0x174010
mulsd %xmm1, %xmm0
callq 0x11140
movsd %xmm0, 0x28(%rsp)
movq 0x100(%rsp), %rdi
movl 0xf4(%rsp), %eax
addl $0x2, %eax
movl $0x3, %ecx
cltd
idivl %ecx
movl %edx, %esi
callq 0x1fc50
movaps %xmm0, %xmm1
movsd 0x158436(%rip), %xmm0   # 0x174010
mulsd %xmm1, %xmm0
callq 0x11140
movq 0x18(%rsp), %rdi
movl 0x24(%rsp), %esi
movaps %xmm0, %xmm1
movsd 0x28(%rsp), %xmm0
mulsd %xmm1, %xmm0
callq 0x2ae50
movq 0x138(%rsp), %rax
movq %rax, 0x30(%rsp)
movl 0x114(%rsp), %eax
movl %eax, 0x3c(%rsp)
movq 0x100(%rsp), %rdi
movl 0xf4(%rsp), %eax
addl $0x1, %eax
movl $0x3, %ecx
cltd
idivl %ecx
movl %edx, %esi
callq 0x1fc50
movaps %xmm0, %xmm1
movsd 0x15843e(%rip), %xmm0   # 0x174080
mulsd %xmm1, %xmm0
callq 0x11140
movsd %xmm0, 0x40(%rsp)
movq 0x100(%rsp), %rdi
movl 0xf4(%rsp), %eax
addl $0x2, %eax
movl $0x3, %ecx
cltd
idivl %ecx
movl %edx, %esi
callq 0x1fc50
movaps %xmm0, %xmm1
movsd 0x158403(%rip), %xmm0   # 0x174080
mulsd %xmm1, %xmm0
callq 0x11140
movq 0x30(%rsp), %rdi
movl 0x3c(%rsp), %esi
movaps %xmm0, %xmm1
movsd 0x40(%rsp), %xmm0
mulsd %xmm1, %xmm0
callq 0x2ae50
movq 0x130(%rsp), %rax
movq %rax, 0x48(%rsp)
movl 0x114(%rsp), %eax
movl %eax, 0x54(%rsp)
movq 0x100(%rsp), %rdi
movl 0xf4(%rsp), %eax
addl $0x1, %eax
movl $0x3, %ecx
cltd
idivl %ecx
movl %edx, %esi
callq 0x1fc50
movaps %xmm0, %xmm1
movsd 0x15837b(%rip), %xmm0   # 0x174060
mulsd %xmm1, %xmm0
callq 0x11140
movsd %xmm0, 0x58(%rsp)
movq 0x100(%rsp), %rdi
movl 0xf4(%rsp), %eax
addl $0x2, %eax
movl $0x3, %ecx
cltd
idivl %ecx
movl %edx, %esi
callq 0x1fc50
movaps %xmm0, %xmm1
movsd 0x158340(%rip), %xmm0   # 0x174060
mulsd %xmm1, %xmm0
callq 0x11140
movq 0x48(%rsp), %rdi
movl 0x54(%rsp), %esi
movaps %xmm0, %xmm1
movsd 0x58(%rsp), %xmm0
mulsd %xmm1, %xmm0
callq 0x2ae50
movq 0x128(%rsp), %rax
movq %rax, 0x60(%rsp)
movl 0x114(%rsp), %eax
movl %eax, 0x6c(%rsp)
movq 0x100(%rsp), %rdi
movl 0xf4(%rsp), %eax
addl $0x1, %eax
movl $0x3, %ecx
cltd
idivl %ecx
movl %edx, %esi
callq 0x1fc50
movaps %xmm0, %xmm1
movsd 0x1582f0(%rip), %xmm0   # 0x174078
mulsd %xmm1, %xmm0
callq 0x11140
movsd %xmm0, 0x70(%rsp)
movq 0x100(%rsp), %rdi
movl 0xf4(%rsp), %eax
addl $0x2, %eax
movl $0x3, %ecx
cltd
idivl %ecx
movl %edx, %esi
callq 0x1fc50
movaps %xmm0, %xmm1
movsd 0x1582b5(%rip), %xmm0   # 0x174078
mulsd %xmm1, %xmm0
callq 0x11140
movq 0x60(%rsp), %rdi
movl 0x6c(%rsp), %esi
movaps %xmm0, %xmm1
movsd 0x70(%rsp), %xmm0
mulsd %xmm1, %xmm0
callq 0x2ae50
movq 0x120(%rsp), %rax
movq %rax, 0x78(%rsp)
movl 0x114(%rsp), %eax
movl %eax, 0x84(%rsp)
movq 0x100(%rsp), %rdi
movl 0xf4(%rsp), %eax
addl $0x1, %eax
movl $0x3, %ecx
cltd
idivl %ecx
movl %edx, %esi
callq 0x1fc50
movaps %xmm0, %xmm1
movsd 0x158242(%rip), %xmm0   # 0x174070
mulsd %xmm1, %xmm0
callq 0x11140
movsd %xmm0, 0x88(%rsp)
movq 0x100(%rsp), %rdi
movl 0xf4(%rsp), %eax
addl $0x2, %eax
movl $0x3, %ecx
cltd
idivl %ecx
movl %edx, %esi
callq 0x1fc50
movaps %xmm0, %xmm1
movsd 0x158204(%rip), %xmm0   # 0x174070
mulsd %xmm1, %xmm0
callq 0x11140
movq 0x78(%rsp), %rdi
movl 0x84(%rsp), %esi
movaps %xmm0, %xmm1
movsd 0x88(%rsp), %xmm0
mulsd %xmm1, %xmm0
callq 0x2ae50
movq 0x118(%rsp), %rax
movq %rax, 0x90(%rsp)
movl 0x114(%rsp), %eax
movl %eax, 0x9c(%rsp)
movq 0x100(%rsp), %rdi
movl 0xf4(%rsp), %eax
addl $0x1, %eax
movl $0x3, %ecx
cltd
idivl %ecx
movl %edx, %esi
callq 0x1fc50
movaps %xmm0, %xmm1
movsd 0x158178(%rip), %xmm0   # 0x174058
mulsd %xmm1, %xmm0
callq 0x11140
movsd %xmm0, 0xa0(%rsp)
movq 0x100(%rsp), %rdi
movl 0xf4(%rsp), %eax
addl $0x2, %eax
movl $0x3, %ecx
cltd
idivl %ecx
movl %edx, %esi
callq 0x1fc50
movaps %xmm0, %xmm1
movsd 0x15813a(%rip), %xmm0   # 0x174058
mulsd %xmm1, %xmm0
callq 0x11140
movq 0x90(%rsp), %rdi
movl 0x9c(%rsp), %esi
movaps %xmm0, %xmm1
movsd 0xa0(%rsp), %xmm0
mulsd %xmm1, %xmm0
callq 0x2ae50
movl 0x114(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x114(%rsp)
jmp 0x1ba24
movq 0xe0(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x158(%rsp)
movl %eax, 0x154(%rsp)
movl $0x448, %esi            # imm = 0x448
callq 0x11690
jmp 0x1c19f
movq 0xd8(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x158(%rsp)
movl %eax, 0x154(%rsp)
movl $0x448, %esi            # imm = 0x448
callq 0x11690
jmp 0x1c19f
movq 0xd0(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x158(%rsp)
movl %eax, 0x154(%rsp)
movl $0x448, %esi            # imm = 0x448
callq 0x11690
jmp 0x1c19f
movq 0xc8(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x158(%rsp)
movl %eax, 0x154(%rsp)
movl $0x448, %esi            # imm = 0x448
callq 0x11690
jmp 0x1c19f
movq 0xc0(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x158(%rsp)
movl %eax, 0x154(%rsp)
movl $0x448, %esi            # imm = 0x448
callq 0x11690
jmp 0x1c19f
movq 0xb8(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x158(%rsp)
movl %eax, 0x154(%rsp)
movl $0x448, %esi            # imm = 0x448
callq 0x11690
jmp 0x1c19f
movq 0xb0(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x158(%rsp)
movl %eax, 0x154(%rsp)
movl $0x448, %esi            # imm = 0x448
callq 0x11690
jmp 0x1c19f
movq 0x160(%rsp), %rdi
movq 0x148(%rsp), %rsi
xorl %edx, %edx
callq 0x148a0
movq 0x160(%rsp), %rdi
movq 0x140(%rsp), %rsi
xorl %edx, %edx
callq 0x148a0
movq 0x160(%rsp), %rdi
movq 0x138(%rsp), %rsi
xorl %edx, %edx
callq 0x148a0
movq 0x160(%rsp), %rdi
movq 0x130(%rsp), %rsi
xorl %edx, %edx
callq 0x148a0
movq 0x160(%rsp), %rdi
movq 0x128(%rsp), %rsi
xorl %edx, %edx
callq 0x148a0
movq 0x160(%rsp), %rdi
movq 0x120(%rsp), %rsi
xorl %edx, %edx
callq 0x148a0
movq 0x160(%rsp), %rdi
movq 0x118(%rsp), %rsi
xorl %edx, %edx
callq 0x148a0
cmpl $0x0, 0x1ae60a(%rip)    # 0x1ca740
je 0x1c17f
leaq 0x168(%rsp), %rdi
callq 0xe99a0
leaq 0x1580c0(%rip), %rdi    # 0x17420c
movb $0x1, %al
callq 0x11090
movq 0x160(%rsp), %rdi
callq 0x1f400
movl %eax, %esi
leaq 0x15814e(%rip), %rdi    # 0x1742b7
movb $0x0, %al
callq 0x11090
movq 0x1a4e19(%rip), %rax    # 0x1c0f90
movq (%rax), %rdi
callq 0x117f0
movq 0x160(%rsp), %rax
movq %rax, 0x180(%rsp)
movq 0x180(%rsp), %rax
addq $0x188, %rsp            # imm = 0x188
retq
movq 0x158(%rsp), %rdi
callq 0x11bb0
nopl (%rax)