#include <assert.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

#define BLOCK_SIZE 512
#define MAX_POINTS 100000000 // 100M points
#define MAX_MEANS 1000
#define MAX_ITER 30

// CUDA prefers struct-of-arrays style here (for cache purposes)
typedef struct {
  double *x, *y;
  int *membership;
} points;

typedef struct {
  double *x, *y;
} centroids;

typedef struct {
  double *x_sum, *y_sum;
  int *size;
} temp_centroids;

// algorithm termination flag
__managed__ int assignment_changed = 1;

// reads n data points from input file
__host__ void read_data(int n, char *file_name, points P) {
  unsigned int i = 0;
  double x, y;
  FILE *file = fopen(file_name, "r");
  assert(file != NULL);

  while (!feof(file) && i < n) {
    if (fscanf(file, "%lf %lf", &x, &y) != 2)
      break;
    P.x[i] = x;
    P.y[i] = y;
    P.membership[i++] = -1;
  }
}

// selects k centers at random from n points
__host__ void init_centers(int n, int k, points P, centroids C) {
  srand(time(NULL));
  for (int i = 0; i < k; ++i) {
    // not actually uniform random sampling, but very close
    int rand_idx = rand() % n;
    C.x[i] = P.x[rand_idx];
    C.y[i] = P.y[rand_idx];
  }
}

// computes ||p-c||^2 for a point p and center c
__device__ inline double norm_2D_sqr(double x1, double y1,
                                     double x2, double y2) {
  // sqrt is monotonic, so we may omit it in the distance calculation
  // i.e. application of sqrt does not change the order of distances
  return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
}

// assign each point to the cluster given by the closest centroid
// NVIDIA suggests const and restrict here to improve compiler optimization
__global__ void
assign_clusters(int n, int k,
                const double *__restrict__ Px,
                const double *__restrict__ Py,
                int *__restrict__ Pmembership,
                double *__restrict__ Cx,
                double *__restrict__ Cy,
                double *__restrict__ Ox_sum,
                double *__restrict__ Oy_sum,
                int *__restrict__ Osize) {
  int index = blockIdx.x * blockDim.x + threadIdx.x;
  int tid = threadIdx.x;

  // thread-local values that will be reduced
  __shared__ double x_sum[BLOCK_SIZE];
  __shared__ double y_sum[BLOCK_SIZE];
  __shared__ int size[BLOCK_SIZE];

  int membership = -1;

  if (index < n) {
    double min_dist = INFINITY;
    for (int i = 0; i < k; ++i) {
      double current_dist = norm_2D_sqr(Px[index], Py[index], Cx[i], Cy[i]);
      if (current_dist < min_dist) {
        min_dist = current_dist;
        membership = i;
      }
    }

    // arbitrary concurrent write is valid since all
    // threads write the same value
    if (membership != Pmembership[index])
      assignment_changed = 1;
    Pmembership[index] = membership;
  }
  __syncthreads();

  // k reductions (one per centroid)
  for (int c = 0; c < k; ++c) {
    x_sum[tid] = (membership == c) ? Px[index] : 0;
    y_sum[tid] = (membership == c) ? Py[index] : 0;
    size[tid] = (membership == c) ? 1 : 0;
    __syncthreads();

    // reduce block's sums into one value (in thread 0)
    for (int offset = BLOCK_SIZE >> 1; offset > 0; offset >>= 1) {
      if (tid < offset) {
        x_sum[tid] += x_sum[tid + offset];
        y_sum[tid] += y_sum[tid + offset];
        size[tid] += size[tid + offset];
      }
      __syncthreads();
    }

    // save block's sums to output arrays
    if (tid == 0) {
      Ox_sum[blockIdx.x * k + c] = x_sum[tid];
      Oy_sum[blockIdx.x * k + c] = y_sum[tid];
      Osize[blockIdx.x * k + c] = size[tid];
    }
    __syncthreads();
  }
}

// reduce temporary cluster sizes and centroid x/y sums to smaller arrays
__global__ void
reduce_temp_clusters(int n, int k,
                     const double *__restrict__ Ix_sum,
                     const double *__restrict__ Iy_sum,
                     const int *__restrict__ Isize,
                     double *__restrict__ Ox_sum,
                     double *__restrict__ Oy_sum,
                     int *__restrict__ Osize) {
  int index = blockIdx.x * blockDim.x + threadIdx.x;
  int stride = blockDim.x * gridDim.x;
  int tid = threadIdx.x;

  // thread-local values that will be reduced
  __shared__ double x_sum[BLOCK_SIZE];
  __shared__ double y_sum[BLOCK_SIZE];
  __shared__ int size[BLOCK_SIZE];

  for (int c = 0; c < k; ++c) {
    x_sum[tid] = 0;
    y_sum[tid] = 0;
    size[tid] = 0;

    // if necessary, sum multiple items per thread
    for (int b = index; b < n; b += stride) {
      x_sum[tid] += Ix_sum[b * k + c];
      y_sum[tid] += Iy_sum[b * k + c];
      size[tid] += Isize[b * k + c];
    }
    __syncthreads();

    // reduce block's sums into one value (in thread 0)
    for (int offset = BLOCK_SIZE >> 1; offset > 0; offset >>= 1) {
      if (tid < offset) {
        x_sum[tid] += x_sum[tid + offset];
        y_sum[tid] += y_sum[tid + offset];
        size[tid] += size[tid + offset];
      }
      __syncthreads();
    }

    // save block's sums to output arrays
    if (tid == 0) {
      Ox_sum[blockIdx.x * k + c] = x_sum[tid];
      Oy_sum[blockIdx.x * k + c] = y_sum[tid];
      Osize[blockIdx.x * k + c] = size[tid];
    }
    __syncthreads();
  }
}

// update cluster centroid positions
__global__ void update_clusters(int n, int k,
                                double *__restrict__ Cx,
                                double *__restrict__ Cy,
                                const double *__restrict__ Ix_sum,
                                const double *__restrict__ Iy_sum,
                                const int *__restrict__ Isize) {
  int index = blockIdx.x * blockDim.x + threadIdx.x;

  if (index < k && Isize[index]) {
    Cx[index] = Ix_sum[index] / Isize[index];
    Cy[index] = Iy_sum[index] / Isize[index];
  }
}

/*
 *  prints results and performance where
 *    k = number of clusters (means)
 *    n = number of points (in 2D)
 *    h = number of iterations until convergence
 *    t = elapsed time (in seconds)
 *
 *    P contains the input points
 *    C contains the final cluster centroids
 *    T contains (in part) the final cluster sizes
 */
__host__ void print_results(int k, int n, int h, double t,
                            points P, centroids C, temp_centroids T) {
  printf("performed %d iterations in %.2f s, perf: %.2f billion\n", h, t,
         (double)k * n * h / t * 1e-9);

  double *xs = (double *)malloc(sizeof(double) * n);
  double *ys = (double *)malloc(sizeof(double) * n);
  int offsets[k + 1];

  offsets[0] = 0;
  for (int i = 0; i < k; ++i) {
    offsets[i + 1] = offsets[i] + T.size[i];
  }

  // pack permutation of input points into clusters in a single pass by using
  // prefix-sum on the cluster sizes as offsets into our output arrays
  for (int i = 0; i < n; ++i) {
    int m = P.membership[i];
    xs[offsets[m]] = P.x[i];
    ys[offsets[m]++] = P.y[i];
  }

  for (int c = 0; c < k; ++c) {
    printf("=====cluster %d centered at %lf %lf has size %d=====\n", c, C.x[c],
           C.y[c], T.size[c]);
    for (int i = offsets[c] - T.size[c]; i < offsets[c]; ++i) {
      printf("%lf %lf\n", xs[i], ys[i]);
    }
  }

  free(xs);
  free(ys);
}

int main(int argc, char **argv) {
  int k, n, h;
  char *file_name;
  points P;
  centroids C;
  temp_centroids T1;
  temp_centroids T2;
  cudaEvent_t start, stop;
  float time;

  // read in number of points and means
  assert(argc >= 4);
  n = atoi(argv[1]);
  k = atoi(argv[2]);
  file_name = argv[3];
  assert(n <= MAX_POINTS && k <= MAX_MEANS);

  int blockSize = BLOCK_SIZE;
  int numBlocks = (n + blockSize - 1) / blockSize;
  int reductionBlockSize = BLOCK_SIZE;
  int reductionNumBlocks =
      (numBlocks + reductionBlockSize - 1) / reductionBlockSize;

  // make sure that we can support the number of points with our two block
  // reductions. with BLOCK_SIZE = 512, this limit is ~250M points
  assert(reductionNumBlocks <= 1024);

  // malloc memory and set up GPU timers
  cudaMallocManaged(&P.x, sizeof(double) * n);
  cudaMallocManaged(&P.y, sizeof(double) * n);
  cudaMallocManaged(&P.membership, sizeof(int) * n);
  cudaMallocManaged(&C.x, sizeof(double) * k);
  cudaMallocManaged(&C.y, sizeof(double) * k);
  cudaMallocManaged(&T1.x_sum, sizeof(double) * numBlocks * k);
  cudaMallocManaged(&T1.y_sum, sizeof(double) * numBlocks * k);
  cudaMallocManaged(&T1.size, sizeof(int) * numBlocks * k);
  cudaMallocManaged(&T2.x_sum, sizeof(double) * reductionNumBlocks * k);
  cudaMallocManaged(&T2.y_sum, sizeof(double) * reductionNumBlocks * k);
  cudaMallocManaged(&T2.size, sizeof(int) * reductionNumBlocks * k);
  cudaEventCreate(&start);
  cudaEventCreate(&stop);

  read_data(n, file_name, P);
  init_centers(n, k, P, C);

  cudaEventRecord(start, 0);
  for (h = 0; assignment_changed && h < MAX_ITER; ++h) {
    // assign points to nearest clusters
    assignment_changed = 0;
    assign_clusters<<<numBlocks, blockSize>>>
      (n, k,
       P.x, P.y, P.membership,
       C.x, C.y,
       T1.x_sum, T1.y_sum, T1.size);
    cudaDeviceSynchronize();

    // two block reductions of cluster sizes and centroid x/y sums
    reduce_temp_clusters<<<reductionNumBlocks, reductionBlockSize>>>
      (numBlocks, k,
       T1.x_sum, T1.y_sum, T1.size,  // input values to reduce
       T2.x_sum, T2.y_sum, T2.size); // reduced output values
    cudaDeviceSynchronize();
    reduce_temp_clusters<<<1, reductionBlockSize>>>
      (reductionNumBlocks, k,
       T2.x_sum, T2.y_sum, T2.size,  // reduce values from T2
       T1.x_sum, T1.y_sum, T1.size); // back into T1
    cudaDeviceSynchronize();

    // update centroid positions
    update_clusters<<<1, k>>>
      (n, k,
       C.x, C.y,
       T1.x_sum, T1.y_sum, T1.size);
    cudaDeviceSynchronize();
  }

  cudaEventRecord(stop, 0);
  cudaEventSynchronize(stop);
  cudaEventElapsedTime(&time, start, stop);
  cudaEventDestroy(start);
  cudaEventDestroy(stop);

  print_results(k, n, h, time * 1e-3, P, C, T1);

  // CUDA automatically frees and resets device on program exit
}

	.file	"tmpxft_00362bd9_00000000-6_kmeans_gpu.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL20__nv_init_managed_rtv, @function
_ZL20__nv_init_managed_rtv:
.LFB1:
	.cfi_startproc
	movb	_ZL22__nv_inited_managed_rt(%rip), %al
	testb	%al, %al
	jne	.L4
	pushq	%rax
	.cfi_def_cfa_offset 16
	movq	_ZL32__nv_fatbinhandle_for_managed_rt(%rip), %rdi
	call	__cudaInitModule@PLT
	movb	%al, _ZL22__nv_inited_managed_rt(%rip)
	popq	%rdx
	.cfi_def_cfa_offset 8
	ret
.L4:
	movb	%al, _ZL22__nv_inited_managed_rt(%rip)
	ret
	.cfi_endproc
.LFE1:
	.size	_ZL20__nv_init_managed_rtv, .-_ZL20__nv_init_managed_rtv
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2034:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2034:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.type	_Z17cudaMallocManagedIdE9cudaErrorPPT_mj.constprop.0.isra.0, @function
_Z17cudaMallocManagedIdE9cudaErrorPPT_mj.constprop.0.isra.0:
.LFB2182:
	.cfi_startproc
	movl	$1, %edx
	jmp	cudaMallocManaged@PLT
	.cfi_endproc
.LFE2182:
	.size	_Z17cudaMallocManagedIdE9cudaErrorPPT_mj.constprop.0.isra.0, .-_Z17cudaMallocManagedIdE9cudaErrorPPT_mj.constprop.0.isra.0
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"r"
.LC1:
	.string	"%lf %lf"
	.text
	.globl	_Z9read_dataiPc6points
	.type	_Z9read_dataiPc6points, @function
