
#include <error.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <cuda_runtime.h>

#define DEVICE_NUMBER (0)

typedef struct {
    int nofThreads;
    int nofBlocks;
    int32_t nof_repetitions;
    int data_size;
    int buffer_length;
    unsigned int *targetMeasOH;
    unsigned int hostMeasOH;
    int *hostBuffer;
    int *targetBuffer;
    uint64_t *target_realSum;
    uint64_t host_realSum;
    unsigned int *target_times;
    unsigned int *host_times;
    FILE *fd;
} param_t;

// Prints a message and returns zero if the given value is not cudaSuccess
#define CheckCUDAError(val) (InternalCheckCUDAError((val), #val, __FILE__, __LINE__))

// Called internally by CheckCUDAError
static int InternalCheckCUDAError(cudaError_t result, const char *fn,
        const char *file, int line) {
    if (result == cudaSuccess) return 0;
    printf("CUDA error %d in %s, line %d (%s): %s\n", (int) result, file, line,
            fn, cudaGetErrorString(result));
    return -1;
}

static void createSequentialArrayHost(param_t params){
    // Link sequentially
    for(int i = 0; i < params.buffer_length; i++){
        params.hostBuffer[i]=(i+params.nofThreads*params.nofBlocks)%params.buffer_length;
    }
}

static __global__ void getMeasurementOverhead(param_t params) {
    unsigned int start, stop;
    uint64_t sum = 0;
    start = clock();
    for (int j = 0; j < params.buffer_length; j++){
        sum +=j;
    }
    stop = clock();
    *params.targetMeasOH = (stop-start)/params.buffer_length;
    *params.target_realSum = sum;
}

static __global__ void sequentialWalk(param_t params) {
    int current;
    unsigned int time_start, time_end, time_acc;
    uint64_t sum;

    int tindex = blockDim.x*blockIdx.x*params.nof_repetitions + params.nof_repetitions *threadIdx.x;

    // Warm up data cache    
    for(int i = 0; i < params.buffer_length; i++){
        sum += params.targetBuffer[i%params.buffer_length];
    }

    // Run experiment multiple times. First iteration (-1) is to warm up icache
    for (int i = -2; i < params.nof_repetitions; i++){

        sum = 0;
        time_acc = 0;
        current = (blockDim.x*blockIdx.x + threadIdx.x)%params.buffer_length;

        __syncthreads();
        time_start = clock();
        // Strided access to array
        for(int j = 0; j < params.buffer_length; j++){
            current = params.targetBuffer[current];
            sum += current;
        }
        time_end = clock();
        time_acc += (time_end - time_start);
        __syncthreads();

        *params.target_realSum = sum;

        // Do not write time for warm up iteration       
        if (i>=0){
            // Write element access time with measurement overhead
            params.target_times[tindex+i] = time_acc/params.buffer_length-(*params.targetMeasOH);
        }
    }
}

#if 0
static void printArray(int* buffer, int size){
    printf("%d\n",size);
    for( int row = 0; row <= ceil(size/10); row++){
        for(int i = row*10; i< row*10+10 && i<size; i++)
            printf("[%4d] ",i);
        printf("\n");
        for(int i = row*10; i< row*10+10 && i<size; i++)
            printf(" %4d, ",buffer[i]);
        printf("\n");
    }

}
#endif

static int initializeTest(param_t *params){
    //allocate buffer
    params->hostBuffer = NULL;
    params->hostBuffer = (int *) malloc(params->buffer_length*sizeof(int));
    if (!params->hostBuffer) {
        perror("Failed allocating host buffer: ");
        return  -1;
    }
    createSequentialArrayHost(*params);
    //allocate device random buffer
    if (CheckCUDAError(cudaMalloc(&params->targetBuffer, \
                    params->buffer_length*sizeof(int)))) return -1;    
/*    
    createSequentialArray<<<params->nofBlocks,params->nofThreads>>>(*params);
    if (CheckCUDAError(cudaDeviceSynchronize())) return -1;
    if (CheckCUDAError(cudaMemcpy(params->hostBuffer, \
                    params->targetBuffer, \
                    params->buffer_length*sizeof(int), \
                    cudaMemcpyDeviceToHost))) return -1;
*/
#if 0
    printArray(params->hostBuffer, params->buffer_length);
#endif

    //allocate device times
    int size_time = params->nof_repetitions \
                    * params->nofThreads \
                    * params->nofBlocks \
                    * sizeof(unsigned int);

    if (CheckCUDAError(cudaMalloc(&params->target_times, \
                    size_time))) return -1;

    //allocate host times
    params->host_times = NULL;
    params->host_times = (unsigned int *) malloc(size_time);
    if (!params->host_times) {
        perror("Failed allocating host_times buffer: ");
        return  -1;
    }
    memset(params->host_times,1, size_time);

    // Allocate device accumulator
    if (CheckCUDAError(cudaMalloc(&params->target_realSum, \
                    sizeof(uint64_t)))) return -1;

    // Allocate device measOH
    if (CheckCUDAError(cudaMalloc(&params->targetMeasOH, \
                    sizeof(unsigned int)))) return -1;

    return 0;
}

static int runTest(param_t *params){
    // Get measurement overhead
    getMeasurementOverhead<<<1,1>>>(*params);
    // Launch kernel
    sequentialWalk<<<params->nofBlocks,params->nofThreads>>>(*params);

    // Synchronize with device
    if (CheckCUDAError(cudaDeviceSynchronize())) return -1;

    // Copyback times
    int size_time = params->nof_repetitions \
                    * params->nofThreads \
                    * params->nofBlocks \
                    * sizeof(unsigned int);

    if (CheckCUDAError(cudaMemcpy(params->host_times, \
                    params->target_times, \
                    size_time, \
                    cudaMemcpyDeviceToHost))) return -1;

    // Copyback sum
    params->host_realSum=0; 
    if (CheckCUDAError(cudaMemcpy(&params->host_realSum, \
                    params->target_realSum, \
                    sizeof(uint64_t), \
                    cudaMemcpyDeviceToHost))) return -1;

    // Copyback target meas oh
    params->hostMeasOH=0; 
    if (CheckCUDAError(cudaMemcpy(&params->hostMeasOH, \
                    params->targetMeasOH, \
                    sizeof(unsigned int), \
                    cudaMemcpyDeviceToHost))) return -1;
    return 0;
}

static int writeResults(param_t *params){

    if (fprintf(params->fd,"{\n") < 0 ) return -1;
    // Write device info
    cudaDeviceProp deviceProp;
    if (CheckCUDAError(cudaGetDeviceProperties(&deviceProp, DEVICE_NUMBER))) return -1;
    int driverVersion = 0;
    if (CheckCUDAError(cudaDriverGetVersion(&driverVersion))) return -1;
    int runtimeVersion = 0;
    if (CheckCUDAError(cudaRuntimeGetVersion(&runtimeVersion))) return -1;
    if (fprintf(params->fd,"\"driverVer\": \"%d\",\n", driverVersion)  < 0 ) return -1;
    if (fprintf(params->fd,"\"runTimeVer\": \"%d\",\n", runtimeVersion)  < 0 ) return -1;
    if (fprintf(params->fd,"\"clockRate\": \"%d\",\n", deviceProp.clockRate)  < 0 ) return -1;
    if (fprintf(params->fd,"\"globalL1CacheSupported\": \"%d\",\n", deviceProp.globalL1CacheSupported)  < 0 ) return -1;
    if (fprintf(params->fd,"\"localL1CacheSupported\": \"%d\",\n", deviceProp.localL1CacheSupported)  < 0 ) return -1;
    if (fprintf(params->fd,"\"l2CacheSize\": \"%d\",\n", deviceProp.l2CacheSize)  < 0 ) return -1;
    if (fprintf(params->fd,"\"memoryBusWidth\": \"%d\",\n", deviceProp.memoryBusWidth)  < 0 ) return -1;
    if (fprintf(params->fd,"\"memoryClockRate\": \"%d\",\n", deviceProp.memoryClockRate)  < 0 ) return -1;
    if (fprintf(params->fd,"\"multiProcessorCount\": \"%d\",\n", deviceProp.multiProcessorCount)  < 0 ) return -1;
    if (fprintf(params->fd,"\"regsPerBlock\": \"%d\",\n", deviceProp.regsPerBlock)  < 0 ) return -1;
    if (fprintf(params->fd,"\"regsPerMultiprocessor\": \"%d\",\n", deviceProp.regsPerMultiprocessor)  < 0 ) return -1;
    if (fprintf(params->fd,"\"sharedMemPerBlock\": \"%zu\",\n", deviceProp.sharedMemPerBlock)  < 0 ) return -1;
    if (fprintf(params->fd,"\"sharedMemPerMultiprocessor\": \"%zu\",\n", deviceProp.sharedMemPerMultiprocessor)  < 0 ) return -1;
    if (fprintf(params->fd,"\"warpSize\": \"%d\",\n", deviceProp.warpSize)  < 0 ) return -1;

    cudaFuncCache config;
    if (CheckCUDAError(cudaDeviceGetCacheConfig ( &config ) )) return -1;
    if (fprintf(params->fd,"\"cacheConfig\": \"%d\",\n", config)  < 0 ) return -1;

    // Write header
    if (fprintf(params->fd,"\"nofThreads\": \"%u\",\n", params->nofThreads)  < 0 ) return -1;
    if (fprintf(params->fd,"\"nofBlocks\": \"%u\",\n", params->nofBlocks)  < 0 ) return -1;
    if (fprintf(params->fd,"\"nof_repetitions\": \"%d\",\n", params->nof_repetitions)  < 0 ) return -1;
    if (fprintf(params->fd,"\"data_size\": \"%d\",\n", params->data_size)  < 0 ) return -1;
    if (fprintf(params->fd,"\"buffer_length\": \"%d\",\n", params->buffer_length)  < 0 ) return -1;
    if (fprintf(params->fd,"\"real_sum\": \"%llu\",\n", (unsigned long long)params->host_realSum)  < 0 ) return -1;
    if (fprintf(params->fd,"\"exp_sum\": \"%llu\",\n", ((unsigned long long)(params->buffer_length-1)*(unsigned long long)params->buffer_length)/2)  < 0 ) return -1;
    if (fprintf(params->fd,"\"measOH\": \"%u\",\n", params->hostMeasOH)  < 0 ) return -1;

    // Write times
    int size_time = params->nof_repetitions \
                    * params->nofThreads \
                    * params->nofBlocks;

    if (fprintf(params->fd,"\"times\":[\n") < 0 ) return -1;
    for (int i = 0; i < size_time-1; i++){
        if (fprintf(params->fd,"\"%u\",\n",params->host_times[i]) < 0 ) return -1;
    }
    if (fprintf(params->fd,"\"%u\"]\n}", params->host_times[size_time-1]) < 0 ) return -1;

    if (fclose(params->fd) < 0) return -1;
    return 0;
}

static int cleanUp(param_t *params){
    // Free target buffers
    cudaFree(params->targetBuffer);
    cudaFree(params->target_times);

    // Free host buffers
    free(params->hostBuffer);
    free(params->host_times);
    return 0;
}

static void PrintUsage(const char *name) {
    printf("Usage: %s <#threads> <#blocks> <# of intervals> <size in KB>"
            "<output JSON file name>\n", name);
}

int main(int argc, char **argv) {

    if (argc != 6) {
        PrintUsage(argv[0]);
        return 1;
    }

    param_t params;

    // Parse input parameter
    int nof_threads = atoi(argv[1]);
    if (nof_threads <= 0) {
        printf("Min one thread. Got %s threads\n", argv[1]);
        return EXIT_FAILURE;
    }

    int nof_blocks = atoi(argv[2]);
    if (nof_blocks <= 0) {
        printf("Min 1 block. Got %s blocks\n", argv[2]);
        return EXIT_FAILURE;
    }
    params.nofThreads = nof_threads;
    params.nofBlocks = nof_blocks;

    int nof_repetitions = atoi(argv[3]);
    if (nof_repetitions <= 0) {
        printf("More than 0 repetitions need to be used. Got %s repetitions\n", argv[3]);
        return EXIT_FAILURE;
    }

    int data_size = atoi(argv[4]);
    if (data_size <= 0) {
        printf("The buffer must be 1 or more KB. Got %s KB\n", argv[4]);
        return EXIT_FAILURE;
    }


    params.nof_repetitions = nof_repetitions;
    params.data_size = data_size*1024;
    params.buffer_length = data_size*1024/sizeof(int);

    params.fd = NULL;
    params.fd = fopen(argv[5],"w");
    if (params.fd == NULL) {
        perror("Error opening output file:");
        return EXIT_FAILURE;
    }

    // Set CUDA device
    if (CheckCUDAError(cudaSetDevice(DEVICE_NUMBER))) {
        return EXIT_FAILURE;
    }

    // Initialize parameters
    if (initializeTest(&params) < 0) return EXIT_FAILURE;

    // Run test
    if (runTest(&params) < 0) return EXIT_FAILURE;

    // Write results
    if (writeResults(&params) < 0){
        perror("Error while writing outpufile: ");
        return EXIT_FAILURE;
    }

    // Clean up
    if (cleanUp(&params) < 0) return EXIT_FAILURE;

    printf("Finished testrun\n");
    cudaDeviceReset();
    return 0;
}

	.file	"tmpxft_00200660_00000000-6_sequential-walk.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2039:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2039:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"/home/ubuntu/Datasets/stackv2/train-structured/realentertain/tt-gpu/master/experiments/sequential-walk-multithread/sequential-walk.cu"
