// File: tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Triangle.cpp
// Function: gaps::R3Triangle::operator=(gaps::R3Triangle const&)
R3Triangle& R3Triangle::
operator=(const R3Triangle& triangle)
{
    // Delete prevous vertices
    if (v[0] && !v[0]->Flags()[R3_VERTEX_SHARED_FLAG]) delete v[0];
    if (v[1] && !v[1]->Flags()[R3_VERTEX_SHARED_FLAG]) delete v[1];
    if (v[2] && !v[2]->Flags()[R3_VERTEX_SHARED_FLAG]) delete v[2];
  
    // Copy properties
    plane = triangle.plane;
    bbox = triangle.bbox;
    flags = triangle.flags;
    mark = 0;

    // Copy vertices 
    if (!triangle.v[0] || triangle.v[0]->Flags()[R3_VERTEX_SHARED_FLAG]) v[0] = triangle.v[0];
    else v[0] = new R3TriangleVertex(*(triangle.v[0]));
    if (!triangle.v[1] || triangle.v[1]->Flags()[R3_VERTEX_SHARED_FLAG]) v[1] = triangle.v[1];
    else v[1] = new R3TriangleVertex(*(triangle.v[1]));
    if (!triangle.v[2] || triangle.v[2]->Flags()[R3_VERTEX_SHARED_FLAG]) v[2] = triangle.v[2];
    else v[2] = new R3TriangleVertex(*(triangle.v[2]));

    // Update the triangle
    Update();

    // Return this
    return *this;
}

