// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3TriangleArray.cpp
// Function: gaps::R3TriangleArray::operator=(gaps::R3TriangleArray const&)
R3TriangleArray& R3TriangleArray::
operator=(const R3TriangleArray& array)
{
    // Delete previous triangles and vertices
    for (int i = 0; i < triangles.NEntries(); i++) delete triangles[i];
    for (int i = 0; i < vertices.NEntries(); i++) delete vertices[i];
    triangles.Empty();
    vertices.Empty();

    // Copy vertices
    for (int i = 0; i < array.vertices.NEntries(); i++) {
      R3TriangleVertex *oldv = array.vertices.Kth(i);
      R3TriangleVertex *newv = new R3TriangleVertex(*oldv);
      vertices.Insert(newv);
      newv->SetSharedFlag();
      oldv->SetMark(i);
    }

    // Copy triangles
    for (int i = 0; i < array.triangles.NEntries(); i++) {
      R3Triangle *oldt = array.triangles.Kth(i);
      R3TriangleVertex *v0 = vertices.Kth(oldt->V0()->Mark());
      R3TriangleVertex *v1 = vertices.Kth(oldt->V1()->Mark());
      R3TriangleVertex *v2 = vertices.Kth(oldt->V2()->Mark());
      R3Triangle *newt = new R3Triangle(v0, v1, v2);
      triangles.Insert(newt);
    }

    // Copy bbox
    bbox = array.bbox;

    // Update everything
    Update();

    // Return this
    return *this;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x18(%rdi), %r12
cmpl $0x0, 0x24(%rdi)
jle 0x52c6e
xorl %r14d, %r14d
movq (%r12), %rax
movq (%rax,%r14,8), %rdi
testq %rdi, %rdi
je 0x52c62
movq (%rdi), %rax
callq *0x8(%rax)
incq %r14
movslq 0x24(%rbx), %rax
cmpq %rax, %r14
jl 0x52c4f
leaq 0x8(%rbx), %rax
movq %rax, (%rsp)
cmpl $0x0, 0x14(%rbx)
jle 0x52ca5
xorl %r14d, %r14d
movq (%rsp), %rax
movq (%rax), %rax
movq (%rax,%r14,8), %rdi
testq %rdi, %rdi
je 0x52c99
movl $0x68, %esi
callq 0xe450
incq %r14
movslq 0x14(%rbx), %rax
cmpq %rax, %r14
jl 0x52c7f
movq %r12, %rdi
xorl %esi, %esi
callq 0x7082c
movq (%rsp), %rdi
xorl %esi, %esi
callq 0x7082c
cmpl $0x0, 0x14(%r15)
jle 0x52d08
xorl %r14d, %r14d
movq 0x8(%r15), %rax
movq (%rax,%r14,8), %rbp
movl $0x68, %edi
callq 0xe440
movq %rax, %r13
movq %rax, %rdi
movq %rbp, %rsi
callq 0x540c2
movl 0x14(%rbx), %edx
movq (%rsp), %rdi
movq %r13, %rsi
callq 0x70682
orb $0x1, 0x5a(%r13)
movl %r14d, 0x60(%rbp)
incq %r14
movslq 0x14(%r15), %rax
cmpq %rax, %r14
jl 0x52cc4
cmpl $0x0, 0x24(%r15)
jle 0x52d8b
xorl %r14d, %r14d
movq 0x18(%r15), %rax
movq (%rax,%r14,8), %rax
movq 0x8(%rax), %rcx
movq 0x10(%rax), %rdx
movslq 0x60(%rcx), %rcx
movq (%rsp), %rsi
movq (%rsi), %rsi
movq (%rsi,%rcx,8), %rcx
movq %rcx, 0x10(%rsp)
movslq 0x60(%rdx), %rcx
movq (%rsi,%rcx,8), %rcx
movq %rcx, 0x8(%rsp)
movq 0x18(%rax), %rax
movslq 0x60(%rax), %rax
movq (%rsi,%rax,8), %rbp
movl $0x88, %edi
callq 0xe440
movq %rax, %r13
movq %rax, %rdi
movq 0x10(%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %rbp, %rcx
callq 0x54628
movl 0x24(%rbx), %edx
movq %r12, %rdi
movq %r13, %rsi
callq 0x70682
incq %r14
movslq 0x24(%r15), %rax
cmpq %rax, %r14
jl 0x52d12
leaq 0x30(%rbx), %rdi
leaq 0x30(%r15), %rsi
callq 0x3cd94
leaq 0x48(%rbx), %rdi
addq $0x48, %r15
movq %r15, %rsi
callq 0x3cd94
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x248(%rax)
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movl $0x88, %esi
jmp 0x52dd8
movq %rax, %rbx
movl $0x68, %esi
movq %r13, %rdi
callq 0xe450
movq %rbx, %rdi
callq 0xe7e0