// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_geometry.c
// Function: glutWireSierpinskiSponge
void FGAPIENTRY glutWireSierpinskiSponge ( int num_levels, GLdouble offset[3], GLdouble scale )
{
  int i, j ;

  FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutWireSierpinskiSponge" );

  if ( num_levels == 0 )
  {

    for ( i = 0 ; i < NUM_TETR_FACES ; i++ )
    {
      glBegin ( GL_LINE_LOOP ) ;
      glNormal3d ( -tet_r[i][0], -tet_r[i][1], -tet_r[i][2] ) ;
      for ( j = 0; j < 3; j++ )
      {
        double x = offset[0] + scale * tet_r[tet_i[i][j]][0] ;
        double y = offset[1] + scale * tet_r[tet_i[i][j]][1] ;
        double z = offset[2] + scale * tet_r[tet_i[i][j]][2] ;
        glVertex3d ( x, y, z ) ;
      }

      glEnd () ;
    }
  }
  else if ( num_levels > 0 )
  {
    GLdouble local_offset[3] ;  /* Use a local variable to avoid buildup of roundoff errors */
    num_levels -- ;
    scale /= 2.0 ;
    for ( i = 0 ; i < NUM_TETR_FACES ; i++ )
    {
      local_offset[0] = offset[0] + scale * tet_r[i][0] ;
      local_offset[1] = offset[1] + scale * tet_r[i][1] ;
      local_offset[2] = offset[2] + scale * tet_r[i][2] ;
      glutWireSierpinskiSponge ( num_levels, local_offset, scale ) ;
    }
  }
}

// Assembly:
subq $0x58, %rsp
movl %edi, 0x54(%rsp)
movq %rsi, 0x48(%rsp)
movsd %xmm0, 0x40(%rsp)
leaq 0x6e096(%rip), %rax     # 0x1fa390
cmpb $0x0, 0x1c(%rax)
jne 0x18c315
leaq 0x115cb(%rip), %rdi     # 0x19d8d2
leaq 0x230ea(%rip), %rsi     # 0x1af3f8
movb $0x0, %al
callq 0x17de70
cmpl $0x0, 0x54(%rsp)
jne 0x18c507
movl $0x0, 0x3c(%rsp)
cmpl $0x4, 0x3c(%rsp)
jge 0x18c502
movl $0x2, %edi
callq 0x221b0
movslq 0x3c(%rsp), %rcx
leaq 0x6e287(%rip), %rax     # 0x1fa5d0
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movsd (%rax), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movslq 0x3c(%rsp), %rcx
leaq 0x6e259(%rip), %rax     # 0x1fa5d0
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movsd 0x8(%rax), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
movslq 0x3c(%rsp), %rcx
leaq 0x6e22a(%rip), %rax     # 0x1fa5d0
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movsd 0x10(%rax), %xmm2
movq %xmm2, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm2
callq 0x22330
movl $0x0, 0x38(%rsp)
cmpl $0x3, 0x38(%rsp)
jge 0x18c4ed
movq 0x48(%rsp), %rax
movsd (%rax), %xmm1
movsd 0x40(%rsp), %xmm0
movslq 0x3c(%rsp), %rcx
leaq 0x6e774(%rip), %rax     # 0x1fab70
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movslq 0x38(%rsp), %rcx
movslq (%rax,%rcx,4), %rcx
leaq 0x6e1bd(%rip), %rax     # 0x1fa5d0
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movsd (%rax), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x30(%rsp)
movq 0x48(%rsp), %rax
movsd 0x8(%rax), %xmm1
movsd 0x40(%rsp), %xmm0
movslq 0x3c(%rsp), %rcx
leaq 0x6e728(%rip), %rax     # 0x1fab70
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movslq 0x38(%rsp), %rcx
movslq (%rax,%rcx,4), %rcx
leaq 0x6e171(%rip), %rax     # 0x1fa5d0
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movsd 0x8(%rax), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x28(%rsp)
movq 0x48(%rsp), %rax
movsd 0x10(%rax), %xmm1
movsd 0x40(%rsp), %xmm0
movslq 0x3c(%rsp), %rcx
leaq 0x6e6db(%rip), %rax     # 0x1fab70
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movslq 0x38(%rsp), %rcx
movslq (%rax,%rcx,4), %rcx
leaq 0x6e124(%rip), %rax     # 0x1fa5d0
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movsd 0x10(%rax), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x30(%rsp), %xmm0
movsd 0x28(%rsp), %xmm1
movsd 0x20(%rsp), %xmm2
callq 0x23020
movl 0x38(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x38(%rsp)
jmp 0x18c3d6
callq 0x22de0
movl 0x3c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3c(%rsp)
jmp 0x18c328
jmp 0x18c60d
cmpl $0x0, 0x54(%rsp)
jle 0x18c60b
movl 0x54(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x54(%rsp)
movsd 0x40(%rsp), %xmm0
movsd 0x1b25(%rip), %xmm1     # 0x18e050
divsd %xmm1, %xmm0
movsd %xmm0, 0x40(%rsp)
movl $0x0, 0x3c(%rsp)
cmpl $0x4, 0x3c(%rsp)
jge 0x18c609
movq 0x48(%rsp), %rax
movsd (%rax), %xmm1
movsd 0x40(%rsp), %xmm0
movslq 0x3c(%rsp), %rcx
leaq 0x6e06d(%rip), %rax     # 0x1fa5d0
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movsd (%rax), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rsp)
movq 0x48(%rsp), %rax
movsd 0x8(%rax), %xmm1
movsd 0x40(%rsp), %xmm0
movslq 0x3c(%rsp), %rcx
leaq 0x6e039(%rip), %rax     # 0x1fa5d0
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movsd 0x8(%rax), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x8(%rsp)
movq 0x48(%rsp), %rax
movsd 0x10(%rax), %xmm1
movsd 0x40(%rsp), %xmm0
movslq 0x3c(%rsp), %rcx
leaq 0x6e003(%rip), %rax     # 0x1fa5d0
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movsd 0x10(%rax), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x10(%rsp)
movl 0x54(%rsp), %edi
movq %rsp, %rsi
movsd 0x40(%rsp), %xmm0
callq 0x18c2e0
movl 0x3c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3c(%rsp)
jmp 0x18c53d
jmp 0x18c60b
jmp 0x18c60d
addq $0x58, %rsp
retq
nopw %cs:(%rax,%rax)