#define IA 16807
#define IM 2147483647
#define AM (1.0/IM)
#define IQ 127773
#define IR 2836
#define NTAB 32
#define NDIV (1+(IM-1)/NTAB)
#define EPS 1.2e-7
#define RNMX (1.0-EPS)

double rand(long *idum) {
    int j;
    long k;
    static long iy=0;
    static long iv[NTAB];
    double temp;
    if (*idum <= 0 || !iy) {

        if (-(*idum) < 1) *idum=1;
        else *idum = -(*idum);

        for (j=NTAB+7; j>=0; j--) {

            k=(*idum)/IQ;
            *idum=IA*(*idum-k*IQ)-IR*k;
            if (*idum < 0) *idum += IM;
            if (j < NTAB) iv[j] = *idum;
        }
        iy=iv[0];
    }
    k=(*idum)/IQ;

    *idum=IA*(*idum-k*IQ)-IR*k;
    if (*idum < 0) *idum += IM;

    j=iy/NDIV;
    iy=iv[j];
    iv[j] = *idum;

    if ((temp=AM*iy) > RNMX) return RNMX;
    else return temp;
}

	.file	"tmpxft_0032e220_00000000-6_rng.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2011:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2011:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z4randPl
	.type	_Z4randPl, @function
_Z4randPl:
.LFB2008:
	.cfi_startproc
	endbr64
	movq	(%rdi), %rax
	movq	%rdi, %rsi
	testq	%rax, %rax
	jle	.L3
	cmpq	$0, _ZZ4randPlE2iy(%rip)
	jne	.L5
	movl	$1, %ecx
	jmp	.L4
.L3:
	movl	$1, %ecx
	je	.L4
	negq	%rax
	movq	%rax, %rcx
.L4:
	movl	$39, %edi
	movl	$127773, %r8d
	leaq	_ZZ4randPlE2iv(%rip), %r9
.L10:
	movq	%rcx, %rax
	cqto
	idivq	%r8
	imulq	$-127773, %rax, %rdx
	imulq	$-2836, %rax, %rax
	addq	%rcx, %rdx
	imulq	$16807, %rdx, %rdx
	addq	%rax, %rdx
	movq	%rdx, %rcx
	jns	.L6
	addq	$2147483647, %rcx
.L6:
	cmpl	$31, %edi
	leaq	-1(%rdi), %rax
	jle	.L7
	movq	%rax, %rdi
	jmp	.L10
.L7:
	movq	%rcx, (%r9,%rdi,8)
	movq	%rax, %rdi
	cmpq	$-1, %rax
	jne	.L10
	movq	_ZZ4randPlE2iv(%rip), %rax
	movq	%rcx, (%rsi)
	movq	%rax, _ZZ4randPlE2iy(%rip)
.L5:
	movq	(%rsi), %rax
	movl	$127773, %ecx
	cqto
	idivq	%rcx
	imulq	$-127773, %rax, %rcx
	addq	(%rsi), %rcx
	imulq	$16807, %rcx, %rcx
	imulq	$-2836, %rax, %rax
	addq	%rax, %rcx
	jns	.L11
	addq	$2147483647, %rcx
.L11:
	movq	_ZZ4randPlE2iy(%rip), %rax
	movq	%rcx, (%rsi)
	movl	$67108864, %esi
	movsd	.LC0(%rip), %xmm1
	cqto
	idivq	%rsi
	leaq	_ZZ4randPlE2iv(%rip), %rsi
	cltq
	movq	(%rsi,%rax,8), %rdx
	movq	%rcx, (%rsi,%rax,8)
	cvtsi2sdq	%rdx, %xmm0
	mulsd	.LC1(%rip), %xmm0
	movq	%rdx, _ZZ4randPlE2iy(%rip)
	minsd	%xmm0, %xmm1
	movaps	%xmm1, %xmm0
	ret
	.cfi_endproc
.LFE2008:
	.size	_Z4randPl, .-_Z4randPl
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2034:
	.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
.LFE2034:
	.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
	.local	_ZZ4randPlE2iv
	.comm	_ZZ4randPlE2iv,256,32
	.local	_ZZ4randPlE2iy
	.comm	_ZZ4randPlE2iy,8,8
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC0:
	.long	-1080863911
	.long	1072693247
	.align 8
.LC1:
	.long	2097152
	.long	1040187392
	.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>
#define IA 16807
#define IM 2147483647
#define AM (1.0/IM)
#define IQ 127773
#define IR 2836
#define NTAB 32
#define NDIV (1+(IM-1)/NTAB)
#define EPS 1.2e-7
#define RNMX (1.0-EPS)