_Z9read_dataiPc6points:
.LFB2027:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC1(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movl	%edi, %ebx
	movq	%rsi, %rdi
	leaq	.LC0(%rip), %rsi
	leaq	0(,%rbx,4), %rbp
	xorl	%ebx, %ebx
	subq	$40, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	call	fopen@PLT
	movq	%rax, %r12
.L11:
	movq	%r12, %rdi
	call	feof@PLT
	testl	%eax, %eax
	jne	.L10
	cmpq	%rbp, %rbx
	je	.L10
	leaq	16(%rsp), %rcx
	leaq	8(%rsp), %rdx
	movq	%r13, %rsi
	movq	%r12, %rdi
	call	__isoc23_fscanf@PLT
	cmpl	$2, %eax
	jne	.L10
	movq	80(%rsp), %rdx
	movsd	8(%rsp), %xmm0
	leaq	(%rbx,%rbx), %rax
	movsd	%xmm0, (%rdx,%rax)
	movq	88(%rsp), %rdx
	movsd	16(%rsp), %xmm0
	movsd	%xmm0, (%rdx,%rax)
	movq	96(%rsp), %rax
	movl	$-1, (%rax,%rbx)
	addq	$4, %rbx
	jmp	.L11
.L10:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	addq	$40, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2027:
	.size	_Z9read_dataiPc6points, .-_Z9read_dataiPc6points
	.globl	_Z12init_centersii6points9centroids
	.type	_Z12init_centersii6points9centroids, @function
_Z12init_centersii6points9centroids:
.LFB2028:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	movq	%rcx, %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	movq	%rdx, %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	movl	%esi, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	movl	%edi, %ebp
	xorl	%edi, %edi
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	xorl	%ebx, %ebx
	call	time@PLT
	movl	%eax, %edi
	call	srand@PLT
.L19:
	cmpl	%ebx, %r12d
	jle	.L22
	call	rand@PLT
	movq	48(%rsp), %rcx
	cltd
	idivl	%ebp
	leaq	0(,%rbx,8), %rax
	incq	%rbx
	movslq	%edx, %rdx
	movsd	(%rcx,%rdx,8), %xmm0
	movq	56(%rsp), %rcx
	movsd	%xmm0, (%rax,%r13)
	movsd	(%rcx,%rdx,8), %xmm0
	movsd	%xmm0, (%rax,%r14)
	jmp	.L19
.L22:
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2028:
	.size	_Z12init_centersii6points9centroids, .-_Z12init_centersii6points9centroids
	.section	.rodata.str1.1
.LC3:
	.string	"performed %d iterations in %.2f s, perf: %.2f billion\n"
.LC4:
	.string	"=====cluster %d centered at %lf %lf has size %d=====\n"
.LC5:
	.string	"%lf %lf\n"
	.text
	.globl	_Z13print_resultsiiid6points9centroids14temp_centroids
	.type	_Z13print_resultsiiid6points9centroids14temp_centroids, @function
_Z13print_resultsiiid6points9centroids14temp_centroids:
.LFB2030:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	cvtsi2sdl	%edi, %xmm1
	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
	movslq	%esi, %r12
	leaq	.LC3(%rip), %rsi
	cvtsi2sdl	%r12d, %xmm2
	pushq	%rbx
	movq	%r12, %r14
	.cfi_offset 3, -56
	movl	%edi, %ebx
	salq	$3, %r12
	movl	$2, %edi
	subq	$72, %rsp
	movq	%rcx, -72(%rbp)
	movq	56(%rbp), %r15
	mulsd	%xmm2, %xmm1
	cvtsi2sdl	%edx, %xmm2
	movq	%r8, -80(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movb	$2, %al
	mulsd	%xmm2, %xmm1
	divsd	%xmm0, %xmm1
	mulsd	.LC2(%rip), %xmm1
	call	__printf_chk@PLT
	movq	%r12, %rdi
	call	malloc@PLT
	movq	%r12, %rdi
	movq	%rax, %r13
	call	malloc@PLT
	movq	%rsp, %rcx
	movq	%rax, %r12
	leal	1(%rbx), %eax
	cltq
	leaq	15(,%rax,4), %rdx
	movq	%rdx, %rax
	andq	$-4096, %rdx
	andq	$-16, %rax
	subq	%rdx, %rcx
.L24:
	cmpq	%rcx, %rsp
	je	.L25
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L24
.L25:
	andl	$4095, %eax
	subq	%rax, %rsp
	testq	%rax, %rax
	je	.L26
	orq	$0, -8(%rsp,%rax)
.L26:
	leaq	3(%rsp), %r9
	xorl	%edx, %edx
	movq	%r9, %rax
	andq	$-4, %r9
	shrq	$2, %rax
	movl	%edx, 0(,%rax,4)
	xorl	%eax, %eax
.L27:
	cmpl	%eax, %ebx
	jle	.L40
	movl	(%r15,%rax,4), %edx
	addl	(%r9,%rax,4), %edx
	movl	%edx, 4(%r9,%rax,4)
	incq	%rax
	jmp	.L27
.L40:
	movq	32(%rbp), %rdi
	movq	16(%rbp), %r8
	xorl	%eax, %eax
	movq	24(%rbp), %r11
.L29:
	cmpl	%eax, %r14d
	jle	.L41
	movslq	(%rdi,%rax,4), %rsi
	movsd	(%r8,%rax,8), %xmm0
	movslq	(%r9,%rsi,4), %rcx
	movq	%rcx, %rdx
	movsd	%xmm0, 0(%r13,%rcx,8)
	movsd	(%r11,%rax,8), %xmm0
	incq	%rax
	incl	%edx
	movl	%edx, (%r9,%rsi,4)
	movsd	%xmm0, (%r12,%rcx,8)
	jmp	.L29
.L41:
	xorl	%r14d, %r14d
.L31:
	movl	%r14d, %edx
	cmpl	%r14d, %ebx
	jle	.L42
	movq	-80(%rbp), %rsi
	movq	-72(%rbp), %rdi
	leaq	0(,%r14,8), %rax
	movq	%r9, -88(%rbp)
	movl	(%r15,%r14,4), %ecx
	movsd	(%rax,%rsi), %xmm1
	movsd	(%rax,%rdi), %xmm0
	movb	$2, %al
	leaq	.LC4(%rip), %rsi
	movl	$2, %edi
	call	__printf_chk@PLT
	movq	-88(%rbp), %r9
	movl	(%r9,%r14,4), %ecx
	movl	%ecx, %edx
	subl	(%r15,%r14,4), %edx
	movslq	%edx, %rdx
.L32:
	cmpl	%edx, %ecx
	jle	.L43
	movsd	(%r12,%rdx,8), %xmm1
	movl	$2, %edi
	movb	$2, %al
	movl	%ecx, -92(%rbp)
	movsd	0(%r13,%rdx,8), %xmm0
	leaq	.LC5(%rip), %rsi
	movq	%r9, -104(%rbp)
	movq	%rdx, -88(%rbp)
	call	__printf_chk@PLT
	movq	-88(%rbp), %rdx
	movq	-104(%rbp), %r9
	movl	-92(%rbp), %ecx
	incq	%rdx
	jmp	.L32
.L43:
	incq	%r14
	jmp	.L31
.L42:
	movq	%r13, %rdi
	call	free@PLT
	movq	%r12, %rdi
	call	free@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	je	.L35
	call	__stack_chk_fail@PLT
.L35:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2030:
	.size	_Z13print_resultsiiid6points9centroids14temp_centroids, .-_Z13print_resultsiiid6points9centroids14temp_centroids
	.globl	_Z57__device_stub__Z15assign_clustersiiPKdS0_PiPdS2_S2_S2_S1_iiPKdS0_PiPdS2_S2_S2_S1_
	.type	_Z57__device_stub__Z15assign_clustersiiPKdS0_PiPdS2_S2_S2_S1_iiPKdS0_PiPdS2_S2_S2_S1_, @function
_Z57__device_stub__Z15assign_clustersiiPKdS0_PiPdS2_S2_S2_S1_iiPKdS0_PiPdS2_S2_S2_S1_:
.LFB2056:
	.cfi_startproc
	endbr64
	subq	$248, %rsp
	.cfi_def_cfa_offset 256
	movl	%edi, 12(%rsp)
	leaq	104(%rsp), %rdi
	movl	%esi, 8(%rsp)
	leaq	116(%rsp), %rsi
	movq	%fs:40, %rax
	movq	%rax, 232(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rax
	movq	%rdx, 24(%rsp)
	leaq	88(%rsp), %rdx
	movq	%rax, 152(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 160(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 168(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 176(%rsp)
	leaq	40(%rsp), %rax
	movq	%rax, 184(%rsp)
	leaq	48(%rsp), %rax
	movq	%rax, 192(%rsp)
	movq	256(%rsp), %rax
	movq	%rcx, 32(%rsp)
	leaq	96(%rsp), %rcx
	movq	%rax, 56(%rsp)
	leaq	56(%rsp), %rax
	movq	%rax, 200(%rsp)
	movq	264(%rsp), %rax
	movq	%r8, 40(%rsp)
	movq	%rax, 64(%rsp)
	leaq	64(%rsp), %rax
	movq	%rax, 208(%rsp)
	movq	272(%rsp), %rax
	movq	%r9, 48(%rsp)
	movq	%rax, 72(%rsp)
	leaq	72(%rsp), %rax
	movq	%rax, 216(%rsp)
	movq	280(%rsp), %rax
	movl	$1, 112(%rsp)
	movq	%rax, 80(%rsp)
	leaq	80(%rsp), %rax
	movq	%rax, 224(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 104(%rsp)
	movq	%rax, 116(%rsp)
	movl	$1, 124(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L44
	pushq	96(%rsp)
	.cfi_def_cfa_offset 264
	leaq	_Z15assign_clustersiiPKdS0_PiPdS2_S2_S2_S1_(%rip), %rdi
	pushq	96(%rsp)
	.cfi_def_cfa_offset 272
	movq	132(%rsp), %rcx
	movl	140(%rsp), %r8d
	movq	120(%rsp), %rsi
	movl	128(%rsp), %edx
	leaq	168(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 264
	popq	%rdx
	.cfi_def_cfa_offset 256
.L44:
	movq	232(%rsp), %rax
	subq	%fs:40, %rax
	je	.L46
	call	__stack_chk_fail@PLT
.L46:
	addq	$248, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2056:
	.size	_Z57__device_stub__Z15assign_clustersiiPKdS0_PiPdS2_S2_S2_S1_iiPKdS0_PiPdS2_S2_S2_S1_, .-_Z57__device_stub__Z15assign_clustersiiPKdS0_PiPdS2_S2_S2_S1_iiPKdS0_PiPdS2_S2_S2_S1_
	.globl	_Z15assign_clustersiiPKdS0_PiPdS2_S2_S2_S1_
	.type	_Z15assign_clustersiiPKdS0_PiPdS2_S2_S2_S1_, @function
_Z15assign_clustersiiPKdS0_PiPdS2_S2_S2_S1_:
.LFB2057:
	.cfi_startproc
	endbr64
	jmp	_Z57__device_stub__Z15assign_clustersiiPKdS0_PiPdS2_S2_S2_S1_iiPKdS0_PiPdS2_S2_S2_S1_
	.cfi_endproc
.LFE2057:
	.size	_Z15assign_clustersiiPKdS0_PiPdS2_S2_S2_S1_, .-_Z15assign_clustersiiPKdS0_PiPdS2_S2_S2_S1_
	.globl	_Z56__device_stub__Z20reduce_temp_clustersiiPKdS0_PKiPdS3_PiiiPKdS0_PKiPdS3_Pi
	.type	_Z56__device_stub__Z20reduce_temp_clustersiiPKdS0_PKiPdS3_PiiiPKdS0_PKiPdS3_Pi, @function
_Z56__device_stub__Z20reduce_temp_clustersiiPKdS0_PKiPdS3_PiiiPKdS0_PKiPdS3_Pi:
.LFB2058:
	.cfi_startproc
	endbr64
	subq	$216, %rsp
	.cfi_def_cfa_offset 224
	movl	%edi, 12(%rsp)
	leaq	88(%rsp), %rdi
	movl	%esi, 8(%rsp)
	leaq	100(%rsp), %rsi
	movq	%fs:40, %rax
	movq	%rax, 200(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rax
	movq	%rdx, 24(%rsp)
	leaq	72(%rsp), %rdx
	movq	%rax, 136(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 144(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 152(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 160(%rsp)
	leaq	40(%rsp), %rax
	movq	%rax, 168(%rsp)
	leaq	48(%rsp), %rax
	movq	%rax, 176(%rsp)
	movq	224(%rsp), %rax
	movq	%rcx, 32(%rsp)
	leaq	80(%rsp), %rcx
	movq	%rax, 56(%rsp)
	leaq	56(%rsp), %rax
	movq	%rax, 184(%rsp)
	movq	232(%rsp), %rax
	movq	%r8, 40(%rsp)
	movq	%rax, 64(%rsp)
	leaq	64(%rsp), %rax
	movq	%rax, 192(%rsp)
	movabsq	$4294967297, %rax
	movq	%r9, 48(%rsp)
	movq	%rax, 88(%rsp)
	movl	$1, 96(%rsp)
	movq	%rax, 100(%rsp)
	movl	$1, 108(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L49
	pushq	80(%rsp)
	.cfi_def_cfa_offset 232
	leaq	_Z20reduce_temp_clustersiiPKdS0_PKiPdS3_Pi(%rip), %rdi
	pushq	80(%rsp)
	.cfi_def_cfa_offset 240
	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 232
	popq	%rdx
	.cfi_def_cfa_offset 224
.L49:
	movq	200(%rsp), %rax
	subq	%fs:40, %rax
	je	.L51
	call	__stack_chk_fail@PLT
.L51:
	addq	$216, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2058:
	.size	_Z56__device_stub__Z20reduce_temp_clustersiiPKdS0_PKiPdS3_PiiiPKdS0_PKiPdS3_Pi, .-_Z56__device_stub__Z20reduce_temp_clustersiiPKdS0_PKiPdS3_PiiiPKdS0_PKiPdS3_Pi
	.globl	_Z20reduce_temp_clustersiiPKdS0_PKiPdS3_Pi
	.type	_Z20reduce_temp_clustersiiPKdS0_PKiPdS3_Pi, @function
_Z20reduce_temp_clustersiiPKdS0_PKiPdS3_Pi:
.LFB2059:
	.cfi_startproc
	endbr64
	jmp	_Z56__device_stub__Z20reduce_temp_clustersiiPKdS0_PKiPdS3_PiiiPKdS0_PKiPdS3_Pi
	.cfi_endproc
.LFE2059:
	.size	_Z20reduce_temp_clustersiiPKdS0_PKiPdS3_Pi, .-_Z20reduce_temp_clustersiiPKdS0_PKiPdS3_Pi
	.globl	_Z48__device_stub__Z15update_clustersiiPdS_PKdS1_PKiiiPdS_PKdS1_PKi
	.type	_Z48__device_stub__Z15update_clustersiiPdS_PKdS1_PKiiiPdS_PKdS1_PKi, @function
_Z48__device_stub__Z15update_clustersiiPdS_PKdS1_PKiiiPdS_PKdS1_PKi:
.LFB2060:
	.cfi_startproc
	endbr64
	subq	$200, %rsp
	.cfi_def_cfa_offset 208
	movl	%edi, 12(%rsp)
	leaq	80(%rsp), %rdi
	movl	%esi, 8(%rsp)
	leaq	92(%rsp), %rsi
	movq	%fs:40, %rax
	movq	%rax, 184(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rax
	movq	%rdx, 24(%rsp)
	leaq	64(%rsp), %rdx
	movq	%rax, 128(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 136(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 144(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 152(%rsp)
	leaq	40(%rsp), %rax
	movq	%rax, 160(%rsp)
	leaq	48(%rsp), %rax
	movq	%rax, 168(%rsp)
	movq	208(%rsp), %rax
	movq	%rcx, 32(%rsp)
	leaq	72(%rsp), %rcx
	movq	%rax, 56(%rsp)
	leaq	56(%rsp), %rax
	movq	%rax, 176(%rsp)
	movabsq	$4294967297, %rax
	movq	%r8, 40(%rsp)
	movq	%r9, 48(%rsp)
	movq	%rax, 80(%rsp)
	movl	$1, 88(%rsp)
	movq	%rax, 92(%rsp)
	movl	$1, 100(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L54
	pushq	72(%rsp)
	.cfi_def_cfa_offset 216
	leaq	_Z15update_clustersiiPdS_PKdS1_PKi(%rip), %rdi
	pushq	72(%rsp)
	.cfi_def_cfa_offset 224
	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 216
	popq	%rdx
	.cfi_def_cfa_offset 208
.L54:
	movq	184(%rsp), %rax
	subq	%fs:40, %rax
	je	.L56
	call	__stack_chk_fail@PLT
.L56:
	addq	$200, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2060:
	.size	_Z48__device_stub__Z15update_clustersiiPdS_PKdS1_PKiiiPdS_PKdS1_PKi, .-_Z48__device_stub__Z15update_clustersiiPdS_PKdS1_PKiiiPdS_PKdS1_PKi
	.globl	_Z15update_clustersiiPdS_PKdS1_PKi
	.type	_Z15update_clustersiiPdS_PKdS1_PKi, @function
_Z15update_clustersiiPdS_PKdS1_PKi:
.LFB2061:
	.cfi_startproc
	endbr64
	jmp	_Z48__device_stub__Z15update_clustersiiPdS_PKdS1_PKiiiPdS_PKdS1_PKi
	.cfi_endproc
.LFE2061:
	.size	_Z15update_clustersiiPdS_PKdS1_PKi, .-_Z15update_clustersiiPdS_PKdS1_PKi
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2031:
	.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
	movq	%rsi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$168, %rsp
	.cfi_def_cfa_offset 224
	movq	8(%rsi), %rdi
	movq	%fs:40, %rax
	movq	%rax, 152(%rsp)
	xorl	%eax, %eax
	call	atoi@PLT
	movq	16(%r12), %rdi
	movslq	%eax, %r14
	call	atoi@PLT
	movl	$512, %ecx
	leaq	80(%rsp), %rdi
	movq	%r14, %rbp
	movl	%eax, %ebx
	movq	24(%r12), %rax
	leaq	0(,%r14,8), %r15
	movq	%r15, %rsi
	movq	%rax, (%rsp)
	leal	511(%r14), %eax
	cltd
	idivl	%ecx
	movl	%eax, %r12d
	addl	$511, %eax
	cltd
	idivl	%ecx
	movl	%eax, %r13d
	call	_Z17cudaMallocManagedIdE9cudaErrorPPT_mj.constprop.0.isra.0
	leaq	88(%rsp), %rdi
	movq	%r15, %rsi
	movslq	%ebx, %r15
	call	_Z17cudaMallocManagedIdE9cudaErrorPPT_mj.constprop.0.isra.0
	leaq	0(,%r14,4), %rsi
	leaq	96(%rsp), %rdi
	call	_Z17cudaMallocManagedIdE9cudaErrorPPT_mj.constprop.0.isra.0
	leaq	0(,%r15,8), %r14
	leaq	64(%rsp), %rdi
	movq	%r14, %rsi
	call	_Z17cudaMallocManagedIdE9cudaErrorPPT_mj.constprop.0.isra.0
	movq	%r14, %rsi
	movslq	%r12d, %r14
	leaq	72(%rsp), %rdi
	call	_Z17cudaMallocManagedIdE9cudaErrorPPT_mj.constprop.0.isra.0
	imulq	%r15, %r14
	leaq	104(%rsp), %rdi
	leaq	0(,%r14,8), %rsi
	movq	%rsi, 8(%rsp)
	call	_Z17cudaMallocManagedIdE9cudaErrorPPT_mj.constprop.0.isra.0
	movq	8(%rsp), %rsi
	leaq	112(%rsp), %rdi
	call	_Z17cudaMallocManagedIdE9cudaErrorPPT_mj.constprop.0.isra.0
	leaq	0(,%r14,4), %rsi
	movslq	%r13d, %r14
	leaq	120(%rsp), %rdi
	call	_Z17cudaMallocManagedIdE9cudaErrorPPT_mj.constprop.0.isra.0
	imulq	%r15, %r14
	xorl	%r15d, %r15d
	leaq	128(%rsp), %rdi
	leaq	0(,%r14,8), %rsi
	movq	%rsi, 8(%rsp)
	call	_Z17cudaMallocManagedIdE9cudaErrorPPT_mj.constprop.0.isra.0
	movq	8(%rsp), %rsi
	leaq	136(%rsp), %rdi
	call	_Z17cudaMallocManagedIdE9cudaErrorPPT_mj.constprop.0.isra.0
	leaq	0(,%r14,4), %rsi
	leaq	144(%rsp), %rdi
	movabsq	$4294967808, %r14
	call	_Z17cudaMallocManagedIdE9cudaErrorPPT_mj.constprop.0.isra.0
	leaq	24(%rsp), %rdi
	call	cudaEventCreate@PLT
	leaq	32(%rsp), %rdi
	call	cudaEventCreate@PLT
	subq	$32, %rsp
	.cfi_def_cfa_offset 256
	movl	%ebp, %edi
	movups	112(%rsp), %xmm1
	movq	128(%rsp), %rax
	movq	32(%rsp), %rsi
	movups	%xmm1, (%rsp)
	movq	%rax, 16(%rsp)
	call	_Z9read_dataiPc6points
	movups	112(%rsp), %xmm2
	movl	%ebx, %esi
	movl	%ebp, %edi
	movq	128(%rsp), %rax
	movq	96(%rsp), %rdx
	movq	104(%rsp), %rcx
	movups	%xmm2, (%rsp)
	movq	%rax, 16(%rsp)
	call	_Z12init_centersii6points9centroids
	movq	56(%rsp), %rdi
	addq	$32, %rsp
	.cfi_def_cfa_offset 224
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
.L60:
	cmpb	$0, _ZL22__nv_inited_managed_rt(%rip)
	jne	.L65
	call	_ZL20__nv_init_managed_rtv
.L65:
	movq	_ZL18assignment_changed(%rip), %rax
	cmpl	$0, (%rax)
	je	.L66
	cmpl	$30, %r15d
	je	.L66
	cmpb	$0, _ZL22__nv_inited_managed_rt(%rip)
	jne	.L67
	call	_ZL20__nv_init_managed_rtv
.L67:
	movq	_ZL18assignment_changed(%rip), %rax
	xorl	%r10d, %r10d
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	%r12d, 40(%rsp)
	movq	%r14, %rdx
	movl	$1, %ecx
	movl	%r10d, (%rax)
	movabsq	$4294967297, %rax
	movq	%rax, 44(%rsp)
	movq	40(%rsp), %rdi
	movl	48(%rsp), %esi
	movq	%r14, 52(%rsp)
	movl	$1, 60(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L61
	pushq	120(%rsp)
	.cfi_def_cfa_offset 232
	movl	%ebx, %esi
	movl	%ebp, %edi
	pushq	120(%rsp)
	.cfi_def_cfa_offset 240
	pushq	120(%rsp)
	.cfi_def_cfa_offset 248
	pushq	96(%rsp)
	.cfi_def_cfa_offset 256
	movq	96(%rsp), %r9
	movq	128(%rsp), %r8
	movq	120(%rsp), %rcx
	movq	112(%rsp), %rdx
	call	_Z57__device_stub__Z15assign_clustersiiPKdS0_PiPdS2_S2_S2_S1_iiPKdS0_PiPdS2_S2_S2_S1_
	addq	$32, %rsp
	.cfi_def_cfa_offset 224
.L61:
	call	cudaDeviceSynchronize@PLT
	movl	%r13d, 40(%rsp)
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	%r14, %rdx
	movl	$1, %ecx
	movabsq	$4294967297, %rax
	movq	%r14, 52(%rsp)
	movq	%rax, 44(%rsp)
	movq	40(%rsp), %rdi
	movl	48(%rsp), %esi
	movl	$1, 60(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L62
	pushq	144(%rsp)
	.cfi_def_cfa_offset 232
	movl	%ebx, %esi
	movl	%r12d, %edi
	pushq	144(%rsp)
	.cfi_def_cfa_offset 240
	movq	144(%rsp), %r9
	movq	136(%rsp), %r8
	movq	128(%rsp), %rcx
	movq	120(%rsp), %rdx
	call	_Z56__device_stub__Z20reduce_temp_clustersiiPKdS0_PKiPdS3_PiiiPKdS0_PKiPdS3_Pi
	popq	%r8
	.cfi_def_cfa_offset 232
	popq	%r9
	.cfi_def_cfa_offset 224
.L62:
	call	cudaDeviceSynchronize@PLT
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	%r14, %rdx
	movl	$1, %ecx
	movl	$1, %esi
	movabsq	$4294967297, %rdi
	movq	%r14, 52(%rsp)
	movl	$1, 60(%rsp)
	movq	%rdi, 40(%rsp)
	movl	$1, 48(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L63
	pushq	120(%rsp)
	.cfi_def_cfa_offset 232
	movl	%ebx, %esi
	movl	%r13d, %edi
	pushq	120(%rsp)
	.cfi_def_cfa_offset 240
	movq	120(%rsp), %r9
	movq	160(%rsp), %r8
	movq	152(%rsp), %rcx
	movq	144(%rsp), %rdx
	call	_Z56__device_stub__Z20reduce_temp_clustersiiPKdS0_PKiPdS3_PiiiPKdS0_PKiPdS3_Pi
	popq	%rsi
	.cfi_def_cfa_offset 232
	popq	%rdi
	.cfi_def_cfa_offset 224
.L63:
	call	cudaDeviceSynchronize@PLT
	movl	%ebx, 52(%rsp)
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movabsq	$4294967297, %rdi
	movl	$1, %esi
	movl	$1, 48(%rsp)
	movq	%rdi, 56(%rsp)
	movl	60(%rsp), %ecx
	movq	52(%rsp), %rdx
	movq	%rdi, 40(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L64
	pushq	%rax
	.cfi_def_cfa_offset 232
	movl	%ebx, %esi
	movl	%ebp, %edi
	pushq	128(%rsp)
	.cfi_def_cfa_offset 240
	movq	128(%rsp), %r9
	movq	120(%rsp), %r8
	movq	88(%rsp), %rcx
	movq	80(%rsp), %rdx
	call	_Z48__device_stub__Z15update_clustersiiPdS_PKdS1_PKiiiPdS_PKdS1_PKi
	popq	%rdx
	.cfi_def_cfa_offset 232
	popq	%rcx
	.cfi_def_cfa_offset 224
.L64:
	call	cudaDeviceSynchronize@PLT
	incl	%r15d
	jmp	.L60
.L66:
	movq	32(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	32(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	32(%rsp), %rdx
	movq	24(%rsp), %rsi
	leaq	52(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	movq	24(%rsp), %rdi
	call	cudaEventDestroy@PLT
	movq	32(%rsp), %rdi
	call	cudaEventDestroy@PLT
	cvtss2sd	52(%rsp), %xmm0
	subq	$48, %rsp
	.cfi_def_cfa_offset 272
	movl	%r15d, %edx
	mulsd	.LC6(%rip), %xmm0
	movq	112(%rsp), %rcx
	movl	%ebp, %esi
	movl	%ebx, %edi
	movq	168(%rsp), %rax
	movups	152(%rsp), %xmm3
	movups	128(%rsp), %xmm4
	movq	120(%rsp), %r8
	movq	%rax, 40(%rsp)
	movq	144(%rsp), %rax
	movups	%xmm3, 24(%rsp)
	movq	%rax, 16(%rsp)
	movups	%xmm4, (%rsp)
	call	_Z13print_resultsiiid6points9centroids14temp_centroids
	addq	$48, %rsp
	.cfi_def_cfa_offset 224
	movq	152(%rsp), %rax
	subq	%fs:40, %rax
	je	.L69
	call	__stack_chk_fail@PLT
.L69:
	addq	$168, %rsp
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	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
.LFE2031:
	.size	main, .-main
	.section	.rodata.str1.1
.LC7:
	.string	"_Z15update_clustersiiPdS_PKdS1_PKi"
.LC8:
	.string	"_Z20reduce_temp_clustersiiPKdS0_PKiPdS3_Pi"
.LC9:
	.string	"_Z15assign_clustersiiPKdS0_PiPdS2_S2_S2_S1_"
.LC10:
	.string	"assignment_changed"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2063:
	.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	.LC7(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z15update_clustersiiPdS_PKdS1_PKi(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	movq	%rax, _ZL32__nv_fatbinhandle_for_managed_rt(%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	.LC8(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z20reduce_temp_clustersiiPKdS0_PKiPdS3_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	.LC9(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z15assign_clustersiiPKdS0_PiPdS2_S2_S2_S1_(%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	%r8d, %r8d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC10(%rip), %rdx
	movl	$4, %r9d
	leaq	_ZL18assignment_changed(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	call	__cudaRegisterManagedVar@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	popq	%rax
	.cfi_def_cfa_offset 24
	popq	%rdx
	.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
.LFE2063:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.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	__nv_managed_data__,"aw"
	.align 8
	.type	_ZL18assignment_changed, @object
	.size	_ZL18assignment_changed, 8
_ZL18assignment_changed:
	.zero	8
	.local	_ZL32__nv_fatbinhandle_for_managed_rt
	.comm	_ZL32__nv_fatbinhandle_for_managed_rt,8,8
	.local	_ZL22__nv_inited_managed_rt
	.comm	_ZL22__nv_inited_managed_rt,1,1
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC2:
	.long	-400107883
	.long	1041313291
	.align 8
.LC6:
	.long	-755914244
	.long	1062232653
	.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:


#include <hip/hip_runtime.h>
#include <assert.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

#define BLOCK_SIZE 512
#define MAX_POINTS 100000000 // 100M points
#define MAX_MEANS 1000
#define MAX_ITER 30

// CUDA prefers struct-of-arrays style here (for cache purposes)
typedef struct {
  double *x, *y;
  int *membership;
} points;

typedef struct {
  double *x, *y;
} centroids;

typedef struct {
  double *x_sum, *y_sum;
  int *size;
} temp_centroids;

// algorithm termination flag
__managed__ int assignment_changed = 1;

// reads n data points from input file
__host__ void read_data(int n, char *file_name, points P) {
  unsigned int i = 0;
  double x, y;
  FILE *file = fopen(file_name, "r");
  assert(file != NULL);

  while (!feof(file) && i < n) {
    if (fscanf(file, "%lf %lf", &x, &y) != 2)
      break;
    P.x[i] = x;
    P.y[i] = y;
    P.membership[i++] = -1;
  }
}

// selects k centers at random from n points
__host__ void init_centers(int n, int k, points P, centroids C) {
  srand(time(NULL));
  for (int i = 0; i < k; ++i) {
    // not actually uniform random sampling, but very close
    int rand_idx = rand() % n;
    C.x[i] = P.x[rand_idx];
    C.y[i] = P.y[rand_idx];
  }
}

// computes ||p-c||^2 for a point p and center c
__device__ inline double norm_2D_sqr(double x1, double y1,
                                     double x2, double y2) {
  // sqrt is monotonic, so we may omit it in the distance calculation
  // i.e. application of sqrt does not change the order of distances
  return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
}

// assign each point to the cluster given by the closest centroid
// NVIDIA suggests const and restrict here to improve compiler optimization
__global__ void
assign_clusters(int n, int k,
                const double *__restrict__ Px,
                const double *__restrict__ Py,
                int *__restrict__ Pmembership,
                double *__restrict__ Cx,
                double *__restrict__ Cy,
                double *__restrict__ Ox_sum,
                double *__restrict__ Oy_sum,
                int *__restrict__ Osize) {
  int index = blockIdx.x * blockDim.x + threadIdx.x;
  int tid = threadIdx.x;

  // thread-local values that will be reduced
  __shared__ double x_sum[BLOCK_SIZE];
  __shared__ double y_sum[BLOCK_SIZE];
  __shared__ int size[BLOCK_SIZE];

  int membership = -1;

  if (index < n) {
    double min_dist = INFINITY;
    for (int i = 0; i < k; ++i) {
      double current_dist = norm_2D_sqr(Px[index], Py[index], Cx[i], Cy[i]);
      if (current_dist < min_dist) {
        min_dist = current_dist;
        membership = i;
      }
    }

    // arbitrary concurrent write is valid since all
    // threads write the same value
    if (membership != Pmembership[index])
      assignment_changed = 1;
    Pmembership[index] = membership;
  }
  __syncthreads();

  // k reductions (one per centroid)
  for (int c = 0; c < k; ++c) {
    x_sum[tid] = (membership == c) ? Px[index] : 0;
    y_sum[tid] = (membership == c) ? Py[index] : 0;
    size[tid] = (membership == c) ? 1 : 0;
    __syncthreads();

    // reduce block's sums into one value (in thread 0)
    for (int offset = BLOCK_SIZE >> 1; offset > 0; offset >>= 1) {
      if (tid < offset) {
        x_sum[tid] += x_sum[tid + offset];
        y_sum[tid] += y_sum[tid + offset];
        size[tid] += size[tid + offset];
      }
      __syncthreads();
    }

    // save block's sums to output arrays
    if (tid == 0) {
      Ox_sum[blockIdx.x * k + c] = x_sum[tid];
      Oy_sum[blockIdx.x * k + c] = y_sum[tid];
      Osize[blockIdx.x * k + c] = size[tid];
    }
    __syncthreads();
  }
}

// reduce temporary cluster sizes and centroid x/y sums to smaller arrays
__global__ void
reduce_temp_clusters(int n, int k,
                     const double *__restrict__ Ix_sum,
                     const double *__restrict__ Iy_sum,
                     const int *__restrict__ Isize,
                     double *__restrict__ Ox_sum,
                     double *__restrict__ Oy_sum,
                     int *__restrict__ Osize) {
  int index = blockIdx.x * blockDim.x + threadIdx.x;
  int stride = blockDim.x * gridDim.x;
  int tid = threadIdx.x;

  // thread-local values that will be reduced
  __shared__ double x_sum[BLOCK_SIZE];
  __shared__ double y_sum[BLOCK_SIZE];
  __shared__ int size[BLOCK_SIZE];

  for (int c = 0; c < k; ++c) {
    x_sum[tid] = 0;
    y_sum[tid] = 0;
    size[tid] = 0;

    // if necessary, sum multiple items per thread
    for (int b = index; b < n; b += stride) {
      x_sum[tid] += Ix_sum[b * k + c];
      y_sum[tid] += Iy_sum[b * k + c];
      size[tid] += Isize[b * k + c];
    }
    __syncthreads();

    // reduce block's sums into one value (in thread 0)
    for (int offset = BLOCK_SIZE >> 1; offset > 0; offset >>= 1) {
      if (tid < offset) {
        x_sum[tid] += x_sum[tid + offset];
        y_sum[tid] += y_sum[tid + offset];
        size[tid] += size[tid + offset];
      }
      __syncthreads();
    }

    // save block's sums to output arrays
    if (tid == 0) {
      Ox_sum[blockIdx.x * k + c] = x_sum[tid];
      Oy_sum[blockIdx.x * k + c] = y_sum[tid];
      Osize[blockIdx.x * k + c] = size[tid];
    }
    __syncthreads();
  }
}

// update cluster centroid positions
__global__ void update_clusters(int n, int k,
                                double *__restrict__ Cx,
                                double *__restrict__ Cy,
                                const double *__restrict__ Ix_sum,
                                const double *__restrict__ Iy_sum,
                                const int *__restrict__ Isize) {
  int index = blockIdx.x * blockDim.x + threadIdx.x;

  if (index < k && Isize[index]) {
    Cx[index] = Ix_sum[index] / Isize[index];
    Cy[index] = Iy_sum[index] / Isize[index];
  }
}

/*
 *  prints results and performance where
 *    k = number of clusters (means)
 *    n = number of points (in 2D)
 *    h = number of iterations until convergence
 *    t = elapsed time (in seconds)
 *
 *    P contains the input points
 *    C contains the final cluster centroids
 *    T contains (in part) the final cluster sizes
 */
__host__ void print_results(int k, int n, int h, double t,
                            points P, centroids C, temp_centroids T) {
  printf("performed %d iterations in %.2f s, perf: %.2f billion\n", h, t,
         (double)k * n * h / t * 1e-9);

  double *xs = (double *)malloc(sizeof(double) * n);
  double *ys = (double *)malloc(sizeof(double) * n);
  int offsets[k + 1];

  offsets[0] = 0;
  for (int i = 0; i < k; ++i) {
    offsets[i + 1] = offsets[i] + T.size[i];
  }

  // pack permutation of input points into clusters in a single pass by using
  // prefix-sum on the cluster sizes as offsets into our output arrays
  for (int i = 0; i < n; ++i) {
    int m = P.membership[i];
    xs[offsets[m]] = P.x[i];
    ys[offsets[m]++] = P.y[i];
  }

  for (int c = 0; c < k; ++c) {
    printf("=====cluster %d centered at %lf %lf has size %d=====\n", c, C.x[c],
           C.y[c], T.size[c]);
    for (int i = offsets[c] - T.size[c]; i < offsets[c]; ++i) {
      printf("%lf %lf\n", xs[i], ys[i]);
    }
  }

  free(xs);
  free(ys);
}

int main(int argc, char **argv) {
  int k, n, h;
  char *file_name;
  points P;
  centroids C;
  temp_centroids T1;
  temp_centroids T2;
  hipEvent_t start, stop;
  float time;

  // read in number of points and means
  assert(argc >= 4);
  n = atoi(argv[1]);
  k = atoi(argv[2]);
  file_name = argv[3];
  assert(n <= MAX_POINTS && k <= MAX_MEANS);

  int blockSize = BLOCK_SIZE;
  int numBlocks = (n + blockSize - 1) / blockSize;
  int reductionBlockSize = BLOCK_SIZE;
  int reductionNumBlocks =
      (numBlocks + reductionBlockSize - 1) / reductionBlockSize;

  // make sure that we can support the number of points with our two block
  // reductions. with BLOCK_SIZE = 512, this limit is ~250M points
  assert(reductionNumBlocks <= 1024);

  // malloc memory and set up GPU timers
  hipMallocManaged(&P.x, sizeof(double) * n);
  hipMallocManaged(&P.y, sizeof(double) * n);
  hipMallocManaged(&P.membership, sizeof(int) * n);
  hipMallocManaged(&C.x, sizeof(double) * k);
  hipMallocManaged(&C.y, sizeof(double) * k);
  hipMallocManaged(&T1.x_sum, sizeof(double) * numBlocks * k);
  hipMallocManaged(&T1.y_sum, sizeof(double) * numBlocks * k);
  hipMallocManaged(&T1.size, sizeof(int) * numBlocks * k);
  hipMallocManaged(&T2.x_sum, sizeof(double) * reductionNumBlocks * k);
  hipMallocManaged(&T2.y_sum, sizeof(double) * reductionNumBlocks * k);
  hipMallocManaged(&T2.size, sizeof(int) * reductionNumBlocks * k);
  hipEventCreate(&start);
  hipEventCreate(&stop);

  read_data(n, file_name, P);
  init_centers(n, k, P, C);

  hipEventRecord(start, 0);
  for (h = 0; assignment_changed && h < MAX_ITER; ++h) {
    // assign points to nearest clusters
    assignment_changed = 0;
    assign_clusters<<<numBlocks, blockSize>>>
      (n, k,
       P.x, P.y, P.membership,
       C.x, C.y,
       T1.x_sum, T1.y_sum, T1.size);
    hipDeviceSynchronize();

    // two block reductions of cluster sizes and centroid x/y sums
    reduce_temp_clusters<<<reductionNumBlocks, reductionBlockSize>>>
      (numBlocks, k,
       T1.x_sum, T1.y_sum, T1.size,  // input values to reduce
       T2.x_sum, T2.y_sum, T2.size); // reduced output values
    hipDeviceSynchronize();
    reduce_temp_clusters<<<1, reductionBlockSize>>>
      (reductionNumBlocks, k,
       T2.x_sum, T2.y_sum, T2.size,  // reduce values from T2
       T1.x_sum, T1.y_sum, T1.size); // back into T1
    hipDeviceSynchronize();

    // update centroid positions
    update_clusters<<<1, k>>>
      (n, k,
       C.x, C.y,
       T1.x_sum, T1.y_sum, T1.size);
    hipDeviceSynchronize();
  }

  hipEventRecord(stop, 0);
  hipEventSynchronize(stop);
  hipEventElapsedTime(&time, start, stop);
  hipEventDestroy(start);
  hipEventDestroy(stop);

  print_results(k, n, h, time * 1e-3, P, C, T1);

  // CUDA automatically frees and resets device on program exit
}

	.text
	.file	"kmeans_gpu.hip"
	.globl	_Z9read_dataiPc6points          # -- Begin function _Z9read_dataiPc6points
	.type	_Z9read_dataiPc6points,@function
_Z9read_dataiPc6points:                 # @_Z9read_dataiPc6points
	.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	%rsi, %rax
	movl	%edi, %r14d
	movl	$.L.str, %esi
	movq	%rax, %rdi
	callq	fopen
	movq	%rax, %rbx
	movq	%rax, %rdi
	callq	feof
	testl	%eax, %eax
	jne	.LBB0_6
# %bb.1:
	testl	%r14d, %r14d
	je	.LBB0_6
# %bb.2:                                # %.lr.ph
	leaq	80(%rsp), %rax
	movq	(%rax), %r12
	movq	8(%rax), %r13
	movq	16(%rax), %rbp
	movl	%r14d, %r14d
	movl	$1, %r15d
.LBB0_3:                                # =>This Inner Loop Header: Depth=1
	movl	$.L.str.1, %esi
	movq	%rbx, %rdi
	leaq	16(%rsp), %rdx
	leaq	8(%rsp), %rcx
	xorl	%eax, %eax
	callq	__isoc23_fscanf
	cmpl	$2, %eax
	jne	.LBB0_6
# %bb.4:                                #   in Loop: Header=BB0_3 Depth=1
	movsd	16(%rsp), %xmm0                 # xmm0 = mem[0],zero
	movsd	%xmm0, -8(%r12,%r15,8)
	movsd	8(%rsp), %xmm0                  # xmm0 = mem[0],zero
	movsd	%xmm0, -8(%r13,%r15,8)
	movl	$-1, -4(%rbp,%r15,4)
	movq	%rbx, %rdi
	callq	feof
	testl	%eax, %eax
	jne	.LBB0_6
# %bb.5:                                #   in Loop: Header=BB0_3 Depth=1
	leaq	1(%r15), %rax
	cmpq	%r14, %r15
	movq	%rax, %r15
	jb	.LBB0_3
.LBB0_6:                                # %._crit_edge
	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
.Lfunc_end0:
	.size	_Z9read_dataiPc6points, .Lfunc_end0-_Z9read_dataiPc6points
	.cfi_endproc
                                        # -- End function
	.globl	_Z12init_centersii6points9centroids # -- Begin function _Z12init_centersii6points9centroids
	.type	_Z12init_centersii6points9centroids,@function
_Z12init_centersii6points9centroids:    # @_Z12init_centersii6points9centroids
	.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
	pushq	%rax
	.cfi_def_cfa_offset 64
	.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	%rcx, (%rsp)                    # 8-byte Spill
	movq	%rdx, %r14
	movl	%esi, %r15d
	movl	%edi, %ebp
	xorl	%edi, %edi
	callq	time
	movl	%eax, %edi
	callq	srand
	testl	%r15d, %r15d
	jle	.LBB1_3
# %bb.1:                                # %.lr.ph
	leaq	64(%rsp), %rax
	movq	(%rax), %r12
	movq	8(%rax), %r13
	movl	%r15d, %r15d
	xorl	%ebx, %ebx
.LBB1_2:                                # =>This Inner Loop Header: Depth=1
	callq	rand
	cltd
	idivl	%ebp
	movslq	%edx, %rax
	movsd	(%r12,%rax,8), %xmm0            # xmm0 = mem[0],zero
	movsd	%xmm0, (%r14,%rbx,8)
	movsd	(%r13,%rax,8), %xmm0            # xmm0 = mem[0],zero
	movq	(%rsp), %rax                    # 8-byte Reload
	movsd	%xmm0, (%rax,%rbx,8)
	incq	%rbx
	cmpq	%rbx, %r15
	jne	.LBB1_2
.LBB1_3:                                # %._crit_edge
	addq	$8, %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
.Lfunc_end1:
	.size	_Z12init_centersii6points9centroids, .Lfunc_end1-_Z12init_centersii6points9centroids
	.cfi_endproc
                                        # -- End function
	.globl	_Z30__device_stub__assign_clustersiiPKdS0_PiPdS2_S2_S2_S1_ # -- Begin function _Z30__device_stub__assign_clustersiiPKdS0_PiPdS2_S2_S2_S1_
	.type	_Z30__device_stub__assign_clustersiiPKdS0_PiPdS2_S2_S2_S1_,@function
_Z30__device_stub__assign_clustersiiPKdS0_PiPdS2_S2_S2_S1_: # @_Z30__device_stub__assign_clustersiiPKdS0_PiPdS2_S2_S2_S1_
	.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	56(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	48(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	40(%rsp), %rcx
	movq	%r8, (%rcx)
	leaq	32(%rsp), %r8
	movq	%r9, (%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	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	$_Z15assign_clustersiiPKdS0_PiPdS2_S2_S2_S1_, %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_end2:
	.size	_Z30__device_stub__assign_clustersiiPKdS0_PiPdS2_S2_S2_S1_, .Lfunc_end2-_Z30__device_stub__assign_clustersiiPKdS0_PiPdS2_S2_S2_S1_
	.cfi_endproc
                                        # -- End function
	.globl	_Z35__device_stub__reduce_temp_clustersiiPKdS0_PKiPdS3_Pi # -- Begin function _Z35__device_stub__reduce_temp_clustersiiPKdS0_PKiPdS3_Pi
	.type	_Z35__device_stub__reduce_temp_clustersiiPKdS0_PKiPdS3_Pi,@function
_Z35__device_stub__reduce_temp_clustersiiPKdS0_PKiPdS3_Pi: # @_Z35__device_stub__reduce_temp_clustersiiPKdS0_PKiPdS3_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	$160, %rsp
	.cfi_def_cfa_offset 208
	.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	56(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	48(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	40(%rsp), %rcx
	movq	%r8, (%rcx)
	leaq	32(%rsp), %r8
	movq	%r9, (%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	208(%rsp), %rax
	movq	%rax, 48(%rbx)
	leaq	216(%rsp), %rax
	movq	%rax, 56(%rbx)
	leaq	80(%rsp), %r14
	leaq	64(%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	$_Z20reduce_temp_clustersiiPKdS0_PKiPdS3_Pi, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$176, %rsp
	.cfi_adjust_cfa_offset -176
	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	_Z35__device_stub__reduce_temp_clustersiiPKdS0_PKiPdS3_Pi, .Lfunc_end3-_Z35__device_stub__reduce_temp_clustersiiPKdS0_PKiPdS3_Pi
	.cfi_endproc
                                        # -- End function
	.globl	_Z30__device_stub__update_clustersiiPdS_PKdS1_PKi # -- Begin function _Z30__device_stub__update_clustersiiPdS_PKdS1_PKi
	.type	_Z30__device_stub__update_clustersiiPdS_PKdS1_PKi,@function
_Z30__device_stub__update_clustersiiPdS_PKdS1_PKi: # @_Z30__device_stub__update_clustersiiPdS_PKdS1_PKi
	.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	$160, %rsp
	.cfi_def_cfa_offset 208
	.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	56(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	48(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	40(%rsp), %rcx
	movq	%r8, (%rcx)
	leaq	32(%rsp), %r8
	movq	%r9, (%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	208(%rsp), %rax
	movq	%rax, 48(%rbx)
	leaq	80(%rsp), %r14
	leaq	64(%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	$_Z15update_clustersiiPdS_PKdS1_PKi, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$176, %rsp
	.cfi_adjust_cfa_offset -176
	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_end4:
	.size	_Z30__device_stub__update_clustersiiPdS_PKdS1_PKi, .Lfunc_end4-_Z30__device_stub__update_clustersiiPdS_PKdS1_PKi
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z13print_resultsiiid6points9centroids14temp_centroids
.LCPI5_0:
	.quad	0x3e112e0be826d695              # double 1.0000000000000001E-9
	.text
	.globl	_Z13print_resultsiiid6points9centroids14temp_centroids
	.type	_Z13print_resultsiiid6points9centroids14temp_centroids,@function
_Z13print_resultsiiid6points9centroids14temp_centroids: # @_Z13print_resultsiiid6points9centroids14temp_centroids
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%r8, -80(%rbp)                  # 8-byte Spill
	movq	%rcx, -72(%rbp)                 # 8-byte Spill
	movl	%esi, %ebx
	movl	%edi, %r13d
	cvtsi2sd	%edi, %xmm1
	cvtsi2sd	%esi, %xmm2
	mulsd	%xmm1, %xmm2
	xorps	%xmm1, %xmm1
	cvtsi2sd	%edx, %xmm1
	mulsd	%xmm2, %xmm1
	divsd	%xmm0, %xmm1
	mulsd	.LCPI5_0(%rip), %xmm1
	movl	$.L.str.2, %edi
	movl	%edx, %esi
	movb	$2, %al
	callq	printf
	movl	%ebx, %r14d
	movslq	%ebx, %r12
	shlq	$3, %r12
	movq	%r12, %rdi
	callq	malloc
	movq	%rax, %r15
	movq	%r12, %rdi
	callq	malloc
	movq	%rax, %r12
	leal	1(%r13), %eax
	movq	%rsp, %rcx
	leaq	15(,%rax,4), %rax
	andq	$-16, %rax
	movq	%rcx, %r11
	subq	%rax, %r11
	movq	%r11, %rsp
	negq	%rax
	movl	$0, (%rcx,%rax)
	movl	%r13d, %ebx
	testl	%r13d, %r13d
	jle	.LBB5_3
# %bb.1:                                # %.lr.ph
	leaq	40(%rbp), %rax
	movq	16(%rax), %rax
	xorl	%ecx, %ecx
	xorl	%edx, %edx
.LBB5_2:                                # =>This Inner Loop Header: Depth=1
	addl	(%rax,%rdx,4), %ecx
	movl	%ecx, 4(%r11,%rdx,4)
	incq	%rdx
	cmpq	%rdx, %rbx
	jne	.LBB5_2
.LBB5_3:                                # %.preheader47
	testl	%r14d, %r14d
	jle	.LBB5_6
# %bb.4:                                # %.lr.ph50
	leaq	16(%rbp), %rdx
	movq	16(%rdx), %rax
	movq	(%rdx), %rcx
	movq	8(%rdx), %rdx
	movl	%r14d, %esi
	xorl	%edi, %edi
.LBB5_5:                                # =>This Inner Loop Header: Depth=1
	movslq	(%rax,%rdi,4), %r8
	movsd	(%rcx,%rdi,8), %xmm0            # xmm0 = mem[0],zero
	movslq	(%r11,%r8,4), %r9
	movsd	%xmm0, (%r15,%r9,8)
	movsd	(%rdx,%rdi,8), %xmm0            # xmm0 = mem[0],zero
	leal	1(%r9), %r10d
	movl	%r10d, (%r11,%r8,4)
	movsd	%xmm0, (%r12,%r9,8)
	incq	%rdi
	cmpq	%rdi, %rsi
	jne	.LBB5_5
.LBB5_6:                                # %.preheader
	movq	%r11, -48(%rbp)                 # 8-byte Spill
	testl	%r13d, %r13d
	jle	.LBB5_12
# %bb.7:                                # %.lr.ph54
	leaq	40(%rbp), %rax
	movq	16(%rax), %rax
	movq	%rax, -56(%rbp)                 # 8-byte Spill
	xorl	%r13d, %r13d
	movq	%rbx, -64(%rbp)                 # 8-byte Spill
.LBB5_8:                                # =>This Loop Header: Depth=1
                                        #     Child Loop BB5_10 Depth 2
	movq	-72(%rbp), %rax                 # 8-byte Reload
	movsd	(%rax,%r13,8), %xmm0            # xmm0 = mem[0],zero
	movq	-80(%rbp), %rax                 # 8-byte Reload
	movsd	(%rax,%r13,8), %xmm1            # xmm1 = mem[0],zero
	movq	-56(%rbp), %rbx                 # 8-byte Reload
	movl	(%rbx,%r13,4), %edx
	movl	$.L.str.3, %edi
	movl	%r13d, %esi
	movb	$2, %al
	callq	printf
	movl	(%rbx,%r13,4), %eax
	testl	%eax, %eax
	jle	.LBB5_11
# %bb.9:                                # %.lr.ph52.preheader
                                        #   in Loop: Header=BB5_8 Depth=1
	movq	-48(%rbp), %rcx                 # 8-byte Reload
	movslq	(%rcx,%r13,4), %r14
	movl	%r14d, %ecx
	subl	%eax, %ecx
	movslq	%ecx, %rbx
.LBB5_10:                               # %.lr.ph52
                                        #   Parent Loop BB5_8 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movsd	(%r15,%rbx,8), %xmm0            # xmm0 = mem[0],zero
	movsd	(%r12,%rbx,8), %xmm1            # xmm1 = mem[0],zero
	movl	$.L.str.4, %edi
	movb	$2, %al
	callq	printf
	incq	%rbx
	cmpq	%r14, %rbx
	jl	.LBB5_10
.LBB5_11:                               # %._crit_edge
                                        #   in Loop: Header=BB5_8 Depth=1
	incq	%r13
	movq	-64(%rbp), %rbx                 # 8-byte Reload
	cmpq	%rbx, %r13
	jne	.LBB5_8
.LBB5_12:                               # %._crit_edge55
	movq	%r15, %rdi
	callq	free
	movq	%r12, %rdi
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa %rsp, 8
	jmp	free                            # TAILCALL
.Lfunc_end5:
	.size	_Z13print_resultsiiid6points9centroids14temp_centroids, .Lfunc_end5-_Z13print_resultsiiid6points9centroids14temp_centroids
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function main
.LCPI6_0:
	.quad	0x3f50624dd2f1a9fc              # double 0.001
	.text
	.globl	main
	.type	main,@function
main:                                   # @main
	.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	$200, %rsp
	.cfi_def_cfa_offset 256
	.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, %rbx
	movq	8(%rsi), %rdi
	callq	atoi
	movl	%eax, %r14d
	movq	16(%rbx), %rdi
	callq	atoi
	movl	%eax, %ebp
	movl	$511, %eax                      # imm = 0x1FF
	leal	(%r14,%rax), %ecx
	movl	$1022, %r12d                    # imm = 0x3FE
	leal	(%r14,%r12), %r15d
	testl	%ecx, %ecx
	cmovnsl	%ecx, %r15d
	sarl	$9, %r15d
	addl	%r15d, %eax
	addl	%r15d, %r12d
	testl	%eax, %eax
	cmovnsl	%eax, %r12d
	movq	24(%rbx), %rax
	movq	%rax, 184(%rsp)                 # 8-byte Spill
	sarl	$9, %r12d
	movq	%r14, 96(%rsp)                  # 8-byte Spill
	movslq	%r14d, %rbx
	leaq	(,%rbx,8), %r14
	leaq	136(%rsp), %rdi
	movq	%r14, %rsi
	movl	$1, %edx
	callq	hipMallocManaged
	leaq	144(%rsp), %rdi
	movq	%r14, %rsi
	movl	$1, %edx
	callq	hipMallocManaged
	leaq	152(%rsp), %rdi
	leaq	(,%rbx,4), %rsi
	movl	$1, %edx
	callq	hipMallocManaged
	movl	%ebp, 56(%rsp)                  # 4-byte Spill
	movslq	%ebp, %r13
	leaq	(,%r13,8), %r14
	leaq	104(%rsp), %rdi
	movq	%r14, %rsi
	movl	$1, %edx
	callq	hipMallocManaged
	leaq	112(%rsp), %rbp
	movq	%rbp, %rdi
	movq	%r14, %rsi
	movl	$1, %edx
	callq	hipMallocManaged
	movl	%r15d, 60(%rsp)                 # 4-byte Spill
	movslq	%r15d, %r14
	imulq	%r13, %r14
	leaq	(,%r14,8), %r15
	leaq	72(%rsp), %rdi
	movq	%r15, %rsi
	movl	$1, %edx
	callq	hipMallocManaged
	leaq	80(%rsp), %rdi
	movq	%r15, %rsi
	movl	$1, %edx
	callq	hipMallocManaged
	leaq	88(%rsp), %rdi
	shlq	$2, %r14
	movq	%r14, %rsi
	movl	$1, %edx
	callq	hipMallocManaged
	movq	%r12, 120(%rsp)                 # 8-byte Spill
	movslq	%r12d, %r14
	imulq	%r13, %r14
	leaq	(,%r14,8), %r15
	leaq	160(%rsp), %rdi
	movq	%r15, %rsi
	movl	$1, %edx
	callq	hipMallocManaged
	leaq	168(%rsp), %rdi
	movq	%r15, %rsi
	movl	$1, %edx
	callq	hipMallocManaged
	leaq	176(%rsp), %rdi
	shlq	$2, %r14
	movq	%r14, %rsi
	movl	$1, %edx
	callq	hipMallocManaged
	leaq	128(%rsp), %r14
	movq	%r14, %rdi
	callq	hipEventCreate
	leaq	64(%rsp), %rdi
	callq	hipEventCreate
	leaq	152(%rsp), %rcx
	movq	(%rcx), %rax
	movq	%rax, 16(%rsp)
	movups	-16(%rcx), %xmm0
	movq	%rcx, %r15
	movups	%xmm0, (%rsp)
	movl	%ebx, %edi
	movq	184(%rsp), %rsi                 # 8-byte Reload
	callq	_Z9read_dataiPc6points
	movq	-8(%rbp), %rdx
	movq	(%rbp), %rcx
	movq	(%r15), %rax
	movq	%rax, 16(%rsp)
	movups	-16(%r15), %xmm0
	movups	%xmm0, (%rsp)
	movl	%ebx, %edi
	movl	%r13d, %esi
	callq	_Z12init_centersii6points9centroids
	movq	(%r14), %rdi
	xorl	%r14d, %r14d
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	assignment_changed(%rip), %rax
	cmpl	$0, (%rax)
	je	.LBB6_12
# %bb.1:                                # %.lr.ph
	movabsq	$4294967296, %rcx               # imm = 0x100000000
	movl	60(%rsp), %r12d                 # 4-byte Reload
	btsq	$32, %r12
	movl	120(%rsp), %r13d                # 4-byte Reload
	btsq	$32, %r13
	movl	56(%rsp), %r15d                 # 4-byte Reload
	btsq	$32, %r15
	xorl	%ebp, %ebp
	leaq	512(%rcx), %rbx
.LBB6_2:                                # =>This Inner Loop Header: Depth=1
	movl	$0, (%rax)
	movq	%r12, %rdi
	movl	$1, %esi
	movq	%rbx, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB6_4
# %bb.3:                                #   in Loop: Header=BB6_2 Depth=1
	movq	136(%rsp), %rdx
	movq	144(%rsp), %rcx
	movq	152(%rsp), %r8
	movq	104(%rsp), %r9
	movq	112(%rsp), %rax
	movups	72(%rsp), %xmm0
	movq	88(%rsp), %rsi
	movq	%rsi, 24(%rsp)
	movups	%xmm0, 8(%rsp)
	movq	%rax, (%rsp)
	movq	96(%rsp), %rdi                  # 8-byte Reload
                                        # kill: def $edi killed $edi killed $rdi
	movl	56(%rsp), %esi                  # 4-byte Reload
	callq	_Z30__device_stub__assign_clustersiiPKdS0_PiPdS2_S2_S2_S1_
.LBB6_4:                                #   in Loop: Header=BB6_2 Depth=1
	callq	hipDeviceSynchronize
	movq	%r13, %rdi
	movl	$1, %esi
	movq	%rbx, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB6_6
# %bb.5:                                #   in Loop: Header=BB6_2 Depth=1
	movq	72(%rsp), %rdx
	movq	80(%rsp), %rcx
	movq	88(%rsp), %r8
	movq	160(%rsp), %r9
	movups	168(%rsp), %xmm0
	movups	%xmm0, (%rsp)
	movl	60(%rsp), %edi                  # 4-byte Reload
	movl	56(%rsp), %esi                  # 4-byte Reload
	callq	_Z35__device_stub__reduce_temp_clustersiiPKdS0_PKiPdS3_Pi
.LBB6_6:                                #   in Loop: Header=BB6_2 Depth=1
	callq	hipDeviceSynchronize
	movabsq	$4294967296, %rax               # imm = 0x100000000
	leaq	1(%rax), %r14
	movq	%r14, %rdi
	movl	$1, %esi
	movq	%rbx, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB6_8
# %bb.7:                                #   in Loop: Header=BB6_2 Depth=1
	movq	160(%rsp), %rdx
	movq	168(%rsp), %rcx
	movq	176(%rsp), %r8
	movq	72(%rsp), %r9
	movups	80(%rsp), %xmm0
	movups	%xmm0, (%rsp)
	movq	120(%rsp), %rdi                 # 8-byte Reload
                                        # kill: def $edi killed $edi killed $rdi
	movl	56(%rsp), %esi                  # 4-byte Reload
	callq	_Z35__device_stub__reduce_temp_clustersiiPKdS0_PKiPdS3_Pi
.LBB6_8:                                #   in Loop: Header=BB6_2 Depth=1
	callq	hipDeviceSynchronize
	movq	%r14, %rdi
	movl	$1, %esi
	movq	%r15, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB6_10
# %bb.9:                                #   in Loop: Header=BB6_2 Depth=1
	movq	104(%rsp), %rdx
	movq	112(%rsp), %rcx
	movq	72(%rsp), %r8
	movq	80(%rsp), %r9
	movq	88(%rsp), %rax
	movq	%rax, (%rsp)
	movq	96(%rsp), %rdi                  # 8-byte Reload
                                        # kill: def $edi killed $edi killed $rdi
	movl	56(%rsp), %esi                  # 4-byte Reload
	callq	_Z30__device_stub__update_clustersiiPdS_PKdS1_PKi
.LBB6_10:                               #   in Loop: Header=BB6_2 Depth=1
	callq	hipDeviceSynchronize
	leal	1(%rbp), %r14d
	movq	assignment_changed(%rip), %rax
	cmpl	$0, (%rax)
	je	.LBB6_12
# %bb.11:                               #   in Loop: Header=BB6_2 Depth=1
	cmpl	$29, %ebp
	movl	%r14d, %ebp
	jb	.LBB6_2
.LBB6_12:                               # %._crit_edge
	movq	64(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	64(%rsp), %rdi
	callq	hipEventSynchronize
	movq	128(%rsp), %rsi
	movq	64(%rsp), %rdx
	leaq	196(%rsp), %rbx
	movq	%rbx, %rdi
	callq	hipEventElapsedTime
	movq	128(%rsp), %rdi
	callq	hipEventDestroy
	movq	64(%rsp), %rdi
	callq	hipEventDestroy
	xorps	%xmm0, %xmm0
	cvtss2sd	(%rbx), %xmm0
	mulsd	.LCPI6_0(%rip), %xmm0
	movq	104(%rsp), %rcx
	movq	112(%rsp), %r8
	movq	88(%rsp), %rax
	movq	%rax, 40(%rsp)
	movups	72(%rsp), %xmm1
	movups	%xmm1, 24(%rsp)
	movq	152(%rsp), %rax
	movq	%rax, 16(%rsp)
	movups	136(%rsp), %xmm1
	movups	%xmm1, (%rsp)
	movl	56(%rsp), %edi                  # 4-byte Reload
	movq	96(%rsp), %rsi                  # 8-byte Reload
                                        # kill: def $esi killed $esi killed $rsi
	movl	%r14d, %edx
	callq	_Z13print_resultsiiid6points9centroids14temp_centroids
	xorl	%eax, %eax
	addq	$200, %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
.Lfunc_end6:
	.size	main, .Lfunc_end6-main
	.cfi_endproc
                                        # -- End function
	.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	.LBB7_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB7_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z15assign_clustersiiPKdS0_PiPdS2_S2_S2_S1_, %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	$_Z20reduce_temp_clustersiiPKdS0_PKiPdS3_Pi, %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	$_Z15update_clustersiiPdS_PKdS1_PKi, %esi
	movl	$.L__unnamed_3, %edx
	movl	$.L__unnamed_3, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$assignment_changed, %esi
	movl	$assignment_changed.managed, %edx
	movl	$.L__unnamed_4, %ecx
	movl	$4, %r8d
	movq	%rbx, %rdi
	movl	$4, %r9d
	callq	__hipRegisterManagedVar
	movl	$__hip_module_dtor, %edi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end7:
	.size	__hip_module_ctor, .Lfunc_end7-__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	.LBB8_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
.LBB8_2:
	retq
.Lfunc_end8:
	.size	__hip_module_dtor, .Lfunc_end8-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	assignment_changed.managed,@object # @assignment_changed.managed
	.data
	.p2align	2, 0x0
assignment_changed.managed:
	.long	1                               # 0x1
	.size	assignment_changed.managed, 4

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"r"
	.size	.L.str, 2

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"%lf %lf"
	.size	.L.str.1, 8

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

	.type	_Z20reduce_temp_clustersiiPKdS0_PKiPdS3_Pi,@object # @_Z20reduce_temp_clustersiiPKdS0_PKiPdS3_Pi
	.globl	_Z20reduce_temp_clustersiiPKdS0_PKiPdS3_Pi
	.p2align	3, 0x0
_Z20reduce_temp_clustersiiPKdS0_PKiPdS3_Pi:
	.quad	_Z35__device_stub__reduce_temp_clustersiiPKdS0_PKiPdS3_Pi
	.size	_Z20reduce_temp_clustersiiPKdS0_PKiPdS3_Pi, 8

	.type	_Z15update_clustersiiPdS_PKdS1_PKi,@object # @_Z15update_clustersiiPdS_PKdS1_PKi
	.globl	_Z15update_clustersiiPdS_PKdS1_PKi
	.p2align	3, 0x0
_Z15update_clustersiiPdS_PKdS1_PKi:
	.quad	_Z30__device_stub__update_clustersiiPdS_PKdS1_PKi
	.size	_Z15update_clustersiiPdS_PKdS1_PKi, 8

	.type	.L.str.2,@object                # @.str.2
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.2:
	.asciz	"performed %d iterations in %.2f s, perf: %.2f billion\n"
	.size	.L.str.2, 55

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"=====cluster %d centered at %lf %lf has size %d=====\n"
	.size	.L.str.3, 54

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"%lf %lf\n"
	.size	.L.str.4, 9

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z15assign_clustersiiPKdS0_PiPdS2_S2_S2_S1_"
	.size	.L__unnamed_1, 44

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z20reduce_temp_clustersiiPKdS0_PKiPdS3_Pi"
	.size	.L__unnamed_2, 43

	.type	.L__unnamed_3,@object           # @2
.L__unnamed_3:
	.asciz	"_Z15update_clustersiiPdS_PKdS1_PKi"
	.size	.L__unnamed_3, 35

	.type	.L__unnamed_4,@object           # @3
.L__unnamed_4:
	.asciz	"assignment_changed"
	.size	.L__unnamed_4, 19

	.type	assignment_changed,@object      # @assignment_changed
	.local	assignment_changed
	.comm	assignment_changed,8,8
	.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 _Z30__device_stub__assign_clustersiiPKdS0_PiPdS2_S2_S2_S1_
	.addrsig_sym _Z35__device_stub__reduce_temp_clustersiiPKdS0_PKiPdS3_Pi
	.addrsig_sym _Z30__device_stub__update_clustersiiPdS_PKdS1_PKi
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym assignment_changed.managed
	.addrsig_sym _Z15assign_clustersiiPKdS0_PiPdS2_S2_S2_S1_
	.addrsig_sym _Z20reduce_temp_clustersiiPKdS0_PKiPdS3_Pi
	.addrsig_sym _Z15update_clustersiiPdS_PKdS1_PKi
	.addrsig_sym assignment_changed
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z15assign_clustersiiPKdS0_PiPdS2_S2_S2_S1_ ; -- Begin function _Z15assign_clustersiiPKdS0_PiPdS2_S2_S2_S1_
	.globl	_Z15assign_clustersiiPKdS0_PiPdS2_S2_S2_S1_
	.p2align	8
	.type	_Z15assign_clustersiiPKdS0_PiPdS2_S2_S2_S1_,@function
_Z15assign_clustersiiPKdS0_PiPdS2_S2_S2_S1_: ; @_Z15assign_clustersiiPKdS0_PiPdS2_S2_S2_S1_
; %bb.0:
	s_clause 0x4
	s_load_b32 s2, s[0:1], 0x54
	s_load_b128 s[4:7], s[0:1], 0x0
	s_load_b64 s[16:17], s[0:1], 0x10
	s_load_b64 s[12:13], s[0:1], 0x40
	s_load_b128 s[8:11], s[0:1], 0x30
	v_mov_b32_e32 v9, -1
	s_waitcnt lgkmcnt(0)
	s_and_b32 s2, s2, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s2, v[0:1]
	v_cmp_gt_i32_e32 vcc_lo, s4, v1
	v_ashrrev_i32_e32 v2, 31, v1
	s_and_saveexec_b32 s4, vcc_lo
	s_cbranch_execz .LBB0_8
; %bb.1:                                ; %.preheader
	s_load_b64 s[18:19], s[0:1], 0x18
	s_cmp_lt_i32 s5, 1
	s_cbranch_scc1 .LBB0_4
; %bb.2:                                ; %.lr.ph
	v_lshlrev_b64 v[3:4], 3, v[1:2]
	s_load_b128 s[0:3], s[0:1], 0x20
	s_mov_b32 s14, 0
	v_mov_b32_e32 v9, -1
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_u32 v5, vcc_lo, s6, v3
	v_add_co_ci_u32_e32 v6, vcc_lo, s7, v4, vcc_lo
	v_add_co_u32 v7, vcc_lo, s16, v3
	v_add_co_ci_u32_e32 v8, vcc_lo, s17, v4, vcc_lo
	global_load_b64 v[3:4], v[5:6], off
	global_load_b64 v[5:6], v[7:8], off
	v_mov_b32_e32 v7, 0
	v_mov_b32_e32 v8, 0x7ff00000
.LBB0_3:                                ; =>This Inner Loop Header: Depth=1
	s_waitcnt lgkmcnt(0)
	s_load_b64 s[20:21], s[2:3], 0x0
	s_waitcnt vmcnt(0) lgkmcnt(0)
	v_add_f64 v[10:11], v[5:6], -s[20:21]
	s_load_b64 s[20:21], s[0:1], 0x0
	s_waitcnt lgkmcnt(0)
	v_add_f64 v[12:13], v[3:4], -s[20:21]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[10:11], v[10:11], v[10:11]
	v_fma_f64 v[10:11], v[12:13], v[12:13], v[10:11]
	s_delay_alu instid0(VALU_DEP_1)
	v_cmp_lt_f64_e32 vcc_lo, v[10:11], v[7:8]
	v_cndmask_b32_e64 v9, v9, s14, vcc_lo
	s_add_i32 s14, s14, 1
	s_add_u32 s0, s0, 8
	v_dual_cndmask_b32 v8, v8, v11 :: v_dual_cndmask_b32 v7, v7, v10
	s_addc_u32 s1, s1, 0
	s_add_u32 s2, s2, 8
	s_addc_u32 s3, s3, 0
	s_cmp_eq_u32 s5, s14
	s_cbranch_scc0 .LBB0_3
	s_branch .LBB0_5
.LBB0_4:
	v_mov_b32_e32 v9, -1
.LBB0_5:                                ; %Flow100
	v_lshlrev_b64 v[3:4], 2, v[1:2]
	s_mov_b32 s0, exec_lo
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v3, vcc_lo, s18, v3
	v_add_co_ci_u32_e32 v4, vcc_lo, s19, v4, vcc_lo
	global_load_b32 v5, v[3:4], off
	s_waitcnt vmcnt(0)
	v_cmpx_ne_u32_e64 v9, v5
	s_cbranch_execz .LBB0_7
; %bb.6:
	s_getpc_b64 s[2:3]
	s_add_u32 s2, s2, assignment_changed@rel32@lo+4
	s_addc_u32 s3, s3, assignment_changed@rel32@hi+12
	v_dual_mov_b32 v5, 0 :: v_dual_mov_b32 v6, 1
	s_load_b64 s[2:3], s[2:3], 0x0
	s_waitcnt lgkmcnt(0)
	global_store_b32 v5, v6, s[2:3]
.LBB0_7:
	s_or_b32 exec_lo, exec_lo, s0
	global_store_b32 v[3:4], v9, off
.LBB0_8:                                ; %Flow101
	s_or_b32 exec_lo, exec_lo, s4
	s_cmp_lt_i32 s5, 1
	s_waitcnt_vscnt null, 0x0
	s_barrier
	buffer_gl0_inv
	s_cbranch_scc1 .LBB0_19
; %bb.9:                                ; %.lr.ph88
	v_lshlrev_b64 v[3:4], 3, v[1:2]
	v_dual_mov_b32 v13, 0 :: v_dual_lshlrev_b32 v10, 3, v0
	v_lshl_or_b32 v12, v0, 2, 0x2000
	s_mov_b32 s1, 0
	s_mul_i32 s15, s15, s5
	s_delay_alu instid0(VALU_DEP_3)
	v_add_co_u32 v1, vcc_lo, s6, v3
	v_add_co_ci_u32_e32 v2, vcc_lo, s7, v4, vcc_lo
	v_add_co_u32 v3, vcc_lo, s16, v3
	v_add_co_ci_u32_e32 v4, vcc_lo, s17, v4, vcc_lo
	v_add_nc_u32_e32 v11, 0x1000, v10
	v_cmp_eq_u32_e32 vcc_lo, 0, v0
	s_mov_b32 s2, 0
.LBB0_10:                               ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_13 Depth 2
	v_mov_b32_e32 v5, 0
	v_mov_b32_e32 v6, 0
	v_cmp_eq_u32_e64 s0, s2, v9
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_dual_mov_b32 v8, v6 :: v_dual_mov_b32 v7, v5
	s_and_saveexec_b32 s3, s0
	s_cbranch_execz .LBB0_12
; %bb.11:                               ;   in Loop: Header=BB0_10 Depth=1
	global_load_b64 v[5:6], v[1:2], off
	global_load_b64 v[7:8], v[3:4], off
.LBB0_12:                               ; %.critedge
                                        ;   in Loop: Header=BB0_10 Depth=1
	s_or_b32 exec_lo, exec_lo, s3
	v_cndmask_b32_e64 v14, 0, 1, s0
	s_movk_i32 s3, 0x100
	s_waitcnt vmcnt(1)
	ds_store_b64 v10, v[5:6]
	s_waitcnt vmcnt(0)
	ds_store_b64 v11, v[7:8]
	ds_store_b32 v12, v14
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
.LBB0_13:                               ;   Parent Loop BB0_10 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	s_mov_b32 s4, exec_lo
	v_cmpx_gt_u32_e64 s3, v0
	s_cbranch_execz .LBB0_15
; %bb.14:                               ;   in Loop: Header=BB0_13 Depth=2
	s_lshl_b32 s0, s3, 3
	v_lshl_add_u32 v18, s3, 2, v12
	v_add_nc_u32_e32 v14, s0, v10
	v_add_nc_u32_e32 v16, s0, v11
	ds_load_b64 v[5:6], v10
	ds_load_b64 v[7:8], v11
	ds_load_b64 v[14:15], v14
	ds_load_b64 v[16:17], v16
	ds_load_b32 v18, v18
	ds_load_b32 v19, v12
	s_waitcnt lgkmcnt(3)
	v_add_f64 v[5:6], v[14:15], v[5:6]
	s_waitcnt lgkmcnt(2)
	v_add_f64 v[7:8], v[16:17], v[7:8]
	s_waitcnt lgkmcnt(0)
	v_add_nc_u32_e32 v14, v19, v18
	ds_store_b64 v10, v[5:6]
	ds_store_b64 v11, v[7:8]
	ds_store_b32 v12, v14
.LBB0_15:                               ;   in Loop: Header=BB0_13 Depth=2
	s_or_b32 exec_lo, exec_lo, s4
	s_lshr_b32 s0, s3, 1
	s_cmp_lt_u32 s3, 2
	s_mov_b32 s3, s0
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
	s_cbranch_scc0 .LBB0_13
; %bb.16:                               ;   in Loop: Header=BB0_10 Depth=1
	s_and_saveexec_b32 s3, vcc_lo
	s_cbranch_execz .LBB0_18
; %bb.17:                               ;   in Loop: Header=BB0_10 Depth=1
	ds_load_b64 v[5:6], v10
	ds_load_b64 v[7:8], v11
	ds_load_b32 v14, v12
	s_add_i32 s0, s2, s15
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_lshl_b64 s[6:7], s[0:1], 3
	s_add_u32 s16, s8, s6
	s_addc_u32 s17, s9, s7
	s_add_u32 s6, s10, s6
	s_addc_u32 s7, s11, s7
	s_lshl_b64 s[18:19], s[0:1], 2
	s_delay_alu instid0(SALU_CYCLE_1)
	s_add_u32 s18, s12, s18
	s_addc_u32 s19, s13, s19
	s_waitcnt lgkmcnt(2)
	global_store_b64 v13, v[5:6], s[16:17]
	s_waitcnt lgkmcnt(1)
	global_store_b64 v13, v[7:8], s[6:7]
	s_waitcnt lgkmcnt(0)
	global_store_b32 v13, v14, s[18:19]
.LBB0_18:                               ;   in Loop: Header=BB0_10 Depth=1
	s_or_b32 exec_lo, exec_lo, s3
	s_add_i32 s2, s2, 1
	s_waitcnt_vscnt null, 0x0
	s_cmp_eq_u32 s2, s5
	s_barrier
	buffer_gl0_inv
	s_cbranch_scc0 .LBB0_10
.LBB0_19:                               ; %._crit_edge89
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z15assign_clustersiiPKdS0_PiPdS2_S2_S2_S1_
		.amdhsa_group_segment_fixed_size 10240
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 328
		.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 20
		.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_end0:
	.size	_Z15assign_clustersiiPKdS0_PiPdS2_S2_S2_S1_, .Lfunc_end0-_Z15assign_clustersiiPKdS0_PiPdS2_S2_S2_S1_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 972
; NumSgprs: 24
; NumVgprs: 20
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 10240 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 2
; NumSGPRsForWavesPerEU: 24
; NumVGPRsForWavesPerEU: 20
; 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	_Z20reduce_temp_clustersiiPKdS0_PKiPdS3_Pi ; -- Begin function _Z20reduce_temp_clustersiiPKdS0_PKiPdS3_Pi
	.globl	_Z20reduce_temp_clustersiiPKdS0_PKiPdS3_Pi
	.p2align	8
	.type	_Z20reduce_temp_clustersiiPKdS0_PKiPdS3_Pi,@function
_Z20reduce_temp_clustersiiPKdS0_PKiPdS3_Pi: ; @_Z20reduce_temp_clustersiiPKdS0_PKiPdS3_Pi
; %bb.0:
	s_load_b64 s[2:3], s[0:1], 0x0
	s_waitcnt lgkmcnt(0)
	s_cmp_lt_i32 s3, 1
	s_cbranch_scc1 .LBB1_13
; %bb.1:                                ; %.lr.ph69
	s_clause 0x3
	s_load_b32 s12, s[0:1], 0x44
	s_load_b32 s14, s[0:1], 0x38
	s_load_b128 s[16:19], s[0:1], 0x28
	s_load_b256 s[4:11], s[0:1], 0x8
	v_lshlrev_b32_e32 v8, 3, v0
	v_lshl_or_b32 v9, v0, 2, 0x2000
	v_mov_b32_e32 v12, 0
	s_mov_b32 s21, 0
	s_delay_alu instid0(VALU_DEP_3)
	v_add_nc_u32_e32 v10, 0x1000, v8
	s_waitcnt lgkmcnt(0)
	s_and_b32 s0, s12, 0xffff
	s_mov_b32 s12, 0
	v_mad_u64_u32 v[1:2], null, s15, s0, v[0:1]
	s_mul_i32 s14, s14, s0
	v_cmp_eq_u32_e64 s0, 0, v0
	s_mul_i32 s15, s15, s3
	s_mul_i32 s20, s14, s3
	s_delay_alu instid0(VALU_DEP_2)
	v_mul_lo_u32 v11, s3, v1
	v_cmp_gt_i32_e32 vcc_lo, s2, v1
.LBB1_2:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB1_4 Depth 2
                                        ;     Child Loop BB1_7 Depth 2
	s_mov_b32 s13, s12
	s_delay_alu instid0(SALU_CYCLE_1)
	v_dual_mov_b32 v2, s12 :: v_dual_mov_b32 v3, s13
	ds_store_b64 v8, v[2:3]
	ds_store_b64 v10, v[2:3]
	ds_store_b32 v9, v12
	s_and_saveexec_b32 s13, vcc_lo
	s_cbranch_execz .LBB1_6
; %bb.3:                                ; %.lr.ph.preheader
                                        ;   in Loop: Header=BB1_2 Depth=1
	v_dual_mov_b32 v2, 0 :: v_dual_mov_b32 v13, 0
	v_dual_mov_b32 v3, 0 :: v_dual_mov_b32 v4, v11
	v_mov_b32_e32 v14, v1
	s_mov_b32 s22, 0
	s_delay_alu instid0(VALU_DEP_2)
	v_dual_mov_b32 v7, v3 :: v_dual_mov_b32 v6, v2
.LBB1_4:                                ; %.lr.ph
                                        ;   Parent Loop BB1_2 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_ashrrev_i32_e32 v5, 31, v4
	v_add_nc_u32_e32 v14, s14, v14
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_3)
	v_lshlrev_b64 v[15:16], 3, v[4:5]
	v_lshlrev_b64 v[19:20], 2, v[4:5]
	v_add_nc_u32_e32 v4, s20, v4
	v_add_co_u32 v17, s1, s4, v15
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_add_co_ci_u32_e64 v18, s1, s5, v16, s1
	v_add_co_u32 v15, s1, s6, v15
	v_add_co_ci_u32_e64 v16, s1, s7, v16, s1
	v_add_co_u32 v19, s1, s8, v19
	global_load_b64 v[17:18], v[17:18], off
	global_load_b64 v[15:16], v[15:16], off
	v_add_co_ci_u32_e64 v20, s1, s9, v20, s1
	v_cmp_le_i32_e64 s1, s2, v14
	global_load_b32 v5, v[19:20], off
	s_or_b32 s22, s1, s22
	s_waitcnt vmcnt(2)
	v_add_f64 v[6:7], v[17:18], v[6:7]
	s_waitcnt vmcnt(1)
	v_add_f64 v[2:3], v[15:16], v[2:3]
	s_waitcnt vmcnt(0)
	v_add_nc_u32_e32 v13, v13, v5
	s_and_not1_b32 exec_lo, exec_lo, s22
	s_cbranch_execnz .LBB1_4
; %bb.5:                                ; %._crit_edge
                                        ;   in Loop: Header=BB1_2 Depth=1
	s_or_b32 exec_lo, exec_lo, s22
	ds_store_b64 v8, v[6:7]
	ds_store_b64 v10, v[2:3]
	ds_store_b32 v9, v13
.LBB1_6:                                ; %Flow
                                        ;   in Loop: Header=BB1_2 Depth=1
	s_or_b32 exec_lo, exec_lo, s13
	s_movk_i32 s13, 0x100
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
.LBB1_7:                                ;   Parent Loop BB1_2 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	s_mov_b32 s22, exec_lo
	v_cmpx_gt_u32_e64 s13, v0
	s_cbranch_execz .LBB1_9
; %bb.8:                                ;   in Loop: Header=BB1_7 Depth=2
	s_lshl_b32 s1, s13, 3
	v_lshl_add_u32 v15, s13, 2, v9
	v_add_nc_u32_e32 v6, s1, v8
	v_add_nc_u32_e32 v13, s1, v10
	ds_load_b64 v[2:3], v8
	ds_load_b64 v[4:5], v10
	ds_load_b64 v[6:7], v6
	ds_load_b64 v[13:14], v13
	ds_load_b32 v15, v15
	ds_load_b32 v16, v9
	s_waitcnt lgkmcnt(3)
	v_add_f64 v[2:3], v[6:7], v[2:3]
	s_waitcnt lgkmcnt(2)
	v_add_f64 v[4:5], v[13:14], v[4:5]
	s_waitcnt lgkmcnt(0)
	v_add_nc_u32_e32 v6, v16, v15
	ds_store_b64 v8, v[2:3]
	ds_store_b64 v10, v[4:5]
	ds_store_b32 v9, v6
.LBB1_9:                                ;   in Loop: Header=BB1_7 Depth=2
	s_or_b32 exec_lo, exec_lo, s22
	s_lshr_b32 s1, s13, 1
	s_cmp_lt_u32 s13, 2
	s_mov_b32 s13, s1
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
	s_cbranch_scc0 .LBB1_7
; %bb.10:                               ;   in Loop: Header=BB1_2 Depth=1
	s_and_saveexec_b32 s1, s0
	s_cbranch_execz .LBB1_12
; %bb.11:                               ;   in Loop: Header=BB1_2 Depth=1
	ds_load_b64 v[2:3], v8
	ds_load_b64 v[4:5], v10
	ds_load_b32 v6, v9
	s_add_i32 s22, s21, s15
	s_mov_b32 s23, s12
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_lshl_b64 s[24:25], s[22:23], 3
	s_add_u32 s26, s10, s24
	s_addc_u32 s27, s11, s25
	s_add_u32 s24, s16, s24
	s_addc_u32 s25, s17, s25
	s_lshl_b64 s[22:23], s[22:23], 2
	s_delay_alu instid0(SALU_CYCLE_1)
	s_add_u32 s22, s18, s22
	s_addc_u32 s23, s19, s23
	s_waitcnt lgkmcnt(2)
	global_store_b64 v12, v[2:3], s[26:27]
	s_waitcnt lgkmcnt(1)
	global_store_b64 v12, v[4:5], s[24:25]
	s_waitcnt lgkmcnt(0)
	global_store_b32 v12, v6, s[22:23]
.LBB1_12:                               ;   in Loop: Header=BB1_2 Depth=1
	s_or_b32 exec_lo, exec_lo, s1
	v_add_nc_u32_e32 v11, 1, v11
	s_add_i32 s21, s21, 1
	s_waitcnt_vscnt null, 0x0
	s_cmp_eq_u32 s21, s3
	s_barrier
	buffer_gl0_inv
	s_cbranch_scc0 .LBB1_2
.LBB1_13:                               ; %._crit_edge70
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z20reduce_temp_clustersiiPKdS0_PKiPdS3_Pi
		.amdhsa_group_segment_fixed_size 10240
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 312
		.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 28
		.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	_Z20reduce_temp_clustersiiPKdS0_PKiPdS3_Pi, .Lfunc_end1-_Z20reduce_temp_clustersiiPKdS0_PKiPdS3_Pi
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 784
; NumSgprs: 30
; NumVgprs: 21
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 10240 bytes/workgroup (compile time only)
; SGPRBlocks: 3
; VGPRBlocks: 2
; NumSGPRsForWavesPerEU: 30
; 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	_Z15update_clustersiiPdS_PKdS1_PKi ; -- Begin function _Z15update_clustersiiPdS_PKdS1_PKi
	.globl	_Z15update_clustersiiPdS_PKdS1_PKi
	.p2align	8
	.type	_Z15update_clustersiiPdS_PKdS1_PKi,@function
_Z15update_clustersiiPdS_PKdS1_PKi:     ; @_Z15update_clustersiiPdS_PKdS1_PKi
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x3c
	s_load_b32 s3, s[0:1], 0x4
	s_waitcnt lgkmcnt(0)
	s_and_b32 s2, s2, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s2, v[0:1]
	s_mov_b32 s2, exec_lo
	v_cmpx_gt_i32_e64 s3, v1
	s_cbranch_execz .LBB2_3
; %bb.1:
	s_load_b64 s[2:3], s[0:1], 0x28
	v_ashrrev_i32_e32 v2, 31, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[3:4], 2, v[1:2]
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v3, vcc_lo, s2, v3
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v4, vcc_lo, s3, v4, vcc_lo
	global_load_b32 v0, v[3:4], off
	s_waitcnt vmcnt(0)
	v_cmp_ne_u32_e32 vcc_lo, 0, v0
	s_and_b32 exec_lo, exec_lo, vcc_lo
	s_cbranch_execz .LBB2_3
; %bb.2:
	s_load_b256 s[4:11], s[0:1], 0x8
	v_lshlrev_b64 v[1:2], 3, v[1:2]
	v_cvt_f64_i32_e32 v[7:8], v0
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_u32 v3, vcc_lo, s8, v1
	v_add_co_ci_u32_e32 v4, vcc_lo, s9, v2, vcc_lo
	v_add_co_u32 v5, vcc_lo, s10, v1
	v_add_co_ci_u32_e32 v6, vcc_lo, s11, v2, vcc_lo
	global_load_b64 v[3:4], v[3:4], off
	global_load_b64 v[5:6], v[5:6], off
	s_waitcnt vmcnt(1)
	v_div_scale_f64 v[9:10], null, v[7:8], v[7:8], v[3:4]
	s_waitcnt vmcnt(0)
	v_div_scale_f64 v[11:12], null, v[7:8], v[7:8], v[5:6]
	v_div_scale_f64 v[21:22], vcc_lo, v[3:4], v[7:8], v[3:4]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_rcp_f64_e32 v[13:14], v[9:10]
	v_rcp_f64_e32 v[15:16], v[11:12]
	s_waitcnt_depctr 0xfff
	v_fma_f64 v[17:18], -v[9:10], v[13:14], 1.0
	v_fma_f64 v[19:20], -v[11:12], v[15:16], 1.0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[13:14], v[13:14], v[17:18], v[13:14]
	v_fma_f64 v[15:16], v[15:16], v[19:20], v[15:16]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[17:18], -v[9:10], v[13:14], 1.0
	v_fma_f64 v[19:20], -v[11:12], v[15:16], 1.0
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_fma_f64 v[13:14], v[13:14], v[17:18], v[13:14]
	v_div_scale_f64 v[17:18], s0, v[5:6], v[7:8], v[5:6]
	v_fma_f64 v[15:16], v[15:16], v[19:20], v[15:16]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_mul_f64 v[19:20], v[21:22], v[13:14]
	v_mul_f64 v[23:24], v[17:18], v[15:16]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[9:10], -v[9:10], v[19:20], v[21:22]
	v_fma_f64 v[11:12], -v[11:12], v[23:24], v[17:18]
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_div_fmas_f64 v[9:10], v[9:10], v[13:14], v[19:20]
	s_mov_b32 vcc_lo, s0
	v_div_fmas_f64 v[11:12], v[11:12], v[15:16], v[23:24]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_div_fixup_f64 v[3:4], v[9:10], v[7:8], v[3:4]
	v_div_fixup_f64 v[5:6], v[11:12], v[7:8], v[5:6]
	v_add_co_u32 v7, vcc_lo, s4, v1
	v_add_co_ci_u32_e32 v8, vcc_lo, s5, v2, vcc_lo
	v_add_co_u32 v0, vcc_lo, s6, v1
	v_add_co_ci_u32_e32 v1, vcc_lo, s7, v2, vcc_lo
	global_store_b64 v[7:8], v[3:4], off
	global_store_b64 v[0:1], v[5:6], off
.LBB2_3:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z15update_clustersiiPdS_PKdS1_PKi
		.amdhsa_group_segment_fixed_size 0
		.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 25
		.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_end2:
	.size	_Z15update_clustersiiPdS_PKdS1_PKi, .Lfunc_end2-_Z15update_clustersiiPdS_PKdS1_PKi
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 464
; NumSgprs: 18
; NumVgprs: 25
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 3
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 25
; 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
	.protected	assignment_changed.managed ; @assignment_changed.managed
	.type	assignment_changed.managed,@object
	.data
	.globl	assignment_changed.managed
	.p2align	2, 0x0
assignment_changed.managed:
	.long	1                               ; 0x1
	.size	assignment_changed.managed, 4

	.protected	assignment_changed      ; @assignment_changed
	.type	assignment_changed,@object
	.section	.bss,"aw",@nobits
	.globl	assignment_changed
	.p2align	3, 0x0
assignment_changed:
	.quad	0
	.size	assignment_changed, 8

	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.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 assignment_changed.managed
	.addrsig_sym assignment_changed
	.addrsig_sym __hip_cuid_
	.amdgpu_metadata
---
amdhsa.kernels:
  - .args:
      - .offset:         0
        .size:           4
        .value_kind:     by_value
      - .offset:         4
        .size:           4
        .value_kind:     by_value
      - .actual_access:  read_only
        .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .actual_access:  read_only
        .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         24
        .size:           8
        .value_kind:     global_buffer
      - .actual_access:  read_only
        .address_space:  global
        .offset:         32
        .size:           8
        .value_kind:     global_buffer
      - .actual_access:  read_only
        .address_space:  global
        .offset:         40
        .size:           8
        .value_kind:     global_buffer
      - .actual_access:  write_only
        .address_space:  global
        .offset:         48
        .size:           8
        .value_kind:     global_buffer
      - .actual_access:  write_only
        .address_space:  global
        .offset:         56
        .size:           8
        .value_kind:     global_buffer
      - .actual_access:  write_only
        .address_space:  global
        .offset:         64
        .size:           8
        .value_kind:     global_buffer
      - .offset:         72
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         76
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         80
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         84
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         86
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         88
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         90
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         92
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         94
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         112
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         120
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         128
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         136
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 10240
    .kernarg_segment_align: 8
    .kernarg_segment_size: 328
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z15assign_clustersiiPKdS0_PiPdS2_S2_S2_S1_
    .private_segment_fixed_size: 0
    .sgpr_count:     24
    .sgpr_spill_count: 0
    .symbol:         _Z15assign_clustersiiPKdS0_PiPdS2_S2_S2_S1_.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     20
    .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
      - .actual_access:  read_only
        .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .actual_access:  read_only
        .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .actual_access:  read_only
        .address_space:  global
        .offset:         24
        .size:           8
        .value_kind:     global_buffer
      - .actual_access:  write_only
        .address_space:  global
        .offset:         32
        .size:           8
        .value_kind:     global_buffer
      - .actual_access:  write_only
        .address_space:  global
        .offset:         40
        .size:           8
        .value_kind:     global_buffer
      - .actual_access:  write_only
        .address_space:  global
        .offset:         48
        .size:           8
        .value_kind:     global_buffer
      - .offset:         56
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         60
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         64
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         68
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         70
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         72
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         74
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         76
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         78
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         96
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         104
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         112
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         120
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 10240
    .kernarg_segment_align: 8
    .kernarg_segment_size: 312
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z20reduce_temp_clustersiiPKdS0_PKiPdS3_Pi
    .private_segment_fixed_size: 0
    .sgpr_count:     30
    .sgpr_spill_count: 0
    .symbol:         _Z20reduce_temp_clustersiiPKdS0_PKiPdS3_Pi.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
      - .offset:         4
        .size:           4
        .value_kind:     by_value
      - .actual_access:  write_only
        .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .actual_access:  write_only
        .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .actual_access:  read_only
        .address_space:  global
        .offset:         24
        .size:           8
        .value_kind:     global_buffer
      - .actual_access:  read_only
        .address_space:  global
        .offset:         32
        .size:           8
        .value_kind:     global_buffer
      - .actual_access:  read_only
        .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: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 304
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z15update_clustersiiPdS_PKdS1_PKi
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z15update_clustersiiPdS_PKdS1_PKi.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     25
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
