// File: tomfunkhouser[P]gaps/apps/mshview/mshview.cpp
// Function: GLUTRedraw()
void GLUTRedraw(void)
{
  // Check meshes
  if (meshes.NEntries() == 0) return;
  
  // Set viewing transformation
  viewer->Camera().Load();

  // Clear window 
  glClearColor(1.0, 1.0, 1.0, 1.0);
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

  // Set backface culling
  if (show_backfacing) glDisable(GL_CULL_FACE);
  else glEnable(GL_CULL_FACE);

  // Set lights
  static GLfloat light0_position[] = { 3.0, 4.0, 5.0, 0.0 };
  glLightfv(GL_LIGHT0, GL_POSITION, light0_position);
  static GLfloat light1_position[] = { -3.0, -2.0, -3.0, 0.0 };
  glLightfv(GL_LIGHT1, GL_POSITION, light1_position);

  // Draw every mesh
  for (int m = 0; m < meshes.NEntries(); m++) {
    R3Mesh *mesh = meshes[m];
    if ((current_mesh != -1) && (m != current_mesh)) continue;

    // Draw faces
    if (show_faces) {
      if (show_materials || show_segments || show_categories) {
        // Draw faces with special colors
        RNGrfxBegin(RN_GRFX_TRIANGLES);
        for (int i = 0; i < mesh->NFaces(); i++) {
          R3MeshFace *face = mesh->Face(i);
          if (show_materials) RNLoadRgb(colors[1 + mesh->FaceMaterial(face)%(ncolors-1)]); 
          else if (show_segments) RNLoadRgb(colors[1 + mesh->FaceSegment(face)%(ncolors-1)]); 
          else if (show_categories) RNLoadRgb(colors[1 + mesh->FaceCategory(face)%(ncolors-1)]); 
          for (int j = 0; j < 3; j++) {
            R3MeshVertex *vertex = mesh->VertexOnFace(face, j);
            R3LoadPoint(mesh->VertexPosition(vertex));
          }
        }
        RNGrfxEnd();
      }
      else {
        // Draw faces
        RNFlags draw_flags = R3_DEFAULT_DRAW_FLAGS;
        if (show_vertex_colors) glDisable(GL_LIGHTING); 
        else { glEnable(GL_LIGHTING); RNLoadRgb(0.8, 0.8, 0.8); draw_flags.Remove(R3_VERTEX_COLORS_DRAW_FLAG); }
        mesh->DrawFaces(draw_flags);
      }
    }

    // Draw edges
    if (show_edges) {
      glDisable(GL_LIGHTING);
      RNLoadRgb(1.0, 0.0, 0.0);
      mesh->DrawEdges(0);
    }

    // Draw boundary edges
    if (show_boundaries) {
      glLineWidth(3);
      glDisable(GL_LIGHTING);
      RNLoadRgb(0.0, 0.0, 0.0);
      for (int i = 0; i < mesh->NEdges(); i++) {
        R3MeshEdge *edge = mesh->Edge(i);
        if (mesh->FaceOnEdge(edge, 0) && mesh->FaceOnEdge(edge, 1)) continue;
        mesh->DrawEdge(edge);
      }
      glLineWidth(1);
    }

    // Draw vertices
    if (show_vertices) {
      RNFlags draw_flags = R3_SURFACES_DRAW_FLAG;
      if (show_vertex_colors) { glDisable(GL_LIGHTING); draw_flags.Add(R3_VERTEX_COLORS_DRAW_FLAG); }
      else { glEnable(GL_LIGHTING); RNLoadRgb(0.0, 0.5, 0.0); }
      glPointSize(5);
      mesh->DrawVertices(draw_flags);
      glPointSize(1);
    }

    // Draw face normals
    if (show_face_normals) {
      glDisable(GL_LIGHTING);
      RNLoadRgb(0.2, 0.2, 0.2);
      RNGrfxBegin(RN_GRFX_LINES);
      RNScalar radius = 0.01 * mesh->BBox().DiagonalLength();
      for (int i = 0; i < mesh->NFaces(); i++) {
        R3MeshFace *face = mesh->Face(i);
        R3Point position = mesh->FaceCentroid(face);
        R3Vector normal = mesh->FaceNormal(face);
        R3LoadPoint(position);
        R3LoadPoint(position + radius * normal);
      }
      RNGrfxEnd();
    }

    // Draw vertex normals
    if (show_vertex_normals) {
      glDisable(GL_LIGHTING);
      RNLoadRgb(0.5, 0.5, 0.5);
      RNGrfxBegin(RN_GRFX_LINES);
      RNScalar radius = 0.0025 * mesh->BBox().DiagonalLength();
      for (int i = 0; i < mesh->NVertices(); i++) {
        R3MeshVertex *vertex = mesh->Vertex(i);
        R3Point position = mesh->VertexPosition(vertex);
        R3Vector normal = mesh->VertexNormal(vertex);
        if (show_vertex_colors) R3LoadRgb(mesh->VertexColor(vertex));
        R3LoadRgb(sqrt(normal.Length()), 0.0, 1.0);
        R3LoadPoint(position);
        R3LoadPoint(position + radius * normal);
      }
      RNGrfxEnd();
    }

    // Draw face names
    if (show_face_names) {
      glDisable(GL_LIGHTING);
      RNLoadRgb(0, 0, 0);
      for (int i = 0; i < mesh->NFaces(); i++) {
        R3MeshFace *face = mesh->Face(i);
        char buffer[256];
        sprintf(buffer, "%d", mesh->FaceID(face));
        R3DrawText(mesh->FaceCentroid(face), buffer);
      }
    }

    // Draw edge names   
    if (show_edge_names) {
      glDisable(GL_LIGHTING);
      RNLoadRgb(0.8, 0.0, 0.0);
      for (int i = 0; i < mesh->NEdges(); i++) {
        R3MeshEdge *edge = mesh->Edge(i);
        char buffer[256];
        sprintf(buffer, "%d", mesh->EdgeID(edge));
        R3DrawText(mesh->EdgeMidpoint(edge), buffer);
      }
    }

    // Draw vertex names
    if (show_vertex_names) {
      glDisable(GL_LIGHTING);
      RNLoadRgb(0.5, 0.3, 0.1);
      RNLength r = 1E-5 * mesh->BBox().DiagonalRadius();
      for (int i = 0; i < mesh->NVertices(); i++) {
        R3MeshVertex *vertex = mesh->Vertex(i);
        R3Point position = mesh->VertexPosition(vertex);
        R3Vector normal = mesh->VertexNormal(vertex);        
        char buffer[256];
        sprintf(buffer, "%d", mesh->VertexID(vertex));
        if (show_vertex_colors) R3LoadRgb(mesh->VertexColor(vertex));
        R3DrawText(position + r * normal, buffer);
      }
    }

    // Draw material names
    if (show_material_names) {
      glDisable(GL_LIGHTING);
      RNLoadRgb(0, 0, 1);
      for (int i = 0; i < mesh->NFaces(); i++) {
        R3MeshFace *face = mesh->Face(i);
        char buffer[256];
        sprintf(buffer, "%d", mesh->FaceMaterial(face));
        R3DrawText(mesh->FaceCentroid(face), buffer);
      }
    }

    // Draw segment names
    if (show_segment_names) {
      glDisable(GL_LIGHTING);
      RNLoadRgb(0, 0, 1);
      for (int i = 0; i < mesh->NFaces(); i++) {
        R3MeshFace *face = mesh->Face(i);
        char buffer[256];
        sprintf(buffer, "%d", mesh->FaceSegment(face));
        R3DrawText(mesh->FaceCentroid(face), buffer);
      }
    }
    
    // Draw category names
    if (show_category_names) {
      glDisable(GL_LIGHTING);
      RNLoadRgb(0, 0, 1);
      for (int i = 0; i < mesh->NFaces(); i++) {
        R3MeshFace *face = mesh->Face(i);
        char buffer[256];
        sprintf(buffer, "%d", mesh->FaceCategory(face));
        R3DrawText(mesh->FaceCentroid(face), buffer);
      }
    }
  }

  // Draw world origin
  if (show_world_origin) {
    glEnable(GL_LIGHTING);
    RNLoadRgb(1.0, 0.0, 0.0);
    RNScalar r = 0.01 * meshes[0]->BBox().DiagonalRadius();
    R3Sphere(world_origin, r).Draw();
  }

  // Draw axes
  if (show_axes) {
    RNScalar d = meshes[0]->BBox().DiagonalRadius();
    glDisable(GL_LIGHTING);
    glLineWidth(3);
    R3BeginLine();
    RNLoadRgb(1, 0, 0);
    R3LoadPoint(R3zero_point + 0.5*d * R3negx_vector);
    R3LoadPoint(R3zero_point + d * R3posx_vector);
    R3EndLine();
    R3BeginLine();
    RNLoadRgb(0, 1, 0);
    R3LoadPoint(R3zero_point + 0.5*d * R3negy_vector);
    R3LoadPoint(R3zero_point + d * R3posy_vector);
    R3EndLine();
    R3BeginLine();
    RNLoadRgb(0, 0, 1);
    R3LoadPoint(R3zero_point + 0.5*d * R3negz_vector);
    R3LoadPoint(R3zero_point + d * R3posz_vector);
    R3EndLine();
    glLineWidth(1);
  }

  // Capture image and exit
  if (image_name) {
    R2Image image(GLUTwindow_width, GLUTwindow_height, 3);
    image.Capture();
    image.Write(image_name);
    GLUTStop();
  }

  // Swap buffers 
  glutSwapBuffers();
}

