////////////////////////////////////////////////////////////////////////////////
// utilities
////////////////////////////////////////////////////////////////////////////////

#include <limits.h>  // INT_MIN
#include <math.h>    // sqrt
#include <stdlib.h>  // abs, atoi
#include <sys/time.h>
#include <time.h>
#include <fstream>
#include <iomanip>
#include <iostream>

using namespace std;

typedef unsigned short int usint;
typedef unsigned long long int ullint;

void die(const char *msg) {
  cout << "ERROR: " << msg << endl;
  exit(1);
}

#define RANDOM_MAX 0x7fffffff  // 2^31 - 1

__device__ int random(const int seed) {
  // glibc: m = 2^31; a = 1103515245; c = 12345
  return (int)((1103515245U * ((unsigned)seed & 0x7fffffffU) + 12345U) &
               0x7fffffffU);
}

template <class C>
__device__ C sign(const C x) {
  return x < 0 ? -1 : (x == 0 ? 0 : 1);
}

template <class C>
__host__ __device__ C square(const C x) {
  return x * x;
}

inline double calc_time(struct timeval &begin, struct timeval &end) {
  return ((end.tv_sec - begin.tv_sec) * 1000000u +
          end.tv_usec - begin.tv_usec) / 1e6;
}

////////////////////////////////////////////////////////////////////////////////
// vix
////////////////////////////////////////////////////////////////////////////////

__device__ int test_one_target(const int nrows, const usint *elevs,
                               const int ox, const int oy, const int oz,
                               const int tx, const int ty, const int tz) {
  if (abs(ox - tx) <= 1 && abs(oy - ty) <= 1) return 1;
  int dx = tx - ox, dy = ty - oy;
  int px, py, pz;  // Current point
  int inciny = abs(dx) < abs(dy);
  int sign;
  float slope, zslope;
  sign = (inciny*dy + (1-inciny)*dx) > 0 ? 1 : -1;
  slope = (float)(inciny*dx + (1-inciny)*dy) / (inciny*dy + (1-inciny)*dx);
  zslope = (float)(tz - oz) / (inciny ? dy : dx);
  const int limit = inciny ? dy : dx;
  int stride = 1;
  for (int i = sign; abs(i) < abs(limit); i += stride*sign, stride <<= 1) {  // *= 1.9, 2.2, 2.5
    int j = round(i * slope);
    px = ox + (inciny*j + (1-inciny)*i);
    py = oy + (inciny*i + (1-inciny)*j);
    pz = elevs[px * nrows + py];
    if (pz > oz + i * zslope) return 0;
  }
  return 1;
}

__global__ void calc_one_vix(const int nrows, const usint *elevs,
                             const int roi, const int oht, const int tht,
                             const int ntests, unsigned char *vix) {
  const int bid = blockIdx.y * gridDim.x + blockIdx.x;
  const int tid = bid * blockDim.x + threadIdx.x;
  if (tid >= square(nrows)) return;

  const int ox = tid / nrows;
  const int oy = tid % nrows;
  const int oz = elevs[ox * nrows + oy] + oht;
  int ntarget = 0;
  int nvis = 0;
  const int vsxmax = min(nrows - 1, ox + roi);  // viewshed bounds
  const int vsymax = min(nrows - 1, oy + roi);
  const int vsxmin = max(0, ox - roi);
  const int vsymin = max(0, oy - roi);
  int r = tid;
  // for (int i = 0; i < 10 * ntests; i++) {  // iterate over random targets
  while (ntarget < ntests) {
    int tx, ty, tz;
    int visq;
    r = random(r);
    //tx = (int)(r * (vsxmax - vsxmin + 0.99999f) / RANDOM_MAX) + vsxmin;
    tx = (int)((2*roi+0.99999f)*r/RANDOM_MAX) + (ox-roi);
    r = random(r);
    //ty = (int)(r * (vsymax - vsymin + 0.99999f) / RANDOM_MAX) + vsymin;
    ty = (int)((2*roi+0.99999f)*r/RANDOM_MAX) + (oy-roi);
    // if (tx == 0 && ty == 0) continue;
    if (square(tx - ox) + square(ty - oy) > square(roi)) {
      tx = ox + (tx - ox)/3; // golden
      ty = oy + (ty - oy)/3;
      //continue; // too slow
    }
    if (tx >=0 && tx < nrows && ty >= 0 && ty < nrows) {
        tz = elevs[tx * nrows + ty] + tht;
        visq = test_one_target(nrows, elevs, ox, oy, oz, tx, ty, tz);
        // cout << "test_one_target(" << ox << ',' << oy << ',' << tx << ',' << ty << ")=" << visq << endl;
    } else {
        visq = 0;
    }
    ntarget++;
    if (visq) nvis++;

    // Stopping rule: do at least 10 points.
    // Then, continue until vix >= .5 or <= .1.
    // This could be improved by using the variance, and by looking at
    // other observers, to select the best.

    // if (ntarget >= ntests) break;
    // if (ntarget < 10) continue;
    // if (v >= 0.5 || v <= 0.1) break;
  }
  float v = (float)nvis / ntarget;
  // cout << "obs at (" << ox << ',' << oy << "), z=" << elevs[ox * nrows + oy] 
  //      << ", vix=" << nvis << '/' << ntarget << '=' << v << endl;
  vix[ox * nrows + oy] = (unsigned char)min(255, (int)(v * 255.999f));
}

void calc_vix(const int nrows, const usint *h_elevs,
              const int roi, const int oht, const int tht,
              const int ntests, unsigned char *h_vix) {
  usint *d_elevs;
  unsigned char *d_vix;

  if (cudaMalloc((void **)&d_elevs, square(nrows) * sizeof(usint)) != cudaSuccess)
    die("cudaMalloc failed");
  if (cudaMalloc((void **)&d_vix, square(nrows) * sizeof(unsigned char)) != cudaSuccess)
    die("cudaMalloc failed");
  if (cudaMemcpy(d_elevs, h_elevs, square(nrows) * sizeof(usint), cudaMemcpyHostToDevice) != cudaSuccess)
    die("cudaMemcpy failed");

  const size_t dimblock = 128;
  // const size_t dimgrid = square(nrows) / dimblock + (square(nrows) % dimblock ? 1 : 0);
  int s = (int)sqrt(square(nrows) / dimblock);
  if (square(s) * dimblock < square(nrows)) s++;
  const dim3 dimgrid(s, s);
  calc_one_vix<<<dimgrid, dimblock>>>(nrows, d_elevs, roi, oht, tht, ntests, d_vix);

  if (cudaMemcpy(h_vix, d_vix, square(nrows) * sizeof(unsigned char), cudaMemcpyDeviceToHost) != cudaSuccess)
    die("cudaMemcpy failed");

  if (cudaFree(d_elevs) != cudaSuccess) die("cudaFree failed");
  if (cudaFree(d_vix) != cudaSuccess) die("cudaFree failed");
}

////////////////////////////////////////////////////////////////////////////////
// findmax
////////////////////////////////////////////////////////////////////////////////

__global__ void process_one_block(const int nrows, unsigned char *vix,
                                  const float blocksize, const int nblockrows,
                                  const int nwantedperblock, int *obs) {
  // no need for if (blockIdx.x >= square(nblockrows)) return;
  extern __shared__ int results[];
  __shared__ int xmin, xmax, ymin, ymax;
  if (threadIdx.x == 0) {
    int bx = blockIdx.x / nblockrows;
    int by = blockIdx.x % nblockrows;
    xmin = (int)(blocksize * bx);
    xmax = min((int)(blocksize * (bx + 1)), nrows);
    ymin = (int)(blocksize * by);
    ymax = min((int)(blocksize * (by + 1)), nrows);
  }
  __syncthreads();

  const int width = ymax - ymin;
  const int npoints = (xmax - xmin) * (ymax - ymin);
  const int npointsperthread = npoints / blockDim.x + (npoints % blockDim.x ? 1 : 0);
  for (int i = 0; i < nwantedperblock; i++) {
    int t = threadIdx.x * npointsperthread;  // the first point, probably used
    int p1x = xmin + t / width;
    int p1y = ymin + t % width;
    unsigned char v1 = vix[p1x * nrows + p1y];
    int h1 = p1x * (p1x + p1y) * 010101010101;
    for (int j = t + 1; j < t + npointsperthread && j < npoints; j++) {
      int p2x = xmin + j / width;
      int p2y = ymin + j % width;
      unsigned char v2 = vix[p2x * nrows + p2y];
      int h2 = p2x * (p2x + p2y) * 010101010101;
      if (v1 < v2 || (v1 == v2 && h1 < h2)) {
        p1x = p2x;
        p1y = p2y;
        v1 = v2;
        h1 = h2;
      }
    }
    results[threadIdx.x * 4] = p1x;
    results[threadIdx.x * 4 + 1] = p1y;
    results[threadIdx.x * 4 + 2] = v1;
    results[threadIdx.x * 4 + 3] = h1;
    if (threadIdx.x == 0) {
      // p1x... is the result of thread 0
      for (int j = 1; j < blockDim.x; j++) {
        int p2x = results[j * 4];
        int p2y = results[j * 4 + 1];
        int v2 = results[j * 4 + 2];
        int h2 = results[j * 4 + 3];
        if (v1 < v2 || (v1 == v2 && h1 < h2)) {
          p1x = p2x;
          p1y = p2y;
          v1 = v2;
          h1 = h2;
        }
      }
      obs[blockIdx.x * nwantedperblock + i] = p1x*nrows + p1y;
      vix[p1x * nrows + p1y] = 0;  // used
    }
    __syncthreads();
  }
}

void find_max(const int nrows, const unsigned char *h_vix,
              const float blocksize, const int nwanted, const int nblockrows,
              const int nwantedperblock, int *h_obs) {
  unsigned char *d_vix;
  int *d_obs;
  if (cudaMalloc((void **)&d_vix, square(nrows) * sizeof(unsigned char)) != cudaSuccess)
    die("cudaMalloc failed");
  if (cudaMalloc((void **)&d_obs, nwanted * sizeof(int)) != cudaSuccess)
    die("cudaMalloc failed");
  if (cudaMemcpy(d_vix, h_vix, square(nrows) * sizeof(unsigned char), cudaMemcpyHostToDevice) != cudaSuccess)
    die("cudaMemcpy failed");

  const size_t dimgrid = square(nblockrows);  // two dimensional
  const size_t dimblock = 256;
  process_one_block<<<dimgrid, dimblock, dimblock * 4 * sizeof(int)>>>(
      nrows, d_vix, blocksize, nblockrows, nwantedperblock, d_obs);

  if (cudaMemcpy(h_obs, d_obs, nwanted * sizeof(int), cudaMemcpyDeviceToHost) != cudaSuccess)
    die("cudaMemcpy failed");

  if (cudaFree(d_vix) != cudaSuccess) die("cudaFree failed");
  if (cudaFree(d_obs) != cudaSuccess) die("cudaFree failed");
}

////////////////////////////////////////////////////////////////////////////////
// viewshed
////////////////////////////////////////////////////////////////////////////////

__device__ void set_vis(const int nwpr, const int row, const int col,
                        ullint *shed) {
  atomicOr(&shed[row * nwpr + col / 64], 1ULL << (63 - col % 64));
}

__global__ void calc_one_shed(const int nrows, const usint *elevs,
                              const int roi, const int oht, const int tht,
                              const int nsheds, const int *obs,
                              ullint *sheds) {
  if (blockIdx.x >= nsheds) return;
  const int nr = 2 * roi + 1;
  const int nwpr = (nr + 63) / 64;
  ullint * const thisshed = &sheds[blockIdx.x * nr * nwpr];
  __shared__ int ox, oy, oz;
  if (threadIdx.x == 0) {
    ox = obs[blockIdx.x]/nrows;
    oy = obs[blockIdx.x]%nrows;
    oz = elevs[ox * nrows + oy] + oht;
    set_vis(nwpr, roi, roi, thisshed);
  }
  __syncthreads();

  // Clipping xmin etc at 0, nrows-1 makes the viewshed depend on the roi, so don't.
  const int xmin = ox - roi;
  const int ymin = oy - roi;
  const int xmax = ox + roi;
  const int ymax = oy + roi;
  const int xwidth = xmax - xmin;
  const int ywidth = ymax - ymin;
  const int perimeter = 2 * (xwidth + ywidth);  // This formula is subtle
  const int ntpt = perimeter / blockDim.x + (perimeter % blockDim.x ? 1 : 0);
  int dx, dy;
  int tx, ty;
  int px, py;  // Current point
  int inciny;
  int sign;
  float slope, zslope;

  const int sector = threadIdx.x;
  for (int ip = sector * ntpt; ip < (sector + 1) * ntpt && ip < perimeter; ip++) {
    if (ip < xwidth) {
      tx = xmin + ip;
      ty = ymin;
    } else if (ip < 2 * xwidth) {
      tx = 1 + xmin - xwidth + ip;
      ty = ymax;
    } else if (ip < 2 * xwidth + ywidth) {
      tx = xmin;
      ty = 1 + ymin - 2 * xwidth + ip;
    } else {
      tx = xmax;
      ty = ymin - 2 * xwidth - ywidth + ip;
    }

    // Run a line of sight out from obs to target.
    dx = tx - ox;
    dy = ty - oy;
    inciny = abs(dx) < abs(dy);
    sign = (inciny*dy + (1-inciny)*dx) > 0 ? 1 : -1;
    slope = (float)(inciny*dx + (1-inciny)*dy) / (inciny*dy + (1-inciny)*dx);
    zslope = -99999.f;

    // i=0 would be the observer, which is always visible.
    for (int i = sign; i != (inciny ? dy : dx) + sign; i += sign) {
      int j = round(i * slope);
      px = ox + (inciny*j + (1-inciny)*i);
      py = oy + (inciny*i + (1-inciny)*j);

      // Have we reached the edge of the area?
      if (px < 0 || px >= nrows || py < 0 || py >= nrows) break;
      if (square(px - ox) + square(py - oy) > square(roi)) break;

      int pelev = elevs[px * nrows + py];
      float s = (float)(pelev - oz) / abs(i);
      if (zslope < s) zslope = s;
      float hz = oz + zslope * abs(i);
      if (pelev + tht >= hz)
        set_vis(nwpr, px - ox + roi, py - oy + roi, thisshed);
    }
  }
}

void calc_sheds(const int nrows, const usint *h_elevs,
                const int roi, const int oht, const int tht,
                const int nsheds, const int *h_obs,
                ullint *h_sheds) {
  usint *d_elevs;
  int *d_obs;
  ullint *d_sheds;
  const int nr = 2 * roi + 1;
  const int nwpr = (nr + 63) / 64;

  if (cudaMalloc((void **)&d_elevs, square(nrows) * sizeof(usint)) != cudaSuccess)
    die("cudaMalloc failed");
  if (cudaMalloc((void **)&d_obs, nsheds * sizeof(int)) != cudaSuccess)
    die("cudaMalloc failed");
  if (cudaMalloc((void **)&d_sheds, nsheds * nr * nwpr * sizeof(ullint)) != cudaSuccess)
    die("cudaMalloc failed");
  if (cudaMemcpy(d_elevs, h_elevs, square(nrows) * sizeof(usint), cudaMemcpyHostToDevice) != cudaSuccess)
    die("cudaMemcpy failed");
  if (cudaMemcpy(d_obs, h_obs, nsheds * sizeof(int), cudaMemcpyHostToDevice) != cudaSuccess)
    die("cudaMemcpy failed");
  if (cudaMemset(d_sheds, 0, nsheds * nr * nwpr * sizeof(ullint)) != cudaSuccess)
    die("cudaMemset failed");

  const size_t dimblock = 256;  // must be a multiple of 32
  const size_t dimgrid = nsheds;
  calc_one_shed<<<dimgrid, dimblock>>>(nrows, d_elevs, roi, oht, tht, nsheds, d_obs, d_sheds);

  if (cudaMemcpy(h_sheds, d_sheds, nsheds * nr * nwpr * sizeof(ullint), cudaMemcpyDeviceToHost)
      != cudaSuccess)
    die("cudaMemcpy failed");

  if (cudaFree(d_elevs) != cudaSuccess) die("cudaFree failed");
  if (cudaFree(d_obs) != cudaSuccess) die("cudaFree failed");
  if (cudaFree(d_sheds) != cudaSuccess) die("cudaFree failed");
}

////////////////////////////////////////////////////////////////////////////////
// site
////////////////////////////////////////////////////////////////////////////////

__device__ int is_obs_vis(const int cumnwpr,
                          const ullint *cumshed,
                          const int obsx, const int obsy) {
  int i = obsx * cumnwpr * 64 + obsy;
  if ((cumshed[i / 64] & 1ULL << (63 - i % 64)) != 0)
    return 1;
  else
    return 0;
}

__global__ void calc_extra_area(const int nrows, const int roi,
                                const int *obs, const int *updatelist,
                                const ullint *sheds,
                                const int nr, const int nwpr, const int cumnwpr,
                                const ullint *cumshed,
                                int *testshedarea) {
  const int oi = updatelist[blockIdx.x];
  const int obsx = obs[oi]/nrows;
  const int obsy = obs[oi]%nrows;
  const ullint *shed = sheds + oi*nr*nwpr;
  int *extraarea = testshedarea + oi;

  extern __shared__ int areas[];
  areas[threadIdx.x] = 0;

  // calculate nrpt rows of extra area
  const int nrpt = nr / blockDim.x + (nr % blockDim.x ? 1 : 0);
  int sum = 0;

  for (int row = threadIdx.x * nrpt; row < (threadIdx.x + 1) * nrpt && row < nr; row++) {
    const int cumrow = obsx - roi + row;
    if (cumrow >= 0 && cumrow < nrows) {
      int firstword = (obsy - roi) / 64;
      int firstbit = (obsy - roi) % 64;
      if (firstbit < 0) {
        firstword--;
        firstbit += 64;
      }
      int lastword = (obsy + roi) / 64;

      ullint prevvalue = 0ULL;
      ullint value, cumvalue, tempvalue;

      for (int cumword = firstword; cumword <= lastword; cumword++)
        if (cumword >= 0 && cumword < cumnwpr) {
          int word = cumword - firstword;  // definition out of loop?
          if (cumword == 0 && word > 0) prevvalue = shed[row * nwpr + word - 1];
          if (word < nwpr)
            value = shed[row * nwpr + word];
          else
            value = 0ULL;
          cumvalue = cumshed[cumrow * cumnwpr + cumword];
          tempvalue = cumvalue;
          tempvalue |= value >> firstbit;
          if (firstbit != 0) tempvalue |= prevvalue << (64 - firstbit);
          tempvalue ^= cumvalue;
          sum += __popcll(tempvalue);
          prevvalue = value;
        }
    }
  }

  areas[threadIdx.x] = sum;
  __syncthreads();  // wait for all threads

  if (threadIdx.x == 0) {
    int sum = 0;
    for (int i = 0; i < blockDim.x; i++)
      sum += areas[i];
    *extraarea = sum;
  }
}

__global__ void union_area(const int nrows, const int roi, const int intervis,
                           const int nsheds, const int *obs,
                           const ullint *sheds,
                           const int nr, const int nwpr, const int cumnwpr,
                           const int nusedsheds, const char *usedq,
                           const int lastobs,
                           const int lastobsx, const int lastobsy,
                           const ullint *cumshed,
                           int *testshedarea, int *updatelist) {
  int tid = blockIdx.x * blockDim.x + threadIdx.x;
  int obsx, obsy, valid;

  // calculate multiple extra areas
  for (int oi = tid; oi < nsheds; oi += gridDim.x * blockDim.x) {
    valid = 1;
    if (usedq[oi]) {
      valid = 0;
    } else {
      obsx = obs[oi]/nrows;
      obsy = obs[oi]%nrows;
      if (nusedsheds > 0) {  // lastobs >= 0
        if (square(obsx-lastobsx) + square(obsy-lastobsy) > square(2*roi))
          valid = 0;
        else if (intervis && !is_obs_vis(cumnwpr, cumshed, obsx, obsy))  // if intervis, reset all after the first
          valid = 0;  // testshedarea[oi] = 0;  // reset invisible ones to zero
      }
    }

    if (valid) {
      /*
      cudaStream_t s;
      cudaStreamCreateWithFlags(&s, cudaStreamNonBlocking);
      calc_extra_area<<<1, nr, nr*sizeof(int), s>>>(nrows, roi, obsx, obsy,
                                                    &sheds[oi*nr*nwpr],
                                                    nr, nwpr, cumnwpr,
                                                    cumshed, &testshedarea[oi]);
      cudaStreamDestroy(s);
      // calc_extra_area<<<1, nr, nr*sizeof(int)>>>(nrows, roi, obsx, obsy, &sheds[oi*nr*nwpr],
      //                                            nr, nwpr, cumnwpr, cumshed, &testshedarea[oi]);
      */
      int index = atomicAdd(updatelist+499999, 1);
      updatelist[index] = oi;
    }
  }
}

__device__ void swap(int *x, int *y) {
  int z = *x;
  *x = *y;
  *y = z;
}

__global__ void findtopobs(const int nsheds, const char *usedq,
                           const int *testshedarea, int *top100) {
  __shared__ int obs[256];
  __shared__ int areas[256];
  obs[threadIdx.x] = 0;
  areas[threadIdx.x] = 0;
  int tid = blockIdx.x * blockDim.x + threadIdx.x;
  int size = gridDim.x * blockDim.x;
  for (int i = tid; i < nsheds; i += size)
    if (!usedq[i]) {
      int extraarea = testshedarea[i];
      if (extraarea > areas[threadIdx.x]) {
        obs[threadIdx.x] = i;
        areas[threadIdx.x] = extraarea;
      }
    }
  __syncthreads();

  if (threadIdx.x < 128 && areas[threadIdx.x + 128] > areas[threadIdx.x]) {
    swap(&obs[threadIdx.x], &obs[threadIdx.x + 128]);
    swap(&areas[threadIdx.x], &areas[threadIdx.x + 128]);
  }
  if (threadIdx.x < 64 && areas[threadIdx.x + 64] > areas[threadIdx.x]) {
    swap(&obs[threadIdx.x], &obs[threadIdx.x + 64]);
    swap(&areas[threadIdx.x], &areas[threadIdx.x + 64]);
  }
  if (threadIdx.x < 32 && areas[threadIdx.x + 32] > areas[threadIdx.x]) {
    swap(&obs[threadIdx.x], &obs[threadIdx.x + 32]);
    swap(&areas[threadIdx.x], &areas[threadIdx.x + 32]);
  }
  if (threadIdx.x < 16 && areas[threadIdx.x + 16] > areas[threadIdx.x]) {
    swap(&obs[threadIdx.x], &obs[threadIdx.x + 16]);
    swap(&areas[threadIdx.x], &areas[threadIdx.x + 16]);
  }
  if (threadIdx.x < 8 && areas[threadIdx.x + 8] > areas[threadIdx.x]) {
    swap(&obs[threadIdx.x], &obs[threadIdx.x + 8]);
    swap(&areas[threadIdx.x], &areas[threadIdx.x + 8]);
  }
  if (threadIdx.x < 4 && areas[threadIdx.x + 4] > areas[threadIdx.x]) {
    swap(&obs[threadIdx.x], &obs[threadIdx.x + 4]);
    swap(&areas[threadIdx.x], &areas[threadIdx.x + 4]);
  }
  if (threadIdx.x < 2 && areas[threadIdx.x + 2] > areas[threadIdx.x]) {
    swap(&obs[threadIdx.x], &obs[threadIdx.x + 2]);
    swap(&areas[threadIdx.x], &areas[threadIdx.x + 2]);
  }
  if (threadIdx.x < 1 && areas[threadIdx.x + 1] > areas[threadIdx.x]) {
    swap(&obs[threadIdx.x], &obs[threadIdx.x + 1]);
    swap(&areas[threadIdx.x], &areas[threadIdx.x + 1]);
  }

  if (threadIdx.x == 0) {
    top100[blockIdx.x] = obs[0];
    top100[blockIdx.x + 100] = areas[0];
  }
}

__global__ void calc_union(const int nrows, const int roi,
                           const int nsheds, const int *obs,
                           const ullint *sheds,
                           const int nr, const int nwpr, const int cumnwpr,
                           const int lastobs, char *usedq,
                           ullint *cumshed) {
  // lastobs >= 0
  __shared__ int lastobsx, lastobsy;
  __shared__ const ullint *shed;
  if (threadIdx.x == 0) {
    usedq[lastobs] = 1;  // set gridDim.x times
    lastobsx = obs[lastobs]/nrows;
    lastobsy = obs[lastobs]%nrows;
    shed = &sheds[lastobs*nr*nwpr];
  }
  __syncthreads();  // wait for thread 0

  int firstword = (lastobsy - roi) / 64;
  int firstbit = (lastobsy - roi) % 64;
  if (firstbit < 0) {
    firstword--;
    firstbit += 64;
  }

  int row = blockIdx.x*blockDim.x + threadIdx.x;
  if (row < nr) {  // a row of shed
    int cumrow = lastobsx - roi + row;
    if (cumrow >= 0 && cumrow < nrows)  // row inside terrain
      for (int word = 0; word < nwpr; word++) {  // each word of row
        int cumword = firstword + word;
        if (cumword >= 0 && cumword < cumnwpr)  // word inside terrain
          cumshed[cumrow * cumnwpr + cumword] |= shed[row * nwpr + word] >> firstbit;
        if (firstbit != 0 && cumword + 1 >= 0 && cumword + 1 < cumnwpr)  // firstbit != 0 and word + 1 inside terrain
          cumshed[cumrow * cumnwpr + cumword + 1] |= shed[row * nwpr + word] << (64 - firstbit);
      }
  }
}

void site_it(const int nrows, const int roi, const int intervis,
             const int nsheds, const int *h_obs, const ullint *h_sheds, char *selected) {
  const int nr = 2 * roi + 1;
  const int nwpr = (nr + 63) / 64;
  const int cumnwpr = (nrows + 63) / 64;

  int *usedsheds;     // list of sheds used so far.
  char *h_usedq;      // whether each particular shed has been used.
  int h_top100[200];  // top 100 tentative observers and extra areas

  usedsheds = 0;
  h_usedq = 0;
  int *areas = 0;
  usedsheds = new int[nsheds];
  h_usedq = new char[nsheds];
  areas = new int[nsheds];
  if (!usedsheds || !h_usedq || !areas)
    die("Memory exhausted. Program terminates.");
  for (int i = 0; i < nsheds; i++) h_usedq[i] = 0;

  int *d_obs;
  ullint *d_sheds;
  char *d_usedq;
  ullint *d_cumshed;
  int *d_testshedarea;
  int *d_top100;
  if (cudaMalloc((void **)&d_obs, nsheds * sizeof(int)) != cudaSuccess)
    die("cudaMalloc failed");
  if (cudaMalloc((void **)&d_sheds, nsheds * nr * nwpr * sizeof(ullint)) != cudaSuccess)
    die("cudaMalloc failed");
  if (cudaMalloc((void **)&d_usedq, nsheds * sizeof(char)) != cudaSuccess)
    die("cudaMalloc failed");
  if (cudaMalloc((void **)&d_cumshed, nrows * cumnwpr * sizeof(ullint)) != cudaSuccess)
    die("cudaMalloc failed");
  if (cudaMalloc((void **)&d_testshedarea, nsheds * sizeof(int)) != cudaSuccess)
    die("cudaMalloc failed");
  if (cudaMalloc((void **)&d_top100, 200 * sizeof(int)) != cudaSuccess)
    die("cudaMalloc failed");
  if (cudaMemcpy(d_obs, h_obs, nsheds * sizeof(int), cudaMemcpyHostToDevice) != cudaSuccess)
    die("cudaMemcpy failed");
  if (cudaMemcpy(d_sheds, h_sheds, nsheds * nr * nwpr * sizeof(ullint), cudaMemcpyHostToDevice)
      != cudaSuccess)
    die("cudaMemcpy failed");
  if (cudaMemset(d_usedq, 0, nsheds * sizeof(char)) != cudaSuccess)
    die("cudaMemset failed");
  if (cudaMemset(d_cumshed, 0, nrows*cumnwpr*sizeof(ullint)) != cudaSuccess)
    die("cudaMemset failed");

  int *d_updatelist;
  if (cudaMalloc((void **)&d_updatelist, 500000*sizeof(int)) != cudaSuccess) die("cudaMalloc failed");

  int nusedsheds = 0;
  int lastobs = -1;
  int lastobsx = 0;
  int lastobsy = 0;
  int cumarea = 0;
  if (cudaMemset(d_testshedarea, 0, nsheds * sizeof(int)) != cudaSuccess)
    die("cudaMemset failed");
  size_t dimgrid = (nsheds+255)/256;
  size_t dimblock = 256;
  // size_t dimgrid = (nsheds + dimblock - 1) / dimblock;

  //cout << "Total area=" << square(nrows) << endl;
  //cout << "#nusedsheds newshed obsx obsy area extraarea newcumarea areapercentage" << endl;

  while (1) {
    if (cudaMemset(d_updatelist, 0, 500000*sizeof(int)) != cudaSuccess) die("cudaMemset failed");

    union_area<<<dimgrid, dimblock>>>(
        nrows, roi, intervis, nsheds, d_obs, d_sheds, nr, nwpr, cumnwpr,
        nusedsheds, d_usedq, lastobs, lastobsx, lastobsy, d_cumshed, d_testshedarea, d_updatelist);

    int updatelistsize;
    if (cudaMemcpy(&updatelistsize, d_updatelist+499999, sizeof(int), cudaMemcpyDeviceToHost) != cudaSuccess) die("cudaMemcpy failed");
      //cout << "\nsize = " << updatelistsize;

    calc_extra_area<<<updatelistsize, nr, nr*sizeof(int)>>>(
        nrows, roi, d_obs, d_updatelist, d_sheds, nr, nwpr, cumnwpr, d_cumshed, d_testshedarea);

    cudaDeviceSynchronize();

    // find top 100 observers
    findtopobs<<<100, 256>>>(nsheds, d_usedq, d_testshedarea, d_top100);
    if (cudaMemcpy(h_top100, d_top100, 200 * sizeof(int), cudaMemcpyDeviceToHost) != cudaSuccess)
      die("cudaMemcpy failed");

    int newshed = 0;
    int extraarea = 0;
    for (int i = 0; i < 100; i++) {
      if (h_top100[i + 100] > extraarea) {
        extraarea = h_top100[i + 100];
        newshed = h_top100[i];
      }
    }
    if (extraarea == 0) {
      //cout << "No more new observers that will add new area." << endl;
      break;
    }

    usedsheds[nusedsheds++] = newshed;
    h_usedq[newshed] = 1;
    lastobs = newshed;
    lastobsx = h_obs[newshed]/nrows;
    lastobsy = h_obs[newshed]%nrows;

    // set usedq and calculate cumshed
    calc_union<<<nr, 1>>>(nrows, roi, nsheds, d_obs, d_sheds, nr, nwpr, cumnwpr, lastobs, d_usedq, d_cumshed);
    cudaDeviceSynchronize();

    cumarea += extraarea;
    double areapercentage = 100.0 * cumarea / square(nrows);
    if (areapercentage > 95)
        break;

    if (nusedsheds == 1) {
      if (cudaMemcpy(areas, d_testshedarea, nsheds * sizeof(int), cudaMemcpyDeviceToHost) != cudaSuccess)
        die("cudaMemcpy failed");
      if (intervis)
        if (cudaMemset(d_testshedarea, 0, nsheds * sizeof(int)) != cudaSuccess)
          die("cudaMemset failed");
    }

    /*
    cout << setw(6) << nusedsheds << setw(6) << newshed
         << setw(6) << h_obs[newshed]/nrows << setw(6) << h_obs[newshed]%nrows
         << setw(8) << areas[newshed] << setw(8) << extraarea
         << setw(10) << cumarea << setw(8) << areapercentage << endl;
    */
  }
  cout << " nusedsheds:" << nusedsheds << " coverage:" << 100.0*cumarea/square(nrows);

  if (cudaFree(d_obs) != cudaSuccess) die("cudaFree failed");
  if (cudaFree(d_sheds) != cudaSuccess) die("cudaFree failed");
  if (cudaFree(d_usedq) != cudaSuccess) die("cudaFree failed");
  if (cudaFree(d_cumshed) != cudaSuccess) die("cudaFree failed");
  if (cudaFree(d_testshedarea) != cudaSuccess) die("cudaFree failed");
  if (cudaFree(d_top100) != cudaSuccess) die("cudaFree failed");
  if (cudaFree(d_updatelist) != cudaSuccess) die("cudaFree failed");

  for (int i = 0; i < nsheds; i++)
    selected[i] = h_usedq[i];
  delete[] usedsheds;
  delete[] h_usedq;
  delete[] areas;
}

////////////////////////////////////////////////////////////////////////////////
// main
////////////////////////////////////////////////////////////////////////////////

int main(int argc, char **argv) {
  double elapsed_secs;
  struct timeval begin, middle, end;
  gettimeofday(&begin, NULL);
  middle = begin;

  int nrows;                      // # rows, cols in this cell
  int roi;                        // radius of interest
  int oht;                        // ht of observer above terrain
  int tht;                        // target ht above terrain
  int ntests;                     // # of targets tested per observer
  int blocksize0;                 // Requested number of rows in one block of the input visibility index array.
  float blocksize;               // Perturbed blocksize0, to remove sliver blocks at the end.
  int nwanted0;                   // Desired number of output observers.
  int nwanted;                    // Modified because blocksize was perturbed.
  int nblocks;                    // Number of blocks on one side of it.
  int nwantedperblock;            // Number of observers to find per block, before culling.
  int intervis;                   // Should new observers be visible to existing ones?

  usint *elevs;      // terrain elevation (input)
  unsigned char *vix;             // visibility index * 256 (output); vim
  int *obs;                       // observers
  ullint *sheds;  // viewsheds
  char *selected;

  //cout << "[SITE, compiled from " << __FILE__ << " on " << __DATE__ << ", " << __TIME__ << ']' << endl;
  if (argc != 10) {
    cout << "argc=" << argc << endl;
    die("SITE requires 9 arguments: nrows, roi, oht/tht, ntests, blocksize, nwanted, intervis, infile, outfile");
  }

  nrows = atoi(argv[1]);
  roi = atoi(argv[2]);
  oht = tht = atoi(argv[3]);
  ntests = atoi(argv[4]);
  blocksize0 = atoi(argv[5]);
  nwanted0 = atoi(argv[6]);
  intervis = atoi(argv[7]);

  //cout << "nrows=" << nrows << ", roi=" << roi << ", oht=" << oht << ", tht=" << tht
  //     << ", ntests=" << ntests << "\nblocksize0=" << blocksize0 << ", nwanted0=" << nwanted0
  //     << ", intervis=" << intervis << endl;

  if (nrows <= 0 || nrows > 20000) die("Unreasonable value for nrows");
  if (roi < 1 || roi > 10000) die("Unreasonable value for roi.");
  if (tht < 0 || tht > 1000000) die("Unreasonable value for tht.");
  if (ntests < 1 || ntests > 1000) die("Unreasonable value for ntests.");
  if (blocksize0 < 10 || blocksize0 > 2000) die("Unreasonable value for blocksize0.");
  if (nwanted0 < 100 || nwanted0 > 2000000) die("Unreasonable value for nwanted0.");
  if (intervis != 0 && intervis != 1) die("Unreasonable value for intervis.");

  // Perturb blocksize so that the last block won't be really small.
  blocksize = (float)nrows / (int)((float)nrows / blocksize0 + 0.5f);  // floating point block size
  nblocks = (int)(nrows / blocksize + 0.5f);                             // number of blocks
  nwantedperblock = (int)((float)nwanted0 / square(nblocks) + 0.99999f);  // number of wanted per block
  nwanted = nwantedperblock * square(nblocks);                          // number of wanted
  int lastsize = nrows - (int)(blocksize * (nblocks - 1));              // size of the last block
  if (square(lastsize) < nwantedperblock)                               // too small
    die("The last block is too small for nwantedperblock.");

  //cout << "blocksize=" << blocksize << ", nblocks=" << nblocks
  //     << ", nwantedperblock=" << nwantedperblock << ", nwanted=" << nwanted << endl;

  // number of rows per shed and number of words per row
  const int nr = 2 * roi + 1;
  const int nwpr = (nr + 63) / 64;

  elevs = 0;
  vix = 0;
  obs = 0;
  sheds = 0;
  selected = 0;
  elevs = new usint[square(nrows)];
  vix = new unsigned char[square(nrows)];
  obs = new int[nwanted];
  sheds = new ullint[nwanted * nr * nwpr];
  selected = new char[nwanted];
  if (!elevs || !vix || !obs || !sheds || !selected)
    die("Memory exhausted. Program terminates.");
/*
  if (cudaMallocHost((void **)&elevs, square(nrows) * sizeof(usint)) != cudaSuccess)
    die("cudaMallocHost failed");
  if (cudaMallocHost((void **)&vix, square(nrows) * sizeof(unsigned char)) != cudaSuccess)
    die("cudaMallocHost failed");
  if (cudaMallocHost((void **)&obs, nwanted * sizeof(int)) != cudaSuccess)
    die("cudaMallocHost failed");
  if (cudaMallocHost((void **)&sheds, nwanted * nr * nwpr * sizeof(ullint)) != cudaSuccess)
    die("cudaMallocHost failed");
*/
  /*
  for (int i = 0; i < nrows; i++)
    for (int j = 0; j < nrows; j++) {
      cin.read(reinterpret_cast<char *>(&elevs[i * nrows + j]), sizeof(usint));
      if (cin.fail()) {
        cout << "Error: at i=" << i << ", j=" << j << endl;
        die("Input failed");
      }
    }
  */
  ifstream ifs(argv[8]);
  ifs.read((char *)elevs, square(nrows)*sizeof(usint));
  if (ifs.fail())
    die("Input failed");
  ifs.close();

  gettimeofday(&end, NULL);
  elapsed_secs = calc_time(middle, end);
  middle = end;
  cout << "input:" << elapsed_secs;

  calc_vix(nrows, elevs, roi, oht, tht, ntests, vix);
  cudaDeviceSynchronize();
  gettimeofday(&end, NULL);
  elapsed_secs = calc_time(middle, end);
  middle = end;
  cout << " vix:" << elapsed_secs;
  /*
  int x;
  ullint sum = 0;
  ifstream ifs("vim.bin");
  for (int i = 0; i < square(nrows); i++) {
    ifs >> x;
    sum += square(vix[i]-x);
  }
  cout << " RMS VIM error:" << sqrt((double)sum/square(nrows));
  ifs.close();
  */

  find_max(nrows, vix, blocksize, nwanted, nblocks, nwantedperblock, obs);
  cudaDeviceSynchronize();
  gettimeofday(&end, NULL);
  elapsed_secs = calc_time(middle, end);
  middle = end;
  cout << " findmax:" << elapsed_secs;
  
  calc_sheds(nrows, elevs, roi, oht, tht, nwanted, obs, sheds);
  cudaDeviceSynchronize();
  gettimeofday(&end, NULL);
  elapsed_secs = calc_time(middle, end);
  middle = end;
  cout << " viewshed:" << elapsed_secs;

  site_it(nrows, roi, intervis, nwanted, obs, sheds, selected);
  cudaDeviceSynchronize();
  gettimeofday(&end, NULL);
  elapsed_secs = calc_time(middle, end);
  middle = end;
  cout << " site:" << elapsed_secs;

  ofstream ofs(argv[9]);
  for (int i = 0; i < nwanted; i++)
    if (selected[i])
      ofs << obs[i]/nrows << ',' << obs[i]%nrows << '\n';
  ofs.close();

  delete[] elevs;
  delete[] vix;
  delete[] obs;
  delete[] sheds;
  delete[] selected;
/*
  if (cudaFreeHost(elevs) != cudaSuccess) die("cudaFreeHost failed");
  if (cudaFreeHost(vix) != cudaSuccess) die("cudaFreeHost failed");
  if (cudaFreeHost(obs) != cudaSuccess) die("cudaFreeHost failed");
  if (cudaFreeHost(sheds) != cudaSuccess) die("cudaFreeHost failed");
*/
  gettimeofday(&end, NULL);
  elapsed_secs = calc_time(middle, end);
  middle = end;
  cout << " output:" << elapsed_secs;
  gettimeofday(&end, NULL);
  elapsed_secs = calc_time(begin, end);
  cout << " total:" << elapsed_secs << endl;
}

	.file	"tmpxft_00396402_00000000-6_siting.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB4021:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE4021:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"ERROR: "
	.text
	.globl	_Z3diePKc
	.type	_Z3diePKc, @function
_Z3diePKc:
.LFB4005:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	.LC0(%rip), %rsi
	movq	%rdi, %rbx
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rbx, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	call	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
	movl	$1, %edi
	call	exit@PLT
	.cfi_endproc
.LFE4005:
	.size	_Z3diePKc, .-_Z3diePKc
	.globl	_Z6randomi
	.type	_Z6randomi, @function
_Z6randomi:
.LFB4006:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	popq	%rax
	.cfi_def_cfa_offset 8
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	movl	$1, 12(%rsp)
	movl	12(%rsp), %edi
	call	exit@PLT
	.cfi_endproc
.LFE4006:
	.size	_Z6randomi, .-_Z6randomi
	.section	.text._Z9calc_timeR7timevalS0_,"axG",@progbits,_Z9calc_timeR7timevalS0_,comdat
	.weak	_Z9calc_timeR7timevalS0_
	.type	_Z9calc_timeR7timevalS0_, @function
_Z9calc_timeR7timevalS0_:
.LFB4009:
	.cfi_startproc
	endbr64
	movq	(%rsi), %rax
	subq	(%rdi), %rax
	imulq	$1000000, %rax, %rax
	addq	8(%rsi), %rax
	subq	8(%rdi), %rax
	cvtsi2sdq	%rax, %xmm0
	divsd	.LC1(%rip), %xmm0
	ret
	.cfi_endproc
.LFE4009:
	.size	_Z9calc_timeR7timevalS0_, .-_Z9calc_timeR7timevalS0_
	.text
	.globl	_Z15test_one_targetiPKtiiiiii
	.type	_Z15test_one_targetiPKtiiiiii, @function
_Z15test_one_targetiPKtiiiiii:
.LFB4010:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	popq	%rax
	.cfi_def_cfa_offset 8
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	movl	$1, 12(%rsp)
	movl	12(%rsp), %edi
	call	exit@PLT
	.cfi_endproc
.LFE4010:
	.size	_Z15test_one_targetiPKtiiiiii, .-_Z15test_one_targetiPKtiiiiii
	.globl	_Z7set_visiiiPy
	.type	_Z7set_visiiiPy, @function
_Z7set_visiiiPy:
.LFB4013:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	popq	%rax
	.cfi_def_cfa_offset 8
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	movl	$1, 12(%rsp)
	movl	12(%rsp), %edi
	call	exit@PLT
	.cfi_endproc
.LFE4013:
	.size	_Z7set_visiiiPy, .-_Z7set_visiiiPy
	.globl	_Z10is_obs_visiPKyii
	.type	_Z10is_obs_visiPKyii, @function
_Z10is_obs_visiPKyii:
.LFB4015:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	popq	%rax
	.cfi_def_cfa_offset 8
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	movl	$1, 12(%rsp)
	movl	12(%rsp), %edi
	call	exit@PLT
	.cfi_endproc
.LFE4015:
	.size	_Z10is_obs_visiPKyii, .-_Z10is_obs_visiPKyii
	.globl	_Z4swapPiS_
	.type	_Z4swapPiS_, @function
_Z4swapPiS_:
.LFB4016:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	popq	%rax
	.cfi_def_cfa_offset 8
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	movl	$1, 12(%rsp)
	movl	12(%rsp), %edi
	call	exit@PLT
	.cfi_endproc
.LFE4016:
	.size	_Z4swapPiS_, .-_Z4swapPiS_
	.globl	_Z40__device_stub__Z12calc_one_vixiPKtiiiiPhiPKtiiiiPh
	.type	_Z40__device_stub__Z12calc_one_vixiPKtiiiiPhiPKtiiiiPh, @function
_Z40__device_stub__Z12calc_one_vixiPKtiiiiPhiPKtiiiiPh:
.LFB4043:
	.cfi_startproc
	endbr64
	subq	$184, %rsp
	.cfi_def_cfa_offset 192
	movq	192(%rsp), %rax
	movl	%edi, 44(%rsp)
	leaq	64(%rsp), %rdi
	movq	%rsi, 32(%rsp)
	leaq	76(%rsp), %rsi
	movl	%edx, 40(%rsp)
	leaq	48(%rsp), %rdx
	movl	%ecx, 28(%rsp)
	leaq	56(%rsp), %rcx
	movl	%r8d, 24(%rsp)
	movl	%r9d, 20(%rsp)
	movq	%rax, 8(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 168(%rsp)
	xorl	%eax, %eax
	leaq	44(%rsp), %rax
	movl	$1, 72(%rsp)
	movq	%rax, 112(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	40(%rsp), %rax
	movq	%rax, 128(%rsp)
	leaq	28(%rsp), %rax
	movq	%rax, 136(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 144(%rsp)
	leaq	20(%rsp), %rax
	movq	%rax, 152(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 160(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 64(%rsp)
	movq	%rax, 76(%rsp)
	movl	$1, 84(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L15
	pushq	56(%rsp)
	.cfi_def_cfa_offset 200
	leaq	_Z12calc_one_vixiPKtiiiiPh(%rip), %rdi
	pushq	56(%rsp)
	.cfi_def_cfa_offset 208
	movq	92(%rsp), %rcx
	movl	100(%rsp), %r8d
	movq	80(%rsp), %rsi
	movl	88(%rsp), %edx
	leaq	128(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 200
	popq	%rdx
	.cfi_def_cfa_offset 192
.L15:
	movq	168(%rsp), %rax
	subq	%fs:40, %rax
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	addq	$184, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4043:
	.size	_Z40__device_stub__Z12calc_one_vixiPKtiiiiPhiPKtiiiiPh, .-_Z40__device_stub__Z12calc_one_vixiPKtiiiiPhiPKtiiiiPh
	.globl	_Z12calc_one_vixiPKtiiiiPh
	.type	_Z12calc_one_vixiPKtiiiiPh, @function
_Z12calc_one_vixiPKtiiiiPh:
.LFB4044:
	.cfi_startproc
	endbr64
	jmp	_Z40__device_stub__Z12calc_one_vixiPKtiiiiPhiPKtiiiiPh
	.cfi_endproc
.LFE4044:
	.size	_Z12calc_one_vixiPKtiiiiPh, .-_Z12calc_one_vixiPKtiiiiPh
	.section	.rodata.str1.1
.LC2:
	.string	"cudaMalloc failed"
.LC3:
	.string	"cudaMemcpy failed"
.LC4:
	.string	"cudaFree failed"
	.text
	.globl	_Z8calc_vixiPKtiiiiPh
	.type	_Z8calc_vixiPKtiiiiPh, @function
_Z8calc_vixiPKtiiiiPh:
.LFB4011:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%rsi, %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movl	%r9d, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movl	%r8d, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movl	%edi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movl	%edi, %ebx
	imull	%edi, %ebx
	subq	$72, %rsp
	.cfi_def_cfa_offset 128
	movq	128(%rsp), %rax
	movl	%edx, (%rsp)
	movslq	%ebx, %rbx
	leaq	16(%rsp), %rdi
	movl	%ecx, 4(%rsp)
	leaq	(%rbx,%rbx), %r15
	movq	%rax, 8(%rsp)
	movq	%r15, %rsi
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	call	cudaMalloc@PLT
	testl	%eax, %eax
	je	.L22
.L24:
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	leaq	.LC2(%rip), %rdi
	je	.L36
	jmp	.L37
.L22:
	leaq	24(%rsp), %rdi
	movq	%rbx, %rsi
	call	cudaMalloc@PLT
	testl	%eax, %eax
	jne	.L24
	movq	16(%rsp), %rdi
	movl	$1, %ecx
	movq	%r15, %rdx
	movq	%r14, %rsi
	call	cudaMemcpy@PLT
	testl	%eax, %eax
	je	.L25
.L29:
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	leaq	.LC3(%rip), %rdi
	je	.L36
	jmp	.L37
.L25:
	movq	%rbx, %rax
	shrq	$7, %rax
	cvtsi2sdq	%rax, %xmm0
	call	sqrt@PLT
	movl	$1, %ecx
	movl	$1, %esi
	cvttsd2sil	%xmm0, %eax
	movl	%eax, %edx
	imull	%eax, %edx
	movslq	%edx, %rdx
	salq	$7, %rdx
	cmpq	%rbx, %rdx
	movl	$33554433, %edx
	adcl	$0, %eax
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	salq	$7, %rdx
	movl	%eax, 32(%rsp)
	movl	%eax, 36(%rsp)
	movq	32(%rsp), %rdi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L28
	pushq	%rax
	.cfi_def_cfa_offset 136
	movl	%r13d, %r9d
	movl	%r12d, %r8d
	movl	%ebp, %edi
	pushq	32(%rsp)
	.cfi_def_cfa_offset 144
	movl	20(%rsp), %ecx
	movl	16(%rsp), %edx
	movq	32(%rsp), %rsi
	call	_Z40__device_stub__Z12calc_one_vixiPKtiiiiPhiPKtiiiiPh
	popq	%rdx
	.cfi_def_cfa_offset 136
	popq	%rcx
	.cfi_def_cfa_offset 128
.L28:
	movq	24(%rsp), %rsi
	movq	8(%rsp), %rdi
	movl	$2, %ecx
	movq	%rbx, %rdx
	call	cudaMemcpy@PLT
	testl	%eax, %eax
	jne	.L29
	movq	16(%rsp), %rdi
	call	cudaFree@PLT
	testl	%eax, %eax
	je	.L30
.L32:
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	leaq	.LC4(%rip), %rdi
	jne	.L37
.L36:
	call	_Z3diePKc
.L30:
	movq	24(%rsp), %rdi
	call	cudaFree@PLT
	testl	%eax, %eax
	jne	.L32
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	je	.L33
.L37:
	call	__stack_chk_fail@PLT
.L33:
	addq	$72, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4011:
	.size	_Z8calc_vixiPKtiiiiPh, .-_Z8calc_vixiPKtiiiiPh
	.globl	_Z43__device_stub__Z17process_one_blockiPhfiiPiiPhfiiPi
	.type	_Z43__device_stub__Z17process_one_blockiPhfiiPiiPhfiiPi, @function
_Z43__device_stub__Z17process_one_blockiPhfiiPiiPhfiiPi:
.LFB4045:
	.cfi_startproc
	endbr64
	subq	$168, %rsp
	.cfi_def_cfa_offset 176
	movl	%edi, 28(%rsp)
	leaq	56(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	68(%rsp), %rsi
	movl	%edx, 12(%rsp)
	leaq	40(%rsp), %rdx
	movl	%ecx, 8(%rsp)
	leaq	48(%rsp), %rcx
	movq	%r8, (%rsp)
	movss	%xmm0, 24(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 152(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rax
	movl	$1, 64(%rsp)
	movq	%rax, 104(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 128(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 136(%rsp)
	movq	%rsp, %rax
	movq	%rax, 144(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 56(%rsp)
	movq	%rax, 68(%rsp)
	movl	$1, 76(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L38
	pushq	48(%rsp)
	.cfi_def_cfa_offset 184
	leaq	_Z17process_one_blockiPhfiiPi(%rip), %rdi
	pushq	48(%rsp)
	.cfi_def_cfa_offset 192
	movq	84(%rsp), %rcx
	movl	92(%rsp), %r8d
	movq	72(%rsp), %rsi
	movl	80(%rsp), %edx
	leaq	120(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 184
	popq	%rdx
	.cfi_def_cfa_offset 176
.L38:
	movq	152(%rsp), %rax
	subq	%fs:40, %rax
	je	.L40
	call	__stack_chk_fail@PLT
.L40:
	addq	$168, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4045:
	.size	_Z43__device_stub__Z17process_one_blockiPhfiiPiiPhfiiPi, .-_Z43__device_stub__Z17process_one_blockiPhfiiPiiPhfiiPi
	.globl	_Z17process_one_blockiPhfiiPi
	.type	_Z17process_one_blockiPhfiiPi, @function
_Z17process_one_blockiPhfiiPi:
.LFB4046:
	.cfi_startproc
	endbr64
	jmp	_Z43__device_stub__Z17process_one_blockiPhfiiPiiPhfiiPi
	.cfi_endproc
.LFE4046:
	.size	_Z17process_one_blockiPhfiiPi, .-_Z17process_one_blockiPhfiiPi
	.globl	_Z8find_maxiPKhfiiiPi
	.type	_Z8find_maxiPKhfiiiPi, @function
_Z8find_maxiPKhfiiiPi:
.LFB4012:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movq	%rsi, %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movl	%r8d, %r14d
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movl	%edi, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	imull	%edi, %r13d
	movslq	%edx, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movl	%ecx, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movl	%edi, %ebx
	movslq	%r13d, %r13
	movq	%r13, %rsi
	subq	$72, %rsp
	.cfi_def_cfa_offset 128
	movq	%r9, 8(%rsp)
	leaq	16(%rsp), %rdi
	movss	%xmm0, 4(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	call	cudaMalloc@PLT
	testl	%eax, %eax
	je	.L44
.L46:
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	leaq	.LC2(%rip), %rdi
	je	.L57
	jmp	.L58
.L44:
	salq	$2, %r12
	leaq	24(%rsp), %rdi
	movq	%r12, %rsi
	call	cudaMalloc@PLT
	testl	%eax, %eax
	jne	.L46
	movq	16(%rsp), %rdi
	movl	$1, %ecx
	movq	%r13, %rdx
	movq	%r15, %rsi
	call	cudaMemcpy@PLT
	testl	%eax, %eax
	je	.L47
.L50:
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	leaq	.LC3(%rip), %rdi
	je	.L57
	jmp	.L58
.L47:
	movl	%ebp, %eax
	movl	$16777217, %edx
	xorl	%r9d, %r9d
	movl	$4096, %r8d
	imull	%ebp, %eax
	salq	$8, %rdx
	movl	$1, %ecx
	movl	%eax, 32(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 36(%rsp)
	movq	32(%rsp), %rdi
	movl	40(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L49
	movq	24(%rsp), %r8
	movss	4(%rsp), %xmm0
	movl	%r14d, %ecx
	movl	%ebp, %edx
	movq	16(%rsp), %rsi
	movl	%ebx, %edi
	call	_Z43__device_stub__Z17process_one_blockiPhfiiPiiPhfiiPi
.L49:
	movq	24(%rsp), %rsi
	movq	8(%rsp), %rdi
	movl	$2, %ecx
	movq	%r12, %rdx
	call	cudaMemcpy@PLT
	testl	%eax, %eax
	jne	.L50
	movq	16(%rsp), %rdi
	call	cudaFree@PLT
	testl	%eax, %eax
	je	.L51
.L53:
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	leaq	.LC4(%rip), %rdi
	jne	.L58
.L57:
	call	_Z3diePKc
.L51:
	movq	24(%rsp), %rdi
	call	cudaFree@PLT
	testl	%eax, %eax
	jne	.L53
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	je	.L54
.L58:
	call	__stack_chk_fail@PLT
.L54:
	addq	$72, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4012:
	.size	_Z8find_maxiPKhfiiiPi, .-_Z8find_maxiPKhfiiiPi
	.globl	_Z44__device_stub__Z13calc_one_shediPKtiiiiPKiPyiPKtiiiiPKiPy
	.type	_Z44__device_stub__Z13calc_one_shediPKtiiiiPKiPyiPKtiiiiPKiPy, @function
_Z44__device_stub__Z13calc_one_shediPKtiiiiPKiPyiPKtiiiiPKiPy:
.LFB4047:
	.cfi_startproc
	endbr64
	subq	$200, %rsp
	.cfi_def_cfa_offset 208
	movq	208(%rsp), %rax
	movl	%edi, 44(%rsp)
	leaq	72(%rsp), %rdi
	movq	%rsi, 32(%rsp)
	leaq	84(%rsp), %rsi
	movq	%rax, 8(%rsp)
	movq	216(%rsp), %rax
	movl	%edx, 40(%rsp)
	leaq	56(%rsp), %rdx
	movl	%ecx, 28(%rsp)
	leaq	64(%rsp), %rcx
	movl	%r8d, 24(%rsp)
	movl	%r9d, 20(%rsp)
	movq	%rax, (%rsp)
	movq	%fs:40, %rax
	movq	%rax, 184(%rsp)
	xorl	%eax, %eax
	leaq	44(%rsp), %rax
	movl	$1, 80(%rsp)
	movq	%rax, 120(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 128(%rsp)
	leaq	40(%rsp), %rax
	movq	%rax, 136(%rsp)
	leaq	28(%rsp), %rax
	movq	%rax, 144(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 152(%rsp)
	leaq	20(%rsp), %rax
	movq	%rax, 160(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 168(%rsp)
	movq	%rsp, %rax
	movq	%rax, 176(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 72(%rsp)
	movq	%rax, 84(%rsp)
	movl	$1, 92(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L59
	pushq	64(%rsp)
	.cfi_def_cfa_offset 216
	leaq	_Z13calc_one_shediPKtiiiiPKiPy(%rip), %rdi
	pushq	64(%rsp)
	.cfi_def_cfa_offset 224
	movq	100(%rsp), %rcx
	movl	108(%rsp), %r8d
	movq	88(%rsp), %rsi
	movl	96(%rsp), %edx
	leaq	136(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 216
	popq	%rdx
	.cfi_def_cfa_offset 208
.L59:
	movq	184(%rsp), %rax
	subq	%fs:40, %rax
	je	.L61
	call	__stack_chk_fail@PLT
.L61:
	addq	$200, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4047:
	.size	_Z44__device_stub__Z13calc_one_shediPKtiiiiPKiPyiPKtiiiiPKiPy, .-_Z44__device_stub__Z13calc_one_shediPKtiiiiPKiPyiPKtiiiiPKiPy
	.globl	_Z13calc_one_shediPKtiiiiPKiPy
	.type	_Z13calc_one_shediPKtiiiiPKiPy, @function
_Z13calc_one_shediPKtiiiiPKiPy:
.LFB4048:
	.cfi_startproc
	endbr64
	jmp	_Z44__device_stub__Z13calc_one_shediPKtiiiiPKiPyiPKtiiiiPKiPy
	.cfi_endproc
.LFE4048:
	.size	_Z13calc_one_shediPKtiiiiPKiPy, .-_Z13calc_one_shediPKtiiiiPKiPy
	.section	.rodata.str1.1
.LC5:
	.string	"cudaMemset failed"
	.text
	.globl	_Z10calc_shedsiPKtiiiiPKiPy
	.type	_Z10calc_shedsiPKtiiiiPKiPy, @function
_Z10calc_shedsiPKtiiiiPKiPy:
.LFB4014:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	%r8d, %r15d
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movl	%edx, %r14d
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movl	%edi, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movl	%r9d, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$120, %rsp
	.cfi_def_cfa_offset 176
	movq	176(%rsp), %rax
	movq	%rsi, 16(%rsp)
	movl	%ecx, 28(%rsp)
	movl	$64, %ecx
	movq	%rax, 32(%rsp)
	movq	184(%rsp), %rax
	movq	%rax, 40(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
	leal	(%rdx,%rdx), %eax
	leal	1(%rax), %ebx
	addl	$64, %eax
	cltd
	idivl	%ecx
	movl	%eax, %ebp
	movl	%edi, %eax
	imull	%edi, %eax
	leaq	56(%rsp), %rdi
	cltq
	addq	%rax, %rax
	movq	%rax, %rsi
	movq	%rax, 8(%rsp)
	call	cudaMalloc@PLT
	testl	%eax, %eax
	je	.L65
.L67:
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	leaq	.LC2(%rip), %rdi
	je	.L80
	jmp	.L81
.L65:
	movslq	%r12d, %rax
	leaq	64(%rsp), %rdi
	salq	$2, %rax
	movq	%rax, %rsi
	movq	%rax, (%rsp)
	call	cudaMalloc@PLT
	testl	%eax, %eax
	jne	.L67
	imull	%r12d, %ebx
	leaq	72(%rsp), %rdi
	imull	%ebp, %ebx
	movslq	%ebx, %rbx
	salq	$3, %rbx
	movq	%rbx, %rsi
	call	cudaMalloc@PLT
	testl	%eax, %eax
	jne	.L67
	movq	8(%rsp), %rdx
	movq	16(%rsp), %rsi
	movl	$1, %ecx
	movq	56(%rsp), %rdi
	call	cudaMemcpy@PLT
	testl	%eax, %eax
	je	.L68
.L70:
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	leaq	.LC3(%rip), %rdi
	je	.L80
	jmp	.L81
.L68:
	movq	(%rsp), %rdx
	movq	32(%rsp), %rsi
	movl	$1, %ecx
	movq	64(%rsp), %rdi
	call	cudaMemcpy@PLT
	testl	%eax, %eax
	jne	.L70
	movq	72(%rsp), %rdi
	xorl	%esi, %esi
	movq	%rbx, %rdx
	call	cudaMemset@PLT
	testl	%eax, %eax
	je	.L71
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	leaq	.LC5(%rip), %rdi
	jne	.L81
.L80:
	call	_Z3diePKc
.L71:
	movl	%r12d, 80(%rsp)
	movl	$16777217, %edx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movabsq	$4294967297, %rax
	salq	$8, %rdx
	movl	$1, %ecx
	movq	%rax, 84(%rsp)
	movq	80(%rsp), %rdi
	movl	88(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L73
	pushq	72(%rsp)
	.cfi_def_cfa_offset 184
	movl	%r14d, %edx
	movl	%r12d, %r9d
	movl	%r15d, %r8d
	pushq	72(%rsp)
	.cfi_def_cfa_offset 192
	movl	%r13d, %edi
	movl	44(%rsp), %ecx
	movq	72(%rsp), %rsi
	call	_Z44__device_stub__Z13calc_one_shediPKtiiiiPKiPyiPKtiiiiPKiPy
	popq	%rax
	.cfi_def_cfa_offset 184
	popq	%rdx
	.cfi_def_cfa_offset 176
.L73:
	movq	72(%rsp), %rsi
	movq	40(%rsp), %rdi
	movl	$2, %ecx
	movq	%rbx, %rdx
	call	cudaMemcpy@PLT
	testl	%eax, %eax
	jne	.L70
	movq	56(%rsp), %rdi
	call	cudaFree@PLT
	testl	%eax, %eax
	je	.L74
.L76:
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	leaq	.LC4(%rip), %rdi
	je	.L80
	jmp	.L81
.L74:
	movq	64(%rsp), %rdi
	call	cudaFree@PLT
	testl	%eax, %eax
	jne	.L76
	movq	72(%rsp), %rdi
	call	cudaFree@PLT
	testl	%eax, %eax
	jne	.L76
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	je	.L77
.L81:
	call	__stack_chk_fail@PLT
.L77:
	addq	$120, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4014:
	.size	_Z10calc_shedsiPKtiiiiPKiPy, .-_Z10calc_shedsiPKtiiiiPKiPy
	.globl	_Z52__device_stub__Z15calc_extra_areaiiPKiS0_PKyiiiS2_PiiiPKiS0_PKyiiiS2_Pi
	.type	_Z52__device_stub__Z15calc_extra_areaiiPKiS0_PKyiiiS2_PiiiPKiS0_PKyiiiS2_Pi, @function
_Z52__device_stub__Z15calc_extra_areaiiPKiS0_PKyiiiS2_PiiiPKiS0_PKyiiiS2_Pi:
.LFB4049:
	.cfi_startproc
	endbr64
	subq	$232, %rsp
	.cfi_def_cfa_offset 240
	movq	256(%rsp), %rax
	movl	%edi, 60(%rsp)
	leaq	88(%rsp), %rdi
	movl	%esi, 56(%rsp)
	leaq	100(%rsp), %rsi
	movq	%rax, 16(%rsp)
	movq	264(%rsp), %rax
	movq	%rdx, 48(%rsp)
	leaq	72(%rsp), %rdx
	movq	%rcx, 40(%rsp)
	leaq	80(%rsp), %rcx
	movq	%r8, 32(%rsp)
	movl	%r9d, 28(%rsp)
	movq	%rax, 8(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 216(%rsp)
	xorl	%eax, %eax
	leaq	60(%rsp), %rax
	movl	$1, 96(%rsp)
	movq	%rax, 136(%rsp)
	leaq	56(%rsp), %rax
	movq	%rax, 144(%rsp)
	leaq	48(%rsp), %rax
	movq	%rax, 152(%rsp)
	leaq	40(%rsp), %rax
	movq	%rax, 160(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 168(%rsp)
	leaq	28(%rsp), %rax
	movq	%rax, 176(%rsp)
	leaq	240(%rsp), %rax
	movq	%rax, 184(%rsp)
	leaq	248(%rsp), %rax
	movq	%rax, 192(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 200(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 208(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 88(%rsp)
	movq	%rax, 100(%rsp)
	movl	$1, 108(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L82
	pushq	80(%rsp)
	.cfi_def_cfa_offset 248
	leaq	_Z15calc_extra_areaiiPKiS0_PKyiiiS2_Pi(%rip), %rdi
	pushq	80(%rsp)
	.cfi_def_cfa_offset 256
	movq	116(%rsp), %rcx
	movl	124(%rsp), %r8d
	movq	104(%rsp), %rsi
	movl	112(%rsp), %edx
	leaq	152(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 248
	popq	%rdx
	.cfi_def_cfa_offset 240
.L82:
	movq	216(%rsp), %rax
	subq	%fs:40, %rax
	je	.L84
	call	__stack_chk_fail@PLT
.L84:
	addq	$232, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4049:
	.size	_Z52__device_stub__Z15calc_extra_areaiiPKiS0_PKyiiiS2_PiiiPKiS0_PKyiiiS2_Pi, .-_Z52__device_stub__Z15calc_extra_areaiiPKiS0_PKyiiiS2_PiiiPKiS0_PKyiiiS2_Pi
	.globl	_Z15calc_extra_areaiiPKiS0_PKyiiiS2_Pi
	.type	_Z15calc_extra_areaiiPKiS0_PKyiiiS2_Pi, @function
_Z15calc_extra_areaiiPKiS0_PKyiiiS2_Pi:
.LFB4050:
	.cfi_startproc
	endbr64
	jmp	_Z52__device_stub__Z15calc_extra_areaiiPKiS0_PKyiiiS2_PiiiPKiS0_PKyiiiS2_Pi
	.cfi_endproc
.LFE4050:
	.size	_Z15calc_extra_areaiiPKiS0_PKyiiiS2_Pi, .-_Z15calc_extra_areaiiPKiS0_PKyiiiS2_Pi
	.globl	_Z56__device_stub__Z10union_areaiiiiPKiPKyiiiiPKciiiS2_PiS5_iiiiPKiPKyiiiiPKciiiS2_PiS5_
	.type	_Z56__device_stub__Z10union_areaiiiiPKiPKyiiiiPKciiiS2_PiS5_iiiiPKiPKyiiiiPKciiiS2_PiS5_, @function
_Z56__device_stub__Z10union_areaiiiiPKiPKyiiiiPKciiiS2_PiS5_iiiiPKiPKyiiiiPKciiiS2_PiS5_:
.LFB4051:
	.cfi_startproc
	endbr64
	subq	$280, %rsp
	.cfi_def_cfa_offset 288
	movq	320(%rsp), %rax
	movl	%edi, 60(%rsp)
	leaq	80(%rsp), %rdi
	movl	%esi, 56(%rsp)
	leaq	92(%rsp), %rsi
	movq	%rax, 24(%rsp)
	movq	352(%rsp), %rax
	movl	%edx, 52(%rsp)
	leaq	64(%rsp), %rdx
	movq	%rax, 16(%rsp)
	movq	360(%rsp), %rax
	movl	%ecx, 48(%rsp)
	leaq	72(%rsp), %rcx
	movq	%rax, 8(%rsp)
	movq	368(%rsp), %rax
	movq	%r8, 40(%rsp)
	movq	%r9, 32(%rsp)
	movq	%rax, (%rsp)
	movq	%fs:40, %rax
	movq	%rax, 264(%rsp)
	xorl	%eax, %eax
	leaq	60(%rsp), %rax
	movq	%rax, 128(%rsp)
	leaq	56(%rsp), %rax
	movq	%rax, 136(%rsp)
	leaq	52(%rsp), %rax
	movq	%rax, 144(%rsp)
	leaq	48(%rsp), %rax
	movq	%rax, 152(%rsp)
	leaq	40(%rsp), %rax
	movq	%rax, 160(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 168(%rsp)
	leaq	288(%rsp), %rax
	movq	%rax, 176(%rsp)
	leaq	296(%rsp), %rax
	movq	%rax, 184(%rsp)
	leaq	304(%rsp), %rax
	movq	%rax, 192(%rsp)
	leaq	312(%rsp), %rax
	movq	%rax, 200(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 208(%rsp)
	leaq	328(%rsp), %rax
	movq	%rax, 216(%rsp)
	leaq	336(%rsp), %rax
	movq	%rax, 224(%rsp)
	leaq	344(%rsp), %rax
	movq	%rax, 232(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 240(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 248(%rsp)
	movq	%rsp, %rax
	movq	%rax, 256(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 80(%rsp)
	movl	$1, 88(%rsp)
	movq	%rax, 92(%rsp)
	movl	$1, 100(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L87
	pushq	72(%rsp)
	.cfi_def_cfa_offset 296
	leaq	_Z10union_areaiiiiPKiPKyiiiiPKciiiS2_PiS5_(%rip), %rdi
	pushq	72(%rsp)
	.cfi_def_cfa_offset 304
	movq	108(%rsp), %rcx
	movl	116(%rsp), %r8d
	movq	96(%rsp), %rsi
	movl	104(%rsp), %edx
	leaq	144(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 296
	popq	%rdx
	.cfi_def_cfa_offset 288
.L87:
	movq	264(%rsp), %rax
	subq	%fs:40, %rax
	je	.L89
	call	__stack_chk_fail@PLT
.L89:
	addq	$280, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4051:
	.size	_Z56__device_stub__Z10union_areaiiiiPKiPKyiiiiPKciiiS2_PiS5_iiiiPKiPKyiiiiPKciiiS2_PiS5_, .-_Z56__device_stub__Z10union_areaiiiiPKiPKyiiiiPKciiiS2_PiS5_iiiiPKiPKyiiiiPKciiiS2_PiS5_
	.globl	_Z10union_areaiiiiPKiPKyiiiiPKciiiS2_PiS5_
	.type	_Z10union_areaiiiiPKiPKyiiiiPKciiiS2_PiS5_, @function
_Z10union_areaiiiiPKiPKyiiiiPKciiiS2_PiS5_:
.LFB4052:
	.cfi_startproc
	endbr64
	jmp	_Z56__device_stub__Z10union_areaiiiiPKiPKyiiiiPKciiiS2_PiS5_iiiiPKiPKyiiiiPKciiiS2_PiS5_
	.cfi_endproc
.LFE4052:
	.size	_Z10union_areaiiiiPKiPKyiiiiPKciiiS2_PiS5_, .-_Z10union_areaiiiiPKiPKyiiiiPKciiiS2_PiS5_
	.globl	_Z37__device_stub__Z10findtopobsiPKcPKiPiiPKcPKiPi
	.type	_Z37__device_stub__Z10findtopobsiPKcPKiPiiPKcPKiPi, @function
_Z37__device_stub__Z10findtopobsiPKcPKiPiiPKcPKiPi:
.LFB4053:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movl	%edi, 28(%rsp)
	leaq	56(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	68(%rsp), %rsi
	movq	%rdx, 8(%rsp)
	leaq	40(%rsp), %rdx
	movq	%rcx, (%rsp)
	leaq	48(%rsp), %rcx
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rax
	movl	$1, 64(%rsp)
	movq	%rax, 104(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 120(%rsp)
	movq	%rsp, %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 56(%rsp)
	movq	%rax, 68(%rsp)
	movl	$1, 76(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L92
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z10findtopobsiPKcPKiPi(%rip), %rdi
	pushq	48(%rsp)
	.cfi_def_cfa_offset 176
	movq	84(%rsp), %rcx
	movl	92(%rsp), %r8d
	movq	72(%rsp), %rsi
	movl	80(%rsp), %edx
	leaq	120(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L92:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L94
	call	__stack_chk_fail@PLT
.L94:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4053:
	.size	_Z37__device_stub__Z10findtopobsiPKcPKiPiiPKcPKiPi, .-_Z37__device_stub__Z10findtopobsiPKcPKiPiiPKcPKiPi
	.globl	_Z10findtopobsiPKcPKiPi
	.type	_Z10findtopobsiPKcPKiPi, @function
_Z10findtopobsiPKcPKiPi:
.LFB4054:
	.cfi_startproc
	endbr64
	jmp	_Z37__device_stub__Z10findtopobsiPKcPKiPiiPKcPKiPi
	.cfi_endproc
.LFE4054:
	.size	_Z10findtopobsiPKcPKiPi, .-_Z10findtopobsiPKcPKiPi
	.globl	_Z45__device_stub__Z10calc_unioniiiPKiPKyiiiiPcPyiiiPKiPKyiiiiPcPy
	.type	_Z45__device_stub__Z10calc_unioniiiPKiPKyiiiiPcPyiiiPKiPKyiiiiPcPy, @function
_Z45__device_stub__Z10calc_unioniiiPKiPKyiiiiPcPyiiiPKiPKyiiiiPcPy:
.LFB4055:
	.cfi_startproc
	endbr64
	subq	$216, %rsp
	.cfi_def_cfa_offset 224
	movq	248(%rsp), %rax
	movl	%edi, 44(%rsp)
	leaq	64(%rsp), %rdi
	movl	%esi, 40(%rsp)
	leaq	76(%rsp), %rsi
	movq	%rax, 8(%rsp)
	movq	256(%rsp), %rax
	movl	%edx, 36(%rsp)
	leaq	48(%rsp), %rdx
	movq	%rcx, 24(%rsp)
	leaq	56(%rsp), %rcx
	movq	%r8, 16(%rsp)
	movl	%r9d, 32(%rsp)
	movq	%rax, (%rsp)
	movq	%fs:40, %rax
	movq	%rax, 200(%rsp)
	xorl	%eax, %eax
	leaq	44(%rsp), %rax
	movl	$1, 72(%rsp)
	movq	%rax, 112(%rsp)
	leaq	40(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	36(%rsp), %rax
	movq	%rax, 128(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 136(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 144(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 152(%rsp)
	leaq	224(%rsp), %rax
	movq	%rax, 160(%rsp)
	leaq	232(%rsp), %rax
	movq	%rax, 168(%rsp)
	leaq	240(%rsp), %rax
	movq	%rax, 176(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 184(%rsp)
	movq	%rsp, %rax
	movq	%rax, 192(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 64(%rsp)
	movq	%rax, 76(%rsp)
	movl	$1, 84(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L97
	pushq	56(%rsp)
	.cfi_def_cfa_offset 232
	leaq	_Z10calc_unioniiiPKiPKyiiiiPcPy(%rip), %rdi
	pushq	56(%rsp)
	.cfi_def_cfa_offset 240
	movq	92(%rsp), %rcx
	movl	100(%rsp), %r8d
	movq	80(%rsp), %rsi
	movl	88(%rsp), %edx
	leaq	128(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 232
	popq	%rdx
	.cfi_def_cfa_offset 224
.L97:
	movq	200(%rsp), %rax
	subq	%fs:40, %rax
	je	.L99
	call	__stack_chk_fail@PLT
.L99:
	addq	$216, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4055:
	.size	_Z45__device_stub__Z10calc_unioniiiPKiPKyiiiiPcPyiiiPKiPKyiiiiPcPy, .-_Z45__device_stub__Z10calc_unioniiiPKiPKyiiiiPcPyiiiPKiPKyiiiiPcPy
	.globl	_Z10calc_unioniiiPKiPKyiiiiPcPy
	.type	_Z10calc_unioniiiPKiPKyiiiiPcPy, @function
_Z10calc_unioniiiPKiPKyiiiiPcPy:
.LFB4056:
	.cfi_startproc
	endbr64
	jmp	_Z45__device_stub__Z10calc_unioniiiPKiPKyiiiiPcPyiiiPKiPKyiiiiPcPy
	.cfi_endproc
.LFE4056:
	.size	_Z10calc_unioniiiPKiPKyiiiiPcPy, .-_Z10calc_unioniiiPKiPKyiiiiPcPy
	.section	.rodata.str1.1
.LC8:
	.string	" nusedsheds:"
.LC9:
	.string	" coverage:"
	.text
	.globl	_Z7site_itiiiiPKiPKyPc
	.type	_Z7site_itiiiiPKiPKyPc, @function
_Z7site_itiiiiPKiPKyPc:
.LFB4017:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$1000, %rsp
	.cfi_def_cfa_offset 1056
	movq	1056(%rsp), %rax
	movl	%ecx, 16(%rsp)
	movl	$64, %ecx
	movl	%edx, 60(%rsp)
	movslq	16(%rsp), %r12
	movl	%esi, 20(%rsp)
	movq	%r8, 64(%rsp)
	movq	%rax, 88(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 984(%rsp)
	movl	%esi, %eax
	addl	%eax, %eax
	leal	1(%rax), %ebp
	addl	$64, %eax
	cltd
	idivl	%ecx
	movl	%eax, 24(%rsp)
	leal	63(%rdi), %eax
	cltd
	idivl	%ecx
	movl	%eax, 28(%rsp)
	movabsq	$2305843009213693950, %rax
	cmpq	%r12, %rax
	jb	.L103
	leaq	0(,%r12,4), %rax
	movl	%edi, %ebx
	movq	%r9, %r13
	movq	%rax, %rdi
	movq	%rax, (%rsp)
	call	_Znam@PLT
	movq	%r12, %rdi
	movq	%rax, 40(%rsp)
	call	_Znam@PLT
	leaq	0(,%r12,4), %rdi
	movq	%rax, %r14
	call	_Znam@PLT
	movq	%rax, 48(%rsp)
	xorl	%eax, %eax
	jmp	.L104
.L103:
	movq	984(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L140
	call	__cxa_throw_bad_array_new_length@PLT
.L104:
	cmpl	%eax, 16(%rsp)
	jle	.L142
	movb	$0, (%r14,%rax)
	incq	%rax
	jmp	.L104
.L142:
	movq	(%rsp), %rsi
	leaq	104(%rsp), %rdi
	call	cudaMalloc@PLT
	testl	%eax, %eax
	je	.L107
.L109:
	movq	984(%rsp), %rax
	subq	%fs:40, %rax
	leaq	.LC2(%rip), %rdi
	je	.L141
	jmp	.L140
.L107:
	movl	16(%rsp), %eax
	movl	24(%rsp), %ecx
	leaq	112(%rsp), %rdi
	imull	%ebp, %eax
	imull	%ecx, %eax
	cltq
	leaq	0(,%rax,8), %r15
	movq	%r15, %rsi
	call	cudaMalloc@PLT
	testl	%eax, %eax
	jne	.L109
	leaq	120(%rsp), %rdi
	movq	%r12, %rsi
	call	cudaMalloc@PLT
	testl	%eax, %eax
	jne	.L109
	movl	28(%rsp), %eax
	leaq	128(%rsp), %rdi
	imull	%ebx, %eax
	cltq
	salq	$3, %rax
	movq	%rax, %rsi
	movq	%rax, 8(%rsp)
	call	cudaMalloc@PLT
	testl	%eax, %eax
	jne	.L109
	movq	(%rsp), %rsi
	leaq	136(%rsp), %rdi
	call	cudaMalloc@PLT
	testl	%eax, %eax
	jne	.L109
	leaq	144(%rsp), %rdi
	movl	$800, %esi
	call	cudaMalloc@PLT
	testl	%eax, %eax
	jne	.L109
	movq	(%rsp), %rdx
	movq	64(%rsp), %rsi
	movl	$1, %ecx
	movq	104(%rsp), %rdi
	call	cudaMemcpy@PLT
	testl	%eax, %eax
	je	.L110
.L112:
	movq	984(%rsp), %rax
	subq	%fs:40, %rax
	leaq	.LC3(%rip), %rdi
	je	.L141
	jmp	.L140
.L110:
	movq	112(%rsp), %rdi
	movl	$1, %ecx
	movq	%r15, %rdx
	movq	%r13, %rsi
	call	cudaMemcpy@PLT
	testl	%eax, %eax
	jne	.L112
	movq	120(%rsp), %rdi
	xorl	%esi, %esi
	movq	%r12, %rdx
	call	cudaMemset@PLT
	testl	%eax, %eax
	je	.L113
.L115:
	movq	984(%rsp), %rax
	subq	%fs:40, %rax
	leaq	.LC5(%rip), %rdi
	je	.L141
	jmp	.L140
.L113:
	movq	8(%rsp), %rdx
	movq	128(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaMemset@PLT
	testl	%eax, %eax
	jne	.L115
	leaq	152(%rsp), %rdi
	movl	$2000000, %esi
	call	cudaMalloc@PLT
	testl	%eax, %eax
	jne	.L109
	movq	(%rsp), %rdx
	movq	136(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaMemset@PLT
	testl	%eax, %eax
	jne	.L115
	movl	16(%rsp), %eax
	xorl	%ecx, %ecx
	movl	$1, %r13d
	orl	$-1, %r12d
	movl	%ecx, 32(%rsp)
	addl	$255, %eax
	movl	%ecx, 56(%rsp)
	sarl	$8, %eax
	movl	%ecx, 36(%rsp)
	movl	%eax, 80(%rsp)
	movslq	%ebp, %rax
	salq	$2, %rax
	movq	%rax, 72(%rsp)
	movl	%ebx, %eax
	imull	%ebx, %eax
	movl	%eax, 84(%rsp)
.L124:
	movq	152(%rsp), %rdi
	leal	-1(%r13), %eax
	xorl	%esi, %esi
	movl	$2000000, %edx
	movl	%eax, 8(%rsp)
	call	cudaMemset@PLT
	testl	%eax, %eax
	jne	.L115
	movl	$16777217, %eax
	movl	$16777217, %edx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	salq	$8, %rax
	salq	$8, %rdx
	movl	$1, %ecx
	movl	$1, 180(%rsp)
	movq	%rax, 172(%rsp)
	movl	80(%rsp), %eax
	movl	%eax, 160(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 164(%rsp)
	movq	160(%rsp), %rdi
	movl	168(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L116
	pushq	%rdx
	.cfi_def_cfa_offset 1064
	movl	%ebx, %edi
	pushq	160(%rsp)
	.cfi_def_cfa_offset 1072
	pushq	152(%rsp)
	.cfi_def_cfa_offset 1080
	pushq	152(%rsp)
	.cfi_def_cfa_offset 1088
	movl	88(%rsp), %eax
	pushq	%rax
	.cfi_def_cfa_offset 1096
	movl	76(%rsp), %eax
	pushq	%rax
	.cfi_def_cfa_offset 1104
	pushq	%r12
	.cfi_def_cfa_offset 1112
	pushq	176(%rsp)
	.cfi_def_cfa_offset 1120
	movl	72(%rsp), %eax
	pushq	%rax
	.cfi_def_cfa_offset 1128
	movl	100(%rsp), %eax
	pushq	%rax
	.cfi_def_cfa_offset 1136
	movl	104(%rsp), %eax
	pushq	%rax
	.cfi_def_cfa_offset 1144
	pushq	%rbp
	.cfi_def_cfa_offset 1152
	movq	208(%rsp), %r9
	movq	200(%rsp), %r8
	movl	112(%rsp), %ecx
	movl	156(%rsp), %edx
	movl	116(%rsp), %esi
	call	_Z56__device_stub__Z10union_areaiiiiPKiPKyiiiiPKciiiS2_PiS5_iiiiPKiPKyiiiiPKciiiS2_PiS5_
	addq	$96, %rsp
	.cfi_def_cfa_offset 1056
.L116:
	leaq	100(%rsp), %rdi
	movl	$2, %ecx
	movl	$4, %edx
	movq	152(%rsp), %rax
	leaq	1999996(%rax), %rsi
	call	cudaMemcpy@PLT
	testl	%eax, %eax
	jne	.L112
	movl	100(%rsp), %edx
	movl	%ebp, 172(%rsp)
	xorl	%r9d, %r9d
	movabsq	$4294967297, %rax
	movq	%rax, 176(%rsp)
	movq	72(%rsp), %r8
	movl	%edx, 160(%rsp)
	movl	180(%rsp), %ecx
	movq	%rax, 164(%rsp)
	movq	172(%rsp), %rdx
	movq	160(%rsp), %rdi
	movl	168(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L117
	pushq	136(%rsp)
	.cfi_def_cfa_offset 1064
	movl	%ebp, %r9d
	movl	%ebx, %edi
	pushq	136(%rsp)
	.cfi_def_cfa_offset 1072
	movl	44(%rsp), %eax
	pushq	%rax
	.cfi_def_cfa_offset 1080
	movl	48(%rsp), %eax
	pushq	%rax
	.cfi_def_cfa_offset 1088
	movq	144(%rsp), %r8
	movq	184(%rsp), %rcx
	movq	136(%rsp), %rdx
	movl	52(%rsp), %esi
	call	_Z52__device_stub__Z15calc_extra_areaiiPKiS0_PKyiiiS2_PiiiPKiS0_PKyiiiS2_Pi
	addq	$32, %rsp
	.cfi_def_cfa_offset 1056
.L117:
	call	cudaDeviceSynchronize@PLT
	movl	$16777217, %eax
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	salq	$8, %rax
	movl	$1073741849, %edi
	movl	$1, %ecx
	movl	$1, %esi
	salq	$2, %rdi
	movq	%rax, %rdx
	movq	%rax, 172(%rsp)
	movl	$1, 180(%rsp)
	movq	%rdi, 160(%rsp)
	movl	$1, 168(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L118
	movq	144(%rsp), %rcx
	movq	136(%rsp), %rdx
	movq	120(%rsp), %rsi
	movl	16(%rsp), %edi
	call	_Z37__device_stub__Z10findtopobsiPKcPKiPiiPKcPKiPi
.L118:
	leaq	184(%rsp), %r12
	movl	$2, %ecx
	movl	$800, %edx
	movq	144(%rsp), %rsi
	movq	%r12, %rdi
	call	cudaMemcpy@PLT
	testl	%eax, %eax
	jne	.L112
	movq	%r12, %rax
	leaq	584(%rsp), %rcx
	xorl	%r15d, %r15d
	xorl	%r12d, %r12d
.L120:
	movl	400(%rax), %edx
	cmpl	%r15d, %edx
	jle	.L119
	movl	(%rax), %r12d
	movl	%edx, %r15d
.L119:
	addq	$4, %rax
	cmpq	%rcx, %rax
	jne	.L120
	testl	%r15d, %r15d
	je	.L121
	movq	40(%rsp), %rax
	movq	64(%rsp), %rcx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	%ebp, 160(%rsp)
	movl	%r12d, -4(%rax,%r13,4)
	movslq	%r12d, %rax
	movb	$1, (%r14,%rax)
	movl	(%rcx,%rax,4), %eax
	movl	$1, %ecx
	movl	%r13d, 8(%rsp)
	movl	$1, 180(%rsp)
	cltd
	idivl	%ebx
	movl	%edx, 56(%rsp)
	movabsq	$4294967297, %rdx
	movq	%rdx, 164(%rsp)
	movq	160(%rsp), %rdi
	movl	168(%rsp), %esi
	movl	%eax, 36(%rsp)
	movq	%rdx, 172(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L122
	pushq	%rax
	.cfi_def_cfa_offset 1064
	movl	%ebp, %r9d
	movl	%ebx, %edi
	pushq	136(%rsp)
	.cfi_def_cfa_offset 1072
	pushq	136(%rsp)
	.cfi_def_cfa_offset 1080
	pushq	%r12
	.cfi_def_cfa_offset 1088
	movl	60(%rsp), %eax
	pushq	%rax
	.cfi_def_cfa_offset 1096
	movl	64(%rsp), %eax
	pushq	%rax
	.cfi_def_cfa_offset 1104
	movq	160(%rsp), %r8
	movq	152(%rsp), %rcx
	movl	64(%rsp), %edx
	movl	68(%rsp), %esi
	call	_Z45__device_stub__Z10calc_unioniiiPKiPKyiiiiPcPyiiiPKiPKyiiiiPcPy
	addq	$48, %rsp
	.cfi_def_cfa_offset 1056
.L122:
	call	cudaDeviceSynchronize@PLT
	addl	%r15d, 32(%rsp)
	cvtsi2sdl	32(%rsp), %xmm0
	mulsd	.LC6(%rip), %xmm0
	cvtsi2sdl	84(%rsp), %xmm1
	divsd	%xmm1, %xmm0
	comisd	.LC7(%rip), %xmm0
	ja	.L121
	cmpl	$1, 8(%rsp)
	jne	.L123
	movq	(%rsp), %rdx
	movq	48(%rsp), %rdi
	movl	$2, %ecx
	movq	136(%rsp), %rsi
	call	cudaMemcpy@PLT
	testl	%eax, %eax
	jne	.L112
	cmpl	$0, 60(%rsp)
	je	.L123
	movq	(%rsp), %rdx
	movq	136(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaMemset@PLT
	testl	%eax, %eax
	jne	.L115
.L123:
	incq	%r13
	jmp	.L124
.L121:
	leaq	.LC8(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	8(%rsp), %esi
	imull	%ebx, %ebx
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	leaq	.LC9(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	cvtsi2sdl	32(%rsp), %xmm0
	mulsd	.LC6(%rip), %xmm0
	cvtsi2sdl	%ebx, %xmm1
	movq	%rax, %rdi
	divsd	%xmm1, %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	104(%rsp), %rdi
	call	cudaFree@PLT
	testl	%eax, %eax
	je	.L125
.L127:
	movq	984(%rsp), %rax
	subq	%fs:40, %rax
	leaq	.LC4(%rip), %rdi
	jne	.L140
.L141:
	call	_Z3diePKc
.L125:
	movq	112(%rsp), %rdi
	call	cudaFree@PLT
	testl	%eax, %eax
	jne	.L127
	movq	120(%rsp), %rdi
	call	cudaFree@PLT
	testl	%eax, %eax
	jne	.L127
	movq	128(%rsp), %rdi
	call	cudaFree@PLT
	testl	%eax, %eax
	jne	.L127
	movq	136(%rsp), %rdi
	call	cudaFree@PLT
	testl	%eax, %eax
	jne	.L127
	movq	144(%rsp), %rdi
	call	cudaFree@PLT
	testl	%eax, %eax
	jne	.L127
	movq	152(%rsp), %rdi
	call	cudaFree@PLT
	testl	%eax, %eax
	jne	.L127
	xorl	%eax, %eax
.L128:
	cmpl	%eax, 16(%rsp)
	jle	.L143
	movb	(%r14,%rax), %dl
	movq	88(%rsp), %rbx
	movb	%dl, (%rbx,%rax)
	incq	%rax
	jmp	.L128
.L143:
	movq	40(%rsp), %rdi
	call	_ZdaPv@PLT
	movq	%r14, %rdi
	call	_ZdaPv@PLT
	movq	48(%rsp), %rdi
	call	_ZdaPv@PLT
	movq	984(%rsp), %rax
	subq	%fs:40, %rax
	je	.L130
.L140:
	call	__stack_chk_fail@PLT
.L130:
	addq	$1000, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4017:
	.size	_Z7site_itiiiiPKiPKyPc, .-_Z7site_itiiiiPKiPKyPc
	.section	.rodata.str1.1
.LC10:
	.string	"_Z10calc_unioniiiPKiPKyiiiiPcPy"
.LC11:
	.string	"_Z10findtopobsiPKcPKiPi"
.LC12:
	.string	"_Z10union_areaiiiiPKiPKyiiiiPKciiiS2_PiS5_"
.LC13:
	.string	"_Z15calc_extra_areaiiPKiS0_PKyiiiS2_Pi"
.LC14:
	.string	"_Z13calc_one_shediPKtiiiiPKiPy"
.LC15:
	.string	"_Z17process_one_blockiPhfiiPi"
.LC16:
	.string	"_Z12calc_one_vixiPKtiiiiPh"
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB4058:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	pushq	$0
	.cfi_def_cfa_offset 24
	xorl	%r9d, %r9d
	orl	$-1, %r8d
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC10(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z10calc_unioniiiPKiPKyiiiiPcPy(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC11(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z10findtopobsiPKcPKiPi(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC12(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z10union_areaiiiiPKiPKyiiiiPKciiiS2_PiS5_(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC13(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z15calc_extra_areaiiPKiS0_PKyiiiS2_Pi(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC14(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z13calc_one_shediPKtiiiiPKiPy(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC15(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z17process_one_blockiPhfiiPi(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC16(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z12calc_one_vixiPKtiiiiPh(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE4058:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.rodata.str1.1
.LC17:
	.string	"argc="
.LC18:
	.string	"SITE requires 9 arguments: nrows, roi, oht/tht, ntests, blocksize, nwanted, intervis, infile, outfile"
.LC19:
	.string	"Unreasonable value for nrows"
.LC20:
	.string	"Unreasonable value for roi."
.LC21:
	.string	"Unreasonable value for tht."
.LC22:
	.string	"Unreasonable value for ntests."
.LC23:
	.string	"Unreasonable value for blocksize0."
.LC24:
	.string	"Unreasonable value for nwanted0."
.LC25:
	.string	"Unreasonable value for intervis."
.LC28:
	.string	"The last block is too small for nwantedperblock."
.LC29:
	.string	"Input failed"
.LC30:
	.string	"input:"
.LC31:
	.string	" vix:"
.LC32:
	.string	" findmax:"
.LC33:
	.string	" viewshed:"
.LC34:
	.string	" site:"
.LC35:
	.string	" output:"
.LC36:
	.string	" total:"
	.section	.text.startup
	.globl	main
	.type	main, @function
main:
.LFB4018:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA4018
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	movq	%rsi, %r12
	xorl	%esi, %esi
	pushq	%rbx
	.cfi_offset 3, -56
	movl	%edi, %ebx
	leaq	-1136(%rbp), %rdi
	subq	$1192, %rsp
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	call	gettimeofday@PLT
	movups	-1136(%rbp), %xmm4
	movups	%xmm4, -1120(%rbp)
	cmpl	$10, %ebx
	je	.L147
	leaq	.LC17(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
.LEHB0:
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	%ebx, %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	movq	%rax, %rdi
	call	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
	leaq	.LC18(%rip), %rdi
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	je	.L186
	jmp	.L183
.L147:
	movq	8(%r12), %rdi
	call	atoi@PLT
	movq	16(%r12), %rdi
	movl	%eax, %r14d
	call	atoi@PLT
	movq	24(%r12), %rdi
	movl	%eax, -1160(%rbp)
	call	atoi@PLT
	movq	32(%r12), %rdi
	movl	%eax, -1144(%rbp)
	call	atoi@PLT
	movq	40(%r12), %rdi
	movl	%eax, -1208(%rbp)
	call	atoi@PLT
	movq	48(%r12), %rdi
	movl	%eax, %r15d
	call	atoi@PLT
	movq	56(%r12), %rdi
	movl	%eax, %ebx
	call	atoi@PLT
	movl	%eax, -1184(%rbp)
	leal	-1(%r14), %eax
	cmpl	$19999, %eax
	jbe	.L149
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	leaq	.LC19(%rip), %rdi
	je	.L186
	jmp	.L183
.L149:
	movl	-1160(%rbp), %eax
	decl	%eax
	cmpl	$9999, %eax
	jbe	.L151
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	leaq	.LC20(%rip), %rdi
	jne	.L183
.L186:
	call	_Z3diePKc
.L151:
	cmpl	$1000000, -1144(%rbp)
	jbe	.L153
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	leaq	.LC21(%rip), %rdi
	je	.L186
	jmp	.L183
.L153:
	movl	-1208(%rbp), %eax
	decl	%eax
	cmpl	$999, %eax
	jbe	.L155
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	leaq	.LC22(%rip), %rdi
	je	.L186
	jmp	.L183
.L155:
	movl	%r15d, %eax
	subl	$10, %eax
	cmpl	$1990, %eax
	jbe	.L157
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	leaq	.LC23(%rip), %rdi
	je	.L186
	jmp	.L183
.L157:
	leal	-100(%rbx), %eax
	cmpl	$1999900, %eax
	jbe	.L159
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	leaq	.LC24(%rip), %rdi
	je	.L186
	jmp	.L183
.L159:
	cmpl	$1, -1184(%rbp)
	jbe	.L161
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	leaq	.LC25(%rip), %rdi
	je	.L186
	jmp	.L183
.L161:
	cvtsi2ssl	%r14d, %xmm0
	cvtsi2ssl	%r15d, %xmm2
	movaps	%xmm0, %xmm1
	movaps	%xmm0, %xmm3
	divss	%xmm2, %xmm1
	movss	.LC26(%rip), %xmm2
	addss	%xmm2, %xmm1
	cvttss2sil	%xmm1, %eax
	cvtsi2ssl	%eax, %xmm1
	divss	%xmm1, %xmm3
	divss	%xmm3, %xmm0
	movss	%xmm3, -1176(%rbp)
	addss	%xmm2, %xmm0
	cvttss2sil	%xmm0, %r15d
	cvtsi2ssl	%ebx, %xmm0
	movl	%r15d, %eax
	imull	%r15d, %eax
	cvtsi2ssl	%eax, %xmm1
	divss	%xmm1, %xmm0
	addss	.LC27(%rip), %xmm0
	cvttss2sil	%xmm0, %ecx
	imull	%ecx, %eax
	movl	%ecx, -1180(%rbp)
	movl	%eax, -1140(%rbp)
	leal	-1(%r15), %eax
	cvtsi2ssl	%eax, %xmm0
	movl	%r14d, %eax
	mulss	%xmm3, %xmm0
	cvttss2sil	%xmm0, %edx
	subl	%edx, %eax
	imull	%eax, %eax
	cmpl	%eax, %ecx
	jle	.L163
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	leaq	.LC28(%rip), %rdi
	je	.L186
	jmp	.L183
.L163:
	movl	-1160(%rbp), %eax
	leal	(%rax,%rax), %r13d
	movl	%r14d, %eax
	imull	%r14d, %eax
	leal	1(%r13), %ebx
	addl	$64, %r13d
	sarl	$6, %r13d
	cltq
	movq	%rax, -1152(%rbp)
	addq	%rax, %rax
	movq	%rax, %rdi
	movq	%rax, -1216(%rbp)
	call	_Znam@PLT
	movq	-1152(%rbp), %rdi
	movq	%rax, -1168(%rbp)
	call	_Znam@PLT
	movslq	-1140(%rbp), %rdx
	movq	%rax, -1192(%rbp)
	movabsq	$2305843009213693950, %rax
	cmpq	%rdx, %rax
	jb	.L165
	leaq	0(,%rdx,4), %rdi
	movq	%rdx, -1224(%rbp)
	call	_Znam@PLT
	movl	-1140(%rbp), %edi
	movq	%rax, -1152(%rbp)
	imull	%ebx, %edi
	leaq	-576(%rbp), %rbx
	imull	%r13d, %edi
	movslq	%edi, %rdi
	salq	$3, %rdi
	call	_Znam@PLT
	movq	-1224(%rbp), %rdi
	movq	%rax, -1200(%rbp)
	call	_Znam@PLT
	movq	64(%r12), %rsi
	movl	$8, %edx
	movq	%rbx, %rdi
	movq	%rax, %r13
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode@PLT
.LEHE0:
	movq	-1216(%rbp), %rdx
	movq	-1168(%rbp), %rsi
	movq	%rbx, %rdi
.LEHB1:
	call	_ZNSi4readEPcl@PLT
.LEHE1:
	jmp	.L187
.L165:
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L183
.LEHB2:
	call	__cxa_throw_bad_array_new_length@PLT
.LEHE2:
.L187:
	testb	$5, -288(%rbp)
	je	.L168
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L183
	leaq	.LC29(%rip), %rdi
.LEHB3:
	call	_Z3diePKc
.L168:
	leaq	-576(%rbp), %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE5closeEv@PLT
	leaq	-1104(%rbp), %rbx
	xorl	%esi, %esi
	movq	%rbx, %rdi
	call	gettimeofday@PLT
	movq	%rbx, %rsi
	leaq	-1120(%rbp), %rdi
	call	_Z9calc_timeR7timevalS0_
	movups	-1104(%rbp), %xmm7
	leaq	.LC30(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	movq	%xmm0, %rbx
	movups	%xmm7, -1120(%rbp)
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	movq	%rbx, %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	pushq	%r10
	movl	-1144(%rbp), %r8d
	movl	%r14d, %edi
	pushq	-1192(%rbp)
	movl	-1208(%rbp), %r9d
	movl	-1160(%rbp), %edx
	movl	%r8d, %ecx
	movq	-1168(%rbp), %rsi
	.cfi_escape 0x2e,0x10
	call	_Z8calc_vixiPKtiiiiPh
	popq	%r8
	popq	%r9
	.cfi_escape 0x2e,0
	call	cudaDeviceSynchronize@PLT
	leaq	-1104(%rbp), %rbx
	xorl	%esi, %esi
	movq	%rbx, %rdi
	call	gettimeofday@PLT
	leaq	-1120(%rbp), %rdi
	movq	%rbx, %rsi
	call	_Z9calc_timeR7timevalS0_
	movups	-1104(%rbp), %xmm4
	leaq	.LC31(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	movsd	%xmm0, -1208(%rbp)
	movups	%xmm4, -1120(%rbp)
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movsd	-1208(%rbp), %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	-1152(%rbp), %r9
	movl	-1180(%rbp), %r8d
	movl	%r15d, %ecx
	movl	%r14d, %edi
	movl	-1140(%rbp), %edx
	movss	-1176(%rbp), %xmm0
	movq	-1192(%rbp), %rsi
	call	_Z8find_maxiPKhfiiiPi
	call	cudaDeviceSynchronize@PLT
	movq	%rbx, %rdi
	xorl	%esi, %esi
	call	gettimeofday@PLT
	leaq	-1120(%rbp), %rax
	movq	%rbx, %rsi
	movq	%rax, %rdi
	movq	%rax, -1176(%rbp)
	call	_Z9calc_timeR7timevalS0_
	movups	-1104(%rbp), %xmm5
	leaq	.LC32(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	movq	%xmm0, %rbx
	movups	%xmm5, -1120(%rbp)
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	movq	%rbx, %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	pushq	-1200(%rbp)
	movl	-1144(%rbp), %r8d
	movl	%r14d, %edi
	movl	-1140(%rbp), %r9d
	pushq	-1152(%rbp)
	movl	-1160(%rbp), %edx
	movl	%r8d, %ecx
	movq	-1168(%rbp), %rsi
	.cfi_escape 0x2e,0x10
	call	_Z10calc_shedsiPKtiiiiPKiPy
	popq	%rsi
	popq	%rdi
	.cfi_escape 0x2e,0
	call	cudaDeviceSynchronize@PLT
	leaq	-1104(%rbp), %rbx
	xorl	%esi, %esi
	movq	%rbx, %rdi
	call	gettimeofday@PLT
	movq	-1176(%rbp), %rdi
	movq	%rbx, %rsi
	call	_Z9calc_timeR7timevalS0_
	movups	-1104(%rbp), %xmm6
	leaq	.LC33(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	movq	%xmm0, %r15
	movups	%xmm6, -1120(%rbp)
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	movq	%r15, %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	pushq	%rcx
	movq	-1200(%rbp), %r9
	movl	%r14d, %edi
	movq	-1152(%rbp), %r8
	movl	-1140(%rbp), %ecx
	pushq	%r13
	movl	-1184(%rbp), %edx
	movl	-1160(%rbp), %esi
	.cfi_escape 0x2e,0x10
	call	_Z7site_itiiiiPKiPKyPc
	popq	%rax
	popq	%rdx
	.cfi_escape 0x2e,0
	call	cudaDeviceSynchronize@PLT
	xorl	%esi, %esi
	movq	%rbx, %rdi
	leaq	_ZSt4cout(%rip), %r15
	call	gettimeofday@PLT
	movq	-1176(%rbp), %rdi
	movq	%rbx, %rsi
	call	_Z9calc_timeR7timevalS0_
	movups	-1104(%rbp), %xmm7
	leaq	.LC34(%rip), %rsi
	movq	%r15, %rdi
	movsd	%xmm0, -1160(%rbp)
	movups	%xmm7, -1120(%rbp)
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movsd	-1160(%rbp), %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	leaq	-1088(%rbp), %rax
	movq	72(%r12), %rsi
	movl	$16, %edx
	movq	%rax, %rdi
	movq	%rax, -1160(%rbp)
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode@PLT
.LEHE3:
	xorl	%r12d, %r12d
.L170:
	cmpl	%r12d, -1140(%rbp)
	jle	.L188
	cmpb	$0, 0(%r13,%r12)
	jne	.L171
.L172:
	incq	%r12
	jmp	.L170
.L171:
	movq	-1152(%rbp), %rax
	movq	-1160(%rbp), %rdi
	movl	(%rax,%r12,4), %eax
	cltd
	idivl	%r14d
	movl	%eax, %esi
.LEHB4:
	call	_ZNSolsEi@PLT
	movq	%rax, %rdi
	movl	$44, %esi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c@PLT
	movq	%rax, %rdi
	movq	-1152(%rbp), %rax
	movl	(%rax,%r12,4), %eax
	cltd
	idivl	%r14d
	movl	%edx, %esi
	call	_ZNSolsEi@PLT
	movq	%rax, %rdi
	movl	$10, %esi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c@PLT
	jmp	.L172
.L188:
	movq	-1160(%rbp), %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE5closeEv@PLT
	movq	-1168(%rbp), %rdi
	call	_ZdaPv@PLT
	movq	-1192(%rbp), %rdi
	call	_ZdaPv@PLT
	movq	-1152(%rbp), %rdi
	call	_ZdaPv@PLT
	movq	-1200(%rbp), %rdi
	call	_ZdaPv@PLT
	movq	%r13, %rdi
	call	_ZdaPv@PLT
	xorl	%esi, %esi
	movq	%rbx, %rdi
	call	gettimeofday@PLT
	movq	-1176(%rbp), %rdi
	movq	%rbx, %rsi
	call	_Z9calc_timeR7timevalS0_
	movups	-1104(%rbp), %xmm3
	leaq	.LC35(%rip), %rsi
	movq	%r15, %rdi
	movq	%xmm0, %r14
	movups	%xmm3, -1120(%rbp)
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	movq	%r14, %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rbx, %rdi
	xorl	%esi, %esi
	call	gettimeofday@PLT
	movq	%rbx, %rsi
	leaq	-1136(%rbp), %rdi
	call	_Z9calc_timeR7timevalS0_
	leaq	.LC36(%rip), %rsi
	movq	%r15, %rdi
	movq	%xmm0, %rbx
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	movq	%rbx, %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rax, %rdi
	call	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
.LEHE4:
	movq	-1160(%rbp), %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@PLT
	leaq	-576(%rbp), %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	je	.L177
	jmp	.L183
.L180:
	endbr64
	movq	%rax, %rbx
.L174:
	movq	-1160(%rbp), %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@PLT
	jmp	.L175
.L179:
	endbr64
	movq	%rax, %rbx
.L175:
	leaq	-576(%rbp), %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L183
	movq	%rbx, %rdi
.LEHB5:
	call	_Unwind_Resume@PLT
.LEHE5:
.L183:
	call	__stack_chk_fail@PLT
.L177:
	leaq	-40(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4018:
	.globl	__gxx_personality_v0
	.section	.gcc_except_table,"a",@progbits
.LLSDA4018:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE4018-.LLSDACSB4018
.LLSDACSB4018:
	.uleb128 .LEHB0-.LFB4018
	.uleb128 .LEHE0-.LEHB0
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB1-.LFB4018
	.uleb128 .LEHE1-.LEHB1
	.uleb128 .L179-.LFB4018
	.uleb128 0
	.uleb128 .LEHB2-.LFB4018
	.uleb128 .LEHE2-.LEHB2
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB3-.LFB4018
	.uleb128 .LEHE3-.LEHB3
	.uleb128 .L179-.LFB4018
	.uleb128 0
	.uleb128 .LEHB4-.LFB4018
	.uleb128 .LEHE4-.LEHB4
	.uleb128 .L180-.LFB4018
	.uleb128 0
	.uleb128 .LEHB5-.LFB4018
	.uleb128 .LEHE5-.LEHB5
	.uleb128 0
	.uleb128 0
.LLSDACSE4018:
	.section	.text.startup
	.size	main, .-main
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC1:
	.long	0
	.long	1093567616
	.align 8
.LC6:
	.long	0
	.long	1079574528
	.align 8
.LC7:
	.long	0
	.long	1079492608
	.section	.rodata.cst4,"aM",@progbits,4
	.align 4
.LC26:
	.long	1056964608
	.align 4
.LC27:
	.long	1065353048
	.hidden	DW.ref.__gxx_personality_v0
	.weak	DW.ref.__gxx_personality_v0
	.section	.data.rel.local.DW.ref.__gxx_personality_v0,"awG",@progbits,DW.ref.__gxx_personality_v0,comdat
	.align 8
	.type	DW.ref.__gxx_personality_v0, @object
	.size	DW.ref.__gxx_personality_v0, 8
DW.ref.__gxx_personality_v0:
	.quad	__gxx_personality_v0
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

////////////////////////////////////////////////////////////////////////////////
// utilities
////////////////////////////////////////////////////////////////////////////////


#include <hip/hip_runtime.h>
#include <limits.h>  // INT_MIN
#include <math.h>    // sqrt
#include <stdlib.h>  // abs, atoi
#include <sys/time.h>
#include <time.h>
#include <fstream>
#include <iomanip>
#include <iostream>

using namespace std;

typedef unsigned short int usint;
typedef unsigned long long int ullint;

void die(const char *msg) {
  cout << "ERROR: " << msg << endl;
  exit(1);
}

#define RANDOM_MAX 0x7fffffff  // 2^31 - 1

__device__ int random(const int seed) {
  // glibc: m = 2^31; a = 1103515245; c = 12345
  return (int)((1103515245U * ((unsigned)seed & 0x7fffffffU) + 12345U) &
               0x7fffffffU);
}

template <class C>
__device__ C sign(const C x) {
  return x < 0 ? -1 : (x == 0 ? 0 : 1);
}

template <class C>
__host__ __device__ C square(const C x) {
  return x * x;
}

inline double calc_time(struct timeval &begin, struct timeval &end) {
  return ((end.tv_sec - begin.tv_sec) * 1000000u +
          end.tv_usec - begin.tv_usec) / 1e6;
}

////////////////////////////////////////////////////////////////////////////////
// vix
////////////////////////////////////////////////////////////////////////////////

__device__ int test_one_target(const int nrows, const usint *elevs,
                               const int ox, const int oy, const int oz,
                               const int tx, const int ty, const int tz) {
  if (abs(ox - tx) <= 1 && abs(oy - ty) <= 1) return 1;
  int dx = tx - ox, dy = ty - oy;
  int px, py, pz;  // Current point
  int inciny = abs(dx) < abs(dy);
  int sign;
  float slope, zslope;
  sign = (inciny*dy + (1-inciny)*dx) > 0 ? 1 : -1;
  slope = (float)(inciny*dx + (1-inciny)*dy) / (inciny*dy + (1-inciny)*dx);
  zslope = (float)(tz - oz) / (inciny ? dy : dx);
  const int limit = inciny ? dy : dx;
  int stride = 1;
  for (int i = sign; abs(i) < abs(limit); i += stride*sign, stride <<= 1) {  // *= 1.9, 2.2, 2.5
    int j = round(i * slope);
    px = ox + (inciny*j + (1-inciny)*i);
    py = oy + (inciny*i + (1-inciny)*j);
    pz = elevs[px * nrows + py];
    if (pz > oz + i * zslope) return 0;
  }
  return 1;
}

__global__ void calc_one_vix(const int nrows, const usint *elevs,
                             const int roi, const int oht, const int tht,
                             const int ntests, unsigned char *vix) {
  const int bid = blockIdx.y * gridDim.x + blockIdx.x;
  const int tid = bid * blockDim.x + threadIdx.x;
  if (tid >= square(nrows)) return;

  const int ox = tid / nrows;
  const int oy = tid % nrows;
  const int oz = elevs[ox * nrows + oy] + oht;
  int ntarget = 0;
  int nvis = 0;
  const int vsxmax = min(nrows - 1, ox + roi);  // viewshed bounds
  const int vsymax = min(nrows - 1, oy + roi);
  const int vsxmin = max(0, ox - roi);
  const int vsymin = max(0, oy - roi);
  int r = tid;
  // for (int i = 0; i < 10 * ntests; i++) {  // iterate over random targets
  while (ntarget < ntests) {
    int tx, ty, tz;
    int visq;
    r = random(r);
    //tx = (int)(r * (vsxmax - vsxmin + 0.99999f) / RANDOM_MAX) + vsxmin;
    tx = (int)((2*roi+0.99999f)*r/RANDOM_MAX) + (ox-roi);
    r = random(r);
    //ty = (int)(r * (vsymax - vsymin + 0.99999f) / RANDOM_MAX) + vsymin;
    ty = (int)((2*roi+0.99999f)*r/RANDOM_MAX) + (oy-roi);
    // if (tx == 0 && ty == 0) continue;
    if (square(tx - ox) + square(ty - oy) > square(roi)) {
      tx = ox + (tx - ox)/3; // golden
      ty = oy + (ty - oy)/3;
      //continue; // too slow
    }
    if (tx >=0 && tx < nrows && ty >= 0 && ty < nrows) {
        tz = elevs[tx * nrows + ty] + tht;
        visq = test_one_target(nrows, elevs, ox, oy, oz, tx, ty, tz);
        // cout << "test_one_target(" << ox << ',' << oy << ',' << tx << ',' << ty << ")=" << visq << endl;
    } else {
        visq = 0;
    }
    ntarget++;
    if (visq) nvis++;

    // Stopping rule: do at least 10 points.
    // Then, continue until vix >= .5 or <= .1.
    // This could be improved by using the variance, and by looking at
    // other observers, to select the best.

    // if (ntarget >= ntests) break;
    // if (ntarget < 10) continue;
    // if (v >= 0.5 || v <= 0.1) break;
  }
  float v = (float)nvis / ntarget;
  // cout << "obs at (" << ox << ',' << oy << "), z=" << elevs[ox * nrows + oy] 
  //      << ", vix=" << nvis << '/' << ntarget << '=' << v << endl;
  vix[ox * nrows + oy] = (unsigned char)min(255, (int)(v * 255.999f));
}

void calc_vix(const int nrows, const usint *h_elevs,
              const int roi, const int oht, const int tht,
              const int ntests, unsigned char *h_vix) {
  usint *d_elevs;
  unsigned char *d_vix;

  if (hipMalloc((void **)&d_elevs, square(nrows) * sizeof(usint)) != hipSuccess)
    die("hipMalloc failed");
  if (hipMalloc((void **)&d_vix, square(nrows) * sizeof(unsigned char)) != hipSuccess)
    die("hipMalloc failed");
  if (hipMemcpy(d_elevs, h_elevs, square(nrows) * sizeof(usint), hipMemcpyHostToDevice) != hipSuccess)
    die("hipMemcpy failed");

  const size_t dimblock = 128;
  // const size_t dimgrid = square(nrows) / dimblock + (square(nrows) % dimblock ? 1 : 0);
  int s = (int)sqrt(square(nrows) / dimblock);
  if (square(s) * dimblock < square(nrows)) s++;
  const dim3 dimgrid(s, s);
  calc_one_vix<<<dimgrid, dimblock>>>(nrows, d_elevs, roi, oht, tht, ntests, d_vix);

  if (hipMemcpy(h_vix, d_vix, square(nrows) * sizeof(unsigned char), hipMemcpyDeviceToHost) != hipSuccess)
    die("hipMemcpy failed");

  if (hipFree(d_elevs) != hipSuccess) die("hipFree failed");
  if (hipFree(d_vix) != hipSuccess) die("hipFree failed");
}

////////////////////////////////////////////////////////////////////////////////
// findmax
////////////////////////////////////////////////////////////////////////////////

__global__ void process_one_block(const int nrows, unsigned char *vix,
                                  const float blocksize, const int nblockrows,
                                  const int nwantedperblock, int *obs) {
  // no need for if (blockIdx.x >= square(nblockrows)) return;
  extern __shared__ int results[];
  __shared__ int xmin, xmax, ymin, ymax;
  if (threadIdx.x == 0) {
    int bx = blockIdx.x / nblockrows;
    int by = blockIdx.x % nblockrows;
    xmin = (int)(blocksize * bx);
    xmax = min((int)(blocksize * (bx + 1)), nrows);
    ymin = (int)(blocksize * by);
    ymax = min((int)(blocksize * (by + 1)), nrows);
  }
  __syncthreads();

  const int width = ymax - ymin;
  const int npoints = (xmax - xmin) * (ymax - ymin);
  const int npointsperthread = npoints / blockDim.x + (npoints % blockDim.x ? 1 : 0);
  for (int i = 0; i < nwantedperblock; i++) {
    int t = threadIdx.x * npointsperthread;  // the first point, probably used
    int p1x = xmin + t / width;
    int p1y = ymin + t % width;
    unsigned char v1 = vix[p1x * nrows + p1y];
    int h1 = p1x * (p1x + p1y) * 010101010101;
    for (int j = t + 1; j < t + npointsperthread && j < npoints; j++) {
      int p2x = xmin + j / width;
      int p2y = ymin + j % width;
      unsigned char v2 = vix[p2x * nrows + p2y];
      int h2 = p2x * (p2x + p2y) * 010101010101;
      if (v1 < v2 || (v1 == v2 && h1 < h2)) {
        p1x = p2x;
        p1y = p2y;
        v1 = v2;
        h1 = h2;
      }
    }
    results[threadIdx.x * 4] = p1x;
    results[threadIdx.x * 4 + 1] = p1y;
    results[threadIdx.x * 4 + 2] = v1;
    results[threadIdx.x * 4 + 3] = h1;
    if (threadIdx.x == 0) {
      // p1x... is the result of thread 0
      for (int j = 1; j < blockDim.x; j++) {
        int p2x = results[j * 4];
        int p2y = results[j * 4 + 1];
        int v2 = results[j * 4 + 2];
        int h2 = results[j * 4 + 3];
        if (v1 < v2 || (v1 == v2 && h1 < h2)) {
          p1x = p2x;
          p1y = p2y;
          v1 = v2;
          h1 = h2;
        }
      }
      obs[blockIdx.x * nwantedperblock + i] = p1x*nrows + p1y;
      vix[p1x * nrows + p1y] = 0;  // used
    }
    __syncthreads();
  }
}

void find_max(const int nrows, const unsigned char *h_vix,
              const float blocksize, const int nwanted, const int nblockrows,
              const int nwantedperblock, int *h_obs) {
  unsigned char *d_vix;
  int *d_obs;
  if (hipMalloc((void **)&d_vix, square(nrows) * sizeof(unsigned char)) != hipSuccess)
    die("hipMalloc failed");
  if (hipMalloc((void **)&d_obs, nwanted * sizeof(int)) != hipSuccess)
    die("hipMalloc failed");
  if (hipMemcpy(d_vix, h_vix, square(nrows) * sizeof(unsigned char), hipMemcpyHostToDevice) != hipSuccess)
    die("hipMemcpy failed");

  const size_t dimgrid = square(nblockrows);  // two dimensional
  const size_t dimblock = 256;
  process_one_block<<<dimgrid, dimblock, dimblock * 4 * sizeof(int)>>>(
      nrows, d_vix, blocksize, nblockrows, nwantedperblock, d_obs);

  if (hipMemcpy(h_obs, d_obs, nwanted * sizeof(int), hipMemcpyDeviceToHost) != hipSuccess)
    die("hipMemcpy failed");

  if (hipFree(d_vix) != hipSuccess) die("hipFree failed");
  if (hipFree(d_obs) != hipSuccess) die("hipFree failed");
}

////////////////////////////////////////////////////////////////////////////////
// viewshed
////////////////////////////////////////////////////////////////////////////////

__device__ void set_vis(const int nwpr, const int row, const int col,
                        ullint *shed) {
  atomicOr(&shed[row * nwpr + col / 64], 1ULL << (63 - col % 64));
}

__global__ void calc_one_shed(const int nrows, const usint *elevs,
                              const int roi, const int oht, const int tht,
                              const int nsheds, const int *obs,
                              ullint *sheds) {
  if (blockIdx.x >= nsheds) return;
  const int nr = 2 * roi + 1;
  const int nwpr = (nr + 63) / 64;
  ullint * const thisshed = &sheds[blockIdx.x * nr * nwpr];
  __shared__ int ox, oy, oz;
  if (threadIdx.x == 0) {
    ox = obs[blockIdx.x]/nrows;
    oy = obs[blockIdx.x]%nrows;
    oz = elevs[ox * nrows + oy] + oht;
    set_vis(nwpr, roi, roi, thisshed);
  }
  __syncthreads();

  // Clipping xmin etc at 0, nrows-1 makes the viewshed depend on the roi, so don't.
  const int xmin = ox - roi;
  const int ymin = oy - roi;
  const int xmax = ox + roi;
  const int ymax = oy + roi;
  const int xwidth = xmax - xmin;
  const int ywidth = ymax - ymin;
  const int perimeter = 2 * (xwidth + ywidth);  // This formula is subtle
  const int ntpt = perimeter / blockDim.x + (perimeter % blockDim.x ? 1 : 0);
  int dx, dy;
  int tx, ty;
  int px, py;  // Current point
  int inciny;
  int sign;
  float slope, zslope;

  const int sector = threadIdx.x;
  for (int ip = sector * ntpt; ip < (sector + 1) * ntpt && ip < perimeter; ip++) {
    if (ip < xwidth) {
      tx = xmin + ip;
      ty = ymin;
    } else if (ip < 2 * xwidth) {
      tx = 1 + xmin - xwidth + ip;
      ty = ymax;
    } else if (ip < 2 * xwidth + ywidth) {
      tx = xmin;
      ty = 1 + ymin - 2 * xwidth + ip;
    } else {
      tx = xmax;
      ty = ymin - 2 * xwidth - ywidth + ip;
    }

    // Run a line of sight out from obs to target.
    dx = tx - ox;
    dy = ty - oy;
    inciny = abs(dx) < abs(dy);
    sign = (inciny*dy + (1-inciny)*dx) > 0 ? 1 : -1;
    slope = (float)(inciny*dx + (1-inciny)*dy) / (inciny*dy + (1-inciny)*dx);
    zslope = -99999.f;

    // i=0 would be the observer, which is always visible.
    for (int i = sign; i != (inciny ? dy : dx) + sign; i += sign) {
      int j = round(i * slope);
      px = ox + (inciny*j + (1-inciny)*i);
      py = oy + (inciny*i + (1-inciny)*j);

      // Have we reached the edge of the area?
      if (px < 0 || px >= nrows || py < 0 || py >= nrows) break;
      if (square(px - ox) + square(py - oy) > square(roi)) break;

      int pelev = elevs[px * nrows + py];
      float s = (float)(pelev - oz) / abs(i);
      if (zslope < s) zslope = s;
      float hz = oz + zslope * abs(i);
      if (pelev + tht >= hz)
        set_vis(nwpr, px - ox + roi, py - oy + roi, thisshed);
    }
  }
}

void calc_sheds(const int nrows, const usint *h_elevs,
                const int roi, const int oht, const int tht,
                const int nsheds, const int *h_obs,
                ullint *h_sheds) {
  usint *d_elevs;
  int *d_obs;
  ullint *d_sheds;
  const int nr = 2 * roi + 1;
  const int nwpr = (nr + 63) / 64;

  if (hipMalloc((void **)&d_elevs, square(nrows) * sizeof(usint)) != hipSuccess)
    die("hipMalloc failed");
  if (hipMalloc((void **)&d_obs, nsheds * sizeof(int)) != hipSuccess)
    die("hipMalloc failed");
  if (hipMalloc((void **)&d_sheds, nsheds * nr * nwpr * sizeof(ullint)) != hipSuccess)
    die("hipMalloc failed");
  if (hipMemcpy(d_elevs, h_elevs, square(nrows) * sizeof(usint), hipMemcpyHostToDevice) != hipSuccess)
    die("hipMemcpy failed");
  if (hipMemcpy(d_obs, h_obs, nsheds * sizeof(int), hipMemcpyHostToDevice) != hipSuccess)
    die("hipMemcpy failed");
  if (hipMemset(d_sheds, 0, nsheds * nr * nwpr * sizeof(ullint)) != hipSuccess)
    die("hipMemset failed");

  const size_t dimblock = 256;  // must be a multiple of 32
  const size_t dimgrid = nsheds;
  calc_one_shed<<<dimgrid, dimblock>>>(nrows, d_elevs, roi, oht, tht, nsheds, d_obs, d_sheds);

  if (hipMemcpy(h_sheds, d_sheds, nsheds * nr * nwpr * sizeof(ullint), hipMemcpyDeviceToHost)
      != hipSuccess)
    die("hipMemcpy failed");

  if (hipFree(d_elevs) != hipSuccess) die("hipFree failed");
  if (hipFree(d_obs) != hipSuccess) die("hipFree failed");
  if (hipFree(d_sheds) != hipSuccess) die("hipFree failed");
}

////////////////////////////////////////////////////////////////////////////////
// site
////////////////////////////////////////////////////////////////////////////////

__device__ int is_obs_vis(const int cumnwpr,
                          const ullint *cumshed,
                          const int obsx, const int obsy) {
  int i = obsx * cumnwpr * 64 + obsy;
  if ((cumshed[i / 64] & 1ULL << (63 - i % 64)) != 0)
    return 1;
  else
    return 0;
}

__global__ void calc_extra_area(const int nrows, const int roi,
                                const int *obs, const int *updatelist,
                                const ullint *sheds,
                                const int nr, const int nwpr, const int cumnwpr,
                                const ullint *cumshed,
                                int *testshedarea) {
  const int oi = updatelist[blockIdx.x];
  const int obsx = obs[oi]/nrows;
  const int obsy = obs[oi]%nrows;
  const ullint *shed = sheds + oi*nr*nwpr;
  int *extraarea = testshedarea + oi;

  extern __shared__ int areas[];
  areas[threadIdx.x] = 0;

  // calculate nrpt rows of extra area
  const int nrpt = nr / blockDim.x + (nr % blockDim.x ? 1 : 0);
  int sum = 0;

  for (int row = threadIdx.x * nrpt; row < (threadIdx.x + 1) * nrpt && row < nr; row++) {
    const int cumrow = obsx - roi + row;
    if (cumrow >= 0 && cumrow < nrows) {
      int firstword = (obsy - roi) / 64;
      int firstbit = (obsy - roi) % 64;
      if (firstbit < 0) {
        firstword--;
        firstbit += 64;
      }
      int lastword = (obsy + roi) / 64;

      ullint prevvalue = 0ULL;
      ullint value, cumvalue, tempvalue;

      for (int cumword = firstword; cumword <= lastword; cumword++)
        if (cumword >= 0 && cumword < cumnwpr) {
          int word = cumword - firstword;  // definition out of loop?
          if (cumword == 0 && word > 0) prevvalue = shed[row * nwpr + word - 1];
          if (word < nwpr)
            value = shed[row * nwpr + word];
          else
            value = 0ULL;
          cumvalue = cumshed[cumrow * cumnwpr + cumword];
          tempvalue = cumvalue;
          tempvalue |= value >> firstbit;
          if (firstbit != 0) tempvalue |= prevvalue << (64 - firstbit);
          tempvalue ^= cumvalue;
          sum += __popcll(tempvalue);
          prevvalue = value;
        }
    }
  }

  areas[threadIdx.x] = sum;
  __syncthreads();  // wait for all threads

  if (threadIdx.x == 0) {
    int sum = 0;
    for (int i = 0; i < blockDim.x; i++)
      sum += areas[i];
    *extraarea = sum;
  }
}

__global__ void union_area(const int nrows, const int roi, const int intervis,
                           const int nsheds, const int *obs,
                           const ullint *sheds,
                           const int nr, const int nwpr, const int cumnwpr,
                           const int nusedsheds, const char *usedq,
                           const int lastobs,
                           const int lastobsx, const int lastobsy,
                           const ullint *cumshed,
                           int *testshedarea, int *updatelist) {
  int tid = blockIdx.x * blockDim.x + threadIdx.x;
  int obsx, obsy, valid;

  // calculate multiple extra areas
  for (int oi = tid; oi < nsheds; oi += gridDim.x * blockDim.x) {
    valid = 1;
    if (usedq[oi]) {
      valid = 0;
    } else {
      obsx = obs[oi]/nrows;
      obsy = obs[oi]%nrows;
      if (nusedsheds > 0) {  // lastobs >= 0
        if (square(obsx-lastobsx) + square(obsy-lastobsy) > square(2*roi))
          valid = 0;
        else if (intervis && !is_obs_vis(cumnwpr, cumshed, obsx, obsy))  // if intervis, reset all after the first
          valid = 0;  // testshedarea[oi] = 0;  // reset invisible ones to zero
      }
    }

    if (valid) {
      /*
      cudaStream_t s;
      cudaStreamCreateWithFlags(&s, cudaStreamNonBlocking);
      calc_extra_area<<<1, nr, nr*sizeof(int), s>>>(nrows, roi, obsx, obsy,
                                                    &sheds[oi*nr*nwpr],
                                                    nr, nwpr, cumnwpr,
                                                    cumshed, &testshedarea[oi]);
      cudaStreamDestroy(s);
      // calc_extra_area<<<1, nr, nr*sizeof(int)>>>(nrows, roi, obsx, obsy, &sheds[oi*nr*nwpr],
      //                                            nr, nwpr, cumnwpr, cumshed, &testshedarea[oi]);
      */
      int index = atomicAdd(updatelist+499999, 1);
      updatelist[index] = oi;
    }
  }
}

__device__ void swap(int *x, int *y) {
  int z = *x;
  *x = *y;
  *y = z;
}

__global__ void findtopobs(const int nsheds, const char *usedq,
                           const int *testshedarea, int *top100) {
  __shared__ int obs[256];
  __shared__ int areas[256];
  obs[threadIdx.x] = 0;
  areas[threadIdx.x] = 0;
  int tid = blockIdx.x * blockDim.x + threadIdx.x;
  int size = gridDim.x * blockDim.x;
  for (int i = tid; i < nsheds; i += size)
    if (!usedq[i]) {
      int extraarea = testshedarea[i];
      if (extraarea > areas[threadIdx.x]) {
        obs[threadIdx.x] = i;
        areas[threadIdx.x] = extraarea;
      }
    }
  __syncthreads();

  if (threadIdx.x < 128 && areas[threadIdx.x + 128] > areas[threadIdx.x]) {
    swap(&obs[threadIdx.x], &obs[threadIdx.x + 128]);
    swap(&areas[threadIdx.x], &areas[threadIdx.x + 128]);
  }
  if (threadIdx.x < 64 && areas[threadIdx.x + 64] > areas[threadIdx.x]) {
    swap(&obs[threadIdx.x], &obs[threadIdx.x + 64]);
    swap(&areas[threadIdx.x], &areas[threadIdx.x + 64]);
  }
  if (threadIdx.x < 32 && areas[threadIdx.x + 32] > areas[threadIdx.x]) {
    swap(&obs[threadIdx.x], &obs[threadIdx.x + 32]);
    swap(&areas[threadIdx.x], &areas[threadIdx.x + 32]);
  }
  if (threadIdx.x < 16 && areas[threadIdx.x + 16] > areas[threadIdx.x]) {
    swap(&obs[threadIdx.x], &obs[threadIdx.x + 16]);
    swap(&areas[threadIdx.x], &areas[threadIdx.x + 16]);
  }
  if (threadIdx.x < 8 && areas[threadIdx.x + 8] > areas[threadIdx.x]) {
    swap(&obs[threadIdx.x], &obs[threadIdx.x + 8]);
    swap(&areas[threadIdx.x], &areas[threadIdx.x + 8]);
  }
  if (threadIdx.x < 4 && areas[threadIdx.x + 4] > areas[threadIdx.x]) {
    swap(&obs[threadIdx.x], &obs[threadIdx.x + 4]);
    swap(&areas[threadIdx.x], &areas[threadIdx.x + 4]);
  }
  if (threadIdx.x < 2 && areas[threadIdx.x + 2] > areas[threadIdx.x]) {
    swap(&obs[threadIdx.x], &obs[threadIdx.x + 2]);
    swap(&areas[threadIdx.x], &areas[threadIdx.x + 2]);
  }
  if (threadIdx.x < 1 && areas[threadIdx.x + 1] > areas[threadIdx.x]) {
    swap(&obs[threadIdx.x], &obs[threadIdx.x + 1]);
    swap(&areas[threadIdx.x], &areas[threadIdx.x + 1]);
  }

  if (threadIdx.x == 0) {
    top100[blockIdx.x] = obs[0];
    top100[blockIdx.x + 100] = areas[0];
  }
}

__global__ void calc_union(const int nrows, const int roi,
                           const int nsheds, const int *obs,
                           const ullint *sheds,
                           const int nr, const int nwpr, const int cumnwpr,
                           const int lastobs, char *usedq,
                           ullint *cumshed) {
  // lastobs >= 0
  __shared__ int lastobsx, lastobsy;
  __shared__ const ullint *shed;
  if (threadIdx.x == 0) {
    usedq[lastobs] = 1;  // set gridDim.x times
    lastobsx = obs[lastobs]/nrows;
    lastobsy = obs[lastobs]%nrows;
    shed = &sheds[lastobs*nr*nwpr];
  }
  __syncthreads();  // wait for thread 0

  int firstword = (lastobsy - roi) / 64;
  int firstbit = (lastobsy - roi) % 64;
  if (firstbit < 0) {
    firstword--;
    firstbit += 64;
  }

  int row = blockIdx.x*blockDim.x + threadIdx.x;
  if (row < nr) {  // a row of shed
    int cumrow = lastobsx - roi + row;
    if (cumrow >= 0 && cumrow < nrows)  // row inside terrain
      for (int word = 0; word < nwpr; word++) {  // each word of row
        int cumword = firstword + word;
        if (cumword >= 0 && cumword < cumnwpr)  // word inside terrain
          cumshed[cumrow * cumnwpr + cumword] |= shed[row * nwpr + word] >> firstbit;
        if (firstbit != 0 && cumword + 1 >= 0 && cumword + 1 < cumnwpr)  // firstbit != 0 and word + 1 inside terrain
          cumshed[cumrow * cumnwpr + cumword + 1] |= shed[row * nwpr + word] << (64 - firstbit);
      }
  }
}

void site_it(const int nrows, const int roi, const int intervis,
             const int nsheds, const int *h_obs, const ullint *h_sheds, char *selected) {
  const int nr = 2 * roi + 1;
  const int nwpr = (nr + 63) / 64;
  const int cumnwpr = (nrows + 63) / 64;

  int *usedsheds;     // list of sheds used so far.
  char *h_usedq;      // whether each particular shed has been used.
  int h_top100[200];  // top 100 tentative observers and extra areas

  usedsheds = 0;
  h_usedq = 0;
  int *areas = 0;
  usedsheds = new int[nsheds];
  h_usedq = new char[nsheds];
  areas = new int[nsheds];
  if (!usedsheds || !h_usedq || !areas)
    die("Memory exhausted. Program terminates.");
  for (int i = 0; i < nsheds; i++) h_usedq[i] = 0;

  int *d_obs;
  ullint *d_sheds;
  char *d_usedq;
  ullint *d_cumshed;
  int *d_testshedarea;
  int *d_top100;
  if (hipMalloc((void **)&d_obs, nsheds * sizeof(int)) != hipSuccess)
    die("hipMalloc failed");
  if (hipMalloc((void **)&d_sheds, nsheds * nr * nwpr * sizeof(ullint)) != hipSuccess)
    die("hipMalloc failed");
  if (hipMalloc((void **)&d_usedq, nsheds * sizeof(char)) != hipSuccess)
    die("hipMalloc failed");
  if (hipMalloc((void **)&d_cumshed, nrows * cumnwpr * sizeof(ullint)) != hipSuccess)
    die("hipMalloc failed");
  if (hipMalloc((void **)&d_testshedarea, nsheds * sizeof(int)) != hipSuccess)
    die("hipMalloc failed");
  if (hipMalloc((void **)&d_top100, 200 * sizeof(int)) != hipSuccess)
    die("hipMalloc failed");
  if (hipMemcpy(d_obs, h_obs, nsheds * sizeof(int), hipMemcpyHostToDevice) != hipSuccess)
    die("hipMemcpy failed");
  if (hipMemcpy(d_sheds, h_sheds, nsheds * nr * nwpr * sizeof(ullint), hipMemcpyHostToDevice)
      != hipSuccess)
    die("hipMemcpy failed");
  if (hipMemset(d_usedq, 0, nsheds * sizeof(char)) != hipSuccess)
    die("hipMemset failed");
  if (hipMemset(d_cumshed, 0, nrows*cumnwpr*sizeof(ullint)) != hipSuccess)
    die("hipMemset failed");

  int *d_updatelist;
  if (hipMalloc((void **)&d_updatelist, 500000*sizeof(int)) != hipSuccess) die("hipMalloc failed");

  int nusedsheds = 0;
  int lastobs = -1;
  int lastobsx = 0;
  int lastobsy = 0;
  int cumarea = 0;
  if (hipMemset(d_testshedarea, 0, nsheds * sizeof(int)) != hipSuccess)
    die("hipMemset failed");
  size_t dimgrid = (nsheds+255)/256;
  size_t dimblock = 256;
  // size_t dimgrid = (nsheds + dimblock - 1) / dimblock;

  //cout << "Total area=" << square(nrows) << endl;
  //cout << "#nusedsheds newshed obsx obsy area extraarea newcumarea areapercentage" << endl;

  while (1) {
    if (hipMemset(d_updatelist, 0, 500000*sizeof(int)) != hipSuccess) die("hipMemset failed");

    union_area<<<dimgrid, dimblock>>>(
        nrows, roi, intervis, nsheds, d_obs, d_sheds, nr, nwpr, cumnwpr,
        nusedsheds, d_usedq, lastobs, lastobsx, lastobsy, d_cumshed, d_testshedarea, d_updatelist);

    int updatelistsize;
    if (hipMemcpy(&updatelistsize, d_updatelist+499999, sizeof(int), hipMemcpyDeviceToHost) != hipSuccess) die("hipMemcpy failed");
      //cout << "\nsize = " << updatelistsize;

    calc_extra_area<<<updatelistsize, nr, nr*sizeof(int)>>>(
        nrows, roi, d_obs, d_updatelist, d_sheds, nr, nwpr, cumnwpr, d_cumshed, d_testshedarea);

    hipDeviceSynchronize();

    // find top 100 observers
    findtopobs<<<100, 256>>>(nsheds, d_usedq, d_testshedarea, d_top100);
    if (hipMemcpy(h_top100, d_top100, 200 * sizeof(int), hipMemcpyDeviceToHost) != hipSuccess)
      die("hipMemcpy failed");

    int newshed = 0;
    int extraarea = 0;
    for (int i = 0; i < 100; i++) {
      if (h_top100[i + 100] > extraarea) {
        extraarea = h_top100[i + 100];
        newshed = h_top100[i];
      }
    }
    if (extraarea == 0) {
      //cout << "No more new observers that will add new area." << endl;
      break;
    }

    usedsheds[nusedsheds++] = newshed;
    h_usedq[newshed] = 1;
    lastobs = newshed;
    lastobsx = h_obs[newshed]/nrows;
    lastobsy = h_obs[newshed]%nrows;

    // set usedq and calculate cumshed
    calc_union<<<nr, 1>>>(nrows, roi, nsheds, d_obs, d_sheds, nr, nwpr, cumnwpr, lastobs, d_usedq, d_cumshed);
    hipDeviceSynchronize();

    cumarea += extraarea;
    double areapercentage = 100.0 * cumarea / square(nrows);
    if (areapercentage > 95)
        break;

    if (nusedsheds == 1) {
      if (hipMemcpy(areas, d_testshedarea, nsheds * sizeof(int), hipMemcpyDeviceToHost) != hipSuccess)
        die("hipMemcpy failed");
      if (intervis)
        if (hipMemset(d_testshedarea, 0, nsheds * sizeof(int)) != hipSuccess)
          die("hipMemset failed");
    }

    /*
    cout << setw(6) << nusedsheds << setw(6) << newshed
         << setw(6) << h_obs[newshed]/nrows << setw(6) << h_obs[newshed]%nrows
         << setw(8) << areas[newshed] << setw(8) << extraarea
         << setw(10) << cumarea << setw(8) << areapercentage << endl;
    */
  }
  cout << " nusedsheds:" << nusedsheds << " coverage:" << 100.0*cumarea/square(nrows);

  if (hipFree(d_obs) != hipSuccess) die("hipFree failed");
  if (hipFree(d_sheds) != hipSuccess) die("hipFree failed");
  if (hipFree(d_usedq) != hipSuccess) die("hipFree failed");
  if (hipFree(d_cumshed) != hipSuccess) die("hipFree failed");
  if (hipFree(d_testshedarea) != hipSuccess) die("hipFree failed");
  if (hipFree(d_top100) != hipSuccess) die("hipFree failed");
  if (hipFree(d_updatelist) != hipSuccess) die("hipFree failed");

  for (int i = 0; i < nsheds; i++)
    selected[i] = h_usedq[i];
  delete[] usedsheds;
  delete[] h_usedq;
  delete[] areas;
}

////////////////////////////////////////////////////////////////////////////////
// main
////////////////////////////////////////////////////////////////////////////////

int main(int argc, char **argv) {
  double elapsed_secs;
  struct timeval begin, middle, end;
  gettimeofday(&begin, NULL);
  middle = begin;

  int nrows;                      // # rows, cols in this cell
  int roi;                        // radius of interest
  int oht;                        // ht of observer above terrain
  int tht;                        // target ht above terrain
  int ntests;                     // # of targets tested per observer
  int blocksize0;                 // Requested number of rows in one block of the input visibility index array.
  float blocksize;               // Perturbed blocksize0, to remove sliver blocks at the end.
  int nwanted0;                   // Desired number of output observers.
  int nwanted;                    // Modified because blocksize was perturbed.
  int nblocks;                    // Number of blocks on one side of it.
  int nwantedperblock;            // Number of observers to find per block, before culling.
  int intervis;                   // Should new observers be visible to existing ones?

  usint *elevs;      // terrain elevation (input)
  unsigned char *vix;             // visibility index * 256 (output); vim
  int *obs;                       // observers
  ullint *sheds;  // viewsheds
  char *selected;

  //cout << "[SITE, compiled from " << __FILE__ << " on " << __DATE__ << ", " << __TIME__ << ']' << endl;
  if (argc != 10) {
    cout << "argc=" << argc << endl;
    die("SITE requires 9 arguments: nrows, roi, oht/tht, ntests, blocksize, nwanted, intervis, infile, outfile");
  }

  nrows = atoi(argv[1]);
  roi = atoi(argv[2]);
  oht = tht = atoi(argv[3]);
  ntests = atoi(argv[4]);
  blocksize0 = atoi(argv[5]);
  nwanted0 = atoi(argv[6]);
  intervis = atoi(argv[7]);

  //cout << "nrows=" << nrows << ", roi=" << roi << ", oht=" << oht << ", tht=" << tht
  //     << ", ntests=" << ntests << "\nblocksize0=" << blocksize0 << ", nwanted0=" << nwanted0
  //     << ", intervis=" << intervis << endl;

  if (nrows <= 0 || nrows > 20000) die("Unreasonable value for nrows");
  if (roi < 1 || roi > 10000) die("Unreasonable value for roi.");
  if (tht < 0 || tht > 1000000) die("Unreasonable value for tht.");
  if (ntests < 1 || ntests > 1000) die("Unreasonable value for ntests.");
  if (blocksize0 < 10 || blocksize0 > 2000) die("Unreasonable value for blocksize0.");
  if (nwanted0 < 100 || nwanted0 > 2000000) die("Unreasonable value for nwanted0.");
  if (intervis != 0 && intervis != 1) die("Unreasonable value for intervis.");

  // Perturb blocksize so that the last block won't be really small.
  blocksize = (float)nrows / (int)((float)nrows / blocksize0 + 0.5f);  // floating point block size
  nblocks = (int)(nrows / blocksize + 0.5f);                             // number of blocks
  nwantedperblock = (int)((float)nwanted0 / square(nblocks) + 0.99999f);  // number of wanted per block
  nwanted = nwantedperblock * square(nblocks);                          // number of wanted
  int lastsize = nrows - (int)(blocksize * (nblocks - 1));              // size of the last block
  if (square(lastsize) < nwantedperblock)                               // too small
    die("The last block is too small for nwantedperblock.");

  //cout << "blocksize=" << blocksize << ", nblocks=" << nblocks
  //     << ", nwantedperblock=" << nwantedperblock << ", nwanted=" << nwanted << endl;

  // number of rows per shed and number of words per row
  const int nr = 2 * roi + 1;
  const int nwpr = (nr + 63) / 64;

  elevs = 0;
  vix = 0;
  obs = 0;
  sheds = 0;
  selected = 0;
  elevs = new usint[square(nrows)];
  vix = new unsigned char[square(nrows)];
  obs = new int[nwanted];
  sheds = new ullint[nwanted * nr * nwpr];
  selected = new char[nwanted];
  if (!elevs || !vix || !obs || !sheds || !selected)
    die("Memory exhausted. Program terminates.");
/*
  if (cudaMallocHost((void **)&elevs, square(nrows) * sizeof(usint)) != cudaSuccess)
    die("cudaMallocHost failed");
  if (cudaMallocHost((void **)&vix, square(nrows) * sizeof(unsigned char)) != cudaSuccess)
    die("cudaMallocHost failed");
  if (cudaMallocHost((void **)&obs, nwanted * sizeof(int)) != cudaSuccess)
    die("cudaMallocHost failed");
  if (cudaMallocHost((void **)&sheds, nwanted * nr * nwpr * sizeof(ullint)) != cudaSuccess)
    die("cudaMallocHost failed");
*/
  /*
  for (int i = 0; i < nrows; i++)
    for (int j = 0; j < nrows; j++) {
      cin.read(reinterpret_cast<char *>(&elevs[i * nrows + j]), sizeof(usint));
      if (cin.fail()) {
        cout << "Error: at i=" << i << ", j=" << j << endl;
        die("Input failed");
      }
    }
  */
  ifstream ifs(argv[8]);
  ifs.read((char *)elevs, square(nrows)*sizeof(usint));
  if (ifs.fail())
    die("Input failed");
  ifs.close();

  gettimeofday(&end, NULL);
  elapsed_secs = calc_time(middle, end);
  middle = end;
  cout << "input:" << elapsed_secs;

  calc_vix(nrows, elevs, roi, oht, tht, ntests, vix);
  hipDeviceSynchronize();
  gettimeofday(&end, NULL);
  elapsed_secs = calc_time(middle, end);
  middle = end;
  cout << " vix:" << elapsed_secs;
  /*
  int x;
  ullint sum = 0;
  ifstream ifs("vim.bin");
  for (int i = 0; i < square(nrows); i++) {
    ifs >> x;
    sum += square(vix[i]-x);
  }
  cout << " RMS VIM error:" << sqrt((double)sum/square(nrows));
  ifs.close();
  */

  find_max(nrows, vix, blocksize, nwanted, nblocks, nwantedperblock, obs);
  hipDeviceSynchronize();
  gettimeofday(&end, NULL);
  elapsed_secs = calc_time(middle, end);
  middle = end;
  cout << " findmax:" << elapsed_secs;
  
  calc_sheds(nrows, elevs, roi, oht, tht, nwanted, obs, sheds);
  hipDeviceSynchronize();
  gettimeofday(&end, NULL);
  elapsed_secs = calc_time(middle, end);
  middle = end;
  cout << " viewshed:" << elapsed_secs;

  site_it(nrows, roi, intervis, nwanted, obs, sheds, selected);
  hipDeviceSynchronize();
  gettimeofday(&end, NULL);
  elapsed_secs = calc_time(middle, end);
  middle = end;
  cout << " site:" << elapsed_secs;

  ofstream ofs(argv[9]);
  for (int i = 0; i < nwanted; i++)
    if (selected[i])
      ofs << obs[i]/nrows << ',' << obs[i]%nrows << '\n';
  ofs.close();

  delete[] elevs;
  delete[] vix;
  delete[] obs;
  delete[] sheds;
  delete[] selected;
/*
  if (cudaFreeHost(elevs) != cudaSuccess) die("cudaFreeHost failed");
  if (cudaFreeHost(vix) != cudaSuccess) die("cudaFreeHost failed");
  if (cudaFreeHost(obs) != cudaSuccess) die("cudaFreeHost failed");
  if (cudaFreeHost(sheds) != cudaSuccess) die("cudaFreeHost failed");
*/
  gettimeofday(&end, NULL);
  elapsed_secs = calc_time(middle, end);
  middle = end;
  cout << " output:" << elapsed_secs;
  gettimeofday(&end, NULL);
  elapsed_secs = calc_time(begin, end);
  cout << " total:" << elapsed_secs << endl;
}

	.text
	.file	"siting.hip"
                                        # Start of file scope inline assembly
	.globl	_ZSt21ios_base_library_initv

                                        # End of file scope inline assembly
	.globl	_Z3diePKc                       # -- Begin function _Z3diePKc
	.type	_Z3diePKc,@function
_Z3diePKc:                              # @_Z3diePKc
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	movq	%rdi, %rbx
	movl	$_ZSt4cout, %edi
	movl	$.L.str, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	movq	%rbx, %rsi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
	movl	$1, %edi
	callq	exit
.Lfunc_end0:
	.size	_Z3diePKc, .Lfunc_end0-_Z3diePKc
	.cfi_endproc
                                        # -- End function
	.globl	_Z27__device_stub__calc_one_vixiPKtiiiiPh # -- Begin function _Z27__device_stub__calc_one_vixiPKtiiiiPh
	.type	_Z27__device_stub__calc_one_vixiPKtiiiiPh,@function
_Z27__device_stub__calc_one_vixiPKtiiiiPh: # @_Z27__device_stub__calc_one_vixiPKtiiiiPh
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$144, %rsp
	.cfi_def_cfa_offset 192
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	20(%rsp), %rax
	movl	%edi, (%rax)
	leaq	40(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	16(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	12(%rsp), %rdx
	movl	%ecx, (%rdx)
	leaq	8(%rsp), %rcx
	movl	%r8d, (%rcx)
	leaq	4(%rsp), %r8
	movl	%r9d, (%r8)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	movq	%r8, 40(%rbx)
	leaq	192(%rsp), %rax
	movq	%rax, 48(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	32(%rsp), %r12
	leaq	24(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z12calc_one_vixiPKtiiiiPh, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$160, %rsp
	.cfi_adjust_cfa_offset -160
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end1:
	.size	_Z27__device_stub__calc_one_vixiPKtiiiiPh, .Lfunc_end1-_Z27__device_stub__calc_one_vixiPKtiiiiPh
	.cfi_endproc
                                        # -- End function
	.globl	_Z8calc_vixiPKtiiiiPh           # -- Begin function _Z8calc_vixiPKtiiiiPh
	.type	_Z8calc_vixiPKtiiiiPh,@function
_Z8calc_vixiPKtiiiiPh:                  # @_Z8calc_vixiPKtiiiiPh
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	%r9d, 36(%rsp)                  # 4-byte Spill
	movl	%r8d, 32(%rsp)                  # 4-byte Spill
	movl	%ecx, %r15d
	movl	%edx, %r12d
	movq	%rsi, %rbp
	movl	%edi, %r13d
	movl	%edi, %ebx
	imull	%ebx, %ebx
	leaq	(%rbx,%rbx), %r14
	leaq	24(%rsp), %rdi
	movq	%r14, %rsi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB2_9
# %bb.1:
	leaq	16(%rsp), %rdi
	movq	%rbx, %rsi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB2_9
# %bb.2:
	movq	24(%rsp), %rdi
	movq	%rbp, %rsi
	movq	%r14, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB2_10
# %bb.3:
	movl	%ebx, %eax
	shrl	$7, %eax
	cvtsi2sd	%eax, %xmm0
	sqrtsd	%xmm0, %xmm0
	cvttsd2si	%xmm0, %eax
	movq	96(%rsp), %rbp
	movl	%eax, %ecx
	imull	%ecx, %ecx
	shlq	$7, %rcx
	cmpq	%rbx, %rcx
	adcl	$0, %eax
	movq	%rax, %rdi
	shlq	$32, %rdi
	orq	%rax, %rdi
	movabsq	$4294967297, %rdx               # imm = 0x100000001
	addq	$127, %rdx
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB2_5
# %bb.4:
	movq	24(%rsp), %rsi
	movq	16(%rsp), %rax
	movq	%rax, (%rsp)
	movl	%r13d, %edi
	movl	%r12d, %edx
	movl	%r15d, %ecx
	movl	32(%rsp), %r8d                  # 4-byte Reload
	movl	36(%rsp), %r9d                  # 4-byte Reload
	callq	_Z27__device_stub__calc_one_vixiPKtiiiiPh
.LBB2_5:
	movq	16(%rsp), %rsi
	movq	%rbp, %rdi
	movq	%rbx, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB2_10
# %bb.6:
	movq	24(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB2_11
# %bb.7:
	movq	16(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB2_11
# %bb.8:
	addq	$40, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.LBB2_9:
	.cfi_def_cfa_offset 96
	movl	$.L.str.1, %edi
	callq	_Z3diePKc
.LBB2_10:
	movl	$.L.str.2, %edi
	callq	_Z3diePKc
.LBB2_11:
	movl	$.L.str.3, %edi
	callq	_Z3diePKc
.Lfunc_end2:
	.size	_Z8calc_vixiPKtiiiiPh, .Lfunc_end2-_Z8calc_vixiPKtiiiiPh
	.cfi_endproc
                                        # -- End function
	.globl	_Z32__device_stub__process_one_blockiPhfiiPi # -- Begin function _Z32__device_stub__process_one_blockiPhfiiPi
	.type	_Z32__device_stub__process_one_blockiPhfiiPi,@function
_Z32__device_stub__process_one_blockiPhfiiPi: # @_Z32__device_stub__process_one_blockiPhfiiPi
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$128, %rsp
	.cfi_def_cfa_offset 176
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	12(%rsp), %rax
	movl	%edi, (%rax)
	leaq	40(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	8(%rsp), %rsi
	movss	%xmm0, (%rsi)
	leaq	4(%rsp), %r9
	movl	%edx, (%r9)
	movq	%rsp, %rdx
	movl	%ecx, (%rdx)
	leaq	32(%rsp), %rcx
	movq	%r8, (%rcx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%r9, 24(%rbx)
	movq	%rdx, 32(%rbx)
	movq	%rcx, 40(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z17process_one_blockiPhfiiPi, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$144, %rsp
	.cfi_adjust_cfa_offset -144
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end3:
	.size	_Z32__device_stub__process_one_blockiPhfiiPi, .Lfunc_end3-_Z32__device_stub__process_one_blockiPhfiiPi
	.cfi_endproc
                                        # -- End function
	.globl	_Z8find_maxiPKhfiiiPi           # -- Begin function _Z8find_maxiPKhfiiiPi
	.type	_Z8find_maxiPKhfiiiPi,@function
_Z8find_maxiPKhfiiiPi:                  # @_Z8find_maxiPKhfiiiPi
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%r9, %rbx
	movl	%r8d, 20(%rsp)                  # 4-byte Spill
	movl	%ecx, %r14d
	movl	%edx, %r12d
	movss	%xmm0, 16(%rsp)                 # 4-byte Spill
	movq	%rsi, %r13
	movl	%edi, %r15d
	movl	%edi, %ebp
	imull	%ebp, %ebp
	leaq	8(%rsp), %rdi
	movq	%rbp, %rsi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB4_9
# %bb.1:
	movslq	%r12d, %r12
	shlq	$2, %r12
	movq	%rsp, %rdi
	movq	%r12, %rsi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB4_9
# %bb.2:
	movq	8(%rsp), %rdi
	movq	%r13, %rsi
	movq	%rbp, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB4_10
# %bb.3:
	movl	%r14d, %edi
	imull	%edi, %edi
	btsq	$32, %rdi
	movabsq	$4294967296, %rdx               # imm = 0x100000000
	orq	$256, %rdx                      # imm = 0x100
	movl	$4096, %r8d                     # imm = 0x1000
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB4_5
# %bb.4:
	movq	8(%rsp), %rsi
	movq	(%rsp), %r8
	movl	%r15d, %edi
	movss	16(%rsp), %xmm0                 # 4-byte Reload
                                        # xmm0 = mem[0],zero,zero,zero
	movl	%r14d, %edx
	movl	20(%rsp), %ecx                  # 4-byte Reload
	callq	_Z32__device_stub__process_one_blockiPhfiiPi
.LBB4_5:
	movq	(%rsp), %rsi
	movq	%rbx, %rdi
	movq	%r12, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB4_10
# %bb.6:
	movq	8(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB4_11
# %bb.7:
	movq	(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB4_11
# %bb.8:
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.LBB4_9:
	.cfi_def_cfa_offset 80
	movl	$.L.str.1, %edi
	callq	_Z3diePKc
.LBB4_10:
	movl	$.L.str.2, %edi
	callq	_Z3diePKc
.LBB4_11:
	movl	$.L.str.3, %edi
	callq	_Z3diePKc
.Lfunc_end4:
	.size	_Z8find_maxiPKhfiiiPi, .Lfunc_end4-_Z8find_maxiPKhfiiiPi
	.cfi_endproc
                                        # -- End function
	.globl	_Z28__device_stub__calc_one_shediPKtiiiiPKiPy # -- Begin function _Z28__device_stub__calc_one_shediPKtiiiiPKiPy
	.type	_Z28__device_stub__calc_one_shediPKtiiiiPKiPy,@function
_Z28__device_stub__calc_one_shediPKtiiiiPKiPy: # @_Z28__device_stub__calc_one_shediPKtiiiiPKiPy
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$144, %rsp
	.cfi_def_cfa_offset 192
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	20(%rsp), %rax
	movl	%edi, (%rax)
	leaq	40(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	16(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	12(%rsp), %rdx
	movl	%ecx, (%rdx)
	leaq	8(%rsp), %rcx
	movl	%r8d, (%rcx)
	leaq	4(%rsp), %r8
	movl	%r9d, (%r8)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	movq	%r8, 40(%rbx)
	leaq	192(%rsp), %rax
	movq	%rax, 48(%rbx)
	leaq	200(%rsp), %rax
	movq	%rax, 56(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	32(%rsp), %r12
	leaq	24(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z13calc_one_shediPKtiiiiPKiPy, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$160, %rsp
	.cfi_adjust_cfa_offset -160
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end5:
	.size	_Z28__device_stub__calc_one_shediPKtiiiiPKiPy, .Lfunc_end5-_Z28__device_stub__calc_one_shediPKtiiiiPKiPy
	.cfi_endproc
                                        # -- End function
	.globl	_Z10calc_shedsiPKtiiiiPKiPy     # -- Begin function _Z10calc_shedsiPKtiiiiPKiPy
	.type	_Z10calc_shedsiPKtiiiiPKiPy,@function
_Z10calc_shedsiPKtiiiiPKiPy:            # @_Z10calc_shedsiPKtiiiiPKiPy
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	%r9d, %ebx
	movl	%r8d, 36(%rsp)                  # 4-byte Spill
	movl	%ecx, 32(%rsp)                  # 4-byte Spill
	movl	%edx, %r15d
	movq	%rsi, %rbp
	leal	64(,%r15,2), %eax
	leal	127(,%r15,2), %r13d
	testl	%eax, %eax
	cmovnsl	%eax, %r13d
	movl	%edi, 28(%rsp)                  # 4-byte Spill
	movl	%edi, %r14d
	imull	%r14d, %r14d
	addl	%r14d, %r14d
	leaq	16(%rsp), %rdi
	movq	%r14, %rsi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB6_13
# %bb.1:
	movslq	%ebx, %r12
	shlq	$2, %r12
	leaq	8(%rsp), %rdi
	movq	%r12, %rsi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB6_13
# %bb.2:
	leal	1(,%r15,2), %eax
	sarl	$6, %r13d
	imull	%ebx, %eax
	imull	%r13d, %eax
	movslq	%eax, %r13
	shlq	$3, %r13
	movq	%rsp, %rdi
	movq	%r13, %rsi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB6_13
# %bb.3:
	movq	16(%rsp), %rdi
	movq	%rbp, %rsi
	movq	%r14, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB6_14
# %bb.4:
	movq	96(%rsp), %rsi
	movq	8(%rsp), %rdi
	movq	%r12, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB6_14
# %bb.5:
	movq	(%rsp), %rdi
	xorl	%esi, %esi
	movq	%r13, %rdx
	callq	hipMemset
	testl	%eax, %eax
	jne	.LBB6_15
# %bb.6:
	movq	104(%rsp), %r14
	movl	%ebx, %edi
	btsq	$32, %rdi
	movabsq	$4294967296, %rdx               # imm = 0x100000000
	orq	$256, %rdx                      # imm = 0x100
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB6_8
# %bb.7:
	movq	16(%rsp), %rsi
	movl	28(%rsp), %edi                  # 4-byte Reload
	movl	%r15d, %edx
	movl	32(%rsp), %ecx                  # 4-byte Reload
	movl	36(%rsp), %r8d                  # 4-byte Reload
	movl	%ebx, %r9d
	pushq	(%rsp)
	.cfi_adjust_cfa_offset 8
	pushq	16(%rsp)
	.cfi_adjust_cfa_offset 8
	callq	_Z28__device_stub__calc_one_shediPKtiiiiPKiPy
	addq	$16, %rsp
	.cfi_adjust_cfa_offset -16
.LBB6_8:
	movq	(%rsp), %rsi
	movq	%r14, %rdi
	movq	%r13, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB6_14
# %bb.9:
	movq	16(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB6_16
# %bb.10:
	movq	8(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB6_16
# %bb.11:
	movq	(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB6_16
# %bb.12:
	addq	$40, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.LBB6_13:
	.cfi_def_cfa_offset 96
	movl	$.L.str.1, %edi
	callq	_Z3diePKc
.LBB6_14:
	movl	$.L.str.2, %edi
	callq	_Z3diePKc
.LBB6_16:
	movl	$.L.str.3, %edi
	callq	_Z3diePKc
.LBB6_15:
	movl	$.L.str.4, %edi
	callq	_Z3diePKc
.Lfunc_end6:
	.size	_Z10calc_shedsiPKtiiiiPKiPy, .Lfunc_end6-_Z10calc_shedsiPKtiiiiPKiPy
	.cfi_endproc
                                        # -- End function
	.globl	_Z30__device_stub__calc_extra_areaiiPKiS0_PKyiiiS2_Pi # -- Begin function _Z30__device_stub__calc_extra_areaiiPKiS0_PKyiiiS2_Pi
	.type	_Z30__device_stub__calc_extra_areaiiPKiS0_PKyiiiS2_Pi,@function
_Z30__device_stub__calc_extra_areaiiPKiS0_PKyiiiS2_Pi: # @_Z30__device_stub__calc_extra_areaiiPKiS0_PKyiiiS2_Pi
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$176, %rsp
	.cfi_def_cfa_offset 224
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	20(%rsp), %rax
	movl	%edi, (%rax)
	leaq	16(%rsp), %rdi
	movl	%esi, (%rdi)
	leaq	56(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	48(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	40(%rsp), %rcx
	movq	%r8, (%rcx)
	leaq	12(%rsp), %r8
	movl	%r9d, (%r8)
	leaq	96(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	movq	%r8, 40(%rbx)
	leaq	224(%rsp), %rax
	movq	%rax, 48(%rbx)
	leaq	232(%rsp), %rax
	movq	%rax, 56(%rbx)
	leaq	240(%rsp), %rax
	movq	%rax, 64(%rbx)
	leaq	248(%rsp), %rax
	movq	%rax, 72(%rbx)
	leaq	80(%rsp), %r14
	leaq	64(%rsp), %r15
	leaq	32(%rsp), %r12
	leaq	24(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z15calc_extra_areaiiPKiS0_PKyiiiS2_Pi, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$192, %rsp
	.cfi_adjust_cfa_offset -192
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end7:
	.size	_Z30__device_stub__calc_extra_areaiiPKiS0_PKyiiiS2_Pi, .Lfunc_end7-_Z30__device_stub__calc_extra_areaiiPKiS0_PKyiiiS2_Pi
	.cfi_endproc
                                        # -- End function
	.globl	_Z25__device_stub__union_areaiiiiPKiPKyiiiiPKciiiS2_PiS5_ # -- Begin function _Z25__device_stub__union_areaiiiiPKiPKyiiiiPKciiiS2_PiS5_
	.type	_Z25__device_stub__union_areaiiiiPKiPKyiiiiPKciiiS2_PiS5_,@function
_Z25__device_stub__union_areaiiiiPKiPKyiiiiPKciiiS2_PiS5_: # @_Z25__device_stub__union_areaiiiiPKiPKyiiiiPKciiiS2_PiS5_
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$224, %rsp
	.cfi_def_cfa_offset 272
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	12(%rsp), %rax
	movl	%edi, (%rax)
	leaq	8(%rsp), %rdi
	movl	%esi, (%rdi)
	leaq	4(%rsp), %rsi
	movl	%edx, (%rsi)
	movq	%rsp, %rdx
	movl	%ecx, (%rdx)
	leaq	40(%rsp), %rcx
	movq	%r8, (%rcx)
	leaq	32(%rsp), %r8
	movq	%r9, (%r8)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	movq	%r8, 40(%rbx)
	leaq	272(%rsp), %rax
	movq	%rax, 48(%rbx)
	leaq	280(%rsp), %rax
	movq	%rax, 56(%rbx)
	leaq	288(%rsp), %rax
	movq	%rax, 64(%rbx)
	leaq	296(%rsp), %rax
	movq	%rax, 72(%rbx)
	leaq	304(%rsp), %rax
	movq	%rax, 80(%rbx)
	leaq	312(%rsp), %rax
	movq	%rax, 88(%rbx)
	leaq	320(%rsp), %rax
	movq	%rax, 96(%rbx)
	leaq	328(%rsp), %rax
	movq	%rax, 104(%rbx)
	leaq	336(%rsp), %rax
	movq	%rax, 112(%rbx)
	leaq	344(%rsp), %rax
	movq	%rax, 120(%rbx)
	leaq	352(%rsp), %rax
	movq	%rax, 128(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z10union_areaiiiiPKiPKyiiiiPKciiiS2_PiS5_, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$240, %rsp
	.cfi_adjust_cfa_offset -240
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end8:
	.size	_Z25__device_stub__union_areaiiiiPKiPKyiiiiPKciiiS2_PiS5_, .Lfunc_end8-_Z25__device_stub__union_areaiiiiPKiPKyiiiiPKciiiS2_PiS5_
	.cfi_endproc
                                        # -- End function
	.globl	_Z25__device_stub__findtopobsiPKcPKiPi # -- Begin function _Z25__device_stub__findtopobsiPKcPKiPi
	.type	_Z25__device_stub__findtopobsiPKcPKiPi,@function
_Z25__device_stub__findtopobsiPKcPKiPi: # @_Z25__device_stub__findtopobsiPKcPKiPi
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	4(%rsp), %rax
	movl	%edi, (%rax)
	leaq	40(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	32(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	24(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	16(%rsp), %r12
	leaq	8(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z10findtopobsiPKcPKiPi, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end9:
	.size	_Z25__device_stub__findtopobsiPKcPKiPi, .Lfunc_end9-_Z25__device_stub__findtopobsiPKcPKiPi
	.cfi_endproc
                                        # -- End function
	.globl	_Z25__device_stub__calc_unioniiiPKiPKyiiiiPcPy # -- Begin function _Z25__device_stub__calc_unioniiiPKiPKyiiiiPcPy
	.type	_Z25__device_stub__calc_unioniiiPKiPKyiiiiPcPy,@function
_Z25__device_stub__calc_unioniiiPKiPKyiiiiPcPy: # @_Z25__device_stub__calc_unioniiiPKiPKyiiiiPcPy
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$176, %rsp
	.cfi_def_cfa_offset 224
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	12(%rsp), %rax
	movl	%edi, (%rax)
	leaq	8(%rsp), %rdi
	movl	%esi, (%rdi)
	leaq	4(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	40(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	32(%rsp), %rcx
	movq	%r8, (%rcx)
	movq	%rsp, %r8
	movl	%r9d, (%r8)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	movq	%r8, 40(%rbx)
	leaq	224(%rsp), %rax
	movq	%rax, 48(%rbx)
	leaq	232(%rsp), %rax
	movq	%rax, 56(%rbx)
	leaq	240(%rsp), %rax
	movq	%rax, 64(%rbx)
	leaq	248(%rsp), %rax
	movq	%rax, 72(%rbx)
	leaq	256(%rsp), %rax
	movq	%rax, 80(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z10calc_unioniiiPKiPKyiiiiPcPy, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$192, %rsp
	.cfi_adjust_cfa_offset -192
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end10:
	.size	_Z25__device_stub__calc_unioniiiPKiPKyiiiiPcPy, .Lfunc_end10-_Z25__device_stub__calc_unioniiiPKiPKyiiiiPcPy
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z7site_itiiiiPKiPKyPc
.LCPI11_0:
	.quad	0x4059000000000000              # double 100
.LCPI11_1:
	.quad	0x4057c00000000000              # double 95
	.text
	.globl	_Z7site_itiiiiPKiPKyPc
	.type	_Z7site_itiiiiPKiPKyPc,@function
_Z7site_itiiiiPKiPKyPc:                 # @_Z7site_itiiiiPKiPKyPc
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$1032, %rsp                     # imm = 0x408
	.cfi_def_cfa_offset 1088
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%r9, 8(%rsp)                    # 8-byte Spill
	movq	%r8, 168(%rsp)                  # 8-byte Spill
	movl	%ecx, %r15d
	movl	%edx, 84(%rsp)                  # 4-byte Spill
                                        # kill: def $esi killed $esi def $rsi
	leal	64(,%rsi,2), %eax
	movq	%rsi, 96(%rsp)                  # 8-byte Spill
	leal	127(,%rsi,2), %r13d
	testl	%eax, %eax
	cmovnsl	%eax, %r13d
                                        # kill: def $edi killed $edi def $rdi
	leal	63(%rdi), %eax
	movq	%rdi, 104(%rsp)                 # 8-byte Spill
	leal	126(%rdi), %ebx
	testl	%eax, %eax
	cmovnsl	%eax, %ebx
	movslq	%ecx, %r14
	leaq	(,%r14,4), %rax
	testl	%r14d, %r14d
	movq	$-1, %r12
	movq	%rax, 24(%rsp)                  # 8-byte Spill
	cmovnsq	%rax, %r12
	movq	%r14, %rdi
	callq	_Znam
	movq	%rax, %rbp
	movq	%r12, %rdi
	callq	_Znam
	movq	%rax, 144(%rsp)                 # 8-byte Spill
	movq	%r15, 32(%rsp)                  # 8-byte Spill
	movl	%r15d, %r15d
	testl	%r14d, %r14d
	jle	.LBB11_2
# %bb.1:                                # %.lr.ph.preheader
	movq	%rbp, %rdi
	xorl	%esi, %esi
	movq	%r15, %rdx
	callq	memset@PLT
.LBB11_2:                               # %._crit_edge
	leaq	72(%rsp), %rdi
	movq	24(%rsp), %rsi                  # 8-byte Reload
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB11_51
# %bb.3:
	sarl	$6, %r13d
	movq	96(%rsp), %rax                  # 8-byte Reload
	leal	1(,%rax,2), %eax
	movq	%rax, 88(%rsp)                  # 8-byte Spill
                                        # kill: def $eax killed $eax killed $rax
	imull	32(%rsp), %eax                  # 4-byte Folded Reload
	movq	%r13, 120(%rsp)                 # 8-byte Spill
	imull	%r13d, %eax
	movslq	%eax, %r12
	shlq	$3, %r12
	leaq	64(%rsp), %rdi
	movq	%r12, %rsi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB11_51
# %bb.4:
	leaq	56(%rsp), %rdi
	movq	%r14, %rsi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB11_51
# %bb.5:
	sarl	$6, %ebx
	movq	%rbx, 112(%rsp)                 # 8-byte Spill
	movl	%ebx, %eax
	imull	104(%rsp), %eax                 # 4-byte Folded Reload
	movslq	%eax, %r13
	shlq	$3, %r13
	leaq	48(%rsp), %rdi
	movq	%r13, %rsi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB11_51
# %bb.6:
	leaq	16(%rsp), %rdi
	movq	24(%rsp), %rsi                  # 8-byte Reload
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB11_51
# %bb.7:
	leaq	128(%rsp), %rdi
	movl	$800, %esi                      # imm = 0x320
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB11_51
# %bb.8:
	movq	72(%rsp), %rdi
	movq	168(%rsp), %rsi                 # 8-byte Reload
	movq	24(%rsp), %rdx                  # 8-byte Reload
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB11_52
# %bb.9:
	movq	64(%rsp), %rdi
	movq	8(%rsp), %rsi                   # 8-byte Reload
	movq	%r12, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB11_52
# %bb.10:
	movq	56(%rsp), %rdi
	xorl	%esi, %esi
	movq	%r14, %rdx
	callq	hipMemset
	testl	%eax, %eax
	movq	104(%rsp), %r12                 # 8-byte Reload
	jne	.LBB11_41
# %bb.11:
	movq	48(%rsp), %rdi
	xorl	%esi, %esi
	movq	%r13, %rdx
	callq	hipMemset
	testl	%eax, %eax
	jne	.LBB11_41
# %bb.12:
	leaq	40(%rsp), %rdi
	movl	$2000000, %esi                  # imm = 0x1E8480
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB11_51
# %bb.13:
	movq	%r15, 192(%rsp)                 # 8-byte Spill
	movq	%rbp, 160(%rsp)                 # 8-byte Spill
	movq	16(%rsp), %rdi
	xorl	%esi, %esi
	movq	24(%rsp), %rdx                  # 8-byte Reload
	callq	hipMemset
	testl	%eax, %eax
	jne	.LBB11_41
# %bb.14:
	movq	40(%rsp), %rdi
	xorl	%r13d, %r13d
	movl	$2000000, %edx                  # imm = 0x1E8480
	xorl	%esi, %esi
	callq	hipMemset
	testl	%eax, %eax
	jne	.LBB11_41
# %bb.15:                               # %.lr.ph210
	movabsq	$4294967296, %rdx               # imm = 0x100000000
	movq	32(%rsp), %rcx                  # 8-byte Reload
	leal	255(%rcx), %eax
	addl	$510, %ecx                      # imm = 0x1FE
	testl	%eax, %eax
	cmovnsl	%eax, %ecx
	sarl	$8, %ecx
	btsq	$32, %rcx
	movq	%rcx, 216(%rsp)                 # 8-byte Spill
	movslq	88(%rsp), %rax                  # 4-byte Folded Reload
	leaq	(,%rax,4), %rcx
	movq	%rcx, 208(%rsp)                 # 8-byte Spill
	movl	%eax, %ecx
	movl	%r12d, %eax
	imull	%r12d, %eax
	cvtsi2sd	%eax, %xmm0
	movsd	%xmm0, 152(%rsp)                # 8-byte Spill
	btsq	$32, %rcx
	movq	%rcx, 184(%rsp)                 # 8-byte Spill
	movl	$-1, %ebp
	leaq	256(%rdx), %rax
	movq	%rax, 8(%rsp)                   # 8-byte Spill
	leaq	100(%rdx), %rax
	movq	%rax, 200(%rsp)                 # 8-byte Spill
	xorl	%eax, %eax
	movq	%rax, 176(%rsp)                 # 8-byte Spill
	xorl	%r14d, %r14d
	xorl	%r15d, %r15d
.LBB11_16:                              # =>This Loop Header: Depth=1
                                        #     Child Loop BB11_25 Depth 2
	movq	216(%rsp), %rdi                 # 8-byte Reload
	movl	$1, %esi
	movq	8(%rsp), %rdx                   # 8-byte Reload
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB11_18
# %bb.17:                               #   in Loop: Header=BB11_16 Depth=1
	movq	72(%rsp), %r8
	movq	64(%rsp), %r9
	subq	$8, %rsp
	.cfi_adjust_cfa_offset 8
	movl	%r12d, %edi
	movq	104(%rsp), %rsi                 # 8-byte Reload
                                        # kill: def $esi killed $esi killed $rsi
	movl	92(%rsp), %edx                  # 4-byte Reload
	movq	40(%rsp), %rcx                  # 8-byte Reload
                                        # kill: def $ecx killed $ecx killed $rcx
	pushq	48(%rsp)
	.cfi_adjust_cfa_offset 8
	pushq	32(%rsp)
	.cfi_adjust_cfa_offset 8
	pushq	72(%rsp)
	.cfi_adjust_cfa_offset 8
	pushq	%r14
	.cfi_adjust_cfa_offset 8
	pushq	216(%rsp)                       # 8-byte Folded Reload
	.cfi_adjust_cfa_offset 8
	pushq	%rbp
	.cfi_adjust_cfa_offset 8
	pushq	112(%rsp)
	.cfi_adjust_cfa_offset 8
	pushq	%r13
	.cfi_adjust_cfa_offset 8
	pushq	184(%rsp)                       # 8-byte Folded Reload
	.cfi_adjust_cfa_offset 8
	pushq	200(%rsp)                       # 8-byte Folded Reload
	.cfi_adjust_cfa_offset 8
	pushq	176(%rsp)                       # 8-byte Folded Reload
	.cfi_adjust_cfa_offset 8
	callq	_Z25__device_stub__union_areaiiiiPKiPKyiiiiPKciiiS2_PiS5_
	addq	$96, %rsp
	.cfi_adjust_cfa_offset -96
.LBB11_18:                              #   in Loop: Header=BB11_16 Depth=1
	movq	40(%rsp), %rsi
	movl	$1999996, %eax                  # imm = 0x1E847C
	addq	%rax, %rsi
	movl	$4, %edx
	leaq	140(%rsp), %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB11_52
# %bb.19:                               #   in Loop: Header=BB11_16 Depth=1
	movl	140(%rsp), %edi
	movabsq	$4294967296, %rax               # imm = 0x100000000
	orq	%rax, %rdi
	movl	$1, %esi
	movq	184(%rsp), %rdx                 # 8-byte Reload
	movl	$1, %ecx
	movq	208(%rsp), %r8                  # 8-byte Reload
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB11_21
# %bb.20:                               #   in Loop: Header=BB11_16 Depth=1
	movq	72(%rsp), %rdx
	movq	40(%rsp), %rcx
	movq	64(%rsp), %r8
	movl	%r12d, %edi
	movq	96(%rsp), %rsi                  # 8-byte Reload
                                        # kill: def $esi killed $esi killed $rsi
	movq	88(%rsp), %r9                   # 8-byte Reload
                                        # kill: def $r9d killed $r9d killed $r9
	pushq	16(%rsp)
	.cfi_adjust_cfa_offset 8
	pushq	56(%rsp)
	.cfi_adjust_cfa_offset 8
	pushq	128(%rsp)                       # 8-byte Folded Reload
	.cfi_adjust_cfa_offset 8
	pushq	144(%rsp)                       # 8-byte Folded Reload
	.cfi_adjust_cfa_offset 8
	callq	_Z30__device_stub__calc_extra_areaiiPKiS0_PKyiiiS2_Pi
	addq	$32, %rsp
	.cfi_adjust_cfa_offset -32
.LBB11_21:                              #   in Loop: Header=BB11_16 Depth=1
	callq	hipDeviceSynchronize
	movq	200(%rsp), %rdi                 # 8-byte Reload
	movl	$1, %esi
	movq	8(%rsp), %rdx                   # 8-byte Reload
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB11_23
# %bb.22:                               #   in Loop: Header=BB11_16 Depth=1
	movq	56(%rsp), %rsi
	movq	16(%rsp), %rdx
	movq	128(%rsp), %rcx
	movq	32(%rsp), %rdi                  # 8-byte Reload
                                        # kill: def $edi killed $edi killed $rdi
	callq	_Z25__device_stub__findtopobsiPKcPKiPi
.LBB11_23:                              #   in Loop: Header=BB11_16 Depth=1
	movl	%r15d, %ebx
	movq	128(%rsp), %rsi
	movl	$800, %edx                      # imm = 0x320
	leaq	224(%rsp), %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB11_52
# %bb.24:                               # %.preheader198.preheader
                                        #   in Loop: Header=BB11_16 Depth=1
	xorl	%eax, %eax
	xorl	%r15d, %r15d
	xorl	%ebp, %ebp
.LBB11_25:                              # %.preheader198
                                        #   Parent Loop BB11_16 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movl	624(%rsp,%rax,4), %ecx
	cmpl	%r15d, %ecx
	jle	.LBB11_27
# %bb.26:                               #   in Loop: Header=BB11_25 Depth=2
	movl	224(%rsp,%rax,4), %ebp
	movl	%ecx, %r15d
.LBB11_27:                              #   in Loop: Header=BB11_25 Depth=2
	incq	%rax
	cmpq	$100, %rax
	jne	.LBB11_25
# %bb.28:                               #   in Loop: Header=BB11_16 Depth=1
	testl	%r15d, %r15d
	je	.LBB11_29
# %bb.32:                               #   in Loop: Header=BB11_16 Depth=1
	movslq	%ebp, %rax
	movq	160(%rsp), %rcx                 # 8-byte Reload
	movb	$1, (%rcx,%rax)
	movq	168(%rsp), %rcx                 # 8-byte Reload
	movl	(%rcx,%rax,4), %eax
	cltd
	idivl	%r12d
                                        # kill: def $eax killed $eax def $rax
	movq	%rax, 176(%rsp)                 # 8-byte Spill
	movl	%edx, %r14d
	movabsq	$4294967296, %rax               # imm = 0x100000000
	leaq	1(%rax), %rdx
	movq	184(%rsp), %rdi                 # 8-byte Reload
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB11_34
# %bb.33:                               #   in Loop: Header=BB11_16 Depth=1
	movq	72(%rsp), %rcx
	movq	64(%rsp), %r8
	subq	$8, %rsp
	.cfi_adjust_cfa_offset 8
	movl	%r12d, %edi
	movq	104(%rsp), %rsi                 # 8-byte Reload
                                        # kill: def $esi killed $esi killed $rsi
	movq	40(%rsp), %rdx                  # 8-byte Reload
                                        # kill: def $edx killed $edx killed $rdx
	movq	96(%rsp), %r9                   # 8-byte Reload
                                        # kill: def $r9d killed $r9d killed $r9
	pushq	56(%rsp)
	.cfi_adjust_cfa_offset 8
	pushq	72(%rsp)
	.cfi_adjust_cfa_offset 8
	pushq	%rbp
	.cfi_adjust_cfa_offset 8
	pushq	144(%rsp)                       # 8-byte Folded Reload
	.cfi_adjust_cfa_offset 8
	pushq	160(%rsp)                       # 8-byte Folded Reload
	.cfi_adjust_cfa_offset 8
	callq	_Z25__device_stub__calc_unioniiiPKiPKyiiiiPcPy
	addq	$48, %rsp
	.cfi_adjust_cfa_offset -48
.LBB11_34:                              #   in Loop: Header=BB11_16 Depth=1
	leal	1(%r13), %r12d
	callq	hipDeviceSynchronize
	addl	%ebx, %r15d
	cvtsi2sd	%r15d, %xmm0
	mulsd	.LCPI11_0(%rip), %xmm0
	divsd	152(%rsp), %xmm0                # 8-byte Folded Reload
	ucomisd	.LCPI11_1(%rip), %xmm0
	ja	.LBB11_35
# %bb.36:                               #   in Loop: Header=BB11_16 Depth=1
	testl	%r13d, %r13d
	jne	.LBB11_40
# %bb.37:                               #   in Loop: Header=BB11_16 Depth=1
	movq	16(%rsp), %rsi
	movq	144(%rsp), %rdi                 # 8-byte Reload
	movq	24(%rsp), %rdx                  # 8-byte Reload
	movl	$2, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB11_52
# %bb.38:                               #   in Loop: Header=BB11_16 Depth=1
	movl	$1, %r12d
	cmpl	$0, 84(%rsp)                    # 4-byte Folded Reload
	je	.LBB11_40
# %bb.39:                               #   in Loop: Header=BB11_16 Depth=1
	movq	16(%rsp), %rdi
	xorl	%esi, %esi
	movq	24(%rsp), %rdx                  # 8-byte Reload
	callq	hipMemset
	testl	%eax, %eax
	jne	.LBB11_41
.LBB11_40:                              #   in Loop: Header=BB11_16 Depth=1
	movq	40(%rsp), %rdi
	movl	$2000000, %edx                  # imm = 0x1E8480
	xorl	%esi, %esi
	callq	hipMemset
	movl	%r12d, %r13d
	testl	%eax, %eax
	movq	104(%rsp), %r12                 # 8-byte Reload
	je	.LBB11_16
.LBB11_41:
	movl	$.L.str.4, %edi
	callq	_Z3diePKc
.LBB11_29:                              # %._crit_edge220
	cvtsi2sd	%ebx, %xmm0
	mulsd	.LCPI11_0(%rip), %xmm0
	divsd	152(%rsp), %xmm0                # 8-byte Folded Reload
	jmp	.LBB11_30
.LBB11_35:
	movl	%r12d, %r13d
.LBB11_30:                              # %split
	movsd	%xmm0, 8(%rsp)                  # 8-byte Spill
	movl	$_ZSt4cout, %edi
	movl	$.L.str.6, %esi
	movl	$12, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$_ZSt4cout, %edi
	movl	%r13d, %esi
	callq	_ZNSolsEi
	movq	%rax, %rbx
	movl	$.L.str.7, %esi
	movl	$10, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	%rbx, %rdi
	movsd	8(%rsp), %xmm0                  # 8-byte Reload
                                        # xmm0 = mem[0],zero
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	72(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	movq	160(%rsp), %rbx                 # 8-byte Reload
	movq	192(%rsp), %r14                 # 8-byte Reload
	jne	.LBB11_31
# %bb.42:
	movq	64(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB11_31
# %bb.43:
	movq	56(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB11_31
# %bb.44:
	movq	48(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB11_31
# %bb.45:
	movq	16(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB11_31
# %bb.46:
	movq	128(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB11_31
# %bb.47:
	movq	40(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB11_31
# %bb.48:                               # %.preheader
	cmpl	$0, 32(%rsp)                    # 4-byte Folded Reload
	jle	.LBB11_50
# %bb.49:                               # %.lr.ph213.preheader
	movq	1088(%rsp), %rdi
	movq	%rbx, %rsi
	movq	%r14, %rdx
	callq	memcpy@PLT
.LBB11_50:                              # %._crit_edge214
	movq	%rbx, %rdi
	callq	_ZdaPv
	movq	144(%rsp), %rdi                 # 8-byte Reload
	callq	_ZdaPv
	addq	$1032, %rsp                     # imm = 0x408
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.LBB11_52:
	.cfi_def_cfa_offset 1088
	movl	$.L.str.2, %edi
	callq	_Z3diePKc
.LBB11_51:
	movl	$.L.str.1, %edi
	callq	_Z3diePKc
.LBB11_31:
	movl	$.L.str.3, %edi
	callq	_Z3diePKc
.Lfunc_end11:
	.size	_Z7site_itiiiiPKiPKyPc, .Lfunc_end11-_Z7site_itiiiiPKiPKyPc
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function main
.LCPI12_0:
	.long	0x3f000000                      # float 0.5
.LCPI12_1:
	.long	0x3f7fff58                      # float 0.999989986
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0
.LCPI12_2:
	.quad	0x412e848000000000              # double 1.0E+6
	.text
	.globl	main
	.type	main,@function
main:                                   # @main
.Lfunc_begin0:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception0
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$1208, %rsp                     # imm = 0x4B8
	.cfi_def_cfa_offset 1264
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rsi, %r14
	movl	%edi, %ebx
	leaq	160(%rsp), %rdi
	xorl	%esi, %esi
	callq	gettimeofday
	cmpl	$10, %ebx
	jne	.LBB12_53
# %bb.1:
	movq	160(%rsp), %rax
	movq	%rax, 112(%rsp)                 # 8-byte Spill
	movq	168(%rsp), %rax
	movq	%rax, 120(%rsp)                 # 8-byte Spill
	movq	8(%r14), %rdi
	callq	atoi
	movl	%eax, %ebx
	movq	16(%r14), %rdi
	callq	atoi
	movl	%eax, %r13d
	movq	24(%r14), %rdi
	callq	atoi
	movl	%eax, 40(%rsp)                  # 4-byte Spill
	movq	32(%r14), %rdi
	callq	atoi
	movl	%eax, %ebp
	movq	40(%r14), %rdi
	callq	atoi
	movl	%eax, %r12d
	movq	48(%r14), %rdi
	callq	atoi
	movl	%eax, %r15d
	movq	56(%r14), %rdi
	callq	atoi
	movl	$-20001, %edx                   # imm = 0xB1DF
	leal	(%rbx,%rdx), %ecx
	cmpl	%edx, %ecx
	jbe	.LBB12_54
# %bb.2:
	movl	$-10001, %edx                   # imm = 0xD8EF
	leal	(%rdx,%r13), %ecx
	cmpl	%edx, %ecx
	jbe	.LBB12_55
# %bb.3:
	cmpl	$1000001, 40(%rsp)              # 4-byte Folded Reload
                                        # imm = 0xF4241
	jae	.LBB12_56
# %bb.4:
	movl	$-1001, %edx                    # imm = 0xFC17
	leal	(%rdx,%rbp), %ecx
	cmpl	%edx, %ecx
	jbe	.LBB12_57
# %bb.5:
	leal	-2001(%r12), %ecx
	cmpl	$-1992, %ecx                    # imm = 0xF838
	jbe	.LBB12_58
# %bb.6:
	leal	-2000001(%r15), %ecx
	cmpl	$-1999902, %ecx                 # imm = 0xFFE17BE2
	jbe	.LBB12_59
# %bb.7:
	cmpl	$2, %eax
	jae	.LBB12_60
# %bb.8:
	movq	%rbp, 152(%rsp)                 # 8-byte Spill
	movl	%eax, 84(%rsp)                  # 4-byte Spill
	movq	%r14, 128(%rsp)                 # 8-byte Spill
	cvtsi2ss	%ebx, %xmm0
	cvtsi2ss	%r12d, %xmm1
	movaps	%xmm0, %xmm2
	divss	%xmm1, %xmm2
	movss	.LCPI12_0(%rip), %xmm1          # xmm1 = mem[0],zero,zero,zero
	addss	%xmm1, %xmm2
	cvttps2dq	%xmm2, %xmm2
	cvtdq2ps	%xmm2, %xmm2
	movaps	%xmm0, %xmm3
	divss	%xmm2, %xmm3
	divss	%xmm3, %xmm0
	addss	%xmm1, %xmm0
	xorps	%xmm1, %xmm1
	cvtsi2ss	%r15d, %xmm1
	cvttss2si	%xmm0, %eax
	movl	%eax, %ebp
	imull	%eax, %ebp
	xorps	%xmm0, %xmm0
	cvtsi2ss	%ebp, %xmm0
	divss	%xmm0, %xmm1
	addss	.LCPI12_1(%rip), %xmm1
	cvttss2si	%xmm1, %esi
	movq	%rax, 136(%rsp)                 # 8-byte Spill
	decl	%eax
	xorps	%xmm0, %xmm0
	cvtsi2ss	%eax, %xmm0
	movss	%xmm3, 92(%rsp)                 # 4-byte Spill
	mulss	%xmm3, %xmm0
	cvttss2si	%xmm0, %eax
	movl	%ebx, %ecx
	subl	%eax, %ecx
	imull	%ecx, %ecx
	cmpl	%esi, %ecx
	jl	.LBB12_61
# %bb.9:
	movl	%esi, 88(%rsp)                  # 4-byte Spill
	imull	%esi, %ebp
	leal	1(,%r13,2), %eax
	movl	%eax, 48(%rsp)                  # 4-byte Spill
	movq	%r13, 32(%rsp)                  # 8-byte Spill
	leal	64(,%r13,2), %r14d
	shrl	$6, %r14d
	movl	%ebx, %r12d
	imull	%r12d, %r12d
	leaq	(%r12,%r12), %rdi
	movq	%rdi, 144(%rsp)                 # 8-byte Spill
	callq	_Znam
	movq	%rax, %r15
	movq	%r12, %rdi
	callq	_Znam
	movq	%rax, 72(%rsp)                  # 8-byte Spill
	movslq	%ebp, %r12
	leaq	(,%r12,4), %rdi
	testl	%r12d, %r12d
	movq	$-1, %rax
	cmovsq	%rax, %rdi
	callq	_Znam
	movq	%rax, %r13
	imull	48(%rsp), %r14d                 # 4-byte Folded Reload
	movl	%ebp, 28(%rsp)                  # 4-byte Spill
	imull	%ebp, %r14d
	movslq	%r14d, %rax
	leaq	(,%rax,8), %rdi
	testl	%eax, %eax
	movq	$-1, %rax
	cmovsq	%rax, %rdi
	callq	_Znam
	movq	%rax, 56(%rsp)                  # 8-byte Spill
	movq	%r12, %rdi
	callq	_Znam
	movq	%rax, 48(%rsp)                  # 8-byte Spill
	movq	128(%rsp), %rax                 # 8-byte Reload
	movq	64(%rax), %rsi
	leaq	688(%rsp), %r14
	movq	%r14, %rdi
	movl	$8, %edx
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode
.Ltmp0:
	movq	%r14, %rdi
	movq	%r15, 64(%rsp)                  # 8-byte Spill
	movq	%r15, %rsi
	movq	144(%rsp), %rdx                 # 8-byte Reload
	callq	_ZNSi4readEPcl
.Ltmp1:
	movq	152(%rsp), %r12                 # 8-byte Reload
# %bb.10:
	movq	688(%rsp), %rax
	movq	-24(%rax), %rax
	testb	$5, 720(%rsp,%rax)
	jne	.LBB12_62
# %bb.11:
.Ltmp4:
	leaq	688(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE5closeEv
.Ltmp5:
# %bb.12:
	leaq	96(%rsp), %r14
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	gettimeofday
	movq	(%r14), %rbp
	movq	8(%r14), %r14
.Ltmp6:
	movl	$_ZSt4cout, %edi
	movl	$.L.str.19, %esi
	movl	$6, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp7:
# %bb.13:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit
	movq	%rbp, %rax
	subq	112(%rsp), %rax                 # 8-byte Folded Reload
	imulq	$1000000, %rax, %rax            # imm = 0xF4240
	movq	%r14, %rcx
	subq	120(%rsp), %rcx                 # 8-byte Folded Reload
	addq	%rax, %rcx
	cvtsi2sd	%rcx, %xmm0
	divsd	.LCPI12_2(%rip), %xmm0
.Ltmp8:
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertIdEERSoT_
.Ltmp9:
# %bb.14:                               # %_ZNSolsEd.exit
.Ltmp10:
	movq	72(%rsp), %rax                  # 8-byte Reload
	movq	%rax, (%rsp)
	movl	%ebx, %edi
	movq	64(%rsp), %rsi                  # 8-byte Reload
	movq	32(%rsp), %rdx                  # 8-byte Reload
                                        # kill: def $edx killed $edx killed $rdx
	movl	40(%rsp), %ecx                  # 4-byte Reload
	movl	%ecx, %r8d
	movl	%r12d, %r9d
	callq	_Z8calc_vixiPKtiiiiPh
.Ltmp11:
# %bb.15:
.Ltmp12:
	callq	hipDeviceSynchronize
.Ltmp13:
# %bb.16:
	movq	%r14, %r15
	leaq	96(%rsp), %r14
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	gettimeofday
	movq	(%r14), %r12
	movq	8(%r14), %rax
	movq	%r15, %r14
	movq	%rbp, %r15
	movq	%rax, %rbp
.Ltmp14:
	movl	$_ZSt4cout, %edi
	movl	$.L.str.20, %esi
	movl	$5, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp15:
# %bb.17:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit139
	movq	%r12, %rax
	subq	%r15, %rax
	imulq	$1000000, %rax, %rax            # imm = 0xF4240
	movq	%rbp, %rcx
	subq	%r14, %rcx
	addq	%rax, %rcx
	xorps	%xmm0, %xmm0
	cvtsi2sd	%rcx, %xmm0
	divsd	.LCPI12_2(%rip), %xmm0
.Ltmp16:
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertIdEERSoT_
.Ltmp17:
# %bb.18:                               # %_ZNSolsEd.exit140
.Ltmp18:
	movl	%ebx, %edi
	movq	72(%rsp), %rsi                  # 8-byte Reload
	movss	92(%rsp), %xmm0                 # 4-byte Reload
                                        # xmm0 = mem[0],zero,zero,zero
	movl	28(%rsp), %edx                  # 4-byte Reload
	movq	136(%rsp), %rcx                 # 8-byte Reload
                                        # kill: def $ecx killed $ecx killed $rcx
	movl	88(%rsp), %r8d                  # 4-byte Reload
	movq	%r13, %r9
	callq	_Z8find_maxiPKhfiiiPi
.Ltmp19:
# %bb.19:
.Ltmp20:
	callq	hipDeviceSynchronize
.Ltmp21:
# %bb.20:
	leaq	96(%rsp), %r14
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	gettimeofday
	movq	(%r14), %r15
	movq	8(%r14), %r14
.Ltmp22:
	movl	$_ZSt4cout, %edi
	movl	$.L.str.21, %esi
	movl	$9, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp23:
# %bb.21:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit141
	movq	%r15, %rax
	subq	%r12, %rax
	imulq	$1000000, %rax, %rax            # imm = 0xF4240
	movq	%r14, %rcx
	subq	%rbp, %rcx
	addq	%rax, %rcx
	xorps	%xmm0, %xmm0
	cvtsi2sd	%rcx, %xmm0
	divsd	.LCPI12_2(%rip), %xmm0
.Ltmp24:
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertIdEERSoT_
.Ltmp25:
# %bb.22:                               # %_ZNSolsEd.exit142
.Ltmp26:
	movq	56(%rsp), %rax                  # 8-byte Reload
	movq	%rax, 8(%rsp)
	movq	%r13, (%rsp)
	movl	%ebx, %edi
	movq	64(%rsp), %rsi                  # 8-byte Reload
	movq	32(%rsp), %rdx                  # 8-byte Reload
                                        # kill: def $edx killed $edx killed $rdx
	movl	40(%rsp), %ecx                  # 4-byte Reload
	movl	%ecx, %r8d
	movl	28(%rsp), %r9d                  # 4-byte Reload
	callq	_Z10calc_shedsiPKtiiiiPKiPy
.Ltmp27:
# %bb.23:
.Ltmp28:
	callq	hipDeviceSynchronize
.Ltmp29:
# %bb.24:
	movq	%r14, %r12
	leaq	96(%rsp), %r14
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	gettimeofday
	movq	(%r14), %rbp
	movq	8(%r14), %rax
	movq	%r12, %r14
	movq	%rax, %r12
.Ltmp30:
	movl	$_ZSt4cout, %edi
	movl	$.L.str.22, %esi
	movl	$10, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp31:
# %bb.25:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit143
	movq	%rbp, %rax
	subq	%r15, %rax
	imulq	$1000000, %rax, %rax            # imm = 0xF4240
	movq	%r12, %rcx
	subq	%r14, %rcx
	addq	%rax, %rcx
	xorps	%xmm0, %xmm0
	cvtsi2sd	%rcx, %xmm0
	divsd	.LCPI12_2(%rip), %xmm0
.Ltmp32:
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertIdEERSoT_
.Ltmp33:
# %bb.26:                               # %_ZNSolsEd.exit144
.Ltmp34:
	movq	48(%rsp), %rax                  # 8-byte Reload
	movq	%rax, (%rsp)
	movl	%ebx, %edi
	movq	32(%rsp), %rsi                  # 8-byte Reload
                                        # kill: def $esi killed $esi killed $rsi
	movl	84(%rsp), %edx                  # 4-byte Reload
	movl	28(%rsp), %ecx                  # 4-byte Reload
	movq	%r13, %r8
	movq	56(%rsp), %r9                   # 8-byte Reload
	callq	_Z7site_itiiiiPKiPKyPc
.Ltmp35:
# %bb.27:
.Ltmp36:
	callq	hipDeviceSynchronize
.Ltmp37:
# %bb.28:
	leaq	96(%rsp), %r14
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	gettimeofday
	movq	(%r14), %r15
	movq	8(%r14), %r14
.Ltmp38:
	movl	$_ZSt4cout, %edi
	movl	$.L.str.23, %esi
	movl	$6, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp39:
# %bb.29:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit145
	movq	%r15, %rax
	subq	%rbp, %rax
	imulq	$1000000, %rax, %rax            # imm = 0xF4240
	movq	%r14, %rcx
	subq	%r12, %rcx
	addq	%rax, %rcx
	xorps	%xmm0, %xmm0
	cvtsi2sd	%rcx, %xmm0
	divsd	.LCPI12_2(%rip), %xmm0
.Ltmp40:
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertIdEERSoT_
.Ltmp41:
# %bb.30:                               # %_ZNSolsEd.exit146
	movq	%r15, 32(%rsp)                  # 8-byte Spill
	movq	%r14, 40(%rsp)                  # 8-byte Spill
	movq	128(%rsp), %rax                 # 8-byte Reload
	movq	72(%rax), %rsi
.Ltmp43:
	leaq	176(%rsp), %rdi
	movl	$16, %edx
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode
.Ltmp44:
# %bb.31:                               # %.preheader
	movl	28(%rsp), %eax                  # 4-byte Reload
	testl	%eax, %eax
	jle	.LBB12_44
# %bb.32:                               # %.lr.ph.preheader
	movl	%eax, %r12d
	xorl	%r14d, %r14d
	leaq	27(%rsp), %r15
.LBB12_33:                              # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movq	48(%rsp), %rax                  # 8-byte Reload
	cmpb	$0, (%rax,%r14)
	je	.LBB12_43
# %bb.34:                               #   in Loop: Header=BB12_33 Depth=1
	movl	(%r13,%r14,4), %eax
	cltd
	idivl	%ebx
.Ltmp46:
	leaq	176(%rsp), %rdi
	movl	%eax, %esi
	callq	_ZNSolsEi
.Ltmp47:
# %bb.35:                               #   in Loop: Header=BB12_33 Depth=1
	movq	%rax, %rbp
	movb	$44, 27(%rsp)
	movq	(%rax), %rax
	movq	-24(%rax), %rax
	cmpq	$0, 16(%rbp,%rax)
	je	.LBB12_38
# %bb.36:                               #   in Loop: Header=BB12_33 Depth=1
.Ltmp48:
	movl	$1, %edx
	movq	%rbp, %rdi
	movq	%r15, %rsi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp49:
# %bb.37:                               #   in Loop: Header=BB12_33 Depth=1
	movq	%rax, %rbp
	jmp	.LBB12_39
.LBB12_38:                              #   in Loop: Header=BB12_33 Depth=1
.Ltmp50:
	movq	%rbp, %rdi
	movl	$44, %esi
	callq	_ZNSo3putEc
.Ltmp51:
.LBB12_39:                              #   in Loop: Header=BB12_33 Depth=1
	movl	(%r13,%r14,4), %eax
	cltd
	idivl	%ebx
.Ltmp52:
	movq	%rbp, %rdi
	movl	%edx, %esi
	callq	_ZNSolsEi
.Ltmp53:
# %bb.40:                               #   in Loop: Header=BB12_33 Depth=1
	movb	$10, 27(%rsp)
	movq	(%rax), %rcx
	movq	-24(%rcx), %rcx
	cmpq	$0, 16(%rax,%rcx)
	je	.LBB12_42
# %bb.41:                               #   in Loop: Header=BB12_33 Depth=1
.Ltmp54:
	movl	$1, %edx
	movq	%rax, %rdi
	movq	%r15, %rsi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp55:
	jmp	.LBB12_43
.LBB12_42:                              #   in Loop: Header=BB12_33 Depth=1
.Ltmp56:
	movq	%rax, %rdi
	movl	$10, %esi
	callq	_ZNSo3putEc
.Ltmp57:
.LBB12_43:                              #   in Loop: Header=BB12_33 Depth=1
	incq	%r14
	cmpq	%r14, %r12
	jne	.LBB12_33
.LBB12_44:                              # %._crit_edge
.Ltmp59:
	leaq	176(%rsp), %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE5closeEv
.Ltmp60:
# %bb.45:
	movq	64(%rsp), %rdi                  # 8-byte Reload
	callq	_ZdaPv
	movq	72(%rsp), %rdi                  # 8-byte Reload
	callq	_ZdaPv
	movq	%r13, %rdi
	callq	_ZdaPv
	movq	56(%rsp), %rdi                  # 8-byte Reload
	callq	_ZdaPv
	movq	48(%rsp), %rdi                  # 8-byte Reload
	callq	_ZdaPv
	leaq	96(%rsp), %rbx
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	gettimeofday
	movq	(%rbx), %r14
	movq	8(%rbx), %rbx
.Ltmp61:
	movl	$_ZSt4cout, %edi
	movl	$.L.str.24, %esi
	movl	$8, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp62:
# %bb.46:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit154
	subq	32(%rsp), %r14                  # 8-byte Folded Reload
	imulq	$1000000, %r14, %rax            # imm = 0xF4240
	subq	40(%rsp), %rbx                  # 8-byte Folded Reload
	addq	%rax, %rbx
	xorps	%xmm0, %xmm0
	cvtsi2sd	%rbx, %xmm0
	divsd	.LCPI12_2(%rip), %xmm0
.Ltmp63:
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertIdEERSoT_
.Ltmp64:
# %bb.47:                               # %_ZNSolsEd.exit156
	leaq	96(%rsp), %rbx
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	gettimeofday
	movq	(%rbx), %r14
	movq	8(%rbx), %rbx
.Ltmp65:
	movl	$_ZSt4cout, %edi
	movl	$.L.str.25, %esi
	movl	$7, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp66:
# %bb.48:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit158
	subq	112(%rsp), %r14                 # 8-byte Folded Reload
	imulq	$1000000, %r14, %rax            # imm = 0xF4240
	subq	120(%rsp), %rbx                 # 8-byte Folded Reload
	addq	%rax, %rbx
	xorps	%xmm0, %xmm0
	cvtsi2sd	%rbx, %xmm0
	divsd	.LCPI12_2(%rip), %xmm0
.Ltmp67:
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertIdEERSoT_
.Ltmp68:
# %bb.49:                               # %_ZNSolsEd.exit160
	movq	%rax, %rbx
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
.Ltmp69:
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp70:
# %bb.50:                               # %.noexc162
.Ltmp71:
	movsbl	%al, %esi
	movq	%rbx, %rdi
	callq	_ZNSo3putEc
.Ltmp72:
# %bb.51:                               # %.noexc163
.Ltmp73:
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp74:
# %bb.52:                               # %_ZNSolsEPFRSoS_E.exit
	movq	_ZTTSt14basic_ofstreamIcSt11char_traitsIcEE(%rip), %rax
	leaq	184(%rsp), %rdi
	movq	%rax, -8(%rdi)
	movq	_ZTTSt14basic_ofstreamIcSt11char_traitsIcEE+24(%rip), %rcx
	movq	-24(%rax), %rax
	movq	%rcx, 176(%rsp,%rax)
	callq	_ZNSt13basic_filebufIcSt11char_traitsIcEED2Ev
	leaq	424(%rsp), %rdi
	callq	_ZNSt8ios_baseD2Ev
	leaq	688(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev
	xorl	%eax, %eax
	addq	$1208, %rsp                     # imm = 0x4B8
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.LBB12_53:
	.cfi_def_cfa_offset 1264
	movl	$_ZSt4cout, %edi
	movl	$.L.str.8, %esi
	movl	$5, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$_ZSt4cout, %edi
	movl	%ebx, %esi
	callq	_ZNSolsEi
	movq	%rax, %rbx
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%rbx, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movl	$.L.str.9, %edi
	callq	_Z3diePKc
.LBB12_54:
	movl	$.L.str.10, %edi
	callq	_Z3diePKc
.LBB12_55:
	movl	$.L.str.11, %edi
	callq	_Z3diePKc
.LBB12_56:
	movl	$.L.str.12, %edi
	callq	_Z3diePKc
.LBB12_57:
	movl	$.L.str.13, %edi
	callq	_Z3diePKc
.LBB12_58:
	movl	$.L.str.14, %edi
	callq	_Z3diePKc
.LBB12_59:
	movl	$.L.str.15, %edi
	callq	_Z3diePKc
.LBB12_60:
	movl	$.L.str.16, %edi
	callq	_Z3diePKc
.LBB12_61:
	movl	$.L.str.17, %edi
	callq	_Z3diePKc
.LBB12_62:
.Ltmp2:
	movl	$.L.str.18, %edi
	callq	_Z3diePKc
.Ltmp3:
# %bb.63:                               # %.unreachable
.LBB12_64:
.Ltmp45:
	jmp	.LBB12_67
.LBB12_65:
.Ltmp75:
	jmp	.LBB12_69
.LBB12_66:
.Ltmp42:
.LBB12_67:
	movq	%rax, %rbx
	jmp	.LBB12_70
.LBB12_68:
.Ltmp58:
.LBB12_69:
	movq	%rax, %rbx
	leaq	176(%rsp), %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev
.LBB12_70:
	leaq	688(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end12:
	.size	main, .Lfunc_end12-main
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table12:
.Lexception0:
	.byte	255                             # @LPStart Encoding = omit
	.byte	255                             # @TType Encoding = omit
	.byte	1                               # Call site Encoding = uleb128
	.uleb128 .Lcst_end0-.Lcst_begin0
.Lcst_begin0:
	.uleb128 .Lfunc_begin0-.Lfunc_begin0    # >> Call Site 1 <<
	.uleb128 .Ltmp0-.Lfunc_begin0           #   Call between .Lfunc_begin0 and .Ltmp0
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp0-.Lfunc_begin0           # >> Call Site 2 <<
	.uleb128 .Ltmp41-.Ltmp0                 #   Call between .Ltmp0 and .Ltmp41
	.uleb128 .Ltmp42-.Lfunc_begin0          #     jumps to .Ltmp42
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp43-.Lfunc_begin0          # >> Call Site 3 <<
	.uleb128 .Ltmp44-.Ltmp43                #   Call between .Ltmp43 and .Ltmp44
	.uleb128 .Ltmp45-.Lfunc_begin0          #     jumps to .Ltmp45
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp46-.Lfunc_begin0          # >> Call Site 4 <<
	.uleb128 .Ltmp57-.Ltmp46                #   Call between .Ltmp46 and .Ltmp57
	.uleb128 .Ltmp58-.Lfunc_begin0          #     jumps to .Ltmp58
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp59-.Lfunc_begin0          # >> Call Site 5 <<
	.uleb128 .Ltmp74-.Ltmp59                #   Call between .Ltmp59 and .Ltmp74
	.uleb128 .Ltmp75-.Lfunc_begin0          #     jumps to .Ltmp75
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp74-.Lfunc_begin0          # >> Call Site 6 <<
	.uleb128 .Ltmp2-.Ltmp74                 #   Call between .Ltmp74 and .Ltmp2
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp2-.Lfunc_begin0           # >> Call Site 7 <<
	.uleb128 .Ltmp3-.Ltmp2                  #   Call between .Ltmp2 and .Ltmp3
	.uleb128 .Ltmp42-.Lfunc_begin0          #     jumps to .Ltmp42
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp3-.Lfunc_begin0           # >> Call Site 8 <<
	.uleb128 .Lfunc_end12-.Ltmp3            #   Call between .Ltmp3 and .Lfunc_end12
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end0:
	.p2align	2, 0x0
                                        # -- End function
	.text
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	subq	$32, %rsp
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -16
	movq	__hip_gpubin_handle(%rip), %rbx
	testq	%rbx, %rbx
	jne	.LBB13_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB13_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z12calc_one_vixiPKtiiiiPh, %esi
	movl	$.L__unnamed_1, %edx
	movl	$.L__unnamed_1, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z17process_one_blockiPhfiiPi, %esi
	movl	$.L__unnamed_2, %edx
	movl	$.L__unnamed_2, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z13calc_one_shediPKtiiiiPKiPy, %esi
	movl	$.L__unnamed_3, %edx
	movl	$.L__unnamed_3, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z15calc_extra_areaiiPKiS0_PKyiiiS2_Pi, %esi
	movl	$.L__unnamed_4, %edx
	movl	$.L__unnamed_4, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z10union_areaiiiiPKiPKyiiiiPKciiiS2_PiS5_, %esi
	movl	$.L__unnamed_5, %edx
	movl	$.L__unnamed_5, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z10findtopobsiPKcPKiPi, %esi
	movl	$.L__unnamed_6, %edx
	movl	$.L__unnamed_6, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z10calc_unioniiiPKiPKyiiiiPcPy, %esi
	movl	$.L__unnamed_7, %edx
	movl	$.L__unnamed_7, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end13:
	.size	__hip_module_ctor, .Lfunc_end13-__hip_module_ctor
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_dtor
	.type	__hip_module_dtor,@function
__hip_module_dtor:                      # @__hip_module_dtor
	.cfi_startproc
# %bb.0:
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	je	.LBB14_2
# %bb.1:
	pushq	%rax
	.cfi_def_cfa_offset 16
	callq	__hipUnregisterFatBinary
	movq	$0, __hip_gpubin_handle(%rip)
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
.LBB14_2:
	retq
.Lfunc_end14:
	.size	__hip_module_dtor, .Lfunc_end14-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"ERROR: "
	.size	.L.str, 8

	.type	_Z12calc_one_vixiPKtiiiiPh,@object # @_Z12calc_one_vixiPKtiiiiPh
	.section	.rodata,"a",@progbits
	.globl	_Z12calc_one_vixiPKtiiiiPh
	.p2align	3, 0x0
_Z12calc_one_vixiPKtiiiiPh:
	.quad	_Z27__device_stub__calc_one_vixiPKtiiiiPh
	.size	_Z12calc_one_vixiPKtiiiiPh, 8

	.type	.L.str.1,@object                # @.str.1
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.1:
	.asciz	"hipMalloc failed"
	.size	.L.str.1, 17

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"hipMemcpy failed"
	.size	.L.str.2, 17

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"hipFree failed"
	.size	.L.str.3, 15

	.type	_Z17process_one_blockiPhfiiPi,@object # @_Z17process_one_blockiPhfiiPi
	.section	.rodata,"a",@progbits
	.globl	_Z17process_one_blockiPhfiiPi
	.p2align	3, 0x0
_Z17process_one_blockiPhfiiPi:
	.quad	_Z32__device_stub__process_one_blockiPhfiiPi
	.size	_Z17process_one_blockiPhfiiPi, 8

	.type	_Z13calc_one_shediPKtiiiiPKiPy,@object # @_Z13calc_one_shediPKtiiiiPKiPy
	.globl	_Z13calc_one_shediPKtiiiiPKiPy
	.p2align	3, 0x0
_Z13calc_one_shediPKtiiiiPKiPy:
	.quad	_Z28__device_stub__calc_one_shediPKtiiiiPKiPy
	.size	_Z13calc_one_shediPKtiiiiPKiPy, 8

	.type	.L.str.4,@object                # @.str.4
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.4:
	.asciz	"hipMemset failed"
	.size	.L.str.4, 17

	.type	_Z15calc_extra_areaiiPKiS0_PKyiiiS2_Pi,@object # @_Z15calc_extra_areaiiPKiS0_PKyiiiS2_Pi
	.section	.rodata,"a",@progbits
	.globl	_Z15calc_extra_areaiiPKiS0_PKyiiiS2_Pi
	.p2align	3, 0x0
_Z15calc_extra_areaiiPKiS0_PKyiiiS2_Pi:
	.quad	_Z30__device_stub__calc_extra_areaiiPKiS0_PKyiiiS2_Pi
	.size	_Z15calc_extra_areaiiPKiS0_PKyiiiS2_Pi, 8

	.type	_Z10union_areaiiiiPKiPKyiiiiPKciiiS2_PiS5_,@object # @_Z10union_areaiiiiPKiPKyiiiiPKciiiS2_PiS5_
	.globl	_Z10union_areaiiiiPKiPKyiiiiPKciiiS2_PiS5_
	.p2align	3, 0x0
_Z10union_areaiiiiPKiPKyiiiiPKciiiS2_PiS5_:
	.quad	_Z25__device_stub__union_areaiiiiPKiPKyiiiiPKciiiS2_PiS5_
	.size	_Z10union_areaiiiiPKiPKyiiiiPKciiiS2_PiS5_, 8

	.type	_Z10findtopobsiPKcPKiPi,@object # @_Z10findtopobsiPKcPKiPi
	.globl	_Z10findtopobsiPKcPKiPi
	.p2align	3, 0x0
_Z10findtopobsiPKcPKiPi:
	.quad	_Z25__device_stub__findtopobsiPKcPKiPi
	.size	_Z10findtopobsiPKcPKiPi, 8

	.type	_Z10calc_unioniiiPKiPKyiiiiPcPy,@object # @_Z10calc_unioniiiPKiPKyiiiiPcPy
	.globl	_Z10calc_unioniiiPKiPKyiiiiPcPy
	.p2align	3, 0x0
_Z10calc_unioniiiPKiPKyiiiiPcPy:
	.quad	_Z25__device_stub__calc_unioniiiPKiPKyiiiiPcPy
	.size	_Z10calc_unioniiiPKiPKyiiiiPcPy, 8

	.type	.L.str.6,@object                # @.str.6
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.6:
	.asciz	" nusedsheds:"
	.size	.L.str.6, 13

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	" coverage:"
	.size	.L.str.7, 11

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"argc="
	.size	.L.str.8, 6

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"SITE requires 9 arguments: nrows, roi, oht/tht, ntests, blocksize, nwanted, intervis, infile, outfile"
	.size	.L.str.9, 102

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	"Unreasonable value for nrows"
	.size	.L.str.10, 29

	.type	.L.str.11,@object               # @.str.11
.L.str.11:
	.asciz	"Unreasonable value for roi."
	.size	.L.str.11, 28

	.type	.L.str.12,@object               # @.str.12
.L.str.12:
	.asciz	"Unreasonable value for tht."
	.size	.L.str.12, 28

	.type	.L.str.13,@object               # @.str.13
.L.str.13:
	.asciz	"Unreasonable value for ntests."
	.size	.L.str.13, 31

	.type	.L.str.14,@object               # @.str.14
.L.str.14:
	.asciz	"Unreasonable value for blocksize0."
	.size	.L.str.14, 35

	.type	.L.str.15,@object               # @.str.15
.L.str.15:
	.asciz	"Unreasonable value for nwanted0."
	.size	.L.str.15, 33

	.type	.L.str.16,@object               # @.str.16
.L.str.16:
	.asciz	"Unreasonable value for intervis."
	.size	.L.str.16, 33

	.type	.L.str.17,@object               # @.str.17
.L.str.17:
	.asciz	"The last block is too small for nwantedperblock."
	.size	.L.str.17, 49

	.type	.L.str.18,@object               # @.str.18
.L.str.18:
	.asciz	"Input failed"
	.size	.L.str.18, 13

	.type	.L.str.19,@object               # @.str.19
.L.str.19:
	.asciz	"input:"
	.size	.L.str.19, 7

	.type	.L.str.20,@object               # @.str.20
.L.str.20:
	.asciz	" vix:"
	.size	.L.str.20, 6

	.type	.L.str.21,@object               # @.str.21
.L.str.21:
	.asciz	" findmax:"
	.size	.L.str.21, 10

	.type	.L.str.22,@object               # @.str.22
.L.str.22:
	.asciz	" viewshed:"
	.size	.L.str.22, 11

	.type	.L.str.23,@object               # @.str.23
.L.str.23:
	.asciz	" site:"
	.size	.L.str.23, 7

	.type	.L.str.24,@object               # @.str.24
.L.str.24:
	.asciz	" output:"
	.size	.L.str.24, 9

	.type	.L.str.25,@object               # @.str.25
.L.str.25:
	.asciz	" total:"
	.size	.L.str.25, 8

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z12calc_one_vixiPKtiiiiPh"
	.size	.L__unnamed_1, 27

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z17process_one_blockiPhfiiPi"
	.size	.L__unnamed_2, 30

	.type	.L__unnamed_3,@object           # @2
.L__unnamed_3:
	.asciz	"_Z13calc_one_shediPKtiiiiPKiPy"
	.size	.L__unnamed_3, 31

	.type	.L__unnamed_4,@object           # @3
.L__unnamed_4:
	.asciz	"_Z15calc_extra_areaiiPKiS0_PKyiiiS2_Pi"
	.size	.L__unnamed_4, 39

	.type	.L__unnamed_5,@object           # @4
.L__unnamed_5:
	.asciz	"_Z10union_areaiiiiPKiPKyiiiiPKciiiS2_PiS5_"
	.size	.L__unnamed_5, 43

	.type	.L__unnamed_6,@object           # @5
.L__unnamed_6:
	.asciz	"_Z10findtopobsiPKcPKiPi"
	.size	.L__unnamed_6, 24

	.type	.L__unnamed_7,@object           # @6
.L__unnamed_7:
	.asciz	"_Z10calc_unioniiiPKiPKyiiiiPcPy"
	.size	.L__unnamed_7, 32

	.type	__hip_fatbin_wrapper,@object    # @__hip_fatbin_wrapper
	.section	.hipFatBinSegment,"a",@progbits
	.p2align	3, 0x0
__hip_fatbin_wrapper:
	.long	1212764230                      # 0x48495046
	.long	1                               # 0x1
	.quad	__hip_fatbin
	.quad	0
	.size	__hip_fatbin_wrapper, 24

	.type	__hip_gpubin_handle,@object     # @__hip_gpubin_handle
	.local	__hip_gpubin_handle
	.comm	__hip_gpubin_handle,8,8
	.section	.init_array,"aw",@init_array
	.p2align	3, 0x0
	.quad	__hip_module_ctor
	.type	__hip_cuid_,@object             # @__hip_cuid_
	.bss
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               # 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym _Z27__device_stub__calc_one_vixiPKtiiiiPh
	.addrsig_sym _Z32__device_stub__process_one_blockiPhfiiPi
	.addrsig_sym _Z28__device_stub__calc_one_shediPKtiiiiPKiPy
	.addrsig_sym _Z30__device_stub__calc_extra_areaiiPKiS0_PKyiiiS2_Pi
	.addrsig_sym _Z25__device_stub__union_areaiiiiPKiPKyiiiiPKciiiS2_PiS5_
	.addrsig_sym _Z25__device_stub__findtopobsiPKcPKiPi
	.addrsig_sym _Z25__device_stub__calc_unioniiiPKiPKyiiiiPcPy
	.addrsig_sym __gxx_personality_v0
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Unwind_Resume
	.addrsig_sym _ZSt4cout
	.addrsig_sym _Z12calc_one_vixiPKtiiiiPh
	.addrsig_sym _Z17process_one_blockiPhfiiPi
	.addrsig_sym _Z13calc_one_shediPKtiiiiPKiPy
	.addrsig_sym _Z15calc_extra_areaiiPKiS0_PKyiiiS2_Pi
	.addrsig_sym _Z10union_areaiiiiPKiPKyiiiiPKciiiS2_PiS5_
	.addrsig_sym _Z10findtopobsiPKcPKiPi
	.addrsig_sym _Z10calc_unioniiiPKiPKyiiiiPcPy
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z12calc_one_vixiPKtiiiiPh ; -- Begin function _Z12calc_one_vixiPKtiiiiPh
	.globl	_Z12calc_one_vixiPKtiiiiPh
	.p2align	8
	.type	_Z12calc_one_vixiPKtiiiiPh,@function
_Z12calc_one_vixiPKtiiiiPh:             ; @_Z12calc_one_vixiPKtiiiiPh
; %bb.0:
	s_clause 0x2
	s_load_b32 s2, s[0:1], 0x28
	s_load_b32 s3, s[0:1], 0x34
	s_load_b32 s10, s[0:1], 0x0
	s_waitcnt lgkmcnt(0)
	s_mul_i32 s2, s2, s15
	s_and_b32 s3, s3, 0xffff
	s_add_i32 s2, s2, s14
	s_delay_alu instid0(SALU_CYCLE_1)
	v_mad_u64_u32 v[1:2], null, s2, s3, v[0:1]
	s_mul_i32 s2, s10, s10
	s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1)
	v_cmp_gt_i32_e32 vcc_lo, s2, v1
	s_and_saveexec_b32 s2, vcc_lo
	s_cbranch_execz .LBB0_23
; %bb.1:
	s_load_b128 s[4:7], s[0:1], 0x10
	v_ashrrev_i32_e32 v2, 31, v1
	s_waitcnt lgkmcnt(0)
	s_cmp_lt_i32 s7, 1
	s_cbranch_scc1 .LBB0_21
; %bb.2:                                ; %.lr.ph
	s_load_b64 s[8:9], s[0:1], 0x8
	v_lshlrev_b64 v[3:4], 1, v[1:2]
	s_ashr_i32 s2, s10, 31
	v_add_nc_u32_e32 v5, v1, v2
	s_add_i32 s3, s10, s2
	v_mov_b32_e32 v11, v1
	s_xor_b32 s3, s3, s2
	s_delay_alu instid0(SALU_CYCLE_1)
	s_sub_i32 s11, 0, s3
	v_xor_b32_e32 v5, v5, v2
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v3, vcc_lo, s8, v3
	v_add_co_ci_u32_e32 v4, vcc_lo, s9, v4, vcc_lo
	global_load_u16 v0, v[3:4], off
	v_cvt_f32_u32_e32 v3, s3
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_rcp_iflag_f32_e32 v3, v3
	s_waitcnt_depctr 0xfff
	v_mul_f32_e32 v3, 0x4f7ffffe, v3
	v_cvt_u32_f32_e32 v3, v3
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_lo_u32 v4, s11, v3
	v_mul_hi_u32 v4, v3, v4
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_nc_u32_e32 v3, v3, v4
	v_mul_hi_u32 v3, v5, v3
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_lo_u32 v4, v3, s3
	v_sub_nc_u32_e32 v4, v5, v4
	v_add_nc_u32_e32 v5, 1, v3
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_subrev_nc_u32_e32 v6, s3, v4
	v_cmp_le_u32_e32 vcc_lo, s3, v4
	v_dual_cndmask_b32 v3, v3, v5 :: v_dual_cndmask_b32 v4, v4, v6
	v_xor_b32_e32 v6, s2, v2
	s_lshl_b32 s2, s4, 1
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_4) | instid1(VALU_DEP_2)
	v_cmp_le_u32_e32 vcc_lo, s3, v4
	s_waitcnt vmcnt(0)
	v_add_nc_u32_e32 v0, s5, v0
	v_add_nc_u32_e32 v5, 1, v3
	s_mov_b32 s5, 0
	v_sub_nc_u32_e32 v9, s6, v0
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_3) | instid1(VALU_DEP_3)
	v_cndmask_b32_e32 v3, v3, v5, vcc_lo
	v_mov_b32_e32 v5, 0
	v_cvt_f32_i32_e32 v10, v0
	s_mov_b32 s6, 0x41c64e6d
	v_xor_b32_e32 v3, v3, v6
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_sub_nc_u32_e32 v3, v3, v6
	v_cvt_f32_i32_e32 v6, s2
	v_mul_lo_u32 v4, v3, s10
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_add_f32_e32 v6, 0x3f7fff58, v6
	v_subrev_nc_u32_e32 v7, s4, v3
	v_sub_nc_u32_e32 v4, v1, v4
	s_delay_alu instid0(VALU_DEP_1)
	v_subrev_nc_u32_e32 v8, s4, v4
	s_mul_i32 s4, s4, s4
.LBB0_3:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_12 Depth 2
	v_mad_u64_u32 v[12:13], null, v11, s6, 0x3039
	s_mov_b32 s2, exec_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_2)
	v_and_b32_e32 v0, 0x7fffffff, v12
	s_waitcnt vmcnt(0)
	v_mad_u64_u32 v[13:14], null, v12, s6, 0x3039
	v_cvt_f32_i32_e32 v0, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_dual_mul_f32 v0, v6, v0 :: v_dual_and_b32 v11, 0x7fffffff, v13
	v_cvt_f32_i32_e32 v12, v11
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_mul_f32_e32 v0, 0x30000000, v0
	v_mul_f32_e32 v12, v6, v12
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cvt_i32_f32_e32 v0, v0
	v_mul_f32_e32 v13, 0x30000000, v12
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_nc_u32_e32 v12, v7, v0
	v_cvt_i32_f32_e32 v0, v13
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_sub_nc_u32_e32 v13, v12, v3
	v_add_nc_u32_e32 v0, v8, v0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_mul_lo_u32 v15, v13, v13
	v_sub_nc_u32_e32 v14, v0, v4
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[16:17], null, v14, v14, v[15:16]
	v_cmpx_lt_u32_e64 s4, v16
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	v_mul_hi_i32 v0, 0x55555556, v13
	v_mul_hi_i32 v13, 0x55555556, v14
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_lshrrev_b32_e32 v12, 31, v0
	v_lshrrev_b32_e32 v14, 31, v13
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add3_u32 v12, v0, v12, v3
	v_add3_u32 v0, v13, v14, v4
; %bb.5:                                ;   in Loop: Header=BB0_3 Depth=1
	s_or_b32 exec_lo, exec_lo, s2
	v_mov_b32_e32 v15, 0
	s_mov_b32 s11, exec_lo
	v_cmpx_lt_i32_e32 -1, v12
	s_cbranch_execz .LBB0_19
; %bb.6:                                ;   in Loop: Header=BB0_3 Depth=1
	v_max_i32_e32 v13, v12, v0
	v_cmp_lt_i32_e32 vcc_lo, -1, v0
	v_mov_b32_e32 v15, 0
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cmp_gt_i32_e64 s2, s10, v13
	s_and_b32 s2, s2, vcc_lo
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_saveexec_b32 s12, s2
	s_cbranch_execz .LBB0_18
; %bb.7:                                ;   in Loop: Header=BB0_3 Depth=1
	v_mad_u64_u32 v[13:14], null, v12, s10, v[0:1]
	s_mov_b32 s3, exec_lo
                                        ; implicit-def: $sgpr13
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v14, 31, v13
	v_lshlrev_b64 v[13:14], 1, v[13:14]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v13, vcc_lo, s8, v13
	v_add_co_ci_u32_e32 v14, vcc_lo, s9, v14, vcc_lo
	global_load_u16 v14, v[13:14], off
	v_sub_nc_u32_e32 v13, v3, v12
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_sub_nc_u32_e32 v15, 0, v13
	v_max_i32_e32 v13, v13, v15
	s_delay_alu instid0(VALU_DEP_1)
	v_cmp_lt_u32_e64 s2, 1, v13
	v_cmpx_gt_u32_e32 2, v13
; %bb.8:                                ;   in Loop: Header=BB0_3 Depth=1
	v_sub_nc_u32_e32 v13, v4, v0
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	s_and_not1_b32 s2, s2, exec_lo
	s_mov_b32 s13, 1
	v_sub_nc_u32_e32 v15, 0, v13
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_max_i32_e32 v13, v13, v15
	v_cmp_lt_u32_e32 vcc_lo, 1, v13
	s_and_b32 s14, vcc_lo, exec_lo
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_b32 s2, s2, s14
; %bb.9:                                ; %Flow110
                                        ;   in Loop: Header=BB0_3 Depth=1
	s_or_b32 exec_lo, exec_lo, s3
	v_mov_b32_e32 v15, s13
	s_and_saveexec_b32 s13, s2
	s_cbranch_execz .LBB0_17
; %bb.10:                               ;   in Loop: Header=BB0_3 Depth=1
	v_sub_nc_u32_e32 v16, v12, v3
	v_sub_nc_u32_e32 v17, v0, v4
	s_mov_b32 s15, 1
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_sub_nc_u32_e32 v0, 0, v16
	v_sub_nc_u32_e32 v12, 0, v17
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_max_i32_e32 v0, v16, v0
	v_max_i32_e32 v12, v17, v12
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cmp_lt_u32_e64 s2, v0, v12
	v_cndmask_b32_e64 v0, v16, v17, s2
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_2)
	v_cmp_gt_i32_e32 vcc_lo, 1, v0
	v_sub_nc_u32_e32 v13, 0, v0
	v_cndmask_b32_e64 v12, 1, -1, vcc_lo
	v_max_i32_e32 v13, v0, v13
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_sub_nc_u32_e32 v15, 0, v12
	v_max_i32_e32 v15, v12, v15
	s_delay_alu instid0(VALU_DEP_1)
	v_cmp_lt_u32_e32 vcc_lo, v15, v13
	v_mov_b32_e32 v15, 1
	s_and_saveexec_b32 s14, vcc_lo
	s_cbranch_execz .LBB0_16
; %bb.11:                               ; %.lr.ph.i.preheader
                                        ;   in Loop: Header=BB0_3 Depth=1
	s_waitcnt vmcnt(0)
	v_and_b32_e32 v14, 0xffff, v14
	v_cndmask_b32_e64 v15, v17, v16, s2
	v_cvt_f32_i32_e32 v0, v0
                                        ; implicit-def: $sgpr16
                                        ; implicit-def: $sgpr18
                                        ; implicit-def: $sgpr17
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_nc_u32_e32 v14, v9, v14
	v_cvt_f32_i32_e32 v15, v15
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cvt_f32_i32_e32 v16, v14
	v_div_scale_f32 v14, null, v0, v0, v15
	v_div_scale_f32 v22, vcc_lo, v15, v0, v15
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_div_scale_f32 v17, null, v0, v0, v16
	v_rcp_f32_e32 v18, v14
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1)
	v_rcp_f32_e32 v19, v17
	s_waitcnt_depctr 0xfff
	v_fma_f32 v20, -v14, v18, 1.0
	v_fma_f32 v21, -v17, v19, 1.0
	v_dual_fmac_f32 v19, v21, v19 :: v_dual_fmac_f32 v18, v20, v18
	v_div_scale_f32 v20, s3, v16, v0, v16
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f32_e32 v23, v20, v19
	v_fma_f32 v25, -v17, v23, v20
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_fmac_f32_e32 v23, v25, v19
	v_mul_f32_e32 v21, v22, v18
	v_fma_f32 v17, -v17, v23, v20
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f32 v24, -v14, v21, v22
	v_fmac_f32_e32 v21, v24, v18
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f32 v14, -v14, v21, v22
	v_div_fmas_f32 v14, v14, v18, v21
	s_mov_b32 vcc_lo, s3
	s_mov_b32 s3, 0
	v_div_fmas_f32 v17, v17, v19, v23
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_div_fixup_f32 v14, v14, v0, v15
	v_div_fixup_f32 v15, v17, v0, v16
	v_mov_b32_e32 v0, v12
.LBB0_12:                               ; %.lr.ph.i
                                        ;   Parent Loop BB0_3 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_cvt_f32_i32_e32 v18, v0
	s_and_not1_b32 s17, s17, exec_lo
	s_or_b32 s18, s18, exec_lo
	v_mul_f32_e32 v16, v14, v18
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_trunc_f32_e32 v17, v16
	v_sub_f32_e32 v19, v16, v17
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cmp_ge_f32_e64 s19, |v19|, 0.5
	v_cndmask_b32_e64 v19, 0, 1.0, s19
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_bfi_b32 v16, 0x7fffffff, v19, v16
	v_add_f32_e32 v16, v17, v16
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cvt_i32_f32_e32 v16, v16
	v_cndmask_b32_e64 v17, v0, v16, s2
	v_cndmask_b32_e64 v16, v16, v0, s2
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_nc_u32_e32 v17, v17, v3
	v_mul_lo_u32 v17, v17, s10
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add3_u32 v16, v16, v4, v17
	v_ashrrev_i32_e32 v17, 31, v16
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[16:17], 1, v[16:17]
	v_add_co_u32 v16, vcc_lo, s8, v16
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_4) | instid1(VALU_DEP_1)
	v_add_co_ci_u32_e32 v17, vcc_lo, s9, v17, vcc_lo
	global_load_u16 v16, v[16:17], off
	v_fma_f32 v17, v15, v18, v10
	s_waitcnt vmcnt(0)
	v_cvt_f32_u32_e32 v16, v16
	v_cmp_nlt_f32_e32 vcc_lo, v17, v16
	s_and_b32 s19, vcc_lo, exec_lo
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_b32 s17, s17, s19
	s_and_saveexec_b32 s19, vcc_lo
; %bb.13:                               ;   in Loop: Header=BB0_12 Depth=2
	v_mad_u64_u32 v[16:17], null, s15, v12, v[0:1]
	s_and_not1_b32 s18, s18, exec_lo
	s_lshl_b32 s15, s15, 1
	s_or_b32 s17, s17, exec_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_sub_nc_u32_e32 v0, 0, v16
	v_max_i32_e32 v0, v16, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(SALU_CYCLE_1)
	v_cmp_ge_u32_e32 vcc_lo, v0, v13
	v_mov_b32_e32 v0, v16
	s_and_b32 s20, vcc_lo, exec_lo
	s_or_b32 s18, s18, s20
; %bb.14:                               ; %Flow
                                        ;   in Loop: Header=BB0_12 Depth=2
	s_or_b32 exec_lo, exec_lo, s19
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s19, exec_lo, s18
	s_or_b32 s3, s19, s3
	s_and_not1_b32 s16, s16, exec_lo
	s_and_b32 s19, s17, exec_lo
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_b32 s16, s16, s19
	s_and_not1_b32 exec_lo, exec_lo, s3
	s_cbranch_execnz .LBB0_12
; %bb.15:                               ; %._crit_edge.loopexit.i
                                        ;   in Loop: Header=BB0_3 Depth=1
	s_or_b32 exec_lo, exec_lo, s3
	v_cndmask_b32_e64 v15, 0, 1, s16
.LBB0_16:                               ; %Flow108
                                        ;   in Loop: Header=BB0_3 Depth=1
	s_or_b32 exec_lo, exec_lo, s14
.LBB0_17:                               ; %Flow111
                                        ;   in Loop: Header=BB0_3 Depth=1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_b32 exec_lo, exec_lo, s13
.LBB0_18:                               ; %Flow112
                                        ;   in Loop: Header=BB0_3 Depth=1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_b32 exec_lo, exec_lo, s12
.LBB0_19:                               ; %_Z15test_one_targetiPKtiiiiii.exit
                                        ;   in Loop: Header=BB0_3 Depth=1
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_2) | instid1(SALU_CYCLE_1)
	s_or_b32 exec_lo, exec_lo, s11
	v_add_nc_u32_e32 v5, v15, v5
	s_add_i32 s5, s5, 1
	s_cmp_lg_u32 s5, s7
	s_cbranch_scc1 .LBB0_3
; %bb.20:                               ; %._crit_edge.loopexit
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_cvt_f32_i32_e32 v0, v5
	v_cvt_f32_i32_e32 v3, s7
	v_div_scale_f32 v4, null, v3, v3, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_rcp_f32_e32 v5, v4
	s_waitcnt_depctr 0xfff
	v_fma_f32 v6, -v4, v5, 1.0
	v_fmac_f32_e32 v5, v6, v5
	v_div_scale_f32 v6, vcc_lo, v0, v3, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f32_e32 v7, v6, v5
	v_fma_f32 v8, -v4, v7, v6
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fmac_f32_e32 v7, v8, v5
	v_fma_f32 v4, -v4, v7, v6
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_div_fmas_f32 v4, v4, v5, v7
	v_div_fixup_f32 v0, v4, v3, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f32_e32 v0, 0x437fffbe, v0
	v_cvt_i32_f32_e32 v0, v0
	s_branch .LBB0_22
.LBB0_21:
                                        ; implicit-def: $vgpr0
.LBB0_22:                               ; %._crit_edge
	s_load_b64 s[0:1], s[0:1], 0x20
	s_delay_alu instid0(VALU_DEP_1)
	v_min_i32_e32 v3, 0xff, v0
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v0, vcc_lo, s0, v1
	v_add_co_ci_u32_e32 v1, vcc_lo, s1, v2, vcc_lo
	global_store_b8 v[0:1], v3, off
.LBB0_23:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z12calc_one_vixiPKtiiiiPh
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 296
		.amdhsa_user_sgpr_count 14
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 1
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 26
		.amdhsa_next_free_sgpr 21
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end0:
	.size	_Z12calc_one_vixiPKtiiiiPh, .Lfunc_end0-_Z12calc_one_vixiPKtiiiiPh
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 1688
; NumSgprs: 23
; NumVgprs: 26
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 3
; NumSGPRsForWavesPerEU: 23
; NumVGPRsForWavesPerEU: 26
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 14
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.protected	_Z17process_one_blockiPhfiiPi ; -- Begin function _Z17process_one_blockiPhfiiPi
	.globl	_Z17process_one_blockiPhfiiPi
	.p2align	8
	.type	_Z17process_one_blockiPhfiiPi,@function
_Z17process_one_blockiPhfiiPi:          ; @_Z17process_one_blockiPhfiiPi
; %bb.0:
	s_clause 0x1
	s_load_b32 s12, s[0:1], 0x0
	s_load_b128 s[4:7], s[0:1], 0x10
	v_cmp_eq_u32_e64 s2, 0, v0
	s_delay_alu instid0(VALU_DEP_1)
	s_and_saveexec_b32 s3, s2
	s_cbranch_execz .LBB1_2
; %bb.1:
	s_waitcnt lgkmcnt(0)
	v_cvt_f32_u32_e32 v1, s5
	s_sub_i32 s8, 0, s5
	v_mov_b32_e32 v6, 0
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_rcp_iflag_f32_e32 v1, v1
	s_waitcnt_depctr 0xfff
	v_mul_f32_e32 v1, 0x4f7ffffe, v1
	v_cvt_u32_f32_e32 v1, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_readfirstlane_b32 s7, v1
	s_mul_i32 s8, s8, s7
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_mul_hi_u32 s8, s7, s8
	s_add_i32 s7, s7, s8
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_mul_hi_u32 s7, s15, s7
	s_mul_i32 s8, s7, s5
	s_add_i32 s9, s7, 1
	s_sub_i32 s8, s15, s8
	s_delay_alu instid0(SALU_CYCLE_1)
	s_sub_i32 s10, s8, s5
	s_cmp_ge_u32 s8, s5
	s_cselect_b32 s7, s9, s7
	s_cselect_b32 s8, s10, s8
	s_add_i32 s9, s7, 1
	s_cmp_ge_u32 s8, s5
	s_cselect_b32 s7, s9, s7
	s_delay_alu instid0(SALU_CYCLE_1)
	s_mul_i32 s5, s7, s5
	s_add_i32 s8, s7, 1
	s_sub_i32 s5, s15, s5
	v_cvt_f32_i32_e32 v1, s8
	s_add_i32 s8, s5, 1
	v_cvt_f32_i32_e32 v3, s7
	v_cvt_f32_i32_e32 v2, s8
	v_cvt_f32_i32_e32 v4, s5
	v_mul_f32_e32 v1, s4, v1
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_dual_mul_f32 v3, s4, v3 :: v_dual_mul_f32 v2, s4, v2
	v_mul_f32_e32 v4, s4, v4
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_cvt_i32_f32_e32 v1, v1
	v_cvt_i32_f32_e32 v5, v2
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_cvt_i32_f32_e32 v2, v3
	v_min_i32_e32 v1, s12, v1
	v_cvt_i32_f32_e32 v4, v4
	s_delay_alu instid0(VALU_DEP_4)
	v_min_i32_e32 v3, s12, v5
	ds_store_2addr_b64 v6, v[1:2], v[3:4] offset1:1
.LBB1_2:
	s_or_b32 exec_lo, exec_lo, s3
	s_waitcnt lgkmcnt(0)
	s_cmp_lt_i32 s6, 1
	s_barrier
	buffer_gl0_inv
	s_cbranch_scc1 .LBB1_22
; %bb.3:                                ; %.lr.ph129
	s_clause 0x1
	s_load_b32 s3, s[0:1], 0x34
	s_load_b64 s[4:5], s[0:1], 0x20
	s_mul_i32 s15, s15, s6
	s_mov_b32 s18, 0
	s_waitcnt lgkmcnt(0)
	s_and_b32 s16, s3, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_cvt_f32_u32_e32 v6, s16
	s_sub_i32 s11, 0, s16
	v_rcp_iflag_f32_e32 v6, v6
	s_waitcnt_depctr 0xfff
	v_dual_mov_b32 v5, 0 :: v_dual_mul_f32 v6, 0x4f7ffffe, v6
	ds_load_2addr_b64 v[1:4], v5 offset1:1
	v_cvt_u32_f32_e32 v6, v6
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_readfirstlane_b32 s9, v6
	s_mul_i32 s11, s11, s9
	s_waitcnt lgkmcnt(0)
	v_readfirstlane_b32 s3, v3
	v_readfirstlane_b32 s7, v4
	v_readfirstlane_b32 s8, v1
	v_readfirstlane_b32 s10, v2
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	s_sub_i32 s14, s3, s7
	s_mul_hi_u32 s7, s9, s11
	s_sub_i32 s3, s8, s10
	s_add_i32 s9, s9, s7
	s_mul_i32 s10, s3, s14
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_mul_hi_u32 s3, s10, s9
	s_mul_i32 s7, s3, s16
	s_add_i32 s8, s3, 1
	s_sub_i32 s7, s10, s7
	s_delay_alu instid0(SALU_CYCLE_1)
	s_sub_i32 s9, s7, s16
	s_cmp_ge_u32 s7, s16
	s_cselect_b32 s3, s8, s3
	s_cselect_b32 s7, s9, s7
	s_add_i32 s8, s3, 1
	s_cmp_ge_u32 s7, s16
	s_cselect_b32 s11, s8, s3
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_mul_i32 s3, s11, s16
	s_sub_i32 s3, s10, s3
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	s_cmp_lg_u32 s3, 0
	s_cselect_b32 vcc_lo, -1, 0
	s_cmp_lg_u32 vcc_lo, 0
	s_addc_u32 s3, s11, 0
	s_ashr_i32 s7, s14, 31
	v_mul_lo_u32 v2, s3, v0
	s_add_i32 s8, s14, s7
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_4) | instid1(VALU_DEP_2)
	s_xor_b32 s13, s8, s7
	s_load_b64 s[8:9], s[0:1], 0x8
	v_cvt_f32_u32_e32 v1, s13
	s_sub_i32 s3, 0, s13
	s_cmp_gt_u32 s16, 1
	v_ashrrev_i32_e32 v4, 31, v2
	v_add_nc_u32_e32 v9, 1, v2
	v_rcp_iflag_f32_e32 v1, v1
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_nc_u32_e32 v6, v2, v4
	v_xor_b32_e32 v7, v6, v4
	v_xor_b32_e32 v4, s7, v4
	s_waitcnt_depctr 0xfff
	v_mul_f32_e32 v1, 0x4f7ffffe, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cvt_u32_f32_e32 v1, v1
	v_mul_lo_u32 v3, s3, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_hi_u32 v3, v1, v3
	v_add_nc_u32_e32 v6, v1, v3
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_hi_u32 v1, v7, v6
	v_mul_lo_u32 v3, v1, s13
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_sub_nc_u32_e32 v3, v7, v3
	v_add_nc_u32_e32 v7, 1, v1
	v_subrev_nc_u32_e32 v8, s13, v3
	v_cmp_le_u32_e64 s3, s13, v3
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_cndmask_b32_e64 v1, v1, v7, s3
	v_cndmask_b32_e64 v3, v3, v8, s3
	v_lshl_add_u32 v8, v0, 4, 16
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_nc_u32_e32 v7, 1, v1
	v_cmp_le_u32_e64 s3, s13, v3
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1)
	v_cndmask_b32_e64 v1, v1, v7, s3
	s_cselect_b32 s3, -1, 0
	s_add_i32 s16, s16, -1
	s_add_i32 s17, 16, 16
	v_xor_b32_e32 v1, v1, v4
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_2)
	v_sub_nc_u32_e32 v7, v1, v4
	v_add_co_ci_u32_e32 v1, vcc_lo, s11, v2, vcc_lo
	s_mov_b32 s11, 0
	v_mul_lo_u32 v0, v7, s14
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_min_i32_e32 v10, s10, v1
	s_sub_i32 s14, 0, s14
	v_cmp_lt_i32_e64 s0, v9, v10
	s_delay_alu instid0(VALU_DEP_3)
	v_sub_nc_u32_e32 v11, v2, v0
.LBB1_4:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB1_6 Depth 2
                                        ;     Child Loop BB1_15 Depth 2
	ds_load_2addr_b32 v[1:2], v5 offset0:1 offset1:3
	s_waitcnt lgkmcnt(0)
	v_add_nc_u32_e32 v12, v7, v1
	v_add_nc_u32_e32 v0, v11, v2
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[3:4], null, v12, s12, v[0:1]
	v_ashrrev_i32_e32 v4, 31, v3
	v_add_co_u32 v3, vcc_lo, s8, v3
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_add_co_ci_u32_e32 v4, vcc_lo, s9, v4, vcc_lo
	global_load_u8 v13, v[3:4], off
	v_add_nc_u32_e32 v3, v0, v12
	v_mul_lo_u32 v3, v12, v3
	s_delay_alu instid0(VALU_DEP_1)
	v_mul_lo_u32 v14, 0x41041041, v3
	s_and_saveexec_b32 s10, s0
	s_cbranch_execz .LBB1_12
; %bb.5:                                ; %.lr.ph.preheader
                                        ;   in Loop: Header=BB1_4 Depth=1
	v_dual_mov_b32 v15, v9 :: v_dual_add_nc_u32 v4, v2, v1
	s_mov_b32 s19, 0
.LBB1_6:                                ; %.lr.ph
                                        ;   Parent Loop BB1_4 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v3, 31, v15
	s_mov_b32 s21, exec_lo
	v_add_nc_u32_e32 v16, v15, v3
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_xor_b32_e32 v16, v16, v3
	v_xor_b32_e32 v3, s7, v3
	v_mul_hi_u32 v17, v16, v6
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_lo_u32 v18, v17, s13
	v_sub_nc_u32_e32 v16, v16, v18
	v_add_nc_u32_e32 v18, 1, v17
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_subrev_nc_u32_e32 v19, s13, v16
	v_cmp_le_u32_e32 vcc_lo, s13, v16
	v_dual_cndmask_b32 v17, v17, v18 :: v_dual_cndmask_b32 v16, v16, v19
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_nc_u32_e32 v18, 1, v17
	v_cmp_le_u32_e32 vcc_lo, s13, v16
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cndmask_b32_e32 v16, v17, v18, vcc_lo
	v_xor_b32_e32 v16, v16, v3
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_sub_nc_u32_e32 v19, v16, v3
	v_mul_lo_u32 v20, s14, v19
	v_add_nc_u32_e32 v16, v19, v1
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add3_u32 v3, v2, v15, v20
	v_mad_u64_u32 v[17:18], null, v16, s12, v[3:4]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_ashrrev_i32_e32 v18, 31, v17
	v_add_co_u32 v17, vcc_lo, s8, v17
	v_add_co_ci_u32_e32 v18, vcc_lo, s9, v18, vcc_lo
	global_load_u8 v17, v[17:18], off
	v_add_nc_u32_e32 v18, v4, v15
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_2)
	v_add3_u32 v18, v18, v20, v19
	s_waitcnt vmcnt(1)
	v_and_b32_e32 v19, 0xff, v13
	v_mul_lo_u32 v18, v16, v18
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_mul_lo_u32 v18, 0x41041041, v18
	s_waitcnt vmcnt(0)
	v_cmp_lt_u16_e64 s20, v19, v17
	v_cmpx_ge_u16_e64 v19, v17
; %bb.7:                                ;   in Loop: Header=BB1_6 Depth=2
	v_cmp_eq_u16_e32 vcc_lo, v19, v17
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_cmp_lt_i32_e64 s1, v14, v18
	s_and_not1_b32 s20, s20, exec_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s1, vcc_lo, s1
	s_and_b32 s1, s1, exec_lo
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_b32 s20, s20, s1
; %bb.8:                                ; %Flow202
                                        ;   in Loop: Header=BB1_6 Depth=2
	s_or_b32 exec_lo, exec_lo, s21
	s_and_saveexec_b32 s1, s20
; %bb.9:                                ;   in Loop: Header=BB1_6 Depth=2
	v_dual_mov_b32 v14, v18 :: v_dual_mov_b32 v13, v17
	v_mov_b32_e32 v0, v3
	v_mov_b32_e32 v12, v16
; %bb.10:                               ;   in Loop: Header=BB1_6 Depth=2
	s_or_b32 exec_lo, exec_lo, s1
	v_add_nc_u32_e32 v15, 1, v15
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	v_cmp_ge_i32_e32 vcc_lo, v15, v10
	s_or_b32 s19, vcc_lo, s19
	s_and_not1_b32 exec_lo, exec_lo, s19
	s_cbranch_execnz .LBB1_6
; %bb.11:                               ; %Flow204
                                        ;   in Loop: Header=BB1_4 Depth=1
	s_or_b32 exec_lo, exec_lo, s19
.LBB1_12:                               ; %Flow205
                                        ;   in Loop: Header=BB1_4 Depth=1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_b32 exec_lo, exec_lo, s10
	s_waitcnt vmcnt(0)
	v_and_b32_e32 v1, 0xff, v13
	ds_store_2addr_b32 v8, v12, v0 offset1:1
	ds_store_2addr_b32 v8, v1, v14 offset0:2 offset1:3
	s_and_saveexec_b32 s19, s2
	s_cbranch_execz .LBB1_21
; %bb.13:                               ; %.preheader
                                        ;   in Loop: Header=BB1_4 Depth=1
	s_and_not1_b32 vcc_lo, exec_lo, s3
	s_cbranch_vccnz .LBB1_20
; %bb.14:                               ; %.lr.ph123.preheader
                                        ;   in Loop: Header=BB1_4 Depth=1
	s_mov_b32 s10, s17
	s_mov_b32 s20, s16
.LBB1_15:                               ; %.lr.ph123
                                        ;   Parent Loop BB1_4 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	s_waitcnt lgkmcnt(0)
	v_mov_b32_e32 v1, s10
	v_and_b32_e32 v15, 0xff, v13
	s_mov_b32 s22, exec_lo
	ds_load_2addr_b32 v[3:4], v1 offset0:2 offset1:3
	ds_load_2addr_b32 v[1:2], v1 offset1:1
	s_waitcnt lgkmcnt(1)
	v_cmp_gt_i32_e64 s21, v3, v15
	v_cmpx_le_i32_e64 v3, v15
; %bb.16:                               ;   in Loop: Header=BB1_15 Depth=2
	v_cmp_eq_u32_e32 vcc_lo, v3, v15
	v_cmp_lt_i32_e64 s1, v14, v4
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_1)
	s_and_not1_b32 s21, s21, exec_lo
	s_and_b32 s1, vcc_lo, s1
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s1, s1, exec_lo
	s_or_b32 s21, s21, s1
; %bb.17:                               ; %Flow
                                        ;   in Loop: Header=BB1_15 Depth=2
	s_or_b32 exec_lo, exec_lo, s22
	s_and_saveexec_b32 s1, s21
	s_cbranch_execz .LBB1_19
; %bb.18:                               ;   in Loop: Header=BB1_15 Depth=2
	v_dual_mov_b32 v14, v4 :: v_dual_mov_b32 v13, v3
	s_waitcnt lgkmcnt(0)
	v_mov_b32_e32 v0, v2
	v_mov_b32_e32 v12, v1
.LBB1_19:                               ;   in Loop: Header=BB1_15 Depth=2
	s_or_b32 exec_lo, exec_lo, s1
	s_add_i32 s20, s20, -1
	s_add_i32 s10, s10, 16
	s_cmp_eq_u32 s20, 0
	s_cbranch_scc0 .LBB1_15
.LBB1_20:                               ; %._crit_edge124
                                        ;   in Loop: Header=BB1_4 Depth=1
	s_waitcnt lgkmcnt(0)
	v_mad_u64_u32 v[1:2], null, v12, s12, v[0:1]
	s_add_i32 s10, s18, s15
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_lshl_b64 s[20:21], s[10:11], 2
	s_add_u32 s20, s4, s20
	s_addc_u32 s21, s5, s21
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_ashrrev_i32_e32 v0, 31, v1
	v_add_co_u32 v2, vcc_lo, s8, v1
	v_add_co_ci_u32_e32 v3, vcc_lo, s9, v0, vcc_lo
	global_store_b32 v5, v1, s[20:21]
	global_store_b8 v[2:3], v5, off
.LBB1_21:                               ; %Flow200
                                        ;   in Loop: Header=BB1_4 Depth=1
	s_or_b32 exec_lo, exec_lo, s19
	s_add_i32 s18, s18, 1
	s_waitcnt lgkmcnt(0)
	s_waitcnt_vscnt null, 0x0
	s_cmp_eq_u32 s18, s6
	s_barrier
	buffer_gl0_inv
	s_cbranch_scc0 .LBB1_4
.LBB1_22:                               ; %._crit_edge130
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z17process_one_blockiPhfiiPi
		.amdhsa_group_segment_fixed_size 16
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 296
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 21
		.amdhsa_next_free_sgpr 23
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end1:
	.size	_Z17process_one_blockiPhfiiPi, .Lfunc_end1-_Z17process_one_blockiPhfiiPi
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 1548
; NumSgprs: 25
; NumVgprs: 21
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 16 bytes/workgroup (compile time only)
; SGPRBlocks: 3
; VGPRBlocks: 2
; NumSGPRsForWavesPerEU: 25
; NumVGPRsForWavesPerEU: 21
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.protected	_Z13calc_one_shediPKtiiiiPKiPy ; -- Begin function _Z13calc_one_shediPKtiiiiPKiPy
	.globl	_Z13calc_one_shediPKtiiiiPKiPy
	.p2align	8
	.type	_Z13calc_one_shediPKtiiiiPKiPy,@function
_Z13calc_one_shediPKtiiiiPKiPy:         ; @_Z13calc_one_shediPKtiiiiPKiPy
; %bb.0:
	s_load_b128 s[4:7], s[0:1], 0x10
	s_waitcnt lgkmcnt(0)
	s_cmp_ge_u32 s15, s7
	s_cbranch_scc1 .LBB2_30
; %bb.1:
	s_clause 0x2
	s_load_b128 s[8:11], s[0:1], 0x20
	s_load_b32 s7, s[0:1], 0x0
	s_load_b64 s[2:3], s[0:1], 0x8
	s_lshl_b32 s13, s4, 1
	s_mov_b32 s12, s15
	s_add_i32 s14, s13, 64
	s_or_b32 s13, s13, 1
	s_ashr_i32 s15, s14, 31
	s_mul_i32 s13, s13, s12
	s_lshr_b32 s15, s15, 26
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_2) | instid1(SALU_CYCLE_1)
	s_add_i32 s14, s14, s15
	s_mov_b32 s15, 0
	s_ashr_i32 s16, s14, 6
	s_mul_i32 s14, s13, s16
	s_delay_alu instid0(SALU_CYCLE_1)
	s_lshl_b64 s[18:19], s[14:15], 3
	s_mov_b32 s14, exec_lo
	s_waitcnt lgkmcnt(0)
	s_add_u32 s10, s10, s18
	s_addc_u32 s11, s11, s19
	v_cmpx_eq_u32_e32 0, v0
	s_cbranch_execz .LBB2_4
; %bb.2:
	s_mov_b32 s13, s15
	v_mbcnt_lo_u32_b32 v5, exec_lo, 0
	s_lshl_b64 s[12:13], s[12:13], 2
	s_delay_alu instid0(SALU_CYCLE_1)
	s_add_u32 s8, s8, s12
	s_addc_u32 s9, s9, s13
	s_ashr_i32 s12, s7, 31
	s_load_b32 s8, s[8:9], 0x0
	s_add_i32 s13, s7, s12
	v_cmp_eq_u32_e32 vcc_lo, 0, v5
	s_xor_b32 s13, s13, s12
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_cvt_f32_u32_e32 v1, s13
	s_sub_i32 s17, 0, s13
	v_rcp_iflag_f32_e32 v1, v1
	s_waitcnt_depctr 0xfff
	v_mul_f32_e32 v1, 0x4f7ffffe, v1
	s_waitcnt lgkmcnt(0)
	s_ashr_i32 s9, s8, 31
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_3) | instid1(VALU_DEP_1)
	s_add_i32 s18, s8, s9
	s_xor_b32 s12, s9, s12
	v_cvt_u32_f32_e32 v1, v1
	s_xor_b32 s18, s18, s9
	v_readfirstlane_b32 s15, v1
	v_mov_b32_e32 v1, 0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_mul_i32 s17, s17, s15
	s_mul_hi_u32 s17, s15, s17
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_add_i32 s15, s15, s17
	s_mul_hi_u32 s15, s18, s15
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_mul_i32 s17, s15, s13
	s_sub_i32 s17, s18, s17
	s_add_i32 s18, s15, 1
	s_sub_i32 s19, s17, s13
	s_cmp_ge_u32 s17, s13
	s_cselect_b32 s15, s18, s15
	s_cselect_b32 s17, s19, s17
	s_add_i32 s18, s15, 1
	s_cmp_ge_u32 s17, s13
	s_cselect_b32 s13, s18, s15
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_xor_b32 s13, s13, s12
	s_sub_i32 s15, s13, s12
	s_lshl_b64 s[12:13], s[8:9], 1
	s_mul_i32 s17, s15, s7
	v_mov_b32_e32 v2, s15
	s_sub_i32 s17, s8, s17
	s_add_u32 s8, s2, s12
	s_addc_u32 s9, s3, s13
	v_mov_b32_e32 v3, s17
	global_load_u16 v4, v1, s[8:9]
	s_waitcnt vmcnt(0)
	v_add_nc_u32_e32 v4, s5, v4
	ds_store_b64 v1, v[2:3]
	ds_store_b32 v1, v4 offset:8
	s_and_b32 exec_lo, exec_lo, vcc_lo
	s_cbranch_execz .LBB2_4
; %bb.3:
	s_ashr_i32 s5, s4, 31
	s_mul_i32 s8, s16, s4
	s_lshr_b32 s5, s5, 26
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_add_i32 s5, s4, s5
	s_ashr_i32 s9, s5, 6
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_add_i32 s8, s8, s9
	s_ashr_i32 s9, s8, 31
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_lshl_b64 s[8:9], s[8:9], 3
	s_add_u32 s8, s10, s8
	s_addc_u32 s9, s11, s9
	s_and_not1_b32 s5, s5, 63
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_sub_i32 s5, s5, s4
	s_add_i32 s5, s5, 63
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_lshl_b64 s[12:13], 1, s5
	v_dual_mov_b32 v2, s12 :: v_dual_mov_b32 v3, s13
	global_atomic_or_b64 v1, v[2:3], s[8:9]
.LBB2_4:
	s_or_b32 exec_lo, exec_lo, s14
	s_waitcnt lgkmcnt(0)
	s_waitcnt_vscnt null, 0x0
	s_barrier
	buffer_gl0_inv
	s_load_b32 s0, s[0:1], 0x3c
	s_waitcnt lgkmcnt(0)
	s_and_b32 s0, s0, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_cvt_f32_u32_e32 v4, s0
	s_sub_i32 s17, 0, s0
	v_rcp_iflag_f32_e32 v4, v4
	s_waitcnt_depctr 0xfff
	v_dual_mov_b32 v3, 0 :: v_dual_mul_f32 v4, 0x4f7ffffe, v4
	ds_load_b64 v[1:2], v3
	s_waitcnt lgkmcnt(0)
	v_readfirstlane_b32 s5, v1
	v_cvt_u32_f32_e32 v1, v4
	v_readfirstlane_b32 s8, v2
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	s_sub_i32 s9, s5, s4
	v_readfirstlane_b32 s1, v1
	s_delay_alu instid0(VALU_DEP_2)
	s_sub_i32 s12, s8, s4
	s_add_i32 s13, s5, s4
	s_add_i32 s14, s8, s4
	s_sub_i32 s15, s13, s9
	s_sub_i32 s18, s14, s12
	s_mul_i32 s17, s17, s1
	s_add_i32 s18, s18, s15
	s_mul_hi_u32 s17, s1, s17
	s_lshl_b32 s19, s18, 1
	s_add_i32 s1, s1, s17
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_mul_hi_u32 s1, s19, s1
	s_mul_i32 s17, s1, s0
	s_add_i32 s20, s1, 1
	s_sub_i32 s17, s19, s17
	s_delay_alu instid0(SALU_CYCLE_1)
	s_sub_i32 s21, s17, s0
	s_cmp_ge_u32 s17, s0
	s_cselect_b32 s1, s20, s1
	s_cselect_b32 s17, s21, s17
	s_add_i32 s20, s1, 1
	s_cmp_ge_u32 s17, s0
	s_cselect_b32 s1, s20, s1
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_mul_i32 s0, s1, s0
	s_sub_i32 s0, s19, s0
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	s_cmp_lg_u32 s0, 0
	s_cselect_b32 vcc_lo, -1, 0
	s_cmp_lg_u32 vcc_lo, 0
	s_addc_u32 s0, s1, 0
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_mul_lo_u32 v1, s0, v0
	s_mov_b32 s0, exec_lo
	v_add_co_ci_u32_e32 v0, vcc_lo, s1, v1, vcc_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_min_i32_e32 v2, s19, v0
	v_cmpx_lt_i32_e64 v1, v2
	s_cbranch_execz .LBB2_30
; %bb.5:                                ; %.lr.ph154
	ds_load_b32 v3, v3 offset:8
	s_lshl_b32 s17, s15, 1
	s_add_i32 s18, s18, s15
	s_sub_i32 s20, s12, s17
	s_sub_i32 s21, s9, s15
	s_sub_i32 s19, s12, s18
	s_add_i32 s20, s20, 1
	s_add_i32 s21, s21, 1
	s_mul_i32 s22, s4, s4
	s_mov_b32 s23, 0
	s_waitcnt lgkmcnt(0)
	v_cvt_f32_i32_e32 v4, v3
.LBB2_6:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB2_20 Depth 2
	s_mov_b32 s0, exec_lo
                                        ; implicit-def: $vgpr5
                                        ; implicit-def: $vgpr0
	v_cmpx_le_i32_e64 s15, v1
	s_xor_b32 s0, exec_lo, s0
	s_cbranch_execz .LBB2_16
; %bb.7:                                ;   in Loop: Header=BB2_6 Depth=1
	s_mov_b32 s1, exec_lo
                                        ; implicit-def: $vgpr5
                                        ; implicit-def: $vgpr0
	v_cmpx_le_i32_e64 s17, v1
	s_xor_b32 s1, exec_lo, s1
	s_cbranch_execz .LBB2_13
; %bb.8:                                ;   in Loop: Header=BB2_6 Depth=1
	s_mov_b32 s24, exec_lo
                                        ; implicit-def: $vgpr0
	v_cmpx_le_i32_e64 s18, v1
	s_xor_b32 s24, exec_lo, s24
; %bb.9:                                ;   in Loop: Header=BB2_6 Depth=1
	v_add_nc_u32_e32 v0, s19, v1
; %bb.10:                               ; %Flow190
                                        ;   in Loop: Header=BB2_6 Depth=1
	s_or_saveexec_b32 s24, s24
	v_mov_b32_e32 v5, s13
	s_xor_b32 exec_lo, exec_lo, s24
; %bb.11:                               ;   in Loop: Header=BB2_6 Depth=1
	v_dual_mov_b32 v5, s9 :: v_dual_add_nc_u32 v0, s20, v1
; %bb.12:                               ; %Flow191
                                        ;   in Loop: Header=BB2_6 Depth=1
	s_or_b32 exec_lo, exec_lo, s24
.LBB2_13:                               ; %Flow193
                                        ;   in Loop: Header=BB2_6 Depth=1
	s_and_not1_saveexec_b32 s1, s1
; %bb.14:                               ;   in Loop: Header=BB2_6 Depth=1
	v_dual_mov_b32 v0, s14 :: v_dual_add_nc_u32 v5, s21, v1
; %bb.15:                               ; %Flow194
                                        ;   in Loop: Header=BB2_6 Depth=1
	s_or_b32 exec_lo, exec_lo, s1
.LBB2_16:                               ; %Flow196
                                        ;   in Loop: Header=BB2_6 Depth=1
	s_and_not1_saveexec_b32 s0, s0
; %bb.17:                               ;   in Loop: Header=BB2_6 Depth=1
	v_dual_mov_b32 v0, s12 :: v_dual_add_nc_u32 v5, s9, v1
; %bb.18:                               ;   in Loop: Header=BB2_6 Depth=1
	s_or_b32 exec_lo, exec_lo, s0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_subrev_nc_u32_e32 v6, s5, v5
	v_subrev_nc_u32_e32 v0, s8, v0
	s_mov_b32 s24, exec_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_sub_nc_u32_e32 v5, 0, v6
	v_sub_nc_u32_e32 v7, 0, v0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_max_i32_e32 v5, v6, v5
	v_max_i32_e32 v7, v0, v7
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cmp_lt_u32_e64 s0, v5, v7
	v_cndmask_b32_e64 v5, v6, v0, s0
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_ne_u32_e32 0, v5
	s_cbranch_execz .LBB2_29
; %bb.19:                               ; %.lr.ph.preheader
                                        ;   in Loop: Header=BB2_6 Depth=1
	v_cndmask_b32_e64 v0, v0, v6, s0
	v_cvt_f32_i32_e32 v8, v5
	s_mov_b32 s25, 0
                                        ; implicit-def: $sgpr26
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cvt_f32_i32_e32 v0, v0
	v_div_scale_f32 v6, null, v8, v8, v0
	v_div_scale_f32 v10, vcc_lo, v0, v8, v0
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_rcp_f32_e32 v7, v6
	s_waitcnt_depctr 0xfff
	v_fma_f32 v9, -v6, v7, 1.0
	v_fmac_f32_e32 v7, v9, v7
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f32_e32 v9, v10, v7
	v_fma_f32 v11, -v6, v9, v10
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fmac_f32_e32 v9, v11, v7
	v_fma_f32 v6, -v6, v9, v10
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
	v_div_fmas_f32 v9, v6, v7, v9
	v_cmp_gt_i32_e32 vcc_lo, 1, v5
	v_mov_b32_e32 v7, 0xc7c34f80
	v_div_fixup_f32 v8, v9, v8, v0
	v_cndmask_b32_e64 v6, 1, -1, vcc_lo
	s_delay_alu instid0(VALU_DEP_1)
	v_mov_b32_e32 v9, v6
.LBB2_20:                               ; %.lr.ph
                                        ;   Parent Loop BB2_6 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_cvt_f32_i32_e32 v0, v9
	s_or_b32 s26, s26, exec_lo
	s_mov_b32 s27, exec_lo
	v_mul_f32_e32 v0, v8, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_trunc_f32_e32 v10, v0
	v_sub_f32_e32 v11, v0, v10
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cmp_ge_f32_e64 s1, |v11|, 0.5
	v_cndmask_b32_e64 v11, 0, 1.0, s1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_bfi_b32 v0, 0x7fffffff, v11, v0
	v_add_f32_e32 v0, v10, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cvt_i32_f32_e32 v0, v0
	v_cndmask_b32_e64 v10, v9, v0, s0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_nc_u32_e32 v12, s5, v10
	v_cmpx_lt_i32_e32 -1, v12
	s_cbranch_execz .LBB2_28
; %bb.21:                               ;   in Loop: Header=BB2_20 Depth=2
	v_cndmask_b32_e64 v11, v0, v9, s0
	s_mov_b32 s28, -1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_nc_u32_e32 v0, s8, v11
	v_max_i32_e32 v13, v12, v0
	v_cmp_lt_i32_e32 vcc_lo, -1, v0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cmp_gt_i32_e64 s1, s7, v13
	s_and_b32 s29, s1, vcc_lo
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_saveexec_b32 s1, s29
	s_cbranch_execz .LBB2_27
; %bb.22:                               ;   in Loop: Header=BB2_20 Depth=2
	v_mul_lo_u32 v13, v11, v11
	s_mov_b32 s29, -1
	s_mov_b32 s28, exec_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[14:15], null, v10, v10, v[13:14]
	v_cmpx_ge_u32_e64 s22, v14
	s_cbranch_execz .LBB2_26
; %bb.23:                               ;   in Loop: Header=BB2_20 Depth=2
	v_mad_u64_u32 v[13:14], null, v12, s7, v[0:1]
	s_mov_b32 s29, exec_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v14, 31, v13
	v_lshlrev_b64 v[12:13], 1, v[13:14]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v12, vcc_lo, s2, v12
	v_add_co_ci_u32_e32 v13, vcc_lo, s3, v13, vcc_lo
	global_load_u16 v0, v[12:13], off
	v_sub_nc_u32_e32 v12, 0, v9
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_max_i32_e32 v12, v9, v12
	v_cvt_f32_i32_e32 v12, v12
	s_waitcnt vmcnt(0)
	v_sub_nc_u32_e32 v13, v0, v3
	v_add_nc_u32_e32 v0, s6, v0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cvt_f32_i32_e32 v13, v13
	v_cvt_f32_i32_e32 v0, v0
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_div_scale_f32 v14, null, v12, v12, v13
	v_div_scale_f32 v17, vcc_lo, v13, v12, v13
	v_rcp_f32_e32 v15, v14
	s_waitcnt_depctr 0xfff
	v_fma_f32 v16, -v14, v15, 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fmac_f32_e32 v15, v16, v15
	v_mul_f32_e32 v16, v17, v15
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f32 v18, -v14, v16, v17
	v_fmac_f32_e32 v16, v18, v15
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f32 v14, -v14, v16, v17
	v_div_fmas_f32 v14, v14, v15, v16
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_div_fixup_f32 v13, v14, v12, v13
	v_cmp_lt_f32_e32 vcc_lo, v7, v13
	v_cndmask_b32_e32 v7, v7, v13, vcc_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f32 v12, v7, v12, v4
	v_cmpx_le_f32_e32 v12, v0
	s_cbranch_execz .LBB2_25
; %bb.24:                               ;   in Loop: Header=BB2_20 Depth=2
	v_add_nc_u32_e32 v12, s4, v11
	v_add_nc_u32_e32 v14, s4, v10
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v0, 31, v12
	v_lshrrev_b32_e32 v0, 26, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_nc_u32_e32 v13, v12, v0
	v_ashrrev_i32_e32 v0, 6, v13
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[10:11], null, v14, s16, v[0:1]
	v_and_b32_e32 v0, 0xffffffc0, v13
	v_sub_nc_u32_e32 v0, v0, v12
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_ashrrev_i32_e32 v11, 31, v10
	v_add_nc_u32_e32 v0, 63, v0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_lshlrev_b64 v[10:11], 3, v[10:11]
	v_lshlrev_b64 v[12:13], v0, 1
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_u32 v10, vcc_lo, s10, v10
	v_add_co_ci_u32_e32 v11, vcc_lo, s11, v11, vcc_lo
	global_atomic_or_b64 v[10:11], v[12:13], off
.LBB2_25:                               ; %Flow
                                        ;   in Loop: Header=BB2_20 Depth=2
	s_or_b32 exec_lo, exec_lo, s29
	s_delay_alu instid0(SALU_CYCLE_1)
	s_xor_b32 s29, exec_lo, -1
.LBB2_26:                               ; %Flow184
                                        ;   in Loop: Header=BB2_20 Depth=2
	s_or_b32 exec_lo, exec_lo, s28
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_not1_b32 s28, s29, exec_lo
.LBB2_27:                               ; %Flow185
                                        ;   in Loop: Header=BB2_20 Depth=2
	s_or_b32 exec_lo, exec_lo, s1
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	s_and_not1_b32 s1, s26, exec_lo
	s_and_b32 s26, s28, exec_lo
	s_or_b32 s26, s1, s26
.LBB2_28:                               ;   in Loop: Header=BB2_20 Depth=2
	s_or_b32 exec_lo, exec_lo, s27
	v_cmp_eq_u32_e32 vcc_lo, v5, v9
	v_add_nc_u32_e32 v9, v9, v6
	s_or_b32 s1, s26, vcc_lo
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s1, exec_lo, s1
	s_or_b32 s25, s1, s25
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_not1_b32 exec_lo, exec_lo, s25
	s_cbranch_execnz .LBB2_20
.LBB2_29:                               ; %Flow188
                                        ;   in Loop: Header=BB2_6 Depth=1
	s_or_b32 exec_lo, exec_lo, s24
	v_add_nc_u32_e32 v1, 1, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	v_cmp_ge_i32_e32 vcc_lo, v1, v2
	s_or_b32 s23, vcc_lo, s23
	s_and_not1_b32 exec_lo, exec_lo, s23
	s_cbranch_execnz .LBB2_6
.LBB2_30:                               ; %.loopexit
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z13calc_one_shediPKtiiiiPKiPy
		.amdhsa_group_segment_fixed_size 12
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 304
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 19
		.amdhsa_next_free_sgpr 30
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end2:
	.size	_Z13calc_one_shediPKtiiiiPKiPy, .Lfunc_end2-_Z13calc_one_shediPKtiiiiPKiPy
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 1800
; NumSgprs: 32
; NumVgprs: 19
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 12 bytes/workgroup (compile time only)
; SGPRBlocks: 3
; VGPRBlocks: 2
; NumSGPRsForWavesPerEU: 32
; NumVGPRsForWavesPerEU: 19
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.protected	_Z15calc_extra_areaiiPKiS0_PKyiiiS2_Pi ; -- Begin function _Z15calc_extra_areaiiPKiS0_PKyiiiS2_Pi
	.globl	_Z15calc_extra_areaiiPKiS0_PKyiiiS2_Pi
	.p2align	8
	.type	_Z15calc_extra_areaiiPKiS0_PKyiiiS2_Pi,@function
_Z15calc_extra_areaiiPKiS0_PKyiiiS2_Pi: ; @_Z15calc_extra_areaiiPKiS0_PKyiiiS2_Pi
; %bb.0:
	s_mov_b32 s2, s15
	s_clause 0x1
	s_load_b128 s[12:15], s[0:1], 0x8
	s_load_b32 s6, s[0:1], 0x4c
	s_mov_b32 s3, 0
	v_mov_b32_e32 v9, 0
	s_lshl_b64 s[4:5], s[2:3], 2
	s_waitcnt lgkmcnt(0)
	s_add_u32 s14, s14, s4
	s_addc_u32 s15, s15, s5
	s_and_b32 s18, s6, 0xffff
	s_load_b256 s[4:11], s[0:1], 0x20
	s_load_b32 s14, s[14:15], 0x0
	v_cvt_f32_u32_e32 v1, s18
	s_waitcnt lgkmcnt(0)
	s_sub_i32 s7, 0, s18
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1)
	v_rcp_iflag_f32_e32 v1, v1
	s_waitcnt_depctr 0xfff
	v_mul_f32_e32 v1, 0x4f7ffffe, v1
	s_ashr_i32 s15, s14, 31
	v_cvt_u32_f32_e32 v1, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_readfirstlane_b32 s2, v1
	s_mul_i32 s7, s7, s2
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_mul_hi_u32 s7, s2, s7
	s_add_i32 s2, s2, s7
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_mul_hi_u32 s2, s4, s2
	s_mul_i32 s7, s2, s18
	s_add_i32 s16, s2, 1
	s_sub_i32 s7, s4, s7
	s_delay_alu instid0(SALU_CYCLE_1)
	s_sub_i32 s17, s7, s18
	s_cmp_ge_u32 s7, s18
	s_cselect_b32 s2, s16, s2
	s_cselect_b32 s7, s17, s7
	s_add_i32 s16, s2, 1
	s_cmp_ge_u32 s7, s18
	s_cselect_b32 s2, s16, s2
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_mul_i32 s7, s2, s18
	s_sub_i32 s7, s4, s7
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	s_cmp_lg_u32 s7, 0
	s_cselect_b32 vcc_lo, -1, 0
	s_cmp_lg_u32 vcc_lo, 0
	s_addc_u32 s21, s2, 0
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_lo_u32 v7, s21, v0
	v_add_co_ci_u32_e32 v8, vcc_lo, s2, v7, vcc_lo
	v_cmp_gt_i32_e64 s2, s4, v7
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cmp_lt_u32_e32 vcc_lo, v7, v8
	s_and_b32 s7, vcc_lo, s2
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_saveexec_b32 s2, s7
	s_cbranch_execz .LBB3_14
; %bb.1:                                ; %.lr.ph115
	s_clause 0x1
	s_load_b64 s[22:23], s[0:1], 0x18
	s_load_b64 s[16:17], s[0:1], 0x0
	s_mul_i32 s0, s5, s4
	v_mul_lo_u32 v2, v0, s5
	s_mul_i32 s0, s0, s14
	v_mov_b32_e32 v9, 0
	s_ashr_i32 s1, s0, 31
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	s_lshl_b64 s[24:25], s[0:1], 3
	v_mul_lo_u32 v10, v2, s21
	s_waitcnt lgkmcnt(0)
	s_add_u32 s1, s22, s24
	s_addc_u32 s7, s23, s25
	s_lshl_b64 s[22:23], s[14:15], 2
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_4) | instid1(SALU_CYCLE_1)
	s_add_u32 s12, s12, s22
	s_addc_u32 s13, s13, s23
	s_ashr_i32 s0, s16, 31
	s_load_b32 s13, s[12:13], 0x0
	s_add_i32 s19, s16, s0
	s_xor_b32 s19, s19, s0
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_cvt_f32_u32_e32 v1, s19
	s_sub_i32 s20, 0, s19
	v_rcp_iflag_f32_e32 v1, v1
	s_waitcnt_depctr 0xfff
	v_mul_f32_e32 v1, 0x4f7ffffe, v1
	s_waitcnt lgkmcnt(0)
	s_ashr_i32 s22, s13, 31
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_3) | instid1(VALU_DEP_1)
	s_add_i32 s23, s13, s22
	s_xor_b32 s0, s22, s0
	v_cvt_u32_f32_e32 v1, v1
	s_xor_b32 s23, s23, s22
	v_readfirstlane_b32 s12, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_mul_i32 s20, s20, s12
	s_mul_hi_u32 s20, s12, s20
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_add_i32 s12, s12, s20
	s_mul_hi_u32 s12, s23, s12
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_2) | instid1(SALU_CYCLE_1)
	s_mul_i32 s20, s12, s19
	s_add_i32 s22, s12, 1
	s_sub_i32 s20, s23, s20
	s_sub_i32 s23, s20, s19
	s_cmp_ge_u32 s20, s19
	s_cselect_b32 s12, s22, s12
	s_cselect_b32 s20, s23, s20
	s_add_i32 s22, s12, 1
	s_cmp_ge_u32 s20, s19
	s_cselect_b32 s12, s22, s12
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_xor_b32 s12, s12, s0
	s_sub_i32 s19, s12, s0
	v_add_nc_u32_e32 v1, s12, v7
	s_mul_i32 s20, s19, s16
	s_sub_i32 s12, s19, s17
	s_sub_i32 s13, s13, s20
	s_delay_alu instid0(VALU_DEP_1)
	v_subrev_nc_u32_e32 v1, s0, v1
	s_sub_i32 s0, s13, s17
	s_add_i32 s19, s13, s17
	s_ashr_i32 s20, s0, 31
	s_ashr_i32 s22, s19, 31
	s_lshr_b32 s20, s20, 26
	s_and_b32 s13, s0, 63
	s_add_i32 s20, s0, s20
	s_lshr_b32 s22, s22, 26
	s_and_b32 s23, s20, 0xffffffc0
	s_add_i32 s19, s19, s22
	s_sub_i32 s0, s0, s23
	s_ashr_i32 s20, s20, 6
	s_ashr_i32 s0, s0, 31
	v_subrev_nc_u32_e32 v1, s17, v1
	s_ashr_i32 s19, s19, 6
	s_add_i32 s20, s0, s20
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	s_cmp_gt_i32 s20, s19
	v_mul_lo_u32 v11, s6, v1
	s_cselect_b32 s17, -1, 0
	s_cmp_eq_u32 s13, 0
	s_cselect_b32 s21, -1, 0
	s_sub_i32 s22, 64, s13
	s_cmp_lg_u32 s20, 0
	s_cselect_b32 s23, -1, 0
	s_add_u32 s24, s1, -8
	s_addc_u32 s25, s7, -1
.LBB3_2:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB3_4 Depth 2
	v_add_nc_u32_e32 v1, s12, v7
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_cmp_gt_i32_e32 vcc_lo, 0, v1
	v_cmp_le_i32_e64 s0, s16, v1
	s_or_b32 s0, vcc_lo, s0
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_or_b32 s0, s0, s17
	s_xor_b32 s26, s0, -1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_saveexec_b32 s0, s26
	s_cbranch_execz .LBB3_12
; %bb.3:                                ; %.lr.ph
                                        ;   in Loop: Header=BB3_2 Depth=1
	v_mov_b32_e32 v1, 0
	v_mov_b32_e32 v2, 0
	s_mov_b32 s26, 0
	s_mov_b32 s27, s20
.LBB3_4:                                ;   Parent Loop BB3_2 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_3) | instid1(SALU_CYCLE_1)
	s_cmp_lt_i32 s27, 0
	s_cselect_b32 s28, -1, 0
	s_cmp_ge_i32 s27, s6
	s_cselect_b32 s29, -1, 0
	s_or_b32 s28, s28, s29
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_b32 vcc_lo, exec_lo, s28
	s_cbranch_vccnz .LBB3_10
; %bb.5:                                ;   in Loop: Header=BB3_4 Depth=2
	v_add_nc_u32_e32 v5, s26, v10
	s_cmp_eq_u32 s27, 0
	s_cselect_b32 s28, -1, 0
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	s_and_b32 s28, s28, s23
	v_ashrrev_i32_e32 v6, 31, v5
	s_and_not1_b32 vcc_lo, exec_lo, s28
	s_cbranch_vccnz .LBB3_7
; %bb.6:                                ;   in Loop: Header=BB3_4 Depth=2
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[1:2], 3, v[5:6]
	v_add_co_u32 v1, vcc_lo, s24, v1
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v2, vcc_lo, s25, v2, vcc_lo
	global_load_b64 v[1:2], v[1:2], off
.LBB3_7:                                ;   in Loop: Header=BB3_4 Depth=2
	v_mov_b32_e32 v3, 0
	v_mov_b32_e32 v4, 0
	s_cmp_ge_i32 s26, s5
	s_cbranch_scc1 .LBB3_9
; %bb.8:                                ;   in Loop: Header=BB3_4 Depth=2
	v_lshlrev_b64 v[3:4], 3, v[5:6]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v3, vcc_lo, s1, v3
	v_add_co_ci_u32_e32 v4, vcc_lo, s7, v4, vcc_lo
	global_load_b64 v[3:4], v[3:4], off
.LBB3_9:                                ;   in Loop: Header=BB3_4 Depth=2
	v_add_nc_u32_e32 v5, s27, v11
	s_waitcnt vmcnt(0)
	v_lshlrev_b64 v[1:2], s22, v[1:2]
	v_lshrrev_b64 v[12:13], s13, v[3:4]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_ashrrev_i32_e32 v6, 31, v5
	v_cndmask_b32_e64 v1, v1, 0, s21
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_cndmask_b32_e64 v2, v2, 0, s21
	v_lshlrev_b64 v[5:6], 3, v[5:6]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_or_b32_e32 v1, v12, v1
	v_or_b32_e32 v2, v13, v2
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_add_co_u32 v5, vcc_lo, s8, v5
	v_add_co_ci_u32_e32 v6, vcc_lo, s9, v6, vcc_lo
	global_load_b64 v[5:6], v[5:6], off
	s_waitcnt vmcnt(0)
	v_not_b32_e32 v5, v5
	v_not_b32_e32 v6, v6
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_and_b32_e32 v1, v1, v5
	v_and_b32_e32 v2, v2, v6
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_bcnt_u32_b32 v1, v1, 0
	v_bcnt_u32_b32 v1, v2, v1
	s_delay_alu instid0(VALU_DEP_1)
	v_add_nc_u32_e32 v9, v9, v1
	v_dual_mov_b32 v1, v3 :: v_dual_mov_b32 v2, v4
.LBB3_10:                               ;   in Loop: Header=BB3_4 Depth=2
	s_add_i32 s28, s27, 1
	s_add_i32 s26, s26, 1
	s_cmp_lt_i32 s27, s19
	s_cbranch_scc0 .LBB3_12
; %bb.11:                               ;   in Loop: Header=BB3_4 Depth=2
	s_mov_b32 s27, s28
	s_branch .LBB3_4
.LBB3_12:                               ; %Flow164
                                        ;   in Loop: Header=BB3_2 Depth=1
	s_or_b32 exec_lo, exec_lo, s0
	v_add_nc_u32_e32 v7, 1, v7
	v_add_nc_u32_e32 v11, s6, v11
	v_add_nc_u32_e32 v10, s5, v10
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_cmp_ge_u32_e32 vcc_lo, v7, v8
	v_cmp_le_i32_e64 s0, s4, v7
	s_or_b32 s0, vcc_lo, s0
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s0, exec_lo, s0
	s_or_b32 s3, s0, s3
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_not1_b32 exec_lo, exec_lo, s3
	s_cbranch_execnz .LBB3_2
; %bb.13:                               ; %Flow165
	s_or_b32 exec_lo, exec_lo, s3
.LBB3_14:                               ; %Flow166
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_b32 exec_lo, exec_lo, s2
; %bb.15:                               ; %._crit_edge
	v_lshl_add_u32 v1, v0, 2, 0
	s_mov_b32 s0, 0
	s_mov_b32 s1, exec_lo
	ds_store_b32 v1, v9
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
	v_cmpx_eq_u32_e32 0, v0
	s_cbranch_execz .LBB3_19
; %bb.16:                               ; %.preheader.preheader
	v_mov_b32_e32 v0, 0
	s_max_u32 s1, s18, 1
.LBB3_17:                               ; %.preheader
                                        ; =>This Inner Loop Header: Depth=1
	v_mov_b32_e32 v1, s0
	s_add_i32 s1, s1, -1
	s_add_i32 s0, s0, 4
	s_cmp_eq_u32 s1, 0
	ds_load_b32 v1, v1
	s_waitcnt lgkmcnt(0)
	v_add_nc_u32_e32 v0, v1, v0
	s_cbranch_scc0 .LBB3_17
; %bb.18:
	s_lshl_b64 s[0:1], s[14:15], 2
	v_mov_b32_e32 v1, 0
	s_add_u32 s0, s10, s0
	s_addc_u32 s1, s11, s1
	global_store_b32 v1, v0, s[0:1]
.LBB3_19:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z15calc_extra_areaiiPKiS0_PKyiiiS2_Pi
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 320
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 14
		.amdhsa_next_free_sgpr 30
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end3:
	.size	_Z15calc_extra_areaiiPKiS0_PKyiiiS2_Pi, .Lfunc_end3-_Z15calc_extra_areaiiPKiS0_PKyiiiS2_Pi
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 1252
; NumSgprs: 32
; NumVgprs: 14
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 3
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 32
; NumVGPRsForWavesPerEU: 14
; Occupancy: 16
; WaveLimiterHint : 1
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.protected	_Z10union_areaiiiiPKiPKyiiiiPKciiiS2_PiS5_ ; -- Begin function _Z10union_areaiiiiPKiPKyiiiiPKciiiS2_PiS5_
	.globl	_Z10union_areaiiiiPKiPKyiiiiPKciiiS2_PiS5_
	.p2align	8
	.type	_Z10union_areaiiiiPKiPKyiiiiPKciiiS2_PiS5_,@function
_Z10union_areaiiiiPKiPKyiiiiPKciiiS2_PiS5_: ; @_Z10union_areaiiiiPKiPKyiiiiPKciiiS2_PiS5_
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x6c
	s_load_b128 s[4:7], s[0:1], 0x0
	s_add_u32 s16, s0, 0x60
	s_addc_u32 s17, s1, 0
	s_waitcnt lgkmcnt(0)
	s_and_b32 s21, s2, 0xffff
	s_mov_b32 s2, exec_lo
	v_mad_u64_u32 v[1:2], null, s15, s21, v[0:1]
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_gt_i32_e64 s7, v1
	s_cbranch_execz .LBB4_16
; %bb.1:                                ; %.lr.ph
	s_clause 0x1
	s_load_b128 s[8:11], s[0:1], 0x28
	s_load_b64 s[2:3], s[0:1], 0x58
	s_load_b32 s23, s[16:17], 0x0
	s_mov_b32 s16, 0
	v_mov_b32_e32 v3, 0
	s_waitcnt lgkmcnt(0)
	s_cmp_gt_i32 s9, 0
	s_cselect_b32 s18, -1, 0
	s_lshl_b32 s22, s5, 1
	s_cmp_lg_u32 s6, 0
	s_mul_i32 s17, s22, s22
	s_cselect_b32 s5, -1, 0
	s_lshl_b32 s6, s8, 6
	s_add_u32 s8, s2, 0x1e847c
	s_addc_u32 s9, s3, 0
	s_ashr_i32 s19, s4, 31
	s_mul_i32 s21, s23, s21
	s_add_i32 s12, s4, s19
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_3) | instid1(VALU_DEP_1)
	s_xor_b32 s20, s12, s19
	s_load_b64 s[12:13], s[0:1], 0x10
	v_cvt_f32_u32_e32 v0, s20
	s_sub_i32 s14, 0, s20
	v_rcp_iflag_f32_e32 v0, v0
	s_waitcnt_depctr 0xfff
	v_mul_f32_e32 v0, 0x4f7ffffe, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cvt_u32_f32_e32 v0, v0
	v_mul_lo_u32 v2, s14, v0
	s_clause 0x1
	s_load_b64 s[14:15], s[0:1], 0x3c
	s_load_b64 s[0:1], s[0:1], 0x48
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_hi_u32 v2, v0, v2
	v_add_nc_u32_e32 v4, v0, v2
.LBB4_2:                                ; =>This Inner Loop Header: Depth=1
	v_ashrrev_i32_e32 v2, 31, v1
	v_add_co_u32 v5, vcc_lo, s10, v1
	s_mov_b32 s22, exec_lo
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v6, vcc_lo, s11, v2, vcc_lo
	global_load_u8 v0, v[5:6], off
	s_waitcnt vmcnt(0)
	v_cmpx_eq_u16_e32 0, v0
	s_cbranch_execz .LBB4_15
; %bb.3:                                ;   in Loop: Header=BB4_2 Depth=1
	s_and_not1_b32 vcc_lo, exec_lo, s18
	s_cbranch_vccnz .LBB4_7
; %bb.4:                                ;   in Loop: Header=BB4_2 Depth=1
	v_lshlrev_b64 v[5:6], 2, v[1:2]
	s_mov_b32 s24, 0
	s_mov_b32 s23, exec_lo
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v5, vcc_lo, s12, v5
	v_add_co_ci_u32_e32 v6, vcc_lo, s13, v6, vcc_lo
	global_load_b32 v0, v[5:6], off
	s_waitcnt vmcnt(0)
	v_ashrrev_i32_e32 v2, 31, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_nc_u32_e32 v5, v0, v2
	v_xor_b32_e32 v5, v5, v2
	v_xor_b32_e32 v2, s19, v2
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_hi_u32 v6, v5, v4
	v_mul_lo_u32 v7, v6, s20
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_sub_nc_u32_e32 v5, v5, v7
	v_add_nc_u32_e32 v7, 1, v6
	v_subrev_nc_u32_e32 v8, s20, v5
	v_cmp_le_u32_e32 vcc_lo, s20, v5
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_dual_cndmask_b32 v6, v6, v7 :: v_dual_cndmask_b32 v5, v5, v8
	v_add_nc_u32_e32 v7, 1, v6
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cmp_le_u32_e32 vcc_lo, s20, v5
	v_cndmask_b32_e32 v5, v6, v7, vcc_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_xor_b32_e32 v5, v5, v2
	v_sub_nc_u32_e32 v2, v5, v2
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_mul_lo_u32 v5, v2, s4
	v_subrev_nc_u32_e32 v6, s14, v2
	v_sub_nc_u32_e32 v0, v0, v5
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_mul_lo_u32 v5, v6, v6
	v_subrev_nc_u32_e32 v8, s15, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[6:7], null, v8, v8, v[5:6]
	v_cmpx_ge_u32_e64 s17, v6
	s_cbranch_execz .LBB4_10
; %bb.5:                                ;   in Loop: Header=BB4_2 Depth=1
	s_and_b32 vcc_lo, exec_lo, s5
	s_cbranch_vccz .LBB4_8
; %bb.6:                                ;   in Loop: Header=BB4_2 Depth=1
	v_mad_u64_u32 v[5:6], null, s6, v2, v[0:1]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v0, 31, v5
	v_lshrrev_b32_e32 v0, 26, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_nc_u32_e32 v0, v5, v0
	v_ashrrev_i32_e32 v6, 6, v0
	v_and_b32_e32 v0, 0xffffffc0, v0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_ashrrev_i32_e32 v7, 31, v6
	v_sub_nc_u32_e32 v0, v0, v5
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_lshlrev_b64 v[6:7], 3, v[6:7]
	v_add_nc_u32_e32 v0, 63, v0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_u32 v6, vcc_lo, s0, v6
	v_add_co_ci_u32_e32 v7, vcc_lo, s1, v7, vcc_lo
	global_load_b64 v[6:7], v[6:7], off
	s_waitcnt vmcnt(0)
	v_lshrrev_b64 v[5:6], v0, v[6:7]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_and_b32_e32 v0, 1, v5
	v_cmp_eq_u32_e32 vcc_lo, 1, v0
	s_or_not1_b32 s24, vcc_lo, exec_lo
	s_branch .LBB4_9
.LBB4_7:                                ;   in Loop: Header=BB4_2 Depth=1
	s_mov_b32 s24, -1
	s_branch .LBB4_11
.LBB4_8:                                ;   in Loop: Header=BB4_2 Depth=1
	s_mov_b32 s24, -1
.LBB4_9:                                ; %Flow74
                                        ;   in Loop: Header=BB4_2 Depth=1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_b32 s24, s24, exec_lo
.LBB4_10:                               ; %Flow73
                                        ;   in Loop: Header=BB4_2 Depth=1
	s_or_b32 exec_lo, exec_lo, s23
.LBB4_11:                               ; %Flow
                                        ;   in Loop: Header=BB4_2 Depth=1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_b32 exec_lo, exec_lo, s24
	s_cbranch_execz .LBB4_15
; %bb.12:                               ; %.critedge
                                        ;   in Loop: Header=BB4_2 Depth=1
	s_mov_b32 s24, exec_lo
	s_mov_b32 s23, exec_lo
	v_mbcnt_lo_u32_b32 v0, s24, 0
                                        ; implicit-def: $vgpr2
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_eq_u32_e32 0, v0
	s_cbranch_execz .LBB4_14
; %bb.13:                               ;   in Loop: Header=BB4_2 Depth=1
	s_bcnt1_i32_b32 s24, s24
	s_delay_alu instid0(SALU_CYCLE_1)
	v_mov_b32_e32 v2, s24
	global_atomic_add_u32 v2, v3, v2, s[8:9] glc
.LBB4_14:                               ;   in Loop: Header=BB4_2 Depth=1
	s_or_b32 exec_lo, exec_lo, s23
	s_waitcnt vmcnt(0)
	v_readfirstlane_b32 s23, v2
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_nc_u32_e32 v5, s23, v0
	v_ashrrev_i32_e32 v6, 31, v5
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[5:6], 2, v[5:6]
	v_add_co_u32 v5, vcc_lo, s2, v5
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v6, vcc_lo, s3, v6, vcc_lo
	global_store_b32 v[5:6], v1, off
.LBB4_15:                               ; %.critedge38
                                        ;   in Loop: Header=BB4_2 Depth=1
	s_or_b32 exec_lo, exec_lo, s22
	v_add_nc_u32_e32 v1, s21, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	v_cmp_le_i32_e32 vcc_lo, s7, v1
	s_or_b32 s16, vcc_lo, s16
	s_and_not1_b32 exec_lo, exec_lo, s16
	s_cbranch_execnz .LBB4_2
.LBB4_16:                               ; %Flow77
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z10union_areaiiiiPKiPKyiiiiPKciiiS2_PiS5_
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 352
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 9
		.amdhsa_next_free_sgpr 25
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end4:
	.size	_Z10union_areaiiiiPKiPKyiiiiPKciiiS2_PiS5_, .Lfunc_end4-_Z10union_areaiiiiPKiPKyiiiiPKciiiS2_PiS5_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 832
; NumSgprs: 27
; NumVgprs: 9
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 3
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 27
; NumVGPRsForWavesPerEU: 9
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.protected	_Z10findtopobsiPKcPKiPi ; -- Begin function _Z10findtopobsiPKcPKiPi
	.globl	_Z10findtopobsiPKcPKiPi
	.p2align	8
	.type	_Z10findtopobsiPKcPKiPi,@function
_Z10findtopobsiPKcPKiPi:                ; @_Z10findtopobsiPKcPKiPi
; %bb.0:
	s_clause 0x3
	s_load_b32 s10, s[0:1], 0x2c
	s_load_b32 s3, s[0:1], 0x0
	s_load_b64 s[8:9], s[0:1], 0x18
	s_load_b128 s[4:7], s[0:1], 0x8
	s_add_u32 s0, s0, 32
	s_mov_b32 s2, s15
	s_addc_u32 s1, s1, 0
	v_lshlrev_b32_e32 v7, 2, v0
	s_delay_alu instid0(VALU_DEP_1)
	v_dual_mov_b32 v9, 0 :: v_dual_add_nc_u32 v8, 0x400, v7
	ds_store_2addr_stride64_b32 v7, v9, v9 offset1:4
	s_waitcnt lgkmcnt(0)
	s_and_b32 s11, s10, 0xffff
	s_mov_b32 s10, exec_lo
	v_mad_u64_u32 v[1:2], null, s2, s11, v[0:1]
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_gt_i32_e64 s3, v1
	s_cbranch_execz .LBB5_7
; %bb.1:                                ; %.lr.ph.preheader
	s_load_b32 s0, s[0:1], 0x0
	v_ashrrev_i32_e32 v2, 31, v1
	v_add_co_u32 v3, vcc_lo, s4, v1
	s_mov_b32 s1, 0
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_lshlrev_b64 v[5:6], 2, v[1:2]
	v_add_co_ci_u32_e32 v4, vcc_lo, s5, v2, vcc_lo
	v_add_co_u32 v5, vcc_lo, s6, v5
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_2) | instid1(SALU_CYCLE_1)
	v_add_co_ci_u32_e32 v6, vcc_lo, s7, v6, vcc_lo
	s_waitcnt lgkmcnt(0)
	s_mul_i32 s4, s0, s11
	s_ashr_i32 s5, s4, 31
	s_delay_alu instid0(SALU_CYCLE_1)
	s_lshl_b64 s[6:7], s[4:5], 2
.LBB5_2:                                ; %.lr.ph
                                        ; =>This Inner Loop Header: Depth=1
	global_load_u8 v2, v[3:4], off
	s_mov_b32 s0, exec_lo
	s_waitcnt vmcnt(0)
	v_cmpx_eq_u16_e32 0, v2
	s_cbranch_execz .LBB5_6
; %bb.3:                                ;   in Loop: Header=BB5_2 Depth=1
	global_load_b32 v2, v[5:6], off
	s_mov_b32 s11, exec_lo
	s_waitcnt vmcnt(0)
	v_cmpx_gt_i32_e64 v2, v9
	s_cbranch_execz .LBB5_5
; %bb.4:                                ;   in Loop: Header=BB5_2 Depth=1
	v_mov_b32_e32 v9, v2
	ds_store_b32 v7, v1
	ds_store_b32 v8, v2
.LBB5_5:                                ; %Flow39
                                        ;   in Loop: Header=BB5_2 Depth=1
	s_or_b32 exec_lo, exec_lo, s11
.LBB5_6:                                ;   in Loop: Header=BB5_2 Depth=1
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_3) | instid1(VALU_DEP_3)
	s_or_b32 exec_lo, exec_lo, s0
	v_add_nc_u32_e32 v1, s4, v1
	v_add_co_u32 v3, vcc_lo, v3, s4
	v_add_co_ci_u32_e32 v4, vcc_lo, s5, v4, vcc_lo
	v_cmp_le_i32_e32 vcc_lo, s3, v1
	v_add_co_u32 v5, s0, v5, s6
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	v_add_co_ci_u32_e64 v6, s0, s7, v6, s0
	s_or_b32 s1, vcc_lo, s1
	s_and_not1_b32 exec_lo, exec_lo, s1
	s_cbranch_execnz .LBB5_2
.LBB5_7:                                ; %Flow41
	s_or_b32 exec_lo, exec_lo, s10
	s_delay_alu instid0(SALU_CYCLE_1)
	s_mov_b32 s0, exec_lo
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
	v_cmpx_gt_u32_e32 0x80, v0
	s_cbranch_execz .LBB5_10
; %bb.8:
	v_or_b32_e32 v1, 0x80, v0
	s_delay_alu instid0(VALU_DEP_1)
	v_lshlrev_b32_e32 v1, 2, v1
	ds_load_b32 v3, v1 offset:1024
	ds_load_b32 v2, v8
	s_waitcnt lgkmcnt(0)
	v_cmp_gt_i32_e32 vcc_lo, v3, v2
	s_and_b32 exec_lo, exec_lo, vcc_lo
	s_cbranch_execz .LBB5_10
; %bb.9:
	ds_load_b32 v4, v1
	ds_load_b32 v5, v7
	v_add_nc_u32_e32 v6, 0x400, v1
	s_waitcnt lgkmcnt(1)
	ds_store_b32 v7, v4
	ds_store_b32 v8, v3
	s_waitcnt lgkmcnt(2)
	ds_store_b32 v1, v5
	ds_store_b32 v6, v2
.LBB5_10:
	s_or_b32 exec_lo, exec_lo, s0
	s_delay_alu instid0(SALU_CYCLE_1)
	s_mov_b32 s0, exec_lo
	v_cmpx_gt_u32_e32 64, v0
	s_cbranch_execz .LBB5_13
; %bb.11:
	v_or_b32_e32 v1, 64, v0
	s_delay_alu instid0(VALU_DEP_1)
	v_lshlrev_b32_e32 v1, 2, v1
	ds_load_b32 v3, v1 offset:1024
	ds_load_b32 v2, v8
	s_waitcnt lgkmcnt(0)
	v_cmp_gt_i32_e32 vcc_lo, v3, v2
	s_and_b32 exec_lo, exec_lo, vcc_lo
	s_cbranch_execz .LBB5_13
; %bb.12:
	ds_load_b32 v4, v1
	ds_load_b32 v5, v7
	v_add_nc_u32_e32 v6, 0x400, v1
	s_waitcnt lgkmcnt(1)
	ds_store_b32 v7, v4
	ds_store_b32 v8, v3
	s_waitcnt lgkmcnt(2)
	ds_store_b32 v1, v5
	ds_store_b32 v6, v2
.LBB5_13:
	s_or_b32 exec_lo, exec_lo, s0
	s_delay_alu instid0(SALU_CYCLE_1)
	s_mov_b32 s0, exec_lo
	v_cmpx_gt_u32_e32 32, v0
	s_cbranch_execz .LBB5_16
; %bb.14:
	v_or_b32_e32 v1, 32, v0
	s_delay_alu instid0(VALU_DEP_1)
	v_lshlrev_b32_e32 v1, 2, v1
	ds_load_b32 v3, v1 offset:1024
	ds_load_b32 v2, v8
	s_waitcnt lgkmcnt(0)
	v_cmp_gt_i32_e32 vcc_lo, v3, v2
	s_and_b32 exec_lo, exec_lo, vcc_lo
	s_cbranch_execz .LBB5_16
; %bb.15:
	ds_load_b32 v4, v1
	ds_load_b32 v5, v7
	v_add_nc_u32_e32 v6, 0x400, v1
	s_waitcnt lgkmcnt(1)
	ds_store_b32 v7, v4
	ds_store_b32 v8, v3
	s_waitcnt lgkmcnt(2)
	ds_store_b32 v1, v5
	ds_store_b32 v6, v2
.LBB5_16:
	s_or_b32 exec_lo, exec_lo, s0
	s_delay_alu instid0(SALU_CYCLE_1)
	s_mov_b32 s0, exec_lo
	v_cmpx_gt_u32_e32 16, v0
	s_cbranch_execz .LBB5_19
; %bb.17:
	v_or_b32_e32 v1, 16, v0
	s_delay_alu instid0(VALU_DEP_1)
	v_lshlrev_b32_e32 v1, 2, v1
	ds_load_b32 v3, v1 offset:1024
	ds_load_b32 v2, v8
	s_waitcnt lgkmcnt(0)
	v_cmp_gt_i32_e32 vcc_lo, v3, v2
	s_and_b32 exec_lo, exec_lo, vcc_lo
	s_cbranch_execz .LBB5_19
; %bb.18:
	ds_load_b32 v4, v1
	ds_load_b32 v5, v7
	v_add_nc_u32_e32 v6, 0x400, v1
	s_waitcnt lgkmcnt(1)
	ds_store_b32 v7, v4
	ds_store_b32 v8, v3
	s_waitcnt lgkmcnt(2)
	ds_store_b32 v1, v5
	ds_store_b32 v6, v2
.LBB5_19:
	s_or_b32 exec_lo, exec_lo, s0
	s_delay_alu instid0(SALU_CYCLE_1)
	s_mov_b32 s0, exec_lo
	v_cmpx_gt_u32_e32 8, v0
	s_cbranch_execz .LBB5_22
; %bb.20:
	v_or_b32_e32 v1, 8, v0
	s_delay_alu instid0(VALU_DEP_1)
	v_lshlrev_b32_e32 v1, 2, v1
	ds_load_b32 v3, v1 offset:1024
	ds_load_b32 v2, v8
	s_waitcnt lgkmcnt(0)
	v_cmp_gt_i32_e32 vcc_lo, v3, v2
	s_and_b32 exec_lo, exec_lo, vcc_lo
	s_cbranch_execz .LBB5_22
; %bb.21:
	ds_load_b32 v4, v1
	ds_load_b32 v5, v7
	v_add_nc_u32_e32 v6, 0x400, v1
	s_waitcnt lgkmcnt(1)
	ds_store_b32 v7, v4
	ds_store_b32 v8, v3
	s_waitcnt lgkmcnt(2)
	ds_store_b32 v1, v5
	ds_store_b32 v6, v2
.LBB5_22:
	s_or_b32 exec_lo, exec_lo, s0
	s_delay_alu instid0(SALU_CYCLE_1)
	s_mov_b32 s0, exec_lo
	v_cmpx_gt_u32_e32 4, v0
	s_cbranch_execz .LBB5_25
; %bb.23:
	v_or_b32_e32 v1, 4, v0
	s_delay_alu instid0(VALU_DEP_1)
	v_lshlrev_b32_e32 v1, 2, v1
	ds_load_b32 v3, v1 offset:1024
	ds_load_b32 v2, v8
	s_waitcnt lgkmcnt(0)
	v_cmp_gt_i32_e32 vcc_lo, v3, v2
	s_and_b32 exec_lo, exec_lo, vcc_lo
	s_cbranch_execz .LBB5_25
; %bb.24:
	ds_load_b32 v4, v1
	ds_load_b32 v5, v7
	v_add_nc_u32_e32 v6, 0x400, v1
	s_waitcnt lgkmcnt(1)
	ds_store_b32 v7, v4
	ds_store_b32 v8, v3
	s_waitcnt lgkmcnt(2)
	ds_store_b32 v1, v5
	ds_store_b32 v6, v2
.LBB5_25:
	s_or_b32 exec_lo, exec_lo, s0
	s_delay_alu instid0(SALU_CYCLE_1)
	s_mov_b32 s0, exec_lo
	v_cmpx_gt_u32_e32 2, v0
	s_cbranch_execz .LBB5_28
; %bb.26:
	v_or_b32_e32 v1, 2, v0
	s_delay_alu instid0(VALU_DEP_1)
	v_lshlrev_b32_e32 v1, 2, v1
	ds_load_b32 v3, v1 offset:1024
	ds_load_b32 v2, v8
	s_waitcnt lgkmcnt(0)
	v_cmp_gt_i32_e32 vcc_lo, v3, v2
	s_and_b32 exec_lo, exec_lo, vcc_lo
	s_cbranch_execz .LBB5_28
; %bb.27:
	ds_load_b32 v4, v1
	ds_load_b32 v5, v7
	v_add_nc_u32_e32 v6, 0x400, v1
	s_waitcnt lgkmcnt(1)
	ds_store_b32 v7, v4
	ds_store_b32 v8, v3
	s_waitcnt lgkmcnt(2)
	ds_store_b32 v1, v5
	ds_store_b32 v6, v2
.LBB5_28:
	s_or_b32 exec_lo, exec_lo, s0
	s_delay_alu instid0(SALU_CYCLE_1)
	s_mov_b32 s0, exec_lo
	v_cmpx_eq_u32_e32 0, v0
	s_cbranch_execz .LBB5_32
; %bb.29:
	v_mov_b32_e32 v0, 0
	s_mov_b32 s0, exec_lo
	ds_load_b32 v2, v0 offset:1028
	ds_load_b32 v1, v8
	s_waitcnt lgkmcnt(0)
	v_cmpx_gt_i32_e64 v2, v1
	s_cbranch_execz .LBB5_31
; %bb.30:
	ds_load_b32 v3, v0 offset:4
	ds_load_b32 v4, v7
	v_add_nc_u32_e64 v5, 4, 0
	s_waitcnt lgkmcnt(1)
	ds_store_b32 v7, v3
	ds_store_b32 v8, v2
	s_waitcnt lgkmcnt(2)
	ds_store_2addr_stride64_b32 v5, v4, v1 offset1:4
.LBB5_31:
	s_or_b32 exec_lo, exec_lo, s0
	ds_load_2addr_stride64_b32 v[1:2], v0 offset1:4
	s_add_i32 s0, s2, 0x64
	s_mov_b32 s1, 0
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_4) | instid1(SALU_CYCLE_1)
	s_lshl_b64 s[4:5], s[0:1], 2
	s_mov_b32 s3, s1
	s_add_u32 s0, s8, s4
	s_addc_u32 s1, s9, s5
	s_lshl_b64 s[2:3], s[2:3], 2
	s_add_u32 s2, s8, s2
	s_addc_u32 s3, s9, s3
	s_waitcnt lgkmcnt(0)
	s_clause 0x1
	global_store_b32 v0, v1, s[2:3]
	global_store_b32 v0, v2, s[0:1]
.LBB5_32:                               ; %.critedge
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z10findtopobsiPKcPKiPi
		.amdhsa_group_segment_fixed_size 2048
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 288
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 10
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end5:
	.size	_Z10findtopobsiPKcPKiPi, .Lfunc_end5-_Z10findtopobsiPKcPKiPi
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 1456
; NumSgprs: 18
; NumVgprs: 10
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 2048 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 10
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.protected	_Z10calc_unioniiiPKiPKyiiiiPcPy ; -- Begin function _Z10calc_unioniiiPKiPKyiiiiPcPy
	.globl	_Z10calc_unioniiiPKiPKyiiiiPcPy
	.p2align	8
	.type	_Z10calc_unioniiiPKiPKyiiiiPcPy,@function
_Z10calc_unioniiiPKiPKyiiiiPcPy:        ; @_Z10calc_unioniiiPKiPKyiiiiPcPy
; %bb.0:
	s_clause 0x1
	s_load_b64 s[2:3], s[0:1], 0x0
	s_load_b256 s[4:11], s[0:1], 0x20
	s_mov_b32 s12, exec_lo
	v_cmpx_eq_u32_e32 0, v0
	s_cbranch_execz .LBB6_2
; %bb.1:
	s_load_b128 s[16:19], s[0:1], 0x10
	s_waitcnt lgkmcnt(0)
	s_ashr_i32 s21, s7, 31
	s_mov_b32 s20, s7
	v_mov_b32_e32 v5, 0
	v_mov_b32_e32 v1, 1
	s_add_u32 s8, s8, s7
	s_addc_u32 s9, s9, s21
	s_lshl_b64 s[20:21], s[20:21], 2
	global_store_b8 v5, v1, s[8:9]
	s_add_u32 s16, s16, s20
	s_addc_u32 s17, s17, s21
	s_ashr_i32 s8, s2, 31
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_add_i32 s9, s2, s8
	s_xor_b32 s9, s9, s8
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cvt_f32_u32_e32 v2, s9
	v_rcp_iflag_f32_e32 v2, v2
	s_waitcnt_depctr 0xfff
	v_mul_f32_e32 v2, 0x4f7ffffe, v2
	global_load_b32 v1, v5, s[16:17]
	s_sub_i32 s16, 0, s9
	v_cvt_u32_f32_e32 v2, v2
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_readfirstlane_b32 s13, v2
	s_mul_i32 s16, s16, s13
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_mul_hi_u32 s16, s13, s16
	s_add_i32 s13, s13, s16
	s_waitcnt vmcnt(0)
	v_readfirstlane_b32 s14, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_ashr_i32 s17, s14, 31
	s_add_i32 s20, s14, s17
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_2) | instid1(SALU_CYCLE_1)
	s_xor_b32 s16, s20, s17
	s_xor_b32 s17, s17, s8
	s_mul_hi_u32 s13, s16, s13
	s_mul_i32 s20, s13, s9
	s_delay_alu instid0(SALU_CYCLE_1)
	s_sub_i32 s8, s16, s20
	s_add_i32 s16, s13, 1
	s_sub_i32 s20, s8, s9
	s_cmp_ge_u32 s8, s9
	s_cselect_b32 s13, s16, s13
	s_cselect_b32 s8, s20, s8
	s_add_i32 s16, s13, 1
	s_cmp_ge_u32 s8, s9
	s_mul_i32 s9, s5, s4
	s_cselect_b32 s8, s16, s13
	s_delay_alu instid0(SALU_CYCLE_1)
	s_xor_b32 s13, s8, s17
	s_mul_i32 s8, s9, s7
	s_sub_i32 s7, s13, s17
	s_ashr_i32 s9, s8, 31
	s_mul_i32 s13, s7, s2
	s_lshl_b64 s[8:9], s[8:9], 3
	s_sub_i32 s13, s14, s13
	s_add_u32 s8, s18, s8
	v_mov_b32_e32 v2, s13
	s_addc_u32 s9, s19, s9
	v_mov_b32_e32 v3, s8
	v_dual_mov_b32 v1, s7 :: v_dual_mov_b32 v4, s9
	ds_store_2addr_b64 v5, v[3:4], v[1:2] offset1:1
.LBB6_2:
	s_or_b32 exec_lo, exec_lo, s12
	s_waitcnt lgkmcnt(0)
	s_waitcnt_vscnt null, 0x0
	s_barrier
	buffer_gl0_inv
	s_load_b32 s0, s[0:1], 0x4c
	s_waitcnt lgkmcnt(0)
	s_and_b32 s0, s0, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[2:3], null, s15, s0, v[0:1]
	s_mov_b32 s0, exec_lo
	v_cmpx_gt_i32_e64 s4, v2
	s_cbranch_execz .LBB6_11
; %bb.3:
	v_mov_b32_e32 v0, 0
	ds_load_b32 v0, v0 offset:8
	s_waitcnt lgkmcnt(0)
	v_subrev_nc_u32_e32 v0, s3, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_nc_u32_e32 v3, v0, v2
	v_cmp_lt_i32_e32 vcc_lo, -1, v3
	v_cmp_gt_i32_e64 s0, s2, v3
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s0, vcc_lo, s0
	s_and_b32 exec_lo, exec_lo, s0
	s_cbranch_execz .LBB6_11
; %bb.4:                                ; %.preheader
	s_cmp_lt_i32 s5, 1
	s_cbranch_scc1 .LBB6_11
; %bb.5:                                ; %.lr.ph
	v_mov_b32_e32 v0, 0
	v_mul_lo_u32 v2, v2, s5
	ds_load_b32 v4, v0 offset:12
	ds_load_b64 v[0:1], v0
	s_waitcnt lgkmcnt(1)
	v_readfirstlane_b32 s0, v4
	v_mul_lo_u32 v4, v3, s6
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_sub_i32 s1, s0, s3
	s_and_b32 s0, s1, 63
	s_ashr_i32 s7, s1, 6
	s_cmp_lg_u32 s0, 0
	s_cselect_b32 s1, -1, 0
	s_sub_i32 s2, 64, s0
	s_add_u32 s3, s10, 8
	s_addc_u32 s4, s11, 0
.LBB6_6:                                ; =>This Inner Loop Header: Depth=1
	s_cmp_lt_i32 s7, 0
	s_cselect_b32 s8, -1, 0
	s_cmp_ge_i32 s7, s6
	s_cselect_b32 s9, -1, 0
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_or_b32 s8, s8, s9
	s_and_b32 vcc_lo, exec_lo, s8
	s_cbranch_vccnz .LBB6_8
; %bb.7:                                ;   in Loop: Header=BB6_6 Depth=1
	v_ashrrev_i32_e32 v3, 31, v2
	v_add_nc_u32_e32 v5, s7, v4
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_lshlrev_b64 v[7:8], 3, v[2:3]
	v_ashrrev_i32_e32 v6, 31, v5
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_lshlrev_b64 v[5:6], 3, v[5:6]
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v7, vcc_lo, v0, v7
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_ci_u32_e32 v8, vcc_lo, v1, v8, vcc_lo
	v_add_co_u32 v5, vcc_lo, s10, v5
	flat_load_b64 v[7:8], v[7:8]
	v_add_co_ci_u32_e32 v6, vcc_lo, s11, v6, vcc_lo
	global_load_b64 v[9:10], v[5:6], off
	s_waitcnt vmcnt(1) lgkmcnt(0)
	v_lshrrev_b64 v[7:8], s0, v[7:8]
	s_waitcnt vmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_or_b32_e32 v8, v10, v8
	v_or_b32_e32 v7, v9, v7
	global_store_b64 v[5:6], v[7:8], off
.LBB6_8:                                ;   in Loop: Header=BB6_6 Depth=1
	s_cmp_gt_i32 s7, -2
	s_cselect_b32 s9, -1, 0
	s_add_i32 s8, s7, 1
	s_and_b32 s9, s1, s9
	s_cmp_lt_i32 s8, s6
	s_cselect_b32 s12, -1, 0
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s9, s9, s12
	s_and_not1_b32 vcc_lo, exec_lo, s9
	s_cbranch_vccnz .LBB6_10
; %bb.9:                                ;   in Loop: Header=BB6_6 Depth=1
	v_ashrrev_i32_e32 v3, 31, v2
	v_add_nc_u32_e32 v5, s7, v4
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_lshlrev_b64 v[7:8], 3, v[2:3]
	v_ashrrev_i32_e32 v6, 31, v5
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_lshlrev_b64 v[5:6], 3, v[5:6]
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v7, vcc_lo, v0, v7
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_ci_u32_e32 v8, vcc_lo, v1, v8, vcc_lo
	v_add_co_u32 v5, vcc_lo, s3, v5
	flat_load_b64 v[7:8], v[7:8]
	v_add_co_ci_u32_e32 v6, vcc_lo, s4, v6, vcc_lo
	global_load_b64 v[9:10], v[5:6], off
	s_waitcnt vmcnt(1) lgkmcnt(0)
	v_lshlrev_b64 v[7:8], s2, v[7:8]
	s_waitcnt vmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_or_b32_e32 v8, v10, v8
	v_or_b32_e32 v7, v9, v7
	global_store_b64 v[5:6], v[7:8], off
.LBB6_10:                               ;   in Loop: Header=BB6_6 Depth=1
	v_add_nc_u32_e32 v2, 1, v2
	s_add_i32 s5, s5, -1
	s_mov_b32 s7, s8
	s_cmp_lg_u32 s5, 0
	s_cbranch_scc1 .LBB6_6
.LBB6_11:                               ; %.loopexit
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z10calc_unioniiiPKiPKyiiiiPcPy
		.amdhsa_group_segment_fixed_size 16
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 320
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 11
		.amdhsa_next_free_sgpr 22
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end6:
	.size	_Z10calc_unioniiiPKiPKyiiiiPcPy, .Lfunc_end6-_Z10calc_unioniiiPKiPKyiiiiPcPy
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 876
; NumSgprs: 24
; NumVgprs: 11
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 16 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 24
; NumVGPRsForWavesPerEU: 11
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgpu_metadata
---
amdhsa.kernels:
  - .args:
      - .offset:         0
        .size:           4
        .value_kind:     by_value
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .offset:         16
        .size:           4
        .value_kind:     by_value
      - .offset:         20
        .size:           4
        .value_kind:     by_value
      - .offset:         24
        .size:           4
        .value_kind:     by_value
      - .offset:         28
        .size:           4
        .value_kind:     by_value
      - .address_space:  global
        .offset:         32
        .size:           8
        .value_kind:     global_buffer
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         44
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         48
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         52
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         54
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         56
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         58
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         60
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         62
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         96
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         104
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 296
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z12calc_one_vixiPKtiiiiPh
    .private_segment_fixed_size: 0
    .sgpr_count:     23
    .sgpr_spill_count: 0
    .symbol:         _Z12calc_one_vixiPKtiiiiPh.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     26
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .offset:         0
        .size:           4
        .value_kind:     by_value
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .offset:         16
        .size:           4
        .value_kind:     by_value
      - .offset:         20
        .size:           4
        .value_kind:     by_value
      - .offset:         24
        .size:           4
        .value_kind:     by_value
      - .address_space:  global
        .offset:         32
        .size:           8
        .value_kind:     global_buffer
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         44
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         48
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         52
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         54
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         56
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         58
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         60
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         62
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         96
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         104
        .size:           2
        .value_kind:     hidden_grid_dims
      - .offset:         160
        .size:           4
        .value_kind:     hidden_dynamic_lds_size
    .group_segment_fixed_size: 16
    .kernarg_segment_align: 8
    .kernarg_segment_size: 296
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z17process_one_blockiPhfiiPi
    .private_segment_fixed_size: 0
    .sgpr_count:     25
    .sgpr_spill_count: 0
    .symbol:         _Z17process_one_blockiPhfiiPi.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     21
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .offset:         0
        .size:           4
        .value_kind:     by_value
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .offset:         16
        .size:           4
        .value_kind:     by_value
      - .offset:         20
        .size:           4
        .value_kind:     by_value
      - .offset:         24
        .size:           4
        .value_kind:     by_value
      - .offset:         28
        .size:           4
        .value_kind:     by_value
      - .address_space:  global
        .offset:         32
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         40
        .size:           8
        .value_kind:     global_buffer
      - .offset:         48
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         52
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         56
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         60
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         62
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         64
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         66
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         68
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         70
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         96
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         104
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         112
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 12
    .kernarg_segment_align: 8
    .kernarg_segment_size: 304
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z13calc_one_shediPKtiiiiPKiPy
    .private_segment_fixed_size: 0
    .sgpr_count:     32
    .sgpr_spill_count: 0
    .symbol:         _Z13calc_one_shediPKtiiiiPKiPy.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     19
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .offset:         0
        .size:           4
        .value_kind:     by_value
      - .offset:         4
        .size:           4
        .value_kind:     by_value
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         24
        .size:           8
        .value_kind:     global_buffer
      - .offset:         32
        .size:           4
        .value_kind:     by_value
      - .offset:         36
        .size:           4
        .value_kind:     by_value
      - .offset:         40
        .size:           4
        .value_kind:     by_value
      - .address_space:  global
        .offset:         48
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         56
        .size:           8
        .value_kind:     global_buffer
      - .offset:         64
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         68
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         72
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         76
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         78
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         80
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         82
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         84
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         86
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         104
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         112
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         120
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         128
        .size:           2
        .value_kind:     hidden_grid_dims
      - .offset:         184
        .size:           4
        .value_kind:     hidden_dynamic_lds_size
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 320
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z15calc_extra_areaiiPKiS0_PKyiiiS2_Pi
    .private_segment_fixed_size: 0
    .sgpr_count:     32
    .sgpr_spill_count: 0
    .symbol:         _Z15calc_extra_areaiiPKiS0_PKyiiiS2_Pi.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     14
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .offset:         0
        .size:           4
        .value_kind:     by_value
      - .offset:         4
        .size:           4
        .value_kind:     by_value
      - .offset:         8
        .size:           4
        .value_kind:     by_value
      - .offset:         12
        .size:           4
        .value_kind:     by_value
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         24
        .size:           8
        .value_kind:     global_buffer
      - .offset:         32
        .size:           4
        .value_kind:     by_value
      - .offset:         36
        .size:           4
        .value_kind:     by_value
      - .offset:         40
        .size:           4
        .value_kind:     by_value
      - .offset:         44
        .size:           4
        .value_kind:     by_value
      - .address_space:  global
        .offset:         48
        .size:           8
        .value_kind:     global_buffer
      - .offset:         56
        .size:           4
        .value_kind:     by_value
      - .offset:         60
        .size:           4
        .value_kind:     by_value
      - .offset:         64
        .size:           4
        .value_kind:     by_value
      - .address_space:  global
        .offset:         72
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         80
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         88
        .size:           8
        .value_kind:     global_buffer
      - .offset:         96
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         100
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         104
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         108
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         110
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         112
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         114
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         116
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         118
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         136
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         144
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         152
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         160
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 352
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z10union_areaiiiiPKiPKyiiiiPKciiiS2_PiS5_
    .private_segment_fixed_size: 0
    .sgpr_count:     27
    .sgpr_spill_count: 0
    .symbol:         _Z10union_areaiiiiPKiPKyiiiiPKciiiS2_PiS5_.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     9
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .offset:         0
        .size:           4
        .value_kind:     by_value
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         24
        .size:           8
        .value_kind:     global_buffer
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         36
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         44
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         46
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         48
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         50
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         52
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         54
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         96
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 2048
    .kernarg_segment_align: 8
    .kernarg_segment_size: 288
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z10findtopobsiPKcPKiPi
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z10findtopobsiPKcPKiPi.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     10
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .offset:         0
        .size:           4
        .value_kind:     by_value
      - .offset:         4
        .size:           4
        .value_kind:     by_value
      - .offset:         8
        .size:           4
        .value_kind:     by_value
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         24
        .size:           8
        .value_kind:     global_buffer
      - .offset:         32
        .size:           4
        .value_kind:     by_value
      - .offset:         36
        .size:           4
        .value_kind:     by_value
      - .offset:         40
        .size:           4
        .value_kind:     by_value
      - .offset:         44
        .size:           4
        .value_kind:     by_value
      - .address_space:  global
        .offset:         48
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         56
        .size:           8
        .value_kind:     global_buffer
      - .offset:         64
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         68
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         72
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         76
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         78
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         80
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         82
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         84
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         86
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         104
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         112
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         120
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         128
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 16
    .kernarg_segment_align: 8
    .kernarg_segment_size: 320
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z10calc_unioniiiPKiPKyiiiiPcPy
    .private_segment_fixed_size: 0
    .sgpr_count:     24
    .sgpr_spill_count: 0
    .symbol:         _Z10calc_unioniiiPKiPKyiiiiPcPy.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     11
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
