// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/apps/grd2grd/grd2grd.cpp
// Function: ReadGrid(char const*)
static R3Grid *
ReadGrid(const char *input_name)
{
  // Start statistics
  RNTime start_time;
  start_time.Read();

  // Allocate a grid
  R3Grid *grid = new R3Grid();
  if (!grid) {
    RNFail("Unable to allocate grid");
    return NULL;
  }

  // Read grid
  int status = grid->ReadFile(input_name);
  if (!status) {
    RNFail("Unable to read grid file %s", input_name);
    return NULL;
  }

  // Print statistics
  if (print_verbose) {
    printf("Read grid ...\n");
    printf("  Time = %.2f seconds\n", start_time.Elapsed());
    printf("  Resolution = %d %d %d\n", grid->XResolution(), grid->YResolution(), grid->ZResolution());
    printf("  Spacing = %g\n", grid->GridToWorldScaleFactor());
    printf("  Cardinality = %d\n", grid->Cardinality());
    printf("  Volume = %g\n", grid->Volume());
    RNInterval grid_range = grid->Range();
    printf("  Minimum = %g\n", grid_range.Min());
    printf("  Maximum = %g\n", grid_range.Max());
    printf("  L1Norm = %g\n", grid->L1Norm());
    printf("  L2Norm = %g\n", grid->L2Norm());
    fflush(stdout);
  }

  // Return success
  return grid;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rdi, %r14
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x704f0
movq %rbx, %rdi
xorl %esi, %esi
callq 0xe760
movl $0x250, %edi            # imm = 0x250
callq 0xe440
movq %rax, %rbx
movq %rax, %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x11a18
movq %rbx, %rdi
movq %r14, %rsi
callq 0x190c0
testl %eax, %eax
je 0x119bc
cmpb $0x1, 0xd5ffc(%rip)     # 0xe78a0
jne 0x119f3
leaq 0x91ae5(%rip), %rdi     # 0xa3396
callq 0xe6f0
leaq 0x8(%rsp), %rdi
callq 0x70552
leaq 0x9195b(%rip), %rdi     # 0xa3222
movb $0x1, %al
callq 0xe070
movl 0x238(%rbx), %esi
movl 0x23c(%rbx), %edx
movl 0x240(%rbx), %ecx
leaq 0x91952(%rip), %rdi     # 0xa3239
xorl %eax, %eax
callq 0xe070
movsd 0x228(%rbx), %xmm0
leaq 0x91955(%rip), %rdi     # 0xa3252
movb $0x1, %al
callq 0xe070
movq %rbx, %rdi
callq 0x12652
leaq 0x9194f(%rip), %rdi     # 0xa3262
movl %eax, %esi
xorl %eax, %eax
callq 0xe070
movsd 0x228(%rbx), %xmm0
movsd %xmm0, (%rsp)
movq %rbx, %rdi
callq 0x12652
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd (%rsp), %xmm1
mulsd %xmm1, %xmm0
mulsd %xmm1, %xmm0
mulsd %xmm1, %xmm0
leaq 0x91926(%rip), %rdi     # 0xa3276
movb $0x1, %al
callq 0xe070
leaq 0x18(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x12594
movsd (%r14), %xmm0
leaq 0x91912(%rip), %rdi     # 0xa3285
movb $0x1, %al
callq 0xe070
movsd 0x8(%r14), %xmm0
leaq 0x9190e(%rip), %rdi     # 0xa3295
movb $0x1, %al
callq 0xe070
movq %rbx, %rdi
callq 0x125fa
leaq 0x91908(%rip), %rdi     # 0xa32a5
movb $0x1, %al
callq 0xe070
movq %rbx, %rdi
callq 0x12622
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x119d1
sqrtsd %xmm0, %xmm0
jmp 0x119d6
leaq 0x91843(%rip), %rdi     # 0xa3206
xorl %ebx, %ebx
movq %r14, %rsi
xorl %eax, %eax
callq 0x72ebe
jmp 0x119f3
callq 0xe340
leaq 0x918d7(%rip), %rdi     # 0xa32b4
movb $0x1, %al
callq 0xe070
movq 0xd4585(%rip), %rax     # 0xe5f70
movq (%rax), %rdi
callq 0xe520
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r14
retq
movq %rax, %r14
movl $0x250, %esi            # imm = 0x250
movq %rbx, %rdi
callq 0xe450
movq %r14, %rdi
callq 0xe7e0
nop