// File: tomfunkhouser[P]gaps/apps/prpview/prpview.cpp
// Function: GLUTInit(int*, char**)
void GLUTInit(int *argc, char **argv)
{
  // Open window 
  glutInit(argc, argv);
  glutInitWindowPosition(100, 100);
  glutInitWindowSize(GLUTwindow_width, GLUTwindow_height);
  glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH | GLUT_MULTISAMPLE);
  GLUTwindow = glutCreateWindow("Property Viewer");

  // Initialize grfx (after create context because calls glewInit)
  RNInitGrfx();

  // Initialize multisampling
  glEnable(GL_MULTISAMPLE);
  
  // Initialize background color 
  glClearColor(200.0/255.0, 200.0/255.0, 200.0/255.0, 1.0);

  // 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);
  glEnable(GL_LIGHTING); 

  // Initialize headlight
  static GLfloat light0_diffuse[] = { 1, 1, 1, 1 };
  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 backlight
  static GLfloat light1_diffuse[] = { 1, 1, 1, 1 };
  static GLfloat light1_position[] = { 0.0, 0.0, -1.0, 0.0 };
  glLightfv(GL_LIGHT1, GL_DIFFUSE, light1_diffuse);
  glLightfv(GL_LIGHT1, GL_POSITION, light1_position);
  glEnable(GL_LIGHT1);

  // Initialize color settings
  glEnable(GL_COLOR_MATERIAL);
  glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);

  // Initialize graphics modes  
  glEnable(GL_DEPTH_TEST);
  glShadeModel(GL_SMOOTH);

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

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movq %rsi, 0x8(%rsp)
movq 0x10(%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x183320
movl $0x64, %esi
movl %esi, %edi
callq 0x183aa0
movl 0x1d5915(%rip), %edi    # 0x1feac4
movl 0x1d590b(%rip), %esi    # 0x1feac0
callq 0x183ae0
movl $0x92, %edi
callq 0x183b20
leaq 0x16d0d5(%rip), %rdi    # 0x1962a0
callq 0x18c340
movl %eax, 0x1dbaa2(%rip)    # 0x204c78
callq 0xf6e30
movl $0x809d, %edi           # imm = 0x809D
callq 0x22900
movss 0x16cecb(%rip), %xmm2   # 0x1960b8
movss 0x16cebb(%rip), %xmm3   # 0x1960b0
movaps %xmm2, %xmm0
movaps %xmm2, %xmm1
callq 0x22fb0
movl $0x1700, %edi           # imm = 0x1700
callq 0x22e30
callq 0x22db0
movl $0xb53, %edi            # imm = 0xB53
leaq 0x1d58b5(%rip), %rsi    # 0x1fead0
callq 0x233c0
movl $0xb51, %edi            # imm = 0xB51
movl $0x1, %esi
callq 0x22160
movl $0xba1, %edi            # imm = 0xBA1
callq 0x22900
movl $0xb50, %edi            # imm = 0xB50
callq 0x22900
movl $0x4000, %edi           # imm = 0x4000
movl $0x1201, %esi           # imm = 0x1201
leaq 0x1d588c(%rip), %rdx    # 0x1feae0
callq 0x23250
movl $0x4000, %edi           # imm = 0x4000
movl $0x1203, %esi           # imm = 0x1203
leaq 0x1d5886(%rip), %rdx    # 0x1feaf0
callq 0x23250
movl $0x4000, %edi           # imm = 0x4000
callq 0x22900
movl $0x4001, %edi           # imm = 0x4001
movl $0x1201, %esi           # imm = 0x1201
leaq 0x1d5876(%rip), %rdx    # 0x1feb00
callq 0x23250
movl $0x4001, %edi           # imm = 0x4001
movl $0x1203, %esi           # imm = 0x1203
leaq 0x1d5870(%rip), %rdx    # 0x1feb10
callq 0x23250
movl $0x4001, %edi           # imm = 0x4001
callq 0x22900
movl $0xb57, %edi            # imm = 0xB57
callq 0x22900
movl $0x408, %edi            # imm = 0x408
movl $0x1602, %esi           # imm = 0x1602
callq 0x22620
movl $0xb71, %edi            # imm = 0xB71
callq 0x22900
movl $0x1d01, %edi           # imm = 0x1D01
callq 0x231b0
leaq -0x2403(%rip), %rdi     # 0x26ee0
callq 0x1812c0
leaq -0xa8f(%rip), %rdi      # 0x28860
callq 0x181340
leaq -0x33b(%rip), %rdi      # 0x28fc0
callq 0x1813b0
leaq -0x727(%rip), %rdi      # 0x28be0
callq 0x181420
leaq -0x943(%rip), %rdi      # 0x289d0
callq 0x181950
leaq -0xa6f(%rip), %rdi      # 0x288b0
callq 0x181a30
addq $0x18, %rsp
retq
nopl (%rax)