#include <iostream>
#include <cuda_runtime.h>
#include <cooperative_groups.h>
#include <vector>

namespace cg = cooperative_groups;

#define BUCKET_SIZE 8192
#define TABLE_SIZE (BUCKET_SIZE * 2)  // Twice the bucket size for collision handling

__device__ int hash_table[TABLE_SIZE];

__global__ void insert_into_hash_table(int *keys, int num_keys) {
    int tid = threadIdx.x + blockIdx.x * blockDim.x;
    if (tid >= num_keys) return;

    int key = keys[tid];
    int hash_index = key % BUCKET_SIZE;
    int index = hash_index;

    // Use cooperative groups for better synchronization
    cg::thread_block cta = cg::this_thread_block();
    cg::grid_group grid = cg::this_grid();

    // Linear probing
    while (true) {
        // Each thread tries to insert into the hash table
        int expected = 0;
        int assumed;
        do {
            assumed = atomicCAS(&hash_table[index], expected, key);
            if (assumed == 0) {
                // Successfully inserted
                break;
            } else if (assumed == key) {
                // Key already exists
                break;
            } else {
                // Collision, try next slot
                index = (index + 1) % TABLE_SIZE;
                expected = 0;
            }
        } while (assumed != 0);

        // Synchronize all threads in the block to ensure no race conditions
        cta.sync();
    }
}

__global__ void search_in_hash_table(int *keys, int num_keys, int *results) {
    int tid = threadIdx.x + blockIdx.x * blockDim.x;
    if (tid >= num_keys) return;

    int key = keys[tid];
    int hash_index = key % BUCKET_SIZE;
    int index = hash_index;

    // Use cooperative groups for better synchronization
    cg::thread_block cta = cg::this_thread_block();

    // Linear probing
    while (true) {
        if (hash_table[index] == key) {
            results[tid] = 1;  // Key found
            break;
        } else if (hash_table[index] == 0) {
            results[tid] = 0;  // Key not found
            break;
        } else {
            // Collision, try next slot
            index = (index + 1) % TABLE_SIZE;
        }
    }

    // Synchronize all threads in the block to ensure no race conditions
    cta.sync();
}

int main() {
    const int num_keys = 1024;
    std::vector<int> h_keys(num_keys);
    std::vector<int> h_results(num_keys, 0);

    // Initialize keys with some values
    for (int i = 0; i < num_keys; ++i) {
        h_keys[i] = i * 3;  // Example keys
    }

    int *d_keys, *d_results;
    cudaError_t err;

    // Allocate memory on the device
    err = cudaMalloc((void **)&d_keys, num_keys * sizeof(int));
    if (err != cudaSuccess) {
        std::cerr << "Error allocating d_keys: " << cudaGetErrorString(err) << std::endl;
        return -1;
    }

    err = cudaMalloc((void **)&d_results, num_keys * sizeof(int));
    if (err != cudaSuccess) {
        std::cerr << "Error allocating d_results: " << cudaGetErrorString(err) << std::endl;
        cudaFree(d_keys);
        return -1;
    }

    // Copy keys from host to device
    err = cudaMemcpy(d_keys, h_keys.data(), num_keys * sizeof(int), cudaMemcpyHostToDevice);
    if (err != cudaSuccess) {
        std::cerr << "Error copying to device: " << cudaGetErrorString(err) << std::endl;
        cudaFree(d_keys);
        cudaFree(d_results);
        return -1;
    }

    // Insert keys into hash table
    int threads_per_block = 256;
    int blocks_per_grid = (num_keys + threads_per_block - 1) / threads_per_block;
    insert_into_hash_table<<<blocks_per_grid, threads_per_block>>>(d_keys, num_keys);
    err = cudaGetLastError();
    if (err != cudaSuccess) {
        std::cerr << "Error launching insert kernel: " << cudaGetErrorString(err) << std::endl;
        cudaFree(d_keys);
        cudaFree(d_results);
        return -1;
    }

    // Search for keys in hash table
    search_in_hash_table<<<blocks_per_grid, threads_per_block>>>(d_keys, num_keys, d_results);
    err = cudaGetLastError();
    if (err != cudaSuccess) {
        std::cerr << "Error launching search kernel: " << cudaGetErrorString(err) << std::endl;
        cudaFree(d_keys);
        cudaFree(d_results);
        return -1;
    }

    // Copy results from device to host
    err = cudaMemcpy(h_results.data(), d_results, num_keys * sizeof(int), cudaMemcpyDeviceToHost);
    if (err != cudaSuccess) {
        std::cerr << "Error copying from device: " << cudaGetErrorString(err) << std::endl;
        cudaFree(d_keys);
        cudaFree(d_results);
        return -1;
    }

    // Verify results
    bool all_found = true;
    for (int i = 0; i < num_keys; ++i) {
        if (h_results[i] != 1) {
            all_found = false;
            break;
        }
    }

    if (all_found) {
        std::cout << "All keys found successfully in the hash table." << std::endl;
    } else {
        std::cout << "Not all keys were found in the hash table." << std::endl;
    }

    // Free device memory
    cudaFree(d_keys);
    cudaFree(d_results);

    return 0;
}
	.file	"tmpxft_001c524d_00000000-6_cuda_code_004655.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB7198:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE7198:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.align 2
	.type	_ZNSolsEPFRSoS_E.isra.0, @function
_ZNSolsEPFRSoS_E.isra.0:
.LFB8165:
	.cfi_startproc
	jmp	*%rsi
	.cfi_endproc
.LFE8165:
	.size	_ZNSolsEPFRSoS_E.isra.0, .-_ZNSolsEPFRSoS_E.isra.0
	.globl	_Z43__device_stub__Z22insert_into_hash_tablePiiPii
	.type	_Z43__device_stub__Z22insert_into_hash_tablePiiPii, @function
