#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>

#define STAR -1
struct timeval start, end;

void load_csv(int*data, char *csv_file, int rows, int cols, int cols_t){
    FILE* file = fopen(csv_file, "r");
    for (int row = 0; row < rows; row++) {
        for (int col = 0; col < cols; col++) {
            if(!fscanf(file, "%d;", &data[row*cols_t + col])) {
                fscanf(file, "%*c;");
                data[row*cols_t + col] = STAR;
            }
        }
    }
    fclose(file);
}

void save_result_csv(char *csv_file, char* result, int*data, int rows, int cols_result, int cols_data){
    FILE* file = fopen(csv_file, "w");
    for (int row = 0; row < rows; row++) {
        for (int result_col =0 ; result_col<cols_result;result_col++){
            for(int i=0;i<result[row*cols_result + result_col];i++){
                for(int j=0;j<cols_data;j++){
                    fprintf(file,"%d;",data[row*cols_data+j]);
                }
                fprintf(file,"%d\n",result_col);
            }
            
        }
        
    }
    fclose(file);
}

int cmpfunc (const void * a, const void * b) {
	const int *r1 = (const int*)a;
	const int *r2 = (const int*)b;
    int mask_index = 11;
    int mask_diff = (*(r1+mask_index)) - (*(r2+mask_index));
    if (mask_diff) {
        return mask_diff;
    }
    return (*(r1+mask_index + 1)) - (*(r2+mask_index+1));
}

__host__ __device__ 
int bsearch(int key, int *rules,int rule_t_size,int start,int end){

    int pivot,result;

	while (end > start) {
		pivot =  start + ((end-start)>>1);
		result = key - rules[pivot*rule_t_size + 12];

		if (result == 0)
			return pivot;

		if (result > 0) {
			start = pivot + 1;
		}else{
            end = pivot;
        }
	}
	return -1;
}

__host__ __device__
void process_transaction(int tr,int *rules, int rules_count ,int rule_size,int rule_t_size, int *data,int tr_count,int tr_size,int* mask_indexes, int MAX_MASK, char* result,int result_size){
    
    for (int i=tr*result_size;i<(tr+1)*result_size;i++){
        result[i]=0;
    }
    
    for (int mask = 0; mask < MAX_MASK ; mask++) {
        int tmp_mask = mask;
        int hash = 0;
        for (int i = 0; i <tr_size; i++) {
            if (tmp_mask % 2 == 0) {
                hash += data[tr*tr_size + i];
            }
            tmp_mask /= 2;
        }
        int index_start = mask_indexes[mask];
        int index_end = mask_indexes[mask + 1];

        if (index_start != index_end) {

            int found = bsearch(hash, rules, rule_t_size, index_start,index_end);
            if (found != -1) {
                
                while (found > 0 && (rules[found*rule_t_size + rule_size+1] == rules[(found-1)*rule_t_size + rule_size+1])) {
                    found--;
                }
                while (found < rules_count && rules[found*rule_t_size +rule_size+1] == hash) {
                    int ok = 1;
                    for (int i = 0; ok && i < tr_size; i++) {
                        ok = (rules[found*rule_t_size +i] == STAR || (rules[found*rule_t_size +i] == data[tr*tr_size + i]));
                    }
                    if (ok) {
                       result[tr*result_size + rules[found*rule_t_size + rule_size -1]]+=1;
                    }
                    found++;
                }
            }
        }
    }
    
    
}

void process_on_CPU(int *rules, int rules_count ,int rule_size,int rule_t_size, int *data,int tr_count,int tr_size,int* mask_indexes, int MAX_MASK, char* result, int result_size){
    
    char transactions_file[20] = "transactions_0.csv";
    char out_file[20] = "out_0.csv";

    for(int i =0;i<2;i++){
        transactions_file[13] = '0'+i;
        out_file[4] = '0'+i;
        printf("Loading transactions_%d\n",i);
        load_csv(data,transactions_file, tr_count, tr_size, tr_size);
        
        printf("CPU: start_%d\n",i);
        gettimeofday(&start, NULL);
        
        #pragma omp parallel for
        for (int tr = 0; tr < tr_count; tr++) {
          process_transaction(tr,rules,rules_count,rule_size,rule_t_size,data,tr_count,tr_size,mask_indexes,MAX_MASK,result,result_size);
        }
        
        gettimeofday(&end, NULL);
        printf("CPU: end_%d : %f s\n",i,(end.tv_sec  - start.tv_sec)+ (end.tv_usec - start.tv_usec) / 1.e6);
        
        //save_result_csv(out_file,result,data,tr_count,result_size,tr_size);
    }
}


__global__
void process_batch_kernel(int curr_batch_size,int *rules, int rules_count ,int rule_size,int rule_t_size, int *data,int tr_count,int tr_size,int* mask_indexes, int MAX_MASK, char*result,int result_size){
    
    int tr = blockIdx.x*blockDim.x + threadIdx.x;
    if(tr >= curr_batch_size)return;
    
    process_transaction(tr,rules,rules_count,rule_size,rule_t_size,data,tr_count,tr_size,mask_indexes,MAX_MASK,result,result_size);
    
}

void cudaAssert(int line,cudaError_t err){
    if(err!=cudaSuccess){printf("%s in %s at line %d\n",cudaGetErrorString(err),__FILE__,line);}
}

void process_on_GPU(int *rules, int rules_count ,int rule_size,int rule_t_size, int *data,int tr_count,int tr_size,int* mask_indexes, int MAX_MASK,char *result,int result_size){
    
    int* data_g;
    int* rules_g;
    int* mask_indexes_g;
    char* result_g;
    
    int BLOCK_SIZE =256;
    int BLOCK_DIM = 16;
    int batch_size = BLOCK_SIZE*BLOCK_DIM;
    int batch_count = (tr_count+batch_size-1)/batch_size; //divide and round up;
    
    cudaAssert(__LINE__,cudaMalloc((void **)&rules_g, rules_count*rule_t_size*sizeof(int)));
    cudaAssert(__LINE__,cudaMalloc((void **)&mask_indexes_g, (MAX_MASK+1)*sizeof(int)));
    cudaAssert(__LINE__,cudaMemcpy(rules_g, rules, rules_count*rule_t_size*sizeof(int), cudaMemcpyHostToDevice));
    cudaAssert(__LINE__,cudaMemcpy(mask_indexes_g, mask_indexes, (MAX_MASK+1)*sizeof(int), cudaMemcpyHostToDevice));
    
    cudaAssert(__LINE__,cudaMalloc((void **)&result_g, batch_size*result_size*sizeof(char)));
    cudaAssert(__LINE__,cudaMalloc((void **)&data_g, batch_size*tr_size*sizeof(int)));
    
    char transactions_file[20] = "transactions_0.csv";
    char out_file[20] = "out_0.csv";

    for(int i =0;i<2;i++){
        transactions_file[13] = '0'+i;
        out_file[4] = '0'+i;
        printf("Loading transactions_%d\n",i);
        load_csv(data,transactions_file, tr_count, tr_size, tr_size);
    
        printf("GPU: start_%d\n",i);
        gettimeofday(&start, NULL);
        
        int curr_batch_size = batch_size;
        for (int batch_nr=0;batch_nr<batch_count;batch_nr++){
            
            if(batch_nr==batch_count-1){
                curr_batch_size = tr_count - batch_nr*batch_size;
            }
            cudaAssert(__LINE__,cudaMemcpy(data_g, data+batch_nr*batch_size*tr_size , curr_batch_size*tr_size*sizeof(int), cudaMemcpyHostToDevice));

            process_batch_kernel<<<BLOCK_DIM,BLOCK_SIZE>>>(curr_batch_size,rules_g,rules_count ,rule_size,rule_t_size,data_g,tr_count,tr_size,mask_indexes_g,MAX_MASK,result_g,result_size);
            cudaAssert(__LINE__,cudaThreadSynchronize());
            
            cudaAssert(__LINE__,cudaMemcpy(result+batch_nr*batch_size*result_size, result_g , curr_batch_size*result_size*sizeof(char), cudaMemcpyDeviceToHost));
            
        }

        gettimeofday(&end, NULL);
        printf("GPU: end_%d : %f s\n",i,(end.tv_sec  - start.tv_sec)+ (end.tv_usec - start.tv_usec) / 1.e6);
        
        // for(int i=0;i<tr_count;i++){
           // printf("%d:",i);
           // for(int j=0;j<result_size;j++){
               // printf("%d",result[i*result_size + j]);
           // }
           // printf("\n");
        // }
        
        //save_result_csv(out_file,result,data,tr_count,result_size,tr_size);
    }
    
    cudaAssert(__LINE__,cudaFree(data_g));
    cudaAssert(__LINE__,cudaFree(rules_g));
    cudaAssert(__LINE__,cudaFree(mask_indexes_g));
    cudaAssert(__LINE__,cudaFree(result_g));

    
}


int main(){
    char *rules_file = (char *)"rule_2M.csv";
    int rules_count = 2000000;
    int rule_size = 11;
    int rule_t_size = rule_size+2;
    int tr_count = 1000000;
    int tr_size = rule_size - 1;
    
    const int MAX_MASK = (1<<tr_size);

	printf("Loading rules\n");
    int *rules = (int*)calloc(rules_count*(rule_t_size),sizeof(int));
    load_csv(rules,rules_file, rules_count, rule_size, rule_t_size);

    	
    int *data = (int*)calloc(tr_count*(tr_size),sizeof(int));
    
    int result_size = 100;
    char *result = (char*)calloc(tr_count*(result_size),sizeof(char));
    
    for (int i = 0; i < rules_count; i++) {
        int mask = 0;
        int hash = 0;
        for (int col = 0; col <tr_size ; col++) {
            if (rules[i*rule_t_size + col] == STAR) {
                mask |= 1 << (col);
            } else {
                hash += rules[i*rule_t_size + col];
            }
        }
        rules[i*rule_t_size + rule_size] = mask;
        rules[i*rule_t_size + rule_size + 1] = hash;
    }
    
	printf("Sorting rules\n");
	qsort(rules, rules_count, sizeof(int)*rule_t_size, cmpfunc);
    
    int *mask_indexes = (int*)calloc(MAX_MASK + 1,sizeof(int));
    
    int cur_mask = rules[0 + rule_size];
    for (int i = 1; i < rules_count; i++) {
        if (cur_mask != rules[i*rule_t_size + rule_size]) {
            for (int j = cur_mask + 1; j <= rules[i*rule_t_size + rule_size]; j++) {
                mask_indexes[j] = i;
            }
            cur_mask = rules[i*rule_t_size + rule_size];
        }
        
        if( i==(rules_count-1)){
            for(int j= cur_mask+1;j<MAX_MASK+1;j++){
                mask_indexes[j]=rules_count;
            }
        }
    }
    
    //process_on_CPU(rules,rules_count ,rule_size,rule_t_size,data,tr_count,tr_size,mask_indexes,MAX_MASK,result,result_size);
    process_on_GPU(rules,rules_count,rule_size,rule_t_size,data,tr_count,tr_size,mask_indexes,MAX_MASK,result,result_size);
	
    return 0;
}

	.file	"tmpxft_00318b28_00000000-6_grandrule.cudafe1.cpp"
	.text
#APP

#NO_APP
	.globl	_Z7cmpfuncPKvS0_
	.type	_Z7cmpfuncPKvS0_, @function
_Z7cmpfuncPKvS0_:
.LFB2029:
	.cfi_startproc
	endbr64
	movl	44(%rdi), %eax
	subl	44(%rsi), %eax
	jne	.L1
	movl	48(%rdi), %eax
	subl	48(%rsi), %eax
.L1:
	ret
	.cfi_endproc
.LFE2029:
	.size	_Z7cmpfuncPKvS0_, .-_Z7cmpfuncPKvS0_
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2038:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2038:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"r"
.LC1:
	.string	"%d;"
.LC2:
	.string	"%*c;"
	.text
	.globl	_Z8load_csvPiPciii
	.type	_Z8load_csvPiPciii, @function
_Z8load_csvPiPciii:
.LFB2027:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	%r8d, %r15d
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movl	%ecx, %r14d
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	xorl	%r13d, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	xorl	%r12d, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%rdi, 16(%rsp)
	movq	%rsi, %rdi
	leaq	.LC0(%rip), %rsi
	movl	%edx, 28(%rsp)
	call	fopen@PLT
	movq	%rax, 8(%rsp)
.L6:
	movl	28(%rsp), %eax
	cmpl	%eax, %r13d
	jge	.L9
	movq	16(%rsp), %rcx
	movslq	%r12d, %rax
	xorl	%ebp, %ebp
	leaq	(%rcx,%rax,4), %rbx
.L10:
	cmpl	%r14d, %ebp
	jge	.L12
	movq	8(%rsp), %rdi
	xorl	%eax, %eax
	movq	%rbx, %rdx
	leaq	.LC1(%rip), %rsi
	call	__isoc23_fscanf@PLT
	testl	%eax, %eax
	jne	.L7
	movq	8(%rsp), %rdi
	leaq	.LC2(%rip), %rsi
	call	__isoc23_fscanf@PLT
	movl	$-1, (%rbx)
.L7:
	incl	%ebp
	addq	$4, %rbx
	jmp	.L10
.L12:
	incl	%r13d
	addl	%r15d, %r12d
	jmp	.L6
.L9:
	movq	8(%rsp), %rdi
	addq	$40, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	jmp	fclose@PLT
	.cfi_endproc
.LFE2027:
	.size	_Z8load_csvPiPciii, .-_Z8load_csvPiPciii
	.section	.rodata.str1.1
.LC3:
	.string	"w"
.LC4:
	.string	"%d\n"
	.text
	.globl	_Z15save_result_csvPcS_Piiii
	.type	_Z15save_result_csvPcS_Piiii, @function
_Z15save_result_csvPcS_Piiii:
.LFB2028:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	xorl	%r13d, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	xorl	%r12d, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movl	%r9d, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$72, %rsp
	.cfi_def_cfa_offset 128
	movq	%rsi, 16(%rsp)
	leaq	.LC3(%rip), %rsi
	movq	%rdx, 24(%rsp)
	movl	%ecx, 36(%rsp)
	movl	%r8d, 12(%rsp)
	call	fopen@PLT
	movq	%rax, (%rsp)
	xorl	%eax, %eax
	movl	%eax, 8(%rsp)
.L14:
	movl	36(%rsp), %eax
	cmpl	%eax, %r13d
	jge	.L18
	movq	24(%rsp), %rcx
	movslq	%r12d, %rax
	xorl	%ebx, %ebx
	leaq	(%rcx,%rax,4), %r15
	movslq	8(%rsp), %rax
	movq	%rax, 48(%rsp)
.L19:
	movl	%ebx, 32(%rsp)
	cmpl	%ebx, 12(%rsp)
	jle	.L23
	movq	16(%rsp), %rax
	movq	48(%rsp), %rdx
	xorl	%r14d, %r14d
	addq	%rdx, %rax
	movq	%rax, 40(%rsp)
.L17:
	movq	40(%rsp), %rax
	movsbl	(%rax,%rbx), %eax
	cmpl	%r14d, %eax
	jle	.L24
	xorl	%r9d, %r9d
.L16:
	cmpl	%r9d, %ebp
	jle	.L25
	movl	(%r15,%r9,4), %ecx
	movq	(%rsp), %rdi
	movl	$2, %esi
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rdx
	movq	%r9, 56(%rsp)
	call	__fprintf_chk@PLT
	movq	56(%rsp), %r9
	incq	%r9
	jmp	.L16
.L25:
	movl	32(%rsp), %ecx
	movq	(%rsp), %rdi
	movl	$2, %esi
	xorl	%eax, %eax
	leaq	.LC4(%rip), %rdx
	incl	%r14d
	call	__fprintf_chk@PLT
	jmp	.L17
.L24:
	incq	%rbx
	jmp	.L19
.L23:
	movl	12(%rsp), %ebx
	incl	%r13d
	addl	%ebx, 8(%rsp)
	addl	%ebp, %r12d
	jmp	.L14
.L18:
	movq	(%rsp), %rdi
	addq	$72, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	jmp	fclose@PLT
	.cfi_endproc
.LFE2028:
	.size	_Z15save_result_csvPcS_Piiii, .-_Z15save_result_csvPcS_Piiii
	.globl	_Z7bsearchiPiiii
	.type	_Z7bsearchiPiiii, @function
_Z7bsearchiPiiii:
.LFB2030:
	.cfi_startproc
	endbr64
.L29:
	cmpl	%ecx, %r8d
	jle	.L35
	movl	%r8d, %eax
	movl	%edi, %r10d
	subl	%ecx, %eax
	sarl	%eax
	addl	%ecx, %eax
	movl	%eax, %r9d
	imull	%edx, %r9d
	movslq	%r9d, %r9
	subl	48(%rsi,%r9,4), %r10d
	testl	%r10d, %r10d
	je	.L26
	jle	.L31
	leal	1(%rax), %ecx
	jmp	.L29
.L31:
	movl	%eax, %r8d
	jmp	.L29
.L35:
	orl	$-1, %eax
.L26:
	ret
	.cfi_endproc
.LFE2030:
	.size	_Z7bsearchiPiiii, .-_Z7bsearchiPiiii
	.globl	_Z19process_transactioniPiiiiS_iiS_iPci
	.type	_Z19process_transactioniPiiiiS_iiS_iPci, @function
_Z19process_transactioniPiiiiS_iiS_iPci:
.LFB2031:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	%edi, %r15d
	movslq	%ecx, %r11
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%r9, %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movl	%edi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movl	%r8d, %ebx
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movl	120(%rsp), %eax
	movl	%edx, 20(%rsp)
	imull	%eax, %r15d
	leal	(%rax,%r15), %edx
	movslq	%r15d, %rax
.L37:
	cmpl	%eax, %edx
	jle	.L64
	movq	112(%rsp), %rdi
	movb	$0, (%rdi,%rax)
	incq	%rax
	jmp	.L37
.L64:
	movslq	%ebx, %rax
	imull	88(%rsp), %ebp
	movl	%ebx, %r13d
	xorl	%r12d, %r12d
	salq	$2, %rax
	negl	%r13d
	movq	%rax, (%rsp)
	imulq	$-4, %r11, %rax
	movslq	%r13d, %r13
	salq	$2, %r13
	movq	%rax, 8(%rsp)
.L39:
	movl	%r12d, %eax
	cmpl	%r12d, 104(%rsp)
	jle	.L65
	xorl	%ecx, %ecx
	xorl	%edi, %edi
	movl	$2, %r8d
.L51:
	cmpl	88(%rsp), %ecx
	jge	.L66
	testb	$1, %al
	jne	.L40
	leal	(%rcx,%rbp), %edx
	movslq	%edx, %rdx
	addl	(%r14,%rdx,4), %edi
.L40:
	cltd
	incl	%ecx
	idivl	%r8d
	jmp	.L51
.L66:
	movq	96(%rsp), %rax
	movl	(%rax,%r12,4), %ecx
	movl	4(%rax,%r12,4), %r8d
	cmpl	%r8d, %ecx
	jne	.L42
.L43:
	incq	%r12
	jmp	.L39
.L42:
	movl	%ebx, %edx
	call	_Z7bsearchiPiiii
	cmpl	$-1, %eax
	je	.L43
	movslq	%eax, %rdx
	imull	%ebx, %eax
	movslq	%eax, %rcx
	subl	%ebx, %eax
	cltq
	addq	%r11, %rcx
	addq	%r11, %rax
	leaq	(%rsi,%rcx,4), %rcx
	leaq	(%rsi,%rax,4), %rax
.L45:
	testl	%edx, %edx
	jle	.L44
	movl	4(%rcx), %r9d
	movl	4(%rax), %r8d
	leaq	-1(%rdx), %r10
	addq	%r13, %rcx
	addq	%r13, %rax
	cmpl	%r8d, %r9d
	jne	.L44
	movq	%r10, %rdx
	jmp	.L45
.L44:
	movslq	%edx, %r9
	imull	%ebx, %edx
	movslq	%edx, %rdx
	addq	%r11, %rdx
	leaq	(%rsi,%rdx,4), %rdx
.L49:
	cmpl	%r9d, 20(%rsp)
	jle	.L43
	cmpl	%edi, 4(%rdx)
	jne	.L43
	movq	8(%rsp), %rax
	movl	$1, %r8d
	leaq	(%rdx,%rax), %r10
	xorl	%eax, %eax
.L50:
	cmpl	%eax, 88(%rsp)
	setg	%cl
	andb	%r8b, %cl
	je	.L67
	movl	(%r10,%rax,4), %r8d
	cmpl	$-1, %r8d
	je	.L46
	leal	0(%rbp,%rax), %ecx
	movslq	%ecx, %rcx
	cmpl	%r8d, (%r14,%rcx,4)
	sete	%cl
.L46:
	movzbl	%cl, %r8d
	incq	%rax
	jmp	.L50
.L67:
	testl	%r8d, %r8d
	je	.L48
	movl	-4(%rdx), %eax
	movq	112(%rsp), %rcx
	addl	%r15d, %eax
	cltq
	incb	(%rcx,%rax)
.L48:
	movq	(%rsp), %rax
	incq	%r9
	addq	%rax, %rdx
	jmp	.L49
.L65:
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2031:
	.size	_Z19process_transactioniPiiiiS_iiS_iPci, .-_Z19process_transactioniPiiiiS_iiS_iPci
	.section	.rodata.str1.1
.LC5:
	.string	"Loading transactions_%d\n"
.LC6:
	.string	"CPU: start_%d\n"
.LC8:
	.string	"CPU: end_%d : %f s\n"
	.text
	.globl	_Z14process_on_CPUPiiiiS_iiS_iPci
	.type	_Z14process_on_CPUPiiiiS_iiS_iPci, @function
