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

  // Write properties to file
  if (!properties->Write(filename)) {
    RNFail("Unable to write properties to %s\n", filename);
    return 0;
  }

  // Print statistics
  if (print_verbose) {
    printf("Wrote properties to %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 success
  return 1;
}

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x38(%rsp)
movq %rsi, 0x30(%rsp)
leaq 0x20(%rsp), %rdi
callq 0xa0ab0
leaq 0x20(%rsp), %rdi
callq 0x13550
movq 0x38(%rsp), %rdi
movq 0x30(%rsp), %rsi
callq 0x15ad0
cmpl $0x0, %eax
jne 0x10e16
movq 0x30(%rsp), %rsi
leaq 0x9469b(%rip), %rdi     # 0xa549d
movb $0x0, %al
callq 0xa4cd0
movl $0x0, 0x44(%rsp)
jmp 0x10ffe
cmpl $0x0, 0xbbdcb(%rip)     # 0xccbe8
je 0x10e95
movq 0x30(%rsp), %rsi
leaq 0x94694(%rip), %rdi     # 0xa54bf
movb $0x0, %al
callq 0xd070
leaq 0x20(%rsp), %rdi
callq 0xa0b70
leaq 0x942c5(%rip), %rdi     # 0xa5108
movb $0x1, %al
callq 0xd070
movq 0x38(%rsp), %rdi
callq 0x135e0
movl %eax, %esi
leaq 0x94338(%rip), %rdi     # 0xa5195
movb $0x0, %al
callq 0xd070
movq 0x38(%rsp), %rdi
callq 0x13470
movq %rax, %rdi
callq 0x135b0
movl %eax, %esi
leaq 0x942c0(%rip), %rdi     # 0xa513f
movb $0x0, %al
callq 0xd070
movq 0xbb113(%rip), %rax     # 0xcbfa0
movq (%rax), %rdi
callq 0xd4e0
cmpl $0x0, 0xbbd50(%rip)     # 0xccbec
je 0x10ff6
leaq 0x95659(%rip), %rdi     # 0xa6502
movb $0x0, %al
callq 0xd070
movl $0x0, 0x1c(%rsp)
movl 0x1c(%rsp), %eax
movl %eax, 0xc(%rsp)
movq 0x38(%rsp), %rdi
callq 0x135e0
movl %eax, %ecx
movl 0xc(%rsp), %eax
cmpl %ecx, %eax
jge 0x10ff4
movq 0x38(%rsp), %rdi
movl 0x1c(%rsp), %esi
callq 0x134e0
movq %rax, 0x10(%rsp)
movl 0x1c(%rsp), %eax
movl %eax, 0x8(%rsp)
movq 0x10(%rsp), %rdi
callq 0x13600
movl 0x8(%rsp), %esi
movq %rax, %rdx
leaq 0x9429f(%rip), %rdi     # 0xa51aa
movb $0x0, %al
callq 0xd070
movq 0x10(%rsp), %rdi
callq 0x178f0
leaq 0x94299(%rip), %rdi     # 0xa51bc
movb $0x1, %al
callq 0xd070
movq 0x10(%rsp), %rdi
callq 0x17a10
leaq 0x94293(%rip), %rdi     # 0xa51ce
movb $0x1, %al
callq 0xd070
movq 0x10(%rsp), %rdi
callq 0x181c0
leaq 0x9428d(%rip), %rdi     # 0xa51e0
movb $0x1, %al
callq 0xd070
movq 0x10(%rsp), %rdi
callq 0x177d0
leaq 0x94286(%rip), %rdi     # 0xa51f1
movb $0x1, %al
callq 0xd070
movq 0x10(%rsp), %rdi
callq 0x18220
movl %eax, %esi
leaq 0x9427b(%rip), %rdi     # 0xa5200
movb $0x0, %al
callq 0xd070
movq 0x10(%rsp), %rdi
callq 0x182a0
movl %eax, %esi
leaq 0x94274(%rip), %rdi     # 0xa5213
movb $0x0, %al
callq 0xd070
movq 0x10(%rsp), %rdi
callq 0x183e0
leaq 0x9426f(%rip), %rdi     # 0xa5226
movb $0x1, %al
callq 0xd070
movq 0x10(%rsp), %rdi
callq 0x18480
leaq 0x94268(%rip), %rdi     # 0xa5237
movb $0x1, %al
callq 0xd070
leaq 0x95525(%rip), %rdi     # 0xa6502
movb $0x0, %al
callq 0xd070
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0x10eb8
jmp 0x10ff6
movl $0x1, 0x44(%rsp)
movl 0x44(%rsp), %eax
addq $0x48, %rsp
retq
nopw (%rax,%rax)