// File: tomfunkhouser[P]gaps/apps/prp2prp/prp2prp.cpp
// Function: ReadProperties(gaps::R3Mesh*, char const*)
static R3MeshPropertySet *
ReadProperties(R3Mesh *mesh, const char *filename)
{
  // Start statistics
  RNTime start_time;
  start_time.Read();

  // Allocate properties
  R3MeshPropertySet *properties = new R3MeshPropertySet(mesh);
  if (!properties) {
    RNFail("Unable to allocate properties for %s\n", filename);
    return NULL;
  }

  // Read properties from file
  if (!properties->Read(filename)) {
    delete properties;
    return NULL;
  }

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

  // Print more statistics
  if (print_debug) {
    printf("\n");
    for (int i = 0; i < properties->NProperties(); i++) {
      R3MeshProperty *property = properties->Property(i);
      printf("  Property %d %s\n", i, property->Name());
      printf("    Minimum = %g\n", property->Minimum());
      printf("    Maximum = %g\n", property->Maximum());
      printf("    Median = %g\n", property->Median());
      printf("    Mean = %g\n", property->Mean());
      printf("    # Minima = %d\n", property->LocalMinimumCount());
      printf("    # Maxima = %d\n", property->LocalMaximumCount());
      printf("    L1Norm = %g\n", property->L1Norm());
      printf("    L2Norm = %g\n", property->L2Norm());
      printf("\n");
    }
  }

  // Return property set
  return properties;
}

// Assembly:
subq $0x68, %rsp
movq %rdi, 0x58(%rsp)
movq %rsi, 0x50(%rsp)
leaq 0x40(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0xa0ab0
movq 0x10(%rsp), %rdi
callq 0x13550
movl $0x18, %edi
callq 0xd400
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0x18(%rsp)
movq 0x58(%rsp), %rsi
callq 0x137a0
jmp 0x10598
movq 0x18(%rsp), %rax
movq %rax, 0x38(%rsp)
cmpq $0x0, 0x38(%rsp)
jne 0x105ed
movq 0x50(%rsp), %rsi
leaq 0x94b9c(%rip), %rdi     # 0xa5152
movb $0x0, %al
callq 0xa4cd0
movq $0x0, 0x60(%rsp)
jmp 0x10820
movq 0x18(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x30(%rsp)
movl %eax, 0x2c(%rsp)
movl $0x18, %esi
callq 0xd410
jmp 0x1082a
movq 0x38(%rsp), %rdi
movq 0x50(%rsp), %rsi
callq 0x13db0
cmpl $0x0, %eax
jne 0x10638
movq 0x38(%rsp), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, %rax
je 0x1062a
movq 0x8(%rsp), %rdi
callq 0x13910
movq 0x8(%rsp), %rdi
movl $0x18, %esi
callq 0xd410
movq $0x0, 0x60(%rsp)
jmp 0x10820
cmpl $0x0, 0xbc5a9(%rip)     # 0xccbe8
je 0x106b7
movq 0x50(%rsp), %rsi
leaq 0x94b2b(%rip), %rdi     # 0xa5178
movb $0x0, %al
callq 0xd070
leaq 0x40(%rsp), %rdi
callq 0xa0b70
leaq 0x94aa3(%rip), %rdi     # 0xa5108
movb $0x1, %al
callq 0xd070
movq 0x38(%rsp), %rdi
callq 0x135e0
movl %eax, %esi
leaq 0x94b16(%rip), %rdi     # 0xa5195
movb $0x0, %al
callq 0xd070
movq 0x38(%rsp), %rdi
callq 0x13470
movq %rax, %rdi
callq 0x135b0
movl %eax, %esi
leaq 0x94a9e(%rip), %rdi     # 0xa513f
movb $0x0, %al
callq 0xd070
movq 0xbb8f1(%rip), %rax     # 0xcbfa0
movq (%rax), %rdi
callq 0xd4e0
cmpl $0x0, 0xbc52e(%rip)     # 0xccbec
je 0x10816
leaq 0x95e37(%rip), %rdi     # 0xa6502
movb $0x0, %al
callq 0xd070
movl $0x0, 0x28(%rsp)
movl 0x28(%rsp), %eax
movl %eax, 0x4(%rsp)
movq 0x38(%rsp), %rdi
callq 0x135e0
movl %eax, %ecx
movl 0x4(%rsp), %eax
cmpl %ecx, %eax
jge 0x10814
movq 0x38(%rsp), %rdi
movl 0x28(%rsp), %esi
callq 0x134e0
movq %rax, 0x20(%rsp)
movl 0x28(%rsp), %eax
movl %eax, (%rsp)
movq 0x20(%rsp), %rdi
callq 0x13600
movl (%rsp), %esi
movq %rax, %rdx
leaq 0x94a7f(%rip), %rdi     # 0xa51aa
movb $0x0, %al
callq 0xd070
movq 0x20(%rsp), %rdi
callq 0x178f0
leaq 0x94a79(%rip), %rdi     # 0xa51bc
movb $0x1, %al
callq 0xd070
movq 0x20(%rsp), %rdi
callq 0x17a10
leaq 0x94a73(%rip), %rdi     # 0xa51ce
movb $0x1, %al
callq 0xd070
movq 0x20(%rsp), %rdi
callq 0x181c0
leaq 0x94a6d(%rip), %rdi     # 0xa51e0
movb $0x1, %al
callq 0xd070
movq 0x20(%rsp), %rdi
callq 0x177d0
leaq 0x94a66(%rip), %rdi     # 0xa51f1
movb $0x1, %al
callq 0xd070
movq 0x20(%rsp), %rdi
callq 0x18220
movl %eax, %esi
leaq 0x94a5b(%rip), %rdi     # 0xa5200
movb $0x0, %al
callq 0xd070
movq 0x20(%rsp), %rdi
callq 0x182a0
movl %eax, %esi
leaq 0x94a54(%rip), %rdi     # 0xa5213
movb $0x0, %al
callq 0xd070
movq 0x20(%rsp), %rdi
callq 0x183e0
leaq 0x94a4f(%rip), %rdi     # 0xa5226
movb $0x1, %al
callq 0xd070
movq 0x20(%rsp), %rdi
callq 0x18480
leaq 0x94a48(%rip), %rdi     # 0xa5237
movb $0x1, %al
callq 0xd070
leaq 0x95d05(%rip), %rdi     # 0xa6502
movb $0x0, %al
callq 0xd070
movl 0x28(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x28(%rsp)
jmp 0x106da
jmp 0x10816
movq 0x38(%rsp), %rax
movq %rax, 0x60(%rsp)
movq 0x60(%rsp), %rax
addq $0x68, %rsp
retq
movq 0x30(%rsp), %rdi
callq 0xd6d0
nopw %cs:(%rax,%rax)