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


// Hypercube
// Version: pas de mémoire partagée
// On réduit tout sur une dimension à chaque appel (non optimisé pour une mémoire partagée par block)
// Pas de distinction entre des threads du même block
// Pas limité en taille

#define pow2(x) (1<<(x))

// Nombre de threads par bloc
#define NBTHREADS_MAX 1024

#define check(error) { checkCudaError((error), __FILE__, __LINE__); }
void checkCudaError(cudaError_t code, const char *file, int line)
{
    if (code != cudaSuccess) {
        fprintf(stderr, "Erreur CUDA: %s:%d %s\n", file, line, cudaGetErrorString(code));
        exit(EXIT_FAILURE);
    }
}

// Note: l'utilisation de mémoire partagée ne paraît pas optimale ici
// nvprof ne montre pas d'amélioration significative (voir des baisses de performance)
// Kernel de la somme hypercube
// Ne fonctionne que pour un seul bloc
__global__
void kernel_hypercube(int *t, int taille) {
    __shared__ int s[NBTHREADS_MAX];

    const int x = threadIdx.x;
    const int nbits = (int)ceil(log2((double)taille));
    int d, mask, in, out;

    if(x < taille) {
        s[x] = t[x];
    }
    __syncthreads();

    for(d = 1; d <= nbits; ++d) {
        if (x < pow2(nbits - d)) {
            mask = x << d;
            in = mask | pow2(d - 1);
            out = mask;

            if (in < taille) {
                s[out] += s[in];
            }
        }

        // NE Fonctionne que sur 1024 à cause de __syncthreads():
        // Syncthreads ne marche que pour les threads du même block (donc <= 1024 threads)
        // On doit synchroniser mêmes les threads en dehors sinon deadlock
        __syncthreads();
    }

    if(x < taille) {
        t[x] = s[x];
    }
}

// Kernel pour une dimension
// Réduit 1 dimension de l'hypercube
__global__
void kernel_hypercube_uneDim(int *t, int taille, int d, int nbits) {
    const int x = threadIdx.x + blockIdx.x * blockDim.x;
    int mask, in, out;

    // On copie de XXX1000 vers XXX0000
    // Les XXX correspondent à la valeur de x
    // suivi de 1 pour l'entrée et 0 pour la sortie
    // suivi d'uniquement des 0 car la réduction a été faite sur les 0

    if (x < pow2(nbits - d)) {
        mask = x << d;
        in = mask | pow2(d - 1);
        out = mask;

        if (in < taille) {
            t[out] += t[in];
        }
    }
}

// Algorithme de l'hypercube pour la somme
// Version séquentielle pour vérifier que l'algorithme est fonctionnel
int somme_hypercube(int *t, int taille) {
    const int nbits = (int)ceil(log2((double)taille));
    int d, x, mask, in, out, tot = 0;

    for(d = 1; d <= nbits; ++d) {
        for(x = 0; x < pow2(nbits - d); ++x) {
            mask = x << d;
            in = mask | pow2(d - 1);
            out = mask;

            if(in < taille) {
                t[out] += t[in];
            }
        }
    }

    tot = t[0];
    return tot;
}

// Somme séquentielle
int somme(int *arr, int taille) {
    int i, tot = 0;
    for(i = 0; i < taille; ++i) {
        tot += arr[i];
    }

    return tot;
}

void fillRandomly(int *t, int taille) {
    int i;
    for(i = 0; i < taille; ++i) {
        t[i] = rand() % 3;
    }
}

void printArr(int *t, int taille) {
    int i;
    for(i = 0; i < taille; ++i) {
        printf("%d ", t[i]);
    }

    printf("\n");
}

// Toujours la même graine pour qu'on puisse avoir des résultats reproductibles

int main(int argc, char **argv) {
    cudaEvent_t start, stop;
    float millis;
    int nBytes;
    int *h_arr = NULL;
    int *d_arr = NULL;
    int nbBlocks;
    int nbits, d;
    struct timeb tav, tap;
    double te;
    int somCpu;
    const int taille = argc < 2 ? 1000000 : strtol(argv[1], NULL, 10);

    nBytes = sizeof(int) * taille;
    nbits = (int)ceil(log2((double)taille));
    h_arr = (int*)malloc(nBytes);

    if(!h_arr) {
        fprintf(stderr, "Erreur d'allocation mémoire\n");
        exit(1);
    }

    check(cudaEventCreate(&start));
    check(cudaEventCreate(&stop));

    check(cudaMalloc(&d_arr, nBytes));

    srand(1234);
    fillRandomly(h_arr, taille);

    if(taille < 100) printArr(h_arr, taille);


    ftime(&tav);
    somCpu = somme(h_arr, taille);
    ftime(&tap);
    te = (double)((tap.time*1000+tap.millitm)-(tav.time*1000+tav.millitm))/1000 ;

    printf("%d éléments, %.3fMo\n", taille, taille / 512.0 / 1024.0 * sizeof(int));
    printf("SequentielCPU: %d, %.3lfs\n", somCpu, te);


    // somme_hypercube() change le tableau, on remet comme avant
    srand(1234);
    fillRandomly(h_arr, taille);


    check(cudaMemcpy(d_arr, h_arr, nBytes, cudaMemcpyHostToDevice));

    cudaEventRecord(start);

    nbBlocks = (taille - 1) / NBTHREADS_MAX + 1;
    if(nbBlocks == 1) {
        // S'il n'y a qu'un seul bloc, pas de problème de synchronisation
        kernel_hypercube<<<nbBlocks, NBTHREADS_MAX>>>(d_arr, taille);
    }
    else {
        // Sinon on doit séparer dimension par dimension
        // Car on ne peut pas synchroniser des threads de blocs différents sur le device
        for(d = 1; d <= nbits; ++d) {
            kernel_hypercube_uneDim<<<nbBlocks, NBTHREADS_MAX>>>(d_arr, taille, d, nbits);
            check(cudaDeviceSynchronize());
        }
    }

    check(cudaEventRecord(stop));
    check(cudaEventSynchronize(stop));
    check(cudaEventElapsedTime(&millis, start, stop));

    check(cudaMemcpy(h_arr, d_arr, nBytes, cudaMemcpyDeviceToHost));

    if(taille < 100) printArr(h_arr, taille);
    printf("HypercubeCUDA: %d, %.3fs\n", h_arr[0], millis / 1000.0f);

    check(cudaFree(d_arr));
    check(cudaEventDestroy(start));
    check(cudaEventDestroy(stop));

    free(h_arr);
    return 0;
}

	.file	"tmpxft_0023214d_00000000-6_sum_v2.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2035:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2035:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"Erreur CUDA: %s:%d %s\n"
	.text
	.globl	_Z14checkCudaError9cudaErrorPKci
	.type	_Z14checkCudaError9cudaErrorPKci, @function
_Z14checkCudaError9cudaErrorPKci:
.LFB2027:
	.cfi_startproc
	endbr64
	testl	%edi, %edi
	je	.L2
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movq	%rsi, %rbx
	subq	$16, %rsp
	.cfi_def_cfa_offset 32
	movl	%edx, 12(%rsp)
	call	cudaGetErrorString@PLT
	movq	stderr(%rip), %rdi
	movq	%rbx, %rcx
	movl	12(%rsp), %r8d
	movq	%rax, %r9
	leaq	.LC0(%rip), %rdx
	movl	$2, %esi
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
	movl	$1, %edi
	call	exit@PLT
.L2:
	.cfi_def_cfa_offset 8
	.cfi_restore 3
	ret
	.cfi_endproc
.LFE2027:
	.size	_Z14checkCudaError9cudaErrorPKci, .-_Z14checkCudaError9cudaErrorPKci
	.globl	_Z15somme_hypercubePii
	.type	_Z15somme_hypercubePii, @function
_Z15somme_hypercubePii:
.LFB2028:
	.cfi_startproc
	endbr64
	cvtsi2sdl	%esi, %xmm0
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movl	%esi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movq	%rdi, %rbx
	pushq	%rcx
	.cfi_def_cfa_offset 32
	call	log2@PLT
	call	ceil@PLT
	movl	$1, %eax
	movl	$1, %edi
	cvttsd2sil	%xmm0, %r8d
