// File: tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelPointSet.cpp
// Function: gaps::R3SurfelPointSet::AllocatePoints(int)
void R3SurfelPointSet::
AllocatePoints(int n)
{
  // Check if already big enough
  if (n <= nallocated) return;

  // To avoid little increments to nallocated
  if (n < 2*npoints) n = 2*npoints;

  // Allocate enough memory to store n points
  R3SurfelPoint *next_points = new R3SurfelPoint [ n ];

  // Copy and delete old points
  if (points) {
    for (int i = 0; i < npoints; i++) next_points[i] = points[i];
    delete [] points;
  }

  // Update set
  points = next_points;
  nallocated = n;
}

// Assembly:
subq $0xa8, %rsp
movq %rdi, 0xa0(%rsp)
movl %esi, 0x9c(%rsp)
movq 0xa0(%rsp), %rcx
movq %rcx, 0x78(%rsp)
movl 0x9c(%rsp), %eax
cmpl 0x14(%rcx), %eax
jg 0x59234
jmp 0x5947e
movq 0x78(%rsp), %rcx
movl 0x9c(%rsp), %eax
movl 0x10(%rcx), %ecx
shll %ecx
cmpl %ecx, %eax
jge 0x5925a
movq 0x78(%rsp), %rax
movl 0x10(%rax), %eax
shll %eax
movl %eax, 0x9c(%rsp)
movslq 0x9c(%rsp), %rax
movq %rax, 0x60(%rsp)
movl $0x10, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
addq $0x8, %rdi
setb %al
orb %al, %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
movq %rdi, 0x58(%rsp)
callq 0x13030
movq %rax, %rcx
movq 0x60(%rsp), %rax
movq %rcx, 0x68(%rsp)
movq %rax, (%rcx)
addq $0x8, %rcx
movq %rcx, 0x70(%rsp)
cmpq $0x0, %rax
je 0x592fc
movq 0x70(%rsp), %rax
movq 0x60(%rsp), %rdx
shlq $0x4, %rdx
movq %rax, %rcx
addq %rdx, %rcx
movq %rcx, 0x48(%rsp)
movq %rax, 0x50(%rsp)
movq 0x50(%rsp), %rdi
movq %rdi, 0x40(%rsp)
callq 0x55630
jmp 0x592e4
movq 0x48(%rsp), %rcx
movq 0x40(%rsp), %rax
addq $0x10, %rax
cmpq %rcx, %rax
movq %rax, 0x50(%rsp)
jne 0x592d3
movq 0x78(%rsp), %rax
movq 0x70(%rsp), %rcx
movq %rcx, 0x90(%rsp)
cmpq $0x0, 0x8(%rax)
je 0x59463
movl $0x0, 0x80(%rsp)
movq 0x78(%rsp), %rcx
movl 0x80(%rsp), %eax
cmpl 0x10(%rcx), %eax
jge 0x593e1
movq 0x78(%rsp), %rax
movq 0x8(%rax), %rsi
movslq 0x80(%rsp), %rax
shlq $0x4, %rax
addq %rax, %rsi
movq 0x90(%rsp), %rdi
movslq 0x80(%rsp), %rax
shlq $0x4, %rax
addq %rax, %rdi
callq 0x55980
movl 0x80(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x80(%rsp)
jmp 0x59324
movq 0x70(%rsp), %rcx
movq %rax, %rsi
movq 0x40(%rsp), %rax
movq %rsi, 0x88(%rsp)
movl %edx, 0x84(%rsp)
cmpq %rax, %rcx
movq %rax, 0x38(%rsp)
je 0x593cd
movq 0x38(%rsp), %rdi
addq $-0x10, %rdi
movq %rdi, 0x30(%rsp)
callq 0x557a0
movq 0x70(%rsp), %rcx
movq 0x30(%rsp), %rax
cmpq %rcx, %rax
movq %rax, 0x38(%rsp)
jne 0x593a6
movq 0x58(%rsp), %rsi
movq 0x68(%rsp), %rdi
callq 0x13a90
jmp 0x59486
movq 0x78(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x28(%rsp)
cmpq $0x0, %rax
je 0x59461
movq 0x28(%rsp), %rcx
movq %rcx, %rax
addq $-0x8, %rax
movq %rax, 0x10(%rsp)
movq -0x8(%rcx), %rdx
movq %rdx, 0x18(%rsp)
shlq $0x4, %rdx
movq %rcx, %rax
addq %rdx, %rax
cmpq %rax, %rcx
movq %rax, 0x20(%rsp)
je 0x5944a
movq 0x20(%rsp), %rdi
addq $-0x10, %rdi
movq %rdi, 0x8(%rsp)
callq 0x557a0
movq 0x28(%rsp), %rcx
movq 0x8(%rsp), %rax
cmpq %rcx, %rax
movq %rax, 0x20(%rsp)
jne 0x59423
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
shlq $0x4, %rsi
addq $0x8, %rsi
callq 0x13a90
jmp 0x59463
movq 0x78(%rsp), %rax
movq 0x90(%rsp), %rcx
movq %rcx, 0x8(%rax)
movl 0x9c(%rsp), %ecx
movl %ecx, 0x14(%rax)
addq $0xa8, %rsp
retq
movq 0x88(%rsp), %rdi
callq 0x13970
nopw %cs:(%rax,%rax)