// File: /workspace/github_cpp_makefile_star2_O3/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 0x4cf0
testl %r14d, %r14d
jle 0x267b
leaq 0x1c0(%rsp), %r12
movl %ebp, %r13d
shlq $0x5, %r13
xorl %ebp, %ebp
leaq 0x1b0(%rsp), %r14
leaq 0x8(%rsp), %r15
movq (%rbx), %rsi
movq %r14, %rdi
movq %r15, %rdx
callq 0x4cb2
movq 0x160(%rsp), %rdi
addq %rbp, %rdi
movq %r14, %rsi
callq 0x2260
movq 0x1b0(%rsp), %rdi
cmpq %r12, %rdi
je 0x266e
movq 0x1c0(%rsp), %rsi
incq %rsi
callq 0x2230
addq $0x8, %rbx
addq $0x20, %rbp
cmpq %rbp, %r13
jne 0x2630
leaq 0x178(%rsp), %rdi
leaq 0x160(%rsp), %rsi
callq 0x4d7c
leaq 0x178(%rsp), %rdi
callq 0x3a60
movl %eax, %ebx
leaq 0x178(%rsp), %rdi
callq 0x4e06
movl 0xbc12(%rip), %ecx      # 0xe2c4
movl 0xbb28(%rip), %eax      # 0xe1e0
cmpl $-0x1, %ebx
je 0x37e9
testl %ecx, %ecx
sete %cl
cmpl $0x2, %eax
setge %al
andb %cl, %al
cmpb $0x1, %al
jne 0x2777
leaq 0x1c0(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0xbb97(%rip), %rsi      # 0xe280
movq 0xbb98(%rip), %rdx      # 0xe288
addq %rsi, %rdx
leaq 0x1b0(%rsp), %rdi
callq 0x9032
leaq 0x79fa(%rip), %rsi      # 0xa101
leaq 0x1b0(%rsp), %rdi
callq 0x2380
movq 0x1b0(%rsp), %rsi
movq 0x1b8(%rsp), %rdx
movq 0xb8ad(%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 0x2777
movq 0x1c0(%rsp), %rsi
incq %rsi
callq 0x2230
xorl %edi, %edi
callq 0x21e0
movq %rax, %r14
movq 0xb850(%rip), %rax      # 0xdfd8
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movq $0x9, 0x8(%rax,%rcx)
movl 0xbb26(%rip), %esi      # 0xe2c4
leaq 0x1b0(%rsp), %rdi
callq 0x4eba
movl 0xba2f(%rip), %eax      # 0xe1e0
leaq 0x1b0(%rsp), %rdi
movl %eax, (%rdi)
movsd 0xba25(%rip), %xmm0     # 0xe1e8
movsd 0xba4d(%rip), %xmm1     # 0xe218
movsd 0xba55(%rip), %xmm2     # 0xe228
movsd 0xba45(%rip), %xmm3     # 0xe220
movl 0xba4f(%rip), %edx      # 0xe230
movsd 0xba4f(%rip), %xmm4     # 0xe238
movsd 0xba4f(%rip), %xmm5     # 0xe240
movsd 0xba4f(%rip), %xmm6     # 0xe248
movsd 0xba4f(%rip), %xmm7     # 0xe250
movl 0xba51(%rip), %ecx      # 0xe258
leaq 0xb9f2(%rip), %rbx      # 0xe200
movq %rbx, %rsi
callq 0x502e
movl 0x310(%rsp), %eax
movq %rax, 0x28(%rsp)
cvttsd2si 0xb9be(%rip), %eax # 0xe1e8
cmpl $0x3, %eax
jge 0x2860
movl $0x1, 0xb9bf(%rip)      # 0xe1f8
movabsq $0x3ff0000000000000, %rcx # imm = 0x3FF0000000000000
movq %rcx, 0xb9c6(%rip)      # 0xe210
cmpl $0x2, %eax
je 0x2860
movl $0x1, 0xb99b(%rip)      # 0xe1f4
movq %rcx, 0xb9a8(%rip)      # 0xe208
movq %r14, 0x150(%rsp)
xorl %eax, %eax
leaq 0xb97f(%rip), %rcx      # 0xe1f0
movsd (%rbx), %xmm0
xorps %xmm1, %xmm1
cvtsi2sdl (%rax,%rcx), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x190(%rsp,%rax,2)
addq $0x4, %rax
addq $0x8, %rbx
cmpq $0xc, %rax
jne 0x2871
xorpd %xmm0, %xmm0
movapd %xmm0, 0x130(%rsp)
xorl %r14d, %r14d
movq %r14, 0x140(%rsp)
movq %r14, 0x120(%rsp)
movapd %xmm0, 0x110(%rsp)
movl 0xb929(%rip), %ebx      # 0xe1f0
xorps %xmm0, %xmm0
cvtsi2sd %ebx, %xmm0
movsd %xmm0, 0x30(%rsp)
xorps %xmm1, %xmm1
cvtsi2sdl 0xb97d(%rip), %xmm1 # 0xe25c
divsd %xmm1, %xmm0
callq 0x2050
cvttsd2si %xmm0, %ecx
movl %ebx, %eax
cltd
movl %ecx, 0x44(%rsp)
idivl %ecx
cvttpd2dq %xmm0, %xmm0
movsd 0xb8ff(%rip), %xmm1     # 0xe200
cvtdq2pd %xmm0, %xmm0
movsd %xmm1, 0x48(%rsp)
mulsd %xmm1, %xmm0
divsd 0x30(%rsp), %xmm0
movapd %xmm0, 0x90(%rsp)
movl %edx, 0x3c(%rsp)
testl %edx, %edx
setg %r15b
cmpl $0x0, 0xb995(%rip)      # 0xe2c4
movl %eax, 0x40(%rsp)
jne 0x2a86
cmpl $0x1, 0xb8a0(%rip)      # 0xe1e0
jle 0x2a86
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0xb929(%rip), %rsi      # 0xe280
movq 0xb92a(%rip), %rdx      # 0xe288
addq %rsi, %rdx
leaq 0x8(%rsp), %rdi
callq 0x9032
leaq 0x779a(%rip), %rsi      # 0xa10c
leaq 0x8(%rsp), %rdi
callq 0x2380
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq 0xb64b(%rip), %rdi      # 0xdfd8
callq 0x2240
movq %rax, %rdi
movl 0x40(%rsp), %esi
callq 0x2320
movq %rax, %rbx
leaq 0x788d(%rip), %rsi      # 0xa235
movl $0x1, %edx
movq %rax, %rdi
callq 0x2240
movq %rbx, %rdi
movl 0x44(%rsp), %esi
callq 0x2320
movq %rax, %rbx
leaq 0x786a(%rip), %rsi      # 0xa235
movl $0x1, %edx
movq %rax, %rdi
callq 0x2240
movq %rbx, %rdi
movl 0x3c(%rsp), %esi
callq 0x2320
movq %rax, %rbx
leaq 0x7847(%rip), %rsi      # 0xa235
movl $0x1, %edx
movq %rax, %rdi
callq 0x2240
movq %rbx, %rdi
movapd 0x90(%rsp), %xmm0
callq 0x22e0
movq %rax, %rbx
leaq 0x781f(%rip), %rsi      # 0xa235
movl $0x1, %edx
movq %rax, %rdi
callq 0x2240
cvtsi2sdl 0x3c(%rsp), %xmm1
movsd 0x48(%rsp), %xmm0
mulsd %xmm1, %xmm0
divsd 0x30(%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 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x2a82
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2230
movl 0x40(%rsp), %eax
xorl %ebp, %ebp
movb %r15b, %bpl
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
addl %eax, %ebp
movsd 0x190(%rsp), %xmm1
movsd 0x7563(%rip), %xmm2     # 0xa008
mulsd %xmm1, %xmm2
mulsd 0x90(%rsp), %xmm0
movsd %xmm2, 0x30(%rsp)
addsd %xmm2, %xmm0
movsd %xmm0, 0x158(%rsp)
mulsd 0x7543(%rip), %xmm1     # 0xa010
movsd %xmm1, 0x48(%rsp)
leaq 0x8(%rsp), %r15
leaq 0xb721(%rip), %r12      # 0xe200
xorl %ebx, %ebx
testq %rbx, %rbx
je 0x2b18
movsd 0x190(%rsp,%rbx), %xmm0
mulsd 0x7511(%rip), %xmm0     # 0xa008
movsd %xmm0, 0x130(%rsp,%rbx)
movsd (%rbx,%r12), %xmm1
subsd %xmm0, %xmm1
movsd %xmm1, 0x110(%rsp,%rbx)
jmp 0x2cc0
movl 0xb7a6(%rip), %ecx      # 0xe2c4
cmpl %eax, %ecx
jge 0x2b67
xorps %xmm0, %xmm0
cvtsi2sd %ecx, %xmm0
movapd 0x90(%rsp), %xmm1
mulsd %xmm1, %xmm0
addsd 0x30(%rsp), %xmm0
movsd %xmm0, 0x130(%rsp)
incl %ecx
xorps %xmm0, %xmm0
cvtsi2sd %ecx, %xmm0
mulsd %xmm1, %xmm0
addsd 0x48(%rsp), %xmm0
movsd %xmm0, 0x110(%rsp)
movl 0x44(%rsp), %ecx
jmp 0x2b98
cmpl %ebp, %ecx
jge 0x2b9b
movsd 0x158(%rsp), %xmm0
movsd %xmm0, 0x130(%rsp)
movsd 0xb67b(%rip), %xmm0     # 0xe200
subsd 0x30(%rsp), %xmm0
movsd %xmm0, 0x110(%rsp)
movl 0x3c(%rsp), %ecx
movl %ecx, %r14d
cmpl $0x2, 0xb63e(%rip)      # 0xe1e0
jl 0x2cc0
leaq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0xb6c7(%rip), %rsi      # 0xe280
movq 0xb6c8(%rip), %rdx      # 0xe288
addq %rsi, %rdx
movq %r15, %rdi
callq 0x9032
movq %r15, %r13
movq %r15, %rdi
leaq 0x7564(%rip), %rsi      # 0xa13c
callq 0x2380
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq 0xb3ea(%rip), %rdi      # 0xdfd8
callq 0x2240
movl 0xb6cb(%rip), %esi      # 0xe2c4
movq %rax, %rdi
callq 0x2320
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
leaq 0x7622(%rip), %rsi      # 0xa235
callq 0x2240
movsd 0x130(%rsp), %xmm0
movq %r15, %rdi
callq 0x22e0
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
leaq 0x75fa(%rip), %rsi      # 0xa235
callq 0x2240
movsd 0x110(%rsp), %xmm0
movq %r15, %rdi
callq 0x22e0
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
leaq 0x75d2(%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 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x2cb9
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2230
movl 0x40(%rsp), %eax
movq %r13, %r15
addq $0x8, %rbx
cmpq $0x18, %rbx
jne 0x2ae1
leaq 0xb51b(%rip), %rax      # 0xe1f0
movq %rax, 0x30(%rsp)
movl %r14d, 0xe4(%rsp)
movq 0xb50b(%rip), %rax      # 0xe1f4
movq %rax, 0xe8(%rsp)
movl $0x1, %r14d
xorl %eax, %eax
movq %r14, %r15
movslq 0xe4(%rsp,%rax,4), %rbp
imulq %rbp, %r14
incq %rax
cmpq $0x3, %rax
jne 0x2cf9
cmpl $0x0, 0x28(%rsp)
jle 0x2d52
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, 0xf0(%rsp,%r13,8)
incq %r13
cmpq %r13, 0x28(%rsp)
jne 0x2d38
leaq 0x1b0(%rsp), %rdi
leaq 0x130(%rsp), %rsi
leaq 0x110(%rsp), %rdx
leaq 0xe4(%rsp), %rcx
leaq 0xf0(%rsp), %r8
callq 0x56a0
xorl %eax, %eax
xorpd %xmm0, %xmm0
movapd %xmm0, 0x50(%rsp)
movq %rax, 0x60(%rsp)
movq %rax, 0x80(%rsp)
movapd %xmm0, 0x70(%rsp)
movq %rax, 0xd0(%rsp)
movapd %xmm0, 0xc0(%rsp)
cmpl $0x0, 0x28(%rsp)
jle 0x2fb5
imulq %rbp, %r15
xorl %eax, %eax
testq %r14, %r14
jle 0x2e03
movq 0xf0(%rsp,%rax,8), %rcx
movsd 0x50(%rsp,%rax,8), %xmm1
movsd 0x70(%rsp,%rax,8), %xmm0
xorl %edx, %edx
xorps %xmm2, %xmm2
cvtss2sd (%rcx,%rdx,4), %xmm2
addsd %xmm2, %xmm1
mulsd %xmm2, %xmm2
addsd %xmm2, %xmm0
incq %rdx
cmpq %rdx, %r15
jne 0x2ddb
movsd %xmm1, 0x50(%rsp,%rax,8)
movsd %xmm0, 0x70(%rsp,%rax,8)
incq %rax
cmpq 0x28(%rsp), %rax
jne 0x2dc0
cmpl $0x0, 0x28(%rsp)
jle 0x2fb5
xorl %ebx, %ebx
xorpd %xmm2, %xmm2
movl 0xb3d0(%rip), %eax      # 0xe1f4
imull 0xb3c5(%rip), %eax      # 0xe1f0
imull 0xb3c6(%rip), %eax      # 0xe1f8
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
movsd 0x50(%rsp,%rbx,8), %xmm3
divsd %xmm1, %xmm3
movsd %xmm3, 0x50(%rsp,%rbx,8)
movsd 0x70(%rsp,%rbx,8), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, 0x70(%rsp,%rbx,8)
movapd %xmm3, %xmm1
mulsd %xmm3, %xmm1
subsd %xmm1, %xmm0
ucomisd %xmm2, %xmm0
jb 0x2e71
sqrtsd %xmm0, %xmm0
jmp 0x2e8c
movsd %xmm3, 0x90(%rsp)
callq 0x21a0
movsd 0x90(%rsp), %xmm3
xorpd %xmm2, %xmm2
movsd %xmm0, 0xc0(%rsp,%rbx,8)
testq %r14, %r14
jle 0x2ecd
movq 0xf0(%rsp,%rbx,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, %r15
jne 0x2ea4
incq %rbx
cmpq 0x28(%rsp), %rbx
jne 0x2e1e
cmpl $0x0, 0x28(%rsp)
jle 0x2fb5
xorl %eax, %eax
xorl %ecx, %ecx
movq %rax, 0x50(%rsp,%rcx,8)
movq %rax, 0x70(%rsp,%rcx,8)
testq %r14, %r14
jle 0x2f33
movq 0xf0(%rsp,%rcx,8), %rdx
xorpd %xmm0, %xmm0
xorpd %xmm1, %xmm1
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 0x2f0b
movsd %xmm1, 0x50(%rsp,%rcx,8)
movsd %xmm0, 0x70(%rsp,%rcx,8)
incq %rcx
cmpq 0x28(%rsp), %rcx
jne 0x2eea
cmpl $0x0, 0x28(%rsp)
jle 0x2fb5
xorl %ebx, %ebx
xorpd %xmm3, %xmm3
movl 0xb2a4(%rip), %eax      # 0xe1f4
imull 0xb299(%rip), %eax      # 0xe1f0
imull 0xb29a(%rip), %eax      # 0xe1f8
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
movsd 0x50(%rsp,%rbx,8), %xmm2
divsd %xmm1, %xmm2
movsd %xmm2, 0x50(%rsp,%rbx,8)
movsd 0x70(%rsp,%rbx,8), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, 0x70(%rsp,%rbx,8)
mulsd %xmm2, %xmm2
subsd %xmm2, %xmm0
ucomisd %xmm3, %xmm0
jb 0x2f99
sqrtsd %xmm0, %xmm0
jmp 0x2fa2
callq 0x21a0
xorpd %xmm3, %xmm3
movsd %xmm0, 0xc0(%rsp,%rbx,8)
incq %rbx
cmpq %rbx, 0x28(%rsp)
jne 0x2f4a
cmpl $0x0, 0xb308(%rip)      # 0xe2c4
jne 0x359f
cmpl $0x0, 0xb217(%rip)      # 0xe1e0
jle 0x359f
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
movq %rax, (%rdi)
movq 0xb29d(%rip), %rsi      # 0xe280
movq 0xb29e(%rip), %rdx      # 0xe288
addq %rsi, %rdx
callq 0x9032
leaq 0x7167(%rip), %rsi      # 0xa160
leaq 0x8(%rsp), %rdi
callq 0x2380
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq 0xafc4(%rip), %rdi      # 0xdfd8
callq 0x2240
movsd 0xb1c7(%rip), %xmm0     # 0xe1e8
movq %rax, %rdi
callq 0x22e0
movq %rax, %rbx
leaq 0x7138(%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 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x3083
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2230
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
movq %rax, (%rdi)
movq 0xb1e9(%rip), %rsi      # 0xe280
movq 0xb1ea(%rip), %rdx      # 0xe288
addq %rsi, %rdx
callq 0x9032
leaq 0x70d5(%rip), %rsi      # 0xa182
leaq 0x8(%rsp), %rdi
callq 0x2380
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq 0xaf10(%rip), %rbx      # 0xdfd8
movq %rbx, %rdi
callq 0x2240
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x30ec
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2230
cvttsd2si 0xb0f4(%rip), %eax # 0xe1e8
testl %eax, %eax
jle 0x3144
xorl %ebp, %ebp
movq 0xaed7(%rip), %r14      # 0xdfd8
leaq 0x712d(%rip), %r15      # 0xa235
movl $0x1, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2240
movq 0x30(%rsp), %r13
movl (%r13), %esi
movq %r14, %rdi
callq 0x2320
cvttsd2si 0xb0b7(%rip), %eax # 0xe1e8
incq %rbp
cltq
addq $0x4, %r13
movq %r13, 0x30(%rsp)
cmpq %rax, %rbp
jl 0x3108
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2210
movsbl %al, %esi
movq 0xae76(%rip), %rdi      # 0xdfd8
callq 0x2040
movq %rax, %rdi
callq 0x2150
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
movq %rax, (%rdi)
movq 0xb0fd(%rip), %rsi      # 0xe280
movq 0xb0fe(%rip), %rdx      # 0xe288
addq %rsi, %rdx
callq 0x9032
leaq 0x7003(%rip), %rsi      # 0xa19c
leaq 0x8(%rsp), %rdi
callq 0x2380
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq 0xae24(%rip), %rbx      # 0xdfd8
movq %rbx, %rdi
callq 0x2240
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x31d8
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2230
cvttsd2si 0xb008(%rip), %eax # 0xe1e8
testl %eax, %eax
jle 0x3229
xorl %r13d, %r13d
movq 0xadea(%rip), %r14      # 0xdfd8
leaq 0x7040(%rip), %r15      # 0xa235
movl $0x1, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2240
movsd (%r12), %xmm0
movq %r14, %rdi
callq 0x22e0
cvttsd2si 0xafcd(%rip), %eax # 0xe1e8
incq %r13
cltq
addq $0x8, %r12
cmpq %rax, %r13
jl 0x31f5
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2210
movsbl %al, %esi
movq 0xad91(%rip), %rdi      # 0xdfd8
callq 0x2040
movq %rax, %rdi
callq 0x2150
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
movq %rax, (%rdi)
movq 0xb018(%rip), %rsi      # 0xe280
movq 0xb019(%rip), %rdx      # 0xe288
addq %rsi, %rdx
callq 0x9032
leaq 0x6f31(%rip), %rsi      # 0xa1af
leaq 0x8(%rsp), %rdi
callq 0x2380
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq 0xad3f(%rip), %rbx      # 0xdfd8
movq %rbx, %rdi
callq 0x2240
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x32bd
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2230
cmpl $0x0, 0x28(%rsp)
jle 0x32fe
xorl %r12d, %r12d
movq 0xad0a(%rip), %r14      # 0xdfd8
leaq 0x6f60(%rip), %r15      # 0xa235
movl $0x1, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2240
movsd 0x50(%rsp,%r12,8), %xmm0
movq %r14, %rdi
callq 0x22e0
incq %r12
cmpq %r12, 0x28(%rsp)
jne 0x32d5
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2210
movsbl %al, %esi
movq 0xacbc(%rip), %rdi      # 0xdfd8
callq 0x2040
movq %rax, %rdi
callq 0x2150
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
movq %rax, (%rdi)
movq 0xaf43(%rip), %rsi      # 0xe280
movq 0xaf44(%rip), %rdx      # 0xe288
addq %rsi, %rdx
callq 0x9032
leaq 0x6e79(%rip), %rsi      # 0xa1cc
leaq 0x8(%rsp), %rdi
callq 0x2380
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq 0xac6a(%rip), %rbx      # 0xdfd8
movq %rbx, %rdi
callq 0x2240
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x3392
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2230
cmpl $0x0, 0x28(%rsp)
jle 0x33d6
xorl %r12d, %r12d
movq 0xac35(%rip), %r14      # 0xdfd8
leaq 0x6e8b(%rip), %r15      # 0xa235
movl $0x1, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2240
movsd 0xc0(%rsp,%r12,8), %xmm0
movq %r14, %rdi
callq 0x22e0
incq %r12
cmpq %r12, 0x28(%rsp)
jne 0x33aa
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2210
movsbl %al, %esi
movq 0xabe4(%rip), %rdi      # 0xdfd8
callq 0x2040
movq %rax, %rdi
callq 0x2150
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
movq %rax, (%rdi)
leaq 0x7b85(%rip), %rdx      # 0xaf9a
movq %rdx, %rsi
callq 0x988e
movq 0x28(%rsp), %rax
decl %eax
cmpl $0x3, %eax
jae 0x3454
movl %eax, %eax
leaq 0x7fd6(%rip), %rdx      # 0xb408
movslq (%rdx,%rax,4), %rcx
addq %rdx, %rcx
leaq 0x7fd8(%rip), %rdx      # 0xb418
movq (%rdx,%rax,8), %r8
leaq 0x8(%rsp), %rdi
movq 0x8(%rdi), %rdx
xorl %esi, %esi
callq 0x22d0
leaq 0xb0(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0xae19(%rip), %rsi      # 0xe280
movq 0xae1a(%rip), %rdx      # 0xe288
addq %rsi, %rdx
leaq 0xa0(%rsp), %rdi
callq 0x9032
leaq 0x6d87(%rip), %rsi      # 0xa20c
leaq 0xa0(%rsp), %rdi
callq 0x2380
movq 0xa0(%rsp), %rsi
movq 0xa8(%rsp), %rdx
movq 0xab2f(%rip), %rdi      # 0xdfd8
callq 0x2240
movsd 0xad32(%rip), %xmm0     # 0xe1e8
movq %rax, %rdi
callq 0x22e0
movq %rax, %rbx
leaq 0x6d4d(%rip), %rsi      # 0xa215
movl $0x21, %edx
movq %rax, %rdi
callq 0x2240
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x2240
movq %rax, %rbx
leaq 0x6d46(%rip), %rsi      # 0xa237
movl $0x4, %edx
movq %rax, %rdi
callq 0x2240
movsd 0xc0(%rsp), %xmm0
movsd 0xc8(%rsp), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
movsd 0xd0(%rsp), %xmm1
mulsd %xmm1, %xmm1
addsd %xmm0, %xmm1
xorps %xmm0, %xmm0
sqrtsd %xmm1, %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 0xa0(%rsp), %rdi
cmpq %r14, %rdi
je 0x3583
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x2230
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x359f
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2230
cmpl $0x0, 0x28(%rsp)
jle 0x35d0
xorl %ebx, %ebx
movq 0xf0(%rsp,%rbx,8), %rdi
testq %rdi, %rdi
je 0x35ba
callq 0x2280
movq $0x0, 0xf0(%rsp,%rbx,8)
incq %rbx
cmpq %rbx, 0x28(%rsp)
jne 0x35a8
xorl %edi, %edi
callq 0x21e0
movq %rax, %r14
subq 0x150(%rsp), %r14
movl 0xabf8(%rip), %eax      # 0xe1e0
cmpl $0x1, %eax
jle 0x36cb
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
movq %rax, (%rdi)
movq 0xac7b(%rip), %rsi      # 0xe280
movq 0xac7c(%rip), %rdx      # 0xe288
addq %rsi, %rdx
callq 0x9032
leaq 0x6c21(%rip), %rsi      # 0xa23c
leaq 0x8(%rsp), %rdi
callq 0x2380
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq 0xa9a2(%rip), %rdi      # 0xdfd8
callq 0x2240
movl 0xac83(%rip), %esi      # 0xe2c4
movq %rax, %rdi
callq 0x2320
movq %rax, %rbx
leaq 0x6beb(%rip), %rsi      # 0xa23e
movl $0x11, %edx
movq %rax, %rdi
callq 0x2240
movq %rbx, %rdi
movq %r14, %rsi
callq 0x21f0
movq %rax, %rbx
leaq 0x75d4(%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 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x36c5
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2230
movl 0xab15(%rip), %eax      # 0xe1e0
cmpl $0x0, 0xabf2(%rip)      # 0xe2c4
jne 0x37d5
testl %eax, %eax
jle 0x37d5
movq 0xa8f1(%rip), %rbx      # 0xdfd8
leaq 0x6b62(%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 0xa8bf(%rip), %rdi      # 0xdfd8
callq 0x2040
movq %rax, %rdi
callq 0x2150
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
movq %rax, (%rdi)
movq 0xab46(%rip), %rsi      # 0xe280
movq 0xab47(%rip), %rdx      # 0xe288
addq %rsi, %rdx
callq 0x9032
leaq 0x6b36(%rip), %rsi      # 0xa286
leaq 0x8(%rsp), %rdi
callq 0x2380
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq 0xa86d(%rip), %rdi      # 0xdfd8
callq 0x2240
movq %rax, %rdi
movq %r14, %rsi
callq 0x21f0
movq %rax, %rbx
leaq 0x74c4(%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 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x37d5
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2230
leaq 0x1b0(%rsp), %rdi
callq 0x65ac
xorl %ebx, %ebx
jmp 0x38d6
testl %ecx, %ecx
sete %cl
testl %eax, %eax
setg %al
andb %cl, %al
cmpb $0x1, %al
jne 0x38cc
movq 0xa7d4(%rip), %rdi      # 0xdfd8
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x2210
movsbl %al, %esi
movq 0xa7b9(%rip), %rdi      # 0xdfd8
callq 0x2040
movq %rax, %rdi
callq 0x2150
movq %rax, %rbx
leaq 0x1c0(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0xaa3e(%rip), %rsi      # 0xe280
movq 0xaa3f(%rip), %rdx      # 0xe288
addq %rsi, %rdx
leaq 0x1b0(%rsp), %rdi
callq 0x9032
leaq 0x6880(%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 0x38cc
movq 0x1c0(%rsp), %rsi
incq %rsi
callq 0x2230
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
callq 0x462b
leaq 0x160(%rsp), %rdi
callq 0x4e06
movl %ebx, %eax
addq $0x3e8, %rsp            # imm = 0x3E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3a1f
jmp 0x39a8
jmp 0x3a1a
jmp 0x39d6
jmp 0x3a1f
jmp 0x3a15
jmp 0x3a1f
jmp 0x3a1f
jmp 0x3a15
jmp 0x3a1f
jmp 0x3a15
jmp 0x3a1f
jmp 0x3a15
jmp 0x3a1f
jmp 0x3a1f
jmp 0x3a15
jmp 0x3a1f
jmp 0x3a1f
jmp 0x3a15
jmp 0x3a1f
jmp 0x3a1f
jmp 0x3a15
jmp 0x3a1f
jmp 0x3a15
jmp 0x39fe
jmp 0x3a15
jmp 0x39a8
jmp 0x3a1a
jmp 0x3a15
jmp 0x3a15
jmp 0x3a1a
jmp 0x39a8
movq %rax, %rbx
leaq 0x178(%rsp), %rdi
callq 0x4e06
jmp 0x3a4b
jmp 0x3a15
movq %rax, %rbx
movq 0x1b0(%rsp), %rdi
cmpq %r14, %rdi
je 0x3a4b
movq 0x1c0(%rsp), %rsi
incq %rsi
callq 0x2230
jmp 0x3a4b
jmp 0x3a1f
jmp 0x3a1f
jmp 0x3a1a
jmp 0x3a1f
movq %rax, %rbx
movq 0xa0(%rsp), %rdi
cmpq %r14, %rdi
je 0x3a22
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x2230
jmp 0x3a22
jmp 0x3a15
jmp 0x3a1f
jmp 0x3a15
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
jne 0x3a31
jmp 0x3a3e
jmp 0x3a15
jmp 0x3a15
jmp 0x3a15
jmp 0x3a15
movq %rax, %rbx
jmp 0x3a3e
movq %rax, %rbx
jmp 0x3a4b
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x3a3e
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2230
leaq 0x1b0(%rsp), %rdi
callq 0x65ac
leaq 0x160(%rsp), %rdi
callq 0x4e06
movq %rbx, %rdi
callq 0x2340