// File: /workspace/github_cpp_makefile_star2_O2/chfeder[P]turbulence_generator/TurbGenDemo.cpp
// Function: main
int main(void)
{
  std::string funcsig = "TurbGenDemo: ";
  std::string parameter_file = "TurbGen.par";

  // 1st example case (turbulence driving)
  if (true) {
    printf("\n%s === 1st example case (turbulence driving) ===\n", funcsig.c_str());

    // create TurbGen class object
    TurbGen tg = TurbGen();

    // First, initialise the turbulence generator with input parameters from parameter_file
    // If MPI is present, we pass the MPI rank to TurbGen.init_driving(...);
    // note that the MPI rank is simply to control printf to stdout, i.e., only rank 0 will print.
    // This function should only be called once, i.e., to initialise the turbulence generator.
    tg.init_driving(parameter_file);

    // as an example, let's loop through a few time steps (e.g., of a hydro code)
    // to demonstrate how the turbulence generator is updated and how the physical turbulent
    // acceleration field is returned by TurbGen.h

    // get the turbulent turnover time
    double t_turb = tg.get_turnover_time();
    // let's go through 5 turnover times based on the inputs in parameter_file above
    double t_end = 5.0 * t_turb;

    // set some number of time steps that the hydro code would go through
    int nsteps = 123;
    // time step (this will normally be set by the hydro code;
    // ultimately, one simply feeds in the 'time' at which one wants the respective
    // physical turbulent acceleration field -- see below in call to TurbGen.check_for_update(...)
    double dt = t_end / nsteps;

    // loop through time steps
    for (int step = 0; step <= nsteps; step++) {

      double time = step * dt;
      printf("%stime = %f\n", funcsig.c_str(), time);

      // Function to update the turbulence driving mode coefficients.
      // Based on input 'time', it checks if the pattern needs to be updated.
      // If it was updated, return true in 'have_updated_pattern', else return false.
      // Note that this call to TurbGen_update(time) is very cheap and returns right away if current input
      // time means that no update of the turbulence driving pattern is necessary; therefore, we can safely
      // call this in every hydro timestep without wasting compute time.
      bool have_updated_pattern = tg.check_for_update(time);

      if (have_updated_pattern) {
        // say we want the turbulent vector field value at some physical position pos[3]
        double pos[3] = {0.1, -0.5, 0.3};
        double v[3]; // return vector
        tg.get_turb_vector(pos, v); // get the vector
        printf("%sturbulent vector at position (%f %f %f) is vx, vy, vz = %f %f %f\n",
               funcsig.c_str(), pos[0], pos[1], pos[2], v[0], v[1], v[2]);
      }

    } // end of loop over timesteps

  } // end of 1st example


  // 2nd example case (return turbulent vector field on uniform grid)
  if (true) {
    printf("\n%s === 2nd example case (fast forward to 5 t_turb and return turbulent vector field on uniform grid) ===\n",
           funcsig.c_str());

    // create TurbGen class object
    TurbGen tg = TurbGen();

    // The above example returns the turbulent vector field at only a single position.
    // Here we want the turbulent vector field at all positions on a 3D uniform grid of size nx, nz, nz.
    // In grid codes, this would be function to call, because it is faster than calling TurbGen_get_turb_vector
    // at every requested position; here, it is done for an entire block (uniform grid) of data.

    // first init as in example 1
    tg.init_driving(parameter_file);

    // now fast forward to target time (e.g., after 5 turbulent turnover times)
    tg.check_for_update(5*tg.get_turnover_time());

    // random example of physical coordinates of a target output grid (pos_beg must be < pos_end):
    double pos_beg[3] = {0.1, -0.5, 0.3}; // first cell coordinate in uniform grid (x,y,z)
    double pos_end[3] = {0.4, -0.3, 0.5}; // last  cell coordinate in uniform grid (x,y,z)
    int n[3] = {10, 20, 13}; // some random number of cells that define the output grid size
    long ntot = n[0]*n[1]*n[2]; // total number of grid cells
    float * grid_out[3]; // output grid (3 cartesian components: vx, vy, vz), receiving the turbulent acceleration field

    // allocate
    for (int dim = 0; dim < 3; dim++) grid_out[dim] = new float[ntot];

    // call to return 3 uniform grids with the 3 components of the turbulent acceleration field at requested positions
    tg.get_turb_vector_unigrid(pos_beg, pos_end, n, grid_out);

    // indices in x,y,z, i.e., i,j,k, and 1D index
    int i, j, k; long index;
    i = 3; j = 0; k = 10;
    index = k*n[1]*n[0] + j*n[0] + i;
    printf("%se.g., x-component of turbulent vector field at index i,j,k = (%i %i %i) is %f\n",
           funcsig.c_str(), i, j, k, grid_out[0][index]);
    i = 9; j = 1; k = 4;
    index = k*n[1]*n[0] + j*n[0] + i;
    printf("%se.g., z-component of turbulent vector field at index i,j,k = (%i %i %i) is %f\n",
           funcsig.c_str(), i, j, k, grid_out[2][index]);

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

  } // end of 2nd example


  // 3rd example case (single realisation)
  if (true) {
    printf("\n%s === 3rd example case (single realisation) ===\n", funcsig.c_str());

    // create TurbGen class object
    TurbGen tg = TurbGen();

    // Example of how to generate a single realisation of a turbulent vector field.
    // One can use this for example to generate an intial turbulent velocity or magnetic field
    // with the spectral properties specified in the call to TurbGen_get_turb_vector_unigrid_single_realisation.

    int ndim = 3; // dimensionality
    double L[3] = {1.0, 1.0, 1.0}; // size of box in x, y, z
    double k_min = 2.0; // minimum wavenumber for turbulent field (in units of 2pi / L[X])
    double k_max = 20.0; // minimum wavenumber for turbulent field (in units of 2pi / L[X])
    int spect_form = 2; // 0: band/rectangle/constant, 1: paraboloid, 2: power law
    double power_law_exp = -2.0; // if spect_form == 2: power-law exponent (e.g., -2 would be Burgers,
                                 // or -5/3 would be Kolmogorov, or 1.5 would Kazantsev)
    double angles_exp = 1.0; // if spect_form == 2: spectral sampling of angles;
                             // number of modes (angles) in k-shell surface increases as k^angles_exp.
                             // For full sampling, angles_exp = 2.0; for healpix-type sampling, angles_exp = 0.0.
    double sol_weight = 0.5; // solenoidal weight: 1.0: solenoidal driving, 0.0: compressive driving, 0.5: natural mixture
    int random_seed = 140281; // random seed for this turbulent realisation

    // random example of physical coordinates of a target output grid (pos_beg must be < pos_end):
    int n[3] = {64, 64, 64}; // some random number of cells that define the output grid size
    double d[3]; for (int dim = 0; dim < 3; dim++) d[dim] = L[dim] / n[dim]; // define cell size of uniform grid
    double pos_beg[3] = {-0.5+d[0]/2, -0.5+d[1]/2, -0.5+d[2]/2}; // first cell coordinate in uniform grid (x,y,z); cell-centered example
    double pos_end[3] = {+0.5-d[0]/2, +0.5-d[1]/2, +0.5-d[2]/2}; // last  cell coordinate in uniform grid (x,y,z); cell-centered example
    long ntot = n[0]*n[1]*n[2]; // total number of grid cells
    float * grid_out[3]; // output grid (three cartesian components: vx, vy, vz), which receives the turbulent acceleration field

    // allocate
    for (int dim = 0; dim < 3; dim++) grid_out[dim] = new float[ntot];

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

    // call to return 3 uniform grids with the 3 components of the turbulent acceleration field at requested positions
    tg.get_turb_vector_unigrid(pos_beg, pos_end, n, grid_out);

    // indices in x,y,z, i.e., i,j,k, and 1D index
    int i, j, k; long index;
    i = 3; j = 0; k = 10;
    index = k*n[1]*n[0] + j*n[0] + i;
    printf("%se.g., x-component of turbulent vector field at index i,j,k = (%i %i %i) is %f\n",
           funcsig.c_str(), i, j, k, grid_out[0][index]);
    i = 9; j = 1; k = 4;
    index = k*n[1]*n[0] + j*n[0] + i;
    printf("%se.g., z-component of turbulent vector field at index i,j,k = (%i %i %i) is %f\n",
           funcsig.c_str(), i, j, k, grid_out[2][index]);

    // compute mean and RMS of vector field
    double mean[3] = {0.0, 0.0, 0.0};
    double rms[3] = {0.0, 0.0, 0.0};
    double std[3] = {0.0, 0.0, 0.0};
    for (int dim = 0; dim < 3; dim++) {
      for (long ni = 0; ni < ntot; ni++) {
        mean[dim] += grid_out[dim][ni];
        rms [dim] += pow(grid_out[dim][ni],2.0);
      }
      mean[dim] /= ntot; // mean
      rms[dim] = sqrt(rms[dim] / ntot); // root mean squared
      std[dim] = sqrt(rms[dim]*rms[dim] - mean[dim]*mean[dim]); // standard deviation
    }
    printf("%sTurbulent vector field mean (x,y,z) = (%e %e %e)\n", funcsig.c_str(), mean[0], mean[1], mean[2]);
    printf("%sTurbulent vector field  rms (x,y,z) = (%e %e %e)\n", funcsig.c_str(),  rms[0],  rms[1],  rms[2]);
    printf("%sTurbulent vector field  std (x,y,z) = (%e %e %e)\n", funcsig.c_str(),  std[0],  std[1],  std[2]);
    printf("%sTurbulent vector field total 3D std = %e\n", funcsig.c_str(), sqrt(std[0]*std[0]+std[1]*std[1]+std[2]*std[2]));
    printf("%sNote that the standard deviations will usually need to be normalised to the target std for single realisations.\n%s",
           funcsig.c_str(), "             See TurbGen for a full program that does this.\n");

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

  } // end of 3rd example

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x3d8, %rsp            # imm = 0x3D8
leaq 0x8b1c(%rip), %rsi      # 0xc160
leaq 0x38(%rsp), %rdi
leaq 0x1a0(%rsp), %rdx
callq 0x3e22
leaq 0x8b11(%rip), %rsi      # 0xc16e
leaq 0x140(%rsp), %rdi
leaq 0x1a0(%rsp), %rdx
callq 0x3e22
movq 0x38(%rsp), %rsi
leaq 0x8afc(%rip), %rdi      # 0xc17a
xorl %eax, %eax
callq 0x3040
leaq 0x1a0(%rsp), %rdi
callq 0x3e5e
leaq 0x180(%rsp), %rdi
leaq 0x140(%rsp), %rsi
callq 0x3380
leaq 0x1a0(%rsp), %rdi
leaq 0x180(%rsp), %rsi
callq 0x3f76
leaq 0x180(%rsp), %rdi
callq 0x3120
leaq 0x1a0(%rsp), %rbx
movsd 0x198(%rbx), %xmm0
mulsd 0x8927(%rip), %xmm0     # 0xc008
divsd 0x8927(%rip), %xmm0     # 0xc010
movsd %xmm0, 0x58(%rsp)
xorl %ebp, %ebp
leaq 0x8ab5(%rip), %r14      # 0xc1ad
leaq 0x20(%rsp), %r15
leaq 0x80(%rsp), %r12
leaq 0x8aae(%rip), %r13      # 0xc1ba
cmpl $0x7c, %ebp
je 0x37b2
cvtsi2sd %ebp, %xmm0
mulsd 0x58(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movq 0x38(%rsp), %rsi
movq %r14, %rdi
movb $0x1, %al
callq 0x3040
movq %rbx, %rdi
movsd 0x8(%rsp), %xmm0
callq 0x3fc6
testb %al, %al
je 0x37ab
movaps 0x9bb3(%rip), %xmm0     # 0xd300
movaps %xmm0, 0x20(%rsp)
movabsq $0x3fd3333333333333, %rax # imm = 0x3FD3333333333333
movq %rax, 0x30(%rsp)
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x3ff2
movq 0x38(%rsp), %rsi
movsd 0x20(%rsp), %xmm0
movsd 0x28(%rsp), %xmm1
movsd 0x30(%rsp), %xmm2
movsd 0x80(%rsp), %xmm3
movsd 0x88(%rsp), %xmm4
movsd 0x90(%rsp), %xmm5
movq %r13, %rdi
movb $0x6, %al
callq 0x3040
incl %ebp
jmp 0x370c
leaq 0x1a0(%rsp), %rdi
callq 0x46b4
movq 0x38(%rsp), %rsi
leaq 0x8a33(%rip), %rdi      # 0xc1fe
xorl %eax, %eax
callq 0x3040
leaq 0x1a0(%rsp), %rdi
callq 0x3e5e
leaq 0x160(%rsp), %rdi
leaq 0x140(%rsp), %rsi
callq 0x3380
leaq 0x1a0(%rsp), %rdi
leaq 0x160(%rsp), %rsi
callq 0x3f76
leaq 0x160(%rsp), %rdi
callq 0x3120
leaq 0x1a0(%rsp), %rdi
movsd 0x198(%rdi), %xmm0
mulsd 0x87da(%rip), %xmm0     # 0xc008
callq 0x3fc6
movaps 0x9ac6(%rip), %xmm0     # 0xd300
movaps %xmm0, 0x20(%rsp)
movabsq $0x3fd3333333333333, %rax # imm = 0x3FD3333333333333
movq %rax, 0x30(%rsp)
movapd 0x9aca(%rip), %xmm0     # 0xd320
movapd %xmm0, 0x80(%rsp)
movabsq $0x3fe0000000000000, %rax # imm = 0x3FE0000000000000
movq %rax, 0x90(%rsp)
movabsq $0x140000000a, %rax     # imm = 0x140000000A
movq %rax, 0x60(%rsp)
movl $0xd, 0x68(%rsp)
xorl %ebx, %ebx
cmpq $0x3, %rbx
je 0x38a7
movl $0x28a0, %edi           # imm = 0x28A0
callq 0x3030
movq %rax, 0xa0(%rsp,%rbx,8)
incq %rbx
jmp 0x388a
leaq 0x1a0(%rsp), %rdi
leaq 0x20(%rsp), %rsi
leaq 0x80(%rsp), %rdx
leaq 0x60(%rsp), %rcx
leaq 0xa0(%rsp), %r8
callq 0x477c
movslq 0x64(%rsp), %rax
movslq 0x60(%rsp), %rcx
imulq %rax, %rcx
movq 0x38(%rsp), %rsi
movq 0xa0(%rsp), %rax
imulq $0x28, %rcx, %rcx
cvtss2sd 0xc(%rax,%rcx), %xmm0
leaq 0x896f(%rip), %rdi      # 0xc269
pushq $0x3
popq %rdx
xorl %ebx, %ebx
pushq $0xa
popq %r8
xorl %ecx, %ecx
movb $0x1, %al
callq 0x3040
movl 0x64(%rsp), %eax
leal 0x1(,%rax,4), %eax
imull 0x60(%rsp), %eax
movq 0x38(%rsp), %rsi
movq 0xb0(%rsp), %rcx
cltq
cvtss2sd 0x24(%rcx,%rax,4), %xmm0
leaq 0x8982(%rip), %rdi      # 0xc2ba
pushq $0x9
popq %rdx
pushq $0x1
popq %rcx
pushq $0x4
popq %r8
movb $0x1, %al
callq 0x3040
cmpq $0x3, %rbx
je 0x396f
movq 0xa0(%rsp,%rbx,8), %rdi
testq %rdi, %rdi
je 0x3961
callq 0x3350
andq $0x0, 0xa0(%rsp,%rbx,8)
incq %rbx
jmp 0x3949
leaq 0x1a0(%rsp), %rdi
callq 0x46b4
movq 0x38(%rsp), %rsi
leaq 0x8983(%rip), %rdi      # 0xc30b
xorl %eax, %eax
callq 0x3040
leaq 0x1a0(%rsp), %rdi
callq 0x3e5e
movapd 0x99ac(%rip), %xmm0     # 0xd350
movapd %xmm0, 0x20(%rsp)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x30(%rsp)
movabsq $0x4000000040, %rax     # imm = 0x4000000040
movq %rax, 0x10(%rsp)
movl $0x40, 0x18(%rsp)
xorl %eax, %eax
cmpq $0x3, %rax
je 0x39f6
cvtsi2sdl 0x10(%rsp,%rax,4), %xmm0
movsd 0x20(%rsp,%rax,8), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x80(%rsp,%rax,8)
incq %rax
jmp 0x39d2
movapd 0x8702(%rip), %xmm0     # 0xc100
movapd 0x80(%rsp), %xmm1
mulpd %xmm0, %xmm1
subpd %xmm1, %xmm0
addpd 0x86f9(%rip), %xmm1     # 0xc110
movapd %xmm1, 0xa0(%rsp)
movsd 0x85f0(%rip), %xmm1     # 0xc018
movsd 0x90(%rsp), %xmm2
mulsd %xmm1, %xmm2
subsd %xmm2, %xmm1
addsd 0x85df(%rip), %xmm2     # 0xc020
movsd %xmm2, 0xb0(%rsp)
movapd %xmm0, 0x60(%rsp)
movsd %xmm1, 0x70(%rsp)
xorl %ebx, %ebx
cmpq $0x3, %rbx
je 0x3a75
movl $0x100000, %edi         # imm = 0x100000
callq 0x3030
movq %rax, 0x100(%rsp,%rbx,8)
incq %rbx
jmp 0x3a58
leaq 0x1a0(%rsp), %rdi
movsd 0x85a3(%rip), %xmm0     # 0xc028
leaq 0x20(%rsp), %rsi
movsd 0x859e(%rip), %xmm1     # 0xc030
movsd 0x859e(%rip), %xmm2     # 0xc038
pushq $0x2
popq %rdx
movsd 0x859b(%rip), %xmm3     # 0xc040
movsd 0x859b(%rip), %xmm4     # 0xc048
movsd 0x8563(%rip), %xmm5     # 0xc018
movl $0x223f9, %ecx          # imm = 0x223F9
callq 0x5336
leaq 0x1a0(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
leaq 0x60(%rsp), %rdx
leaq 0x10(%rsp), %rcx
leaq 0x100(%rsp), %r8
callq 0x477c
movslq 0x14(%rsp), %rax
movslq 0x10(%rsp), %rcx
imulq %rax, %rcx
movq 0x38(%rsp), %rsi
movq 0x100(%rsp), %rax
imulq $0x28, %rcx, %rcx
cvtss2sd 0xc(%rax,%rcx), %xmm0
leaq 0x8757(%rip), %rdi      # 0xc269
pushq $0x3
popq %rdx
xorl %ebx, %ebx
pushq $0xa
popq %r8
xorl %ecx, %ecx
movb $0x1, %al
callq 0x3040
movl 0x14(%rsp), %eax
leal 0x1(,%rax,4), %eax
imull 0x10(%rsp), %eax
movq 0x38(%rsp), %rsi
movq 0x110(%rsp), %rcx
cltq
cvtss2sd 0x24(%rcx,%rax,4), %xmm0
leaq 0x876a(%rip), %rdi      # 0xc2ba
pushq $0x9
popq %rdx
pushq $0x1
popq %rcx
pushq $0x4
popq %r8
movb $0x1, %al
callq 0x3040
andq $0x0, 0xf0(%rsp)
xorps %xmm0, %xmm0
andq $0x0, 0xd0(%rsp)
movaps %xmm0, 0xe0(%rsp)
andq $0x0, 0x130(%rsp)
movaps %xmm0, 0xc0(%rsp)
movaps %xmm0, 0x120(%rsp)
xorpd %xmm2, %xmm2
cmpq $0x3, %rbx
je 0x3c5e
movq 0x100(%rsp,%rbx,8), %rax
movsd 0xe0(%rsp,%rbx,8), %xmm3
movsd 0xc0(%rsp,%rbx,8), %xmm0
xorl %ecx, %ecx
cmpq $0x40000, %rcx          # imm = 0x40000
je 0x3be0
cvtss2sd (%rax,%rcx,4), %xmm1
addsd %xmm1, %xmm3
mulsd %xmm1, %xmm1
addsd %xmm1, %xmm0
incq %rcx
jmp 0x3bc1
movsd %xmm0, 0xc0(%rsp,%rbx,8)
movsd 0x845f(%rip), %xmm1     # 0xc050
mulsd %xmm1, %xmm3
movsd %xmm3, 0xe0(%rsp,%rbx,8)
mulsd %xmm1, %xmm0
ucomisd %xmm2, %xmm0
jb 0x3c0e
sqrtsd %xmm0, %xmm0
jmp 0x3c23
movsd %xmm3, 0x8(%rsp)
callq 0x3200
movsd 0x8(%rsp), %xmm3
xorpd %xmm2, %xmm2
movsd %xmm0, 0xc0(%rsp,%rbx,8)
mulsd %xmm3, %xmm3
mulsd %xmm0, %xmm0
subsd %xmm3, %xmm0
ucomisd %xmm2, %xmm0
jb 0x3c44
sqrtsd %xmm0, %xmm0
jmp 0x3c4d
callq 0x3200
xorpd %xmm2, %xmm2
movsd %xmm0, 0x120(%rsp,%rbx,8)
incq %rbx
jmp 0x3b9b
movq 0x38(%rsp), %rsi
movsd 0xe0(%rsp), %xmm0
movsd 0xe8(%rsp), %xmm1
movsd 0xf0(%rsp), %xmm2
leaq 0x86b9(%rip), %rdi      # 0xc33e
movb $0x3, %al
callq 0x3040
movq 0x38(%rsp), %rsi
movsd 0xc0(%rsp), %xmm0
movsd 0xc8(%rsp), %xmm1
movsd 0xd0(%rsp), %xmm2
leaq 0x86bf(%rip), %rdi      # 0xc372
movb $0x3, %al
callq 0x3040
movq 0x38(%rsp), %rsi
movsd 0x120(%rsp), %xmm0
movsd %xmm0, 0x58(%rsp)
movsd 0x128(%rsp), %xmm1
movsd %xmm1, 0x138(%rsp)
movsd 0x130(%rsp), %xmm2
movsd %xmm2, 0x8(%rsp)
leaq 0x86b0(%rip), %rdi      # 0xc3a6
movb $0x3, %al
callq 0x3040
movq 0x38(%rsp), %rsi
movsd 0x138(%rsp), %xmm1
mulsd %xmm1, %xmm1
movsd 0x58(%rsp), %xmm0
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
movsd 0x8(%rsp), %xmm1
mulsd %xmm1, %xmm1
addsd %xmm0, %xmm1
sqrtsd %xmm1, %xmm0
leaq 0x86a4(%rip), %rdi      # 0xc3da
movb $0x1, %al
callq 0x3040
movq 0x38(%rsp), %rsi
leaq 0x86bd(%rip), %rdi      # 0xc406
leaq 0x872b(%rip), %rdx      # 0xc47b
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x3040
cmpq $0x3, %rbx
je 0x3d7f
movq 0x100(%rsp,%rbx,8), %rdi
testq %rdi, %rdi
je 0x3d71
callq 0x3350
andq $0x0, 0x100(%rsp,%rbx,8)
incq %rbx
jmp 0x3d59
leaq 0x1a0(%rsp), %rdi
callq 0x46b4
leaq 0x140(%rsp), %rdi
callq 0x3120
leaq 0x38(%rsp), %rdi
callq 0x3120
xorl %eax, %eax
addq $0x3d8, %rsp            # imm = 0x3D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3dde
jmp 0x3df2
movq %rax, %rbx
leaq 0x160(%rsp), %rdi
jmp 0x3dd5
jmp 0x3dde
movq %rax, %rbx
leaq 0x180(%rsp), %rdi
callq 0x3120
jmp 0x3df5
jmp 0x3df2
movq %rax, %rbx
jmp 0x3e02
movq %rax, %rbx
jmp 0x3e0f
jmp 0x3df2
jmp 0x3df2
jmp 0x3df2
jmp 0x3df2
jmp 0x3df2
movq %rax, %rbx
leaq 0x1a0(%rsp), %rdi
callq 0x46b4
leaq 0x140(%rsp), %rdi
callq 0x3120
leaq 0x38(%rsp), %rdi
callq 0x3120
movq %rbx, %rdi
callq 0x3470
nop