// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelScene.cpp
// Function: gaps::R3SurfelScene::WriteAsciiStream(_IO_FILE*)
int R3SurfelScene::
WriteAsciiStream(FILE *fp)
{
  // Write header
  fprintf(fp, "SSA 1.1\n");

  // Write scene header
  WriteAsciiString(fp, name);
  fprintf(fp, " %d %d %d %d %d %d %d %d %d %d %d %d", 
    tree->NNodes(), NObjects(), NLabels(), NFeatures(),
    NObjectRelationships(), NLabelRelationships(), 
    NLabelAssignments(), NScans(), 
    NObjectProperties(), NLabelProperties(),
    NImages(), NComments());
  for (int j = 0; j < 3; j++) fprintf(fp, " 0");
  fprintf(fp, "\n");

  // Write transformation
  fprintf(fp, "T");
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 4; j++) {
      fprintf(fp, " %g", Transformation().Matrix()[i][j]);
    }
  }
  fprintf(fp, "\n");

  // Write comments
  for (int i = 0; i < NComments(); i++) {
    fprintf(fp, "C ");
    WriteAsciiString(fp, Comment(i));
    fprintf(fp, "\n");
  }

  // Write nodes
  for (int i = 0; i < tree->NNodes(); i++) {
    R3SurfelNode *node = tree->Node(i);
    int parent_index = (node->Parent()) ? node->Parent()->TreeIndex() : -1;
    fprintf(fp, "N ");
    WriteAsciiString(fp, node->Name());
    fprintf(fp, " %d %d %d %d %g %g", parent_index, node->NParts(), node->NBlocks(), 0, node->Complexity(), node->Resolution());
    for (int j = 0; j < 8; j++) fprintf(fp, " 0");
    fprintf(fp, "\n");
    for (int j = 0; j < node->NBlocks(); j++) {
      R3SurfelBlock *block = node->Block(j);
      fprintf(fp, "%d ", block->DatabaseIndex());
    }
    fprintf(fp, "\n");
  }

  // 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();
    const R3SurfelFeatureVector& feature_vector = object->feature_vector;
    fprintf(fp, "O ");
    WriteAsciiString(fp, object->Name());
    fprintf(fp, " %d %d %d %d %d %g %u", object->Identifier(), parent_index, object->NParts(), object->NNodes(), 
            feature_vector.NValues(), object->Complexity(), (unsigned int) object->Flags());
    for (int j = 0; j < 7; j++) fprintf(fp, " 0");
    fprintf(fp, "\n");
    for (int j = 0; j < feature_vector.NValues(); j++) {
      fprintf(fp, "%g ", feature_vector.Value(j));
    }
    fprintf(fp, "\n");
    for (int j = 0; j < object->NNodes(); j++) {
      R3SurfelNode *node = object->Node(j);
      fprintf(fp, "%d ", node->TreeIndex());
    }
    fprintf(fp, "\n");
  }

  // Write labels
  for (int i = 0; i < NLabels(); i++) {
    R3SurfelLabel *label = Label(i);
    int dummy = 0;
    const RNRgb& color = label->Color();
    int parent_index = (label->Parent()) ? label->Parent()->SceneIndex() : -1;
    fprintf(fp, "L ");
    WriteAsciiString(fp, label->Name());
    fprintf(fp, " %d %d %d %d %d %g %g %g %u", label->Identifier(), label->AssignmentKeystroke(), 
      dummy, parent_index, label->NParts(), color.R(), color.G(), color.B(),
      (unsigned int) label->Flags());
    for (int j = 0; j < 3; j++) fprintf(fp, " 0");
    fprintf(fp, "\n");
  }

  // Write features
  for (int i = 0; i < NFeatures(); i++) {
    R3SurfelFeature *feature = Feature(i);
    fprintf(fp, "F ");
    WriteAsciiString(fp, feature->Name());
    fprintf(fp, " %g %g %g %d %d", feature->Minimum(), feature->Maximum(), feature->Weight(), feature->Type(), 1);
    for (int j = 0; j < 1; j++) fprintf(fp, " 0");
    fprintf(fp, "\n");
    if (feature->Type() == R3_SURFEL_OVERHEAD_GRID_FEATURE_TYPE) {
      const char *filename = ((R3SurfelOverheadGridFeature *) feature)->filename;
      fprintf(fp, "%s\n", (filename) ? filename : "None");
    }
  }

  // Write object relationships
  for (int i = 0; i < NObjectRelationships(); i++) {
    R3SurfelObjectRelationship *relationship = ObjectRelationship(i);
    fprintf(fp, "OR %d %d %d", relationship->Type(), relationship->NObjects(), relationship->NOperands());
    for (int j = 0; j < 4; j++) fprintf(fp, " 0");
    for (int j = 0; j < relationship->NObjects(); j++) fprintf(fp, " %d", relationship->Object(j)->SceneIndex());
    fprintf(fp, "\n");
    for (int j = 0; j < relationship->NOperands(); j++) fprintf(fp, " %g", relationship->Operand(j));
    fprintf(fp, "\n");
    fprintf(fp, "\n");
  }

  // Write label relationships
  for (int i = 0; i < NLabelRelationships(); i++) {
    R3SurfelLabelRelationship *relationship = LabelRelationship(i);
    fprintf(fp, "LR %d %d %d", relationship->Type(), relationship->NLabels(), relationship->NOperands());
    for (int j = 0; j < 4; j++) fprintf(fp, " 0");
    for (int j = 0; j < relationship->NLabels(); j++) fprintf(fp, " %d", relationship->Label(j)->SceneIndex());
    fprintf(fp, "\n");
    for (int j = 0; j < relationship->NOperands(); j++) fprintf(fp, " %g", relationship->Operand(j));
    fprintf(fp, "\n");
    fprintf(fp, "\n");
  }

  // Write assignments
  for (int i = 0; i < NLabelAssignments(); i++) {
    R3SurfelLabelAssignment *assignment = LabelAssignment(i);
    R3SurfelObject *object = assignment->Object();
    R3SurfelLabel *label = assignment->Label();
    fprintf(fp, "A %d %d %g %d", object->SceneIndex(), label->SceneIndex(), assignment->Confidence(), assignment->Originator());
    for (int j = 0; j < 4; j++) fprintf(fp, " 0");
    fprintf(fp, "\n");
  }

  // Write scans
  for (int i = 0; i < NScans(); i++) {
    R3SurfelScan *scan = Scan(i);
    R3Point viewpoint = scan->Viewpoint();
    R3Vector towards = scan->Towards();
    R3Vector up = scan->Up();
    fprintf(fp, "S ");
    WriteAsciiString(fp, scan->Name());
    fprintf(fp, " %g %g %g", viewpoint.X(), viewpoint.Y(), viewpoint.Z());
    fprintf(fp, " %g %g %g", towards.X(), towards.Y(), towards.Z());
    fprintf(fp, " %g %g %g", up.X(), up.Y(), up.Z());
    fprintf(fp, " %.6f %d", scan->Timestamp(), (scan->Node()) ? scan->Node()->TreeIndex() : -1);
    fprintf(fp, " %d %d ", scan->ImageWidth(), scan->ImageHeight());
    fprintf(fp, " %g %g %g ", scan->XFocal(), scan->ImageCenter().X(), scan->ImageCenter().Y());
    fprintf(fp, " %u ", (unsigned int) scan->Flags());
    fprintf(fp, " %g ", scan->YFocal());
    for (int j = 0; j < 1; j++) fprintf(fp, " 0");
    fprintf(fp, "\n");
  }

  // Write images
  for (int i = 0; i < NImages(); i++) {
    R3SurfelImage *image = Image(i);
    R3Point viewpoint = image->Viewpoint();
    R3Vector towards = image->Towards();
    R3Vector up = image->Up();
    fprintf(fp, "I ");
    WriteAsciiString(fp, image->Name());
    fprintf(fp, " %g %g %g", viewpoint.X(), viewpoint.Y(), viewpoint.Z());
    fprintf(fp, " %g %g %g", towards.X(), towards.Y(), towards.Z());
    fprintf(fp, " %g %g %g", up.X(), up.Y(), up.Z());
    fprintf(fp, " %.6f", image->Timestamp());
    fprintf(fp, " %d ", (image->Scan()) ? image->Scan()->SceneIndex() : -1);
    fprintf(fp, " %d %d ", image->ImageWidth(), image->ImageHeight());
    fprintf(fp, " %g %g ", image->XFocal(), image->YFocal());
    fprintf(fp, " %g %g ", image->ImageCenter().X(), image->ImageCenter().Y());
    fprintf(fp, " %u ", (unsigned int) image->Flags());
    fprintf(fp, " %d ", image->DistortionType());
    fprintf(fp, " %d ", (image->HasRollingShutter()) ? 1 : 0);
    for (int j = 0; j < 2; j++) fprintf(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();
      fprintf(fp, "%g %g %g ", radial_distortion[0], radial_distortion[1], radial_distortion[2]);
      fprintf(fp, "%g %g ", tangential_distortion[0], 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;
      fprintf(fp, " %g %g %g ", viewpoint0.X(), viewpoint0.Y(), viewpoint0.Z());
      fprintf(fp, " %g %g %g ", towards0.X(), towards0.Y(), towards0.Z());
      fprintf(fp, " %g %g %g ", up0.X(), up0.Y(), up0.Z());
      fprintf(fp, " %g %g %g ", viewpoint1.X(), viewpoint1.Y(), viewpoint1.Z());
      fprintf(fp, " %g %g %g ", towards1.X(), towards1.Y(), towards1.Z());
      fprintf(fp, " %g %g %g ", up1.X(), up1.Y(), up1.Z());
      fprintf(fp, " %.9f %.9f ", rs_timestamps[0], rs_timestamps[1]);
    }
    fprintf(fp, "\n");
  }

  // Write object properties
  for (int i = 0; i < NObjectProperties(); i++) {
    R3SurfelObjectProperty *property = ObjectProperty(i);
    fprintf(fp, "OP %d %d %d", property->Type(), property->Object()->SceneIndex(), property->NOperands());
    for (int j = 0; j < 4; j++) fprintf(fp, " 0");
    fprintf(fp, "\n");
    for (int j = 0; j < property->NOperands(); j++) fprintf(fp, " %g", property->Operand(j));
    fprintf(fp, "\n");
    fprintf(fp, "\n");
  }

  // Write label properties
  for (int i = 0; i < NLabelProperties(); i++) {
    R3SurfelLabelProperty *property = LabelProperty(i);
    fprintf(fp, "LP %d %d %d", property->Type(), property->Label()->SceneIndex(), property->NOperands());
    for (int j = 0; j < 4; j++) fprintf(fp, " 0");
    fprintf(fp, "\n");
    for (int j = 0; j < property->NOperands(); j++) fprintf(fp, " %g", property->Operand(j));
    fprintf(fp, "\n");
    fprintf(fp, "\n");
  }

  // 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 $0x1f8, %rsp            # imm = 0x1F8
movq %rsi, %r14
movq %rdi, %rbx
leaq 0xc0061(%rip), %rdi     # 0xdd7d1
movl $0x8, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x139a0
movq 0x1d0(%rbx), %rsi
movq %r14, %rdi
callq 0x1e7c4
movq 0x8(%rbx), %rax
movl 0x24(%rax), %edx
movl 0x1c(%rbx), %ecx
movl 0x2c(%rbx), %r8d
movl 0xac(%rbx), %r9d
movl 0x5c(%rbx), %eax
movq %rax, 0x8(%rsp)
movl 0x6c(%rbx), %eax
movq %rax, 0x10(%rsp)
movl 0x7c(%rbx), %r11d
movl 0x8c(%rbx), %r15d
movl 0x3c(%rbx), %r12d
movl 0x4c(%rbx), %r13d
movl 0x9c(%rbx), %ebp
movq %rbx, (%rsp)
movl 0x1e4(%rbx), %r10d
leaq 0xbfff9(%rip), %rsi     # 0xdd7da
movq %r14, %rdi
xorl %eax, %eax
pushq %r10
pushq %rbp
pushq %r13
pushq %r12
pushq %r15
pushq %r11
pushq 0x40(%rsp)
pushq 0x40(%rsp)
callq 0x13740
addq $0x40, %rsp
movl $0x3, %ebp
leaq 0xcbeb8(%rip), %rbx     # 0xe96c6
movl $0x2, %esi
movl $0x1, %edx
movq %rbx, %rdi
movq %r14, %rcx
callq 0x139a0
decl %ebp
jne 0x1d80e
movl $0xa, %edi
movq %r14, %rsi
callq 0x13670
movl $0x54, %edi
movq %r14, %rsi
callq 0x13670
movq (%rsp), %rax
leaq 0xb8(%rax), %rbx
xorl %r12d, %r12d
leaq 0xbffbe(%rip), %r15     # 0xdd814
xorl %r13d, %r13d
movsd (%rbx,%r13,8), %xmm0
movq %r14, %rdi
movq %r15, %rsi
movb $0x1, %al
callq 0x13740
incq %r13
cmpq $0x4, %r13
jne 0x1d859
incq %r12
addq $0x20, %rbx
cmpq $0x4, %r12
jne 0x1d856
movl $0xa, %edi
movq %r14, %rsi
callq 0x13670
movq (%rsp), %rdx
cmpl $0x0, 0x1e4(%rdx)
jle 0x1d8f1
xorl %ebx, %ebx
leaq 0xbff5a(%rip), %r15     # 0xdd7ff
movl $0x2, %esi
movl $0x1, %edx
movq %r15, %rdi
movq %r14, %rcx
callq 0x139a0
movq (%rsp), %rax
movq 0x1d8(%rax), %rax
movq (%rax,%rbx,8), %rsi
movq %r14, %rdi
callq 0x1e7c4
movl $0xa, %edi
movq %r14, %rsi
callq 0x13670
movq (%rsp), %rdx
incq %rbx
movslq 0x1e4(%rdx), %rax
cmpq %rax, %rbx
jl 0x1d8a5
movq 0x8(%rdx), %rax
cmpl $0x0, 0x24(%rax)
jle 0x1da26
leaq 0xcbdc0(%rip), %r13     # 0xe96c6
leaq 0xbff96(%rip), %rbp     # 0xdd8a3
xorl %ebx, %ebx
movq 0x18(%rax), %rax
movq (%rax,%rbx,8), %r15
movq 0x28(%r15), %rax
testq %rax, %rax
je 0x1d929
movl 0x20(%rax), %eax
movl %eax, 0x8(%rsp)
jmp 0x1d931
movl $0xffffffff, 0x8(%rsp)  # imm = 0xFFFFFFFF
movl $0x2, %esi
movl $0x1, %edx
leaq 0xbfec0(%rip), %rdi     # 0xdd802
movq %r14, %rcx
callq 0x139a0
movq 0xb8(%r15), %rsi
movq %r14, %rdi
callq 0x1e7c4
movl 0x3c(%r15), %eax
movl %eax, 0x10(%rsp)
movl 0x4c(%r15), %r12d
movq %r15, %rdi
callq 0x3742e
movsd %xmm0, 0x18(%rsp)
movq %r15, %rdi
callq 0x37452
movaps %xmm0, %xmm1
movq %r14, %rdi
leaq 0xbfe7d(%rip), %rsi     # 0xdd805
movl 0x8(%rsp), %edx
movl 0x10(%rsp), %ecx
movl %r12d, %r8d
xorl %r9d, %r9d
movsd 0x18(%rsp), %xmm0
movb $0x2, %al
callq 0x13740
movl $0x8, %r12d
movl $0x2, %esi
movl $0x1, %edx
movq %r13, %rdi
movq %r14, %rcx
callq 0x139a0
decl %r12d
jne 0x1d9a9
movl $0xa, %edi
movq %r14, %rsi
callq 0x13670
cmpl $0x0, 0x4c(%r15)
jle 0x1da01
xorl %r12d, %r12d
movq 0x40(%r15), %rax
movq (%rax,%r12,8), %rax
movl 0xa0(%rax), %edx
movq %r14, %rdi
movq %rbp, %rsi
xorl %eax, %eax
callq 0x13740
incq %r12
movslq 0x4c(%r15), %rax
cmpq %rax, %r12
jl 0x1d9da
movl $0xa, %edi
movq %r14, %rsi
callq 0x13670
incq %rbx
movq (%rsp), %rdx
movq 0x8(%rdx), %rax
movslq 0x24(%rax), %rcx
cmpq %rcx, %rbx
jl 0x1d90f
cmpl $0x0, 0x1c(%rdx)
jle 0x1db9c
leaq 0xcbc8f(%rip), %r13     # 0xe96c6
leaq 0xbfe70(%rip), %rbp     # 0xdd8ae
leaq 0xbfe5e(%rip), %r15     # 0xdd8a3
xorl %ecx, %ecx
movq 0x10(%rdx), %rax
movq (%rax,%rcx,8), %r12
movq 0x18(%r12), %rax
testq %rax, %rax
movq %rcx, 0x8(%rsp)
je 0x1da63
movl 0x10(%rax), %ebx
jmp 0x1da68
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl $0x2, %esi
movl $0x1, %edx
leaq 0xbfd9f(%rip), %rdi     # 0xdd818
movq %r14, %rcx
callq 0x139a0
movq 0x88(%r12), %rsi
movq %r14, %rdi
callq 0x1e7c4
movq %r12, %rdi
callq 0x17056
movl 0x2c(%r12), %r8d
movl 0x6c(%r12), %r9d
movl 0x80(%r12), %r10d
movsd 0x98(%r12), %xmm0
movl 0xe8(%r12), %r11d
movq %r14, %rdi
leaq 0xbfd54(%rip), %rsi     # 0xdd81b
movl %eax, %edx
movl %ebx, %ecx
movb $0x1, %al
pushq %r11
pushq %r10
callq 0x13740
addq $0x10, %rsp
movl $0x7, %ebx
movl $0x2, %esi
movl $0x1, %edx
movq %r13, %rdi
movq %r14, %rcx
callq 0x139a0
decl %ebx
jne 0x1dadf
movl $0xa, %edi
movq %r14, %rsi
callq 0x13670
cmpl $0x0, 0x80(%r12)
jle 0x1db39
xorl %ebx, %ebx
movq 0x78(%r12), %rax
movsd (%rax,%rbx,8), %xmm0
movq %r14, %rdi
movq %rbp, %rsi
movb $0x1, %al
callq 0x13740
incq %rbx
movslq 0x80(%r12), %rax
cmpq %rax, %rbx
jl 0x1db12
movl $0xa, %edi
movq %r14, %rsi
callq 0x13670
cmpl $0x0, 0x6c(%r12)
jle 0x1db76
xorl %ebx, %ebx
movq 0x60(%r12), %rax
movq (%rax,%rbx,8), %rax
movl 0x20(%rax), %edx
movq %r14, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x13740
incq %rbx
movslq 0x6c(%r12), %rax
cmpq %rax, %rbx
jl 0x1db50
movl $0xa, %edi
movq %r14, %rsi
callq 0x13670
movq 0x8(%rsp), %rcx
incq %rcx
movq (%rsp), %rdx
movslq 0x1c(%rdx), %rax
cmpq %rax, %rcx
jl 0x1da47
cmpl $0x0, 0x2c(%rdx)
jle 0x1dc7e
xorl %ebx, %ebx
leaq 0xbfc85(%rip), %r12     # 0xdd834
leaq 0xcbb10(%rip), %r13     # 0xe96c6
movq 0x20(%rdx), %rax
movq (%rax,%rbx,8), %r15
movq 0x18(%r15), %rax
testq %rax, %rax
je 0x1dbcc
movl 0x10(%rax), %ebp
jmp 0x1dbd1
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl $0x2, %esi
movl $0x1, %edx
leaq 0xbfc4f(%rip), %rdi     # 0xdd831
movq %r14, %rcx
callq 0x139a0
movq 0x60(%r15), %rsi
movq %r14, %rdi
callq 0x1e7c4
movq %r15, %rdi
callq 0x4048a
movl 0x2c(%r15), %r10d
movl 0x6c(%r15), %ecx
movsd 0x70(%r15), %xmm0
movsd 0x78(%r15), %xmm1
movsd 0x80(%r15), %xmm2
movl 0x88(%r15), %r11d
movq %r14, %rdi
movq %r12, %rsi
movl %eax, %edx
xorl %r8d, %r8d
movl %ebp, %r9d
movb $0x3, %al
pushq %r11
pushq %r10
callq 0x13740
addq $0x10, %rsp
movl $0x3, %ebp
movl $0x2, %esi
movl $0x1, %edx
movq %r13, %rdi
movq %r14, %rcx
callq 0x139a0
decl %ebp
jne 0x1dc44
movl $0xa, %edi
movq %r14, %rsi
callq 0x13670
incq %rbx
movq (%rsp), %rdx
movslq 0x2c(%rdx), %rax
cmpq %rax, %rbx
jl 0x1dbb6
cmpl $0x0, 0xac(%rdx)
jle 0x1dd8a
leaq 0xbfbbe(%rip), %r15     # 0xdd850
leaq 0xbfbba(%rip), %r12     # 0xdd853
leaq 0xcba26(%rip), %r13     # 0xe96c6
xorl %ebx, %ebx
movq 0xa0(%rdx), %rax
movq (%rax,%rbx,8), %rbp
movl $0x2, %esi
movl $0x1, %edx
movq %r15, %rdi
movq %r14, %rcx
callq 0x139a0
movq 0x18(%rbp), %rsi
movq %r14, %rdi
callq 0x1e7c4
movsd 0x20(%rbp), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x28(%rbp), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x30(%rbp), %xmm0
movsd %xmm0, 0x18(%rsp)
movq (%rbp), %rax
movq %rbp, %rdi
callq *0x10(%rax)
movq %r14, %rdi
movq %r12, %rsi
movsd 0x8(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
movsd 0x18(%rsp), %xmm2
movl %eax, %edx
movl $0x1, %ecx
movb $0x3, %al
callq 0x13740
movl $0x2, %esi
movl $0x1, %edx
movq %r13, %rdi
movq %r14, %rcx
callq 0x139a0
movl $0xa, %edi
movq %r14, %rsi
callq 0x13670
movq (%rbp), %rax
movq %rbp, %rdi
callq *0x10(%rax)
cmpl $0x3, %eax
jne 0x1dd73
movq 0x48(%rbp), %rdx
testq %rdx, %rdx
leaq 0xbf7ce(%rip), %rax     # 0xdd52c
cmoveq %rax, %rdx
movq %r14, %rdi
leaq 0xc7fa9(%rip), %rsi     # 0xe5d15
xorl %eax, %eax
callq 0x13740
incq %rbx
movq (%rsp), %rdx
movslq 0xac(%rdx), %rax
cmpq %rax, %rbx
jl 0x1dca2
cmpl $0x0, 0x5c(%rdx)
jle 0x1de8b
leaq 0xcb92b(%rip), %r12     # 0xe96c6
leaq 0xca767(%rip), %r13     # 0xe8509
leaq 0xbfa6b(%rip), %rbp     # 0xdd814
xorl %ecx, %ecx
movq 0x50(%rdx), %rax
movq %rcx, 0x8(%rsp)
movq (%rax,%rcx,8), %r15
movl 0x34(%r15), %edx
movl 0x24(%r15), %ecx
movl 0x30(%r15), %r8d
movq %r14, %rdi
leaq 0xbfa95(%rip), %rsi     # 0xdd863
xorl %eax, %eax
callq 0x13740
movl $0x4, %ebx
movl $0x2, %esi
movl $0x1, %edx
movq %r12, %rdi
movq %r14, %rcx
callq 0x139a0
decl %ebx
jne 0x1ddda
cmpl $0x0, 0x24(%r15)
jle 0x1de20
xorl %ebx, %ebx
movq 0x18(%r15), %rax
movq (%rax,%rbx,8), %rax
movl 0x10(%rax), %edx
movq %r14, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x13740
incq %rbx
movslq 0x24(%r15), %rax
cmpq %rax, %rbx
jl 0x1ddfc
movl $0xa, %edi
movq %r14, %rsi
callq 0x13670
cmpl $0x0, 0x30(%r15)
jle 0x1de58
xorl %ebx, %ebx
movq 0x28(%r15), %rax
movsd (%rax,%rbx,8), %xmm0
movq %r14, %rdi
movq %rbp, %rsi
movb $0x1, %al
callq 0x13740
incq %rbx
movslq 0x30(%r15), %rax
cmpq %rax, %rbx
jl 0x1de36
movl $0xa, %edi
movq %r14, %rsi
callq 0x13670
movl $0xa, %edi
movq %r14, %rsi
callq 0x13670
movq 0x8(%rsp), %rcx
incq %rcx
movq (%rsp), %rdx
movslq 0x5c(%rdx), %rax
cmpq %rax, %rcx
jl 0x1ddab
cmpl $0x0, 0x6c(%rdx)
jle 0x1df8c
leaq 0xcb82a(%rip), %r12     # 0xe96c6
leaq 0xca666(%rip), %r13     # 0xe8509
leaq 0xbf96a(%rip), %rbp     # 0xdd814
xorl %ecx, %ecx
movq 0x60(%rdx), %rax
movq %rcx, 0x8(%rsp)
movq (%rax,%rcx,8), %r15
movl 0x34(%r15), %edx
movl 0x24(%r15), %ecx
movl 0x30(%r15), %r8d
movq %r14, %rdi
leaq 0xbf9a0(%rip), %rsi     # 0xdd86f
xorl %eax, %eax
callq 0x13740
movl $0x4, %ebx
movl $0x2, %esi
movl $0x1, %edx
movq %r12, %rdi
movq %r14, %rcx
callq 0x139a0
decl %ebx
jne 0x1dedb
cmpl $0x0, 0x24(%r15)
jle 0x1df21
xorl %ebx, %ebx
movq 0x18(%r15), %rax
movq (%rax,%rbx,8), %rax
movl 0x10(%rax), %edx
movq %r14, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x13740
incq %rbx
movslq 0x24(%r15), %rax
cmpq %rax, %rbx
jl 0x1defd
movl $0xa, %edi
movq %r14, %rsi
callq 0x13670
cmpl $0x0, 0x30(%r15)
jle 0x1df59
xorl %ebx, %ebx
movq 0x28(%r15), %rax
movsd (%rax,%rbx,8), %xmm0
movq %r14, %rdi
movq %rbp, %rsi
movb $0x1, %al
callq 0x13740
incq %rbx
movslq 0x30(%r15), %rax
cmpq %rax, %rbx
jl 0x1df37
movl $0xa, %edi
movq %r14, %rsi
callq 0x13670
movl $0xa, %edi
movq %r14, %rsi
callq 0x13670
movq 0x8(%rsp), %rcx
incq %rcx
movq (%rsp), %rdx
movslq 0x6c(%rdx), %rax
cmpq %rax, %rcx
jl 0x1deac
cmpl $0x0, 0x7c(%rdx)
jle 0x1e009
xorl %ebx, %ebx
leaq 0xbf8e0(%rip), %r15     # 0xdd87b
leaq 0xcb724(%rip), %r12     # 0xe96c6
movq 0x70(%rdx), %rax
movq (%rax,%rbx,8), %rax
movq 0x18(%rax), %rcx
movq 0x28(%rax), %rsi
movl 0x10(%rcx), %edx
movl 0x10(%rsi), %ecx
movsd 0x38(%rax), %xmm0
movl 0x40(%rax), %r8d
movq %r14, %rdi
movq %r15, %rsi
movb $0x1, %al
callq 0x13740
movl $0x4, %ebp
movl $0x2, %esi
movl $0x1, %edx
movq %r12, %rdi
movq %r14, %rcx
callq 0x139a0
decl %ebp
jne 0x1dfd3
movl $0xa, %edi
movq %r14, %rsi
callq 0x13670
incq %rbx
movq (%rsp), %rdx
movslq 0x7c(%rdx), %rax
cmpq %rax, %rbx
jl 0x1dfa2
cmpl $0x0, 0x8c(%rdx)
jle 0x1e1eb
leaq 0xbf86f(%rip), %r15     # 0xdd88c
leaq 0xbf889(%rip), %r13     # 0xdd8ad
leaq 0xcb69b(%rip), %rbp     # 0xe96c6
xorl %ebx, %ebx
movq 0x80(%rdx), %rax
movq (%rax,%rbx,8), %r12
leaq 0x28(%r12), %rsi
leaq 0x178(%rsp), %rdi
callq 0x83dd2
leaq 0x70(%r12), %rsi
leaq 0xf8(%rsp), %rdi
callq 0x85490
leaq 0x58(%r12), %rsi
leaq 0x20(%rsp), %rdi
callq 0x84866
movl $0x2, %esi
movl $0x1, %edx
leaq 0xbf80d(%rip), %rdi     # 0xdd889
movq %r14, %rcx
callq 0x139a0
movq 0xb8(%r12), %rsi
movq %r14, %rdi
callq 0x1e7c4
movsd 0x178(%rsp), %xmm0
movsd 0x180(%rsp), %xmm1
movsd 0x188(%rsp), %xmm2
movq %r14, %rdi
movq %r15, %rsi
movb $0x3, %al
callq 0x13740
movsd 0xf8(%rsp), %xmm0
movsd 0x100(%rsp), %xmm1
movsd 0x108(%rsp), %xmm2
movq %r14, %rdi
movq %r15, %rsi
movb $0x3, %al
callq 0x13740
movsd 0x20(%rsp), %xmm0
movsd 0x28(%rsp), %xmm1
movsd 0x30(%rsp), %xmm2
movq %r14, %rdi
movq %r15, %rsi
movb $0x3, %al
callq 0x13740
movq 0x18(%r12), %rax
testq %rax, %rax
je 0x1e112
movl 0x20(%rax), %edx
jmp 0x1e117
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movsd 0x88(%r12), %xmm0
movq %r14, %rdi
leaq 0xbf76b(%rip), %rsi     # 0xdd896
movb $0x1, %al
callq 0x13740
movl 0x90(%r12), %edx
movl 0x94(%r12), %ecx
movq %r14, %rdi
leaq 0xbf753(%rip), %rsi     # 0xdd89f
xorl %eax, %eax
callq 0x13740
movsd 0xa8(%r12), %xmm0
movsd 0x98(%r12), %xmm1
movsd 0xa0(%r12), %xmm2
movq %r14, %rdi
leaq 0xbf72c(%rip), %rsi     # 0xdd8a7
movb $0x3, %al
callq 0x13740
movl 0xc0(%r12), %edx
movq %r14, %rdi
leaq 0xbfdf5(%rip), %rsi     # 0xddf89
xorl %eax, %eax
callq 0x13740
movsd 0xb0(%r12), %xmm0
movq %r14, %rdi
movq %r13, %rsi
movb $0x1, %al
callq 0x13740
movl $0x2, %esi
movl $0x1, %edx
movq %rbp, %rdi
movq %r14, %rcx
callq 0x139a0
movl $0xa, %edi
movq %r14, %rsi
callq 0x13670
incq %rbx
movq (%rsp), %rdx
movslq 0x8c(%rdx), %rax
cmpq %rax, %rbx
jl 0x1e02d
cmpl $0x0, 0x9c(%rdx)
jle 0x1e616
leaq 0xbf6a3(%rip), %r12     # 0xdd8a2
xorl %ebx, %ebx
movq 0x90(%rdx), %rax
movq (%rax,%rbx,8), %rbp
leaq 0x30(%rbp), %rsi
leaq 0x20(%rsp), %rdi
callq 0x83dd2
leaq 0x78(%rbp), %rsi
leaq 0xe0(%rsp), %rdi
callq 0x85490
leaq 0x60(%rbp), %rsi
leaq 0xc8(%rsp), %rdi
callq 0x84866
movl $0x2, %esi
movl $0x1, %edx
leaq 0xbf665(%rip), %rdi     # 0xdd8b2
movq %r14, %rcx
callq 0x139a0
movq 0x1c0(%rbp), %rsi
movq %r14, %rdi
callq 0x1e7c4
movsd 0x20(%rsp), %xmm0
movsd 0x28(%rsp), %xmm1
movsd 0x30(%rsp), %xmm2
movq %r14, %rdi
leaq 0xbf60c(%rip), %r15     # 0xdd88c
movq %r15, %rsi
movb $0x3, %al
callq 0x13740
movsd 0xe0(%rsp), %xmm0
movsd 0xe8(%rsp), %xmm1
movsd 0xf0(%rsp), %xmm2
movq %r14, %rdi
movq %r15, %rsi
movb $0x3, %al
callq 0x13740
movsd 0xc8(%rsp), %xmm0
movsd 0xd0(%rsp), %xmm1
movsd 0xd8(%rsp), %xmm2
movq %r14, %rdi
movq %r15, %rsi
movb $0x3, %al
callq 0x13740
movsd 0x90(%rbp), %xmm0
movq %r14, %rdi
leaq 0xbf5c9(%rip), %rsi     # 0xdd8b5
movb $0x1, %al
callq 0x13740
movq 0x18(%rbp), %rax
testq %rax, %rax
je 0x1e301
movl 0x10(%rax), %edx
jmp 0x1e306
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r14, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0x13740
movl 0x98(%rbp), %edx
movl 0x9c(%rbp), %ecx
movq %r14, %rdi
leaq 0xbf576(%rip), %rsi     # 0xdd89f
xorl %eax, %eax
callq 0x13740
movsd 0xb0(%rbp), %xmm0
movsd 0xb8(%rbp), %xmm1
movq %r14, %rdi
leaq 0xbf560(%rip), %r15     # 0xdd8aa
movq %r15, %rsi
movb $0x2, %al
callq 0x13740
movsd 0xa0(%rbp), %xmm0
movsd 0xa8(%rbp), %xmm1
movq %r14, %rdi
movq %r15, %rsi
movb $0x2, %al
callq 0x13740
movl 0x1c8(%rbp), %edx
movq %r14, %rdi
leaq 0xbfc08(%rip), %rsi     # 0xddf89
xorl %eax, %eax
callq 0x13740
movl 0xc0(%rbp), %edx
movq %r14, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0x13740
movl 0x1c8(%rbp), %edx
andl $0x1, %edx
movq %r14, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0x13740
movl $0x2, %esi
movl $0x1, %edx
leaq 0xbf4f9(%rip), %r15     # 0xdd8bb
movq %r15, %rdi
movq %r14, %rcx
callq 0x139a0
movl $0x2, %esi
movl $0x1, %edx
movq %r15, %rdi
movq %r14, %rcx
callq 0x139a0
cmpl $0x0, 0xc0(%rbp)
je 0x1e435
movsd 0xc8(%rbp), %xmm0
movsd 0xd0(%rbp), %xmm1
movsd 0xd8(%rbp), %xmm2
movq %r14, %rdi
leaq 0xbf49b(%rip), %rsi     # 0xdd8a8
movb $0x3, %al
callq 0x13740
movsd 0xe0(%rbp), %xmm0
movsd 0xe8(%rbp), %xmm1
movq %r14, %rdi
leaq 0xbf47d(%rip), %rsi     # 0xdd8ab
movb $0x2, %al
callq 0x13740
testb $0x1, 0x1c8(%rbp)
je 0x1e5f2
leaq 0xf0(%rbp), %rsi
leaq 0x178(%rsp), %r15
movq %r15, %rdi
callq 0x707ce
leaq 0x150(%rbp), %rsi
leaq 0xf8(%rsp), %r13
movq %r13, %rdi
callq 0x707ce
leaq 0xb0(%rsp), %rdi
movq %r15, %rsi
leaq 0x5171ee(%rip), %r12    # 0x535670
movq %r12, %rdx
callq 0x7443a
leaq 0x98(%rsp), %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x7443a
leaq 0x80(%rsp), %rdi
movq %r15, %rsi
leaq 0xc6db1(%rip), %r12     # 0xe5260
movq %r12, %rdx
callq 0x743c2
leaq 0x68(%rsp), %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x743c2
leaq 0x50(%rsp), %rdi
movq %r15, %rsi
leaq 0xc6d2a(%rip), %r15     # 0xe5200
movq %r15, %rdx
callq 0x743c2
leaq 0x38(%rsp), %rdi
movq %r13, %rsi
leaq 0xbf3b5(%rip), %r12     # 0xdd8a2
movq %r15, %rdx
callq 0x743c2
movsd 0xb0(%rsp), %xmm0
movsd 0xb8(%rsp), %xmm1
movsd 0xc0(%rsp), %xmm2
movq %r14, %rdi
leaq 0xbf38d(%rip), %r15     # 0xdd8a7
movq %r15, %rsi
movb $0x3, %al
callq 0x13740
movsd 0x80(%rsp), %xmm0
movsd 0x88(%rsp), %xmm1
movsd 0x90(%rsp), %xmm2
movq %r14, %rdi
movq %r15, %rsi
movb $0x3, %al
callq 0x13740
movsd 0x50(%rsp), %xmm0
movsd 0x58(%rsp), %xmm1
movsd 0x60(%rsp), %xmm2
movq %r14, %rdi
movq %r15, %rsi
movb $0x3, %al
callq 0x13740
movsd 0x98(%rsp), %xmm0
movsd 0xa0(%rsp), %xmm1
movsd 0xa8(%rsp), %xmm2
movq %r14, %rdi
movq %r15, %rsi
movb $0x3, %al
callq 0x13740
movsd 0x68(%rsp), %xmm0
movsd 0x70(%rsp), %xmm1
movsd 0x78(%rsp), %xmm2
movq %r14, %rdi
movq %r15, %rsi
movb $0x3, %al
callq 0x13740
movsd 0x38(%rsp), %xmm0
movsd 0x40(%rsp), %xmm1
movsd 0x48(%rsp), %xmm2
movq %r14, %rdi
movq %r15, %rsi
movb $0x3, %al
callq 0x13740
movsd 0x1b0(%rbp), %xmm0
movsd 0x1b8(%rbp), %xmm1
movq %r14, %rdi
leaq 0xbf2d3(%rip), %rsi     # 0xdd8be
movb $0x2, %al
callq 0x13740
movl $0xa, %edi
movq %r14, %rsi
callq 0x13670
incq %rbx
movq (%rsp), %rdx
movslq 0x9c(%rdx), %rax
cmpq %rax, %rbx
jl 0x1e201
cmpl $0x0, 0x3c(%rdx)
jle 0x1e6de
leaq 0xcb09f(%rip), %r12     # 0xe96c6
leaq 0xbf1e6(%rip), %r13     # 0xdd814
xorl %ebx, %ebx
movq 0x30(%rdx), %rax
movq (%rax,%rbx,8), %rbp
movl 0x2c(%rbp), %edx
movq 0x18(%rbp), %rax
movl 0x10(%rax), %ecx
movl 0x28(%rbp), %r8d
movq %r14, %rdi
leaq 0xbf27a(%rip), %rsi     # 0xdd8ca
xorl %eax, %eax
callq 0x13740
movl $0x4, %r15d
movl $0x2, %esi
movl $0x1, %edx
movq %r12, %rdi
movq %r14, %rcx
callq 0x139a0
decl %r15d
jne 0x1e65d
movl $0xa, %edi
movq %r14, %rsi
callq 0x13670
cmpl $0x0, 0x28(%rbp)
jle 0x1e6b0
xorl %r15d, %r15d
movq 0x20(%rbp), %rax
movsd (%rax,%r15,8), %xmm0
movq %r14, %rdi
movq %r13, %rsi
movb $0x1, %al
callq 0x13740
incq %r15
movslq 0x28(%rbp), %rax
cmpq %rax, %r15
jl 0x1e68d
movl $0xa, %edi
movq %r14, %rsi
callq 0x13670
movl $0xa, %edi
movq %r14, %rsi
callq 0x13670
incq %rbx
movq (%rsp), %rdx
movslq 0x3c(%rdx), %rax
cmpq %rax, %rbx
jl 0x1e630
cmpl $0x0, 0x4c(%rdx)
jle 0x1e7a6
leaq 0xcafd7(%rip), %r12     # 0xe96c6
leaq 0xbf11e(%rip), %r13     # 0xdd814
xorl %ebx, %ebx
movq 0x40(%rdx), %rax
movq (%rax,%rbx,8), %rbp
movl 0x2c(%rbp), %edx
movq 0x18(%rbp), %rax
movl 0x10(%rax), %ecx
movl 0x28(%rbp), %r8d
movq %r14, %rdi
leaq 0xbf1be(%rip), %rsi     # 0xdd8d6
xorl %eax, %eax
callq 0x13740
movl $0x4, %r15d
movl $0x2, %esi
movl $0x1, %edx
movq %r12, %rdi
movq %r14, %rcx
callq 0x139a0
decl %r15d
jne 0x1e725
movl $0xa, %edi
movq %r14, %rsi
callq 0x13670
cmpl $0x0, 0x28(%rbp)
jle 0x1e778
xorl %r15d, %r15d
movq 0x20(%rbp), %rax
movsd (%rax,%r15,8), %xmm0
movq %r14, %rdi
movq %r13, %rsi
movb $0x1, %al
callq 0x13740
incq %r15
movslq 0x28(%rbp), %rax
cmpq %rax, %r15
jl 0x1e755
movl $0xa, %edi
movq %r14, %rsi
callq 0x13670
movl $0xa, %edi
movq %r14, %rsi
callq 0x13670
incq %rbx
movq (%rsp), %rdx
movslq 0x4c(%rdx), %rax
cmpq %rax, %rbx
jl 0x1e6f8
andb $-0x2, 0x1e8(%rdx)
movl $0x1, %eax
addq $0x1f8, %rsp            # imm = 0x1F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq