// File: tomfunkhouser[P]gaps/apps/msh2prp/msh2prp.cpp
// Function: ComputeProperties(gaps::R3Mesh*)
static R3MeshPropertySet *
ComputeProperties(R3Mesh *mesh)
{
  // Allocate property set
  R3MeshPropertySet *properties = new R3MeshPropertySet(mesh);
  if (!properties) {
    RNFail("Unable to allocate property set.\n");
    return NULL;
  }

  // Compute basic properties
  if (compute_basic_properties) {
    R3MeshPropertySet *basic_properties = ComputeBasicProperties(mesh);
    if (!basic_properties) return NULL;
    properties->Insert(basic_properties);
    delete basic_properties;
  }

  // Compute coordinate properties
  if (compute_coordinate_properties) {
    R3MeshPropertySet *coordinate_properties = ComputeCoordinateProperties(mesh);
    if (!coordinate_properties) return NULL;
    properties->Insert(coordinate_properties);
    delete coordinate_properties;
  }

  // Compute curvature properties
  if (compute_curvature_properties) {
    R3MeshPropertySet *curvature_properties = ComputeCurvatureProperties(mesh);
    if (!curvature_properties) return NULL;
    properties->Insert(curvature_properties);
    delete curvature_properties;
  }

  // Compute laplacian properties
  if (compute_laplacian_properties) {
    R3MeshPropertySet *laplacian_properties = ComputeLaplacianProperties(mesh);
    if (!laplacian_properties) return NULL;
    properties->Insert(laplacian_properties);
    delete laplacian_properties;
  }

  // Compute volume properties
  if (compute_volume_properties) {
    R3MeshPropertySet *volume_properties = ComputeVolumeProperties(mesh);
    if (!volume_properties) return NULL;
    properties->Insert(volume_properties);
    delete volume_properties;
  }

  // Compute boundary properties
  if (compute_boundary_properties) {
    R3MeshPropertySet *boundary_properties = ComputeBoundaryProperties(mesh);
    if (!boundary_properties) return NULL;
    properties->Insert(boundary_properties);
    delete boundary_properties;
  }

  // Compute dijkstra distance properties
  if (compute_dijkstra_distance_properties) {
    R3MeshPropertySet *dijkstra_distance_properties = ComputeDijkstraDistanceProperties(mesh);
    if (!dijkstra_distance_properties) return NULL;
    properties->Insert(dijkstra_distance_properties);
    delete dijkstra_distance_properties;
  }

  // Compute dijkstra histogram properties
  if (compute_dijkstra_histogram_properties) {
    R3MeshPropertySet *dijkstra_histogram_properties = ComputeDijkstraHistogramProperties(mesh);
    if (!dijkstra_histogram_properties) return NULL;
    properties->Insert(dijkstra_histogram_properties);
    delete dijkstra_histogram_properties;
  }

  // Compute ray tracing properties
  if (compute_raytrace_properties) {
    R3MeshPropertySet *raytrace_properties = ComputeRayTracingProperties(mesh);
    if (!raytrace_properties) return NULL;
    properties->Insert(raytrace_properties);
    delete raytrace_properties;
  }

  // Read mturk segmentation properties
  if (input_mturk_segmentation_name) {
    R3MeshPropertySet *segmentation_properties = ReadMTurkProperties(mesh,
      input_mturk_segmentation_name, input_mturk_annotation_name, input_mturk_label_mapping_name);
    if (!segmentation_properties) return NULL;
    properties->Insert(segmentation_properties);
    delete segmentation_properties;
  }

  // Compute map properties
  if (input_map_name) {
    R3MeshPropertySet *map_properties = ComputeMapProperties(mesh, input_map_name);
    if (!map_properties) return NULL;
    properties->Insert(map_properties);
    delete map_properties;
  }

  // Compute solidtexture properties
  if (compute_solidtexture_properties) {
    R3MeshPropertySet *solidtexture_properties = ComputeSolidTextureProperties(mesh);
    if (!solidtexture_properties) return NULL;
    properties->Insert(solidtexture_properties);
    delete solidtexture_properties;
  }

  // Return property set
  return properties;
}

