/******************************************


 *******************************************/


#include <time.h>
#include <stdio.h>
#include <limits.h>

#define BLOCK_SIZE 32
void run_test();
//----------
#define gpuErrchk(ans) { gpuAssert((ans), __FILE__, __LINE__); }
inline void gpuAssert(cudaError_t code, const char *file, int line, bool abort=true)
{
    if (code != cudaSuccess)
    {
        printf("GPUassert: %s %s %d\n", cudaGetErrorString(code), file, line);
        if (abort) exit(code);
    }
}
// vector broadcast general except first dimension(x)

__global__ void broadcast_multi(float *x,float *y, float *z,
                                int *stride_x, int *stride_y,
                                int *stride_z,int N_z, int dimlen_z) {
    // ,int dimlen_z
    // const int dimlen_z=3;
    int index_z = threadIdx.x + (blockIdx.x * blockDim.x);
    int index_x,index_y;
    // int coords[dimlen_z];
    // int* coords = (int*)malloc(sizeof(int)*dimlen_z);
    int coords;

    int temp_index;
    while (index_z < N_z) {
        temp_index = index_z;
        index_x =0;
        index_y = 0;
        // n multiple of 2
        // (i/n) == (i>>log2(n))
        // we can place foo%n==foo&(n-1) if second dim is multiple of 2
        //try unsigned int

        for (int i=dimlen_z-1; i>0; i--)
        {
            coords = temp_index / (stride_z[i]);
            index_x+= stride_x[i]*coords;
            index_y+= stride_y[i]*coords;
            temp_index = temp_index %(stride_z[i]);
        }
            index_x+= temp_index;
            index_y+= temp_index;

        // for (int i=dimlen_z-1; i>=0; i--)
        // {
        //     coords = temp_index /(stride_z[i]);
        //     index_x+= stride_x[i]*coords;
        //     index_y+= stride_y[i]*coords;
        //     temp_index = temp_index &(stride_z[i]-1);
        // }
        // index_x =0;
        // index_y = 0;

        // z[index_z] = x[index_x]+y[index_y];
        z[index_z] = x[index_z]+y[index_z];

        index_z+=(blockDim.x * gridDim.x);

    }

}

int main(void)
{

    // int A_dimsizes[5] = {28,28,1344,4,4};
    // int A_len = 5;
    // int brdcastdim = 3;
    // for(int i = 0; i<10; i++)
    {
        run_test();
    }
    // run_test(100,10,1);

}


void run_test()
{
  // int stride_A[3] = {1,1,64};
  // // row stride
  // int stride_B[3] = {1,10,0};
  // int stride_Z[3] = {1,10,640};
  // int dimlen_z = 3;
  //
    const int A_len = 6;
    int A_dimsizes[A_len] = {50,50,20,40,4,4};
    int B_dimsizes[A_len] = {50,50,20,40,4,4};
    int A_strides[A_len];
    int A_N=1;

    A_strides[0]=1;
    int k=1;
    for (int i=0; i<A_len-1; i++)
    {
        k*=A_dimsizes[i];
        A_strides[i+1]=k;
        A_N*=A_dimsizes[i];
    }
    A_N*=A_dimsizes[A_len-1];


    // int B_dimsizes[A_len] = {28,28,1344,4,4};
    int B_len = A_len;
    int B_strides[B_len];
    int B_N=1;

    B_strides[0]=1;
    k=1;
    for (int i=0; i<B_len-1; i++)
    {
        k*=B_dimsizes[i];
        B_strides[i+1]=k;
        B_N*=B_dimsizes[i];
    }
    B_N*=B_dimsizes[A_len-1];

    for (int i=0; i<B_len; i++)
    {
        if (B_dimsizes[i]!=A_dimsizes[i])
        {
            if (B_dimsizes[i]==1)
            {
              B_strides[i]=0;
            }
            else{
              A_strides[i]=0;
            }

        }
    }
    int C_N = 1;
    int C_dimsizes[A_len];

    for (int i=0; i<B_len; i++)
    {

            if (B_dimsizes[i]>=A_dimsizes[i])
            {
                C_dimsizes[i]=B_dimsizes[i];
                C_N*=B_dimsizes[i];
            }
            else{
                C_dimsizes[i]=A_dimsizes[i];
                C_N*=A_dimsizes[i];
            }


    }

    int C_strides[A_len];
    C_strides[0]=1;
    k=1;
    for (int i=0; i<A_len-1; i++)
    {
        k*=C_dimsizes[i];
        C_strides[i+1]=k;
    }
    // C_N*=C_dimsizes[A_len-1];



    // we will broadcast to third dim (z)
    // // int brdcastdim = 3;
    // int brdcastdimstride = A_strides[brdcastdim-1];
    // int brdcastnextstride = A_strides[brdcastdim];
    // int multidimsize=1;

    // for (int i=brdcastdim; i<A_len; i++)
    // {
    //     multidimsize*=A_dimsizes[i];
    // }
    // int B_N=A_dimsizes[brdcastdim-1];

    float *A, *B,*C, *d_A, *d_B, *d_C;
    int *d_stride_A, *d_stride_B, *d_stride_C;
    A = (float*)malloc(A_N*sizeof(float));
    B = (float*)malloc(B_N*sizeof(float));
    C = (float*)malloc(C_N*sizeof(float));

    cudaMalloc(&d_A, A_N*sizeof(float));
    cudaMalloc(&d_B, B_N*sizeof(float));
    cudaMalloc(&d_C, C_N*sizeof(float));
    cudaMalloc(&d_stride_A, B_len*sizeof(int));
    cudaMalloc(&d_stride_B, B_len*sizeof(int));
    cudaMalloc(&d_stride_C, B_len*sizeof(int));
    // cudaMalloc(&d_coords, A_len*sizeof(int));

    for (int i = 0; i < A_N; i++) {
        A[i] = 1;

    }
    for (int i = 0; i < B_N; i++) {
        B[i] = 2;
    }

    cudaEvent_t start, stop;
    cudaEventCreate(&start);
    cudaEventCreate(&stop);
    gpuErrchk(cudaMemcpy(d_A, A, A_N*sizeof(float), cudaMemcpyHostToDevice));
    gpuErrchk(cudaMemcpy(d_B, B, B_N*sizeof(float), cudaMemcpyHostToDevice));
    gpuErrchk(cudaMemcpy(d_C, C, C_N*sizeof(float), cudaMemcpyHostToDevice));
    gpuErrchk(cudaMemcpy(d_stride_A, A_strides, A_len*sizeof(int), cudaMemcpyHostToDevice));
    gpuErrchk(cudaMemcpy(d_stride_B, B_strides, A_len*sizeof(int), cudaMemcpyHostToDevice));
    gpuErrchk(cudaMemcpy(d_stride_C, C_strides, A_len*sizeof(int), cudaMemcpyHostToDevice));

    cudaEventRecord(start);


    int ITER=10;
    for (int i=0; i<ITER; i++)
    {

      broadcast_multi<<<256,256>>>(d_A,d_B, d_C,
       d_stride_A, d_stride_B,
       d_stride_C,C_N,A_len);

    }
    cudaEventRecord(stop);
    cudaEventSynchronize(stop);
    float milliseconds = 0;
    cudaEventElapsedTime(&milliseconds, start, stop);
    milliseconds = milliseconds/ITER;


    gpuErrchk(cudaMemcpy(C, d_C, C_N*sizeof(float), cudaMemcpyDeviceToHost));


    int maxError = 0;

    for (int i = 0; i < C_N; i++)
    {
          if(C[i]!=3)
          {
              maxError+=1;
              printf("error value %d index  %d \n",C[i],i);
          }
    }

    for (int i = 0; i < A_len; i++)
    {
              printf("Astride %d : %d \n",i,A_strides[i]);
    }
    for (int i = 0; i < A_len; i++)
    {
              printf("Bstride %d : %d \n",i,B_strides[i]);
    }
    for (int i = 0; i < A_len; i++)
    {
              printf("Cstride %d : %d \n",i,C_strides[i]);
    }
    for (int i = 0; i < A_len; i++)
    {
              printf("C_dimsizes %d : %d \n",i,C_dimsizes[i]);
    }



    if (maxError!=0)
    {
        printf("Max error: %d\n", maxError);
    }
    double total_data = (((double)A_N)+(double)B_N+(double)C_N)*4;
    double gflop = (A_N)/(milliseconds*1e6);
    // printf("total data: %f\n size1 %f\n size2\n", total_data,size1);
    // printf("milliseconds: %f\n", milliseconds);
    //gflop
    // printf("%f\n", gflop);
    // Effective Bandwidth
    printf("Effective Bandwidth %f\n", total_data/milliseconds/1e6);
}
	.file	"tmpxft_0034f559_00000000-6_broadcastBW.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2032:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2032:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata._Z9gpuAssert9cudaErrorPKcib.str1.1,"aMS",@progbits,1