_Z43__device_stub__Z22insert_into_hash_tablePiiPii:
.LFB7220:
	.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	.L3
	pushq	32(%rsp)
	.cfi_def_cfa_offset 136
	leaq	_Z22insert_into_hash_tablePii(%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
.L3:
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	je	.L5
	call	__stack_chk_fail@PLT
.L5:
	addq	$120, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE7220:
	.size	_Z43__device_stub__Z22insert_into_hash_tablePiiPii, .-_Z43__device_stub__Z22insert_into_hash_tablePiiPii
	.globl	_Z22insert_into_hash_tablePii
	.type	_Z22insert_into_hash_tablePii, @function
_Z22insert_into_hash_tablePii:
.LFB7221:
	.cfi_startproc
	endbr64
	jmp	_Z43__device_stub__Z22insert_into_hash_tablePiiPii
	.cfi_endproc
.LFE7221:
	.size	_Z22insert_into_hash_tablePii, .-_Z22insert_into_hash_tablePii
	.globl	_Z43__device_stub__Z20search_in_hash_tablePiiS_PiiS_
	.type	_Z43__device_stub__Z20search_in_hash_tablePiiS_PiiS_, @function
_Z43__device_stub__Z20search_in_hash_tablePiiS_PiiS_:
.LFB7222:
	.cfi_startproc
	endbr64
	subq	$136, %rsp
	.cfi_def_cfa_offset 144
	movq	%rdi, 24(%rsp)
	leaq	40(%rsp), %rcx
	leaq	48(%rsp), %rdi
	movl	%esi, 20(%rsp)
	leaq	60(%rsp), %rsi
	movq	%rdx, 8(%rsp)
	leaq	32(%rsp), %rdx
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	20(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 112(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L9
	pushq	40(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_Z20search_in_hash_tablePiiS_(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 160
	movq	76(%rsp), %rcx
	movl	84(%rsp), %r8d
	movq	64(%rsp), %rsi
	movl	72(%rsp), %edx
	leaq	112(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 152
	popq	%rdx
	.cfi_def_cfa_offset 144
.L9:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L11
	call	__stack_chk_fail@PLT
.L11:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE7222:
	.size	_Z43__device_stub__Z20search_in_hash_tablePiiS_PiiS_, .-_Z43__device_stub__Z20search_in_hash_tablePiiS_PiiS_
	.globl	_Z20search_in_hash_tablePiiS_
	.type	_Z20search_in_hash_tablePiiS_, @function
_Z20search_in_hash_tablePiiS_:
.LFB7223:
	.cfi_startproc
	endbr64
	jmp	_Z43__device_stub__Z20search_in_hash_tablePiiS_PiiS_
	.cfi_endproc
.LFE7223:
	.size	_Z20search_in_hash_tablePiiS_, .-_Z20search_in_hash_tablePiiS_
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"_Z20search_in_hash_tablePiiS_"
.LC1:
	.string	"_Z22insert_into_hash_tablePii"
.LC2:
	.string	"hash_table"
.LC3:
	.string	"_ZN50_INTERNAL_832b2b03_19_cuda_code_004655_cu_93caed794cuda3std3__419piecewise_constructE"
.LC4:
	.string	"_ZN50_INTERNAL_832b2b03_19_cuda_code_004655_cu_93caed794cuda3std6ranges3__45__cpo4swapE"
.LC5:
	.string	"_ZN50_INTERNAL_832b2b03_19_cuda_code_004655_cu_93caed794cuda3std6ranges3__45__cpo9iter_moveE"
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB7225:
	.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	.LC0(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z20search_in_hash_tablePiiS_(%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	.LC1(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z22insert_into_hash_tablePii(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC2(%rip), %rdx
	movl	$65536, %r9d
	leaq	_ZL10hash_table(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	call	__cudaRegisterVar@PLT
	popq	%rax
	.cfi_def_cfa_offset 24
	popq	%rdx
	.cfi_def_cfa_offset 16
	pushq	$0
	.cfi_def_cfa_offset 24
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC3(%rip), %rdx
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	movq	%rdx, %rcx
	movl	$1, %r9d
	leaq	_ZN4cuda3std3__419piecewise_constructE(%rip), %rsi
	call	__cudaRegisterVar@PLT
	popq	%rcx
	.cfi_def_cfa_offset 24
	popq	%rsi
	.cfi_def_cfa_offset 16
	pushq	$0
	.cfi_def_cfa_offset 24
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC4(%rip), %rdx
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	movq	%rdx, %rcx
	movl	$1, %r9d
	leaq	_ZN4cuda3std6ranges3__45__cpo4swapE(%rip), %rsi
	call	__cudaRegisterVar@PLT
	popq	%rdi
	.cfi_def_cfa_offset 24
	popq	%r8
	.cfi_def_cfa_offset 16
	pushq	$0
	.cfi_def_cfa_offset 24
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC5(%rip), %rdx
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	movl	$1, %r9d
	movq	%rdx, %rcx
	leaq	_ZN4cuda3std6ranges3__45__cpo9iter_moveE(%rip), %rsi
	call	__cudaRegisterVar@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	popq	%r9
	.cfi_def_cfa_offset 24
	popq	%r10
	.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
.LFE7225:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.text._ZNSt6vectorIiSaIiEED2Ev,"axG",@progbits,_ZNSt6vectorIiSaIiEED5Ev,comdat
	.align 2
	.weak	_ZNSt6vectorIiSaIiEED2Ev
	.type	_ZNSt6vectorIiSaIiEED2Ev, @function
_ZNSt6vectorIiSaIiEED2Ev:
.LFB7674:
	.cfi_startproc
	endbr64
	movq	(%rdi), %rax
	testq	%rax, %rax
	je	.L16
	movq	16(%rdi), %rsi
	movq	%rax, %rdi
	subq	%rax, %rsi
	jmp	_ZdlPvm@PLT
.L16:
	ret
	.cfi_endproc
.LFE7674:
	.size	_ZNSt6vectorIiSaIiEED2Ev, .-_ZNSt6vectorIiSaIiEED2Ev
	.weak	_ZNSt6vectorIiSaIiEED1Ev
	.set	_ZNSt6vectorIiSaIiEED1Ev,_ZNSt6vectorIiSaIiEED2Ev
	.section	.rodata.str1.1
.LC6:
	.string	"Error allocating d_keys: "
.LC7:
	.string	"Error allocating d_results: "
.LC8:
	.string	"Error copying to device: "
.LC9:
	.string	"Error launching insert kernel: "
.LC10:
	.string	"Error launching search kernel: "
.LC11:
	.string	"Error copying from device: "
.LC12:
	.string	"Not all keys were found in the hash table."
.LC13:
	.string	"All keys found successfully in the hash table."
	.section	.text.startup
	.globl	main
	.type	main, @function
main:
.LFB7195:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA7195
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movl	$4096, %edi
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$96, %rsp
	.cfi_def_cfa_offset 128
	movq	%fs:40, %rax
	movq	%rax, 88(%rsp)
	xorl	%eax, %eax
.LEHB0:
	call	_Znwm@PLT
.LEHE0:
	xorl	%r8d, %r8d
	leaq	4096(%rax), %rdx
	movq	%rax, 40(%rsp)
	movq	%rax, %rbx
	movq	%rdx, 56(%rsp)
	movl	%r8d, (%rax)
	xorl	%eax, %eax
.L19:
	addq	$4, %rax
	cmpq	$4096, %rax
	je	.L91
	xorl	%edi, %edi
	movl	%edi, (%rbx,%rax)
	jmp	.L19
.L91:
	xorl	%esi, %esi
	movl	$4096, %edi
	movq	%rdx, 48(%rsp)
	movq	%rsi, 72(%rsp)
	movq	%rsi, 80(%rsp)
.LEHB1:
	call	_Znwm@PLT
.LEHE1:
	leaq	4096(%rax), %rdx
	movq	%rax, 64(%rsp)
	movq	%rax, %rbp
	xorl	%eax, %eax
	movq	%rdx, 80(%rsp)
.L21:
	xorl	%ecx, %ecx
	movl	%ecx, 0(%rbp,%rax)
	addq	$4, %rax
	cmpq	$4096, %rax
	jne	.L21
	movq	%rdx, 72(%rsp)
	xorl	%eax, %eax
.L22:
	leal	(%rax,%rax,2), %edx
	movl	%edx, (%rbx,%rax,4)
	incq	%rax
	cmpq	$1024, %rax
	jne	.L22
	movq	%rsp, %rdi
	movl	$4096, %esi
.LEHB2:
	call	cudaMalloc@PLT
	movl	%eax, %r12d
	testl	%eax, %eax
	je	.L23
	leaq	.LC6(%rip), %rsi
	leaq	_ZSt4cerr(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	%r12d, %edi
	movq	%rax, %rbx
	call	cudaGetErrorString@PLT
	movq	%rax, %rsi
	movq	%rbx, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
.L26:
	orl	$-1, %ebx
	jmp	.L24
.L23:
	leaq	8(%rsp), %rdi
	movl	$4096, %esi
	call	cudaMalloc@PLT
	movl	%eax, %r12d
	testl	%eax, %eax
	je	.L25
	leaq	.LC7(%rip), %rsi
	leaq	_ZSt4cerr(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	%r12d, %edi
	movq	%rax, %rbx
	call	cudaGetErrorString@PLT
	movq	%rax, %rsi
	movq	%rbx, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movq	(%rsp), %rdi
	jmp	.L63
.L25:
	movq	(%rsp), %rdi
	movl	$1, %ecx
	movl	$4096, %edx
	movq	%rbx, %rsi
	call	cudaMemcpy@PLT
	movl	%eax, %ebx
	testl	%eax, %eax
	je	.L27
	leaq	.LC8(%rip), %rsi
.L86:
	leaq	_ZSt4cerr(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	%ebx, %edi
	movq	%rax, %rbp
	call	cudaGetErrorString@PLT
	movq	%rax, %rsi
	movq	%rbp, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movq	(%rsp), %rdi
	call	cudaFree@PLT
	movq	8(%rsp), %rdi
.L63:
	call	cudaFree@PLT
	jmp	.L26
.L27:
	movl	$16777217, %edx
	movl	$1073741825, %edi
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	salq	$8, %rdx
	salq	$2, %rdi
	movl	$1, %ecx
	movl	$1, %esi
	movq	%rdx, 28(%rsp)
	movl	$1, 36(%rsp)
	movq	%rdi, 16(%rsp)
	movl	$1, 24(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	je	.L28
.L30:
	call	cudaGetLastError@PLT
	movl	%eax, %ebx
	testl	%eax, %eax
	je	.L31
	leaq	.LC9(%rip), %rsi
	jmp	.L86
.L28:
	movq	(%rsp), %rdi
	movl	$1024, %esi
	call	_Z43__device_stub__Z22insert_into_hash_tablePiiPii
	jmp	.L30
.L31:
	movl	$16777217, %edx
	movl	$1073741825, %edi
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	salq	$8, %rdx
	salq	$2, %rdi
	movl	$1, %ecx
	movl	$1, %esi
	movq	%rdx, 28(%rsp)
	movl	$1, 36(%rsp)
	movq	%rdi, 16(%rsp)
	movl	$1, 24(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	je	.L32
.L34:
	call	cudaGetLastError@PLT
	movl	%eax, %ebx
	testl	%eax, %eax
	je	.L35
	leaq	.LC10(%rip), %rsi
	jmp	.L86
.L32:
	movq	8(%rsp), %rdx
	movq	(%rsp), %rdi
	movl	$1024, %esi
	call	_Z43__device_stub__Z20search_in_hash_tablePiiS_PiiS_
	jmp	.L34
.L35:
	movq	8(%rsp), %rsi
	movl	$2, %ecx
	movl	$4096, %edx
	movq	%rbp, %rdi
	call	cudaMemcpy@PLT
	movl	%eax, %ebx
	leaq	.LC11(%rip), %rsi
	xorl	%eax, %eax
	testl	%ebx, %ebx
	jne	.L86
.L36:
	cmpl	$1, 0(%rbp,%rax,4)
	jne	.L37
	incq	%rax
	cmpq	$1024, %rax
	jne	.L36
	leaq	.LC13(%rip), %rsi
	jmp	.L72
.L37:
	leaq	.LC12(%rip), %rsi
.L72:
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movq	(%rsp), %rdi
	call	cudaFree@PLT
	movq	8(%rsp), %rdi
	call	cudaFree@PLT
.LEHE2:
	xorl	%ebx, %ebx
.L24:
	leaq	64(%rsp), %rdi
	call	_ZNSt6vectorIiSaIiEED1Ev
	leaq	40(%rsp), %rdi
	call	_ZNSt6vectorIiSaIiEED1Ev
	movq	88(%rsp), %rax
	subq	%fs:40, %rax
	je	.L46
	jmp	.L58
.L49:
	endbr64
	movq	%rax, %rbx
.L41:
	leaq	64(%rsp), %rdi
	call	_ZNSt6vectorIiSaIiEED1Ev
	jmp	.L42
.L48:
	endbr64
	movq	%rax, %rbx
.L42:
	leaq	40(%rsp), %rdi
	call	_ZNSt6vectorIiSaIiEED1Ev
	movq	88(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L58
	movq	%rbx, %rdi
.LEHB3:
	call	_Unwind_Resume@PLT
.LEHE3:
.L58:
	call	__stack_chk_fail@PLT
.L46:
	addq	$96, %rsp
	.cfi_def_cfa_offset 32
	movl	%ebx, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE7195:
	.globl	__gxx_personality_v0
	.section	.gcc_except_table,"a",@progbits
.LLSDA7195:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE7195-.LLSDACSB7195
.LLSDACSB7195:
	.uleb128 .LEHB0-.LFB7195
	.uleb128 .LEHE0-.LEHB0
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB1-.LFB7195
	.uleb128 .LEHE1-.LEHB1
	.uleb128 .L48-.LFB7195
	.uleb128 0
	.uleb128 .LEHB2-.LFB7195
	.uleb128 .LEHE2-.LEHB2
	.uleb128 .L49-.LFB7195
	.uleb128 0
	.uleb128 .LEHB3-.LFB7195
	.uleb128 .LEHE3-.LEHB3
	.uleb128 0
	.uleb128 0
.LLSDACSE7195:
	.section	.text.startup
	.size	main, .-main
	.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
	.local	_ZL10hash_table
	.comm	_ZL10hash_table,65536,32
	.weak	_ZN4cuda3std3__419piecewise_constructE
	.section	.rodata._ZN4cuda3std3__419piecewise_constructE,"aG",@progbits,_ZN4cuda3std3__419piecewise_constructE,comdat
	.type	_ZN4cuda3std3__419piecewise_constructE, @gnu_unique_object
	.size	_ZN4cuda3std3__419piecewise_constructE, 1
_ZN4cuda3std3__419piecewise_constructE:
	.zero	1
	.weak	_ZN4cuda3std6ranges3__45__cpo9iter_moveE
	.section	.rodata._ZN4cuda3std6ranges3__45__cpo9iter_moveE,"aG",@progbits,_ZN4cuda3std6ranges3__45__cpo9iter_moveE,comdat
	.type	_ZN4cuda3std6ranges3__45__cpo9iter_moveE, @gnu_unique_object
	.size	_ZN4cuda3std6ranges3__45__cpo9iter_moveE, 1
_ZN4cuda3std6ranges3__45__cpo9iter_moveE:
	.zero	1
	.weak	_ZN4cuda3std6ranges3__45__cpo4swapE
	.section	.rodata._ZN4cuda3std6ranges3__45__cpo4swapE,"aG",@progbits,_ZN4cuda3std6ranges3__45__cpo4swapE,comdat
	.type	_ZN4cuda3std6ranges3__45__cpo4swapE, @gnu_unique_object
	.size	_ZN4cuda3std6ranges3__45__cpo4swapE, 1
_ZN4cuda3std6ranges3__45__cpo4swapE:
	.zero	1
	.hidden	DW.ref.__gxx_personality_v0
	.weak	DW.ref.__gxx_personality_v0
	.section	.data.rel.local.DW.ref.__gxx_personality_v0,"awG",@progbits,DW.ref.__gxx_personality_v0,comdat
	.align 8
	.type	DW.ref.__gxx_personality_v0, @object
	.size	DW.ref.__gxx_personality_v0, 8
DW.ref.__gxx_personality_v0:
	.quad	__gxx_personality_v0
	.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 <iostream>
#include <hip/hip_runtime.h>
#include <hip/hip_cooperative_groups.h>
#include <vector>

namespace cg = cooperative_groups;

#define BUCKET_SIZE 8192
#define TABLE_SIZE (BUCKET_SIZE * 2)  // Twice the bucket size for collision handling

__device__ int hash_table[TABLE_SIZE];

__global__ void insert_into_hash_table(int *keys, int num_keys) {
    int tid = threadIdx.x + blockIdx.x * blockDim.x;
    if (tid >= num_keys) return;

    int key = keys[tid];
    int hash_index = key % BUCKET_SIZE;
    int index = hash_index;

    // Use cooperative groups for better synchronization
    cg::thread_block cta = cg::this_thread_block();
    cg::grid_group grid = cg::this_grid();

    // Linear probing
    while (true) {
        // Each thread tries to insert into the hash table
        int expected = 0;
        int assumed;
        do {
            assumed = atomicCAS(&hash_table[index], expected, key);
            if (assumed == 0) {
                // Successfully inserted
                break;
            } else if (assumed == key) {
                // Key already exists
                break;
            } else {
                // Collision, try next slot
                index = (index + 1) % TABLE_SIZE;
                expected = 0;
            }
        } while (assumed != 0);

        // Synchronize all threads in the block to ensure no race conditions
        cta.sync();
    }
}

__global__ void search_in_hash_table(int *keys, int num_keys, int *results) {
    int tid = threadIdx.x + blockIdx.x * blockDim.x;
    if (tid >= num_keys) return;

    int key = keys[tid];
    int hash_index = key % BUCKET_SIZE;
    int index = hash_index;

    // Use cooperative groups for better synchronization
    cg::thread_block cta = cg::this_thread_block();

    // Linear probing
    while (true) {
        if (hash_table[index] == key) {
            results[tid] = 1;  // Key found
            break;
        } else if (hash_table[index] == 0) {
            results[tid] = 0;  // Key not found
            break;
        } else {
            // Collision, try next slot
            index = (index + 1) % TABLE_SIZE;
        }
    }

    // Synchronize all threads in the block to ensure no race conditions
    cta.sync();
}

int main() {
    const int num_keys = 1024;
    std::vector<int> h_keys(num_keys);
    std::vector<int> h_results(num_keys, 0);

    // Initialize keys with some values
    for (int i = 0; i < num_keys; ++i) {
        h_keys[i] = i * 3;  // Example keys
    }

    int *d_keys, *d_results;
    hipError_t err;

    // Allocate memory on the device
    err = hipMalloc((void **)&d_keys, num_keys * sizeof(int));
    if (err != hipSuccess) {
        std::cerr << "Error allocating d_keys: " << hipGetErrorString(err) << std::endl;
        return -1;
    }

    err = hipMalloc((void **)&d_results, num_keys * sizeof(int));
    if (err != hipSuccess) {
        std::cerr << "Error allocating d_results: " << hipGetErrorString(err) << std::endl;
        hipFree(d_keys);
        return -1;
    }

    // Copy keys from host to device
    err = hipMemcpy(d_keys, h_keys.data(), num_keys * sizeof(int), hipMemcpyHostToDevice);
    if (err != hipSuccess) {
        std::cerr << "Error copying to device: " << hipGetErrorString(err) << std::endl;
        hipFree(d_keys);
        hipFree(d_results);
        return -1;
    }

    // Insert keys into hash table
    int threads_per_block = 256;
    int blocks_per_grid = (num_keys + threads_per_block - 1) / threads_per_block;
    insert_into_hash_table<<<blocks_per_grid, threads_per_block>>>(d_keys, num_keys);
    err = hipGetLastError();
    if (err != hipSuccess) {
        std::cerr << "Error launching insert kernel: " << hipGetErrorString(err) << std::endl;
        hipFree(d_keys);
        hipFree(d_results);
        return -1;
    }

    // Search for keys in hash table
    search_in_hash_table<<<blocks_per_grid, threads_per_block>>>(d_keys, num_keys, d_results);
    err = hipGetLastError();
    if (err != hipSuccess) {
        std::cerr << "Error launching search kernel: " << hipGetErrorString(err) << std::endl;
        hipFree(d_keys);
        hipFree(d_results);
        return -1;
    }

    // Copy results from device to host
    err = hipMemcpy(h_results.data(), d_results, num_keys * sizeof(int), hipMemcpyDeviceToHost);
    if (err != hipSuccess) {
        std::cerr << "Error copying from device: " << hipGetErrorString(err) << std::endl;
        hipFree(d_keys);
        hipFree(d_results);
        return -1;
    }

    // Verify results
    bool all_found = true;
    for (int i = 0; i < num_keys; ++i) {
        if (h_results[i] != 1) {
            all_found = false;
            break;
        }
    }

    if (all_found) {
        std::cout << "All keys found successfully in the hash table." << std::endl;
    } else {
        std::cout << "Not all keys were found in the hash table." << std::endl;
    }

    // Free device memory
    hipFree(d_keys);
    hipFree(d_results);

    return 0;
}
	.text
	.file	"cuda_code_004655.hip"
                                        # Start of file scope inline assembly
	.globl	_ZSt21ios_base_library_initv

                                        # End of file scope inline assembly
	.globl	_Z37__device_stub__insert_into_hash_tablePii # -- Begin function _Z37__device_stub__insert_into_hash_tablePii
	.type	_Z37__device_stub__insert_into_hash_tablePii,@function
_Z37__device_stub__insert_into_hash_tablePii: # @_Z37__device_stub__insert_into_hash_tablePii
	.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	$_Z22insert_into_hash_tablePii, %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_end0:
	.size	_Z37__device_stub__insert_into_hash_tablePii, .Lfunc_end0-_Z37__device_stub__insert_into_hash_tablePii
	.cfi_endproc
                                        # -- End function
	.globl	_Z35__device_stub__search_in_hash_tablePiiS_ # -- Begin function _Z35__device_stub__search_in_hash_tablePiiS_
	.type	_Z35__device_stub__search_in_hash_tablePiiS_,@function
_Z35__device_stub__search_in_hash_tablePiiS_: # @_Z35__device_stub__search_in_hash_tablePiiS_
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	12(%rsp), %rcx
	movl	%esi, (%rcx)
	leaq	32(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	movq	%rsi, 16(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z20search_in_hash_tablePiiS_, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end1:
	.size	_Z35__device_stub__search_in_hash_tablePiiS_, .Lfunc_end1-_Z35__device_stub__search_in_hash_tablePiiS_
	.cfi_endproc
                                        # -- End function
	.globl	main                            # -- Begin function main
	.type	main,@function
main:                                   # @main
.Lfunc_begin0:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception0
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$16, %rsp
	.cfi_def_cfa_offset 64
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	$4096, %edi                     # imm = 0x1000
	callq	_Znwm
	movq	%rax, %rbx
	movl	$4096, %edx                     # imm = 0x1000
	movq	%rax, %rdi
	xorl	%esi, %esi
	callq	memset@PLT
.Ltmp0:
	movl	$4096, %edi                     # imm = 0x1000
	callq	_Znwm
.Ltmp1:
# %bb.1:                                # %.lr.ph.i.i.i.i.i.i.i.i.i.preheader
	movq	%rax, %r14
	xorl	%r15d, %r15d
	movl	$4096, %edx                     # imm = 0x1000
	movq	%rax, %rdi
	xorl	%esi, %esi
	callq	memset@PLT
	movq	%rbx, %rax
.LBB2_2:                                # %_ZNSt6vectorIiSaIiEEC2EmRKiRKS0_.exit
                                        # =>This Inner Loop Header: Depth=1
	movl	%r15d, (%rax)
	addq	$3, %r15
	addq	$4, %rax
	cmpq	$3072, %r15                     # imm = 0xC00
	jne	.LBB2_2
# %bb.3:
.Ltmp3:
	movq	%rsp, %r12
	movl	$4096, %esi                     # imm = 0x1000
	movq	%r12, %rdi
	callq	hipMalloc
.Ltmp4:
# %bb.4:
	movl	%eax, %ebp
	testl	%eax, %eax
	je	.LBB2_13
# %bb.5:
.Ltmp5:
	movl	$_ZSt4cerr, %edi
	movl	$.L.str, %esi
	movl	$25, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp6:
# %bb.6:                                # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit
.Ltmp7:
	movl	%ebp, %edi
	callq	hipGetErrorString
.Ltmp8:
# %bb.7:
	movq	%rax, %r15
	testq	%rax, %rax
	je	.LBB2_8
# %bb.9:
	movq	%r15, %rdi
	callq	strlen
.Ltmp9:
	movl	$_ZSt4cerr, %edi
	movq	%r15, %rsi
	movq	%rax, %rdx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp10:
	jmp	.LBB2_10
.LBB2_13:
.Ltmp19:
	leaq	8(%rsp), %r15
	movl	$4096, %esi                     # imm = 0x1000
	movq	%r15, %rdi
	callq	hipMalloc
.Ltmp20:
# %bb.14:
	movl	%eax, %ebp
	testl	%eax, %eax
	je	.LBB2_23
# %bb.15:
.Ltmp21:
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.1, %esi
	movl	$28, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp22:
# %bb.16:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit68
.Ltmp23:
	movl	%ebp, %edi
	callq	hipGetErrorString
.Ltmp24:
# %bb.17:
	movq	%rax, %r15
	testq	%rax, %rax
	je	.LBB2_18
# %bb.19:
	movq	%r15, %rdi
	callq	strlen
.Ltmp25:
	movl	$_ZSt4cerr, %edi
	movq	%r15, %rsi
	movq	%rax, %rdx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp26:
	jmp	.LBB2_20
.LBB2_8:
	movq	_ZSt4cerr(%rip), %rax
	movq	-24(%rax), %rax
	leaq	_ZSt4cerr(%rax), %rdi
	movl	32(%rdi), %esi
	orl	$1, %esi
.Ltmp11:
	callq	_ZNSt9basic_iosIcSt11char_traitsIcEE5clearESt12_Ios_Iostate
.Ltmp12:
.LBB2_10:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit65
	movq	_ZSt4cerr(%rip), %rax
	movl	$_ZSt4cerr, %edi
	addq	-24(%rax), %rdi
.Ltmp13:
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp14:
# %bb.11:                               # %.noexc116
.Ltmp15:
	movsbl	%al, %esi
	movl	$_ZSt4cerr, %edi
	callq	_ZNSo3putEc
.Ltmp16:
# %bb.12:                               # %.noexc117
	movl	$-1, %ebp
.Ltmp17:
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp18:
	jmp	.LBB2_74
.LBB2_23:
	movq	(%rsp), %rdi
.Ltmp35:
	movl	$4096, %edx                     # imm = 0x1000
	movq	%rbx, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
.Ltmp36:
# %bb.24:
	movl	%eax, %ebp
	testl	%eax, %eax
	je	.LBB2_35
# %bb.25:
.Ltmp37:
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.2, %esi
	movl	$25, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp38:
# %bb.26:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit76
.Ltmp39:
	movl	%ebp, %edi
	callq	hipGetErrorString
.Ltmp40:
# %bb.27:
	movq	%rax, %r12
	testq	%rax, %rax
	je	.LBB2_28
# %bb.29:
	movq	%r12, %rdi
	callq	strlen
.Ltmp41:
	movl	$_ZSt4cerr, %edi
	movq	%r12, %rsi
	movq	%rax, %rdx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp42:
	jmp	.LBB2_30
.LBB2_18:
	movq	_ZSt4cerr(%rip), %rax
	movq	-24(%rax), %rax
	leaq	_ZSt4cerr(%rax), %rdi
	movl	32(%rdi), %esi
	orl	$1, %esi
.Ltmp27:
	callq	_ZNSt9basic_iosIcSt11char_traitsIcEE5clearESt12_Ios_Iostate
.Ltmp28:
.LBB2_20:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit72
	movq	_ZSt4cerr(%rip), %rax
	movl	$_ZSt4cerr, %edi
	addq	-24(%rax), %rdi
.Ltmp29:
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp30:
# %bb.21:                               # %.noexc119
.Ltmp31:
	movsbl	%al, %esi
	movl	$_ZSt4cerr, %edi
	callq	_ZNSo3putEc
.Ltmp32:
# %bb.22:                               # %.noexc120
.Ltmp33:
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp34:
	jmp	.LBB2_34
.LBB2_35:
.Ltmp56:
	movabsq	$4294967300, %rdi               # imm = 0x100000004
	movabsq	$4294967552, %rdx               # imm = 0x100000100
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
.Ltmp57:
# %bb.36:
	testl	%eax, %eax
	jne	.LBB2_38
# %bb.37:
	movq	(%rsp), %rdi
.Ltmp58:
	movl	$1024, %esi                     # imm = 0x400
	callq	_Z37__device_stub__insert_into_hash_tablePii
.Ltmp59:
.LBB2_38:
.Ltmp60:
	callq	hipGetLastError
.Ltmp61:
# %bb.39:
	movl	%eax, %ebp
	testl	%eax, %eax
	je	.LBB2_48
# %bb.40:
.Ltmp62:
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.3, %esi
	movl	$31, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp63:
# %bb.41:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit84
.Ltmp64:
	movl	%ebp, %edi
	callq	hipGetErrorString
.Ltmp65:
# %bb.42:
	movq	%rax, %r15
	testq	%rax, %rax
	je	.LBB2_43
# %bb.44:
	movq	%r15, %rdi
	callq	strlen
.Ltmp66:
	movl	$_ZSt4cerr, %edi
	movq	%r15, %rsi
	movq	%rax, %rdx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp67:
	jmp	.LBB2_45
.LBB2_28:
	movq	_ZSt4cerr(%rip), %rax
	movq	-24(%rax), %rax
	leaq	_ZSt4cerr(%rax), %rdi
	movl	32(%rdi), %esi
	orl	$1, %esi
.Ltmp43:
	callq	_ZNSt9basic_iosIcSt11char_traitsIcEE5clearESt12_Ios_Iostate
.Ltmp44:
.LBB2_30:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit80
	movq	_ZSt4cerr(%rip), %rax
	movl	$_ZSt4cerr, %edi
	addq	-24(%rax), %rdi
.Ltmp45:
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp46:
# %bb.31:                               # %.noexc123
.Ltmp47:
	movsbl	%al, %esi
	movl	$_ZSt4cerr, %edi
	callq	_ZNSo3putEc
.Ltmp48:
# %bb.32:                               # %.noexc124
.Ltmp49:
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp50:
# %bb.33:                               # %_ZNSolsEPFRSoS_E.exit82
	movq	(%rsp), %rdi
.Ltmp51:
	callq	hipFree
.Ltmp52:
	movq	%r15, %r12
.LBB2_34:                               # %.invoke
	movq	(%r12), %rdi
	movl	$-1, %ebp
.Ltmp53:
	callq	hipFree
.Ltmp54:
.LBB2_74:                               # %_ZNSt6vectorIiSaIiEED2Ev.exit108
	movq	%r14, %rdi
	callq	_ZdlPv
	movq	%rbx, %rdi
	callq	_ZdlPv
	movl	%ebp, %eax
	addq	$16, %rsp
	.cfi_def_cfa_offset 48
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.LBB2_48:
	.cfi_def_cfa_offset 64
.Ltmp76:
	movabsq	$4294967300, %rdi               # imm = 0x100000004
	movabsq	$4294967552, %rdx               # imm = 0x100000100
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
.Ltmp77:
# %bb.49:
	testl	%eax, %eax
	jne	.LBB2_51
# %bb.50:
	movq	(%rsp), %rdi
	movq	8(%rsp), %rdx
.Ltmp78:
	movl	$1024, %esi                     # imm = 0x400
	callq	_Z35__device_stub__search_in_hash_tablePiiS_
.Ltmp79:
.LBB2_51:
.Ltmp80:
	callq	hipGetLastError
.Ltmp81:
# %bb.52:
	movl	%eax, %ebp
	testl	%eax, %eax
	je	.LBB2_57
# %bb.53:
.Ltmp82:
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.4, %esi
	movl	$31, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp83:
# %bb.54:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit92
.Ltmp84:
	movl	%ebp, %edi
	callq	hipGetErrorString
.Ltmp85:
# %bb.55:
.Ltmp86:
	movl	$_ZSt4cerr, %edi
	movq	%rax, %rsi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
.Ltmp87:
# %bb.56:
.Ltmp88:
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
.Ltmp89:
	jmp	.LBB2_66
.LBB2_43:
	movq	_ZSt4cerr(%rip), %rax
	movq	-24(%rax), %rax
	leaq	_ZSt4cerr(%rax), %rdi
	movl	32(%rdi), %esi
	orl	$1, %esi
.Ltmp68:
	callq	_ZNSt9basic_iosIcSt11char_traitsIcEE5clearESt12_Ios_Iostate
.Ltmp69:
.LBB2_45:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit88
	movq	_ZSt4cerr(%rip), %rax
	movl	$_ZSt4cerr, %edi
	addq	-24(%rax), %rdi
.Ltmp70:
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp71:
# %bb.46:                               # %.noexc127
.Ltmp72:
	movsbl	%al, %esi
	movl	$_ZSt4cerr, %edi
	callq	_ZNSo3putEc
.Ltmp73:
# %bb.47:                               # %.noexc128
.Ltmp74:
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp75:
.LBB2_66:                               # %_ZNSolsEPFRSoS_E.exit98.invoke
	movq	(%rsp), %rdi
.Ltmp100:
	callq	hipFree
.Ltmp101:
# %bb.67:                               # %.invoke159
	movl	$-1, %ebp
	movq	8(%rsp), %rdi
.Ltmp102:
	callq	hipFree
.Ltmp103:
	jmp	.LBB2_74
.LBB2_57:
	movq	8(%rsp), %rsi
.Ltmp90:
	movl	$4096, %edx                     # imm = 0x1000
	movq	%r14, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
.Ltmp91:
# %bb.58:
	movl	%eax, %ebp
	testl	%eax, %eax
	je	.LBB2_59
# %bb.62:
.Ltmp92:
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.5, %esi
	movl	$27, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp93:
# %bb.63:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit96
.Ltmp94:
	movl	%ebp, %edi
	callq	hipGetErrorString
.Ltmp95:
# %bb.64:
.Ltmp96:
	movl	$_ZSt4cerr, %edi
	movq	%rax, %rsi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
.Ltmp97:
# %bb.65:
.Ltmp98:
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
.Ltmp99:
	jmp	.LBB2_66
.LBB2_59:                               # %.preheader.preheader
	xorl	%eax, %eax
.LBB2_60:                               # %.preheader
                                        # =>This Inner Loop Header: Depth=1
	cmpl	$1, (%r14,%rax,4)
	jne	.LBB2_61
# %bb.68:                               #   in Loop: Header=BB2_60 Depth=1
	incq	%rax
	cmpq	$1024, %rax                     # imm = 0x400
	jne	.LBB2_60
# %bb.69:
	movl	$46, %edx
	movl	$.L.str.6, %esi
	jmp	.LBB2_70
.LBB2_61:
	movl	$42, %edx
	movl	$.L.str.7, %esi
.LBB2_70:                               # %.invoke160
.Ltmp105:
	movl	$_ZSt4cout, %edi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp106:
# %bb.71:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit104.invoke
.Ltmp107:
	movl	$_ZSt4cout, %edi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
.Ltmp108:
# %bb.72:                               # %_ZNSolsEPFRSoS_E.exit102
	movq	(%rsp), %rdi
.Ltmp109:
	callq	hipFree
.Ltmp110:
# %bb.73:
	xorl	%ebp, %ebp
	movq	8(%rsp), %rdi
.Ltmp111:
	callq	hipFree
.Ltmp112:
	jmp	.LBB2_74
.LBB2_80:
.Ltmp113:
	jmp	.LBB2_76
.LBB2_79:
.Ltmp104:
	jmp	.LBB2_76
.LBB2_78:
.Ltmp2:
	movq	%rax, %r15
	jmp	.LBB2_77
.LBB2_75:
.Ltmp55:
.LBB2_76:                               # %_ZNSt6vectorIiSaIiEED2Ev.exit110
	movq	%rax, %r15
	movq	%r14, %rdi
	callq	_ZdlPv
.LBB2_77:                               # %_ZNSt6vectorIiSaIiEED2Ev.exit112
	movq	%rbx, %rdi
	callq	_ZdlPv
	movq	%r15, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end2:
	.size	main, .Lfunc_end2-main
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table2:
.Lexception0:
	.byte	255                             # @LPStart Encoding = omit
	.byte	255                             # @TType Encoding = omit
	.byte	1                               # Call site Encoding = uleb128
	.uleb128 .Lcst_end0-.Lcst_begin0
.Lcst_begin0:
	.uleb128 .Lfunc_begin0-.Lfunc_begin0    # >> Call Site 1 <<
	.uleb128 .Ltmp0-.Lfunc_begin0           #   Call between .Lfunc_begin0 and .Ltmp0
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp0-.Lfunc_begin0           # >> Call Site 2 <<
	.uleb128 .Ltmp1-.Ltmp0                  #   Call between .Ltmp0 and .Ltmp1
	.uleb128 .Ltmp2-.Lfunc_begin0           #     jumps to .Ltmp2
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp1-.Lfunc_begin0           # >> Call Site 3 <<
	.uleb128 .Ltmp3-.Ltmp1                  #   Call between .Ltmp1 and .Ltmp3
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp3-.Lfunc_begin0           # >> Call Site 4 <<
	.uleb128 .Ltmp34-.Ltmp3                 #   Call between .Ltmp3 and .Ltmp34
	.uleb128 .Ltmp55-.Lfunc_begin0          #     jumps to .Ltmp55
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp56-.Lfunc_begin0          # >> Call Site 5 <<
	.uleb128 .Ltmp67-.Ltmp56                #   Call between .Ltmp56 and .Ltmp67
	.uleb128 .Ltmp104-.Lfunc_begin0         #     jumps to .Ltmp104
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp43-.Lfunc_begin0          # >> Call Site 6 <<
	.uleb128 .Ltmp54-.Ltmp43                #   Call between .Ltmp43 and .Ltmp54
	.uleb128 .Ltmp55-.Lfunc_begin0          #     jumps to .Ltmp55
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp76-.Lfunc_begin0          # >> Call Site 7 <<
	.uleb128 .Ltmp99-.Ltmp76                #   Call between .Ltmp76 and .Ltmp99
	.uleb128 .Ltmp104-.Lfunc_begin0         #     jumps to .Ltmp104
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp105-.Lfunc_begin0         # >> Call Site 8 <<
	.uleb128 .Ltmp112-.Ltmp105              #   Call between .Ltmp105 and .Ltmp112
	.uleb128 .Ltmp113-.Lfunc_begin0         #     jumps to .Ltmp113
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp112-.Lfunc_begin0         # >> Call Site 9 <<
	.uleb128 .Lfunc_end2-.Ltmp112           #   Call between .Ltmp112 and .Lfunc_end2
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end0:
	.p2align	2, 0x0
                                        # -- End function
	.text
	.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	.LBB3_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB3_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z22insert_into_hash_tablePii, %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	$_Z20search_in_hash_tablePiiS_, %esi
	movl	$.L__unnamed_2, %edx
	movl	$.L__unnamed_2, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$0, 8(%rsp)
	movl	$0, (%rsp)
	movl	$hash_table, %esi
	movl	$.L__unnamed_3, %edx
	movl	$.L__unnamed_3, %ecx
	movl	$65536, %r9d                    # imm = 0x10000
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	callq	__hipRegisterVar
	movl	$__hip_module_dtor, %edi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.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	hash_table,@object              # @hash_table
	.local	hash_table
	.comm	hash_table,65536,16
	.type	_Z22insert_into_hash_tablePii,@object # @_Z22insert_into_hash_tablePii
	.section	.rodata,"a",@progbits
	.globl	_Z22insert_into_hash_tablePii
	.p2align	3, 0x0
_Z22insert_into_hash_tablePii:
	.quad	_Z37__device_stub__insert_into_hash_tablePii
	.size	_Z22insert_into_hash_tablePii, 8

	.type	_Z20search_in_hash_tablePiiS_,@object # @_Z20search_in_hash_tablePiiS_
	.globl	_Z20search_in_hash_tablePiiS_
	.p2align	3, 0x0
_Z20search_in_hash_tablePiiS_:
	.quad	_Z35__device_stub__search_in_hash_tablePiiS_
	.size	_Z20search_in_hash_tablePiiS_, 8

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"Error allocating d_keys: "
	.size	.L.str, 26

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"Error allocating d_results: "
	.size	.L.str.1, 29

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"Error copying to device: "
	.size	.L.str.2, 26

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"Error launching insert kernel: "
	.size	.L.str.3, 32

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"Error launching search kernel: "
	.size	.L.str.4, 32

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"Error copying from device: "
	.size	.L.str.5, 28

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"All keys found successfully in the hash table."
	.size	.L.str.6, 47

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"Not all keys were found in the hash table."
	.size	.L.str.7, 43

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z22insert_into_hash_tablePii"
	.size	.L__unnamed_1, 30

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z20search_in_hash_tablePiiS_"
	.size	.L__unnamed_2, 30

	.type	.L__unnamed_3,@object           # @2
.L__unnamed_3:
	.asciz	"hash_table"
	.size	.L__unnamed_3, 11

	.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 _Z37__device_stub__insert_into_hash_tablePii
	.addrsig_sym _Z35__device_stub__search_in_hash_tablePiiS_
	.addrsig_sym __gxx_personality_v0
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Unwind_Resume
	.addrsig_sym hash_table
	.addrsig_sym _Z22insert_into_hash_tablePii
	.addrsig_sym _Z20search_in_hash_tablePiiS_
	.addrsig_sym _ZSt4cerr
	.addrsig_sym _ZSt4cout
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z22insert_into_hash_tablePii ; -- Begin function _Z22insert_into_hash_tablePii
	.globl	_Z22insert_into_hash_tablePii
	.p2align	8
	.type	_Z22insert_into_hash_tablePii,@function
_Z22insert_into_hash_tablePii:          ; @_Z22insert_into_hash_tablePii
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x1c
	s_load_b32 s3, s[0:1], 0x8
	s_waitcnt lgkmcnt(0)
	s_and_b32 s2, s2, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s2, v[0:1]
	s_mov_b32 s2, exec_lo
	v_cmpx_gt_i32_e64 s3, v1
	s_cbranch_execz .LBB0_9
; %bb.1:
	s_load_b64 s[0:1], s[0:1], 0x0
	v_ashrrev_i32_e32 v2, 31, v1
	s_getpc_b64 s[4:5]
	s_add_u32 s4, s4, hash_table@rel32@lo+4
	s_addc_u32 s5, s5, hash_table@rel32@hi+12
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[0:1], 2, v[1:2]
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v0, vcc_lo, s0, v0
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_3) | instid1(VALU_DEP_1)
	v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
	global_load_b32 v0, v[0:1], off
	s_waitcnt vmcnt(0)
	v_ashrrev_i32_e32 v1, 31, v0
	v_lshrrev_b32_e32 v1, 19, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_nc_u32_e32 v1, v0, v1
	v_and_b32_e32 v1, 0xffffe000, v1
	s_delay_alu instid0(VALU_DEP_1)
	v_sub_nc_u32_e32 v2, v0, v1
	v_mov_b32_e32 v1, 0
.LBB0_2:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_4 Depth 2
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_3) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v3, 31, v2
	s_getpc_b64 s[0:1]
	s_add_u32 s0, s0, hash_table@rel32@lo+4
	s_addc_u32 s1, s1, hash_table@rel32@hi+12
	v_lshlrev_b64 v[3:4], 2, v[2:3]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v3, vcc_lo, v3, s0
	v_add_co_ci_u32_e32 v4, vcc_lo, s1, v4, vcc_lo
	global_atomic_cmpswap_b32 v3, v[3:4], v[0:1], off glc
	s_waitcnt vmcnt(0)
	v_cmp_ne_u32_e32 vcc_lo, 0, v3
	v_cmp_ne_u32_e64 s0, v3, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s0, vcc_lo, s0
	s_and_saveexec_b32 s1, s0
	s_cbranch_execz .LBB0_6
; %bb.3:                                ; %.lr.ph.preheader
                                        ;   in Loop: Header=BB0_2 Depth=1
	s_mov_b32 s2, 0
.LBB0_4:                                ; %.lr.ph
                                        ;   Parent Loop BB0_2 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	v_add_nc_u32_e32 v2, 1, v2
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v3, 31, v2
	v_lshrrev_b32_e32 v3, 18, v3
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_nc_u32_e32 v3, v2, v3
	v_and_b32_e32 v3, 0xffffc000, v3
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_sub_nc_u32_e32 v2, v2, v3
	v_ashrrev_i32_e32 v3, 31, v2
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[3:4], 2, v[2:3]
	v_add_co_u32 v3, vcc_lo, v3, s4
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_4) | instid1(VALU_DEP_1)
	v_add_co_ci_u32_e32 v4, vcc_lo, s5, v4, vcc_lo
	global_atomic_cmpswap_b32 v3, v[3:4], v[0:1], off glc
	s_waitcnt vmcnt(0)
	v_cmp_eq_u32_e32 vcc_lo, 0, v3
	v_cmp_eq_u32_e64 s0, v3, v0
	s_or_b32 s0, vcc_lo, s0
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s0, exec_lo, s0
	s_or_b32 s2, s0, s2
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_not1_b32 exec_lo, exec_lo, s2
	s_cbranch_execnz .LBB0_4
; %bb.5:                                ; %loop.exit.guard
                                        ;   in Loop: Header=BB0_2 Depth=1
	s_or_b32 exec_lo, exec_lo, s2
.LBB0_6:                                ; %Flow
                                        ;   in Loop: Header=BB0_2 Depth=1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_b32 exec_lo, exec_lo, s1
	s_mov_b32 s0, -1
	s_mov_b32 vcc_lo, exec_lo
	s_cbranch_vccz .LBB0_8
; %bb.7:                                ; %._crit_edge
                                        ;   in Loop: Header=BB0_2 Depth=1
	s_barrier
	s_mov_b32 s0, 0
	buffer_gl0_inv
.LBB0_8:                                ; %Flow52
                                        ;   in Loop: Header=BB0_2 Depth=1
	s_and_not1_b32 vcc_lo, exec_lo, s0
	s_cbranch_vccnz .LBB0_2
.LBB0_9:                                ; %UnifiedReturnBlock
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z22insert_into_hash_tablePii
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 272
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 5
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end0:
	.size	_Z22insert_into_hash_tablePii, .Lfunc_end0-_Z22insert_into_hash_tablePii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 444
; NumSgprs: 18
; NumVgprs: 5
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 5
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.protected	_Z20search_in_hash_tablePiiS_ ; -- Begin function _Z20search_in_hash_tablePiiS_
	.globl	_Z20search_in_hash_tablePiiS_
	.p2align	8
	.type	_Z20search_in_hash_tablePiiS_,@function
_Z20search_in_hash_tablePiiS_:          ; @_Z20search_in_hash_tablePiiS_
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x24
	s_load_b32 s3, s[0:1], 0x8
	s_waitcnt lgkmcnt(0)
	s_and_b32 s2, s2, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s2, v[0:1]
	s_mov_b32 s2, exec_lo
	v_cmpx_gt_i32_e64 s3, v1
	s_cbranch_execz .LBB1_8
; %bb.1:
	s_load_b64 s[2:3], s[0:1], 0x0
	v_ashrrev_i32_e32 v2, 31, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[0:1], 2, v[1:2]
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v2, vcc_lo, s2, v0
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v3, vcc_lo, s3, v1, vcc_lo
	s_getpc_b64 s[2:3]
	s_add_u32 s2, s2, hash_table@rel32@lo+4
	s_addc_u32 s3, s3, hash_table@rel32@hi+12
	global_load_b32 v4, v[2:3], off
	s_waitcnt vmcnt(0)
	v_ashrrev_i32_e32 v2, 31, v4
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshrrev_b32_e32 v2, 19, v2
	v_add_nc_u32_e32 v2, v4, v2
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_and_b32_e32 v2, 0xffffe000, v2
	v_sub_nc_u32_e32 v2, v4, v2
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v3, 31, v2
	v_lshlrev_b64 v[5:6], 2, v[2:3]
	v_mov_b32_e32 v3, 1
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_u32 v5, vcc_lo, v5, s2
	v_add_co_ci_u32_e32 v6, vcc_lo, s3, v6, vcc_lo
	s_mov_b32 s2, exec_lo
	global_load_b32 v5, v[5:6], off
	s_waitcnt vmcnt(0)
	v_cmpx_ne_u32_e64 v5, v4
	s_cbranch_execz .LBB1_7
; %bb.2:                                ; %.lr.ph.preheader
	s_mov_b32 s3, 0
                                        ; implicit-def: $sgpr4
.LBB1_3:                                ; %.lr.ph
                                        ; =>This Inner Loop Header: Depth=1
	v_cmp_ne_u32_e32 vcc_lo, 0, v5
	v_mov_b32_e32 v3, 0
	s_or_b32 s4, s4, exec_lo
                                        ; implicit-def: $vgpr5
	s_and_saveexec_b32 s5, vcc_lo
	s_cbranch_execz .LBB1_5
; %bb.4:                                ;   in Loop: Header=BB1_3 Depth=1
	v_add_nc_u32_e32 v2, 1, v2
	s_getpc_b64 s[6:7]
	s_add_u32 s6, s6, hash_table@rel32@lo+4
	s_addc_u32 s7, s7, hash_table@rel32@hi+12
	s_and_not1_b32 s4, s4, exec_lo
	v_ashrrev_i32_e32 v3, 31, v2
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshrrev_b32_e32 v3, 18, v3
	v_add_nc_u32_e32 v3, v2, v3
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_and_b32_e32 v3, 0xffffc000, v3
	v_sub_nc_u32_e32 v2, v2, v3
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v3, 31, v2
	v_lshlrev_b64 v[5:6], 2, v[2:3]
	v_mov_b32_e32 v3, 1
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_u32 v5, vcc_lo, v5, s6
	v_add_co_ci_u32_e32 v6, vcc_lo, s7, v6, vcc_lo
	global_load_b32 v5, v[5:6], off
	s_waitcnt vmcnt(0)
	v_cmp_eq_u32_e32 vcc_lo, v5, v4
	s_and_b32 s6, vcc_lo, exec_lo
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_b32 s4, s4, s6
.LBB1_5:                                ; %Flow
                                        ;   in Loop: Header=BB1_3 Depth=1
	s_or_b32 exec_lo, exec_lo, s5
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s5, exec_lo, s4
	s_or_b32 s3, s5, s3
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_not1_b32 exec_lo, exec_lo, s3
	s_cbranch_execnz .LBB1_3
; %bb.6:                                ; %Flow25
	s_or_b32 exec_lo, exec_lo, s3
.LBB1_7:                                ; %Flow26
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_b32 exec_lo, exec_lo, s2
	s_load_b64 s[0:1], s[0:1], 0x10
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v0, vcc_lo, s0, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
	global_store_b32 v[0:1], v3, off
	s_waitcnt_vscnt null, 0x0
	s_barrier
	buffer_gl0_inv
.LBB1_8:
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z20search_in_hash_tablePiiS_
		.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 7
		.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	_Z20search_in_hash_tablePiiS_, .Lfunc_end1-_Z20search_in_hash_tablePiiS_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 472
; NumSgprs: 18
; NumVgprs: 7
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 7
; Occupancy: 16
; WaveLimiterHint : 1
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.protected	hash_table              ; @hash_table
	.type	hash_table,@object
	.section	.bss,"aw",@nobits
	.globl	hash_table
	.p2align	4, 0x0
hash_table:
	.zero	65536
	.size	hash_table, 65536

	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.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 hash_table
	.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
      - .offset:         16
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         20
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         24
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         28
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         30
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         32
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         34
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         36
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         38
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         56
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         64
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         80
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 272
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z22insert_into_hash_tablePii
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z22insert_into_hash_tablePii.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     5
    .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
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .offset:         24
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         28
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         36
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         38
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         40
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         42
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         44
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         46
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         64
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         88
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 280
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z20search_in_hash_tablePiiS_
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z20search_in_hash_tablePiiS_.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     7
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