// Assembly:
subq $0xf8, %rsp
movq %rdi, 0xe8(%rsp)
movl $0x18, %edi
callq 0x11680
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0x68(%rsp)
movq 0xe8(%rsp), %rsi
callq 0x24ce0
jmp 0x15163
movq 0x68(%rsp), %rax
movq %rax, 0xe0(%rsp)
cmpq $0x0, 0xe0(%rsp)
jne 0x151c2
leaq 0x15f0d4(%rip), %rdi    # 0x174256
movb $0x0, %al
callq 0xedb00
movq $0x0, 0xf0(%rsp)
jmp 0x157b5
movq 0x68(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd8(%rsp)
movl %eax, 0xd4(%rsp)
movl $0x18, %esi
callq 0x11690
jmp 0x157c5
cmpl $0x0, 0x1b557f(%rip)    # 0x1ca748
je 0x1523f
movq 0xe8(%rsp), %rdi
callq 0x159b0
movq %rax, 0xc8(%rsp)
cmpq $0x0, 0xc8(%rsp)
jne 0x151fc
movq $0x0, 0xf0(%rsp)
jmp 0x157b5
movq 0xe0(%rsp), %rdi
movq 0xc8(%rsp), %rsi
callq 0x1f310
movq 0xc8(%rsp), %rax
movq %rax, 0x60(%rsp)
cmpq $0x0, %rax
je 0x1523d
movq 0x60(%rsp), %rdi
callq 0x24e50
movq 0x60(%rsp), %rdi
movl $0x18, %esi
callq 0x11690
jmp 0x1523f
cmpl $0x0, 0x1b5506(%rip)    # 0x1ca74c
je 0x152bc
movq 0xe8(%rsp), %rdi
callq 0x15e20
movq %rax, 0xc0(%rsp)
cmpq $0x0, 0xc0(%rsp)
jne 0x15279
movq $0x0, 0xf0(%rsp)
jmp 0x157b5
movq 0xe0(%rsp), %rdi
movq 0xc0(%rsp), %rsi
callq 0x1f310
movq 0xc0(%rsp), %rax
movq %rax, 0x58(%rsp)
cmpq $0x0, %rax
je 0x152ba
movq 0x58(%rsp), %rdi
callq 0x24e50
movq 0x58(%rsp), %rdi
movl $0x18, %esi
callq 0x11690
jmp 0x152bc
cmpl $0x0, 0x1b548d(%rip)    # 0x1ca750
je 0x15339
movq 0xe8(%rsp), %rdi
callq 0x16450
movq %rax, 0xb8(%rsp)
cmpq $0x0, 0xb8(%rsp)
jne 0x152f6
movq $0x0, 0xf0(%rsp)
jmp 0x157b5
movq 0xe0(%rsp), %rdi
movq 0xb8(%rsp), %rsi
callq 0x1f310
movq 0xb8(%rsp), %rax
movq %rax, 0x50(%rsp)
cmpq $0x0, %rax
je 0x15337
movq 0x50(%rsp), %rdi
callq 0x24e50
movq 0x50(%rsp), %rdi
movl $0x18, %esi
callq 0x11690
jmp 0x15339
cmpl $0x0, 0x1b541c(%rip)    # 0x1ca75c
je 0x153b6
movq 0xe8(%rsp), %rdi
callq 0x186e0
movq %rax, 0xb0(%rsp)
cmpq $0x0, 0xb0(%rsp)
jne 0x15373
movq $0x0, 0xf0(%rsp)
jmp 0x157b5
movq 0xe0(%rsp), %rdi
movq 0xb0(%rsp), %rsi
callq 0x1f310
movq 0xb0(%rsp), %rax
movq %rax, 0x48(%rsp)
cmpq $0x0, %rax
je 0x153b4
movq 0x48(%rsp), %rdi
callq 0x24e50
movq 0x48(%rsp), %rdi
movl $0x18, %esi
callq 0x11690
jmp 0x153b6
cmpl $0x0, 0x1b5397(%rip)    # 0x1ca754
je 0x15433
movq 0xe8(%rsp), %rdi
callq 0x192d0
movq %rax, 0xa8(%rsp)
cmpq $0x0, 0xa8(%rsp)
jne 0x153f0
movq $0x0, 0xf0(%rsp)
jmp 0x157b5
movq 0xe0(%rsp), %rdi
movq 0xa8(%rsp), %rsi
callq 0x1f310
movq 0xa8(%rsp), %rax
movq %rax, 0x40(%rsp)
cmpq $0x0, %rax
je 0x15431
movq 0x40(%rsp), %rdi
callq 0x24e50
movq 0x40(%rsp), %rdi
movl $0x18, %esi
callq 0x11690
jmp 0x15433
cmpl $0x0, 0x1b531e(%rip)    # 0x1ca758
je 0x154b0
movq 0xe8(%rsp), %rdi
callq 0x196b0
movq %rax, 0xa0(%rsp)
cmpq $0x0, 0xa0(%rsp)
jne 0x1546d
movq $0x0, 0xf0(%rsp)
jmp 0x157b5
movq 0xe0(%rsp), %rdi
movq 0xa0(%rsp), %rsi
callq 0x1f310
movq 0xa0(%rsp), %rax
movq %rax, 0x38(%rsp)
cmpq $0x0, %rax
je 0x154ae
movq 0x38(%rsp), %rdi
callq 0x24e50
movq 0x38(%rsp), %rdi
movl $0x18, %esi
callq 0x11690
jmp 0x154b0
cmpl $0x0, 0x1b52a9(%rip)    # 0x1ca760
je 0x1552d
movq 0xe8(%rsp), %rdi
callq 0x19a90
movq %rax, 0x98(%rsp)
cmpq $0x0, 0x98(%rsp)
jne 0x154ea
movq $0x0, 0xf0(%rsp)
jmp 0x157b5
movq 0xe0(%rsp), %rdi
movq 0x98(%rsp), %rsi
callq 0x1f310
movq 0x98(%rsp), %rax
movq %rax, 0x30(%rsp)
cmpq $0x0, %rax
je 0x1552b
movq 0x30(%rsp), %rdi
callq 0x24e50
movq 0x30(%rsp), %rdi
movl $0x18, %esi
callq 0x11690
jmp 0x1552d
cmpl $0x0, 0x1b5230(%rip)    # 0x1ca764
je 0x155aa
movq 0xe8(%rsp), %rdi
callq 0x1a1a0
movq %rax, 0x90(%rsp)
cmpq $0x0, 0x90(%rsp)
jne 0x15567
movq $0x0, 0xf0(%rsp)
jmp 0x157b5
movq 0xe0(%rsp), %rdi
movq 0x90(%rsp), %rsi
callq 0x1f310
movq 0x90(%rsp), %rax
movq %rax, 0x28(%rsp)
cmpq $0x0, %rax
je 0x155a8
movq 0x28(%rsp), %rdi
callq 0x24e50
movq 0x28(%rsp), %rdi
movl $0x18, %esi
callq 0x11690
jmp 0x155aa
cmpl $0x0, 0x1b51b7(%rip)    # 0x1ca768
je 0x15627
movq 0xe8(%rsp), %rdi
callq 0x1a940
movq %rax, 0x88(%rsp)
cmpq $0x0, 0x88(%rsp)
jne 0x155e4
movq $0x0, 0xf0(%rsp)
jmp 0x157b5
movq 0xe0(%rsp), %rdi
movq 0x88(%rsp), %rsi
callq 0x1f310
movq 0x88(%rsp), %rax
movq %rax, 0x20(%rsp)
cmpq $0x0, %rax
je 0x15625
movq 0x20(%rsp), %rdi
callq 0x24e50
movq 0x20(%rsp), %rdi
movl $0x18, %esi
callq 0x11690
jmp 0x15627
cmpq $0x0, 0x1b5149(%rip)    # 0x1ca778
je 0x156be
movq 0xe8(%rsp), %rdi
movq 0x1b5134(%rip), %rsi    # 0x1ca778
movq 0x1b5135(%rip), %rdx    # 0x1ca780
movq 0x1b5136(%rip), %rcx    # 0x1ca788
callq 0x1b150
movq %rax, 0x80(%rsp)
cmpq $0x0, 0x80(%rsp)
jne 0x1567b
movq $0x0, 0xf0(%rsp)
jmp 0x157b5
movq 0xe0(%rsp), %rdi
movq 0x80(%rsp), %rsi
callq 0x1f310
movq 0x80(%rsp), %rax
movq %rax, 0x18(%rsp)
cmpq $0x0, %rax
je 0x156bc
movq 0x18(%rsp), %rdi
callq 0x24e50
movq 0x18(%rsp), %rdi
movl $0x18, %esi
callq 0x11690
jmp 0x156be
cmpq $0x0, 0x1b50aa(%rip)    # 0x1ca770
je 0x15737
movq 0xe8(%rsp), %rdi
movq 0x1b5099(%rip), %rsi    # 0x1ca770
callq 0x1b3f0
movq %rax, 0x78(%rsp)
cmpq $0x0, 0x78(%rsp)
jne 0x156fa
movq $0x0, 0xf0(%rsp)
jmp 0x157b5
movq 0xe0(%rsp), %rdi
movq 0x78(%rsp), %rsi
callq 0x1f310
movq 0x78(%rsp), %rax
movq %rax, 0x10(%rsp)
cmpq $0x0, %rax
je 0x15735
movq 0x10(%rsp), %rdi
callq 0x24e50
movq 0x10(%rsp), %rdi
movl $0x18, %esi
callq 0x11690
jmp 0x15737
cmpl $0x0, 0x1b502e(%rip)    # 0x1ca76c
je 0x157a5
movq 0xe8(%rsp), %rdi
callq 0x1b770
movq %rax, 0x70(%rsp)
cmpq $0x0, 0x70(%rsp)
jne 0x15768
movq $0x0, 0xf0(%rsp)
jmp 0x157b5
movq 0xe0(%rsp), %rdi
movq 0x70(%rsp), %rsi
callq 0x1f310
movq 0x70(%rsp), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, %rax
je 0x157a3
movq 0x8(%rsp), %rdi
callq 0x24e50
movq 0x8(%rsp), %rdi
movl $0x18, %esi
callq 0x11690
jmp 0x157a5
movq 0xe0(%rsp), %rax
movq %rax, 0xf0(%rsp)
movq 0xf0(%rsp), %rax
addq $0xf8, %rsp
retq
movq 0xd8(%rsp), %rdi
callq 0x11bb0
nopw %cs:(%rax,%rax)