.LC1:
	.string	"CUDA error %d in %s, line %d (%s): %s\n"
	.text
	.type	_ZL22InternalCheckCUDAError9cudaErrorPKcS1_i.constprop.0, @function
_ZL22InternalCheckCUDAError9cudaErrorPKcS1_i.constprop.0:
.LFB2187:
	.cfi_startproc
	testl	%edi, %edi
	je	.L6
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movl	%edi, %ebx
	subq	$16, %rsp
	.cfi_def_cfa_offset 32
	movl	%edx, 12(%rsp)
	movq	%rsi, (%rsp)
	call	cudaGetErrorString@PLT
	leaq	.LC0(%rip), %rcx
	movl	$2, %edi
	leaq	.LC1(%rip), %rsi
	pushq	%rdx
	.cfi_def_cfa_offset 40
	movl	%ebx, %edx
	pushq	%rax
	.cfi_def_cfa_offset 48
	movq	16(%rsp), %r9
	xorl	%eax, %eax
	movl	28(%rsp), %r8d
	call	__printf_chk@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	orl	$-1, %eax
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
.L6:
	.cfi_restore 3
	xorl	%eax, %eax
	ret
	.cfi_endproc
.LFE2187:
	.size	_ZL22InternalCheckCUDAError9cudaErrorPKcS1_i.constprop.0, .-_ZL22InternalCheckCUDAError9cudaErrorPKcS1_i.constprop.0
	.section	.rodata.str1.1
.LC2:
	.string	"{\n"
.LC3:
	.string	"cudaGetDeviceProperties(&deviceProp, DEVICE_NUMBER)"
.LC4:
	.string	"cudaDriverGetVersion(&driverVersion)"
.LC5:
	.string	"cudaRuntimeGetVersion(&runtimeVersion)"
.LC6:
	.string	"\"driverVer\": \"%d\",\n"
.LC7:
	.string	"\"runTimeVer\": \"%d\",\n"
.LC8:
	.string	"\"clockRate\": \"%d\",\n"
.LC9:
	.string	"\"globalL1CacheSupported\": \"%d\",\n"
.LC10:
	.string	"\"localL1CacheSupported\": \"%d\",\n"
.LC11:
	.string	"\"l2CacheSize\": \"%d\",\n"
.LC12:
	.string	"\"memoryBusWidth\": \"%d\",\n"
.LC13:
	.string	"\"memoryClockRate\": \"%d\",\n"
.LC14:
	.string	"\"multiProcessorCount\": \"%d\",\n"
.LC15:
	.string	"\"regsPerBlock\": \"%d\",\n"
.LC16:
	.string	"\"regsPerMultiprocessor\": \"%d\",\n"
.LC17:
	.string	"\"sharedMemPerBlock\": \"%zu\",\n"
.LC18:
	.string	"\"sharedMemPerMultiprocessor\": \"%zu\",\n"
.LC19:
	.string	"\"warpSize\": \"%d\",\n"
.LC20:
	.string	"cudaDeviceGetCacheConfig ( &config )"
.LC21:
	.string	"\"cacheConfig\": \"%d\",\n"
.LC22:
	.string	"\"nofThreads\": \"%u\",\n"
.LC23:
	.string	"\"nofBlocks\": \"%u\",\n"
.LC24:
	.string	"\"nof_repetitions\": \"%d\",\n"
.LC25:
	.string	"\"data_size\": \"%d\",\n"
.LC26:
	.string	"\"buffer_length\": \"%d\",\n"
.LC27:
	.string	"\"real_sum\": \"%llu\",\n"
.LC28:
	.string	"\"exp_sum\": \"%llu\",\n"
.LC29:
	.string	"\"measOH\": \"%u\",\n"
.LC30:
	.string	"\"times\":[\n"
.LC31:
	.string	"\"%u\",\n"
.LC32:
	.string	"\"%u\"]\n}"
	.text
	.type	_ZL12writeResultsP7param_t, @function
_ZL12writeResultsP7param_t:
.LFB2033:
	.cfi_startproc
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC2(%rip), %rdx
	movl	$2, %esi
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movq	%rdi, %rbx
	subq	$1064, %rsp
	.cfi_def_cfa_offset 1104
	movq	88(%rdi), %rdi
	movq	%fs:40, %rax
	movq	%rax, 1048(%rsp)
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
	testl	%eax, %eax
	jns	.L13
.L15:
	orl	$-1, %eax
	jmp	.L12
.L13:
	xorl	%esi, %esi
	leaq	16(%rsp), %rdi
	call	cudaGetDeviceProperties_v2@PLT
	movl	$209, %edx
	leaq	.LC3(%rip), %rsi
	movl	%eax, %edi
	call	_ZL22InternalCheckCUDAError9cudaErrorPKcS1_i.constprop.0
	testl	%eax, %eax
	jne	.L15
	xorl	%edx, %edx
	leaq	4(%rsp), %rdi
	movl	%edx, 4(%rsp)
	call	cudaDriverGetVersion@PLT
	movl	$211, %edx
	leaq	.LC4(%rip), %rsi
	movl	%eax, %edi
	call	_ZL22InternalCheckCUDAError9cudaErrorPKcS1_i.constprop.0
	testl	%eax, %eax
	jne	.L15
	xorl	%eax, %eax
	leaq	8(%rsp), %rdi
	movl	%eax, 8(%rsp)
	call	cudaRuntimeGetVersion@PLT
	movl	$213, %edx
	leaq	.LC5(%rip), %rsi
	movl	%eax, %edi
	call	_ZL22InternalCheckCUDAError9cudaErrorPKcS1_i.constprop.0
	testl	%eax, %eax
	jne	.L15
	movq	88(%rbx), %rdi
	movl	4(%rsp), %ecx
	movl	$2, %esi
	leaq	.LC6(%rip), %rdx
	call	__fprintf_chk@PLT
	testl	%eax, %eax
	js	.L15
	movq	88(%rbx), %rdi
	movl	8(%rsp), %ecx
	xorl	%eax, %eax
	movl	$2, %esi
	leaq	.LC7(%rip), %rdx
	call	__fprintf_chk@PLT
	testl	%eax, %eax
	js	.L15
	movq	88(%rbx), %rdi
	movl	364(%rsp), %ecx
	xorl	%eax, %eax
	leaq	.LC8(%rip), %rdx
	movl	$2, %esi
	call	__fprintf_chk@PLT
	testl	%eax, %eax
	js	.L15
	movq	88(%rbx), %rdi
	movl	648(%rsp), %ecx
	xorl	%eax, %eax
	leaq	.LC9(%rip), %rdx
	movl	$2, %esi
	call	__fprintf_chk@PLT
	testl	%eax, %eax
	js	.L15
	movq	88(%rbx), %rdi
	movl	652(%rsp), %ecx
	xorl	%eax, %eax
	leaq	.LC10(%rip), %rdx
	movl	$2, %esi
	call	__fprintf_chk@PLT
	testl	%eax, %eax
	js	.L15
	movq	88(%rbx), %rdi
	movl	632(%rsp), %ecx
	xorl	%eax, %eax
	leaq	.LC11(%rip), %rdx
	movl	$2, %esi
	call	__fprintf_chk@PLT
	testl	%eax, %eax
	js	.L15
	movq	88(%rbx), %rdi
	movl	628(%rsp), %ecx
	xorl	%eax, %eax
	leaq	.LC12(%rip), %rdx
	movl	$2, %esi
	call	__fprintf_chk@PLT
	testl	%eax, %eax
	js	.L15
	movq	88(%rbx), %rdi
	movl	624(%rsp), %ecx
	xorl	%eax, %eax
	leaq	.LC13(%rip), %rdx
	movl	$2, %esi
	call	__fprintf_chk@PLT
	testl	%eax, %eax
	js	.L15
	movq	88(%rbx), %rdi
	movl	404(%rsp), %ecx
	xorl	%eax, %eax
	leaq	.LC14(%rip), %rdx
	movl	$2, %esi
	call	__fprintf_chk@PLT
	testl	%eax, %eax
	js	.L15
	movq	88(%rbx), %rdi
	movl	320(%rsp), %ecx
	xorl	%eax, %eax
	leaq	.LC15(%rip), %rdx
	movl	$2, %esi
	call	__fprintf_chk@PLT
	testl	%eax, %eax
	js	.L15
	movq	88(%rbx), %rdi
	movl	664(%rsp), %ecx
	xorl	%eax, %eax
	leaq	.LC16(%rip), %rdx
	movl	$2, %esi
	call	__fprintf_chk@PLT
	testl	%eax, %eax
	js	.L15
	movq	88(%rbx), %rdi
	xorl	%eax, %eax
	movq	312(%rsp), %rcx
	leaq	.LC17(%rip), %rdx
	movl	$2, %esi
	call	__fprintf_chk@PLT
	testl	%eax, %eax
	js	.L15
	movq	88(%rbx), %rdi
	xorl	%eax, %eax
	movq	656(%rsp), %rcx
	leaq	.LC18(%rip), %rdx
	movl	$2, %esi
	call	__fprintf_chk@PLT
	testl	%eax, %eax
	js	.L15
	movq	88(%rbx), %rdi
	movl	324(%rsp), %ecx
	xorl	%eax, %eax
	leaq	.LC19(%rip), %rdx
	movl	$2, %esi
	call	__fprintf_chk@PLT
	testl	%eax, %eax
	js	.L15
	leaq	12(%rsp), %rdi
	call	cudaDeviceGetCacheConfig@PLT
	movl	$230, %edx
	leaq	.LC20(%rip), %rsi
	movl	%eax, %edi
	call	_ZL22InternalCheckCUDAError9cudaErrorPKcS1_i.constprop.0
	testl	%eax, %eax
	jne	.L15
	movq	88(%rbx), %rdi
	movl	12(%rsp), %ecx
	movl	$2, %esi
	leaq	.LC21(%rip), %rdx
	call	__fprintf_chk@PLT
	testl	%eax, %eax
	js	.L15
	movq	88(%rbx), %rdi
	movl	(%rbx), %ecx
	xorl	%eax, %eax
	leaq	.LC22(%rip), %rdx
	movl	$2, %esi
	call	__fprintf_chk@PLT
	testl	%eax, %eax
	js	.L15
	movl	4(%rbx), %ecx
	movq	88(%rbx), %rdi
	xorl	%eax, %eax
	leaq	.LC23(%rip), %rdx
	movl	$2, %esi
	call	__fprintf_chk@PLT
	testl	%eax, %eax
	js	.L15
	movl	8(%rbx), %ecx
	movq	88(%rbx), %rdi
	xorl	%eax, %eax
	leaq	.LC24(%rip), %rdx
	movl	$2, %esi
	call	__fprintf_chk@PLT
	testl	%eax, %eax
	js	.L15
	movl	12(%rbx), %ecx
	movq	88(%rbx), %rdi
	xorl	%eax, %eax
	leaq	.LC25(%rip), %rdx
	movl	$2, %esi
	call	__fprintf_chk@PLT
	testl	%eax, %eax
	js	.L15
	movl	16(%rbx), %ecx
	movq	88(%rbx), %rdi
	xorl	%eax, %eax
	leaq	.LC26(%rip), %rdx
	movl	$2, %esi
	call	__fprintf_chk@PLT
	testl	%eax, %eax
	js	.L15
	movq	64(%rbx), %rcx
	movq	88(%rbx), %rdi
	xorl	%eax, %eax
	movl	$2, %esi
	leaq	.LC27(%rip), %rdx
	call	__fprintf_chk@PLT
	testl	%eax, %eax
	js	.L15
	movslq	16(%rbx), %rax
	movq	88(%rbx), %rdi
	movl	$2, %esi
	leaq	.LC28(%rip), %rdx
	leal	-1(%rax), %ecx
	movslq	%ecx, %rcx
	imulq	%rax, %rcx
	xorl	%eax, %eax
	shrq	%rcx
	call	__fprintf_chk@PLT
	testl	%eax, %eax
	js	.L15
	movl	32(%rbx), %ecx
	movq	88(%rbx), %rdi
	xorl	%eax, %eax
	leaq	.LC29(%rip), %rdx
	movl	$2, %esi
	call	__fprintf_chk@PLT
	testl	%eax, %eax
	js	.L15
	movq	88(%rbx), %rdi
	leaq	.LC30(%rip), %rdx
	xorl	%eax, %eax
	movl	8(%rbx), %ebp
	movl	$2, %esi
	imull	(%rbx), %ebp
	xorl	%r12d, %r12d
	imull	4(%rbx), %ebp
	leaq	.LC31(%rip), %r13
	call	__fprintf_chk@PLT
	testl	%eax, %eax
	js	.L15