// Assembly:
subq $0xac8, %rsp            # imm = 0xAC8
leaq 0x1d333a(%rip), %rdi    # 0x1fac18
callq 0x2a760
cmpl $0x0, %eax
jne 0x278ed
jmp 0x28bd3
movq 0x1d3a14(%rip), %rdi    # 0x1fb308
callq 0x2a770
movq %rax, %rdi
xorl %esi, %esi
callq 0x2fe20
movss 0x16577d(%rip), %xmm3   # 0x18d088
movaps %xmm3, %xmm0
movaps %xmm3, %xmm1
movaps %xmm3, %xmm2
callq 0x22fb0
movl $0x4100, %edi           # imm = 0x4100
callq 0x22220
cmpl $0x0, 0x1d39e6(%rip)    # 0x1fb310
je 0x27938
movl $0xb44, %edi            # imm = 0xB44
callq 0x22230
jmp 0x27942
movl $0xb44, %edi            # imm = 0xB44
callq 0x22900
movl $0x4000, %edi           # imm = 0x4000
movl $0x1203, %esi           # imm = 0x1203
leaq 0x1cd13d(%rip), %rdx    # 0x1f4a90
callq 0x23240
movl $0x4001, %edi           # imm = 0x4001
movl $0x1203, %esi           # imm = 0x1203
leaq 0x1cd137(%rip), %rdx    # 0x1f4aa0
callq 0x23240
movl $0x0, 0xac4(%rsp)
movl 0xac4(%rsp), %eax
movl %eax, 0x7c(%rsp)
leaq 0x1d328d(%rip), %rdi    # 0x1fac18
callq 0x2a760
movl %eax, %ecx
movl 0x7c(%rsp), %eax
cmpl %ecx, %eax
jge 0x28812
movl 0xac4(%rsp), %esi
leaq 0x1d326c(%rip), %rdi    # 0x1fac18
callq 0x2a780
movq (%rax), %rax
movq %rax, 0xab8(%rsp)
cmpl $-0x1, 0x1cd0ed(%rip)   # 0x1f4ab0
je 0x279d9
movl 0xac4(%rsp), %eax
cmpl 0x1cd0de(%rip), %eax    # 0x1f4ab0
je 0x279d9
jmp 0x287fc
cmpl $0x0, 0x1cd0d4(%rip)    # 0x1f4ab4
je 0x27c45
cmpl $0x0, 0x1d3927(%rip)    # 0x1fb314
jne 0x27a05
cmpl $0x0, 0x1d3922(%rip)    # 0x1fb318
jne 0x27a05
cmpl $0x0, 0x1d391d(%rip)    # 0x1fb31c
je 0x27baf
movl $0x4, %edi
callq 0x2a7a0
movl $0x0, 0xab4(%rsp)
movl 0xab4(%rsp), %eax
movl %eax, 0x78(%rsp)
movq 0xab8(%rsp), %rdi
callq 0x2a7c0
movl %eax, %ecx
movl 0x78(%rsp), %eax
cmpl %ecx, %eax
jge 0x27ba5
movq 0xab8(%rsp), %rdi
movl 0xab4(%rsp), %esi
callq 0x2a7e0
movq %rax, 0xaa8(%rsp)
cmpl $0x0, 0x1d38b1(%rip)    # 0x1fb314
je 0x27aa0
movq 0xab8(%rsp), %rdi
movq 0xaa8(%rsp), %rsi
callq 0x2a860
movl $0x47, %ecx
cltd
idivl %ecx
addl $0x1, %edx
movslq %edx, %rax
leaq 0x1d31b1(%rip), %rdi    # 0x1fac40
imulq $0x18, %rax, %rax
addq %rax, %rdi
callq 0x2a810
jmp 0x27b24
cmpl $0x0, 0x1d3871(%rip)    # 0x1fb318
je 0x27ae1
movq 0xab8(%rsp), %rdi
movq 0xaa8(%rsp), %rsi
callq 0x2a880
movl $0x47, %ecx
cltd
idivl %ecx
addl $0x1, %edx
movslq %edx, %rax
leaq 0x1d316d(%rip), %rdi    # 0x1fac40
imulq $0x18, %rax, %rax
addq %rax, %rdi
callq 0x2a810
jmp 0x27b22
cmpl $0x0, 0x1d3834(%rip)    # 0x1fb31c
je 0x27b20
movq 0xab8(%rsp), %rdi
movq 0xaa8(%rsp), %rsi
callq 0x2a8a0
movl $0x47, %ecx
cltd
idivl %ecx
addl $0x1, %edx
movslq %edx, %rax
leaq 0x1d312c(%rip), %rdi    # 0x1fac40
imulq $0x18, %rax, %rax
addq %rax, %rdi
callq 0x2a810
jmp 0x27b22
jmp 0x27b24
movl $0x0, 0xaa4(%rsp)
cmpl $0x3, 0xaa4(%rsp)
jge 0x27b8d
movq 0xab8(%rsp), %rdi
movq 0xaa8(%rsp), %rsi
movl 0xaa4(%rsp), %edx
callq 0x2a8c0
movq %rax, 0xa98(%rsp)
movq 0xab8(%rsp), %rdi
movq 0xa98(%rsp), %rsi
callq 0x2a900
movq %rax, %rdi
callq 0x2a8e0
movl 0xaa4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xaa4(%rsp)
jmp 0x27b2f
jmp 0x27b8f
movl 0xab4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xab4(%rsp)
jmp 0x27a1a
callq 0x2a920
jmp 0x27c43
leaq 0xa90(%rsp), %rdi
movl $0x772, %esi            # imm = 0x772
callq 0x2a930
cmpl $0x0, 0x1d3758(%rip)    # 0x1fb320
je 0x27bd6
movl $0xb50, %edi            # imm = 0xB50
callq 0x22230
jmp 0x27c1a
movl $0xb50, %edi            # imm = 0xB50
callq 0x22900
movsd 0x165438(%rip), %xmm2   # 0x18d020
movaps %xmm2, %xmm0
movaps %xmm2, %xmm1
callq 0x2a950
leaq 0xa88(%rsp), %rdi
movl $0x400, %esi            # imm = 0x400
callq 0x2a930
movq 0xa88(%rsp), %rsi
leaq 0xa90(%rsp), %rdi
callq 0x2a980
movq 0xab8(%rsp), %rdi
movq 0xa90(%rsp), %rax
movq %rax, 0xa80(%rsp)
movq 0xa80(%rsp), %rsi
movq (%rdi), %rax
callq *0x138(%rax)
jmp 0x27c45
cmpl $0x0, 0x1d36d8(%rip)    # 0x1fb324
je 0x27c9f
movl $0xb50, %edi            # imm = 0xB50
callq 0x22230
movsd 0x1653b8(%rip), %xmm0   # 0x18d018
xorps %xmm2, %xmm2
movaps %xmm2, %xmm1
callq 0x2a950
movq 0xab8(%rsp), %rax
movq %rax, 0x70(%rsp)
leaq 0xa78(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x2a930
movq 0x70(%rsp), %rdi
movq 0xa78(%rsp), %rsi
movq (%rdi), %rax
callq *0x130(%rax)
cmpl $0x0, 0x1d3682(%rip)    # 0x1fb328
je 0x27d99
movss 0x1653d8(%rip), %xmm0   # 0x18d08c
callq 0x232f0
movl $0xb50, %edi            # imm = 0xB50
callq 0x22230
xorps %xmm2, %xmm2
movaps %xmm2, %xmm0
movaps %xmm2, %xmm1
callq 0x2a950
movl $0x0, 0xa74(%rsp)
movl 0xa74(%rsp), %eax
movl %eax, 0x6c(%rsp)
movq 0xab8(%rsp), %rdi
callq 0x2a9c0
movl %eax, %ecx
movl 0x6c(%rsp), %eax
cmpl %ecx, %eax
jge 0x27d8c
movq 0xab8(%rsp), %rdi
movl 0xa74(%rsp), %esi
callq 0x2a9e0
movq %rax, 0xa68(%rsp)
movq 0xab8(%rsp), %rdi
movq 0xa68(%rsp), %rsi
xorl %edx, %edx
callq 0x2aa10
cmpq $0x0, %rax
je 0x27d5d
movq 0xab8(%rsp), %rdi
movq 0xa68(%rsp), %rsi
movl $0x1, %edx
callq 0x2aa10
cmpq $0x0, %rax
je 0x27d5d
jmp 0x27d76
movq 0xab8(%rsp), %rdi
movq 0xa68(%rsp), %rsi
movq (%rdi), %rax
callq *0x160(%rax)
movl 0xa74(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xa74(%rsp)
jmp 0x27cdc
movss 0x1652f4(%rip), %xmm0   # 0x18d088
callq 0x232f0
cmpl $0x0, 0x1d358c(%rip)    # 0x1fb32c
je 0x27e54
leaq 0xa60(%rsp), %rdi
movl $0x2, %esi
callq 0x2a930
cmpl $0x0, 0x1d3561(%rip)    # 0x1fb320
je 0x27df4
movl $0xb50, %edi            # imm = 0xB50
callq 0x22230
leaq 0xa58(%rsp), %rdi
movl $0x400, %esi            # imm = 0x400
callq 0x2a930
movq 0xa58(%rsp), %rsi
leaq 0xa60(%rsp), %rdi
callq 0x2aa30
jmp 0x27e11
movl $0xb50, %edi            # imm = 0xB50
callq 0x22900
xorps %xmm2, %xmm2
movsd 0x16521f(%rip), %xmm1   # 0x18d028
movaps %xmm2, %xmm0
callq 0x2a950
movss 0x165277(%rip), %xmm0   # 0x18d090
callq 0x220b0
movq 0xab8(%rsp), %rdi
movq 0xa60(%rsp), %rax
movq %rax, 0xa50(%rsp)
movq 0xa50(%rsp), %rsi
movq (%rdi), %rax
callq *0x128(%rax)
movss 0x165239(%rip), %xmm0   # 0x18d088
callq 0x220b0
cmpl $0x0, 0x1d34d5(%rip)    # 0x1fb330
je 0x27fb4
movl $0xb50, %edi            # imm = 0xB50
callq 0x22230
movsd 0x1651d5(%rip), %xmm2   # 0x18d048
movaps %xmm2, %xmm0
movaps %xmm2, %xmm1
callq 0x2a950
movl $0x1, %edi
callq 0x2a7a0
movq 0xab8(%rsp), %rdi
callq 0x2aa70
movq %rax, %rdi
callq 0xb7980
movaps %xmm0, %xmm1
movsd 0x165198(%rip), %xmm0   # 0x18d040
mulsd %xmm1, %xmm0
movsd %xmm0, 0xa48(%rsp)
movl $0x0, 0xa44(%rsp)
movl 0xa44(%rsp), %eax
movl %eax, 0x68(%rsp)
movq 0xab8(%rsp), %rdi
callq 0x2a7c0
movl %eax, %ecx
movl 0x68(%rsp), %eax
cmpl %ecx, %eax
jge 0x27faf
movq 0xab8(%rsp), %rdi
movl 0xa44(%rsp), %esi
callq 0x2a7e0
movq %rax, 0xa38(%rsp)
movq 0xab8(%rsp), %rsi
movq 0xa38(%rsp), %rdx
leaq 0xa20(%rsp), %rdi
callq 0x7e0f0
movq 0xab8(%rsp), %rdi
movq 0xa38(%rsp), %rsi
callq 0x2aa90
movq %rax, %rsi
leaq 0xa08(%rsp), %rdi
callq 0xccc30
leaq 0xa20(%rsp), %rdi
callq 0x2a8e0
movsd 0xa48(%rsp), %xmm0
leaq 0x9d8(%rsp), %rdi
leaq 0xa08(%rsp), %rsi
callq 0x2aac0
leaq 0x9f0(%rsp), %rdi
leaq 0xa20(%rsp), %rsi
leaq 0x9d8(%rsp), %rdx
callq 0xcc050
leaq 0x9f0(%rsp), %rdi
callq 0x2a8e0
movl 0xa44(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xa44(%rsp)
jmp 0x27ec0
callq 0x2a920
cmpl $0x0, 0x1d3379(%rip)    # 0x1fb334
je 0x28164
movl $0xb50, %edi            # imm = 0xB50
callq 0x22230
movsd 0x165055(%rip), %xmm2   # 0x18d028
movaps %xmm2, %xmm0
movaps %xmm2, %xmm1
callq 0x2a950
movl $0x1, %edi
callq 0x2a7a0
movq 0xab8(%rsp), %rdi
callq 0x2aa70
movq %rax, %rdi
callq 0xb7980
movaps %xmm0, %xmm1
movsd 0x165048(%rip), %xmm0   # 0x18d050
mulsd %xmm1, %xmm0
movsd %xmm0, 0x9d0(%rsp)
movl $0x0, 0x9cc(%rsp)
movl 0x9cc(%rsp), %eax
movl %eax, 0x64(%rsp)
movq 0xab8(%rsp), %rdi
callq 0x2ab00
movl %eax, %ecx
movl 0x64(%rsp), %eax
cmpl %ecx, %eax
jge 0x2815f
movq 0xab8(%rsp), %rdi
movl 0x9cc(%rsp), %esi
callq 0x2ab20
movq %rax, 0x9c0(%rsp)
movq 0xab8(%rsp), %rdi
movq 0x9c0(%rsp), %rsi
callq 0x2a900
movq %rax, %rsi
leaq 0x9a8(%rsp), %rdi
callq 0xcbad0
movq 0xab8(%rsp), %rdi
movq 0x9c0(%rsp), %rsi
callq 0x2ab50
movq %rax, %rsi
leaq 0x990(%rsp), %rdi
callq 0xccc30
cmpl $0x0, 0x1d326d(%rip)    # 0x1fb320
je 0x280d2
movq 0xab8(%rsp), %rdi
movq 0x9c0(%rsp), %rsi
callq 0x2abc0
movq %rax, %rdi
callq 0x2a810
leaq 0x990(%rsp), %rdi
callq 0xccdd0
callq 0x22770
xorps %xmm1, %xmm1
movsd 0x164f29(%rip), %xmm2   # 0x18d018
callq 0x2a950
leaq 0x9a8(%rsp), %rdi
callq 0x2a8e0
movsd 0x9d0(%rsp), %xmm0
leaq 0x960(%rsp), %rdi
leaq 0x990(%rsp), %rsi
callq 0x2aac0
leaq 0x978(%rsp), %rdi
leaq 0x9a8(%rsp), %rsi
leaq 0x960(%rsp), %rdx
callq 0xcc050
leaq 0x978(%rsp), %rdi
callq 0x2a8e0
movl 0x9cc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x9cc(%rsp)
jmp 0x28020
callq 0x2a920
cmpl $0x0, 0x1d31cd(%rip)    # 0x1fb338
je 0x28258
movl $0xb50, %edi            # imm = 0xB50
callq 0x22230
xorl %edx, %edx
movl %edx, %edi
movl %edx, %esi
callq 0x2abe0
movl $0x0, 0x95c(%rsp)
movl 0x95c(%rsp), %eax
movl %eax, 0x60(%rsp)
movq 0xab8(%rsp), %rdi
callq 0x2a7c0
movl %eax, %ecx
movl 0x60(%rsp), %eax
cmpl %ecx, %eax
jge 0x28256
movq 0xab8(%rsp), %rdi
movl 0x95c(%rsp), %esi
callq 0x2a7e0
movq %rax, 0x950(%rsp)
leaq 0x850(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0xab8(%rsp), %rdi
movq 0x950(%rsp), %rsi
callq 0x2ac10
movq 0x58(%rsp), %rdi
movl %eax, %edx
leaq 0x16bb67(%rip), %rsi    # 0x193d6a
movb $0x0, %al
callq 0x22160
movq 0xab8(%rsp), %rsi
movq 0x950(%rsp), %rdx
leaq 0x838(%rsp), %rdi
callq 0x7e0f0
leaq 0x850(%rsp), %rsi
leaq 0x838(%rsp), %rdi
xorl %eax, %eax
movl %eax, %edx
callq 0x2ac30
movl 0x95c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x95c(%rsp)
jmp 0x28191
jmp 0x28258
cmpl $0x0, 0x1d30dd(%rip)    # 0x1fb33c
je 0x28354
movl $0xb50, %edi            # imm = 0xB50
callq 0x22230
movsd 0x164da9(%rip), %xmm0   # 0x18d020
xorps %xmm2, %xmm2
movaps %xmm2, %xmm1
callq 0x2a950
movl $0x0, 0x834(%rsp)
movl 0x834(%rsp), %eax
movl %eax, 0x54(%rsp)
movq 0xab8(%rsp), %rdi
callq 0x2a9c0
movl %eax, %ecx
movl 0x54(%rsp), %eax
cmpl %ecx, %eax
jge 0x28352
movq 0xab8(%rsp), %rdi
movl 0x834(%rsp), %esi
callq 0x2a9e0
movq %rax, 0x828(%rsp)
leaq 0x720(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0xab8(%rsp), %rdi
movq 0x828(%rsp), %rsi
callq 0x2ac90
movq 0x48(%rsp), %rdi
movl %eax, %edx
leaq 0x16ba6b(%rip), %rsi    # 0x193d6a
movb $0x0, %al
callq 0x22160
movq 0xab8(%rsp), %rsi
movq 0x828(%rsp), %rdx
leaq 0x708(%rsp), %rdi
callq 0x2acb0
leaq 0x720(%rsp), %rsi
leaq 0x708(%rsp), %rdi
xorl %eax, %eax
movl %eax, %edx
callq 0x2ac30
movl 0x834(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x834(%rsp)
jmp 0x2828d
jmp 0x28354
cmpl $0x0, 0x1d2fe5(%rip)    # 0x1fb340
je 0x28515
movl $0xb50, %edi            # imm = 0xB50
callq 0x22230
movsd 0x164cb5(%rip), %xmm0   # 0x18d028
movsd 0x164cb5(%rip), %xmm1   # 0x18d030
movsd 0x164cdd(%rip), %xmm2   # 0x18d060
callq 0x2a950
movq 0xab8(%rsp), %rdi
callq 0x2aa70
movq %rax, %rdi
callq 0x2ad20
movaps %xmm0, %xmm1
movsd 0x164cb0(%rip), %xmm0   # 0x18d058
mulsd %xmm1, %xmm0
movsd %xmm0, 0x700(%rsp)
movl $0x0, 0x6fc(%rsp)
movl 0x6fc(%rsp), %eax
movl %eax, 0x44(%rsp)
movq 0xab8(%rsp), %rdi
callq 0x2ab00
movl %eax, %ecx
movl 0x44(%rsp), %eax
cmpl %ecx, %eax
jge 0x28513
movq 0xab8(%rsp), %rdi
movl 0x6fc(%rsp), %esi
callq 0x2ab20
movq %rax, 0x6f0(%rsp)
movq 0xab8(%rsp), %rdi
movq 0x6f0(%rsp), %rsi
callq 0x2a900
movq %rax, %rsi
leaq 0x6d8(%rsp), %rdi
callq 0xcbad0
movq 0xab8(%rsp), %rdi
movq 0x6f0(%rsp), %rsi
callq 0x2ab50
movq %rax, %rsi
leaq 0x6c0(%rsp), %rdi
callq 0xccc30
leaq 0x5c0(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0xab8(%rsp), %rdi
movq 0x6f0(%rsp), %rsi
callq 0x2ad40
movq 0x38(%rsp), %rdi
movl %eax, %edx
leaq 0x16b8ee(%rip), %rsi    # 0x193d6a
movb $0x0, %al
callq 0x22160
cmpl $0x0, 0x1d2e96(%rip)    # 0x1fb320
je 0x284a9
movq 0xab8(%rsp), %rdi
movq 0x6f0(%rsp), %rsi
callq 0x2abc0
movq %rax, %rdi
callq 0x2a810
movsd 0x700(%rsp), %xmm0
leaq 0x590(%rsp), %rdi
leaq 0x6c0(%rsp), %rsi
callq 0x2aac0
leaq 0x5a8(%rsp), %rdi
leaq 0x6d8(%rsp), %rsi
leaq 0x590(%rsp), %rdx
callq 0xcc050
leaq 0x5c0(%rsp), %rsi
leaq 0x5a8(%rsp), %rdi
xorl %eax, %eax
movl %eax, %edx
callq 0x2ac30
movl 0x6fc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x6fc(%rsp)
jmp 0x283c0
jmp 0x28515
cmpl $0x0, 0x1d2e28(%rip)    # 0x1fb344
je 0x2860c
movl $0xb50, %edi            # imm = 0xB50
callq 0x22230
xorl %esi, %esi
movl $0x1, %edx
movl %esi, %edi
callq 0x2abe0
movl $0x0, 0x58c(%rsp)
movl 0x58c(%rsp), %eax
movl %eax, 0x34(%rsp)
movq 0xab8(%rsp), %rdi
callq 0x2a7c0
movl %eax, %ecx
movl 0x34(%rsp), %eax
cmpl %ecx, %eax
jge 0x2860a
movq 0xab8(%rsp), %rdi
movl 0x58c(%rsp), %esi
callq 0x2a7e0
movq %rax, 0x580(%rsp)
leaq 0x480(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0xab8(%rsp), %rdi
movq 0x580(%rsp), %rsi
callq 0x2a860
movq 0x28(%rsp), %rdi
movl %eax, %edx
leaq 0x16b7b3(%rip), %rsi    # 0x193d6a
movb $0x0, %al
callq 0x22160
movq 0xab8(%rsp), %rsi
movq 0x580(%rsp), %rdx
leaq 0x468(%rsp), %rdi
callq 0x7e0f0
leaq 0x480(%rsp), %rsi
leaq 0x468(%rsp), %rdi
xorl %eax, %eax
movl %eax, %edx
callq 0x2ac30
movl 0x58c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x58c(%rsp)
jmp 0x28545
jmp 0x2860c
cmpl $0x0, 0x1d2d35(%rip)    # 0x1fb348
je 0x28703
movl $0xb50, %edi            # imm = 0xB50
callq 0x22230
xorl %esi, %esi
movl $0x1, %edx
movl %esi, %edi
callq 0x2abe0
movl $0x0, 0x464(%rsp)
movl 0x464(%rsp), %eax
movl %eax, 0x24(%rsp)
movq 0xab8(%rsp), %rdi
callq 0x2a7c0
movl %eax, %ecx
movl 0x24(%rsp), %eax
cmpl %ecx, %eax
jge 0x28701
movq 0xab8(%rsp), %rdi
movl 0x464(%rsp), %esi
callq 0x2a7e0
movq %rax, 0x458(%rsp)
leaq 0x350(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0xab8(%rsp), %rdi
movq 0x458(%rsp), %rsi
callq 0x2a880
movq 0x18(%rsp), %rdi
movl %eax, %edx
leaq 0x16b6bc(%rip), %rsi    # 0x193d6a
movb $0x0, %al
callq 0x22160
movq 0xab8(%rsp), %rsi
movq 0x458(%rsp), %rdx
leaq 0x338(%rsp), %rdi
callq 0x7e0f0
leaq 0x350(%rsp), %rsi
leaq 0x338(%rsp), %rdi
xorl %eax, %eax
movl %eax, %edx
callq 0x2ac30
movl 0x464(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x464(%rsp)
jmp 0x2863c
jmp 0x28703
cmpl $0x0, 0x1d2c42(%rip)    # 0x1fb34c
je 0x287fa
movl $0xb50, %edi            # imm = 0xB50
callq 0x22230
xorl %esi, %esi
movl $0x1, %edx
movl %esi, %edi
callq 0x2abe0
movl $0x0, 0x334(%rsp)
movl 0x334(%rsp), %eax
movl %eax, 0x14(%rsp)
movq 0xab8(%rsp), %rdi
callq 0x2a7c0
movl %eax, %ecx
movl 0x14(%rsp), %eax
cmpl %ecx, %eax
jge 0x287f8
movq 0xab8(%rsp), %rdi
movl 0x334(%rsp), %esi
callq 0x2a7e0
movq %rax, 0x328(%rsp)
leaq 0x220(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0xab8(%rsp), %rdi
movq 0x328(%rsp), %rsi
callq 0x2a8a0
movq 0x8(%rsp), %rdi
movl %eax, %edx
leaq 0x16b5c5(%rip), %rsi    # 0x193d6a
movb $0x0, %al
callq 0x22160
movq 0xab8(%rsp), %rsi
movq 0x328(%rsp), %rdx
leaq 0x208(%rsp), %rdi
callq 0x7e0f0
leaq 0x220(%rsp), %rsi
leaq 0x208(%rsp), %rdi
xorl %eax, %eax
movl %eax, %edx
callq 0x2ac30
movl 0x334(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x334(%rsp)
jmp 0x28733
jmp 0x287fa
jmp 0x287fc
movl 0xac4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xac4(%rsp)
jmp 0x27979
cmpl $0x0, 0x1d2b37(%rip)    # 0x1fb350
je 0x288ec
movl $0xb50, %edi            # imm = 0xB50
callq 0x22900
movsd 0x1647e7(%rip), %xmm0   # 0x18d018
xorps %xmm2, %xmm2
movaps %xmm2, %xmm1
callq 0x2a950
leaq 0x1d23d5(%rip), %rdi    # 0x1fac18
xorl %esi, %esi
callq 0x2a780
movq (%rax), %rdi
callq 0x2aa70
movq %rax, %rdi
callq 0x2ad20
movsd 0x1647de(%rip), %xmm1   # 0x18d040
mulsd %xmm1, %xmm0
movsd %xmm0, 0x200(%rsp)
movsd 0x200(%rsp), %xmm0
leaq 0x1d23a9(%rip), %rsi    # 0x1fac28
leaq 0x1d8(%rsp), %rdi
callq 0xb1df0
leaq 0x1d0(%rsp), %rdi
movl $0x772, %esi            # imm = 0x772
callq 0x2a930
jmp 0x288a0
movq 0x1d0(%rsp), %rsi
leaq 0x1d8(%rsp), %rdi
callq 0x682f0
jmp 0x288b7
leaq 0x1d8(%rsp), %rdi
callq 0x2ad60
jmp 0x288ec
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1c8(%rsp)
movl %eax, 0x1c4(%rsp)
leaq 0x1d8(%rsp), %rdi
callq 0x2ad60
jmp 0x28bdb
cmpl $0x0, 0x1d2a61(%rip)    # 0x1fb354
je 0x28b48
leaq 0x1d2318(%rip), %rdi    # 0x1fac18
xorl %esi, %esi
callq 0x2a780
movq (%rax), %rdi
callq 0x2aa70
movq %rax, %rdi
callq 0x2ad20
movsd %xmm0, 0x1b8(%rsp)
movl $0xb50, %edi            # imm = 0xB50
callq 0x22230
movss 0x16475a(%rip), %xmm0   # 0x18d08c
callq 0x232f0
callq 0x2ad70
movl $0x1, %edi
xorl %edx, %edx
movl %edx, %esi
callq 0x2abe0
movsd 0x1646d6(%rip), %xmm0   # 0x18d028
mulsd 0x1b8(%rsp), %xmm0
leaq 0x188(%rsp), %rdi
leaq 0x1d603e(%rip), %rsi    # 0x1fe9a8
callq 0x2aac0
leaq 0x1a0(%rsp), %rdi
leaq 0x1d5ec2(%rip), %rsi    # 0x1fe840
leaq 0x188(%rsp), %rdx
callq 0xcc050
leaq 0x1a0(%rsp), %rdi
callq 0x2a8e0
movsd 0x1b8(%rsp), %xmm0
leaq 0x158(%rsp), %rdi
leaq 0x1d5fb0(%rip), %rsi    # 0x1fe960
callq 0x2aac0
leaq 0x170(%rsp), %rdi
leaq 0x1d5e7c(%rip), %rsi    # 0x1fe840
leaq 0x158(%rsp), %rdx
callq 0xcc050
leaq 0x170(%rsp), %rdi
callq 0x2a8e0
callq 0x2ad80
callq 0x2ad70
xorl %edx, %edx
movl $0x1, %esi
movl %edx, %edi
callq 0x2abe0
movsd 0x16462a(%rip), %xmm0   # 0x18d028
mulsd 0x1b8(%rsp), %xmm0
leaq 0x128(%rsp), %rdi
leaq 0x1d5faa(%rip), %rsi    # 0x1fe9c0
callq 0x2aac0
leaq 0x140(%rsp), %rdi
leaq 0x1d5e16(%rip), %rsi    # 0x1fe840
leaq 0x128(%rsp), %rdx
callq 0xcc050
leaq 0x140(%rsp), %rdi
callq 0x2a8e0
movsd 0x1b8(%rsp), %xmm0
leaq 0xf8(%rsp), %rdi
leaq 0x1d5f1c(%rip), %rsi    # 0x1fe978
callq 0x2aac0
leaq 0x110(%rsp), %rdi
leaq 0x1d5dd0(%rip), %rsi    # 0x1fe840
leaq 0xf8(%rsp), %rdx
callq 0xcc050
leaq 0x110(%rsp), %rdi
callq 0x2a8e0
callq 0x2ad80
callq 0x2ad70
xorl %esi, %esi
movl $0x1, %edx
movl %esi, %edi
callq 0x2abe0
movsd 0x16457e(%rip), %xmm0   # 0x18d028
mulsd 0x1b8(%rsp), %xmm0
leaq 0xc8(%rsp), %rdi
leaq 0x1d5f16(%rip), %rsi    # 0x1fe9d8
callq 0x2aac0
leaq 0xe0(%rsp), %rdi
leaq 0x1d5d6a(%rip), %rsi    # 0x1fe840
leaq 0xc8(%rsp), %rdx
callq 0xcc050
leaq 0xe0(%rsp), %rdi
callq 0x2a8e0
movsd 0x1b8(%rsp), %xmm0
leaq 0x98(%rsp), %rdi
leaq 0x1d5e88(%rip), %rsi    # 0x1fe990
callq 0x2aac0
leaq 0xb0(%rsp), %rdi
leaq 0x1d5d24(%rip), %rsi    # 0x1fe840
leaq 0x98(%rsp), %rdx
callq 0xcc050
leaq 0xb0(%rsp), %rdi
callq 0x2a8e0
callq 0x2ad80
movss 0x164545(%rip), %xmm0   # 0x18d088
callq 0x232f0
cmpq $0x0, 0x1d2808(%rip)    # 0x1fb358
je 0x28bce
movl 0x1cbf60(%rip), %esi    # 0x1f4ab8
movl 0x1cbf5e(%rip), %edx    # 0x1f4abc
leaq 0x80(%rsp), %rdi
movq %rdi, (%rsp)
movl $0x3, %ecx
callq 0xe4e80
movq (%rsp), %rdi
callq 0xe62a0
jmp 0x28b7f
movq 0x1d27d2(%rip), %rsi    # 0x1fb358
leaq 0x80(%rsp), %rdi
callq 0x2ad90
jmp 0x28b95
callq 0x278b0
jmp 0x28b9c
leaq 0x80(%rsp), %rdi
callq 0xe53a0
jmp 0x28bce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1c8(%rsp)
movl %eax, 0x1c4(%rsp)
leaq 0x80(%rsp), %rdi
callq 0xe53a0
jmp 0x28bdb
callq 0x179200
addq $0xac8, %rsp            # imm = 0xAC8
retq
movq 0x1c8(%rsp), %rdi
callq 0x23260
nopl (%rax,%rax)