// File: auton1[P]viterbi/entry.cpp
// Function: entry::check_end(unsigned int, unsigned int, std::vector<char, std::allocator<char>> const&)
bool entry::check_end(unsigned int line_position, const unsigned int type, const vector<char> &line)
{
	static unsigned char end_float[4] = {0x02, 0x00, 0x80, 0x7F};
	static unsigned char end_int1 = 0x81;
	static unsigned char end_int2[2] = {0x01, 0x80};
	static unsigned char end_int3[4] = {0x01, 0x00, 0x00, 0x80};

	char test_char;
	bool end = true;
	if (type==1)
	{
		test_char = *reinterpret_cast<const char*>(&line[line_position]);
		end = (test_char == end_int1);
	}
	else if (type==2)
	{
		for (unsigned int ui=0; ui<sizeof(int16_t); ui++)
		{
			test_char = *reinterpret_cast<const char*>(&line[line_position]);
			if (test_char != end_int2[ui])
			{
				end = false;
				break;
			}
			line_position += sizeof(char);
		}
	}
	else if (type==3)
	{
		for (unsigned int ui=0; ui<sizeof(int32_t); ui++)
		{
			test_char = *reinterpret_cast<const char*>(&line[line_position]);
			if (test_char != end_int3[ui])
			{
				end = false;
				break;
			}
			line_position += sizeof(char);
		}
	}
	else if (type==5)
	{
		for (unsigned int ui=0; ui<sizeof(float); ui++)
		{
			test_char = *reinterpret_cast<const char*>(&line[line_position]);
			if (test_char != end_float[ui])
			{
				end = false;
				break;
			}
			line_position += sizeof(char);
		}
	}
	else if (type==7)
		end = false;

	return end;
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movl %esi, 0x1c(%rsp)
movl %edx, 0x18(%rsp)
movq %rcx, 0x10(%rsp)
movb $0x1, 0xe(%rsp)
cmpl $0x1, 0x18(%rsp)
jne 0x49454
movq 0x10(%rsp), %rdi
movl 0x1c(%rsp), %eax
movl %eax, %esi
callq 0x49920
movb (%rax), %al
movb %al, 0xf(%rsp)
movsbl 0xf(%rsp), %eax
movzbl 0x4a185(%rip), %ecx     # 0x935c9
cmpl %ecx, %eax
sete %al
andb $0x1, %al
movb %al, 0xe(%rsp)
jmp 0x495a7
cmpl $0x2, 0x18(%rsp)
jne 0x494c2
movl $0x0, 0x8(%rsp)
movl 0x8(%rsp), %eax
cmpq $0x2, %rax
jae 0x494bd
movq 0x10(%rsp), %rdi
movl 0x1c(%rsp), %eax
movl %eax, %esi
callq 0x49920
movb (%rax), %al
movb %al, 0xf(%rsp)
movsbl 0xf(%rsp), %eax
movl 0x8(%rsp), %ecx
movl %ecx, %edx
leaq 0x4a135(%rip), %rcx     # 0x935ca
movzbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
je 0x494a4
movb $0x0, 0xe(%rsp)
jmp 0x494bd
movl 0x1c(%rsp), %eax
addq $0x1, %rax
movl %eax, 0x1c(%rsp)
movl 0x8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x8(%rsp)
jmp 0x49463
jmp 0x495a5
cmpl $0x3, 0x18(%rsp)
jne 0x4952d
movl $0x0, 0x4(%rsp)
movl 0x4(%rsp), %eax
cmpq $0x4, %rax
jae 0x4952b
movq 0x10(%rsp), %rdi
movl 0x1c(%rsp), %eax
movl %eax, %esi
callq 0x49920
movb (%rax), %al
movb %al, 0xf(%rsp)
movsbl 0xf(%rsp), %eax
movl 0x4(%rsp), %ecx
movl %ecx, %edx
leaq 0x4a0c9(%rip), %rcx     # 0x935cc
movzbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
je 0x49512
movb $0x0, 0xe(%rsp)
jmp 0x4952b
movl 0x1c(%rsp), %eax
addq $0x1, %rax
movl %eax, 0x1c(%rsp)
movl 0x4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4(%rsp)
jmp 0x494d1
jmp 0x495a3
cmpl $0x5, 0x18(%rsp)
jne 0x49593
movl $0x0, (%rsp)
movl (%rsp), %eax
cmpq $0x4, %rax
jae 0x49591
movq 0x10(%rsp), %rdi
movl 0x1c(%rsp), %eax
movl %eax, %esi
callq 0x49920
movb (%rax), %al
movb %al, 0xf(%rsp)
movsbl 0xf(%rsp), %eax
movl (%rsp), %ecx
movl %ecx, %edx
leaq 0x4a05a(%rip), %rcx     # 0x935c5
movzbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
je 0x4957a
movb $0x0, 0xe(%rsp)
jmp 0x49591
movl 0x1c(%rsp), %eax
addq $0x1, %rax
movl %eax, 0x1c(%rsp)
movl (%rsp), %eax
addl $0x1, %eax
movl %eax, (%rsp)
jmp 0x4953b
jmp 0x495a1
cmpl $0x7, 0x18(%rsp)
jne 0x4959f
movb $0x0, 0xe(%rsp)
jmp 0x495a1
jmp 0x495a3
jmp 0x495a5
jmp 0x495a7
movb 0xe(%rsp), %al
andb $0x1, %al
addq $0x28, %rsp
retq
nopw %cs:(%rax,%rax)