// File: /workspace/github_cpp_makefile_star2_O2/smallmuou[P]tinyhtml/tinyxmlparser.cpp
// Function: TiXmlAttribute::Parse(char const*, TiXmlParsingData*, TiXmlEncoding)
const char* TiXmlAttribute::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding )
{
	p = SkipWhiteSpace( p, encoding );
	if ( !p || !*p ) return 0;

	if ( data )
	{
		data->Stamp( p, encoding );
		location = data->Cursor();
	}
	// Read the name, the '=' and the value.
	const char* pErr = p;
	p = ReadName( p, &name, encoding );
	if ( !p || !*p )
	{
		if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, pErr, data, encoding );
		return 0;
	}
	p = SkipWhiteSpace( p, encoding );
	if ( !p || !*p || *p != '=' )
	{
		if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding );
		return 0;
	}

	++p;	// skip '='
	p = SkipWhiteSpace( p, encoding );
	if ( !p || !*p )
	{
		if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding );
		return 0;
	}
	
	const char* end;
	const char SINGLE_QUOTE = '\'';
	const char DOUBLE_QUOTE = '\"';

	if ( *p == SINGLE_QUOTE )
	{
		++p;
		end = "\'";		// single quote in string
		p = ReadText( p, &value, false, end, false, encoding );
	}
	else if ( *p == DOUBLE_QUOTE )
	{
		++p;
		end = "\"";		// double quote in string
		p = ReadText( p, &value, false, end, false, encoding );
	}
	else
	{
		// All attribute values should be in single or double quotes.
		// But this is such a common error that the parser will try
		// its best, even without them.
		value = "";
		while (    p && *p											// existence
				&& !IsWhiteSpace( *p )								// whitespace
				&& *p != '/' && *p != '>' )							// tag end
		{
			if ( *p == SINGLE_QUOTE || *p == DOUBLE_QUOTE ) {
				// [ 1451649 ] Attribute values with trailing quotes not handled correctly
				// We did not have an opening quote but seem to have a 
				// closing one. Give up and throw an error.
				if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding );
				return 0;
			}
			value += *p;
			++p;
		}
	}
	return p;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl %ecx, %ebx
movq %rdx, %r14
movq %rdi, %r15
movq %rsi, %rdi
movl %ecx, %esi
callq 0x5fec
testq %rax, %rax
je 0x7096
movq %rax, %r12
cmpb $0x0, (%rax)
je 0x7096
testq %r14, %r14
je 0x7019
movq %r14, %rdi
movq %r12, %rsi
movl %ebx, %edx
callq 0x5e48
movq (%r14), %rax
movq %rax, 0x8(%r15)
leaq 0x20(%r15), %rsi
movq %r12, %rdi
callq 0x606a
testq %rax, %rax
je 0x706b
cmpb $0x0, (%rax)
je 0x706b
movq %rax, %rdi
movl %ebx, %esi
callq 0x5fec
testq %rax, %rax
je 0x707c
cmpb $0x3d, (%rax)
jne 0x707c
incq %rax
movq %rax, %rdi
movl %ebx, %esi
callq 0x5fec
movq %rax, %r12
testq %rax, %rax
je 0x706b
movzbl (%r12), %eax
cmpl $0x27, %eax
je 0x70b6
cmpl $0x22, %eax
je 0x70a6
testl %eax, %eax
jne 0x70e0
movq 0x18(%r15), %rdi
testq %rdi, %rdi
je 0x7096
pushq $0x6
popq %rsi
movq %r12, %rdx
jmp 0x708b
movq 0x18(%r15), %rdi
testq %rdi, %rdi
je 0x7096
pushq $0x6
popq %rsi
movq %rax, %rdx
movq %r14, %rcx
movl %ebx, %r8d
callq 0x6760
xorl %r12d, %r12d
movq %r12, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
incq %r12
addq $0x28, %r15
leaq 0x2387(%rip), %rcx      # 0x943b
jmp 0x70c4
incq %r12
addq $0x28, %r15
leaq 0x2297(%rip), %rcx      # 0x935b
movq %r12, %rdi
movq %r15, %rsi
xorl %edx, %edx
xorl %r8d, %r8d
movl %ebx, %r9d
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x641e
leaq 0x28(%r15), %r13
leaq 0x22fa(%rip), %rsi      # 0x93e5
movq %r13, %rdi
callq 0x5988
movb (%r12), %al
testb %al, %al
je 0x7099
movsbl %al, %edi
callq 0x7582
testb %al, %al
jne 0x7099
movzbl (%r12), %eax
cmpl $0x22, %eax
je 0x706b
cmpl $0x3e, %eax
je 0x7099
cmpl $0x2f, %eax
je 0x7099
cmpl $0x27, %eax
je 0x706b
movsbl %al, %esi
movq %r13, %rdi
callq 0x5972
incq %r12
jmp 0x70f3