#pragma once

#include<iostream>
#include<random>

void initialize_projection_plane(float* m, int numbers, float sigma=1, float mu=0){
    std::default_random_engine generator;
    std::uniform_real_distribution<float> distribution(-1, 1.0);
    
    for (int i = 0; i < numbers; ++i) {
        m[i] = sigma * distribution(generator) + mu;
    }
}

void initialize_bits(float* bits, int hashSize){
    bits[0] = 1.0;
    for (int i = 1; i < hashSize; ++i) {
        bits[i] = 2 * bits[i-1];
    }
}

void show_array(float* a, int rows, int cols) {
    for (int i = 0; i < rows; ++i) {
        for (int j = 0; j < cols; ++j) {
            std::cout << a[i*cols + j] << ' ';
        }
        std::cout << std::endl;
    }
}

// int main(){
    
//     int tableNums = 4;
//     int inputDim = 100;
//     int hashSize = 12;
//     int inputSize = 5000000;
    
//     // Initialize the inputs on host
//     int input_bytes = inputSize * inputDim * sizeof(float);
//     float* input;
//     input = (float*) malloc(input_bytes);
//     initialize_projection_plane(input, input_bytes / sizeof(float));

//     // Initialize projection planes
//     float* projections;
//     int projection_plane_bytes = tableNums * inputDim * hashSize * sizeof(float);

//     projections = (float*) malloc(projection_plane_bytes);
//     initialize_projection_plane(projections, projection_plane_bytes / sizeof(float));

//     // Initialize bits
//     float* bits = (float*) malloc(hashSize * sizeof(float));    
//     initialize_bits(bits, hashSize);

//     // initialize result
//     int results_bytes = tableNums * inputSize * hashSize * sizeof(float);
//     float* results = (float*) malloc(results_bytes);

//     // initialize hash values
//     int hash_values_bytes = tableNums * inputSize * sizeof(float);
//     float* hash_values = (float*) malloc(hash_values_bytes);
//     std::fill(hash_values, hash_values + hash_values_bytes / sizeof(float), (float) 0.0);

//     auto start = high_resolution_clock::now(); 
    
//     index(input, inputSize, inputDim, projections, tableNums, hashSize, bits, hash_values);
    
//     auto stop = high_resolution_clock::now(); 
//     cout <<  duration_cast<microseconds>(stop - start).count() << endl;

//     // show_array(projections, tableNums * inputDim, hashSize);
//     // show_array(input, inputSize, inputDim);
//     // show_array(results, inputSize, tableNums * hashSize);
//     // show_array(hash_values, inputSize * tableNums, 1);

//     free(input);
//     free(projections);
//     free(bits);
//     free(hash_values);

//     return 0;
// }
	.file	"tmpxft_0031658a_00000000-6_helper.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB4724:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE4724:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z27initialize_projection_planePfiff
	.type	_Z27initialize_projection_planePfiff, @function
_Z27initialize_projection_planePfiff:
.LFB4719:
	.cfi_startproc
	endbr64
	movss	.LC2(%rip), %xmm5
	movq	%rdi, %r8
	movl	$1, %edx
	movl	%esi, %edi
	movss	.LC3(%rip), %xmm3
	xorl	%esi, %esi
	movl	$2147483647, %r9d
	xorps	%xmm4, %xmm4
.L3:
	cmpl	%esi, %edi
	jle	.L10
	imulq	$16807, %rdx, %rax
	xorl	%edx, %edx
	divq	%r9
	movq	%rdx, %rcx
	decq	%rcx
	js	.L4
	cvtsi2ssq	%rcx, %xmm2
	jmp	.L5
.L4:
	movq	%rcx, %rax
	andl	$1, %ecx
	shrq	%rax
	orq	%rcx, %rax
	cvtsi2ssq	%rax, %xmm2
	addss	%xmm2, %xmm2
.L5:
	addss	%xmm4, %xmm2
	mulss	%xmm5, %xmm2
	comiss	%xmm3, %xmm2
	jb	.L6
	movss	.LC0(%rip), %xmm2
.L6:
	addss	%xmm2, %xmm2
	subss	%xmm3, %xmm2
	mulss	%xmm0, %xmm2
	addss	%xmm1, %xmm2
	movss	%xmm2, (%r8,%rsi,4)
	incq	%rsi
	jmp	.L3
