// File: /workspace/github_cpp_makefile_star2_O3/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 0x6f740
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 0x119fc
movq %rbx, %rdi
movq %r14, %rsi
callq 0x191a6
testl %eax, %eax
je 0x119a2
cmpb $0x1, 0xd5016(%rip)     # 0xe68a0
jne 0x119d9
leaq 0x90afc(%rip), %rdi     # 0xa2393
callq 0xe6f0
leaq 0x8(%rsp), %rdi
callq 0x6f7a2
leaq 0x90972(%rip), %rdi     # 0xa221f
movb $0x1, %al
callq 0xe070
movl 0x238(%rbx), %esi
movl 0x23c(%rbx), %edx
movl 0x240(%rbx), %ecx
leaq 0x90969(%rip), %rdi     # 0xa2236
xorl %eax, %eax
callq 0xe070
movsd 0x228(%rbx), %xmm0
leaq 0x9096c(%rip), %rdi     # 0xa224f
movb $0x1, %al
callq 0xe070
movq %rbx, %rdi
callq 0x1264c
leaq 0x90966(%rip), %rdi     # 0xa225f
movl %eax, %esi
xorl %eax, %eax
callq 0xe070
movsd 0x228(%rbx), %xmm0
movsd %xmm0, (%rsp)
movq %rbx, %rdi
callq 0x1264c
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd (%rsp), %xmm1
mulsd %xmm1, %xmm0
mulsd %xmm1, %xmm0
mulsd %xmm1, %xmm0
leaq 0x9093d(%rip), %rdi     # 0xa2273
movb $0x1, %al
callq 0xe070
leaq 0x18(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1258e
movsd (%r14), %xmm0
leaq 0x90929(%rip), %rdi     # 0xa2282
movb $0x1, %al
callq 0xe070
movsd 0x8(%r14), %xmm0
leaq 0x90925(%rip), %rdi     # 0xa2292
movb $0x1, %al
callq 0xe070
movq %rbx, %rdi
callq 0x125f4
leaq 0x9091f(%rip), %rdi     # 0xa22a2
movb $0x1, %al
callq 0xe070
movq %rbx, %rdi
callq 0x1261c
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x119b7
sqrtsd %xmm0, %xmm0
jmp 0x119bc
leaq 0x9085a(%rip), %rdi     # 0xa2203
xorl %ebx, %ebx
movq %r14, %rsi
xorl %eax, %eax
callq 0x71ea2
jmp 0x119d9
callq 0xe340
leaq 0x908ee(%rip), %rdi     # 0xa22b1
movb $0x1, %al
callq 0xe070
movq 0xd359f(%rip), %rax     # 0xe4f70
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