// File: smallmuou[P]tinyhtml/tinyxmlparser.cpp
// Function: TiXmlParsingData::Stamp(char const*, TiXmlEncoding)
void TiXmlParsingData::Stamp( const char* now, TiXmlEncoding encoding )
{
	assert( now );

	// Do nothing if the tabsize is 0.
	if ( tabsize < 1 )
	{
		return;
	}

	// Get the current row, column.
	int row = cursor.row;
	int col = cursor.col;
	const char* p = stamp;
	assert( p );

	while ( p < now )
	{
		// Treat p as unsigned, so we have a happy compiler.
		const unsigned char* pU = (const unsigned char*)p;

		// Code contributed by Fletcher Dunn: (modified by lee)
		switch (*pU) {
			case 0:
				// We *should* never get here, but in case we do, don't
				// advance past the terminating null character, ever
				return;

			case '\r':
				// bump down to the next line
				++row;
				col = 0;				
				// Eat the character
				++p;

				// Check for \r\n sequence, and treat this as a single character
				if (*p == '\n') {
					++p;
				}
				break;

			case '\n':
				// bump down to the next line
				++row;
				col = 0;

				// Eat the character
				++p;

				// Check for \n\r sequence, and treat this as a single
				// character.  (Yes, this bizarre thing does occur still
				// on some arcane platforms...)
				if (*p == '\r') {
					++p;
				}
				break;

			case '\t':
				// Eat the character
				++p;

				// Skip to next tab stop
				col = (col / tabsize + 1) * tabsize;
				break;

			case TIXML_UTF_LEAD_0:
				if ( encoding == TIXML_ENCODING_UTF8 )
				{
					if ( *(p+1) && *(p+2) )
					{
						// In these cases, don't advance the column. These are
						// 0-width spaces.
						if ( *(pU+1)==TIXML_UTF_LEAD_1 && *(pU+2)==TIXML_UTF_LEAD_2 )
							p += 3;	
						else if ( *(pU+1)==0xbfU && *(pU+2)==0xbeU )
							p += 3;	
						else if ( *(pU+1)==0xbfU && *(pU+2)==0xbfU )
							p += 3;	
						else
							{ p +=3; ++col; }	// A normal character.
					}
				}
				else
				{
					++p;
					++col;
				}
				break;

			default:
				if ( encoding == TIXML_ENCODING_UTF8 )
				{
					// Eat the 1 to 4 byte utf8 character.
					int step = TiXmlBase::utf8ByteTable[*((const unsigned char*)p)];
					if ( step == 0 )
						step = 1;		// Error case from bad encoding, but handle gracefully.
					p += step;

					// Just advance one column, of course.
					++col;
				}
				else
				{
					++p;
					++col;
				}
				break;
		}
	}
	cursor.row = row;
	cursor.col = col;
	assert( cursor.row >= -1 );
	assert( cursor.col >= -1 );
	stamp = p;
	assert( stamp );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x8ab4
jmp 0x8ad3
leaq 0x5f94(%rip), %rdi      # 0xea4f
leaq 0x5f91(%rip), %rsi      # 0xea53
movl $0xc6, %edx
leaq 0x5f97(%rip), %rcx      # 0xea65
callq 0x30e0
movq -0x40(%rbp), %rax
cmpl $0x1, 0x10(%rax)
jge 0x8ae2
jmp 0x8dee
movq -0x40(%rbp), %rax
movl (%rax), %ecx
movl %ecx, -0x18(%rbp)
movl 0x4(%rax), %ecx
movl %ecx, -0x1c(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x8b02
jmp 0x8b21
leaq 0x580a(%rip), %rdi      # 0xe313
leaq 0x5f43(%rip), %rsi      # 0xea53
movl $0xd2, %edx
leaq 0x5f49(%rip), %rcx      # 0xea65
callq 0x30e0
jmp 0x8b23
movq -0x28(%rbp), %rax
cmpq -0x10(%rbp), %rax
jae 0x8d5a
movq -0x28(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movzbl (%rax), %eax
movl %eax, -0x44(%rbp)
testl %eax, %eax
je 0x8b7e
jmp 0x8b49
movl -0x44(%rbp), %eax
subl $0x9, %eax
je 0x8bf5
jmp 0x8b57
movl -0x44(%rbp), %eax
subl $0xa, %eax
je 0x8bbc
jmp 0x8b61
movl -0x44(%rbp), %eax
subl $0xd, %eax
je 0x8b83
jmp 0x8b6b
movl -0x44(%rbp), %eax
subl $0xef, %eax
je 0x8c1b
jmp 0x8cf9
jmp 0x8dee
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0xa, %eax
jne 0x8bb7
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x8d55
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0xd, %eax
jne 0x8bf0
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x8d55
movq -0x40(%rbp), %rcx
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
movl -0x1c(%rbp), %eax
cltd
idivl 0x10(%rcx)
addl $0x1, %eax
imull 0x10(%rcx), %eax
movl %eax, -0x1c(%rbp)
jmp 0x8d55
cmpl $0x1, -0x14(%rbp)
jne 0x8ce2
movq -0x28(%rbp), %rax
cmpb $0x0, 0x1(%rax)
je 0x8ce0
movq -0x28(%rbp), %rax
cmpb $0x0, 0x2(%rax)
je 0x8ce0
movq -0x30(%rbp), %rax
movzbl 0x1(%rax), %eax
cmpl $0xbb, %eax
jne 0x8c6d
movq -0x30(%rbp), %rax
movzbl 0x2(%rax), %eax
cmpl $0xbf, %eax
jne 0x8c6d
movq -0x28(%rbp), %rax
addq $0x3, %rax
movq %rax, -0x28(%rbp)
jmp 0x8cde
movq -0x30(%rbp), %rax
movzbl 0x1(%rax), %eax
cmpl $0xbf, %eax
jne 0x8c99
movq -0x30(%rbp), %rax
movzbl 0x2(%rax), %eax
cmpl $0xbe, %eax
jne 0x8c99
movq -0x28(%rbp), %rax
addq $0x3, %rax
movq %rax, -0x28(%rbp)
jmp 0x8cdc
movq -0x30(%rbp), %rax
movzbl 0x1(%rax), %eax
cmpl $0xbf, %eax
jne 0x8cc5
movq -0x30(%rbp), %rax
movzbl 0x2(%rax), %eax
cmpl $0xbf, %eax
jne 0x8cc5
movq -0x28(%rbp), %rax
addq $0x3, %rax
movq %rax, -0x28(%rbp)
jmp 0x8cda
movq -0x28(%rbp), %rax
addq $0x3, %rax
movq %rax, -0x28(%rbp)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x8cdc
jmp 0x8cde
jmp 0x8ce0
jmp 0x8cf7
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x8d55
cmpl $0x1, -0x14(%rbp)
jne 0x8d3e
movq -0x28(%rbp), %rax
movzbl (%rax), %eax
movl %eax, %ecx
leaq 0x5901(%rip), %rax      # 0xe610
movl (%rax,%rcx,4), %eax
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
jne 0x8d22
movl $0x1, -0x34(%rbp)
movl -0x34(%rbp), %ecx
movq -0x28(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x8d53
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x8d55
jmp 0x8b23
movq -0x40(%rbp), %rax
movl -0x18(%rbp), %ecx
movl %ecx, (%rax)
movl -0x1c(%rbp), %ecx
movl %ecx, 0x4(%rax)
cmpl $-0x1, (%rax)
jl 0x8d70
jmp 0x8d8f
leaq 0x5d28(%rip), %rdi      # 0xea9f
leaq 0x5cd5(%rip), %rsi      # 0xea53
movl $0x133, %edx            # imm = 0x133
leaq 0x5cdb(%rip), %rcx      # 0xea65
callq 0x30e0
movq -0x40(%rbp), %rax
cmpl $-0x1, 0x4(%rax)
jl 0x8d9b
jmp 0x8dba
leaq 0x5d0e(%rip), %rdi      # 0xeab0
leaq 0x5caa(%rip), %rsi      # 0xea53
movl $0x134, %edx            # imm = 0x134
leaq 0x5cb0(%rip), %rcx      # 0xea65
callq 0x30e0
movq -0x40(%rbp), %rax
movq -0x28(%rbp), %rcx
movq %rcx, 0x8(%rax)
cmpq $0x0, 0x8(%rax)
je 0x8dcf
jmp 0x8dee
leaq 0x5ceb(%rip), %rdi      # 0xeac1
leaq 0x5c76(%rip), %rsi      # 0xea53
movl $0x136, %edx            # imm = 0x136
leaq 0x5c7c(%rip), %rcx      # 0xea65
callq 0x30e0
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)