.L10:
	ret
	.cfi_endproc
.LFE4719:
	.size	_Z27initialize_projection_planePfiff, .-_Z27initialize_projection_planePfiff
	.globl	_Z15initialize_bitsPfi
	.type	_Z15initialize_bitsPfi, @function
_Z15initialize_bitsPfi:
.LFB4720:
	.cfi_startproc
	endbr64
	movl	$0x3f800000, (%rdi)
	xorl	%eax, %eax
.L12:
	incq	%rax
	cmpl	%eax, %esi
	jle	.L14
	movss	-4(%rdi,%rax,4), %xmm0
	addss	%xmm0, %xmm0
	movss	%xmm0, (%rdi,%rax,4)
	jmp	.L12
.L14:
	ret
	.cfi_endproc
.LFE4720:
	.size	_Z15initialize_bitsPfi, .-_Z15initialize_bitsPfi
	.globl	_Z10show_arrayPfii
	.type	_Z10show_arrayPfii, @function
_Z10show_arrayPfii:
.LFB4721:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	%esi, %r15d
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	xorl	%r14d, %r14d
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	xorl	%r13d, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%rdi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movl	%edx, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
.L16:
	cmpl	%r15d, %r14d
	jge	.L15
	movslq	%r13d, %rax
	xorl	%ebx, %ebx
	leaq	(%r12,%rax,4), %rax
	movq	%rax, 8(%rsp)
.L21:
	cmpl	%ebx, %ebp
	jle	.L24
	movq	8(%rsp), %rax
	leaq	_ZSt4cout(%rip), %rdi
	cvtss2sd	(%rax,%rbx,4), %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movb	$32, 23(%rsp)
	movq	%rax, %rdi
	movq	(%rax), %rax
	movq	-24(%rax), %rax
	cmpq	$0, 16(%rdi,%rax)
	je	.L17
	leaq	23(%rsp), %rsi
	movl	$1, %edx
	call	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l@PLT
	jmp	.L18
.L17:
	movl	$32, %esi
	call	_ZNSo3putEc@PLT
.L18:
	incq	%rbx
	jmp	.L21
.L24:
	leaq	_ZSt4cout(%rip), %rdi
	incl	%r14d
	addl	%ebp, %r13d
	call	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
	jmp	.L16
.L15:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	je	.L22
	call	__stack_chk_fail@PLT
.L22:
	addq	$40, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4721:
	.size	_Z10show_arrayPfii, .-_Z10show_arrayPfii
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB4747:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	movq	%rax, %rdi
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE4747:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.section	.rodata.cst4,"aM",@progbits,4
	.align 4
.LC0:
	.long	1065353215
	.align 4
.LC2:
	.long	805306368
	.align 4
.LC3:
	.long	1065353216
	.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:

#pragma once
#include <hip/hip_runtime.h>


#include<iostream>
#include<random>

void initialize_projection_plane(float* m, int numbers, float sigma=1, float mu=0){
    std::default_random_engine generator;
    std::uniform_real_distribution<float> distribution(-1, 1.0);
    
    for (int i = 0; i < numbers; ++i) {
        m[i] = sigma * distribution(generator) + mu;
    }
}

void initialize_bits(float* bits, int hashSize){
    bits[0] = 1.0;
    for (int i = 1; i < hashSize; ++i) {
        bits[i] = 2 * bits[i-1];
    }
}

void show_array(float* a, int rows, int cols) {
    for (int i = 0; i < rows; ++i) {
        for (int j = 0; j < cols; ++j) {
            std::cout << a[i*cols + j] << ' ';
        }
        std::cout << std::endl;
    }
}

// int main(){
    
//     int tableNums = 4;
//     int inputDim = 100;
//     int hashSize = 12;
//     int inputSize = 5000000;
    
//     // Initialize the inputs on host
//     int input_bytes = inputSize * inputDim * sizeof(float);
//     float* input;
//     input = (float*) malloc(input_bytes);
//     initialize_projection_plane(input, input_bytes / sizeof(float));

//     // Initialize projection planes
//     float* projections;
//     int projection_plane_bytes = tableNums * inputDim * hashSize * sizeof(float);

//     projections = (float*) malloc(projection_plane_bytes);
//     initialize_projection_plane(projections, projection_plane_bytes / sizeof(float));

