// File: /workspace/github_cpp_makefile_star2_O3/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 $0xb8, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movslq 0x14(%rdi), %r13
movq (%rsi), %rax
leaq 0x70(%rsp), %rdi
callq *0x68(%rax)
movsd 0x20(%r14), %xmm0
movsd %xmm0, 0x68(%rsp)
movq %rsp, %r14
movsd 0x84b33(%rip), %xmm1    # 0xa2238
movsd 0x84b33(%rip), %xmm2    # 0xa2240
xorps %xmm0, %xmm0
movq %r14, %rdi
callq 0x3c532
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq *0x20(%rax)
movq %rax, 0x40(%rsp)
movq %rsp, %r14
movsd 0x84b12(%rip), %xmm1    # 0xa2248
xorps %xmm0, %xmm0
movq %r14, %rdi
movsd 0x84afc(%rip), %xmm2    # 0xa2240
callq 0x3c532
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq *0x20(%rax)
movq %rax, 0x38(%rsp)
movq %rsp, %r14
movsd 0x84ae9(%rip), %xmm2    # 0xa2250
xorps %xmm0, %xmm0
movq %r14, %rdi
movsd 0x84ac3(%rip), %xmm1    # 0xa2238
callq 0x3c532
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq *0x20(%rax)
movq %rax, 0x48(%rsp)
movq %rsp, %r14
xorps %xmm0, %xmm0
movq %r14, %rdi
movsd 0x84aaa(%rip), %xmm1    # 0xa2248
movsd 0x84aaa(%rip), %xmm2    # 0xa2250
callq 0x3c532
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq *0x20(%rax)
movq %rax, 0x60(%rsp)
movq %rsp, %r14
xorps %xmm1, %xmm1
movq %r14, %rdi
movsd 0x84a71(%rip), %xmm0    # 0xa2240
movsd 0x84a71(%rip), %xmm2    # 0xa2248
callq 0x3c532
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq *0x20(%rax)
movq %rax, %rbp
movq %rsp, %r14
xorps %xmm1, %xmm1
movq %r14, %rdi
movsd 0x84a42(%rip), %xmm0    # 0xa2240
movsd 0x84a32(%rip), %xmm2    # 0xa2238
callq 0x3c532
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq *0x20(%rax)
movq %rax, 0x20(%rsp)
movq %rsp, %r14
xorps %xmm1, %xmm1
movq %r14, %rdi
movsd 0x84a21(%rip), %xmm0    # 0xa2250
movsd 0x84a11(%rip), %xmm2    # 0xa2248
callq 0x3c532
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq *0x20(%rax)
movq %rax, 0x58(%rsp)
movq %rsp, %r14
xorps %xmm1, %xmm1
movq %r14, %rdi
movsd 0x849f0(%rip), %xmm0    # 0xa2250
movsd 0x849d0(%rip), %xmm2    # 0xa2238
callq 0x3c532
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq *0x20(%rax)
movq %rax, 0x30(%rsp)
movq %rsp, %r14
xorps %xmm2, %xmm2
movq %r14, %rdi
movsd 0x849b7(%rip), %xmm0    # 0xa2248
movsd 0x849a7(%rip), %xmm1    # 0xa2240
callq 0x3c532
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq *0x20(%rax)
movq %rax, %r15
movq %rsp, %r14
xorps %xmm2, %xmm2
movq %r14, %rdi
movsd 0x84988(%rip), %xmm0    # 0xa2248
movsd 0x84988(%rip), %xmm1    # 0xa2250
callq 0x3c532
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq *0x20(%rax)
movq %rax, 0x28(%rsp)
movq %rsp, %r14
xorps %xmm2, %xmm2
movq %r14, %rdi
movsd 0x84947(%rip), %xmm0    # 0xa2238
movsd 0x84947(%rip), %xmm1    # 0xa2240
callq 0x3c532
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq *0x20(%rax)
movq %rax, 0x18(%rsp)
movq %rsp, %r12
xorps %xmm2, %xmm2
movq %r12, %rdi
movsd 0x84916(%rip), %xmm0    # 0xa2238
movsd 0x84926(%rip), %xmm1    # 0xa2250
callq 0x3c532
movq (%rbx), %rax
movq %rbx, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq *0x20(%rax)
movq %rax, 0x50(%rsp)
movq (%rbx), %rax
movq %rbx, %rdi
movq 0x40(%rsp), %r12
movq %r12, %rsi
movq %rbp, %rdx
movq 0x38(%rsp), %r14
movq %r14, %rcx
xorl %r8d, %r8d
callq *0x48(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
movq %r12, %rsi
movq 0x28(%rsp), %r12
movq %r12, %rdx
movq %rbp, %rcx
xorl %r8d, %r8d
callq *0x48(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
movq %r12, %rsi
movq 0x20(%rsp), %r12
movq %r12, %rdx
movq %rbp, %rcx
xorl %r8d, %r8d
callq *0x48(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
movq %rbp, %rsi
movq %r12, %rdx
movq %r15, %r12
movq %r15, %rcx
xorl %r8d, %r8d
callq *0x48(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
movq %rbp, %rsi
movq %r15, %rdx
movq %r14, %r15
movq %r14, %rcx
xorl %r8d, %r8d
callq *0x48(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
movq %r12, %rsi
movq 0x18(%rsp), %r14
movq %r14, %rdx
movq %r15, %rcx
xorl %r8d, %r8d
callq *0x48(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
movq %r12, %rsi
movq 0x60(%rsp), %rbp
movq %rbp, %rdx
movq %r14, %rcx
xorl %r8d, %r8d
callq *0x48(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
movq 0x20(%rsp), %r15
movq %r15, %rsi
movq %rbp, %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 %rbp, %rcx
xorl %r8d, %r8d
callq *0x48(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
movq %r15, %rsi
movq 0x30(%rsp), %r15
movq %r15, %rdx
movq %rbp, %rcx
xorl %r8d, %r8d
callq *0x48(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
movq %r15, %rsi
movq 0x18(%rsp), %r12
movq %r12, %rdx
movq %rbp, %rcx
xorl %r8d, %r8d
callq *0x48(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
movq %r15, %rsi
movq 0x58(%rsp), %r14
movq %r14, %rdx
movq %r12, %rcx
xorl %r8d, %r8d
callq *0x48(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
movq %r15, %rsi
movq 0x50(%rsp), %rbp
movq %rbp, %rdx
movq %r14, %rcx
xorl %r8d, %r8d
callq *0x48(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
movq %rbp, %rsi
movq 0x40(%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), %r12
movq %r12, %rdx
movq %r14, %rcx
xorl %r8d, %r8d
callq *0x48(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
movq 0x18(%rsp), %rcx
xorl %r8d, %r8d
callq *0x48(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
movq 0x28(%rsp), %r12
movq %r12, %rsi
movq %r15, %rdx
movq %rbp, %rcx
xorl %r8d, %r8d
callq *0x48(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
movq %r12, %rsi
movq %rbp, %rdx
movq 0x48(%rsp), %r15
movq %r15, %rcx
xorl %r8d, %r8d
callq *0x48(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
movq 0x20(%rsp), %rcx
xorl %r8d, %r8d
callq *0x48(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
movq 0x30(%rsp), %rsi
movq %r15, %rdx
movq %rbp, %rcx
xorl %r8d, %r8d
callq *0x48(%rax)
cmpl 0x14(%rbx), %r13d
jge 0x1dbf3
movq %rsp, %r14
leaq 0xa0(%rsp), %r15
leaq 0x88(%rsp), %r12
movq 0x8(%rbx), %rax
movq (%rax,%r13,8), %rbp
leaq 0x18(%rbp), %rsi
movq %r14, %rdi
callq 0x3c542
movsd (%rsp), %xmm0
movsd 0x8(%rsp), %xmm1
movsd 0x10(%rsp), %xmm2
movq %r15, %rdi
callq 0x3cfc6
movq %r15, %rdi
callq 0x3d0cc
leaq 0xc7ffd(%rip), %rax     # 0xe5b98
ucomisd (%rax), %xmm0
jbe 0x1dbd5
movsd 0x68(%rsp), %xmm1
divsd %xmm0, %xmm1
movq %r12, %rdi
movq %r14, %rsi
movapd %xmm1, %xmm0
callq 0x3cf76
movq %r15, %rdi
leaq 0x70(%rsp), %rsi
movq %r12, %rdx
callq 0x3cf30
movq %r14, %rdi
movq %r15, %rsi
callq 0x3c89a
movq %rbx, %rdi
movq %rbp, %rsi
movq %r14, %rdx
callq 0x13858
incq %r13
movslq 0x14(%rbx), %rax
cmpq %rax, %r13
jl 0x1db5f
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop