// File: /workspace/github_cpp_makefile_star2_O2/kiven-li[P]xbytes/xbytes.cpp
// Function: xbytes::xbytes::dump_action_table()
void xbytes::dump_action_table()
{
	std::cout << "==============ACTION TABLE============" << std::endl;
	std::cout << "STATE 	";
	for(int i = 0; i < symbols.size(); ++i)
	{
		std::cout << symbols[i]->name << "	";
	}
	std::cout << std::endl;

	for(int i = 0; i < states.size(); ++i)
	{
		std::cout << i << "	";
		for(int j = 0; j < states[i]->actions.size(); ++j)
		{
			int valid_action_count = 0;
			action_array& aa = states[i]->actions[j];
			for(int m = 0; m < aa.size(); ++m)
			{
				assert(valid_action_count <= 1);
				action& act = aa[m];
				std::stringstream ss;
				switch(act.type)
				{
				case LR_ACTION_REDUCE:
					ss << "R" << act.r->index << "	";
					valid_action_count++;
					break;
				case LR_ACTION_SHIFT:
					ss << "S" << act.next_state << "	";
					valid_action_count++;
					break;
				case LR_ACTION_GOTO:
					ss << "G" << act.next_state << "	";
					valid_action_count++;
					break;
				case LR_ACTION_ACCEPT:
					ss << "accept" << "	";
					valid_action_count++;
					break;
				case LR_ACTION_ERROR:
					ss << "-	";
					valid_action_count++;
				}

				std::cout << ss.str();
			}
		}
		std::cout << std::endl;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1c8, %rsp            # imm = 0x1C8
movq %rdi, -0x30(%rbp)
movq 0x8e09(%rip), %rbx      # 0xefd8
leaq 0x451f(%rip), %rsi      # 0xa6f5
movq %rbx, %rdi
callq 0x2220
movq %rax, %rdi
callq 0x2110
leaq 0x452f(%rip), %rsi      # 0xa71c
movq %rbx, %rdi
callq 0x2220
xorl %r15d, %r15d
leaq 0x4450(%rip), %r14      # 0xa64f
movq -0x30(%rbp), %rcx
movq 0x8(%rcx), %rax
movq 0x10(%rcx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r15, %rcx
jbe 0x6237
movq (%rax,%r15,8), %rsi
addq $0x8, %rsi
movq %rbx, %rdi
callq 0x2200
movq %rax, %rdi
movq %r14, %rsi
callq 0x2220
incq %r15
jmp 0x61ff
movq 0x8d9a(%rip), %rdi      # 0xefd8
callq 0x2110
xorl %ebx, %ebx
movq -0x30(%rbp), %rcx
movq 0x40(%rcx), %rax
subq 0x38(%rcx), %rax
sarq $0x3, %rax
cmpq %rbx, %rax
jbe 0x644b
movq 0x8d73(%rip), %rdi      # 0xefd8
movl %ebx, %esi
callq 0x2370
movq %rax, %rdi
leaq 0x43d9(%rip), %rsi      # 0xa64f
callq 0x2220
xorl %esi, %esi
movq %rbx, -0x38(%rbp)
movq -0x30(%rbp), %rax
movq 0x38(%rax), %rax
movq (%rax,%rbx,8), %rax
movq 0x50(%rax), %r12
movq 0x58(%rax), %rax
subq %r12, %rax
cqto
pushq $0x18
popq %rcx
idivq %rcx
cmpq %rsi, %rax
jbe 0x6437
movq %rsi, -0x40(%rbp)
imulq $0x18, %rsi, %rax
addq %rax, %r12
xorl %r15d, %r15d
pushq $0x8
popq %r14
xorl %r13d, %r13d
movq (%r12), %rbx
movq 0x8(%r12), %rax
subq %rbx, %rax
cqto
pushq $0x18
popq %rcx
idivq %rcx
cmpq %r15, %rax
jbe 0x6427
cmpl $0x2, %r13d
jge 0x645d
leaq -0x1e8(%rbp), %rdi
callq 0x2190
movl -0x8(%rbx,%r14), %eax
decl %eax
cmpl $0x4, %eax
ja 0x63e5
leaq 0x3da4(%rip), %rcx      # 0xa0ac
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq -0x1d8(%rbp), %rdi
leaq 0x4448(%rip), %rsi      # 0xa767
callq 0x2220
movl -0x4(%rbx,%r14), %esi
movq %rax, %rdi
callq 0x2370
movq %rax, %rdi
leaq 0x4314(%rip), %rsi      # 0xa64f
callq 0x2220
jmp 0x63e2
leaq -0x1d8(%rbp), %rdi
leaq 0x441d(%rip), %rsi      # 0xa770
callq 0x2220
jmp 0x63e2
leaq -0x1d8(%rbp), %rdi
leaq 0x42df(%rip), %rsi      # 0xa64a
callq 0x2220
movq (%rbx,%r14), %rcx
movl (%rcx), %esi
movq %rax, %rdi
callq 0x2370
movq %rax, %rdi
leaq 0x42c7(%rip), %rsi      # 0xa64f
callq 0x2220
jmp 0x63e2
leaq -0x1d8(%rbp), %rdi
leaq 0x43cc(%rip), %rsi      # 0xa769
callq 0x2220
movq %rax, %rdi
leaq 0x42a3(%rip), %rsi      # 0xa64f
callq 0x2220
jmp 0x63e2
leaq -0x1d8(%rbp), %rdi
leaq 0x43a4(%rip), %rsi      # 0xa765
callq 0x2220
movl -0x4(%rbx,%r14), %esi
movq %rax, %rdi
callq 0x2370
movq %rax, %rdi
leaq 0x4272(%rip), %rsi      # 0xa64f
callq 0x2220
incl %r13d
leaq -0x60(%rbp), %rbx
movq %rbx, %rdi
leaq -0x1d0(%rbp), %rsi
callq 0x2310
movq 0x8bd9(%rip), %rdi      # 0xefd8
movq %rbx, %rsi
callq 0x2200
movq %rbx, %rdi
callq 0x2100
leaq -0x1e8(%rbp), %rdi
callq 0x21b0
incq %r15
addq $0x18, %r14
jmp 0x62be
movq -0x40(%rbp), %rsi
incq %rsi
movq -0x38(%rbp), %rbx
jmp 0x6281
movq 0x8b9a(%rip), %rdi      # 0xefd8
callq 0x2110
incq %rbx
jmp 0x6245
addq $0x1c8, %rsp            # imm = 0x1C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x42c0(%rip), %rdi      # 0xa724
leaq 0x3d3d(%rip), %rsi      # 0xa1a8
leaq 0x42ca(%rip), %rcx      # 0xa73c
movl $0x590, %edx            # imm = 0x590
callq 0x2160
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
callq 0x2100
jmp 0x648f
jmp 0x648c
movq %rax, %rbx
leaq -0x1e8(%rbp), %rdi
callq 0x21b0
movq %rbx, %rdi
callq 0x2380
nop