//     // Initialize bits
//     float* bits = (float*) malloc(hashSize * sizeof(float));    
//     initialize_bits(bits, hashSize);

//     // initialize result
//     int results_bytes = tableNums * inputSize * hashSize * sizeof(float);
//     float* results = (float*) malloc(results_bytes);

//     // initialize hash values
//     int hash_values_bytes = tableNums * inputSize * sizeof(float);
//     float* hash_values = (float*) malloc(hash_values_bytes);
//     std::fill(hash_values, hash_values + hash_values_bytes / sizeof(float), (float) 0.0);

//     auto start = high_resolution_clock::now(); 
    
//     index(input, inputSize, inputDim, projections, tableNums, hashSize, bits, hash_values);
    
//     auto stop = high_resolution_clock::now(); 
//     cout <<  duration_cast<microseconds>(stop - start).count() << endl;

//     // show_array(projections, tableNums * inputDim, hashSize);
//     // show_array(input, inputSize, inputDim);
//     // show_array(results, inputSize, tableNums * hashSize);
//     // show_array(hash_values, inputSize * tableNums, 1);

//     free(input);
//     free(projections);
//     free(bits);
//     free(hash_values);

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

                                        # End of file scope inline assembly
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function _Z27initialize_projection_planePfiff
.LCPI0_0:
	.long	0xbf800000                      # float -1
	.text
	.globl	_Z27initialize_projection_planePfiff
	.type	_Z27initialize_projection_planePfiff,@function
_Z27initialize_projection_planePfiff:   # @_Z27initialize_projection_planePfiff
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r12
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	subq	$24, %rsp
	.cfi_def_cfa_offset 64
	.cfi_offset %rbx, -40
	.cfi_offset %r12, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	$1, 16(%rsp)
	testl	%esi, %esi
	jle	.LBB0_3
# %bb.1:                                # %.lr.ph.preheader
	movaps	%xmm0, %xmm2
	movq	%rdi, %rbx
	movl	%esi, %r15d
	xorl	%r12d, %r12d
	leaq	16(%rsp), %r14
	movss	%xmm1, 12(%rsp)                 # 4-byte Spill
	movss	%xmm0, 8(%rsp)                  # 4-byte Spill
.LBB0_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movq	%r14, %rdi
	callq	_ZSt18generate_canonicalIfLm24ESt26linear_congruential_engineImLm16807ELm0ELm2147483647EEET_RT1_
	movss	8(%rsp), %xmm2                  # 4-byte Reload
                                        # xmm2 = mem[0],zero,zero,zero
	movss	12(%rsp), %xmm1                 # 4-byte Reload
                                        # xmm1 = mem[0],zero,zero,zero
	addss	%xmm0, %xmm0
	addss	.LCPI0_0(%rip), %xmm0
	mulss	%xmm2, %xmm0
	addss	%xmm1, %xmm0
	movss	%xmm0, (%rbx,%r12,4)
	incq	%r12
	cmpq	%r12, %r15
	jne	.LBB0_2
.LBB0_3:                                # %._crit_edge
	addq	$24, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	_Z27initialize_projection_planePfiff, .Lfunc_end0-_Z27initialize_projection_planePfiff
	.cfi_endproc
                                        # -- End function
	.globl	_Z15initialize_bitsPfi          # -- Begin function _Z15initialize_bitsPfi
	.type	_Z15initialize_bitsPfi,@function
_Z15initialize_bitsPfi:                 # @_Z15initialize_bitsPfi
	.cfi_startproc
# %bb.0:
	movl	$1065353216, (%rdi)             # imm = 0x3F800000
	cmpl	$2, %esi
	jl	.LBB1_3
# %bb.1:                                # %.lr.ph.preheader
	movl	%esi, %eax
	movss	(%rdi), %xmm0                   # xmm0 = mem[0],zero,zero,zero
	movl	$1, %ecx
.LBB1_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	addss	%xmm0, %xmm0
	movss	%xmm0, (%rdi,%rcx,4)
	incq	%rcx
	cmpq	%rcx, %rax
	jne	.LBB1_2
.LBB1_3:                                # %._crit_edge
	retq