_Z14process_on_CPUPiiiiS_iiS_iPci:
.LFB2032:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	start(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movl	%r9d, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	xorl	%ebx, %ebx
	subq	$72, %rsp
	.cfi_def_cfa_offset 128
	movl	%edx, 24(%rsp)
	movq	136(%rsp), %r14
	movabsq	$7146702845200199529, %rdx
	movq	%rdi, 8(%rsp)
	movq	152(%rsp), %r15
	movl	%esi, 20(%rsp)
	movl	%ecx, 28(%rsp)
	movq	%r8, (%rsp)
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	movabsq	$8386654079495008884, %rax
	movq	%rdx, 44(%rsp)
	movl	$30323, 52(%rsp)
	movq	%rax, 36(%rsp)
.L71:
	leal	48(%rbx), %eax
	movl	%ebx, %edx
	leaq	.LC5(%rip), %rsi
	xorl	%r12d, %r12d
	movb	%al, 49(%rsp)
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	(%rsp), %rdi
	leaq	36(%rsp), %rsi
	movl	%ebp, %edx
	movl	128(%rsp), %r8d
	movl	%r8d, %ecx
	call	_Z8load_csvPiPciii
	movl	%ebx, %edx
	leaq	.LC6(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	xorl	%esi, %esi
	movq	%r13, %rdi
	call	gettimeofday@PLT
.L69:
	cmpl	%ebp, %r12d
	jge	.L75
	movl	160(%rsp), %eax
	movl	%r12d, %edi
	incl	%r12d
	pushq	%rax
	.cfi_def_cfa_offset 136
	pushq	%r15
	.cfi_def_cfa_offset 144
	movl	160(%rsp), %eax
	pushq	%rax
	.cfi_def_cfa_offset 152
	pushq	%r14
	.cfi_def_cfa_offset 160
	movl	160(%rsp), %eax
	pushq	%rax
	.cfi_def_cfa_offset 168
	pushq	%rbp
	.cfi_def_cfa_offset 176
	movq	48(%rsp), %r9
	movl	76(%rsp), %r8d
	movl	72(%rsp), %ecx
	movl	68(%rsp), %edx
	movq	56(%rsp), %rsi
	call	_Z19process_transactioniPiiiiS_iiS_iPci
	addq	$48, %rsp
	.cfi_def_cfa_offset 128
	jmp	.L69
.L75:
	xorl	%esi, %esi
	leaq	end(%rip), %rdi
	call	gettimeofday@PLT
	movq	8+end(%rip), %rax
	movl	%ebx, %edx
	subq	8+start(%rip), %rax
	cvtsi2sdq	%rax, %xmm0
	movq	end(%rip), %rax
	subq	0(%r13), %rax
	divsd	.LC7(%rip), %xmm0
	cvtsi2sdq	%rax, %xmm1
	leaq	.LC8(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	addsd	%xmm1, %xmm0
	call	__printf_chk@PLT
	testl	%ebx, %ebx
	jne	.L76
	movl	$1, %ebx
	jmp	.L71
.L76:
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	je	.L72
	call	__stack_chk_fail@PLT
.L72:
	addq	$72, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2032:
	.size	_Z14process_on_CPUPiiiiS_iiS_iPci, .-_Z14process_on_CPUPiiiiS_iiS_iPci
	.section	.rodata.str1.1
.LC9:
	.string	"/home/ubuntu/Datasets/stackv2/train-structured/jakmak24/pcm_project/master/grandrule.cu"
.LC10:
	.string	"%s in %s at line %d\n"
	.text
	.globl	_Z10cudaAsserti9cudaError
	.type	_Z10cudaAsserti9cudaError, @function
_Z10cudaAsserti9cudaError:
.LFB2033:
	.cfi_startproc
	endbr64
	testl	%esi, %esi
	je	.L77
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	movl	%edi, %r8d
	movl	%esi, %edi
	movl	%r8d, 12(%rsp)
	call	cudaGetErrorString@PLT
	movl	12(%rsp), %r8d
	movl	$2, %edi
	leaq	.LC9(%rip), %rcx
	movq	%rax, %rdx
	leaq	.LC10(%rip), %rsi
	xorl	%eax, %eax
	addq	$24, %rsp
	.cfi_def_cfa_offset 8
	jmp	__printf_chk@PLT
.L77:
	ret
	.cfi_endproc
.LFE2033:
	.size	_Z10cudaAsserti9cudaError, .-_Z10cudaAsserti9cudaError
	.globl	_Z54__device_stub__Z20process_batch_kerneliPiiiiS_iiS_iPciiPiiiiS_iiS_iPci
	.type	_Z54__device_stub__Z20process_batch_kerneliPiiiiS_iiS_iPciiPiiiiS_iiS_iPci, @function
_Z54__device_stub__Z20process_batch_kerneliPiiiiS_iiS_iPciiPiiiiS_iiS_iPci:
.LFB2060:
	.cfi_startproc
	endbr64
	subq	$232, %rsp
	.cfi_def_cfa_offset 240
	movq	256(%rsp), %rax
	movl	%edi, 44(%rsp)
	leaq	72(%rsp), %rdi
	movq	%rsi, 32(%rsp)
	leaq	84(%rsp), %rsi
	movq	%rax, 8(%rsp)
	movq	272(%rsp), %rax
	movl	%edx, 40(%rsp)
	leaq	56(%rsp), %rdx
	movl	%ecx, 28(%rsp)
	leaq	64(%rsp), %rcx
	movl	%r8d, 24(%rsp)
	movq	%r9, 16(%rsp)
	movq	%rax, (%rsp)
	movq	%fs:40, %rax
	movq	%rax, 216(%rsp)
	xorl	%eax, %eax
	leaq	44(%rsp), %rax
	movl	$1, 80(%rsp)
	movq	%rax, 120(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 128(%rsp)
	leaq	40(%rsp), %rax
	movq	%rax, 136(%rsp)
	leaq	28(%rsp), %rax
	movq	%rax, 144(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 152(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 160(%rsp)
	leaq	240(%rsp), %rax
	movq	%rax, 168(%rsp)
	leaq	248(%rsp), %rax
	movq	%rax, 176(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 184(%rsp)
	leaq	264(%rsp), %rax
	movq	%rax, 192(%rsp)
	movq	%rsp, %rax
	movq	%rax, 200(%rsp)
	leaq	280(%rsp), %rax
	movq	%rax, 208(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 72(%rsp)
	movq	%rax, 84(%rsp)
	movl	$1, 92(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L82
	pushq	64(%rsp)
	.cfi_def_cfa_offset 248
	leaq	_Z20process_batch_kerneliPiiiiS_iiS_iPci(%rip), %rdi
	pushq	64(%rsp)
	.cfi_def_cfa_offset 256
	movq	100(%rsp), %rcx
	movl	108(%rsp), %r8d
	movq	88(%rsp), %rsi
	movl	96(%rsp), %edx
	leaq	136(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 248
	popq	%rdx
	.cfi_def_cfa_offset 240
.L82:
	movq	216(%rsp), %rax
	subq	%fs:40, %rax
	je	.L84
	call	__stack_chk_fail@PLT
.L84:
	addq	$232, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2060:
	.size	_Z54__device_stub__Z20process_batch_kerneliPiiiiS_iiS_iPciiPiiiiS_iiS_iPci, .-_Z54__device_stub__Z20process_batch_kerneliPiiiiS_iiS_iPciiPiiiiS_iiS_iPci
	.globl	_Z20process_batch_kerneliPiiiiS_iiS_iPci
	.type	_Z20process_batch_kerneliPiiiiS_iiS_iPci, @function
_Z20process_batch_kerneliPiiiiS_iiS_iPci:
.LFB2061:
	.cfi_startproc
	endbr64
	jmp	_Z54__device_stub__Z20process_batch_kerneliPiiiiS_iiS_iPciiPiiiiS_iiS_iPci
	.cfi_endproc
.LFE2061:
	.size	_Z20process_batch_kerneliPiiiiS_iiS_iPci, .-_Z20process_batch_kerneliPiiiiS_iiS_iPci
	.section	.rodata.str1.1
.LC11:
	.string	"GPU: start_%d\n"
.LC12:
	.string	"GPU: end_%d : %f s\n"
	.text
	.globl	_Z14process_on_GPUPiiiiS_iiS_iPci
	.type	_Z14process_on_GPUPiiiiS_iiS_iPci, @function
_Z14process_on_GPUPiiiiS_iiS_iPci:
.LFB2034:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movl	%esi, %r14d
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%rdi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movl	%r9d, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$152, %rsp
	.cfi_def_cfa_offset 208
	movq	232(%rsp), %rax
	movq	%r8, 24(%rsp)
	leaq	64(%rsp), %rdi
	movl	%ecx, 20(%rsp)
	movl	$4096, %ecx
	movq	216(%rsp), %r13
	movl	%esi, 16(%rsp)
	movl	%edx, 36(%rsp)
	movq	%rax, 40(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leal	4095(%r9), %eax
	cltd
	idivl	%ecx
	movl	%eax, 32(%rsp)
	movl	20(%rsp), %eax
	imull	%eax, %r14d
	movslq	%r14d, %r14
	salq	$2, %r14
	movq	%r14, %rsi
	call	cudaMalloc@PLT
	movl	$167, %edi
	movl	%eax, %esi
	call	_Z10cudaAsserti9cudaError
	movl	224(%rsp), %eax
	leaq	72(%rsp), %rdi
	leal	1(%rax), %ebx
	movslq	%ebx, %rbx
	salq	$2, %rbx
	movq	%rbx, %rsi
	call	cudaMalloc@PLT
	movl	$168, %edi
	movl	%eax, %esi
	call	_Z10cudaAsserti9cudaError
	movq	64(%rsp), %rdi
	movq	%r14, %rdx
	movq	%r12, %rsi
	movl	$1, %ecx
	call	cudaMemcpy@PLT
	movl	$169, %edi
	movl	%eax, %esi
	call	_Z10cudaAsserti9cudaError
	movq	72(%rsp), %rdi
	movq	%rbx, %rdx
	movq	%r13, %rsi
	movl	$1, %ecx
	xorl	%ebx, %ebx
	call	cudaMemcpy@PLT
	movl	$170, %edi
	movl	%eax, %esi
	call	_Z10cudaAsserti9cudaError
	movl	240(%rsp), %eax
	leaq	80(%rsp), %rdi
	sall	$12, %eax
	cltq
	movq	%rax, %rsi
	movq	%rax, (%rsp)
	call	cudaMalloc@PLT
	movl	$172, %edi
	movl	%eax, %esi
	call	_Z10cudaAsserti9cudaError
	movl	208(%rsp), %eax
	leaq	56(%rsp), %rdi
	sall	$12, %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rsi
	movq	%rax, 8(%rsp)
	call	cudaMalloc@PLT
	movl	$173, %edi
	movl	%eax, %esi
	call	_Z10cudaAsserti9cudaError
	movabsq	$8386654079495008884, %rax
	movabsq	$7146702845200199529, %rdx
	movl	$30323, 132(%rsp)
	movq	%rax, 116(%rsp)
	movq	%rdx, 124(%rsp)
.L92:
	leal	48(%rbx), %eax
	movl	%ebx, %edx
	leaq	.LC5(%rip), %rsi
	xorl	%r13d, %r13d
	movb	%al, 129(%rsp)
	movl	$2, %edi
	xorl	%eax, %eax
	movl	$4096, %r12d
	call	__printf_chk@PLT
	movl	208(%rsp), %r8d
	movq	24(%rsp), %rdi
	movl	%ebp, %edx
	leaq	116(%rsp), %rsi
	movl	%r8d, %ecx
	call	_Z8load_csvPiPciii
	movl	%ebx, %edx
	leaq	.LC11(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	xorl	%esi, %esi
	leaq	start(%rip), %rdi
	call	gettimeofday@PLT
	movq	40(%rsp), %r14
	movq	24(%rsp), %r15
.L88:
	movl	32(%rsp), %eax
	cmpl	%eax, %r13d
	jge	.L96
	movl	32(%rsp), %eax
	decl	%eax
	cmpl	%r13d, %eax
	jne	.L89
	imull	$-4096, %r13d, %r12d
	addl	%ebp, %r12d
.L89:
	movl	208(%rsp), %edx
	movq	56(%rsp), %rdi
	movl	$1, %ecx
	movq	%r15, %rsi
	imull	%r12d, %edx
	movslq	%edx, %rdx
	salq	$2, %rdx
	call	cudaMemcpy@PLT
	movl	$193, %edi
	movl	%eax, %esi
	call	_Z10cudaAsserti9cudaError
	movl	$16777217, %edx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	$268435457, %edi
	salq	$8, %rdx
	movl	$1, %ecx
	movl	$1, %esi
	salq	$4, %rdi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L90
	movl	240(%rsp), %eax
	movl	%r12d, %edi
	pushq	%rax
	.cfi_def_cfa_offset 216
	pushq	88(%rsp)
	.cfi_def_cfa_offset 224
	movl	240(%rsp), %eax
	pushq	%rax
	.cfi_def_cfa_offset 232
	pushq	96(%rsp)
	.cfi_def_cfa_offset 240
	movl	240(%rsp), %eax
	pushq	%rax
	.cfi_def_cfa_offset 248
	pushq	%rbp
	.cfi_def_cfa_offset 256
	movq	104(%rsp), %r9
	movl	68(%rsp), %r8d
	movl	84(%rsp), %ecx
	movl	64(%rsp), %edx
	movq	112(%rsp), %rsi
	call	_Z54__device_stub__Z20process_batch_kerneliPiiiiS_iiS_iPciiPiiiiS_iiS_iPci
	addq	$48, %rsp
	.cfi_def_cfa_offset 208
.L90:
	call	cudaThreadSynchronize@PLT
	movl	$196, %edi
	incl	%r13d
	movl	%eax, %esi
	call	_Z10cudaAsserti9cudaError
	movl	240(%rsp), %edx
	movq	80(%rsp), %rsi
	movq	%r14, %rdi
	movl	$2, %ecx
	imull	%r12d, %edx
	movslq	%edx, %rdx
	call	cudaMemcpy@PLT
	movl	$198, %edi
	movl	%eax, %esi
	call	_Z10cudaAsserti9cudaError
	movq	(%rsp), %rax
	addq	%rax, %r14
	movq	8(%rsp), %rax
	addq	%rax, %r15
	jmp	.L88
.L96:
	xorl	%esi, %esi
	leaq	end(%rip), %rdi
	call	gettimeofday@PLT
	movq	8+end(%rip), %rax
	movl	%ebx, %edx
	subq	8+start(%rip), %rax
	leaq	start(%rip), %rcx
	leaq	.LC12(%rip), %rsi
	movl	$2, %edi
	cvtsi2sdq	%rax, %xmm0
	movq	end(%rip), %rax
	subq	(%rcx), %rax
	divsd	.LC7(%rip), %xmm0
	cvtsi2sdq	%rax, %xmm1
	movb	$1, %al
	addsd	%xmm1, %xmm0
	call	__printf_chk@PLT
	testl	%ebx, %ebx
	jne	.L97
	movl	$1, %ebx
	jmp	.L92
.L97:
	movq	56(%rsp), %rdi
	call	cudaFree@PLT
	movl	$216, %edi
	movl	%eax, %esi
	call	_Z10cudaAsserti9cudaError
	movq	64(%rsp), %rdi
	call	cudaFree@PLT
	movl	$217, %edi
	movl	%eax, %esi
	call	_Z10cudaAsserti9cudaError
	movq	72(%rsp), %rdi
	call	cudaFree@PLT
	movl	$218, %edi
	movl	%eax, %esi
	call	_Z10cudaAsserti9cudaError
	movq	80(%rsp), %rdi
	call	cudaFree@PLT
	movl	$219, %edi
	movl	%eax, %esi
	call	_Z10cudaAsserti9cudaError
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L93
	call	__stack_chk_fail@PLT
.L93:
	addq	$152, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2034:
	.size	_Z14process_on_GPUPiiiiS_iiS_iPci, .-_Z14process_on_GPUPiiiiS_iiS_iPci
	.section	.rodata.str1.1
.LC13:
	.string	"Loading rules\n"
.LC14:
	.string	"rule_2M.csv"
.LC15:
	.string	"Sorting rules\n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2035:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC13(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	call	__printf_chk@PLT
	movl	$4, %esi
	movl	$26000000, %edi
	call	calloc@PLT
	movl	$13, %r8d
	movl	$11, %ecx
	movl	$2000000, %edx
	movq	%rax, %rdi
	leaq	.LC14(%rip), %rsi
	movq	%rax, %rbx
	call	_Z8load_csvPiPciii
	movl	$4, %esi
	movl	$10000000, %edi
	call	calloc@PLT
	movl	$100000000, %edi
	movl	$1, %esi
	movq	%rax, %rbp
	call	calloc@PLT
	xorl	%edi, %edi
	movl	$1, %r9d
	movq	%rax, %r12
	movq	%rbx, %rax
.L99:
	xorl	%ecx, %ecx
	xorl	%esi, %esi
	xorl	%edx, %edx
.L102:
	movl	(%rax,%rcx,4), %r8d
	cmpl	$-1, %r8d
	jne	.L100
	movl	%r9d, %r8d
	sall	%cl, %r8d
	orl	%r8d, %edx
	jmp	.L101
.L100:
	addl	%r8d, %esi
.L101:
	incq	%rcx
	cmpq	$10, %rcx
	jne	.L102
	addl	$13, %edi
	movl	%edx, 44(%rax)
	addq	$52, %rax
	movl	%esi, -4(%rax)
	cmpl	$26000000, %edi
	jne	.L99
	leaq	.LC15(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	leaq	_Z7cmpfuncPKvS0_(%rip), %rcx
	movl	$52, %edx
	movq	%rbx, %rdi
	movl	$2000000, %esi
	call	qsort@PLT
	movl	$4, %esi
	movl	$1025, %edi
	call	calloc@PLT
	movl	44(%rbx), %ecx
	movl	$1, %esi
.L110:
	imulq	$52, %rsi, %rdx
	movl	44(%rbx,%rdx), %edx
	cmpl	%ecx, %edx
	jne	.L104
.L109:
	cmpq	$1999999, %rsi
	je	.L119
	incq	%rsi
	movl	%edx, %ecx
	jmp	.L110
.L104:
	incl	%ecx
	movl	%esi, %edi
	movslq	%ecx, %rcx
.L107:
	cmpl	%ecx, %edx
	jl	.L109
	movl	%edi, (%rax,%rcx,4)
	incq	%rcx
	jmp	.L107
.L119:
	incl	%edx
	movslq	%edx, %rdx
.L111:
	cmpl	$1024, %edx
	jg	.L120
	movl	$2000000, (%rax,%rdx,4)
	incq	%rdx
	jmp	.L111
.L120:
	pushq	%rdx
	.cfi_def_cfa_offset 40
	movq	%rbp, %r8
	movq	%rbx, %rdi
	movl	$1000000, %r9d
	pushq	$100
	.cfi_def_cfa_offset 48
	movl	$13, %ecx
	movl	$11, %edx
	movl	$2000000, %esi
	pushq	%r12
	.cfi_def_cfa_offset 56
	pushq	$1024
	.cfi_def_cfa_offset 64
	pushq	%rax
	.cfi_def_cfa_offset 72
	pushq	$10
	.cfi_def_cfa_offset 80
	call	_Z14process_on_GPUPiiiiS_iiS_iPci
	addq	$48, %rsp
	.cfi_def_cfa_offset 32
	xorl	%eax, %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
.LFE2035:
	.size	main, .-main
	.section	.rodata.str1.1
.LC16:
	.string	"_Z20process_batch_kerneliPiiiiS_iiS_iPci"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2063:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 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	.LC16(%rip), %rdx
	movq	%rax, %rdi
	leaq	_Z20process_batch_kerneliPiiiiS_iiS_iPci(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	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	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE2063:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.globl	end
	.bss
	.align 16
	.type	end, @object
	.size	end, 16
end:
	.zero	16
	.globl	start
	.align 16
	.type	start, @object
	.size	start, 16
start:
	.zero	16
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC7:
	.long	0
	.long	1093567616
	.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>
#include <stdlib.h>
#include <sys/time.h>

#define STAR -1
struct timeval start, end;

void load_csv(int*data, char *csv_file, int rows, int cols, int cols_t){
    FILE* file = fopen(csv_file, "r");
    for (int row = 0; row < rows; row++) {
        for (int col = 0; col < cols; col++) {
            if(!fscanf(file, "%d;", &data[row*cols_t + col])) {
                fscanf(file, "%*c;");
                data[row*cols_t + col] = STAR;
            }
        }
    }
    fclose(file);
}

void save_result_csv(char *csv_file, char* result, int*data, int rows, int cols_result, int cols_data){
    FILE* file = fopen(csv_file, "w");
    for (int row = 0; row < rows; row++) {
        for (int result_col =0 ; result_col<cols_result;result_col++){
            for(int i=0;i<result[row*cols_result + result_col];i++){
                for(int j=0;j<cols_data;j++){
                    fprintf(file,"%d;",data[row*cols_data+j]);
                }
                fprintf(file,"%d\n",result_col);
            }
            
        }
        
    }
    fclose(file);
}

int cmpfunc (const void * a, const void * b) {
	const int *r1 = (const int*)a;
	const int *r2 = (const int*)b;
    int mask_index = 11;
    int mask_diff = (*(r1+mask_index)) - (*(r2+mask_index));
    if (mask_diff) {
        return mask_diff;
    }
    return (*(r1+mask_index + 1)) - (*(r2+mask_index+1));
}

__host__ __device__ 
int bsearch(int key, int *rules,int rule_t_size,int start,int end){

    int pivot,result;

	while (end > start) {
		pivot =  start + ((end-start)>>1);
		result = key - rules[pivot*rule_t_size + 12];

		if (result == 0)
			return pivot;

		if (result > 0) {
			start = pivot + 1;
		}else{
            end = pivot;
        }
	}
	return -1;
}

__host__ __device__
void process_transaction(int tr,int *rules, int rules_count ,int rule_size,int rule_t_size, int *data,int tr_count,int tr_size,int* mask_indexes, int MAX_MASK, char* result,int result_size){
    
    for (int i=tr*result_size;i<(tr+1)*result_size;i++){
        result[i]=0;
    }
    
    for (int mask = 0; mask < MAX_MASK ; mask++) {
        int tmp_mask = mask;
        int hash = 0;
        for (int i = 0; i <tr_size; i++) {
            if (tmp_mask % 2 == 0) {
                hash += data[tr*tr_size + i];
            }
            tmp_mask /= 2;
        }
        int index_start = mask_indexes[mask];
        int index_end = mask_indexes[mask + 1];

        if (index_start != index_end) {

            int found = bsearch(hash, rules, rule_t_size, index_start,index_end);
            if (found != -1) {
                
                while (found > 0 && (rules[found*rule_t_size + rule_size+1] == rules[(found-1)*rule_t_size + rule_size+1])) {
                    found--;
                }
                while (found < rules_count && rules[found*rule_t_size +rule_size+1] == hash) {
                    int ok = 1;
                    for (int i = 0; ok && i < tr_size; i++) {
                        ok = (rules[found*rule_t_size +i] == STAR || (rules[found*rule_t_size +i] == data[tr*tr_size + i]));
                    }
                    if (ok) {
                       result[tr*result_size + rules[found*rule_t_size + rule_size -1]]+=1;
                    }
                    found++;
                }
            }
        }
    }
    
    
}

void process_on_CPU(int *rules, int rules_count ,int rule_size,int rule_t_size, int *data,int tr_count,int tr_size,int* mask_indexes, int MAX_MASK, char* result, int result_size){
    
    char transactions_file[20] = "transactions_0.csv";
    char out_file[20] = "out_0.csv";

    for(int i =0;i<2;i++){
        transactions_file[13] = '0'+i;
        out_file[4] = '0'+i;
        printf("Loading transactions_%d\n",i);
        load_csv(data,transactions_file, tr_count, tr_size, tr_size);
        
        printf("CPU: start_%d\n",i);
        gettimeofday(&start, NULL);
        
        #pragma omp parallel for
        for (int tr = 0; tr < tr_count; tr++) {
          process_transaction(tr,rules,rules_count,rule_size,rule_t_size,data,tr_count,tr_size,mask_indexes,MAX_MASK,result,result_size);
        }
        
        gettimeofday(&end, NULL);
        printf("CPU: end_%d : %f s\n",i,(end.tv_sec  - start.tv_sec)+ (end.tv_usec - start.tv_usec) / 1.e6);
        
        //save_result_csv(out_file,result,data,tr_count,result_size,tr_size);
    }
}


__global__
void process_batch_kernel(int curr_batch_size,int *rules, int rules_count ,int rule_size,int rule_t_size, int *data,int tr_count,int tr_size,int* mask_indexes, int MAX_MASK, char*result,int result_size){
    
    int tr = blockIdx.x*blockDim.x + threadIdx.x;
    if(tr >= curr_batch_size)return;
    
    process_transaction(tr,rules,rules_count,rule_size,rule_t_size,data,tr_count,tr_size,mask_indexes,MAX_MASK,result,result_size);
    
}

void cudaAssert(int line,hipError_t err){
    if(err!=hipSuccess){printf("%s in %s at line %d\n",hipGetErrorString(err),__FILE__,line);}
}

void process_on_GPU(int *rules, int rules_count ,int rule_size,int rule_t_size, int *data,int tr_count,int tr_size,int* mask_indexes, int MAX_MASK,char *result,int result_size){
    
    int* data_g;
    int* rules_g;
    int* mask_indexes_g;
    char* result_g;
    
    int BLOCK_SIZE =256;
    int BLOCK_DIM = 16;
    int batch_size = BLOCK_SIZE*BLOCK_DIM;
    int batch_count = (tr_count+batch_size-1)/batch_size; //divide and round up;
    
    cudaAssert(__LINE__,hipMalloc((void **)&rules_g, rules_count*rule_t_size*sizeof(int)));
    cudaAssert(__LINE__,hipMalloc((void **)&mask_indexes_g, (MAX_MASK+1)*sizeof(int)));
    cudaAssert(__LINE__,hipMemcpy(rules_g, rules, rules_count*rule_t_size*sizeof(int), hipMemcpyHostToDevice));
    cudaAssert(__LINE__,hipMemcpy(mask_indexes_g, mask_indexes, (MAX_MASK+1)*sizeof(int), hipMemcpyHostToDevice));
    
    cudaAssert(__LINE__,hipMalloc((void **)&result_g, batch_size*result_size*sizeof(char)));
    cudaAssert(__LINE__,hipMalloc((void **)&data_g, batch_size*tr_size*sizeof(int)));
    
    char transactions_file[20] = "transactions_0.csv";
    char out_file[20] = "out_0.csv";

    for(int i =0;i<2;i++){
        transactions_file[13] = '0'+i;
        out_file[4] = '0'+i;
        printf("Loading transactions_%d\n",i);
        load_csv(data,transactions_file, tr_count, tr_size, tr_size);
    
        printf("GPU: start_%d\n",i);
        gettimeofday(&start, NULL);
        
        int curr_batch_size = batch_size;
        for (int batch_nr=0;batch_nr<batch_count;batch_nr++){
            
            if(batch_nr==batch_count-1){
                curr_batch_size = tr_count - batch_nr*batch_size;
            }
            cudaAssert(__LINE__,hipMemcpy(data_g, data+batch_nr*batch_size*tr_size , curr_batch_size*tr_size*sizeof(int), hipMemcpyHostToDevice));

            process_batch_kernel<<<BLOCK_DIM,BLOCK_SIZE>>>(curr_batch_size,rules_g,rules_count ,rule_size,rule_t_size,data_g,tr_count,tr_size,mask_indexes_g,MAX_MASK,result_g,result_size);
            cudaAssert(__LINE__,hipDeviceSynchronize());
            
            cudaAssert(__LINE__,hipMemcpy(result+batch_nr*batch_size*result_size, result_g , curr_batch_size*result_size*sizeof(char), hipMemcpyDeviceToHost));
            
        }

        gettimeofday(&end, NULL);
        printf("GPU: end_%d : %f s\n",i,(end.tv_sec  - start.tv_sec)+ (end.tv_usec - start.tv_usec) / 1.e6);
        
        // for(int i=0;i<tr_count;i++){
           // printf("%d:",i);
           // for(int j=0;j<result_size;j++){
               // printf("%d",result[i*result_size + j]);
           // }
           // printf("\n");
        // }
        
        //save_result_csv(out_file,result,data,tr_count,result_size,tr_size);
    }
    
    cudaAssert(__LINE__,hipFree(data_g));
    cudaAssert(__LINE__,hipFree(rules_g));
    cudaAssert(__LINE__,hipFree(mask_indexes_g));
    cudaAssert(__LINE__,hipFree(result_g));

    
}


int main(){
    char *rules_file = (char *)"rule_2M.csv";
    int rules_count = 2000000;
    int rule_size = 11;
    int rule_t_size = rule_size+2;
    int tr_count = 1000000;
    int tr_size = rule_size - 1;
    
    const int MAX_MASK = (1<<tr_size);

	printf("Loading rules\n");
    int *rules = (int*)calloc(rules_count*(rule_t_size),sizeof(int));
    load_csv(rules,rules_file, rules_count, rule_size, rule_t_size);

    	
    int *data = (int*)calloc(tr_count*(tr_size),sizeof(int));
    
    int result_size = 100;
    char *result = (char*)calloc(tr_count*(result_size),sizeof(char));
    
    for (int i = 0; i < rules_count; i++) {
        int mask = 0;
        int hash = 0;
        for (int col = 0; col <tr_size ; col++) {
            if (rules[i*rule_t_size + col] == STAR) {
                mask |= 1 << (col);
            } else {
                hash += rules[i*rule_t_size + col];
            }
        }
        rules[i*rule_t_size + rule_size] = mask;
        rules[i*rule_t_size + rule_size + 1] = hash;
    }
    
	printf("Sorting rules\n");
	qsort(rules, rules_count, sizeof(int)*rule_t_size, cmpfunc);
    
    int *mask_indexes = (int*)calloc(MAX_MASK + 1,sizeof(int));
    
    int cur_mask = rules[0 + rule_size];
    for (int i = 1; i < rules_count; i++) {
        if (cur_mask != rules[i*rule_t_size + rule_size]) {
            for (int j = cur_mask + 1; j <= rules[i*rule_t_size + rule_size]; j++) {
                mask_indexes[j] = i;
            }
            cur_mask = rules[i*rule_t_size + rule_size];
        }
        
        if( i==(rules_count-1)){
            for(int j= cur_mask+1;j<MAX_MASK+1;j++){
                mask_indexes[j]=rules_count;
            }
        }
    }
    
    //process_on_CPU(rules,rules_count ,rule_size,rule_t_size,data,tr_count,tr_size,mask_indexes,MAX_MASK,result,result_size);
    process_on_GPU(rules,rules_count,rule_size,rule_t_size,data,tr_count,tr_size,mask_indexes,MAX_MASK,result,result_size);
	
    return 0;
}

	.text
	.file	"grandrule.hip"
	.globl	_Z8load_csvPiPciii              # -- Begin function _Z8load_csvPiPciii
	.type	_Z8load_csvPiPciii,@function
_Z8load_csvPiPciii:                     # @_Z8load_csvPiPciii
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	%r8d, %ebp
	movl	%ecx, 4(%rsp)                   # 4-byte Spill
	movl	%edx, %r12d
	movq	%rsi, %rax
	movq	%rdi, %r14
	movl	$.L.str, %esi
	movq	%rax, %rdi
	callq	fopen
	movq	%rax, %r15
	testl	%r12d, %r12d
	jle	.LBB0_4
# %bb.1:                                # %.preheader.lr.ph
	movslq	%ebp, %r13
	movl	%r12d, %eax
	movq	%rax, 16(%rsp)                  # 8-byte Spill
	movl	4(%rsp), %eax                   # 4-byte Reload
	movq	%rax, 8(%rsp)                   # 8-byte Spill
	shlq	$2, %r13
	xorl	%ebp, %ebp
.LBB0_2:                                # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB0_5 Depth 2
	movq	8(%rsp), %rbx                   # 8-byte Reload
	movq	%r14, %r12
	cmpl	$0, 4(%rsp)                     # 4-byte Folded Reload
	jle	.LBB0_3
.LBB0_5:                                #   Parent Loop BB0_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movl	$.L.str.1, %esi
	movq	%r15, %rdi
	movq	%r12, %rdx
	xorl	%eax, %eax
	callq	__isoc23_fscanf
	testl	%eax, %eax
	jne	.LBB0_7
# %bb.6:                                #   in Loop: Header=BB0_5 Depth=2
	movl	$.L.str.2, %esi
	movq	%r15, %rdi
	xorl	%eax, %eax
	callq	__isoc23_fscanf
	movl	$-1, (%r12)
.LBB0_7:                                #   in Loop: Header=BB0_5 Depth=2
	addq	$4, %r12
	decq	%rbx
	jne	.LBB0_5
.LBB0_3:                                # %._crit_edge
                                        #   in Loop: Header=BB0_2 Depth=1
	incq	%rbp
	addq	%r13, %r14
	cmpq	16(%rsp), %rbp                  # 8-byte Folded Reload
	jne	.LBB0_2
.LBB0_4:                                # %._crit_edge20
	movq	%r15, %rdi
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	jmp	fclose                          # TAILCALL
.Lfunc_end0:
	.size	_Z8load_csvPiPciii, .Lfunc_end0-_Z8load_csvPiPciii
	.cfi_endproc
                                        # -- End function
	.globl	_Z15save_result_csvPcS_Piiii    # -- Begin function _Z15save_result_csvPcS_Piiii
	.type	_Z15save_result_csvPcS_Piiii,@function
_Z15save_result_csvPcS_Piiii:           # @_Z15save_result_csvPcS_Piiii
	.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	$72, %rsp
	.cfi_def_cfa_offset 128
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	%r9d, 20(%rsp)                  # 4-byte Spill
	movl	%r8d, 12(%rsp)                  # 4-byte Spill
	movl	%ecx, %r13d
	movq	%rdx, 48(%rsp)                  # 8-byte Spill
	movq	%rsi, 40(%rsp)                  # 8-byte Spill
	movl	$.L.str.3, %esi
	callq	fopen
	movq	%rax, %r12
	testl	%r13d, %r13d
	jle	.LBB1_12
# %bb.1:                                # %.preheader29.lr.ph
	movl	%r13d, %eax
	movq	%rax, 56(%rsp)                  # 8-byte Spill
	movl	12(%rsp), %eax                  # 4-byte Reload
	movq	%rax, 64(%rsp)                  # 8-byte Spill
	movl	20(%rsp), %r14d                 # 4-byte Reload
	movl	$0, 16(%rsp)                    # 4-byte Folded Spill
	xorl	%eax, %eax
	movq	%rax, 24(%rsp)                  # 8-byte Spill
.LBB1_2:                                # %.preheader29
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_4 Depth 2
                                        #       Child Loop BB1_6 Depth 3
                                        #         Child Loop BB1_8 Depth 4
	cmpl	$0, 12(%rsp)                    # 4-byte Folded Reload
	jle	.LBB1_11
# %bb.3:                                # %.preheader28.lr.ph
                                        #   in Loop: Header=BB1_2 Depth=1
	movl	16(%rsp), %eax                  # 4-byte Reload
	movq	48(%rsp), %rcx                  # 8-byte Reload
	leaq	(%rcx,%rax,4), %rbp
	movq	24(%rsp), %rax                  # 8-byte Reload
                                        # kill: def $eax killed $eax killed $rax def $rax
	imull	12(%rsp), %eax                  # 4-byte Folded Reload
	addq	40(%rsp), %rax                  # 8-byte Folded Reload
	movq	%rax, 32(%rsp)                  # 8-byte Spill
	xorl	%r13d, %r13d
.LBB1_4:                                # %.preheader28
                                        #   Parent Loop BB1_2 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB1_6 Depth 3
                                        #         Child Loop BB1_8 Depth 4
	movq	32(%rsp), %rax                  # 8-byte Reload
	cmpb	$0, (%rax,%r13)
	jle	.LBB1_10
# %bb.5:                                # %.preheader.preheader
                                        #   in Loop: Header=BB1_4 Depth=2
	xorl	%ebx, %ebx
.LBB1_6:                                # %.preheader
                                        #   Parent Loop BB1_2 Depth=1
                                        #     Parent Loop BB1_4 Depth=2
                                        # =>    This Loop Header: Depth=3
                                        #         Child Loop BB1_8 Depth 4
	cmpl	$0, 20(%rsp)                    # 4-byte Folded Reload
	jle	.LBB1_9
# %bb.7:                                # %.lr.ph.preheader
                                        #   in Loop: Header=BB1_6 Depth=3
	xorl	%r15d, %r15d
.LBB1_8:                                # %.lr.ph
                                        #   Parent Loop BB1_2 Depth=1
                                        #     Parent Loop BB1_4 Depth=2
                                        #       Parent Loop BB1_6 Depth=3
                                        # =>      This Inner Loop Header: Depth=4
	movl	(%rbp,%r15,4), %edx
	movl	$.L.str.1, %esi
	movq	%r12, %rdi
	xorl	%eax, %eax
	callq	fprintf
	incq	%r15
	cmpq	%r15, %r14
	jne	.LBB1_8
.LBB1_9:                                # %._crit_edge
                                        #   in Loop: Header=BB1_6 Depth=3
	movl	$.L.str.4, %esi
	movq	%r12, %rdi
	movl	%r13d, %edx
	xorl	%eax, %eax
	callq	fprintf
	incl	%ebx
	movq	32(%rsp), %rax                  # 8-byte Reload
	movsbl	(%rax,%r13), %eax
	cmpl	%eax, %ebx
	jl	.LBB1_6
.LBB1_10:                               # %._crit_edge32
                                        #   in Loop: Header=BB1_4 Depth=2
	incq	%r13
	cmpq	64(%rsp), %r13                  # 8-byte Folded Reload
	jne	.LBB1_4
.LBB1_11:                               # %._crit_edge34
                                        #   in Loop: Header=BB1_2 Depth=1
	movq	24(%rsp), %rcx                  # 8-byte Reload
	incq	%rcx
	movl	16(%rsp), %eax                  # 4-byte Reload
	addl	20(%rsp), %eax                  # 4-byte Folded Reload
	movl	%eax, 16(%rsp)                  # 4-byte Spill
	movq	%rcx, %rax
	movq	%rcx, 24(%rsp)                  # 8-byte Spill
	cmpq	56(%rsp), %rcx                  # 8-byte Folded Reload
	jne	.LBB1_2
.LBB1_12:                               # %._crit_edge36
	movq	%r12, %rdi
	addq	$72, %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
	jmp	fclose                          # TAILCALL
.Lfunc_end1:
	.size	_Z15save_result_csvPcS_Piiii, .Lfunc_end1-_Z15save_result_csvPcS_Piiii
	.cfi_endproc
                                        # -- End function
	.globl	_Z7cmpfuncPKvS0_                # -- Begin function _Z7cmpfuncPKvS0_
	.type	_Z7cmpfuncPKvS0_,@function
_Z7cmpfuncPKvS0_:                       # @_Z7cmpfuncPKvS0_
	.cfi_startproc
# %bb.0:
	movl	44(%rdi), %eax
	subl	44(%rsi), %eax
	je	.LBB2_1
# %bb.2:
	retq
.LBB2_1:
	movl	48(%rdi), %eax
	subl	48(%rsi), %eax
	retq
.Lfunc_end2:
	.size	_Z7cmpfuncPKvS0_, .Lfunc_end2-_Z7cmpfuncPKvS0_
	.cfi_endproc
                                        # -- End function
	.globl	_Z7bsearchiPiiii                # -- Begin function _Z7bsearchiPiiii
	.type	_Z7bsearchiPiiii,@function
_Z7bsearchiPiiii:                       # @_Z7bsearchiPiiii
	.cfi_startproc
# %bb.0:
	movl	$-1, %eax
.LBB3_1:                                # =>This Inner Loop Header: Depth=1
	cmpl	%ecx, %r8d
	jle	.LBB3_4
# %bb.2:                                # %.lr.ph
                                        #   in Loop: Header=BB3_1 Depth=1
	movl	%r8d, %r9d
	subl	%ecx, %r9d
	sarl	%r9d
	addl	%ecx, %r9d
	movl	%r9d, %r10d
	imull	%edx, %r10d
	movslq	%r10d, %r10
	movl	48(%rsi,%r10,4), %r10d
	cmpl	%edi, %r10d
	je	.LBB3_3
# %bb.5:                                #   in Loop: Header=BB3_1 Depth=1
	jl	.LBB3_6
# %bb.7:                                #   in Loop: Header=BB3_1 Depth=1
	movl	%r9d, %r8d
	jmp	.LBB3_1
.LBB3_6:                                #   in Loop: Header=BB3_1 Depth=1
	incl	%r9d
	movl	%r9d, %ecx
	jmp	.LBB3_1
.LBB3_3:
	movl	%r9d, %eax
.LBB3_4:                                # %._crit_edge
	retq
.Lfunc_end3:
	.size	_Z7bsearchiPiiii, .Lfunc_end3-_Z7bsearchiPiiii
	.cfi_endproc
                                        # -- End function
	.globl	_Z19process_transactioniPiiiiS_iiS_iPci # -- Begin function _Z19process_transactioniPiiiiS_iiS_iPci
	.type	_Z19process_transactioniPiiiiS_iiS_iPci,@function
_Z19process_transactioniPiiiiS_iiS_iPci: # @_Z19process_transactioniPiiiiS_iiS_iPci
	.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	$56, %rsp
	.cfi_def_cfa_offset 112
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%r9, %r12
	movl	%r8d, %ebx
	movl	%ecx, %ebp
	movl	%edx, 4(%rsp)                   # 4-byte Spill
	movq	%rsi, %r14
	movl	%edi, %r13d
	movl	152(%rsp), %edx
	movl	136(%rsp), %r15d
	movl	%edx, %eax
	imull	%edi, %eax
	leal	1(%r13), %ecx
	imull	%edx, %ecx
	movslq	%eax, %rsi
	movq	%rsi, 16(%rsp)                  # 8-byte Spill
	cmpl	%ecx, %eax
	jge	.LBB4_2
# %bb.1:                                # %.lr.ph.preheader
	movq	144(%rsp), %rax
	movq	16(%rsp), %rcx                  # 8-byte Reload
	leaq	(%rax,%rcx), %rdi
	decl	%edx
	incq	%rdx
	xorl	%esi, %esi
	callq	memset@PLT
.LBB4_2:                                # %.preheader97
	testl	%r15d, %r15d
	jle	.LBB4_33
# %bb.3:                                # %.preheader96.lr.ph
	movl	120(%rsp), %ecx
	imull	%ecx, %r13d
	movslq	%r13d, %rax
	movl	%ecx, %r13d
	movslq	%ebx, %rdx
	movslq	%ebp, %rcx
	movslq	%r13d, %rsi
	movl	%r15d, %edi
	movq	%rdi, 32(%rsp)                  # 8-byte Spill
	movl	%esi, %r8d
	leaq	(%r12,%rax,4), %r9
	leaq	4(%r14,%rcx,4), %rax
	movq	%rax, 8(%rsp)                   # 8-byte Spill
	movq	%rdx, 40(%rsp)                  # 8-byte Spill
	leaq	(,%rdx,4), %rax
	movq	%rax, 24(%rsp)                  # 8-byte Spill
	negq	%rax
	movq	%rax, 48(%rsp)                  # 8-byte Spill
	xorl	%r11d, %r11d
.LBB4_4:                                # %.preheader96
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB4_6 Depth 2
                                        #     Child Loop BB4_14 Depth 2
                                        #     Child Loop BB4_17 Depth 2
                                        #     Child Loop BB4_22 Depth 2
                                        #       Child Loop BB4_25 Depth 3
	movl	$0, %r15d
	testl	%r13d, %r13d
	jle	.LBB4_9
# %bb.5:                                # %.lr.ph103.preheader
                                        #   in Loop: Header=BB4_4 Depth=1
	xorl	%eax, %eax
	xorl	%r15d, %r15d
	movl	%r11d, %ecx
.LBB4_6:                                # %.lr.ph103
                                        #   Parent Loop BB4_4 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	testb	$1, %cl
	jne	.LBB4_8
# %bb.7:                                #   in Loop: Header=BB4_6 Depth=2
	addl	(%r9,%rax,4), %r15d
.LBB4_8:                                #   in Loop: Header=BB4_6 Depth=2
	movl	%ecx, %edi
	shrl	$31, %edi
	addl	%ecx, %edi
	sarl	%edi
	incq	%rax
	movl	%edi, %ecx
	cmpq	%rax, %r8
	jne	.LBB4_6
.LBB4_9:                                # %._crit_edge
                                        #   in Loop: Header=BB4_4 Depth=1
	movq	128(%rsp), %rax
	movl	(%rax,%r11,4), %r12d
	movl	4(%rax,%r11,4), %eax
.LBB4_14:                               #   Parent Loop BB4_4 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	cmpl	%r12d, %eax
	jle	.LBB4_32
# %bb.10:                               # %.lr.ph.i
                                        #   in Loop: Header=BB4_14 Depth=2
	movl	%eax, %edi
	subl	%r12d, %edi
	sarl	%edi
	leal	(%rdi,%r12), %ecx
	movl	%ecx, %r10d
	imull	%ebx, %r10d
	movslq	%r10d, %r10
	movl	48(%r14,%r10,4), %r10d
	cmpl	%r15d, %r10d
	je	.LBB4_15
# %bb.11:                               #   in Loop: Header=BB4_14 Depth=2
	jl	.LBB4_12
# %bb.13:                               #   in Loop: Header=BB4_14 Depth=2
	movl	%ecx, %eax
	jmp	.LBB4_14
.LBB4_12:                               #   in Loop: Header=BB4_14 Depth=2
	incl	%ecx
	movl	%ecx, %r12d
	jmp	.LBB4_14
.LBB4_15:                               # %_Z7bsearchiPiiii.exit
                                        #   in Loop: Header=BB4_4 Depth=1
	cmpl	$-1, %ecx
	je	.LBB4_32
# %bb.16:                               # %.preheader94.preheader
                                        #   in Loop: Header=BB4_4 Depth=1
	movslq	%r12d, %r10
	movslq	%edi, %rbp
	leaq	(%r10,%rbp), %rdi
	movl	%ecx, %eax
	sarl	$31, %eax
	andl	%ecx, %eax
	addl	%ebp, %r12d
	incl	%r12d
	movq	24(%rsp), %rdx                  # 8-byte Reload
	movq	%rdx, %rcx
	imulq	%rdi, %rcx
	addq	%r10, %rbp
	decq	%rbp
	imulq	%rdx, %rbp
	movq	8(%rsp), %r10                   # 8-byte Reload
.LBB4_17:                               # %.preheader94
                                        #   Parent Loop BB4_4 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	testq	%rdi, %rdi
	jle	.LBB4_18
# %bb.19:                               #   in Loop: Header=BB4_17 Depth=2
	movl	(%r10,%rcx), %edx
	decq	%rdi
	decl	%r12d
	movq	48(%rsp), %r13                  # 8-byte Reload
	addq	%r10, %r13
	cmpl	(%r10,%rbp), %edx
	movq	%r13, %r10
	je	.LBB4_17
	jmp	.LBB4_20
.LBB4_18:                               #   in Loop: Header=BB4_4 Depth=1
	movl	%eax, %r12d
.LBB4_20:                               # %.critedge
                                        #   in Loop: Header=BB4_4 Depth=1
	cmpl	4(%rsp), %r12d                  # 4-byte Folded Reload
	movl	120(%rsp), %r13d
	jge	.LBB4_32
# %bb.21:                               # %.lr.ph111.preheader
                                        #   in Loop: Header=BB4_4 Depth=1
	movslq	%r12d, %rax
.LBB4_22:                               # %.lr.ph111
                                        #   Parent Loop BB4_4 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB4_25 Depth 3
	movq	%rax, %r12
	imulq	40(%rsp), %r12                  # 8-byte Folded Reload
	movq	8(%rsp), %rcx                   # 8-byte Reload
	cmpl	%r15d, (%rcx,%r12,4)
	jne	.LBB4_32
# %bb.23:                               # %.preheader
                                        #   in Loop: Header=BB4_22 Depth=2
	testl	%r13d, %r13d
	jle	.LBB4_30
# %bb.24:                               # %.lr.ph107.preheader
                                        #   in Loop: Header=BB4_22 Depth=2
	leaq	(%r14,%r12,4), %rdi
	xorl	%ecx, %ecx
.LBB4_25:                               # %.lr.ph107
                                        #   Parent Loop BB4_4 Depth=1
                                        #     Parent Loop BB4_22 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movl	(%rdi,%rcx,4), %r10d
	cmpl	$-1, %r10d
	je	.LBB4_29
# %bb.26:                               #   in Loop: Header=BB4_25 Depth=3
	movl	(%r9,%rcx,4), %ebp
	cmpl	%ebp, %r10d
	jne	.LBB4_28
# %bb.27:                               #   in Loop: Header=BB4_25 Depth=3
	incq	%rcx
	cmpq	%rsi, %rcx
	jl	.LBB4_25
	jmp	.LBB4_28
.LBB4_29:                               # %.thread
                                        #   in Loop: Header=BB4_25 Depth=3
	incq	%rcx
	cmpq	%rsi, %rcx
	jl	.LBB4_25
	jmp	.LBB4_30
.LBB4_28:                               # %._crit_edge108
                                        #   in Loop: Header=BB4_22 Depth=2
	cmpl	%ebp, %r10d
	jne	.LBB4_31
.LBB4_30:                               # %.critedge115
                                        #   in Loop: Header=BB4_22 Depth=2
	movq	8(%rsp), %rcx                   # 8-byte Reload
	movslq	-8(%rcx,%r12,4), %rcx
	addq	16(%rsp), %rcx                  # 8-byte Folded Reload
	movq	144(%rsp), %rdx
	incb	(%rdx,%rcx)
.LBB4_31:                               #   in Loop: Header=BB4_22 Depth=2
	incq	%rax
	cmpl	4(%rsp), %eax                   # 4-byte Folded Reload
	jne	.LBB4_22
.LBB4_32:                               # %.critedge2
                                        #   in Loop: Header=BB4_4 Depth=1
	incq	%r11
	cmpq	32(%rsp), %r11                  # 8-byte Folded Reload
	jne	.LBB4_4
.LBB4_33:                               # %._crit_edge114
	addq	$56, %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_end4:
	.size	_Z19process_transactioniPiiiiS_iiS_iPci, .Lfunc_end4-_Z19process_transactioniPiiiiS_iiS_iPci
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z14process_on_CPUPiiiiS_iiS_iPci
.LCPI5_0:
	.quad	0x412e848000000000              # double 1.0E+6
	.text
	.globl	_Z14process_on_CPUPiiiiS_iiS_iPci
	.type	_Z14process_on_CPUPiiiiS_iiS_iPci,@function
_Z14process_on_CPUPiiiiS_iiS_iPci:      # @_Z14process_on_CPUPiiiiS_iiS_iPci
	.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	$120, %rsp
	.cfi_def_cfa_offset 176
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	%r9d, %r14d
	movq	%r8, %r12
	movl	%ecx, 64(%rsp)                  # 4-byte Spill
	movl	%edx, 60(%rsp)                  # 4-byte Spill
	movl	%esi, 56(%rsp)                  # 4-byte Spill
	movq	%rdi, 80(%rsp)                  # 8-byte Spill
	movl	176(%rsp), %ebp
	movabsq	$8386654079495008884, %rax      # imm = 0x746361736E617274
	leaq	96(%rsp), %rcx
	movq	%rax, (%rcx)
	movl	$1936617321, 8(%rcx)            # imm = 0x736E6F69
	movb	$95, 12(%rcx)
	movl	$1987273518, 14(%rcx)           # imm = 0x7673632E
	movw	$0, 18(%rcx)
	movb	$1, %al
	xorl	%r15d, %r15d
	movl	%r9d, 52(%rsp)                  # 4-byte Spill
	movq	%r8, 72(%rsp)                   # 8-byte Spill
	movl	60(%rsp), %r13d                 # 4-byte Reload
.LBB5_1:                                # =>This Loop Header: Depth=1
                                        #     Child Loop BB5_3 Depth 2
	movq	%rax, 88(%rsp)                  # 8-byte Spill
	movl	%r15d, %eax
	orb	$48, %al
	movb	%al, 109(%rsp)
	movl	$.L.str.5, %edi
	movl	%r15d, %esi
	xorl	%eax, %eax
	callq	printf
	movq	%r12, %rdi
	leaq	96(%rsp), %rsi
	movl	%r14d, %edx
	movl	%ebp, %ecx
	movl	%ebp, %r8d
	callq	_Z8load_csvPiPciii
	movl	$.L.str.6, %edi
	movl	%r15d, 68(%rsp)                 # 4-byte Spill
	movl	%r15d, %esi
	xorl	%eax, %eax
	callq	printf
	movl	$start, %edi
	xorl	%esi, %esi
	callq	gettimeofday
	testl	%r14d, %r14d
	movl	64(%rsp), %r12d                 # 4-byte Reload
	movl	56(%rsp), %r14d                 # 4-byte Reload
	movq	80(%rsp), %r15                  # 8-byte Reload
	movl	208(%rsp), %edi
	movq	200(%rsp), %rdx
	movl	192(%rsp), %esi
	movq	184(%rsp), %rax
	movl	%ebp, %ebx
	jle	.LBB5_4
# %bb.2:                                # %.lr.ph.preheader
                                        #   in Loop: Header=BB5_1 Depth=1
	xorl	%ebp, %ebp
.LBB5_3:                                # %.lr.ph
                                        #   Parent Loop BB5_1 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movl	%edi, 40(%rsp)
	movq	%rdx, 32(%rsp)
	movl	%esi, 24(%rsp)
	movq	%rax, 16(%rsp)
	movl	%ebx, 8(%rsp)
	movl	%ebp, %edi
	movq	%r15, %rsi
	movl	%r14d, %edx
	movl	%r13d, %ecx
	movl	%r12d, %r8d
	movq	72(%rsp), %r9                   # 8-byte Reload
	movq	%rax, %rbx
	callq	_Z19process_transactioniPiiiiS_iiS_iPci
	movq	%rbx, %rax
	movl	192(%rsp), %esi
	movq	200(%rsp), %rdx
	movl	208(%rsp), %edi
	movl	176(%rsp), %ebx
	incl	%ebp
	cmpl	%ebp, 52(%rsp)                  # 4-byte Folded Reload
	jne	.LBB5_3
.LBB5_4:                                # %._crit_edge
                                        #   in Loop: Header=BB5_1 Depth=1
	movl	$end, %edi
	xorl	%esi, %esi
	callq	gettimeofday
	movq	end(%rip), %rax
	subq	start(%rip), %rax
	xorps	%xmm1, %xmm1
	cvtsi2sd	%rax, %xmm1
	movq	end+8(%rip), %rax
	subq	start+8(%rip), %rax
	xorps	%xmm0, %xmm0
	cvtsi2sd	%rax, %xmm0
	divsd	.LCPI5_0(%rip), %xmm0
	addsd	%xmm1, %xmm0
	movl	$.L.str.7, %edi
	movl	68(%rsp), %esi                  # 4-byte Reload
	movb	$1, %al
	callq	printf
	movl	$1, %r15d
	testb	$1, 88(%rsp)                    # 1-byte Folded Reload
	movl	$0, %eax
	movq	72(%rsp), %r12                  # 8-byte Reload
	movl	52(%rsp), %r14d                 # 4-byte Reload
	movl	%ebx, %ebp
	jne	.LBB5_1
# %bb.5:
	addq	$120, %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_end5:
	.size	_Z14process_on_CPUPiiiiS_iiS_iPci, .Lfunc_end5-_Z14process_on_CPUPiiiiS_iiS_iPci
	.cfi_endproc
                                        # -- End function
	.globl	_Z35__device_stub__process_batch_kerneliPiiiiS_iiS_iPci # -- Begin function _Z35__device_stub__process_batch_kerneliPiiiiS_iiS_iPci
	.type	_Z35__device_stub__process_batch_kerneliPiiiiS_iiS_iPci,@function
_Z35__device_stub__process_batch_kerneliPiiiiS_iiS_iPci: # @_Z35__device_stub__process_batch_kerneliPiiiiS_iiS_iPci
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$176, %rsp
	.cfi_def_cfa_offset 224
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	12(%rsp), %rax
	movl	%edi, (%rax)
	leaq	40(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	8(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	4(%rsp), %rdx
	movl	%ecx, (%rdx)
	movq	%rsp, %rcx
	movl	%r8d, (%rcx)
	leaq	32(%rsp), %r8
	movq	%r9, (%r8)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	movq	%r8, 40(%rbx)
	leaq	224(%rsp), %rax
	movq	%rax, 48(%rbx)
	leaq	232(%rsp), %rax
	movq	%rax, 56(%rbx)
	leaq	240(%rsp), %rax
	movq	%rax, 64(%rbx)
	leaq	248(%rsp), %rax
	movq	%rax, 72(%rbx)
	leaq	256(%rsp), %rax
	movq	%rax, 80(%rbx)
	leaq	264(%rsp), %rax
	movq	%rax, 88(%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	$_Z20process_batch_kerneliPiiiiS_iiS_iPci, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$192, %rsp
	.cfi_adjust_cfa_offset -192
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end6:
	.size	_Z35__device_stub__process_batch_kerneliPiiiiS_iiS_iPci, .Lfunc_end6-_Z35__device_stub__process_batch_kerneliPiiiiS_iiS_iPci
	.cfi_endproc
                                        # -- End function
	.globl	_Z10cudaAsserti10hipError_t     # -- Begin function _Z10cudaAsserti10hipError_t
	.type	_Z10cudaAsserti10hipError_t,@function
_Z10cudaAsserti10hipError_t:            # @_Z10cudaAsserti10hipError_t
	.cfi_startproc
# %bb.0:
	testl	%esi, %esi
	je	.LBB7_1
# %bb.2:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	movl	%edi, %ebx
	movl	%esi, %edi
	callq	hipGetErrorString
	movl	$.L.str.8, %edi
	movl	$.L.str.9, %edx
	movq	%rax, %rsi
	movl	%ebx, %ecx
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	printf                          # TAILCALL
.LBB7_1:
	.cfi_restore %rbx
	retq
.Lfunc_end7:
	.size	_Z10cudaAsserti10hipError_t, .Lfunc_end7-_Z10cudaAsserti10hipError_t
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z14process_on_GPUPiiiiS_iiS_iPci
.LCPI8_0:
	.quad	0x412e848000000000              # double 1.0E+6
	.text
	.globl	_Z14process_on_GPUPiiiiS_iiS_iPci
	.type	_Z14process_on_GPUPiiiiS_iiS_iPci,@function
_Z14process_on_GPUPiiiiS_iiS_iPci:      # @_Z14process_on_GPUPiiiiS_iiS_iPci
	.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	$168, %rsp
	.cfi_def_cfa_offset 224
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	%r9d, %r15d
	movq	%r8, 40(%rsp)                   # 8-byte Spill
	movl	%edx, 32(%rsp)                  # 4-byte Spill
	movq	%rdi, (%rsp)                    # 8-byte Spill
	movslq	240(%rsp), %rbx
	movslq	224(%rsp), %rax
	movq	%rax, 72(%rsp)                  # 8-byte Spill
	movslq	256(%rsp), %rax
	movq	%rax, 64(%rsp)                  # 8-byte Spill
	leal	4095(%r15), %eax
	leal	8190(%r15), %r13d
	testl	%eax, %eax
	cmovnsl	%eax, %r13d
	sarl	$12, %r13d
	movl	%ecx, 36(%rsp)                  # 4-byte Spill
	movl	%ecx, %eax
	movl	%esi, 28(%rsp)                  # 4-byte Spill
	imull	%esi, %eax
	movslq	%eax, %r14
	shlq	$2, %r14
	leaq	56(%rsp), %rbp
	movq	%rbp, %rdi
	movq	%r14, %rsi
	callq	hipMalloc
	movl	$169, %edi
	movl	%eax, %esi
	callq	_Z10cudaAsserti10hipError_t
	movq	%rbx, 96(%rsp)                  # 8-byte Spill
	leaq	4(,%rbx,4), %r12
	leaq	48(%rsp), %rbx
	movq	%rbx, %rdi
	movq	%r12, %rsi
	callq	hipMalloc
	movl	$170, %edi
	movl	%eax, %esi
	callq	_Z10cudaAsserti10hipError_t
	movq	(%rbp), %rdi
	movl	$1, %ebp
	movq	(%rsp), %rsi                    # 8-byte Reload
	movq	%r14, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	movl	$171, %edi
	movl	%eax, %esi
	callq	_Z10cudaAsserti10hipError_t
	movq	(%rbx), %rdi
	movq	232(%rsp), %rsi
	movq	%r12, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	movl	$172, %edi
	movl	%eax, %esi
	callq	_Z10cudaAsserti10hipError_t
	movq	64(%rsp), %r14                  # 8-byte Reload
	movl	%r14d, %eax
	shll	$12, %eax
	movslq	%eax, %rsi
	leaq	8(%rsp), %rdi
	callq	hipMalloc
	movl	$174, %edi
	movl	%eax, %esi
	callq	_Z10cudaAsserti10hipError_t
	movq	72(%rsp), %rbx                  # 8-byte Reload
	movl	%ebx, %eax
	shll	$12, %eax
	movslq	%eax, %rsi
	shlq	$2, %rsi
	leaq	16(%rsp), %rdi
	callq	hipMalloc
	movl	$175, %edi
	movl	%eax, %esi
	callq	_Z10cudaAsserti10hipError_t
	movabsq	$8386654079495008884, %rax      # imm = 0x746361736E617274
	leaq	144(%rsp), %rcx
	movq	%rax, (%rcx)
	movl	$1936617321, 8(%rcx)            # imm = 0x736E6F69
	movb	$95, 12(%rcx)
	movl	$1987273518, 14(%rcx)           # imm = 0x7673632E
	leal	-1(%r13), %eax
	cmpl	$2, %r13d
	cmovll	%ebp, %r13d
	movw	$0, 18(%rcx)
	shlq	$12, %rax
	movq	%rax, 128(%rsp)                 # 8-byte Spill
	movq	%r15, 80(%rsp)                  # 8-byte Spill
	movl	%r15d, %eax
	movq	%rax, (%rsp)                    # 8-byte Spill
	movq	%r14, %rax
	movq	%r14, %r15
	shlq	$12, %rax
	movq	%rax, 120(%rsp)                 # 8-byte Spill
	movq	%rbx, %rax
	shlq	$14, %rax
	movq	%rax, 112(%rsp)                 # 8-byte Spill
	shlq	$12, %r13
	movq	%r13, 136(%rsp)                 # 8-byte Spill
	movb	$1, %al
	movabsq	$4294967312, %rcx               # imm = 0x100000010
	addq	$240, %rcx
	movq	%rcx, 104(%rsp)                 # 8-byte Spill
	xorl	%ebp, %ebp
.LBB8_1:                                # =>This Loop Header: Depth=1
                                        #     Child Loop BB8_3 Depth 2
	movq	%rax, 88(%rsp)                  # 8-byte Spill
	movl	%ebp, %eax
	orb	$48, %al
	movb	%al, 157(%rsp)
	movl	$.L.str.5, %edi
	movl	%ebp, %esi
	xorl	%eax, %eax
	callq	printf
	movq	40(%rsp), %rdi                  # 8-byte Reload
	leaq	144(%rsp), %rsi
	movq	80(%rsp), %r14                  # 8-byte Reload
	movl	%r14d, %edx
	movq	%rbx, %rcx
	movl	%ecx, %r8d
	callq	_Z8load_csvPiPciii
	movl	$.L.str.10, %edi
	movl	%ebp, 24(%rsp)                  # 4-byte Spill
	movl	%ebp, %esi
	xorl	%eax, %eax
	callq	printf
	movl	$start, %edi
	xorl	%esi, %esi
	callq	gettimeofday
	testl	%r14d, %r14d
	jle	.LBB8_6
# %bb.2:                                # %.lr.ph.preheader
                                        #   in Loop: Header=BB8_1 Depth=1
	movl	$4096, %r14d                    # imm = 0x1000
	movq	40(%rsp), %rbp                  # 8-byte Reload
	movq	248(%rsp), %r12
	xorl	%r13d, %r13d
.LBB8_3:                                # %.lr.ph
                                        #   Parent Loop BB8_1 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movl	%r14d, %eax
	movq	(%rsp), %rcx                    # 8-byte Reload
	leal	(%rcx,%r13), %r14d
	movq	128(%rsp), %rcx                 # 8-byte Reload
	addq	%r13, %rcx
	cmovnel	%eax, %r14d
	movq	16(%rsp), %rdi
	movl	%r14d, %eax
	imull	%ebx, %eax
	movslq	%eax, %rdx
	shlq	$2, %rdx
	movq	%rbp, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	movl	$195, %edi
	movl	%eax, %esi
	callq	_Z10cudaAsserti10hipError_t
	movabsq	$4294967312, %rdi               # imm = 0x100000010
	movl	$1, %esi
	movq	104(%rsp), %rdx                 # 8-byte Reload
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB8_5
# %bb.4:                                #   in Loop: Header=BB8_3 Depth=2
	movq	56(%rsp), %rsi
	movq	16(%rsp), %r9
	movl	%r14d, %edi
	movl	28(%rsp), %edx                  # 4-byte Reload
	movl	32(%rsp), %ecx                  # 4-byte Reload
	movl	36(%rsp), %r8d                  # 4-byte Reload
	pushq	%r15
	.cfi_adjust_cfa_offset 8
	pushq	16(%rsp)
	.cfi_adjust_cfa_offset 8
	pushq	112(%rsp)                       # 8-byte Folded Reload
	.cfi_adjust_cfa_offset 8
	pushq	72(%rsp)
	.cfi_adjust_cfa_offset 8
	pushq	%rbx
	.cfi_adjust_cfa_offset 8
	pushq	40(%rsp)                        # 8-byte Folded Reload
	.cfi_adjust_cfa_offset 8
	callq	_Z35__device_stub__process_batch_kerneliPiiiiS_iiS_iPci
	addq	$48, %rsp
	.cfi_adjust_cfa_offset -48
.LBB8_5:                                #   in Loop: Header=BB8_3 Depth=2
	callq	hipDeviceSynchronize
	movl	$198, %edi
	movl	%eax, %esi
	callq	_Z10cudaAsserti10hipError_t
	movq	8(%rsp), %rsi
	movl	%r14d, %eax
	imull	%r15d, %eax
	movslq	%eax, %rdx
	movq	%r12, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	movl	$200, %edi
	movl	%eax, %esi
	callq	_Z10cudaAsserti10hipError_t
	addq	$-4096, %r13                    # imm = 0xF000
	addq	120(%rsp), %r12                 # 8-byte Folded Reload
	addq	112(%rsp), %rbp                 # 8-byte Folded Reload
	movq	136(%rsp), %rax                 # 8-byte Reload
	addq	%r13, %rax
	jne	.LBB8_3
.LBB8_6:                                # %._crit_edge
                                        #   in Loop: Header=BB8_1 Depth=1
	movl	$end, %edi
	xorl	%esi, %esi
	callq	gettimeofday
	movq	end(%rip), %rax
	subq	start(%rip), %rax
	xorps	%xmm1, %xmm1
	cvtsi2sd	%rax, %xmm1
	movq	end+8(%rip), %rax
	subq	start+8(%rip), %rax
	xorps	%xmm0, %xmm0
	cvtsi2sd	%rax, %xmm0
	divsd	.LCPI8_0(%rip), %xmm0
	addsd	%xmm1, %xmm0
	movl	$.L.str.11, %edi
	movl	24(%rsp), %esi                  # 4-byte Reload
	movb	$1, %al
	callq	printf
	movl	$1, %ebp
	testb	$1, 88(%rsp)                    # 1-byte Folded Reload
	movl	$0, %eax
	jne	.LBB8_1
# %bb.7:
	movq	16(%rsp), %rdi
	callq	hipFree
	movl	$218, %edi
	movl	%eax, %esi
	callq	_Z10cudaAsserti10hipError_t
	movq	56(%rsp), %rdi
	callq	hipFree
	movl	$219, %edi
	movl	%eax, %esi
	callq	_Z10cudaAsserti10hipError_t
	movq	48(%rsp), %rdi
	callq	hipFree
	movl	$220, %edi
	movl	%eax, %esi
	callq	_Z10cudaAsserti10hipError_t
	movq	8(%rsp), %rdi
	callq	hipFree
	movl	$221, %edi
	movl	%eax, %esi
	callq	_Z10cudaAsserti10hipError_t
	addq	$168, %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_end8:
	.size	_Z14process_on_GPUPiiiiS_iiS_iPci, .Lfunc_end8-_Z14process_on_GPUPiiiiS_iiS_iPci
	.cfi_endproc
                                        # -- End function
	.globl	main                            # -- Begin function main
	.type	main,@function
main:                                   # @main
	.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
	movl	$.Lstr, %edi
	callq	puts@PLT
	movl	$26000000, %edi                 # imm = 0x18CBA80
	movl	$4, %esi
	callq	calloc
	movq	%rax, %rbx
	movl	$.L.str.12, %esi
	movq	%rax, %rdi
	movl	$2000000, %edx                  # imm = 0x1E8480
	movl	$11, %ecx
	movl	$13, %r8d
	callq	_Z8load_csvPiPciii
	movl	$10000000, %edi                 # imm = 0x989680
	movl	$4, %esi
	callq	calloc
	movq	%rax, %r14
	movl	$100000000, %edi                # imm = 0x5F5E100
	movl	$1, %esi
	callq	calloc
	movq	%rax, %r15
	xorl	%eax, %eax
	movq	%rbx, %rdx
	xorl	%esi, %esi
.LBB9_1:                                # %.preheader104
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB9_2 Depth 2
	leaq	(%rsi,%rsi,2), %rcx
	leaq	(%rsi,%rcx,4), %rdi
	xorl	%ecx, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
.LBB9_2:                                #   Parent Loop BB9_1 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movl	(%rdx,%rcx,4), %r10d
	movl	$1, %r11d
	shll	%cl, %r11d
	cmpl	$-1, %r10d
	cmovnel	%eax, %r11d
	cmovel	%eax, %r10d
	orl	%r11d, %r9d
	addl	%r10d, %r8d
	incq	%rcx
	cmpq	$10, %rcx
	jne	.LBB9_2
# %bb.3:                                #   in Loop: Header=BB9_1 Depth=1
	movl	%r9d, 44(%rbx,%rdi,4)
	movl	%r8d, 48(%rbx,%rdi,4)
	incq	%rsi
	addq	$52, %rdx
	cmpq	$2000000, %rsi                  # imm = 0x1E8480
	jne	.LBB9_1
# %bb.4:
	movl	$.Lstr.1, %edi
	callq	puts@PLT
	movl	$2000000, %esi                  # imm = 0x1E8480
	movl	$52, %edx
	movl	$_Z7cmpfuncPKvS0_, %ecx
	movq	%rbx, %rdi
	callq	qsort
	movl	$1025, %edi                     # imm = 0x401
	movl	$4, %esi
	callq	calloc
	movl	44(%rbx), %edx
	movl	$1, %ecx
.LBB9_5:                                # =>This Loop Header: Depth=1
                                        #     Child Loop BB9_8 Depth 2
                                        #     Child Loop BB9_13 Depth 2
	imulq	$52, %rcx, %rsi
	movl	44(%rbx,%rsi), %esi
	cmpl	%esi, %edx
	je	.LBB9_10
# %bb.6:                                # %.preheader102
                                        #   in Loop: Header=BB9_5 Depth=1
	jge	.LBB9_9
# %bb.7:                                # %.lr.ph.preheader
                                        #   in Loop: Header=BB9_5 Depth=1
	movslq	%esi, %rdi
	movslq	%edx, %rdx
.LBB9_8:                                # %.lr.ph
                                        #   Parent Loop BB9_5 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movl	%ecx, 4(%rax,%rdx,4)
	incq	%rdx
	cmpq	%rdx, %rdi
	jne	.LBB9_8
.LBB9_9:                                #   in Loop: Header=BB9_5 Depth=1
	movl	%esi, %edx
.LBB9_10:                               # %.loopexit103
                                        #   in Loop: Header=BB9_5 Depth=1
	cmpq	$1999999, %rcx                  # imm = 0x1E847F
	jne	.LBB9_14
# %bb.11:                               # %.loopexit103
                                        #   in Loop: Header=BB9_5 Depth=1
	cmpl	$1023, %edx                     # imm = 0x3FF
	jg	.LBB9_14
# %bb.12:                               # %.lr.ph114.preheader
                                        #   in Loop: Header=BB9_5 Depth=1
	movslq	%edx, %rsi
.LBB9_13:                               # %.lr.ph114
                                        #   Parent Loop BB9_5 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movl	$2000000, 4(%rax,%rsi,4)        # imm = 0x1E8480
	incq	%rsi
	cmpq	$1024, %rsi                     # imm = 0x400
	jne	.LBB9_13
.LBB9_14:                               # %.loopexit
                                        #   in Loop: Header=BB9_5 Depth=1
	incq	%rcx
	cmpq	$2000000, %rcx                  # imm = 0x1E8480
	jne	.LBB9_5
# %bb.15:
	subq	$8, %rsp
	.cfi_adjust_cfa_offset 8
	movq	%rbx, %rdi
	movl	$2000000, %esi                  # imm = 0x1E8480
	movl	$11, %edx
	movl	$13, %ecx
	movq	%r14, %r8
	movl	$1000000, %r9d                  # imm = 0xF4240
	pushq	$100
	.cfi_adjust_cfa_offset 8
	pushq	%r15
	.cfi_adjust_cfa_offset 8
	pushq	$1024                           # imm = 0x400
	.cfi_adjust_cfa_offset 8
	pushq	%rax
	.cfi_adjust_cfa_offset 8
	pushq	$10
	.cfi_adjust_cfa_offset 8
	callq	_Z14process_on_GPUPiiiiS_iiS_iPci
	addq	$48, %rsp
	.cfi_adjust_cfa_offset -48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.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:
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	jne	.LBB10_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rdi
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB10_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z20process_batch_kerneliPiiiiS_iiS_iPci, %esi
	movl	$.L__unnamed_1, %edx
	movl	$.L__unnamed_1, %ecx
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$40, %rsp
	.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	start,@object                   # @start
	.bss
	.globl	start
	.p2align	3, 0x0
start:
	.zero	16
	.size	start, 16

	.type	end,@object                     # @end
	.globl	end
	.p2align	3, 0x0
end:
	.zero	16
	.size	end, 16

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

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"%d;"
	.size	.L.str.1, 4

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"%*c;"
	.size	.L.str.2, 5

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

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

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"Loading transactions_%d\n"
	.size	.L.str.5, 25

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"CPU: start_%d\n"
	.size	.L.str.6, 15

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"CPU: end_%d : %f s\n"
	.size	.L.str.7, 20

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

	.type	.L.str.8,@object                # @.str.8
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.8:
	.asciz	"%s in %s at line %d\n"
	.size	.L.str.8, 21

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"/home/ubuntu/Datasets/stackv2/train-structured-repos-hip-sm89/jakmak24/pcm_project/master/grandrule.hip"
	.size	.L.str.9, 104

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	"GPU: start_%d\n"
	.size	.L.str.10, 15

	.type	.L.str.11,@object               # @.str.11
.L.str.11:
	.asciz	"GPU: end_%d : %f s\n"
	.size	.L.str.11, 20

	.type	.L.str.12,@object               # @.str.12
.L.str.12:
	.asciz	"rule_2M.csv"
	.size	.L.str.12, 12

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z20process_batch_kerneliPiiiiS_iiS_iPci"
	.size	.L__unnamed_1, 41

	.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	"Loading rules"
	.size	.Lstr, 14

	.type	.Lstr.1,@object                 # @str.1
.Lstr.1:
	.asciz	"Sorting rules"
	.size	.Lstr.1, 14

	.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 _Z7cmpfuncPKvS0_
	.addrsig_sym _Z35__device_stub__process_batch_kerneliPiiiiS_iiS_iPci
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym start
	.addrsig_sym end
	.addrsig_sym _Z20process_batch_kerneliPiiiiS_iiS_iPci
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z20process_batch_kerneliPiiiiS_iiS_iPci ; -- Begin function _Z20process_batch_kerneliPiiiiS_iiS_iPci
	.globl	_Z20process_batch_kerneliPiiiiS_iiS_iPci
	.p2align	8
	.type	_Z20process_batch_kerneliPiiiiS_iiS_iPci,@function
_Z20process_batch_kerneliPiiiiS_iiS_iPci: ; @_Z20process_batch_kerneliPiiiiS_iiS_iPci
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x5c
	s_load_b32 s3, 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_mov_b32 s2, exec_lo
	v_cmpx_gt_i32_e64 s3, v1
	s_cbranch_execz .LBB0_39
; %bb.1:
	s_clause 0x1
	s_load_b32 s4, s[0:1], 0x48
	s_load_b64 s[2:3], s[0:1], 0x40
	s_mov_b32 s5, exec_lo
	s_waitcnt lgkmcnt(0)
	v_mul_lo_u32 v6, v1, s4
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_nc_u32_e32 v0, s4, v6
	v_cmpx_lt_i32_e64 v6, v0
	s_cbranch_execz .LBB0_4
; %bb.2:                                ; %.lr.ph.i.preheader
	v_ashrrev_i32_e32 v0, 31, v6
	v_add_co_u32 v2, vcc_lo, s2, v6
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v3, vcc_lo, s3, v0, vcc_lo
	v_mov_b32_e32 v0, 0
.LBB0_3:                                ; %.lr.ph.i
                                        ; =>This Inner Loop Header: Depth=1
	global_store_b8 v[2:3], v0, off
	v_add_co_u32 v2, vcc_lo, v2, 1
	v_add_co_ci_u32_e32 v3, vcc_lo, 0, v3, vcc_lo
	s_add_i32 s4, s4, -1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmp_eq_u32 s4, 0
	s_cbranch_scc0 .LBB0_3
.LBB0_4:                                ; %Flow118
	s_or_b32 exec_lo, exec_lo, s5
	s_load_b32 s15, s[0:1], 0x38
	s_waitcnt lgkmcnt(0)
	s_cmp_lt_i32 s15, 1
	s_cbranch_scc1 .LBB0_39
; %bb.5:                                ; %.preheader93.lr.ph.i
	s_load_b128 s[4:7], s[0:1], 0x10
	s_waitcnt lgkmcnt(0)
	s_clause 0x3
	s_load_b32 s7, s[0:1], 0x2c
	s_load_b64 s[8:9], s[0:1], 0x8
	s_load_b64 s[10:11], s[0:1], 0x20
	s_load_b64 s[0:1], s[0:1], 0x30
	v_mov_b32_e32 v8, 0
	s_mov_b32 s13, 0
	s_delay_alu instid0(SALU_CYCLE_1)
	s_mov_b32 s12, s13
	s_waitcnt lgkmcnt(0)
	v_mul_lo_u32 v7, v1, s7
	s_cmp_gt_i32 s7, 0
	s_mov_b32 s14, s5
	s_cselect_b32 s5, -1, 0
	s_add_u32 s16, s8, 48
	s_addc_u32 s17, s9, 0
	s_add_u32 s18, s8, 4
	s_addc_u32 s19, s9, 0
.LBB0_6:                                ; %.preheader93.i
                                        ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_8 Depth 2
                                        ;     Child Loop BB0_14 Depth 2
                                        ;     Child Loop BB0_20 Depth 2
                                        ;     Child Loop BB0_25 Depth 2
                                        ;       Child Loop BB0_28 Depth 3
	v_mov_b32_e32 v9, 0
	s_and_not1_b32 vcc_lo, exec_lo, s5
	s_cbranch_vccnz .LBB0_11
; %bb.7:                                ; %.lr.ph99.i.preheader
                                        ;   in Loop: Header=BB0_6 Depth=1
	v_dual_mov_b32 v9, 0 :: v_dual_mov_b32 v0, v7
	s_mov_b32 s20, s7
	s_mov_b32 s21, s12
.LBB0_8:                                ; %.lr.ph99.i
                                        ;   Parent Loop BB0_6 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	s_bitcmp1_b32 s21, 0
	s_cselect_b32 s22, -1, 0
	s_and_b32 vcc_lo, exec_lo, s22
	s_cbranch_vccnz .LBB0_10
; %bb.9:                                ;   in Loop: Header=BB0_8 Depth=2
	v_ashrrev_i32_e32 v1, 31, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[1:2], 2, v[0:1]
	v_add_co_u32 v1, vcc_lo, s10, v1
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v2, vcc_lo, s11, v2, vcc_lo
	global_load_b32 v1, v[1:2], off
	s_waitcnt vmcnt(0)
	v_add_nc_u32_e32 v9, v1, v9
.LBB0_10:                               ;   in Loop: Header=BB0_8 Depth=2
	s_lshr_b32 s22, s21, 31
	v_add_nc_u32_e32 v0, 1, v0
	s_add_i32 s21, s21, s22
	s_add_i32 s20, s20, -1
	s_ashr_i32 s21, s21, 1
	s_cmp_eq_u32 s20, 0
	s_cbranch_scc0 .LBB0_8
.LBB0_11:                               ; %Flow114
                                        ;   in Loop: Header=BB0_6 Depth=1
	s_lshl_b64 s[20:21], s[12:13], 2
	s_delay_alu instid0(SALU_CYCLE_1)
	s_add_u32 s20, s0, s20
	s_addc_u32 s21, s1, s21
	global_load_b64 v[0:1], v8, s[20:21]
	s_waitcnt vmcnt(0)
	v_cmp_ne_u32_e32 vcc_lo, v0, v1
	s_cbranch_vccz .LBB0_38
; %bb.12:                               ;   in Loop: Header=BB0_6 Depth=1
	v_cmp_le_i32_e32 vcc_lo, v1, v0
	v_mov_b32_e32 v2, -1
	s_cbranch_vccnz .LBB0_18
; %bb.13:                               ; %.lr.ph.i.i.preheader
                                        ;   in Loop: Header=BB0_6 Depth=1
	s_mov_b32 s20, 0
                                        ; implicit-def: $sgpr21
.LBB0_14:                               ; %.lr.ph.i.i
                                        ;   Parent Loop BB0_6 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	v_sub_nc_u32_e32 v2, v1, v0
	s_or_b32 s21, s21, exec_lo
	s_mov_b32 s22, exec_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v2, 1, v2
	v_add_nc_u32_e32 v2, v2, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_lo_u32 v3, v2, s6
	v_ashrrev_i32_e32 v4, 31, v3
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[3:4], 2, v[3:4]
	v_add_co_u32 v3, vcc_lo, s16, v3
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v4, vcc_lo, s17, v4, vcc_lo
	global_load_b32 v3, v[3:4], off
	s_waitcnt vmcnt(0)
	v_cmpx_ne_u32_e64 v3, v9
; %bb.15:                               ;   in Loop: Header=BB0_14 Depth=2
	v_cmp_lt_i32_e32 vcc_lo, v3, v9
	v_add_nc_u32_e32 v4, 1, v2
	s_and_not1_b32 s21, s21, exec_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_dual_cndmask_b32 v1, v2, v1 :: v_dual_cndmask_b32 v0, v0, v4
	v_mov_b32_e32 v2, -1
	v_cmp_le_i32_e32 vcc_lo, v1, v0
	s_and_b32 s23, vcc_lo, exec_lo
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_b32 s21, s21, s23
; %bb.16:                               ; %Flow109
                                        ;   in Loop: Header=BB0_14 Depth=2
	s_or_b32 exec_lo, exec_lo, s22
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s22, exec_lo, s21
	s_or_b32 s20, s22, s20
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_not1_b32 exec_lo, exec_lo, s20
	s_cbranch_execnz .LBB0_14
; %bb.17:                               ; %Flow110
                                        ;   in Loop: Header=BB0_6 Depth=1
	s_or_b32 exec_lo, exec_lo, s20
.LBB0_18:                               ; %_Z7bsearchiPiiii.exit.i
                                        ;   in Loop: Header=BB0_6 Depth=1
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	s_mov_b32 s20, exec_lo
	v_cmpx_ne_u32_e32 -1, v2
	s_cbranch_execz .LBB0_37
; %bb.19:                               ; %.preheader92.preheader.i
                                        ;   in Loop: Header=BB0_6 Depth=1
	v_add_nc_u32_e32 v0, -1, v2
	v_mul_lo_u32 v1, s6, v2
	v_min_i32_e32 v3, 0, v2
	s_mov_b32 s21, 0
	s_mov_b32 s22, s14
	v_mul_lo_u32 v0, s6, v0
                                        ; implicit-def: $sgpr23
.LBB0_20:                               ; %.preheader92.i
                                        ;   Parent Loop BB0_6 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	s_delay_alu instid0(VALU_DEP_2)
	v_mov_b32_e32 v10, v3
	s_or_b32 s23, s23, exec_lo
	s_mov_b32 s24, exec_lo
                                        ; implicit-def: $vgpr4
	v_cmpx_lt_i32_e32 0, v2
	s_cbranch_execz .LBB0_22
; %bb.21:                               ;   in Loop: Header=BB0_20 Depth=2
	v_add_nc_u32_e32 v4, s22, v1
	s_delay_alu instid0(VALU_DEP_4) | instskip(SKIP_2) | instid1(VALU_DEP_2)
	v_add_nc_u32_e32 v10, s22, v0
	s_and_not1_b32 s23, s23, exec_lo
	s_sub_i32 s22, s22, s6
	v_ashrrev_i32_e32 v5, 31, v4
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_ashrrev_i32_e32 v11, 31, v10
	v_lshlrev_b64 v[4:5], 2, v[4:5]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_lshlrev_b64 v[10:11], 2, v[10:11]
	v_add_co_u32 v4, vcc_lo, s18, v4
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_ci_u32_e32 v5, vcc_lo, s19, v5, vcc_lo
	v_add_co_u32 v10, vcc_lo, s18, v10
	s_delay_alu instid0(VALU_DEP_4)
	v_add_co_ci_u32_e32 v11, vcc_lo, s19, v11, vcc_lo
	s_clause 0x1
	global_load_b32 v4, v[4:5], off
	global_load_b32 v5, v[10:11], off
	v_mov_b32_e32 v10, v2
	s_waitcnt vmcnt(0)
	v_cmp_ne_u32_e32 vcc_lo, v4, v5
	v_add_nc_u32_e32 v4, -1, v2
	s_and_b32 s25, vcc_lo, exec_lo
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_b32 s23, s23, s25
.LBB0_22:                               ; %Flow105
                                        ;   in Loop: Header=BB0_20 Depth=2
	s_or_b32 exec_lo, exec_lo, s24
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	v_mov_b32_e32 v2, v4
	s_and_b32 s24, exec_lo, s23
	s_or_b32 s21, s24, s21
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_not1_b32 exec_lo, exec_lo, s21
	s_cbranch_execnz .LBB0_20
; %bb.23:                               ; %.critedge.i
                                        ;   in Loop: Header=BB0_6 Depth=1
	s_or_b32 exec_lo, exec_lo, s21
	v_cmp_gt_i32_e32 vcc_lo, s4, v10
	s_and_b32 exec_lo, exec_lo, vcc_lo
	s_cbranch_execz .LBB0_37
; %bb.24:                               ; %.lr.ph107.i.preheader
                                        ;   in Loop: Header=BB0_6 Depth=1
	v_mul_lo_u32 v0, s6, v10
	s_mov_b32 s21, 0
                                        ; implicit-def: $sgpr22
.LBB0_25:                               ; %.lr.ph107.i
                                        ;   Parent Loop BB0_6 Depth=1
                                        ; =>  This Loop Header: Depth=2
                                        ;       Child Loop BB0_28 Depth 3
	v_mad_u64_u32 v[1:2], null, v10, s6, s[14:15]
	s_or_b32 s22, s22, exec_lo
	s_mov_b32 s23, exec_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v2, 31, v1
	v_lshlrev_b64 v[2:3], 2, v[1:2]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v2, vcc_lo, s8, v2
	v_add_co_ci_u32_e32 v3, vcc_lo, s9, v3, vcc_lo
	global_load_b32 v1, v[2:3], off offset:4
	s_waitcnt vmcnt(0)
	v_cmpx_eq_u32_e64 v1, v9
	s_cbranch_execz .LBB0_36
; %bb.26:                               ; %.preheader.i
                                        ;   in Loop: Header=BB0_25 Depth=2
	s_and_not1_b32 vcc_lo, exec_lo, s5
	s_cbranch_vccnz .LBB0_32
; %bb.27:                               ; %.lr.ph103.i.preheader
                                        ;   in Loop: Header=BB0_25 Depth=2
	v_ashrrev_i32_e32 v1, 31, v0
	s_mov_b32 s26, 1
	s_mov_b32 s25, 0
                                        ; implicit-def: $sgpr27
                                        ; implicit-def: $sgpr24
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[4:5], 2, v[0:1]
	v_add_co_u32 v4, vcc_lo, s8, v4
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v5, vcc_lo, s9, v5, vcc_lo
.LBB0_28:                               ; %.lr.ph103.i
                                        ;   Parent Loop BB0_6 Depth=1
                                        ;     Parent Loop BB0_25 Depth=2
                                        ; =>    This Inner Loop Header: Depth=3
	global_load_b32 v1, v[4:5], off
	s_or_b32 s27, s27, exec_lo
	s_mov_b32 s28, exec_lo
	s_waitcnt vmcnt(0)
	v_cmpx_ne_u32_e32 -1, v1
	s_cbranch_execz .LBB0_30
; %bb.29:                               ;   in Loop: Header=BB0_28 Depth=3
	v_add3_u32 v11, v7, s26, -1
	s_and_not1_b32 s27, s27, exec_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v12, 31, v11
	v_lshlrev_b64 v[11:12], 2, v[11:12]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v11, vcc_lo, s10, v11
	v_add_co_ci_u32_e32 v12, vcc_lo, s11, v12, vcc_lo
	global_load_b32 v11, v[11:12], off
	s_waitcnt vmcnt(0)
	v_cmp_eq_u32_e32 vcc_lo, v1, v11
	s_and_b32 s29, vcc_lo, exec_lo
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_b32 s27, s27, s29
.LBB0_30:                               ;   in Loop: Header=BB0_28 Depth=3
	s_or_b32 exec_lo, exec_lo, s28
	s_cmp_ge_i32 s26, s7
	v_add_co_u32 v4, vcc_lo, v4, 4
	s_cselect_b32 s28, -1, 0
	s_xor_b32 s29, s27, -1
	s_add_i32 s26, s26, 1
	s_or_b32 s28, s29, s28
	v_add_co_ci_u32_e32 v5, vcc_lo, 0, v5, vcc_lo
	s_and_b32 s28, exec_lo, s28
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_2) | instid1(SALU_CYCLE_1)
	s_or_b32 s25, s28, s25
	s_and_not1_b32 s24, s24, exec_lo
	s_and_b32 s28, s27, exec_lo
	s_or_b32 s24, s24, s28
	s_and_not1_b32 exec_lo, exec_lo, s25
	s_cbranch_execnz .LBB0_28
; %bb.31:                               ; %._crit_edge104.i
                                        ;   in Loop: Header=BB0_25 Depth=2
	s_or_b32 exec_lo, exec_lo, s25
	s_branch .LBB0_33
.LBB0_32:                               ;   in Loop: Header=BB0_25 Depth=2
	s_mov_b32 s24, -1
.LBB0_33:                               ; %Flow
                                        ;   in Loop: Header=BB0_25 Depth=2
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_saveexec_b32 s25, s24
	s_cbranch_execz .LBB0_35
; %bb.34:                               ; %.critedge111.i
                                        ;   in Loop: Header=BB0_25 Depth=2
	global_load_b32 v1, v[2:3], off offset:-4
	s_waitcnt vmcnt(0)
	v_add_nc_u32_e32 v1, v1, v6
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_ashrrev_i32_e32 v2, 31, v1
	v_add_co_u32 v1, vcc_lo, s2, v1
	v_add_co_ci_u32_e32 v2, vcc_lo, s3, v2, vcc_lo
	global_load_u8 v3, v[1:2], off
	s_waitcnt vmcnt(0)
	v_add_nc_u16 v3, v3, 1
	global_store_b8 v[1:2], v3, off
.LBB0_35:                               ;   in Loop: Header=BB0_25 Depth=2
	s_or_b32 exec_lo, exec_lo, s25
	v_add_nc_u32_e32 v10, 1, v10
	v_add_nc_u32_e32 v0, s6, v0
	s_and_not1_b32 s22, s22, exec_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	v_cmp_le_i32_e32 vcc_lo, s4, v10
	s_and_b32 s24, vcc_lo, exec_lo
	s_or_b32 s22, s22, s24
.LBB0_36:                               ; %Flow101
                                        ;   in Loop: Header=BB0_25 Depth=2
	s_or_b32 exec_lo, exec_lo, s23
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s23, exec_lo, s22
	s_or_b32 s21, s23, s21
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_not1_b32 exec_lo, exec_lo, s21
	s_cbranch_execnz .LBB0_25
.LBB0_37:                               ; %Flow106
                                        ;   in Loop: Header=BB0_6 Depth=1
	s_or_b32 exec_lo, exec_lo, s20
.LBB0_38:                               ; %.critedge2.i
                                        ;   in Loop: Header=BB0_6 Depth=1
	s_add_i32 s12, s12, 1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmp_lg_u32 s12, s15
	s_cbranch_scc1 .LBB0_6
.LBB0_39:                               ; %_Z19process_transactioniPiiiiS_iiS_iPci.exit
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z20process_batch_kerneliPiiiiS_iiS_iPci
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 336
		.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 13
		.amdhsa_next_free_sgpr 30
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end0:
	.size	_Z20process_batch_kerneliPiiiiS_iiS_iPci, .Lfunc_end0-_Z20process_batch_kerneliPiiiiS_iiS_iPci
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 1376
; NumSgprs: 32
; NumVgprs: 13
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 3
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 32
; NumVGPRsForWavesPerEU: 13
; Occupancy: 16
; WaveLimiterHint : 1
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgpu_metadata
---
amdhsa.kernels:
  - .args:
      - .offset:         0
        .size:           4
        .value_kind:     by_value
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .offset:         16
        .size:           4
        .value_kind:     by_value
      - .offset:         20
        .size:           4
        .value_kind:     by_value
      - .offset:         24
        .size:           4
        .value_kind:     by_value
      - .address_space:  global
        .offset:         32
        .size:           8
        .value_kind:     global_buffer
      - .offset:         40
        .size:           4
        .value_kind:     by_value
      - .offset:         44
        .size:           4
        .value_kind:     by_value
      - .address_space:  global
        .offset:         48
        .size:           8
        .value_kind:     global_buffer
      - .offset:         56
        .size:           4
        .value_kind:     by_value
      - .address_space:  global
        .offset:         64
        .size:           8
        .value_kind:     global_buffer
      - .offset:         72
        .size:           4
        .value_kind:     by_value
      - .offset:         80
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         84
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         88
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         92
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         94
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         96
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         98
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         100
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         102
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         120
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         128
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         136
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         144
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 336
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z20process_batch_kerneliPiiiiS_iiS_iPci
    .private_segment_fixed_size: 0
    .sgpr_count:     32
    .sgpr_spill_count: 0
    .symbol:         _Z20process_batch_kerneliPiiiiS_iiS_iPci.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     13
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
