// File: /workspace/github_cpp_makefile_star2_O1/chfeder[P]turbulence_generator/TurbGen.cpp
// Function: main
int main(int argc, char * argv[])
{
    /// initialise MPI
#ifdef HAVE_MPI
    MPI_Init(&argc, &argv);
    MPI_Comm_size(MPI_COMM_WORLD, &NPE);
    MPI_Comm_rank(MPI_COMM_WORLD, &MyPE);
#endif

    /// Parse inputs
    vector<string> Arguments(argc);
    for (int i = 0; i < argc; i++) Arguments[i] = static_cast<string>(argv[i]);
    if (ParseInputs(Arguments) == -1)
    {
        if (MyPE==0 && verbose>0) cout<<endl<<ProgSign+"Error in ParseInputs(). Exiting."<<endl;
        HelpMe();
#ifdef HAVE_MPI
        MPI_Finalize();
#endif
        return -1;
    }

    if (MyPE==0 && verbose>1) cout<<ProgSign+"started..."<<endl;

#ifdef HAVE_MPI
    // stop on error in domain decomposition if we run with MPI and number cores is > number of grid cells in X
    if (NPE > N[X]) {
        if (MyPE==0 && verbose>0) cout<<ProgSign+"Error in domain decomposition: NPE must be <= N[X]"<<endl;
        MPI_Finalize();
        return -1;
    }
#endif

    long starttime = time(NULL);
    cout<<setprecision(9);

    // create TurbGen class object
    TurbGen tg = TurbGen(MyPE);
    tg.set_verbose(verbose);

    // initialise generator to return a single turbulent realisation based on input parameters
    tg.init_single_realisation(ndim, L, k_min, k_mid, k_max, spect_form, power_law_exp, power_law_exp_2, angles_exp, sol_weight, random_seed);

    // get the number of vector field components
    int ncmp = tg.get_number_of_components();

    // set dimensionality dependencies
    if ((int)ndim < 3) { N[Z] = 1; L[Z] = 1.0; } // 2D
    if ((int)ndim < 2) { N[Y] = 1; L[Y] = 1.0; } // 1D

    // define cell size of uniform grid
    double del[3];
    for (int d = 0; d < 3; d++) del[d] = L[d] / N[d];

    // always generate within [0,L], cell-centered; user can shift output to target physical location, if needed
    double pos_beg[3] = {0.0, 0.0, 0.0}, pos_end[3] = {0.0, 0.0, 0.0}; // start and end coordinates of output grid
    // parallelise along X (generalises to non-MPI case, where NPE=1 and MyPE=0)
    int divN_PE = ceil((double)N[X]/(double)NPE);
    int NPE_main = N[X] / divN_PE;
    int modN_PE = N[X] - NPE_main * divN_PE;
    double divL_PE = L[X] * (double)divN_PE / (double)N[X];
    double modL_PE = L[X] * (double)modN_PE / (double)N[X];
    int NPE_in_use = NPE_main; if (modN_PE > 0) NPE_in_use += 1;
    int NX = 0; // number of cells in X for MyPE (idle PEs get nothing, i.e., NX=0)
    if (MyPE==0 && verbose>1)
        cout<<ProgSign+"NPE_main, divN_PE, modN_PE, divL_PE, modL_PE = "<<NPE_main<<" "<<divN_PE<<" "<<modN_PE<<" "<<divL_PE<<" "<<modL_PE<<endl;
    // set pos_beg and pos_end
    for (int d = 0; d < 3; d++) {
        if (d==X) { // parallelised direction - x
            if (MyPE < NPE_main) { // equally distribute to NPE_main cores
                pos_beg[d] = MyPE*divL_PE + del[d]/2.0; // first cell coordinate (cell center)
                pos_end[d] = (MyPE+1)*divL_PE - del[d]/2.0; // last cell coordinate (cell center)
                NX = divN_PE;
            } else if (MyPE < NPE_in_use) { // last PE gets the rest (idle PEs get nothing, i.e., NX=0)
                pos_beg[d] = NPE_main*divL_PE + del[d]/2.0; // first cell coordinate (cell center)
                pos_end[d] = L[X] - del[d]/2.0; // last cell coordinate (cell center)
                NX = modN_PE;
            }
            if (verbose>1)
                cout<<ProgSign+"MyPE, pos_beg[X], pos_beg[X], NX = "<<MyPE<<" "<<pos_beg[X]<<" "<<pos_end[X]<<" "<<NX<<endl;
        } else { // non-parallelised direction(s)
            pos_beg[d] = del[d]/2.0; // first cell coordinate (cell center)
            pos_end[d] = L[d] - del[d]/2.0; // last cell coordinate (cell center)
        }
    }

#ifdef HAVE_MPI
    if (MyPE==0 && verbose>0) {
        cout<<ProgSign+"First "<<NPE_main<<" core(s) carry(ies) NX="<<divN_PE<<" cell(s) (each)."<<endl;
        if (modN_PE > 0) cout<<ProgSign+"Core #"<<NPE_main+1<<" carries NX="<<modN_PE<<" cell(s)."<<endl;
        if (NPE_in_use < NPE) cout<<ProgSign+"Warning: non-optimal load balancing; "<<NPE-NPE_in_use<<" core(s) remain(s) idle."<<endl;
    }
#endif

    // total number of output grid cells
    int N_out[3] = {NX, N[Y], N[Z]};
    long ntot = 1; for (int d = 0; d < 3; d++) ntot *= N_out[d];
    // output grid, which receives the turbulent field (up to ndim = 3)
    float * grid_out[3];
    // allocate
    for (int d = 0; d < ncmp; d++) grid_out[d] = new float[ntot];

    // call to return uniform grid(s) with ncmp components of the turbulent field at requested positions
    tg.get_turb_vector_unigrid(pos_beg, pos_end, N_out, grid_out);

    // compute mean and std of generated turbulent field and then re-normalise to mean=0 and std=1
    double mean [3] = {0.0, 0.0, 0.0};
    double mean2[3] = {0.0, 0.0, 0.0};
    double std[3] = {0.0, 0.0, 0.0};
    for (int d = 0; d < ncmp; d++) {
        for (long ni = 0; ni < ntot; ni++) {
            mean [d] += grid_out[d][ni];
            mean2[d] += pow(grid_out[d][ni],2.0);
        }
    }
#ifdef HAVE_MPI
    MPI_Allreduce(MPI_IN_PLACE, mean , 3, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
    MPI_Allreduce(MPI_IN_PLACE, mean2, 3, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
#endif
    for (int d = 0; d < ncmp; d++) {
        mean [d] /= N[X]*N[Y]*N[Z]; // mean
        mean2[d] /= N[X]*N[Y]*N[Z]; // mean squared
        std[d] = sqrt(mean2[d] - mean[d]*mean[d]); // standard deviation
        for (long ni = 0; ni < ntot; ni++) {
            grid_out[d][ni] -= mean[d];
            grid_out[d][ni] /= std[d];
        }
    }

    // re-compute mean and std
    for (int d = 0; d < ncmp; d++) {
        mean[d] = 0.0; mean2[d] = 0.0;
        for (long ni = 0; ni < ntot; ni++) {
            mean [d] += grid_out[d][ni];
            mean2[d] += pow(grid_out[d][ni],2.0);
        }
    }
#ifdef HAVE_MPI
    MPI_Allreduce(MPI_IN_PLACE, mean , 3, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
    MPI_Allreduce(MPI_IN_PLACE, mean2, 3, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
#endif
    for (int d = 0; d < ncmp; d++) {
        mean [d] /= N[X]*N[Y]*N[Z]; // mean
        mean2[d] /= N[X]*N[Y]*N[Z]; // mean squared
        std[d] = sqrt(mean2[d] - mean[d]*mean[d]); // standard deviation
    }

    if (MyPE==0 && verbose>0) {
        cout<<ProgSign+"Generated "<<ndim<<"D turbulent field with"<<endl;
        cout<<ProgSign+" number of grid cells N ="; for (int d = 0; d < (int)ndim; d++) cout<<" "<<N[d]; cout<<endl;
        cout<<ProgSign+" physical size L ="; for (int d = 0; d < (int)ndim; d++) cout<<" "<<L[d]; cout<<endl;
        cout<<ProgSign+" mean (for each component) ="; for (int d = 0; d < ncmp; d++) cout<<" "<<mean[d]; cout<<endl;
        cout<<ProgSign+" 1D standard deviation (for each component) ="; for (int d = 0; d < ncmp; d++) cout<<" "<<std[d]; cout<<endl;
        string expected = "";
        if (ncmp==1) expected = "1";
        if (ncmp==2) expected = "sqrt(2)";
        if (ncmp==3) expected = "sqrt(3)";
        cout<<ProgSign+" total ("<<ndim<<"D) standard deviation (expected: "<<expected<<") = "<<sqrt(std[0]*std[0]+std[1]*std[1]+std[2]*std[2])<<endl;
    }

#ifdef HAVE_HDF5
    // write to HDF5 file
    if (MyPE==0 && verbose>0) {
        cout<<"-----------------------------------------------------"<<endl;
        cout<<ProgSign+"Creating '"<<outfilename<<"' for output..."<<endl;
    }
    HDFIO hdfio = HDFIO();
    hdfio.create(outfilename, MPI_COMM);
    // write scalars
    vector<int> hdf5dims(0);
    hdfio.write(&ndim, "ndim", hdf5dims, H5T_NATIVE_DOUBLE, MPI_COMM);
    hdfio.write(&ncmp, "ncmp", hdf5dims, H5T_NATIVE_INT, MPI_COMM);
    hdfio.write(&k_min, "kmin", hdf5dims, H5T_NATIVE_DOUBLE, MPI_COMM);
    hdfio.write(&k_mid, "kmid", hdf5dims, H5T_NATIVE_DOUBLE, MPI_COMM);
    hdfio.write(&k_max, "kmax", hdf5dims, H5T_NATIVE_DOUBLE, MPI_COMM);
    hdfio.write(&spect_form, "spect_form", hdf5dims, H5T_NATIVE_INT, MPI_COMM);
    if (spect_form == 2) {
        hdfio.write(&power_law_exp,   "power_law_exp",   hdf5dims, H5T_NATIVE_DOUBLE, MPI_COMM);
        hdfio.write(&power_law_exp_2, "power_law_exp_2", hdf5dims, H5T_NATIVE_DOUBLE, MPI_COMM);
        hdfio.write(&angles_exp, "angles_exp", hdf5dims, H5T_NATIVE_DOUBLE, MPI_COMM);
    }
    hdfio.write(&sol_weight, "sol_weight", hdf5dims, H5T_NATIVE_DOUBLE, MPI_COMM);
    hdfio.write(&random_seed, "random_seed", hdf5dims, H5T_NATIVE_INT, MPI_COMM);
    // write N and L vectors
    hdf5dims.resize(1); hdf5dims[0] = (int)ndim;
    int No[(int)ndim]; double Lo[(int)ndim]; // order Z,Y,X
     for (int d = 0; d < (int)ndim; d++) {
        No[(int)ndim-1-d] = N[d];
        Lo[(int)ndim-1-d] = L[d];
    }
    hdfio.write(No, "N", hdf5dims, H5T_NATIVE_INT, MPI_COMM);
    hdfio.write(Lo, "L", hdf5dims, H5T_NATIVE_DOUBLE, MPI_COMM);
    // write turbulent field (components)
    hdf5dims.resize((int)ndim); for (int d = 0; d < (int)ndim; d++) hdf5dims[(int)ndim-1-d] = N[d]; // order Z,Y,X
    if (MyPE==0 && verbose>1) { cout<<ProgSign+"hdf5dims ="; for (int d = 0; d < (int)ndim; d++) cout<<" "<<hdf5dims[d]; cout<<endl; }
    for (int dc = 0; dc < ncmp; dc++) { // loop over component(s)
        string dsetname = "turb_field";
        if (dc == 0) dsetname += "_x";
        if (dc == 1) dsetname += "_y";
        if (dc == 2) dsetname += "_z";
        hdfio.create_dataset(dsetname, hdf5dims, H5T_NATIVE_FLOAT, MPI_COMM); // create HDF5 dataset
        // specify dimensions and offset for slab operation
        hsize_t offset[(int)ndim], count[(int)ndim], out_offset[(int)ndim], out_count[(int)ndim];
        for (int d = 0; d < (int)ndim; d++) {
            int dd = (int)ndim-1-d; // order Z,Y,X
            // collective HDF5 IO only works if inactive cores participate, but with counts=0 and offsets=0
            offset[dd] = 0; count[dd] = 0; out_offset[dd] = 0; out_count[dd] = 0;
            if (MyPE < NPE_in_use) {
                if (d==0) offset[dd] = MyPE*divN_PE;
                count[dd] = N_out[d];
                out_offset[dd] = 0;
                out_count[dd] = N_out[d];
            }
        }
        if (verbose>1) {
            for (int d = 0; d < (int)ndim; d++)
                cout<<"MyPE, d, offset, count, out_offset, out_count = "<<
                        MyPE<<" "<<d<<" "<<offset[d]<<" "<<count[d]<<" "<<out_offset[d]<<" "<<out_count[d]<<endl;
        }
        // write slab to file (in parallel, if we have MPI)
        hdfio.overwrite_slab(grid_out[dc], dsetname, H5T_NATIVE_FLOAT, offset, count, (int)ndim, out_offset, out_count, MPI_COMM);
        if (MyPE==0 && verbose>0) cout<<ProgSign+"Dataset '"<<dsetname<<"' in '"<<outfilename<<"' written."<<endl;
    }
    // output generating modes and their amplitudes
    if (write_modes) {
        // modes
        vector< vector<double> > modes = tg.get_modes();
        int nmodes = modes[0].size(); // all dims have the same number of modes
        hdf5dims.resize(2); hdf5dims[0] = (int)ndim; hdf5dims[1] = nmodes;
        double * ptmp = new double[((int)ndim)*nmodes];
        for (int d = 0; d < (int)ndim; d++)
            for (int m = 0; m < nmodes; m++)
                ptmp[d*nmodes+m] = modes[d][m];
        hdfio.write(ptmp, "Fourier_modes", hdf5dims, H5T_NATIVE_DOUBLE, MPI_COMM);
        delete [] ptmp;
        // amplitudes
        vector<double> amplitudes = tg.get_amplitudes();
        ptmp = new double[amplitudes.size()];
        for (int i = 0; i < amplitudes.size(); i++) ptmp[i] = amplitudes[i];
        hdf5dims.resize(1); hdf5dims[0] = amplitudes.size();
        hdfio.write(ptmp, "Fourier_amplitudes", hdf5dims, H5T_NATIVE_DOUBLE, MPI_COMM);
        delete [] ptmp;
    }
    hdfio.close();
    if (MyPE==0 && verbose>0) cout<<ProgSign+"Finished writing '"<<outfilename<<"'."<<endl;
#endif

    // clean up
    for (int d = 0; d < ncmp; d++) {
      if (grid_out[d]) delete [] grid_out[d]; grid_out[d] = NULL;
    }

    /// print out wallclock time used
    long endtime = time(NULL);
    long duration = endtime-starttime;
    if (verbose>1) cout<<ProgSign+"["<<MyPE<<"] Local runtime: "<<duration<<"s"<<endl;
#ifdef HAVE_MPI
    MPI_Allreduce(MPI_IN_PLACE, &duration, 1, MPI_LONG, MPI_MAX, MPI_COMM_WORLD);
#endif
    if (MyPE==0 && verbose>0) {
        cout<<"-----------------------------------------------------"<<endl;
        cout<<ProgSign+"Total runtime: "<<duration<<"s"<<endl;
    }

#ifdef HAVE_MPI
    MPI_Finalize();
#endif
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x3e8, %rsp            # imm = 0x3E8
movq %rsi, %rbx
movl %edi, %ebp
movslq %edi, %r14
leaq 0x160(%rsp), %rdi
leaq 0x1b0(%rsp), %rdx
movq %r14, %rsi
callq 0x4d12
testl %r14d, %r14d
jle 0x2679
leaq 0x1c0(%rsp), %r12
movl %ebp, %r13d
shlq $0x5, %r13
xorl %ebp, %ebp
leaq 0x1b0(%rsp), %r14
movq %rsp, %r15
movq (%rbx), %rsi
movq %r14, %rdi
movq %r15, %rdx
callq 0x4cd4
movq 0x160(%rsp), %rdi
addq %rbp, %rdi
movq %r14, %rsi
callq 0x2260
movq 0x1b0(%rsp), %rdi
cmpq %r12, %rdi
je 0x266c
movq 0x1c0(%rsp), %rsi
incq %rsi
callq 0x2230
addq $0x8, %rbx
addq $0x20, %rbp
cmpq %rbp, %r13
jne 0x262e
leaq 0x178(%rsp), %rdi
leaq 0x160(%rsp), %rsi
callq 0x4d9c
leaq 0x178(%rsp), %rdi
callq 0x3a7a
movl %eax, %ebx
leaq 0x178(%rsp), %rdi
callq 0x4e26
movl 0xbc14(%rip), %ecx      # 0xe2c4
movl 0xbb2a(%rip), %eax      # 0xe1e0
cmpl $-0x1, %ebx
je 0x356d
testl %ecx, %ecx
sete %cl
cmpl $0x2, %eax
setge %al
andb %cl, %al
cmpb $0x1, %al
jne 0x2775
leaq 0x1c0(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0xbb99(%rip), %rsi      # 0xe280
movq 0xbb9a(%rip), %rdx      # 0xe288
addq %rsi, %rdx
leaq 0x1b0(%rsp), %rdi
callq 0x909e
leaq 0x79fc(%rip), %rsi      # 0xa101
leaq 0x1b0(%rsp), %rdi
callq 0x2380
movq 0x1b0(%rsp), %rsi
movq 0x1b8(%rsp), %rdx
movq 0xb8af(%rip), %rdi      # 0xdfd8
callq 0x2240
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2210
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2150
movq 0x1b0(%rsp), %rdi
cmpq %r14, %rdi
je 0x2775
movq 0x1c0(%rsp), %rsi
incq %rsi
callq 0x2230
xorl %edi, %edi
callq 0x21e0
movq %rax, %r12
movq 0xb852(%rip), %rax      # 0xdfd8
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movq $0x9, 0x8(%rax,%rcx)
movl 0xbb28(%rip), %esi      # 0xe2c4
leaq 0x1b0(%rsp), %rdi
callq 0x4ed8
movl 0xba31(%rip), %eax      # 0xe1e0
leaq 0x1b0(%rsp), %rdi
movl %eax, (%rdi)
movsd 0xba27(%rip), %xmm0     # 0xe1e8
movsd 0xba4f(%rip), %xmm1     # 0xe218
movsd 0xba57(%rip), %xmm2     # 0xe228
movsd 0xba47(%rip), %xmm3     # 0xe220
movl 0xba51(%rip), %edx      # 0xe230
movsd 0xba51(%rip), %xmm4     # 0xe238
movsd 0xba51(%rip), %xmm5     # 0xe240
movsd 0xba51(%rip), %xmm6     # 0xe248
movsd 0xba51(%rip), %xmm7     # 0xe250
movl 0xba53(%rip), %ecx      # 0xe258
leaq 0xb9f4(%rip), %rbx      # 0xe200
movq %rbx, %rsi
callq 0x50aa
cvttsd2si 0xb9cc(%rip), %ecx # 0xe1e8
movl 0x310(%rsp), %eax
movq %rax, 0x20(%rsp)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
cmpl $0x2, %ecx
jg 0x2848
movl $0x1, 0xb9b7(%rip)      # 0xe1f8
movq %rax, 0xb9c8(%rip)      # 0xe210
cmpl $0x1, %ecx
jg 0x285e
movl $0x1, 0xb99d(%rip)      # 0xe1f4
movq %rax, 0xb9aa(%rip)      # 0xe208
xorl %eax, %eax
leaq 0xb989(%rip), %r13      # 0xe1f0
movsd (%rbx), %xmm0
xorps %xmm1, %xmm1
cvtsi2sdl (%rax,%r13), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x190(%rsp,%rax,2)
addq $0x4, %rax
addq $0x8, %rbx
cmpq $0xc, %rax
jne 0x2867
xorpd %xmm0, %xmm0
movapd %xmm0, 0x110(%rsp)
xorl %r14d, %r14d
movq %r14, 0x120(%rsp)
movq %r14, 0x100(%rsp)
movapd %xmm0, 0xf0(%rsp)
movl 0xb932(%rip), %ebx      # 0xe1f0
xorps %xmm0, %xmm0
cvtsi2sd %ebx, %xmm0
movsd %xmm0, 0x38(%rsp)
xorps %xmm1, %xmm1
cvtsi2sdl 0xb986(%rip), %xmm1 # 0xe25c
divsd %xmm1, %xmm0
callq 0x2050
cvttsd2si %xmm0, %ecx
movl %ebx, %eax
cltd
movl %ecx, %r15d
idivl %ecx
cvttpd2dq %xmm0, %xmm0
movsd 0xb909(%rip), %xmm1     # 0xe200
cvtdq2pd %xmm0, %xmm0
movsd %xmm1, 0x30(%rsp)
mulsd %xmm1, %xmm0
divsd 0x38(%rsp), %xmm0
movapd %xmm0, 0x130(%rsp)
movl %edx, 0x28(%rsp)
testl %edx, %edx
setg %bpl
cmpl $0x0, 0xb99f(%rip)      # 0xe2c4
movl %eax, 0x2c(%rsp)
jne 0x2a79
cmpl $0x1, 0xb8aa(%rip)      # 0xe1e0
jle 0x2a79
leaq 0x10(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0xb934(%rip), %rsi      # 0xe280
movq 0xb935(%rip), %rdx      # 0xe288
addq %rsi, %rdx
movq %rsp, %rdi
callq 0x909e
leaq 0x77a7(%rip), %rsi      # 0xa10c
movq %rsp, %rdi
callq 0x2380
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq 0xb65b(%rip), %rdi      # 0xdfd8
callq 0x2240
movq %rax, %rdi
movl 0x2c(%rsp), %esi
callq 0x2320
movq %rax, %rbx
leaq 0x789d(%rip), %rsi      # 0xa235
movl $0x1, %edx
movq %rax, %rdi
callq 0x2240
movq %rbx, %rdi
movl %r15d, %esi
callq 0x2320
movq %rax, %rbx
leaq 0x787b(%rip), %rsi      # 0xa235
movl $0x1, %edx
movq %rax, %rdi
callq 0x2240
movq %rbx, %rdi
movl 0x28(%rsp), %esi
callq 0x2320
movq %rax, %rbx
leaq 0x7858(%rip), %rsi      # 0xa235
movl $0x1, %edx
movq %rax, %rdi
callq 0x2240
movq %rbx, %rdi
movapd 0x130(%rsp), %xmm0
callq 0x22e0
movq %rax, %rbx
leaq 0x7830(%rip), %rsi      # 0xa235
movl $0x1, %edx
movq %rax, %rdi
callq 0x2240
cvtsi2sdl 0x28(%rsp), %xmm1
movsd 0x30(%rsp), %xmm0
mulsd %xmm1, %xmm0
divsd 0x38(%rsp), %xmm0
movq %rbx, %rdi
callq 0x22e0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2210
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2150
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x2a75
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2230
movl 0x2c(%rsp), %eax
movq %r13, 0x38(%rsp)
movq %r12, 0x148(%rsp)
xorl %ecx, %ecx
movb %bpl, %cl
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
addl %eax, %ecx
movl %ecx, 0x5c(%rsp)
movsd 0x190(%rsp), %xmm1
movsd 0x755f(%rip), %xmm2     # 0xa008
mulsd %xmm1, %xmm2
mulsd 0x130(%rsp), %xmm0
movsd %xmm2, 0x30(%rsp)
addsd %xmm2, %xmm0
movsd %xmm0, 0x150(%rsp)
mulsd 0x753f(%rip), %xmm1     # 0xa010
movsd %xmm1, 0x158(%rsp)
movq %rsp, %rbp
leaq 0xb71c(%rip), %r12      # 0xe200
xorl %ebx, %ebx
movl %r15d, %r13d
testq %rbx, %rbx
je 0x2b20
movsd 0x190(%rsp,%rbx), %xmm0
mulsd 0x7509(%rip), %xmm0     # 0xa008
movsd %xmm0, 0x110(%rsp,%rbx)
movsd (%rbx,%r12), %xmm1
subsd %xmm0, %xmm1
movsd %xmm1, 0xf0(%rsp,%rbx)
jmp 0x2cc9
movl 0xb79e(%rip), %ecx      # 0xe2c4
cmpl %eax, %ecx
jge 0x2b71
xorps %xmm0, %xmm0
cvtsi2sd %ecx, %xmm0
movapd 0x130(%rsp), %xmm1
mulsd %xmm1, %xmm0
addsd 0x30(%rsp), %xmm0
movsd %xmm0, 0x110(%rsp)
incl %ecx
xorps %xmm0, %xmm0
cvtsi2sd %ecx, %xmm0
mulsd %xmm1, %xmm0
addsd 0x158(%rsp), %xmm0
movsd %xmm0, 0xf0(%rsp)
movl %r13d, %r14d
jmp 0x2ba7
cmpl 0x5c(%rsp), %ecx
jge 0x2ba7
movsd 0x150(%rsp), %xmm0
movsd %xmm0, 0x110(%rsp)
movsd 0xb66f(%rip), %xmm0     # 0xe200
subsd 0x30(%rsp), %xmm0
movsd %xmm0, 0xf0(%rsp)
movl 0x28(%rsp), %ecx
movl %ecx, %r14d
cmpl $0x2, 0xb632(%rip)      # 0xe1e0
jl 0x2cc9
leaq 0x10(%rsp), %rax
movq %rax, (%rsp)
movq 0xb6bc(%rip), %rsi      # 0xe280
movq 0xb6bd(%rip), %rdx      # 0xe288
addq %rsi, %rdx
movq %rbp, %r15
movq %rbp, %rdi
callq 0x909e
movq %r15, %rbp
movq %r15, %rdi
leaq 0x7556(%rip), %rsi      # 0xa13c
callq 0x2380
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq 0xb3dd(%rip), %rdi      # 0xdfd8
callq 0x2240
movl 0xb6be(%rip), %esi      # 0xe2c4
movq %rax, %rdi
callq 0x2320
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
leaq 0x7615(%rip), %rsi      # 0xa235
callq 0x2240
movsd 0x110(%rsp), %xmm0
movq %r15, %rdi
callq 0x22e0
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
leaq 0x75ed(%rip), %rsi      # 0xa235
callq 0x2240
movsd 0xf0(%rsp), %xmm0
movq %r15, %rdi
callq 0x22e0
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
leaq 0x75c5(%rip), %rsi      # 0xa235
callq 0x2240
movq %r15, %rdi
movl %r14d, %esi
callq 0x2320
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2210
movsbl %al, %esi
movq %r15, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2150
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x2cc5
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2230
movl 0x2c(%rsp), %eax
addq $0x8, %rbx
cmpq $0x18, %rbx
jne 0x2ae9
movl %r14d, 0xc4(%rsp)
movq 0xb50e(%rip), %rax      # 0xe1f4
movq %rax, 0xc8(%rsp)
movl $0x1, %r14d
xorl %eax, %eax
movq %r14, %r15
movslq 0xc4(%rsp,%rax,4), %rbp
imulq %rbp, %r14
incq %rax
cmpq $0x3, %rax
jne 0x2cf6
cmpl $0x0, 0x20(%rsp)
jle 0x2d4f
movq %r14, %rax
shrq $0x3e, %rax
leaq (,%r14,4), %rcx
xorl %r13d, %r13d
negq %rax
movl $0x0, %ebx
sbbq %rbx, %rbx
orq %rcx, %rbx
movq %rbx, %rdi
callq 0x2030
movq %rax, 0xd0(%rsp,%r13,8)
incq %r13
cmpq %r13, 0x20(%rsp)
jne 0x2d35
leaq 0x1b0(%rsp), %rdi
leaq 0x110(%rsp), %rsi
leaq 0xf0(%rsp), %rdx
leaq 0xc4(%rsp), %rcx
leaq 0xd0(%rsp), %r8
callq 0x570a
xorpd %xmm0, %xmm0
movapd %xmm0, 0x40(%rsp)
xorl %eax, %eax
movq %rax, 0x50(%rsp)
movq %rax, 0x70(%rsp)
movapd %xmm0, 0x60(%rsp)
movq %rax, 0xb0(%rsp)
movapd %xmm0, 0xa0(%rsp)
cmpl $0x0, 0x20(%rsp)
jle 0x2e06
movq %r15, %rax
imulq %rbp, %rax
xorl %ecx, %ecx
testq %r14, %r14
jle 0x2dfc
movq 0xd0(%rsp,%rcx,8), %rdx
movsd 0x40(%rsp,%rcx,8), %xmm1
movsd 0x60(%rsp,%rcx,8), %xmm0
xorl %esi, %esi
xorps %xmm2, %xmm2
cvtss2sd (%rdx,%rsi,4), %xmm2
addsd %xmm2, %xmm1
mulsd %xmm2, %xmm2
addsd %xmm2, %xmm0
incq %rsi
cmpq %rsi, %rax
jne 0x2dd4
movsd %xmm1, 0x40(%rsp,%rcx,8)
movsd %xmm0, 0x60(%rsp,%rcx,8)
incq %rcx
cmpq 0x20(%rsp), %rcx
jne 0x2db9
cmpl $0x0, 0x20(%rsp)
jle 0x2edb
movq %r15, %rbx
imulq %rbp, %rbx
xorl %r13d, %r13d
xorpd %xmm2, %xmm2
movl 0xb3cf(%rip), %eax      # 0xe1f4
imull 0xb3c4(%rip), %eax      # 0xe1f0
imull 0xb3c5(%rip), %eax      # 0xe1f8
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
movsd 0x40(%rsp,%r13,8), %xmm3
divsd %xmm1, %xmm3
movsd %xmm3, 0x40(%rsp,%r13,8)
movsd 0x60(%rsp,%r13,8), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, 0x60(%rsp,%r13,8)
movapd %xmm3, %xmm1
mulsd %xmm3, %xmm1
subsd %xmm1, %xmm0
ucomisd %xmm2, %xmm0
jb 0x2e76
sqrtsd %xmm0, %xmm0
jmp 0x2e8b
movsd %xmm3, 0x30(%rsp)
callq 0x21a0
movsd 0x30(%rsp), %xmm3
xorpd %xmm2, %xmm2
movsd %xmm0, 0xa0(%rsp,%r13,8)
testq %r14, %r14
jle 0x2ecd
movq 0xd0(%rsp,%r13,8), %rax
xorl %ecx, %ecx
xorps %xmm1, %xmm1
cvtss2sd (%rax,%rcx,4), %xmm1
subsd %xmm3, %xmm1
cvtsd2ss %xmm1, %xmm1
cvtss2sd %xmm1, %xmm1
divsd %xmm0, %xmm1
cvtsd2ss %xmm1, %xmm1
movss %xmm1, (%rax,%rcx,4)
incq %rcx
cmpq %rcx, %rbx
jne 0x2ea4
incq %r13
cmpq 0x20(%rsp), %r13
jne 0x2e1f
cmpl $0x0, 0x20(%rsp)
jle 0x2f41
imulq %rbp, %r15
xorl %eax, %eax
xorl %ecx, %ecx
movq %rax, 0x40(%rsp,%rcx,8)
movq %rax, 0x60(%rsp,%rcx,8)
testq %r14, %r14
jle 0x2f37
movq 0xd0(%rsp,%rcx,8), %rdx
movsd 0x40(%rsp,%rcx,8), %xmm1
movsd 0x60(%rsp,%rcx,8), %xmm0
xorl %esi, %esi
xorps %xmm2, %xmm2
cvtss2sd (%rdx,%rsi,4), %xmm2
addsd %xmm2, %xmm1
mulsd %xmm2, %xmm2
addsd %xmm2, %xmm0
incq %rsi
cmpq %rsi, %r15
jne 0x2f0f
movsd %xmm1, 0x40(%rsp,%rcx,8)
movsd %xmm0, 0x60(%rsp,%rcx,8)
incq %rcx
cmpq 0x20(%rsp), %rcx
jne 0x2eea
cmpl $0x0, 0x20(%rsp)
jle 0x2fb9
xorl %ebx, %ebx
xorpd %xmm3, %xmm3
movl 0xb2a0(%rip), %eax      # 0xe1f4
imull 0xb295(%rip), %eax      # 0xe1f0
imull 0xb296(%rip), %eax      # 0xe1f8
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
movsd 0x40(%rsp,%rbx,8), %xmm2
divsd %xmm1, %xmm2
movsd %xmm2, 0x40(%rsp,%rbx,8)
movsd 0x60(%rsp,%rbx,8), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, 0x60(%rsp,%rbx,8)
mulsd %xmm2, %xmm2
subsd %xmm2, %xmm0
ucomisd %xmm3, %xmm0
jb 0x2f9d
sqrtsd %xmm0, %xmm0
jmp 0x2fa6
callq 0x21a0
xorpd %xmm3, %xmm3
movsd %xmm0, 0xa0(%rsp,%rbx,8)
incq %rbx
cmpq %rbx, 0x20(%rsp)
jne 0x2f4e
cmpl $0x0, 0xb304(%rip)      # 0xe2c4
jne 0x36ce
cmpl $0x0, 0xb213(%rip)      # 0xe1e0
jle 0x36ce
movq %rsp, %rdi
leaq 0x10(%rsp), %rax
movq %rax, (%rdi)
movq 0xb29b(%rip), %rsi      # 0xe280
movq 0xb29c(%rip), %rdx      # 0xe288
addq %rsi, %rdx
callq 0x909e
leaq 0x7165(%rip), %rsi      # 0xa160
movq %rsp, %rdi
callq 0x2380
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq 0xafc5(%rip), %rdi      # 0xdfd8
callq 0x2240
movsd 0xb1c8(%rip), %xmm0     # 0xe1e8
movq %rax, %rdi
callq 0x22e0
movq %rax, %rbx
leaq 0x7139(%rip), %rsi      # 0xa16b
movl $0x16, %edx
movq %rax, %rdi
callq 0x2240
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2210
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2150
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x3081
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2230
movq %rsp, %rdi
leaq 0x10(%rsp), %rax
movq %rax, (%rdi)
movq 0xb1ed(%rip), %rsi      # 0xe280
movq 0xb1ee(%rip), %rdx      # 0xe288
addq %rsi, %rdx
callq 0x909e
leaq 0x70d9(%rip), %rsi      # 0xa182
movq %rsp, %rdi
callq 0x2380
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq 0xaf17(%rip), %rbx      # 0xdfd8
movq %rbx, %rdi
callq 0x2240
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x30e4
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2230
cvttsd2si 0xb0fc(%rip), %eax # 0xe1e8
testl %eax, %eax
jle 0x313c
xorl %r13d, %r13d
movq 0xaede(%rip), %r14      # 0xdfd8
leaq 0x7134(%rip), %r15      # 0xa235
movl $0x1, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2240
movq 0x38(%rsp), %rbp
movl (%rbp), %esi
movq %r14, %rdi
callq 0x2320
cvttsd2si 0xb0bf(%rip), %eax # 0xe1e8
incq %r13
cltq
addq $0x4, %rbp
movq %rbp, 0x38(%rsp)
cmpq %rax, %r13
jl 0x3101
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2210
movsbl %al, %esi
movq 0xae7e(%rip), %rdi      # 0xdfd8
callq 0x2040
movq %rax, %rdi
callq 0x2150
movq %rsp, %rdi
leaq 0x10(%rsp), %rax
movq %rax, (%rdi)
movq 0xb107(%rip), %rsi      # 0xe280
movq 0xb108(%rip), %rdx      # 0xe288
addq %rsi, %rdx
callq 0x909e
leaq 0x700d(%rip), %rsi      # 0xa19c
movq %rsp, %rdi
callq 0x2380
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq 0xae31(%rip), %rbx      # 0xdfd8
movq %rbx, %rdi
callq 0x2240
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x31ca
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2230
cvttsd2si 0xb016(%rip), %eax # 0xe1e8
testl %eax, %eax
jle 0x321b
xorl %r13d, %r13d
movq 0xadf8(%rip), %r14      # 0xdfd8
leaq 0x704e(%rip), %r15      # 0xa235
movl $0x1, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2240
movsd (%r12), %xmm0
movq %r14, %rdi
callq 0x22e0
cvttsd2si 0xafdb(%rip), %eax # 0xe1e8
incq %r13
cltq
addq $0x8, %r12
cmpq %rax, %r13
jl 0x31e7
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2210
movsbl %al, %esi
movq 0xad9f(%rip), %rdi      # 0xdfd8
callq 0x2040
movq %rax, %rdi
callq 0x2150
movq %rsp, %rdi
leaq 0x10(%rsp), %rax
movq %rax, (%rdi)
movq 0xb028(%rip), %rsi      # 0xe280
movq 0xb029(%rip), %rdx      # 0xe288
addq %rsi, %rdx
callq 0x909e
leaq 0x6f41(%rip), %rsi      # 0xa1af
movq %rsp, %rdi
callq 0x2380
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq 0xad52(%rip), %rbx      # 0xdfd8
movq %rbx, %rdi
callq 0x2240
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x32a9
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2230
cmpl $0x0, 0x20(%rsp)
jle 0x32ea
xorl %r12d, %r12d
movq 0xad1e(%rip), %r14      # 0xdfd8
leaq 0x6f74(%rip), %r15      # 0xa235
movl $0x1, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2240
movsd 0x40(%rsp,%r12,8), %xmm0
movq %r14, %rdi
callq 0x22e0
incq %r12
cmpq %r12, 0x20(%rsp)
jne 0x32c1
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2210
movsbl %al, %esi
movq 0xacd0(%rip), %rdi      # 0xdfd8
callq 0x2040
movq %rax, %rdi
callq 0x2150
movq %rsp, %rdi
leaq 0x10(%rsp), %rax
movq %rax, (%rdi)
movq 0xaf59(%rip), %rsi      # 0xe280
movq 0xaf5a(%rip), %rdx      # 0xe288
addq %rsi, %rdx
callq 0x909e
leaq 0x6e8f(%rip), %rsi      # 0xa1cc
movq %rsp, %rdi
callq 0x2380
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq 0xac83(%rip), %rbx      # 0xdfd8
movq %rbx, %rdi
callq 0x2240
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x3378
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2230
cmpl $0x0, 0x20(%rsp)
jle 0x33bc
xorl %r12d, %r12d
movq 0xac4f(%rip), %r14      # 0xdfd8
leaq 0x6ea5(%rip), %r15      # 0xa235
movl $0x1, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2240
movsd 0xa0(%rsp,%r12,8), %xmm0
movq %r14, %rdi
callq 0x22e0
incq %r12
cmpq %r12, 0x20(%rsp)
jne 0x3390
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2210
movsbl %al, %esi
movq 0xabfe(%rip), %rdi      # 0xdfd8
callq 0x2040
movq %rax, %rdi
callq 0x2150
movq %rsp, %rdi
leaq 0x10(%rsp), %rax
movq %rax, (%rdi)
leaq 0x7ba1(%rip), %rdx      # 0xaf9a
movq %rdx, %rsi
callq 0x98be
cmpq $0x3, 0x20(%rsp)
je 0x3463
cmpl $0x2, 0x20(%rsp)
je 0x3441
cmpl $0x1, 0x20(%rsp)
jne 0x347e
movq %rsp, %rdi
movq 0x8(%rdi), %rdx
leaq 0x6dd5(%rip), %rcx      # 0xa1fa
movl $0x1, %r8d
xorl %esi, %esi
callq 0x22d0
cmpq $0x3, 0x20(%rsp)
je 0x3463
cmpl $0x2, 0x20(%rsp)
jne 0x347e
movq %rsp, %rdi
movq 0x8(%rdi), %rdx
leaq 0x6dad(%rip), %rcx      # 0xa1fc
movl $0x7, %r8d
xorl %esi, %esi
callq 0x22d0
cmpl $0x3, 0x20(%rsp)
jne 0x347e
movq %rsp, %rdi
movq 0x8(%rdi), %rdx
leaq 0x6d93(%rip), %rcx      # 0xa204
movl $0x7, %r8d
xorl %esi, %esi
callq 0x22d0
leaq 0x90(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0xadef(%rip), %rsi      # 0xe280
movq 0xadf0(%rip), %rdx      # 0xe288
addq %rsi, %rdx
leaq 0x80(%rsp), %rdi
callq 0x909e
leaq 0x6d5d(%rip), %rsi      # 0xa20c
leaq 0x80(%rsp), %rdi
callq 0x2380
movq 0x80(%rsp), %rsi
movq 0x88(%rsp), %rdx
movq 0xab05(%rip), %rdi      # 0xdfd8
callq 0x2240
movsd 0xad08(%rip), %xmm0     # 0xe1e8
movq %rax, %rdi
callq 0x22e0
movq %rax, %rbx
leaq 0x6d23(%rip), %rsi      # 0xa215
movl $0x21, %edx
movq %rax, %rdi
callq 0x2240
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %rbx, %rdi
callq 0x2240
movq %rax, %rbx
leaq 0x6d1d(%rip), %rsi      # 0xa237
movl $0x4, %edx
movq %rax, %rdi
callq 0x2240
movsd 0xa0(%rsp), %xmm1
movsd 0xa8(%rsp), %xmm0
mulsd %xmm0, %xmm0
mulsd %xmm1, %xmm1
addsd %xmm0, %xmm1
movsd 0xb0(%rsp), %xmm0
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x365f
sqrtsd %xmm0, %xmm0
jmp 0x3664
testl %ecx, %ecx
sete %cl
testl %eax, %eax
setg %al
andb %cl, %al
cmpb $0x1, %al
jne 0x3650
movq 0xaa50(%rip), %rdi      # 0xdfd8
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x2210
movsbl %al, %esi
movq 0xaa35(%rip), %rdi      # 0xdfd8
callq 0x2040
movq %rax, %rdi
callq 0x2150
movq %rax, %rbx
leaq 0x1c0(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0xacba(%rip), %rsi      # 0xe280
movq 0xacbb(%rip), %rdx      # 0xe288
addq %rsi, %rdx
leaq 0x1b0(%rsp), %rdi
callq 0x909e
leaq 0x6afc(%rip), %rsi      # 0xa0e0
leaq 0x1b0(%rsp), %rdi
callq 0x2380
movq 0x1b0(%rsp), %rsi
movq 0x1b8(%rsp), %rdx
movq %rbx, %rdi
callq 0x2240
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2210
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2150
movq 0x1b0(%rsp), %rdi
cmpq %r14, %rdi
je 0x3650
movq 0x1c0(%rsp), %rsi
incq %rsi
callq 0x2230
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
callq 0x464e
jmp 0x3907
callq 0x21a0
movq %rbx, %rdi
callq 0x22e0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2210
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2150
movq 0x80(%rsp), %rdi
cmpq %r14, %rdi
je 0x36b3
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x2230
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x36ce
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2230
cmpl $0x0, 0x20(%rsp)
movq 0x148(%rsp), %r15
jle 0x3707
xorl %ebx, %ebx
movq 0xd0(%rsp,%rbx,8), %rdi
testq %rdi, %rdi
je 0x36f1
callq 0x2280
movq $0x0, 0xd0(%rsp,%rbx,8)
incq %rbx
cmpq %rbx, 0x20(%rsp)
jne 0x36df
xorl %edi, %edi
callq 0x21e0
movq %rax, %r14
subq %r15, %r14
cmpl $0x1, 0xaac5(%rip)      # 0xe1e0
jle 0x37ef
movq %rsp, %rdi
leaq 0x10(%rsp), %rax
movq %rax, (%rdi)
movq 0xab4d(%rip), %rsi      # 0xe280
movq 0xab4e(%rip), %rdx      # 0xe288
addq %rsi, %rdx
callq 0x909e
leaq 0x6af3(%rip), %rsi      # 0xa23c
movq %rsp, %rdi
callq 0x2380
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq 0xa877(%rip), %rdi      # 0xdfd8
callq 0x2240
movl 0xab58(%rip), %esi      # 0xe2c4
movq %rax, %rdi
callq 0x2320
movq %rax, %rbx
leaq 0x6ac0(%rip), %rsi      # 0xa23e
movl $0x11, %edx
movq %rax, %rdi
callq 0x2240
movq %rbx, %rdi
movq %r14, %rsi
callq 0x21f0
movq %rax, %rbx
leaq 0x74a9(%rip), %rsi      # 0xac49
movl $0x1, %edx
movq %rax, %rdi
callq 0x2240
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2210
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2150
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x37ef
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2230
cmpl $0x0, 0xaace(%rip)      # 0xe2c4
jne 0x38f8
cmpl $0x0, 0xa9dd(%rip)      # 0xe1e0
jle 0x38f8
movq 0xa7c8(%rip), %rbx      # 0xdfd8
leaq 0x6a39(%rip), %rsi      # 0xa250
movl $0x35, %edx
movq %rbx, %rdi
callq 0x2240
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2210
movsbl %al, %esi
movq 0xa796(%rip), %rdi      # 0xdfd8
callq 0x2040
movq %rax, %rdi
callq 0x2150
movq %rsp, %rdi
leaq 0x10(%rsp), %rax
movq %rax, (%rdi)
movq 0xaa1f(%rip), %rsi      # 0xe280
movq 0xaa20(%rip), %rdx      # 0xe288
addq %rsi, %rdx
callq 0x909e
leaq 0x6a0f(%rip), %rsi      # 0xa286
movq %rsp, %rdi
callq 0x2380
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq 0xa749(%rip), %rdi      # 0xdfd8
callq 0x2240
movq %rax, %rdi
movq %r14, %rsi
callq 0x21f0
movq %rax, %rbx
leaq 0x73a0(%rip), %rsi      # 0xac49
movl $0x1, %edx
movq %rax, %rdi
callq 0x2240
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2210
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2150
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x38f8
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2230
leaq 0x1b0(%rsp), %rdi
callq 0x65e2
xorl %ebx, %ebx
leaq 0x160(%rsp), %rdi
callq 0x4e26
movl %ebx, %eax
addq $0x3e8, %rsp            # imm = 0x3E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x39d0
jmp 0x3a35
jmp 0x39fe
jmp 0x3a3a
jmp 0x3a30
jmp 0x3a3a
jmp 0x3a3a
jmp 0x3a30
jmp 0x3a3a
jmp 0x3a30
jmp 0x3a3a
jmp 0x3a30
jmp 0x3a3a
jmp 0x3a3a
jmp 0x3a30
jmp 0x3a3a
jmp 0x3a3a
jmp 0x3a30
jmp 0x3a3a
jmp 0x3a3a
jmp 0x3a30
jmp 0x3a3a
jmp 0x3a30
jmp 0x3a3a
jmp 0x3a30
jmp 0x39d0
jmp 0x3a35
jmp 0x3a3a
jmp 0x3a30
jmp 0x3a30
jmp 0x3a35
jmp 0x39d0
movq %rax, %rbx
leaq 0x178(%rsp), %rdi
callq 0x4e26
jmp 0x3a65
jmp 0x3a30
movq %rax, %rbx
movq 0x1b0(%rsp), %rdi
cmpq %r14, %rdi
je 0x3a65
movq 0x1c0(%rsp), %rsi
incq %rsi
callq 0x2230
jmp 0x3a65
jmp 0x3a3a
jmp 0x3a3a
jmp 0x3a35
jmp 0x3a3a
movq %rax, %rbx
movq 0x80(%rsp), %rdi
cmpq %r14, %rdi
je 0x3a3d
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x2230
jmp 0x3a3d
jmp 0x3a30
jmp 0x3a3a
jmp 0x3a30
jmp 0x3a3a
jmp 0x3a30
jmp 0x3a30
jmp 0x3a30
jmp 0x3a30
movq %rax, %rbx
jmp 0x3a58
movq %rax, %rbx
jmp 0x3a65
movq %rax, %rbx
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x3a58
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2230
leaq 0x1b0(%rsp), %rdi
callq 0x65e2
leaq 0x160(%rsp), %rdi
callq 0x4e26
movq %rbx, %rdi
callq 0x2340