// File: Luthaf[P]zeopp/grid.cc
// Function: generateBOVGrid(ATOM_NETWORK*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void generateBOVGrid(ATOM_NETWORK *atmnet, string name_f_dist, string name_g_dist, string name_h_dist, string name_f_bov, string name_g_bov, string name_h_bov) {

//-----declare large 3D array as a 3D pointer (i.e., ***) - we have to declare it as pointers otherwise we cannot declare an arbitrarily large grid - but if the grid is too large, you may not have enough RAM to store it, so watch the system monitor!
  double ***grid_distance;

//-----set the extent of the grid. If we know coordinate H (i.e. the coordinate in the abc plane that has all non-0 coordinates) we will know the maximum extent. 
//For my purposes, I defined a cube in terms of corners. A, B, and C correspond to defined unit cell vectors.
//D is the bottom corner between the B and C axes. E is the top corner between the A and C axes.
//F is the top corner between the B and C axes. G is the outermost corner. The innermost corner is simply (0, 0, 0).

  double origin_x = 0; 
  double origin_y = 0; 
  double origin_z = 0; 
  double Ax  = atmnet->v_a.x;
  double Bx = atmnet->v_b.x;
  double By  = atmnet->v_b.y;
  double Cx = atmnet->v_c.x;
  double Cy = atmnet->v_c.y;
  double Cz  = atmnet->v_c.z;

  double Dx = Ax + Bx; double Dy = By; double Dz = 0;
  double Ex = Ax + Cx; double Ey = Cy; double Ez = Cz;
  double Fx = Bx + Cx; double Fy = Cy; double Fz = Cz;
  double Gx = Ax + Bx + Cx; double Gy = By + Cy; double Gz = Cz;

  vector <double> xCoords;
  xCoords.push_back(origin_x); xCoords.push_back(Ax); xCoords.push_back(Bx); xCoords.push_back(Cx); xCoords.push_back(Dx); xCoords.push_back(Ex); xCoords.push_back(Fx); xCoords.push_back(Gx);
  vector <double> yCoords;
  yCoords.push_back(origin_y);yCoords.push_back(By); yCoords.push_back(Cy); yCoords.push_back(Gy);
	vector <double> zCoords;
	zCoords.push_back(origin_y); zCoords.push_back(Cz);

  double xMin = 1000; double xMax = 0;
  for (int a=0; a<xCoords.size(); a++){
    xMin = min(xMin, xCoords.at(a));
    xMax = max(xMax, xCoords.at(a));
  }

  double yMin = 1000; double yMax = 0;
  for (int b=0; b<yCoords.size(); b++){
    yMin = min(yMin, yCoords.at(b));
    yMax = max(yMax, yCoords.at(b));
  }
  double zMin = 1000; double zMax = 0;
  for (int c=0; c<zCoords.size(); c++){
    zMin = min(zMin, zCoords.at(c));
    zMax = max(zMax, zCoords.at(c));
  }

  double XGridDist = xMax - xMin; double YGridDist = yMax - yMin; double ZGridDist = zMax - zMin;


//-----set size that grid will take, i.e. the number of grid points in each dimension
  
  double tempXgrid = XGridDist/GRIDRES; double tempYgrid = YGridDist/GRIDRES; double tempZgrid = ZGridDist/GRIDRES;

  int x_grid_steps = ceil(tempXgrid);
  int y_grid_steps = ceil(tempYgrid); 
  int z_grid_steps = ceil(tempZgrid);

  double shiftInX = x_grid_steps - tempXgrid;
  double shiftInY = y_grid_steps - tempYgrid;
  double shiftInZ = z_grid_steps - tempZgrid;

  double xGridRes = XGridDist/x_grid_steps; double yGridRes = YGridDist/y_grid_steps; double zGridRes = ZGridDist/z_grid_steps;

  x_grid_steps++;
  y_grid_steps++;
  z_grid_steps++;

