// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3PointSet.cpp
// Function: gaps::R3PointSet::ReadBinaryFile(char const*)
int R3PointSet::
ReadBinaryFile(const char *filename)
{
  // Open file
  FILE *fp = fopen(filename, "rb");
  if (!fp) {
    RNFail("Unable to open %s\n", filename);
    return 0;
  }

  // Read points
  float buf[16];
  while (fread(buf, sizeof(float), 16, fp) == (unsigned int) 16) {
    R3Point position(buf[0], buf[1], buf[2]);
    R3Vector normal(buf[3], buf[4], buf[5]);
    RNRgb color(buf[6], buf[7], buf[8]);
    double timestamp = buf[9];
    int category_identifier = buf[10] + 0.5;
    int instance_identifier = buf[11] + 0.5;
    double value = buf[12];
    normal.Normalize();
    int index = InsertPoint(position);
    SetPointNormal(index, normal);
    SetPointColor(index, color);
    SetPointTimestamp(index, timestamp);
    SetPointCategoryIdentifier(index, category_identifier);
    SetPointInstanceIdentifier(index, instance_identifier);
    SetPointValue(index, value);
  }

  // Close file
  fclose(fp);

  // Return success
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x744e4(%rip), %rsi     # 0xf566a
movq %r15, %rdi
callq 0x22a80
testq %rax, %rax
je 0x81339
movq %rax, %r14
leaq 0x20(%rsp), %rdi
movl $0x4, %esi
movl $0x10, %edx
movq %rax, %rcx
callq 0x22e20
cmpq $0x10, %rax
jne 0x8132a
movq %r14, 0x8(%rsp)
xorps %xmm0, %xmm0
cvtss2sd 0x20(%rsp), %xmm0
xorps %xmm1, %xmm1
cvtss2sd 0x24(%rsp), %xmm1
xorps %xmm2, %xmm2
cvtss2sd 0x28(%rsp), %xmm2
leaq 0x90(%rsp), %r14
movq %r14, %rdi
callq 0x7e04e
xorps %xmm0, %xmm0
cvtss2sd 0x2c(%rsp), %xmm0
xorps %xmm1, %xmm1
cvtss2sd 0x30(%rsp), %xmm1
xorps %xmm2, %xmm2
cvtss2sd 0x34(%rsp), %xmm2
leaq 0x78(%rsp), %r12
movq %r12, %rdi
callq 0x7eae6
xorps %xmm0, %xmm0
cvtss2sd 0x38(%rsp), %xmm0
xorps %xmm1, %xmm1
cvtss2sd 0x3c(%rsp), %xmm1
xorps %xmm2, %xmm2
cvtss2sd 0x40(%rsp), %xmm2
leaq 0x60(%rsp), %rdi
callq 0x9fc44
xorps %xmm0, %xmm0
cvtss2sd 0x44(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
xorps %xmm0, %xmm0
cvtss2sd 0x48(%rsp), %xmm0
movsd 0x72db0(%rip), %xmm1    # 0xf4008
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %r15d
xorps %xmm0, %xmm0
cvtss2sd 0x4c(%rsp), %xmm0
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %ebp
xorps %xmm0, %xmm0
cvtss2sd 0x50(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movq %r12, %rdi
callq 0x7ee08
movq 0x8(%rbx), %rax
subq (%rbx), %rax
shrq $0x3, %rax
imull $0xaaaaaaab, %eax, %r13d # imm = 0xAAAAAAAB
movq %rbx, %rdi
movl %r13d, %esi
movq %r14, %rdx
movq 0x8(%rsp), %r14
callq 0x7ff52
movq %rbx, %rdi
movl %r13d, %esi
movq %r12, %rdx
callq 0x7ffd2
movq %rbx, %rdi
movl %r13d, %esi
leaq 0x60(%rsp), %rdx
callq 0x8014e
movq %rbx, %rdi
movl %r13d, %esi
movsd 0x10(%rsp), %xmm0
callq 0x801c8
movq %rbx, %rdi
movl %r13d, %esi
movl %r15d, %edx
callq 0x80272
movq %rbx, %rdi
movl %r13d, %esi
movl %ebp, %edx
callq 0x8030c
movq %rbx, %rdi
movl %r13d, %esi
movsd 0x18(%rsp), %xmm0
callq 0x8044c
movl $0x4, %esi
movl $0x10, %edx
leaq 0x20(%rsp), %rdi
movq %r14, %rcx
callq 0x22e20
cmpq $0x10, %rax
je 0x811c0
movq %r14, %rdi
callq 0x22880
movl $0x1, %ebx
jmp 0x8134c
leaq 0x760ca(%rip), %rdi     # 0xf740a
xorl %ebx, %ebx
movq %r15, %rsi
xorl %eax, %eax
callq 0xa2c4e
movl %ebx, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq