// File: tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelObject.cpp
// Function: gaps::R3SurfelObject::~R3SurfelObject()
R3SurfelObject::
~R3SurfelObject(void)
{
  // Delete object properties
  while (NObjectProperties() > 0) {
    R3SurfelObjectProperty *property = ObjectProperty(NObjectProperties()-1);
    delete property;
  }

  // Delete object relationships
  while (NObjectRelationships() > 0) {
    R3SurfelObjectRelationship *relationship = ObjectRelationship(NObjectRelationships()-1);
    delete relationship;
  }

  // Delete object assignments
  while (NLabelAssignments() > 0) {
    R3SurfelLabelAssignment *assignment = LabelAssignment(NLabelAssignments()-1);
    delete assignment;
  }

  // Remove nodes from object
  while (NNodes() > 0) {
    R3SurfelNode *node = Node(NNodes()-1);
    RemoveNode(node);
  }

  // Delete parts
  while (NParts() > 0) {
    R3SurfelObject *part = Part(NParts()-1);
    delete part;
  }

  // Remove from parent
  SetParent(NULL);

  // Remove object from scene (handles all removals)
  if (scene) scene->RemoveObject(this);

  // Delete name
  if (name) free(name);
}

// Assembly:
subq $0xa8, %rsp
movq %rdi, 0xa0(%rsp)
movq 0xa0(%rsp), %rax
movq %rax, 0x70(%rsp)
leaq 0x1d4e4d(%rip), %rcx    # 0x1edd30
addq $0x10, %rcx
movq %rcx, (%rax)
movq 0x70(%rsp), %rdi
callq 0x1ba20
movl %eax, 0x6c(%rsp)
jmp 0x18efa
movl 0x6c(%rsp), %eax
cmpl $0x0, %eax
jle 0x18f57
movq 0x70(%rsp), %rdi
callq 0x1ba20
movl %eax, 0x68(%rsp)
jmp 0x18f13
movq 0x70(%rsp), %rdi
movl 0x68(%rsp), %esi
decl %esi
callq 0x1ba40
movq %rax, 0x60(%rsp)
jmp 0x18f2a
movq 0x60(%rsp), %rax
movq %rax, 0x98(%rsp)
movq 0x98(%rsp), %rax
movq %rax, 0x58(%rsp)
cmpq $0x0, %rax
je 0x18f55
movq 0x58(%rsp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x18eea
jmp 0x18f59
movq 0x70(%rsp), %rdi
callq 0x1ba70
movl %eax, 0x54(%rsp)
jmp 0x18f69
movl 0x54(%rsp), %eax
cmpl $0x0, %eax
jle 0x18fc6
movq 0x70(%rsp), %rdi
callq 0x1ba70
movl %eax, 0x50(%rsp)
jmp 0x18f82
movq 0x70(%rsp), %rdi
movl 0x50(%rsp), %esi
decl %esi
callq 0x1ba90
movq %rax, 0x48(%rsp)
jmp 0x18f99
movq 0x48(%rsp), %rax
movq %rax, 0x90(%rsp)
movq 0x90(%rsp), %rax
movq %rax, 0x40(%rsp)
cmpq $0x0, %rax
je 0x18fc4
movq 0x40(%rsp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x18f59
jmp 0x18fc8
movq 0x70(%rsp), %rdi
callq 0x1bac0
movl %eax, 0x3c(%rsp)
jmp 0x18fd8
movl 0x3c(%rsp), %eax
cmpl $0x0, %eax
jle 0x19035
movq 0x70(%rsp), %rdi
callq 0x1bac0
movl %eax, 0x38(%rsp)
jmp 0x18ff1
movq 0x70(%rsp), %rdi
movl 0x38(%rsp), %esi
decl %esi
callq 0x1bae0
movq %rax, 0x30(%rsp)
jmp 0x19008
movq 0x30(%rsp), %rax
movq %rax, 0x88(%rsp)
movq 0x88(%rsp), %rax
movq %rax, 0x28(%rsp)
cmpq $0x0, %rax
je 0x19033
movq 0x28(%rsp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x18fc8
jmp 0x19037
movq 0x70(%rsp), %rdi
callq 0x18660
movl %eax, 0x24(%rsp)
jmp 0x19047
movl 0x24(%rsp), %eax
cmpl $0x0, %eax
jle 0x1909a
movq 0x70(%rsp), %rdi
callq 0x18660
movl %eax, 0x20(%rsp)
jmp 0x19060
movq 0x70(%rsp), %rdi
movl 0x20(%rsp), %esi
decl %esi
callq 0x18680
movq %rax, 0x18(%rsp)
jmp 0x19077
movq 0x70(%rsp), %rdi
movq 0x18(%rsp), %rax
movq %rax, 0x80(%rsp)
movq 0x80(%rsp), %rsi
callq 0x191d0
jmp 0x19098
jmp 0x19037
jmp 0x1909c
movq 0x70(%rsp), %rdi
callq 0x1bb10
movl %eax, 0x14(%rsp)
jmp 0x190ac
movl 0x14(%rsp), %eax
cmpl $0x0, %eax
jle 0x19101
movq 0x70(%rsp), %rdi
callq 0x1bb10
movl %eax, 0x10(%rsp)
jmp 0x190c5
movq 0x70(%rsp), %rdi
movl 0x10(%rsp), %esi
decl %esi
callq 0x1bb30
movq %rax, 0x8(%rsp)
jmp 0x190dc
movq 0x8(%rsp), %rax
movq %rax, 0x78(%rsp)
movq 0x78(%rsp), %rax
movq %rax, (%rsp)
cmpq $0x0, %rax
je 0x190ff
movq (%rsp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x1909c
movq 0x70(%rsp), %rdi
movq (%rdi), %rax
movq 0x38(%rax), %rax
xorl %ecx, %ecx
movl %ecx, %esi
callq *%rax
jmp 0x19115
movq 0x70(%rsp), %rax
cmpq $0x0, 0x8(%rax)
je 0x19137
movq 0x70(%rsp), %rsi
movq 0x8(%rsi), %rdi
movq (%rdi), %rax
movq 0x20(%rax), %rax
callq *%rax
jmp 0x19135
jmp 0x19137
movq 0x70(%rsp), %rax
cmpq $0x0, 0x88(%rax)
je 0x19157
movq 0x70(%rsp), %rax
movq 0x88(%rax), %rdi
callq 0x136a0
movq 0x70(%rsp), %rdi
addq $0xa0, %rdi
callq 0x1b990
movq 0x70(%rsp), %rdi
addq $0x70, %rdi
callq 0x6c250
movq 0x70(%rsp), %rdi
addq $0x60, %rdi
callq 0x1b9a0
movq 0x70(%rsp), %rdi
addq $0x50, %rdi
callq 0x1b9b0
movq 0x70(%rsp), %rdi
addq $0x40, %rdi
callq 0x1b9c0
movq 0x70(%rsp), %rdi
addq $0x30, %rdi
callq 0x1b9d0
movq 0x70(%rsp), %rdi
addq $0x20, %rdi
callq 0x1b9e0
addq $0xa8, %rsp
retq
movq %rax, %rdi
callq 0x187d0
nopl (%rax)