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

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

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

  // Print statistics
  if (print_verbose) {
    printf("Read property from %s ...\n", filename);
    printf("  Time = %.2f seconds\n", start_time.Elapsed());
    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());
    fflush(stdout);
  }

  // Return property 
  return property;
}

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x48(%rsp)
movq %rsi, 0x40(%rsp)
leaq 0x30(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0xe7be0
movq 0x8(%rsp), %rdi
callq 0x1b2d0
movl $0x448, %edi            # imm = 0x448
callq 0xf4d0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0x10(%rsp)
movq 0x48(%rsp), %rsi
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rdx
callq 0x262f0
jmp 0x13f9f
movq 0x10(%rsp), %rax
movq %rax, 0x28(%rsp)
cmpq $0x0, 0x28(%rsp)
jne 0x13ff4
movq 0x40(%rsp), %rsi
leaq 0x1364d4(%rip), %rdi    # 0x14a491
movb $0x0, %al
callq 0xebe00
movq $0x0, 0x50(%rsp)
jmp 0x14151
movq 0x10(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x20(%rsp)
movl %eax, 0x1c(%rsp)
movl $0x448, %esi            # imm = 0x448
callq 0xf4e0
jmp 0x1415b
movq 0x28(%rsp), %rdi
movq 0x40(%rsp), %rsi
callq 0x2a770
cmpl $0x0, %eax
jne 0x1403c
movq 0x28(%rsp), %rax
movq %rax, (%rsp)
cmpq $0x0, %rax
je 0x1402e
movq (%rsp), %rdi
callq 0x26680
movq (%rsp), %rdi
movl $0x448, %esi            # imm = 0x448
callq 0xf4e0
movq $0x0, 0x50(%rsp)
jmp 0x14151
cmpl $0x0, 0x17d58d(%rip)    # 0x1915d0
je 0x14147
movq 0x40(%rsp), %rsi
leaq 0x136460(%rip), %rdi    # 0x14a4b5
movb $0x0, %al
callq 0xf070
leaq 0x30(%rsp), %rdi
callq 0xe7ca0
leaq 0x136108(%rip), %rdi    # 0x14a175
movb $0x1, %al
callq 0xf070
movq 0x28(%rsp), %rdi
callq 0x27170
leaq 0x13644b(%rip), %rdi    # 0x14a4d0
movb $0x1, %al
callq 0xf070
movq 0x28(%rsp), %rdi
callq 0x27290
leaq 0x136443(%rip), %rdi    # 0x14a4e0
movb $0x1, %al
callq 0xf070
movq 0x28(%rsp), %rdi
callq 0x27a40
leaq 0x13643b(%rip), %rdi    # 0x14a4f0
movb $0x1, %al
callq 0xf070
movq 0x28(%rsp), %rdi
callq 0x27050
leaq 0x136432(%rip), %rdi    # 0x14a4ff
movb $0x1, %al
callq 0xf070
movq 0x28(%rsp), %rdi
callq 0x27aa0
movl %eax, %esi
leaq 0x136425(%rip), %rdi    # 0x14a50c
movb $0x0, %al
callq 0xf070
movq 0x28(%rsp), %rdi
callq 0x27b20
movl %eax, %esi
leaq 0x13641c(%rip), %rdi    # 0x14a51d
movb $0x0, %al
callq 0xf070
movq 0x28(%rsp), %rdi
callq 0x27c60
leaq 0x136415(%rip), %rdi    # 0x14a52e
movb $0x1, %al
callq 0xf070
movq 0x28(%rsp), %rdi
callq 0x27d00
leaq 0x13640c(%rip), %rdi    # 0x14a53d
movb $0x1, %al
callq 0xf070
movq 0x173e51(%rip), %rax    # 0x187f90
movq (%rax), %rdi
callq 0xf5e0
movq 0x28(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0x50(%rsp), %rax
addq $0x58, %rsp
retq
movq 0x20(%rsp), %rdi
callq 0xf8a0
nopw %cs:(%rax,%rax)