// File: auton1[P]viterbi/entry.cpp
// Function: entry::check_missing(unsigned int, unsigned int, std::vector<char, std::allocator<char>> const&)
bool entry::check_missing(unsigned int line_position, const unsigned int type, const vector<char> &line)
{
	static unsigned char missing_float[4] = {0x01, 0x00, 0x80, 0x7F};
	static unsigned char missing_int1 = 0x80;
	static unsigned char missing_int2[2] = {0x00, 0x80};
	static unsigned char missing_int3[4] = {0x00, 0x00, 0x00, 0x80};

	char test_char;
	bool missing = true;
	if (type==1)
	{
		test_char = *reinterpret_cast<const char*>(&line[line_position]);
		missing = (test_char == missing_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 != missing_int2[ui])
			{
				missing = 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 != missing_int3[ui])
			{
				missing = 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 != missing_float[ui])
			{
				missing = false;
				break;
			}
			line_position += sizeof(char);
		}
	}
	else if (type==7)
		missing = false;

	return missing;
}

// 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 0x49294
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 0x4a33a(%rip), %ecx     # 0x935be
cmpl %ecx, %eax
sete %al
andb $0x1, %al
movb %al, 0xe(%rsp)
jmp 0x493e7
cmpl $0x2, 0x18(%rsp)
jne 0x49302
movl $0x0, 0x8(%rsp)
movl 0x8(%rsp), %eax
cmpq $0x2, %rax
jae 0x492fd
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 0x4a2ea(%rip), %rcx     # 0x935bf
movzbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
je 0x492e4
movb $0x0, 0xe(%rsp)
jmp 0x492fd
movl 0x1c(%rsp), %eax
addq $0x1, %rax
movl %eax, 0x1c(%rsp)
movl 0x8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x8(%rsp)
jmp 0x492a3
jmp 0x493e5
cmpl $0x3, 0x18(%rsp)
jne 0x4936d
movl $0x0, 0x4(%rsp)
movl 0x4(%rsp), %eax
cmpq $0x4, %rax
jae 0x4936b
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 0x4a27e(%rip), %rcx     # 0x935c1
movzbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
je 0x49352
movb $0x0, 0xe(%rsp)
jmp 0x4936b
movl 0x1c(%rsp), %eax
addq $0x1, %rax
movl %eax, 0x1c(%rsp)
movl 0x4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4(%rsp)
jmp 0x49311
jmp 0x493e3
cmpl $0x5, 0x18(%rsp)
jne 0x493d3
movl $0x0, (%rsp)
movl (%rsp), %eax
cmpq $0x4, %rax
jae 0x493d1
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 0x4a20f(%rip), %rcx     # 0x935ba
movzbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
je 0x493ba
movb $0x0, 0xe(%rsp)
jmp 0x493d1
movl 0x1c(%rsp), %eax
addq $0x1, %rax
movl %eax, 0x1c(%rsp)
movl (%rsp), %eax
addl $0x1, %eax
movl %eax, (%rsp)
jmp 0x4937b
jmp 0x493e1
cmpl $0x7, 0x18(%rsp)
jne 0x493df
movb $0x0, 0xe(%rsp)
jmp 0x493e1
jmp 0x493e3
jmp 0x493e5
jmp 0x493e7
movb 0xe(%rsp), %al
andb $0x1, %al
addq $0x28, %rsp
retq
nopw %cs:(%rax,%rax)