// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3TriangleArray.cpp
// Function: gaps::R3TriangleArray::R3TriangleArray(gaps::R3TriangleArray const&)
R3TriangleArray::
R3TriangleArray(const R3TriangleArray& array)
  : vertices(),
    triangles(),
    bbox(array.bbox),
    flags(array.flags),
    vbo_id(0),
    vbo_size(0)
{
    // 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);
    }

    // Update everything
    Update();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r15
movq %rdi, %rbx
callq 0x54600
leaq 0x918d2(%rip), %rax     # 0xe3208
movq %rax, (%rbx)
leaq 0x8(%rbx), %r14
movq %r14, %rdi
movq %rbx, 0x10(%rsp)
callq 0x6f80c
leaq 0x18(%rbx), %rdi
movq %rdi, 0x20(%rsp)
callq 0x6f80c
leaq 0x28(%rbx), %r13
leaq 0x28(%r15), %rsi
movq %r13, %rdi
callq 0x272d4
movq 0x60(%r15), %rax
movq %rax, 0x60(%rbx)
movq $0x0, 0x68(%rbx)
cmpl $0x0, 0x14(%r15)
jle 0x519c9
xorl %ebx, %ebx
movq 0x8(%r15), %rax
movq (%rax,%rbx,8), %rbp
movl $0x68, %edi
callq 0xe440
movq %rax, %r12
movq %rax, %rdi
movq %rbp, %rsi
callq 0x53452
movq 0x10(%rsp), %rax
movl 0x14(%rax), %edx
movq %r14, %rdi
movq %r12, %rsi
callq 0x6f8a2
orb $0x1, 0x5a(%r12)
movl %ebx, 0x60(%rbp)
incq %rbx
movslq 0x14(%r15), %rax
cmpq %rax, %rbx
jl 0x51981
movq %r13, 0x18(%rsp)
cmpl $0x0, 0x24(%r15)
jle 0x51a59
xorl %ebx, %ebx
movq %r14, 0x8(%rsp)
movq %r15, %r13
movq 0x18(%r15), %rax
movq (%rax,%rbx,8), %rax
movq 0x8(%rax), %rcx
movq 0x10(%rax), %rdx
movslq 0x60(%rcx), %rcx
movq (%r14), %rsi
movq (%rsi,%rcx,8), %rbp
movslq 0x60(%rdx), %rcx
movq (%rsi,%rcx,8), %r15
movq 0x18(%rax), %rax
movslq 0x60(%rax), %rax
movq (%rsi,%rax,8), %r14
movl $0x88, %edi
callq 0xe440
movq %rax, %r12
movq %rax, %rdi
movq %rbp, %rsi
movq %r15, %rdx
movq %r14, %rcx
callq 0x539b8
movq 0x10(%rsp), %rax
movl 0x24(%rax), %edx
movq 0x20(%rsp), %rdi
movq %r12, %rsi
callq 0x6f8a2
incq %rbx
movslq 0x24(%r13), %rax
cmpq %rax, %rbx
movq 0x8(%rsp), %r14
movq %r13, %r15
jl 0x519e0
movq 0x10(%rsp), %rdi
movq (%rdi), %rax
callq *0x248(%rax)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, 0x8(%rsp)
jmp 0x51abf
movq %r14, 0x8(%rsp)
movq %rax, %rbx
jmp 0x51ad9
movq %r14, 0x8(%rsp)
movq %rax, %rbx
jmp 0x51ae3
movq %rax, %rbx
jmp 0x51aed
movq %rax, %rbx
movl $0x88, %esi
movq %r12, %rdi
callq 0xe450
jmp 0x51ac2
movq %r14, 0x8(%rsp)
movq %rax, %rbx
movl $0x68, %esi
movq %r12, %rdi
callq 0xe450
jmp 0x51ad1
movq %rax, %rbx
movq 0x18(%rsp), %r13
jmp 0x51ad1
movq %r14, 0x8(%rsp)
movq %rax, %rbx
movq %r13, %rdi
callq 0x280f4
movq 0x20(%rsp), %rdi
callq 0x6f876
movq 0x8(%rsp), %rdi
callq 0x6f876
movq 0x10(%rsp), %rdi
callq 0x5460c
movq %rbx, %rdi
callq 0xe7e0
nop