.Lfunc_end1:
	.size	_Z15initialize_bitsPfi, .Lfunc_end1-_Z15initialize_bitsPfi
	.cfi_endproc
                                        # -- End function
	.globl	_Z10show_arrayPfii              # -- Begin function _Z10show_arrayPfii
	.type	_Z10show_arrayPfii,@function
_Z10show_arrayPfii:                     # @_Z10show_arrayPfii
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rdi, 8(%rsp)                   # 8-byte Spill
	testl	%esi, %esi
	jle	.LBB2_7
# %bb.1:                                # %.preheader.lr.ph
	movl	%esi, %eax
	movq	%rax, 16(%rsp)                  # 8-byte Spill
	movl	%edx, %r13d
	xorl	%ebp, %ebp
	leaq	3(%rsp), %r15
	xorl	%r14d, %r14d
	movl	%edx, 4(%rsp)                   # 4-byte Spill
.LBB2_2:                                # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB2_4 Depth 2
	testl	%edx, %edx
	jle	.LBB2_6
# %bb.3:                                # %.lr.ph
                                        #   in Loop: Header=BB2_2 Depth=1
	movl	%ebp, %eax
	movq	8(%rsp), %rcx                   # 8-byte Reload
	leaq	(%rcx,%rax,4), %r12
	xorl	%ebx, %ebx
.LBB2_4:                                #   Parent Loop BB2_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	xorps	%xmm0, %xmm0
	cvtss2sd	(%r12,%rbx,4), %xmm0
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertIdEERSoT_
	movb	$32, 3(%rsp)
	movq	(%rax), %rcx
	movq	-24(%rcx), %rcx
	cmpq	$0, 16(%rax,%rcx)
	je	.LBB2_8
# %bb.5:                                #   in Loop: Header=BB2_4 Depth=2
	movl	$1, %edx
	movq	%rax, %rdi
	movq	%r15, %rsi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	jmp	.LBB2_9
.LBB2_8:                                #   in Loop: Header=BB2_4 Depth=2
	movq	%rax, %rdi
	movl	$32, %esi
	callq	_ZNSo3putEc
.LBB2_9:                                # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c.exit
                                        #   in Loop: Header=BB2_4 Depth=2
	incq	%rbx
	cmpq	%rbx, %r13
	jne	.LBB2_4
.LBB2_6:                                # %._crit_edge
                                        #   in Loop: Header=BB2_2 Depth=1
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rdi
	movl	$_ZSt4cout, %eax
	addq	%rax, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	incq	%r14
	movl	4(%rsp), %edx                   # 4-byte Reload
	addl	%edx, %ebp
	cmpq	16(%rsp), %r14                  # 8-byte Folded Reload
	jne	.LBB2_2
.LBB2_7:                                # %._crit_edge13
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end2:
	.size	_Z10show_arrayPfii, .Lfunc_end2-_Z10show_arrayPfii
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _ZSt18generate_canonicalIfLm24ESt26linear_congruential_engineImLm16807ELm0ELm2147483647EEET_RT1_
.LCPI3_0:
	.quad	0x41dfffffff800000              # double 2147483646
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0
.LCPI3_1:
	.long	0x40000000                      # float 2
.LCPI3_2:
	.long	0x5f000000                      # float 9.22337203E+18
.LCPI3_3:
	.long	0x3f800000                      # float 1
	.section	.text._ZSt18generate_canonicalIfLm24ESt26linear_congruential_engineImLm16807ELm0ELm2147483647EEET_RT1_,"axG",@progbits,_ZSt18generate_canonicalIfLm24ESt26linear_congruential_engineImLm16807ELm0ELm2147483647EEET_RT1_,comdat
	.weak	_ZSt18generate_canonicalIfLm24ESt26linear_congruential_engineImLm16807ELm0ELm2147483647EEET_RT1_
	.type	_ZSt18generate_canonicalIfLm24ESt26linear_congruential_engineImLm16807ELm0ELm2147483647EEET_RT1_,@function
