#include <stdio.h>

// Return true if chunk x,z is a slime chunk, false otherwise. Use s as seed.
// https://minecraft.gamepedia.com/Slime
// https://docs.oracle.com/javase/7/docs/api/java/util/Random.html
// http://developer.classpath.org/doc/java/util/Random-source.html
__device__ bool isSlimeChunk(long long s, long long x, long long z) {
  unsigned long long seed = (s +
      (int) (x * x * 0x4c1906LL) +
      (int) (x * 0x5ac0dbLL) +
      (int) (z * z) * 0x4307a7LL +
      (int) (z * 0x5f24fLL)
      ^ 0x5E434E432LL) & ((1LL << 48) - 1);

  int bits, val;
  do {
    seed = (seed * 0x5DEECE66DLL + 0xBLL) & ((1LL << 48) - 1);
    bits = (int)(seed >> 17);
    val = bits % 10;
  } while (bits - val + 9 < 0);

  return val == 0;
}

// Return the square root of x
__device__ __host__ int sqrt(int x) {
  if (x == 0 || x == 1) return x;
  int i = 1, result = 1;
  while (result <= x) {
    ++i;
    result = i*i;
  }
  return i-1;
}

// Calculate the slime chunks in the initial row. This is different because the old values cannot be reused.
// Use x as the x coordinate, s as the seed and store the result in row.
// Each bit in row is one chunk, each int in row is one z coordinate.
__global__ void setInitialX(long long s, int x, int* row) {
  int z = blockIdx.y * blockDim.y + threadIdx.y;
  int current = 0;
  
  for (int i = 0; i < 32; ++i) {
    current |= isSlimeChunk(s, x+i, z - 1875000) << (31-i);
  }

  row[z] = current;
}

// Same as setInitialX, except it reuses a few chunks (which were already calculated in the previous setX/setInitialX call).
__global__ void setX(long long s, int x, int* row) {
  int z = blockIdx.y * blockDim.y + threadIdx.y;
  int current = row[z] << 16; // 17 chunks are tested at a time so 16 need to be included in the next search again
                              // 32-16 == 16

  for (int i = 16; i < 32; ++i) {
    current |= isSlimeChunk(s, x+i, z - 1875000) << (31-i);
  }

  row[z] = current;
}

// Count the amount of "1" bits in x and return it.
// This is only better if most bits are 0, which is the case for slime chunks (9/10 is 0 and 1/10 is 1).
// https://en.wikipedia.org/wiki/Hamming_weight
// TODO see if a lookup table is faster and if it is, implement it
__device__ int popcount(int x) {
  int count;
  for (count = 0; x; count++) {
    x &= x - 1;
  }
  return count;
}

// Count how many blocks are loaded and in a slime chunk at the same time.
// Take the slime chunks from row and return the result in n.
// currentMax is the current highest value. If the value cannot exceed this, the calculation will be stopped earlier to save time.
__global__ void count(int* row, unsigned short* n, int currentMax, short* sb, short* sbs) {
  int x = blockIdx.x * blockDim.x;
  int z = blockIdx.y * blockDim.y + threadIdx.y;

  // Avoid going too high and trying to access unavailable memory
  if (z >= 3750000) return;

  // Load the chunks from row
  int chunks[17];
  for (int i=0; i<17; ++i) {
    chunks[i] = row[z+i] >> 15-x & 0x1FFFF;
  }

  // First count all in a 17x17 area to simplify, if this doesn't succeed, don't check all different locations within that chunk.
  short sum = 0;
  for (int i=0; i<17; ++i) {
    sum += popcount(chunks[i]);
  }
  if (sum*256 <= currentMax) {
    n[16*z+x] = 0;
    return;
  }

  // Second simplification, exclude the blocks that are not in any of the spawnblocks and test again
  int cl[289]; // chunklist, 1 if a chunk is a slime chunk, otherwise 0 for each chunk in a 17x17 area
  for (int i=0; i<17; ++i) {
    for (int j=0; j<17; ++j) {
      cl[i*17+j] = chunks[i] >> (16-j) & 1;
    }
  }
  sum = 0;
  for (int i=0; i<289; ++i) {
      sum += cl[i]==1 ? sbs[i] : 0;
  }
  if (sum <= currentMax) {
    n[16*z+x] = 0;
    return;
  }

  // Calculate different rates for all heights and positions inside the chunk
  // Each value of j is a new height and/or position inside the chunk
  // Each value of i is the coordinates for a chunk around the chunk the player is in
  short highest = 0;
  for (int j=0; j<6144; ++j) {
    sum = 0;
    for (int i=0; i<289; ++i) {
      sum += cl[i]==1 ? sb[j*289+i] : 0;
    }
    if (sum > highest) {
      highest = sum;
    }
  }

  if (highest > currentMax) {
    //printf("%u,%u - %u\n",x,z,highest);
    n[16*z+x] = highest;
  } else {
    n[16*z+x] = 0;
  }

  return;
}

// Fill f with the amount of blocks within spawn radius (24 < x <= 128) in each chunk, for each x and z coordinate in the chunk and 24 y coordinates
// it uses 17x17 chunks, not 16x16
__global__ void calcSpawnableBlocks(short int* f) {
  int thread = blockIdx.x * blockDim.x + threadIdx.x;
  int x = thread/384;
  int y = thread%384/16;
  int z = thread%16;
  int i = x*110976+z*6936 + y*289;
//  for (int xx=-128; xx<129; ++xx) {
//    for (int zz=-128; zz<129; ++zz) {
  for (int xx=-128; xx<145; ++xx) {
    for (int zz=-128; zz<145; ++zz) {
      int t = sqrt((x-xx)*(x-xx) + (z-zz)*(z-zz) + y*y);
      if (24 < t && t <= 128) {
//        f[i + (xx+128)/17*17+(zz+128)/17]++;
        f[i + (xx+128)/16*17+(zz+128)/16]++;
      }
    }
  }
}

// Count blocks if slime can spawn there at any x, y, or z position of the player
void calcSecondSpawnableBlocks(short* a) {
  for (int i=0; i<17*17; ++i) a[i] = 0;
  for (int xx=-128; xx<145; ++xx) {
    for (int zz=-128; zz<145; ++zz) {
      bool temp = false;
      for (int x=0; x<16 && !temp; ++x) {
        for (int z=0; z<16 && !temp; ++z) {
          if (sqrt((x-xx)*(x-xx) + (z-zz)*(z-zz)) <= 128) temp = true;
        }
      }
      if (temp) a[(xx+128)/16*17 + (zz+128)/16]++;
    }
  }
}

// Find the highest amount of slime chunks in an area and the location of those slime chunks
// c (count) is the amount of slime chunks in an area and l (location) is the location of those slime chunks.
// the highest 1024 will be returned in the first 1024 items in count and location
// http://developer.download.nvidia.com/compute/cuda/1_1/Website/projects/reduction/doc/reduction.pdf
__global__ void findHighest(unsigned short *c, unsigned short *o, int *l) {
  __shared__ short scount[1024];
  __shared__ int slocation[1024];

  unsigned int tid = threadIdx.x;
  unsigned int i = blockIdx.x*blockDim.x + threadIdx.x;
  if(i >= 59999232) return;
  scount[tid] = c[i];
  slocation[tid] = i;
  __syncthreads();

  for(unsigned int s=blockDim.x/2; s>0; s>>=1) {
    if (tid < s) {
      if (scount[tid+s] > scount[tid]) {
        scount[tid] = scount[tid+s];
        slocation[tid] = slocation[tid+s];
      }
    }
    __syncthreads();
  }

  if(tid==0) {
    o[blockIdx.x] = scount[0];
    l[blockIdx.x] = slocation[0];
  }
}

// Inefficient function to move the location and count of the highest chunk to index 0 of c and l
void findHighestCpu(unsigned short* c, int* l, unsigned short* oc, int* cl) {
  cudaMemcpy(c, oc, 58608 * sizeof(short), cudaMemcpyDeviceToHost);
  cudaMemcpy(l, cl, 58608 * sizeof(int), cudaMemcpyDeviceToHost);
  
  unsigned short highest = 0;
  for (int i=0; i<58608; ++i) highest = c[i]>highest ? c[i] : highest;
  for (int i=0; i<58608; ++i) {
    if (c[i] == highest) {
      c[0] = c[i];
      l[0] = l[i];
      return;
    }
  }
}

void printError() {
  cudaError_t err = cudaGetLastError();
  if (err != cudaSuccess)
    printf("Error: %s\n", cudaGetErrorString(err));
}

int main() {
  // Cuda variables
  int *chunks; // Each bit represents a chunk. 1 if the chunk is a slime chunk, otherwise 0
  cudaMalloc((void**)&chunks, sizeof(int) * 3750912);
  unsigned short *chunkCount; // The amount of blocks slimes can spawn on in a 17x17 area centered around the player
  cudaMalloc((void**)&chunkCount, sizeof(short) * 3750000 * 16);
  short int *spawnBlocks; // A list with the amount of spawnable blocks in each chunk for each position in the chunk and each height
  cudaMalloc((void**)&spawnBlocks, sizeof(short int) * 17*17 * 16*16*24);
  cudaMemset(spawnBlocks, 0, sizeof(short int) * 17*17 * 16*16*24);
  int *chunkLocation; // The location of the chunk corresponding to the count in chunkCount. Format is z*16+x
  cudaMalloc((void**)&chunkLocation, sizeof(int) * 3663 * 16);
  unsigned short *outCount; // The output of the findHighest function
  cudaMalloc((void**)&outCount, sizeof(short) * 3663 * 16);
  short *spawnBlocksSecond; // Combination of all possible heights and positions of spawnBlocks
  cudaMalloc((void**)&spawnBlocksSecond, sizeof(short) * 17 * 17);

  // Host variables for outCount and chunkLocation
  unsigned short *countt = (unsigned short*) malloc(58608 * sizeof(short));
  int *location = (int*) malloc(58608 * sizeof(int));

  // Get seed, minx and maxx from user input
  long long seed = 0;
  char temp[8] = {0};
  int minx = -1875000;
  int maxx = 1875000;
  int highest = 0;
  printf("Enter seed: ");
  scanf("%d", &seed);
  printf("Enter x start (min is -1875000) ('d' for default -1875000): ");
  scanf("%s", temp);
  if (temp[0] != 'd')
    sscanf(temp, "%d", &minx);
  printf("Enter x end (max is 1875000) ('d' for default 1875000): ");
  scanf("%s", temp);
  if (temp[0] != 'd')
    sscanf(temp, "%d", &maxx);
  if (minx < -1875000 || maxx > 1875000 || maxx < minx) {
    printf("Illegal minx or maxx, range is -1875000 to 1875000 and minx must be smaller than maxx");
    return 1;
  }
  printf("Enter highest to begin with: ");
  scanf("%d", &highest);

  printf("Calculating spawnable blocks\n");  
  calcSpawnableBlocks<<<6, 1024>>>(spawnBlocks);
  cudaDeviceSynchronize();

  short *sbsCpu = (short*) malloc(17*17*sizeof(short));
  printf("Calculating second spawnable blocks\n");
  calcSecondSpawnableBlocks(sbsCpu);
  cudaDeviceSynchronize();
  cudaMemcpy(spawnBlocksSecond, sbsCpu, 17*17*sizeof(short), cudaMemcpyHostToDevice);

  printf("Setting initial X\n");
  setInitialX<<<dim3(1, 3663), dim3(1, 1024)>>>(seed, minx, chunks);
  cudaDeviceSynchronize();

  printf("Counting slime chunks/blocks\n");
  count<<<dim3(16, 3663), dim3(1, 1024)>>>(chunks,chunkCount,highest,spawnBlocks,spawnBlocksSecond);
  cudaDeviceSynchronize();

  printf("Finding highest chunk\n");
  findHighest<<<3663 * 16, 1024>>>(chunkCount, outCount, chunkLocation);
  cudaDeviceSynchronize();

  findHighestCpu(countt, location, outCount, chunkLocation);
  if (countt[0] > highest) {
    printf("New highest in first row: %u - %u\n", countt[0], location[0]);
    highest = countt[0];
  } else {
    printf("No new highest in first row, continuing with %d\n", highest);
  }

  printf("Starting computation of other chunks\n");

  for (int i = minx+16; i < maxx; i += 16) {
    setX<<<dim3(1, 3663), dim3(1, 1024)>>>(seed, i, chunks);
    cudaDeviceSynchronize();

    count<<<dim3(16, 3663), dim3(1, 1024)>>>(chunks,chunkCount,highest,spawnBlocks,spawnBlocksSecond);
    cudaDeviceSynchronize();

    findHighest<<<3663 * 16, 1024>>>(chunkCount, outCount, chunkLocation);
    cudaDeviceSynchronize();

    findHighestCpu(countt, location, outCount, chunkLocation);
    if (countt[0] > highest) {
      printf("New highest value: %u - %u with i %d, absolute location: %d, %d\n", countt[0], location[0], i, location[0]%16*16+i*16, location[0]/16*16-30000000);
      highest = countt[0];
    }
  }

  // Freeing memory
  cudaFree(chunks);
  cudaFree(chunkCount);
  cudaFree(spawnBlocks);
  cudaFree(chunkLocation);
  cudaFree(outCount);
  cudaFree(spawnBlocksSecond);
  free(countt);
  free(location);
  free(sbsCpu);
}

	.file	"tmpxft_0020bded_00000000-6_main.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2036:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2036:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z12isSlimeChunkxxx
	.type	_Z12isSlimeChunkxxx, @function
_Z12isSlimeChunkxxx:
.LFB2027:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	popq	%rax
	.cfi_def_cfa_offset 8
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	movl	$1, 12(%rsp)
	movl	12(%rsp), %edi
	call	exit@PLT
	.cfi_endproc
.LFE2027:
	.size	_Z12isSlimeChunkxxx, .-_Z12isSlimeChunkxxx
	.globl	_Z4sqrti
	.type	_Z4sqrti, @function
_Z4sqrti:
.LFB2028:
	.cfi_startproc
	endbr64
	movl	%edi, %eax
	cmpl	$1, %edi
	jbe	.L5
	movl	$1, %ecx
	movl	$1, %edx
.L6:
	cmpl	%ecx, %eax
	jl	.L9
	incl	%edx
	movl	%edx, %ecx
	imull	%edx, %ecx
	jmp	.L6
.L9:
	leal	-1(%rdx), %eax
.L5:
	ret
	.cfi_endproc
.LFE2028:
	.size	_Z4sqrti, .-_Z4sqrti
	.globl	_Z8popcounti
	.type	_Z8popcounti, @function
_Z8popcounti:
.LFB2029:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	popq	%rax
	.cfi_def_cfa_offset 8
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	movl	$1, 12(%rsp)
	movl	12(%rsp), %edi
	call	exit@PLT
	.cfi_endproc
.LFE2029:
	.size	_Z8popcounti, .-_Z8popcounti
	.globl	_Z25calcSecondSpawnableBlocksPs
	.type	_Z25calcSecondSpawnableBlocksPs, @function
_Z25calcSecondSpawnableBlocksPs:
.LFB2030:
	.cfi_startproc
	endbr64
	movl	$578, %ecx
	xorl	%eax, %eax
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	movq	%rdi, %rsi
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	xorl	%r8d, %r8d
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	movl	$128, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	rep stosb
.L13:
	movl	%r8d, %ebx
	movl	%ebp, %r11d
	xorl	%r9d, %r9d
	sarl	$4, %ebx
	subl	%r8d, %r11d
	imull	$17, %ebx, %ebx
.L21:
	movl	%ebp, %r12d
	xorl	%r10d, %r10d
	subl	%r9d, %r12d
.L19:
	leal	(%r11,%r10), %r14d
	xorl	%r13d, %r13d
	imull	%r14d, %r14d
.L14:
	leal	(%r12,%r13), %edi
	incl	%r13d
	imull	%edi, %edi
	addl	%r14d, %edi
	call	_Z4sqrti
	cmpl	$128, %eax
	setg	%dl
	cmpl	$15, %r13d
	jg	.L22
	testb	%dl, %dl
	jne	.L14
.L22:
	incl	%r10d
	cmpl	$15, %r10d
	jg	.L16
	testb	%dl, %dl
	jne	.L19
.L16:
	cmpl	$128, %eax
	jg	.L17
	movl	%r9d, %eax
	sarl	$4, %eax
	addl	%ebx, %eax
	cltq
	incw	(%rsi,%rax,2)
.L17:
	incl	%r9d
	cmpl	$273, %r9d
	jne	.L21
	incl	%r8d
	cmpl	$273, %r8d
	jne	.L13
	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
.LFE2030:
	.size	_Z25calcSecondSpawnableBlocksPs, .-_Z25calcSecondSpawnableBlocksPs
	.globl	_Z14findHighestCpuPtPiS_S0_
	.type	_Z14findHighestCpuPtPiS_S0_, @function
_Z14findHighestCpuPtPiS_S0_:
.LFB2031:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movq	%rcx, %r12
	movl	$2, %ecx
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movq	%rsi, %rbp
	movq	%rdx, %rsi
	movl	$117216, %edx
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movq	%rdi, %rbx
	call	cudaMemcpy@PLT
	movl	$234432, %edx
	movq	%r12, %rsi
	movq	%rbp, %rdi
	movl	$2, %ecx
	call	cudaMemcpy@PLT
	xorl	%eax, %eax
	xorl	%edx, %edx
.L35:
	movw	(%rbx,%rax,2), %cx
	cmpw	%cx, %dx
	cmovb	%ecx, %edx
	incq	%rax
	cmpq	$58608, %rax
	jne	.L35
	xorl	%eax, %eax
.L38:
	cmpw	%dx, (%rbx,%rax,2)
	jne	.L36
	movl	0(%rbp,%rax,4), %eax
	movw	%dx, (%rbx)
	movl	%eax, 0(%rbp)
	jmp	.L34
.L36:
	incq	%rax
	cmpq	$58608, %rax
	jne	.L38
.L34:
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2031:
	.size	_Z14findHighestCpuPtPiS_S0_, .-_Z14findHighestCpuPtPiS_S0_
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"Error: %s\n"
	.text
	.globl	_Z10printErrorv
	.type	_Z10printErrorv, @function
_Z10printErrorv:
.LFB2032:
	.cfi_startproc
	endbr64
	pushq	%rsi
	.cfi_def_cfa_offset 16
	call	cudaGetLastError@PLT
	testl	%eax, %eax
	je	.L42
	movl	%eax, %edi
	call	cudaGetErrorString@PLT
	leaq	.LC0(%rip), %rsi
	movl	$2, %edi
	popq	%rcx
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	movq	%rax, %rdx
	xorl	%eax, %eax
	jmp	__printf_chk@PLT
.L42:
	.cfi_restore_state
	popq	%rax
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2032:
	.size	_Z10printErrorv, .-_Z10printErrorv
	.globl	_Z33__device_stub__Z11setInitialXxiPixiPi
	.type	_Z33__device_stub__Z11setInitialXxiPixiPi, @function
_Z33__device_stub__Z11setInitialXxiPixiPi:
.LFB2058:
	.cfi_startproc
	endbr64
	subq	$136, %rsp
	.cfi_def_cfa_offset 144
	movq	%rdi, 24(%rsp)
	leaq	40(%rsp), %rcx
	leaq	48(%rsp), %rdi
	movl	%esi, 20(%rsp)
	leaq	60(%rsp), %rsi
	movq	%rdx, 8(%rsp)
	leaq	32(%rsp), %rdx
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	20(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 112(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L45
	pushq	40(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_Z11setInitialXxiPi(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 160
	movq	76(%rsp), %rcx
	movl	84(%rsp), %r8d
	movq	64(%rsp), %rsi
	movl	72(%rsp), %edx
	leaq	112(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 152
	popq	%rdx
	.cfi_def_cfa_offset 144
.L45:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L47
	call	__stack_chk_fail@PLT
.L47:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2058:
	.size	_Z33__device_stub__Z11setInitialXxiPixiPi, .-_Z33__device_stub__Z11setInitialXxiPixiPi
	.globl	_Z11setInitialXxiPi
	.type	_Z11setInitialXxiPi, @function
_Z11setInitialXxiPi:
.LFB2059:
	.cfi_startproc
	endbr64
	jmp	_Z33__device_stub__Z11setInitialXxiPixiPi
	.cfi_endproc
.LFE2059:
	.size	_Z11setInitialXxiPi, .-_Z11setInitialXxiPi
	.globl	_Z25__device_stub__Z4setXxiPixiPi
	.type	_Z25__device_stub__Z4setXxiPixiPi, @function
_Z25__device_stub__Z4setXxiPixiPi:
.LFB2060:
	.cfi_startproc
	endbr64
	subq	$136, %rsp
	.cfi_def_cfa_offset 144
	movq	%rdi, 24(%rsp)
	leaq	40(%rsp), %rcx
	leaq	48(%rsp), %rdi
	movl	%esi, 20(%rsp)
	leaq	60(%rsp), %rsi
	movq	%rdx, 8(%rsp)
	leaq	32(%rsp), %rdx
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	20(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 112(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L50
	pushq	40(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_Z4setXxiPi(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 160
	movq	76(%rsp), %rcx
	movl	84(%rsp), %r8d
	movq	64(%rsp), %rsi
	movl	72(%rsp), %edx
	leaq	112(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 152
	popq	%rdx
	.cfi_def_cfa_offset 144
.L50:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L52
	call	__stack_chk_fail@PLT
.L52:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2060:
	.size	_Z25__device_stub__Z4setXxiPixiPi, .-_Z25__device_stub__Z4setXxiPixiPi
	.globl	_Z4setXxiPi
	.type	_Z4setXxiPi, @function
_Z4setXxiPi:
.LFB2061:
	.cfi_startproc
	endbr64
	jmp	_Z25__device_stub__Z4setXxiPixiPi
	.cfi_endproc
.LFE2061:
	.size	_Z4setXxiPi, .-_Z4setXxiPi
	.globl	_Z32__device_stub__Z5countPiPtiPsS1_PiPtiPsS1_
	.type	_Z32__device_stub__Z5countPiPtiPsS1_PiPtiPsS1_, @function
_Z32__device_stub__Z5countPiPtiPsS1_PiPtiPsS1_:
.LFB2062:
	.cfi_startproc
	endbr64
	subq	$168, %rsp
	.cfi_def_cfa_offset 176
	movq	%rdi, 40(%rsp)
	leaq	64(%rsp), %rdi
	movq	%rsi, 32(%rsp)
	leaq	76(%rsp), %rsi
	movl	%edx, 28(%rsp)
	leaq	48(%rsp), %rdx
	movq	%rcx, 16(%rsp)
	leaq	56(%rsp), %rcx
	movq	%r8, 8(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 152(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rax
	movl	$1, 72(%rsp)
	movq	%rax, 112(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	28(%rsp), %rax
	movq	%rax, 128(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 136(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 144(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 64(%rsp)
	movq	%rax, 76(%rsp)
	movl	$1, 84(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L55
	pushq	56(%rsp)
	.cfi_def_cfa_offset 184
	leaq	_Z5countPiPtiPsS1_(%rip), %rdi
	pushq	56(%rsp)
	.cfi_def_cfa_offset 192
	movq	92(%rsp), %rcx
	movl	100(%rsp), %r8d
	movq	80(%rsp), %rsi
	movl	88(%rsp), %edx
	leaq	128(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 184
	popq	%rdx
	.cfi_def_cfa_offset 176
.L55:
	movq	152(%rsp), %rax
	subq	%fs:40, %rax
	je	.L57
	call	__stack_chk_fail@PLT
.L57:
	addq	$168, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2062:
	.size	_Z32__device_stub__Z5countPiPtiPsS1_PiPtiPsS1_, .-_Z32__device_stub__Z5countPiPtiPsS1_PiPtiPsS1_
	.globl	_Z5countPiPtiPsS1_
	.type	_Z5countPiPtiPsS1_, @function
_Z5countPiPtiPsS1_:
.LFB2063:
	.cfi_startproc
	endbr64
	jmp	_Z32__device_stub__Z5countPiPtiPsS1_PiPtiPsS1_
	.cfi_endproc
.LFE2063:
	.size	_Z5countPiPtiPsS1_, .-_Z5countPiPtiPsS1_
	.globl	_Z39__device_stub__Z19calcSpawnableBlocksPsPs
	.type	_Z39__device_stub__Z19calcSpawnableBlocksPsPs, @function
_Z39__device_stub__Z19calcSpawnableBlocksPsPs:
.LFB2064:
	.cfi_startproc
	endbr64
	subq	$104, %rsp
	.cfi_def_cfa_offset 112
	movq	%rdi, 8(%rsp)
	leaq	24(%rsp), %rcx
	leaq	16(%rsp), %rdx
	leaq	44(%rsp), %rsi
	leaq	32(%rsp), %rdi
	movq	%fs:40, %rax
	movq	%rax, 88(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rax
	movl	$1, 40(%rsp)
	movq	%rax, 80(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 32(%rsp)
	movq	%rax, 44(%rsp)
	movl	$1, 52(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L60
	pushq	24(%rsp)
	.cfi_def_cfa_offset 120
	leaq	_Z19calcSpawnableBlocksPs(%rip), %rdi
	pushq	24(%rsp)
	.cfi_def_cfa_offset 128
	movq	60(%rsp), %rcx
	movl	68(%rsp), %r8d
	movq	48(%rsp), %rsi
	movl	56(%rsp), %edx
	leaq	96(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 120
	popq	%rdx
	.cfi_def_cfa_offset 112
.L60:
	movq	88(%rsp), %rax
	subq	%fs:40, %rax
	je	.L62
	call	__stack_chk_fail@PLT
.L62:
	addq	$104, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2064:
	.size	_Z39__device_stub__Z19calcSpawnableBlocksPsPs, .-_Z39__device_stub__Z19calcSpawnableBlocksPsPs
	.globl	_Z19calcSpawnableBlocksPs
	.type	_Z19calcSpawnableBlocksPs, @function
_Z19calcSpawnableBlocksPs:
.LFB2065:
	.cfi_startproc
	endbr64
	jmp	_Z39__device_stub__Z19calcSpawnableBlocksPsPs
	.cfi_endproc
.LFE2065:
	.size	_Z19calcSpawnableBlocksPs, .-_Z19calcSpawnableBlocksPs
	.globl	_Z35__device_stub__Z11findHighestPtS_PiPtS_Pi
	.type	_Z35__device_stub__Z11findHighestPtS_PiPtS_Pi, @function
_Z35__device_stub__Z11findHighestPtS_PiPtS_Pi:
.LFB2066:
	.cfi_startproc
	endbr64
	subq	$136, %rsp
	.cfi_def_cfa_offset 144
	movq	%rdi, 24(%rsp)
	leaq	40(%rsp), %rcx
	leaq	48(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	60(%rsp), %rsi
	movq	%rdx, 8(%rsp)
	leaq	32(%rsp), %rdx
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 112(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L65
	pushq	40(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_Z11findHighestPtS_Pi(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 160
	movq	76(%rsp), %rcx
	movl	84(%rsp), %r8d
	movq	64(%rsp), %rsi
	movl	72(%rsp), %edx
	leaq	112(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 152
	popq	%rdx
	.cfi_def_cfa_offset 144
.L65:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L67
	call	__stack_chk_fail@PLT
.L67:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2066:
	.size	_Z35__device_stub__Z11findHighestPtS_PiPtS_Pi, .-_Z35__device_stub__Z11findHighestPtS_PiPtS_Pi
	.globl	_Z11findHighestPtS_Pi
	.type	_Z11findHighestPtS_Pi, @function
_Z11findHighestPtS_Pi:
.LFB2067:
	.cfi_startproc
	endbr64
	jmp	_Z35__device_stub__Z11findHighestPtS_PiPtS_Pi
	.cfi_endproc
.LFE2067:
	.size	_Z11findHighestPtS_Pi, .-_Z11findHighestPtS_Pi
	.section	.rodata.str1.1
.LC1:
	.string	"Enter seed: "
.LC2:
	.string	"%d"
.LC3:
	.string	"Enter x start (min is -1875000) ('d' for default -1875000): "
.LC4:
	.string	"%s"
.LC5:
	.string	"Enter x end (max is 1875000) ('d' for default 1875000): "
.LC6:
	.string	"Illegal minx or maxx, range is -1875000 to 1875000 and minx must be smaller than maxx"
.LC7:
	.string	"Enter highest to begin with: "
.LC8:
	.string	"Calculating spawnable blocks\n"
.LC9:
	.string	"Calculating second spawnable blocks\n"
.LC10:
	.string	"Setting initial X\n"
.LC11:
	.string	"Counting slime chunks/blocks\n"
.LC12:
	.string	"Finding highest chunk\n"
.LC13:
	.string	"New highest in first row: %u - %u\n"
.LC14:
	.string	"No new highest in first row, continuing with %d\n"
.LC15:
	.string	"Starting computation of other chunks\n"
.LC16:
	.string	"New highest value: %u - %u with i %d, absolute location: %d, %d\n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2033:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	movl	$15003648, %esi
	leaq	.LC4(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	leaq	.LC2(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rdi
	leaq	96(%rsp), %r13
	call	cudaMalloc@PLT
	leaq	24(%rsp), %rdi
	movl	$120000000, %esi
	call	cudaMalloc@PLT
	leaq	32(%rsp), %rdi
	movl	$3551232, %esi
	call	cudaMalloc@PLT
	movq	32(%rsp), %rdi
	movl	$3551232, %edx
	xorl	%esi, %esi
	call	cudaMemset@PLT
	leaq	40(%rsp), %rdi
	movl	$234432, %esi
	call	cudaMalloc@PLT
	leaq	48(%rsp), %rdi
	movl	$117216, %esi
	call	cudaMalloc@PLT
	movl	$578, %esi
	leaq	56(%rsp), %rdi
	call	cudaMalloc@PLT
	movl	$117216, %edi
	call	malloc@PLT
	movl	$234432, %edi
	movq	%rax, %rbx
	call	malloc@PLT
	xorl	%edi, %edi
	xorl	%r8d, %r8d
	leaq	.LC1(%rip), %rsi
	movq	%rdi, 64(%rsp)
	movq	%rax, %r12
	xorl	%eax, %eax
	movq	%rdi, 96(%rsp)
	movl	$2, %edi
	movl	%r8d, 12(%rsp)
	movl	$-1875000, 4(%rsp)
	movl	$1875000, 8(%rsp)
	call	__printf_chk@PLT
	leaq	64(%rsp), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc23_scanf@PLT
	leaq	.LC3(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	xorl	%eax, %eax
	movq	%r13, %rsi
	movq	%r14, %rdi
	call	__isoc23_scanf@PLT
	cmpb	$100, 96(%rsp)
	je	.L71
	leaq	4(%rsp), %rdx
	movq	%rbp, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc23_sscanf@PLT
.L71:
	leaq	.LC5(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	xorl	%eax, %eax
	movq	%r13, %rsi
	movq	%r14, %rdi
	call	__isoc23_scanf@PLT
	cmpb	$100, 96(%rsp)
	je	.L72
	leaq	8(%rsp), %rdx
	movq	%rbp, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc23_sscanf@PLT
.L72:
	movl	4(%rsp), %edx
	cmpl	$-1875000, %edx
	jl	.L73
	movl	8(%rsp), %eax
	cmpl	%eax, %edx
	jg	.L73
	cmpl	$1875000, %eax
	jle	.L74
.L73:
	leaq	.LC6(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$1, %eax
	jmp	.L70
.L74:
	leaq	.LC7(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	leaq	12(%rsp), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc23_scanf@PLT
	leaq	.LC8(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$4194305, %edx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	$2147483651, %edi
	salq	$10, %rdx
	movl	$1, %ecx
	movl	$1, %esi
	addq	%rdi, %rdi
	movq	%rdx, 84(%rsp)
	movl	$1, 92(%rsp)
	movq	%rdi, 72(%rsp)
	movl	$1, 80(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L77
	movq	32(%rsp), %rdi
	call	_Z39__device_stub__Z19calcSpawnableBlocksPsPs
.L77:
	call	cudaDeviceSynchronize@PLT
	movl	$578, %edi
	call	malloc@PLT
	leaq	.LC9(%rip), %rsi
	movl	$2, %edi
	movq	%rax, %r13
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	%r13, %rdi
	call	_Z25calcSecondSpawnableBlocksPs
	call	cudaDeviceSynchronize@PLT
	movq	56(%rsp), %rdi
	movl	$1, %ecx
	movq	%r13, %rsi
	movl	$578, %edx
	call	cudaMemcpy@PLT
	leaq	.LC10(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	$1, %ecx
	movabsq	$4398046511105, %rdx
	movl	$1, %esi
	movabsq	$15732465205249, %rdi
	movl	$1, 92(%rsp)
	movq	%rdx, 84(%rsp)
	movq	%rdi, 72(%rsp)
	movl	$1, 80(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L78
	movq	16(%rsp), %rdx
	movl	4(%rsp), %esi
	movq	64(%rsp), %rdi
	call	_Z33__device_stub__Z11setInitialXxiPixiPi
.L78:
	call	cudaDeviceSynchronize@PLT
	leaq	.LC11(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	$1, %ecx
	movabsq	$4398046511105, %rdx
	movl	$1, %esi
	movabsq	$15732465205264, %rdi
	movl	$1, 92(%rsp)
	movq	%rdx, 84(%rsp)
	movq	%rdi, 72(%rsp)
	movl	$1, 80(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L79
	movq	56(%rsp), %r8
	movq	32(%rsp), %rcx
	movl	12(%rsp), %edx
	movq	24(%rsp), %rsi
	movq	16(%rsp), %rdi
	call	_Z32__device_stub__Z5countPiPtiPsS1_PiPtiPsS1_
.L79:
	call	cudaDeviceSynchronize@PLT
	leaq	.LC12(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$4194305, %edx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	$268439119, %edi
	salq	$10, %rdx
	movl	$1, %ecx
	movl	$1, %esi
	salq	$4, %rdi
	movq	%rdx, 84(%rsp)
	movl	$1, 92(%rsp)
	movq	%rdi, 72(%rsp)
	movl	$1, 80(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L80
	movq	40(%rsp), %rdx
	movq	48(%rsp), %rsi
	movq	24(%rsp), %rdi
	call	_Z35__device_stub__Z11findHighestPtS_PiPtS_Pi
.L80:
	call	cudaDeviceSynchronize@PLT
	movq	48(%rsp), %rdx
	movq	%r12, %rsi
	movq	%rbx, %rdi
	movq	40(%rsp), %rcx
	call	_Z14findHighestCpuPtPiS_S0_
	movzwl	(%rbx), %eax
	movl	12(%rsp), %edx
	cmpl	%edx, %eax
	jle	.L81
	movl	(%r12), %ecx
	movl	%eax, %edx
	movl	$2, %edi
	xorl	%eax, %eax
	leaq	.LC13(%rip), %rsi
	call	__printf_chk@PLT
	movzwl	(%rbx), %eax
	movl	%eax, 12(%rsp)
	jmp	.L82
.L81:
	leaq	.LC14(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L82:
	leaq	.LC15(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	movabsq	$4398046511105, %r14
	call	__printf_chk@PLT
	movl	4(%rsp), %eax
	leal	16(%rax), %ebp
.L83:
	cmpl	%ebp, 8(%rsp)
	jle	.L91
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	%r14, %rdx
	movl	$1, %ecx
	movabsq	$15732465205249, %rdi
	movl	$1, %esi
	movq	%r14, 84(%rsp)
	movl	$1, 92(%rsp)
	movq	%rdi, 72(%rsp)
	movl	$1, 80(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L84
	movq	16(%rsp), %rdx
	movq	64(%rsp), %rdi
	movl	%ebp, %esi
	call	_Z25__device_stub__Z4setXxiPixiPi
.L84:
	call	cudaDeviceSynchronize@PLT
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	%r14, %rdx
	movl	$1, %ecx
	movl	$1, %esi
	movabsq	$15732465205264, %rdi
	movq	%r14, 84(%rsp)
	movl	$1, 92(%rsp)
	movq	%rdi, 72(%rsp)
	movl	$1, 80(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L85
	movq	56(%rsp), %r8
	movq	32(%rsp), %rcx
	movl	12(%rsp), %edx
	movq	24(%rsp), %rsi
	movq	16(%rsp), %rdi
	call	_Z32__device_stub__Z5countPiPtiPsS1_PiPtiPsS1_
.L85:
	call	cudaDeviceSynchronize@PLT
	movl	$4194305, %edx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	$268439119, %edi
	salq	$10, %rdx
	movl	$1, %ecx
	movl	$1, %esi
	salq	$4, %rdi
	movq	%rdx, 84(%rsp)
	movl	$1, 92(%rsp)
	movq	%rdi, 72(%rsp)
	movl	$1, 80(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L86
	movq	40(%rsp), %rdx
	movq	48(%rsp), %rsi
	movq	24(%rsp), %rdi
	call	_Z35__device_stub__Z11findHighestPtS_PiPtS_Pi
.L86:
	call	cudaDeviceSynchronize@PLT
	movq	40(%rsp), %rcx
	movq	%r12, %rsi
	movq	%rbx, %rdi
	movq	48(%rsp), %rdx
	call	_Z14findHighestCpuPtPiS_S0_
	movzwl	(%rbx), %esi
	cmpl	12(%rsp), %esi
	jle	.L87
	movl	(%r12), %ecx
	movl	$16, %edi
	movl	%ebp, %r8d
	movl	%ecx, %eax
	cltd
	idivl	%edi
	movl	$2, %edi
	subl	$1875000, %eax
	leal	(%rdx,%rbp), %r9d
	pushq	%rdx
	.cfi_def_cfa_offset 168
	movl	%esi, %edx
	sall	$4, %eax
	leaq	.LC16(%rip), %rsi
	sall	$4, %r9d
	pushq	%rax
	.cfi_def_cfa_offset 176
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movzwl	(%rbx), %eax
	movl	%eax, 28(%rsp)
	popq	%rcx
	.cfi_def_cfa_offset 168
	popq	%rsi
	.cfi_def_cfa_offset 160
.L87:
	addl	$16, %ebp
	jmp	.L83
.L91:
	movq	16(%rsp), %rdi
	call	cudaFree@PLT
	movq	24(%rsp), %rdi
	call	cudaFree@PLT
	movq	32(%rsp), %rdi
	call	cudaFree@PLT
	movq	40(%rsp), %rdi
	call	cudaFree@PLT
	movq	48(%rsp), %rdi
	call	cudaFree@PLT
	movq	56(%rsp), %rdi
	call	cudaFree@PLT
	movq	%rbx, %rdi
	call	free@PLT
	movq	%r12, %rdi
	call	free@PLT
	movq	%r13, %rdi
	call	free@PLT
	xorl	%eax, %eax
.L70:
	movq	104(%rsp), %rdx
	subq	%fs:40, %rdx
	je	.L89
	call	__stack_chk_fail@PLT
.L89:
	addq	$112, %rsp
	.cfi_def_cfa_offset 48
	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
.LFE2033:
	.size	main, .-main
	.section	.rodata.str1.1
.LC17:
	.string	"_Z11findHighestPtS_Pi"
.LC18:
	.string	"_Z19calcSpawnableBlocksPs"
.LC19:
	.string	"_Z5countPiPtiPsS1_"
.LC20:
	.string	"_Z4setXxiPi"
.LC21:
	.string	"_Z11setInitialXxiPi"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2069:
	.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	.LC17(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z11findHighestPtS_Pi(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC18(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z19calcSpawnableBlocksPs(%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	.LC19(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z5countPiPtiPsS1_(%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	.LC20(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z4setXxiPi(%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	.LC21(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z11setInitialXxiPi(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE2069:
	.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
	.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 <stdio.h>

// Return true if chunk x,z is a slime chunk, false otherwise. Use s as seed.
// https://minecraft.gamepedia.com/Slime
// https://docs.oracle.com/javase/7/docs/api/java/util/Random.html
// http://developer.classpath.org/doc/java/util/Random-source.html
__device__ bool isSlimeChunk(long long s, long long x, long long z) {
  unsigned long long seed = (s +
      (int) (x * x * 0x4c1906LL) +
      (int) (x * 0x5ac0dbLL) +
      (int) (z * z) * 0x4307a7LL +
      (int) (z * 0x5f24fLL)
      ^ 0x5E434E432LL) & ((1LL << 48) - 1);

  int bits, val;
  do {
    seed = (seed * 0x5DEECE66DLL + 0xBLL) & ((1LL << 48) - 1);
    bits = (int)(seed >> 17);
    val = bits % 10;
  } while (bits - val + 9 < 0);

  return val == 0;
}

// Return the square root of x
__device__ __host__ int sqrt(int x) {
  if (x == 0 || x == 1) return x;
  int i = 1, result = 1;
  while (result <= x) {
    ++i;
    result = i*i;
  }
  return i-1;
}

// Calculate the slime chunks in the initial row. This is different because the old values cannot be reused.
// Use x as the x coordinate, s as the seed and store the result in row.
// Each bit in row is one chunk, each int in row is one z coordinate.
__global__ void setInitialX(long long s, int x, int* row) {
  int z = blockIdx.y * blockDim.y + threadIdx.y;
  int current = 0;
  
  for (int i = 0; i < 32; ++i) {
    current |= isSlimeChunk(s, x+i, z - 1875000) << (31-i);
  }

  row[z] = current;
}

// Same as setInitialX, except it reuses a few chunks (which were already calculated in the previous setX/setInitialX call).
__global__ void setX(long long s, int x, int* row) {
  int z = blockIdx.y * blockDim.y + threadIdx.y;
  int current = row[z] << 16; // 17 chunks are tested at a time so 16 need to be included in the next search again
                              // 32-16 == 16

  for (int i = 16; i < 32; ++i) {
    current |= isSlimeChunk(s, x+i, z - 1875000) << (31-i);
  }

  row[z] = current;
}

// Count the amount of "1" bits in x and return it.
// This is only better if most bits are 0, which is the case for slime chunks (9/10 is 0 and 1/10 is 1).
// https://en.wikipedia.org/wiki/Hamming_weight
// TODO see if a lookup table is faster and if it is, implement it
__device__ int popcount(int x) {
  int count;
  for (count = 0; x; count++) {
    x &= x - 1;
  }
  return count;
}

// Count how many blocks are loaded and in a slime chunk at the same time.
// Take the slime chunks from row and return the result in n.
// currentMax is the current highest value. If the value cannot exceed this, the calculation will be stopped earlier to save time.
__global__ void count(int* row, unsigned short* n, int currentMax, short* sb, short* sbs) {
  int x = blockIdx.x * blockDim.x;
  int z = blockIdx.y * blockDim.y + threadIdx.y;

  // Avoid going too high and trying to access unavailable memory
  if (z >= 3750000) return;

  // Load the chunks from row
  int chunks[17];
  for (int i=0; i<17; ++i) {
    chunks[i] = row[z+i] >> 15-x & 0x1FFFF;
  }

  // First count all in a 17x17 area to simplify, if this doesn't succeed, don't check all different locations within that chunk.
  short sum = 0;
  for (int i=0; i<17; ++i) {
    sum += popcount(chunks[i]);
  }
  if (sum*256 <= currentMax) {
    n[16*z+x] = 0;
    return;
  }

  // Second simplification, exclude the blocks that are not in any of the spawnblocks and test again
  int cl[289]; // chunklist, 1 if a chunk is a slime chunk, otherwise 0 for each chunk in a 17x17 area
  for (int i=0; i<17; ++i) {
    for (int j=0; j<17; ++j) {
      cl[i*17+j] = chunks[i] >> (16-j) & 1;
    }
  }
  sum = 0;
  for (int i=0; i<289; ++i) {
      sum += cl[i]==1 ? sbs[i] : 0;
  }
  if (sum <= currentMax) {
    n[16*z+x] = 0;
    return;
  }

  // Calculate different rates for all heights and positions inside the chunk
  // Each value of j is a new height and/or position inside the chunk
  // Each value of i is the coordinates for a chunk around the chunk the player is in
  short highest = 0;
  for (int j=0; j<6144; ++j) {
    sum = 0;
    for (int i=0; i<289; ++i) {
      sum += cl[i]==1 ? sb[j*289+i] : 0;
    }
    if (sum > highest) {
      highest = sum;
    }
  }

  if (highest > currentMax) {
    //printf("%u,%u - %u\n",x,z,highest);
    n[16*z+x] = highest;
  } else {
    n[16*z+x] = 0;
  }

  return;
}

// Fill f with the amount of blocks within spawn radius (24 < x <= 128) in each chunk, for each x and z coordinate in the chunk and 24 y coordinates
// it uses 17x17 chunks, not 16x16
__global__ void calcSpawnableBlocks(short int* f) {
  int thread = blockIdx.x * blockDim.x + threadIdx.x;
  int x = thread/384;
  int y = thread%384/16;
  int z = thread%16;
  int i = x*110976+z*6936 + y*289;
//  for (int xx=-128; xx<129; ++xx) {
//    for (int zz=-128; zz<129; ++zz) {
  for (int xx=-128; xx<145; ++xx) {
    for (int zz=-128; zz<145; ++zz) {
      int t = sqrt((x-xx)*(x-xx) + (z-zz)*(z-zz) + y*y);
      if (24 < t && t <= 128) {
//        f[i + (xx+128)/17*17+(zz+128)/17]++;
        f[i + (xx+128)/16*17+(zz+128)/16]++;
      }
    }
  }
}

// Count blocks if slime can spawn there at any x, y, or z position of the player
void calcSecondSpawnableBlocks(short* a) {
  for (int i=0; i<17*17; ++i) a[i] = 0;
  for (int xx=-128; xx<145; ++xx) {
    for (int zz=-128; zz<145; ++zz) {
      bool temp = false;
      for (int x=0; x<16 && !temp; ++x) {
        for (int z=0; z<16 && !temp; ++z) {
          if (sqrt((x-xx)*(x-xx) + (z-zz)*(z-zz)) <= 128) temp = true;
        }
      }
      if (temp) a[(xx+128)/16*17 + (zz+128)/16]++;
    }
  }
}

// Find the highest amount of slime chunks in an area and the location of those slime chunks
// c (count) is the amount of slime chunks in an area and l (location) is the location of those slime chunks.
// the highest 1024 will be returned in the first 1024 items in count and location
// http://developer.download.nvidia.com/compute/cuda/1_1/Website/projects/reduction/doc/reduction.pdf
__global__ void findHighest(unsigned short *c, unsigned short *o, int *l) {
  __shared__ short scount[1024];
  __shared__ int slocation[1024];

  unsigned int tid = threadIdx.x;
  unsigned int i = blockIdx.x*blockDim.x + threadIdx.x;
  if(i >= 59999232) return;
  scount[tid] = c[i];
  slocation[tid] = i;
  __syncthreads();

  for(unsigned int s=blockDim.x/2; s>0; s>>=1) {
    if (tid < s) {
      if (scount[tid+s] > scount[tid]) {
        scount[tid] = scount[tid+s];
        slocation[tid] = slocation[tid+s];
      }
    }
    __syncthreads();
  }

  if(tid==0) {
    o[blockIdx.x] = scount[0];
    l[blockIdx.x] = slocation[0];
  }
}

// Inefficient function to move the location and count of the highest chunk to index 0 of c and l
void findHighestCpu(unsigned short* c, int* l, unsigned short* oc, int* cl) {
  hipMemcpy(c, oc, 58608 * sizeof(short), hipMemcpyDeviceToHost);
  hipMemcpy(l, cl, 58608 * sizeof(int), hipMemcpyDeviceToHost);
  
  unsigned short highest = 0;
  for (int i=0; i<58608; ++i) highest = c[i]>highest ? c[i] : highest;
  for (int i=0; i<58608; ++i) {
    if (c[i] == highest) {
      c[0] = c[i];
      l[0] = l[i];
      return;
    }
  }
}

void printError() {
  hipError_t err = hipGetLastError();
  if (err != hipSuccess)
    printf("Error: %s\n", hipGetErrorString(err));
}

int main() {
  // Cuda variables
  int *chunks; // Each bit represents a chunk. 1 if the chunk is a slime chunk, otherwise 0
  hipMalloc((void**)&chunks, sizeof(int) * 3750912);
  unsigned short *chunkCount; // The amount of blocks slimes can spawn on in a 17x17 area centered around the player
  hipMalloc((void**)&chunkCount, sizeof(short) * 3750000 * 16);
  short int *spawnBlocks; // A list with the amount of spawnable blocks in each chunk for each position in the chunk and each height
  hipMalloc((void**)&spawnBlocks, sizeof(short int) * 17*17 * 16*16*24);
  hipMemset(spawnBlocks, 0, sizeof(short int) * 17*17 * 16*16*24);
  int *chunkLocation; // The location of the chunk corresponding to the count in chunkCount. Format is z*16+x
  hipMalloc((void**)&chunkLocation, sizeof(int) * 3663 * 16);
  unsigned short *outCount; // The output of the findHighest function
  hipMalloc((void**)&outCount, sizeof(short) * 3663 * 16);
  short *spawnBlocksSecond; // Combination of all possible heights and positions of spawnBlocks
  hipMalloc((void**)&spawnBlocksSecond, sizeof(short) * 17 * 17);

  // Host variables for outCount and chunkLocation
  unsigned short *countt = (unsigned short*) malloc(58608 * sizeof(short));
  int *location = (int*) malloc(58608 * sizeof(int));

  // Get seed, minx and maxx from user input
  long long seed = 0;
  char temp[8] = {0};
  int minx = -1875000;
  int maxx = 1875000;
  int highest = 0;
  printf("Enter seed: ");
  scanf("%d", &seed);
  printf("Enter x start (min is -1875000) ('d' for default -1875000): ");
  scanf("%s", temp);
  if (temp[0] != 'd')
    sscanf(temp, "%d", &minx);
  printf("Enter x end (max is 1875000) ('d' for default 1875000): ");
  scanf("%s", temp);
  if (temp[0] != 'd')
    sscanf(temp, "%d", &maxx);
  if (minx < -1875000 || maxx > 1875000 || maxx < minx) {
    printf("Illegal minx or maxx, range is -1875000 to 1875000 and minx must be smaller than maxx");
    return 1;
  }
  printf("Enter highest to begin with: ");
  scanf("%d", &highest);

  printf("Calculating spawnable blocks\n");  
  calcSpawnableBlocks<<<6, 1024>>>(spawnBlocks);
  hipDeviceSynchronize();

  short *sbsCpu = (short*) malloc(17*17*sizeof(short));
  printf("Calculating second spawnable blocks\n");
  calcSecondSpawnableBlocks(sbsCpu);
  hipDeviceSynchronize();
  hipMemcpy(spawnBlocksSecond, sbsCpu, 17*17*sizeof(short), hipMemcpyHostToDevice);

  printf("Setting initial X\n");
  setInitialX<<<dim3(1, 3663), dim3(1, 1024)>>>(seed, minx, chunks);
  hipDeviceSynchronize();

  printf("Counting slime chunks/blocks\n");
  count<<<dim3(16, 3663), dim3(1, 1024)>>>(chunks,chunkCount,highest,spawnBlocks,spawnBlocksSecond);
  hipDeviceSynchronize();

  printf("Finding highest chunk\n");
  findHighest<<<3663 * 16, 1024>>>(chunkCount, outCount, chunkLocation);
  hipDeviceSynchronize();

  findHighestCpu(countt, location, outCount, chunkLocation);
  if (countt[0] > highest) {
    printf("New highest in first row: %u - %u\n", countt[0], location[0]);
    highest = countt[0];
  } else {
    printf("No new highest in first row, continuing with %d\n", highest);
  }

  printf("Starting computation of other chunks\n");

  for (int i = minx+16; i < maxx; i += 16) {
    setX<<<dim3(1, 3663), dim3(1, 1024)>>>(seed, i, chunks);
    hipDeviceSynchronize();

    count<<<dim3(16, 3663), dim3(1, 1024)>>>(chunks,chunkCount,highest,spawnBlocks,spawnBlocksSecond);
    hipDeviceSynchronize();

    findHighest<<<3663 * 16, 1024>>>(chunkCount, outCount, chunkLocation);
    hipDeviceSynchronize();

    findHighestCpu(countt, location, outCount, chunkLocation);
    if (countt[0] > highest) {
      printf("New highest value: %u - %u with i %d, absolute location: %d, %d\n", countt[0], location[0], i, location[0]%16*16+i*16, location[0]/16*16-30000000);
      highest = countt[0];
    }
  }

  // Freeing memory
  hipFree(chunks);
  hipFree(chunkCount);
  hipFree(spawnBlocks);
  hipFree(chunkLocation);
  hipFree(outCount);
  hipFree(spawnBlocksSecond);
  free(countt);
  free(location);
  free(sbsCpu);
}

	.text
	.file	"main.hip"
	.globl	_Z4sqrti                        # -- Begin function _Z4sqrti
	.type	_Z4sqrti,@function
_Z4sqrti:                               # @_Z4sqrti
	.cfi_startproc
# %bb.0:
	cmpl	$2, %edi
	jae	.LBB0_2
# %bb.1:
	movl	%edi, %eax
                                        # kill: def $eax killed $eax killed $rax
	retq
.LBB0_2:                                # %.preheader
	xorl	%eax, %eax
	testl	%edi, %edi
	jle	.LBB0_4
.LBB0_3:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	leal	2(%rax), %ecx
	imull	%ecx, %ecx
	incl	%eax
	cmpl	%edi, %ecx
	jle	.LBB0_3
.LBB0_4:                                # %._crit_edge
                                        # kill: def $eax killed $eax killed $rax
	retq
.Lfunc_end0:
	.size	_Z4sqrti, .Lfunc_end0-_Z4sqrti
	.cfi_endproc
                                        # -- End function
	.globl	_Z26__device_stub__setInitialXxiPi # -- Begin function _Z26__device_stub__setInitialXxiPi
	.type	_Z26__device_stub__setInitialXxiPi,@function
_Z26__device_stub__setInitialXxiPi:     # @_Z26__device_stub__setInitialXxiPi
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	12(%rsp), %rcx
	movl	%esi, (%rcx)
	leaq	32(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	movq	%rsi, 16(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z11setInitialXxiPi, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end1:
	.size	_Z26__device_stub__setInitialXxiPi, .Lfunc_end1-_Z26__device_stub__setInitialXxiPi
	.cfi_endproc
                                        # -- End function
	.globl	_Z19__device_stub__setXxiPi     # -- Begin function _Z19__device_stub__setXxiPi
	.type	_Z19__device_stub__setXxiPi,@function
_Z19__device_stub__setXxiPi:            # @_Z19__device_stub__setXxiPi
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	12(%rsp), %rcx
	movl	%esi, (%rcx)
	leaq	32(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	movq	%rsi, 16(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z4setXxiPi, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end2:
	.size	_Z19__device_stub__setXxiPi, .Lfunc_end2-_Z19__device_stub__setXxiPi
	.cfi_endproc
                                        # -- End function
	.globl	_Z20__device_stub__countPiPtiPsS1_ # -- Begin function _Z20__device_stub__countPiPtiPsS1_
	.type	_Z20__device_stub__countPiPtiPsS1_,@function
_Z20__device_stub__countPiPtiPsS1_:     # @_Z20__device_stub__countPiPtiPsS1_
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$144, %rsp
	.cfi_def_cfa_offset 192
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	56(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	48(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	12(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	40(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	32(%rsp), %rcx
	movq	%r8, (%rcx)
	leaq	96(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%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	$_Z5countPiPtiPsS1_, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$160, %rsp
	.cfi_adjust_cfa_offset -160
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end3:
	.size	_Z20__device_stub__countPiPtiPsS1_, .Lfunc_end3-_Z20__device_stub__countPiPtiPsS1_
	.cfi_endproc
                                        # -- End function
	.globl	_Z34__device_stub__calcSpawnableBlocksPs # -- Begin function _Z34__device_stub__calcSpawnableBlocksPs
	.type	_Z34__device_stub__calcSpawnableBlocksPs,@function
_Z34__device_stub__calcSpawnableBlocksPs: # @_Z34__device_stub__calcSpawnableBlocksPs
	.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	$64, %rsp
	.cfi_def_cfa_offset 112
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	24(%rsp), %rax
	movq	%rdi, (%rax)
	movq	%rsp, %rbx
	movq	%rax, (%rbx)
	leaq	48(%rsp), %r14
	leaq	32(%rsp), %r15
	leaq	16(%rsp), %r12
	leaq	8(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z19calcSpawnableBlocksPs, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$80, %rsp
	.cfi_adjust_cfa_offset -80
	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	_Z34__device_stub__calcSpawnableBlocksPs, .Lfunc_end4-_Z34__device_stub__calcSpawnableBlocksPs
	.cfi_endproc
                                        # -- End function
	.globl	_Z25calcSecondSpawnableBlocksPs # -- Begin function _Z25calcSecondSpawnableBlocksPs
	.type	_Z25calcSecondSpawnableBlocksPs,@function
_Z25calcSecondSpawnableBlocksPs:        # @_Z25calcSecondSpawnableBlocksPs
	.cfi_startproc
# %bb.0:                                # %.preheader34.preheader
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	movq	%rdi, %rbx
	movl	$578, %edx                      # imm = 0x242
	xorl	%esi, %esi
	callq	memset@PLT
	movl	$-128, %eax
.LBB5_1:                                # %.preheader34
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB5_2 Depth 2
                                        #       Child Loop BB5_3 Depth 3
                                        #         Child Loop BB5_4 Depth 4
                                        #           Child Loop BB5_6 Depth 5
	leal	128(%rax), %ecx
	movl	%ecx, %edx
	shrl	$4, %edx
	andl	$-16, %ecx
	addl	%edx, %ecx
	movl	$-128, %edx
.LBB5_2:                                # %.preheader33
                                        #   Parent Loop BB5_1 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB5_3 Depth 3
                                        #         Child Loop BB5_4 Depth 4
                                        #           Child Loop BB5_6 Depth 5
	xorl	%esi, %esi
.LBB5_3:                                # %.lr.ph
                                        #   Parent Loop BB5_1 Depth=1
                                        #     Parent Loop BB5_2 Depth=2
                                        # =>    This Loop Header: Depth=3
                                        #         Child Loop BB5_4 Depth 4
                                        #           Child Loop BB5_6 Depth 5
	movl	%esi, %edi
	subl	%eax, %edi
	imull	%edi, %edi
	xorl	%r8d, %r8d
.LBB5_4:                                #   Parent Loop BB5_1 Depth=1
                                        #     Parent Loop BB5_2 Depth=2
                                        #       Parent Loop BB5_3 Depth=3
                                        # =>      This Loop Header: Depth=4
                                        #           Child Loop BB5_6 Depth 5
	movl	%r8d, %r9d
	subl	%edx, %r9d
	imull	%r9d, %r9d
	addl	%edi, %r9d
	cmpl	$2, %r9d
	jb	.LBB5_12
# %bb.5:                                # %.lr.ph.i.preheader
                                        #   in Loop: Header=BB5_4 Depth=4
	xorl	%r10d, %r10d
.LBB5_6:                                # %.lr.ph.i
                                        #   Parent Loop BB5_1 Depth=1
                                        #     Parent Loop BB5_2 Depth=2
                                        #       Parent Loop BB5_3 Depth=3
                                        #         Parent Loop BB5_4 Depth=4
                                        # =>        This Inner Loop Header: Depth=5
	leal	2(%r10), %r11d
	imull	%r11d, %r11d
	incl	%r10d
	cmpl	%r9d, %r11d
	jbe	.LBB5_6
# %bb.7:                                # %_Z4sqrti.exit
                                        #   in Loop: Header=BB5_4 Depth=4
	cmpl	$129, %r10d
	jb	.LBB5_12
# %bb.8:                                #   in Loop: Header=BB5_4 Depth=4
	leal	1(%r8), %r9d
	cmpl	$15, %r8d
	movl	%r9d, %r8d
	jb	.LBB5_4
# %bb.9:                                # %._crit_edge
                                        #   in Loop: Header=BB5_3 Depth=3
	leal	1(%rsi), %edi
	cmpl	$15, %esi
	movl	%edi, %esi
	jb	.LBB5_3
	jmp	.LBB5_13
.LBB5_12:                               # %._crit_edge.thread.thread
                                        #   in Loop: Header=BB5_2 Depth=2
	leal	128(%rdx), %esi
	shrl	$4, %esi
	addl	%ecx, %esi
	incw	(%rbx,%rsi,2)
.LBB5_13:                               # %._crit_edge.thread
                                        #   in Loop: Header=BB5_2 Depth=2
	incl	%edx
	cmpl	$145, %edx
	jne	.LBB5_2
# %bb.10:                               #   in Loop: Header=BB5_1 Depth=1
	incl	%eax
	cmpl	$145, %eax
	jne	.LBB5_1
# %bb.11:
	popq	%rbx
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end5:
	.size	_Z25calcSecondSpawnableBlocksPs, .Lfunc_end5-_Z25calcSecondSpawnableBlocksPs
	.cfi_endproc
                                        # -- End function
	.globl	_Z26__device_stub__findHighestPtS_Pi # -- Begin function _Z26__device_stub__findHighestPtS_Pi
	.type	_Z26__device_stub__findHighestPtS_Pi,@function
_Z26__device_stub__findHighestPtS_Pi:   # @_Z26__device_stub__findHighestPtS_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	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rcx
	movq	%rsi, (%rcx)
	leaq	24(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	movq	%rsi, 16(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	16(%rsp), %r12
	leaq	8(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z11findHighestPtS_Pi, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end6:
	.size	_Z26__device_stub__findHighestPtS_Pi, .Lfunc_end6-_Z26__device_stub__findHighestPtS_Pi
	.cfi_endproc
                                        # -- End function
	.globl	_Z14findHighestCpuPtPiS_S0_     # -- Begin function _Z14findHighestCpuPtPiS_S0_
	.type	_Z14findHighestCpuPtPiS_S0_,@function
_Z14findHighestCpuPtPiS_S0_:            # @_Z14findHighestCpuPtPiS_S0_
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rcx, %r15
	movq	%rdx, %rax
	movq	%rsi, %rbx
	movq	%rdi, %r14
	movl	$117216, %edx                   # imm = 0x1C9E0
	movq	%rax, %rsi
	movl	$2, %ecx
	callq	hipMemcpy
	movl	$234432, %edx                   # imm = 0x393C0
	movq	%rbx, %rdi
	movq	%r15, %rsi
	movl	$2, %ecx
	callq	hipMemcpy
	xorl	%ecx, %ecx
	xorl	%eax, %eax
.LBB7_1:                                # =>This Inner Loop Header: Depth=1
	movzwl	(%r14,%rcx,2), %edx
	cmpw	%ax, %dx
	cmovbel	%eax, %edx
	movl	%edx, %eax
	incq	%rcx
	cmpq	$58608, %rcx                    # imm = 0xE4F0
	jne	.LBB7_1
# %bb.2:                                # %.preheader.preheader
	xorl	%ecx, %ecx
.LBB7_4:                                # %.preheader
                                        # =>This Inner Loop Header: Depth=1
	cmpw	%ax, (%r14,%rcx,2)
	je	.LBB7_5
# %bb.3:                                #   in Loop: Header=BB7_4 Depth=1
	incq	%rcx
	cmpq	$58608, %rcx                    # imm = 0xE4F0
	jne	.LBB7_4
	jmp	.LBB7_6
.LBB7_5:
	movw	%ax, (%r14)
	movl	(%rbx,%rcx,4), %eax
	movl	%eax, (%rbx)
.LBB7_6:                                # %.loopexit
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end7:
	.size	_Z14findHighestCpuPtPiS_S0_, .Lfunc_end7-_Z14findHighestCpuPtPiS_S0_
	.cfi_endproc
                                        # -- End function
	.globl	_Z10printErrorv                 # -- Begin function _Z10printErrorv
	.type	_Z10printErrorv,@function
_Z10printErrorv:                        # @_Z10printErrorv
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	callq	hipGetLastError
	testl	%eax, %eax
	je	.LBB8_1
# %bb.2:
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str, %edi
	movq	%rax, %rsi
	xorl	%eax, %eax
	popq	%rcx
	.cfi_def_cfa_offset 8
	jmp	printf                          # TAILCALL
.LBB8_1:
	.cfi_def_cfa_offset 16
	popq	%rax
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end8:
	.size	_Z10printErrorv, .Lfunc_end8-_Z10printErrorv
	.cfi_endproc
                                        # -- End function
	.globl	main                            # -- Begin function 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	$88, %rsp
	.cfi_def_cfa_offset 144
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	leaq	40(%rsp), %rdi
	movl	$15003648, %esi                 # imm = 0xE4F000
	callq	hipMalloc
	leaq	32(%rsp), %rdi
	movl	$120000000, %esi                # imm = 0x7270E00
	callq	hipMalloc
	leaq	56(%rsp), %rbx
	movl	$3551232, %esi                  # imm = 0x363000
	movq	%rbx, %rdi
	callq	hipMalloc
	movq	(%rbx), %rdi
	xorl	%r13d, %r13d
	movl	$3551232, %edx                  # imm = 0x363000
	xorl	%esi, %esi
	callq	hipMemset
	leaq	24(%rsp), %rdi
	movl	$234432, %esi                   # imm = 0x393C0
	callq	hipMalloc
	leaq	16(%rsp), %rdi
	movl	$117216, %esi                   # imm = 0x1C9E0
	callq	hipMalloc
	leaq	48(%rsp), %rdi
	movl	$578, %esi                      # imm = 0x242
	callq	hipMalloc
	movl	$117216, %edi                   # imm = 0x1C9E0
	callq	malloc
	movq	%rax, %rbx
	movl	$234432, %edi                   # imm = 0x393C0
	callq	malloc
	movq	%rax, %r14
	leaq	72(%rsp), %r12
	movq	%r13, (%r12)
	leaq	64(%rsp), %r15
	movq	%r13, (%r15)
	movl	$-1875000, 8(%rsp)              # imm = 0xFFE363C8
	movl	$1875000, 12(%rsp)              # imm = 0x1C9C38
	movl	$0, 4(%rsp)
	movl	$.L.str.1, %edi
	xorl	%eax, %eax
	callq	printf
	movl	$.L.str.2, %edi
	movq	%r12, %rsi
	xorl	%eax, %eax
	callq	__isoc23_scanf
	movl	$.L.str.3, %edi
	xorl	%eax, %eax
	callq	printf
	movl	$.L.str.4, %edi
	movq	%r15, %rsi
	xorl	%eax, %eax
	callq	__isoc23_scanf
	cmpb	$100, (%r15)
	je	.LBB9_2
# %bb.1:
	leaq	64(%rsp), %rdi
	leaq	8(%rsp), %rdx
	movl	$.L.str.2, %esi
	xorl	%eax, %eax
	callq	__isoc23_sscanf
.LBB9_2:
	movl	$.L.str.5, %edi
	xorl	%eax, %eax
	callq	printf
	leaq	64(%rsp), %r15
	movl	$.L.str.4, %edi
	movq	%r15, %rsi
	xorl	%eax, %eax
	callq	__isoc23_scanf
	movl	$1875000, %eax                  # imm = 0x1C9C38
	cmpb	$100, (%r15)
	je	.LBB9_4
# %bb.3:
	leaq	64(%rsp), %rdi
	leaq	12(%rsp), %r15
	movl	$.L.str.2, %esi
	movq	%r15, %rdx
	xorl	%eax, %eax
	callq	__isoc23_sscanf
	movl	(%r15), %eax
.LBB9_4:
	movl	8(%rsp), %ecx
	cmpl	$-1875000, %ecx                 # imm = 0xFFE363C8
	jl	.LBB9_7
# %bb.5:
	cmpl	$1875000, %eax                  # imm = 0x1C9C38
	jg	.LBB9_7
# %bb.6:
	cmpl	%ecx, %eax
	jl	.LBB9_7
# %bb.8:
	movabsq	$4294968320, %r15               # imm = 0x100000400
	movl	$.L.str.7, %edi
	xorl	%eax, %eax
	callq	printf
	leaq	4(%rsp), %rsi
	movl	$.L.str.2, %edi
	xorl	%eax, %eax
	callq	__isoc23_scanf
	movl	$.Lstr, %edi
	callq	puts@PLT
	leaq	-1018(%r15), %rdi
	movl	$1, %esi
	movq	%r15, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB9_10
# %bb.9:
	movq	56(%rsp), %rdi
	callq	_Z34__device_stub__calcSpawnableBlocksPs
.LBB9_10:
	movabsq	$15732465205249, %r12           # imm = 0xE4F00000001
	movabsq	$4398046511105, %rbp            # imm = 0x40000000001
	callq	hipDeviceSynchronize
	movl	$578, %edi                      # imm = 0x242
	callq	malloc
	movq	%rax, %r15
	movl	$.Lstr.1, %edi
	callq	puts@PLT
	movq	%r15, %rdi
	callq	_Z25calcSecondSpawnableBlocksPs
	callq	hipDeviceSynchronize
	movq	48(%rsp), %rdi
	movl	$578, %edx                      # imm = 0x242
	movq	%r15, 80(%rsp)                  # 8-byte Spill
	movq	%r15, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	movl	$.Lstr.2, %edi
	callq	puts@PLT
	movq	%r12, %rdi
	movl	$1, %esi
	movq	%rbp, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB9_12
# %bb.11:
	movq	72(%rsp), %rdi
	movl	8(%rsp), %esi
	movq	40(%rsp), %rdx
	callq	_Z26__device_stub__setInitialXxiPi
.LBB9_12:
	callq	hipDeviceSynchronize
	movl	$.Lstr.3, %edi
	callq	puts@PLT
	addq	$15, %r12
	movq	%r12, %rdi
	movl	$1, %esi
	movq	%rbp, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB9_14
# %bb.13:
	movq	40(%rsp), %rdi
	movq	32(%rsp), %rsi
	movl	4(%rsp), %edx
	movq	56(%rsp), %rcx
	movq	48(%rsp), %r8
	callq	_Z20__device_stub__countPiPtiPsS1_
.LBB9_14:
	callq	hipDeviceSynchronize
	movl	$.Lstr.4, %edi
	callq	puts@PLT
	movabsq	$4294968320, %rdx               # imm = 0x100000400
	leaq	57584(%rdx), %r15
	movq	%r15, %rdi
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB9_16
# %bb.15:
	movq	32(%rsp), %rdi
	movq	16(%rsp), %rsi
	movq	24(%rsp), %rdx
	callq	_Z26__device_stub__findHighestPtS_Pi
.LBB9_16:
	callq	hipDeviceSynchronize
	movq	16(%rsp), %rdx
	movq	24(%rsp), %rcx
	movq	%rbx, %rdi
	movq	%r14, %rsi
	callq	_Z14findHighestCpuPtPiS_S0_
	movzwl	(%rbx), %esi
	movl	4(%rsp), %eax
	cmpl	%esi, %eax
	jge	.LBB9_18
# %bb.17:
	movl	(%r14), %edx
	movl	$.L.str.13, %edi
	xorl	%eax, %eax
	callq	printf
	movzwl	(%rbx), %eax
	movl	%eax, 4(%rsp)
	jmp	.LBB9_19
.LBB9_7:
	movl	$.L.str.6, %edi
	xorl	%eax, %eax
	callq	printf
	movl	$1, %eax
	jmp	.LBB9_22
.LBB9_18:
	movl	$.L.str.14, %edi
	movl	%eax, %esi
	xorl	%eax, %eax
	callq	printf
.LBB9_19:
	movl	$.Lstr.5, %edi
	callq	puts@PLT
	movl	8(%rsp), %r13d
.LBB9_20:                               # =>This Inner Loop Header: Depth=1
	addl	$16, %r13d
	cmpl	12(%rsp), %r13d
	jge	.LBB9_21
# %bb.23:                               # %.lr.ph
                                        #   in Loop: Header=BB9_20 Depth=1
	movabsq	$15732465205249, %rdi           # imm = 0xE4F00000001
	movl	$1, %esi
	movq	%rbp, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB9_25
# %bb.24:                               #   in Loop: Header=BB9_20 Depth=1
	movq	72(%rsp), %rdi
	movq	40(%rsp), %rdx
	movl	%r13d, %esi
	callq	_Z19__device_stub__setXxiPi
.LBB9_25:                               #   in Loop: Header=BB9_20 Depth=1
	callq	hipDeviceSynchronize
	movq	%r12, %rdi
	movl	$1, %esi
	movq	%rbp, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB9_27
# %bb.26:                               #   in Loop: Header=BB9_20 Depth=1
	movq	40(%rsp), %rdi
	movq	32(%rsp), %rsi
	movl	4(%rsp), %edx
	movq	56(%rsp), %rcx
	movq	48(%rsp), %r8
	callq	_Z20__device_stub__countPiPtiPsS1_
.LBB9_27:                               #   in Loop: Header=BB9_20 Depth=1
	callq	hipDeviceSynchronize
	movq	%r15, %rdi
	movl	$1, %esi
	movabsq	$4294968320, %rdx               # imm = 0x100000400
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB9_29
# %bb.28:                               #   in Loop: Header=BB9_20 Depth=1
	movq	32(%rsp), %rdi
	movq	16(%rsp), %rsi
	movq	24(%rsp), %rdx
	callq	_Z26__device_stub__findHighestPtS_Pi
.LBB9_29:                               #   in Loop: Header=BB9_20 Depth=1
	callq	hipDeviceSynchronize
	movq	16(%rsp), %rdx
	movq	24(%rsp), %rcx
	movq	%rbx, %rdi
	movq	%r14, %rsi
	callq	_Z14findHighestCpuPtPiS_S0_
	movzwl	(%rbx), %esi
	cmpl	%esi, 4(%rsp)
	jge	.LBB9_20
# %bb.30:                               #   in Loop: Header=BB9_20 Depth=1
	movl	(%r14), %edx
	leal	15(%rdx), %r9d
	testl	%edx, %edx
	cmovnsl	%edx, %r9d
	andl	$-16, %r9d
	movl	%edx, %r8d
	subl	%r9d, %r8d
	addl	%r13d, %r8d
	shll	$4, %r8d
	addl	$-30000000, %r9d                # imm = 0xFE363C80
	movl	$.L.str.16, %edi
                                        # kill: def $edx killed $edx killed $rdx
	movl	%r13d, %ecx
	xorl	%eax, %eax
	callq	printf
	movzwl	(%rbx), %eax
	movl	%eax, 4(%rsp)
	jmp	.LBB9_20
.LBB9_21:                               # %._crit_edge
	movq	40(%rsp), %rdi
	callq	hipFree
	movq	32(%rsp), %rdi
	callq	hipFree
	movq	56(%rsp), %rdi
	callq	hipFree
	movq	24(%rsp), %rdi
	callq	hipFree
	movq	16(%rsp), %rdi
	callq	hipFree
	movq	48(%rsp), %rdi
	callq	hipFree
	movq	%rbx, %rdi
	callq	free
	movq	%r14, %rdi
	callq	free
	movq	80(%rsp), %rdi                  # 8-byte Reload
	callq	free
	xorl	%eax, %eax
.LBB9_22:
	addq	$88, %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_end9:
	.size	main, .Lfunc_end9-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	.LBB10_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB10_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z11setInitialXxiPi, %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	$_Z4setXxiPi, %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	$_Z5countPiPtiPsS1_, %esi
	movl	$.L__unnamed_3, %edx
	movl	$.L__unnamed_3, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z19calcSpawnableBlocksPs, %esi
	movl	$.L__unnamed_4, %edx
	movl	$.L__unnamed_4, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z11findHighestPtS_Pi, %esi
	movl	$.L__unnamed_5, %edx
	movl	$.L__unnamed_5, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end10:
	.size	__hip_module_ctor, .Lfunc_end10-__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	.LBB11_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
.LBB11_2:
	retq
.Lfunc_end11:
	.size	__hip_module_dtor, .Lfunc_end11-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	_Z11setInitialXxiPi,@object     # @_Z11setInitialXxiPi
	.section	.rodata,"a",@progbits
	.globl	_Z11setInitialXxiPi
	.p2align	3, 0x0
_Z11setInitialXxiPi:
	.quad	_Z26__device_stub__setInitialXxiPi
	.size	_Z11setInitialXxiPi, 8

	.type	_Z4setXxiPi,@object             # @_Z4setXxiPi
	.globl	_Z4setXxiPi
	.p2align	3, 0x0
_Z4setXxiPi:
	.quad	_Z19__device_stub__setXxiPi
	.size	_Z4setXxiPi, 8

	.type	_Z5countPiPtiPsS1_,@object      # @_Z5countPiPtiPsS1_
	.globl	_Z5countPiPtiPsS1_
	.p2align	3, 0x0
_Z5countPiPtiPsS1_:
	.quad	_Z20__device_stub__countPiPtiPsS1_
	.size	_Z5countPiPtiPsS1_, 8

	.type	_Z19calcSpawnableBlocksPs,@object # @_Z19calcSpawnableBlocksPs
	.globl	_Z19calcSpawnableBlocksPs
	.p2align	3, 0x0
_Z19calcSpawnableBlocksPs:
	.quad	_Z34__device_stub__calcSpawnableBlocksPs
	.size	_Z19calcSpawnableBlocksPs, 8

	.type	_Z11findHighestPtS_Pi,@object   # @_Z11findHighestPtS_Pi
	.globl	_Z11findHighestPtS_Pi
	.p2align	3, 0x0
_Z11findHighestPtS_Pi:
	.quad	_Z26__device_stub__findHighestPtS_Pi
	.size	_Z11findHighestPtS_Pi, 8

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"Error: %s\n"
	.size	.L.str, 11

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"Enter seed: "
	.size	.L.str.1, 13

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"%d"
	.size	.L.str.2, 3

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"Enter x start (min is -1875000) ('d' for default -1875000): "
	.size	.L.str.3, 61

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"%s"
	.size	.L.str.4, 3

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"Enter x end (max is 1875000) ('d' for default 1875000): "
	.size	.L.str.5, 57

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"Illegal minx or maxx, range is -1875000 to 1875000 and minx must be smaller than maxx"
	.size	.L.str.6, 86

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"Enter highest to begin with: "
	.size	.L.str.7, 30

	.type	.L.str.13,@object               # @.str.13
.L.str.13:
	.asciz	"New highest in first row: %u - %u\n"
	.size	.L.str.13, 35

	.type	.L.str.14,@object               # @.str.14
.L.str.14:
	.asciz	"No new highest in first row, continuing with %d\n"
	.size	.L.str.14, 49

	.type	.L.str.16,@object               # @.str.16
.L.str.16:
	.asciz	"New highest value: %u - %u with i %d, absolute location: %d, %d\n"
	.size	.L.str.16, 65

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z11setInitialXxiPi"
	.size	.L__unnamed_1, 20

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z4setXxiPi"
	.size	.L__unnamed_2, 12

	.type	.L__unnamed_3,@object           # @2
.L__unnamed_3:
	.asciz	"_Z5countPiPtiPsS1_"
	.size	.L__unnamed_3, 19

	.type	.L__unnamed_4,@object           # @3
.L__unnamed_4:
	.asciz	"_Z19calcSpawnableBlocksPs"
	.size	.L__unnamed_4, 26

	.type	.L__unnamed_5,@object           # @4
.L__unnamed_5:
	.asciz	"_Z11findHighestPtS_Pi"
	.size	.L__unnamed_5, 22

	.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

	.type	.Lstr,@object                   # @str
	.section	.rodata.str1.1,"aMS",@progbits,1
.Lstr:
	.asciz	"Calculating spawnable blocks"
	.size	.Lstr, 29

	.type	.Lstr.1,@object                 # @str.1
.Lstr.1:
	.asciz	"Calculating second spawnable blocks"
	.size	.Lstr.1, 36

	.type	.Lstr.2,@object                 # @str.2
.Lstr.2:
	.asciz	"Setting initial X"
	.size	.Lstr.2, 18

	.type	.Lstr.3,@object                 # @str.3
.Lstr.3:
	.asciz	"Counting slime chunks/blocks"
	.size	.Lstr.3, 29

	.type	.Lstr.4,@object                 # @str.4
.Lstr.4:
	.asciz	"Finding highest chunk"
	.size	.Lstr.4, 22

	.type	.Lstr.5,@object                 # @str.5
.Lstr.5:
	.asciz	"Starting computation of other chunks"
	.size	.Lstr.5, 37

	.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 _Z26__device_stub__setInitialXxiPi
	.addrsig_sym _Z19__device_stub__setXxiPi
	.addrsig_sym _Z20__device_stub__countPiPtiPsS1_
	.addrsig_sym _Z34__device_stub__calcSpawnableBlocksPs
	.addrsig_sym _Z26__device_stub__findHighestPtS_Pi
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Z11setInitialXxiPi
	.addrsig_sym _Z4setXxiPi
	.addrsig_sym _Z5countPiPtiPsS1_
	.addrsig_sym _Z19calcSpawnableBlocksPs
	.addrsig_sym _Z11findHighestPtS_Pi
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z11setInitialXxiPi     ; -- Begin function _Z11setInitialXxiPi
	.globl	_Z11setInitialXxiPi
	.p2align	8
	.type	_Z11setInitialXxiPi,@function
_Z11setInitialXxiPi:                    ; @_Z11setInitialXxiPi
; %bb.0:
	s_load_b32 s2, s[0:1], 0x24
	v_bfe_u32 v2, v0, 10, 10
	s_load_b64 s[4:5], s[0:1], 0x0
	s_mov_b32 s3, 0
	s_waitcnt lgkmcnt(0)
	s_lshr_b32 s2, s2, 16
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[0:1], null, s15, s2, v[2:3]
	s_load_b32 s2, s[0:1], 0x8
	v_add_nc_u32_e32 v1, 0xffe363c8, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_mul_lo_u32 v2, 0x5f24f, v1
	v_mul_lo_u32 v5, v1, v1
	v_ashrrev_i32_e32 v4, 31, v2
	v_add_co_u32 v3, vcc_lo, v2, s4
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_co_ci_u32_e32 v4, vcc_lo, s5, v4, vcc_lo
	v_mad_i64_i32 v[1:2], null, 0x4307a7, v5, v[3:4]
	v_mov_b32_e32 v3, 0
.LBB0_1:                                ; =>This Inner Loop Header: Depth=1
	s_waitcnt lgkmcnt(0)
	s_add_i32 s4, s2, s3
	s_delay_alu instid0(SALU_CYCLE_1)
	s_mul_i32 s5, s4, s4
	s_mul_i32 s4, s4, 0x5ac0db
	s_mul_i32 s5, s5, 0x4c1906
	s_ashr_i32 s6, s4, 31
	s_ashr_i32 s7, s5, 31
	s_add_u32 s4, s5, s4
	s_addc_u32 s5, s7, s6
	v_add_co_u32 v4, vcc_lo, s4, v1
	v_add_co_ci_u32_e32 v5, vcc_lo, s5, v2, vcc_lo
	s_xor_b32 s4, s3, 31
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_xor_b32_e32 v6, 0xe434e432, v4
	s_add_i32 s3, s3, 1
	v_xor_b32_e32 v7, 5, v5
	s_cmp_eq_u32 s3, 32
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_mad_u64_u32 v[4:5], null, 0xdeece66d, v6, 11
	v_mul_lo_u32 v7, 0xdeece66d, v7
	v_lshl_add_u32 v6, v6, 2, v6
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add3_u32 v5, v7, v5, v6
	v_alignbit_b32 v4, v5, v4, 17
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_and_b32_e32 v4, 0x7fffffff, v4
	v_mul_lo_u32 v4, 0xcccccccd, v4
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_alignbit_b32 v4, v4, v4, 1
	v_cmp_gt_u32_e32 vcc_lo, 0x1999999a, v4
	v_cndmask_b32_e64 v4, 0, 1, vcc_lo
	s_delay_alu instid0(VALU_DEP_1)
	v_lshl_or_b32 v3, v4, s4, v3
	s_cbranch_scc0 .LBB0_1
; %bb.2:
	s_load_b64 s[0:1], s[0:1], 0x10
	v_ashrrev_i32_e32 v1, 31, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[0:1], 2, v[0:1]
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v0, vcc_lo, s0, v0
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
	global_store_b32 v[0:1], v3, off
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z11setInitialXxiPi
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 280
		.amdhsa_user_sgpr_count 14
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 1
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 1
		.amdhsa_next_free_vgpr 8
		.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_end0:
	.size	_Z11setInitialXxiPi, .Lfunc_end0-_Z11setInitialXxiPi
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 400
; NumSgprs: 18
; NumVgprs: 8
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 8
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 14
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 1
	.text
	.protected	_Z4setXxiPi             ; -- Begin function _Z4setXxiPi
	.globl	_Z4setXxiPi
	.p2align	8
	.type	_Z4setXxiPi,@function
_Z4setXxiPi:                            ; @_Z4setXxiPi
; %bb.0:
	s_clause 0x1
	s_load_b32 s4, s[0:1], 0x24
	s_load_b64 s[2:3], s[0:1], 0x10
	v_bfe_u32 v0, v0, 10, 10
	s_waitcnt lgkmcnt(0)
	s_lshr_b32 s4, s4, 16
	s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1)
	v_mad_u64_u32 v[2:3], null, s15, s4, v[0:1]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v3, 31, v2
	v_lshlrev_b64 v[0:1], 2, v[2:3]
	v_add_nc_u32_e32 v2, 0xffe363c8, v2
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_mul_lo_u32 v3, 0x5f24f, v2
	v_add_co_u32 v0, vcc_lo, s2, v0
	s_delay_alu instid0(VALU_DEP_4)
	v_add_co_ci_u32_e32 v1, vcc_lo, s3, v1, vcc_lo
	s_clause 0x1
	s_load_b64 s[2:3], s[0:1], 0x0
	s_load_b32 s0, s[0:1], 0x8
	v_mul_lo_u32 v7, v2, v2
	global_load_b32 v6, v[0:1], off
	v_ashrrev_i32_e32 v5, 31, v3
	s_mov_b32 s1, 16
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v4, vcc_lo, v3, s2
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_co_ci_u32_e32 v5, vcc_lo, s3, v5, vcc_lo
	v_mad_i64_i32 v[2:3], null, 0x4307a7, v7, v[4:5]
	s_waitcnt vmcnt(0)
	v_lshlrev_b32_e32 v4, 16, v6
.LBB1_1:                                ; =>This Inner Loop Header: Depth=1
	s_add_i32 s2, s0, s1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_mul_i32 s3, s2, s2
	s_mul_i32 s2, s2, 0x5ac0db
	s_mul_i32 s3, s3, 0x4c1906
	s_ashr_i32 s4, s2, 31
	s_ashr_i32 s5, s3, 31
	s_add_u32 s2, s3, s2
	s_addc_u32 s3, s5, s4
	v_add_co_u32 v5, vcc_lo, s2, v2
	v_add_co_ci_u32_e32 v6, vcc_lo, s3, v3, vcc_lo
	s_xor_b32 s2, s1, 31
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_xor_b32_e32 v7, 0xe434e432, v5
	s_add_i32 s1, s1, 1
	v_xor_b32_e32 v8, 5, v6
	s_cmp_eq_u32 s1, 32
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_mad_u64_u32 v[5:6], null, 0xdeece66d, v7, 11
	v_mul_lo_u32 v8, 0xdeece66d, v8
	v_lshl_add_u32 v7, v7, 2, v7
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add3_u32 v6, v8, v6, v7
	v_alignbit_b32 v5, v6, v5, 17
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_and_b32_e32 v5, 0x7fffffff, v5
	v_mul_lo_u32 v5, 0xcccccccd, v5
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_alignbit_b32 v5, v5, v5, 1
	v_cmp_gt_u32_e32 vcc_lo, 0x1999999a, v5
	v_cndmask_b32_e64 v5, 0, 1, vcc_lo
	s_delay_alu instid0(VALU_DEP_1)
	v_lshl_or_b32 v4, v5, s2, v4
	s_cbranch_scc0 .LBB1_1
; %bb.2:
	global_store_b32 v[0:1], v4, off
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z4setXxiPi
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 280
		.amdhsa_user_sgpr_count 14
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 1
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 1
		.amdhsa_next_free_vgpr 9
		.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_end1:
	.size	_Z4setXxiPi, .Lfunc_end1-_Z4setXxiPi
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 416
; NumSgprs: 18
; NumVgprs: 9
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 9
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 14
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 1
	.text
	.protected	_Z5countPiPtiPsS1_      ; -- Begin function _Z5countPiPtiPsS1_
	.globl	_Z5countPiPtiPsS1_
	.p2align	8
	.type	_Z5countPiPtiPsS1_,@function
_Z5countPiPtiPsS1_:                     ; @_Z5countPiPtiPsS1_
; %bb.0:
	s_load_b32 s2, s[0:1], 0x34
	v_bfe_u32 v2, v0, 10, 10
	s_waitcnt lgkmcnt(0)
	s_lshr_b32 s3, s2, 16
	s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1)
	v_mad_u64_u32 v[0:1], null, s15, s3, v[2:3]
	s_mov_b32 s3, exec_lo
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_gt_i32_e32 0x393870, v0
	s_cbranch_execz .LBB2_29
; %bb.1:
	s_load_b128 s[4:7], s[0:1], 0x0
	s_and_b32 s2, s2, 0xffff
	v_mov_b32_e32 v1, v0
	s_mul_i32 s14, s14, s2
	s_mov_b32 s3, 0
	s_sub_i32 s2, 15, s14
.LBB2_2:                                ; =>This Inner Loop Header: Depth=1
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(SALU_CYCLE_1)
	v_ashrrev_i32_e32 v2, 31, v1
	s_add_i32 s8, s3, 16
	s_add_i32 s3, s3, 4
	s_cmpk_lg_i32 s3, 0x44
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_2)
	v_lshlrev_b64 v[2:3], 2, v[1:2]
	v_add_nc_u32_e32 v1, 1, v1
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v2, vcc_lo, s4, v2
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_3) | instid1(VALU_DEP_1)
	v_add_co_ci_u32_e32 v3, vcc_lo, s5, v3, vcc_lo
	global_load_b32 v2, v[2:3], off
	s_waitcnt vmcnt(0)
	v_ashrrev_i32_e32 v2, s2, v2
	v_and_b32_e32 v2, 0x1ffff, v2
	scratch_store_b32 off, v2, s8
	s_cbranch_scc1 .LBB2_2
; %bb.3:                                ; %.preheader76.preheader
	v_mov_b32_e32 v1, 0
	s_mov_b32 s2, 0
.LBB2_4:                                ; %.preheader76
                                        ; =>This Inner Loop Header: Depth=1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_add_i32 s3, s2, 16
	s_add_i32 s2, s2, 4
	scratch_load_b32 v2, off, s3
	s_cmpk_eq_i32 s2, 0x44
	s_waitcnt vmcnt(0)
	v_bcnt_u32_b32 v1, v2, v1
	s_cbranch_scc0 .LBB2_4
; %bb.5:
	s_load_b32 s4, s[0:1], 0x10
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_2)
	v_bfe_i32 v1, v1, 0, 16
	v_lshl_add_u32 v0, v0, 4, s14
	s_mov_b32 s2, exec_lo
	v_lshlrev_b32_e32 v1, 8, v1
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_ge_i32_e64 s4, v1
	s_xor_b32 s2, exec_lo, s2
	s_cbranch_execz .LBB2_7
; %bb.6:
	v_ashrrev_i32_e32 v1, 31, v0
	v_mov_b32_e32 v2, 0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[0:1], 1, v[0:1]
	v_add_co_u32 v0, vcc_lo, s6, v0
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v1, vcc_lo, s7, v1, vcc_lo
	global_store_b16 v[0:1], v2, off
                                        ; implicit-def: $vgpr0
.LBB2_7:                                ; %Flow147
	s_and_not1_saveexec_b32 s2, s2
	s_cbranch_execz .LBB2_29
; %bb.8:
	v_mov_b32_e32 v1, 0x60
	s_mov_b32 s2, 0
.LBB2_9:                                ; %.preheader75
                                        ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB2_10 Depth 2
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	s_lshl_b32 s3, s2, 2
	v_mov_b32_e32 v3, v1
	s_add_i32 s3, s3, 16
	scratch_load_b32 v2, off, s3
	s_mov_b32 s3, 16
.LBB2_10:                               ;   Parent Loop BB2_9 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	s_waitcnt vmcnt(0)
	v_bfe_u32 v4, v2, s3, 1
	s_add_i32 s3, s3, -1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmp_eq_u32 s3, -1
	scratch_store_b32 v3, v4, off
	v_add_nc_u32_e32 v3, 4, v3
	s_cbranch_scc0 .LBB2_10
; %bb.11:                               ;   in Loop: Header=BB2_9 Depth=1
	v_add_nc_u32_e32 v1, 0x44, v1
	s_add_i32 s2, s2, 1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmp_lg_u32 s2, 17
	s_cbranch_scc1 .LBB2_9
; %bb.12:                               ; %.preheader74.preheader
	s_load_b128 s[0:3], s[0:1], 0x18
	v_dual_mov_b32 v1, 0 :: v_dual_mov_b32 v2, 0
	s_mov_b32 s5, 0
.LBB2_13:                               ; %.preheader74
                                        ; =>This Inner Loop Header: Depth=1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_add_i32 s8, s5, 0x60
	scratch_load_b32 v3, off, s8
	s_waitcnt vmcnt(0)
	v_cmp_eq_u32_e32 vcc_lo, 1, v3
	v_mov_b32_e32 v3, 0
	s_and_saveexec_b32 s8, vcc_lo
	s_cbranch_execz .LBB2_15
; %bb.14:                               ;   in Loop: Header=BB2_13 Depth=1
	s_waitcnt lgkmcnt(0)
	global_load_u16 v3, v1, s[2:3]
.LBB2_15:                               ;   in Loop: Header=BB2_13 Depth=1
	s_or_b32 exec_lo, exec_lo, s8
	s_waitcnt vmcnt(0)
	v_add_nc_u16 v2, v3, v2
	s_add_i32 s5, s5, 4
	s_waitcnt lgkmcnt(0)
	s_add_u32 s2, s2, 2
	s_addc_u32 s3, s3, 0
	s_cmpk_eq_i32 s5, 0x484
	s_cbranch_scc0 .LBB2_13
; %bb.16:
	v_bfe_i32 v1, v2, 0, 16
	s_mov_b32 s2, exec_lo
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_ge_i32_e64 s4, v1
	s_xor_b32 s2, exec_lo, s2
	s_cbranch_execz .LBB2_18
; %bb.17:
	v_ashrrev_i32_e32 v1, 31, v0
	v_mov_b32_e32 v2, 0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[0:1], 1, v[0:1]
	v_add_co_u32 v0, vcc_lo, s6, v0
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v1, vcc_lo, s7, v1, vcc_lo
	global_store_b16 v[0:1], v2, off
                                        ; implicit-def: $vgpr0
.LBB2_18:                               ; %Flow145
	s_and_not1_saveexec_b32 s2, s2
	s_cbranch_execz .LBB2_29
; %bb.19:                               ; %.preheader.preheader
	v_dual_mov_b32 v1, 0 :: v_dual_mov_b32 v2, 0
	s_mov_b32 s5, 0
.LBB2_20:                               ; %.preheader
                                        ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB2_21 Depth 2
	v_dual_mov_b32 v3, 0x60 :: v_dual_mov_b32 v4, 0
	s_mov_b64 s[2:3], 0
.LBB2_21:                               ;   Parent Loop BB2_20 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	scratch_load_b32 v5, v3, off
	s_waitcnt vmcnt(0)
	v_cmp_eq_u32_e32 vcc_lo, 1, v5
	v_mov_b32_e32 v5, 0
	s_and_saveexec_b32 s8, vcc_lo
	s_cbranch_execz .LBB2_23
; %bb.22:                               ;   in Loop: Header=BB2_21 Depth=2
	s_add_u32 s10, s0, s2
	s_addc_u32 s11, s1, s3
	global_load_u16 v5, v1, s[10:11]
.LBB2_23:                               ;   in Loop: Header=BB2_21 Depth=2
	s_or_b32 exec_lo, exec_lo, s8
	s_waitcnt vmcnt(0)
	v_add_nc_u16 v4, v5, v4
	v_add_nc_u32_e32 v3, 4, v3
	s_add_u32 s2, s2, 2
	s_addc_u32 s3, s3, 0
	s_cmpk_eq_i32 s2, 0x242
	s_cbranch_scc0 .LBB2_21
; %bb.24:                               ;   in Loop: Header=BB2_20 Depth=1
	v_max_i16 v2, v4, v2
	s_add_i32 s5, s5, 1
	s_add_u32 s0, s0, 0x242
	s_addc_u32 s1, s1, 0
	s_cmpk_eq_i32 s5, 0x1800
	s_cbranch_scc0 .LBB2_20
; %bb.25:
	v_ashrrev_i32_e32 v1, 31, v0
	v_and_b32_e32 v3, 0xffff, v2
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[0:1], 1, v[0:1]
	v_add_co_u32 v0, s0, s6, v0
	s_delay_alu instid0(VALU_DEP_1)
	v_add_co_ci_u32_e64 v1, s0, s7, v1, s0
	s_mov_b32 s0, exec_lo
	v_cmpx_ge_i32_e64 s4, v3
	s_xor_b32 s0, exec_lo, s0
	s_cbranch_execz .LBB2_27
; %bb.26:
	v_mov_b32_e32 v3, 0
	global_store_b16 v[0:1], v3, off
                                        ; implicit-def: $vgpr0_vgpr1
.LBB2_27:                               ; %Flow
	s_and_not1_saveexec_b32 s0, s0
	s_cbranch_execz .LBB2_29
; %bb.28:
	global_store_b16 v[0:1], v2, off
.LBB2_29:
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z5countPiPtiPsS1_
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 1264
		.amdhsa_kernarg_size 296
		.amdhsa_user_sgpr_count 14
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 1
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 1
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 1
		.amdhsa_next_free_vgpr 6
		.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	_Z5countPiPtiPsS1_, .Lfunc_end2-_Z5countPiPtiPsS1_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 876
; NumSgprs: 18
; NumVgprs: 6
; ScratchSize: 1264
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 6
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 1
; COMPUTE_PGM_RSRC2:USER_SGPR: 14
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 1
	.text
	.protected	_Z19calcSpawnableBlocksPs ; -- Begin function _Z19calcSpawnableBlocksPs
	.globl	_Z19calcSpawnableBlocksPs
	.p2align	8
	.type	_Z19calcSpawnableBlocksPs,@function
_Z19calcSpawnableBlocksPs:              ; @_Z19calcSpawnableBlocksPs
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x14
	s_load_b64 s[0:1], s[0:1], 0x0
	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_movk_i32 s2, 0xff80
	v_mul_hi_i32 v0, 0x2aaaaaab, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_lshrrev_b32_e32 v2, 31, v0
	v_ashrrev_i32_e32 v0, 6, v0
	v_add_nc_u32_e32 v6, v0, v2
	v_ashrrev_i32_e32 v2, 31, v1
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_mul_i32_i24_e32 v0, 0x180, v6
	v_lshrrev_b32_e32 v2, 28, v2
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_sub_nc_u32_e32 v0, v1, v0
	v_add_nc_u32_e32 v2, v1, v2
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_ashrrev_i16 v3, 15, v0
	v_and_b32_e32 v2, -16, v2
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_lshrrev_b16 v3, 12, v3
	v_sub_nc_u32_e32 v7, v1, v2
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_nc_u16 v0, v0, v3
	v_mul_i32_i24_e32 v2, 0x1b18, v7
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i16 v0, 4, v0
	v_bfe_i32 v1, v0, 0, 16
	v_mul_i32_i24_e32 v0, 0x1b180, v6
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_mul_i32_i24_e32 v3, 0x121, v1
	v_mul_i32_i24_e32 v1, v1, v1
	v_add3_u32 v0, v0, v2, v3
.LBB3_1:                                ; %.preheader
                                        ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB3_2 Depth 2
                                        ;       Child Loop BB3_4 Depth 3
	v_subrev_nc_u32_e32 v4, s2, v6
	s_add_i32 s3, s2, 0x80
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	s_lshr_b32 s3, s3, 4
	v_mad_u64_u32 v[2:3], null, v4, v4, v[1:2]
	v_mad_u64_u32 v[3:4], null, s3, 17, v[0:1]
	s_movk_i32 s3, 0xff80
.LBB3_2:                                ;   Parent Loop BB3_1 Depth=1
                                        ; =>  This Loop Header: Depth=2
                                        ;       Child Loop BB3_4 Depth 3
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_subrev_nc_u32_e32 v8, s3, v7
	s_mov_b32 s4, exec_lo
	v_mad_u64_u32 v[4:5], null, v8, v8, v[2:3]
	s_delay_alu instid0(VALU_DEP_1)
	v_mov_b32_e32 v5, v4
	v_cmpx_lt_u32_e32 1, v4
	s_cbranch_execz .LBB3_6
; %bb.3:                                ; %.lr.ph.i.preheader
                                        ;   in Loop: Header=BB3_2 Depth=2
	s_mov_b32 s5, 0
	s_mov_b32 s6, 0
.LBB3_4:                                ; %.lr.ph.i
                                        ;   Parent Loop BB3_1 Depth=1
                                        ;     Parent Loop BB3_2 Depth=2
                                        ; =>    This Inner Loop Header: Depth=3
	s_delay_alu instid0(SALU_CYCLE_1)
	s_add_i32 s7, s6, 2
	s_add_i32 s6, s6, 1
	s_mul_i32 s7, s7, s7
	v_mov_b32_e32 v5, s6
	v_cmp_gt_u32_e32 vcc_lo, s7, v4
	s_or_b32 s5, vcc_lo, s5
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_not1_b32 exec_lo, exec_lo, s5
	s_cbranch_execnz .LBB3_4
; %bb.5:                                ; %Flow
                                        ;   in Loop: Header=BB3_2 Depth=2
	s_or_b32 exec_lo, exec_lo, s5
.LBB3_6:                                ; %Flow35
                                        ;   in Loop: Header=BB3_2 Depth=2
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	s_or_b32 exec_lo, exec_lo, s4
	v_subrev_nc_u32_e32 v4, 25, v5
	s_mov_b32 s4, exec_lo
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_gt_u32_e32 0x68, v4
	s_cbranch_execz .LBB3_8
; %bb.7:                                ;   in Loop: Header=BB3_2 Depth=2
	s_add_i32 s5, s3, 0x80
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_lshr_b32 s5, s5, 4
	v_add_nc_u32_e32 v4, s5, v3
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v5, 31, v4
	v_lshlrev_b64 v[4:5], 1, v[4:5]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v4, vcc_lo, s0, v4
	v_add_co_ci_u32_e32 v5, vcc_lo, s1, v5, vcc_lo
	global_load_u16 v8, v[4:5], off
	s_waitcnt vmcnt(0)
	v_add_nc_u16 v8, v8, 1
	global_store_b16 v[4:5], v8, off
.LBB3_8:                                ;   in Loop: Header=BB3_2 Depth=2
	s_or_b32 exec_lo, exec_lo, s4
	s_add_i32 s3, s3, 1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmpk_eq_i32 s3, 0x91
	s_cbranch_scc0 .LBB3_2
; %bb.9:                                ;   in Loop: Header=BB3_1 Depth=1
	s_add_i32 s2, s2, 1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmpk_eq_i32 s2, 0x91
	s_cbranch_scc0 .LBB3_1
; %bb.10:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z19calcSpawnableBlocksPs
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 264
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 9
		.amdhsa_next_free_sgpr 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_end3:
	.size	_Z19calcSpawnableBlocksPs, .Lfunc_end3-_Z19calcSpawnableBlocksPs
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 500
; NumSgprs: 18
; NumVgprs: 9
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 9
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.protected	_Z11findHighestPtS_Pi   ; -- Begin function _Z11findHighestPtS_Pi
	.globl	_Z11findHighestPtS_Pi
	.p2align	8
	.type	_Z11findHighestPtS_Pi,@function
_Z11findHighestPtS_Pi:                  ; @_Z11findHighestPtS_Pi
; %bb.0:
	s_load_b32 s3, s[0:1], 0x24
	s_mov_b32 s2, s15
	s_mov_b32 s4, exec_lo
	s_waitcnt lgkmcnt(0)
	s_and_b32 s3, s3, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s2, s3, v[0:1]
	v_cmpx_gt_u32_e32 0x3938400, v1
	s_cbranch_execz .LBB4_9
; %bb.1:
	s_load_b128 s[4:7], s[0:1], 0x0
	v_mov_b32_e32 v2, 0
	s_cmp_lt_u32 s3, 2
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[2:3], 1, v[1:2]
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v2, vcc_lo, s4, v2
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v3, vcc_lo, s5, v3, vcc_lo
	global_load_u16 v4, v[2:3], off
	v_lshlrev_b32_e32 v3, 1, v0
	v_lshlrev_b32_e32 v2, 2, v0
	s_waitcnt vmcnt(0)
	ds_store_b16 v3, v4 offset:4096
	ds_store_b32 v2, v1
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
	s_cbranch_scc1 .LBB4_7
; %bb.2:
	v_or_b32_e32 v1, 0x1000, v3
.LBB4_3:                                ; %.lr.ph
                                        ; =>This Inner Loop Header: Depth=1
	s_mov_b32 s4, s3
	s_lshr_b32 s3, s3, 1
	s_mov_b32 s5, exec_lo
	v_cmpx_gt_u32_e64 s3, v0
	s_cbranch_execz .LBB4_6
; %bb.4:                                ;   in Loop: Header=BB4_3 Depth=1
	v_lshl_add_u32 v3, s3, 1, v1
	ds_load_u16 v3, v3
	ds_load_u16 v4, v1
	s_waitcnt lgkmcnt(0)
	v_cmp_gt_i16_e32 vcc_lo, v3, v4
	s_and_b32 exec_lo, exec_lo, vcc_lo
	s_cbranch_execz .LBB4_6
; %bb.5:                                ;   in Loop: Header=BB4_3 Depth=1
	v_lshl_add_u32 v4, s3, 2, v2
	ds_load_b32 v4, v4
	ds_store_b16 v1, v3
	s_waitcnt lgkmcnt(1)
	ds_store_b32 v2, v4
.LBB4_6:                                ;   in Loop: Header=BB4_3 Depth=1
	s_or_b32 exec_lo, exec_lo, s5
	s_cmp_lt_u32 s4, 4
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
	s_cbranch_scc0 .LBB4_3
.LBB4_7:                                ; %._crit_edge
	v_cmp_eq_u32_e32 vcc_lo, 0, v0
	s_mov_b32 s3, 0
	s_and_b32 exec_lo, exec_lo, vcc_lo
	s_cbranch_execz .LBB4_9
; %bb.8:
	s_load_b64 s[0:1], s[0:1], 0x10
	v_mov_b32_e32 v0, 0
	s_lshl_b64 s[4:5], s[2:3], 2
	ds_load_u16 v1, v0 offset:4096
	ds_load_b32 v2, v0
	s_waitcnt lgkmcnt(0)
	s_add_u32 s0, s0, s4
	s_addc_u32 s1, s1, s5
	s_lshl_b64 s[2:3], s[2:3], 1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_add_u32 s2, s6, s2
	s_addc_u32 s3, s7, s3
	s_clause 0x1
	global_store_b16 v0, v1, s[2:3]
	global_store_b32 v0, v2, s[0:1]
.LBB4_9:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z11findHighestPtS_Pi
		.amdhsa_group_segment_fixed_size 6144
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 280
		.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 5
		.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_end4:
	.size	_Z11findHighestPtS_Pi, .Lfunc_end4-_Z11findHighestPtS_Pi
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 400
; NumSgprs: 18
; NumVgprs: 5
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 6144 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 5
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgpu_metadata
---
amdhsa.kernels:
  - .args:
      - .offset:         0
        .size:           8
        .value_kind:     by_value
      - .offset:         8
        .size:           4
        .value_kind:     by_value
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .offset:         24
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         28
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         36
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         38
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         40
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         42
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         44
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         46
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         64
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         88
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 280
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z11setInitialXxiPi
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z11setInitialXxiPi.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     8
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .offset:         0
        .size:           8
        .value_kind:     by_value
      - .offset:         8
        .size:           4
        .value_kind:     by_value
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .offset:         24
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         28
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         36
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         38
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         40
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         42
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         44
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         46
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         64
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         88
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 280
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z4setXxiPi
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z4setXxiPi.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     9
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .offset:         16
        .size:           4
        .value_kind:     by_value
      - .address_space:  global
        .offset:         24
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         32
        .size:           8
        .value_kind:     global_buffer
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         44
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         48
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         52
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         54
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         56
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         58
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         60
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         62
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         96
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         104
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 296
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z5countPiPtiPsS1_
    .private_segment_fixed_size: 1264
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z5countPiPtiPsS1_.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     6
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .offset:         8
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         12
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         16
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         20
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         22
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         24
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         26
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         28
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         30
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         48
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         56
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         64
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         72
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 264
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z19calcSpawnableBlocksPs
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z19calcSpawnableBlocksPs.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     9
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .offset:         24
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         28
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         36
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         38
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         40
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         42
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         44
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         46
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         64
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         88
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 6144
    .kernarg_segment_align: 8
    .kernarg_segment_size: 280
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z11findHighestPtS_Pi
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z11findHighestPtS_Pi.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     5
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
