// File: /workspace/github_cpp_makefile_star2_O2/hzeller[P]gcode-multi-shell-extrude/multi-shell-extrude.cc
// Function: main
int main(int argc, char *argv[]) {
  ParamHeadline h1("Screw-data from template");
  StringParam fun_init    ("AABBBAABBBAABBB", "screw-template", 't', "Template string for screw.");
  FloatParam thread_depth (-1, "thread-depth", 'd',   "Depth of thread, initial-size/5 if negative");
  FloatParam twist        (0.0, "twist",        0,    "Twist ratio of angle per radius fraction (good -0.3..0.3)");

  ParamHeadline h2("Screw-data from polygon file");
  StringParam polygon_file("", "polygon-file", 'D',  "File describing polygon. Files with x y pairs");

  ParamHeadline h3("General Parameters");
  FloatParam total_height (-1,    "height", 'h', "Total height to be printed (must set)");
  FloatParam pitch        (30.0,  "pitch",  'p', "Millimeter height a full turn takes. "
                           "Negative for left-turning screw; 0 for straight hull.");
  FloatParam initial_size (10.0, "size",    's', "Polygon sizing parameter. Means radius if from "
                           "--screw-template, factor for --polygon-file");
  Vector2DParam center_offset(Vector2D(0.0, 0.0), "center-offset", 0, "Rotation-center offset into polygon.");
  BoolParam  auto_center(false, "auto-center", 0, "Automatically center around centroid.");
  FloatParam pump         (0.0,   "pump",    0, "Pump polygon as if the center was not a dot, but a circle of this radius");
  IntParam screw_count    (2,     "number", 'n', "Number of screws to be printed");
  FloatParam initial_shell(0,     "start-offset", 0, "Initial offset for first polygon");
  FloatParam shell_increment(1.2, "offset", 'R', "Offset increment between screws - the clearance");
  FloatParam lock_offset  (-1,    "lock-offset", 0, "EXPERIMENTAL offset to stop screw at end; Approx value: (offset - shell_thickness)/2 + 0.05");
  FloatParam brim(0, "brim", 0, "Add brim of this size on the bottom for better stability");
  FloatParam brim_spiral_factor(0.55, "brim-spiral-factor", 0,
                               "Distance between spirals in brim as factor of shell-thickness");
  FloatParam brim_smooth_radius(0, "brim-smooth-radius", 0, "Smoothing of brim connection to polygon to not get lost in inner details");
  BoolParam vessel(false, "vessel", 0, "Make a vessel with closed bottom");

  ParamHeadline h4("Quality");
  FloatParam layer_height (0.16,  "layer-height", 'l', "Height of each layer");
  FloatParam shell_thickness(0.8, "shell-thickness", 0, "Thickness of shell");
  FloatParam feed_mm_per_sec(100, "feed-rate",    'f', "maximum, in mm/s");
  FloatParam min_layer_time(3,    "layer-time",   'T', "Min time per layer; upper bound for feed-rate");
  FloatParam fan_on (0.3,  "fan-on-height", 0, "Height to switch on fan");
  FloatParam elephant_foot_multiplier (0.9,  "slender-elephant", 0, "Extrusion multiplier at first two layer heights to prevent elephant foot");
  FloatParam retract_amount (1.2, "retract", 0, "Millimeter of retract");
  FloatParam first_layer_feed_multiplier (0.7, "first-layer-speed", 0, "Feedrate multiplier for first layer");
  ParamHeadline h5("Printer Parameters");
  FloatParam nozzle_diameter(0.4, "nozzle-diameter", 0, "Diameter of extruder nozzle");
  FloatParam bed_temp(-1, "bed-temp", 0, "Bed temperature.");
  FloatParam temperature(190, "temperature", 0, "Extrusion temperature.");
  FloatParam temp_variation(0, "temperature-variation", 0, "Temperature variation around --temperature, e.g. to get dark lines in wood filament.");
  FloatParam filament_diameter(1.75, "filament-diameter", 0, "Diameter of filament");
  Vector2DParam machine_limit(Vector2D(150.0,150.0), "bed-size",    'L',  "x/y size limit of your printbed.");
  Vector2DParam head_offset(Vector2D(45.0,45.0),"head-offset", 'o', "dx/dy offset per print.");
  Vector2DParam edge_offset(Vector2D(5.0,5.0), "edge-offset",  0,  "Offset from the edge of the bed (bottom left origin).");

  // Output options
  ParamHeadline h6("Output Options");
  BoolParam do_postscript(false, "postscript", 'P', "PostScript output instead of GCode output");
  FloatParam postscript_thick_factor(1.0, "ps-thick-factor", 0, "Line thickness factor for shell size. Chooser smaller (e.g. 0.1) to better see overlaps");
  BoolParam matryoshka(false,    "nested",      0, "For PostScript: show nested (Matryoshka doll style)");

  if (!SetParametersFromCommandline(argc, argv)) {
    return ParameterUsage(argv[0]);
  }

  if (total_height < 0) {
    fprintf(stderr, "\n--height needs to be set\n\n");
    return ParameterUsage(argv[0]);
  }

  if (thread_depth < 0)
    thread_depth = initial_size / 5;

  if (matryoshka && !do_postscript) {
    fprintf(stderr, "Matryoshka mode only valid with postscript\n");
    return ParameterUsage(argv[0]);
  }

  // Calculated values from input parameters.
  const double nozzle_radius = nozzle_diameter / 2;
  const double filament_radius = filament_diameter / 2;
  const double shell_thickness_factor = shell_thickness / nozzle_diameter;

  matryoshka = matryoshka & do_postscript;   // Formulate it this way.

  // Get polygon we'll be working on; either from rotational input or file.
  Polygon input_polygon = (polygon_file.get().empty()
                           ? RotationalPolygon(fun_init.get().c_str(),
                                               initial_size,
                                               thread_depth, twist)
                           : ReadPolygon(polygon_file, initial_size));

  // Add pump if needed.
  if (pump > 0) {
    input_polygon = RadialPumpPolygon(input_polygon, pump);
  }

  if (auto_center) {
    center_offset = Centroid(input_polygon);
    center_offset = Vector2D(0,0) - center_offset;
  }

  // .. and offsetting
  if (center_offset->x != 0 || center_offset->y != 0) {
    input_polygon = OffsetCenter(input_polygon,
                                 center_offset->x, center_offset->y);
  }

  const Polygon base_polygon = input_polygon;
  if (base_polygon.empty()) {
    fprintf(stderr, "Polygon empty\n");
    return 1;
  }
  if (base_polygon.size() < 3) {
    fprintf(stderr, "Polygon is a %sgon :) Need at least 3 vertices.\n",
            base_polygon.size() == 1 ? "Mono" : "Duo");
    return 1;
  }

  // Determine limits
  if (matryoshka) {
    Polygon biggst_polygon
      = PolygonOffset(base_polygon,
                      initial_shell + (screw_count-1) * shell_increment);
    double max_radius = GetRadius(biggst_polygon) + brim;
    Vector2D poly_radius(max_radius + 5, max_radius + 5);
    machine_limit = poly_radius * 2;
    edge_offset = poly_radius;  // In matryoshka-case, edge_offset is center
  } else {
    const Vector2D max_machine = machine_limit - edge_offset;
    Vector2D pos = edge_offset;
    float radius = GetRadius(PolygonOffset(base_polygon, initial_shell));
    Vector2D screw_dimension(2 * (radius + brim), 2*(radius + brim));
    for (int i = 0; i < screw_count; ++i) {
      Vector2D new_pos = pos + screw_dimension;
      if (new_pos.x > max_machine.x || new_pos.y > max_machine.y) {
        fprintf(stderr, "With currently configured bedsize and printhead-offset, "
                "only %d screws fit (radius is %.1fmm)\n"
                "Configure your machine constraints with -L <x/y> -o < dx,dy> "
                "(currently -L %.0f,%.0f -o %.0f,%.0f)\n", i, radius,
                machine_limit->x, machine_limit->y,
                head_offset->x, head_offset->y);
        screw_count = i;
        break;
      }
      pos = new_pos + head_offset;
      screw_dimension = screw_dimension
        + Vector2D(shell_increment, shell_increment) * 2;
    }
    pos = pos - head_offset;
    // Now, pos is the largest corner. We can offset
    // the edge_offset now to the difference to center things.
    edge_offset = edge_offset + (max_machine - pos - edge_offset) / 2;
  }

  const double filament_extrusion_factor = shell_thickness_factor *
    (nozzle_radius * (layer_height/2)) / (filament_radius*filament_radius);

  Printer *printer = NULL;
  if (do_postscript) {
    total_height = std::min(total_height.get(),
                            3 * layer_height); // not needed more.
    // no move lines w/ Matryoshka
    printer = CreatePostscriptPrinter(!matryoshka,
                                      postscript_thick_factor * shell_thickness);
  } else {
    printer = CreateGCodePrinter(filament_extrusion_factor, retract_amount,
                                 temperature, bed_temp);
  }
  printer->Preamble(machine_limit, feed_mm_per_sec);

  printer->Comment("https://github.com/hzeller/gcode-multi-shell-extrude\n");
  printer->Comment("\n");
  printer->Comment(" ");
  for (int i = 0; i < argc; ++i)
    printf("%s ", argv[i]);
  printf("\n");
  printer->Comment("\n");
  if (!polygon_file.get().empty()) {
    printer->Comment("Polygon from polygon-file '%s'\n",
                     polygon_file.get().c_str());
    printer->Comment("size-factor=%.1f\n", initial_size.get());
  } else {
    printer->Comment("Polygon from screw template '%s'\n",
                     fun_init.get().c_str());
    printer->Comment("thread-depth=%.1fmm size=%.1fmm (radius)\n",
                     thread_depth.get(), initial_size.get());
  }
  printer->Comment("h=%.1fmm n=%d (shell-increment=%.1fmm)\n",
                   total_height.get(), screw_count.get(), shell_increment.get());
  printer->Comment("feed=%.1fmm/s (maximum; layer time at least %.1f s)\n",
                   feed_mm_per_sec.get(), min_layer_time.get());
  printer->Comment("pitch=%.1fmm/turn layer-height=%.3f\n",
                   pitch.get(), layer_height.get());
  printer->Comment("machine limits: bed: (%.0f/%.0f):  "
                  "head-offset: (%.0f,%.0f)\n",
                   machine_limit->x, machine_limit->y,
                   head_offset->x, head_offset->y);
  printer->Comment("----\n");

  printer->Init(machine_limit, feed_mm_per_sec);

  // How much the whole system should rotate per mm height.
  const double rotation_per_mm = (fabs(pitch) < 0.1) ? 0 : 1.0 / pitch;

  double total_time = 0;
  double total_travel = 0;

  constexpr float kHoverPos = 10.0;  // Hovering over screws while moving
  Vector2D center = edge_offset;
  printer->SetSpeed(feed_mm_per_sec);  // initial speed.
  for (int i = 0; i < screw_count; ++i) {
    const float current_offset = initial_shell + i * shell_increment;
    Polygon polygon = PolygonOffset(base_polygon, current_offset);
    if (polygon.size() == 0) {
      fprintf(stderr, "Polygon offset %.1f results in empty polygon\n",
              initial_shell + i * shell_increment);
      continue;
    }
    const double radius = GetRadius(polygon);
    Vector2D screw_radius(radius + brim, radius + brim);
    if (!matryoshka) {
      // We start here.
      center = center + screw_radius;
    }
    printer->MoveTo(center, i > 0 ? total_height + kHoverPos : kHoverPos);
    const float polygon_len = CalcPolygonLen(polygon);
    const float area = polygon_len * total_height * 2;  // inside and out.
    float layer_feedrate =  polygon_len / min_layer_time;
    layer_feedrate = std::min(layer_feedrate, feed_mm_per_sec.get());
    printer->ResetExtrude();
    printer->SetSpeed(layer_feedrate);
    printer->Comment("Screw #%d, polygon-offset=%.1f\n",
                     i+1, initial_shell + i * shell_increment);
    if (vessel) {
      const float spiral_layer_distance = shell_thickness * brim_spiral_factor;
      printer->Comment("Create vessel-bottom\n");
      printer->SetColor(0.5, 0, 0.5);
      CreateBottomPlate(polygon, printer, center,
                        0, -radius, spiral_layer_distance);
      // TODO: make this multi-layer.
      printer->GoZPos(2);
    }

    if (brim > 0) {
      const float spiral_layer_distance = shell_thickness * brim_spiral_factor;
      int layers = (int) ceil(brim / spiral_layer_distance);
      Polygon brim_polygon = polygon;
      if (brim_smooth_radius > 0)
        brim_polygon = PolygonOffset(PolygonOffset(polygon, brim_smooth_radius), -brim_smooth_radius);
      printer->Comment("Create brim\n");
      printer->SetColor(0, 0.5, 0);
      CreateBottomPlate(brim_polygon, printer, center,
                        layers * spiral_layer_distance, spiral_layer_distance/2,
                        spiral_layer_distance);
    }
    ExtrusionParams params = {
      .feedrate = layer_feedrate,
      .layer_height = layer_height,
      .total_height = total_height,
      .rotation_per_mm = rotation_per_mm,
      .lock_offset = lock_offset,
      .fan_on_height = fan_on,
      .elephant_foot_multiplier = elephant_foot_multiplier,
      .first_layer_feedrate_multiplier = first_layer_feed_multiplier,
      .base_temp = temperature,
      .temp_variation = temp_variation
    };

    CreateExtrusion(polygon, printer, center, params);
    const double travel = printer->GetExtrusionDistance();  // since last reset.
    total_travel += travel;
    total_time += travel / layer_feedrate;  // roughly (without acceleration)
    printer->SetSpeed(feed_mm_per_sec);
    printer->Retract();
    printer->GoZPos(total_height + kHoverPos);
    if (!matryoshka) {
      center = center + screw_radius + head_offset;
    }
    if (!do_postscript) {
      fprintf(stderr, "Screw-surface (out+in) for offset %.1f: ~%.1f cm²\n",
              current_offset, area / 100);
    }
  }

  printer->Postamble();
  if (!do_postscript) {  // doesn't make sense to print for PostScript
    int t = (int)total_time;
    const int hours = t / 3600;
    t %= 3600;
    const int minutes = t / 60;
    const int seconds = t % 60;
    fprintf(stderr, "Total time >= %02d:%02d:%02d; %.2fm filament\n", hours,
            minutes, seconds, total_travel * filament_extrusion_factor / 1000);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x938, %rsp            # imm = 0x938
movq %rsi, %r14
movl %edi, %r12d
leaq 0xe887(%rip), %rsi      # 0x1217a
leaq 0x918(%rsp), %rdi
callq 0x56c6
leaq 0xe88c(%rip), %rsi      # 0x12193
leaq 0x4a0(%rsp), %rdi
leaq 0x460(%rsp), %rdx
callq 0x56e2
leaq 0xe880(%rip), %rdx      # 0x121a3
leaq 0xe888(%rip), %r8       # 0x121b2
leaq 0x540(%rsp), %rdi
leaq 0x4a0(%rsp), %rsi
pushq $0x74
popq %rcx
callq 0x571e
leaq 0x4a0(%rsp), %rdi
callq 0x30f0
leaq 0xe877(%rip), %rsi      # 0x121cd
leaq 0xe87d(%rip), %rcx      # 0x121da
leaq 0x518(%rsp), %rdi
movss 0xe77b(%rip), %xmm0     # 0x120e8
pushq $0x64
popq %rdx
callq 0x5756
leaq 0xe88a(%rip), %rsi      # 0x12206
leaq 0xe889(%rip), %rcx      # 0x1220c
leaq 0x850(%rsp), %rdi
xorps %xmm0, %xmm0
xorl %edx, %edx
callq 0x5756
leaq 0xe8aa(%rip), %rsi      # 0x12246
leaq 0x8f8(%rsp), %rdi
callq 0x56c6
leaq 0xf926(%rip), %rsi      # 0x132d6
leaq 0x440(%rsp), %rdi
leaq 0x4c0(%rsp), %rdx
callq 0x56e2
leaq 0xe9ad(%rip), %rdx      # 0x12379
leaq 0xe890(%rip), %r8       # 0x12263
leaq 0x460(%rsp), %rdi
leaq 0x440(%rsp), %rsi
pushq $0x44
popq %rcx
callq 0x571e
leaq 0x440(%rsp), %rdi
callq 0x30f0
leaq 0xe892(%rip), %rsi      # 0x12291
leaq 0x8d8(%rsp), %rdi
callq 0x56c6
leaq 0xecb3(%rip), %rsi      # 0x126c6
leaq 0xe88a(%rip), %rcx      # 0x122a4
leaq 0x1a0(%rsp), %rdi
movss 0xe6be(%rip), %xmm0     # 0x120e8
pushq $0x68
popq %rdx
callq 0x5756
leaq 0xe891(%rip), %rsi      # 0x122ca
leaq 0xe890(%rip), %rcx      # 0x122d0
leaq 0x620(%rsp), %rdi
movss 0xe69c(%rip), %xmm0     # 0x120ec
pushq $0x70
popq %rdx
callq 0x5756
leaq 0xee3e(%rip), %rsi      # 0x1289d
leaq 0xe8c5(%rip), %rcx      # 0x1232b
leaq 0x2d8(%rsp), %rdi
movss 0xe67a(%rip), %xmm0     # 0x120f0
pushq $0x73
popq %rdx
callq 0x5756
leaq 0xe901(%rip), %rsi      # 0x12386
leaq 0xe908(%rip), %rcx      # 0x12394
leaq 0x4c0(%rsp), %rdi
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
xorl %edx, %edx
callq 0x5784
leaq 0xe911(%rip), %rdx      # 0x123b9
leaq 0xe916(%rip), %r8       # 0x123c5
leaq 0x828(%rsp), %rdi
xorl %esi, %esi
xorl %ecx, %ecx
callq 0x57c2
leaq 0xe924(%rip), %rsi      # 0x123eb
leaq 0xe922(%rip), %rcx      # 0x123f0
leaq 0x800(%rsp), %rdi
xorps %xmm0, %xmm0
xorl %edx, %edx
callq 0x5756
leaq 0xe952(%rip), %rdx      # 0x12439
leaq 0xe952(%rip), %r8       # 0x12440
leaq 0x2b0(%rsp), %rdi
pushq $0x2
popq %rsi
pushq $0x6e
popq %rcx
callq 0x57ee
leaq 0xe957(%rip), %rsi      # 0x1245f
leaq 0xe95d(%rip), %rcx      # 0x1246c
leaq 0x288(%rsp), %rdi
xorps %xmm0, %xmm0
xorl %edx, %edx
callq 0x5756
leaq 0xeda0(%rip), %rsi      # 0x128c8
leaq 0xe95e(%rip), %rcx      # 0x1248d
leaq 0x248(%rsp), %rdi
movss 0xe5b5(%rip), %xmm0     # 0x120f4
pushq $0x52
popq %rdx
callq 0x5756
leaq 0xe96f(%rip), %rsi      # 0x124bd
leaq 0xe974(%rip), %rcx      # 0x124c9
leaq 0x7d8(%rsp), %rdi
movss 0xe583(%rip), %xmm0     # 0x120e8
xorl %edx, %edx
callq 0x5756
leaq 0xe9b2(%rip), %rsi      # 0x12525
leaq 0xe9b0(%rip), %rcx      # 0x1252a
leaq 0x418(%rsp), %rdi
xorps %xmm0, %xmm0
xorl %edx, %edx
callq 0x5756
leaq 0xe9d0(%rip), %rsi      # 0x12563
leaq 0xe9dc(%rip), %rcx      # 0x12576
leaq 0x5f8(%rsp), %rdi
movss 0xe54e(%rip), %xmm0     # 0x120f8
xorl %edx, %edx
callq 0x5756
leaq 0xe9fc(%rip), %rsi      # 0x125b4
leaq 0xea08(%rip), %rcx      # 0x125c7
leaq 0x5d0(%rsp), %rdi
xorps %xmm0, %xmm0
xorl %edx, %edx
callq 0x5756
leaq 0xea38(%rip), %rdx      # 0x12610
leaq 0xea38(%rip), %r8       # 0x12617
leaq 0x7b0(%rsp), %rdi
xorl %esi, %esi
xorl %ecx, %ecx
callq 0x57c2
leaq 0xea41(%rip), %rsi      # 0x12638
leaq 0x8b8(%rsp), %rdi
callq 0x56c6
leaq 0xea35(%rip), %rsi      # 0x12640
leaq 0xea3b(%rip), %rcx      # 0x1264d
leaq 0x4f0(%rsp), %rdi
movss 0xe4da(%rip), %xmm0     # 0x120fc
pushq $0x6c
popq %rdx
callq 0x5756
leaq 0xe973(%rip), %rsi      # 0x125a4
leaq 0xea2a(%rip), %rcx      # 0x12662
leaq 0x3f0(%rsp), %rdi
movss 0xe4b8(%rip), %xmm0     # 0x12100
xorl %edx, %edx
callq 0x5756
leaq 0xea5f(%rip), %rsi      # 0x126b5
leaq 0xea18(%rip), %rcx      # 0x12675
leaq 0x220(%rsp), %rdi
movss 0xe497(%rip), %xmm0     # 0x12104
pushq $0x66
popq %rdx
callq 0x5756
leaq 0xea0a(%rip), %rsi      # 0x12686
leaq 0xea0e(%rip), %rcx      # 0x12691
leaq 0x5a8(%rsp), %rdi
movss 0xe475(%rip), %xmm0     # 0x12108
pushq $0x54
popq %rdx
callq 0x5756
leaq 0xea1d(%rip), %rsi      # 0x126bf
leaq 0xea24(%rip), %rcx      # 0x126cd
leaq 0x788(%rsp), %rdi
movss 0xe453(%rip), %xmm0     # 0x1210c
xorl %edx, %edx
callq 0x5756
leaq 0xea1e(%rip), %rsi      # 0x126e5
leaq 0xea28(%rip), %rcx      # 0x126f6
leaq 0x760(%rsp), %rdi
movss 0xe432(%rip), %xmm0     # 0x12110
xorl %edx, %edx
callq 0x5756
leaq 0xea61(%rip), %rsi      # 0x1274d
leaq 0xea4c(%rip), %rcx      # 0x1273f
leaq 0x738(%rsp), %rdi
movss 0xe3f1(%rip), %xmm0     # 0x120f4
xorl %edx, %edx
callq 0x5756
leaq 0xea44(%rip), %rsi      # 0x12755
leaq 0xea4f(%rip), %rcx      # 0x12767
leaq 0x710(%rsp), %rdi
movss 0xe3ec(%rip), %xmm0     # 0x12114
xorl %edx, %edx
callq 0x5756
leaq 0xea55(%rip), %rsi      # 0x1278b
leaq 0x898(%rsp), %rdi
callq 0x56c6
leaq 0xea54(%rip), %rsi      # 0x1279e
leaq 0xea5d(%rip), %rcx      # 0x127ae
leaq 0x6e8(%rsp), %rdi
movss 0xe3b7(%rip), %xmm0     # 0x12118
xorl %edx, %edx
callq 0x5756
leaq 0xea5b(%rip), %rsi      # 0x127ca
leaq 0xea5d(%rip), %rcx      # 0x127d3
leaq 0x6c0(%rsp), %rdi
movss 0xe362(%rip), %xmm0     # 0x120e8
xorl %edx, %edx
callq 0x5756
leaq 0xea50(%rip), %rsi      # 0x127e4
leaq 0xea55(%rip), %rcx      # 0x127f0
leaq 0x580(%rsp), %rdi
movss 0xe371(%rip), %xmm0     # 0x1211c
xorl %edx, %edx
callq 0x5756
leaq 0xea4e(%rip), %rsi      # 0x12807
leaq 0xea5d(%rip), %rcx      # 0x1281d
leaq 0x698(%rsp), %rdi
xorps %xmm0, %xmm0
xorl %edx, %edx
callq 0x5756
leaq 0xea99(%rip), %rsi      # 0x12872
leaq 0xeaa4(%rip), %rcx      # 0x12884
leaq 0x670(%rsp), %rdi
movss 0xe330(%rip), %xmm0     # 0x12120
xorl %edx, %edx
callq 0x5756
leaq 0xea9b(%rip), %rsi      # 0x12899
leaq 0xea9d(%rip), %rcx      # 0x128a2
leaq 0x1c8(%rsp), %rdi
movsd 0xe253(%rip), %xmm0     # 0x12068
pushq $0x4c
popq %rdx
movaps %xmm0, %xmm1
callq 0x5784
leaq 0xea9c(%rip), %rsi      # 0x128c3
leaq 0xeaa1(%rip), %rcx      # 0x128cf
leaq 0x3c0(%rsp), %rdi
movsd 0xe232(%rip), %xmm0     # 0x12070
pushq $0x6f
popq %rdx
movaps %xmm0, %xmm1
callq 0x5784
leaq 0xea97(%rip), %rsi      # 0x128e7
leaq 0xea9c(%rip), %rcx      # 0x128f3
leaq 0x300(%rsp), %rdi
movsd 0xe211(%rip), %xmm0     # 0x12078
movaps %xmm0, %xmm1
xorl %edx, %edx
callq 0x5784
leaq 0xeab1(%rip), %rsi      # 0x12929
leaq 0x878(%rsp), %rdi
callq 0x56c6
leaq 0xeaac(%rip), %rdx      # 0x12938
leaq 0xeab0(%rip), %r8       # 0x12943
leaq 0x398(%rsp), %rdi
pushq $0x50
popq %rcx
xorl %esi, %esi
callq 0x57c2
leaq 0xeac1(%rip), %rsi      # 0x1296d
leaq 0xeaca(%rip), %rcx      # 0x1297d
leaq 0x648(%rsp), %rdi
movss 0xe261(%rip), %xmm0     # 0x12124
xorl %edx, %edx
callq 0x5756
leaq 0xeb04(%rip), %rdx      # 0x129d5
leaq 0xeb04(%rip), %r8       # 0x129dc
leaq 0x1f8(%rsp), %rdi
xorl %esi, %esi
xorl %ecx, %ecx
callq 0x57c2
movl %r12d, %edi
movq %r14, %rsi
callq 0x75e7
testb %al, %al
je 0x4315
xorps %xmm0, %xmm0
ucomiss 0x1c0(%rsp), %xmm0
ja 0x4290
movss 0x538(%rsp), %xmm1
ucomiss %xmm1, %xmm0
jbe 0x3f35
movss 0x2f8(%rsp), %xmm1
divss 0xe1fc(%rip), %xmm1     # 0x12128
movss %xmm1, 0x538(%rsp)
movb 0x218(%rsp), %al
movb 0x3b8(%rsp), %cl
cmpb $0x1, %al
jne 0x3f50
testb $0x1, %cl
je 0x42f9
movss 0x708(%rsp), %xmm0
movss %xmm0, 0x10(%rsp)
movss 0x690(%rsp), %xmm0
mulss 0xe1bc(%rip), %xmm0     # 0x1212c
movss %xmm0, 0x70(%rsp)
movss 0x410(%rsp), %xmm0
movss %xmm0, 0xa0(%rsp)
andb %al, %cl
movb %cl, 0x218(%rsp)
cmpq $0x0, 0x488(%rsp)
je 0x3fbc
leaq 0x480(%rsp), %rsi
cvtss2sd 0x2f8(%rsp), %xmm0
leaq 0xe8(%rsp), %rdi
callq 0x3634
jmp 0x3fe7
cvtss2sd 0x2f8(%rsp), %xmm0
movq 0x560(%rsp), %rsi
cvtss2sd %xmm1, %xmm1
cvtss2sd 0x870(%rsp), %xmm2
leaq 0xe8(%rsp), %rdi
callq 0x5de8
movss 0x820(%rsp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0x402b
cvtss2sd %xmm0, %xmm0
leaq 0x30(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
callq 0x37d9
leaq 0xe8(%rsp), %rdi
leaq 0x30(%rsp), %rbx
movq %rbx, %rsi
callq 0x5b40
movq %rbx, %rdi
callq 0x5b22
cmpb $0x0, 0x848(%rsp)
je 0x4062
leaq 0xe8(%rsp), %rdi
callq 0x7960
movaps %xmm0, %xmm2
movlhps %xmm1, %xmm2            # xmm2 = xmm2[0],xmm1[0]
xorps %xmm0, %xmm0
subpd %xmm2, %xmm0
movupd %xmm0, 0x4e0(%rsp)
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
jmp 0x4074
movsd 0x4e0(%rsp), %xmm0
movsd 0x4e8(%rsp), %xmm1
xorps %xmm2, %xmm2
ucomisd %xmm2, %xmm0
jne 0x4087
jp 0x4087
ucomisd %xmm2, %xmm1
jne 0x4087
jnp 0x40b6
leaq 0x30(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
callq 0x35be
leaq 0xe8(%rsp), %rdi
leaq 0x30(%rsp), %rbx
movq %rbx, %rsi
callq 0x5b40
movq %rbx, %rdi
callq 0x5b22
leaq 0x120(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
callq 0x5676
movq 0x120(%rsp), %rcx
movq 0x128(%rsp), %rax
cmpq %rax, %rcx
je 0x42a5
subq %rcx, %rax
cmpq $0x20, %rax
jbe 0x42c3
cmpb $0x1, 0x218(%rsp)
jne 0x418d
movl 0x2d0(%rsp), %eax
decl %eax
cvtsi2ss %eax, %xmm0
mulss 0x268(%rsp), %xmm0
addss 0x2a8(%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x30(%rsp), %rdi
leaq 0x120(%rsp), %rsi
xorl %edx, %edx
callq 0x6280
leaq 0x30(%rsp), %rbx
movq %rbx, %rdi
callq 0x388d
cvtss2sd 0x438(%rsp), %xmm1
addsd %xmm0, %xmm1
addsd 0xdf20(%rip), %xmm1     # 0x12078
movsd %xmm1, 0x320(%rsp)
movsd %xmm1, 0x328(%rsp)
addsd %xmm1, %xmm1
movsd %xmm1, 0x1e8(%rsp)
movsd %xmm1, 0x1f0(%rsp)
movq %rbx, %rdi
callq 0x5b22
jmp 0x43ae
movups 0x1e8(%rsp), %xmm0
movaps %xmm0, 0x60(%rsp)
movups 0x320(%rsp), %xmm0
movaps %xmm0, 0x80(%rsp)
cvtss2sd 0x2a8(%rsp), %xmm0
leaq 0x30(%rsp), %rdi
leaq 0x120(%rsp), %rsi
xorl %ebx, %ebx
xorl %edx, %edx
callq 0x6280
movapd 0x60(%rsp), %xmm0
subpd 0x80(%rsp), %xmm0
movapd %xmm0, 0x60(%rsp)
leaq 0x30(%rsp), %r15
movq %r15, %rdi
callq 0x388d
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x28(%rsp)
movq %r15, %rdi
callq 0x5b22
movss 0x28(%rsp), %xmm7
movss 0x438(%rsp), %xmm0
addss %xmm7, %xmm0
addss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm0
movl 0x2d0(%rsp), %eax
movupd 0x3e0(%rsp), %xmm3
cvtss2sd 0x268(%rsp), %xmm1
addsd %xmm1, %xmm1
testl %eax, %eax
cmovlel %ebx, %eax
movlhps %xmm0, %xmm0            # xmm0 = xmm0[0,0]
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
movapd 0x60(%rsp), %xmm5
movapd 0x80(%rsp), %xmm6
cmpl %ebx, %eax
je 0x4384
movaps %xmm0, %xmm2
addpd %xmm6, %xmm2
ucomisd %xmm5, %xmm2
ja 0x4324
movapd %xmm5, %xmm4
cmpltpd %xmm2, %xmm4
pextrw $0x4, %xmm4, %ecx
testb $0x1, %cl
jne 0x4324
addpd %xmm3, %xmm2
addpd %xmm1, %xmm0
incl %ebx
movapd %xmm2, %xmm6
jmp 0x4250
movq 0x16d41(%rip), %rax     # 0x1afd8
movq (%rax), %rcx
leaq 0xe76f(%rip), %rdi      # 0x12a10
pushq $0x1b
jmp 0x430c
movq 0x16d2c(%rip), %rax     # 0x1afd8
movq (%rax), %rcx
leaq 0xe7a2(%rip), %rdi      # 0x12a58
pushq $0xe
popq %rsi
pushq $0x1
popq %rdx
callq 0x33f0
jmp 0x42f1
movq 0x16d0e(%rip), %rcx     # 0x1afd8
movq (%rcx), %rdi
cmpq $0x10, %rax
leaq 0xe7c0(%rip), %rax      # 0x12a98
leaq 0xe7be(%rip), %rdx      # 0x12a9d
cmoveq %rax, %rdx
leaq 0xe77d(%rip), %rsi      # 0x12a67
xorl %eax, %eax
callq 0x32f0
pushq $0x1
popq %rbx
jmp 0x51e8
movq 0x16cd8(%rip), %rax     # 0x1afd8
movq (%rax), %rcx
leaq 0xe722(%rip), %rdi      # 0x12a2c
pushq $0x2b
popq %rsi
pushq $0x1
popq %rdx
callq 0x33f0
movq (%r14), %rdi
callq 0x7471
movl %eax, %ebx
jmp 0x5202
movq 0x16cad(%rip), %rax     # 0x1afd8
movq (%rax), %rdi
cvtss2sd %xmm7, %xmm0
movsd 0x1e8(%rsp), %xmm1
movsd 0x1f0(%rsp), %xmm2
movapd %xmm3, %xmm4
unpckhpd %xmm3, %xmm4            # xmm4 = xmm4[1],xmm3[1]
leaq 0xe74e(%rip), %rsi      # 0x12aa1
movl %ebx, %edx
movb $0x5, %al
movapd %xmm6, 0x80(%rsp)
callq 0x32f0
movapd 0x80(%rsp), %xmm6
movapd 0x60(%rsp), %xmm5
movl %ebx, 0x2d0(%rsp)
movupd 0x3e0(%rsp), %xmm3
subpd %xmm3, %xmm6
subpd %xmm6, %xmm5
movupd 0x320(%rsp), %xmm0
subpd %xmm0, %xmm5
mulpd 0xdc7f(%rip), %xmm5     # 0x12020
addpd %xmm0, %xmm5
movupd %xmm5, 0x320(%rsp)
movss 0x10(%rsp), %xmm0
movss 0xa0(%rsp), %xmm3
divss %xmm0, %xmm3
mulss 0xdd63(%rip), %xmm0     # 0x1212c
cvtss2sd %xmm0, %xmm1
cvtss2sd 0x70(%rsp), %xmm2
cvtss2sd %xmm3, %xmm3
movss 0x510(%rsp), %xmm5
movss 0xdd44(%rip), %xmm4     # 0x1212c
mulss %xmm5, %xmm4
cvtss2sd %xmm4, %xmm0
mulsd %xmm1, %xmm0
mulsd %xmm3, %xmm0
mulsd %xmm2, %xmm2
divsd %xmm2, %xmm0
cmpb $0x1, 0x3b8(%rsp)
movsd %xmm0, 0x138(%rsp)
jne 0x4455
mulss 0xdced(%rip), %xmm5     # 0x12108
minss 0x1c0(%rsp), %xmm5
movss %xmm5, 0x1c0(%rsp)
movzbl 0x218(%rsp), %edi
movss 0x668(%rsp), %xmm0
mulss 0x410(%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
xorl $0x1, %edi
callq 0x69fa
jmp 0x4475
cvtss2sd 0x758(%rsp), %xmm1
cvtss2sd 0x5a0(%rsp), %xmm2
cvtss2sd 0x6e0(%rsp), %xmm3
callq 0x6984
movq %rax, %r15
leaq 0x1e8(%rsp), %rbx
cvtss2sd 0x240(%rsp), %xmm0
movq (%rax), %rax
movq %r15, %rdi
movq %rbx, %rsi
callq *(%rax)
movq (%r15), %rcx
leaq 0xe6c5(%rip), %rsi      # 0x12b63
movq %r15, %rdi
xorl %eax, %eax
callq *0x18(%rcx)
movq (%r15), %rcx
leaq 0xee25(%rip), %rsi      # 0x132d5
movq %r15, %rdi
xorl %eax, %eax
callq *0x18(%rcx)
movq (%r15), %rcx
leaq 0xee5a(%rip), %rsi      # 0x1331c
xorl %r13d, %r13d
movq %r15, %rdi
xorl %eax, %eax
callq *0x18(%rcx)
testl %r12d, %r12d
cmovlel %r13d, %r12d
leaq 0xe6be(%rip), %r13      # 0x12b99
xorl %ebp, %ebp
cmpq %rbp, %r12
je 0x44f5
movq (%r14,%rbp,8), %rsi
movq %r13, %rdi
xorl %eax, %eax
callq 0x3040
incq %rbp
jmp 0x44dd
pushq $0xa
popq %rdi
callq 0x32e0
movq (%r15), %rcx
leaq 0xedce(%rip), %rsi      # 0x132d5
movq %r15, %rdi
xorl %eax, %eax
callq *0x18(%rcx)
cmpq $0x0, 0x488(%rsp)
je 0x4551
movq 0x480(%rsp), %rdx
movq (%r15), %rcx
leaq 0xe671(%rip), %rsi      # 0x12b9d
movq %r15, %rdi
xorl %eax, %eax
callq *0x18(%rcx)
cvtss2sd 0x2f8(%rsp), %xmm0
movq (%r15), %rcx
leaq 0xe676(%rip), %rsi      # 0x12bbd
movq %r15, %rdi
movb $0x1, %al
callq *0x18(%rcx)
jmp 0x458f
movq 0x560(%rsp), %rdx
movq (%r15), %rcx
leaq 0xe66c(%rip), %rsi      # 0x12bcf
movq %r15, %rdi
xorl %eax, %eax
callq *0x18(%rcx)
cvtss2sd 0x538(%rsp), %xmm0
cvtss2sd 0x2f8(%rsp), %xmm1
movq (%r15), %rcx
leaq 0xe66a(%rip), %rsi      # 0x12bf1
movq %r15, %rdi
movb $0x2, %al
callq *0x18(%rcx)
cvtss2sd 0x1c0(%rsp), %xmm0
movl 0x2d0(%rsp), %edx
cvtss2sd 0x268(%rsp), %xmm1
movq (%r15), %rcx
leaq 0xe669(%rip), %rsi      # 0x12c1b
movq %r15, %rdi
movb $0x2, %al
callq *0x18(%rcx)
cvtss2sd 0x240(%rsp), %xmm0
cvtss2sd 0x5c8(%rsp), %xmm1
movq (%r15), %rcx
leaq 0xe66d(%rip), %rsi      # 0x12c43
movq %r15, %rdi
movb $0x2, %al
callq *0x18(%rcx)
cvtss2sd 0x640(%rsp), %xmm0
cvtss2sd 0x510(%rsp), %xmm1
movq (%r15), %rcx
leaq 0xe67e(%rip), %rsi      # 0x12c78
movq %r15, %rdi
movb $0x2, %al
callq *0x18(%rcx)
movsd 0x1e8(%rsp), %xmm0
movsd 0x1f0(%rsp), %xmm1
movsd 0x3e0(%rsp), %xmm2
movsd 0x3e8(%rsp), %xmm3
movq (%r15), %rcx
leaq 0xe66d(%rip), %rsi      # 0x12c9d
movq %r15, %rdi
movb $0x4, %al
callq *0x18(%rcx)
movq (%r15), %rcx
leaq 0xe698(%rip), %rsi      # 0x12cda
movq %r15, %rdi
xorl %eax, %eax
callq *0x18(%rcx)
cvtss2sd 0x240(%rsp), %xmm0
movq (%r15), %rax
movq %r15, %rdi
movq %rbx, %rsi
callq *0x8(%rax)
movss 0x640(%rsp), %xmm0
movaps %xmm0, 0x10(%rsp)
movups 0x320(%rsp), %xmm0
movaps %xmm0, 0x50(%rsp)
cvtss2sd 0x240(%rsp), %xmm0
movq (%r15), %rax
movq %r15, %rdi
callq *0x28(%rax)
movaps 0x10(%rsp), %xmm1
cvtss2sd %xmm1, %xmm0
andps 0xd994(%rip), %xmm1     # 0x12030
cvtss2sd %xmm1, %xmm2
movsd 0xd9d8(%rip), %xmm1     # 0x12080
divsd %xmm0, %xmm1
cmpltsd 0xd9d3(%rip), %xmm2     # 0x12088
andnpd %xmm1, %xmm2
movapd %xmm2, 0x330(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0xd0(%rsp)
leaq 0x50(%rsp), %rbx
leaq 0x380(%rsp), %r14
leaq 0x270(%rsp), %r13
xorl %eax, %eax
movsd %xmm0, 0xc8(%rsp)
cmpl 0x2d0(%rsp), %eax
jge 0x51ca
movl %eax, 0xc(%rsp)
cvtsi2ss %eax, %xmm1
movss 0x268(%rsp), %xmm0
movss %xmm1, 0x10(%rsp)
mulss %xmm1, %xmm0
addss 0x2a8(%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0xb0(%rsp), %rdi
leaq 0x120(%rsp), %rsi
movsd %xmm0, 0x140(%rsp)
xorl %edx, %edx
callq 0x6280
movq 0xb8(%rsp), %rax
cmpq 0xb0(%rsp), %rax
je 0x5158
leaq 0xb0(%rsp), %rdi
callq 0x388d
cvtss2sd 0x438(%rsp), %xmm1
movsd %xmm0, 0x80(%rsp)
addsd %xmm0, %xmm1
cmpb $0x0, 0x218(%rsp)
jne 0x479a
movapd %xmm1, %xmm0
unpcklpd %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0]
addpd 0x50(%rsp), %xmm0
movapd %xmm0, 0x50(%rsp)
movapd %xmm1, 0x340(%rsp)
movss 0x1c0(%rsp), %xmm1
addss 0xd93c(%rip), %xmm1     # 0x120f0
movsd 0xd8dc(%rip), %xmm0     # 0x12098
cmpl $0x0, 0xc(%rsp)
je 0x47c7
cvtss2sd %xmm1, %xmm0
movq (%r15), %rax
movq %r15, %rdi
movq %rbx, %rsi
callq *0x48(%rax)
leaq 0xb0(%rsp), %rdi
callq 0x352c
cvtsd2ss %xmm0, %xmm1
movss 0x1c0(%rsp), %xmm0
movss %xmm1, 0x70(%rsp)
mulss %xmm1, %xmm0
movss %xmm0, 0x4c(%rsp)
movss 0x5c8(%rsp), %xmm0
movss %xmm0, 0x60(%rsp)
movss 0x240(%rsp), %xmm0
movss %xmm0, 0xa0(%rsp)
movq (%r15), %rax
movq %r15, %rdi
callq *0x30(%rax)
movss 0x70(%rsp), %xmm0
divss 0x60(%rsp), %xmm0
movss 0xa0(%rsp), %xmm1
minss %xmm0, %xmm1
cvtss2sd %xmm1, %xmm0
movq (%r15), %rax
movq %r15, %rdi
movsd %xmm0, 0x98(%rsp)
callq *0x28(%rax)
movl 0xc(%rsp), %edx
incl %edx
movss 0x10(%rsp), %xmm0
mulss 0x268(%rsp), %xmm0
addss 0x2a8(%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
movq (%r15), %rcx
movq %r15, %rdi
leaq 0xe489(%rip), %rsi      # 0x12d0e
movl %edx, 0xc(%rsp)
movb $0x1, %al
callq *0x18(%rcx)
cmpb $0x1, 0x7d0(%rsp)
jne 0x4916
movss 0x410(%rsp), %xmm0
mulss 0x618(%rsp), %xmm0
movss %xmm0, 0x10(%rsp)
movq (%r15), %rcx
movq %r15, %rdi
leaq 0xe471(%rip), %rsi      # 0x12d2e
xorl %eax, %eax
callq *0x18(%rcx)
movq (%r15), %rax
xorps %xmm1, %xmm1
movq %r15, %rdi
movss 0xd859(%rip), %xmm0     # 0x1212c
movaps %xmm0, %xmm2
callq *0x68(%rax)
cvtsd2ss 0x80(%rsp), %xmm1
xorps 0xd757(%rip), %xmm1     # 0x12040
xorps %xmm0, %xmm0
leaq 0xb0(%rsp), %rdi
movq %r15, %rsi
movq %rbx, %rdx
movss 0x10(%rsp), %xmm2
callq 0x53db
movq (%r15), %rax
movq %r15, %rdi
movsd 0xd78d(%rip), %xmm0     # 0x120a0
callq *0x40(%rax)
movss 0x438(%rsp), %xmm0
ucomiss 0xd80a(%rip), %xmm0     # 0x12130
jbe 0x4a2e
movss 0x410(%rsp), %xmm1
mulss 0x618(%rsp), %xmm1
movss %xmm1, 0x10(%rsp)
divss %xmm1, %xmm0
callq 0x3130
movss %xmm0, 0x70(%rsp)
leaq 0x30(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0x5676
movss 0x5f0(%rsp), %xmm0
ucomiss 0xd7bb(%rip), %xmm0     # 0x12130
jbe 0x49cb
cvtss2sd %xmm0, %xmm0
movq %r14, %rdi
leaq 0xb0(%rsp), %rsi
xorl %edx, %edx
callq 0x6280
movss 0x5f0(%rsp), %xmm0
xorps 0xd6a3(%rip), %xmm0     # 0x12040
cvtss2sd %xmm0, %xmm0
movq %r13, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x6280
leaq 0x30(%rsp), %rdi
movq %r13, %rsi
callq 0x5b40
movq %r13, %rdi
callq 0x5b22
movq %r14, %rdi
callq 0x5b22
movq (%r15), %rcx
movq %r15, %rdi
leaq 0xe36c(%rip), %rsi      # 0x12d44
xorl %eax, %eax
callq *0x18(%rcx)
movq (%r15), %rax
xorps %xmm0, %xmm0
xorpd %xmm2, %xmm2
movq %r15, %rdi
movss 0xd73a(%rip), %xmm1     # 0x1212c
callq *0x68(%rax)
cvttss2si 0x70(%rsp), %eax
cvtsi2ss %eax, %xmm0
movss 0x10(%rsp), %xmm2
mulss %xmm2, %xmm0
movaps %xmm2, %xmm1
mulss 0xd718(%rip), %xmm1     # 0x1212c
leaq 0x30(%rsp), %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x53db
leaq 0x30(%rsp), %rdi
callq 0x5b22
movss 0x510(%rsp), %xmm0
movss %xmm0, 0x10(%rsp)
cvtss2sd 0x1c0(%rsp), %xmm0
movsd %xmm0, 0x100(%rsp)
cvtss2sd 0x7a8(%rsp), %xmm0
movsd %xmm0, 0x160(%rsp)
cvtss2sd 0x780(%rsp), %xmm0
movaps %xmm0, 0x370(%rsp)
movss 0x7f8(%rsp), %xmm0
movss %xmm0, 0x24(%rsp)
cvtss2sd 0x730(%rsp), %xmm0
movsd %xmm0, 0x108(%rsp)
movss 0x5a0(%rsp), %xmm0
movss %xmm0, 0x70(%rsp)
movss 0x6b8(%rsp), %xmm0
movss %xmm0, 0xa0(%rsp)
movsd 0x50(%rsp), %xmm0
movsd 0x58(%rsp), %xmm1
movq (%r15), %rcx
movq %r15, %rdi
leaq 0xe2e6(%rip), %rsi      # 0x12db3
movb $0x2, %al
callq *0x18(%rcx)
movq (%r15), %rax
xorpd %xmm0, %xmm0
xorps %xmm1, %xmm1
xorpd %xmm2, %xmm2
movq %r15, %rdi
callq *0x68(%rax)
cvtss2sd 0x10(%rsp), %xmm1
movapd 0x330(%rsp), %xmm0
movsd %xmm1, 0xd8(%rsp)
mulsd %xmm1, %xmm0
addsd %xmm0, %xmm0
mulsd 0xd59a(%rip), %xmm0     # 0x120a8
movsd %xmm0, 0x118(%rsp)
movq (%r15), %rax
movq %r15, %rdi
xorl %esi, %esi
callq *0x58(%rax)
movss 0x4c(%rsp), %xmm0
addss %xmm0, %xmm0
movss %xmm0, 0x4c(%rsp)
cvtss2sd 0x24(%rsp), %xmm2
andq $0x0, 0x40(%rsp)
movss 0xd5e6(%rip), %xmm0     # 0x1212c
movss 0x10(%rsp), %xmm3
mulss %xmm0, %xmm3
xorps %xmm1, %xmm1
movaps %xmm1, 0x30(%rsp)
cvtss2sd %xmm3, %xmm1
movsd %xmm1, 0x150(%rsp)
mulss %xmm0, %xmm3
cvtss2sd %xmm3, %xmm0
movsd %xmm0, 0x190(%rsp)
cvtss2sd 0xa0(%rsp), %xmm0
movsd %xmm0, 0x170(%rsp)
cvtss2sd 0x70(%rsp), %xmm0
movsd %xmm0, 0x168(%rsp)
movsd 0x100(%rsp), %xmm3
movapd %xmm3, %xmm0
addsd 0xd504(%rip), %xmm0     # 0x120b0
movsd %xmm0, 0x148(%rsp)
movaps %xmm2, 0x360(%rsp)
xorps 0xd48c(%rip), %xmm2     # 0x12050
movaps %xmm2, 0x350(%rsp)
movsd 0x98(%rsp), %xmm2
movapd %xmm2, %xmm0
divsd 0xd4d7(%rip), %xmm0     # 0x120b8
movsd 0xd4d7(%rip), %xmm1     # 0x120c0
minsd %xmm0, %xmm1
movsd %xmm1, 0x158(%rsp)
movsd 0xd8(%rsp), %xmm4
movapd %xmm4, %xmm0
addsd %xmm4, %xmm0
movsd %xmm0, 0x60(%rsp)
movapd %xmm4, %xmm0
mulsd 0xd4af(%rip), %xmm0     # 0x120c8
movsd %xmm0, 0x180(%rsp)
movsd 0xd456(%rip), %xmm1     # 0x12080
movsd 0x108(%rsp), %xmm0
subsd %xmm0, %xmm1
movsd %xmm1, 0x178(%rsp)
mulsd %xmm0, %xmm2
movsd %xmm2, 0x198(%rsp)
movapd %xmm4, %xmm0
mulsd 0xd477(%rip), %xmm0     # 0x120d0
addsd %xmm3, %xmm0
movsd %xmm0, 0x188(%rsp)
xorpd %xmm0, %xmm0
movsd %xmm0, 0x110(%rsp)
xorl %ebx, %ebx
movsd %xmm0, 0x80(%rsp)
movsd %xmm0, 0xe0(%rsp)
xorl %r14d, %r14d
xorpd %xmm1, %xmm1
movsd 0x100(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x506e
movsd %xmm1, 0x28(%rsp)
cvtsd2ss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
mulsd 0xd421(%rip), %xmm0     # 0x120d8
divsd 0xd421(%rip), %xmm0     # 0x120e0
callq 0x3090
mulsd 0x170(%rsp), %xmm0
addsd 0x168(%rsp), %xmm0
cvtsd2ss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm0
movq (%r15), %rax
movq %r15, %rdi
callq *0x20(%rax)
testl %ebx, %ebx
je 0x4d7f
cmpl $0x1, %ebx
je 0x4d5b
cmpl $0x2, %ebx
jne 0x4e35
movss 0x24(%rsp), %xmm0
ucomiss 0xd426(%rip), %xmm0     # 0x12130
pushq $0x2
popq %rbp
jbe 0x4dd7
movsd 0x28(%rsp), %xmm0
ucomisd 0x148(%rsp), %xmm0
jbe 0x4dd7
movq %r13, %rdi
leaq 0xb0(%rsp), %rsi
movaps 0x350(%rsp), %xmm0
xorl %edx, %edx
callq 0x6280
leaq 0x30(%rsp), %rdi
movq %r13, %rsi
callq 0x5b40
movq %r13, %rdi
callq 0x5b22
pushq $0x3
jmp 0x4dbf
movss 0x24(%rsp), %xmm0
ucomiss 0xd3c8(%rip), %xmm0     # 0x12130
pushq $0x1
popq %rbp
jbe 0x4dd7
movsd 0x28(%rsp), %xmm0
ucomisd 0xd33d(%rip), %xmm0     # 0x120b8
ja 0x4dc2
jmp 0x4dd7
movss 0x24(%rsp), %xmm0
ucomiss 0xd3a4(%rip), %xmm0     # 0x12130
jbe 0x4dc2
movq %r13, %rdi
leaq 0xb0(%rsp), %rsi
movaps 0x360(%rsp), %xmm0
xorl %edx, %edx
callq 0x6280
leaq 0x30(%rsp), %rdi
movq %r13, %rsi
callq 0x5b40
movq %r13, %rdi
callq 0x5b22
pushq $0x1
popq %rbp
jmp 0x4dd7
leaq 0x30(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0x5862
pushq $0x2
popq %rbp
cmpl %ebx, %ebp
je 0x4e35
leaq 0x30(%rsp), %rdi
callq 0x352c
movsd %xmm0, 0x110(%rsp)
movq (%r15), %rax
movq %r15, %rdi
movsd 0x158(%rsp), %xmm0
callq *0x28(%rax)
movq 0x30(%rsp), %rax
movupd (%rax), %xmm0
addpd 0x50(%rsp), %xmm0
movapd %xmm0, 0x270(%rsp)
movsd 0x28(%rsp), %xmm0
addsd 0x150(%rsp), %xmm0
movq (%r15), %rax
movq %r15, %rdi
movq %r13, %rsi
callq *0x48(%rax)
movl %ebp, %ebx
xorl %ebp, %ebp
xorl %r12d, %r12d
movq 0x30(%rsp), %rdi
movq 0x38(%rsp), %rax
subq %rdi, %rax
shrq $0x4, %rax
cltq
cmpq %rax, %r12
jge 0x5017
testq %rbp, %rbp
je 0x4e95
movsd (%rdi,%rbp), %xmm0
subsd -0x10(%rdi,%rbp), %xmm0
movsd 0x8(%rdi,%rbp), %xmm1
subsd -0x8(%rdi,%rbp), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
sqrtsd %xmm0, %xmm0
movsd 0x80(%rsp), %xmm1
addsd %xmm0, %xmm1
movapd %xmm1, %xmm0
jmp 0x4e98
xorps %xmm0, %xmm0
movsd %xmm0, 0x80(%rsp)
divsd 0x110(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
mulsd 0x118(%rsp), %xmm0
addsd 0xe0(%rsp), %xmm0
addq %rbp, %rdi
cvtsd2ss %xmm0, %xmm0
callq 0x592e
movapd %xmm1, 0xa0(%rsp)
movaps %xmm0, 0x70(%rsp)
movsd 0x10(%rsp), %xmm1
mulsd 0xd8(%rsp), %xmm1
addsd 0x28(%rsp), %xmm1
movsd 0x60(%rsp), %xmm0
ucomisd %xmm1, %xmm0
movsd 0x198(%rsp), %xmm0
movsd %xmm1, 0x10(%rsp)
ja 0x4f5c
movsd 0x180(%rsp), %xmm0
ucomisd %xmm1, %xmm0
movsd 0x98(%rsp), %xmm0
jbe 0x4f5c
movapd %xmm1, %xmm0
movsd 0x60(%rsp), %xmm1
subsd %xmm1, %xmm0
divsd %xmm1, %xmm0
mulsd 0x178(%rsp), %xmm0
addsd 0x108(%rsp), %xmm0
mulsd 0x98(%rsp), %xmm0
movq (%r15), %rax
movq %r15, %rdi
callq *0x28(%rax)
jmp 0x4f65
movq (%r15), %rax
movq %r15, %rdi
callq *0x28(%rax)
movsd 0x10(%rsp), %xmm3
ucomisd 0x190(%rsp), %xmm3
jbe 0x4fdd
movsd 0x188(%rsp), %xmm0
ucomisd %xmm3, %xmm0
jbe 0x4fdd
movapd 0x70(%rsp), %xmm0
unpcklpd 0xa0(%rsp), %xmm0       # xmm0 = xmm0[0],mem[0]
addpd 0x50(%rsp), %xmm0
movapd %xmm0, 0x270(%rsp)
movapd %xmm3, %xmm1
cmpltsd 0x60(%rsp), %xmm1
movapd %xmm1, %xmm0
andpd 0x370(%rsp), %xmm0
movsd 0xd0bd(%rip), %xmm2     # 0x12080
andnpd %xmm2, %xmm1
orpd %xmm0, %xmm1
movq (%r15), %rax
movq %r15, %rdi
movq %r13, %rsi
movapd %xmm3, %xmm0
callq *0x50(%rax)
jmp 0x500b
movapd 0x70(%rsp), %xmm0
unpcklpd 0xa0(%rsp), %xmm0       # xmm0 = xmm0[0],mem[0]
addpd 0x50(%rsp), %xmm0
movapd %xmm0, 0x270(%rsp)
movq (%r15), %rax
movq %r15, %rdi
movq %r13, %rsi
movapd %xmm3, %xmm0
callq *0x48(%rax)
incq %r12
addq $0x10, %rbp
jmp 0x4e3a
movsd 0x28(%rsp), %xmm0
ucomisd 0x160(%rsp), %xmm0
setbe %al
orb %r14b, %al
testb $0x1, %al
jne 0x503f
movq (%r15), %rax
movb $0x1, %r14b
movq %r15, %rdi
pushq $0x1
popq %rsi
callq *0x58(%rax)
movsd 0x28(%rsp), %xmm1
addsd 0xd8(%rsp), %xmm1
movsd 0xe0(%rsp), %xmm0
addsd 0x118(%rsp), %xmm0
movsd %xmm0, 0xe0(%rsp)
jmp 0x4c8e
leaq 0x30(%rsp), %rdi
callq 0x5b22
movq (%r15), %rax
movq %r15, %rdi
callq *0x60(%rax)
movsd %xmm0, 0x10(%rsp)
cvtss2sd 0x240(%rsp), %xmm0
movq (%r15), %rax
movq %r15, %rdi
callq *0x28(%rax)
movq (%r15), %rax
movq %r15, %rdi
callq *0x38(%rax)
movss 0x1c0(%rsp), %xmm0
addss 0xd03d(%rip), %xmm0     # 0x120f0
cvtss2sd %xmm0, %xmm0
movq (%r15), %rax
movq %r15, %rdi
callq *0x40(%rax)
cmpb $0x0, 0x218(%rsp)
leaq 0x50(%rsp), %rbx
leaq 0x380(%rsp), %r14
jne 0x50fd
movapd 0x340(%rsp), %xmm1
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
addpd 0x50(%rsp), %xmm1
movupd 0x3e0(%rsp), %xmm0
addpd %xmm1, %xmm0
movapd %xmm0, 0x50(%rsp)
movsd 0xd0(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, 0xd0(%rsp)
divsd 0x98(%rsp), %xmm1
movsd 0xc8(%rsp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0xc8(%rsp)
cmpb $0x0, 0x3b8(%rsp)
je 0x5192
leaq 0xb0(%rsp), %rdi
callq 0x5b22
movl 0xc(%rsp), %eax
jmp 0x46ee
movss 0x10(%rsp), %xmm0
mulss 0x268(%rsp), %xmm0
movq 0x15e6a(%rip), %rax     # 0x1afd8
movq (%rax), %rdi
addss 0x2a8(%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0xdb5b(%rip), %rsi      # 0x12ce0
movb $0x1, %al
callq 0x32f0
incl 0xc(%rsp)
jmp 0x5142
movq 0x15e3f(%rip), %rax     # 0x1afd8
movq (%rax), %rdi
movss 0x4c(%rsp), %xmm0
divss 0xcf5a(%rip), %xmm0     # 0x12104
cvtss2sd %xmm0, %xmm1
leaq 0xdb9c(%rip), %rsi      # 0x12d51
movsd 0x140(%rsp), %xmm0
movb $0x2, %al
callq 0x32f0
jmp 0x5142
movq (%r15), %rax
movq %r15, %rdi
callq *0x10(%rax)
cmpb $0x0, 0x3b8(%rsp)
movsd 0x138(%rsp), %xmm0
je 0x5230
xorl %ebx, %ebx
leaq 0x120(%rsp), %rdi
callq 0x5b22
leaq 0xe8(%rsp), %rdi
callq 0x5b22
leaq 0x460(%rsp), %rdi
callq 0x581c
leaq 0x540(%rsp), %rdi
callq 0x581c
movl %ebx, %eax
addq $0x938, %rsp            # imm = 0x938
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cvttsd2si 0xc8(%rsp), %eax
movl $0xe10, %ecx            # imm = 0xE10
cltd
idivl %ecx
movl %eax, %r9d
movl %edx, %eax
movw $0x3c, %cx
cwtd
idivw %cx
movswl %ax, %ecx
movswl %dx, %r8d
movq 0x15d7b(%rip), %rax     # 0x1afd8
movq (%rax), %rdi
mulsd 0xd0(%rsp), %xmm0
divsd 0xce1f(%rip), %xmm0     # 0x12090
leaq 0xdb0d(%rip), %rsi      # 0x12d85
movl %r9d, %edx
movb $0x1, %al
callq 0x32f0
jmp 0x51e6
jmp 0x5361
jmp 0x5361
jmp 0x5297
jmp 0x5297
jmp 0x5297
movq %rax, %rbx
jmp 0x53ac
jmp 0x5342
jmp 0x5361
jmp 0x5342
jmp 0x5342
jmp 0x5342
jmp 0x5342
jmp 0x5342
jmp 0x5342
jmp 0x5342
jmp 0x5342
jmp 0x5342
jmp 0x5342
jmp 0x5342
jmp 0x5342
jmp 0x5342
jmp 0x5342
jmp 0x5342
jmp 0x5342
jmp 0x5342
jmp 0x5342
jmp 0x5342
jmp 0x5342
jmp 0x5342
jmp 0x5342
jmp 0x5342
jmp 0x5342
jmp 0x5342
jmp 0x5342
jmp 0x5342
jmp 0x5342
jmp 0x5342
jmp 0x5342
jmp 0x5342
jmp 0x5342
jmp 0x5342
jmp 0x5342
jmp 0x5342
jmp 0x5342
jmp 0x5342
movq %rax, %rbx
leaq 0x440(%rsp), %rdi
callq 0x30f0
jmp 0x53c6
jmp 0x531d
jmp 0x531d
jmp 0x531d
movq %rax, %rbx
jmp 0x53c6
movq %rax, %rbx
leaq 0x4a0(%rsp), %rdi
callq 0x30f0
jmp 0x53d3
movq %rax, %rbx
jmp 0x53d3
movq %rax, %rbx
jmp 0x53b9
movq %rax, %rbx
leaq 0x380(%rsp), %rdi
callq 0x5b22
jmp 0x5388
jmp 0x5385
jmp 0x5372
jmp 0x5361
jmp 0x5372
movq %rax, %rbx
jmp 0x539f
jmp 0x5385
jmp 0x5372
jmp 0x5372
jmp 0x5372
jmp 0x5385
jmp 0x5385
movq %rax, %rbx
jmp 0x5392
jmp 0x5385
jmp 0x5385
jmp 0x5385
jmp 0x5385
jmp 0x5385
jmp 0x5385
jmp 0x5385
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x5b22
leaq 0xb0(%rsp), %rdi
callq 0x5b22
leaq 0x120(%rsp), %rdi
callq 0x5b22
leaq 0xe8(%rsp), %rdi
callq 0x5b22
leaq 0x460(%rsp), %rdi
callq 0x581c
leaq 0x540(%rsp), %rdi
callq 0x581c
movq %rbx, %rdi
callq 0x33a0