//-----create large 3D array
  printf("Declaring 3D array.\n\n");
	grid_distance = new double**[x_grid_steps];
	for(int i=0; i<x_grid_steps; i++) {
		grid_distance[i] = new double*[y_grid_steps];
		for(int j=0; j<y_grid_steps; j++) {
			grid_distance[i][j] = new double[z_grid_steps];
		}
	}

//-----fill it with values for the F function
  printf("Filling 3D array F with values.\n\n");
	for(int i=0; i<x_grid_steps; i++) {
		for(int j=0; j<y_grid_steps; j++) {
			for(int k=0; k<z_grid_steps; k++) {
				grid_distance[i][j][k] = calculate_distance_function(atmnet, i,j,k, xMin, yMin, 0, xGridRes, yGridRes, zGridRes, x_grid_steps, y_grid_steps, z_grid_steps, 'f'); 
			}
		}
	}

//-----Print structure_f.distances and structure_f.bov
  printf("Printing F grid.\n\n");
  FILE *file_distances_f, *file_bov_f; 
  char* distance_filename_f = new char [100];
  strcpy(distance_filename_f, name_f_dist.c_str()); 
  file_distances_f = fopen(distance_filename_f,"w");
  write_distances(file_distances_f, grid_distance, x_grid_steps, y_grid_steps, z_grid_steps);
  fclose(file_distances_f); 
  char* bov_filename_f = new char [100];
  strcpy(bov_filename_f, name_f_bov.c_str()); 
  file_bov_f = fopen(bov_filename_f,"w");
  write_bov(file_bov_f, distance_filename_f, x_grid_steps, y_grid_steps, z_grid_steps, xMin, yMin, zMin, XGridDist, YGridDist, ZGridDist);
  fclose(file_bov_f);

//-----fill it with values for the G function
/*
  printf("Filling 3D array G with values.\n\n");
	for(int i=0; i<x_grid_steps; i++) {
		for(int j=0; j<y_grid_steps; j++) {
			for(int k=0; k<z_grid_steps; k++) {
				grid_distance[i][j][k] = calculate_distance_function(atmnet, i,j,k, xMin, yMin, 0, xGridRes, yGridRes, zGridRes, x_grid_steps, y_grid_steps, z_grid_steps, 'g'); 
			}
		}
	}

//-----Print structure_g.distances and structure_g.bov
  printf("Printing G grid.\n\n");
  FILE *file_distances_g, *file_bov_g; 
  char* distance_filename_g = new char [100];
  strcpy(distance_filename_g, name_g_dist.c_str()); 
  file_distances_g = fopen(distance_filename_g,"w");
  write_distances(file_distances_g, grid_distance, x_grid_steps, y_grid_steps, z_grid_steps);
  fclose(file_distances_g); 
  char* bov_filename_g = new char [100];
  strcpy(bov_filename_g, name_g_bov.c_str()); 
  file_bov_g = fopen(bov_filename_g,"w");
  write_bov(file_bov_g, distance_filename_g, x_grid_steps, y_grid_steps, z_grid_steps, xMin, yMin, zMin, XGridDist, YGridDist, ZGridDist);
  fclose(file_bov_g);
*/


//-----fill it with values for the H function
/*
  printf("Filling 3D array H with values.\n\n");
	for(int i=0; i<x_grid_steps; i++) {
		for(int j=0; j<y_grid_steps; j++) {
			for(int k=0; k<z_grid_steps; k++) {
				grid_distance[i][j][k] = calculate_distance_function(atmnet, i,j,k, xMin, yMin, 0, xGridRes, yGridRes, zGridRes, x_grid_steps, y_grid_steps, z_grid_steps, 'h'); 
			}
		}
	}


//-----Print structure_h.distances and structure_h.bov

  printf("Printing H grid.\n\n");
  FILE *file_distances_h, *file_bov_h; 
  char* distance_filename_h = new char [100];
  strcpy(distance_filename_h, name_h_dist.c_str()); 
  file_distances_h = fopen(distance_filename_h,"w");
  write_distances(file_distances_h, grid_distance, x_grid_steps, y_grid_steps, z_grid_steps);
  fclose(file_distances_h); 
  char* bov_filename_h = new char [100];
  strcpy(bov_filename_h, name_h_bov.c_str()); 
  file_bov_h = fopen(bov_filename_h,"w");
  write_bov(file_bov_h, distance_filename_h, x_grid_steps, y_grid_steps, z_grid_steps, xMin, yMin, zMin, XGridDist, YGridDist, ZGridDist);
  fclose(file_bov_h);
*/


