// File: /workspace/github_cpp_makefile_star2_O3/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
movl 0x24(%rdi), %eax
testl %eax, %eax
jle 0x51fe3
xorl %r14d, %r14d
movq (%r12), %rcx
movq (%rcx,%r14,8), %rdi
testq %rdi, %rdi
je 0x51fd8
movq (%rdi), %rax
callq *0x8(%rax)
movl 0x24(%rbx), %eax
incq %r14
movslq %eax, %rcx
cmpq %rcx, %r14
jl 0x51fc2
leaq 0x8(%rbx), %rax
movq %rax, (%rsp)
cmpl $0x0, 0x14(%rbx)
jle 0x52012
xorl %r14d, %r14d
movq 0x8(%rbx), %rax
movq (%rax,%r14,8), %rdi
movl $0x68, %esi
callq 0xe450
incq %r14
movslq 0x14(%rbx), %rax
cmpq %rax, %r14
jl 0x51ff4
movq %r12, %rdi
xorl %esi, %esi
callq 0x6fa6c
movq (%rsp), %rdi
xorl %esi, %esi
callq 0x6fa6c
cmpl $0x0, 0x14(%r15)
jle 0x52075
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 0x53452
movl 0x14(%rbx), %edx
movq (%rsp), %rdi
movq %r13, %rsi
callq 0x6f8a2
orb $0x1, 0x5a(%r13)
movl %r14d, 0x60(%rbp)
incq %r14
movslq 0x14(%r15), %rax
cmpq %rax, %r14
jl 0x52031
cmpl $0x0, 0x24(%r15)
jle 0x520f8
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 0x539b8
movl 0x24(%rbx), %edx
movq %r12, %rdi
movq %r13, %rsi
callq 0x6f8a2
incq %r14
movslq 0x24(%r15), %rax
cmpq %rax, %r14
jl 0x5207f
leaq 0x30(%rbx), %rdi
leaq 0x30(%r15), %rsi
callq 0x3c89a
leaq 0x48(%rbx), %rdi
addq $0x48, %r15
movq %r15, %rsi
callq 0x3c89a
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 0x52145
movq %rax, %rbx
movl $0x68, %esi
movq %r13, %rdi
callq 0xe450
movq %rbx, %rdi
callq 0xe7e0
nop