// File: auton1[P]viterbi/entry.cpp
// Function: entry::get_typed_int(unsigned int*, std::vector<char, std::allocator<char>> const&, unsigned int&, unsigned int&)
int entry::get_typed_int(unsigned int * line_position, const vector<char>& line, unsigned int &type, unsigned int &size)
{
	int out;

	get_type( line_position, line, type, size );

	if (size > 1)
	{
		LOG.printLOG("Error: Int vector when expected only a single Integer value.\n" );
		exit(0);
	}

	if (type == 1)
	{
		int8_t tmp;
		tmp = *reinterpret_cast<const int8_t*>(&line[*line_position]);
		*line_position += sizeof(tmp);
		out = tmp;
	}
	else if (type == 2)
	{
		int16_t tmp;
		tmp = *reinterpret_cast<const int16_t*>(&line[*line_position]);
		*line_position += sizeof(tmp);
		out = tmp;
	}
	else if (type == 3)
	{
		int32_t tmp;
		tmp = *reinterpret_cast<const int32_t*>(&line[*line_position]);
		*line_position += sizeof(tmp);
		out = tmp;
	}
	else
	{
		LOG.printLOG("Error: Invalid type for integer size.\n");
		exit(0);
	}
	return out;
}

// Assembly:
subq $0xa8, %rsp
movq %rdi, 0xa0(%rsp)
movq %rsi, 0x98(%rsp)
movq %rdx, 0x90(%rsp)
movq %rcx, 0x88(%rsp)
movq %r8, 0x80(%rsp)
movq 0xa0(%rsp), %rdi
movq 0x98(%rsp), %rsi
movq 0x90(%rsp), %rdx
movq 0x88(%rsp), %rcx
movq 0x80(%rsp), %r8
callq 0x489f0
movq 0x80(%rsp), %rax
cmpl $0x1, (%rax)
jbe 0x48ce9
leaq 0x57(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x69f0
movq 0x8(%rsp), %rdx
leaq 0x2c5c0(%rip), %rsi     # 0x75238
leaq 0x58(%rsp), %rdi
callq 0x67c0
jmp 0x48c84
leaq 0x4a975(%rip), %rdi     # 0x93600
leaq 0x58(%rsp), %rsi
callq 0x71280
jmp 0x48c97
leaq 0x58(%rsp), %rdi
callq 0x6b50
leaq 0x57(%rsp), %rdi
callq 0x65f0
xorl %edi, %edi
callq 0x66b0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x48(%rsp)
movl %eax, 0x44(%rsp)
jmp 0x48cda
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x48(%rsp)
movl %eax, 0x44(%rsp)
leaq 0x58(%rsp), %rdi
callq 0x6b50
leaq 0x57(%rsp), %rdi
callq 0x65f0
jmp 0x48e5f
movq 0x88(%rsp), %rax
cmpl $0x1, (%rax)
jne 0x48d33
movq 0x90(%rsp), %rdi
movq 0x98(%rsp), %rax
movl (%rax), %eax
movl %eax, %esi
callq 0x49920
movb (%rax), %al
movb %al, 0x43(%rsp)
movq 0x98(%rsp), %rax
movl (%rax), %ecx
addq $0x1, %rcx
movl %ecx, (%rax)
movsbl 0x43(%rsp), %eax
movl %eax, 0x7c(%rsp)
jmp 0x48e53
movq 0x88(%rsp), %rax
cmpl $0x2, (%rax)
jne 0x48d7f
movq 0x90(%rsp), %rdi
movq 0x98(%rsp), %rax
movl (%rax), %eax
movl %eax, %esi
callq 0x49920
movw (%rax), %ax
movw %ax, 0x40(%rsp)
movq 0x98(%rsp), %rax
movl (%rax), %ecx
addq $0x2, %rcx
movl %ecx, (%rax)
movswl 0x40(%rsp), %eax
movl %eax, 0x7c(%rsp)
jmp 0x48e51
movq 0x88(%rsp), %rax
cmpl $0x3, (%rax)
jne 0x48dc8
movq 0x90(%rsp), %rdi
movq 0x98(%rsp), %rax
movl (%rax), %eax
movl %eax, %esi
callq 0x49920
movl (%rax), %eax
movl %eax, 0x3c(%rsp)
movq 0x98(%rsp), %rax
movl (%rax), %ecx
addq $0x4, %rcx
movl %ecx, (%rax)
movl 0x3c(%rsp), %eax
movl %eax, 0x7c(%rsp)
jmp 0x48e4f
leaq 0x17(%rsp), %rdi
movq %rdi, (%rsp)
callq 0x69f0
movq (%rsp), %rdx
leaq 0x2c495(%rip), %rsi     # 0x75276
leaq 0x18(%rsp), %rdi
callq 0x67c0
jmp 0x48ded
leaq 0x4a80c(%rip), %rdi     # 0x93600
leaq 0x18(%rsp), %rsi
callq 0x71280
jmp 0x48e00
leaq 0x18(%rsp), %rdi
callq 0x6b50
leaq 0x17(%rsp), %rdi
callq 0x65f0
xorl %edi, %edi
callq 0x66b0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x48(%rsp)
movl %eax, 0x44(%rsp)
jmp 0x48e43
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x48(%rsp)
movl %eax, 0x44(%rsp)
leaq 0x18(%rsp), %rdi
callq 0x6b50
leaq 0x17(%rsp), %rdi
callq 0x65f0
jmp 0x48e5f
jmp 0x48e51
jmp 0x48e53
movl 0x7c(%rsp), %eax
addq $0xa8, %rsp
retq
movq 0x48(%rsp), %rdi
callq 0x69e0
nopl (%rax)