// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_teapot.c
// Function: fghTeapot
static void fghTeapot( GLint grid, GLdouble scale, GLenum type )
{
#if defined(_WIN32_WCE)
		int i, numV=sizeof(strip_vertices)/4, numI=sizeof(strip_normals)/4;
#else
    double p[4][4][3], q[4][4][3], r[4][4][3], s[4][4][3];
    long i, j, k, l;
#endif

    glPushAttrib( GL_ENABLE_BIT | GL_EVAL_BIT );
    glEnable( GL_AUTO_NORMAL );
    glEnable( GL_NORMALIZE );
    glEnable( GL_MAP2_VERTEX_3 );
    glEnable( GL_MAP2_TEXTURE_COORD_2 );

    glPushMatrix();
    glRotated( 270.0, 1.0, 0.0, 0.0 );
    glScaled( 0.5 * scale, 0.5 * scale, 0.5 * scale );
    glTranslated( 0.0, 0.0, -1.5 );

#if defined(_WIN32_WCE)
    glRotated( 90.0, 1.0, 0.0, 0.0 );
    glBegin( GL_TRIANGLE_STRIP );

    for( i = 0; i < numV-1; i++ )
    {
        int vidx = strip_vertices[i],
            nidx = strip_normals[i];

        if( vidx != -1 )
        {
            glNormal3fv( normals[nidx]  );
            glVertex3fv( vertices[vidx] );
        }
        else
        {
            glEnd();
            glBegin( GL_TRIANGLE_STRIP );
        }
    }

    glEnd();
#else
    for (i = 0; i < 10; i++) {
      for (j = 0; j < 4; j++) {
        for (k = 0; k < 4; k++) {
          for (l = 0; l < 3; l++) {
            p[j][k][l] = cpdata[patchdata[i][j * 4 + k]][l];
            q[j][k][l] = cpdata[patchdata[i][j * 4 + (3 - k)]][l];
            if (l == 1)
              q[j][k][l] *= -1.0;
            if (i < 6) {
              r[j][k][l] =
                cpdata[patchdata[i][j * 4 + (3 - k)]][l];
              if (l == 0)
                r[j][k][l] *= -1.0;
              s[j][k][l] = cpdata[patchdata[i][j * 4 + k]][l];
              if (l == 0)
                s[j][k][l] *= -1.0;
              if (l == 1)
                s[j][k][l] *= -1.0;
            }
          }
        }
      }

      glMap2d(GL_MAP2_TEXTURE_COORD_2, 0.0, 1.0, 2, 2, 0.0, 1.0, 4, 2,
        &tex[0][0][0]);
      glMap2d(GL_MAP2_VERTEX_3, 0.0, 1.0, 3, 4, 0.0, 1.0, 12, 4,
        &p[0][0][0]);
      glMapGrid2d(grid, 0.0, 1.0, grid, 0.0, 1.0);
      glEvalMesh2(type, 0, grid, 0, grid);
      glMap2d(GL_MAP2_VERTEX_3, 0.0, 1.0, 3, 4, 0.0, 1.0, 12, 4,
        &q[0][0][0]);
      glEvalMesh2(type, 0, grid, 0, grid);
      if (i < 6) {
        glMap2d(GL_MAP2_VERTEX_3, 0.0, 1.0, 3, 4, 0.0, 1.0, 12, 4,
          &r[0][0][0]);
        glEvalMesh2(type, 0, grid, 0, grid);
        glMap2d(GL_MAP2_VERTEX_3, 0.0, 1.0, 3, 4, 0.0, 1.0, 12, 4,
          &s[0][0][0]);
        glEvalMesh2(type, 0, grid, 0, grid);
      }
    }
#endif  /* defined(_WIN32_WCE) */

    glPopMatrix();
    glPopAttrib();
}

