
#include "CNextStateLookupTable.cuh"

#include "CStateLookupTable.cuh"

CNextStateLookupTable::CNextStateLookupTable(unsigned int const p_cnK) :
		CStateLookupTable(p_cnK
#ifdef _USE_CUDA_
				, LookupTableType_Next // Set table type
#endif
				)
{

}

CNextStateLookupTable::~CNextStateLookupTable(void)
{
}

unsigned int CNextStateLookupTable::Shift(unsigned int const p_cnState, unsigned int const p_cnInput) const
{
	// Shift right once and put the input in the MSB
	return (p_cnState >> 1) + ((p_cnInput == 0) ? (0) : (1 << (m_cnMemory - 1)));
}

CNextStateLookupTable* CNextStateLookupTable::Create(unsigned int const p_cnK)
{
	CNextStateLookupTable* l_pcInstance = new CNextStateLookupTable(p_cnK);
	l_pcInstance->InitializeStateLookupTable();
	return l_pcInstance;
}

	.file	"tmpxft_002e7dc5_00000000-6_CNextStateLookupTable.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.align 2
	.globl	_ZNK21CNextStateLookupTable5ShiftEjj
	.type	_ZNK21CNextStateLookupTable5ShiftEjj, @function
_ZNK21CNextStateLookupTable5ShiftEjj:
.LFB4005:
	.cfi_startproc
	endbr64
	shrl	%esi
	testl	%edx, %edx
	je	.L2
	movl	8(%rdi), %ecx
	movl	$1, %edx
	decl	%ecx
	sall	%cl, %edx
.L2:
	leal	(%rsi,%rdx), %eax
	ret
	.cfi_endproc
.LFE4005:
	.size	_ZNK21CNextStateLookupTable5ShiftEjj, .-_ZNK21CNextStateLookupTable5ShiftEjj
	.align 2
	.globl	_ZN21CNextStateLookupTableD2Ev
	.type	_ZN21CNextStateLookupTableD2Ev, @function
_ZN21CNextStateLookupTableD2Ev:
.LFB4002:
	.cfi_startproc
	endbr64
	leaq	16+_ZTV21CNextStateLookupTable(%rip), %rax
	movq	%rax, (%rdi)
	jmp	_ZN17CStateLookupTableD2Ev@PLT
	.cfi_endproc
.LFE4002:
	.size	_ZN21CNextStateLookupTableD2Ev, .-_ZN21CNextStateLookupTableD2Ev
	.globl	_ZN21CNextStateLookupTableD1Ev
	.set	_ZN21CNextStateLookupTableD1Ev,_ZN21CNextStateLookupTableD2Ev
	.align 2
	.globl	_ZN21CNextStateLookupTableD0Ev
	.type	_ZN21CNextStateLookupTableD0Ev, @function
_ZN21CNextStateLookupTableD0Ev:
.LFB4004:
	.cfi_startproc
	endbr64
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	movq	%rdi, 8(%rsp)
	call	_ZN21CNextStateLookupTableD1Ev
	movq	8(%rsp), %rdi
	movl	$40, %esi
	addq	$24, %rsp
	.cfi_def_cfa_offset 8
	jmp	_ZdlPvm@PLT
	.cfi_endproc
.LFE4004:
	.size	_ZN21CNextStateLookupTableD0Ev, .-_ZN21CNextStateLookupTableD0Ev
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB4009:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE4009:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.align 2
	.globl	_ZN21CNextStateLookupTableC2Ej
	.type	_ZN21CNextStateLookupTableC2Ej, @function
_ZN21CNextStateLookupTableC2Ej:
.LFB3999:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movq	%rdi, %rbx
	call	_ZN17CStateLookupTableC2Ej@PLT
	leaq	16+_ZTV21CNextStateLookupTable(%rip), %rax
	movq	%rax, (%rbx)
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3999:
	.size	_ZN21CNextStateLookupTableC2Ej, .-_ZN21CNextStateLookupTableC2Ej
	.globl	_ZN21CNextStateLookupTableC1Ej
	.set	_ZN21CNextStateLookupTableC1Ej,_ZN21CNextStateLookupTableC2Ej
	.align 2
	.globl	_ZN21CNextStateLookupTable6CreateEj
	.type	_ZN21CNextStateLookupTable6CreateEj, @function
_ZN21CNextStateLookupTable6CreateEj:
.LFB4006:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA4006
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movl	%edi, %ebp
	movl	$40, %edi
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	pushq	%rcx
	.cfi_def_cfa_offset 32
.LEHB0:
	call	_Znwm@PLT
.LEHE0:
	movl	%ebp, %esi
	movq	%rax, %rdi
	movq	%rax, %rbx