.L9:
	cmpl	%r8d, %eax
	jg	.L12
	movl	%r8d, %ecx
	movl	%edi, %r10d
	movl	%edi, %r9d
	xorl	%esi, %esi
	subl	%eax, %ecx
	sall	%cl, %r10d
	leal	-1(%rax), %ecx
	sall	%cl, %r9d
.L13:
	cmpl	%esi, %r10d
	jle	.L15
	movl	%eax, %ecx
	movl	%esi, %edx
	sall	%cl, %edx
	movl	%r9d, %ecx
	orl	%edx, %ecx
	cmpl	%ecx, %ebp
	jle	.L10
	movslq	%edx, %rdx
	movslq	%ecx, %rcx
	movl	(%rbx,%rcx,4), %ecx
	addl	%ecx, (%rbx,%rdx,4)
.L10:
	incl	%esi
	jmp	.L13
.L15:
	incl	%eax
	jmp	.L9
.L12:
	movl	(%rbx), %eax
	popq	%rdx
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2028:
	.size	_Z15somme_hypercubePii, .-_Z15somme_hypercubePii
	.globl	_Z5sommePii
	.type	_Z5sommePii, @function
_Z5sommePii:
.LFB2029:
	.cfi_startproc
	endbr64
	xorl	%eax, %eax
	xorl	%edx, %edx
.L17:
	cmpl	%eax, %esi
	jle	.L19
	addl	(%rdi,%rax,4), %edx
	incq	%rax
	jmp	.L17
.L19:
	movl	%edx, %eax
	ret
	.cfi_endproc
.LFE2029:
	.size	_Z5sommePii, .-_Z5sommePii
	.globl	_Z12fillRandomlyPii
	.type	_Z12fillRandomlyPii, @function
_Z12fillRandomlyPii:
.LFB2030:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movl	$3, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movq	%rdi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movl	%esi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	xorl	%ebx, %ebx
	pushq	%rdx
	.cfi_def_cfa_offset 48
.L21:
	cmpl	%ebx, %ebp
	jle	.L24
	call	rand@PLT
	cltd
	idivl	%r13d
	movl	%edx, (%r12,%rbx,4)
	incq	%rbx
	jmp	.L21
.L24:
	popq	%rax
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2030:
	.size	_Z12fillRandomlyPii, .-_Z12fillRandomlyPii
	.section	.rodata.str1.1
.LC1:
	.string	"%d "
.LC2:
	.string	"\n"
	.text
	.globl	_Z8printArrPii
	.type	_Z8printArrPii, @function
