// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVMesh.cpp
// Function: gaps::GSVMesh::LoadScan(gaps::GSVScan*, double, double)
int GSVMesh::
LoadScan(GSVScan *scan, 
  RNLength min_viewpoint_movement,
  RNLength max_depth_discontinuity)
{
  // Just checking
  if (!scan) return 0;
  if (scan->NScanlines() == 0) return 1;

  // Read points
  scan->ReadPoints();

  // Compute whether faces sould be flipped (clockwise)
  RNBoolean flip = (scan->SegmentIndex() == 2) ? 1 : 0;

  // Compute total number of vertices and length of scan viewpoint path
  int total_vertex_count = 0;
  RNScalar total_travel_distance = 0;
  R3Point prev_viewpoint = scan->Scanline(0)->Pose().Viewpoint();
  for (int ie = 0; ie < scan->NScanlines(); ie++) {
    GSVScanline *scanline = scan->Scanline(ie);
    const GSVPose& pose = scanline->Pose();
    const R3Point& viewpoint = pose.Viewpoint();
    RNLength movement = R3Distance(viewpoint, prev_viewpoint);
    total_travel_distance += movement;
    if (movement < min_viewpoint_movement) continue;
    prev_viewpoint = viewpoint;
    total_vertex_count += scanline->NPoints();
  }

  // Compute number of rows and columns
  if (total_travel_distance == 0) { scan->ReleasePoints(); return 1; }
  int ncols = (int) (total_travel_distance / min_viewpoint_movement + 0.5);
  if (ncols == 0) { scan->ReleasePoints(); return 1; }
  const int nrows = 180;
  int col = 0;

  // Allocate vertex data
  gsv_vertex_block = new GSVMeshVertex [ total_vertex_count ];
  if (!gsv_vertex_block) { 
    RNFail("Unable to allocate GSV Mesh vertex array\n"); 
    scan->ReleasePoints(); 
    return 0; 
  }

  // Initialize vertex buffer
  int buffer_index = 0;
  GSVMeshVertex *vertex_buffer[2][nrows];
  for (int k = 0; k < nrows; k++) {
    vertex_buffer[0][k] = NULL;
    vertex_buffer[1][k] = NULL;
  }

  // Create mesh
  int vertex_count = 0;
  prev_viewpoint = scan->Scanline(0)->Pose().Viewpoint();
  for (int ie = 0; ie < scan->NScanlines(); ie++) {
    GSVScanline *scanline = scan->Scanline(ie);
    const GSVPose& pose = scanline->Pose();
    const R3Point& viewpoint = pose.Viewpoint();
    RNLength movement = R3Distance(viewpoint, prev_viewpoint);
    if (movement < min_viewpoint_movement) continue;
    prev_viewpoint = viewpoint;
    const R3Vector& towards = pose.Towards();
    R3Vector up = pose.Up();

    // Initialize buffer of vertices in scanline indexed by row
    for (int k = 0; k < nrows; k++) {
      vertex_buffer[buffer_index][k] = NULL;
    }

    // Create vertices for scanline
    for (int j = 0; j < scanline->NPoints(); j++) {
      R3Point position = scanline->PointPosition(j);
      R3Vector v = position - viewpoint;
      RNLength distance = v.Length();
      if (RNIsZero(distance)) continue;
      v /= distance;
      RNScalar dot = v.Dot(towards);
      RNAngle angle = acos(dot);
      if (v.Dot(up) > 0) angle = RN_PI_OVER_TWO + angle;
      else angle = RN_PI_OVER_TWO - angle;
      int row = (int) (nrows * angle / RN_PI + 0.5);
      if ((row < 0) || (row >= nrows)) continue;
      if (vertex_buffer[buffer_index][row]) continue;
      assert(vertex_count < total_vertex_count);
      GSVMeshVertex *vertex = &gsv_vertex_block[vertex_count];
      vertex_buffer[buffer_index][row] = vertex;
      CreateVertex(position, vertex);
      vertex->scanline = scanline;
      vertex->point_index = j;
      vertex->boundary_type = GSV_MESH_NO_BOUNDARY;
      if (j == 0) vertex->boundary_type = GSV_MESH_BOTTOM_BOUNDARY;
      else if (j == (scanline->NPoints()-1)) vertex->boundary_type = GSV_MESH_TOP_BOUNDARY;
      else if (ie == 0) vertex->boundary_type = GSV_MESH_LEFT_BOUNDARY;
      else if (ie == (scan->NScanlines()-1)) vertex->boundary_type = GSV_MESH_RIGHT_BOUNDARY;
      vertex_count++;
    }

    // Create faces between this and previous scanline
    if (col > 0) {
      int row0 = 0;
      int row1 = 0;
      while ((row0 < nrows) && (!vertex_buffer[1-buffer_index][row0])) row0++;
      while ((row1 < nrows) && (!vertex_buffer[buffer_index][row1])) row1++;
      if ((row0 < nrows) && (row1 < nrows)) {
        GSVMeshVertex *vertex0 = vertex_buffer[1-buffer_index][row0];
        GSVMeshVertex *vertex1 = vertex_buffer[buffer_index][row1];
        while ((row0 < nrows-1) || (row1 < nrows-1)) {
          // Get next vertex
          int row = 0;
          GSVMeshVertex *vertex = NULL;
          if (row0 < row1) {
            row0++;
            vertex = vertex_buffer[1-buffer_index][row0];
            row = 0;
          }
          else {
            row1++;
            vertex = vertex_buffer[buffer_index][row1];
            row = 1;
          }

          // Check vertex
          if (vertex && vertex0 && vertex1) {
            // Mark vertex types
            RNBoolean curtain = FALSE;
            RNLength depth = VertexLaserDepth(vertex);
            RNLength depth0 = VertexLaserDepth(vertex0);
            RNLength depth1 = VertexLaserDepth(vertex1);
            if (max_depth_discontinuity > 0) {
              const R3Point& position0 = VertexPosition(vertex0);
              const R3Point& position1 = VertexPosition(vertex1);
              R3Vector normal_vector0 = VertexNormal(vertex0);
              R3Vector normal_vector1 = VertexNormal(vertex1);
              R3Vector normal_vector = 0.5 * (normal_vector0 + normal_vector1);
              normal_vector.Normalize();
              R3Vector laser_vector0 = VertexLaserViewpoint(vertex0) - position0;
              laser_vector0.Normalize();
              R3Vector laser_vector1 = VertexLaserViewpoint(vertex1)- position1;
              laser_vector1.Normalize();
              R3Vector laser_vector = 0.5 * (laser_vector0 + laser_vector1);
              laser_vector.Normalize();
              RNScalar dot = fabs(laser_vector.Dot(normal_vector));
              if (dot < 0.5) dot = 0.5;
              RNLength max_depth_diff = max_depth_discontinuity / dot;
              if (depth - depth0 > max_depth_diff) {
                vertex0->boundary_type = GSV_MESH_SILHOUETTE_BOUNDARY;
                vertex->boundary_type = GSV_MESH_SHADOW_BOUNDARY;
                curtain = TRUE;
              }
              else if (depth0 - depth > max_depth_diff) {
                vertex->boundary_type = GSV_MESH_SILHOUETTE_BOUNDARY;
                vertex0->boundary_type = GSV_MESH_SHADOW_BOUNDARY;
                curtain = TRUE;
              }
              if (depth - depth1 > max_depth_diff) {
                vertex1->boundary_type = GSV_MESH_SILHOUETTE_BOUNDARY;
                vertex->boundary_type = GSV_MESH_SHADOW_BOUNDARY;
                curtain = TRUE;
              }
              else if (depth1 - depth > max_depth_diff) {
                vertex->boundary_type = GSV_MESH_SILHOUETTE_BOUNDARY;
                vertex1->boundary_type = GSV_MESH_SHADOW_BOUNDARY;
                curtain = TRUE;
              }
            }
            
            // Create face
            if (!curtain) {
              R3MeshFace *face = NULL;
              if (flip) face = CreateFace(vertex0, vertex, vertex1);
              else face = CreateFace(vertex0, vertex1, vertex);
              if (face) SetFaceSegment(face, 1);
            }
          }
          
          // Update stuff for next triangle
          if (vertex) {
            if (row == 0) vertex0 = vertex;
            else vertex1 = vertex;
          }
        }
      }
    }

    // Update stuff for next scanline
    buffer_index = 1 - buffer_index;
    col++;
  }

  // Release points
  scan->ReleasePoints(); 

  // Return success
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xce8, %rsp            # imm = 0xCE8
movsd %xmm1, 0x70(%rsp)
movsd %xmm0, 0x58(%rsp)
testq %rsi, %rsi
je 0x43084
movq %rsi, %r13
movq %rdi, 0x10(%rsp)
movl $0x1, %ebx
cmpl $0x0, 0x34(%rsi)
je 0x43086
movq %r13, %rdi
callq 0x40188
movq %r13, %rdi
callq 0x3f79a
movl %eax, 0x64(%rsp)
movq 0x28(%r13), %rax
movq (%rax), %rsi
addq $0x40, %rsi
leaq 0xb0(%rsp), %rdi
callq 0xd43ee
cmpl $0x0, 0x34(%r13)
jle 0x4307a
xorpd %xmm1, %xmm1
xorl %r14d, %r14d
leaq 0xb0(%rsp), %rbx
xorl %ebp, %ebp
movsd %xmm1, 0x20(%rsp)
movq 0x28(%r13), %rax
movq (%rax,%r14,8), %r12
leaq 0x40(%r12), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x9c174
movapd %xmm0, %xmm2
movsd 0x58(%rsp), %xmm0
ucomisd %xmm2, %xmm0
ja 0x43053
movq %rbx, %rdi
movq %r15, %rsi
movsd %xmm2, 0x50(%rsp)
callq 0xd4746
movsd 0x50(%rsp), %xmm2
addl 0x30(%r12), %ebp
movsd 0x20(%rsp), %xmm1
addsd %xmm2, %xmm1
incq %r14
movslq 0x34(%r13), %rax
cmpq %rax, %r14
jl 0x43009
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
movl $0x1, %ebx
jne 0x4309a
jp 0x4309a
movq %r13, %rdi
callq 0x40262
jmp 0x43086
xorl %ebx, %ebx
movl %ebx, %eax
addq $0xce8, %rsp            # imm = 0xCE8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
divsd 0x58(%rsp), %xmm1
addsd 0x108f68(%rip), %xmm1   # 0x14c010
cvttsd2si %xmm1, %eax
testl %eax, %eax
je 0x4307a
movq %r13, 0x40(%rsp)
movslq %ebp, %r12
movl $0xa8, %ecx
movq %r12, %rax
mulq %rcx
movq %rax, %rbx
seto %al
addq $0x8, %rbx
movq $-0x1, %rcx
cmovbq %rcx, %rbx
testb %al, %al
cmovneq %rcx, %rbx
movq %rbx, %rdi
callq 0x27040
movq %r12, (%rax)
movq %rax, 0x20(%rsp)
leaq 0x8(%rax), %r14
testl %r12d, %r12d
je 0x4313b
imulq $0xa8, %r12, %r13
xorl %r12d, %r12d
leaq 0x189d68(%rip), %rbp    # 0x1cce70
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
leaq (%r14,%r12), %rdi
callq 0xb31d6
movq %rbp, (%r14,%r12)
movq $0x0, 0x98(%r14,%r12)
movq %r15, 0xa0(%r14,%r12)
addq $0xa8, %r12
cmpq %r12, %r13
jne 0x4310e
movq 0x10(%rsp), %rax
movq %r14, 0x138(%rax)
leaq 0x1a0(%rsp), %rdi
movq $0x0, 0x48(%rsp)
movl $0xb40, %edx            # imm = 0xB40
xorl %esi, %esi
callq 0x274b0
movq 0x40(%rsp), %r13
movq 0x28(%r13), %rax
movq (%rax), %rsi
addq $0x40, %rsi
leaq 0xb0(%rsp), %rdi
callq 0xd4746
cmpl $0x0, 0x34(%r13)
jle 0x438a8
leaq 0x115175(%rip), %rax    # 0x158308
movsd (%rax), %xmm0
movsd %xmm0, 0x50(%rsp)
leaq 0x115154(%rip), %rax    # 0x1582f8
movsd (%rax), %xmm0
movsd %xmm0, 0xa8(%rsp)
leaq 0xb0(%rsp), %rbx
xorl %r14d, %r14d
movl $0x0, 0x8(%rsp)
movl $0x0, 0x1c(%rsp)
movq 0x28(%r13), %rax
movq (%rax,%r14,8), %r12
leaq 0x40(%r12), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x9c174
movsd 0x58(%rsp), %xmm1
ucomisd %xmm0, %xmm1
ja 0x43898
movq %r14, 0x68(%rsp)
leaq 0x38(%r12), %r13
movq %rbx, %rdi
movq %r15, %rsi
callq 0xd4746
leaq 0x188(%rsp), %rdi
movq %r13, %rsi
callq 0x450fa
leaq 0x170(%rsp), %rdi
movq %r13, %rsi
callq 0x45140
movl 0x8(%rsp), %eax
movq %rax, 0xa0(%rsp)
imulq $0x5a0, %rax, %rax      # imm = 0x5A0
leaq (%rsp,%rax), %rdi
addq $0x1a0, %rdi            # imm = 0x1A0
movl $0x5a0, %edx            # imm = 0x5A0
movq %rdi, 0x38(%rsp)
xorl %esi, %esi
callq 0x274b0
cmpl $0x0, 0x30(%r12)
jle 0x43438
xorl %r14d, %r14d
xorl %ebx, %ebx
movq 0x28(%r12), %rax
movsd (%rax,%r14), %xmm0
movsd 0x8(%rax,%r14), %xmm1
movsd 0x10(%rax,%r14), %xmm2
leaq 0xe0(%rsp), %r13
movq %r13, %rdi
callq 0xd43de
leaq 0x128(%rsp), %rbp
movq %rbp, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0xd463a
movq %rbp, %rdi
callq 0xd4f78
leaq 0x1931a1(%rip), %rax    # 0x1d6458
movsd (%rax), %xmm1
movapd %xmm1, %xmm2
xorpd 0x1099f9(%rip), %xmm2   # 0x14ccc0
ucomisd %xmm2, %xmm0
jb 0x432d7
ucomisd %xmm0, %xmm1
jae 0x43423
leaq 0x128(%rsp), %r13
movq %r13, %rdi
callq 0xd5a44
movq %r13, %rdi
leaq 0x188(%rsp), %rsi
callq 0xd50fe
callq 0x278b0
movapd %xmm0, 0x20(%rsp)
movq %r13, %rdi
leaq 0x170(%rsp), %rsi
callq 0xd50fe
xorpd %xmm1, %xmm1
cmpltsd %xmm0, %xmm1
movapd %xmm1, %xmm0
movapd 0x20(%rsp), %xmm2
andpd %xmm2, %xmm0
xorpd 0x10998f(%rip), %xmm2   # 0x14ccc0
andnpd %xmm2, %xmm1
orpd %xmm0, %xmm1
addsd 0x50(%rsp), %xmm1
mulsd 0x109969(%rip), %xmm1   # 0x14ccb0
divsd 0xa8(%rsp), %xmm1
addsd 0x108cb8(%rip), %xmm1   # 0x14c010
cvttsd2si %xmm1, %eax
cmpl $0xb3, %eax
ja 0x43423
movl %eax, %eax
movq 0x38(%rsp), %rcx
cmpq $0x0, (%rcx,%rax,8)
jne 0x43423
leaq (%rcx,%rax,8), %rax
movq 0x10(%rsp), %rdi
movq 0x138(%rdi), %r13
movslq 0x1c(%rsp), %rcx
imulq $0xa8, %rcx, %rbp
movq %r13, %rdx
addq %rbp, %rdx
movq %rdx, (%rax)
movq (%rdi), %rax
leaq 0xe0(%rsp), %rsi
movq %rdx, 0x20(%rsp)
callq *0x20(%rax)
movq %r12, 0x98(%r13,%rbp)
movl %ebx, 0xa0(%r13,%rbp)
movl $0x0, 0xa4(%r13,%rbp)
testq %rbx, %rbx
je 0x433fe
movq 0x68(%rsp), %rsi
testq %rsi, %rsi
sete %dl
movl 0x30(%r12), %ecx
decl %ecx
xorl %eax, %eax
cmpq %rcx, %rbx
sete %cl
orb %cl, %dl
movq 0x40(%rsp), %rdx
je 0x43405
movb %cl, %al
leal (%rax,%rax,2), %eax
incl %eax
jmp 0x43414
movl $0x3, %eax
jmp 0x43414
movl 0x34(%rdx), %ecx
decl %ecx
movl $0x2, %eax
cmpq %rcx, %rsi
jne 0x4341f
movq 0x20(%rsp), %rcx
movl %eax, 0xa4(%rcx)
incl 0x1c(%rsp)
incq %rbx
movslq 0x30(%r12), %rax
addq $0x50, %r14
cmpq %rax, %rbx
jl 0x43269
movl $0x1, %ebx
subl 0x8(%rsp), %ebx
cmpl $0x0, 0x48(%rsp)
movq 0x38(%rsp), %rsi
jle 0x43876
movl %ebx, %eax
movq %rax, 0x90(%rsp)
imulq $0x5a0, %rax, %rax      # imm = 0x5A0
cmpq $0x0, 0x1a0(%rsp,%rax)
je 0x43474
movb $0x1, %cl
xorl %r12d, %r12d
jmp 0x434b2
leaq 0x1a8(%rsp), %rcx
addq %rax, %rcx
xorl %edx, %edx
cmpq $0xb3, %rdx
je 0x434a9
leaq 0x1(%rdx), %r12
cmpq $0x0, (%rcx,%rdx,8)
movq %r12, %rdx
je 0x43481
leaq -0x1(%r12), %rcx
cmpq $0xb3, %rcx
setb %cl
jmp 0x434b2
setb %cl
movl $0xb4, %r12d
xorl %r14d, %r14d
cmpq $0x0, (%rsi,%r14,8)
jne 0x434cd
incq %r14
cmpq $0xb4, %r14
jne 0x434b5
jmp 0x43876
testb %cl, %cl
je 0x43876
cmpl $0xb3, %r12d
setge %cl
cmpq $0xb3, %r14
setae %dl
testb %dl, %cl
jne 0x43876
movq (%rsi,%r14,8), %rcx
movl %r12d, %edx
addq %rsp, %rax
addq $0x1a0, %rax            # imm = 0x1A0
movq (%rax,%rdx,8), %rax
movl %ebx, 0x60(%rsp)
movq %rax, %rbp
movq %rcx, %r13
cmpl %r14d, %r12d
movq %r12, 0x20(%rsp)
movq %r14, 0x38(%rsp)
jge 0x43530
leal 0x1(%r12), %eax
movq 0x90(%rsp), %rcx
movl %eax, %r12d
jmp 0x4353f
leal 0x1(%r14), %eax
movq 0xa0(%rsp), %rcx
movl %eax, %r14d
cltq
imulq $0x5a0, %rcx, %rcx      # imm = 0x5A0
addq %rsp, %rcx
addq $0x1a0, %rcx            # imm = 0x1A0
movq (%rcx,%rax,8), %r15
testq %r15, %r15
je 0x43837
testq %rbp, %rbp
je 0x43837
testq %r13, %r13
je 0x43837
movq %r15, %rsi
callq 0x42e52
movsd %xmm0, 0x8(%rsp)
movq %rbp, %rsi
callq 0x42e52
movsd %xmm0, 0x98(%rsp)
movq %r13, %rsi
callq 0x42e52
movapd %xmm0, %xmm1
movsd 0x70(%rsp), %xmm0
ucomisd 0x108a96(%rip), %xmm0   # 0x14c040
jbe 0x437fc
movsd %xmm1, 0x88(%rsp)
testb $0x2, 0x78(%rbp)
jne 0x435d0
movq 0x10(%rsp), %rdi
movq (%rdi), %rax
movq %rbp, %rsi
callq *0x2b0(%rax)
leaq 0x30(%rbp), %rsi
leaq 0xe0(%rsp), %rdi
callq 0xd4e82
testb $0x2, 0x78(%r13)
jne 0x435f9
movq 0x10(%rsp), %rdi
movq (%rdi), %rax
movq %r13, %rsi
callq *0x2b0(%rax)
leaq 0x18(%rbp), %rax
movq %rax, 0x78(%rsp)
leaq 0x18(%r13), %rax
movq %rax, 0x80(%rsp)
leaq 0x30(%r13), %rsi
leaq 0x128(%rsp), %rbx
movq %rbx, %rdi
callq 0xd4e82
leaq 0xc8(%rsp), %rdi
leaq 0xe0(%rsp), %rsi
movq %rbx, %rdx
callq 0xd5acc
leaq 0x158(%rsp), %rbx
movq %rbx, %rdi
leaq 0xc8(%rsp), %rsi
movsd 0x1089bb(%rip), %xmm0   # 0x14c010
callq 0xd580e
movq %rbx, %rdi
callq 0xd5188
movq 0x98(%rbp), %rax
leaq 0x40(%rax), %rsi
testq %rax, %rax
leaq 0x59bfc9(%rip), %rax    # 0x5df640
cmoveq %rax, %rsi
leaq 0x110(%rsp), %rdi
callq 0xd43ee
leaq 0xc8(%rsp), %rbx
movq %rbx, %rdi
leaq 0x110(%rsp), %rsi
movq 0x78(%rsp), %rdx
callq 0xd463a
movq %rbx, %rdi
callq 0xd5188
movq 0x98(%r13), %rax
leaq 0x40(%rax), %rsi
testq %rax, %rax
cmoveq 0x1918bd(%rip), %rsi    # 0x1d4f80
leaq 0xf8(%rsp), %rdi
callq 0xd43ee
leaq 0x110(%rsp), %rbx
movq %rbx, %rdi
leaq 0xf8(%rsp), %rsi
movq 0x80(%rsp), %rdx
callq 0xd463a
movq %rbx, %rdi
callq 0xd5188
leaq 0x140(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
movq %rbx, %rdx
callq 0xd5acc
leaq 0xf8(%rsp), %rbx
movq %rbx, %rdi
leaq 0x140(%rsp), %rsi
movsd 0x1088e5(%rip), %xmm0   # 0x14c010
callq 0xd580e
movq %rbx, %rdi
callq 0xd5188
movq %rbx, %rdi
leaq 0x158(%rsp), %rsi
callq 0xd50fe
andpd 0x109770(%rip), %xmm0   # 0x14cec0
movsd 0x1088b8(%rip), %xmm1   # 0x14c010
maxsd %xmm0, %xmm1
movsd 0x70(%rsp), %xmm0
divsd %xmm1, %xmm0
movsd 0x8(%rsp), %xmm2
movapd %xmm2, %xmm1
movsd 0x98(%rsp), %xmm3
subsd %xmm3, %xmm1
ucomisd %xmm0, %xmm1
movq %rbp, %rcx
movq %r15, %rdx
ja 0x4379b
subsd %xmm2, %xmm3
movb $0x1, %al
ucomisd %xmm0, %xmm3
movq %r15, %rcx
movq %rbp, %rdx
jbe 0x437b1
movl $0x6, 0xa4(%rcx)
movl $0x5, 0xa4(%rdx)
xorl %eax, %eax
movapd %xmm2, %xmm1
movsd 0x88(%rsp), %xmm3
subsd %xmm3, %xmm1
ucomisd %xmm0, %xmm1
movq %r13, %rcx
movq %r15, %rdx
movl 0x60(%rsp), %ebx
ja 0x437e2
subsd %xmm2, %xmm3
ucomisd %xmm0, %xmm3
movq %r15, %rcx
movq %r13, %rdx
jbe 0x437f8
movl $0x6, 0xa4(%rcx)
movl $0x5, 0xa4(%rdx)
jmp 0x43837
testb %al, %al
je 0x43837
movq 0x10(%rsp), %rdi
movq (%rdi), %rax
movq 0x48(%rax), %rax
cmpl $0x2, 0x64(%rsp)
jne 0x4381a
movq %rbp, %rsi
movq %r15, %rdx
movq %r13, %rcx
jmp 0x43823
movq %rbp, %rsi
movq %r13, %rdx
movq %r15, %rcx
xorl %r8d, %r8d
callq *%rax
testq %rax, %rax
je 0x43837
movl $0x1, 0x9c(%rax)
testq %r15, %r15
movq %rbp, %rax
cmovneq %r15, %rax
movq 0x38(%rsp), %rcx
cmpl %ecx, 0x20(%rsp)
movq %r15, %rcx
cmovlq %r13, %rcx
cmovgeq %rbp, %rax
testq %r15, %r15
cmoveq %r13, %rcx
cmpl $0xb3, %r12d
jl 0x43509
cmpl $0xb3, %r14d
jl 0x43509
movq 0x48(%rsp), %rax
incl %eax
movq %rax, 0x48(%rsp)
movl %ebx, 0x8(%rsp)
leaq 0xb0(%rsp), %rbx
movq 0x68(%rsp), %r14
movq 0x40(%rsp), %r13
incq %r14
movslq 0x34(%r13), %rax
cmpq %rax, %r14
jl 0x431cc
movq %r13, %rdi
callq 0x40262
movl $0x1, %ebx
jmp 0x43086
movq %rax, %r14
testq %r12, %r12
je 0x438e0
movq 0x20(%rsp), %r15
addq $-0xa0, %r15
leaq (%r15,%r12), %rdi
callq 0xb3276
addq $-0xa8, %r12
jne 0x438ce
movq 0x20(%rsp), %rdi
movq %rbx, %rsi
callq 0x28330
movq %r14, %rdi
callq 0x28150
nop