.L16:
	leal	-1(%rbp), %edx
	movq	80(%rbx), %rax
	movq	88(%rbx), %rdi
	cmpl	%r12d, %edx
	jle	.L20
	movl	(%rax,%r12,4), %ecx
	movq	%r13, %rdx
	movl	$2, %esi
	xorl	%eax, %eax
	incq	%r12
	call	__fprintf_chk@PLT
	testl	%eax, %eax
	jns	.L16
	jmp	.L15
.L20:
	movslq	%ebp, %rbp
	leaq	.LC32(%rip), %rdx
	movl	$2, %esi
	movl	-4(%rax,%rbp,4), %ecx
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
	testl	%eax, %eax
	js	.L15
	movq	88(%rbx), %rdi
	call	fclose@PLT
	sarl	$31, %eax
.L12:
	movq	1048(%rsp), %rdx
	subq	%fs:40, %rdx
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	addq	$1064, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2033:
	.size	_ZL12writeResultsP7param_t, .-_ZL12writeResultsP7param_t
	.type	_ZL48__device_stub__Z22getMeasurementOverhead7param_tR7param_t, @function
_ZL48__device_stub__Z22getMeasurementOverhead7param_tR7param_t:
.LFB2061:
	.cfi_startproc
	subq	$88, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 72(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rcx
	movq	%rdi, 64(%rsp)
	movq	%rsp, %rdx
	movabsq	$4294967297, %rax
	leaq	28(%rsp), %rsi
	leaq	16(%rsp), %rdi
	movl	$1, 24(%rsp)
	movq	%rax, 16(%rsp)
	movq	%rax, 28(%rsp)
	movl	$1, 36(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L21
	pushq	8(%rsp)
	.cfi_def_cfa_offset 104
	leaq	_ZL22getMeasurementOverhead7param_t(%rip), %rdi
	pushq	8(%rsp)
	.cfi_def_cfa_offset 112
	movq	44(%rsp), %rcx
	movl	52(%rsp), %r8d
	movq	32(%rsp), %rsi
	movl	40(%rsp), %edx
	leaq	80(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 104
	popq	%rdx
	.cfi_def_cfa_offset 96
.L21:
	movq	72(%rsp), %rax
	subq	%fs:40, %rax
	je	.L23
	call	__stack_chk_fail@PLT
.L23:
	addq	$88, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2061:
	.size	_ZL48__device_stub__Z22getMeasurementOverhead7param_tR7param_t, .-_ZL48__device_stub__Z22getMeasurementOverhead7param_tR7param_t
	.type	_ZL22getMeasurementOverhead7param_t, @function
_ZL22getMeasurementOverhead7param_t:
.LFB2062:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	16(%rsp), %rdi
	call	_ZL48__device_stub__Z22getMeasurementOverhead7param_tR7param_t
	popq	%rdx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2062:
	.size	_ZL22getMeasurementOverhead7param_t, .-_ZL22getMeasurementOverhead7param_t
	.type	_ZL40__device_stub__Z14sequentialWalk7param_tR7param_t, @function
_ZL40__device_stub__Z14sequentialWalk7param_tR7param_t:
.LFB2063:
	.cfi_startproc
	subq	$88, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 72(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rcx
	movq	%rdi, 64(%rsp)
	movq	%rsp, %rdx
	movabsq	$4294967297, %rax
	leaq	28(%rsp), %rsi
	leaq	16(%rsp), %rdi
	movl	$1, 24(%rsp)
	movq	%rax, 16(%rsp)
	movq	%rax, 28(%rsp)
	movl	$1, 36(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L27
	pushq	8(%rsp)
	.cfi_def_cfa_offset 104
	leaq	_ZL14sequentialWalk7param_t(%rip), %rdi
	pushq	8(%rsp)
	.cfi_def_cfa_offset 112
	movq	44(%rsp), %rcx
	movl	52(%rsp), %r8d
	movq	32(%rsp), %rsi
	movl	40(%rsp), %edx
	leaq	80(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 104
	popq	%rdx
	.cfi_def_cfa_offset 96
.L27:
	movq	72(%rsp), %rax
	subq	%fs:40, %rax
	je	.L29
	call	__stack_chk_fail@PLT
.L29:
	addq	$88, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2063:
	.size	_ZL40__device_stub__Z14sequentialWalk7param_tR7param_t, .-_ZL40__device_stub__Z14sequentialWalk7param_tR7param_t
	.type	_ZL14sequentialWalk7param_t, @function
_ZL14sequentialWalk7param_t:
.LFB2064:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	16(%rsp), %rdi
	call	_ZL40__device_stub__Z14sequentialWalk7param_tR7param_t
	popq	%rdx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2064:
	.size	_ZL14sequentialWalk7param_t, .-_ZL14sequentialWalk7param_t
	.section	.rodata.str1.1
.LC33:
	.string	"Usage: %s <#threads> <#blocks> <# of intervals> <size in KB><output JSON file name>\n"
.LC34:
	.string	"Min one thread. Got %s threads\n"
.LC35:
	.string	"Min 1 block. Got %s blocks\n"
.LC36:
	.string	"More than 0 repetitions need to be used. Got %s repetitions\n"
.LC37:
	.string	"The buffer must be 1 or more KB. Got %s KB\n"
.LC38:
	.string	"w"
.LC39:
	.string	"Error opening output file:"
.LC40:
	.string	"cudaSetDevice(DEVICE_NUMBER)"
.LC41:
	.string	"Failed allocating host buffer: "
.LC42:
	.string	"cudaMalloc(&params->targetBuffer, params->buffer_length*sizeof(int))"
.LC43:
	.string	"cudaMalloc(&params->target_times, size_time)"
.LC44:
	.string	"Failed allocating host_times buffer: "
.LC45:
	.string	"cudaMalloc(&params->target_realSum, sizeof(uint64_t))"
.LC46:
	.string	"cudaMalloc(&params->targetMeasOH, sizeof(unsigned int))"
.LC47:
	.string	"cudaDeviceSynchronize()"
.LC48:
	.string	"cudaMemcpy(params->host_times, params->target_times, size_time, cudaMemcpyDeviceToHost)"
.LC49:
	.string	"cudaMemcpy(&params->host_realSum, params->target_realSum, sizeof(uint64_t), cudaMemcpyDeviceToHost)"
.LC50:
	.string	"cudaMemcpy(&params->hostMeasOH, params->targetMeasOH, sizeof(unsigned int), cudaMemcpyDeviceToHost)"
.LC51:
	.string	"Error while writing outpufile: "
.LC52:
	.string	"Finished testrun\n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2036:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movq	%rsi, %rbx
	subq	$224, %rsp
	.cfi_def_cfa_offset 256
	movq	%fs:40, %rax
	movq	%rax, 216(%rsp)
	xorl	%eax, %eax
	cmpl	$6, %edi
	je	.L34
	movq	(%rsi), %rdx
	movl	$2, %edi
	leaq	.LC33(%rip), %rsi
	jmp	.L55
.L34:
	movq	8(%rsi), %r12
	movq	%r12, %rdi
	call	atoi@PLT
	movl	%eax, %ebp
	testl	%eax, %eax
	jg	.L36
	movq	%r12, %rdx
	leaq	.LC34(%rip), %rsi
.L54:
	movl	$2, %edi
	xorl	%eax, %eax
.L55:
	call	__printf_chk@PLT
.L35:
	movl	$1, %ebx
	jmp	.L33
.L36:
	movq	16(%rbx), %r12
	movq	%r12, %rdi
	call	atoi@PLT
	movq	%r12, %rdx
	leaq	.LC35(%rip), %rsi
	testl	%eax, %eax
	jle	.L54
	movq	24(%rbx), %r12
	movl	%ebp, 24(%rsp)
	movl	%eax, 28(%rsp)
	movq	%r12, %rdi
	call	atoi@PLT
	movq	%r12, %rdx
	leaq	.LC36(%rip), %rsi
	movl	%eax, %ebp
	testl	%eax, %eax
	jle	.L54
	movq	32(%rbx), %r12
	movq	%r12, %rdi
	call	atoi@PLT
	movq	%r12, %rdx
	leaq	.LC37(%rip), %rsi
	testl	%eax, %eax
	jle	.L54
	sall	$10, %eax
	movq	40(%rbx), %rdi
	xorl	%ecx, %ecx
	leaq	.LC38(%rip), %rsi
	movl	%eax, 36(%rsp)
	cltq
	shrq	$2, %rax
	movl	%ebp, 32(%rsp)
	movl	%eax, 40(%rsp)
	movq	%rcx, 112(%rsp)
	call	fopen@PLT
	leaq	.LC39(%rip), %rdi
	movq	%rax, 112(%rsp)
	testq	%rax, %rax
	je	.L53
	xorl	%edi, %edi
	call	cudaSetDevice@PLT
	movl	$323, %edx
	leaq	.LC40(%rip), %rsi
	movl	%eax, %edi
	call	_ZL22InternalCheckCUDAError9cudaErrorPKcS1_i.constprop.0
	testl	%eax, %eax
	jne	.L35
	movslq	40(%rsp), %rbx
	movq	%rbx, %rbp
	salq	$2, %rbx
	movq	%rbx, %rdi
	call	malloc@PLT
	leaq	.LC41(%rip), %rdi
	movq	%rax, 64(%rsp)
	movq	%rax, %rsi
	testq	%rax, %rax
	je	.L53
	movl	24(%rsp), %edi
	imull	28(%rsp), %edi
	xorl	%ecx, %ecx
.L44:
	cmpl	%ecx, %ebp
	jle	.L56
	leal	(%rdi,%rcx), %eax
	cltd
	idivl	%ebp
	movl	%edx, (%rsi,%rcx,4)
	incq	%rcx
	jmp	.L44
.L56:
	leaq	72(%rsp), %rdi
	movq	%rbx, %rsi
	leaq	24(%rsp), %rbp
	call	cudaMalloc@PLT
	movl	$125, %edx
	leaq	.LC42(%rip), %rsi
	movl	%eax, %edi
	call	_ZL22InternalCheckCUDAError9cudaErrorPKcS1_i.constprop.0
	testl	%eax, %eax
	jne	.L35
	movl	32(%rsp), %ebx
	imull	24(%rsp), %ebx
	leaq	96(%rsp), %rdi
	imull	28(%rsp), %ebx
	sall	$2, %ebx
	movslq	%ebx, %rbx
	movq	%rbx, %rsi
	call	cudaMalloc@PLT
	movl	$145, %edx
	leaq	.LC43(%rip), %rsi
	movl	%eax, %edi
	call	_ZL22InternalCheckCUDAError9cudaErrorPKcS1_i.constprop.0
	testl	%eax, %eax
	jne	.L35
	movq	%rbx, %rdi
	call	malloc@PLT
	movq	%rax, 104(%rsp)
	movq	%rax, %rdi
	testq	%rax, %rax
	jne	.L47
	leaq	.LC44(%rip), %rdi
	jmp	.L53
.L47:
	movq	%rbx, %rdx
	movq	%rbx, %rcx
	movl	$1, %esi
	call	__memset_chk@PLT
	leaq	80(%rsp), %rdi
	movl	$8, %esi
	call	cudaMalloc@PLT
	movl	$158, %edx
	leaq	.LC45(%rip), %rsi
	movl	%eax, %edi
	call	_ZL22InternalCheckCUDAError9cudaErrorPKcS1_i.constprop.0
	testl	%eax, %eax
	jne	.L35
	leaq	48(%rsp), %rdi
	movl	$4, %esi
	call	cudaMalloc@PLT
	movl	$162, %edx
	leaq	.LC46(%rip), %rsi
	movl	%eax, %edi
	call	_ZL22InternalCheckCUDAError9cudaErrorPKcS1_i.constprop.0
	testl	%eax, %eax
	jne	.L35
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	$1, %ecx
	movl	$1, %esi
	movabsq	$4294967297, %rdi
	movl	$1, 20(%rsp)
	movq	%rdi, %rdx
	movq	%rdi, 12(%rsp)
	movq	%rdi, (%rsp)
	movl	$1, 8(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L48
	leaq	120(%rsp), %rdi
	movl	$24, %ecx
	movq	%rbp, %rsi
	rep movsl
	leaq	120(%rsp), %rdi
	call	_ZL48__device_stub__Z22getMeasurementOverhead7param_tR7param_t
.L48:
	movl	24(%rsp), %eax
	movl	28(%rsp), %edx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	%eax, 12(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 16(%rsp)
	movl	20(%rsp), %ecx
	movl	%edx, (%rsp)
	movq	12(%rsp), %rdx
	movq	%rax, 4(%rsp)
	movq	(%rsp), %rdi
	movl	8(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L49
	leaq	120(%rsp), %rdi
	movl	$24, %ecx
	movq	%rbp, %rsi
	rep movsl
	leaq	120(%rsp), %rdi
	call	_ZL40__device_stub__Z14sequentialWalk7param_tR7param_t
.L49:
	call	cudaDeviceSynchronize@PLT
	movl	$175, %edx
	leaq	.LC47(%rip), %rsi
	movl	%eax, %edi
	call	_ZL22InternalCheckCUDAError9cudaErrorPKcS1_i.constprop.0
	testl	%eax, %eax
	jne	.L35
	movl	32(%rsp), %edx
	imull	24(%rsp), %edx
	movl	$2, %ecx
	imull	28(%rsp), %edx
	movq	96(%rsp), %rsi
	movq	104(%rsp), %rdi
	sall	$2, %edx
	movslq	%edx, %rdx
	call	cudaMemcpy@PLT
	movl	$183, %edx
	leaq	.LC48(%rip), %rsi
	movl	%eax, %edi
	call	_ZL22InternalCheckCUDAError9cudaErrorPKcS1_i.constprop.0
	testl	%eax, %eax
	jne	.L35
	xorl	%edx, %edx
	movq	80(%rsp), %rsi
	leaq	88(%rsp), %rdi
	movl	$2, %ecx
	movq	%rdx, 88(%rsp)
	movl	$8, %edx
	call	cudaMemcpy@PLT
	movl	$190, %edx
	leaq	.LC49(%rip), %rsi
	movl	%eax, %edi
	call	_ZL22InternalCheckCUDAError9cudaErrorPKcS1_i.constprop.0
	testl	%eax, %eax
	jne	.L35
	movq	48(%rsp), %rsi
	xorl	%eax, %eax
	leaq	56(%rsp), %rdi
	movl	$2, %ecx
	movl	$4, %edx
	movl	%eax, 56(%rsp)
	call	cudaMemcpy@PLT
	movl	$197, %edx
	leaq	.LC50(%rip), %rsi
	movl	%eax, %edi
	call	_ZL22InternalCheckCUDAError9cudaErrorPKcS1_i.constprop.0
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	.L35
	movq	%rbp, %rdi
	call	_ZL12writeResultsP7param_t
	testl	%eax, %eax
	jns	.L50
	leaq	.LC51(%rip), %rdi
.L53:
	call	perror@PLT
	jmp	.L35
.L50:
	movq	72(%rsp), %rdi
	call	cudaFree@PLT
	movq	96(%rsp), %rdi
	call	cudaFree@PLT
	movq	64(%rsp), %rdi
	call	free@PLT
	movq	104(%rsp), %rdi
	call	free@PLT
	leaq	.LC52(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	call	cudaDeviceReset@PLT
.L33:
	movq	216(%rsp), %rax
	subq	%fs:40, %rax
	je	.L51
	call	__stack_chk_fail@PLT
.L51:
	addq	$224, %rsp
	.cfi_def_cfa_offset 32
	movl	%ebx, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2036:
	.size	main, .-main
	.section	.rodata.str1.1
.LC53:
	.string	"_Z14sequentialWalk7param_t"
.LC54:
	.string	"_Z22getMeasurementOverhead7param_t"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2066:
	.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	.LC53(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_ZL14sequentialWalk7param_t(%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	.LC54(%rip), %rdx
	orl	$-1, %r8d
	leaq	_ZL22getMeasurementOverhead7param_t(%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
.LFE2066:
	.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 <error.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <hip/hip_runtime.h>

#define DEVICE_NUMBER (0)

typedef struct {
    int nofThreads;
    int nofBlocks;
    int32_t nof_repetitions;
    int data_size;
    int buffer_length;
    unsigned int *targetMeasOH;
    unsigned int hostMeasOH;
    int *hostBuffer;
    int *targetBuffer;
    uint64_t *target_realSum;
    uint64_t host_realSum;
    unsigned int *target_times;
    unsigned int *host_times;
    FILE *fd;
} param_t;

// Prints a message and returns zero if the given value is not cudaSuccess
#define CheckCUDAError(val) (InternalCheckCUDAError((val), #val, __FILE__, __LINE__))

// Called internally by CheckCUDAError
static int InternalCheckCUDAError(hipError_t result, const char *fn,
        const char *file, int line) {
    if (result == hipSuccess) return 0;
    printf("CUDA error %d in %s, line %d (%s): %s\n", (int) result, file, line,
            fn, hipGetErrorString(result));
    return -1;
}

static void createSequentialArrayHost(param_t params){
    // Link sequentially
    for(int i = 0; i < params.buffer_length; i++){
        params.hostBuffer[i]=(i+params.nofThreads*params.nofBlocks)%params.buffer_length;
    }
}

static __global__ void getMeasurementOverhead(param_t params) {
    unsigned int start, stop;
    uint64_t sum = 0;
    start = clock();
    for (int j = 0; j < params.buffer_length; j++){
        sum +=j;
    }
    stop = clock();
    *params.targetMeasOH = (stop-start)/params.buffer_length;
    *params.target_realSum = sum;
}

static __global__ void sequentialWalk(param_t params) {
    int current;
    unsigned int time_start, time_end, time_acc;
    uint64_t sum;

    int tindex = blockDim.x*blockIdx.x*params.nof_repetitions + params.nof_repetitions *threadIdx.x;

    // Warm up data cache    
    for(int i = 0; i < params.buffer_length; i++){
        sum += params.targetBuffer[i%params.buffer_length];
    }

    // Run experiment multiple times. First iteration (-1) is to warm up icache
    for (int i = -2; i < params.nof_repetitions; i++){

        sum = 0;
        time_acc = 0;
        current = (blockDim.x*blockIdx.x + threadIdx.x)%params.buffer_length;

        __syncthreads();
        time_start = clock();
        // Strided access to array
        for(int j = 0; j < params.buffer_length; j++){
            current = params.targetBuffer[current];
            sum += current;
        }
        time_end = clock();
        time_acc += (time_end - time_start);
        __syncthreads();

        *params.target_realSum = sum;

        // Do not write time for warm up iteration       
        if (i>=0){
            // Write element access time with measurement overhead
            params.target_times[tindex+i] = time_acc/params.buffer_length-(*params.targetMeasOH);
        }
    }
}

#if 0
static void printArray(int* buffer, int size){
    printf("%d\n",size);
    for( int row = 0; row <= ceil(size/10); row++){
        for(int i = row*10; i< row*10+10 && i<size; i++)
            printf("[%4d] ",i);
        printf("\n");
        for(int i = row*10; i< row*10+10 && i<size; i++)
            printf(" %4d, ",buffer[i]);
        printf("\n");
    }

}
#endif

static int initializeTest(param_t *params){
    //allocate buffer
    params->hostBuffer = NULL;
    params->hostBuffer = (int *) malloc(params->buffer_length*sizeof(int));
    if (!params->hostBuffer) {
        perror("Failed allocating host buffer: ");
        return  -1;
    }
    createSequentialArrayHost(*params);
    //allocate device random buffer
    if (CheckCUDAError(hipMalloc(&params->targetBuffer, \
                    params->buffer_length*sizeof(int)))) return -1;    
/*    
    createSequentialArray<<<params->nofBlocks,params->nofThreads>>>(*params);
    if (CheckCUDAError(cudaDeviceSynchronize())) return -1;
    if (CheckCUDAError(cudaMemcpy(params->hostBuffer, \
                    params->targetBuffer, \
                    params->buffer_length*sizeof(int), \
                    cudaMemcpyDeviceToHost))) return -1;
*/
#if 0
    printArray(params->hostBuffer, params->buffer_length);
#endif

    //allocate device times
    int size_time = params->nof_repetitions \
                    * params->nofThreads \
                    * params->nofBlocks \
                    * sizeof(unsigned int);

    if (CheckCUDAError(hipMalloc(&params->target_times, \
                    size_time))) return -1;

    //allocate host times
    params->host_times = NULL;
    params->host_times = (unsigned int *) malloc(size_time);
    if (!params->host_times) {
        perror("Failed allocating host_times buffer: ");
        return  -1;
    }
    memset(params->host_times,1, size_time);

    // Allocate device accumulator
    if (CheckCUDAError(hipMalloc(&params->target_realSum, \
                    sizeof(uint64_t)))) return -1;

    // Allocate device measOH
    if (CheckCUDAError(hipMalloc(&params->targetMeasOH, \
                    sizeof(unsigned int)))) return -1;

    return 0;
}

static int runTest(param_t *params){
    // Get measurement overhead
    getMeasurementOverhead<<<1,1>>>(*params);
    // Launch kernel
    sequentialWalk<<<params->nofBlocks,params->nofThreads>>>(*params);

    // Synchronize with device
    if (CheckCUDAError(hipDeviceSynchronize())) return -1;

    // Copyback times
    int size_time = params->nof_repetitions \
                    * params->nofThreads \
                    * params->nofBlocks \
                    * sizeof(unsigned int);

    if (CheckCUDAError(hipMemcpy(params->host_times, \
                    params->target_times, \
                    size_time, \
                    hipMemcpyDeviceToHost))) return -1;

    // Copyback sum
    params->host_realSum=0; 
    if (CheckCUDAError(hipMemcpy(&params->host_realSum, \
                    params->target_realSum, \
                    sizeof(uint64_t), \
                    hipMemcpyDeviceToHost))) return -1;

    // Copyback target meas oh
    params->hostMeasOH=0; 
    if (CheckCUDAError(hipMemcpy(&params->hostMeasOH, \
                    params->targetMeasOH, \
                    sizeof(unsigned int), \
                    hipMemcpyDeviceToHost))) return -1;
    return 0;
}

static int writeResults(param_t *params){

    if (fprintf(params->fd,"{\n") < 0 ) return -1;
    // Write device info
    hipDeviceProp_t deviceProp;
    if (CheckCUDAError(hipGetDeviceProperties(&deviceProp, DEVICE_NUMBER))) return -1;
    int driverVersion = 0;
    if (CheckCUDAError(hipDriverGetVersion(&driverVersion))) return -1;
    int runtimeVersion = 0;
    if (CheckCUDAError(hipRuntimeGetVersion(&runtimeVersion))) return -1;
    if (fprintf(params->fd,"\"driverVer\": \"%d\",\n", driverVersion)  < 0 ) return -1;
    if (fprintf(params->fd,"\"runTimeVer\": \"%d\",\n", runtimeVersion)  < 0 ) return -1;
    if (fprintf(params->fd,"\"clockRate\": \"%d\",\n", deviceProp.clockRate)  < 0 ) return -1;
    if (fprintf(params->fd,"\"globalL1CacheSupported\": \"%d\",\n", deviceProp.globalL1CacheSupported)  < 0 ) return -1;
    if (fprintf(params->fd,"\"localL1CacheSupported\": \"%d\",\n", deviceProp.localL1CacheSupported)  < 0 ) return -1;
    if (fprintf(params->fd,"\"l2CacheSize\": \"%d\",\n", deviceProp.l2CacheSize)  < 0 ) return -1;
    if (fprintf(params->fd,"\"memoryBusWidth\": \"%d\",\n", deviceProp.memoryBusWidth)  < 0 ) return -1;
    if (fprintf(params->fd,"\"memoryClockRate\": \"%d\",\n", deviceProp.memoryClockRate)  < 0 ) return -1;
    if (fprintf(params->fd,"\"multiProcessorCount\": \"%d\",\n", deviceProp.multiProcessorCount)  < 0 ) return -1;
    if (fprintf(params->fd,"\"regsPerBlock\": \"%d\",\n", deviceProp.regsPerBlock)  < 0 ) return -1;
    if (fprintf(params->fd,"\"regsPerMultiprocessor\": \"%d\",\n", deviceProp.regsPerMultiprocessor)  < 0 ) return -1;
    if (fprintf(params->fd,"\"sharedMemPerBlock\": \"%zu\",\n", deviceProp.sharedMemPerBlock)  < 0 ) return -1;
    if (fprintf(params->fd,"\"sharedMemPerMultiprocessor\": \"%zu\",\n", deviceProp.sharedMemPerMultiprocessor)  < 0 ) return -1;
    if (fprintf(params->fd,"\"warpSize\": \"%d\",\n", deviceProp.warpSize)  < 0 ) return -1;

    hipFuncCache_t config;
    if (CheckCUDAError(hipDeviceGetCacheConfig ( &config ) )) return -1;
    if (fprintf(params->fd,"\"cacheConfig\": \"%d\",\n", config)  < 0 ) return -1;

    // Write header
    if (fprintf(params->fd,"\"nofThreads\": \"%u\",\n", params->nofThreads)  < 0 ) return -1;
    if (fprintf(params->fd,"\"nofBlocks\": \"%u\",\n", params->nofBlocks)  < 0 ) return -1;
    if (fprintf(params->fd,"\"nof_repetitions\": \"%d\",\n", params->nof_repetitions)  < 0 ) return -1;
    if (fprintf(params->fd,"\"data_size\": \"%d\",\n", params->data_size)  < 0 ) return -1;
    if (fprintf(params->fd,"\"buffer_length\": \"%d\",\n", params->buffer_length)  < 0 ) return -1;
    if (fprintf(params->fd,"\"real_sum\": \"%llu\",\n", (unsigned long long)params->host_realSum)  < 0 ) return -1;
    if (fprintf(params->fd,"\"exp_sum\": \"%llu\",\n", ((unsigned long long)(params->buffer_length-1)*(unsigned long long)params->buffer_length)/2)  < 0 ) return -1;
    if (fprintf(params->fd,"\"measOH\": \"%u\",\n", params->hostMeasOH)  < 0 ) return -1;

    // Write times
    int size_time = params->nof_repetitions \
                    * params->nofThreads \
                    * params->nofBlocks;

    if (fprintf(params->fd,"\"times\":[\n") < 0 ) return -1;
    for (int i = 0; i < size_time-1; i++){
        if (fprintf(params->fd,"\"%u\",\n",params->host_times[i]) < 0 ) return -1;
    }
    if (fprintf(params->fd,"\"%u\"]\n}", params->host_times[size_time-1]) < 0 ) return -1;

    if (fclose(params->fd) < 0) return -1;
    return 0;
}

static int cleanUp(param_t *params){
    // Free target buffers
    hipFree(params->targetBuffer);
    hipFree(params->target_times);

    // Free host buffers
    free(params->hostBuffer);
    free(params->host_times);
    return 0;
}

static void PrintUsage(const char *name) {
    printf("Usage: %s <#threads> <#blocks> <# of intervals> <size in KB>"
            "<output JSON file name>\n", name);
}

int main(int argc, char **argv) {

    if (argc != 6) {
        PrintUsage(argv[0]);
        return 1;
    }

    param_t params;

    // Parse input parameter
    int nof_threads = atoi(argv[1]);
    if (nof_threads <= 0) {
        printf("Min one thread. Got %s threads\n", argv[1]);
        return EXIT_FAILURE;
    }

    int nof_blocks = atoi(argv[2]);
    if (nof_blocks <= 0) {
        printf("Min 1 block. Got %s blocks\n", argv[2]);
        return EXIT_FAILURE;
    }
    params.nofThreads = nof_threads;
    params.nofBlocks = nof_blocks;

    int nof_repetitions = atoi(argv[3]);
    if (nof_repetitions <= 0) {
        printf("More than 0 repetitions need to be used. Got %s repetitions\n", argv[3]);
        return EXIT_FAILURE;
    }

    int data_size = atoi(argv[4]);
    if (data_size <= 0) {
        printf("The buffer must be 1 or more KB. Got %s KB\n", argv[4]);
        return EXIT_FAILURE;
    }


    params.nof_repetitions = nof_repetitions;
    params.data_size = data_size*1024;
    params.buffer_length = data_size*1024/sizeof(int);

    params.fd = NULL;
    params.fd = fopen(argv[5],"w");
    if (params.fd == NULL) {
        perror("Error opening output file:");
        return EXIT_FAILURE;
    }

    // Set CUDA device
    if (CheckCUDAError(hipSetDevice(DEVICE_NUMBER))) {
        return EXIT_FAILURE;
    }

    // Initialize parameters
    if (initializeTest(&params) < 0) return EXIT_FAILURE;

    // Run test
    if (runTest(&params) < 0) return EXIT_FAILURE;

    // Write results
    if (writeResults(&params) < 0){
        perror("Error while writing outpufile: ");
        return EXIT_FAILURE;
    }

    // Clean up
    if (cleanUp(&params) < 0) return EXIT_FAILURE;

    printf("Finished testrun\n");
    hipDeviceReset();
    return 0;
}

	.text
	.file	"sequential-walk.hip"
	.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	$104, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rsi, %rbx
	cmpl	$6, %edi
	jne	.LBB0_18
# %bb.1:
	movq	8(%rbx), %r15
	movq	%r15, %rdi
	callq	atoi
	testl	%eax, %eax
	jle	.LBB0_19
# %bb.2:
	movl	%eax, %r14d
	movq	16(%rbx), %r15
	movq	%r15, %rdi
	callq	atoi
	testl	%eax, %eax
	jle	.LBB0_20
# %bb.3:
	movl	%eax, %ebp
	movl	%r14d, 8(%rsp)
	movl	%eax, 12(%rsp)
	movq	24(%rbx), %r15
	movq	%r15, %rdi
	callq	atoi
	testl	%eax, %eax
	jle	.LBB0_21
# %bb.4:
	movl	%eax, %r12d
	movq	32(%rbx), %r13
	movq	%r13, %rdi
	callq	atoi
	testl	%eax, %eax
	jle	.LBB0_26
# %bb.5:
	movl	%eax, %r15d
	movl	%r12d, 16(%rsp)
	shll	$10, %r15d
	movl	%r15d, 20(%rsp)
	movl	%r15d, %r12d
	shrl	$2, %r12d
	movl	%r12d, 24(%rsp)
	movq	40(%rbx), %rdi
	movl	$.L.str.4, %esi
	callq	fopen
	movq	%rax, 96(%rsp)
	testq	%rax, %rax
	je	.LBB0_27
# %bb.6:
	xorl	%edi, %edi
	callq	hipSetDevice
	movl	$.L.str.6, %esi
	movl	%eax, %edi
	movl	$323, %edx                      # imm = 0x143
	callq	_ZL22InternalCheckCUDAError10hipError_tPKcS1_i
	movl	$1, %ebx
	testl	%eax, %eax
	jne	.LBB0_25
# %bb.7:
	movl	%r15d, %r15d
	movq	%r15, %rdi
	callq	malloc
	movq	%rax, 48(%rsp)
	testq	%rax, %rax
	je	.LBB0_28
# %bb.8:                                # %.lr.ph.i.i
	movq	%rax, %rcx
	leaq	56(%rsp), %rdi
	imull	%ebp, %r14d
	movl	%r12d, %esi
	xorl	%r8d, %r8d
.LBB0_9:                                # =>This Inner Loop Header: Depth=1
	leal	(%r14,%r8), %eax
	cltd
	idivl	%r12d
	movl	%edx, (%rcx,%r8,4)
	incq	%r8
	cmpq	%r8, %rsi
	jne	.LBB0_9
# %bb.10:                               # %_ZL25createSequentialArrayHost7param_t.exit.i
	movq	%r15, %rsi
	callq	hipMalloc
	movl	$.L.str.13, %esi
	movl	%eax, %edi
	movl	$126, %edx
	callq	_ZL22InternalCheckCUDAError10hipError_tPKcS1_i
	testl	%eax, %eax
	jne	.LBB0_25
# %bb.11:
	leaq	80(%rsp), %rdi
	movl	-64(%rdi), %eax
	imull	-72(%rdi), %eax
	imull	-68(%rdi), %eax
	shll	$2, %eax
	movslq	%eax, %r14
	movq	%r14, %rsi
	callq	hipMalloc
	movl	$.L.str.14, %esi
	movl	%eax, %edi
	movl	$146, %edx
	callq	_ZL22InternalCheckCUDAError10hipError_tPKcS1_i
	testl	%eax, %eax
	jne	.LBB0_25
# %bb.12:
	movq	%r14, %rdi
	callq	malloc
	movq	%rax, 88(%rsp)
	testq	%rax, %rax
	je	.LBB0_30
# %bb.13:
	movl	$1, %ebx
	movq	%rax, %rdi
	movl	$1, %esi
	movq	%r14, %rdx
	callq	memset@PLT
	leaq	64(%rsp), %rdi
	movl	$8, %esi
	callq	hipMalloc
	movl	$.L.str.16, %esi
	movl	%eax, %edi
	movl	$159, %edx
	callq	_ZL22InternalCheckCUDAError10hipError_tPKcS1_i
	testl	%eax, %eax
	jne	.LBB0_25
# %bb.14:                               # %_ZL14initializeTestP7param_t.exit
	leaq	32(%rsp), %rdi
	movl	$4, %esi
	callq	hipMalloc
	movl	$.L.str.17, %esi
	movl	%eax, %edi
	movl	$163, %edx
	callq	_ZL22InternalCheckCUDAError10hipError_tPKcS1_i
	testl	%eax, %eax
	jne	.LBB0_25
# %bb.15:
	leaq	8(%rsp), %rdi
	callq	_ZL7runTestP7param_t
	testl	%eax, %eax
	js	.LBB0_25
# %bb.16:
	leaq	8(%rsp), %rdi
	callq	_ZL12writeResultsP7param_t
	testl	%eax, %eax
	js	.LBB0_31
# %bb.17:
	leaq	8(%rsp), %rdi
	callq	_ZL7cleanUpP7param_t
	movl	$.Lstr, %edi
	callq	puts@PLT
	callq	hipDeviceReset
	xorl	%ebx, %ebx
	jmp	.LBB0_25
.LBB0_18:
	movq	(%rbx), %rsi
	movl	$.L.str.10, %edi
	jmp	.LBB0_23
.LBB0_19:
	movl	$.L.str, %edi
	jmp	.LBB0_22
.LBB0_20:
	movl	$.L.str.1, %edi
	jmp	.LBB0_22
.LBB0_21:
	movl	$.L.str.2, %edi
.LBB0_22:                               # %_ZL14initializeTestP7param_t.exit.thread
	movq	%r15, %rsi
.LBB0_23:                               # %_ZL14initializeTestP7param_t.exit.thread
	xorl	%eax, %eax
	callq	printf
.LBB0_24:
	movl	$1, %ebx
.LBB0_25:
	movl	%ebx, %eax
	addq	$104, %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
.LBB0_26:
	.cfi_def_cfa_offset 160
	movl	$.L.str.3, %edi
	movq	%r13, %rsi
	jmp	.LBB0_23
.LBB0_27:
	movl	$.L.str.5, %edi
	callq	perror
	jmp	.LBB0_24
.LBB0_28:
	movl	$.L.str.12, %edi
.LBB0_29:
	callq	perror
	jmp	.LBB0_25
.LBB0_30:
	movl	$.L.str.15, %edi
	jmp	.LBB0_29
.LBB0_31:
	movl	$.L.str.8, %edi
	jmp	.LBB0_29
.Lfunc_end0:
	.size	main, .Lfunc_end0-main
	.cfi_endproc
                                        # -- End function
	.type	_ZL22InternalCheckCUDAError10hipError_tPKcS1_i,@function # -- Begin function _ZL22InternalCheckCUDAError10hipError_tPKcS1_i
_ZL22InternalCheckCUDAError10hipError_tPKcS1_i: # @_ZL22InternalCheckCUDAError10hipError_tPKcS1_i
	.cfi_startproc
# %bb.0:
	testl	%edi, %edi
	je	.LBB1_1
# %bb.2:
	pushq	%rbp
	.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 %rbp, -16
	movl	%edx, %ebp
	movq	%rsi, %rbx
	movl	%edi, %r14d
	callq	hipGetErrorString
	movl	$.L.str.11, %edi
	movl	$.L.str.7, %edx
	movl	%r14d, %esi
	movl	%ebp, %ecx
	movq	%rbx, %r8
	movq	%rax, %r9
	xorl	%eax, %eax
	callq	printf
	movl	$-1, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	.cfi_restore %rbx
	.cfi_restore %r14
	.cfi_restore %rbp
	retq
.LBB1_1:
	xorl	%eax, %eax
	retq
.Lfunc_end1:
	.size	_ZL22InternalCheckCUDAError10hipError_tPKcS1_i, .Lfunc_end1-_ZL22InternalCheckCUDAError10hipError_tPKcS1_i
	.cfi_endproc
                                        # -- End function
	.type	_ZL7runTestP7param_t,@function  # -- Begin function _ZL7runTestP7param_t
_ZL7runTestP7param_t:                   # @_ZL7runTestP7param_t
	.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	$152, %rsp
	.cfi_def_cfa_offset 208
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rdi, %rbx
	movabsq	$4294967296, %r14               # imm = 0x100000000
	leaq	1(%r14), %rdi
	movl	$1, %esi
	movq	%rdi, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB2_2
# %bb.1:
	leaq	56(%rsp), %rax
	movl	$12, %ecx
	movq	%rax, %rdi
	movq	%rbx, %rsi
	rep;movsq (%rsi), %es:(%rdi)
	movq	%rsp, %rcx
	movq	%rax, (%rcx)
	leaq	40(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%rsp), %r13
	leaq	8(%rsp), %rbp
	movq	%r15, %rdi
	movq	%r12, %rsi
	movq	%r13, %rdx
	movq	%rbp, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r15), %rsi
	movl	8(%r15), %edx
	movq	(%r12), %rcx
	movl	8(%r12), %r8d
	movl	$_ZL22getMeasurementOverhead7param_t, %edi
	movq	%rsp, %r9
	pushq	(%rbp)
	.cfi_adjust_cfa_offset 8
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$16, %rsp
	.cfi_adjust_cfa_offset -16
.LBB2_2:
	movl	(%rbx), %edx
	movl	4(%rbx), %edi
	orq	%r14, %rdi
	orq	%r14, %rdx
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB2_4
# %bb.3:
	leaq	56(%rsp), %rax
	movl	$12, %ecx
	movq	%rax, %rdi
	movq	%rbx, %rsi
	rep;movsq (%rsi), %es:(%rdi)
	movq	%rsp, %r14
	movq	%rax, (%r14)
	leaq	40(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%rsp), %r13
	leaq	8(%rsp), %rbp
	movq	%r15, %rdi
	movq	%r12, %rsi
	movq	%r13, %rdx
	movq	%rbp, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r15), %rsi
	movl	8(%r15), %edx
	movq	(%r12), %rcx
	movl	8(%r12), %r8d
	movl	$_ZL14sequentialWalk7param_t, %edi
	movq	%r14, %r9
	pushq	(%rbp)
	.cfi_adjust_cfa_offset 8
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$16, %rsp
	.cfi_adjust_cfa_offset -16
.LBB2_4:
	callq	hipDeviceSynchronize
	movl	$.L.str.18, %esi
	movl	%eax, %edi
	movl	$175, %edx
	callq	_ZL22InternalCheckCUDAError10hipError_tPKcS1_i
	movl	$-1, %ebp
	testl	%eax, %eax
	jne	.LBB2_8
# %bb.5:
	movl	8(%rbx), %eax
	imull	(%rbx), %eax
	imull	4(%rbx), %eax
	shll	$2, %eax
	movq	80(%rbx), %rdi
	movq	72(%rbx), %rsi
	movslq	%eax, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	movl	$.L.str.19, %esi
	movl	%eax, %edi
	movl	$186, %edx
	callq	_ZL22InternalCheckCUDAError10hipError_tPKcS1_i
	testl	%eax, %eax
	jne	.LBB2_8
# %bb.6:
	leaq	64(%rbx), %rdi
	movq	$0, 64(%rbx)
	movq	56(%rbx), %rsi
	movl	$8, %edx
	movl	$2, %ecx
	callq	hipMemcpy
	movl	$.L.str.20, %esi
	movl	%eax, %edi
	movl	$193, %edx
	callq	_ZL22InternalCheckCUDAError10hipError_tPKcS1_i
	testl	%eax, %eax
	jne	.LBB2_8
# %bb.7:
	leaq	32(%rbx), %rdi
	movl	$0, 32(%rbx)
	movq	24(%rbx), %rsi
	movl	$4, %edx
	movl	$2, %ecx
	callq	hipMemcpy
	movl	$.L.str.21, %esi
	movl	%eax, %edi
	movl	$200, %edx
	callq	_ZL22InternalCheckCUDAError10hipError_tPKcS1_i
	xorl	%ebp, %ebp
	negl	%eax
	sbbl	%ebp, %ebp
.LBB2_8:
	movl	%ebp, %eax
	addq	$152, %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_end2:
	.size	_ZL7runTestP7param_t, .Lfunc_end2-_ZL7runTestP7param_t
	.cfi_endproc
                                        # -- End function
	.type	_ZL12writeResultsP7param_t,@function # -- Begin function _ZL12writeResultsP7param_t
_ZL12writeResultsP7param_t:             # @_ZL12writeResultsP7param_t
	.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	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$1488, %rsp                     # imm = 0x5D0
	.cfi_def_cfa_offset 1536
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rdi, %r14
	movq	88(%rdi), %rdi
	movl	$.L.str.22, %esi
	xorl	%eax, %eax
	callq	fprintf
	testl	%eax, %eax
	js	.LBB3_1
# %bb.2:
	leaq	16(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipGetDevicePropertiesR0600
	movl	$.L.str.23, %esi
	movl	%eax, %edi
	movl	$209, %edx
	callq	_ZL22InternalCheckCUDAError10hipError_tPKcS1_i
	movl	$-1, %ebx
	testl	%eax, %eax
	jne	.LBB3_36
# %bb.3:
	leaq	12(%rsp), %rdi
	movl	$0, (%rdi)
	callq	hipDriverGetVersion
	movl	$.L.str.24, %esi
	movl	%eax, %edi
	movl	$211, %edx
	callq	_ZL22InternalCheckCUDAError10hipError_tPKcS1_i
	movl	$-1, %ebx
	testl	%eax, %eax
	jne	.LBB3_36
# %bb.4:
	leaq	8(%rsp), %rdi
	movl	$0, (%rdi)
	callq	hipRuntimeGetVersion
	movl	$.L.str.25, %esi
	movl	%eax, %edi
	movl	$213, %edx
	callq	_ZL22InternalCheckCUDAError10hipError_tPKcS1_i
	movl	$-1, %ebx
	testl	%eax, %eax
	jne	.LBB3_36
# %bb.5:
	movq	88(%r14), %rdi
	movl	12(%rsp), %edx
	movl	$.L.str.26, %esi
	xorl	%eax, %eax
	callq	fprintf
	testl	%eax, %eax
	js	.LBB3_36
# %bb.6:
	movq	88(%r14), %rdi
	movl	8(%rsp), %edx
	movl	$.L.str.27, %esi
	xorl	%eax, %eax
	callq	fprintf
	testl	%eax, %eax
	js	.LBB3_36
# %bb.7:
	movq	88(%r14), %rdi
	movl	364(%rsp), %edx
	movl	$.L.str.28, %esi
	xorl	%eax, %eax
	callq	fprintf
	testl	%eax, %eax
	js	.LBB3_36
# %bb.8:
	movq	88(%r14), %rdi
	movl	648(%rsp), %edx
	movl	$.L.str.29, %esi
	xorl	%eax, %eax
	callq	fprintf
	testl	%eax, %eax
	js	.LBB3_36
# %bb.9:
	movq	88(%r14), %rdi
	movl	652(%rsp), %edx
	movl	$.L.str.30, %esi
	xorl	%eax, %eax
	callq	fprintf
	testl	%eax, %eax
	js	.LBB3_36
# %bb.10:
	movq	88(%r14), %rdi
	movl	632(%rsp), %edx
	movl	$.L.str.31, %esi
	xorl	%eax, %eax
	callq	fprintf
	testl	%eax, %eax
	js	.LBB3_36
# %bb.11:
	movq	88(%r14), %rdi
	movl	628(%rsp), %edx
	movl	$.L.str.32, %esi
	xorl	%eax, %eax
	callq	fprintf
	testl	%eax, %eax
	js	.LBB3_36
# %bb.12:
	movq	88(%r14), %rdi
	movl	624(%rsp), %edx
	movl	$.L.str.33, %esi
	xorl	%eax, %eax
	callq	fprintf
	testl	%eax, %eax
	js	.LBB3_36
# %bb.13:
	movq	88(%r14), %rdi
	movl	404(%rsp), %edx
	movl	$.L.str.34, %esi
	xorl	%eax, %eax
	callq	fprintf
	testl	%eax, %eax
	js	.LBB3_36
# %bb.14:
	movq	88(%r14), %rdi
	movl	320(%rsp), %edx
	movl	$.L.str.35, %esi
	xorl	%eax, %eax
	callq	fprintf
	testl	%eax, %eax
	js	.LBB3_36
# %bb.15:
	movq	88(%r14), %rdi
	movl	664(%rsp), %edx
	movl	$.L.str.36, %esi
	xorl	%eax, %eax
	callq	fprintf
	testl	%eax, %eax
	js	.LBB3_36
# %bb.16:
	movq	88(%r14), %rdi
	movq	312(%rsp), %rdx
	movl	$.L.str.37, %esi
	xorl	%eax, %eax
	callq	fprintf
	testl	%eax, %eax
	js	.LBB3_36
# %bb.17:
	movq	88(%r14), %rdi
	movq	656(%rsp), %rdx
	movl	$.L.str.38, %esi
	xorl	%eax, %eax
	callq	fprintf
	testl	%eax, %eax
	js	.LBB3_36
# %bb.18:
	movq	88(%r14), %rdi
	movl	324(%rsp), %edx
	movl	$.L.str.39, %esi
	xorl	%eax, %eax
	callq	fprintf
	testl	%eax, %eax
	js	.LBB3_36
# %bb.19:
	leaq	4(%rsp), %rdi
	callq	hipDeviceGetCacheConfig
	movl	$.L.str.40, %esi
	movl	%eax, %edi
	movl	$230, %edx
	callq	_ZL22InternalCheckCUDAError10hipError_tPKcS1_i
	movl	$-1, %ebx
	testl	%eax, %eax
	jne	.LBB3_36
# %bb.20:
	movq	88(%r14), %rdi
	movl	4(%rsp), %edx
	movl	$.L.str.41, %esi
	xorl	%eax, %eax
	callq	fprintf
	testl	%eax, %eax
	js	.LBB3_36
# %bb.21:
	movq	88(%r14), %rdi
	movl	(%r14), %edx
	movl	$.L.str.42, %esi
	xorl	%eax, %eax
	callq	fprintf
	testl	%eax, %eax
	js	.LBB3_36
# %bb.22:
	movq	88(%r14), %rdi
	movl	4(%r14), %edx
	movl	$.L.str.43, %esi
	xorl	%eax, %eax
	callq	fprintf
	testl	%eax, %eax
	js	.LBB3_36
# %bb.23:
	movq	88(%r14), %rdi
	movl	8(%r14), %edx
	movl	$.L.str.44, %esi
	xorl	%eax, %eax
	callq	fprintf
	testl	%eax, %eax
	js	.LBB3_36
# %bb.24:
	movq	88(%r14), %rdi
	movl	12(%r14), %edx
	movl	$.L.str.45, %esi
	xorl	%eax, %eax
	callq	fprintf
	testl	%eax, %eax
	js	.LBB3_36
# %bb.25:
	movq	88(%r14), %rdi
	movl	16(%r14), %edx
	movl	$.L.str.46, %esi
	xorl	%eax, %eax
	callq	fprintf
	testl	%eax, %eax
	js	.LBB3_36
# %bb.26:
	movq	64(%r14), %rdx
	movq	88(%r14), %rdi
	movl	$.L.str.47, %esi
	xorl	%eax, %eax
	callq	fprintf
	testl	%eax, %eax
	js	.LBB3_36
# %bb.27:
	movq	88(%r14), %rdi
	movslq	16(%r14), %rax
	leaq	-1(%rax), %rdx
	imulq	%rax, %rdx
	shrq	%rdx
	movl	$.L.str.48, %esi
	xorl	%eax, %eax
	callq	fprintf
	testl	%eax, %eax
	js	.LBB3_36
# %bb.28:
	movq	88(%r14), %rdi
	movl	32(%r14), %edx
	movl	$.L.str.49, %esi
	xorl	%eax, %eax
	callq	fprintf
	testl	%eax, %eax
	js	.LBB3_36
# %bb.29:
	movl	8(%r14), %ebp
	movl	(%r14), %r15d
	movl	4(%r14), %r12d
	movq	88(%r14), %rdi
	movl	$.L.str.50, %esi
	xorl	%eax, %eax
	callq	fprintf
	testl	%eax, %eax
	js	.LBB3_36
# %bb.30:                               # %.preheader
	imull	%ebp, %r15d
	imull	%r12d, %r15d
	leal	-1(%r15), %ebp
	cmpl	$2, %r15d
	jl	.LBB3_34
# %bb.31:                               # %.lr.ph
	movl	%ebp, %r15d
	xorl	%r12d, %r12d
.LBB3_33:                               # =>This Inner Loop Header: Depth=1
	movq	80(%r14), %rax
	movq	88(%r14), %rdi
	movl	(%rax,%r12,4), %edx
	movl	$.L.str.51, %esi
	xorl	%eax, %eax
	callq	fprintf
	testl	%eax, %eax
	js	.LBB3_36
# %bb.32:                               #   in Loop: Header=BB3_33 Depth=1
	incq	%r12
	cmpq	%r12, %r15
	jne	.LBB3_33
.LBB3_34:                               # %.critedge
	movq	80(%r14), %rax
	movq	88(%r14), %rdi
	movslq	%ebp, %rcx
	movl	(%rax,%rcx,4), %edx
	movl	$.L.str.52, %esi
	xorl	%eax, %eax
	callq	fprintf
	testl	%eax, %eax
	js	.LBB3_36
# %bb.35:
	movq	88(%r14), %rdi
	callq	fclose
	movl	%eax, %ebx
	sarl	$31, %ebx
	jmp	.LBB3_36
.LBB3_1:
	movl	$-1, %ebx
.LBB3_36:
	movl	%ebx, %eax
	addq	$1488, %rsp                     # imm = 0x5D0
	.cfi_def_cfa_offset 48
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.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_end3:
	.size	_ZL12writeResultsP7param_t, .Lfunc_end3-_ZL12writeResultsP7param_t
	.cfi_endproc
                                        # -- End function
	.type	_ZL7cleanUpP7param_t,@function  # -- Begin function _ZL7cleanUpP7param_t
_ZL7cleanUpP7param_t:                   # @_ZL7cleanUpP7param_t
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	movq	%rdi, %rbx
	movq	48(%rdi), %rdi
	callq	hipFree
	movq	72(%rbx), %rdi
	callq	hipFree
	movq	40(%rbx), %rdi
	callq	free
	movq	80(%rbx), %rdi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	free                            # TAILCALL
.Lfunc_end4:
	.size	_ZL7cleanUpP7param_t, .Lfunc_end4-_ZL7cleanUpP7param_t
	.cfi_endproc
                                        # -- End function
	.type	_ZL37__device_stub__getMeasurementOverhead7param_t,@function # -- Begin function _ZL37__device_stub__getMeasurementOverhead7param_t
_ZL37__device_stub__getMeasurementOverhead7param_t: # @_ZL37__device_stub__getMeasurementOverhead7param_t
	.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	112(%rsp), %rax
	movq	%rsp, %rbx
	movq	%rax, (%rbx)
	leaq	48(%rsp), %r14
	leaq	32(%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	$_ZL22getMeasurementOverhead7param_t, %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_end5:
	.size	_ZL37__device_stub__getMeasurementOverhead7param_t, .Lfunc_end5-_ZL37__device_stub__getMeasurementOverhead7param_t
	.cfi_endproc
                                        # -- End function
	.type	_ZL29__device_stub__sequentialWalk7param_t,@function # -- Begin function _ZL29__device_stub__sequentialWalk7param_t
_ZL29__device_stub__sequentialWalk7param_t: # @_ZL29__device_stub__sequentialWalk7param_t
	.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	112(%rsp), %rax
	movq	%rsp, %rbx
	movq	%rax, (%rbx)
	leaq	48(%rsp), %r14
	leaq	32(%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	$_ZL14sequentialWalk7param_t, %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_end6:
	.size	_ZL29__device_stub__sequentialWalk7param_t, .Lfunc_end6-_ZL29__device_stub__sequentialWalk7param_t
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	subq	$32, %rsp
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -16
	movq	__hip_gpubin_handle(%rip), %rbx
	testq	%rbx, %rbx
	jne	.LBB7_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB7_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_ZL22getMeasurementOverhead7param_t, %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	$_ZL14sequentialWalk7param_t, %esi
	movl	$.L__unnamed_2, %edx
	movl	$.L__unnamed_2, %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_end7:
	.size	__hip_module_ctor, .Lfunc_end7-__hip_module_ctor
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_dtor
	.type	__hip_module_dtor,@function
__hip_module_dtor:                      # @__hip_module_dtor
	.cfi_startproc
# %bb.0:
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	je	.LBB8_2
# %bb.1:
	pushq	%rax
	.cfi_def_cfa_offset 16
	callq	__hipUnregisterFatBinary
	movq	$0, __hip_gpubin_handle(%rip)
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
.LBB8_2:
	retq
.Lfunc_end8:
	.size	__hip_module_dtor, .Lfunc_end8-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"Min one thread. Got %s threads\n"
	.size	.L.str, 32

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"Min 1 block. Got %s blocks\n"
	.size	.L.str.1, 28

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"More than 0 repetitions need to be used. Got %s repetitions\n"
	.size	.L.str.2, 61

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"The buffer must be 1 or more KB. Got %s KB\n"
	.size	.L.str.3, 44

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"w"
	.size	.L.str.4, 2

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"Error opening output file:"
	.size	.L.str.5, 27

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"hipSetDevice(DEVICE_NUMBER)"
	.size	.L.str.6, 28

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"/home/ubuntu/Datasets/stackv2/train-structured-repos-hip-sm89/realentertain/tt-gpu/master/experiments/sequential-walk-multithread/sequential-walk.hip"
	.size	.L.str.7, 150

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"Error while writing outpufile: "
	.size	.L.str.8, 32

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	"Usage: %s <#threads> <#blocks> <# of intervals> <size in KB><output JSON file name>\n"
	.size	.L.str.10, 85

	.type	.L.str.11,@object               # @.str.11
.L.str.11:
	.asciz	"CUDA error %d in %s, line %d (%s): %s\n"
	.size	.L.str.11, 39

	.type	.L.str.12,@object               # @.str.12
.L.str.12:
	.asciz	"Failed allocating host buffer: "
	.size	.L.str.12, 32

	.type	.L.str.13,@object               # @.str.13
.L.str.13:
	.asciz	"hipMalloc(&params->targetBuffer, params->buffer_length*sizeof(int))"
	.size	.L.str.13, 68

	.type	.L.str.14,@object               # @.str.14
.L.str.14:
	.asciz	"hipMalloc(&params->target_times, size_time)"
	.size	.L.str.14, 44

	.type	.L.str.15,@object               # @.str.15
.L.str.15:
	.asciz	"Failed allocating host_times buffer: "
	.size	.L.str.15, 38

	.type	.L.str.16,@object               # @.str.16
.L.str.16:
	.asciz	"hipMalloc(&params->target_realSum, sizeof(uint64_t))"
	.size	.L.str.16, 53

	.type	.L.str.17,@object               # @.str.17
.L.str.17:
	.asciz	"hipMalloc(&params->targetMeasOH, sizeof(unsigned int))"
	.size	.L.str.17, 55

	.type	_ZL22getMeasurementOverhead7param_t,@object # @_ZL22getMeasurementOverhead7param_t
	.section	.rodata,"a",@progbits
	.p2align	3, 0x0
_ZL22getMeasurementOverhead7param_t:
	.quad	_ZL37__device_stub__getMeasurementOverhead7param_t
	.size	_ZL22getMeasurementOverhead7param_t, 8

	.type	_ZL14sequentialWalk7param_t,@object # @_ZL14sequentialWalk7param_t
	.p2align	3, 0x0
_ZL14sequentialWalk7param_t:
	.quad	_ZL29__device_stub__sequentialWalk7param_t
	.size	_ZL14sequentialWalk7param_t, 8

	.type	.L.str.18,@object               # @.str.18
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.18:
	.asciz	"hipDeviceSynchronize()"
	.size	.L.str.18, 23

	.type	.L.str.19,@object               # @.str.19
.L.str.19:
	.asciz	"hipMemcpy(params->host_times, params->target_times, size_time, hipMemcpyDeviceToHost)"
	.size	.L.str.19, 86

	.type	.L.str.20,@object               # @.str.20
.L.str.20:
	.asciz	"hipMemcpy(&params->host_realSum, params->target_realSum, sizeof(uint64_t), hipMemcpyDeviceToHost)"
	.size	.L.str.20, 98

	.type	.L.str.21,@object               # @.str.21
.L.str.21:
	.asciz	"hipMemcpy(&params->hostMeasOH, params->targetMeasOH, sizeof(unsigned int), hipMemcpyDeviceToHost)"
	.size	.L.str.21, 98

	.type	.L.str.22,@object               # @.str.22
.L.str.22:
	.asciz	"{\n"
	.size	.L.str.22, 3

	.type	.L.str.23,@object               # @.str.23
.L.str.23:
	.asciz	"hipGetDeviceProperties(&deviceProp, DEVICE_NUMBER)"
	.size	.L.str.23, 51

	.type	.L.str.24,@object               # @.str.24
.L.str.24:
	.asciz	"hipDriverGetVersion(&driverVersion)"
	.size	.L.str.24, 36

	.type	.L.str.25,@object               # @.str.25
.L.str.25:
	.asciz	"hipRuntimeGetVersion(&runtimeVersion)"
	.size	.L.str.25, 38

	.type	.L.str.26,@object               # @.str.26
.L.str.26:
	.asciz	"\"driverVer\": \"%d\",\n"
	.size	.L.str.26, 20

	.type	.L.str.27,@object               # @.str.27
.L.str.27:
	.asciz	"\"runTimeVer\": \"%d\",\n"
	.size	.L.str.27, 21

	.type	.L.str.28,@object               # @.str.28
.L.str.28:
	.asciz	"\"clockRate\": \"%d\",\n"
	.size	.L.str.28, 20

	.type	.L.str.29,@object               # @.str.29
.L.str.29:
	.asciz	"\"globalL1CacheSupported\": \"%d\",\n"
	.size	.L.str.29, 33

	.type	.L.str.30,@object               # @.str.30
.L.str.30:
	.asciz	"\"localL1CacheSupported\": \"%d\",\n"
	.size	.L.str.30, 32

	.type	.L.str.31,@object               # @.str.31
.L.str.31:
	.asciz	"\"l2CacheSize\": \"%d\",\n"
	.size	.L.str.31, 22

	.type	.L.str.32,@object               # @.str.32
.L.str.32:
	.asciz	"\"memoryBusWidth\": \"%d\",\n"
	.size	.L.str.32, 25

	.type	.L.str.33,@object               # @.str.33
.L.str.33:
	.asciz	"\"memoryClockRate\": \"%d\",\n"
	.size	.L.str.33, 26

	.type	.L.str.34,@object               # @.str.34
.L.str.34:
	.asciz	"\"multiProcessorCount\": \"%d\",\n"
	.size	.L.str.34, 30

	.type	.L.str.35,@object               # @.str.35
.L.str.35:
	.asciz	"\"regsPerBlock\": \"%d\",\n"
	.size	.L.str.35, 23

	.type	.L.str.36,@object               # @.str.36
.L.str.36:
	.asciz	"\"regsPerMultiprocessor\": \"%d\",\n"
	.size	.L.str.36, 32

	.type	.L.str.37,@object               # @.str.37
.L.str.37:
	.asciz	"\"sharedMemPerBlock\": \"%zu\",\n"
	.size	.L.str.37, 29

	.type	.L.str.38,@object               # @.str.38
.L.str.38:
	.asciz	"\"sharedMemPerMultiprocessor\": \"%zu\",\n"
	.size	.L.str.38, 38

	.type	.L.str.39,@object               # @.str.39
.L.str.39:
	.asciz	"\"warpSize\": \"%d\",\n"
	.size	.L.str.39, 19

	.type	.L.str.40,@object               # @.str.40
.L.str.40:
	.asciz	"hipDeviceGetCacheConfig ( &config )"
	.size	.L.str.40, 36

	.type	.L.str.41,@object               # @.str.41
.L.str.41:
	.asciz	"\"cacheConfig\": \"%d\",\n"
	.size	.L.str.41, 22

	.type	.L.str.42,@object               # @.str.42
.L.str.42:
	.asciz	"\"nofThreads\": \"%u\",\n"
	.size	.L.str.42, 21

	.type	.L.str.43,@object               # @.str.43
.L.str.43:
	.asciz	"\"nofBlocks\": \"%u\",\n"
	.size	.L.str.43, 20

	.type	.L.str.44,@object               # @.str.44
.L.str.44:
	.asciz	"\"nof_repetitions\": \"%d\",\n"
	.size	.L.str.44, 26

	.type	.L.str.45,@object               # @.str.45
.L.str.45:
	.asciz	"\"data_size\": \"%d\",\n"
	.size	.L.str.45, 20

	.type	.L.str.46,@object               # @.str.46
.L.str.46:
	.asciz	"\"buffer_length\": \"%d\",\n"
	.size	.L.str.46, 24

	.type	.L.str.47,@object               # @.str.47
.L.str.47:
	.asciz	"\"real_sum\": \"%llu\",\n"
	.size	.L.str.47, 21

	.type	.L.str.48,@object               # @.str.48
.L.str.48:
	.asciz	"\"exp_sum\": \"%llu\",\n"
	.size	.L.str.48, 20

	.type	.L.str.49,@object               # @.str.49
.L.str.49:
	.asciz	"\"measOH\": \"%u\",\n"
	.size	.L.str.49, 17

	.type	.L.str.50,@object               # @.str.50
.L.str.50:
	.asciz	"\"times\":[\n"
	.size	.L.str.50, 11

	.type	.L.str.51,@object               # @.str.51
.L.str.51:
	.asciz	"\"%u\",\n"
	.size	.L.str.51, 7

	.type	.L.str.52,@object               # @.str.52
.L.str.52:
	.asciz	"\"%u\"]\n}"
	.size	.L.str.52, 8

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_ZL22getMeasurementOverhead7param_t"
	.size	.L__unnamed_1, 36

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_ZL14sequentialWalk7param_t"
	.size	.L__unnamed_2, 28

	.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	"Finished testrun"
	.size	.Lstr, 17

	.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 _ZL37__device_stub__getMeasurementOverhead7param_t
	.addrsig_sym _ZL29__device_stub__sequentialWalk7param_t
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _ZL22getMeasurementOverhead7param_t
	.addrsig_sym _ZL14sequentialWalk7param_t
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.section	.text._ZL22getMeasurementOverhead7param_t,"axG",@progbits,_ZL22getMeasurementOverhead7param_t,comdat
	.globl	_ZL22getMeasurementOverhead7param_t ; -- Begin function _ZL22getMeasurementOverhead7param_t
	.p2align	8
	.type	_ZL22getMeasurementOverhead7param_t,@function
_ZL22getMeasurementOverhead7param_t:    ; @_ZL22getMeasurementOverhead7param_t
; %bb.0:
	s_clause 0x2
	s_load_b32 s6, s[0:1], 0x10
	s_load_b64 s[2:3], s[0:1], 0x18
	s_load_b64 s[0:1], s[0:1], 0x38
	s_getreg_b32 s7, hwreg(HW_REG_SHADER_CYCLES, 0, 20)
	s_waitcnt lgkmcnt(0)
	s_cmp_lt_i32 s6, 1
	s_cbranch_scc1 .LBB0_2
; %bb.1:                                ; %.lr.ph.preheader
	s_add_i32 s8, s6, -1
	s_add_i32 s4, s6, -2
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	s_mul_hi_u32 s5, s8, s4
	s_mul_i32 s4, s8, s4
	s_lshr_b64 s[4:5], s[4:5], 1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_add_u32 s4, s4, s8
	s_addc_u32 s5, s5, 0
	s_branch .LBB0_3
.LBB0_2:
	s_mov_b64 s[4:5], 0
.LBB0_3:                                ; %._crit_edge
	v_cvt_f32_u32_e32 v0, s6
	s_sub_i32 s9, 0, s6
	s_getreg_b32 s10, hwreg(HW_REG_SHADER_CYCLES, 0, 20)
	v_mov_b32_e32 v2, 0
	s_sub_i32 s7, s10, s7
	v_rcp_iflag_f32_e32 v0, v0
	s_waitcnt_depctr 0xfff
	v_mul_f32_e32 v0, 0x4f7ffffe, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cvt_u32_f32_e32 v0, v0
	v_readfirstlane_b32 s8, v0
	v_dual_mov_b32 v0, s4 :: v_dual_mov_b32 v1, s5
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_mul_i32 s9, s9, s8
	s_mul_hi_u32 s9, s8, s9
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_add_i32 s8, s8, s9
	s_mul_hi_u32 s8, s7, s8
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_mul_i32 s9, s8, s6
	s_sub_i32 s7, s7, s9
	s_add_i32 s9, s8, 1
	s_sub_i32 s10, s7, s6
	s_cmp_ge_u32 s7, s6
	s_cselect_b32 s8, s9, s8
	s_cselect_b32 s7, s10, s7
	s_add_i32 s9, s8, 1
	s_cmp_ge_u32 s7, s6
	s_cselect_b32 s6, s9, s8
	s_delay_alu instid0(SALU_CYCLE_1)
	v_mov_b32_e32 v3, s6
	s_clause 0x1
	global_store_b32 v2, v3, s[2:3]
	global_store_b64 v2, v[0:1], s[0:1]
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _ZL22getMeasurementOverhead7param_t
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 96
		.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 4
		.amdhsa_next_free_sgpr 11
		.amdhsa_reserve_vcc 0
		.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
	.section	.text._ZL22getMeasurementOverhead7param_t,"axG",@progbits,_ZL22getMeasurementOverhead7param_t,comdat
.Lfunc_end0:
	.size	_ZL22getMeasurementOverhead7param_t, .Lfunc_end0-_ZL22getMeasurementOverhead7param_t
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 252
; NumSgprs: 11
; NumVgprs: 4
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 1
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 11
; NumVGPRsForWavesPerEU: 4
; 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
	.section	.text._ZL14sequentialWalk7param_t,"axG",@progbits,_ZL14sequentialWalk7param_t,comdat
	.globl	_ZL14sequentialWalk7param_t     ; -- Begin function _ZL14sequentialWalk7param_t
	.p2align	8
	.type	_ZL14sequentialWalk7param_t,@function
_ZL14sequentialWalk7param_t:            ; @_ZL14sequentialWalk7param_t
; %bb.0:                                ; %.preheader
	s_load_b32 s10, s[0:1], 0x8
	s_waitcnt lgkmcnt(0)
	s_cmp_lt_i32 s10, -1
	s_cbranch_scc1 .LBB1_8
; %bb.1:                                ; %.lr.ph38
	s_clause 0x2
	s_load_b32 s11, s[0:1], 0x10
	s_load_b64 s[2:3], s[0:1], 0x18
	s_load_b32 s4, s[0:1], 0x6c
	v_mov_b32_e32 v6, 0
	s_waitcnt lgkmcnt(0)
	v_cvt_f32_u32_e32 v1, s11
	s_sub_i32 s6, 0, s11
	s_and_b32 s4, s4, 0xffff
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_rcp_iflag_f32_e32 v1, v1
	s_waitcnt_depctr 0xfff
	v_mul_f32_e32 v1, 0x4f7ffffe, v1
	v_cvt_u32_f32_e32 v1, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_readfirstlane_b32 s5, v1
	v_mad_u64_u32 v[1:2], null, s15, s4, v[0:1]
	s_mul_i32 s6, s6, s5
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_mul_hi_u32 s4, s5, s6
	s_add_i32 s12, s5, s4
	s_clause 0x1
	s_load_b128 s[4:7], s[0:1], 0x30
	s_load_b64 s[8:9], s[0:1], 0x48
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_4) | instid1(VALU_DEP_2)
	v_mul_hi_u32 v0, v1, s12
	s_cmp_gt_i32 s11, 0
	v_mul_lo_u32 v4, v1, s10
	s_cselect_b32 s0, -1, 0
	s_mov_b32 s1, -2
	v_mul_lo_u32 v0, v0, s11
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_sub_nc_u32_e32 v0, v1, v0
	v_subrev_nc_u32_e32 v2, s11, v0
	v_cmp_le_u32_e32 vcc_lo, s11, v0
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_cndmask_b32_e32 v0, v0, v2, vcc_lo
	v_cndmask_b32_e64 v2, 0, 1, s0
	v_subrev_nc_u32_e32 v3, s11, v0
	v_cmp_le_u32_e32 vcc_lo, s11, v0
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_cmp_ne_u32_e64 s0, 1, v2
	v_cndmask_b32_e32 v5, v0, v3, vcc_lo
.LBB1_2:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB1_4 Depth 2
	v_mov_b32_e32 v0, 0
	v_mov_b32_e32 v1, 0
	s_waitcnt lgkmcnt(0)
	s_waitcnt_vscnt null, 0x0
	s_barrier
	buffer_gl0_inv
	s_and_b32 vcc_lo, exec_lo, s0
	s_getreg_b32 s13, hwreg(HW_REG_SHADER_CYCLES, 0, 20)
	s_cbranch_vccnz .LBB1_5
; %bb.3:                                ; %.lr.ph.preheader
                                        ;   in Loop: Header=BB1_2 Depth=1
	v_mov_b32_e32 v2, v5
	s_mov_b32 s14, s11
.LBB1_4:                                ; %.lr.ph
                                        ;   Parent Loop BB1_2 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	v_ashrrev_i32_e32 v3, 31, v2
	s_add_i32 s14, s14, -1
	s_cmp_eq_u32 s14, 0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[2:3], 2, v[2:3]
	v_add_co_u32 v2, vcc_lo, s4, v2
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_4) | instid1(VALU_DEP_2)
	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 v3, 31, v2
	v_add_co_u32 v0, vcc_lo, v0, v2
	v_add_co_ci_u32_e32 v1, vcc_lo, v1, v3, vcc_lo
	s_cbranch_scc0 .LBB1_4
.LBB1_5:                                ; %Flow44
                                        ;   in Loop: Header=BB1_2 Depth=1
	s_getreg_b32 s14, hwreg(HW_REG_SHADER_CYCLES, 0, 20)
	s_cmp_gt_i32 s1, -1
	s_barrier
	buffer_gl0_inv
	global_store_b64 v6, v[0:1], s[6:7]
	s_cbranch_scc0 .LBB1_7
; %bb.6:                                ;   in Loop: Header=BB1_2 Depth=1
	global_load_b32 v2, v6, s[2:3]
	v_add_nc_u32_e32 v0, s1, v4
	s_sub_i32 s13, s14, s13
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_mul_hi_u32 s14, s13, s12
	s_mul_i32 s15, s14, s11
	s_delay_alu instid0(VALU_DEP_1)
	v_ashrrev_i32_e32 v1, 31, v0
	s_sub_i32 s13, s13, s15
	s_add_i32 s15, s14, 1
	s_sub_i32 s16, s13, s11
	s_cmp_ge_u32 s13, s11
	v_lshlrev_b64 v[0:1], 2, v[0:1]
	s_cselect_b32 s14, s15, s14
	s_cselect_b32 s13, s16, s13
	s_add_i32 s15, s14, 1
	s_cmp_ge_u32 s13, s11
	s_cselect_b32 s13, s15, s14
	v_add_co_u32 v0, vcc_lo, s8, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s9, v1, vcc_lo
	s_waitcnt vmcnt(0)
	v_sub_nc_u32_e32 v2, s13, v2
	global_store_b32 v[0:1], v2, off
.LBB1_7:                                ;   in Loop: Header=BB1_2 Depth=1
	s_add_i32 s1, s1, 1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmp_eq_u32 s1, s10
	s_cbranch_scc0 .LBB1_2
.LBB1_8:                                ; %._crit_edge39
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _ZL14sequentialWalk7param_t
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 352
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 7
		.amdhsa_next_free_sgpr 17
		.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
	.section	.text._ZL14sequentialWalk7param_t,"axG",@progbits,_ZL14sequentialWalk7param_t,comdat
.Lfunc_end1:
	.size	_ZL14sequentialWalk7param_t, .Lfunc_end1-_ZL14sequentialWalk7param_t
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 536
; NumSgprs: 19
; NumVgprs: 7
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 19
; NumVGPRsForWavesPerEU: 7
; 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:           96
        .value_kind:     by_value
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 96
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _ZL22getMeasurementOverhead7param_t
    .private_segment_fixed_size: 0
    .sgpr_count:     11
    .sgpr_spill_count: 0
    .symbol:         _ZL22getMeasurementOverhead7param_t.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     4
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .offset:         0
        .size:           96
        .value_kind:     by_value
      - .offset:         96
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         100
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         104
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         108
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         110
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         112
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         114
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         116
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         118
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         136
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         144
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         152
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         160
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 352
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _ZL14sequentialWalk7param_t
    .private_segment_fixed_size: 0
    .sgpr_count:     19
    .sgpr_spill_count: 0
    .symbol:         _ZL14sequentialWalk7param_t.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     7
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
