// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelScene.cpp
// Function: gaps::R3SurfelScene::InsertScene(gaps::R3SurfelScene const&, gaps::R3SurfelObject*, gaps::R3SurfelLabel*, gaps::R3SurfelNode*)
void R3SurfelScene::
InsertScene(const R3SurfelScene& scene2, 
  R3SurfelObject *parent_object1, 
  R3SurfelLabel *parent_label1,
  R3SurfelNode *parent_node1)
{
  // Get convenient variables
  R3SurfelScene& scene1 = *this;
  R3SurfelTree *tree1 = scene1.Tree();
  R3SurfelTree *tree2 = scene2.Tree();
  R3SurfelDatabase *database1 = tree1->Database();
  R3SurfelDatabase *database2 = tree2->Database();

  // Find parents in scene1
  if (!parent_node1) parent_node1 = tree1->RootNode();
  if (!parent_object1) parent_object1 = scene1.RootObject();
  if (!parent_label1) parent_label1 = scene1.RootLabel();

 // COPY COMMENTS

  // Copy comments from scene2
  for (int i = 0; i < scene2.NComments(); i++) {
    const char *comment2 = scene2.Comment(i);
    scene1.InsertComment(comment2);
  }

 // COPY FEATURES

#if 0
  // Copy label features from scene2
  for (int i = 0; i < scene2.NFeatures(); i++) {
    R3SurfelFeature *feature2 = scene2.Feature(i);
    R3SurfelFeature *feature1 = new R3SurfelFeature(feature2->Name(), feature2->Minimum(), feature2->Maximum());
    scene1.InsertFeature(feature1);
  }
#endif

  // COPY NODES

  // Create surfel tree nodes in scene1
  RNArray<R3SurfelNode *> nodes1;
  nodes1.Insert(tree1->RootNode());
  for (int i = 1; i < tree2->NNodes(); i++) {
    R3SurfelNode *node1 = new R3SurfelNode();
    nodes1.Insert(node1);
  }

  // Copy node stuff from scene2
  for (int i = 1; i < tree2->NNodes(); i++) {
    R3SurfelNode *node1 = nodes1.Kth(i);
    R3SurfelNode *node2 = tree2->Node(i);
    R3SurfelNode *parent2 = node2->Parent();
    R3SurfelNode *parent1 = parent_node1;
    if (parent2 && (!parent2->Name() || strcmp(parent2->Name(), "Root")))
      parent1 = nodes1.Kth(parent2->TreeIndex());
    tree1->InsertNode(node1, parent1);
    node1->SetName(node2->Name());
    for (int j = 0; j < node2->NBlocks(); j++) {
      R3SurfelBlock *block2 = node2->Block(j);
      database2->ReadBlock(block2);
      R3SurfelBlock *block1 = new R3SurfelBlock(*block2);
      database1->InsertBlock(block1);
      node1->InsertBlock(block1);
      database1->ReleaseBlock(block1);
      database2->ReleaseBlock(block2);
    }      
  }

  // COPY OBJECTS

  // Create objects in scene1
  RNArray<R3SurfelObject *> objects1;
  objects1.Insert(scene1.RootObject());
  for (int i = 1; i < scene2.NObjects(); i++) {
    R3SurfelObject *object1 = new R3SurfelObject();
    objects1.Insert(object1);
  }

  // Copy object stuff from scene2
  for (int i = 1; i < scene2.NObjects(); i++) {
    R3SurfelObject *object1 = objects1.Kth(i);
    R3SurfelObject *object2 = scene2.Object(i);
    R3SurfelObject *parent2 = object2->Parent();
    R3SurfelObject *parent1 = parent_object1;
    if (parent2 && (!parent2->Name() || strcmp(parent2->Name(), "Root")))
      parent1 = objects1.Kth(parent2->SceneIndex());
    scene1.InsertObject(object1, parent1);
    object1->SetName(object2->Name());
    object1->SetIdentifier(object2->Identifier());
    object1->SetFeatureVector(object2->feature_vector);
    for (int j = 0; j < object2->NNodes(); j++) {
      R3SurfelNode *node2 = object2->Node(j);
      R3SurfelNode *node1 = nodes1.Kth(node2->TreeIndex());
      object1->InsertNode(node1);
    }
  }

  // COPY LABELS 

  // Create labels in scene1
  RNArray<R3SurfelLabel *> labels1;
  labels1.Insert(scene1.RootLabel());
  for (int i = 1; i < scene2.NLabels(); i++) {
    R3SurfelLabel *label1 = new R3SurfelLabel();
    labels1.Insert(label1);
  }

  // Copy label stuff from scene2
  for (int i = 1; i < scene2.NLabels(); i++) {
    R3SurfelLabel *label1 = labels1.Kth(i);
    R3SurfelLabel *label2 = scene2.Label(i);
    R3SurfelLabel *parent2 = label2->Parent();
    R3SurfelLabel *parent1 = parent_label1;
    if (parent2 && (!parent2->Name() || strcmp(parent2->Name(), "Root")))
      parent1 = labels1.Kth(parent2->SceneIndex());
    label1->SetName(label2->Name());
    label1->SetIdentifier(label2->Identifier());
    label1->SetAssignmentKeystroke(label2->AssignmentKeystroke());
    label1->SetColor(label2->Color());
    label1->SetFlags(label2->Flags());
    scene1.InsertLabel(label1, parent1);
  }

  // COPY OBJECT PROPERTIES

  // Copy object properties from scene2
  for (int i = 0; i < scene2.NObjectProperties(); i++) {
    R3SurfelObjectProperty *property2 = scene2.ObjectProperty(i);
    int type = property2->Type();
    RNArray<R3SurfelObject *> objects1;
    R3SurfelObject *object2 = property2->Object();
    R3SurfelObject *object1 = objects1.Kth(object2->SceneIndex());
    objects1.Insert(object1);
    int noperands1 = 0;
    RNScalar *operands1 = NULL;
    if (property2->NOperands() > 0) {
      noperands1 = property2->NOperands();
      operands1 = new RNScalar [ noperands1 ];
      for (int j = 0; j < noperands1; j++) {
        RNScalar operand2 = property2->Operand(j);
        operands1[j] = operand2;
      }
    }
    R3SurfelObjectProperty *property1 = new R3SurfelObjectProperty(type, object1, operands1, noperands1);
    scene1.InsertObjectProperty(property1);
    delete [] operands1;
  }

  // COPY LABEL PROPERTIES

  // Copy label properties from scene2
  for (int i = 0; i < scene2.NLabelProperties(); i++) {
    R3SurfelLabelProperty *property2 = scene2.LabelProperty(i);
    int type = property2->Type();
    RNArray<R3SurfelLabel *> labels1;
    R3SurfelLabel *label2 = property2->Label();
    R3SurfelLabel *label1 = labels1.Kth(label2->SceneIndex());
    labels1.Insert(label1);
    int noperands1 = 0;
    RNScalar *operands1 = NULL;
    if (property2->NOperands() > 0) {
      noperands1 = property2->NOperands();
      operands1 = new RNScalar [ noperands1 ];
      for (int j = 0; j < noperands1; j++) {
        RNScalar operand2 = property2->Operand(j);
        operands1[j] = operand2;
      }
    }
    R3SurfelLabelProperty *property1 = new R3SurfelLabelProperty(type, label1, operands1, noperands1);
    scene1.InsertLabelProperty(property1);
    delete [] operands1;
  }

  // COPY OBJECT RELATIONSHIPS

  // Copy object relationships from scene2
  for (int i = 0; i < scene2.NObjectRelationships(); i++) {
    R3SurfelObjectRelationship *relationship2 = scene2.ObjectRelationship(i);
    int type = relationship2->Type();
    RNArray<R3SurfelObject *> objects1;
    for (int j = 0; j < relationship2->NObjects(); j++) {
      R3SurfelObject *object2 = relationship2->Object(j);
      R3SurfelObject *object1 = objects1.Kth(object2->SceneIndex());
      objects1.Insert(object1);
    }
    int noperands1 = 0;
    RNScalar *operands1 = NULL;
    if (relationship2->NOperands() > 0) {
      noperands1 = relationship2->NOperands();
      operands1 = new RNScalar [ noperands1 ];
      for (int j = 0; j < noperands1; j++) {
        RNScalar operand2 = relationship2->Operand(j);
        operands1[j] = operand2;
      }
    }
    R3SurfelObjectRelationship *relationship1 = new R3SurfelObjectRelationship(type, objects1, operands1, noperands1);
    scene1.InsertObjectRelationship(relationship1);
    delete [] operands1;
  }

  // COPY LABEL RELATIONSHIPS

  // Copy label relationships from scene2
  for (int i = 0; i < scene2.NLabelRelationships(); i++) {
    R3SurfelLabelRelationship *relationship2 = scene2.LabelRelationship(i);
    int type = relationship2->Type();
    RNArray<R3SurfelLabel *> labels1;
    for (int j = 0; j < relationship2->NLabels(); j++) {
      R3SurfelLabel *label2 = relationship2->Label(j);
      R3SurfelLabel *label1 = labels1.Kth(label2->SceneIndex());
      labels1.Insert(label1);
    }
    int noperands1 = 0;
    RNScalar *operands1 = NULL;
    if (relationship2->NOperands() > 0) {
      noperands1 = relationship2->NOperands();
      operands1 = new RNScalar [ noperands1 ];
      for (int j = 0; j < noperands1; j++) {
        RNScalar operand2 = relationship2->Operand(j);
        operands1[j] = operand2;
      }
    }
    R3SurfelLabelRelationship *relationship1 = new R3SurfelLabelRelationship(type, labels1, operands1);
    scene1.InsertLabelRelationship(relationship1);
    delete [] operands1;
  }

  // COPY ASSIGNMENTS

  // Copy label assignments from scene2
  for (int i = 0; i < scene2.NLabelAssignments(); i++) {
    R3SurfelLabelAssignment *assignment2 = scene2.LabelAssignment(i);
    R3SurfelObject *object2 = assignment2->Object();
    R3SurfelLabel *label2 = assignment2->Label();
    R3SurfelObject *object1 = objects1.Kth(object2->SceneIndex());
    R3SurfelLabel *label1 = labels1.Kth(label2->SceneIndex());
    R3SurfelLabelAssignment *assignment1 = new R3SurfelLabelAssignment(object1, label1, assignment2->Confidence(), assignment2->Originator());
    scene1.InsertLabelAssignment(assignment1);
  }

  // COPY SCANS

  // Copy scans from scene2
  RNArray<R3SurfelScan *> scans1;
  for (int i = 0; i < scene2.NScans(); i++) {
    R3SurfelScan *scan2 = scene2.Scan(i);
    R3SurfelScan *scan1 = new R3SurfelScan(scan2->Name());
    scan1->SetPose(scan2->Pose());
    scan1->SetTimestamp(scan2->Timestamp());
    scan1->SetXFocal(scan2->XFocal());
    scan1->SetYFocal(scan2->YFocal());
    scan1->SetImageDimensions(scan2->ImageWidth(), scan2->ImageHeight());
    scan1->SetImageCenter(scan2->ImageCenter());
    scan1->SetFlags(scan2->Flags());
    R3SurfelNode *node2 = scan2->Node();
    R3SurfelNode *node1 = nodes1.Kth(node2->TreeIndex());
    scan1->SetNode(node1);
    scene1.InsertScan(scan1);
    scans1.Insert(scan1);
  }

  // COPY IMAGES
  
  // Copy images from scene2
  for (int i = 0; i < scene2.NImages(); i++) {
    R3SurfelImage *image2 = scene2.Image(i);
    R3SurfelImage *image1 = new R3SurfelImage(image2->Name());
    const R3CoordSystem *rolling_shutter_poses = image2->RollingShutterPoses();
    const RNScalar *rolling_shutter_timestamps = image2->RollingShutterTimestamps();
    image1->SetRollingShutterPoses(rolling_shutter_poses[0], rolling_shutter_poses[1]);
    image1->SetRollingShutterTimestamps(rolling_shutter_timestamps[0], rolling_shutter_timestamps[1]);
    image1->SetXFocal(image2->XFocal());
    image1->SetYFocal(image2->YFocal());
    image1->SetImageDimensions(image2->ImageWidth(), image2->ImageHeight());
    image1->SetImageCenter(image2->ImageCenter());
    image1->SetDistortionType(image2->DistortionType());
    image1->SetRadialDistortion(image2->RadialDistortion());
    image1->SetTangentialDistortion(image2->TangentialDistortion());
    image1->SetFlags(image2->Flags());
    R3SurfelScan *scan2 = image2->Scan();
    R3SurfelScan *scan1 = (scan2) ? scans1.Kth(scan2->SceneIndex()) : NULL;
    image1->SetScan(scan1);
    scene1.InsertImage(image1);

    // Copy image channels?
    // XXX
  }

  // Mark scene as dirty
  flags.Add(R3_SURFEL_SCENE_DIRTY_FLAG);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rcx, 0x28(%rsp)
movq %rsi, %r14
movq %rdi, (%rsp)
movq 0x8(%rdi), %rax
movq %rax, 0x20(%rsp)
movq %r8, 0x30(%rsp)
testq %r8, %r8
jne 0x18f3f
movq 0x20(%rsp), %rax
movq 0x18(%rax), %rax
movq (%rax), %rax
movq %rax, 0x30(%rsp)
testq %rdx, %rdx
jne 0x18f4f
movq (%rsp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rdx
movq %rdx, 0x68(%rsp)
movq 0x8(%r14), %r12
cmpq $0x0, 0x28(%rsp)
jne 0x18f70
movq (%rsp), %rax
movq 0x20(%rax), %rax
movq (%rax), %rax
movq %rax, 0x28(%rsp)
movq 0x20(%rsp), %rax
movq 0x10(%rax), %r15
movq 0x10(%r12), %rax
movq %rax, 0x70(%rsp)
xorl %ebx, %ebx
movslq 0x1e4(%r14), %rax
cmpq %rax, %rbx
jge 0x18fae
movq 0x1d8(%r14), %rax
movq (%rax,%rbx,8), %rsi
movq (%rsp), %rdi
movq (%rdi), %rax
callq *0xc0(%rax)
incq %rbx
jmp 0x18f85
leaq 0x58(%rsp), %rbx
movq %rbx, %rdi
callq 0x9a7ae
movq 0x20(%rsp), %rax
movq 0x18(%rax), %rax
movq (%rax), %rsi
movq %rbx, %rdi
callq 0x1784c
pushq $0x1
popq %rbp
leaq 0x58(%rsp), %rbx
movl 0x24(%r12), %eax
cmpl %eax, %ebp
jge 0x19006
movl $0xd0, %edi
callq 0x134f0
movq %rax, %r13
movq %rax, %rdi
xorl %esi, %esi
callq 0x33394
movq %rbx, %rdi
movq %r13, %rsi
callq 0x1784c
incl %ebp
jmp 0x18fd7
pushq $0x1
popq %rcx
movq %r14, 0x8(%rsp)
movq %r12, 0x78(%rsp)
cltq
cmpq %rax, %rcx
jge 0x1911d
movq 0x58(%rsp), %rbx
movq (%rbx,%rcx,8), %rbp
movq 0x18(%r12), %rax
movq %rcx, 0x80(%rsp)
movq (%rax,%rcx,8), %r14
movq 0x28(%r14), %r12
movq 0x30(%rsp), %rdx
testq %r12, %r12
je 0x19071
movq 0xb8(%r12), %rdi
testq %rdi, %rdi
je 0x19068
leaq 0xaf3aa(%rip), %rsi     # 0xc8404
callq 0x13750
movq 0x30(%rsp), %rdx
testl %eax, %eax
je 0x19071
movslq 0x20(%r12), %rax
movq (%rbx,%rax,8), %rdx
movq 0x20(%rsp), %rdi
movq %rbp, %rsi
callq 0x34e72
movq 0xb8(%r14), %rsi
movq (%rbp), %rax
movq %rbp, %rdi
callq *0x10(%rax)
xorl %r12d, %r12d
movslq 0x4c(%r14), %rax
cmpq %rax, %r12
jge 0x190fe
movq 0x40(%r14), %rax
movq (%rax,%r12,8), %r13
movq 0x70(%rsp), %rdi
movq %r13, %rsi
callq 0x20a64
movl $0xc8, %edi
callq 0x134f0
movq %rax, %rbx
movq %rax, %rdi
movq %r13, %rsi
callq 0x29674
movq (%r15), %rax
movq %r15, %rdi
movq %rbx, %rsi
callq *0x10(%rax)
movq (%rbp), %rax
movq %rbp, %rdi
movq %rbx, %rsi
callq *0x28(%rax)
movq %r15, %rdi
movq %rbx, %rsi
callq 0x20aa0
movq 0x70(%rsp), %rdi
movq %r13, %rsi
callq 0x20aa0
incq %r12
jmp 0x19092
movq 0x80(%rsp), %rcx
incq %rcx
movq 0x78(%rsp), %r12
movl 0x24(%r12), %eax
movq 0x8(%rsp), %r14
jmp 0x19013
leaq 0x48(%rsp), %rdi
callq 0x9a7ae
movq (%rsp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rsi
leaq 0x48(%rsp), %rdi
callq 0x1784c
pushq $0x1
popq %rbp
leaq 0x48(%rsp), %rbx
movl 0x1c(%r14), %eax
cmpl %eax, %ebp
jge 0x19172
movl $0xf8, %edi
callq 0x134f0
movq %rax, %r15
movq %rax, %rdi
xorl %esi, %esi
callq 0x16360
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1784c
incl %ebp
jmp 0x19144
pushq $0x1
popq %rbx
leaq 0xaf288(%rip), %r15     # 0xc8404
cltq
cmpq %rax, %rbx
jge 0x1924e
movq 0x48(%rsp), %r14
movq (%r14,%rbx,8), %r12
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rax
movq (%rax,%rbx,8), %r13
movq 0x18(%r13), %rbp
movq 0x68(%rsp), %rdx
testq %rbp, %rbp
je 0x191d0
movq 0x88(%rbp), %rdi
testq %rdi, %rdi
je 0x191c8
movq %r15, %rsi
callq 0x13750
movq 0x68(%rsp), %rdx
testl %eax, %eax
je 0x191d0
movslq 0x10(%rbp), %rax
movq (%r14,%rax,8), %rdx
movq (%rsp), %rdi
movq (%rdi), %rax
movq %r12, %rsi
callq *0x18(%rax)
movq 0x88(%r13), %rsi
movq (%r12), %rax
movq %r12, %rdi
callq *0x10(%rax)
movq %r13, %rdi
callq 0x1683e
movq (%r12), %rcx
movq %r12, %rdi
movl %eax, %esi
callq *0x18(%rcx)
leaq 0x70(%r13), %rsi
movq (%r12), %rax
movq %r12, %rdi
callq *0x20(%rax)
xorl %r14d, %r14d
movslq 0x6c(%r13), %rax
cmpq %rax, %r14
jge 0x1923e
movq 0x60(%r13), %rax
movq (%rax,%r14,8), %rax
movslq 0x20(%rax), %rax
movq 0x58(%rsp), %rcx
movq (%rcx,%rax,8), %rsi
movq %r12, %rdi
callq 0x17274
incq %r14
jmp 0x19213
incq %rbx
movq 0x8(%rsp), %rax
movl 0x1c(%rax), %eax
jmp 0x1917c
leaq 0x38(%rsp), %rdi
callq 0x9a7ae
movq (%rsp), %rax
movq 0x20(%rax), %rax
movq (%rax), %rsi
leaq 0x38(%rsp), %rdi
callq 0x1784c
movq 0x8(%rsp), %r14
pushq $0x1
popq %rbp
leaq 0x38(%rsp), %rbx
movl 0x2c(%r14), %eax
cmpl %eax, %ebp
jge 0x192a8
movl $0x98, %edi
callq 0x134f0
movq %rax, %r15
movq %rax, %rdi
xorl %esi, %esi
callq 0x3b2a4
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1784c
incl %ebp
jmp 0x1927a
pushq $0x1
popq %rbx
cltq
cmpq %rax, %rbx
jge 0x1936f
movq 0x38(%rsp), %r14
movq (%r14,%rbx,8), %r12
movq 0x8(%rsp), %rax
movq 0x20(%rax), %rax
movq (%rax,%rbx,8), %r13
movq 0x18(%r13), %r15
movq 0x28(%rsp), %rbp
testq %r15, %r15
je 0x19300
movq 0x60(%r15), %rdi
testq %rdi, %rdi
je 0x192f8
leaq 0xaf11a(%rip), %rsi     # 0xc8404
callq 0x13750
movq 0x28(%rsp), %rbp
testl %eax, %eax
je 0x19300
movslq 0x10(%r15), %rax
movq (%r14,%rax,8), %rbp
movq 0x60(%r13), %rsi
movq (%r12), %rax
movq %r12, %rdi
callq *0x18(%rax)
movq %r13, %rdi
callq 0x3b59e
movq (%r12), %rcx
movq %r12, %rdi
movl %eax, %esi
callq *0x20(%rcx)
movl 0x6c(%r13), %esi
movq (%r12), %rax
movq %r12, %rdi
callq *0x28(%rax)
leaq 0x70(%r13), %rsi
movq (%r12), %rax
movq %r12, %rdi
callq *0x30(%rax)
movq 0x88(%r13), %rsi
movq (%r12), %rax
movq %r12, %rdi
callq *0x38(%rax)
movq (%rsp), %rdi
movq (%rdi), %rax
movq %r12, %rsi
movq %rbp, %rdx
callq *0x30(%rax)
incq %rbx
movq 0x8(%rsp), %rax
movl 0x2c(%rax), %eax
jmp 0x192ab
xorl %r14d, %r14d
leaq 0x10(%rsp), %r15
movq 0x8(%rsp), %rcx
movslq 0x3c(%rcx), %rax
cmpq %rax, %r14
jge 0x19440
movq 0x30(%rcx), %rax
movq (%rax,%r14,8), %rbx
movl 0x2c(%rbx), %ebp
movq %r15, %rdi
callq 0x9a7ae
movq 0x18(%rbx), %rax
movslq 0x10(%rax), %rax
movq 0x10(%rsp), %rcx
movq (%rcx,%rax,8), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x1784c
movslq 0x28(%rbx), %r15
testq %r15, %r15
jle 0x193ed
leaq (,%r15,8), %rdi
callq 0x13030
movq %rax, %r13
movq 0x20(%rbx), %rax
xorl %ecx, %ecx
cmpq %rcx, %r15
je 0x193f3
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, (%r13,%rcx,8)
incq %rcx
jmp 0x193d7
xorl %r13d, %r13d
xorl %r15d, %r15d
pushq $0x30
popq %rdi
callq 0x134f0
movq %rax, %rbx
movq %rax, %rdi
movl %ebp, %esi
movq %r12, %rdx
movq %r13, %rcx
movl %r15d, %r8d
callq 0x3a124
movq (%rsp), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
callq *0x40(%rax)
testq %r13, %r13
je 0x1942b
movq %r13, %rdi
callq 0x136a0
leaq 0x10(%rsp), %r15
movq %r15, %rdi
callq 0x9a81c
incq %r14
jmp 0x19377
xorl %r14d, %r14d
leaq 0x10(%rsp), %r15
movq 0x8(%rsp), %rcx
movslq 0x4c(%rcx), %rax
cmpq %rax, %r14
jge 0x19511
movq 0x40(%rcx), %rax
movq (%rax,%r14,8), %rbx
movl 0x2c(%rbx), %ebp
movq %r15, %rdi
callq 0x9a7ae
movq 0x18(%rbx), %rax
movslq 0x10(%rax), %rax
movq 0x10(%rsp), %rcx
movq (%rcx,%rax,8), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x1784c
movslq 0x28(%rbx), %r15
testq %r15, %r15
jle 0x194be
leaq (,%r15,8), %rdi
callq 0x13030
movq %rax, %r13
movq 0x20(%rbx), %rax
xorl %ecx, %ecx
cmpq %rcx, %r15
je 0x194c4
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, (%r13,%rcx,8)
incq %rcx
jmp 0x194a8
xorl %r13d, %r13d
xorl %r15d, %r15d
pushq $0x30
popq %rdi
callq 0x134f0
movq %rax, %rbx
movq %rax, %rdi
movl %ebp, %esi
movq %r12, %rdx
movq %r13, %rcx
movl %r15d, %r8d
callq 0x3b8c8
movq (%rsp), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
callq *0x50(%rax)
testq %r13, %r13
je 0x194fc
movq %r13, %rdi
callq 0x136a0
leaq 0x10(%rsp), %r15
movq %r15, %rdi
callq 0x9a81c
incq %r14
jmp 0x19448
xorl %r14d, %r14d
leaq 0x10(%rsp), %r15
movq 0x8(%rsp), %rcx
movslq 0x5c(%rcx), %rax
cmpq %rax, %r14
jge 0x195ef
movq 0x50(%rcx), %rax
movq (%rax,%r14,8), %rbx
movl 0x34(%rbx), %ebp
movq %r15, %rdi
callq 0x9a7ae
xorl %r12d, %r12d
movslq 0x24(%rbx), %rax
cmpq %rax, %r12
jge 0x1956c
movq 0x18(%rbx), %rax
movq (%rax,%r12,8), %rax
movslq 0x10(%rax), %rax
movq 0x10(%rsp), %rcx
movq (%rcx,%rax,8), %rsi
movq %r15, %rdi
callq 0x1784c
incq %r12
jmp 0x19541
movslq 0x30(%rbx), %r12
testq %r12, %r12
jle 0x195a1
leaq (,%r12,8), %rdi
callq 0x13030
movq %rax, %r13
movq 0x28(%rbx), %rax
xorl %ecx, %ecx
cmpq %rcx, %r12
je 0x195a7
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, (%r13,%rcx,8)
incq %rcx
jmp 0x1958b
xorl %r12d, %r12d
xorl %r13d, %r13d
pushq $0x38
popq %rdi
callq 0x134f0
movq %rax, %rbx
movq %rax, %rdi
movl %ebp, %esi
movq %r15, %rdx
movq %r13, %rcx
movl %r12d, %r8d
callq 0x3af50
movq (%rsp), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
callq *0x60(%rax)
testq %r13, %r13
je 0x195df
movq %r13, %rdi
callq 0x136a0
movq %r15, %rdi
callq 0x9a81c
incq %r14
jmp 0x19519
xorl %r14d, %r14d
leaq 0x10(%rsp), %r15
movq 0x8(%rsp), %rcx
movslq 0x6c(%rcx), %rax
cmpq %rax, %r14
jge 0x196ca
movq 0x60(%rcx), %rax
movq (%rax,%r14,8), %rbx
movl 0x34(%rbx), %ebp
movq %r15, %rdi
callq 0x9a7ae
xorl %r12d, %r12d
movslq 0x24(%rbx), %rax
cmpq %rax, %r12
jge 0x1964a
movq 0x18(%rbx), %rax
movq (%rax,%r12,8), %rax
movslq 0x10(%rax), %rax
movq 0x10(%rsp), %rcx
movq (%rcx,%rax,8), %rsi
movq %r15, %rdi
callq 0x1784c
incq %r12
jmp 0x1961f
movslq 0x30(%rbx), %r12
testq %r12, %r12
jle 0x1967f
leaq (,%r12,8), %rdi
callq 0x13030
movq %rax, %r13
movq 0x28(%rbx), %rax
xorl %ecx, %ecx
cmpq %rcx, %r12
je 0x19682
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, (%r13,%rcx,8)
incq %rcx
jmp 0x19669
xorl %r13d, %r13d
pushq $0x38
popq %rdi
callq 0x134f0
movq %rax, %rbx
movq %rax, %rdi
movl %ebp, %esi
movq %r15, %rdx
movq %r13, %rcx
xorl %r8d, %r8d
callq 0x3ba80
movq (%rsp), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
callq *0x70(%rax)
testq %r13, %r13
je 0x196ba
movq %r13, %rdi
callq 0x136a0
movq %r15, %rdi
callq 0x9a81c
incq %r14
jmp 0x195f7
xorl %r14d, %r14d
pushq $0x50
popq %r15
movq 0x8(%rsp), %rcx
movslq 0x7c(%rcx), %rax
cmpq %rax, %r14
jge 0x1973f
movq 0x70(%rcx), %rax
movq (%rax,%r14,8), %rbp
movq 0x18(%rbp), %rax
movq 0x28(%rbp), %rcx
movslq 0x10(%rax), %rax
movq 0x48(%rsp), %rdx
movq (%rdx,%rax,8), %r12
movslq 0x10(%rcx), %rax
movq 0x38(%rsp), %rcx
movq (%rcx,%rax,8), %r13
movq %r15, %rdi
callq 0x134f0
movq %rax, %rbx
movsd 0x38(%rbp), %xmm0
movl 0x40(%rbp), %ecx
movq %rax, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x3bd58
movq (%rsp), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
callq *0x80(%rax)
incq %r14
jmp 0x196d1
leaq 0x10(%rsp), %rdi
callq 0x9a7ae
xorl %ebx, %ebx
leaq 0x10(%rsp), %r15
movq 0x8(%rsp), %r14
movslq 0x8c(%r14), %rax
cmpq %rax, %rbx
jge 0x1984b
movq 0x80(%r14), %rax
movq (%rax,%rbx,8), %r14
movl $0xd0, %edi
callq 0x134f0
movq %rax, %r12
movq 0xb8(%r14), %rsi
movq %rax, %rdi
callq 0x36ca4
leaq 0x28(%r14), %rsi
movq (%r12), %rax
movq %r12, %rdi
callq *0x10(%rax)
movsd 0x88(%r14), %xmm0
movq (%r12), %rax
movq %r12, %rdi
callq *0x28(%rax)
movsd 0xa8(%r14), %xmm0
movq (%r12), %rax
movq %r12, %rdi
callq *0x50(%rax)
movsd 0xb0(%r14), %xmm0
movq (%r12), %rax
movq %r12, %rdi
callq *0x58(%rax)
movl 0x90(%r14), %esi
movl 0x94(%r14), %edx
movq (%r12), %rax
movq %r12, %rdi
callq *0x38(%rax)
leaq 0x98(%r14), %rsi
movq (%r12), %rax
movq %r12, %rdi
callq *0x40(%rax)
movq 0xc0(%r14), %rsi
movq (%r12), %rax
movq %r12, %rdi
callq *0x60(%rax)
movq 0x18(%r14), %rax
movslq 0x20(%rax), %rax
movq 0x58(%rsp), %rcx
movq (%rcx,%rax,8), %rsi
movq (%r12), %rax
movq %r12, %rdi
callq *0x78(%rax)
movq (%rsp), %rdi
movq (%rdi), %rax
movq %r12, %rsi
callq *0x90(%rax)
movq %r15, %rdi
movq %r12, %rsi
callq 0x1784c
incq %rbx
jmp 0x19750
xorl %ebx, %ebx
movslq 0x9c(%r14), %rax
cmpq %rax, %rbx
jge 0x1999c
movq 0x90(%r14), %rax
movq (%rax,%rbx,8), %r14
movl $0x1d8, %edi            # imm = 0x1D8
callq 0x134f0
movq %rax, %r15
movq 0x1c0(%r14), %rsi
movq %rax, %rdi
callq 0x3721c
leaq 0xf0(%r14), %rsi
leaq 0x150(%r14), %rdx
movq (%r15), %rax
movq %r15, %rdi
callq *0xb8(%rax)
movsd 0x1b0(%r14), %xmm0
movsd 0x1b8(%r14), %xmm1
movq (%r15), %rax
movq %r15, %rdi
callq *0xc0(%rax)
movsd 0xb0(%r14), %xmm0
movq (%r15), %rax
movq %r15, %rdi
callq *0x88(%rax)
movsd 0xb8(%r14), %xmm0
movq (%r15), %rax
movq %r15, %rdi
callq *0x90(%rax)
movl 0x98(%r14), %esi
movl 0x9c(%r14), %edx
movq (%r15), %rax
movq %r15, %rdi
callq *0x70(%rax)
leaq 0xa0(%r14), %rsi
movq (%r15), %rax
movq %r15, %rdi
callq *0x78(%rax)
movl 0xc0(%r14), %esi
movq (%r15), %rax
movq %r15, %rdi
callq *0xa0(%rax)
leaq 0xc8(%r14), %rsi
movq (%r15), %rax
movq %r15, %rdi
callq *0xa8(%rax)
leaq 0xe0(%r14), %rsi
movq (%r15), %rax
movq %r15, %rdi
callq *0xb0(%rax)
movq 0x1c8(%r14), %rsi
movq (%r15), %rax
movq %r15, %rdi
callq *0xd8(%rax)
movq 0x18(%r14), %rax
testq %rax, %rax
je 0x19971
movslq 0x10(%rax), %rax
movq 0x10(%rsp), %rcx
movq (%rcx,%rax,8), %rsi
jmp 0x19973
xorl %esi, %esi
movq 0x8(%rsp), %r14
movq (%r15), %rax
movq %r15, %rdi
callq *0xd0(%rax)
movq (%rsp), %rdi
movq (%rdi), %rax
movq %r15, %rsi
callq *0xa0(%rax)
incq %rbx
jmp 0x1984d
movq (%rsp), %rax
orb $0x1, 0x1e8(%rax)
leaq 0x10(%rsp), %rdi
callq 0x9a81c
leaq 0x38(%rsp), %rdi
callq 0x9a81c
leaq 0x48(%rsp), %rdi
callq 0x9a81c
leaq 0x58(%rsp), %rdi
callq 0x9a81c
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x19aad
jmp 0x19aad
jmp 0x19ad1
jmp 0x19ad1
jmp 0x19af4
jmp 0x19af4
jmp 0x19ab8
jmp 0x19ab8
jmp 0x19ab8
jmp 0x19ab8
movq %rax, %r14
movl $0x1d8, %esi            # imm = 0x1D8
movq %r15, %rdi
jmp 0x19a59
jmp 0x19ab8
movq %rax, %r14
movl $0xd0, %esi
movq %r12, %rdi
jmp 0x19a59
movq %rax, %r14
pushq $0x50
popq %rsi
movq %rbx, %rdi
jmp 0x19a6f
jmp 0x19a41
jmp 0x19aad
movq %rax, %r14
pushq $0x38
jmp 0x19a55
jmp 0x19aad
jmp 0x19a50
jmp 0x19ab8
jmp 0x19aad
movq %rax, %r14
pushq $0x30
popq %rsi
movq %rbx, %rdi
callq 0x13500
jmp 0x19abb
jmp 0x19ab8
jmp 0x19aad
movq %rax, %r14
movl $0x98, %esi
movq %r15, %rdi
callq 0x13500
jmp 0x19ac5
movq %rax, %r14
movl $0xf8, %esi
movq %r15, %rdi
callq 0x13500
jmp 0x19ad4
movq %rax, %r14
movl $0xd0, %esi
movq %r13, %rdi
jmp 0x19aed
jmp 0x19ab8
jmp 0x19aad
jmp 0x19ab8
jmp 0x19ab8
jmp 0x19ab8
jmp 0x19ab8
jmp 0x19aad
jmp 0x19ad1
jmp 0x19af4
jmp 0x19af4
jmp 0x19ab8
jmp 0x19ad1
movq %rax, %r14
jmp 0x19ac5
jmp 0x19ab8
jmp 0x19ab8
jmp 0x19ab8
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x9a81c
leaq 0x38(%rsp), %rdi
callq 0x9a81c
jmp 0x19ad4
movq %rax, %r14
leaq 0x48(%rsp), %rdi
callq 0x9a81c
jmp 0x19af7
jmp 0x19af4
movq %rax, %r14
movl $0xc8, %esi
movq %rbx, %rdi
callq 0x13500
jmp 0x19af7
movq %rax, %r14
leaq 0x58(%rsp), %rdi
callq 0x9a81c
movq %r14, %rdi
callq 0x138f0
nop