// File: gersteinlab[P]MUSIC/src/ms_mapped_read_tools.cpp
// Function: validate_mapping_map_str(char*, bool&)
bool validate_mapping_map_str(char* mapping_map_str, bool& is_read_spliced)
{
	int i = 0;

	is_read_spliced = false;

	int state = VAL;
	while(mapping_map_str[i] != 0)
	{		
		if(state == VAL)
		{
			//fprintf(stderr, "%c (%d)\n", quality_str[i], 0);
			// MIDNSHPX=
			if(mapping_map_str[i] == 'M' ||
				mapping_map_str[i] == 'I' ||
				mapping_map_str[i] == 'D' ||
				mapping_map_str[i] == 'N' ||
				mapping_map_str[i] == 'S' ||		
				mapping_map_str[i] == 'H' ||
				mapping_map_str[i] == 'P' ||
				mapping_map_str[i] == 'X' ||
				mapping_map_str[i] == '=')
			{
				state = TYPE;

				if(mapping_map_str[i] != 'M')
				{
					is_read_spliced = true;
				}
			}
			else if(mapping_map_str[i] >= '0' && mapping_map_str[i] <= '9')
			{
				// State is still VAL.
			}
			else
			{
				return(false);
			}
		}
		else if(state == TYPE)
		{
			//fprintf(stderr, "%c (%d)\n", quality_str[i], 1);
			// A number is expected.
			if(mapping_map_str[i] >= '0' && mapping_map_str[i] <= '9')
			{
				state = VAL;
			}
			else
			{
				return(false);
			}
		}

		// Move to next character.
		i++;
	}

	return(true);
}

// Assembly:
movq %rdi, -0x10(%rsp)
movq %rsi, -0x18(%rsp)
movl $0x0, -0x1c(%rsp)
movq -0x18(%rsp), %rax
movb $0x0, (%rax)
movl $0x0, -0x20(%rsp)
movq -0x10(%rsp), %rax
movslq -0x1c(%rsp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0x1f6e1
cmpl $0x0, -0x20(%rsp)
jne 0x1f68f
movq -0x10(%rsp), %rax
movslq -0x1c(%rsp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x4d, %eax
je 0x1f637
movq -0x10(%rsp), %rax
movslq -0x1c(%rsp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x49, %eax
je 0x1f637
movq -0x10(%rsp), %rax
movslq -0x1c(%rsp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x44, %eax
je 0x1f637
movq -0x10(%rsp), %rax
movslq -0x1c(%rsp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x4e, %eax
je 0x1f637
movq -0x10(%rsp), %rax
movslq -0x1c(%rsp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x53, %eax
je 0x1f637
movq -0x10(%rsp), %rax
movslq -0x1c(%rsp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x48, %eax
je 0x1f637
movq -0x10(%rsp), %rax
movslq -0x1c(%rsp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x50, %eax
je 0x1f637
movq -0x10(%rsp), %rax
movslq -0x1c(%rsp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x58, %eax
je 0x1f637
movq -0x10(%rsp), %rax
movslq -0x1c(%rsp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x3d, %eax
jne 0x1f65c
movl $0x1, -0x20(%rsp)
movq -0x10(%rsp), %rax
movslq -0x1c(%rsp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x4d, %eax
je 0x1f65a
movq -0x18(%rsp), %rax
movb $0x1, (%rax)
jmp 0x1f68d
movq -0x10(%rsp), %rax
movslq -0x1c(%rsp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x30, %eax
jl 0x1f684
movq -0x10(%rsp), %rax
movslq -0x1c(%rsp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x39, %eax
jg 0x1f684
jmp 0x1f68b
movb $0x0, -0x1(%rsp)
jmp 0x1f6e6
jmp 0x1f68d
jmp 0x1f6d1
cmpl $0x1, -0x20(%rsp)
jne 0x1f6cf
movq -0x10(%rsp), %rax
movslq -0x1c(%rsp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x30, %eax
jl 0x1f6c6
movq -0x10(%rsp), %rax
movslq -0x1c(%rsp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x39, %eax
jg 0x1f6c6
movl $0x0, -0x20(%rsp)
jmp 0x1f6cd
movb $0x0, -0x1(%rsp)
jmp 0x1f6e6
jmp 0x1f6cf
jmp 0x1f6d1
movl -0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rsp)
jmp 0x1f562
movb $0x1, -0x1(%rsp)
movb -0x1(%rsp), %al
andb $0x1, %al
retq
nopl (%rax)