// File: spatialfruitsalad[P]volume2position/main.cpp
// Function: main
int main( int argc, char *argv[] )
{

///////////////////////////////
// Parse command line arguments
///////////////////////////////
    if (argc != 9)
    {
        std::cerr << "wrong number of Command line arguments" << std::endl;
        std::cerr << "./ip_analyzing_gm\n[inFileName] \n[outFolderName] \n[nx] [ny] [nz] [erosiondepth] [sigma_g] [sigma_p]";
        return 0;
    }

    std::string inFileName = argv[1];
    std::string outFolderName = argv[2];

    CreateFolders(outFolderName);

    // the size of the tomogram
    unsigned long  nx = atoi(argv[3]);
    unsigned long  ny = atoi(argv[4]);
    unsigned long  nz = atoi(argv[5]);

    // erosion depth for watershed segmentation of the particles
    int erosiondepth = atoi(argv[6]);


    // bilateral filter parameters
    double bf_sigma_Pos = atof(argv[7]);
    double bf_sigma_Col = atof(argv[8]);
    //double bf_sigma_Pos = 1.75;
    //double bf_sigma_Col = 2000;
    // cutoff for spatial gauss
    unsigned bf_size = static_cast<unsigned>(bf_sigma_Pos * 2.5);

///////////////////////////////
// Load Tomogram
///////////////////////////////
    std::cout << "loading tomogram from " << inFileName << std::endl;

    tomogram3d<uint16_t> original;
    original.read_raw(inFileName, "uint16_t", nx, ny, nz);

    std::cout << "tomogram successfully loaded" << std::endl;
    
    // write some images of the original tomogram
    WriteImages(original, outFolderName + "/images/", "0_original", nz);
    
///////////////////////////////
// Apply bilateral filter
///////////////////////////////
    {
    std::cout << "applying filter" << std::endl;
    // create filter object
    bilateralFilter B (bf_size, bf_sigma_Pos, bf_sigma_Col);
    tomogram3d<uint16_t> filtered;
    // apply filter
    B.Process(original, filtered);
    // original data is no longer needed, so swap it with filtered and dismiss filtered.
    std::swap(original, filtered);
    filtered.clear();
    original.write_raw(outFolderName + "/bilateral.raw", "uint16_t");
    // write some slices of the bilateral tomogram
    WriteImages(original, outFolderName + "/images/", "1_bilateral", nz);
    }

///////////////////////////////
// Create Homogenized Tomogram
///////////////////////////////
    tomogram3d<uint16_t> hom;
    // class for homogenization
    homogenator H;
    H.Process(original, hom, outFolderName);    
    
    //original is no longer needed
    original.clear();
    // write some slices of the homogenized tomogram
    hom.write_raw(outFolderName + "/homogenized.raw", "uint16_t");
    WriteImages(hom, outFolderName + "/images/", "2_homogenized", nz);

///////////////////////////////
// Apply selected Area Histogram
///////////////////////////////
    std::cout << "calculate histogram" << std::endl;
    // this will calculate a histogram of the whole tomogram 
    selectedAreaHistogram sah(nx,ny, nz);

    // selected area histogram will fill two vectors: bins will contain the bin information (list of the bins, identified by the first grey value in each bin.), 
    std::vector<double> bins;
    // hist will include the corresponding greyvalue counts
    std::vector<double> hist;
    sah.Process(hom, bins, hist, outFolderName, 150);

    // the black outside region should not get counted so just remove that from the histogram
    hist[0] = 0;
///////////////////////////////
// Calculate threshold with Otsu's method
///////////////////////////////
    std::cout << "calculate Threshold" << std::endl;
    cSegmentationByOtsu::NormalizeHisto(hist);
    double T = cSegmentationByOtsu::CalculateSegmentationThreshold(hist);
    std::cout << "binthresh from otsu: " << T << std::endl; 
    // since otsu doesn't need to know anything about the bins it is acting on, it will just return the bin ID (this is T). 
    // To get the greyvalue threshold (t1_gv) the next line is needed.
    uint16_t t1_gv = static_cast<uint16_t>(bins.at(T));

    std::cout << "threshol from otsu: " << static_cast<int>(t1_gv) << std::endl;
    
    // this writes a gnuplot script for visualizing otsu thresholding and histogram calculation
    {
    std::cout << "write gnuplot script for histogram" << std::endl;
    std::ofstream out(outFolderName + "/plot_selectedAreaHistogram.gpl");
    out << "#!/usr/bin/gnuplot -persist"<< std::endl;
    out << "t_low = " << static_cast<int>(t1_gv)<< std::endl;
    out << "set xlabel 'greyvalue'" << std::endl;
    out << "set ylabel 'occurrence'" << std::endl;
    out << "set xr [1:]" << std::endl;
    out << "set arrow from t_low, 0 to t_low, graph(0, 1) nohead" << std::endl;
    out << "pl 'selectedAreaHist.dat' w l" << std::endl;
    out.close();
    }
///////////////////////////////
// Create Particle binray image
///////////////////////////////
    std::cout << std::endl << "make binarized versions" << std::endl;
    tomogram3d<uint8_t> binary_particles;
    binary_particles.initialise(nx,ny,nz,0);

    // loop over all voxels and compare with calculated threshold
    for (unsigned long k = 0; k != nz; ++k)
    for (unsigned long j = 0; j != ny; ++j)
    for (unsigned long i = 0; i != nx; ++i)
    {
        uint16_t v = hom.get(i,j,k);
        if (v >= t1_gv)
        { 
            binary_particles.set(i,j,k,1); 
        }
    }
   
    WriteImages(binary_particles,  outFolderName+"images/", "3_binary", nz);

///////////////////////////////
// Remove inside holes from particle image
///////////////////////////////
    tomogram3d<uint8_t> binary_water;
    binary_water.initialise(nx,ny,nz,0);
    removeInsideHoles::Process(binary_particles);
    WriteImages(binary_particles, outFolderName+"images/", "4_binary_woHolesInside", nz); 
    binary_particles.write_raw(outFolderName + "/particles_binary.raw", "uint8_t");

///////////////////////////////
// Create labeled image
///////////////////////////////
    tomogram3d<int> out;
    try
    {
        // this calculates the segmented tomogram
        watershedSegmentation::Process(binary_particles, out, erosiondepth, outFolderName + "/images/", 100);

        // remove all clusters that touch the border
        out.cleanBorder(0.075);

        // write some images 
        WriteImages(out,outFolderName+"images/","7_labeled" , nz);
        WriteImages(out,outFolderName+"images/","8_labeled_color" , nz, true);

    }
    catch (std::string& e)
    {
        std::cerr << e << std::endl;
        return 1;
    }

///////////////////////////////
// Calculate centroids and save tomogram (converted to save disk space)
///////////////////////////////
    // calculate centroids and volumes, also
    // convert to uint16_t for writing
    std::cout << "convert and calculate" << std::endl;
    std::map<unsigned long, unsigned int> volumes;
    std::map<unsigned long, double> xPos;
    std::map<unsigned long, double> yPos;
    std::map<unsigned long, double> zPos;
    
    tomogram3d<uint16_t> safe;
    safe.initialise(nx, ny, nz, 0);
    std::cout << "counting voxels" << std::endl;

    
    for (unsigned int k = 0; k != nz; ++k)
    {
        std::cout << k << " ";
    for (unsigned int j = 0; j != ny; ++j)
    for (unsigned int i = 0; i != nx; ++i)
    {
        uint16_t v = static_cast<uint16_t>(out.get(i,j,k));
        safe.set(i,j,k, v);
        volumes[v] += 1;
        xPos[v] += i;    
        yPos[v] += j;    
        zPos[v] += k;    
    }
    }
    std::cout << "finished, writing centroids" << std::endl;
    // write centroids
    std::string filename = outFolderName +  "/particles_centroids_ed" + std::to_string(static_cast<int>(erosiondepth)) +  ".dat";
    std::cout << "filename: " << filename << std::endl;
    std::ofstream myOut(filename);
    if(!myOut.good())
    {
        std::cerr << "error: cannot write" << std::endl;
        return 1;
    }
    myOut << "#1_x #2_y #3_z #4_l #5_vol" << std::endl;
    myOut << "#boxsz=" << nz << ", boundary_condition= none " << std::endl;
    for(size_t i = 0; i != volumes.size(); ++i)
    {
        double v = static_cast<double>(volumes[i]);
        if(v == 0) continue;
        myOut << " " << xPos[i]/v << " " << yPos[i]/v << " " << zPos[i]/v << " " << i << " "  << volumes[i] << std::endl;
    }
    myOut.close();


    // save images, write tomogram
    WriteImages(safe, outFolderName+"images/", "5_particles_woInsideHoles", nz); 

    filename = outFolderName +  "particles_labelled_ed" + std::to_string(static_cast<int>(erosiondepth)) +  ".raw";
    safe.write_raw(filename, "uint16_t");

    return 0;
}