// Assembly:
subq $0xe8, %rsp
movq %rdi, 0xe0(%rsp)
movq %rsi, 0xd8(%rsp)
movq 0xe0(%rsp), %rcx
movq %rcx, 0x58(%rsp)
xorl %eax, %eax
cmpq $0x0, 0x8(%rcx)
movb %al, 0x67(%rsp)
je 0x9c25a
movq 0x58(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x9a5a0
movq %rax, 0xd0(%rsp)
leaq 0xc8(%rsp), %rdi
movl $0x10000, %esi          # imm = 0x10000
callq 0x13d80
movq 0xc8(%rsp), %rsi
leaq 0xd0(%rsp), %rdi
callq 0x13d50
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
movb %al, 0x67(%rsp)
movb 0x67(%rsp), %al
testb $0x1, %al
jne 0x9c264
jmp 0x9c289
movq 0x58(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x50(%rsp)
cmpq $0x0, %rax
je 0x9c287
movq 0x50(%rsp), %rdi
movl $0x68, %esi
callq 0xf4d0
jmp 0x9c289
movq 0x58(%rsp), %rcx
xorl %eax, %eax
cmpq $0x0, 0x10(%rcx)
movb %al, 0x4f(%rsp)
je 0x9c2e4
movq 0x58(%rsp), %rax
movq 0x10(%rax), %rdi
callq 0x9a5a0
movq %rax, 0xc0(%rsp)
leaq 0xb8(%rsp), %rdi
movl $0x10000, %esi          # imm = 0x10000
callq 0x13d80
movq 0xb8(%rsp), %rsi
leaq 0xc0(%rsp), %rdi
callq 0x13d50
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
movb %al, 0x4f(%rsp)
movb 0x4f(%rsp), %al
testb $0x1, %al
jne 0x9c2ee
jmp 0x9c313
movq 0x58(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x40(%rsp)
cmpq $0x0, %rax
je 0x9c311
movq 0x40(%rsp), %rdi
movl $0x68, %esi
callq 0xf4d0
jmp 0x9c313
movq 0x58(%rsp), %rcx
xorl %eax, %eax
cmpq $0x0, 0x18(%rcx)
movb %al, 0x3f(%rsp)
je 0x9c36e
movq 0x58(%rsp), %rax
movq 0x18(%rax), %rdi
callq 0x9a5a0
movq %rax, 0xb0(%rsp)
leaq 0xa8(%rsp), %rdi
movl $0x10000, %esi          # imm = 0x10000
callq 0x13d80
movq 0xa8(%rsp), %rsi
leaq 0xb0(%rsp), %rdi
callq 0x13d50
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
movb %al, 0x3f(%rsp)
movb 0x3f(%rsp), %al
testb $0x1, %al
jne 0x9c378
jmp 0x9c39d
movq 0x58(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x30(%rsp)
cmpq $0x0, %rax
je 0x9c39b
movq 0x30(%rsp), %rdi
movl $0x68, %esi
callq 0xf4d0
jmp 0x9c39d
movq 0x58(%rsp), %rdi
movq 0xd8(%rsp), %rsi
addq $0x20, %rsi
addq $0x20, %rdi
callq 0x3a4d0
movq 0x58(%rsp), %rdi
movq 0xd8(%rsp), %rsi
addq $0x40, %rsi
addq $0x40, %rdi
callq 0x37500
movq 0x58(%rsp), %rax
movq 0xd8(%rsp), %rcx
movq 0x78(%rcx), %rcx
movq %rcx, 0x78(%rax)
movl $0x0, 0x80(%rax)
movq 0xd8(%rsp), %rcx
movb $0x1, %al
cmpq $0x0, 0x8(%rcx)
movb %al, 0x2f(%rsp)
je 0x9c44f
movq 0xd8(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x9a5a0
movq %rax, 0xa0(%rsp)
leaq 0x98(%rsp), %rdi
movl $0x10000, %esi          # imm = 0x10000
callq 0x13d80
movq 0x98(%rsp), %rsi
leaq 0xa0(%rsp), %rdi
callq 0x13d50
cmpl $0x0, %eax
setne %al
movb %al, 0x2f(%rsp)
movb 0x2f(%rsp), %al
testb $0x1, %al
jne 0x9c459
jmp 0x9c470
movq 0x58(%rsp), %rax
movq 0xd8(%rsp), %rcx
movq 0x8(%rcx), %rcx
movq %rcx, 0x8(%rax)
jmp 0x9c4d0
movl $0x68, %edi
callq 0xf4c0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0x20(%rsp)
movq 0xd8(%rsp), %rax
movq 0x8(%rax), %rsi
callq 0x9a850
jmp 0x9c498
movq 0x58(%rsp), %rax
movq 0x20(%rsp), %rcx
movq %rcx, 0x8(%rax)
jmp 0x9c4d0
movq 0x20(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x90(%rsp)
movl %eax, 0x8c(%rsp)
movl $0x68, %esi
callq 0xf4d0
jmp 0x9c693
movq 0xd8(%rsp), %rcx
movb $0x1, %al
cmpq $0x0, 0x10(%rcx)
movb %al, 0x1f(%rsp)
je 0x9c529
movq 0xd8(%rsp), %rax
movq 0x10(%rax), %rdi
callq 0x9a5a0
movq %rax, 0x80(%rsp)
leaq 0x78(%rsp), %rdi
movl $0x10000, %esi          # imm = 0x10000
callq 0x13d80
movq 0x78(%rsp), %rsi
leaq 0x80(%rsp), %rdi
callq 0x13d50
cmpl $0x0, %eax
setne %al
movb %al, 0x1f(%rsp)
movb 0x1f(%rsp), %al
testb $0x1, %al
jne 0x9c533
jmp 0x9c54a
movq 0x58(%rsp), %rax
movq 0xd8(%rsp), %rcx
movq 0x10(%rcx), %rcx
movq %rcx, 0x10(%rax)
jmp 0x9c5aa
movl $0x68, %edi
callq 0xf4c0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0x10(%rsp)
movq 0xd8(%rsp), %rax
movq 0x10(%rax), %rsi
callq 0x9a850
jmp 0x9c572
movq 0x58(%rsp), %rax
movq 0x10(%rsp), %rcx
movq %rcx, 0x10(%rax)
jmp 0x9c5aa
movq 0x10(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x90(%rsp)
movl %eax, 0x8c(%rsp)
movl $0x68, %esi
callq 0xf4d0
jmp 0x9c693
movq 0xd8(%rsp), %rcx
movb $0x1, %al
cmpq $0x0, 0x18(%rcx)
movb %al, 0xf(%rsp)
je 0x9c5fd
movq 0xd8(%rsp), %rax
movq 0x18(%rax), %rdi
callq 0x9a5a0
movq %rax, 0x70(%rsp)
leaq 0x68(%rsp), %rdi
movl $0x10000, %esi          # imm = 0x10000
callq 0x13d80
movq 0x68(%rsp), %rsi
leaq 0x70(%rsp), %rdi
callq 0x13d50
cmpl $0x0, %eax
setne %al
movb %al, 0xf(%rsp)
movb 0xf(%rsp), %al
testb $0x1, %al
jne 0x9c607
jmp 0x9c61e
movq 0x58(%rsp), %rax
movq 0xd8(%rsp), %rcx
movq 0x18(%rcx), %rcx
movq %rcx, 0x18(%rax)
jmp 0x9c678
movl $0x68, %edi
callq 0xf4c0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, (%rsp)
movq 0xd8(%rsp), %rax
movq 0x18(%rax), %rsi
callq 0x9a850
jmp 0x9c645
movq 0x58(%rsp), %rax
movq (%rsp), %rcx
movq %rcx, 0x18(%rax)
jmp 0x9c678
movq (%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x90(%rsp)
movl %eax, 0x8c(%rsp)
movl $0x68, %esi
callq 0xf4d0
jmp 0x9c693
movq 0x58(%rsp), %rdi
movq (%rdi), %rax
callq *0x250(%rax)
movq 0x58(%rsp), %rax
addq $0xe8, %rsp
retq
movq 0x90(%rsp), %rdi
callq 0xf890