.LC0:
	.string	"GPUassert: %s %s %d\n"
	.section	.text._Z9gpuAssert9cudaErrorPKcib,"axG",@progbits,_Z9gpuAssert9cudaErrorPKcib,comdat
	.weak	_Z9gpuAssert9cudaErrorPKcib
	.type	_Z9gpuAssert9cudaErrorPKcib, @function
_Z9gpuAssert9cudaErrorPKcib:
.LFB2027:
	.cfi_startproc
	endbr64
	testl	%edi, %edi
	je	.L8
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movq	%rsi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movl	%ecx, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movl	%edi, %ebx
	subq	$16, %rsp
	.cfi_def_cfa_offset 48
	movl	%edx, 12(%rsp)
	call	cudaGetErrorString@PLT
	movl	12(%rsp), %r8d
	movq	%r12, %rcx
	leaq	.LC0(%rip), %rsi
	movq	%rax, %rdx
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	testb	%bpl, %bpl
	je	.L2
	movl	%ebx, %edi
	call	exit@PLT
.L2:
	addq	$16, %rsp
	.cfi_def_cfa_offset 32
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L8:
	.cfi_restore 3
	.cfi_restore 6
	.cfi_restore 12
	ret
	.cfi_endproc
.LFE2027:
	.size	_Z9gpuAssert9cudaErrorPKcib, .-_Z9gpuAssert9cudaErrorPKcib
	.text
	.globl	_Z49__device_stub__Z15broadcast_multiPfS_S_PiS0_S0_iiPfS_S_PiS0_S0_ii
	.type	_Z49__device_stub__Z15broadcast_multiPfS_S_PiS0_S0_iiPfS_S_PiS0_S0_ii, @function
