// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelScene.cpp
// Function: gaps::R3SurfelScene::WriteBinaryStream(_IO_FILE*)
int R3SurfelScene::
WriteBinaryStream(FILE *fp) 
{
  // Write file header
  if (!WriteBinaryString(fp, "SSB 1.1", 16)) {
    RNFail("Unable to write to %s\n", filename);
    return 0;
  }

  // Write scene header
  WriteBinaryString(fp, name);
  WriteBinaryInteger(fp, tree->NNodes());
  WriteBinaryInteger(fp, NObjects());
  WriteBinaryInteger(fp, NLabels());
  WriteBinaryInteger(fp, NFeatures());
  WriteBinaryInteger(fp, NObjectRelationships());
  WriteBinaryInteger(fp, NLabelRelationships());
  WriteBinaryInteger(fp, NLabelAssignments());
  WriteBinaryInteger(fp, NScans());
  WriteBinaryInteger(fp, NObjectProperties());
  WriteBinaryInteger(fp, NLabelProperties());
  WriteBinaryInteger(fp, NImages());
  WriteBinaryInteger(fp, NComments());
  for (int j = 0; j < 3; j++) WriteBinaryInteger(fp, 0);

  // Write transformation
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 4; j++) {
      WriteBinaryDouble(fp, Transformation().Matrix()[i][j]);
    }
  }

  // Write comments
  for (int i = 0; i < NComments(); i++) {
    WriteBinaryString(fp, Comment(i));
  }

  // Write nodes
  for (int i = 0; i < tree->NNodes(); i++) {
    R3SurfelNode *node = tree->Node(i);
    int parent_index = (node->Parent()) ? node->Parent()->TreeIndex() : -1;
    WriteBinaryString(fp, node->Name());
    WriteBinaryInteger(fp, parent_index);
    WriteBinaryInteger(fp, node->NParts());
    WriteBinaryInteger(fp, node->NBlocks());
    WriteBinaryDouble(fp, node->Complexity());
    WriteBinaryDouble(fp, node->Resolution());
    for (int j = 0; j < 8; j++) WriteBinaryInteger(fp, 0);
    for (int j = 0; j < node->NBlocks(); j++) {
      R3SurfelBlock *block = node->Block(j);
      WriteBinaryInteger(fp, block->DatabaseIndex());
    }
  }

  // Write objects
  for (int i = 0; i < NObjects(); i++) {
    R3SurfelObject *object = Object(i);
    int parent_index = (object->Parent()) ? object->Parent()->SceneIndex() : -1;
    const R3SurfelFeatureVector& feature_vector = object->FeatureVector();
    WriteBinaryString(fp, object->Name());
    WriteBinaryInteger(fp, object->Identifier());
    WriteBinaryInteger(fp, parent_index);
    WriteBinaryInteger(fp, object->NParts());
    WriteBinaryInteger(fp, object->NNodes());
    WriteBinaryInteger(fp, feature_vector.NValues());
    WriteBinaryDouble(fp, object->Complexity());
    WriteBinaryInteger(fp, object->Flags());
    for (int j = 0; j < 7; j++) WriteBinaryInteger(fp, 0);
    for (int j = 0; j < feature_vector.NValues(); j++) {
      WriteBinaryDouble(fp, feature_vector.Value(j));
    }
    for (int j = 0; j < object->NNodes(); j++) {
      R3SurfelNode *node = object->Node(j);
      WriteBinaryInteger(fp, node->TreeIndex());
    }
  }

  // Write labels
  for (int i = 0; i < NLabels(); i++) {
    R3SurfelLabel *label = Label(i);
    const RNRgb& color = label->Color();
    int parent_index = (label->Parent()) ? label->Parent()->SceneIndex() : -1;
    WriteBinaryString(fp, label->Name());
    WriteBinaryInteger(fp, label->Identifier());
    WriteBinaryInteger(fp, label->AssignmentKeystroke());
    WriteBinaryInteger(fp, parent_index);
    WriteBinaryInteger(fp, label->NParts());
    WriteBinaryDouble(fp, color.R());
    WriteBinaryDouble(fp, color.G());
    WriteBinaryDouble(fp, color.B());
    WriteBinaryInteger(fp, label->Flags());
    for (int j = 0; j < 3; j++) WriteBinaryInteger(fp, 0);
  }

  // Write features
  for (int i = 0; i < NFeatures(); i++) {
    R3SurfelFeature *feature = Feature(i);
    WriteBinaryString(fp, feature->Name());
    WriteBinaryDouble(fp, feature->Minimum());
    WriteBinaryDouble(fp, feature->Maximum());
    WriteBinaryDouble(fp, feature->Weight());
    WriteBinaryInteger(fp, feature->Type());
    for (int j = 0; j < 4; j++) WriteBinaryInteger(fp, 0);
    if (feature->Type() == R3_SURFEL_OVERHEAD_GRID_FEATURE_TYPE) {
      WriteBinaryString(fp, ((R3SurfelOverheadGridFeature *) feature)->filename);
    }
  }

  // Write object relationships
  for (int i = 0; i < NObjectRelationships(); i++) {
    R3SurfelObjectRelationship *relationship = ObjectRelationship(i);
    WriteBinaryInteger(fp, relationship->Type());
    WriteBinaryInteger(fp, relationship->NObjects());
    WriteBinaryInteger(fp, relationship->NOperands());
    for (int j = 0; j < 4; j++) WriteBinaryInteger(fp, 0);
    for (int j = 0; j < relationship->NObjects(); j++) 
      WriteBinaryInteger(fp, relationship->Object(j)->SceneIndex());
    for (int j = 0; j < relationship->NOperands(); j++) 
      WriteBinaryDouble(fp, relationship->Operand(j));
  }

  // Write label relationships
  for (int i = 0; i < NLabelRelationships(); i++) {
    R3SurfelLabelRelationship *relationship = LabelRelationship(i);
    WriteBinaryInteger(fp, relationship->Type());
    WriteBinaryInteger(fp, relationship->NLabels());
    WriteBinaryInteger(fp, relationship->NOperands());
    for (int j = 0; j < 4; j++) WriteBinaryInteger(fp, 0);
    for (int j = 0; j < relationship->NLabels(); j++) 
      WriteBinaryInteger(fp, relationship->Label(j)->SceneIndex());
    for (int j = 0; j < relationship->NOperands(); j++) 
      WriteBinaryDouble(fp, relationship->Operand(j));
  }

  // Write assignments
  for (int i = 0; i < NLabelAssignments(); i++) {
    R3SurfelLabelAssignment *assignment = LabelAssignment(i);
    R3SurfelObject *object = assignment->Object();
    R3SurfelLabel *label = assignment->Label();
    WriteBinaryInteger(fp, object->SceneIndex());
    WriteBinaryInteger(fp, label->SceneIndex());
    WriteBinaryDouble(fp, assignment->Confidence());
    WriteBinaryInteger(fp, assignment->Originator());
    for (int j = 0; j < 4; j++) WriteBinaryInteger(fp, 0);
  }

  // Write scans
  for (int i = 0; i < NScans(); i++) {
    R3SurfelScan *scan = Scan(i);
    WriteBinaryString(fp, scan->Name());
    WriteBinaryDouble(fp, scan->Viewpoint().X());
    WriteBinaryDouble(fp, scan->Viewpoint().Y());
    WriteBinaryDouble(fp, scan->Viewpoint().Z());
    WriteBinaryDouble(fp, scan->Towards().X());
    WriteBinaryDouble(fp, scan->Towards().Y());
    WriteBinaryDouble(fp, scan->Towards().Z());
    WriteBinaryDouble(fp, scan->Up().X());
    WriteBinaryDouble(fp, scan->Up().Y());
    WriteBinaryDouble(fp, scan->Up().Z());
    WriteBinaryDouble(fp, scan->Timestamp());
    WriteBinaryInteger(fp, (scan->Node()) ? scan->Node()->TreeIndex() : -1);
    WriteBinaryInteger(fp, scan->ImageWidth());
    WriteBinaryInteger(fp, scan->ImageHeight());
    WriteBinaryDouble(fp, scan->XFocal());
    WriteBinaryDouble(fp, scan->ImageCenter().X());
    WriteBinaryDouble(fp, scan->ImageCenter().Y());
    WriteBinaryInteger(fp, scan->Flags());
    WriteBinaryDouble(fp, scan->YFocal());
    for (int j = 0; j < 4; j++) WriteBinaryInteger(fp, 0);
  }

  // Write images
  for (int i = 0; i < NImages(); i++) {
    R3SurfelImage *image = Image(i);
    WriteBinaryString(fp, image->Name());
    WriteBinaryDouble(fp, image->Viewpoint().X());
    WriteBinaryDouble(fp, image->Viewpoint().Y());
    WriteBinaryDouble(fp, image->Viewpoint().Z());
    WriteBinaryDouble(fp, image->Towards().X());
    WriteBinaryDouble(fp, image->Towards().Y());
    WriteBinaryDouble(fp, image->Towards().Z());
    WriteBinaryDouble(fp, image->Up().X());
    WriteBinaryDouble(fp, image->Up().Y());
    WriteBinaryDouble(fp, image->Up().Z());
    WriteBinaryDouble(fp, image->Timestamp());
    WriteBinaryInteger(fp, (image->scan) ? image->scan->SceneIndex() : -1);
    WriteBinaryInteger(fp, image->ImageWidth());
    WriteBinaryInteger(fp, image->ImageHeight());
    WriteBinaryDouble(fp, image->XFocal());
    WriteBinaryDouble(fp, image->YFocal());
    WriteBinaryDouble(fp, image->ImageCenter().X());
    WriteBinaryDouble(fp, image->ImageCenter().Y());
    WriteBinaryInteger(fp, image->Flags());
    WriteBinaryInteger(fp, image->DistortionType());
    WriteBinaryInteger(fp, (image->HasRollingShutter()) ? 1 : 0);
    for (int j = 0; j < 3; j++) WriteBinaryInteger(fp, 0);

    // Write extra image parameters
    if (image->DistortionType() != R3_SURFEL_NO_DISTORTION) {
      const RNScalar *radial_distortion = image->RadialDistortion();
      const RNScalar *tangential_distortion = image->TangentialDistortion();
      WriteBinaryDouble(fp, radial_distortion[0]);
      WriteBinaryDouble(fp, radial_distortion[1]);
      WriteBinaryDouble(fp, radial_distortion[2]);
      WriteBinaryDouble(fp, tangential_distortion[0]);
      WriteBinaryDouble(fp, tangential_distortion[1]);
    }
    if (image->HasRollingShutter()) {
      const R3CoordSystem *rs_poses = image->RollingShutterPoses();
      const RNScalar *rs_timestamps = image->RollingShutterTimestamps();
      R4Matrix camera_to_world0 = rs_poses[0].Matrix();
      R4Matrix camera_to_world1 = rs_poses[1].Matrix();
      R3Point viewpoint0 = camera_to_world0 * R3zero_point;
      R3Point viewpoint1 = camera_to_world1 * R3zero_point;
      R3Vector towards0 = camera_to_world0 * R3negz_vector;
      R3Vector towards1 = camera_to_world1 * R3negz_vector;
      R3Vector up0 = camera_to_world0 * R3posy_vector;
      R3Vector up1 = camera_to_world1 * R3posy_vector;
      WriteBinaryDouble(fp, viewpoint0.X());
      WriteBinaryDouble(fp, viewpoint0.Y());
      WriteBinaryDouble(fp, viewpoint0.Z());
      WriteBinaryDouble(fp, towards0.X());
      WriteBinaryDouble(fp, towards0.Y());
      WriteBinaryDouble(fp, towards0.Z());
      WriteBinaryDouble(fp, up0.X());
      WriteBinaryDouble(fp, up0.Y());
      WriteBinaryDouble(fp, up0.Z());
      WriteBinaryDouble(fp, viewpoint1.X());
      WriteBinaryDouble(fp, viewpoint1.Y());
      WriteBinaryDouble(fp, viewpoint1.Z());
      WriteBinaryDouble(fp, towards1.X());
      WriteBinaryDouble(fp, towards1.Y());
      WriteBinaryDouble(fp, towards1.Z());
      WriteBinaryDouble(fp, up1.X());
      WriteBinaryDouble(fp, up1.Y());
      WriteBinaryDouble(fp, up1.Z());
      WriteBinaryDouble(fp, rs_timestamps[0]);
      WriteBinaryDouble(fp, rs_timestamps[1]);
    }
  }

  // Write object properties
  for (int i = 0; i < NObjectProperties(); i++) {
    R3SurfelObjectProperty *property = ObjectProperty(i);
    WriteBinaryInteger(fp, property->Type());
    WriteBinaryInteger(fp, property->Object()->SceneIndex());
    WriteBinaryInteger(fp, property->NOperands());
    for (int j = 0; j < 4; j++) WriteBinaryInteger(fp, 0);
    for (int j = 0; j < property->NOperands(); j++) 
      WriteBinaryDouble(fp, property->Operand(j));
  }

  // Write label properties
  for (int i = 0; i < NLabelProperties(); i++) {
    R3SurfelLabelProperty *property = LabelProperty(i);
    WriteBinaryInteger(fp, property->Type());
    WriteBinaryInteger(fp, property->Label()->SceneIndex());
    WriteBinaryInteger(fp, property->NOperands());
    for (int j = 0; j < 4; j++) WriteBinaryInteger(fp, 0);
    for (int j = 0; j < property->NOperands(); j++) 
      WriteBinaryDouble(fp, property->Operand(j));
  }

  // Mark scene as clean
  flags.Remove(R3_SURFEL_SCENE_DIRTY_FLAG);

  // Return success
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x198, %rsp            # imm = 0x198
movq %rsi, %r14
movq %rdi, (%rsp)
leaq 0xbd293(%rip), %rsi     # 0xdd912
movq %r14, %rdi
movl $0x10, %edx
callq 0x214a5
testl %eax, %eax
je 0x21476
movq (%rsp), %rbx
movq 0x1d0(%rbx), %rsi
movq %r14, %rdi
movl $0x100, %edx            # imm = 0x100
callq 0x214a5
movq 0x8(%rbx), %rax
movl 0x24(%rax), %esi
movq %r14, %rdi
callq 0x21528
movl 0x1c(%rbx), %esi
movq %r14, %rdi
callq 0x21528
movl 0x2c(%rbx), %esi
movq %r14, %rdi
callq 0x21528
movl 0xac(%rbx), %esi
movq %r14, %rdi
callq 0x21528
movl 0x5c(%rbx), %esi
movq %r14, %rdi
callq 0x21528
movl 0x6c(%rbx), %esi
movq %r14, %rdi
callq 0x21528
movl 0x7c(%rbx), %esi
movq %r14, %rdi
callq 0x21528
movl 0x8c(%rbx), %esi
movq %r14, %rdi
callq 0x21528
movl 0x3c(%rbx), %esi
movq %r14, %rdi
callq 0x21528
movl 0x4c(%rbx), %esi
movq %r14, %rdi
callq 0x21528
movl 0x9c(%rbx), %esi
movq %r14, %rdi
callq 0x21528
movl 0x1e4(%rbx), %esi
movq %r14, %rdi
callq 0x21528
movl $0x3, %ebp
movq %r14, %rdi
xorl %esi, %esi
callq 0x21528
decl %ebp
jne 0x20745
movq (%rsp), %rax
leaq 0xb8(%rax), %r15
xorl %r12d, %r12d
xorl %r13d, %r13d
movsd (%r15,%r13,8), %xmm0
movq %r14, %rdi
callq 0x21559
incq %r13
cmpq $0x4, %r13
jne 0x20764
incq %r12
addq $0x20, %r15
cmpq $0x4, %r12
jne 0x20761
movq (%rsp), %rax
cmpl $0x0, 0x1e4(%rax)
jle 0x207c3
xorl %r15d, %r15d
movq (%rsp), %rbx
movq 0x1d8(%rbx), %rax
movq (%rax,%r15,8), %rsi
movq %r14, %rdi
movl $0x100, %edx            # imm = 0x100
callq 0x214a5
incq %r15
movslq 0x1e4(%rbx), %rax
cmpq %rax, %r15
jl 0x2079c
movq (%rsp), %rax
movq 0x8(%rax), %rax
cmpl $0x0, 0x24(%rax)
jle 0x208a0
xorl %r12d, %r12d
movq 0x18(%rax), %rax
movq (%rax,%r12,8), %r15
movq 0x28(%r15), %rax
testq %rax, %rax
je 0x207ee
movl 0x20(%rax), %ebp
jmp 0x207f3
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movq 0xb8(%r15), %rsi
movq %r14, %rdi
movl $0x100, %edx            # imm = 0x100
callq 0x214a5
movq %r14, %rdi
movl %ebp, %esi
callq 0x21528
movl 0x3c(%r15), %esi
movq %r14, %rdi
callq 0x21528
movl 0x4c(%r15), %esi
movq %r14, %rdi
callq 0x21528
movq %r15, %rdi
callq 0x3742e
movq %r14, %rdi
callq 0x21559
movq %r15, %rdi
callq 0x37452
movq %r14, %rdi
callq 0x21559
movl $0x8, %ebp
movq %r14, %rdi
xorl %esi, %esi
callq 0x21528
decl %ebp
jne 0x2084e
cmpl $0x0, 0x4c(%r15)
jle 0x20888
xorl %r13d, %r13d
movq 0x40(%r15), %rax
movq (%rax,%r13,8), %rax
movl 0xa0(%rax), %esi
movq %r14, %rdi
callq 0x21528
incq %r13
movslq 0x4c(%r15), %rax
cmpq %rax, %r13
jl 0x20866
incq %r12
movq (%rsp), %rax
movq 0x8(%rax), %rax
movslq 0x24(%rax), %rcx
cmpq %rcx, %r12
jl 0x207d8
movq (%rsp), %rax
cmpl $0x0, 0x1c(%rax)
jle 0x209c9
xorl %r13d, %r13d
movq (%rsp), %rax
movq 0x10(%rax), %rax
movq (%rax,%r13,8), %r15
movq 0x18(%r15), %rax
testq %rax, %rax
je 0x208cb
movl 0x10(%rax), %ebp
jmp 0x208d0
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movq %r15, %rdi
callq 0x17342
movq %rax, %r12
movq 0x88(%r15), %rsi
movq %r14, %rdi
movl $0x100, %edx            # imm = 0x100
callq 0x214a5
movq %r15, %rdi
callq 0x17056
movq %r14, %rdi
movl %eax, %esi
callq 0x21528
movq %r14, %rdi
movl %ebp, %esi
callq 0x21528
movl 0x2c(%r15), %esi
movq %r14, %rdi
callq 0x21528
movl 0x6c(%r15), %esi
movq %r14, %rdi
callq 0x21528
movl 0x10(%r12), %esi
movq %r14, %rdi
callq 0x21528
movsd 0x98(%r15), %xmm0
movq %r14, %rdi
callq 0x21559
movl 0xe8(%r15), %esi
movq %r14, %rdi
callq 0x21528
movl $0x7, %ebp
movq %r14, %rdi
xorl %esi, %esi
callq 0x21528
decl %ebp
jne 0x20955
cmpl $0x0, 0x10(%r12)
jle 0x2098c
xorl %ebp, %ebp
movq 0x8(%r12), %rax
movsd (%rax,%rbp,8), %xmm0
movq %r14, %rdi
callq 0x21559
incq %rbp
movslq 0x10(%r12), %rax
cmpq %rax, %rbp
jl 0x2096d
cmpl $0x0, 0x6c(%r15)
jle 0x209b5
xorl %r12d, %r12d
movq 0x60(%r15), %rax
movq (%rax,%r12,8), %rax
movl 0x20(%rax), %esi
movq %r14, %rdi
callq 0x21528
incq %r12
movslq 0x6c(%r15), %rax
cmpq %rax, %r12
jl 0x20996
incq %r13
movq (%rsp), %rax
movslq 0x1c(%rax), %rax
cmpq %rax, %r13
jl 0x208b1
movq (%rsp), %rax
cmpl $0x0, 0x2c(%rax)
jle 0x20aa1
xorl %r12d, %r12d
movq (%rsp), %rax
movq 0x20(%rax), %rax
movq (%rax,%r12,8), %r15
movq 0x18(%r15), %rax
testq %rax, %rax
je 0x209f4
movl 0x10(%rax), %ebp
jmp 0x209f9
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movq 0x60(%r15), %rsi
movq %r14, %rdi
movl $0x100, %edx            # imm = 0x100
callq 0x214a5
movq %r15, %rdi
callq 0x4048a
movq %r14, %rdi
movl %eax, %esi
callq 0x21528
movl 0x6c(%r15), %esi
movq %r14, %rdi
callq 0x21528
movq %r14, %rdi
movl %ebp, %esi
callq 0x21528
movl 0x2c(%r15), %esi
movq %r14, %rdi
callq 0x21528
movsd 0x70(%r15), %xmm0
movq %r14, %rdi
callq 0x21559
movsd 0x78(%r15), %xmm0
movq %r14, %rdi
callq 0x21559
movsd 0x80(%r15), %xmm0
movq %r14, %rdi
callq 0x21559
movl 0x88(%r15), %esi
movq %r14, %rdi
callq 0x21528
movl $0x3, %ebp
movq %r14, %rdi
xorl %esi, %esi
callq 0x21528
decl %ebp
jne 0x20a7f
incq %r12
movq (%rsp), %rax
movslq 0x2c(%rax), %rax
cmpq %rax, %r12
jl 0x209da
movq (%rsp), %rax
cmpl $0x0, 0xac(%rax)
jle 0x20b5b
xorl %r12d, %r12d
movq (%rsp), %rax
movq 0xa0(%rax), %rax
movq (%rax,%r12,8), %r15
movq 0x18(%r15), %rsi
movq %r14, %rdi
movl $0x100, %edx            # imm = 0x100
callq 0x214a5
movsd 0x20(%r15), %xmm0
movq %r14, %rdi
callq 0x21559
movsd 0x28(%r15), %xmm0
movq %r14, %rdi
callq 0x21559
movsd 0x30(%r15), %xmm0
movq %r14, %rdi
callq 0x21559
movq (%r15), %rax
movq %r15, %rdi
callq *0x10(%rax)
movq %r14, %rdi
movl %eax, %esi
callq 0x21528
movl $0x4, %ebp
movq %r14, %rdi
xorl %esi, %esi
callq 0x21528
decl %ebp
jne 0x20b17
movq (%r15), %rax
movq %r15, %rdi
callq *0x10(%rax)
cmpl $0x3, %eax
jne 0x20b44
movq 0x48(%r15), %rsi
movq %r14, %rdi
movl $0x100, %edx            # imm = 0x100
callq 0x214a5
incq %r12
movq (%rsp), %rax
movslq 0xac(%rax), %rax
cmpq %rax, %r12
jl 0x20ab5
movq (%rsp), %rax
cmpl $0x0, 0x5c(%rax)
jle 0x20c1d
xorl %r15d, %r15d
movq (%rsp), %rax
movq 0x50(%rax), %rax
movq (%rax,%r15,8), %r12
movl 0x34(%r12), %esi
movq %r14, %rdi
callq 0x21528
movl 0x24(%r12), %esi
movq %r14, %rdi
callq 0x21528
movl 0x30(%r12), %esi
movq %r14, %rdi
callq 0x21528
movl $0x4, %ebp
movq %r14, %rdi
xorl %esi, %esi
callq 0x21528
decl %ebp
jne 0x20ba4
cmpl $0x0, 0x24(%r12)
jle 0x20bde
xorl %r13d, %r13d
movq 0x18(%r12), %rax
movq (%rax,%r13,8), %rax
movl 0x10(%rax), %esi
movq %r14, %rdi
callq 0x21528
incq %r13
movslq 0x24(%r12), %rax
cmpq %rax, %r13
jl 0x20bbd
cmpl $0x0, 0x30(%r12)
jle 0x20c09
xorl %r13d, %r13d
movq 0x28(%r12), %rax
movsd (%rax,%r13,8), %xmm0
movq %r14, %rdi
callq 0x21559
incq %r13
movslq 0x30(%r12), %rax
cmpq %rax, %r13
jl 0x20be9
incq %r15
movq (%rsp), %rax
movslq 0x5c(%rax), %rax
cmpq %rax, %r15
jl 0x20b6c
movq (%rsp), %rax
cmpl $0x0, 0x6c(%rax)
jle 0x20cdf
xorl %r15d, %r15d
movq (%rsp), %rax
movq 0x60(%rax), %rax
movq (%rax,%r15,8), %r12
movl 0x34(%r12), %esi
movq %r14, %rdi
callq 0x21528
movl 0x24(%r12), %esi
movq %r14, %rdi
callq 0x21528
movl 0x30(%r12), %esi
movq %r14, %rdi
callq 0x21528
movl $0x4, %ebp
movq %r14, %rdi
xorl %esi, %esi
callq 0x21528
decl %ebp
jne 0x20c66
cmpl $0x0, 0x24(%r12)
jle 0x20ca0
xorl %r13d, %r13d
movq 0x18(%r12), %rax
movq (%rax,%r13,8), %rax
movl 0x10(%rax), %esi
movq %r14, %rdi
callq 0x21528
incq %r13
movslq 0x24(%r12), %rax
cmpq %rax, %r13
jl 0x20c7f
cmpl $0x0, 0x30(%r12)
jle 0x20ccb
xorl %r13d, %r13d
movq 0x28(%r12), %rax
movsd (%rax,%r13,8), %xmm0
movq %r14, %rdi
callq 0x21559
incq %r13
movslq 0x30(%r12), %rax
cmpq %rax, %r13
jl 0x20cab
incq %r15
movq (%rsp), %rax
movslq 0x6c(%rax), %rax
cmpq %rax, %r15
jl 0x20c2e
movq (%rsp), %rax
cmpl $0x0, 0x7c(%rax)
jle 0x20d58
xorl %r15d, %r15d
movq (%rsp), %rax
movq 0x70(%rax), %rax
movq (%rax,%r15,8), %r12
movq 0x18(%r12), %rax
movq 0x28(%r12), %r13
movl 0x10(%rax), %esi
movq %r14, %rdi
callq 0x21528
movl 0x10(%r13), %esi
movq %r14, %rdi
callq 0x21528
movsd 0x38(%r12), %xmm0
movq %r14, %rdi
callq 0x21559
movl 0x40(%r12), %esi
movq %r14, %rdi
callq 0x21528
movl $0x4, %ebp
movq %r14, %rdi
xorl %esi, %esi
callq 0x21528
decl %ebp
jne 0x20d3a
incq %r15
movq (%rsp), %rax
movslq 0x7c(%rax), %rax
cmpq %rax, %r15
jl 0x20cec
movq (%rsp), %rax
cmpl $0x0, 0x8c(%rax)
jle 0x20efc
xorl %r13d, %r13d
leaq 0x98(%rsp), %r15
movq (%rsp), %rax
movq 0x80(%rax), %rax
movq (%rax,%r13,8), %rbp
movq 0xb8(%rbp), %rsi
movq %r14, %rdi
movl $0x100, %edx            # imm = 0x100
callq 0x214a5
movsd 0x28(%rbp), %xmm0
movq %r14, %rdi
callq 0x21559
movsd 0x30(%rbp), %xmm0
movq %r14, %rdi
callq 0x21559
movsd 0x38(%rbp), %xmm0
movq %r14, %rdi
callq 0x21559
leaq 0x70(%rbp), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x85490
movsd 0x98(%rsp), %xmm0
movq %r14, %rdi
callq 0x21559
movq %r15, %rdi
movq %r12, %rsi
callq 0x85490
movsd 0xa0(%rsp), %xmm0
movq %r14, %rdi
callq 0x21559
movq %r15, %rdi
movq %r12, %rsi
callq 0x85490
movsd 0xa8(%rsp), %xmm0
movq %r14, %rdi
callq 0x21559
movsd 0x58(%rbp), %xmm0
movq %r14, %rdi
callq 0x21559
movsd 0x60(%rbp), %xmm0
movq %r14, %rdi
callq 0x21559
movsd 0x68(%rbp), %xmm0
movq %r14, %rdi
callq 0x21559
movsd 0x88(%rbp), %xmm0
movq %r14, %rdi
callq 0x21559
movq 0x18(%rbp), %rax
testq %rax, %rax
je 0x20e5b
movl 0x20(%rax), %esi
jmp 0x20e60
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movq %r14, %rdi
callq 0x21528
movl 0x90(%rbp), %esi
movq %r14, %rdi
callq 0x21528
movl 0x94(%rbp), %esi
movq %r14, %rdi
callq 0x21528
movsd 0xa8(%rbp), %xmm0
movq %r14, %rdi
callq 0x21559
movsd 0x98(%rbp), %xmm0
movq %r14, %rdi
callq 0x21559
movsd 0xa0(%rbp), %xmm0
movq %r14, %rdi
callq 0x21559
movl 0xc0(%rbp), %esi
movq %r14, %rdi
callq 0x21528
movsd 0xb0(%rbp), %xmm0
movq %r14, %rdi
callq 0x21559
movl $0x4, %ebp
movq %r14, %rdi
xorl %esi, %esi
callq 0x21528
decl %ebp
jne 0x20ed7
incq %r13
movq (%rsp), %rax
movslq 0x8c(%rax), %rax
cmpq %rax, %r13
jl 0x20d74
movq (%rsp), %rax
cmpl $0x0, 0x9c(%rax)
jle 0x21332
xorl %r13d, %r13d
movq (%rsp), %rax
movq 0x90(%rax), %rax
movq (%rax,%r13,8), %r12
movq 0x1c0(%r12), %rsi
movq %r14, %rdi
movl $0x100, %edx            # imm = 0x100
callq 0x214a5
movsd 0x30(%r12), %xmm0
movq %r14, %rdi
callq 0x21559
movsd 0x38(%r12), %xmm0
movq %r14, %rdi
callq 0x21559
movsd 0x40(%r12), %xmm0
movq %r14, %rdi
callq 0x21559
leaq 0x78(%r12), %rbp
leaq 0x98(%rsp), %r15
movq %r15, %rdi
movq %rbp, %rsi
callq 0x85490
movsd 0x98(%rsp), %xmm0
movq %r14, %rdi
callq 0x21559
movq %r15, %rdi
movq %rbp, %rsi
callq 0x85490
movsd 0xa0(%rsp), %xmm0
movq %r14, %rdi
callq 0x21559
movq %r15, %rdi
movq %rbp, %rsi
callq 0x85490
movsd 0xa8(%rsp), %xmm0
movq %r14, %rdi
callq 0x21559
movsd 0x60(%r12), %xmm0
movq %r14, %rdi
callq 0x21559
movsd 0x68(%r12), %xmm0
movq %r14, %rdi
callq 0x21559
movsd 0x70(%r12), %xmm0
movq %r14, %rdi
callq 0x21559
movsd 0x90(%r12), %xmm0
movq %r14, %rdi
callq 0x21559
movq 0x18(%r12), %rax
testq %rax, %rax
je 0x21010
movl 0x10(%rax), %esi
jmp 0x21015
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movq %r14, %rdi
callq 0x21528
movl 0x98(%r12), %esi
movq %r14, %rdi
callq 0x21528
movl 0x9c(%r12), %esi
movq %r14, %rdi
callq 0x21528
movsd 0xb0(%r12), %xmm0
movq %r14, %rdi
callq 0x21559
movsd 0xb8(%r12), %xmm0
movq %r14, %rdi
callq 0x21559
movsd 0xa0(%r12), %xmm0
movq %r14, %rdi
callq 0x21559
movsd 0xa8(%r12), %xmm0
movq %r14, %rdi
callq 0x21559
movl 0x1c8(%r12), %esi
movq %r14, %rdi
callq 0x21528
movl 0xc0(%r12), %esi
movq %r14, %rdi
callq 0x21528
movl 0x1c8(%r12), %esi
andl $0x1, %esi
movq %r14, %rdi
callq 0x21528
movl $0x3, %ebp
movq %r14, %rdi
xorl %esi, %esi
callq 0x21528
decl %ebp
jne 0x210bd
cmpl $0x0, 0xc0(%r12)
je 0x21130
movsd 0xc8(%r12), %xmm0
movq %r14, %rdi
callq 0x21559
movsd 0xd0(%r12), %xmm0
movq %r14, %rdi
callq 0x21559
movsd 0xd8(%r12), %xmm0
movq %r14, %rdi
callq 0x21559
movsd 0xe0(%r12), %xmm0
movq %r14, %rdi
callq 0x21559
movsd 0xe8(%r12), %xmm0
movq %r14, %rdi
callq 0x21559
testb $0x1, 0x1c8(%r12)
je 0x2131b
leaq 0xf0(%r12), %rsi
leaq 0x98(%rsp), %rbx
movq %rbx, %rdi
callq 0x707ce
leaq 0x150(%r12), %rsi
leaq 0x118(%rsp), %rdi
callq 0x707ce
leaq 0x80(%rsp), %rdi
movq %rbx, %rsi
movq %r13, %rbp
leaq 0x5144ef(%rip), %r13    # 0x535670
movq %r13, %rdx
callq 0x7443a
leaq 0x68(%rsp), %rdi
leaq 0x118(%rsp), %r15
movq %r15, %rsi
movq %r13, %rdx
movq %rbp, %r13
callq 0x7443a
leaq 0x50(%rsp), %rdi
movq %rbx, %rsi
leaq 0xc40ad(%rip), %rbp     # 0xe5260
movq %rbp, %rdx
callq 0x743c2
leaq 0x38(%rsp), %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0x743c2
leaq 0x20(%rsp), %rdi
movq %rbx, %rsi
leaq 0xc4026(%rip), %rbp     # 0xe5200
movq %rbp, %rdx
callq 0x743c2
leaq 0x8(%rsp), %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0x743c2
movsd 0x80(%rsp), %xmm0
movq %r14, %rdi
callq 0x21559
movsd 0x88(%rsp), %xmm0
movq %r14, %rdi
callq 0x21559
movsd 0x90(%rsp), %xmm0
movq %r14, %rdi
callq 0x21559
movsd 0x50(%rsp), %xmm0
movq %r14, %rdi
callq 0x21559
movsd 0x58(%rsp), %xmm0
movq %r14, %rdi
callq 0x21559
movsd 0x60(%rsp), %xmm0
movq %r14, %rdi
callq 0x21559
movsd 0x20(%rsp), %xmm0
movq %r14, %rdi
callq 0x21559
movsd 0x28(%rsp), %xmm0
movq %r14, %rdi
callq 0x21559
movsd 0x30(%rsp), %xmm0
movq %r14, %rdi
callq 0x21559
movsd 0x68(%rsp), %xmm0
movq %r14, %rdi
callq 0x21559
movsd 0x70(%rsp), %xmm0
movq %r14, %rdi
callq 0x21559
movsd 0x78(%rsp), %xmm0
movq %r14, %rdi
callq 0x21559
movsd 0x38(%rsp), %xmm0
movq %r14, %rdi
callq 0x21559
movsd 0x40(%rsp), %xmm0
movq %r14, %rdi
callq 0x21559
movsd 0x48(%rsp), %xmm0
movq %r14, %rdi
callq 0x21559
movsd 0x8(%rsp), %xmm0
movq %r14, %rdi
callq 0x21559
movsd 0x10(%rsp), %xmm0
movq %r14, %rdi
callq 0x21559
movsd 0x18(%rsp), %xmm0
movq %r14, %rdi
callq 0x21559
movsd 0x1b0(%r12), %xmm0
movq %r14, %rdi
callq 0x21559
movsd 0x1b8(%r12), %xmm0
movq %r14, %rdi
callq 0x21559
incq %r13
movq (%rsp), %rax
movslq 0x9c(%rax), %rax
cmpq %rax, %r13
jl 0x20f10
movq (%rsp), %rax
cmpl $0x0, 0x3c(%rax)
jle 0x213cb
xorl %r15d, %r15d
movq (%rsp), %rax
movq 0x30(%rax), %rax
movq (%rax,%r15,8), %r12
movl 0x2c(%r12), %esi
movq %r14, %rdi
callq 0x21528
movq 0x18(%r12), %rax
movl 0x10(%rax), %esi
movq %r14, %rdi
callq 0x21528
movl 0x28(%r12), %esi
movq %r14, %rdi
callq 0x21528
movl $0x4, %ebp
movq %r14, %rdi
xorl %esi, %esi
callq 0x21528
decl %ebp
jne 0x2137e
cmpl $0x0, 0x28(%r12)
jle 0x213b7
xorl %r13d, %r13d
movq 0x20(%r12), %rax
movsd (%rax,%r13,8), %xmm0
movq %r14, %rdi
callq 0x21559
incq %r13
movslq 0x28(%r12), %rax
cmpq %rax, %r13
jl 0x21397
incq %r15
movq (%rsp), %rax
movslq 0x3c(%rax), %rax
cmpq %rax, %r15
jl 0x21343
movq (%rsp), %rax
cmpl $0x0, 0x4c(%rax)
jle 0x21464
xorl %r15d, %r15d
movq (%rsp), %rax
movq 0x40(%rax), %rax
movq (%rax,%r15,8), %r12
movl 0x2c(%r12), %esi
movq %r14, %rdi
callq 0x21528
movq 0x18(%r12), %rax
movl 0x10(%rax), %esi
movq %r14, %rdi
callq 0x21528
movl 0x28(%r12), %esi
movq %r14, %rdi
callq 0x21528
movl $0x4, %ebp
movq %r14, %rdi
xorl %esi, %esi
callq 0x21528
decl %ebp
jne 0x21417
cmpl $0x0, 0x28(%r12)
jle 0x21450
xorl %r13d, %r13d
movq 0x20(%r12), %rax
movsd (%rax,%r13,8), %xmm0
movq %r14, %rdi
callq 0x21559
incq %r13
movslq 0x28(%r12), %rax
cmpq %rax, %r13
jl 0x21430
incq %r15
movq (%rsp), %rax
movslq 0x4c(%rax), %rax
cmpq %rax, %r15
jl 0x213dc
movq (%rsp), %rax
andb $-0x2, 0x1e8(%rax)
movl $0x1, %ebx
jmp 0x21491
movq (%rsp), %rax
movq 0x1c0(%rax), %rsi
leaq 0xbc492(%rip), %rdi     # 0xdd91a
xorl %ebx, %ebx
xorl %eax, %eax
callq 0xac81a
movl %ebx, %eax
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq