// File: /workspace/github_cpp_makefile_star2_O1/thierry7100[P]CutOptim/main.cpp
// Function: main
int main(int argc, char *argv[])
{
string InputFileName;
string OutputFileName;
double MinCutDistance = 1.0;
double StepAngle = 0;
double rect_cost = 0.0;
int Flag_file = 0;
int debug_level = 0;
int Output_Layer = 0;
int KeepNested = 1;
int OptimizingLevel = 1;
int FirstPos = CenterCenter;
int UseCache = 0;
bool Flag_free_rot = 1;
string debug_file_name = "Debug_CutOptim.txt";

double max_segment_length = 1000.0;
#ifdef UNDEF
        //  Used to check param passing from inkscape
        ofstream ParamDbg("/home/thierry/Programmes/CutOptim/DebgParam.txt");
        if ( ParamDbg.is_open() == false )
        {
            cerr << "unable to open /home/thierry/Programmes/CutOptim/DebgParam.txt\n";
            exit(1);
        }
         ParamDbg << "--- Params  ------\n";
        ParamDbg << " argc =" << argc << "\n";
        for ( int i = 0; i < argc; i++)
        {
            ParamDbg << "Argv[" << i << "]=" << argv[i] << "\n";
        }
        ParamDbg.close();
#endif
    auto result = parse(argc, argv);
    InputFileName = result["f"].as<std::string>();
    if (result.count("output"))
    {
        OutputFileName = result["output"].as<std::string>();
        Flag_file = 1;
    }
    if (result.count("distance"))
        MinCutDistance = result["distance"].as<double>();
    if (result.count("angle"))
    {
        StepAngle = result["angle"].as<double>();
        Flag_free_rot = 0;
    }
    if (result.count("max_length"))
        max_segment_length = result["max_length"].as<double>();
    if (result.count("rect_cost"))
        rect_cost = result["rect_cost"].as<double>();
    if (result.count("debug_level"))
        debug_level = result["debug_level"].as<int>();
    if (result.count("layer_output"))
        Output_Layer = result["layer_output"].as<int>();
    if (result.count("optimizing_level"))
        OptimizingLevel = result["optimizing_level"].as<int>();
    if (result.count("original"))
    {
        Output_Layer |= result["original"].as<bool>();
    }
    if ( result.count("firstpos"))
    {
        FirstPos = ConvertPos(result["firstpos"].as<string>() );
    }
    if ( result.count("df_name"))
    {
        debug_file_name = result["df_name"].as<string>();
    }
    if (result.count("nested"))
    {
        KeepNested = result["nested"].as<bool>();
    }

    if (result.count("use_cache"))
    {
        UseCache = result["use_cache"].as<bool>();
    }

    if (result.count("free_rot"))
    {
        Flag_free_rot = result["free_rot"].as<bool>();
    }
    if (result.count("debug_file"))
        debug_level += result["debug_file"].as<bool>();;
    if ( Flag_file )
    {
        cout << "Parse options complete" << endl;
        cout << "Input File = " << InputFileName << std::endl;
        cout << "Output File = " << OutputFileName << std::endl;
        cout << "angle = " << StepAngle << std::endl;
        cout << "MinCutDistance = " << MinCutDistance << std::endl;
        cout << "Debug Level = " << debug_level << std::endl;
        cout << "Output layers = " << Output_Layer << std::endl;
        cout << "Optimizing level = " << OptimizingLevel << std::endl;
        cout << "Max_segment_length = " << max_segment_length << std::endl;
        cout << "Use free rotation = " << Flag_free_rot << std::endl;
        cout << "Rectangle cost factor = " << rect_cost << std::endl;
        cout << "Keep nested paths = " << KeepNested << std::endl;
        cout << "Use Cache = " << UseCache << std::endl;
    }

      //    Read and process input file

    SvgDoc InputSVG(InputFileName);
    InputSVG.setDebugLevel(debug_level, debug_file_name);
    InputSVG.setUseCache(UseCache);
    InputSVG.setRectCost(rect_cost);
    if ( InputSVG.SvgData == NULL )
    {
    cerr << " No input to process aborting \n";
    return 1;
    }
    //    Change paths to polygones
    InputSVG.TransformPaths(MinCutDistance / 10.0, KeepNested);
    //    Make larger polygons
    InputSVG.EnlargePaths(MinCutDistance);
    //  Break longer edges if necessary
    InputSVG.BreakLongerEdges(max_segment_length, MinCutDistance / 10.0);
    //    Sort polygons by area
    InputSVG.BuilSingleListPath();
      //    Compute convex hulls of each path
      //  InputSVG.ComputeConvexHulls();
      //    Optimize
    if ( StepAngle == 0 ) StepAngle = 360;
    if ( Flag_free_rot )
        InputSVG.OptimizeFreeRot(OptimizingLevel, FirstPos, Flag_file);
    else
        InputSVG.Optimize(StepAngle * 2 * M_PI / 360, OptimizingLevel, FirstPos, Flag_file);
    InputSVG.WriteDoc(OutputFileName, Flag_file, Output_Layer);


#ifdef TEST_GEO
      //    Now test distance from point to Segment
      Point P00 = Point(0,0);
      Point P11 = Point(1,1);
      Segment Seg1 = Segment(P00, P11);
      Point P01 = Point(0, 1);
      Point P10 = Point(1, 0);
      printf("Distance from P10 to Seg1 =%.3f\n", sqrt(Seg1.sqrDistancePoint(P10)));
      printf("Distance from P01 to Seg1 =%.3f\n", sqrt(Seg1.sqrDistancePoint(P01)));
      Point P2 = Point(2,0);
      printf("Distance from P2 to Seg1 =%.3f\n", sqrt(Seg1.sqrDistancePoint(P2)));
      Point P3 = Point(-1,-1);
      printf("Distance from P3 to Seg1 =%.3f\n", sqrt(Seg1.sqrDistancePoint(P3)));
      Point P4 = Point(2,2);
      printf("Distance from P4 to Seg1 =%.3f\n", sqrt(Seg1.sqrDistancePoint(P4)));
      Point P5 = Point(-1,0);
      printf("Distance from P5 to Seg1 =%.3f\n", sqrt(Seg1.sqrDistancePoint(P5)));
      Segment Seg2 = Segment(P11, P00);
      printf("Distance from P1 to Seg2 =%.3f\n", sqrt(Seg2.sqrDistancePoint(P10)));
      printf("Distance from P2 to Seg2 =%.3f\n", sqrt(Seg2.sqrDistancePoint(P2)));
      printf("Distance from P3 to Seg2 =%.3f\n", sqrt(Seg2.sqrDistancePoint(P3)));
      printf("Distance from P4 to Seg2 =%.3f\n", sqrt(Seg2.sqrDistancePoint(P4)));
      printf("Distance from P5 to Seg2 =%.3f\n", sqrt(Seg2.sqrDistancePoint(P5)));

      //    Test Polygons
      Polygon Poly1 = Polygon();
      Polygon Poly2 = Polygon();
      //    First a rectangle
      Poly1.addVertice(P00);
      Poly1.addVertice(P01);
      Poly1.addVertice(P11);
      Poly1.addVertice(P10);
      Poly1.addVertice(P00);
      printf("Polygon 1 nVertices = %d clockwise =%d, area = %.3f\n", Poly1.nVertices, Poly1.isClockWise(), Poly1.area());

      Poly2.addVertice(P00);
      Poly2.addVertice(P10);
      Poly2.addVertice(P11);
      Poly2.addVertice(P01);
      Poly2.addVertice(P00);
      printf("Polygon 2 nVertices = %d clockwise =%d, area = %.3f\n", Poly2.nVertices, Poly2.isClockWise(), Poly2.area());
      printf("Distance P01 to Poly2 =%.3f\n", sqrt(Poly2.distance(P01)));
      printf("Distance P10 to Poly2 =%.3f\n", sqrt(Poly2.distance(P10)));
      printf("Distance P2 to Poly2 =%.3f\n", sqrt(Poly2.distance(P2)));
      printf("Distance P3 to Poly2 =%.3f\n", sqrt(Poly2.distance(P3)));
      printf("Distance P4 to Poly2 =%.3f\n", sqrt(Poly2.distance(P4)));
      printf("Distance P5 to Poly2 =%.3f\n", sqrt(Poly2.distance(P5)));

      Polygon Poly8 = Polygon();
      for (int i = 0; i <= 8; i++)
      {
        Point p = Point(cos(i*M_PI/4.0), sin(i*M_PI/4.0));
        Poly8.addVertice(p);
      }
      printf("Polygon 8 nVertices = %d clockwise =%d, area = %.3f\n", Poly8.nVertices, Poly8.isClockWise(), Poly8.area());

      printf("Distance P01 to Poly8 =%.3f\n", sqrt(Poly8.distance(P01)));
      printf("Distance P10 to Poly8 =%.3f\n", sqrt(Poly8.distance(P10)));
      printf("Distance P2 to Poly8 =%.3f\n", sqrt(Poly8.distance(P2)));
      printf("Distance P3 to Poly8 =%.3f\n", sqrt(Poly8.distance(P3)));
      printf("Distance P4 to Poly8 =%.3f\n", sqrt(Poly8.distance(P4)));
      printf("Distance P5 to Poly8 =%.3f\n", sqrt(Poly8.distance(P5)));
#endif
#if TEST_ANGLES > 0
    printf("Cas 1 : Départ en -1,0, arrivée en 0,0,  puis va en 0,1\n");
    double sf1 = atan2(-1, 0);
    double sf2 = atan2(-0.2, -1);

    if ( sf1 < 0 ) sf1 += 2*M_PI;
    if ( sf2 < 0 ) sf2 += 2*M_PI;
    double sm2 = 0;
    printf("sf1 = %.1f, sf2 = %.1f\n", sf1 * 180 / M_PI, sf2 *180.0 / M_PI);

    printf("Essai sm1 sm2\n");

    sm2 = 0;
    for ( double a = 1.0; a < 360; a+= 20.0)
    {
        sm2 = a/180.0 * M_PI;
        printf("Angle %.1f, SM1 %d  SM2 %d\n", a, CheckOKAngles(sf1, sf2, sm2), CheckOKAngles(sf2, sf1, sm2));
    }
#endif
      return(0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x458, %rsp            # imm = 0x458
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x88(%rsp), %rcx
movq %rcx, -0x10(%rcx)
xorl %eax, %eax
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x68(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x48(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x324c0(%rip), %rsi     # 0x3d446
leaq 0x324cb(%rip), %rdx     # 0x3d458
leaq 0x38(%rsp), %rdi
callq 0x102ca
leaq 0x378(%rsp), %rdi
movl %ebp, %esi
movq %rbx, %rdx
callq 0x7e2c
leaq 0xa8(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x35d5e(%rip), %rsi     # 0x40d1b
leaq 0x35d58(%rip), %rdx     # 0x40d1c
leaq 0x98(%rsp), %rdi
callq 0x102ca
leaq 0x378(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0xd2a6
movq %rax, %rdi
callq 0xd334
leaq 0x78(%rsp), %rdi
movq %rax, %rsi
callq 0x7260
movq 0x98(%rsp), %rdi
cmpq %r12, %rdi
je 0xb018
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x7440
leaq 0x98(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x32262(%rip), %rsi     # 0x3d28c
leaq 0x32261(%rip), %rdx     # 0x3d292
callq 0x102ca
leaq 0x378(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0xcdc8
movq %rax, %r15
movq 0x98(%rsp), %rdi
cmpq %r12, %rdi
je 0xb06b
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x7440
testq %r15, %r15
je 0xb0df
leaq 0x98(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x3220a(%rip), %rsi     # 0x3d28c
leaq 0x32209(%rip), %rdx     # 0x3d292
callq 0x102ca
leaq 0x378(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0xd2a6
movq %rax, %rdi
callq 0xd334
leaq 0x58(%rsp), %rdi
movq %rax, %rsi
callq 0x7260
movq 0x98(%rsp), %rdi
cmpq %r12, %rdi
je 0xb0d5
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x7440
movl $0x1, 0xc(%rsp)
jmp 0xb0e7
movl $0x0, 0xc(%rsp)
leaq 0x98(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x321ea(%rip), %rsi     # 0x3d2e3
leaq 0x321eb(%rip), %rdx     # 0x3d2eb
callq 0x102ca
leaq 0x378(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0xcdc8
movq %rax, %rbx
movq 0x98(%rsp), %rdi
cmpq %r12, %rdi
je 0xb13a
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x7440
testq %rbx, %rbx
je 0xb1a3
leaq 0x98(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x32192(%rip), %rsi     # 0x3d2e3
leaq 0x32193(%rip), %rdx     # 0x3d2eb
callq 0x102ca
leaq 0x378(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0xd2a6
movq %rax, %rdi
callq 0xd3bc
movsd (%rax), %xmm0
movsd %xmm0, 0x20(%rsp)
movq 0x98(%rsp), %rdi
cmpq %r12, %rdi
je 0xb1b1
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x7440
jmp 0xb1b1
movsd 0x31e5d(%rip), %xmm0    # 0x3d008
movsd %xmm0, 0x20(%rsp)
leaq 0x98(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x323b3(%rip), %rsi     # 0x3d576
leaq 0x323b1(%rip), %rdx     # 0x3d57b
callq 0x102ca
leaq 0x378(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0xcdc8
movq %rax, %rbx
movq 0x98(%rsp), %rdi
cmpq %r12, %rdi
je 0xb204
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x7440
testq %rbx, %rbx
je 0xb275
leaq 0x98(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x3235b(%rip), %rsi     # 0x3d576
leaq 0x32359(%rip), %rdx     # 0x3d57b
callq 0x102ca
leaq 0x378(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0xd2a6
movq %rax, %rdi
callq 0xd3bc
movsd (%rax), %xmm0
movsd %xmm0, 0x28(%rsp)
movq 0x98(%rsp), %rdi
cmpq %r12, %rdi
je 0xb26b
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x7440
movl $0x0, 0x10(%rsp)
jmp 0xb285
movb $0x1, %al
movl %eax, 0x10(%rsp)
xorpd %xmm0, %xmm0
movsd %xmm0, 0x28(%rsp)
leaq 0x98(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x320a3(%rip), %rsi     # 0x3d33a
leaq 0x320a6(%rip), %rdx     # 0x3d344
callq 0x102ca
leaq 0x378(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0xcdc8
movq %rax, %rbx
movq 0x98(%rsp), %rdi
cmpq %r12, %rdi
je 0xb2d8
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x7440
testq %rbx, %rbx
je 0xb341
leaq 0x98(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x3204b(%rip), %rsi     # 0x3d33a
leaq 0x3204e(%rip), %rdx     # 0x3d344
callq 0x102ca
leaq 0x378(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0xd2a6
movq %rax, %rdi
callq 0xd3bc
movsd (%rax), %xmm0
movsd %xmm0, 0x30(%rsp)
movq 0x98(%rsp), %rdi
cmpq %r12, %rdi
je 0xb34f
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x7440
jmp 0xb34f
movsd 0x31cc7(%rip), %xmm0    # 0x3d010
movsd %xmm0, 0x30(%rsp)
leaq 0x98(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x31fb6(%rip), %rsi     # 0x3d317
leaq 0x31fb8(%rip), %rdx     # 0x3d320
callq 0x102ca
leaq 0x378(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0xcdc8
movq %rax, %rbx
movq 0x98(%rsp), %rdi
cmpq %r12, %rdi
je 0xb3a2
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x7440
testq %rbx, %rbx
je 0xb40b
leaq 0x98(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x31f5e(%rip), %rsi     # 0x3d317
leaq 0x31f60(%rip), %rdx     # 0x3d320
callq 0x102ca
leaq 0x378(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0xd2a6
movq %rax, %rdi
callq 0xd3bc
movsd (%rax), %xmm0
movsd %xmm0, 0x18(%rsp)
movq 0x98(%rsp), %rdi
cmpq %r12, %rdi
je 0xb415
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x7440
jmp 0xb415
xorpd %xmm0, %xmm0
movsd %xmm0, 0x18(%rsp)
leaq 0x98(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x31f9b(%rip), %rsi     # 0x3d3c2
leaq 0x31f9f(%rip), %rdx     # 0x3d3cd
callq 0x102ca
leaq 0x378(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0xcdc8
movq %rax, %rbx
movq 0x98(%rsp), %rdi
cmpq %r12, %rdi
je 0xb468
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x7440
testq %rbx, %rbx
je 0xb4ca
leaq 0x98(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x31f43(%rip), %rsi     # 0x3d3c2
leaq 0x31f47(%rip), %rdx     # 0x3d3cd
callq 0x102ca
leaq 0x378(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0xd2a6
movq %rax, %rdi
callq 0xd444
movl (%rax), %r14d
movq 0x98(%rsp), %rdi
cmpq %r12, %rdi
je 0xb4cd
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x7440
jmp 0xb4cd
xorl %r14d, %r14d
leaq 0x98(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x31ff3(%rip), %rsi     # 0x3d4d2
leaq 0x31ff8(%rip), %rdx     # 0x3d4de
callq 0x102ca
leaq 0x378(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0xcdc8
movq %rax, %rbx
movq 0x98(%rsp), %rdi
cmpq %r12, %rdi
je 0xb520
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x7440
testq %rbx, %rbx
movq %r15, 0x350(%rsp)
je 0xb589
leaq 0x98(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x31f93(%rip), %rsi     # 0x3d4d2
leaq 0x31f98(%rip), %rdx     # 0x3d4de
callq 0x102ca
leaq 0x378(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0xd2a6
movq %rax, %rdi
callq 0xd444
movl (%rax), %ebp
movq 0x98(%rsp), %rdi
cmpq %r12, %rdi
je 0xb58b
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x7440
jmp 0xb58b
xorl %ebp, %ebp
leaq 0x98(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x31dde(%rip), %rsi     # 0x3d37b
leaq 0x31de7(%rip), %rdx     # 0x3d38b
callq 0x102ca
leaq 0x378(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0xcdc8
movq %rax, %rbx
movq 0x98(%rsp), %rdi
cmpq %r12, %rdi
je 0xb5de
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x7440
testq %rbx, %rbx
je 0xb643
leaq 0x98(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x31d86(%rip), %rsi     # 0x3d37b
leaq 0x31d8f(%rip), %rdx     # 0x3d38b
callq 0x102ca
leaq 0x378(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0xd2a6
movq %rax, %rdi
callq 0xd444
movl (%rax), %eax
movl %eax, 0x8(%rsp)
movq 0x98(%rsp), %rdi
cmpq %r12, %rdi
je 0xb64b
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x7440
jmp 0xb64b
movl $0x1, 0x8(%rsp)
leaq 0x98(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x31dfe(%rip), %rsi     # 0x3d45b
leaq 0x31dff(%rip), %rdx     # 0x3d463
callq 0x102ca
leaq 0x378(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0xcdc8
movq %rax, %rbx
movq 0x98(%rsp), %rdi
cmpq %r12, %rdi
je 0xb69e
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x7440
testq %rbx, %rbx
je 0xb700
leaq 0x98(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x31da6(%rip), %rsi     # 0x3d45b
leaq 0x31da7(%rip), %rdx     # 0x3d463
callq 0x102ca
leaq 0x378(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0xd2a6
movq %rax, %rdi
callq 0xd4cc
movzbl (%rax), %ebx
movq 0x98(%rsp), %rdi
cmpq %r12, %rdi
je 0xb6fe
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x7440
orl %ebx, %ebp
leaq 0x98(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x31e9e(%rip), %rsi     # 0x3d5b0
leaq 0x31e9f(%rip), %rdx     # 0x3d5b8
callq 0x102ca
leaq 0x378(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0xcdc8
movq %rax, %rbx
movq 0x98(%rsp), %rdi
cmpq %r12, %rdi
je 0xb753
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x7440
testq %rbx, %rbx
je 0xb7f3
leaq 0x98(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x31e42(%rip), %rsi     # 0x3d5b0
leaq 0x31e43(%rip), %rdx     # 0x3d5b8
callq 0x102ca
leaq 0x378(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0xd2a6
movq %rax, %rdi
callq 0xd334
leaq 0x448(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x438(%rsp), %rdi
callq 0x16258
xorl %esi, %esi
cmpq $0x2, 0x440(%rsp)
jb 0xb868
movq 0x438(%rsp), %rax
movzbl (%rax), %edx
xorl %esi, %esi
cmpl $0x61, %edx
jg 0xb800
cmpl $0x42, %edx
je 0xb816
cmpl $0x43, %edx
je 0xb81d
movl $0x0, %ecx
cmpl $0x54, %edx
je 0xb822
jmp 0xb868
movl $0x5, 0x14(%rsp)
jmp 0xb8a6
cmpl $0x62, %edx
je 0xb816
cmpl $0x63, %edx
je 0xb81d
movl $0x0, %ecx
cmpl $0x74, %edx
je 0xb822
jmp 0xb868
movl $0x8, %ecx
jmp 0xb822
movl $0x4, %ecx
movzbl 0x1(%rax), %eax
addl $-0x43, %eax
cmpl $0x2f, %eax
ja 0xb868
movabsq $0x100000001, %rdx      # imm = 0x100000001
btq %rax, %rdx
jb 0xb863
movabsq $0x20000000200, %rdx    # imm = 0x20000000200
btq %rax, %rdx
jb 0xb866
movabsq $0x800000008000, %rdx   # imm = 0x800000008000
btq %rax, %rdx
jae 0xb868
orl $0x2, %ecx
jmp 0xb866
orl $0x1, %ecx
movl %ecx, %esi
movl %esi, 0x14(%rsp)
movq 0x438(%rsp), %rdi
cmpq %rbx, %rdi
je 0xb889
movq 0x448(%rsp), %rsi
incq %rsi
callq 0x7440
movq 0x98(%rsp), %rdi
cmpq %r12, %rdi
je 0xb8a6
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x7440
leaq 0x98(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x31b73(%rip), %rsi     # 0x3d42b
leaq 0x31b73(%rip), %rdx     # 0x3d432
callq 0x102ca
leaq 0x378(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0xcdc8
movq %rax, %rbx
movq 0x98(%rsp), %rdi
cmpq %r12, %rdi
je 0xb8f9
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x7440
testq %rbx, %rbx
je 0xb963
leaq 0x98(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x31b1b(%rip), %rsi     # 0x3d42b
leaq 0x31b1b(%rip), %rdx     # 0x3d432
callq 0x102ca
leaq 0x378(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0xd2a6
movq %rax, %rdi
callq 0xd334
leaq 0x38(%rsp), %rdi
movq %rax, %rsi
callq 0x7260
movq 0x98(%rsp), %rdi
cmpq %r12, %rdi
je 0xb963
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x7440
leaq 0x98(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x31b0d(%rip), %rsi     # 0x3d482
leaq 0x31b0c(%rip), %rdx     # 0x3d488
callq 0x102ca
leaq 0x378(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0xcdc8
movq %rax, %rbx
movq 0x98(%rsp), %rdi
cmpq %r12, %rdi
je 0xb9b6
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x7440
testq %rbx, %rbx
je 0xba18
leaq 0x98(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x31ab5(%rip), %rsi     # 0x3d482
leaq 0x31ab4(%rip), %rdx     # 0x3d488
callq 0x102ca
leaq 0x378(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0xd2a6
movq %rax, %rdi
callq 0xd4cc
movzbl (%rax), %ebx
movq 0x98(%rsp), %rdi
cmpq %r12, %rdi
je 0xba1d
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x7440
jmp 0xba1d
movl $0x1, %ebx
leaq 0x98(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x31a76(%rip), %rsi     # 0x3d4a5
leaq 0x31a78(%rip), %rdx     # 0x3d4ae
callq 0x102ca
leaq 0x378(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0xcdc8
movq %rax, %r15
movq 0x98(%rsp), %rdi
cmpq %r12, %rdi
je 0xba70
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x7440
testq %r15, %r15
je 0xbad3
leaq 0x98(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x31a1e(%rip), %rsi     # 0x3d4a5
leaq 0x31a20(%rip), %rdx     # 0x3d4ae
callq 0x102ca
leaq 0x378(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0xd2a6
movq %rax, %rdi
callq 0xd4cc
movzbl (%rax), %r15d
movq 0x98(%rsp), %rdi
cmpq %r12, %rdi
je 0xbad6
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x7440
jmp 0xbad6
xorl %r15d, %r15d
leaq 0x98(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x31aa9(%rip), %rsi     # 0x3d591
leaq 0x31aaa(%rip), %rdx     # 0x3d599
callq 0x102ca
leaq 0x378(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0xcdc8
movq %rax, %r13
movq 0x98(%rsp), %rdi
cmpq %r12, %rdi
je 0xbb29
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x7440
testq %r13, %r13
je 0xbb8c
leaq 0x98(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x31a51(%rip), %rsi     # 0x3d591
leaq 0x31a52(%rip), %rdx     # 0x3d599
callq 0x102ca
leaq 0x378(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0xd2a6
movq %rax, %rdi
callq 0xd4cc
movb (%rax), %al
movl %eax, 0x10(%rsp)
movq 0x98(%rsp), %rdi
cmpq %r12, %rdi
je 0xbb8c
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x7440
leaq 0x98(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x3185b(%rip), %rsi     # 0x3d3f9
leaq 0x3185e(%rip), %rdx     # 0x3d403
callq 0x102ca
leaq 0x378(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0xcdc8
movq %rax, %r13
movq 0x98(%rsp), %rdi
cmpq %r12, %rdi
je 0xbbdf
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x7440
testq %r13, %r13
je 0xbc43
leaq 0x98(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x31803(%rip), %rsi     # 0x3d3f9
leaq 0x31806(%rip), %rdx     # 0x3d403
callq 0x102ca
leaq 0x378(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0xd2a6
movq %rax, %rdi
callq 0xd4cc
movzbl (%rax), %r13d
movq 0x98(%rsp), %rdi
cmpq %r12, %rdi
je 0xbc40
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x7440
addl %r13d, %r14d
cmpq $0x0, 0x350(%rsp)
je 0xc083
movq 0x46337(%rip), %r12     # 0x51f90
leaq 0x319b4(%rip), %rsi     # 0x3d614
movl $0x16, %edx
movq %r12, %rdi
callq 0x74d0
movq (%r12), %rax
addq -0x18(%rax), %r12
movq %r12, %rdi
movl $0xa, %esi
callq 0x73f0
movsbl %al, %esi
movq 0x46304(%rip), %rdi     # 0x51f90
callq 0x7050
movq %rax, %rdi
callq 0x7300
movq 0x462f0(%rip), %rdi     # 0x51f90
leaq 0x31984(%rip), %rsi     # 0x3d62b
movl $0xd, %edx
callq 0x74d0
movq 0x78(%rsp), %rsi
movq 0x80(%rsp), %rdx
movq 0x462cb(%rip), %rdi     # 0x51f90
callq 0x74d0
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x73f0
movsbl %al, %esi
movq %r12, %rdi
callq 0x7050
movq %rax, %rdi
callq 0x7300
movq 0x46295(%rip), %rdi     # 0x51f90
leaq 0x31937(%rip), %rsi     # 0x3d639
movl $0xe, %edx
callq 0x74d0
movq 0x58(%rsp), %rsi
movq 0x60(%rsp), %rdx
movq 0x46273(%rip), %rdi     # 0x51f90
callq 0x74d0
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x73f0
movsbl %al, %esi
movq %r12, %rdi
callq 0x7050
movq %rax, %rdi
callq 0x7300
movq 0x4623d(%rip), %rdi     # 0x51f90
leaq 0x318ee(%rip), %rsi     # 0x3d648
movl $0x8, %edx
callq 0x74d0
movq 0x46225(%rip), %rdi     # 0x51f90
movsd 0x28(%rsp), %xmm0
callq 0x7680
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x73f0
movsbl %al, %esi
movq %r12, %rdi
callq 0x7050
movq %rax, %rdi
callq 0x7300
movq 0x461e9(%rip), %rdi     # 0x51f90
leaq 0x318a3(%rip), %rsi     # 0x3d651
movl $0x11, %edx
callq 0x74d0
movq 0x461d1(%rip), %rdi     # 0x51f90
movsd 0x20(%rsp), %xmm0
callq 0x7680
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x73f0
movsbl %al, %esi
movq %r12, %rdi
callq 0x7050
movq %rax, %rdi
callq 0x7300
movq 0x46195(%rip), %rdi     # 0x51f90
leaq 0x31861(%rip), %rsi     # 0x3d663
movl $0xe, %edx
callq 0x74d0
movq 0x4617d(%rip), %rdi     # 0x51f90
movl %r14d, %esi
callq 0x7710
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x73f0
movsbl %al, %esi
movq %r12, %rdi
callq 0x7050
movq %rax, %rdi
callq 0x7300
movq 0x46144(%rip), %rdi     # 0x51f90
leaq 0x3181f(%rip), %rsi     # 0x3d672
movl $0x10, %edx
callq 0x74d0
movq 0x4612c(%rip), %rdi     # 0x51f90
movl %ebp, %esi
callq 0x7710
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x73f0
movsbl %al, %esi
movq %r12, %rdi
callq 0x7050
movq %rax, %rdi
callq 0x7300
movq 0x460f4(%rip), %rdi     # 0x51f90
leaq 0x317e0(%rip), %rsi     # 0x3d683
movl $0x13, %edx
callq 0x74d0
movq 0x460dc(%rip), %rdi     # 0x51f90
movl 0x8(%rsp), %esi
callq 0x7710
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x73f0
movsbl %al, %esi
movq %r12, %rdi
callq 0x7050
movq %rax, %rdi
callq 0x7300
movq 0x460a2(%rip), %rdi     # 0x51f90
leaq 0x317a2(%rip), %rsi     # 0x3d697
movl $0x15, %edx
callq 0x74d0
movq 0x4608a(%rip), %rdi     # 0x51f90
movsd 0x30(%rsp), %xmm0
callq 0x7680
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x73f0
movsbl %al, %esi
movq %r12, %rdi
callq 0x7050
movq %rax, %rdi
callq 0x7300
movq 0x4604e(%rip), %rdi     # 0x51f90
leaq 0x31764(%rip), %rsi     # 0x3d6ad
movl $0x14, %edx
callq 0x74d0
movzbl 0x10(%rsp), %esi
movq 0x46031(%rip), %rdi     # 0x51f90
callq 0x76d0
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x73f0
movsbl %al, %esi
movq %r12, %rdi
callq 0x7050
movq %rax, %rdi
callq 0x7300
movq 0x45ffb(%rip), %rdi     # 0x51f90
leaq 0x31726(%rip), %rsi     # 0x3d6c2
movl $0x18, %edx
callq 0x74d0
movq 0x45fe3(%rip), %rdi     # 0x51f90
movsd 0x18(%rsp), %xmm0
callq 0x7680
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x73f0
movsbl %al, %esi
movq %r12, %rdi
callq 0x7050
movq %rax, %rdi
callq 0x7300
movq 0x45fa7(%rip), %rdi     # 0x51f90
leaq 0x316eb(%rip), %rsi     # 0x3d6db
movl $0x14, %edx
callq 0x74d0
movq 0x45f8f(%rip), %rdi     # 0x51f90
movl %ebx, %esi
callq 0x7710
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x73f0
movsbl %al, %esi
movq %r12, %rdi
callq 0x7050
movq %rax, %rdi
callq 0x7300
movq 0x45f57(%rip), %rdi     # 0x51f90
leaq 0x316b0(%rip), %rsi     # 0x3d6f0
movl $0xc, %edx
callq 0x74d0
movq 0x45f3f(%rip), %rdi     # 0x51f90
movl %r15d, %esi
callq 0x7710
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x73f0
movsbl %al, %esi
movq %r12, %rdi
callq 0x7050
movq %rax, %rdi
callq 0x7300
leaq 0x98(%rsp), %rdi
leaq 0x78(%rsp), %rsi
callq 0x2efe0
leaq 0x368(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rdx
addq %rsi, %rdx
leaq 0x358(%rsp), %rdi
callq 0x16258
leaq 0x100(%rsp), %rdi
movl %r14d, -0x8(%rdi)
leaq 0x358(%rsp), %rsi
movl $0x10, %edx
callq 0x71f0
movq 0x358(%rsp), %rdi
cmpq %r12, %rdi
je 0xc0f7
movq 0x368(%rsp), %rsi
incq %rsi
callq 0x7440
movl %r15d, 0xfc(%rsp)
movsd 0x18(%rsp), %xmm0
movsd %xmm0, 0xd0(%rsp)
cmpq $0x0, 0xa0(%rsp)
je 0xc197
movsd 0x20(%rsp), %xmm0
divsd 0x30ef1(%rip), %xmm0    # 0x3d018
leaq 0x98(%rsp), %rdi
movsd %xmm0, 0x18(%rsp)
movl %ebx, %esi
callq 0x2d22e
leaq 0x98(%rsp), %rdi
movsd 0x20(%rsp), %xmm0
callq 0x2e9a8
leaq 0x98(%rsp), %rdi
movsd 0x30(%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
callq 0x2ed0a
leaq 0x98(%rsp), %rdi
callq 0x3194e
cmpb $0x0, 0x10(%rsp)
je 0xc1b6
leaq 0x98(%rsp), %rdi
movl 0x8(%rsp), %esi
movl 0x14(%rsp), %edx
movl 0xc(%rsp), %ecx
callq 0x35bb4
jmp 0xc20a
movl $0x1, %ebx
movq 0x45e3d(%rip), %rdi     # 0x51fe0
leaq 0x31553(%rip), %rsi     # 0x3d6fd
movl $0x1f, %edx
callq 0x74d0
jmp 0xc224
movsd 0x28(%rsp), %xmm2
movapd %xmm2, %xmm1
addsd %xmm2, %xmm1
mulsd 0x30e54(%rip), %xmm1    # 0x3d020
divsd 0x30e54(%rip), %xmm1    # 0x3d028
xorpd %xmm0, %xmm0
cmpeqsd %xmm2, %xmm0
movsd 0x30e4b(%rip), %xmm2    # 0x3d030
andpd %xmm0, %xmm2
andnpd %xmm1, %xmm0
orpd %xmm2, %xmm0
leaq 0x98(%rsp), %rdi
movl 0x8(%rsp), %esi
movl 0x14(%rsp), %edx
movl 0xc(%rsp), %ecx
callq 0x31de4
xorl %ebx, %ebx
leaq 0x98(%rsp), %rdi
leaq 0x58(%rsp), %rsi
movl 0xc(%rsp), %edx
movl %ebp, %ecx
callq 0x31844
leaq 0x98(%rsp), %rdi
callq 0x2f132
leaq 0x420(%rsp), %rdi
callq 0x12b56
leaq 0x3e0(%rsp), %rdi
callq 0x1444e
leaq 0x3a8(%rsp), %rdi
callq 0x144ec
leaq 0x388(%rsp), %r14
movq %r14, %rdi
callq 0xd168
movq -0x8(%r14), %rdi
testq %rdi, %rdi
je 0xc276
callq 0xd68c
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
leaq 0x88(%rsp), %r14
je 0xc29a
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x7440
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0xc2b6
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x7440
movq 0x78(%rsp), %rdi
cmpq %r14, %rdi
je 0xc2d0
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x7440
movl %ebx, %eax
addq $0x458, %rsp            # imm = 0x458
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xc409
jmp 0xc409
jmp 0xc409
jmp 0xc409
jmp 0xc409
jmp 0xc409
jmp 0xc409
jmp 0xc409
jmp 0xc409
jmp 0xc409
jmp 0xc409
jmp 0xc409
jmp 0xc409
jmp 0xc409
jmp 0xc409
movq %rax, %rbx
movq 0x358(%rsp), %rdi
cmpq %r12, %rdi
je 0xc3fa
movq 0x368(%rsp), %rsi
incq %rsi
callq 0x7440
jmp 0xc3fa
jmp 0xc409
jmp 0xc3d5
jmp 0xc409
jmp 0xc3d5
jmp 0xc409
jmp 0xc3d5
jmp 0xc409
jmp 0xc3d5
jmp 0xc409
jmp 0xc3d5
jmp 0xc409
jmp 0xc3d5
jmp 0xc409
jmp 0xc3d5
jmp 0xc409
jmp 0xc3d5
jmp 0xc409
jmp 0xc3d5
jmp 0xc409
jmp 0xc3d5
jmp 0xc409
jmp 0xc3d5
jmp 0xc409
jmp 0xc3d5
jmp 0xc409
jmp 0xc3d5
jmp 0xc409
jmp 0xc3d5
jmp 0xc409
jmp 0xc3d5
jmp 0xc409
jmp 0xc409
movq %rax, %rbx
jmp 0xc419
movq %rax, %rbx
jmp 0xc435
jmp 0xc3d5
jmp 0xc3d5
jmp 0xc3d5
jmp 0xc3d5
jmp 0xc3d5
jmp 0xc3d5
jmp 0xc3d5
jmp 0xc3d5
jmp 0xc3d5
jmp 0xc3d5
jmp 0xc3d5
jmp 0xc3d5
jmp 0xc3d5
jmp 0xc3d5
jmp 0xc3d5
movq %rax, %rbx
movq 0x98(%rsp), %rdi
cmpq %r12, %rdi
je 0xc40c
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x7440
jmp 0xc40c
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0x2f132
jmp 0xc40c
movq %rax, %rbx
leaq 0x378(%rsp), %rdi
callq 0xd1c4
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0xc435
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x7440
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0xc451
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x7440
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0xc473
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x7440
movq %rbx, %rdi
callq 0x7730
nop