_Z8printArrPii:
.LFB2031:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC1(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movq	%rdi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movl	%esi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	xorl	%ebx, %ebx
	pushq	%rcx
	.cfi_def_cfa_offset 48
.L26:
	cmpl	%ebx, %ebp
	jle	.L29
	movl	(%r12,%rbx,4), %edx
	movq	%r13, %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	incq	%rbx
	call	__printf_chk@PLT
	jmp	.L26
.L29:
	popq	%rdx
	.cfi_def_cfa_offset 40
	leaq	.LC2(%rip), %rsi
	popq	%rbx
	.cfi_def_cfa_offset 32
	movl	$2, %edi
	popq	%rbp
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	jmp	__printf_chk@PLT
	.cfi_endproc
.LFE2031:
	.size	_Z8printArrPii, .-_Z8printArrPii
	.globl	_Z37__device_stub__Z16kernel_hypercubePiiPii
	.type	_Z37__device_stub__Z16kernel_hypercubePiiPii, @function
_Z37__device_stub__Z16kernel_hypercubePiiPii:
.LFB2057:
	.cfi_startproc
	endbr64
	subq	$120, %rsp
	.cfi_def_cfa_offset 128
	movq	%rdi, 8(%rsp)
	leaq	32(%rsp), %rcx
	leaq	24(%rsp), %rdx
	movl	%esi, 4(%rsp)
	leaq	40(%rsp), %rdi
	leaq	52(%rsp), %rsi
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rax
	movl	$1, 48(%rsp)
	movq	%rax, 88(%rsp)
	leaq	4(%rsp), %rax
	movq	%rax, 96(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 40(%rsp)
	movq	%rax, 52(%rsp)
	movl	$1, 60(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L30
	pushq	32(%rsp)
	.cfi_def_cfa_offset 136
	leaq	_Z16kernel_hypercubePii(%rip), %rdi
	pushq	32(%rsp)
	.cfi_def_cfa_offset 144
	movq	68(%rsp), %rcx
	movl	76(%rsp), %r8d
	movq	56(%rsp), %rsi
	movl	64(%rsp), %edx
	leaq	104(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 136
	popq	%rdx
	.cfi_def_cfa_offset 128
.L30:
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	je	.L32
	call	__stack_chk_fail@PLT
.L32:
	addq	$120, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2057:
	.size	_Z37__device_stub__Z16kernel_hypercubePiiPii, .-_Z37__device_stub__Z16kernel_hypercubePiiPii
	.globl	_Z16kernel_hypercubePii
	.type	_Z16kernel_hypercubePii, @function
_Z16kernel_hypercubePii:
.LFB2058:
	.cfi_startproc
	endbr64
	jmp	_Z37__device_stub__Z16kernel_hypercubePiiPii
	.cfi_endproc
.LFE2058:
	.size	_Z16kernel_hypercubePii, .-_Z16kernel_hypercubePii
	.globl	_Z46__device_stub__Z23kernel_hypercube_uneDimPiiiiPiiii
	.type	_Z46__device_stub__Z23kernel_hypercube_uneDimPiiiiPiiii, @function
_Z46__device_stub__Z23kernel_hypercube_uneDimPiiiiPiiii:
.LFB2059:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	56(%rsp), %rdi
	movl	%esi, 20(%rsp)
	leaq	68(%rsp), %rsi
	movl	%edx, 16(%rsp)
	leaq	40(%rsp), %rdx
	movl	%ecx, 12(%rsp)
	leaq	48(%rsp), %rcx
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 64(%rsp)
	movq	%rax, 104(%rsp)
	leaq	20(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 56(%rsp)
	movq	%rax, 68(%rsp)
	movl	$1, 76(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L35
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z23kernel_hypercube_uneDimPiiii(%rip), %rdi
	pushq	48(%rsp)
	.cfi_def_cfa_offset 176
	movq	84(%rsp), %rcx
	movl	92(%rsp), %r8d
	movq	72(%rsp), %rsi
	movl	80(%rsp), %edx
	leaq	120(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L35:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L37
	call	__stack_chk_fail@PLT
.L37:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2059:
	.size	_Z46__device_stub__Z23kernel_hypercube_uneDimPiiiiPiiii, .-_Z46__device_stub__Z23kernel_hypercube_uneDimPiiiiPiiii
	.globl	_Z23kernel_hypercube_uneDimPiiii
	.type	_Z23kernel_hypercube_uneDimPiiii, @function
_Z23kernel_hypercube_uneDimPiiii:
.LFB2060:
	.cfi_startproc
	endbr64
	jmp	_Z46__device_stub__Z23kernel_hypercube_uneDimPiiiiPiiii
	.cfi_endproc
.LFE2060:
	.size	_Z23kernel_hypercube_uneDimPiiii, .-_Z23kernel_hypercube_uneDimPiiii
	.section	.rodata.str1.1
.LC3:
	.string	"Erreur d'allocation m\303\251moire\n"
.LC4:
	.string	"/home/ubuntu/Datasets/stackv2/train-structured/Eren121/S8_TPs_CUDA_v2/master/sum_v2.cu"
.LC9:
	.string	"%d \303\251l\303\251ments, %.3fMo\n"
.LC10:
	.string	"SequentielCPU: %d, %.3lfs\n"
.LC12:
	.string	"HypercubeCUDA: %d, %.3fs\n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.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
	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
	movl	$1000000, %ebx
	subq	$120, %rsp
	.cfi_def_cfa_offset 176
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
	xorl	%eax, %eax
	decl	%edi
	movq	%rax, 40(%rsp)
	jle	.L41
	movq	8(%rsi), %rdi
	movl	$10, %edx
	xorl	%esi, %esi
	call	__isoc23_strtol@PLT
	movl	%eax, %ebx
.L41:
	cvtsi2sdl	%ebx, %xmm1
	movaps	%xmm1, %xmm0
	movq	%xmm1, %r14
	call	log2@PLT
	call	ceil@PLT
	leal	0(,%rbx,4), %eax
	cltq
	cvttsd2sil	%xmm0, %r13d
	movq	%rax, %rdi
	movq	%rax, 8(%rsp)
	call	malloc@PLT
	movq	%rax, %rbp
	testq	%rax, %rax
	jne	.L42
	movq	stderr(%rip), %rdi
	leaq	.LC3(%rip), %rdx
	movl	$2, %esi
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
	movl	$1, %edi
	call	exit@PLT
.L42:
	leaq	24(%rsp), %rdi
	call	cudaEventCreate@PLT
	movl	$162, %edx
	leaq	.LC4(%rip), %rsi
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrorPKci
	leaq	32(%rsp), %rdi
	call	cudaEventCreate@PLT
	movl	$163, %edx
	leaq	.LC4(%rip), %rsi
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrorPKci
	movq	8(%rsp), %rsi
	leaq	40(%rsp), %rdi
	call	cudaMalloc@PLT
	leaq	.LC4(%rip), %rsi
	movl	$165, %edx
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrorPKci
	movl	$1234, %edi
	call	srand@PLT
	movl	%ebx, %esi
	movq	%rbp, %rdi
	call	_Z12fillRandomlyPii
	cmpl	$99, %ebx
	jg	.L43
	movl	%ebx, %esi
	movq	%rbp, %rdi
	call	_Z8printArrPii
.L43:
	leaq	72(%rsp), %rdi
	call	ftime@PLT
	movl	%ebx, %esi
	movq	%rbp, %rdi
	call	_Z5sommePii
	leaq	88(%rsp), %rdi
	movl	%eax, %r12d
	call	ftime@PLT
	movzwl	96(%rsp), %edx
	movzwl	80(%rsp), %ecx
	leaq	.LC9(%rip), %rsi
	imulq	$1000, 88(%rsp), %rax
	movl	$2, %edi
	addq	%rdx, %rax
	imulq	$1000, 72(%rsp), %rdx
	addq	%rcx, %rdx
	subq	%rdx, %rax
	movl	%ebx, %edx
	cvtsi2sdq	%rax, %xmm0
	divsd	.LC5(%rip), %xmm0
	movb	$1, %al
	movq	%xmm0, %r15
	movq	%r14, %xmm0
	movabsq	$4294968320, %r14
	mulsd	.LC6(%rip), %xmm0
	mulsd	.LC7(%rip), %xmm0
	mulsd	.LC8(%rip), %xmm0
	call	__printf_chk@PLT
	movq	%r15, %xmm0
	movl	%r12d, %edx
	movb	$1, %al
	leaq	.LC10(%rip), %rsi
	movl	$2, %edi
	movl	$1, %r12d
	call	__printf_chk@PLT
	movl	$1234, %edi
	call	srand@PLT
	movl	%ebx, %esi
	movq	%rbp, %rdi
	call	_Z12fillRandomlyPii
	movq	8(%rsp), %rdx
	movq	40(%rsp), %rdi
	movq	%rbp, %rsi
	movl	$1, %ecx
	call	cudaMemcpy@PLT
	movl	$187, %edx
	leaq	.LC4(%rip), %rsi
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrorPKci
	movq	24(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	leal	-1(%rbx), %eax
	movl	$1024, %ecx
	cltd
	idivl	%ecx
	leal	1(%rax), %r15d
	testl	%eax, %eax
	jne	.L44
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	%r14, %rdx
	movl	$1, %ecx
	movabsq	$4294967297, %rdi
	movl	$1, %esi
	movq	%r14, 60(%rsp)
	movl	$1, 68(%rsp)
	movq	%rdi, 48(%rsp)
	movl	$1, 56(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L46
	movq	40(%rsp), %rdi
	movl	%ebx, %esi
	call	_Z37__device_stub__Z16kernel_hypercubePiiPii
	jmp	.L46
.L48:
	movl	%r15d, 48(%rsp)
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	%r14, %rdx
	movabsq	$4294967297, %rax
	movl	$1, %ecx
	movq	%r14, 60(%rsp)
	movq	%rax, 52(%rsp)
	movq	48(%rsp), %rdi
	movl	56(%rsp), %esi
	movl	$1, 68(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L47
	movq	40(%rsp), %rdi
	movl	%r13d, %ecx
	movl	%r12d, %edx
	movl	%ebx, %esi
	call	_Z46__device_stub__Z23kernel_hypercube_uneDimPiiiiPiiii
.L47:
	call	cudaDeviceSynchronize@PLT
	movl	$201, %edx
	leaq	.LC4(%rip), %rsi
	incl	%r12d
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrorPKci
.L44:
	cmpl	%r13d, %r12d
	jle	.L48
.L46:
	movq	32(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movl	$205, %edx
	leaq	.LC4(%rip), %rsi
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrorPKci
	movq	32(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movl	$206, %edx
	leaq	.LC4(%rip), %rsi
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrorPKci
	movq	32(%rsp), %rdx
	movq	24(%rsp), %rsi
	leaq	60(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	movl	$207, %edx
	leaq	.LC4(%rip), %rsi
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrorPKci
	movq	8(%rsp), %rdx
	movq	40(%rsp), %rsi
	movq	%rbp, %rdi
	movl	$2, %ecx
	call	cudaMemcpy@PLT
	movl	$209, %edx
	leaq	.LC4(%rip), %rsi
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrorPKci
	cmpl	$99, %ebx
	jg	.L49
	movl	%ebx, %esi
	movq	%rbp, %rdi
	call	_Z8printArrPii
.L49:
	movl	0(%rbp), %edx
	movl	$2, %edi
	movb	$1, %al
	movss	60(%rsp), %xmm0
	leaq	.LC12(%rip), %rsi
	divss	.LC11(%rip), %xmm0
	cvtss2sd	%xmm0, %xmm0
	call	__printf_chk@PLT
	movq	40(%rsp), %rdi
	call	cudaFree@PLT
	movl	$214, %edx
	leaq	.LC4(%rip), %rsi
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrorPKci
	movq	24(%rsp), %rdi
	call	cudaEventDestroy@PLT
	movl	$215, %edx
	leaq	.LC4(%rip), %rsi
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrorPKci
	movq	32(%rsp), %rdi
	call	cudaEventDestroy@PLT
	movl	$216, %edx
	leaq	.LC4(%rip), %rsi
	movl	%eax, %edi
	call	_Z14checkCudaError9cudaErrorPKci
	movq	%rbp, %rdi
	call	free@PLT
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	je	.L50
	call	__stack_chk_fail@PLT
.L50:
	addq	$120, %rsp
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2032:
	.size	main, .-main
	.section	.rodata.str1.1
.LC13:
	.string	"_Z23kernel_hypercube_uneDimPiiii"
.LC14:
	.string	"_Z16kernel_hypercubePii"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2062:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	pushq	$0
	.cfi_def_cfa_offset 24
	xorl	%r9d, %r9d
	orl	$-1, %r8d
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC13(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z23kernel_hypercube_uneDimPiiii(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC14(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z16kernel_hypercubePii(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE2062:
	.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.cst8,"aM",@progbits,8
	.align 8
.LC5:
	.long	0
	.long	1083129856
	.align 8
.LC6:
	.long	0
	.long	1063256064
	.align 8
.LC7:
	.long	0
	.long	1062207488
	.align 8
.LC8:
	.long	0
	.long	1074790400
	.section	.rodata.cst4,"aM",@progbits,4
	.align 4
.LC11:
	.long	1148846080
	.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 <math.h>
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
#include <sys/timeb.h>


// Hypercube
// Version: pas de mémoire partagée
// On réduit tout sur une dimension à chaque appel (non optimisé pour une mémoire partagée par block)
// Pas de distinction entre des threads du même block
// Pas limité en taille

#define pow2(x) (1<<(x))

// Nombre de threads par bloc
#define NBTHREADS_MAX 1024

#define check(error) { checkCudaError((error), __FILE__, __LINE__); }
void checkCudaError(hipError_t code, const char *file, int line)
{
    if (code != hipSuccess) {
        fprintf(stderr, "Erreur CUDA: %s:%d %s\n", file, line, hipGetErrorString(code));
        exit(EXIT_FAILURE);
    }
}

// Note: l'utilisation de mémoire partagée ne paraît pas optimale ici
// nvprof ne montre pas d'amélioration significative (voir des baisses de performance)
// Kernel de la somme hypercube
// Ne fonctionne que pour un seul bloc
__global__
void kernel_hypercube(int *t, int taille) {
    __shared__ int s[NBTHREADS_MAX];

    const int x = threadIdx.x;
    const int nbits = (int)ceil(log2((double)taille));
    int d, mask, in, out;

    if(x < taille) {
        s[x] = t[x];
    }
    __syncthreads();

    for(d = 1; d <= nbits; ++d) {
        if (x < pow2(nbits - d)) {
            mask = x << d;
            in = mask | pow2(d - 1);
            out = mask;

            if (in < taille) {
                s[out] += s[in];
            }
        }

        // NE Fonctionne que sur 1024 à cause de __syncthreads():
        // Syncthreads ne marche que pour les threads du même block (donc <= 1024 threads)
        // On doit synchroniser mêmes les threads en dehors sinon deadlock
        __syncthreads();
    }

    if(x < taille) {
        t[x] = s[x];
    }
}

// Kernel pour une dimension
// Réduit 1 dimension de l'hypercube
__global__
void kernel_hypercube_uneDim(int *t, int taille, int d, int nbits) {
    const int x = threadIdx.x + blockIdx.x * blockDim.x;
    int mask, in, out;

    // On copie de XXX1000 vers XXX0000
    // Les XXX correspondent à la valeur de x
    // suivi de 1 pour l'entrée et 0 pour la sortie
    // suivi d'uniquement des 0 car la réduction a été faite sur les 0

    if (x < pow2(nbits - d)) {
        mask = x << d;
        in = mask | pow2(d - 1);
        out = mask;

        if (in < taille) {
            t[out] += t[in];
        }
    }
}

// Algorithme de l'hypercube pour la somme
// Version séquentielle pour vérifier que l'algorithme est fonctionnel
int somme_hypercube(int *t, int taille) {
    const int nbits = (int)ceil(log2((double)taille));
    int d, x, mask, in, out, tot = 0;

    for(d = 1; d <= nbits; ++d) {
        for(x = 0; x < pow2(nbits - d); ++x) {
            mask = x << d;
            in = mask | pow2(d - 1);
            out = mask;

            if(in < taille) {
                t[out] += t[in];
            }
        }
    }

    tot = t[0];
    return tot;
}

// Somme séquentielle
int somme(int *arr, int taille) {
    int i, tot = 0;
    for(i = 0; i < taille; ++i) {
        tot += arr[i];
    }

    return tot;
}

void fillRandomly(int *t, int taille) {
    int i;
    for(i = 0; i < taille; ++i) {
        t[i] = rand() % 3;
    }
}

void printArr(int *t, int taille) {
    int i;
    for(i = 0; i < taille; ++i) {
        printf("%d ", t[i]);
    }

    printf("\n");
}

// Toujours la même graine pour qu'on puisse avoir des résultats reproductibles

int main(int argc, char **argv) {
    hipEvent_t start, stop;
    float millis;
    int nBytes;
    int *h_arr = NULL;
    int *d_arr = NULL;
    int nbBlocks;
    int nbits, d;
    struct timeb tav, tap;
    double te;
    int somCpu;
    const int taille = argc < 2 ? 1000000 : strtol(argv[1], NULL, 10);

    nBytes = sizeof(int) * taille;
    nbits = (int)ceil(log2((double)taille));
    h_arr = (int*)malloc(nBytes);

    if(!h_arr) {
        fprintf(stderr, "Erreur d'allocation mémoire\n");
        exit(1);
    }

    check(hipEventCreate(&start));
    check(hipEventCreate(&stop));

    check(hipMalloc(&d_arr, nBytes));

    srand(1234);
    fillRandomly(h_arr, taille);

    if(taille < 100) printArr(h_arr, taille);


    ftime(&tav);
    somCpu = somme(h_arr, taille);
    ftime(&tap);
    te = (double)((tap.time*1000+tap.millitm)-(tav.time*1000+tav.millitm))/1000 ;

    printf("%d éléments, %.3fMo\n", taille, taille / 512.0 / 1024.0 * sizeof(int));
    printf("SequentielCPU: %d, %.3lfs\n", somCpu, te);


    // somme_hypercube() change le tableau, on remet comme avant
    srand(1234);
    fillRandomly(h_arr, taille);


    check(hipMemcpy(d_arr, h_arr, nBytes, hipMemcpyHostToDevice));

    hipEventRecord(start);

    nbBlocks = (taille - 1) / NBTHREADS_MAX + 1;
    if(nbBlocks == 1) {
        // S'il n'y a qu'un seul bloc, pas de problème de synchronisation
        kernel_hypercube<<<nbBlocks, NBTHREADS_MAX>>>(d_arr, taille);
    }
    else {
        // Sinon on doit séparer dimension par dimension
        // Car on ne peut pas synchroniser des threads de blocs différents sur le device
        for(d = 1; d <= nbits; ++d) {
            kernel_hypercube_uneDim<<<nbBlocks, NBTHREADS_MAX>>>(d_arr, taille, d, nbits);
            check(hipDeviceSynchronize());
        }
    }

    check(hipEventRecord(stop));
    check(hipEventSynchronize(stop));
    check(hipEventElapsedTime(&millis, start, stop));

    check(hipMemcpy(h_arr, d_arr, nBytes, hipMemcpyDeviceToHost));

    if(taille < 100) printArr(h_arr, taille);
    printf("HypercubeCUDA: %d, %.3fs\n", h_arr[0], millis / 1000.0f);

    check(hipFree(d_arr));
    check(hipEventDestroy(start));
    check(hipEventDestroy(stop));

    free(h_arr);
    return 0;
}

	.text
	.file	"sum_v2.hip"
	.globl	_Z14checkCudaError10hipError_tPKci # -- Begin function _Z14checkCudaError10hipError_tPKci
	.type	_Z14checkCudaError10hipError_tPKci,@function
_Z14checkCudaError10hipError_tPKci:     # @_Z14checkCudaError10hipError_tPKci
	.cfi_startproc
# %bb.0:
	testl	%edi, %edi
	jne	.LBB0_2
# %bb.1:
	retq
.LBB0_2:
	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	%edx, %ebx
	movq	%rsi, %r14
	movq	stderr(%rip), %r15
	callq	hipGetErrorString
	movl	$.L.str, %esi
	movq	%r15, %rdi
	movq	%r14, %rdx
	movl	%ebx, %ecx
	movq	%rax, %r8
	xorl	%eax, %eax
	callq	fprintf
	movl	$1, %edi
	callq	exit
.Lfunc_end0:
	.size	_Z14checkCudaError10hipError_tPKci, .Lfunc_end0-_Z14checkCudaError10hipError_tPKci
	.cfi_endproc
                                        # -- End function
	.globl	_Z31__device_stub__kernel_hypercubePii # -- Begin function _Z31__device_stub__kernel_hypercubePii
	.type	_Z31__device_stub__kernel_hypercubePii,@function
_Z31__device_stub__kernel_hypercubePii: # @_Z31__device_stub__kernel_hypercubePii
	.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	$80, %rsp
	.cfi_def_cfa_offset 128
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	24(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	4(%rsp), %rcx
	movl	%esi, (%rcx)
	leaq	64(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	leaq	48(%rsp), %r14
	leaq	32(%rsp), %r15
	leaq	16(%rsp), %r12
	leaq	8(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z16kernel_hypercubePii, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$96, %rsp
	.cfi_adjust_cfa_offset -96
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end1:
	.size	_Z31__device_stub__kernel_hypercubePii, .Lfunc_end1-_Z31__device_stub__kernel_hypercubePii
	.cfi_endproc
                                        # -- End function
	.globl	_Z38__device_stub__kernel_hypercube_uneDimPiiii # -- Begin function _Z38__device_stub__kernel_hypercube_uneDimPiiii
	.type	_Z38__device_stub__kernel_hypercube_uneDimPiiii,@function
_Z38__device_stub__kernel_hypercube_uneDimPiiii: # @_Z38__device_stub__kernel_hypercube_uneDimPiiii
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	20(%rsp), %rdi
	movl	%esi, (%rdi)
	leaq	16(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	12(%rsp), %rdx
	movl	%ecx, (%rdx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	32(%rsp), %r12
	leaq	24(%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	$_Z23kernel_hypercube_uneDimPiiii, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end2:
	.size	_Z38__device_stub__kernel_hypercube_uneDimPiiii, .Lfunc_end2-_Z38__device_stub__kernel_hypercube_uneDimPiiii
	.cfi_endproc
                                        # -- End function
	.globl	_Z15somme_hypercubePii          # -- Begin function _Z15somme_hypercubePii
	.type	_Z15somme_hypercubePii,@function
_Z15somme_hypercubePii:                 # @_Z15somme_hypercubePii
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	pushq	%rax
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -24
	.cfi_offset %rbp, -16
	movl	%esi, %ebp
	movq	%rdi, %rbx
	cvtsi2sd	%esi, %xmm0
	callq	log2
	callq	ceil@PLT
	cvttsd2si	%xmm0, %edx
	testl	%edx, %edx
	jle	.LBB3_8
# %bb.1:                                # %.preheader.preheader
	movl	$1, %eax
.LBB3_2:                                # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB3_4 Depth 2
	movl	%edx, %ecx
	subl	%eax, %ecx
	cmpl	$31, %ecx
	je	.LBB3_7
# %bb.3:                                # %.lr.ph
                                        #   in Loop: Header=BB3_2 Depth=1
	movl	$1, %esi
                                        # kill: def $cl killed $cl killed $ecx
	shll	%cl, %esi
	leal	-1(%rax), %ecx
	movl	$1, %edi
                                        # kill: def $cl killed $cl killed $ecx
	shll	%cl, %edi
	xorl	%r8d, %r8d
.LBB3_4:                                #   Parent Loop BB3_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movl	%r8d, %r9d
	movl	%eax, %ecx
	shll	%cl, %r9d
	movl	%r9d, %ecx
	orl	%edi, %ecx
	cmpl	%ebp, %ecx
	jge	.LBB3_6
# %bb.5:                                #   in Loop: Header=BB3_4 Depth=2
	movslq	%ecx, %rcx
	movl	(%rbx,%rcx,4), %ecx
	movslq	%r9d, %r9
	addl	%ecx, (%rbx,%r9,4)
.LBB3_6:                                #   in Loop: Header=BB3_4 Depth=2
	incl	%r8d
	cmpl	%r8d, %esi
	jne	.LBB3_4
.LBB3_7:                                # %._crit_edge
                                        #   in Loop: Header=BB3_2 Depth=1
	leal	1(%rax), %ecx
	cmpl	%eax, %edx
	movl	%ecx, %eax
	jne	.LBB3_2
.LBB3_8:                                # %._crit_edge26
	movl	(%rbx), %eax
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end3:
	.size	_Z15somme_hypercubePii, .Lfunc_end3-_Z15somme_hypercubePii
	.cfi_endproc
                                        # -- End function
	.globl	_Z5sommePii                     # -- Begin function _Z5sommePii
	.type	_Z5sommePii,@function
_Z5sommePii:                            # @_Z5sommePii
	.cfi_startproc
# %bb.0:
	testl	%esi, %esi
	jle	.LBB4_1
# %bb.2:                                # %.lr.ph.preheader
	movl	%esi, %ecx
	xorl	%edx, %edx
	xorl	%eax, %eax
.LBB4_3:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	addl	(%rdi,%rdx,4), %eax
	incq	%rdx
	cmpq	%rdx, %rcx
	jne	.LBB4_3
# %bb.4:                                # %._crit_edge
	retq
.LBB4_1:
	xorl	%eax, %eax
	retq
.Lfunc_end4:
	.size	_Z5sommePii, .Lfunc_end4-_Z5sommePii
	.cfi_endproc
                                        # -- End function
	.globl	_Z12fillRandomlyPii             # -- Begin function _Z12fillRandomlyPii
	.type	_Z12fillRandomlyPii,@function
_Z12fillRandomlyPii:                    # @_Z12fillRandomlyPii
	.cfi_startproc
# %bb.0:
	testl	%esi, %esi
	jle	.LBB5_4
# %bb.1:                                # %.lr.ph.preheader
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rdi, %rbx
	movl	%esi, %r14d
	xorl	%r15d, %r15d
.LBB5_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	callq	rand
	cltq
	imulq	$1431655766, %rax, %rcx         # imm = 0x55555556
	movq	%rcx, %rdx
	shrq	$63, %rdx
	shrq	$32, %rcx
	addl	%edx, %ecx
	leal	(%rcx,%rcx,2), %ecx
	subl	%ecx, %eax
	movl	%eax, (%rbx,%r15,4)
	incq	%r15
	cmpq	%r15, %r14
	jne	.LBB5_2
# %bb.3:
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	.cfi_restore %rbx
	.cfi_restore %r14
	.cfi_restore %r15
.LBB5_4:                                # %._crit_edge
	retq
.Lfunc_end5:
	.size	_Z12fillRandomlyPii, .Lfunc_end5-_Z12fillRandomlyPii
	.cfi_endproc
                                        # -- End function
	.globl	_Z8printArrPii                  # -- Begin function _Z8printArrPii
	.type	_Z8printArrPii,@function
_Z8printArrPii:                         # @_Z8printArrPii
	.cfi_startproc
# %bb.0:
	testl	%esi, %esi
	jle	.LBB6_4
# %bb.1:                                # %.lr.ph.preheader
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rdi, %rbx
	movl	%esi, %r14d
	xorl	%r15d, %r15d
.LBB6_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movl	(%rbx,%r15,4), %esi
	movl	$.L.str.1, %edi
	xorl	%eax, %eax
	callq	printf
	incq	%r15
	cmpq	%r15, %r14
	jne	.LBB6_2
# %bb.3:
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	.cfi_restore %rbx
	.cfi_restore %r14
	.cfi_restore %r15
.LBB6_4:                                # %._crit_edge
	movl	$10, %edi
	jmp	putchar@PLT                     # TAILCALL
.Lfunc_end6:
	.size	_Z8printArrPii, .Lfunc_end6-_Z8printArrPii
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function main
.LCPI7_0:
	.quad	0x408f400000000000              # double 1000
.LCPI7_1:
	.quad	0x3f60000000000000              # double 0.001953125
.LCPI7_2:
	.quad	0x3f50000000000000              # double 9.765625E-4
.LCPI7_3:
	.quad	0x4010000000000000              # double 4
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0
.LCPI7_4:
	.long	0x447a0000                      # float 1000
	.text
	.globl	main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$104, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	$0, 8(%rsp)
	movl	$1000000, %r13d                 # imm = 0xF4240
	cmpl	$2, %edi
	jl	.LBB7_2
# %bb.1:
	movq	8(%rsi), %rdi
	xorl	%esi, %esi
	movl	$10, %edx
	callq	__isoc23_strtol
	movq	%rax, %r13
.LBB7_2:
	leal	(,%r13,4), %ebx
	cvtsi2sd	%r13d, %xmm0
	movsd	%xmm0, 16(%rsp)                 # 8-byte Spill
	callq	log2
	callq	ceil@PLT
	movsd	%xmm0, 56(%rsp)                 # 8-byte Spill
	movslq	%ebx, %r14
	movq	%r14, %rdi
	callq	malloc
	testq	%rax, %rax
	je	.LBB7_25
# %bb.3:
	movq	%rax, %rbx
	leaq	32(%rsp), %rdi
	callq	hipEventCreate
	movl	$.L.str.4, %esi
	movl	%eax, %edi
	movl	$164, %edx
	callq	_Z14checkCudaError10hipError_tPKci
	leaq	24(%rsp), %rdi
	callq	hipEventCreate
	movl	$.L.str.4, %esi
	movl	%eax, %edi
	movl	$165, %edx
	callq	_Z14checkCudaError10hipError_tPKci
	leaq	8(%rsp), %rdi
	movq	%r14, 48(%rsp)                  # 8-byte Spill
	movq	%r14, %rsi
	callq	hipMalloc
	movl	$.L.str.4, %esi
	movl	%eax, %edi
	movl	$167, %edx
	callq	_Z14checkCudaError10hipError_tPKci
	movl	$1234, %edi                     # imm = 0x4D2
	callq	srand
	movl	%r13d, %r12d
	testl	%r13d, %r13d
	jle	.LBB7_10
# %bb.4:                                # %.lr.ph.preheader.i
	xorl	%r14d, %r14d
.LBB7_5:                                # %.lr.ph.i
                                        # =>This Inner Loop Header: Depth=1
	callq	rand
	cltq
	imulq	$1431655766, %rax, %rcx         # imm = 0x55555556
	movq	%rcx, %rdx
	shrq	$63, %rdx
	shrq	$32, %rcx
	addl	%edx, %ecx
	leal	(%rcx,%rcx,2), %ecx
	subl	%ecx, %eax
	movl	%eax, (%rbx,%r14,4)
	incq	%r14
	cmpq	%r14, %r12
	jne	.LBB7_5
# %bb.6:                                # %_Z12fillRandomlyPii.exit
	cmpl	$100, %r13d
	setl	7(%rsp)                         # 1-byte Folded Spill
	jge	.LBB7_8
# %bb.7:                                # %_Z12fillRandomlyPii.exit.thread
	movq	%rbx, %rdi
	movl	%r13d, %esi
	callq	_Z8printArrPii
.LBB7_8:                                # %.lr.ph.preheader.i53
	leaq	72(%rsp), %rdi
	callq	ftime
	xorl	%eax, %eax
	xorl	%ebp, %ebp
.LBB7_9:                                # %.lr.ph.i55
                                        # =>This Inner Loop Header: Depth=1
	addl	(%rbx,%rax,4), %ebp
	incq	%rax
	cmpq	%rax, %r12
	jne	.LBB7_9
	jmp	.LBB7_11
.LBB7_10:                               # %_Z5sommePii.exit.critedge
	movq	%rbx, %rdi
	movl	%r13d, %esi
	callq	_Z8printArrPii
	leaq	72(%rsp), %rdi
	callq	ftime
	xorl	%ebp, %ebp
	movb	$1, 7(%rsp)                     # 1-byte Folded Spill
.LBB7_11:                               # %_Z5sommePii.exit
	leaq	88(%rsp), %r15
	movq	%r15, %rdi
	callq	ftime
	movq	(%r15), %rax
	movzwl	8(%r15), %ecx
	movzwl	80(%rsp), %edx
	subq	%rdx, %rcx
	subq	72(%rsp), %rax
	imulq	$1000, %rax, %rax               # imm = 0x3E8
	addq	%rcx, %rax
	xorps	%xmm0, %xmm0
	cvtsi2sd	%rax, %xmm0
	divsd	.LCPI7_0(%rip), %xmm0
	movsd	%xmm0, 64(%rsp)                 # 8-byte Spill
	movsd	16(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	mulsd	.LCPI7_1(%rip), %xmm0
	mulsd	.LCPI7_2(%rip), %xmm0
	mulsd	.LCPI7_3(%rip), %xmm0
	movl	$.L.str.5, %edi
	movl	%r13d, %esi
	movb	$1, %al
	callq	printf
	movl	$.L.str.6, %edi
	movl	%ebp, %esi
	movsd	64(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	movb	$1, %al
	callq	printf
	movl	$1234, %edi                     # imm = 0x4D2
	callq	srand
	testl	%r13d, %r13d
	jle	.LBB7_14
# %bb.12:                               # %.lr.ph.preheader.i59
	xorl	%r14d, %r14d
.LBB7_13:                               # %.lr.ph.i61
                                        # =>This Inner Loop Header: Depth=1
	callq	rand
	cltq
	imulq	$1431655766, %rax, %rcx         # imm = 0x55555556
	movq	%rcx, %rdx
	shrq	$63, %rdx
	shrq	$32, %rcx
	addl	%edx, %ecx
	leal	(%rcx,%rcx,2), %ecx
	subl	%ecx, %eax
	movl	%eax, (%rbx,%r14,4)
	incq	%r14
	cmpq	%r14, %r12
	jne	.LBB7_13
.LBB7_14:                               # %_Z12fillRandomlyPii.exit65
	movq	8(%rsp), %rdi
	movq	%rbx, %rsi
	movq	48(%rsp), %rdx                  # 8-byte Reload
	movl	$1, %ecx
	callq	hipMemcpy
	movl	$.L.str.4, %esi
	movl	%eax, %edi
	movl	$189, %edx
	callq	_Z14checkCudaError10hipError_tPKci
	movq	32(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	leal	-1(%r13), %eax
	movq	%r13, 16(%rsp)                  # 8-byte Spill
	leal	1022(%r13), %ecx
	testl	%eax, %eax
	cmovsl	%ecx, %eax
	cmpl	$2047, %ecx                     # imm = 0x7FF
	jae	.LBB7_15
# %bb.20:
	movabsq	$4294968320, %rdx               # imm = 0x100000400
	leaq	-1023(%rdx), %rdi
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB7_22
# %bb.21:
	movq	8(%rsp), %rdi
	movq	16(%rsp), %rsi                  # 8-byte Reload
                                        # kill: def $esi killed $esi killed $rsi
	callq	_Z31__device_stub__kernel_hypercubePii
	jmp	.LBB7_22
.LBB7_15:                               # %.preheader
	cvttsd2si	56(%rsp), %ebp          # 8-byte Folded Reload
	testl	%ebp, %ebp
	jle	.LBB7_22
# %bb.16:                               # %.lr.ph
	sarl	$10, %eax
	incl	%eax
	movabsq	$4294968320, %r12               # imm = 0x100000400
	movl	%eax, %eax
	leaq	(%rax,%r12), %r13
	addq	$-1024, %r13                    # imm = 0xFC00
	movl	%ebp, %r14d
	negl	%r14d
	movl	$1, %r15d
.LBB7_17:                               # =>This Inner Loop Header: Depth=1
	movq	%r13, %rdi
	movl	$1, %esi
	movq	%r12, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB7_19
# %bb.18:                               #   in Loop: Header=BB7_17 Depth=1
	movq	8(%rsp), %rdi
	movq	16(%rsp), %rsi                  # 8-byte Reload
                                        # kill: def $esi killed $esi killed $rsi
	movl	%r15d, %edx
	movl	%ebp, %ecx
	callq	_Z38__device_stub__kernel_hypercube_uneDimPiiii
.LBB7_19:                               #   in Loop: Header=BB7_17 Depth=1
	callq	hipDeviceSynchronize
	movl	$.L.str.4, %esi
	movl	%eax, %edi
	movl	$203, %edx
	callq	_Z14checkCudaError10hipError_tPKci
	leal	(%r14,%r15), %eax
	incl	%eax
	movl	%r15d, %ecx
	incl	%ecx
	movl	%ecx, %r15d
	cmpl	$1, %eax
	jne	.LBB7_17
.LBB7_22:                               # %.loopexit
	movq	24(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movl	$.L.str.4, %esi
	movl	%eax, %edi
	movl	$207, %edx
	callq	_Z14checkCudaError10hipError_tPKci
	movq	24(%rsp), %rdi
	callq	hipEventSynchronize
	movl	$.L.str.4, %esi
	movl	%eax, %edi
	movl	$208, %edx
	callq	_Z14checkCudaError10hipError_tPKci
	movq	32(%rsp), %rsi
	movq	24(%rsp), %rdx
	leaq	44(%rsp), %rdi
	callq	hipEventElapsedTime
	movl	$.L.str.4, %esi
	movl	%eax, %edi
	movl	$209, %edx
	callq	_Z14checkCudaError10hipError_tPKci
	movq	8(%rsp), %rsi
	movq	%rbx, %rdi
	movq	48(%rsp), %rdx                  # 8-byte Reload
	movl	$2, %ecx
	callq	hipMemcpy
	movl	$.L.str.4, %esi
	movl	%eax, %edi
	movl	$211, %edx
	callq	_Z14checkCudaError10hipError_tPKci
	cmpb	$0, 7(%rsp)                     # 1-byte Folded Reload
	je	.LBB7_24
# %bb.23:
	movq	%rbx, %rdi
	movq	16(%rsp), %rsi                  # 8-byte Reload
                                        # kill: def $esi killed $esi killed $rsi
	callq	_Z8printArrPii
.LBB7_24:
	movl	(%rbx), %esi
	movss	44(%rsp), %xmm0                 # xmm0 = mem[0],zero,zero,zero
	divss	.LCPI7_4(%rip), %xmm0
	cvtss2sd	%xmm0, %xmm0
	movl	$.L.str.7, %edi
	movb	$1, %al
	callq	printf
	movq	8(%rsp), %rdi
	callq	hipFree
	movl	$.L.str.4, %esi
	movl	%eax, %edi
	movl	$216, %edx
	callq	_Z14checkCudaError10hipError_tPKci
	movq	32(%rsp), %rdi
	callq	hipEventDestroy
	movl	$.L.str.4, %esi
	movl	%eax, %edi
	movl	$217, %edx
	callq	_Z14checkCudaError10hipError_tPKci
	movq	24(%rsp), %rdi
	callq	hipEventDestroy
	movl	$.L.str.4, %esi
	movl	%eax, %edi
	movl	$218, %edx
	callq	_Z14checkCudaError10hipError_tPKci
	movq	%rbx, %rdi
	callq	free
	xorl	%eax, %eax
	addq	$104, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.LBB7_25:
	.cfi_def_cfa_offset 160
	movq	stderr(%rip), %rcx
	movl	$.L.str.3, %edi
	movl	$29, %esi
	movl	$1, %edx
	callq	fwrite@PLT
	movl	$1, %edi
	callq	exit
.Lfunc_end7:
	.size	main, .Lfunc_end7-main
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	subq	$32, %rsp
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -16
	movq	__hip_gpubin_handle(%rip), %rbx
	testq	%rbx, %rbx
	jne	.LBB8_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB8_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z16kernel_hypercubePii, %esi
	movl	$.L__unnamed_1, %edx
	movl	$.L__unnamed_1, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z23kernel_hypercube_uneDimPiiii, %esi
	movl	$.L__unnamed_2, %edx
	movl	$.L__unnamed_2, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end8:
	.size	__hip_module_ctor, .Lfunc_end8-__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	.LBB9_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
.LBB9_2:
	retq
.Lfunc_end9:
	.size	__hip_module_dtor, .Lfunc_end9-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"Erreur CUDA: %s:%d %s\n"
	.size	.L.str, 23

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

	.type	_Z23kernel_hypercube_uneDimPiiii,@object # @_Z23kernel_hypercube_uneDimPiiii
	.globl	_Z23kernel_hypercube_uneDimPiiii
	.p2align	3, 0x0
_Z23kernel_hypercube_uneDimPiiii:
	.quad	_Z38__device_stub__kernel_hypercube_uneDimPiiii
	.size	_Z23kernel_hypercube_uneDimPiiii, 8

	.type	.L.str.1,@object                # @.str.1
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.1:
	.asciz	"%d "
	.size	.L.str.1, 4

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"Erreur d'allocation m\303\251moire\n"
	.size	.L.str.3, 30

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"/home/ubuntu/Datasets/stackv2/train-structured-repos-hip-sm89/Eren121/S8_TPs_CUDA_v2/master/sum_v2.hip"
	.size	.L.str.4, 103

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"%d \303\251l\303\251ments, %.3fMo\n"
	.size	.L.str.5, 23

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"SequentielCPU: %d, %.3lfs\n"
	.size	.L.str.6, 27

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"HypercubeCUDA: %d, %.3fs\n"
	.size	.L.str.7, 26

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z16kernel_hypercubePii"
	.size	.L__unnamed_1, 24

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z23kernel_hypercube_uneDimPiiii"
	.size	.L__unnamed_2, 33

	.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 _Z31__device_stub__kernel_hypercubePii
	.addrsig_sym _Z38__device_stub__kernel_hypercube_uneDimPiiii
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Z16kernel_hypercubePii
	.addrsig_sym _Z23kernel_hypercube_uneDimPiiii
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z16kernel_hypercubePii ; -- Begin function _Z16kernel_hypercubePii
	.globl	_Z16kernel_hypercubePii
	.p2align	8
	.type	_Z16kernel_hypercubePii,@function
_Z16kernel_hypercubePii:                ; @_Z16kernel_hypercubePii
; %bb.0:
	s_clause 0x1
	s_load_b32 s4, s[0:1], 0x8
	s_load_b64 s[2:3], s[0:1], 0x0
	v_lshlrev_b32_e32 v1, 2, v0
	s_waitcnt lgkmcnt(0)
	v_cmp_gt_i32_e64 s0, s4, v0
	s_delay_alu instid0(VALU_DEP_1)
	s_and_saveexec_b32 s1, s0
	s_cbranch_execz .LBB0_2
; %bb.1:
	global_load_b32 v2, v1, s[2:3]
	s_waitcnt vmcnt(0)
	ds_store_b32 v1, v2
.LBB0_2:
	s_or_b32 exec_lo, exec_lo, s1
	v_cvt_f64_i32_e32 v[2:3], s4
	s_mov_b32 s7, 0x3fe55555
	s_mov_b32 s6, 0x55555555
	s_mov_b32 s8, 0x6b47b09a
	s_mov_b32 s10, 0xbf559e2b
	s_mov_b32 s9, 0x3fc38538
	s_mov_b32 s11, 0x3fc3ab76
	s_cmp_gt_i32 s4, -1
	s_mov_b32 s5, 1
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
	v_frexp_mant_f64_e32 v[4:5], v[2:3]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_cmp_gt_f64_e32 vcc_lo, s[6:7], v[4:5]
	s_mov_b32 s6, 0x55555780
	v_cndmask_b32_e64 v6, 0, 1, vcc_lo
	v_ldexp_f64 v[4:5], v[4:5], v6
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_add_f64 v[6:7], v[4:5], 1.0
	v_add_f64 v[12:13], v[4:5], -1.0
	v_rcp_f64_e32 v[8:9], v[6:7]
	v_add_f64 v[14:15], v[6:7], -1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_add_f64 v[4:5], v[4:5], -v[14:15]
	s_waitcnt_depctr 0xfff
	v_fma_f64 v[10:11], -v[6:7], v[8:9], 1.0
	v_fma_f64 v[8:9], v[10:11], v[8:9], v[8:9]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[10:11], -v[6:7], v[8:9], 1.0
	v_fma_f64 v[8:9], v[10:11], v[8:9], v[8:9]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[10:11], v[12:13], v[8:9]
	v_mul_f64 v[16:17], v[6:7], v[10:11]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[6:7], v[10:11], v[6:7], -v[16:17]
	v_fma_f64 v[4:5], v[10:11], v[4:5], v[6:7]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[6:7], v[16:17], v[4:5]
	v_add_f64 v[14:15], v[12:13], -v[6:7]
	v_add_f64 v[16:17], v[6:7], -v[16:17]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f64 v[12:13], v[12:13], -v[14:15]
	v_add_f64 v[4:5], v[16:17], -v[4:5]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[6:7], v[12:13], -v[6:7]
	v_add_f64 v[4:5], v[4:5], v[6:7]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[4:5], v[14:15], v[4:5]
	v_mul_f64 v[4:5], v[8:9], v[4:5]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[6:7], v[10:11], v[4:5]
	v_mul_f64 v[8:9], v[6:7], v[6:7]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_2)
	v_fma_f64 v[12:13], v[8:9], s[10:11], s[8:9]
	s_mov_b32 s8, 0xd7f4df2e
	s_mov_b32 s9, 0x3fc7474d
	v_mul_f64 v[14:15], v[6:7], v[8:9]
	v_fma_f64 v[12:13], v[8:9], v[12:13], s[8:9]
	s_mov_b32 s8, 0x16291751
	s_mov_b32 s9, 0x3fcc71c0
	s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1)
	v_fma_f64 v[12:13], v[8:9], v[12:13], s[8:9]
	s_mov_b32 s8, 0x9b27acf1
	s_mov_b32 s9, 0x3fd24924
	s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1)
	v_fma_f64 v[12:13], v[8:9], v[12:13], s[8:9]
	s_mov_b32 s8, 0x998ef7b6
	s_mov_b32 s9, 0x3fd99999
	s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1)
	v_fma_f64 v[12:13], v[8:9], v[12:13], s[8:9]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_4) | instid1(VALU_DEP_3)
	v_fma_f64 v[8:9], v[8:9], v[12:13], s[6:7]
	v_ldexp_f64 v[12:13], v[6:7], 1
	v_add_f64 v[6:7], v[6:7], -v[10:11]
	s_mov_b32 s6, 0x652b82fe
	s_mov_b32 s7, 0x3ff71547
	v_mul_f64 v[8:9], v[14:15], v[8:9]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f64 v[4:5], v[4:5], -v[6:7]
	v_add_f64 v[10:11], v[12:13], v[8:9]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_ldexp_f64 v[4:5], v[4:5], 1
	v_add_f64 v[6:7], v[10:11], -v[12:13]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[6:7], v[8:9], -v[6:7]
	v_add_f64 v[4:5], v[4:5], v[6:7]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[6:7], v[10:11], v[4:5]
	v_add_f64 v[8:9], v[6:7], -v[10:11]
	v_mul_f64 v[10:11], v[6:7], s[6:7]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f64 v[4:5], v[4:5], -v[8:9]
	v_fma_f64 v[8:9], v[6:7], s[6:7], -v[10:11]
	s_delay_alu instid0(VALU_DEP_1)
	v_fma_f64 v[4:5], v[4:5], s[6:7], v[8:9]
	v_frexp_exp_i32_f64_e32 v8, v[2:3]
	s_mov_b32 s6, 0xffda0d24
	s_mov_b32 s7, 0x3c7777d0
	s_delay_alu instid0(VALU_DEP_2) | instid1(SALU_CYCLE_1)
	v_fma_f64 v[2:3], v[6:7], s[6:7], v[4:5]
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_subrev_co_ci_u32_e32 v4, vcc_lo, 0, v8, vcc_lo
	s_cselect_b32 vcc_lo, -1, 0
	s_cmp_lg_u32 s4, 0
	v_cvt_f64_i32_e32 v[4:5], v4
	s_cselect_b32 s1, -1, 0
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[6:7], v[10:11], v[2:3]
	v_add_f64 v[8:9], v[6:7], v[4:5]
	v_add_f64 v[10:11], v[6:7], -v[10:11]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f64 v[12:13], v[8:9], -v[4:5]
	v_add_f64 v[2:3], v[2:3], -v[10:11]
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_add_f64 v[14:15], v[12:13], -v[8:9]
	v_add_f64 v[6:7], v[6:7], -v[12:13]
	v_add_f64 v[4:5], v[14:15], v[4:5]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[4:5], v[6:7], v[4:5]
	v_add_f64 v[2:3], v[2:3], v[4:5]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[2:3], v[8:9], v[2:3]
	v_cndmask_b32_e32 v3, 0x7ff80000, v3, vcc_lo
	s_and_b32 vcc_lo, s1, vcc_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cndmask_b32_e32 v2, 0, v2, vcc_lo
	v_cndmask_b32_e64 v3, 0xfff00000, v3, s1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ceil_f64_e32 v[2:3], v[2:3]
	v_cvt_i32_f64_e32 v2, v[2:3]
	s_delay_alu instid0(VALU_DEP_1)
	v_cmp_gt_i32_e32 vcc_lo, 1, v2
	v_readfirstlane_b32 s1, v2
	s_cbranch_vccnz .LBB0_7
; %bb.3:                                ; %.lr.ph.preheader
	s_delay_alu instid0(VALU_DEP_1)
	s_add_i32 s6, s1, -1
.LBB0_4:                                ; %.lr.ph
                                        ; =>This Inner Loop Header: Depth=1
	v_lshlrev_b32_e32 v2, s5, v0
	s_add_i32 s1, s5, -1
	s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1)
	v_lshl_or_b32 v3, 1, s1, v2
	s_lshl_b32 s1, 1, s6
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cmp_gt_i32_e32 vcc_lo, s1, v0
	v_cmp_gt_i32_e64 s1, s4, v3
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s7, vcc_lo, s1
	s_and_saveexec_b32 s1, s7
	s_cbranch_execz .LBB0_6
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	v_lshlrev_b32_e32 v3, 2, v3
	v_lshlrev_b32_e32 v2, 2, v2
	ds_load_b32 v3, v3
	ds_load_b32 v4, v2
	s_waitcnt lgkmcnt(0)
	v_add_nc_u32_e32 v3, v4, v3
	ds_store_b32 v2, v3
.LBB0_6:                                ;   in Loop: Header=BB0_4 Depth=1
	s_or_b32 exec_lo, exec_lo, s1
	s_add_i32 s6, s6, -1
	s_add_i32 s5, s5, 1
	s_cmp_lg_u32 s6, -1
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
	s_cbranch_scc1 .LBB0_4
.LBB0_7:                                ; %._crit_edge
	s_and_saveexec_b32 s1, s0
	s_cbranch_execz .LBB0_9
; %bb.8:
	ds_load_b32 v0, v1
	s_waitcnt lgkmcnt(0)
	global_store_b32 v1, v0, s[2:3]
.LBB0_9:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z16kernel_hypercubePii
		.amdhsa_group_segment_fixed_size 4096
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 12
		.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 18
		.amdhsa_next_free_sgpr 12
		.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	_Z16kernel_hypercubePii, .Lfunc_end0-_Z16kernel_hypercubePii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 1120
; NumSgprs: 14
; NumVgprs: 18
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 4096 bytes/workgroup (compile time only)
; SGPRBlocks: 1
; VGPRBlocks: 2
; NumSGPRsForWavesPerEU: 14
; NumVGPRsForWavesPerEU: 18
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.protected	_Z23kernel_hypercube_uneDimPiiii ; -- Begin function _Z23kernel_hypercube_uneDimPiiii
	.globl	_Z23kernel_hypercube_uneDimPiiii
	.p2align	8
	.type	_Z23kernel_hypercube_uneDimPiiii,@function
_Z23kernel_hypercube_uneDimPiiii:       ; @_Z23kernel_hypercube_uneDimPiiii
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x24
	s_load_b128 s[4:7], s[0:1], 0x8
	s_waitcnt lgkmcnt(0)
	s_and_b32 s2, s2, 0xffff
	s_sub_i32 s3, s6, s5
	v_mad_u64_u32 v[1:2], null, s15, s2, v[0:1]
	s_add_i32 s2, s5, -1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b32_e32 v0, s5, v1
	v_lshl_or_b32 v2, 1, s2, v0
	s_lshl_b32 s2, 1, s3
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cmp_gt_i32_e32 vcc_lo, s2, v1
	v_cmp_gt_i32_e64 s2, s4, v2
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s2, vcc_lo, s2
	s_and_saveexec_b32 s3, s2
	s_cbranch_execz .LBB1_2
; %bb.1:
	s_load_b64 s[0:1], s[0:1], 0x0
	v_ashrrev_i32_e32 v3, 31, v2
	v_ashrrev_i32_e32 v1, 31, v0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_lshlrev_b64 v[2:3], 2, v[2:3]
	v_lshlrev_b64 v[0:1], 2, v[0:1]
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_u32 v2, vcc_lo, s0, v2
	v_add_co_ci_u32_e32 v3, vcc_lo, s1, v3, vcc_lo
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_add_co_u32 v0, vcc_lo, s0, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
	s_clause 0x1
	global_load_b32 v2, v[2:3], off
	global_load_b32 v3, v[0:1], off
	s_waitcnt vmcnt(0)
	v_add_nc_u32_e32 v2, v3, v2
	global_store_b32 v[0:1], v2, off
.LBB1_2:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z23kernel_hypercube_uneDimPiiii
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 280
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 4
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end1:
	.size	_Z23kernel_hypercube_uneDimPiiii, .Lfunc_end1-_Z23kernel_hypercube_uneDimPiiii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 220
; NumSgprs: 18
; NumVgprs: 4
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 4
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.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
      - .offset:         8
        .size:           4
        .value_kind:     by_value
    .group_segment_fixed_size: 4096
    .kernarg_segment_align: 8
    .kernarg_segment_size: 12
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z16kernel_hypercubePii
    .private_segment_fixed_size: 0
    .sgpr_count:     14
    .sgpr_spill_count: 0
    .symbol:         _Z16kernel_hypercubePii.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     18
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .offset:         8
        .size:           4
        .value_kind:     by_value
      - .offset:         12
        .size:           4
        .value_kind:     by_value
      - .offset:         16
        .size:           4
        .value_kind:     by_value
      - .offset:         24
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         28
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         36
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         38
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         40
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         42
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         44
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         46
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         64
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         88
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 280
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z23kernel_hypercube_uneDimPiiii
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z23kernel_hypercube_uneDimPiiii.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     4
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
