// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelUtils.cpp
// Function: gaps::CreateConnectedPointSet(gaps::R3SurfelPointSet*, double, double, double)
R3SurfelPointSet *
CreateConnectedPointSet(R3SurfelPointSet *pointset, 
  RNScalar min_volume, RNScalar max_volume, RNLength max_spacing)
{
  // Create grid
  R3Grid *grid = CreateGrid(pointset, max_spacing);
  if (!grid) return NULL;

  // Find largest connected component
  if (!MaskToLargestConnectedComponent(grid, 0.5, min_volume, max_volume)) { 
    delete grid; 
    return NULL; 
  }

  // Create connnected point set
  R3SurfelGridConstraint constraint(grid);
  R3SurfelPointSet *connected_pointset = CreatePointSet(pointset, &constraint);

  // Delete grid
  delete grid;

  // Return connected point set
  return connected_pointset;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movsd %xmm1, 0x18(%rsp)
movsd %xmm0, 0x10(%rsp)
movq %rdi, %r14
movapd %xmm2, %xmm0
movl $0x400, %esi            # imm = 0x400
callq 0x242e5
testq %rax, %rax
je 0x24244
movq %rax, %rbx
movslq 0x24c(%rax), %rbp
testq %rbp, %rbp
je 0x2422f
movsd 0x220(%rbx), %xmm0
movsd %xmm0, 0x8(%rsp)
movq %rbp, %rax
shlq $0x2, %rax
testl %ebp, %ebp
pushq $-0x1
popq %r15
cmovnsq %rax, %r15
movq %r15, %rdi
callq 0x13030
movq %rax, %r13
movq %r15, %rdi
callq 0x13030
movq %rax, %r12
movq %r15, %rdi
callq 0x13030
movq %rax, %r15
movsd 0xa3fef(%rip), %xmm0    # 0xc8138
movq %rbx, %rdi
movl %ebp, %esi
movq %r12, (%rsp)
movq %r12, %rdx
movq %r13, %rcx
movq %rax, %r8
callq 0x7582c
testl %eax, %eax
jle 0x24216
movsd 0x8(%rsp), %xmm1
movapd %xmm1, %xmm0
mulsd %xmm1, %xmm0
mulsd %xmm1, %xmm0
movsd 0x10(%rsp), %xmm1
mulsd %xmm0, %xmm1
cvttsd2si %xmm1, %ecx
mulsd 0x18(%rsp), %xmm0
cvttsd2si %xmm0, %edx
movl %eax, %esi
xorl %edi, %edi
pushq $-0x1
popq %rax
xorl %r8d, %r8d
cmpq %rdi, %rsi
je 0x241d9
testl %edx, %edx
setg %r10b
testl %ecx, %ecx
setg %bpl
movl (%r13,%rdi,4), %r9d
cmpl %ecx, %r9d
setl %r12b
cmpl %edx, %r9d
setg %r11b
testb %r12b, %bpl
jne 0x241d4
andb %r11b, %r10b
jne 0x241d4
cmpl %r8d, %r9d
cmovgl %edi, %eax
cmovgl %r9d, %r8d
incq %rdi
jmp 0x2419c
testl %eax, %eax
js 0x24216
movl 0x24c(%rbx), %ecx
xorl %edx, %edx
testl %ecx, %ecx
cmovlel %edx, %ecx
movsd 0xa3f56(%rip), %xmm0    # 0xc8148
cmpq %rdx, %rcx
je 0x24259
movapd %xmm0, %xmm1
cmpl %eax, (%r15,%rdx,4)
je 0x24205
xorpd %xmm1, %xmm1
movq 0x230(%rbx), %rsi
movsd %xmm1, (%rsi,%rdx,8)
incq %rdx
jmp 0x241f2
movq %r13, %rdi
callq 0x136a0
movq (%rsp), %rdi
callq 0x136a0
movq %r15, %rdi
callq 0x136a0
movq %rbx, %rdi
callq 0x6c22a
movl $0x250, %esi            # imm = 0x250
movq %rbx, %rdi
callq 0x13500
xorl %r14d, %r14d
movq %r14, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r13, %rdi
callq 0x136a0
movq (%rsp), %rdi
callq 0x136a0
movq %r15, %rdi
callq 0x136a0
leaq 0x1009af(%rip), %rax    # 0x124c28
movsd (%rax), %xmm0
leaq 0x20(%rsp), %r15
pushq $0x4
popq %rdx
pushq $0x1
popq %r8
xorpd %xmm1, %xmm1
xorpd %xmm2, %xmm2
movq %r15, %rdi
movq %rbx, %rsi
xorl %ecx, %ecx
callq 0x2d9f6
movq %r14, %rdi
movq %r15, %rsi
callq 0x20c50
movq %rax, %r14
movq %rbx, %rdi
callq 0x6c22a
movl $0x250, %esi            # imm = 0x250
movq %rbx, %rdi
callq 0x13500
leaq 0x20(%rsp), %rdi
callq 0x2ec74
jmp 0x24247
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x2ec74
movq %rbx, %rdi
callq 0x138f0