// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Mesh.cpp
// Function: gaps::R3Mesh::CreateIcosahedron(gaps::R3Sphere const&)
void R3Mesh::
CreateIcosahedron(const R3Sphere& sphere)
{
  // Create mesh elements for a sphere and add to mesh
  int saved_nvertices = NVertices();
  R3Point c = sphere.Centroid();
  RNLength r = sphere.Radius();
  
  // Create mesh elements for a icosahedron and add to mesh
  R3MeshVertex *v0 = CreateVertex(R3Point(0, -0.5257311, 0.8506508));
  R3MeshVertex *v1 = CreateVertex(R3Point(0, 0.5257311, 0.8506508));
  R3MeshVertex *v2 = CreateVertex(R3Point(0, -0.5257311, -0.8506508));
  R3MeshVertex *v3 = CreateVertex(R3Point(0, 0.5257311, -0.8506508));
  R3MeshVertex *v4 = CreateVertex(R3Point(0.8506508, 0, 0.5257311));
  R3MeshVertex *v5 = CreateVertex(R3Point(0.8506508, 0, -0.5257311));
  R3MeshVertex *v6 = CreateVertex(R3Point(-0.8506508, 0, 0.5257311));
  R3MeshVertex *v7 = CreateVertex(R3Point(-0.8506508, 0, -0.5257311));
  R3MeshVertex *v8 = CreateVertex(R3Point(0.5257311, 0.8506508, 0));
  R3MeshVertex *v9 = CreateVertex(R3Point(0.5257311, -0.8506508, 0));
  R3MeshVertex *v10 = CreateVertex(R3Point(-0.5257311, 0.8506508, 0));
  R3MeshVertex *v11 = CreateVertex(R3Point(-0.5257311, -0.8506508, 0));
  CreateFace(v0, v4, v1);
  CreateFace(v0, v9, v4);
  CreateFace(v9, v5, v4);
  CreateFace(v4, v5, v8);
  CreateFace(v4, v8, v1);
  CreateFace(v8, v10, v1);
  CreateFace(v8, v3, v10);
  CreateFace(v5, v3, v8);
  CreateFace(v5, v2, v3);
  CreateFace(v2, v7, v3);
  CreateFace(v7, v10, v3);
  CreateFace(v7, v6, v10);
  CreateFace(v7, v11, v6);
  CreateFace(v11, v0, v6);
  CreateFace(v0, v1, v6);
  CreateFace(v6, v1, v10);
  CreateFace(v9, v0, v11);
  CreateFace(v9, v11, v2);
  CreateFace(v9, v2, v5);
  CreateFace(v7, v2, v11);

  // Map vertices to sphere
  for (int i = saved_nvertices; i < NVertices(); i++) {
    R3MeshVertex *v = Vertex(i);
    R3Point p = VertexPosition(v);
    RNLength d = p.Vector().Length();
    if (RNIsPositive(d)) p = c+(r/d)*p;
    SetVertexPosition(v, p);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movslq 0x14(%rdi), %rbp
movq (%rsi), %rax
leaq 0x80(%rsp), %rdi
callq *0x68(%rax)
movsd 0x20(%r14), %xmm0
movsd %xmm0, 0x78(%rsp)
leaq 0x8(%rsp), %r14
movsd 0x77d94(%rip), %xmm1    # 0x93238
movsd 0x77d94(%rip), %xmm2    # 0x93240
xorps %xmm0, %xmm0
movq %r14, %rdi
callq 0x37b4c
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq *0x20(%rax)
movq %rax, %r15
leaq 0x8(%rsp), %r14
movsd 0x77d73(%rip), %xmm1    # 0x93248
xorps %xmm0, %xmm0
movq %r14, %rdi
movsd 0x77d5d(%rip), %xmm2    # 0x93240
callq 0x37b4c
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq *0x20(%rax)
movq %rax, 0x40(%rsp)
leaq 0x8(%rsp), %r14
movsd 0x77d48(%rip), %xmm2    # 0x93250
xorps %xmm0, %xmm0
movq %r14, %rdi
movsd 0x77d22(%rip), %xmm1    # 0x93238
callq 0x37b4c
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq *0x20(%rax)
movq %rax, 0x48(%rsp)
leaq 0x8(%rsp), %r14
xorps %xmm0, %xmm0
movq %r14, %rdi
movsd 0x77d07(%rip), %xmm1    # 0x93248
movsd 0x77d07(%rip), %xmm2    # 0x93250
callq 0x37b4c
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq *0x20(%rax)
movq %rax, 0x70(%rsp)
leaq 0x8(%rsp), %r14
xorps %xmm1, %xmm1
movq %r14, %rdi
movsd 0x77ccc(%rip), %xmm0    # 0x93240
movsd 0x77ccc(%rip), %xmm2    # 0x93248
callq 0x37b4c
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq *0x20(%rax)
movq %rax, %r12
leaq 0x8(%rsp), %r14
xorps %xmm1, %xmm1
movq %r14, %rdi
movsd 0x77c9b(%rip), %xmm0    # 0x93240
movsd 0x77c8b(%rip), %xmm2    # 0x93238
callq 0x37b4c
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq *0x20(%rax)
movq %rax, 0x30(%rsp)
leaq 0x8(%rsp), %r14
xorps %xmm1, %xmm1
movq %r14, %rdi
movsd 0x77c78(%rip), %xmm0    # 0x93250
movsd 0x77c68(%rip), %xmm2    # 0x93248
callq 0x37b4c
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq *0x20(%rax)
movq %rax, 0x68(%rsp)
leaq 0x8(%rsp), %r14
xorps %xmm1, %xmm1
movq %r14, %rdi
movsd 0x77c45(%rip), %xmm0    # 0x93250
movsd 0x77c25(%rip), %xmm2    # 0x93238
callq 0x37b4c
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq *0x20(%rax)
movq %rax, 0x38(%rsp)
leaq 0x8(%rsp), %r14
xorps %xmm2, %xmm2
movq %r14, %rdi
movsd 0x77c0a(%rip), %xmm0    # 0x93248
movsd 0x77bfa(%rip), %xmm1    # 0x93240
callq 0x37b4c
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq *0x20(%rax)
movq %rax, 0x50(%rsp)
leaq 0x8(%rsp), %r14
xorps %xmm2, %xmm2
movq %r14, %rdi
movsd 0x77bd7(%rip), %xmm0    # 0x93248
movsd 0x77bd7(%rip), %xmm1    # 0x93250
callq 0x37b4c
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq *0x20(%rax)
movq %rax, 0x28(%rsp)
leaq 0x8(%rsp), %r14
xorps %xmm2, %xmm2
movq %r14, %rdi
movsd 0x77b94(%rip), %xmm0    # 0x93238
movsd 0x77b94(%rip), %xmm1    # 0x93240
callq 0x37b4c
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq *0x20(%rax)
movq %rax, 0x20(%rsp)
leaq 0x8(%rsp), %r13
xorps %xmm2, %xmm2
movq %r13, %rdi
movsd 0x77b61(%rip), %xmm0    # 0x93238
movsd 0x77b71(%rip), %xmm1    # 0x93250
callq 0x37b4c
movq (%rbx), %rax
movq %rbx, %rdi
movq %r13, %rsi
xorl %edx, %edx
callq *0x20(%rax)
movq %rax, 0x60(%rsp)
movq (%rbx), %rax
movq %rbx, %rdi
movq %r15, 0x58(%rsp)
movq %r15, %rsi
movq %r12, %rdx
movq 0x40(%rsp), %rcx
movq %rcx, %r13
xorl %r8d, %r8d
callq *0x48(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
movq %r15, %rsi
movq 0x28(%rsp), %r14
movq %r14, %rdx
movq %r12, %rcx
xorl %r8d, %r8d
callq *0x48(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
movq 0x30(%rsp), %r15
movq %r15, %rdx
movq %r12, %rcx
xorl %r8d, %r8d
callq *0x48(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
movq %r12, %rsi
movq %r12, %r14
movq %r15, %rdx
movq 0x50(%rsp), %r12
movq %r12, %rcx
xorl %r8d, %r8d
callq *0x48(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
movq %r13, %r14
movq %r13, %rcx
xorl %r8d, %r8d
callq *0x48(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
movq %r12, %rsi
movq 0x20(%rsp), %r13
movq %r13, %rdx
movq %r14, %rcx
xorl %r8d, %r8d
callq *0x48(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
movq %r12, %rsi
movq 0x70(%rsp), %r14
movq %r14, %rdx
movq %r13, %rcx
xorl %r8d, %r8d
callq *0x48(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %r12, %rcx
xorl %r8d, %r8d
callq *0x48(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
movq %r15, %rsi
movq 0x48(%rsp), %r15
movq %r15, %rdx
movq %r14, %rcx
xorl %r8d, %r8d
callq *0x48(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
movq %r15, %rsi
movq 0x38(%rsp), %r15
movq %r15, %rdx
movq %r14, %rcx
xorl %r8d, %r8d
callq *0x48(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
movq %r15, %rsi
movq %r13, %rdx
movq %r14, %rcx
xorl %r8d, %r8d
callq *0x48(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
movq %r15, %rsi
movq 0x68(%rsp), %r14
movq %r14, %rdx
movq %r13, %rcx
xorl %r8d, %r8d
callq *0x48(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
movq %r15, %rsi
movq 0x60(%rsp), %r15
movq %r15, %rdx
movq %r14, %rcx
xorl %r8d, %r8d
callq *0x48(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
movq %r15, %rsi
movq %r15, %r12
movq 0x58(%rsp), %r15
movq %r15, %rdx
movq %r14, %rcx
xorl %r8d, %r8d
callq *0x48(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
movq %r15, %rsi
movq 0x40(%rsp), %r13
movq %r13, %rdx
movq %r14, %rcx
xorl %r8d, %r8d
callq *0x48(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
movq %r13, %rdx
movq 0x20(%rsp), %rcx
xorl %r8d, %r8d
callq *0x48(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
movq 0x28(%rsp), %r13
movq %r13, %rsi
movq %r15, %rdx
movq %r12, %rcx
xorl %r8d, %r8d
callq *0x48(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq 0x48(%rsp), %r15
movq %r15, %rcx
xorl %r8d, %r8d
callq *0x48(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
movq %r13, %rsi
movq %r15, %rdx
movq 0x30(%rsp), %rcx
xorl %r8d, %r8d
callq *0x48(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
movq 0x38(%rsp), %rsi
movq %r15, %rdx
movq %r12, %rcx
leaq 0x8(%rsp), %r15
xorl %r8d, %r8d
callq *0x48(%rax)
leaq 0xb0(%rsp), %r14
leaq 0x98(%rsp), %r12
movslq 0x14(%rbx), %rax
cmpq %rax, %rbp
jge 0x1b998
movq 0x8(%rbx), %rax
movq (%rax,%rbp,8), %r13
leaq 0x18(%r13), %rsi
movq %r15, %rdi
callq 0x37b5c
movq %r14, %rdi
movq %r15, %rsi
callq 0x212f8
movq %r14, %rdi
callq 0x38412
leaq 0xbf263(%rip), %rax     # 0xdaba8
ucomisd (%rax), %xmm0
jbe 0x1b982
movsd 0x78(%rsp), %xmm1
divsd %xmm0, %xmm1
movq %r12, %rdi
movq %r15, %rsi
movapd %xmm1, %xmm0
callq 0x382c0
movq %r14, %rdi
leaq 0x80(%rsp), %rsi
movq %r12, %rdx
callq 0x3827a
movq %r15, %rdi
movq %r14, %rsi
callq 0x37e36
movq %rbx, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0x12ccc
incq %rbp
jmp 0x1b90a
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq