// File: smallmuou[P]tinyhtml/tinyxml.cpp
// Function: TiXmlElement::Print(_IO_FILE*, int) const
void TiXmlElement::Print( FILE* cfile, int depth ) const
{
	int i;
	assert( cfile );
	for ( i=0; i<depth; i++ ) {
		fprintf( cfile, "    " );
	}

	fprintf( cfile, "<%s", value.c_str() );

	const TiXmlAttribute* attrib;
	for ( attrib = attributeSet.First(); attrib; attrib = attrib->Next() )
	{
		fprintf( cfile, " " );
		attrib->Print( cfile, depth );
	}

	// There are 3 different formatting approaches:
	// 1) An element without children is printed as a <foo /> node
	// 2) An element with only a text child is printed as <foo> text </foo>
	// 3) An element with children is printed on multiple lines.
	TiXmlNode* node;
	if ( !firstChild )
	{
		fprintf( cfile, " />" );
	}
	else if ( firstChild == lastChild && firstChild->ToText() )
	{
		fprintf( cfile, ">" );
		firstChild->Print( cfile, depth + 1 );
		fprintf( cfile, "</%s>", value.c_str() );
	}
	else
	{
		fprintf( cfile, ">" );

		for ( node = firstChild; node; node=node->NextSibling() )
		{
			if ( !node->ToText() )
			{
				fprintf( cfile, "\n" );
			}
			node->Print( cfile, depth+1 );
		}
		fprintf( cfile, "\n" );
		for( i=0; i<depth; ++i ) {
			fprintf( cfile, "    " );
		}
		fprintf( cfile, "</%s>", value.c_str() );
	}
}

// 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, -0x30(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x5034
jmp 0x5053
leaq 0x922c(%rip), %rdi      # 0xe267
leaq 0x8ff5(%rip), %rsi      # 0xe037
movl $0x323, %edx            # imm = 0x323
leaq 0x921f(%rip), %rcx      # 0xe26d
callq 0x30e0
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x507f
movq -0x10(%rbp), %rdi
leaq 0x9234(%rip), %rsi      # 0xe2a1
movb $0x0, %al
callq 0x31e0
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x505a
movq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
addq $0x38, %rdi
callq 0x7810
movq -0x38(%rbp), %rdi
movq %rax, %rdx
leaq 0x9204(%rip), %rsi      # 0xe2a6
movb $0x0, %al
callq 0x31e0
movq -0x30(%rbp), %rdi
addq $0x50, %rdi
callq 0x7aa0
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x50f3
movq -0x10(%rbp), %rdi
leaq 0x91d8(%rip), %rsi      # 0xe2a4
movb $0x0, %al
callq 0x31e0
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
movq (%rdi), %rax
callq *0x10(%rax)
movq -0x20(%rbp), %rdi
callq 0x5270
movq %rax, -0x20(%rbp)
jmp 0x50ba
movq -0x30(%rbp), %rax
cmpq $0x0, 0x28(%rax)
jne 0x5115
movq -0x10(%rbp), %rdi
leaq 0x91a1(%rip), %rsi      # 0xe2aa
movb $0x0, %al
callq 0x31e0
jmp 0x5264
movq -0x30(%rbp), %rcx
movq 0x28(%rcx), %rax
cmpq 0x30(%rcx), %rax
jne 0x5190
movq -0x30(%rbp), %rax
movq 0x28(%rax), %rdi
movq (%rdi), %rax
callq *0x70(%rax)
cmpq $0x0, %rax
je 0x5190
movq -0x10(%rbp), %rdi
leaq 0x9261(%rip), %rsi      # 0xe3a3
movb $0x0, %al
callq 0x31e0
movq -0x30(%rbp), %rax
movq 0x28(%rax), %rdi
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
addl $0x1, %edx
movq (%rdi), %rax
callq *0x10(%rax)
movq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rax
movq %rax, -0x40(%rbp)
addq $0x38, %rdi
callq 0x7810
movq -0x40(%rbp), %rdi
movq %rax, %rdx
leaq 0x912a(%rip), %rsi      # 0xe2ae
movb $0x0, %al
callq 0x31e0
jmp 0x5262
movq -0x10(%rbp), %rdi
leaq 0x9208(%rip), %rsi      # 0xe3a3
movb $0x0, %al
callq 0x31e0
movq -0x30(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x51fa
movq -0x28(%rbp), %rdi
movq (%rdi), %rax
callq *0x70(%rax)
cmpq $0x0, %rax
jne 0x51d7
movq -0x10(%rbp), %rdi
leaq 0x9214(%rip), %rsi      # 0xe3e4
movb $0x0, %al
callq 0x31e0
movq -0x28(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
addl $0x1, %edx
movq (%rdi), %rax
callq *0x10(%rax)
movq -0x28(%rbp), %rdi
callq 0x7ae0
movq %rax, -0x28(%rbp)
jmp 0x51ae
movq -0x10(%rbp), %rdi
leaq 0x91df(%rip), %rsi      # 0xe3e4
movb $0x0, %al
callq 0x31e0
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x5238
movq -0x10(%rbp), %rdi
leaq 0x907b(%rip), %rsi      # 0xe2a1
movb $0x0, %al
callq 0x31e0
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x5213
movq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rax
movq %rax, -0x48(%rbp)
addq $0x38, %rdi
callq 0x7810
movq -0x48(%rbp), %rdi
movq %rax, %rdx
leaq 0x9053(%rip), %rsi      # 0xe2ae
movb $0x0, %al
callq 0x31e0
jmp 0x5264
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)