.LEHB1:
	call	_ZN21CNextStateLookupTableC1Ej
.LEHE1:
	movq	%rbx, %rdi
.LEHB2:
	call	_ZN17CStateLookupTable26InitializeStateLookupTableEv@PLT
	movq	%rbx, %rax
	popq	%rdx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
.L15:
	.cfi_restore_state
	endbr64
	movq	%rax, %rbp
.L14:
	movq	%rbx, %rdi
	movl	$40, %esi
	call	_ZdlPvm@PLT
	movq	%rbp, %rdi
	call	_Unwind_Resume@PLT
.LEHE2:
	.cfi_endproc
.LFE4006:
	.globl	__gxx_personality_v0
	.section	.gcc_except_table,"a",@progbits
.LLSDA4006:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE4006-.LLSDACSB4006
.LLSDACSB4006:
	.uleb128 .LEHB0-.LFB4006
	.uleb128 .LEHE0-.LEHB0
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB1-.LFB4006
	.uleb128 .LEHE1-.LEHB1
	.uleb128 .L15-.LFB4006
	.uleb128 0
	.uleb128 .LEHB2-.LFB4006
	.uleb128 .LEHE2-.LEHB2
	.uleb128 0
	.uleb128 0
.LLSDACSE4006:
	.text
	.size	_ZN21CNextStateLookupTable6CreateEj, .-_ZN21CNextStateLookupTable6CreateEj
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB4032:
	.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
.LFE4032:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.weak	_ZTS21CNextStateLookupTable
	.section	.rodata._ZTS21CNextStateLookupTable,"aG",@progbits,_ZTS21CNextStateLookupTable,comdat
	.align 16
	.type	_ZTS21CNextStateLookupTable, @object
	.size	_ZTS21CNextStateLookupTable, 24
_ZTS21CNextStateLookupTable:
	.string	"21CNextStateLookupTable"
	.weak	_ZTI21CNextStateLookupTable
	.section	.data.rel.ro._ZTI21CNextStateLookupTable,"awG",@progbits,_ZTI21CNextStateLookupTable,comdat
	.align 8
	.type	_ZTI21CNextStateLookupTable, @object
	.size	_ZTI21CNextStateLookupTable, 24
_ZTI21CNextStateLookupTable:
	.quad	_ZTVN10__cxxabiv120__si_class_type_infoE+16
	.quad	_ZTS21CNextStateLookupTable
	.quad	_ZTI17CStateLookupTable
	.weak	_ZTV21CNextStateLookupTable
	.section	.data.rel.ro.local._ZTV21CNextStateLookupTable,"awG",@progbits,_ZTV21CNextStateLookupTable,comdat
	.align 8
	.type	_ZTV21CNextStateLookupTable, @object
	.size	_ZTV21CNextStateLookupTable, 40
_ZTV21CNextStateLookupTable:
	.quad	0
	.quad	_ZTI21CNextStateLookupTable
	.quad	_ZN21CNextStateLookupTableD1Ev
	.quad	_ZN21CNextStateLookupTableD0Ev
	.quad	_ZNK21CNextStateLookupTable5ShiftEjj
	.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
	.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:

/**symbols lookup table
 * @file CNextStateLookupTable.h
 * @brief Class definition for next states lookup table
 * @author Oren Cohen
 * @bug No known bugs
 */

#ifndef LOOKUP_TABLES_CNEXTSTATELOOKUPTABLE_H_
#define LOOKUP_TABLES_CNEXTSTATELOOKUPTABLE_H_

#include "CStateLookupTable.cuh"

/**
 * Lookup table of possible next states
 *
 * Usage example:
 * @code
 * CNextStateLookupTable table(3);
 * This will generates :
 * state	input:0	input:1
 * 000	000	100
 * 001	000	100
 * 010	001	101
 * 011	001	101
 * 100	010	110
 * 101	010	110
 * 110	011	111
 * 111	011	111
 * @endcode
 */
class CNextStateLookupTable: public CStateLookupTable
{
public:
	static CNextStateLookupTable* Create(unsigned int const p_cnK);

	virtual ~CNextStateLookupTable(void);

private:
	CNextStateLookupTable(unsigned int const p_cnK);

	unsigned int Shift(unsigned int const p_cnState, unsigned int const p_cnInput) const;
};

#endif /* LOOKUP_TABLES_CNEXTSTATELOOKUPTABLE_H_ */

	.text
	.file	"CNextStateLookupTable.hip"
                                        # Start of file scope inline assembly
	.globl	_ZSt21ios_base_library_initv

                                        # End of file scope inline assembly
	.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