_ZSt18generate_canonicalIfLm24ESt26linear_congruential_engineImLm16807ELm0ELm2147483647EEET_RT1_: # @_ZSt18generate_canonicalIfLm24ESt26linear_congruential_engineImLm16807ELm0ELm2147483647EEET_RT1_
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	subq	$64, %rsp
	.cfi_def_cfa_offset 80
	.cfi_offset %rbx, -16
	movq	%rdi, %rbx
	fldl	.LCPI3_0(%rip)
	fstpt	(%rsp)
	callq	logl
	fstpt	52(%rsp)                        # 10-byte Folded Spill
	flds	.LCPI3_1(%rip)
	fstpt	(%rsp)
	callq	logl
	fldt	52(%rsp)                        # 10-byte Folded Reload
	fdivp	%st, %st(1)
	flds	.LCPI3_2(%rip)
	xorl	%ecx, %ecx
	fxch	%st(1)
	fucomi	%st(1), %st
	fldz
	fcmovnb	%st(2), %st
	fstp	%st(2)
	fsubp	%st, %st(1)
	setae	%cl
	fnstcw	28(%rsp)
	movzwl	28(%rsp), %eax
	orl	$3072, %eax                     # imm = 0xC00
	movw	%ax, 30(%rsp)
	fldcw	30(%rsp)
	fistpll	40(%rsp)
	fldcw	28(%rsp)
	shlq	$63, %rcx
	xorq	40(%rsp), %rcx
	leaq	23(%rcx), %rax
	xorl	%edx, %edx
	divq	%rcx
	movq	%rax, %rcx
	cmpq	$1, %rax
	adcq	$0, %rcx
	movq	(%rbx), %rsi
	xorps	%xmm0, %xmm0
	movss	.LCPI3_3(%rip), %xmm1           # xmm1 = mem[0],zero,zero,zero
	movabsq	$8589934597, %rdi               # imm = 0x200000005
.LBB3_1:                                # %select.unfold
                                        # =>This Inner Loop Header: Depth=1
	imulq	$16807, %rsi, %rsi              # imm = 0x41A7
	movq	%rsi, %rax
	mulq	%rdi
	movq	%rsi, %rax
	subq	%rdx, %rax
	shrq	%rax
	addq	%rdx, %rax
	shrq	$30, %rax
	movq	%rax, %rdx
	shlq	$31, %rdx
	subq	%rdx, %rax
	leaq	(%rsi,%rax), %rdx
	decq	%rdx
	testq	%rdx, %rdx
	js	.LBB3_2
# %bb.3:                                # %select.unfold
                                        #   in Loop: Header=BB3_1 Depth=1
	xorps	%xmm2, %xmm2
	cvtsi2ss	%rdx, %xmm2
	jmp	.LBB3_4
.LBB3_2:                                #   in Loop: Header=BB3_1 Depth=1
	movq	%rdx, %r8
	shrq	%r8
	andl	$1, %edx
	orq	%r8, %rdx
	xorps	%xmm2, %xmm2
	cvtsi2ss	%rdx, %xmm2
	addss	%xmm2, %xmm2
.LBB3_4:                                # %select.unfold
                                        #   in Loop: Header=BB3_1 Depth=1
	addq	%rax, %rsi
	mulss	%xmm1, %xmm2
	movss	%xmm1, 36(%rsp)
	flds	36(%rsp)
	fmull	.LCPI3_0(%rip)
	addss	%xmm2, %xmm0
	fstps	32(%rsp)
	movss	32(%rsp), %xmm1                 # xmm1 = mem[0],zero,zero,zero
	decq	%rcx
	jne	.LBB3_1
# %bb.5:
	movq	%rsi, (%rbx)
	divss	%xmm1, %xmm0
	ucomiss	.LCPI3_3(%rip), %xmm0
	jae	.LBB3_7
# %bb.6:
	addq	$64, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	retq
.LBB3_7:
	.cfi_def_cfa_offset 80
	movss	.LCPI3_3(%rip), %xmm0           # xmm0 = mem[0],zero,zero,zero
	xorps	%xmm1, %xmm1
	addq	$64, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	nextafterf                      # TAILCALL
.Lfunc_end3:
	.size	_ZSt18generate_canonicalIfLm24ESt26linear_congruential_engineImLm16807ELm0ELm2147483647EEET_RT1_, .Lfunc_end3-_ZSt18generate_canonicalIfLm24ESt26linear_congruential_engineImLm16807ELm0ELm2147483647EEET_RT1_
	.cfi_endproc
                                        # -- End function
	.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 _ZSt4cout
	.addrsig_sym __hip_cuid_

	.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_
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.amdgpu_metadata
---
amdhsa.kernels:  []
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