double rand(long *idum) {
    int j;
    long k;
    static long iy=0;
    static long iv[NTAB];
    double temp;
    if (*idum <= 0 || !iy) {

        if (-(*idum) < 1) *idum=1;
        else *idum = -(*idum);

        for (j=NTAB+7; j>=0; j--) {

            k=(*idum)/IQ;
            *idum=IA*(*idum-k*IQ)-IR*k;
            if (*idum < 0) *idum += IM;
            if (j < NTAB) iv[j] = *idum;
        }
        iy=iv[0];
    }
    k=(*idum)/IQ;

    *idum=IA*(*idum-k*IQ)-IR*k;
    if (*idum < 0) *idum += IM;

    j=iy/NDIV;
    iy=iv[j];
    iv[j] = *idum;

    if ((temp=AM*iy) > RNMX) return RNMX;
    else return temp;
}

	.text
	.file	"rng.hip"
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z4randPl
.LCPI0_0:
	.quad	0x3e00000000200000              # double 4.6566128752457969E-10
.LCPI0_1:
	.quad	0x3fefffffbf935359              # double 0.99999987999999995
	.text
	.globl	_Z4randPl
	.type	_Z4randPl,@function
_Z4randPl:                              # @_Z4randPl
	.cfi_startproc
# %bb.0:
	movq	(%rdi), %rcx
	movabsq	$4730756183288445817, %rsi      # imm = 0x41A705AF1FE3FB79
	testq	%rcx, %rcx
	jle	.LBB0_2
# %bb.1:
	movq	_ZZ4randPlE2iy(%rip), %r8
	testq	%r8, %r8
	jne	.LBB0_7
.LBB0_2:
	movq	%rcx, %rax
	negq	%rax
	testq	%rcx, %rcx
	movl	$1, %ecx
	cmovsq	%rax, %rcx
	movl	$39, %r8d
.LBB0_3:                                # =>This Inner Loop Header: Depth=1
	movq	%rcx, %rax
	imulq	%rsi
	movq	%rdx, %rax
	shrq	$63, %rax
	sarq	$15, %rdx
	addq	%rax, %rdx
	imulq	$-127773, %rdx, %rax            # imm = 0xFFFE0CE3
	addq	%rcx, %rax
	imulq	$16807, %rax, %rax              # imm = 0x41A7
	imulq	$-2836, %rdx, %rdx              # imm = 0xF4EC
	leaq	(%rax,%rdx), %rcx
	addq	$2147483647, %rcx               # imm = 0x7FFFFFFF
	addq	%rdx, %rax
	cmovnsq	%rax, %rcx
	cmpq	$31, %r8
	ja	.LBB0_5
# %bb.4:                                #   in Loop: Header=BB0_3 Depth=1
	movq	%rcx, _ZZ4randPlE2iv(,%r8,8)
.LBB0_5:                                #   in Loop: Header=BB0_3 Depth=1
	addq	$-1, %r8
	jb	.LBB0_3
# %bb.6:
	movq	_ZZ4randPlE2iv(%rip), %r8
.LBB0_7:
	movq	%rcx, %rax
	imulq	%rsi
	movq	%rdx, %rax
	shrq	$63, %rax
	sarq	$15, %rdx
	addq	%rax, %rdx
	imulq	$-127773, %rdx, %rax            # imm = 0xFFFE0CE3
	addq	%rcx, %rax
	imulq	$16807, %rax, %rax              # imm = 0x41A7
	imulq	$-2836, %rdx, %rcx              # imm = 0xF4EC
	leaq	(%rax,%rcx), %rdx
	addq	$2147483647, %rdx               # imm = 0x7FFFFFFF
	addq	%rcx, %rax
	cmovnsq	%rax, %rdx
	movq	%rdx, (%rdi)
	leaq	67108863(%r8), %rax
	testq	%r8, %r8
	cmovnsq	%r8, %rax
	shrq	$26, %rax
	cltq
	movq	_ZZ4randPlE2iv(,%rax,8), %rcx
	movq	%rcx, _ZZ4randPlE2iy(%rip)
	cvtsi2sd	%rcx, %xmm1
	mulsd	.LCPI0_0(%rip), %xmm1
	movq	%rdx, _ZZ4randPlE2iv(,%rax,8)
	movsd	.LCPI0_1(%rip), %xmm0           # xmm0 = mem[0],zero
	minsd	%xmm1, %xmm0
	retq
.Lfunc_end0:
	.size	_Z4randPl, .Lfunc_end0-_Z4randPl
	.cfi_endproc
                                        # -- End function
	.type	_ZZ4randPlE2iy,@object          # @_ZZ4randPlE2iy
	.local	_ZZ4randPlE2iy
	.comm	_ZZ4randPlE2iy,8,8
	.type	_ZZ4randPlE2iv,@object          # @_ZZ4randPlE2iv
	.local	_ZZ4randPlE2iv
	.comm	_ZZ4randPlE2iv,256,16
	.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 __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