// Assembly:
subq $0xfe8, %rsp            # imm = 0xFE8
movl $0x0, 0xfe4(%rsp)
movl %edi, 0xfe0(%rsp)
movq %rsi, 0xfd8(%rsp)
cmpl $0x9, 0xfe0(%rsp)
je 0x3880
movq 0x307a6(%rip), %rdi     # 0x33fe8
leaq 0x2491a(%rip), %rsi     # 0x28163
callq 0x3290
movq %rax, %rdi
movq 0x30748(%rip), %rsi     # 0x33fa0
callq 0x32c0
movq 0x30784(%rip), %rdi     # 0x33fe8
leaq 0x2491f(%rip), %rsi     # 0x2818a
callq 0x3290
movl $0x0, 0xfe4(%rsp)
jmp 0x5e3a
movq 0xfd8(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x2a0(%rsp)
leaq 0xfb7(%rsp), %rdi
movq %rdi, 0x2a8(%rsp)
callq 0x34b0
movq 0x2a0(%rsp), %rsi
movq 0x2a8(%rsp), %rdx
leaq 0xfb8(%rsp), %rdi
callq 0x3360
jmp 0x38c8
leaq 0xfb7(%rsp), %rdi
callq 0x32d0
movq 0xfd8(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x290(%rsp)
leaq 0xf7f(%rsp), %rdi
movq %rdi, 0x298(%rsp)
callq 0x34b0
movq 0x290(%rsp), %rsi
movq 0x298(%rsp), %rdx
leaq 0xf80(%rsp), %rdi
callq 0x3360
jmp 0x391d
leaq 0xf7f(%rsp), %rdi
callq 0x32d0
leaq 0xf58(%rsp), %rdi
leaq 0xf80(%rsp), %rsi
callq 0x3120
jmp 0x3941
leaq 0xf58(%rsp), %rdi
callq 0x3670
jmp 0x3950
leaq 0xf58(%rsp), %rdi
callq 0x3538
movq 0xfd8(%rsp), %rax
movq 0x18(%rax), %rdi
callq 0x33d0
cltq
movq %rax, 0xf50(%rsp)
movq 0xfd8(%rsp), %rax
movq 0x20(%rax), %rdi
callq 0x33d0
cltq
movq %rax, 0xf48(%rsp)
movq 0xfd8(%rsp), %rax
movq 0x28(%rax), %rdi
callq 0x33d0
cltq
movq %rax, 0xf40(%rsp)
movq 0xfd8(%rsp), %rax
movq 0x30(%rax), %rdi
callq 0x33d0
movl %eax, 0xf3c(%rsp)
movq 0xfd8(%rsp), %rax
movq 0x38(%rax), %rdi
callq 0x3310
movsd %xmm0, 0xf30(%rsp)
movq 0xfd8(%rsp), %rax
movq 0x40(%rax), %rdi
callq 0x3310
movsd %xmm0, 0xf28(%rsp)
movsd 0xf30(%rsp), %xmm0
movsd 0x245fd(%rip), %xmm1    # 0x28008
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
movl %eax, 0xf24(%rsp)
movq 0x3059e(%rip), %rdi     # 0x33fc0
leaq 0x247c4(%rip), %rsi     # 0x281ed
callq 0x3290
movq %rax, 0x288(%rsp)
jmp 0x3a38
movq 0x288(%rsp), %rdi
leaq 0xfb8(%rsp), %rsi
callq 0x3270
movq %rax, 0x280(%rsp)
jmp 0x3a57
movq 0x280(%rsp), %rdi
movq 0x3053a(%rip), %rsi     # 0x33fa0
callq 0x32c0
jmp 0x3a6d
leaq 0xef0(%rsp), %rdi
callq 0x6190
leaq 0xed0(%rsp), %rdi
leaq 0xfb8(%rsp), %rsi
callq 0x3120
jmp 0x3a91
leaq 0xeaf(%rsp), %rdi
movq %rdi, 0x278(%rsp)
callq 0x34b0
movq 0x278(%rsp), %rdx
leaq 0x2474f(%rip), %rsi     # 0x28204
leaq 0xeb0(%rsp), %rdi
callq 0x3360
jmp 0x3ac4
movq 0xf50(%rsp), %rcx
movq 0xf48(%rsp), %r8
movq 0xf40(%rsp), %r9
leaq 0xef0(%rsp), %rdi
leaq 0xed0(%rsp), %rsi
leaq 0xeb0(%rsp), %rdx
callq 0x61a0
jmp 0x3afb
leaq 0xeb0(%rsp), %rdi
callq 0x3538
leaq 0xeaf(%rsp), %rdi
callq 0x32d0
leaq 0xed0(%rsp), %rdi
callq 0x3538
movq 0x30497(%rip), %rdi     # 0x33fc0
leaq 0x246dd(%rip), %rsi     # 0x2820d
callq 0x3290
movq %rax, 0x270(%rsp)
jmp 0x3b3f
movq 0x270(%rsp), %rdi
movq 0x30452(%rip), %rsi     # 0x33fa0
callq 0x32c0
jmp 0x3b55
leaq 0x246ce(%rip), %rdx     # 0x2822a
leaq 0xe88(%rsp), %rdi
leaq 0xf80(%rsp), %rsi
callq 0x6100
jmp 0x3b73
leaq 0xe67(%rsp), %rdi
movq %rdi, 0x268(%rsp)
callq 0x34b0
movq 0x268(%rsp), %rdx
leaq 0x2469c(%rip), %rsi     # 0x28233
leaq 0xe68(%rsp), %rdi
callq 0x3360
jmp 0x3ba6
movq 0xf40(%rsp), %rcx
leaq 0xef0(%rsp), %rdi
leaq 0xe88(%rsp), %rsi
leaq 0xe68(%rsp), %rdx
xorl %r8d, %r8d
callq 0x69c0
jmp 0x3bd0
leaq 0xe68(%rsp), %rdi
callq 0x3538
leaq 0xe67(%rsp), %rdi
callq 0x32d0
leaq 0xe88(%rsp), %rdi
callq 0x3538
movq 0x303c2(%rip), %rdi     # 0x33fc0
leaq 0x24639(%rip), %rsi     # 0x2823e
callq 0x3290
movq %rax, 0x260(%rsp)
jmp 0x3c14
movq 0x260(%rsp), %rdi
movq 0x3037d(%rip), %rsi     # 0x33fa0
callq 0x32c0
jmp 0x3c2a
movl 0xf24(%rsp), %esi
movsd 0xf30(%rsp), %xmm0
movsd 0xf28(%rsp), %xmm1
leaq 0xdf8(%rsp), %rdi
callq 0x7210
jmp 0x3c52
leaq 0xdc8(%rsp), %rdi
movq %rdi, 0x258(%rsp)
callq 0x6190
movq 0x258(%rsp), %rdx
leaq 0xdf8(%rsp), %rdi
leaq 0xef0(%rsp), %rsi
callq 0x7820
jmp 0x3c86
leaq 0xef0(%rsp), %rdi
leaq 0xdc8(%rsp), %rsi
movq %rsi, 0x250(%rsp)
callq 0x7d00
movq 0x250(%rsp), %rdi
callq 0x7d50
jmp 0x3cb2
leaq 0x24595(%rip), %rdx     # 0x2824e
leaq 0xda8(%rsp), %rdi
leaq 0xf80(%rsp), %rsi
callq 0x6100
jmp 0x3cd0
leaq 0xd87(%rsp), %rdi
movq %rdi, 0x248(%rsp)
callq 0x34b0
movq 0x248(%rsp), %rdx
leaq 0x24510(%rip), %rsi     # 0x28204
leaq 0xd88(%rsp), %rdi
callq 0x3360
jmp 0x3d03
leaq 0xef0(%rsp), %rdi
leaq 0xda8(%rsp), %rsi
leaq 0xd88(%rsp), %rdx
callq 0x7d90
jmp 0x3d22
leaq 0xd88(%rsp), %rdi
callq 0x3538
leaq 0xd87(%rsp), %rdi
callq 0x32d0
leaq 0xda8(%rsp), %rdi
callq 0x3538
leaq 0x244da(%rip), %rdx     # 0x2822a
leaq 0xd60(%rsp), %rdi
leaq 0xf80(%rsp), %rsi
callq 0x6100
jmp 0x3d67
leaq 0xd3f(%rsp), %rdi
movq %rdi, 0x240(%rsp)
callq 0x34b0
movq 0x240(%rsp), %rdx
leaq 0x244d2(%rip), %rsi     # 0x2825d
leaq 0xd40(%rsp), %rdi
callq 0x3360
jmp 0x3d9a
movq 0xf40(%rsp), %rcx
leaq 0xef0(%rsp), %rdi
leaq 0xd60(%rsp), %rsi
leaq 0xd40(%rsp), %rdx
xorl %r8d, %r8d
callq 0x69c0
jmp 0x3dc4
leaq 0xd40(%rsp), %rdi
callq 0x3538
leaq 0xd3f(%rsp), %rdi
callq 0x32d0
leaq 0xd60(%rsp), %rdi
callq 0x3538
leaq 0xdc8(%rsp), %rdi
callq 0x8530
leaq 0xdf8(%rsp), %rdi
callq 0x8540
leaq 0xd08(%rsp), %rdi
callq 0x6190
leaq 0xce0(%rsp), %rdi
leaq 0xf80(%rsp), %rsi
callq 0x3120
jmp 0x3e29
leaq 0xd07(%rsp), %rdi
leaq 0xef0(%rsp), %rsi
leaq 0xd08(%rsp), %rdx
leaq 0xce0(%rsp), %rcx
movsd 0x241bf(%rip), %xmm0    # 0x28010
callq 0x8570
jmp 0x3e58
leaq 0xce0(%rsp), %rdi
callq 0x3538
leaq 0xef0(%rsp), %rdi
callq 0x7d50
jmp 0x3e74
leaq 0x243ee(%rip), %rdx     # 0x28269
leaq 0xcc0(%rsp), %rdi
leaq 0xf80(%rsp), %rsi
callq 0x6100
jmp 0x3e92
leaq 0xc9f(%rsp), %rdi
movq %rdi, 0x238(%rsp)
callq 0x34b0
movq 0x238(%rsp), %rdx
leaq 0x2434e(%rip), %rsi     # 0x28204
leaq 0xca0(%rsp), %rdi
callq 0x3360
jmp 0x3ec5
leaq 0xd08(%rsp), %rdi
leaq 0xcc0(%rsp), %rsi
leaq 0xca0(%rsp), %rdx
callq 0x7d90
jmp 0x3ee4
leaq 0xca0(%rsp), %rdi
callq 0x3538
leaq 0xc9f(%rsp), %rdi
callq 0x32d0
leaq 0xcc0(%rsp), %rdi
callq 0x3538
leaq 0x24318(%rip), %rdx     # 0x2822a
leaq 0xc78(%rsp), %rdi
leaq 0xf80(%rsp), %rsi
callq 0x6100
jmp 0x3f29
leaq 0xc57(%rsp), %rdi
movq %rdi, 0x230(%rsp)
callq 0x34b0
movq 0x230(%rsp), %rdx
leaq 0x2432d(%rip), %rsi     # 0x2827a
leaq 0xc58(%rsp), %rdi
callq 0x3360
jmp 0x3f5c
movq 0xf40(%rsp), %rcx
leaq 0xd08(%rsp), %rdi
leaq 0xc78(%rsp), %rsi
leaq 0xc58(%rsp), %rdx
xorl %r8d, %r8d
callq 0x69c0
jmp 0x3f86
leaq 0xc58(%rsp), %rdi
callq 0x3538
leaq 0xc57(%rsp), %rdi
callq 0x32d0
leaq 0xc78(%rsp), %rdi
callq 0x3538
movq 0x3000c(%rip), %rdi     # 0x33fc0
leaq 0x242cd(%rip), %rsi     # 0x28288
callq 0x3290
movq %rax, 0x228(%rsp)
jmp 0x3fca
movq 0x228(%rsp), %rdi
movq 0x2ffc7(%rip), %rsi     # 0x33fa0
callq 0x32c0
jmp 0x3fe0
movq 0xf50(%rsp), %rsi
movq 0xf48(%rsp), %rdx
movq 0xf40(%rsp), %rcx
leaq 0xc38(%rsp), %rdi
callq 0x9180
jmp 0x4007
leaq 0xc20(%rsp), %rdi
callq 0x9270
leaq 0xc08(%rsp), %rdi
callq 0x9270
leaq 0xbe8(%rsp), %rdi
leaq 0xf80(%rsp), %rsi
callq 0x3120
jmp 0x4038
leaq 0xc38(%rsp), %rdi
leaq 0xd08(%rsp), %rsi
leaq 0xc20(%rsp), %rdx
leaq 0xc08(%rsp), %rcx
leaq 0xbe8(%rsp), %r8
movl $0x96, %r9d
callq 0x9280
jmp 0x406d
leaq 0xbe8(%rsp), %rdi
callq 0x3538
xorl %eax, %eax
movl %eax, %esi
leaq 0xc08(%rsp), %rdi
callq 0x9d40
movq $0x0, (%rax)
movq 0x2ff27(%rip), %rdi     # 0x33fc0
leaq 0x241fc(%rip), %rsi     # 0x2829c
callq 0x3290
movq %rax, 0x220(%rsp)
jmp 0x40af
movq 0x220(%rsp), %rdi
movq 0x2fee2(%rip), %rsi     # 0x33fa0
callq 0x32c0
jmp 0x40c5
leaq 0xc08(%rsp), %rdi
callq 0x9d60
jmp 0x40d4
leaq 0xc08(%rsp), %rdi
callq 0x9e50
movsd %xmm0, 0x218(%rsp)
jmp 0x40ec
movsd 0x218(%rsp), %xmm0
movsd %xmm0, 0xbe0(%rsp)
movq 0x2febb(%rip), %rdi     # 0x33fc0
leaq 0x241a4(%rip), %rsi     # 0x282b0
callq 0x3290
movq %rax, 0x210(%rsp)
jmp 0x411b
movq 0x210(%rsp), %rdi
movsd 0xbe0(%rsp), %xmm0
callq 0x34e0
movq %rax, 0x208(%rsp)
jmp 0x413b
movq 0x208(%rsp), %rdi
movq 0x2fe56(%rip), %rsi     # 0x33fa0
callq 0x32c0
jmp 0x4151
movsd 0xbe0(%rsp), %xmm0
movsd 0x23eb6(%rip), %xmm2    # 0x28018
movaps %xmm0, %xmm1
subsd %xmm2, %xmm1
cvttsd2si %xmm1, %rax
cvttsd2si %xmm0, %rsi
movq %rsi, %rcx
sarq $0x3f, %rcx
andq %rcx, %rax
orq %rax, %rsi
leaq 0xc20(%rsp), %rdi
callq 0xa1c0
movq %rax, 0x200(%rsp)
jmp 0x4197
movq 0x200(%rsp), %rax
cvttsd2si (%rax), %eax
movw %ax, 0xbde(%rsp)
movq 0x2fe0e(%rip), %rdi     # 0x33fc0
leaq 0x2410d(%rip), %rsi     # 0x282c6
callq 0x3290
movq %rax, 0x1f8(%rsp)
jmp 0x41c8
movq 0x1f8(%rsp), %rdi
movzwl 0xbde(%rsp), %esi
callq 0x3470
movq %rax, 0x1f0(%rsp)
jmp 0x41e7
movq 0x1f0(%rsp), %rdi
movq 0x2fdaa(%rip), %rsi     # 0x33fa0
callq 0x32c0
jmp 0x41fd
movq 0x2fdbc(%rip), %rdi     # 0x33fc0
leaq 0x240d0(%rip), %rsi     # 0x282db
callq 0x3290
movq %rax, 0x1e8(%rsp)
jmp 0x421a
movq 0x1e8(%rsp), %rdi
movq 0x2fd77(%rip), %rsi     # 0x33fa0
callq 0x32c0
jmp 0x4230
leaq 0x240c7(%rip), %rdx     # 0x282fe
leaq 0x9b8(%rsp), %rdi
leaq 0xf80(%rsp), %rsi
callq 0x6100
jmp 0x424e
leaq 0x9d8(%rsp), %rdi
leaq 0x9b8(%rsp), %rsi
movl $0x10, %edx
callq 0x3500
jmp 0x426a
leaq 0x9b8(%rsp), %rdi
callq 0x3538
leaq 0x240a0(%rip), %rsi     # 0x2831e
leaq 0x9d8(%rsp), %rdi
callq 0x3290
movq %rax, 0x1e0(%rsp)
jmp 0x4295
movq 0x1e0(%rsp), %rdi
movq 0x2fcfc(%rip), %rsi     # 0x33fa0
callq 0x32c0
jmp 0x42ab
leaq 0x24088(%rip), %rsi     # 0x2833a
leaq 0x9d8(%rsp), %rdi
callq 0x3290
movq %rax, 0x1d8(%rsp)
jmp 0x42c9
movq 0x1d8(%rsp), %rdi
movzwl 0xbde(%rsp), %esi
callq 0x3470
movq %rax, 0x1d0(%rsp)
jmp 0x42e8
movq 0x1d0(%rsp), %rdi
movq 0x2fca9(%rip), %rsi     # 0x33fa0
callq 0x32c0
jmp 0x42fe
leaq 0x2403e(%rip), %rsi     # 0x28343
leaq 0x9d8(%rsp), %rdi
callq 0x3290
movq %rax, 0x1c8(%rsp)
jmp 0x431c
movq 0x1c8(%rsp), %rdi
movq 0x2fc75(%rip), %rsi     # 0x33fa0
callq 0x32c0
jmp 0x4332
leaq 0x24021(%rip), %rsi     # 0x2835a
leaq 0x9d8(%rsp), %rdi
callq 0x3290
movq %rax, 0x1c0(%rsp)
jmp 0x4350
movq 0x1c0(%rsp), %rdi
movq 0x2fc41(%rip), %rsi     # 0x33fa0
callq 0x32c0
jmp 0x4366
leaq 0x24005(%rip), %rsi     # 0x28372
leaq 0x9d8(%rsp), %rdi
callq 0x3290
movq %rax, 0x1b8(%rsp)
jmp 0x4384
movq 0x1b8(%rsp), %rdi
movq 0x2fc0d(%rip), %rsi     # 0x33fa0
callq 0x32c0
jmp 0x439a
leaq 0x23fdd(%rip), %rsi     # 0x2837e
leaq 0x9d8(%rsp), %rdi
callq 0x3290
movq %rax, 0x1b0(%rsp)
jmp 0x43b8
movq 0x1b0(%rsp), %rdi
movq 0x2fbd9(%rip), %rsi     # 0x33fa0
callq 0x32c0
jmp 0x43ce
leaq 0x23fde(%rip), %rsi     # 0x283b3
leaq 0x9d8(%rsp), %rdi
callq 0x3290
movq %rax, 0x1a8(%rsp)
jmp 0x43ec
movq 0x1a8(%rsp), %rdi
movq 0x2fba5(%rip), %rsi     # 0x33fa0
callq 0x32c0
jmp 0x4402
leaq 0x9d8(%rsp), %rdi
callq 0x3370
jmp 0x4411
leaq 0x9d8(%rsp), %rdi
callq 0x3390
movq 0x2fb9b(%rip), %rdi     # 0x33fc0
movq 0x2fb74(%rip), %rsi     # 0x33fa0
callq 0x32c0
movq %rax, 0x1a0(%rsp)
jmp 0x443b
movq 0x1a0(%rsp), %rdi
leaq 0x23f87(%rip), %rsi     # 0x283d1
callq 0x3290
movq %rax, 0x198(%rsp)
jmp 0x4459
movq 0x198(%rsp), %rdi
movq 0x2fb38(%rip), %rsi     # 0x33fa0
callq 0x32c0
jmp 0x446f
leaq 0x988(%rsp), %rdi
movq %rdi, 0x190(%rsp)
callq 0xa200
movq 0x190(%rsp), %rdi
movq 0xf50(%rsp), %rsi
movq 0xf48(%rsp), %rdx
movq 0xf40(%rsp), %rcx
xorl %r8d, %r8d
callq 0xa210
jmp 0x44ae
movq $0x0, 0x980(%rsp)
movq 0x980(%rsp), %rax
cmpq 0xf40(%rsp), %rax
je 0x49a9
movq $0x0, 0x978(%rsp)
movq 0x978(%rsp), %rax
cmpq 0xf48(%rsp), %rax
je 0x498e
movq $0x0, 0x970(%rsp)
movq 0x970(%rsp), %rax
cmpq 0xf50(%rsp), %rax
je 0x4973
movq 0x970(%rsp), %rsi
movq 0x978(%rsp), %rdx
movq 0x980(%rsp), %rcx
leaq 0xd08(%rsp), %rdi
callq 0xa350
movw %ax, 0x18e(%rsp)
jmp 0x4543
movw 0x18e(%rsp), %ax
movw %ax, 0x96e(%rsp)
movzwl 0x96e(%rsp), %eax
movzwl 0xbde(%rsp), %ecx
cmpl %ecx, %eax
jl 0x4958
movq 0x970(%rsp), %rsi
movq 0x978(%rsp), %rdx
movq 0x980(%rsp), %rcx
leaq 0x988(%rsp), %rdi
movl $0x1, %r8d
callq 0xa6f0
jmp 0x4598
jmp 0x4958
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
leaq 0xfb7(%rsp), %rdi
callq 0x32d0
jmp 0x5e49
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
leaq 0xf7f(%rsp), %rdi
callq 0x32d0
jmp 0x5e2b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
jmp 0x5e1e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
leaq 0xf58(%rsp), %rdi
callq 0x3538
jmp 0x5e1e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
jmp 0x5e11
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
jmp 0x4678
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
leaq 0xeb0(%rsp), %rdi
callq 0x3538
leaq 0xeaf(%rsp), %rdi
callq 0x32d0
leaq 0xed0(%rsp), %rdi
callq 0x3538
jmp 0x5e11
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
jmp 0x46ce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
leaq 0xe68(%rsp), %rdi
callq 0x3538
leaq 0xe67(%rsp), %rdi
callq 0x32d0
leaq 0xe88(%rsp), %rdi
callq 0x3538
jmp 0x5e11
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
jmp 0x47aa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
jmp 0x473d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
leaq 0xd88(%rsp), %rdi
callq 0x3538
leaq 0xd87(%rsp), %rdi
callq 0x32d0
leaq 0xda8(%rsp), %rdi
callq 0x3538
jmp 0x47aa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
jmp 0x4790
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
leaq 0xd40(%rsp), %rdi
callq 0x3538
leaq 0xd3f(%rsp), %rdi
callq 0x32d0
leaq 0xd60(%rsp), %rdi
callq 0x3538
leaq 0xdc8(%rsp), %rdi
callq 0x8530
leaq 0xdf8(%rsp), %rdi
callq 0x8540
jmp 0x5e11
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
jmp 0x5e04
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
leaq 0xce0(%rsp), %rdi
callq 0x3538
jmp 0x5e04
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
jmp 0x483f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
leaq 0xca0(%rsp), %rdi
callq 0x3538
leaq 0xc9f(%rsp), %rdi
callq 0x32d0
leaq 0xcc0(%rsp), %rdi
callq 0x3538
jmp 0x5e04
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
jmp 0x4895
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
leaq 0xc58(%rsp), %rdi
callq 0x3538
leaq 0xc57(%rsp), %rdi
callq 0x32d0
leaq 0xc78(%rsp), %rdi
callq 0x3538
jmp 0x5e04
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
jmp 0x5ddd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
leaq 0xbe8(%rsp), %rdi
callq 0x3538
jmp 0x5ddd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
leaq 0x9b8(%rsp), %rdi
callq 0x3538
jmp 0x5ddd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
leaq 0x9d8(%rsp), %rdi
callq 0x3390
jmp 0x5ddd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
jmp 0x5dd0
jmp 0x495a
movq 0x970(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x970(%rsp)
jmp 0x44fe
jmp 0x4975
movq 0x978(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x978(%rsp)
jmp 0x44dc
jmp 0x4990
movq 0x980(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x980(%rsp)
jmp 0x44ba
leaq 0x2387b(%rip), %rdx     # 0x2822b
leaq 0x948(%rsp), %rdi
leaq 0xf80(%rsp), %rsi
callq 0x6100
jmp 0x49c7
leaq 0x927(%rsp), %rdi
movq %rdi, 0x180(%rsp)
callq 0x34b0
movq 0x180(%rsp), %rdx
leaq 0x239fe(%rip), %rsi     # 0x283e9
leaq 0x928(%rsp), %rdi
callq 0x3360
jmp 0x49fa
movq 0xf40(%rsp), %rcx
leaq 0x988(%rsp), %rdi
leaq 0x948(%rsp), %rsi
leaq 0x928(%rsp), %rdx
xorl %r8d, %r8d
callq 0xaab0
jmp 0x4a24
leaq 0x928(%rsp), %rdi
callq 0x3538
leaq 0x927(%rsp), %rdi
callq 0x32d0
leaq 0x948(%rsp), %rdi
callq 0x3538
leaq 0x8f0(%rsp), %rdi
movq %rdi, 0x178(%rsp)
callq 0xa200
movq 0x178(%rsp), %rdi
movq 0xf50(%rsp), %rsi
movq 0xf48(%rsp), %rdx
movq 0xf40(%rsp), %rcx
xorl %r8d, %r8d
callq 0xa210
jmp 0x4a8a
leaq 0x988(%rsp), %rdi
callq 0xb300
jmp 0x4a99
leaq 0x2378b(%rip), %rdx     # 0x2822b
leaq 0x8d0(%rsp), %rdi
leaq 0xf80(%rsp), %rsi
callq 0x6100
jmp 0x4ab7
leaq 0x8af(%rsp), %rdi
movq %rdi, 0x170(%rsp)
callq 0x34b0
movq 0x170(%rsp), %rdx
leaq 0x23917(%rip), %rsi     # 0x283f2
leaq 0x8b0(%rsp), %rdi
callq 0x3360
jmp 0x4aea
movq 0xf40(%rsp), %rcx
leaq 0x988(%rsp), %rdi
leaq 0x8d0(%rsp), %rsi
leaq 0x8b0(%rsp), %rdx
xorl %r8d, %r8d
callq 0xaab0
jmp 0x4b14
leaq 0x8b0(%rsp), %rdi
callq 0x3538
leaq 0x8af(%rsp), %rdi
callq 0x32d0
leaq 0x8d0(%rsp), %rdi
callq 0x3538
leaq 0x238c7(%rip), %rdx     # 0x28409
leaq 0x888(%rsp), %rdi
leaq 0xf80(%rsp), %rsi
callq 0x6100
jmp 0x4b59
leaq 0x867(%rsp), %rdi
movq %rdi, 0x168(%rsp)
callq 0x34b0
movq 0x168(%rsp), %rdx
leaq 0x238a2(%rip), %rsi     # 0x2841f
leaq 0x868(%rsp), %rdi
callq 0x3360
jmp 0x4b8c
leaq 0x988(%rsp), %rdi
leaq 0x888(%rsp), %rsi
leaq 0x868(%rsp), %rdx
callq 0xc1b0
jmp 0x4bab
leaq 0x868(%rsp), %rdi
callq 0x3538
leaq 0x867(%rsp), %rdi
callq 0x32d0
leaq 0x888(%rsp), %rdi
callq 0x3538
leaq 0x830(%rsp), %rdi
callq 0xc950
cvtsi2ssl 0xf3c(%rsp), %xmm0
movss %xmm0, 0x164(%rsp)
leaq 0x23632(%rip), %rdx     # 0x2822a
leaq 0x810(%rsp), %rdi
leaq 0xf80(%rsp), %rsi
callq 0x6100
jmp 0x4c0f
movss 0x164(%rsp), %xmm0
leaq 0x988(%rsp), %rdi
leaq 0x830(%rsp), %rsi
leaq 0x810(%rsp), %rdx
movl $0x64, %ecx
callq 0xc960
jmp 0x4c3c
leaq 0x810(%rsp), %rdi
callq 0x3538
leaq 0x830(%rsp), %rdi
movsd 0x233c7(%rip), %xmm0    # 0x28020
callq 0xe160
jmp 0x4c60
leaq 0x235c4(%rip), %rdx     # 0x2822b
leaq 0x7f0(%rsp), %rdi
leaq 0xf80(%rsp), %rsi
callq 0x6100
jmp 0x4c7e
leaq 0x7cf(%rsp), %rdi
movq %rdi, 0x158(%rsp)
callq 0x34b0
movq 0x158(%rsp), %rdx
leaq 0x23785(%rip), %rsi     # 0x28427
leaq 0x7d0(%rsp), %rdi
callq 0x3360
jmp 0x4cb1
movq 0xf40(%rsp), %rcx
leaq 0x830(%rsp), %rdi
leaq 0x7f0(%rsp), %rsi
leaq 0x7d0(%rsp), %rdx
xorl %r8d, %r8d
callq 0xe5f0
jmp 0x4cdb
leaq 0x7d0(%rsp), %rdi
callq 0x3538
leaq 0x7cf(%rsp), %rdi
callq 0x32d0
leaq 0x7f0(%rsp), %rdi
callq 0x3538
leaq 0x23522(%rip), %rdx     # 0x2822b
leaq 0x7a8(%rsp), %rdi
leaq 0xf80(%rsp), %rsi
callq 0x6100
jmp 0x4d20
leaq 0x787(%rsp), %rdi
movq %rdi, 0x150(%rsp)
callq 0x34b0
movq 0x150(%rsp), %rdx
leaq 0x236ed(%rip), %rsi     # 0x28431
leaq 0x788(%rsp), %rdi
callq 0x3360
jmp 0x4d53
movq 0xf40(%rsp), %rcx
leaq 0x830(%rsp), %rdi
leaq 0x7a8(%rsp), %rsi
leaq 0x788(%rsp), %rdx
movl $0x1, %r8d
callq 0xe5f0
jmp 0x4d80
leaq 0x788(%rsp), %rdi
callq 0x3538
leaq 0x787(%rsp), %rdi
callq 0x32d0
leaq 0x7a8(%rsp), %rdi
callq 0x3538
jmp 0x5062
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
jmp 0x4de3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
leaq 0x928(%rsp), %rdi
callq 0x3538
leaq 0x927(%rsp), %rdi
callq 0x32d0
leaq 0x948(%rsp), %rdi
callq 0x3538
jmp 0x5dd0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
jmp 0x5dc3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
jmp 0x4e52
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
leaq 0x8b0(%rsp), %rdi
callq 0x3538
leaq 0x8af(%rsp), %rdi
callq 0x32d0
leaq 0x8d0(%rsp), %rdi
callq 0x3538
jmp 0x5dc3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
jmp 0x4ea8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
leaq 0x868(%rsp), %rdi
callq 0x3538
leaq 0x867(%rsp), %rdi
callq 0x32d0
leaq 0x888(%rsp), %rdi
callq 0x3538
jmp 0x5dc3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
jmp 0x4faa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
leaq 0x810(%rsp), %rdi
callq 0x3538
jmp 0x4faa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
jmp 0x4f3d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
leaq 0x7d0(%rsp), %rdi
callq 0x3538
leaq 0x7cf(%rsp), %rdi
callq 0x32d0
leaq 0x7f0(%rsp), %rdi
callq 0x3538
jmp 0x4faa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
jmp 0x4f90
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
leaq 0x788(%rsp), %rdi
callq 0x3538
leaq 0x787(%rsp), %rdi
callq 0x32d0
leaq 0x7a8(%rsp), %rdi
callq 0x3538
movl 0xfa4(%rsp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x5db6
movq 0xfa8(%rsp), %rdi
callq 0x3100
movq %rax, 0x778(%rsp)
movq 0x778(%rsp), %rsi
movq 0x2f006(%rip), %rdi     # 0x33fe8
callq 0x3270
movq %rax, 0x148(%rsp)
jmp 0x4ff1
movq 0x148(%rsp), %rdi
movq 0x2efa0(%rip), %rsi     # 0x33fa0
callq 0x32c0
jmp 0x5007
movl $0x1, 0xfe4(%rsp)
movl $0x1, 0x774(%rsp)
callq 0x3400
jmp 0x503f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
callq 0x3400
jmp 0x505d
jmp 0x5d2f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
jmp 0x5db6
jmp 0x5db6
movq 0x2ef57(%rip), %rdi     # 0x33fc0
leaq 0x233d1(%rip), %rsi     # 0x28441
callq 0x3290
movq %rax, 0x140(%rsp)
jmp 0x507f
movq 0x140(%rsp), %rdi
movq 0x2ef12(%rip), %rsi     # 0x33fa0
callq 0x32c0
jmp 0x5095
leaq 0x740(%rsp), %rdi
callq 0xee50
leaq 0x710(%rsp), %rdi
callq 0xee60
leaq 0x6e0(%rsp), %rdi
callq 0xee60
leaq 0x6b0(%rsp), %rdi
callq 0xee60
leaq 0x680(%rsp), %rdi
movq %rdi, 0x138(%rsp)
callq 0x6190
movq 0x138(%rsp), %rdi
movq 0xf50(%rsp), %rsi
movq 0xf48(%rsp), %rdx
movq 0xf40(%rsp), %rcx
xorl %r8d, %r8d
callq 0xee70
jmp 0x5108
movq 0x2eeb1(%rip), %rdi     # 0x33fc0
leaq 0x23341(%rip), %rsi     # 0x28457
callq 0x3290
movq %rax, 0x130(%rsp)
jmp 0x5125
movq 0x130(%rsp), %rdi
movq 0x2ee6c(%rip), %rsi     # 0x33fa0
callq 0x32c0
jmp 0x513b
movl $0x0, 0x67c(%rsp)
movl 0x67c(%rsp), %eax
cmpq 0xf40(%rsp), %rax
je 0x53fc
movl 0x67c(%rsp), %esi
movq 0x2ee57(%rip), %rdi     # 0x33fc0
callq 0x3350
movq %rax, 0x128(%rsp)
jmp 0x5178
movq 0x128(%rsp), %rdi
leaq 0x23ac1(%rip), %rsi     # 0x28c48
callq 0x3290
jmp 0x518e
movl $0x0, 0x678(%rsp)
movl 0x678(%rsp), %eax
cmpq 0xf48(%rsp), %rax
je 0x53e4
movl $0x0, 0x674(%rsp)
movl 0x674(%rsp), %eax
cmpq 0xf50(%rsp), %rax
je 0x53cc
movl 0x674(%rsp), %eax
movl %eax, %esi
movl 0x678(%rsp), %eax
movl %eax, %edx
movl 0x67c(%rsp), %eax
movl %eax, %ecx
leaq 0x830(%rsp), %rdi
callq 0xefc0
movl %eax, 0x124(%rsp)
jmp 0x51ff
movl 0x124(%rsp), %eax
movw %ax, 0x672(%rsp)
movl 0x674(%rsp), %eax
movl %eax, %esi
movl 0x678(%rsp), %eax
movl %eax, %edx
movl 0x67c(%rsp), %eax
movl %eax, %ecx
movzwl 0x672(%rsp), %r8d
leaq 0x680(%rsp), %rdi
callq 0xf360
jmp 0x5241
movzwl 0x672(%rsp), %eax
movq %rax, 0x668(%rsp)
leaq 0x740(%rsp), %rdi
leaq 0x668(%rsp), %rsi
callq 0xf720
movq %rax, 0x118(%rsp)
jmp 0x5270
movq 0x118(%rsp), %rax
movl (%rax), %ecx
incl %ecx
movl %ecx, (%rax)
movl 0x674(%rsp), %eax
cvtsi2sd %rax, %xmm0
movsd %xmm0, 0x108(%rsp)
movzwl 0x672(%rsp), %eax
movq %rax, 0x660(%rsp)
leaq 0x710(%rsp), %rdi
leaq 0x660(%rsp), %rsi
callq 0xf810
movq %rax, 0x110(%rsp)
jmp 0x52c2
movq 0x110(%rsp), %rax
movsd 0x108(%rsp), %xmm1
movsd (%rax), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax)
movl 0x678(%rsp), %eax
cvtsi2sd %rax, %xmm0
movsd %xmm0, 0xf8(%rsp)
movzwl 0x672(%rsp), %eax
movq %rax, 0x658(%rsp)
leaq 0x6e0(%rsp), %rdi
leaq 0x658(%rsp), %rsi
callq 0xf810
movq %rax, 0x100(%rsp)
jmp 0x5323
movq 0x100(%rsp), %rax
movsd 0xf8(%rsp), %xmm1
movsd (%rax), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax)
movl 0x67c(%rsp), %eax
cvtsi2sd %rax, %xmm0
movsd %xmm0, 0xe8(%rsp)
movzwl 0x672(%rsp), %eax
movq %rax, 0x650(%rsp)
leaq 0x6b0(%rsp), %rdi
leaq 0x650(%rsp), %rsi
callq 0xf810
movq %rax, 0xf0(%rsp)
jmp 0x5384
movq 0xf0(%rsp), %rax
movsd 0xe8(%rsp), %xmm0
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
movl 0x674(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x674(%rsp)
jmp 0x51b9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
jmp 0x5ce9
jmp 0x53ce
movl 0x678(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x678(%rsp)
jmp 0x5199
jmp 0x53e6
movl 0x67c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x67c(%rsp)
jmp 0x5146
movq 0x2ebbd(%rip), %rdi     # 0x33fc0
leaq 0x2305d(%rip), %rsi     # 0x28467
callq 0x3290
movq %rax, 0xe0(%rsp)
jmp 0x5419
movq 0xe0(%rsp), %rdi
movq 0x2eb78(%rip), %rsi     # 0x33fa0
callq 0x32c0
jmp 0x542f
leaq 0x2304d(%rip), %rdx     # 0x28483
leaq 0x5f0(%rsp), %rdi
leaq 0xf80(%rsp), %rsi
callq 0x6100
jmp 0x544d
movl 0xf3c(%rsp), %esi
leaq 0x5d0(%rsp), %rdi
callq 0xfa40
jmp 0x5463
leaq 0x610(%rsp), %rdi
leaq 0x5f0(%rsp), %rsi
leaq 0x5d0(%rsp), %rdx
callq 0xf950
jmp 0x5482
leaq 0x2373b(%rip), %rdx     # 0x28bc4
leaq 0x630(%rsp), %rdi
leaq 0x610(%rsp), %rsi
callq 0xf900
jmp 0x54a0
leaq 0x610(%rsp), %rdi
callq 0x3538
leaq 0x5d0(%rsp), %rdi
callq 0x3538
leaq 0x5f0(%rsp), %rdi
callq 0x3538
movq 0x2eaf2(%rip), %rdi     # 0x33fc0
leaq 0x22fc6(%rip), %rsi     # 0x2849b
callq 0x3290
movq %rax, 0xd8(%rsp)
jmp 0x54e4
movq 0xd8(%rsp), %rdi
leaq 0x630(%rsp), %rsi
callq 0x3270
movq %rax, 0xd0(%rsp)
jmp 0x5503
movq 0xd0(%rsp), %rdi
movq 0x2ea8e(%rip), %rsi     # 0x33fa0
callq 0x32c0
jmp 0x5519
leaq 0x3d0(%rsp), %rdi
leaq 0x630(%rsp), %rsi
movl $0x10, %edx
callq 0x3500
jmp 0x5535
movq 0x3d0(%rsp), %rax
movq -0x18(%rax), %rax
leaq 0x3d0(%rsp,%rax), %rdi
callq 0x3440
movb %al, 0xcf(%rsp)
jmp 0x5557
movb 0xcf(%rsp), %al
testb $0x1, %al
jne 0x5654
jmp 0x5568
movq 0x2ea79(%rip), %rdi     # 0x33fe8
leaq 0x22f30(%rip), %rsi     # 0x284a6
callq 0x3290
movq %rax, 0xc0(%rsp)
jmp 0x5585
movq 0xc0(%rsp), %rdi
movq 0x2ea0c(%rip), %rsi     # 0x33fa0
callq 0x32c0
jmp 0x559b
movl $0x1, 0xfe4(%rsp)
movl $0x1, 0x774(%rsp)
jmp 0x5c72
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
jmp 0x5610
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
jmp 0x5603
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
leaq 0x610(%rsp), %rdi
callq 0x3538
leaq 0x5d0(%rsp), %rdi
callq 0x3538
leaq 0x5f0(%rsp), %rdi
callq 0x3538
jmp 0x5ce9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
jmp 0x5cdc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
jmp 0x5ccf
leaq 0x22e5f(%rip), %rsi     # 0x284ba
leaq 0x3d0(%rsp), %rdi
callq 0x3290
movq %rax, 0xb8(%rsp)
jmp 0x5672
movq 0xb8(%rsp), %rdi
movq 0x2e91f(%rip), %rsi     # 0x33fa0
callq 0x32c0
jmp 0x5688
leaq 0x22e46(%rip), %rsi     # 0x284d5
leaq 0x3d0(%rsp), %rdi
callq 0x3290
movq %rax, 0xb0(%rsp)
jmp 0x56a6
movq 0xb0(%rsp), %rdi
movq 0xf40(%rsp), %rsi
callq 0x3090
movq %rax, 0xa8(%rsp)
jmp 0x56c5
movq 0xa8(%rsp), %rdi
leaq 0x22e09(%rip), %rsi     # 0x284dd
callq 0x3290
movq %rax, 0xa0(%rsp)
jmp 0x56e3
movq 0xa0(%rsp), %rdi
movq 0x2e8ae(%rip), %rsi     # 0x33fa0
callq 0x32c0
jmp 0x56f9
movq $0x0, 0x3c8(%rsp)
movq 0x3c8(%rsp), %rax
movq %rax, 0x98(%rsp)
leaq 0x740(%rsp), %rdi
callq 0xfb80
movq %rax, %rcx
movq 0x98(%rsp), %rax
cmpq %rcx, %rax
je 0x5951
leaq 0x740(%rsp), %rdi
leaq 0x3c8(%rsp), %rsi
callq 0xfb90
movq %rax, 0x90(%rsp)
jmp 0x5755
movq 0x90(%rsp), %rax
movl (%rax), %eax
cvtsi2sd %rax, %xmm0
movsd %xmm0, 0x3c0(%rsp)
movsd 0x3c0(%rsp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x5786
jp 0x5786
jmp 0x5938
leaq 0x234bb(%rip), %rsi     # 0x28c48
leaq 0x3d0(%rsp), %rdi
callq 0x3290
movq %rax, 0x88(%rsp)
jmp 0x57a4
leaq 0x710(%rsp), %rdi
leaq 0x3c8(%rsp), %rsi
callq 0xfc80
movq %rax, 0x80(%rsp)
jmp 0x57c3
movq 0x88(%rsp), %rdi
movq 0x80(%rsp), %rax
movsd (%rax), %xmm0
movsd 0x3c0(%rsp), %xmm1
divsd %xmm1, %xmm0
callq 0x34e0
movq %rax, 0x78(%rsp)
jmp 0x57f0
movq 0x78(%rsp), %rdi
leaq 0x2344c(%rip), %rsi     # 0x28c48
callq 0x3290
movq %rax, 0x70(%rsp)
jmp 0x5808
leaq 0x6e0(%rsp), %rdi
leaq 0x3c8(%rsp), %rsi
callq 0xfc80
movq %rax, 0x68(%rsp)
jmp 0x5824
movq 0x70(%rsp), %rdi
movq 0x68(%rsp), %rax
movsd (%rax), %xmm0
movsd 0x3c0(%rsp), %xmm1
divsd %xmm1, %xmm0
callq 0x34e0
movq %rax, 0x60(%rsp)
jmp 0x584b
movq 0x60(%rsp), %rdi
leaq 0x233f1(%rip), %rsi     # 0x28c48
callq 0x3290
movq %rax, 0x58(%rsp)
jmp 0x5863
leaq 0x6b0(%rsp), %rdi
leaq 0x3c8(%rsp), %rsi
callq 0xfc80
movq %rax, 0x50(%rsp)
jmp 0x587f
movq 0x58(%rsp), %rdi
movq 0x50(%rsp), %rax
movsd (%rax), %xmm0
movsd 0x3c0(%rsp), %xmm1
divsd %xmm1, %xmm0
callq 0x34e0
movq %rax, 0x48(%rsp)
jmp 0x58a6
movq 0x48(%rsp), %rdi
leaq 0x23396(%rip), %rsi     # 0x28c48
callq 0x3290
movq %rax, 0x40(%rsp)
jmp 0x58be
movq 0x40(%rsp), %rdi
movq 0x3c8(%rsp), %rsi
callq 0x3090
movq %rax, 0x38(%rsp)
jmp 0x58d7
movq 0x38(%rsp), %rdi
leaq 0x23365(%rip), %rsi     # 0x28c48
callq 0x3290
movq %rax, 0x30(%rsp)
jmp 0x58ef
leaq 0x740(%rsp), %rdi
leaq 0x3c8(%rsp), %rsi
callq 0xfb90
movq %rax, 0x28(%rsp)
jmp 0x590b
movq 0x30(%rsp), %rdi
movq 0x28(%rsp), %rax
movl (%rax), %esi
callq 0x3350
movq %rax, 0x20(%rsp)
jmp 0x5923
movq 0x20(%rsp), %rdi
movq 0x2e671(%rip), %rsi     # 0x33fa0
callq 0x32c0
jmp 0x5936
jmp 0x5938
movq 0x3c8(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x3c8(%rsp)
jmp 0x5705
leaq 0x3d0(%rsp), %rdi
callq 0x3370
jmp 0x5960
leaq 0x228c4(%rip), %rdx     # 0x2822b
leaq 0x3a0(%rsp), %rdi
leaq 0xf80(%rsp), %rsi
callq 0x6100
jmp 0x597e
leaq 0x37f(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0x34b0
movq 0x18(%rsp), %rdx
leaq 0x22b5d(%rip), %rsi     # 0x284f9
leaq 0x380(%rsp), %rdi
callq 0x3360
jmp 0x59ab
movq 0xf40(%rsp), %rcx
leaq 0x680(%rsp), %rdi
leaq 0x3a0(%rsp), %rsi
leaq 0x380(%rsp), %rdx
xorl %r8d, %r8d
callq 0x69c0
jmp 0x59d5
leaq 0x380(%rsp), %rdi
callq 0x3538
leaq 0x37f(%rsp), %rdi
callq 0x32d0
leaq 0x3a0(%rsp), %rdi
callq 0x3538
leaq 0x22b10(%rip), %rdx     # 0x28513
leaq 0x318(%rsp), %rdi
leaq 0xf80(%rsp), %rsi
callq 0x6100
jmp 0x5a1a
movl 0xf3c(%rsp), %esi
leaq 0x2f8(%rsp), %rdi
callq 0xfa40
jmp 0x5a30
leaq 0x338(%rsp), %rdi
leaq 0x318(%rsp), %rsi
leaq 0x2f8(%rsp), %rdx
callq 0xf950
jmp 0x5a4f
leaq 0x2281f(%rip), %rdx     # 0x28275
leaq 0x358(%rsp), %rdi
leaq 0x338(%rsp), %rsi
callq 0xf900
jmp 0x5a6d
leaq 0x630(%rsp), %rdi
movq %rdi, 0x10(%rsp)
leaq 0x358(%rsp), %rsi
movq %rsi, 0x8(%rsp)
callq 0x3300
movq 0x8(%rsp), %rdi
callq 0x3538
leaq 0x338(%rsp), %rdi
callq 0x3538
leaq 0x2f8(%rsp), %rdi
callq 0x3538
leaq 0x318(%rsp), %rdi
callq 0x3538
movq 0x10(%rsp), %rsi
leaq 0x2d8(%rsp), %rdi
callq 0x3120
jmp 0x5ad1
leaq 0x2b7(%rsp), %rdi
movq %rdi, (%rsp)
callq 0x34b0
movq (%rsp), %rdx
leaq 0x22717(%rip), %rsi     # 0x28204
leaq 0x2b8(%rsp), %rdi
callq 0x3360
jmp 0x5afc
leaq 0x680(%rsp), %rdi
leaq 0x2d8(%rsp), %rsi
leaq 0x2b8(%rsp), %rdx
callq 0x7d90
jmp 0x5b1b
leaq 0x2b8(%rsp), %rdi
callq 0x3538
leaq 0x2b7(%rsp), %rdi
callq 0x32d0
leaq 0x2d8(%rsp), %rdi
callq 0x3538
movl $0x0, 0xfe4(%rsp)
movl $0x1, 0x774(%rsp)
jmp 0x5c72
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
jmp 0x5b94
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
leaq 0x380(%rsp), %rdi
callq 0x3538
leaq 0x37f(%rsp), %rdi
callq 0x32d0
leaq 0x3a0(%rsp), %rdi
callq 0x3538
jmp 0x5ccf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
jmp 0x5c0d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
jmp 0x5c00
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
leaq 0x338(%rsp), %rdi
callq 0x3538
leaq 0x2f8(%rsp), %rdi
callq 0x3538
leaq 0x318(%rsp), %rdi
callq 0x3538
jmp 0x5ccf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
jmp 0x5c56
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xfa8(%rsp)
movl %eax, 0xfa4(%rsp)
leaq 0x2b8(%rsp), %rdi
callq 0x3538
leaq 0x2b7(%rsp), %rdi
callq 0x32d0
leaq 0x2d8(%rsp), %rdi
callq 0x3538
jmp 0x5ccf
leaq 0x3d0(%rsp), %rdi
callq 0x3390
leaq 0x630(%rsp), %rdi
callq 0x3538
leaq 0x680(%rsp), %rdi
callq 0x8530
leaq 0x6b0(%rsp), %rdi
callq 0xfd70
leaq 0x6e0(%rsp), %rdi
callq 0xfd70
leaq 0x710(%rsp), %rdi
callq 0xfd70
leaq 0x740(%rsp), %rdi
callq 0xfd80
jmp 0x5d2f
leaq 0x3d0(%rsp), %rdi
callq 0x3390
leaq 0x630(%rsp), %rdi
callq 0x3538
leaq 0x680(%rsp), %rdi
callq 0x8530
leaq 0x6b0(%rsp), %rdi
callq 0xfd70
leaq 0x6e0(%rsp), %rdi
callq 0xfd70
leaq 0x710(%rsp), %rdi
callq 0xfd70
leaq 0x740(%rsp), %rdi
callq 0xfd80
jmp 0x5db6
leaq 0x830(%rsp), %rdi
callq 0xfd90
leaq 0x8f0(%rsp), %rdi
callq 0xfda0
leaq 0x988(%rsp), %rdi
callq 0xfda0
leaq 0xc08(%rsp), %rdi
callq 0xfdb0
leaq 0xc20(%rsp), %rdi
callq 0xfdb0
leaq 0xc38(%rsp), %rdi
callq 0xfe10
leaq 0xd08(%rsp), %rdi
callq 0x8530
leaq 0xef0(%rsp), %rdi
callq 0x8530
leaq 0xf80(%rsp), %rdi
callq 0x3538
leaq 0xfb8(%rsp), %rdi
callq 0x3538
jmp 0x5e3a
leaq 0x830(%rsp), %rdi
callq 0xfd90
leaq 0x8f0(%rsp), %rdi
callq 0xfda0
leaq 0x988(%rsp), %rdi
callq 0xfda0
leaq 0xc08(%rsp), %rdi
callq 0xfdb0
leaq 0xc20(%rsp), %rdi
callq 0xfdb0
leaq 0xc38(%rsp), %rdi
callq 0xfe10
leaq 0xd08(%rsp), %rdi
callq 0x8530
leaq 0xef0(%rsp), %rdi
callq 0x8530
leaq 0xf80(%rsp), %rdi
callq 0x3538
leaq 0xfb8(%rsp), %rdi
callq 0x3538
jmp 0x5e49
movl 0xfe4(%rsp), %eax
addq $0xfe8, %rsp            # imm = 0xFE8
retq
movq 0xfa8(%rsp), %rdi
callq 0x34a0
movq %rax, %rdi
callq 0xee40
nop