// Assembly:
subq $0x638, %rsp            # imm = 0x638
movl %edi, 0x634(%rsp)
movsd %xmm0, 0x628(%rsp)
movl %esi, 0x624(%rsp)
movl $0x12000, %edi          # imm = 0x12000
callq 0x22f00
movl $0xd80, %edi            # imm = 0xD80
callq 0x22910
movl $0xba1, %edi            # imm = 0xBA1
callq 0x22910
movl $0xdb7, %edi            # imm = 0xDB7
callq 0x22910
movl $0xdb4, %edi            # imm = 0xDB4
callq 0x22910
callq 0x23110
movsd 0x227a3(%rip), %xmm0    # 0x1af6b0
movsd 0x10fb(%rip), %xmm1     # 0x18e010
xorps %xmm3, %xmm3
movaps %xmm3, %xmm2
callq 0x22d30
movsd 0x10f8(%rip), %xmm0     # 0x18e020
mulsd 0x628(%rsp), %xmm0
movsd 0x10e7(%rip), %xmm1     # 0x18e020
mulsd 0x628(%rsp), %xmm1
movsd 0x10d6(%rip), %xmm2     # 0x18e020
mulsd 0x628(%rsp), %xmm2
callq 0x22a90
xorps %xmm1, %xmm1
movsd 0x22745(%rip), %xmm2    # 0x1af6a8
movaps %xmm1, %xmm0
callq 0x22aa0
movq $0x0, 0x18(%rsp)
cmpq $0xa, 0x18(%rsp)
jge 0x18d430
movq $0x0, 0x10(%rsp)
cmpq $0x4, 0x10(%rsp)
jge 0x18d267
movq $0x0, 0x8(%rsp)
cmpq $0x4, 0x8(%rsp)
jge 0x18d252
movq $0x0, (%rsp)
cmpq $0x3, (%rsp)
jge 0x18d23d
movq 0x18(%rsp), %rcx
leaq 0x6e7c7(%rip), %rax     # 0x1fb790
shlq $0x6, %rcx
addq %rcx, %rax
movq 0x10(%rsp), %rcx
shlq $0x2, %rcx
addq 0x8(%rsp), %rcx
movslq (%rax,%rcx,4), %rcx
leaq 0x6dbb7(%rip), %rax     # 0x1faba0
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
leaq 0x4a0(%rsp), %rax
imulq $0x60, 0x10(%rsp), %rcx
addq %rcx, %rax
imulq $0x18, 0x8(%rsp), %rcx
addq %rcx, %rax
movq (%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq 0x18(%rsp), %rcx
leaq 0x6e768(%rip), %rax     # 0x1fb790
shlq $0x6, %rcx
addq %rcx, %rax
movq 0x10(%rsp), %rcx
shlq $0x2, %rcx
movl $0x3, %edx
subq 0x8(%rsp), %rdx
addq %rdx, %rcx
movslq (%rax,%rcx,4), %rcx
leaq 0x6db50(%rip), %rax     # 0x1faba0
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
leaq 0x320(%rsp), %rax
imulq $0x60, 0x10(%rsp), %rcx
addq %rcx, %rax
imulq $0x18, 0x8(%rsp), %rcx
addq %rcx, %rax
movq (%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
cmpq $0x1, (%rsp)
jne 0x18d0ba
leaq 0x320(%rsp), %rax
imulq $0x60, 0x10(%rsp), %rcx
addq %rcx, %rax
imulq $0x18, 0x8(%rsp), %rcx
addq %rcx, %rax
movq (%rsp), %rcx
movsd 0x1500(%rip), %xmm0     # 0x18e5b0
mulsd (%rax,%rcx,8), %xmm0
movsd %xmm0, (%rax,%rcx,8)
cmpq $0x6, 0x18(%rsp)
jge 0x18d22a
movq 0x18(%rsp), %rcx
leaq 0x6e6be(%rip), %rax     # 0x1fb790
shlq $0x6, %rcx
addq %rcx, %rax
movq 0x10(%rsp), %rcx
shlq $0x2, %rcx
movl $0x3, %edx
subq 0x8(%rsp), %rdx
addq %rdx, %rcx
movslq (%rax,%rcx,4), %rcx
leaq 0x6daa6(%rip), %rax     # 0x1faba0
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
leaq 0x1a0(%rsp), %rax
imulq $0x60, 0x10(%rsp), %rcx
addq %rcx, %rax
imulq $0x18, 0x8(%rsp), %rcx
addq %rcx, %rax
movq (%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
cmpq $0x0, (%rsp)
jne 0x18d164
leaq 0x1a0(%rsp), %rax
imulq $0x60, 0x10(%rsp), %rcx
addq %rcx, %rax
imulq $0x18, 0x8(%rsp), %rcx
addq %rcx, %rax
movq (%rsp), %rcx
movsd 0x1456(%rip), %xmm0     # 0x18e5b0
mulsd (%rax,%rcx,8), %xmm0
movsd %xmm0, (%rax,%rcx,8)
movq 0x18(%rsp), %rcx
leaq 0x6e620(%rip), %rax     # 0x1fb790
shlq $0x6, %rcx
addq %rcx, %rax
movq 0x10(%rsp), %rcx
shlq $0x2, %rcx
addq 0x8(%rsp), %rcx
movslq (%rax,%rcx,4), %rcx
leaq 0x6da10(%rip), %rax     # 0x1faba0
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
leaq 0x20(%rsp), %rax
imulq $0x60, 0x10(%rsp), %rcx
addq %rcx, %rax
imulq $0x18, 0x8(%rsp), %rcx
addq %rcx, %rax
movq (%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
cmpq $0x0, (%rsp)
jne 0x18d1f4
leaq 0x20(%rsp), %rax
imulq $0x60, 0x10(%rsp), %rcx
addq %rcx, %rax
imulq $0x18, 0x8(%rsp), %rcx
addq %rcx, %rax
movq (%rsp), %rcx
movsd 0x13c6(%rip), %xmm0     # 0x18e5b0
mulsd (%rax,%rcx,8), %xmm0
movsd %xmm0, (%rax,%rcx,8)
cmpq $0x1, (%rsp)
jne 0x18d228
leaq 0x20(%rsp), %rax
imulq $0x60, 0x10(%rsp), %rcx
addq %rcx, %rax
imulq $0x18, 0x8(%rsp), %rcx
addq %rcx, %rax
movq (%rsp), %rcx
movsd 0x1392(%rip), %xmm0     # 0x18e5b0
mulsd (%rax,%rcx,8), %xmm0
movsd %xmm0, (%rax,%rcx,8)
jmp 0x18d22a
jmp 0x18d22c
movq (%rsp), %rax
addq $0x1, %rax
movq %rax, (%rsp)
jmp 0x18cfb2
jmp 0x18d23f
movq 0x8(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x8(%rsp)
jmp 0x18cf9e
jmp 0x18d254
movq 0x10(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x10(%rsp)
jmp 0x18cf89
movl $0xdb4, %edi            # imm = 0xDB4
xorps %xmm2, %xmm2
movsd 0xd99(%rip), %xmm3      # 0x18e010
movl $0x2, %r8d
movl $0x4, %ecx
leaq 0x6e787(%rip), %r9      # 0x1fba10
movaps %xmm2, %xmm0
movaps %xmm3, %xmm1
movl %r8d, %esi
movl %r8d, %edx
callq 0x22120
leaq 0x4a0(%rsp), %r9
movl $0xdb7, %edi            # imm = 0xDB7
xorps %xmm2, %xmm2
movsd 0xd5e(%rip), %xmm3      # 0x18e010
movl $0x3, %esi
movl $0x4, %r8d
movl $0xc, %ecx
movaps %xmm2, %xmm0
movaps %xmm3, %xmm1
movl %r8d, %edx
callq 0x22120
movl 0x634(%rsp), %edi
movl 0x634(%rsp), %esi
xorps %xmm2, %xmm2
movsd 0xd27(%rip), %xmm3      # 0x18e010
movaps %xmm2, %xmm0
movaps %xmm3, %xmm1
callq 0x23040
movl 0x624(%rsp), %edi
movl 0x634(%rsp), %edx
movl 0x634(%rsp), %r8d
xorl %ecx, %ecx
movl %ecx, %esi
callq 0x224e0
leaq 0x320(%rsp), %r9
movl $0xdb7, %edi            # imm = 0xDB7
xorps %xmm2, %xmm2
movsd 0xce5(%rip), %xmm3      # 0x18e010
movl $0x3, %esi
movl $0x4, %r8d
movl $0xc, %ecx
movaps %xmm2, %xmm0
movaps %xmm3, %xmm1
movl %r8d, %edx
callq 0x22120
movl 0x624(%rsp), %edi
movl 0x634(%rsp), %edx
movl 0x634(%rsp), %r8d
xorl %ecx, %ecx
movl %ecx, %esi
callq 0x224e0
cmpq $0x6, 0x18(%rsp)
jge 0x18d41b
leaq 0x1a0(%rsp), %r9
movl $0xdb7, %edi            # imm = 0xDB7
xorps %xmm2, %xmm2
movsd 0xc84(%rip), %xmm3      # 0x18e010
movl $0x3, %esi
movl $0x4, %r8d
movl $0xc, %ecx
movaps %xmm2, %xmm0
movaps %xmm3, %xmm1
movl %r8d, %edx
callq 0x22120
movl 0x624(%rsp), %edi
movl 0x634(%rsp), %edx
movl 0x634(%rsp), %r8d
xorl %ecx, %ecx
movl %ecx, %esi
callq 0x224e0
leaq 0x20(%rsp), %r9
movl $0xdb7, %edi            # imm = 0xDB7
xorps %xmm2, %xmm2
movsd 0xc32(%rip), %xmm3      # 0x18e010
movl $0x3, %esi
movl $0x4, %r8d
movl $0xc, %ecx
movaps %xmm2, %xmm0
movaps %xmm3, %xmm1
movl %r8d, %edx
callq 0x22120
movl 0x624(%rsp), %edi
movl 0x634(%rsp), %edx
movl 0x634(%rsp), %r8d
xorl %ecx, %ecx
movl %ecx, %esi
callq 0x224e0
jmp 0x18d41d
movq 0x18(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x18(%rsp)
jmp 0x18cf74
callq 0x233a0
callq 0x220a0
addq $0x638, %rsp            # imm = 0x638
retq
nopw %cs:(%rax,%rax)