_Z49__device_stub__Z15broadcast_multiPfS_S_PiS0_S0_iiPfS_S_PiS0_S0_ii:
.LFB2054:
	.cfi_startproc
	endbr64
	subq	$200, %rsp
	.cfi_def_cfa_offset 208
	movq	%rdi, 40(%rsp)
	leaq	72(%rsp), %rdi
	movq	%rsi, 32(%rsp)
	leaq	84(%rsp), %rsi
	movq	%rdx, 24(%rsp)
	leaq	56(%rsp), %rdx
	movq	%rcx, 16(%rsp)
	leaq	64(%rsp), %rcx
	movq	%r8, 8(%rsp)
	movq	%r9, (%rsp)
	movq	%fs:40, %rax
	movq	%rax, 184(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rax
	movl	$1, 80(%rsp)
	movq	%rax, 120(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 128(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 136(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 144(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 152(%rsp)
	movq	%rsp, %rax
	movq	%rax, 160(%rsp)
	leaq	208(%rsp), %rax
	movq	%rax, 168(%rsp)
	leaq	216(%rsp), %rax
	movq	%rax, 176(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 72(%rsp)
	movq	%rax, 84(%rsp)
	movl	$1, 92(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L12
	pushq	64(%rsp)
	.cfi_def_cfa_offset 216
	leaq	_Z15broadcast_multiPfS_S_PiS0_S0_ii(%rip), %rdi
	pushq	64(%rsp)
	.cfi_def_cfa_offset 224
	movq	100(%rsp), %rcx
	movl	108(%rsp), %r8d
	movq	88(%rsp), %rsi
	movl	96(%rsp), %edx
	leaq	136(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 216
	popq	%rdx
	.cfi_def_cfa_offset 208
.L12:
	movq	184(%rsp), %rax
	subq	%fs:40, %rax
	je	.L14
	call	__stack_chk_fail@PLT
.L14:
	addq	$200, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2054:
	.size	_Z49__device_stub__Z15broadcast_multiPfS_S_PiS0_S0_iiPfS_S_PiS0_S0_ii, .-_Z49__device_stub__Z15broadcast_multiPfS_S_PiS0_S0_iiPfS_S_PiS0_S0_ii
	.globl	_Z15broadcast_multiPfS_S_PiS0_S0_ii
	.type	_Z15broadcast_multiPfS_S_PiS0_S0_ii, @function
_Z15broadcast_multiPfS_S_PiS0_S0_ii:
.LFB2055:
	.cfi_startproc
	endbr64
	jmp	_Z49__device_stub__Z15broadcast_multiPfS_S_PiS0_S0_iiPfS_S_PiS0_S0_ii
	.cfi_endproc
.LFE2055:
	.size	_Z15broadcast_multiPfS_S_PiS0_S0_ii, .-_Z15broadcast_multiPfS_S_PiS0_S0_ii
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC3:
	.string	"/home/ubuntu/Datasets/stackv2/train-structured/ddikbayir/kepler/master/broadcastBW.cu"
.LC7:
	.string	"error value %d index  %d \n"
.LC8:
	.string	"Astride %d : %d \n"
.LC9:
	.string	"Bstride %d : %d \n"
.LC10:
	.string	"Cstride %d : %d \n"
.LC11:
	.string	"C_dimsizes %d : %d \n"
.LC12:
	.string	"Max error: %d\n"
.LC15:
	.string	"Effective Bandwidth %f\n"
	.text
	.globl	_Z8run_testv
	.type	_Z8run_testv, @function
_Z8run_testv:
.LFB2029:
	.cfi_startproc
	endbr64
	movabsq	$214748364850, %rcx
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movabsq	$171798691860, %rdx
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$280, %rsp
	.cfi_def_cfa_offset 336
	movq	%fs:40, %rax
	movq	%rax, 264(%rsp)
	xorl	%eax, %eax
	leaq	172(%rsp), %rsi
	movq	%rcx, 120(%rsp)
	movabsq	$17179869188, %rax
	movl	$1, 168(%rsp)
	movq	%rdx, 128(%rsp)
	movq	%rax, 136(%rsp)
	movq	%rcx, 144(%rsp)
	leaq	120(%rsp), %rcx
	movq	%rdx, 152(%rsp)
	movl	$1, %edx
	movq	%rax, 160(%rsp)
	xorl	%eax, %eax
.L18:
	imull	(%rax,%rcx), %edx
	movl	%edx, (%rsi,%rax)
	addq	$4, %rax
	cmpq	$20, %rax
	jne	.L18
	leal	0(,%rdx,4), %eax
	leaq	144(%rsp), %rsi
	movl	$1, 240(%rsp)
	movl	$1, %edx
	movl	%eax, 8(%rsp)
	leaq	244(%rsp), %rdi
	xorl	%eax, %eax
.L19:
	imull	(%rax,%rsi), %edx
	movl	%edx, (%rdi,%rax)
	addq	$4, %rax
	cmpq	$20, %rax
	jne	.L19
	leal	0(,%rdx,4), %eax
	movl	%eax, 12(%rsp)
	xorl	%eax, %eax
.L22:
	movl	(%rsi,%rax), %edx
	cmpl	(%rcx,%rax), %edx
	je	.L20
	decl	%edx
	jne	.L21
	xorl	%r8d, %r8d
	movl	%r8d, 240(%rsp,%rax)
	jmp	.L20
.L21:
	xorl	%edi, %edi
	movl	%edi, 168(%rsp,%rax)
.L20:
	addq	$4, %rax
	cmpq	$24, %rax
	jne	.L22
	xorl	%eax, %eax
	movl	$1, %ebx
	leaq	192(%rsp), %r12
.L25:
	movl	(%rsi,%rax), %edx
	movl	(%rcx,%rax), %edi
	cmpl	%edi, %edx
	jl	.L23
	imull	%edx, %ebx
	jmp	.L24
.L23:
	imull	%edi, %ebx
	movl	%edi, %edx
.L24:
	movl	%edx, (%rax,%r12)
	addq	$4, %rax
	cmpq	$24, %rax
	jne	.L25
	xorl	%eax, %eax
	movl	$1, %edx
	movl	$1, 216(%rsp)
	leaq	220(%rsp), %rcx
.L26:
	imull	(%r12,%rax), %edx
	movl	%edx, (%rcx,%rax)
	addq	$4, %rax
	cmpq	$20, %rax
	jne	.L26
	movslq	8(%rsp), %rbp
	salq	$2, %rbp
	movq	%rbp, %rdi
	call	malloc@PLT
	movslq	12(%rsp), %r13
	movq	%rax, %r15
	salq	$2, %r13
	movq	%r13, %rdi
	call	malloc@PLT
	movq	%rax, %r14
	movslq	%ebx, %rax
	salq	$2, %rax
	movq	%rax, %rdi
	movq	%rax, (%rsp)
	call	malloc@PLT
	leaq	32(%rsp), %rdi
	movq	%rbp, %rsi
	movq	%rax, 16(%rsp)
	call	cudaMalloc@PLT
	leaq	40(%rsp), %rdi
	movq	%r13, %rsi
	call	cudaMalloc@PLT
	movq	(%rsp), %rsi
	leaq	48(%rsp), %rdi
	call	cudaMalloc@PLT
	leaq	56(%rsp), %rdi
	movl	$24, %esi
	call	cudaMalloc@PLT
	leaq	64(%rsp), %rdi
	movl	$24, %esi
	call	cudaMalloc@PLT
	leaq	72(%rsp), %rdi
	movl	$24, %esi
	call	cudaMalloc@PLT
	movss	.LC1(%rip), %xmm0
	xorl	%eax, %eax
.L27:
	cmpl	%eax, 8(%rsp)
	jle	.L58
	movss	%xmm0, (%r15,%rax,4)
	incq	%rax
	jmp	.L27
.L58:
	movss	.LC2(%rip), %xmm0
	xorl	%eax, %eax
.L29:
	cmpl	%eax, 12(%rsp)
	jle	.L59
	movss	%xmm0, (%r14,%rax,4)
	incq	%rax
	jmp	.L29
.L59:
	leaq	80(%rsp), %rdi
	call	cudaEventCreate@PLT
	leaq	88(%rsp), %rdi
	call	cudaEventCreate@PLT
	movq	32(%rsp), %rdi
	movq	%rbp, %rdx
	movq	%r15, %rsi
	movl	$1, %ecx
	leaq	.LC3(%rip), %rbp
	movl	$10, %r15d
	call	cudaMemcpy@PLT
	movq	%rbp, %rsi
	movl	$1, %ecx
	movl	$212, %edx
	movl	%eax, %edi
	call	_Z9gpuAssert9cudaErrorPKcib
	movq	40(%rsp), %rdi
	movq	%r13, %rdx
	movq	%r14, %rsi
	movl	$1, %ecx
	leaq	168(%rsp), %r14
	leaq	240(%rsp), %r13
	call	cudaMemcpy@PLT
	movq	%rbp, %rsi
	movl	$1, %ecx
	movl	$213, %edx
	movl	%eax, %edi
	call	_Z9gpuAssert9cudaErrorPKcib
	movq	(%rsp), %rdx
	movq	16(%rsp), %rsi
	movl	$1, %ecx
	movq	48(%rsp), %rdi
	call	cudaMemcpy@PLT
	movq	%rbp, %rsi
	movl	$1, %ecx
	movl	$214, %edx
	movl	%eax, %edi
	call	_Z9gpuAssert9cudaErrorPKcib
	movq	56(%rsp), %rdi
	movl	$1, %ecx
	movq	%r14, %rsi
	movl	$24, %edx
	call	cudaMemcpy@PLT
	movq	%rbp, %rsi
	movl	$1, %ecx
	movl	$215, %edx
	movl	%eax, %edi
	call	_Z9gpuAssert9cudaErrorPKcib
	movq	64(%rsp), %rdi
	movl	$1, %ecx
	movq	%r13, %rsi
	movl	$24, %edx
	call	cudaMemcpy@PLT
	movq	%rbp, %rsi
	movl	$1, %ecx
	movl	$216, %edx
	movl	%eax, %edi
	call	_Z9gpuAssert9cudaErrorPKcib
	movq	72(%rsp), %rdi
	movl	$1, %ecx
	leaq	216(%rsp), %rax
	movl	$24, %edx
	movq	%rax, %rsi
	movq	%rax, 24(%rsp)
	call	cudaMemcpy@PLT
	movq	%rbp, %rsi
	movl	$1, %ecx
	movl	$217, %edx
	movl	%eax, %edi
	movl	$16777217, %ebp
	call	_Z9gpuAssert9cudaErrorPKcib
	movq	80(%rsp), %rdi
	xorl	%esi, %esi
	salq	$8, %rbp
	call	cudaEventRecord@PLT
.L32:
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	%rbp, %rdx
	movl	$1, %ecx
	movq	%rbp, %rdi
	movl	$1, %esi
	movq	%rbp, 108(%rsp)
	movl	$1, 116(%rsp)
	movq	%rbp, 96(%rsp)
	movl	$1, 104(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L31
	pushq	$6
	.cfi_def_cfa_offset 344
	pushq	%rbx
	.cfi_def_cfa_offset 352
	movq	88(%rsp), %r9
	movq	80(%rsp), %r8
	movq	72(%rsp), %rcx
	movq	64(%rsp), %rdx
	movq	56(%rsp), %rsi
	movq	48(%rsp), %rdi
	call	_Z49__device_stub__Z15broadcast_multiPfS_S_PiS0_S0_iiPfS_S_PiS0_S0_ii
	popq	%rax
	.cfi_def_cfa_offset 344
	popq	%rdx
	.cfi_def_cfa_offset 336
.L31:
	decl	%r15d
	jne	.L32
	movq	88(%rsp), %rdi
	xorl	%esi, %esi
	xorl	%r15d, %r15d
	xorl	%ebp, %ebp
	call	cudaEventRecord@PLT
	movq	88(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	88(%rsp), %rdx
	movq	80(%rsp), %rsi
	leaq	108(%rsp), %rdi
	movl	$0x00000000, 108(%rsp)
	call	cudaEventElapsedTime@PLT
	movq	(%rsp), %rdx
	movq	48(%rsp), %rsi
	movl	$2, %ecx
	movq	16(%rsp), %rdi
	movss	108(%rsp), %xmm0
	divss	.LC5(%rip), %xmm0
	movss	%xmm0, 108(%rsp)
	call	cudaMemcpy@PLT
	movl	$1, %ecx
	movl	$238, %edx
	leaq	.LC3(%rip), %rsi
	movl	%eax, %edi
	call	_Z9gpuAssert9cudaErrorPKcib
.L33:
	cmpl	%r15d, %ebx
	jle	.L60
	movq	16(%rsp), %rax
	movss	(%rax,%r15,4), %xmm0
	ucomiss	.LC6(%rip), %xmm0
	jp	.L43
	je	.L34
.L43:
	movl	%r15d, %edx
	leaq	.LC7(%rip), %rsi
	movb	$1, %al
	incl	%ebp
	movl	$2, %edi
	cvtss2sd	%xmm0, %xmm0
	call	__printf_chk@PLT
.L34:
	incq	%r15
	jmp	.L33
.L60:
	xorl	%r15d, %r15d
.L37:
	movl	(%r14,%r15,4), %ecx
	movl	%r15d, %edx
	leaq	.LC8(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	incq	%r15
	call	__printf_chk@PLT
	cmpq	$6, %r15
	jne	.L37
	xorl	%r15d, %r15d
	leaq	.LC9(%rip), %r14
.L38:
	movl	0(%r13,%r15,4), %ecx
	movl	%r15d, %edx
	movq	%r14, %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	incq	%r15
	call	__printf_chk@PLT
	cmpq	$6, %r15
	jne	.L38
	xorl	%r14d, %r14d
	leaq	.LC10(%rip), %r13
.L39:
	movq	24(%rsp), %rax
	movl	%r14d, %edx
	movq	%r13, %rsi
	movl	$2, %edi
	movl	(%rax,%r14,4), %ecx
	xorl	%eax, %eax
	incq	%r14
	call	__printf_chk@PLT
	cmpq	$6, %r14
	jne	.L39
	xorl	%r14d, %r14d
	leaq	.LC11(%rip), %r13
.L40:
	movl	(%r12,%r14,4), %ecx
	movl	%r14d, %edx
	movq	%r13, %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	incq	%r14
	call	__printf_chk@PLT
	cmpq	$6, %r14
	jne	.L40
	testl	%ebp, %ebp
	je	.L41
	movl	%ebp, %edx
	leaq	.LC12(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L41:
	cvtsi2sdl	12(%rsp), %xmm1
	leaq	.LC15(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	cvtsi2sdl	8(%rsp), %xmm0
	addsd	%xmm1, %xmm0
	cvtsi2sdl	%ebx, %xmm1
	addsd	%xmm1, %xmm0
	mulsd	.LC13(%rip), %xmm0
	cvtss2sd	108(%rsp), %xmm1
	divsd	%xmm1, %xmm0
	divsd	.LC14(%rip), %xmm0
	call	__printf_chk@PLT
	movq	264(%rsp), %rax
	subq	%fs:40, %rax
	je	.L42
	call	__stack_chk_fail@PLT
.L42:
	addq	$280, %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
.LFE2029:
	.size	_Z8run_testv, .-_Z8run_testv
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2028:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	call	_Z8run_testv
	xorl	%eax, %eax
	popq	%rdx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2028:
	.size	main, .-main
	.section	.rodata.str1.1
.LC16:
	.string	"_Z15broadcast_multiPfS_S_PiS0_S0_ii"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2057:
	.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	_Z15broadcast_multiPfS_S_PiS0_S0_ii(%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
.LFE2057:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.section	.rodata.cst4,"aM",@progbits,4
	.align 4
.LC1:
	.long	1065353216
	.align 4
.LC2:
	.long	1073741824
	.align 4
.LC5:
	.long	1092616192
	.align 4
.LC6:
	.long	1077936128
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC13:
	.long	0
	.long	1074790400
	.align 8
.LC14:
	.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 <time.h>
#include <stdio.h>
#include <limits.h>

#define BLOCK_SIZE 32
void run_test();
//----------
#define gpuErrchk(ans) { gpuAssert((ans), __FILE__, __LINE__); }
inline void gpuAssert(hipError_t code, const char *file, int line, bool abort=true)
{
    if (code != hipSuccess)
    {
        printf("GPUassert: %s %s %d\n", hipGetErrorString(code), file, line);
        if (abort) exit(code);
    }
}
// vector broadcast general except first dimension(x)

__global__ void broadcast_multi(float *x,float *y, float *z,
                                int *stride_x, int *stride_y,
                                int *stride_z,int N_z, int dimlen_z) {
    // ,int dimlen_z
    // const int dimlen_z=3;
    int index_z = threadIdx.x + (blockIdx.x * blockDim.x);
    int index_x,index_y;
    // int coords[dimlen_z];
    // int* coords = (int*)malloc(sizeof(int)*dimlen_z);
    int coords;

    int temp_index;
    while (index_z < N_z) {
        temp_index = index_z;
        index_x =0;
        index_y = 0;
        // n multiple of 2
        // (i/n) == (i>>log2(n))
        // we can place foo%n==foo&(n-1) if second dim is multiple of 2
        //try unsigned int

        for (int i=dimlen_z-1; i>0; i--)
        {
            coords = temp_index / (stride_z[i]);
            index_x+= stride_x[i]*coords;
            index_y+= stride_y[i]*coords;
            temp_index = temp_index %(stride_z[i]);
        }
            index_x+= temp_index;
            index_y+= temp_index;

        // for (int i=dimlen_z-1; i>=0; i--)
        // {
        //     coords = temp_index /(stride_z[i]);
        //     index_x+= stride_x[i]*coords;
        //     index_y+= stride_y[i]*coords;
        //     temp_index = temp_index &(stride_z[i]-1);
        // }
        // index_x =0;
        // index_y = 0;

        // z[index_z] = x[index_x]+y[index_y];
        z[index_z] = x[index_z]+y[index_z];

        index_z+=(blockDim.x * gridDim.x);

    }

}

int main(void)
{

    // int A_dimsizes[5] = {28,28,1344,4,4};
    // int A_len = 5;
    // int brdcastdim = 3;
    // for(int i = 0; i<10; i++)
    {
        run_test();
    }
    // run_test(100,10,1);

}


void run_test()
{
  // int stride_A[3] = {1,1,64};
  // // row stride
  // int stride_B[3] = {1,10,0};
  // int stride_Z[3] = {1,10,640};
  // int dimlen_z = 3;
  //
    const int A_len = 6;
    int A_dimsizes[A_len] = {50,50,20,40,4,4};
    int B_dimsizes[A_len] = {50,50,20,40,4,4};
    int A_strides[A_len];
    int A_N=1;

    A_strides[0]=1;
    int k=1;
    for (int i=0; i<A_len-1; i++)
    {
        k*=A_dimsizes[i];
        A_strides[i+1]=k;
        A_N*=A_dimsizes[i];
    }
    A_N*=A_dimsizes[A_len-1];


    // int B_dimsizes[A_len] = {28,28,1344,4,4};
    int B_len = A_len;
    int B_strides[B_len];
    int B_N=1;

    B_strides[0]=1;
    k=1;
    for (int i=0; i<B_len-1; i++)
    {
        k*=B_dimsizes[i];
        B_strides[i+1]=k;
        B_N*=B_dimsizes[i];
    }
    B_N*=B_dimsizes[A_len-1];

    for (int i=0; i<B_len; i++)
    {
        if (B_dimsizes[i]!=A_dimsizes[i])
        {
            if (B_dimsizes[i]==1)
            {
              B_strides[i]=0;
            }
            else{
              A_strides[i]=0;
            }

        }
    }
    int C_N = 1;
    int C_dimsizes[A_len];

    for (int i=0; i<B_len; i++)
    {

            if (B_dimsizes[i]>=A_dimsizes[i])
            {
                C_dimsizes[i]=B_dimsizes[i];
                C_N*=B_dimsizes[i];
            }
            else{
                C_dimsizes[i]=A_dimsizes[i];
                C_N*=A_dimsizes[i];
            }


    }

    int C_strides[A_len];
    C_strides[0]=1;
    k=1;
    for (int i=0; i<A_len-1; i++)
    {
        k*=C_dimsizes[i];
        C_strides[i+1]=k;
    }
    // C_N*=C_dimsizes[A_len-1];



    // we will broadcast to third dim (z)
    // // int brdcastdim = 3;
    // int brdcastdimstride = A_strides[brdcastdim-1];
    // int brdcastnextstride = A_strides[brdcastdim];
    // int multidimsize=1;

    // for (int i=brdcastdim; i<A_len; i++)
    // {
    //     multidimsize*=A_dimsizes[i];
    // }
    // int B_N=A_dimsizes[brdcastdim-1];

    float *A, *B,*C, *d_A, *d_B, *d_C;
    int *d_stride_A, *d_stride_B, *d_stride_C;
    A = (float*)malloc(A_N*sizeof(float));
    B = (float*)malloc(B_N*sizeof(float));
    C = (float*)malloc(C_N*sizeof(float));

    hipMalloc(&d_A, A_N*sizeof(float));
    hipMalloc(&d_B, B_N*sizeof(float));
    hipMalloc(&d_C, C_N*sizeof(float));
    hipMalloc(&d_stride_A, B_len*sizeof(int));
    hipMalloc(&d_stride_B, B_len*sizeof(int));
    hipMalloc(&d_stride_C, B_len*sizeof(int));
    // cudaMalloc(&d_coords, A_len*sizeof(int));

    for (int i = 0; i < A_N; i++) {
        A[i] = 1;

    }
    for (int i = 0; i < B_N; i++) {
        B[i] = 2;
    }

    hipEvent_t start, stop;
    hipEventCreate(&start);
    hipEventCreate(&stop);
    gpuErrchk(hipMemcpy(d_A, A, A_N*sizeof(float), hipMemcpyHostToDevice));
    gpuErrchk(hipMemcpy(d_B, B, B_N*sizeof(float), hipMemcpyHostToDevice));
    gpuErrchk(hipMemcpy(d_C, C, C_N*sizeof(float), hipMemcpyHostToDevice));
    gpuErrchk(hipMemcpy(d_stride_A, A_strides, A_len*sizeof(int), hipMemcpyHostToDevice));
    gpuErrchk(hipMemcpy(d_stride_B, B_strides, A_len*sizeof(int), hipMemcpyHostToDevice));
    gpuErrchk(hipMemcpy(d_stride_C, C_strides, A_len*sizeof(int), hipMemcpyHostToDevice));

    hipEventRecord(start);


    int ITER=10;
    for (int i=0; i<ITER; i++)
    {

      broadcast_multi<<<256,256>>>(d_A,d_B, d_C,
       d_stride_A, d_stride_B,
       d_stride_C,C_N,A_len);

    }
    hipEventRecord(stop);
    hipEventSynchronize(stop);
    float milliseconds = 0;
    hipEventElapsedTime(&milliseconds, start, stop);
    milliseconds = milliseconds/ITER;


    gpuErrchk(hipMemcpy(C, d_C, C_N*sizeof(float), hipMemcpyDeviceToHost));


    int maxError = 0;

    for (int i = 0; i < C_N; i++)
    {
          if(C[i]!=3)
          {
              maxError+=1;
              printf("error value %d index  %d \n",C[i],i);
          }
    }

    for (int i = 0; i < A_len; i++)
    {
              printf("Astride %d : %d \n",i,A_strides[i]);
    }
    for (int i = 0; i < A_len; i++)
    {
              printf("Bstride %d : %d \n",i,B_strides[i]);
    }
    for (int i = 0; i < A_len; i++)
    {
              printf("Cstride %d : %d \n",i,C_strides[i]);
    }
    for (int i = 0; i < A_len; i++)
    {
              printf("C_dimsizes %d : %d \n",i,C_dimsizes[i]);
    }



    if (maxError!=0)
    {
        printf("Max error: %d\n", maxError);
    }
    double total_data = (((double)A_N)+(double)B_N+(double)C_N)*4;
    double gflop = (A_N)/(milliseconds*1e6);
    // printf("total data: %f\n size1 %f\n size2\n", total_data,size1);
    // printf("milliseconds: %f\n", milliseconds);
    //gflop
    // printf("%f\n", gflop);
    // Effective Bandwidth
    printf("Effective Bandwidth %f\n", total_data/milliseconds/1e6);
}
	.text
	.file	"broadcastBW.hip"
	.globl	_Z30__device_stub__broadcast_multiPfS_S_PiS0_S0_ii # -- Begin function _Z30__device_stub__broadcast_multiPfS_S_PiS0_S0_ii
	.type	_Z30__device_stub__broadcast_multiPfS_S_PiS0_S0_ii,@function
_Z30__device_stub__broadcast_multiPfS_S_PiS0_S0_ii: # @_Z30__device_stub__broadcast_multiPfS_S_PiS0_S0_ii
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$160, %rsp
	.cfi_def_cfa_offset 208
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	56(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	48(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	40(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	32(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	24(%rsp), %rcx
	movq	%r8, (%rcx)
	leaq	16(%rsp), %r8
	movq	%r9, (%r8)
	leaq	96(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	movq	%r8, 40(%rbx)
	leaq	208(%rsp), %rax
	movq	%rax, 48(%rbx)
	leaq	216(%rsp), %rax
	movq	%rax, 56(%rbx)
	leaq	80(%rsp), %r14
	leaq	64(%rsp), %r15
	leaq	8(%rsp), %r12
	movq	%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	$_Z15broadcast_multiPfS_S_PiS0_S0_ii, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$176, %rsp
	.cfi_adjust_cfa_offset -176
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	_Z30__device_stub__broadcast_multiPfS_S_PiS0_S0_ii, .Lfunc_end0-_Z30__device_stub__broadcast_multiPfS_S_PiS0_S0_ii
	.cfi_endproc
                                        # -- End function
	.globl	main                            # -- Begin function main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	callq	_Z8run_testv
	xorl	%eax, %eax
	popq	%rcx
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end1:
	.size	main, .Lfunc_end1-main
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst16,"aM",@progbits,16
	.p2align	4, 0x0                          # -- Begin function _Z8run_testv
.LCPI2_0:
	.long	50                              # 0x32
	.long	50                              # 0x32
	.long	20                              # 0x14
	.long	40                              # 0x28
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0
.LCPI2_1:
	.long	0x41200000                      # float 10
.LCPI2_2:
	.long	0x40400000                      # float 3
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0
.LCPI2_3:
	.quad	0x4010000000000000              # double 4
.LCPI2_4:
	.quad	0x412e848000000000              # double 1.0E+6
	.text
	.globl	_Z8run_testv
	.type	_Z8run_testv,@function
_Z8run_testv:                           # @_Z8run_testv
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$280, %rsp                      # imm = 0x118
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movaps	.LCPI2_0(%rip), %xmm0           # xmm0 = [50,50,20,40]
	movaps	%xmm0, -256(%rbp)
	movabsq	$17179869188, %rax              # imm = 0x400000004
	movq	%rax, -240(%rbp)
	movaps	%xmm0, -224(%rbp)
	movq	%rax, -208(%rbp)
	movl	$1, -192(%rbp)
	movl	$1, %r14d
	movl	$1, %eax
	movl	$1, %ecx
.LBB2_1:                                # =>This Inner Loop Header: Depth=1
	movl	-260(%rbp,%rax,4), %edx
	imull	%edx, %ecx
	movl	%ecx, -192(%rbp,%rax,4)
	imull	%edx, %r14d
	incq	%rax
	cmpq	$6, %rax
	jne	.LBB2_1
# %bb.2:
	movq	%rsp, -160(%rbp)                # 8-byte Spill
	movq	%rsp, %rax
	leaq	-32(%rax), %rbx
	movq	%rbx, %rsp
	movl	$1, -32(%rax)
	movl	$1, %eax
	movl	$1, %ecx
	movl	$1, %r15d
.LBB2_3:                                # =>This Inner Loop Header: Depth=1
	movl	-228(%rbp,%rcx,4), %edx
	imull	%edx, %eax
	movl	%eax, (%rbx,%rcx,4)
	imull	%edx, %r15d
	incq	%rcx
	cmpq	$6, %rcx
	jne	.LBB2_3
# %bb.4:
	leal	(,%r14,4), %esi
	xorl	%eax, %eax
	leaq	-192(%rbp), %rcx
.LBB2_5:                                # =>This Inner Loop Header: Depth=1
	movl	-224(%rbp,%rax), %edx
	cmpl	-256(%rbp,%rax), %edx
	je	.LBB2_7
# %bb.6:                                # %.sink.split
                                        #   in Loop: Header=BB2_5 Depth=1
	cmpl	$1, %edx
	movq	%rcx, %rdx
	cmoveq	%rbx, %rdx
	movl	$0, (%rdx,%rax)
.LBB2_7:                                #   in Loop: Header=BB2_5 Depth=1
	addq	$4, %rax
	cmpq	$24, %rax
	jne	.LBB2_5
# %bb.8:
	movl	$1, %r13d
	xorl	%eax, %eax
.LBB2_9:                                # =>This Inner Loop Header: Depth=1
	movl	-224(%rbp,%rax,4), %ecx
	movl	-256(%rbp,%rax,4), %edx
	cmpl	%edx, %ecx
	cmovgl	%ecx, %edx
	movl	%edx, -320(%rbp,%rax,4)
	imull	%edx, %r13d
	incq	%rax
	cmpq	$6, %rax
	jne	.LBB2_9
# %bb.10:
	movl	$1, -288(%rbp)
	movl	$1, %eax
	movl	$1, %ecx
.LBB2_11:                               # =>This Inner Loop Header: Depth=1
	imull	-324(%rbp,%rcx,4), %eax
	movl	%eax, -288(%rbp,%rcx,4)
	incq	%rcx
	cmpq	$6, %rcx
	jne	.LBB2_11
# %bb.12:
	leal	(,%r15,4), %eax
	movl	%eax, -44(%rbp)                 # 4-byte Spill
	movl	%esi, -48(%rbp)                 # 4-byte Spill
	movslq	%esi, %rdi
	shlq	$2, %rdi
	movq	%rdi, -104(%rbp)                # 8-byte Spill
	callq	malloc
	movq	%rax, %r12
	movslq	-44(%rbp), %rdi                 # 4-byte Folded Reload
	shlq	$2, %rdi
	movq	%rdi, -96(%rbp)                 # 8-byte Spill
	callq	malloc
	movq	%rax, -168(%rbp)                # 8-byte Spill
	movslq	%r13d, %rdi
	shlq	$2, %rdi
	movq	%rdi, -56(%rbp)                 # 8-byte Spill
	callq	malloc
	movq	%rax, -64(%rbp)                 # 8-byte Spill
	leaq	-152(%rbp), %rdi
	movq	-104(%rbp), %rsi                # 8-byte Reload
	callq	hipMalloc
	leaq	-144(%rbp), %rdi
	movq	-96(%rbp), %rsi                 # 8-byte Reload
	callq	hipMalloc
	leaq	-80(%rbp), %rdi
	movq	-56(%rbp), %rsi                 # 8-byte Reload
	callq	hipMalloc
	leaq	-136(%rbp), %rdi
	movl	$24, %esi
	callq	hipMalloc
	leaq	-128(%rbp), %rdi
	movl	$24, %esi
	callq	hipMalloc
	leaq	-120(%rbp), %rdi
	movl	$24, %esi
	callq	hipMalloc
	testl	%r14d, %r14d
	jle	.LBB2_15
# %bb.13:                               # %.lr.ph.preheader
	movl	-48(%rbp), %ecx                 # 4-byte Reload
	cmpl	$2, %ecx
	movl	$1, %eax
	cmovgel	%ecx, %eax
	xorl	%ecx, %ecx
.LBB2_14:                               # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movl	$1065353216, (%r12,%rcx,4)      # imm = 0x3F800000
	incq	%rcx
	cmpq	%rcx, %rax
	jne	.LBB2_14
.LBB2_15:                               # %.preheader159
	testl	%r15d, %r15d
	movq	-168(%rbp), %r14                # 8-byte Reload
	jle	.LBB2_18
# %bb.16:                               # %.lr.ph173.preheader
	movl	-44(%rbp), %ecx                 # 4-byte Reload
	cmpl	$2, %ecx
	movl	$1, %eax
	cmovgel	%ecx, %eax
	xorl	%ecx, %ecx
.LBB2_17:                               # %.lr.ph173
                                        # =>This Inner Loop Header: Depth=1
	movl	$1073741824, (%r14,%rcx,4)      # imm = 0x40000000
	incq	%rcx
	cmpq	%rcx, %rax
	jne	.LBB2_17
.LBB2_18:                               # %._crit_edge
	leaq	-112(%rbp), %rdi
	callq	hipEventCreate
	leaq	-72(%rbp), %rdi
	callq	hipEventCreate
	movq	-152(%rbp), %rdi
	movq	%r12, %rsi
	movq	-104(%rbp), %rdx                # 8-byte Reload
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB2_52
# %bb.19:                               # %_Z9gpuAssert10hipError_tPKcib.exit
	movq	-144(%rbp), %rdi
	movq	%r14, %rsi
	movq	-96(%rbp), %rdx                 # 8-byte Reload
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB2_20
# %bb.22:                               # %_Z9gpuAssert10hipError_tPKcib.exit142
	movq	-80(%rbp), %rdi
	movq	-64(%rbp), %rsi                 # 8-byte Reload
	movq	-56(%rbp), %rdx                 # 8-byte Reload
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB2_23
# %bb.24:                               # %_Z9gpuAssert10hipError_tPKcib.exit144
	movq	-136(%rbp), %rdi
	leaq	-192(%rbp), %rsi
	movl	$24, %edx
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB2_25
# %bb.26:                               # %_Z9gpuAssert10hipError_tPKcib.exit146
	movq	-128(%rbp), %rdi
	movl	$24, %edx
	movq	%rbx, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB2_27
# %bb.28:                               # %_Z9gpuAssert10hipError_tPKcib.exit148
	movq	-120(%rbp), %rdi
	leaq	-288(%rbp), %rsi
	movl	$24, %edx
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB2_29
# %bb.48:                               # %_Z9gpuAssert10hipError_tPKcib.exit150
	movabsq	$4294967552, %r15               # imm = 0x100000100
	movq	-112(%rbp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movl	$10, %r14d
.LBB2_49:                               # =>This Inner Loop Header: Depth=1
	movq	%r15, %rdi
	movl	$1, %esi
	movq	%r15, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB2_51
# %bb.50:                               #   in Loop: Header=BB2_49 Depth=1
	movq	-152(%rbp), %rdi
	movq	-144(%rbp), %rsi
	movq	-80(%rbp), %rdx
	movq	-136(%rbp), %rcx
	movq	-128(%rbp), %r8
	movq	-120(%rbp), %r9
	pushq	$6
	pushq	%r13
	callq	_Z30__device_stub__broadcast_multiPfS_S_PiS0_S0_ii
	addq	$16, %rsp
.LBB2_51:                               #   in Loop: Header=BB2_49 Depth=1
	decl	%r14d
	jne	.LBB2_49
# %bb.30:
	movq	-72(%rbp), %rdi
	xorl	%r12d, %r12d
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	-72(%rbp), %rdi
	callq	hipEventSynchronize
	leaq	-84(%rbp), %r15
	movl	$0, (%r15)
	movq	-112(%rbp), %rsi
	movq	-72(%rbp), %rdx
	movq	%r15, %rdi
	callq	hipEventElapsedTime
	movss	(%r15), %xmm0                   # xmm0 = mem[0],zero,zero,zero
	divss	.LCPI2_1(%rip), %xmm0
	movss	%xmm0, (%r15)
	movq	-80(%rbp), %rsi
	movq	-64(%rbp), %rdi                 # 8-byte Reload
	movq	-56(%rbp), %rdx                 # 8-byte Reload
	movl	$2, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB2_47
# %bb.31:                               # %_Z9gpuAssert10hipError_tPKcib.exit152.preheader
	testl	%r13d, %r13d
	jle	.LBB2_36
# %bb.32:                               # %.lr.ph177.preheader
	movl	%r13d, %r14d
	xorl	%r15d, %r15d
	xorl	%r12d, %r12d
.LBB2_33:                               # %.lr.ph177
                                        # =>This Inner Loop Header: Depth=1
	movq	-64(%rbp), %rax                 # 8-byte Reload
	movss	(%rax,%r15,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	ucomiss	.LCPI2_2(%rip), %xmm0
	jne	.LBB2_34
	jnp	.LBB2_35
.LBB2_34:                               #   in Loop: Header=BB2_33 Depth=1
	incl	%r12d
	cvtss2sd	%xmm0, %xmm0
	movl	$.L.str.1, %edi
	movl	%r15d, %esi
	movb	$1, %al
	callq	printf
.LBB2_35:                               # %_Z9gpuAssert10hipError_tPKcib.exit152
                                        #   in Loop: Header=BB2_33 Depth=1
	incq	%r15
	cmpq	%r15, %r14
	jne	.LBB2_33
.LBB2_36:                               # %.preheader158
	xorl	%r14d, %r14d
.LBB2_37:                               # =>This Inner Loop Header: Depth=1
	movl	-192(%rbp,%r14,4), %edx
	movl	$.L.str.2, %edi
	movl	%r14d, %esi
	xorl	%eax, %eax
	callq	printf
	incq	%r14
	cmpq	$6, %r14
	jne	.LBB2_37
# %bb.38:                               # %.preheader157.preheader
	xorl	%r14d, %r14d
.LBB2_39:                               # %.preheader157
                                        # =>This Inner Loop Header: Depth=1
	movl	(%rbx,%r14,4), %edx
	movl	$.L.str.3, %edi
	movl	%r14d, %esi
	xorl	%eax, %eax
	callq	printf
	incq	%r14
	cmpq	$6, %r14
	jne	.LBB2_39
# %bb.40:                               # %.preheader156.preheader
	xorl	%ebx, %ebx
.LBB2_41:                               # %.preheader156
                                        # =>This Inner Loop Header: Depth=1
	movl	-288(%rbp,%rbx,4), %edx
	movl	$.L.str.4, %edi
	movl	%ebx, %esi
	xorl	%eax, %eax
	callq	printf
	incq	%rbx
	cmpq	$6, %rbx
	jne	.LBB2_41
# %bb.42:                               # %.preheader.preheader
	xorl	%ebx, %ebx
.LBB2_43:                               # %.preheader
                                        # =>This Inner Loop Header: Depth=1
	movl	-320(%rbp,%rbx,4), %edx
	movl	$.L.str.5, %edi
	movl	%ebx, %esi
	xorl	%eax, %eax
	callq	printf
	incq	%rbx
	cmpq	$6, %rbx
	jne	.LBB2_43
# %bb.44:
	testl	%r12d, %r12d
	je	.LBB2_46
# %bb.45:
	movl	$.L.str.6, %edi
	movl	%r12d, %esi
	xorl	%eax, %eax
	callq	printf
.LBB2_46:
	xorps	%xmm0, %xmm0
	cvtsi2sdl	-48(%rbp), %xmm0        # 4-byte Folded Reload
	cvtsi2sdl	-44(%rbp), %xmm1        # 4-byte Folded Reload
	addsd	%xmm0, %xmm1
	xorps	%xmm0, %xmm0
	cvtsi2sd	%r13d, %xmm0
	addsd	%xmm1, %xmm0
	mulsd	.LCPI2_3(%rip), %xmm0
	xorps	%xmm1, %xmm1
	cvtss2sd	-84(%rbp), %xmm1
	divsd	%xmm1, %xmm0
	divsd	.LCPI2_4(%rip), %xmm0
	movl	$.L.str.7, %edi
	movb	$1, %al
	callq	printf
	movq	-160(%rbp), %rsp                # 8-byte Reload
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa %rsp, 8
	retq
.LBB2_52:
	.cfi_def_cfa %rbp, 16
	movl	%eax, %r12d
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.8, %edi
	movl	$.L.str, %edx
	movq	%rax, %rsi
	movl	$214, %ecx
	xorl	%eax, %eax
	callq	printf
	movl	%r12d, %edi
	callq	exit
.LBB2_20:
	movl	%eax, %r15d
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.8, %edi
	movl	$.L.str, %edx
	movq	%rax, %rsi
	movl	$215, %ecx
	jmp	.LBB2_21
.LBB2_23:
	movl	%eax, %r15d
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.8, %edi
	movl	$.L.str, %edx
	movq	%rax, %rsi
	movl	$216, %ecx
	jmp	.LBB2_21
.LBB2_25:
	movl	%eax, %r15d
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.8, %edi
	movl	$.L.str, %edx
	movq	%rax, %rsi
	movl	$217, %ecx
	jmp	.LBB2_21
.LBB2_27:
	movl	%eax, %r15d
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.8, %edi
	movl	$.L.str, %edx
	movq	%rax, %rsi
	movl	$218, %ecx
	jmp	.LBB2_21
.LBB2_29:
	movl	%eax, %r15d
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.8, %edi
	movl	$.L.str, %edx
	movq	%rax, %rsi
	movl	$219, %ecx
	jmp	.LBB2_21
.LBB2_47:
	movl	%eax, %r15d
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.8, %edi
	movl	$.L.str, %edx
	movq	%rax, %rsi
	movl	$240, %ecx
.LBB2_21:
	xorl	%eax, %eax
	callq	printf
	movl	%r15d, %edi
	callq	exit
.Lfunc_end2:
	.size	_Z8run_testv, .Lfunc_end2-_Z8run_testv
	.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	.LBB3_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rdi
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB3_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z15broadcast_multiPfS_S_PiS0_S0_ii, %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_end3:
	.size	__hip_module_ctor, .Lfunc_end3-__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	.LBB4_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
.LBB4_2:
	retq
.Lfunc_end4:
	.size	__hip_module_dtor, .Lfunc_end4-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	_Z15broadcast_multiPfS_S_PiS0_S0_ii,@object # @_Z15broadcast_multiPfS_S_PiS0_S0_ii
	.section	.rodata,"a",@progbits
	.globl	_Z15broadcast_multiPfS_S_PiS0_S0_ii
	.p2align	3, 0x0
_Z15broadcast_multiPfS_S_PiS0_S0_ii:
	.quad	_Z30__device_stub__broadcast_multiPfS_S_PiS0_S0_ii
	.size	_Z15broadcast_multiPfS_S_PiS0_S0_ii, 8

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"/home/ubuntu/Datasets/stackv2/train-structured-repos-hip-sm89/ddikbayir/kepler/master/broadcastBW.hip"
	.size	.L.str, 102

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"error value %d index  %d \n"
	.size	.L.str.1, 27

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

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

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

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

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

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"Effective Bandwidth %f\n"
	.size	.L.str.7, 24

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"GPUassert: %s %s %d\n"
	.size	.L.str.8, 21

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

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

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

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym _Z30__device_stub__broadcast_multiPfS_S_PiS0_S0_ii
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Z15broadcast_multiPfS_S_PiS0_S0_ii
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z15broadcast_multiPfS_S_PiS0_S0_ii ; -- Begin function _Z15broadcast_multiPfS_S_PiS0_S0_ii
	.globl	_Z15broadcast_multiPfS_S_PiS0_S0_ii
	.p2align	8
	.type	_Z15broadcast_multiPfS_S_PiS0_S0_ii,@function
_Z15broadcast_multiPfS_S_PiS0_S0_ii:    ; @_Z15broadcast_multiPfS_S_PiS0_S0_ii
; %bb.0:
	s_clause 0x1
	s_load_b32 s4, s[0:1], 0x44
	s_load_b32 s8, s[0:1], 0x30
	s_add_u32 s2, s0, 56
	s_addc_u32 s3, s1, 0
	s_waitcnt lgkmcnt(0)
	s_and_b32 s9, s4, 0xffff
	s_mov_b32 s4, exec_lo
	v_mad_u64_u32 v[1:2], null, s15, s9, v[0:1]
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_gt_i32_e64 s8, v1
	s_cbranch_execz .LBB0_3
; %bb.1:                                ; %.preheader.lr.ph
	s_load_b32 s10, s[2:3], 0x0
	s_clause 0x1
	s_load_b128 s[4:7], s[0:1], 0x0
	s_load_b64 s[2:3], s[0:1], 0x10
	s_waitcnt lgkmcnt(0)
	s_mul_i32 s1, s10, s9
	s_mov_b32 s9, 0
.LBB0_2:                                ; %.preheader
                                        ; =>This Inner Loop Header: Depth=1
	v_ashrrev_i32_e32 v2, 31, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[2:3], 2, v[1:2]
	v_add_co_u32 v4, vcc_lo, s4, v2
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v5, vcc_lo, s5, v3, vcc_lo
	v_add_co_u32 v6, vcc_lo, s6, v2
	v_add_co_ci_u32_e32 v7, vcc_lo, s7, v3, vcc_lo
	v_add_co_u32 v2, s0, s2, v2
	global_load_b32 v0, v[4:5], off
	global_load_b32 v4, v[6:7], off
	v_add_nc_u32_e32 v1, s1, v1
	v_add_co_ci_u32_e64 v3, s0, s3, v3, s0
	s_waitcnt vmcnt(0)
	v_add_f32_e32 v0, v0, v4
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_2) | instid1(SALU_CYCLE_1)
	v_cmp_le_i32_e32 vcc_lo, s8, v1
	global_store_b32 v[2:3], v0, off
	s_or_b32 s9, vcc_lo, s9
	s_and_not1_b32 exec_lo, exec_lo, s9
	s_cbranch_execnz .LBB0_2
.LBB0_3:                                ; %._crit_edge
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z15broadcast_multiPfS_S_PiS0_S0_ii
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 312
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 8
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end0:
	.size	_Z15broadcast_multiPfS_S_PiS0_S0_ii, .Lfunc_end0-_Z15broadcast_multiPfS_S_PiS0_S0_ii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 236
; NumSgprs: 18
; NumVgprs: 8
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 8
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 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:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         24
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         32
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         40
        .size:           8
        .value_kind:     global_buffer
      - .offset:         48
        .size:           4
        .value_kind:     by_value
      - .offset:         52
        .size:           4
        .value_kind:     by_value
      - .offset:         56
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         60
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         64
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         68
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         70
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         72
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         74
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         76
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         78
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         96
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         104
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         112
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         120
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 312
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z15broadcast_multiPfS_S_PiS0_S0_ii
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z15broadcast_multiPfS_S_PiS0_S0_ii.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     8
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
