// File: tomfunkhouser[P]gaps/apps/confview/confview.cpp
// Function: GLUTInterface()
void GLUTInterface(void)
{
  // Open window
  int argc = 0;
  char *argv[1];
  argv[argc++] = RNStrdup("conf2texture");
  glutInit(&argc, argv);
  glutInitWindowPosition(100, 100);
  glutInitWindowSize(GLUTwindow_width, GLUTwindow_height);
  glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
  GLUTwindow = glutCreateWindow("Configuration Viewer");
  
  // Initialize grfx (after create context because calls glewInit)
  RNInitGrfx();

  // Initialize graphics modes  
  glEnable(GL_DEPTH_TEST);
  glEnable(GL_CULL_FACE);

  // Initialize lighting
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
  static GLfloat lmodel_ambient[] = { 0.2, 0.2, 0.2, 1.0 };
  glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);
  glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE);
  glEnable(GL_NORMALIZE);

  // Define headlight
  static GLfloat light0_diffuse[] = { 0.5, 0.5, 0.5, 1.0 };
  static GLfloat light0_position[] = { 0.0, 0.0, 1.0, 0.0 };
  glLightfv(GL_LIGHT0, GL_DIFFUSE, light0_diffuse);
  glLightfv(GL_LIGHT0, GL_POSITION, light0_position);
  glEnable(GL_LIGHT0);

  // Initialize GLUT callback functions 
  glutDisplayFunc(GLUTRedraw);
  glutReshapeFunc(GLUTResize);
  glutKeyboardFunc(GLUTKeyboard);
  glutSpecialFunc(GLUTSpecial);
  glutMouseFunc(GLUTMouse);
  glutMotionFunc(GLUTMotion);

  // Reset viewer
  ResetViewer();

  // Run main loop -- never returns 
  glutMainLoop();
}

// Assembly:
subq $0x18, %rsp
movl $0x0, 0x14(%rsp)
leaq 0x19a877(%rip), %rdi    # 0x1c734a
callq 0x12c3b0
movq %rax, %rcx
movl 0x14(%rsp), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, 0x14(%rsp)
cltq
movq %rcx, 0x8(%rsp,%rax,8)
leaq 0x8(%rsp), %rsi
leaq 0x14(%rsp), %rdi
callq 0x1b3d50
movl $0x64, %esi
movl %esi, %edi
callq 0x1b44d0
movl 0x208fcc(%rip), %edi    # 0x235adc
movl 0x208fca(%rip), %esi    # 0x235ae0
callq 0x1b4510
movl $0x12, %edi
callq 0x1b4550
leaq 0x19a82b(%rip), %rdi    # 0x1c7357
callq 0x1bcd70
movl %eax, 0x20f259(%rip)    # 0x23bd90
callq 0x1278b0
movl $0xb71, %edi            # imm = 0xB71
callq 0x24930
movl $0xb44, %edi            # imm = 0xB44
callq 0x24930
movl $0x1700, %edi           # imm = 0x1700
callq 0x24e80
callq 0x24e00
movl $0xb53, %edi            # imm = 0xB53
leaq 0x208f95(%rip), %rsi    # 0x235b00
callq 0x25400
movl $0xb51, %edi            # imm = 0xB51
movl $0x1, %esi
callq 0x24170
movl $0xba1, %edi            # imm = 0xBA1
callq 0x24930
movl $0x4000, %edi           # imm = 0x4000
movl $0x1201, %esi           # imm = 0x1201
leaq 0x208f76(%rip), %rdx    # 0x235b10
callq 0x25290
movl $0x4000, %edi           # imm = 0x4000
movl $0x1203, %esi           # imm = 0x1203
leaq 0x208f70(%rip), %rdx    # 0x235b20
callq 0x25290
movl $0x4000, %edi           # imm = 0x4000
callq 0x24930
leaq -0x3956(%rip), %rdi     # 0x29270
callq 0x1b1cf0
leaq -0x2832(%rip), %rdi     # 0x2a3a0
callq 0x1b1d70
leaq -0x8fe(%rip), %rdi      # 0x2c2e0
callq 0x1b1de0
leaq -0x114a(%rip), %rdi     # 0x2baa0
callq 0x1b1e50
leaq -0x2406(%rip), %rdi     # 0x2a7f0
callq 0x1b2380
leaq -0x2812(%rip), %rdi     # 0x2a3f0
callq 0x1b2460
callq 0x2c010
callq 0x1b7b50
addq $0x18, %rsp
retq
nopw %cs:(%rax,%rax)