// File: tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelBlock.cpp
// Function: gaps::R3SurfelBlock::R3SurfelBlock(gaps::RNArray<gaps::R3Surfel const*> const&, gaps::R3Point const&, double)
R3SurfelBlock::
R3SurfelBlock(const RNArray<const R3Surfel *>& array,
  const R3Point& position_origin, RNScalar timestamp_origin)
  : surfels(NULL),
    nsurfels(array.NEntries()),
    position_origin(position_origin),
    bbox(FLT_MAX,FLT_MAX,FLT_MAX,-FLT_MAX,-FLT_MAX,-FLT_MAX),
    timestamp_origin(timestamp_origin),
    timestamp_range(FLT_MAX,-FLT_MAX),
    min_identifier(UINT_MAX),
    max_identifier(0),
    resolution(0),
    flags(0),
    data(NULL),
    database(NULL),
    database_index(-1),
    file_surfels_offset(0),
    file_surfels_count(0),
    file_read_count(0),
    node(NULL),
    opengl_id(0)
{
  // Copy surfels
  if (nsurfels > 0) {
    surfels = new R3Surfel [ nsurfels ];
    for (int i = 0; i < nsurfels; i++) {
      this->surfels[i] = *(array[i]);
    }
  }
}

// Assembly:
subq $0x88, %rsp
movq %rdi, 0x80(%rsp)
movq %rsi, 0x78(%rsp)
movq %rdx, 0x70(%rsp)
movsd %xmm0, 0x68(%rsp)
movq 0x80(%rsp), %rax
movq %rax, 0x40(%rsp)
movq $0x0, (%rax)
movq 0x78(%rsp), %rdi
callq 0x16d50
movq 0x40(%rsp), %rdi
movl %eax, 0x8(%rdi)
addq $0x10, %rdi
movq 0x70(%rsp), %rsi
callq 0xf8390
movq 0x40(%rsp), %rdi
addq $0x28, %rdi
movq %rdi, 0x38(%rsp)
movsd 0x15aba7(%rip), %xmm2   # 0x1a4190
movsd %xmm2, 0x48(%rsp)
movsd 0x15ab91(%rip), %xmm5   # 0x1a4188
movsd %xmm5, 0x50(%rsp)
movaps %xmm2, %xmm0
movaps %xmm2, %xmm1
movaps %xmm5, %xmm3
movaps %xmm5, %xmm4
callq 0xc9ee0
movq 0x40(%rsp), %rdi
movsd 0x48(%rsp), %xmm0
movsd 0x50(%rsp), %xmm1
movsd 0x68(%rsp), %xmm2
movsd %xmm2, 0x60(%rdi)
addq $0x68, %rdi
callq 0x144d90
jmp 0x49635
movq 0x40(%rsp), %rdi
movl $0xffffffff, 0x78(%rdi) # imm = 0xFFFFFFFF
movl $0x0, 0x7c(%rdi)
movq $0x0, 0x80(%rdi)
addq $0x88, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x1b970
jmp 0x49665
movq 0x40(%rsp), %rax
movq $0x0, 0x90(%rax)
movq $0x0, 0x98(%rax)
movl $0xffffffff, 0xa0(%rax) # imm = 0xFFFFFFFF
movq $0x0, 0xa8(%rax)
movl $0x0, 0xb0(%rax)
movl $0x0, 0xb4(%rax)
movq $0x0, 0xb8(%rax)
movl $0x0, 0xc0(%rax)
cmpl $0x0, 0x8(%rax)
jle 0x497e6
movq 0x40(%rsp), %rax
movslq 0x8(%rax), %rax
movq %rax, 0x20(%rsp)
movl $0x30, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
movq %rdi, 0x28(%rsp)
callq 0x13030
movq %rax, 0x30(%rsp)
jmp 0x496fd
movq 0x20(%rsp), %rax
cmpq $0x0, %rax
je 0x4974f
movq 0x30(%rsp), %rax
movq 0x20(%rsp), %rcx
imulq $0x30, %rcx, %rdx
movq %rax, %rcx
addq %rdx, %rcx
movq %rcx, 0x10(%rsp)
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x47310
jmp 0x49737
movq 0x10(%rsp), %rcx
movq 0x8(%rsp), %rax
addq $0x30, %rax
cmpq %rcx, %rax
movq %rax, 0x18(%rsp)
jne 0x49726
movq 0x40(%rsp), %rax
movq 0x30(%rsp), %rcx
movq %rcx, (%rax)
movl $0x0, 0x58(%rsp)
movq 0x40(%rsp), %rcx
movl 0x58(%rsp), %eax
cmpl 0x8(%rcx), %eax
jge 0x497e4
movq 0x78(%rsp), %rdi
movl 0x58(%rsp), %esi
callq 0x4fb70
movq %rax, (%rsp)
jmp 0x49786
movq (%rsp), %rsi
movq 0x40(%rsp), %rax
movq (%rax), %rdi
movslq 0x58(%rsp), %rax
imulq $0x30, %rax, %rax
addq %rax, %rdi
movl $0x30, %edx
callq 0x13460
movl 0x58(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x58(%rsp)
jmp 0x49764
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x60(%rsp)
movl %eax, 0x5c(%rsp)
jmp 0x497ee
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x60(%rsp)
movl %eax, 0x5c(%rsp)
callq 0x13a90
jmp 0x497ee
jmp 0x497e6
addq $0x88, %rsp
retq
movq 0x38(%rsp), %rdi
callq 0x1b990
movq 0x60(%rsp), %rdi
callq 0x13970
nopw %cs:(%rax,%rax)