// File: tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelBlock.cpp
// Function: gaps::R3SurfelBlock::operator=(gaps::R3SurfelBlock const&)
R3SurfelBlock& R3SurfelBlock::
operator=(const R3SurfelBlock& block)
{
  // Delete old surfels
  if (this->surfels) delete this->surfels;
  this->surfels = NULL;

  // Copy properties
  this->nsurfels = block.nsurfels;
  this->position_origin = block.position_origin;
  this->bbox = block.bbox;
  this->timestamp_origin = block.timestamp_origin;
  this->timestamp_range = block.timestamp_range;
  this->min_identifier = block.min_identifier;
  this->max_identifier = block.max_identifier;
  this->resolution = block.resolution;
  this->flags = block.flags & R3_SURFEL_BLOCK_PROPERTY_FLAGS;
  this->data = NULL;
  this->database = NULL;
  this->database_index = -1;
  this->file_surfels_offset = 0;
  this->file_surfels_count = 0;
  this->file_read_count = 0;
  this->node = NULL;
  this->opengl_id = 0;

  // Copy surfels
  if (this->nsurfels > 0) {
    this->surfels = new R3Surfel [ this->nsurfels ];
    for (int i = 0; i < this->nsurfels; i++) {
      this->surfels[i] = block.surfels[i];
    }
  }

  // Return this
  return *this;
}

// Assembly:
subq $0x68, %rsp
movq %rdi, 0x60(%rsp)
movq %rsi, 0x58(%rsp)
movq 0x60(%rsp), %rax
movq %rax, 0x38(%rsp)
cmpq $0x0, (%rax)
je 0x4a2b2
movq 0x38(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x30(%rsp)
cmpq $0x0, %rax
je 0x4a2b0
movq 0x30(%rsp), %rdi
movl $0x30, %esi
callq 0x13580
jmp 0x4a2b2
movq 0x38(%rsp), %rdi
movq $0x0, (%rdi)
movq 0x58(%rsp), %rax
movl 0x8(%rax), %eax
movl %eax, 0x8(%rdi)
movq 0x58(%rsp), %rsi
addq $0x10, %rsi
addq $0x10, %rdi
callq 0xf89e0
movq 0x38(%rsp), %rdi
movq 0x58(%rsp), %rsi
addq $0x28, %rsi
addq $0x28, %rdi
callq 0x1bd40
movq 0x38(%rsp), %rax
movq 0x58(%rsp), %rcx
movsd 0x60(%rcx), %xmm0
movsd %xmm0, 0x60(%rax)
movq 0x58(%rsp), %rcx
movq 0x68(%rcx), %rdx
movq %rdx, 0x68(%rax)
movq 0x70(%rcx), %rcx
movq %rcx, 0x70(%rax)
movq 0x58(%rsp), %rcx
movl 0x78(%rcx), %ecx
movl %ecx, 0x78(%rax)
movq 0x58(%rsp), %rcx
movl 0x7c(%rcx), %ecx
movl %ecx, 0x7c(%rax)
movq 0x58(%rsp), %rcx
movsd 0x80(%rcx), %xmm0
movsd %xmm0, 0x80(%rax)
movq 0x58(%rsp), %rdi
addq $0x88, %rdi
callq 0x1c310
movq %rax, %rsi
andq $0xff, %rsi
leaq 0x50(%rsp), %rdi
callq 0x1b970
movq 0x38(%rsp), %rax
movq 0x50(%rsp), %rcx
movq %rcx, 0x88(%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 0x4a4e9
movq 0x38(%rsp), %rax
movslq 0x8(%rax), %rax
movq %rax, 0x20(%rsp)
movl $0x30, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
movq %rdi, 0x18(%rsp)
callq 0x13030
movq %rax, %rcx
movq 0x20(%rsp), %rax
movq %rcx, 0x28(%rsp)
cmpq $0x0, %rax
je 0x4a466
movq 0x28(%rsp), %rax
movq 0x20(%rsp), %rcx
imulq $0x30, %rcx, %rdx
movq %rax, %rcx
addq %rdx, %rcx
movq %rcx, 0x8(%rsp)
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rdi
movq %rdi, (%rsp)
callq 0x47310
jmp 0x4a44f
movq 0x8(%rsp), %rcx
movq (%rsp), %rax
addq $0x30, %rax
cmpq %rcx, %rax
movq %rax, 0x10(%rsp)
jne 0x4a43f
movq 0x38(%rsp), %rax
movq 0x28(%rsp), %rcx
movq %rcx, (%rax)
movl $0x0, 0x40(%rsp)
movq 0x38(%rsp), %rcx
movl 0x40(%rsp), %eax
cmpl 0x8(%rcx), %eax
jge 0x4a4e7
movq 0x38(%rsp), %rax
movq 0x58(%rsp), %rcx
movq (%rcx), %rsi
movslq 0x40(%rsp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rsi
movq (%rax), %rdi
movslq 0x40(%rsp), %rax
imulq $0x30, %rax, %rax
addq %rax, %rdi
movl $0x30, %edx
callq 0x13460
movl 0x40(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x40(%rsp)
jmp 0x4a47b
movq 0x18(%rsp), %rsi
movq 0x28(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x48(%rsp)
movl %eax, 0x44(%rsp)
callq 0x13a90
jmp 0x4a4f3
jmp 0x4a4e9
movq 0x38(%rsp), %rax
addq $0x68, %rsp
retq
movq 0x48(%rsp), %rdi
callq 0x13970
nopl (%rax)