// File: 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
subq $0x250, %rsp            # imm = 0x250
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x1f0(%rbp)
movq 0x192d7(%rip), %rdi     # 0x23fd8
leaq 0xe9dd(%rip), %rsi      # 0x196e5
callq 0x32e0
movq %rax, %rdi
movq 0x192b1(%rip), %rsi     # 0x23fc8
callq 0x3320
movq 0x192b5(%rip), %rdi     # 0x23fd8
leaq 0xe9e2(%rip), %rsi      # 0x1970c
callq 0x32e0
movl $0x0, -0xc(%rbp)
movq -0x1f0(%rbp), %rdi
movslq -0xc(%rbp), %rax
movq %rax, -0x1f8(%rbp)
addq $0x8, %rdi
callq 0xc4d0
movq %rax, %rcx
movq -0x1f8(%rbp), %rax
cmpq %rcx, %rax
jae 0xada1
movq -0x1f0(%rbp), %rdi
addq $0x8, %rdi
movslq -0xc(%rbp), %rsi
callq 0xc4f0
movq (%rax), %rsi
addq $0x8, %rsi
movq 0x19256(%rip), %rdi     # 0x23fd8
callq 0x3290
movq %rax, %rdi
leaq 0xe8ae(%rip), %rsi      # 0x1963f
callq 0x32e0
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0xad36
movq 0x19230(%rip), %rdi     # 0x23fd8
movq 0x19219(%rip), %rsi     # 0x23fc8
callq 0x3320
movl $0x0, -0x10(%rbp)
movq -0x1f0(%rbp), %rdi
movslq -0x10(%rbp), %rax
movq %rax, -0x200(%rbp)
addq $0x38, %rdi
callq 0xc550
movq %rax, %rcx
movq -0x200(%rbp), %rax
cmpq %rcx, %rax
jae 0xb14d
movl -0x10(%rbp), %esi
movq 0x191e5(%rip), %rdi     # 0x23fd8
callq 0x34d0
movq %rax, %rdi
leaq 0xe83d(%rip), %rsi      # 0x1963f
callq 0x32e0
movl $0x0, -0x14(%rbp)
movq -0x1f0(%rbp), %rdi
movslq -0x14(%rbp), %rax
movq %rax, -0x208(%rbp)
addq $0x38, %rdi
movslq -0x10(%rbp), %rsi
callq 0xc570
movq (%rax), %rdi
addq $0x50, %rdi
callq 0xcef0
movq %rax, %rcx
movq -0x208(%rbp), %rax
cmpq %rcx, %rax
jae 0xb12c
movq -0x1f0(%rbp), %rdi
movl $0x0, -0x18(%rbp)
addq $0x38, %rdi
movslq -0x10(%rbp), %rsi
callq 0xc570
movq (%rax), %rdi
addq $0x50, %rdi
movslq -0x14(%rbp), %rsi
callq 0xce30
movq %rax, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movslq -0x24(%rbp), %rax
movq %rax, -0x210(%rbp)
movq -0x20(%rbp), %rdi
callq 0xcf20
movq %rax, %rcx
movq -0x210(%rbp), %rax
cmpq %rcx, %rax
jae 0xb11c
cmpl $0x1, -0x18(%rbp)
jg 0xaeb1
jmp 0xaed0
leaq 0xe85c(%rip), %rdi      # 0x19714
leaq 0xe2d9(%rip), %rsi      # 0x19198
movl $0x590, %edx            # imm = 0x590
leaq 0xe861(%rip), %rcx      # 0x1972c
callq 0x31d0
movq -0x20(%rbp), %rdi
movslq -0x24(%rbp), %rsi
callq 0xcf50
movq %rax, -0x30(%rbp)
leaq -0x1b8(%rbp), %rdi
callq 0x3210
movq -0x30(%rbp), %rax
movl (%rax), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x218(%rbp)
subl $0x4, %eax
ja 0xb0a0
movq -0x218(%rbp), %rax
leaq 0xe197(%rip), %rcx      # 0x190ac
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq -0x1a8(%rbp), %rdi
leaq 0xe70e(%rip), %rsi      # 0x1963a
callq 0x32e0
movq %rax, -0x220(%rbp)
jmp 0xaf3a
movq -0x220(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movl (%rax), %esi
callq 0x34d0
movq %rax, -0x228(%rbp)
jmp 0xaf59
movq -0x228(%rbp), %rdi
leaq 0xe6d8(%rip), %rsi      # 0x1963f
callq 0x32e0
jmp 0xaf6e
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0xb0a0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1c0(%rbp)
movl %eax, -0x1c4(%rbp)
jmp 0xb10e
leaq -0x1a8(%rbp), %rdi
leaq 0xe7b4(%rip), %rsi      # 0x19755
callq 0x32e0
movq %rax, -0x230(%rbp)
jmp 0xafaf
movq -0x230(%rbp), %rdi
movq -0x30(%rbp), %rax
movl 0x4(%rax), %esi
callq 0x34d0
movq %rax, -0x238(%rbp)
jmp 0xafcb
movq -0x238(%rbp), %rdi
leaq 0xe666(%rip), %rsi      # 0x1963f
callq 0x32e0
jmp 0xafe0
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0xb0a0
leaq -0x1a8(%rbp), %rdi
leaq 0xe75b(%rip), %rsi      # 0x19757
callq 0x32e0
movq %rax, -0x240(%rbp)
jmp 0xb00a
movq -0x240(%rbp), %rdi
movq -0x30(%rbp), %rax
movl 0x4(%rax), %esi
callq 0x34d0
movq %rax, -0x248(%rbp)
jmp 0xb026
movq -0x248(%rbp), %rdi
leaq 0xe60b(%rip), %rsi      # 0x1963f
callq 0x32e0
jmp 0xb03b
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0xb0a0
leaq -0x1a8(%rbp), %rdi
leaq 0xe705(%rip), %rsi      # 0x19759
callq 0x32e0
movq %rax, -0x250(%rbp)
jmp 0xb062
movq -0x250(%rbp), %rdi
leaq 0xe5cf(%rip), %rsi      # 0x1963f
callq 0x32e0
jmp 0xb077
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0xb0a0
leaq -0x1a8(%rbp), %rdi
leaq 0xe6d0(%rip), %rsi      # 0x19760
callq 0x32e0
jmp 0xb097
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
leaq -0x1e8(%rbp), %rdi
leaq -0x1b8(%rbp), %rsi
callq 0x32d0
jmp 0xb0b5
movq 0x18f1c(%rip), %rdi     # 0x23fd8
leaq -0x1e8(%rbp), %rsi
callq 0x3290
jmp 0xb0ca
leaq -0x1e8(%rbp), %rdi
callq 0x31b0
leaq -0x1b8(%rbp), %rdi
callq 0x3230
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xae82
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1c0(%rbp)
movl %eax, -0x1c4(%rbp)
leaq -0x1e8(%rbp), %rdi
callq 0x31b0
leaq -0x1b8(%rbp), %rdi
callq 0x3230
jmp 0xb156
jmp 0xb11e
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xae0e
movq 0x18ea5(%rip), %rdi     # 0x23fd8
movq 0x18e8e(%rip), %rsi     # 0x23fc8
callq 0x3320
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0xadbb
addq $0x250, %rsp            # imm = 0x250
popq %rbp
retq
movq -0x1c0(%rbp), %rdi
callq 0x34e0
nopw %cs:(%rax,%rax)