//-----free memory!
  printf("Freeing memory.\n\n");
	for(int i=0; i<x_grid_steps; i++) {
		for(int j=0; j<y_grid_steps; j++) {
			delete[] grid_distance[i][j];
		}
    delete[] grid_distance[i];
	}
  delete[] grid_distance; //important to have one "delete[]" per "new"
  delete[] distance_filename_f;
  //delete[] distance_filename_g;
  //delete[] distance_filename_h;
  delete[] bov_filename_f;
  //delete[] bov_filename_g;
  //delete[] bov_filename_h;

//---end successfully
  printf("Program complete.\n\n");


}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x360, %rsp            # imm = 0x360
movq %r8, -0x248(%rbp)
movq %rsi, -0x240(%rbp)
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq $0x0, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movq $0x0, -0x50(%rbp)
movq -0x8(%rbp), %rax
movsd 0x38(%rax), %xmm0
movsd %xmm0, -0x58(%rbp)
movq -0x8(%rbp), %rax
movsd 0x50(%rax), %xmm0
movsd %xmm0, -0x60(%rbp)
movq -0x8(%rbp), %rax
movsd 0x58(%rax), %xmm0
movsd %xmm0, -0x68(%rbp)
movq -0x8(%rbp), %rax
movsd 0x68(%rax), %xmm0
movsd %xmm0, -0x70(%rbp)
movq -0x8(%rbp), %rax
movsd 0x70(%rax), %xmm0
movsd %xmm0, -0x78(%rbp)
movq -0x8(%rbp), %rax
movsd 0x78(%rax), %xmm0
movsd %xmm0, -0x80(%rbp)
movsd -0x58(%rbp), %xmm0
movsd -0x60(%rbp), %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, -0x88(%rbp)
movsd -0x68(%rbp), %xmm0
movsd %xmm0, -0x90(%rbp)
movq $0x0, -0x98(%rbp)
movsd -0x58(%rbp), %xmm0
movsd -0x70(%rbp), %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, -0xa0(%rbp)
movsd -0x78(%rbp), %xmm0
movsd %xmm0, -0xa8(%rbp)
movsd -0x80(%rbp), %xmm0
movsd %xmm0, -0xb0(%rbp)
movsd -0x60(%rbp), %xmm0
movsd -0x70(%rbp), %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, -0xb8(%rbp)
movsd -0x78(%rbp), %xmm0
movsd %xmm0, -0xc0(%rbp)
movsd -0x80(%rbp), %xmm0
movsd %xmm0, -0xc8(%rbp)
movsd -0x58(%rbp), %xmm0
movsd -0x60(%rbp), %xmm1
addsd %xmm1, %xmm0
movsd -0x70(%rbp), %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, -0xd0(%rbp)
movsd -0x68(%rbp), %xmm0
movsd -0x78(%rbp), %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, -0xd8(%rbp)
movsd -0x80(%rbp), %xmm0
movsd %xmm0, -0xe0(%rbp)
leaq -0xf8(%rbp), %rdi
movq %rdi, -0x238(%rbp)
callq 0xf650
movq -0x238(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x105c0
jmp 0xefc66
leaq -0xf8(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x105c0
jmp 0xefc78
leaq -0xf8(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x105c0
jmp 0xefc8a
leaq -0xf8(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x105c0
jmp 0xefc9c
leaq -0xf8(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x105c0
jmp 0xefcb1
leaq -0xf8(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x105c0
jmp 0xefcc6
leaq -0xf8(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x105c0
jmp 0xefcdb
leaq -0xf8(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x105c0
jmp 0xefcf0
leaq -0x120(%rbp), %rdi
movq %rdi, -0x250(%rbp)
callq 0xf650
movq -0x250(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x105c0
jmp 0xefd15
leaq -0x120(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x105c0
jmp 0xefd27
leaq -0x120(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x105c0
jmp 0xefd39
leaq -0x120(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x105c0
jmp 0xefd4e
leaq -0x138(%rbp), %rdi
movq %rdi, -0x258(%rbp)
callq 0xf650
movq -0x258(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x105c0
jmp 0xefd73
leaq -0x138(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x105c0
jmp 0xefd85
movsd 0x107b1b(%rip), %xmm0   # 0x1f78a8
movsd %xmm0, -0x140(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x148(%rbp)
movl $0x0, -0x14c(%rbp)
movslq -0x14c(%rbp), %rax
movq %rax, -0x260(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0xf990
movq %rax, %rcx
movq -0x260(%rbp), %rax
cmpq %rcx, %rax
jae 0xefed2
movslq -0x14c(%rbp), %rsi
leaq -0xf8(%rbp), %rdi
callq 0xfc80
movq %rax, -0x268(%rbp)
jmp 0xefdf3
movq -0x268(%rbp), %rsi
leaq -0x140(%rbp), %rdi
callq 0x64f50
movq %rax, -0x270(%rbp)
jmp 0xefe0f
movq -0x270(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x140(%rbp)
movslq -0x14c(%rbp), %rsi
leaq -0xf8(%rbp), %rdi
callq 0xfc80
movq %rax, -0x278(%rbp)
jmp 0xefe3e
movq -0x278(%rbp), %rsi
leaq -0x148(%rbp), %rdi
callq 0x64c70
movq %rax, -0x280(%rbp)
jmp 0xefe5a
movq -0x280(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x148(%rbp)
movl -0x14c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14c(%rbp)
jmp 0xefdaa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x100(%rbp)
movl %eax, -0x104(%rbp)
jmp 0xf07ea
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x100(%rbp)
movl %eax, -0x104(%rbp)
jmp 0xf07de
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x100(%rbp)
movl %eax, -0x104(%rbp)
leaq -0x138(%rbp), %rdi
callq 0xf9d0
jmp 0xf07de
movsd 0x1079ce(%rip), %xmm0   # 0x1f78a8
movsd %xmm0, -0x158(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x160(%rbp)
movl $0x0, -0x164(%rbp)
movslq -0x164(%rbp), %rax
movq %rax, -0x288(%rbp)
leaq -0x120(%rbp), %rdi
callq 0xf990
movq %rax, %rcx
movq -0x288(%rbp), %rax
cmpq %rcx, %rax
jae 0xeffce
movslq -0x164(%rbp), %rsi
leaq -0x120(%rbp), %rdi
callq 0xfc80
movq %rax, -0x290(%rbp)
jmp 0xeff40
movq -0x290(%rbp), %rsi
leaq -0x158(%rbp), %rdi
callq 0x64f50
movq %rax, -0x298(%rbp)
jmp 0xeff5c
movq -0x298(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x158(%rbp)
movslq -0x164(%rbp), %rsi
leaq -0x120(%rbp), %rdi
callq 0xfc80
movq %rax, -0x2a0(%rbp)
jmp 0xeff8b
movq -0x2a0(%rbp), %rsi
leaq -0x160(%rbp), %rdi
callq 0x64c70
movq %rax, -0x2a8(%rbp)
jmp 0xeffa7
movq -0x2a8(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x160(%rbp)
movl -0x164(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x164(%rbp)
jmp 0xefef7
movsd 0x1078d2(%rip), %xmm0   # 0x1f78a8
movsd %xmm0, -0x170(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x178(%rbp)
movl $0x0, -0x17c(%rbp)
movslq -0x17c(%rbp), %rax
movq %rax, -0x2b0(%rbp)
leaq -0x138(%rbp), %rdi
callq 0xf990
movq %rax, %rcx
movq -0x2b0(%rbp), %rax
cmpq %rcx, %rax
jae 0xf00ca
movslq -0x17c(%rbp), %rsi
leaq -0x138(%rbp), %rdi
callq 0xfc80
movq %rax, -0x2b8(%rbp)
jmp 0xf003c
movq -0x2b8(%rbp), %rsi
leaq -0x170(%rbp), %rdi
callq 0x64f50
movq %rax, -0x2c0(%rbp)
jmp 0xf0058
movq -0x2c0(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x170(%rbp)
movslq -0x17c(%rbp), %rsi
leaq -0x138(%rbp), %rdi
callq 0xfc80
movq %rax, -0x2c8(%rbp)
jmp 0xf0087
movq -0x2c8(%rbp), %rsi
leaq -0x178(%rbp), %rdi
callq 0x64c70
movq %rax, -0x2d0(%rbp)
jmp 0xf00a3
movq -0x2d0(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x178(%rbp)
movl -0x17c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x17c(%rbp)
jmp 0xefff3
movsd -0x148(%rbp), %xmm0
movsd -0x140(%rbp), %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, -0x188(%rbp)
movsd -0x160(%rbp), %xmm0
movsd -0x158(%rbp), %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, -0x190(%rbp)
movsd -0x178(%rbp), %xmm0
movsd -0x170(%rbp), %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, -0x198(%rbp)
movsd -0x188(%rbp), %xmm0
movsd 0x10c2d2(%rip), %xmm1   # 0x1fc400
divsd %xmm1, %xmm0
movsd %xmm0, -0x1a0(%rbp)
movsd -0x190(%rbp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, -0x1a8(%rbp)
movsd -0x198(%rbp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, -0x1b0(%rbp)
movsd -0x1a0(%rbp), %xmm0
callq 0x50e0
cvttsd2si %xmm0, %eax
movl %eax, -0x1b4(%rbp)
movsd -0x1a8(%rbp), %xmm0
callq 0x50e0
cvttsd2si %xmm0, %eax
movl %eax, -0x1b8(%rbp)
movsd -0x1b0(%rbp), %xmm0
callq 0x50e0
cvttsd2si %xmm0, %eax
movl %eax, -0x1bc(%rbp)
cvtsi2sdl -0x1b4(%rbp), %xmm0
movsd -0x1a0(%rbp), %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, -0x1c8(%rbp)
cvtsi2sdl -0x1b8(%rbp), %xmm0
movsd -0x1a8(%rbp), %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, -0x1d0(%rbp)
cvtsi2sdl -0x1bc(%rbp), %xmm0
movsd -0x1b0(%rbp), %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, -0x1d8(%rbp)
movsd -0x188(%rbp), %xmm0
cvtsi2sdl -0x1b4(%rbp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x1e0(%rbp)
movsd -0x190(%rbp), %xmm0
cvtsi2sdl -0x1b8(%rbp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x1e8(%rbp)
movsd -0x198(%rbp), %xmm0
cvtsi2sdl -0x1bc(%rbp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x1f0(%rbp)
movl -0x1b4(%rbp), %eax
incl %eax
movl %eax, -0x1b4(%rbp)
movl -0x1b8(%rbp), %eax
incl %eax
movl %eax, -0x1b8(%rbp)
movl -0x1bc(%rbp), %eax
incl %eax
movl %eax, -0x1bc(%rbp)
leaq 0x10c1b8(%rip), %rdi    # 0x1fc438
xorl %eax, %eax
callq 0x5070
jmp 0xf0289
movslq -0x1b4(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0x5030
movq %rax, -0x2d8(%rbp)
jmp 0xf02b4
movq -0x2d8(%rbp), %rax
movq %rax, -0x38(%rbp)
movl $0x0, -0x1f4(%rbp)
movl -0x1f4(%rbp), %eax
cmpl -0x1b4(%rbp), %eax
jge 0xf03a7
movslq -0x1b8(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0x5030
movq %rax, -0x2e0(%rbp)
jmp 0xf0306
movq -0x2e0(%rbp), %rdx
movq -0x38(%rbp), %rax
movslq -0x1f4(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl $0x0, -0x1f8(%rbp)
movl -0x1f8(%rbp), %eax
cmpl -0x1b8(%rbp), %eax
jge 0xf0391
movslq -0x1bc(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0x5030
movq %rax, -0x2e8(%rbp)
jmp 0xf035f
movq -0x2e8(%rbp), %rdx
movq -0x38(%rbp), %rax
movslq -0x1f4(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x1f8(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x1f8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1f8(%rbp)
jmp 0xf0326
jmp 0xf0393
movl -0x1f4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1f4(%rbp)
jmp 0xf02c9
leaq 0x10c0a0(%rip), %rdi    # 0x1fc44e
xorl %eax, %eax
callq 0x5070
jmp 0xf03b7
movl $0x0, -0x1fc(%rbp)
movl -0x1fc(%rbp), %eax
cmpl -0x1b4(%rbp), %eax
jge 0xf04eb
movl $0x0, -0x200(%rbp)
movl -0x200(%rbp), %eax
cmpl -0x1b8(%rbp), %eax
jge 0xf04d5
movl $0x0, -0x204(%rbp)
movl -0x204(%rbp), %eax
cmpl -0x1bc(%rbp), %eax
jge 0xf04bf
movq -0x8(%rbp), %rdi
movl -0x1fc(%rbp), %esi
movl -0x200(%rbp), %edx
movl -0x204(%rbp), %ecx
movsd -0x140(%rbp), %xmm0
movsd -0x158(%rbp), %xmm1
movsd -0x1e0(%rbp), %xmm3
movsd -0x1e8(%rbp), %xmm4
movsd -0x1f0(%rbp), %xmm5
movl -0x1b4(%rbp), %r8d
movl -0x1b8(%rbp), %r9d
movl -0x1bc(%rbp), %r10d
movq %rsp, %rax
movl %r10d, (%rax)
movl $0x66, 0x8(%rax)
xorps %xmm2, %xmm2
callq 0xf0810
movsd %xmm0, -0x2f0(%rbp)
jmp 0xf047d
movsd -0x2f0(%rbp), %xmm0
movq -0x38(%rbp), %rax
movslq -0x1fc(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x200(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x204(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x204(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x204(%rbp)
jmp 0xf03f9
jmp 0xf04c1
movl -0x200(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x200(%rbp)
jmp 0xf03dd
jmp 0xf04d7
movl -0x1fc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1fc(%rbp)
jmp 0xf03c1
leaq 0x10bf7e(%rip), %rdi    # 0x1fc470
xorl %eax, %eax
callq 0x5070
jmp 0xf04fb
movl $0x64, %edi
callq 0x5030
movq %rax, -0x2f8(%rbp)
jmp 0xf050e
movq -0x240(%rbp), %rdi
movq -0x2f8(%rbp), %rax
movq %rax, -0x220(%rbp)
movq -0x220(%rbp), %rax
movq %rax, -0x308(%rbp)
callq 0x5200
movq -0x308(%rbp), %rdi
movq %rax, %rsi
callq 0x54d0
movq -0x220(%rbp), %rdi
leaq 0x1066c1(%rip), %rsi    # 0x1f6c14
callq 0x5650
movq %rax, -0x300(%rbp)
jmp 0xf0561
movq -0x300(%rbp), %rax
movq %rax, -0x210(%rbp)
movq -0x210(%rbp), %rdi
movq -0x38(%rbp), %rsi
movl -0x1b4(%rbp), %edx
movl -0x1b8(%rbp), %ecx
movl -0x1bc(%rbp), %r8d
callq 0xf0c00
jmp 0xf0594
movq -0x210(%rbp), %rdi
callq 0x5550
jmp 0xf05a2
movl $0x64, %edi
callq 0x5030
movq %rax, -0x310(%rbp)
jmp 0xf05b5
movq -0x248(%rbp), %rdi
movq -0x310(%rbp), %rax
movq %rax, -0x228(%rbp)
movq -0x228(%rbp), %rax
movq %rax, -0x320(%rbp)
callq 0x5200
movq -0x320(%rbp), %rdi
movq %rax, %rsi
callq 0x54d0
movq -0x228(%rbp), %rdi
leaq 0x10661a(%rip), %rsi    # 0x1f6c14
callq 0x5650
movq %rax, -0x318(%rbp)
jmp 0xf0608
movq -0x318(%rbp), %rax
movq %rax, -0x218(%rbp)
movq -0x218(%rbp), %rdi
movq -0x220(%rbp), %rsi
movl -0x1b4(%rbp), %edx
movl -0x1b8(%rbp), %ecx
movl -0x1bc(%rbp), %r8d
movsd -0x140(%rbp), %xmm0
movsd -0x158(%rbp), %xmm1
movsd -0x170(%rbp), %xmm2
movsd -0x188(%rbp), %xmm3
movsd -0x190(%rbp), %xmm4
movsd -0x198(%rbp), %xmm5
callq 0xf0d10
jmp 0xf066e
movq -0x218(%rbp), %rdi
callq 0x5550
jmp 0xf067c
leaq 0x10be00(%rip), %rdi    # 0x1fc483
xorl %eax, %eax
callq 0x5070
jmp 0xf068c
movl $0x0, -0x22c(%rbp)
movl -0x22c(%rbp), %eax
cmpl -0x1b4(%rbp), %eax
jge 0xf0744
movl $0x0, -0x230(%rbp)
movl -0x230(%rbp), %eax
cmpl -0x1b8(%rbp), %eax
jge 0xf0706
movq -0x38(%rbp), %rax
movslq -0x22c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x230(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x328(%rbp)
cmpq $0x0, %rax
je 0xf06f3
movq -0x328(%rbp), %rdi
callq 0x56c0
jmp 0xf06f5
movl -0x230(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x230(%rbp)
jmp 0xf06b2
movq -0x38(%rbp), %rax
movslq -0x22c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x330(%rbp)
cmpq $0x0, %rax
je 0xf072e
movq -0x330(%rbp), %rdi
callq 0x56c0
jmp 0xf0730
movl -0x22c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x22c(%rbp)
jmp 0xf0696
movq -0x38(%rbp), %rax
movq %rax, -0x338(%rbp)
cmpq $0x0, %rax
je 0xf0761
movq -0x338(%rbp), %rdi
callq 0x56c0
movq -0x220(%rbp), %rax
movq %rax, -0x340(%rbp)
cmpq $0x0, %rax
je 0xf0781
movq -0x340(%rbp), %rdi
callq 0x56c0
movq -0x228(%rbp), %rax
movq %rax, -0x348(%rbp)
cmpq $0x0, %rax
je 0xf07a1
movq -0x348(%rbp), %rdi
callq 0x56c0
leaq 0x10bced(%rip), %rdi    # 0x1fc495
xorl %eax, %eax
callq 0x5070
jmp 0xf07b1
leaq -0x138(%rbp), %rdi
callq 0xf9d0
leaq -0x120(%rbp), %rdi
callq 0xf9d0
leaq -0xf8(%rbp), %rdi
callq 0xf9d0
addq $0x360, %rsp            # imm = 0x360
popq %rbp
retq
leaq -0x120(%rbp), %rdi
callq 0xf9d0
leaq -0xf8(%rbp), %rdi
callq 0xf9d0
movq -0x100(%rbp), %rdi
callq 0x58f0
nopw %cs:(%rax,%rax)