// File: /workspace/github_cpp_makefile_star2_O3/jeffchan[P]blockchain-parser/BlockChain.cpp
// Function: BlockChainImpl::printBlock(BlockChain::Block const*)
virtual void printBlock(const Block *block) // prints the contents of the block to the console for debugging purposes
	{
		printf("==========================================================================================\r\n");
		printf("Block #%s\r\n", formatNumber(block->blockIndex) );

		printf("ComputedBlockHash: ");
		printReverseHash(block->computedBlockHash);
		printf("\r\n");

		if ( block->previousBlockHash )
		{
			printf("PreviousBlockHash:");
			printReverseHash(block->previousBlockHash);
			printf("\r\n");
		}
		if ( block->nextBlockHash )
		{
			printf("NextBlockHash:");
			printReverseHash(block->nextBlockHash);
			printf("\r\n");
		}


		printf("Merkle root: ");
		printReverseHash(block->merkleRoot);
		printf("\r\n");

		printf("Number of Transactions: %s\r\n", formatNumber(block->transactionCount) );
		printf("Timestamp : %s\r\n", getTimeString(block->timeStamp ) );
		printf("Bits: %d Hex: %08X\r\n", block->bits, block->bits );
		printf("Size: %0.10f KB or %s bytes.\r\n", (float)block->blockLength / 1024.0f, formatNumber(block->blockLength) );
		printf("Version: %d\r\n", block->blockFormatVersion );
		printf("Nonce: %u\r\n", block->nonce );
		printf("BlockReward: %f\r\n", (float)block->blockReward / ONE_BTC );

		printf("%s transactions\r\n", formatNumber(block->transactionCount) );
		for (uint32_t i=0; i<block->transactionCount; i++)
		{
			const BlockTransaction &t = block->transactions[i];
			printf("Transaction %s : %s inputs %s outputs. VersionNumber: %d\r\n", formatNumber(i), formatNumber(t.inputCount), formatNumber(t.outputCount), t.transactionVersionNumber );
			printf("TransactionHash: ");
			printReverseHash(t.transactionHash);
			printf("\r\n");
			for (uint32_t i=0; i<t.inputCount; i++)
			{
				const BlockInput &input = t.inputs[i];
				printf("    Input %s : ResponsScriptLength: %s TransactionIndex: %s : TransactionHash: ", formatNumber(i), formatNumber(input.responseScriptLength), formatNumber(input.transactionIndex) );

				printReverseHash(input.transactionHash);

				printf("\r\n");

				if ( input.transactionIndex != 0xFFFFFFFF )
				{
					const BlockTransaction *t = readSingleTransaction(input.transactionHash);
					if ( t == NULL )
					{
						printf("ERROR: TransactionIndex[%d] FAILED TO LOCATE TRANSACTION FOR HASH: ", input.transactionIndex );
						printReverseHash(input.transactionHash);
						printf("\r\n");
					}
					else
					{
						if ( input.transactionIndex < t->outputCount )
						{
							const BlockOutput &o = t->outputs[input.transactionIndex];
							if ( o.publicKey )
							{
								char scratch[256];
								bool ok=true;
								if ( o.isRipeMD160 )
								{
									uint8_t temp[25];
									BLOCKCHAIN_BITCOIN_ADDRESS::bitcoinRIPEMD160ToAddress(o.publicKey,temp);
									BLOCKCHAIN_BITCOIN_ADDRESS::bitcoinAddressToAscii(temp,scratch,256);
								}
								else
								{
									ok = BLOCKCHAIN_BITCOIN_ADDRESS::bitcoinPublicKeyToAscii(o.publicKey,scratch,256);
								}
								if ( ok )
								{
									printf("     Spending From Public Key: %s in the amount of: %0.4f\r\n", scratch, (float)o.value / ONE_BTC );
								}
								else
								{
									printf("ERROR: Unable to decode public key!\r\n");
								}
							}
							else
							{
								printf("ERROR: No public key found for this previous output.\r\n");
							}
						}
						else
						{
							printf("ERROR: Invalid transaction index!\r\n");
						}
					}
				}
			}
			for (uint32_t i=0; i<t.outputCount; i++)
			{
				const BlockOutput &output = t.outputs[i];
				printf("    Output: %s : %f BTC : ChallengeScriptLength: %s\r\n", formatNumber(i), (float)output.value / ONE_BTC, formatNumber(output.challengeScriptLength) );
				if ( output.publicKey )
				{
					char scratch[256];
					bool ok=true;
					if ( output.isRipeMD160 )
					{
						uint8_t temp[25];
						BLOCKCHAIN_BITCOIN_ADDRESS::bitcoinRIPEMD160ToAddress(output.publicKey,temp);
						BLOCKCHAIN_BITCOIN_ADDRESS::bitcoinAddressToAscii(temp,scratch,256);
					}
					else
					{
						ok = BLOCKCHAIN_BITCOIN_ADDRESS::bitcoinPublicKeyToAscii(output.publicKey,scratch,256);
					}
					if ( ok )
					{
						printf("PublicKey: %s : %s\r\n", scratch, output.isRipeMD160 ? "RIPEMD160" : "ECDSA" );
					}
					else
					{
						printf("Failed to encode the public key.\r\n");
					}
				}
				else
				{
					printf("ERROR: Unable to derive a public key for this output!\r\n");
				}
			}
		}

		printf("==========================================================================================\r\n");
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x158, %rsp            # imm = 0x158
movq %rsi, %r15
movq %rdi, -0x38(%rbp)
leaq 0xdbef(%rip), %rdi      # 0x19917
callq 0x2260
movl 0x50(%r15), %edi
callq 0xb535
leaq 0xbde5(%rip), %rdi      # 0x17b22
movq %rax, %rsi
xorl %eax, %eax
callq 0x2050
leaq 0xbde0(%rip), %rdi      # 0x17b2e
xorl %eax, %eax
callq 0x2050
movl $0x4f, %r14d
leaq 0xba6f(%rip), %rbx      # 0x177d1
movzbl (%r15,%r14), %esi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2050
decq %r14
cmpq $0x2f, %r14
jne 0xbd62
leaq 0xdced(%rip), %rdi      # 0x19a6e
callq 0x2260
cmpq $0x0, 0x8(%r15)
je 0xbdb4
leaq 0xbdae(%rip), %rdi      # 0x17b42
xorl %eax, %eax
callq 0x2050
movq 0x8(%r15), %rsi
movq -0x38(%rbp), %rdi
callq 0xcf34
leaq 0xdcbf(%rip), %rdi      # 0x19a6e
callq 0x2260
cmpq $0x0, 0x70(%r15)
movq -0x38(%rbp), %rbx
je 0xbde5
leaq 0xbd8f(%rip), %rdi      # 0x17b55
xorl %eax, %eax
callq 0x2050
movq 0x70(%r15), %rsi
movq %rbx, %rdi
callq 0xcf34
leaq 0xdc8e(%rip), %rdi      # 0x19a6e
callq 0x2260
leaq 0xbd78(%rip), %rdi      # 0x17b64
xorl %eax, %eax
callq 0x2050
movq 0x10(%r15), %rsi
movq %rbx, %rdi
callq 0xcf34
leaq 0xdc68(%rip), %rdi      # 0x19a6e
callq 0x2260
movl 0x24(%r15), %edi
callq 0xb535
leaq 0xbd57(%rip), %rdi      # 0x17b72
movq %rax, %rsi
xorl %eax, %eax
callq 0x2050
movl 0x18(%r15), %edi
callq 0xb616
leaq 0xbd5a(%rip), %rdi      # 0x17b8f
movq %rax, %rsi
xorl %eax, %eax
callq 0x2050
movl 0x1c(%r15), %edx
leaq 0xbd56(%rip), %rdi      # 0x17ba0
movl %edx, %esi
xorl %eax, %eax
callq 0x2050
movl (%r15), %edi
cvtsi2ss %rdi, %xmm0
mulss 0xb975(%rip), %xmm0     # 0x177d8
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x30(%rbp)
callq 0xb535
leaq 0xbd3d(%rip), %rdi      # 0x17bb5
movsd -0x30(%rbp), %xmm0
movq %rax, %rsi
movb $0x1, %al
callq 0x2050
movl 0x4(%r15), %esi
leaq 0xbd42(%rip), %rdi      # 0x17bd4
xorl %eax, %eax
callq 0x2050
movl 0x20(%r15), %esi
leaq 0xbd3e(%rip), %rdi      # 0x17be2
xorl %eax, %eax
callq 0x2050
movq 0x68(%r15), %rax
testq %rax, %rax
js 0xbebe
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
jmp 0xbed6
movq %rax, %rcx
shrq %rcx
andl $0x1, %eax
orq %rcx, %rax
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
addss %xmm0, %xmm0
divss 0xb832(%rip), %xmm0     # 0x17710
cvtss2sd %xmm0, %xmm0
leaq 0xbd05(%rip), %rdi      # 0x17bee
movb $0x1, %al
callq 0x2050
movl 0x24(%r15), %edi
callq 0xb535
leaq 0xbd00(%rip), %rdi      # 0x17c00
movq %rax, %rsi
xorl %eax, %eax
callq 0x2050
cmpl $0x0, 0x24(%r15)
je 0xc287
movl $0x43, %r13d
xorl %edi, %edi
movq %r15, -0x40(%rbp)
movq 0x28(%r15), %rbx
imulq $0x58, %rdi, %r14
leaq (%rbx,%r14), %rax
movq %rax, -0x30(%rbp)
movq %rdi, -0x48(%rbp)
callq 0xb535
movq %rax, %r15
movl 0x4(%rbx,%r14), %edi
callq 0xb535
movq %rax, %r12
movl 0x10(%rbx,%r14), %edi
callq 0xb535
movl (%rbx,%r14), %r8d
leaq 0xbcb3(%rip), %rdi      # 0x17c12
movq %r15, %rsi
movq %r12, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x2050
leaq 0xbd15(%rip), %rdi      # 0x17c8b
xorl %eax, %eax
callq 0x2050
movq %r13, -0x50(%rbp)
addq %r13, %rbx
xorl %r14d, %r14d
leaq 0xb843(%rip), %r15      # 0x177d1
movzbl (%rbx,%r14), %esi
movq %r15, %rdi
xorl %eax, %eax
callq 0x2050
decq %r14
cmpq $-0x20, %r14
jne 0xbf8e
leaq 0xdac1(%rip), %rdi      # 0x19a6e
callq 0x2260
movq -0x30(%rbp), %rcx
cmpl $0x0, 0x4(%rcx)
je 0xc141
xorl %r14d, %r14d
xorl %r12d, %r12d
movq 0x8(%rcx), %r13
movl %r12d, %edi
callq 0xb535
movq %rax, %r15
movl 0xc(%r13,%r14), %edi
callq 0xb535
movq %rax, %rbx
movl 0x8(%r13,%r14), %edi
callq 0xb535
leaq 0xbc5a(%rip), %rdi      # 0x17c4d
movq %r15, %rsi
movq %rbx, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x2050
movq (%r13,%r14), %rsi
movq -0x38(%rbp), %rbx
movq %rbx, %rdi
callq 0xcf34
leaq 0xda53(%rip), %rdi      # 0x19a6e
callq 0x2260
cmpl $-0x1, 0x8(%r13,%r14)
je 0xc12a
movq (%r13,%r14), %rsi
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x18(%rax)
movl 0x8(%r13,%r14), %esi
testq %rax, %rax
je 0xc08a
cmpl 0x10(%rax), %esi
jae 0xc0ae
movq 0x18(%rax), %rax
leaq (%rsi,%rsi,4), %rcx
movq 0x20(%rax,%rcx,8), %rdi
testq %rdi, %rdi
je 0xc0b7
leaq (%rax,%rcx,8), %rbx
cmpb $0x1, 0x18(%rbx)
jne 0xc0c0
leaq -0x80(%rbp), %r15
movq %r15, %rsi
callq 0xb1cd
movq %r15, %rdi
leaq -0x180(%rbp), %r15
movq %r15, %rsi
movl $0x100, %edx            # imm = 0x100
callq 0xb233
jmp 0xc0d8
leaq 0xbc0c(%rip), %rdi      # 0x17c9d
xorl %eax, %eax
callq 0x2050
movq (%r13,%r14), %rsi
movq %rbx, %rdi
callq 0xcf34
leaq 0xd9c2(%rip), %rdi      # 0x19a6e
jmp 0xc125
leaq 0xd917(%rip), %rdi      # 0x199cc
jmp 0xc125
leaq 0xd931(%rip), %rdi      # 0x199ef
jmp 0xc125
leaq -0x180(%rbp), %r15
movq %r15, %rsi
movl $0x100, %edx            # imm = 0x100
callq 0xb0c4
testb %al, %al
je 0xc11e
movq (%rbx), %rax
testq %rax, %rax
js 0xc0ea
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
jmp 0xc0ff
movq %rax, %rcx
shrq %rcx
andl $0x1, %eax
orq %rcx, %rax
cvtsi2ss %rax, %xmm0
addss %xmm0, %xmm0
divss 0xb609(%rip), %xmm0     # 0x17710
cvtss2sd %xmm0, %xmm0
leaq 0xbbcf(%rip), %rdi      # 0x17ce1
movq %r15, %rsi
movb $0x1, %al
callq 0x2050
jmp 0xc12a
leaq 0xd900(%rip), %rdi      # 0x19a25
callq 0x2260
incq %r12
movq -0x30(%rbp), %rcx
movl 0x4(%rcx), %eax
addq $0x20, %r14
cmpq %rax, %r12
jb 0xbfc6
cmpl $0x0, 0x10(%rcx)
movq -0x50(%rbp), %r13
je 0xc26b
movl $0x20, %ebx
xorl %r12d, %r12d
movq 0x18(%rcx), %r14
movl %r12d, %edi
callq 0xb535
movq %rax, %r15
movq -0x20(%r14,%rbx), %rax
testq %rax, %rax
js 0xc17a
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
jmp 0xc192
movq %rax, %rcx
shrq %rcx
andl $0x1, %eax
orq %rcx, %rax
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
addss %xmm0, %xmm0
divss 0xb576(%rip), %xmm0     # 0x17710
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x58(%rbp)
movl -0x18(%r14,%rbx), %edi
callq 0xb535
leaq 0xbb69(%rip), %rdi      # 0x17d1d
movq %r15, %rsi
movsd -0x58(%rbp), %xmm0
movq %rax, %rdx
movb $0x1, %al
callq 0x2050
movq (%r14,%rbx), %rdi
testq %rdi, %rdi
je 0xc1fc
cmpb $0x1, -0x8(%r14,%rbx)
jne 0xc205
leaq -0x80(%rbp), %r15
movq %r15, %rsi
callq 0xb1cd
movq %r15, %rdi
leaq -0x180(%rbp), %r15
movq %r15, %rsi
movl $0x100, %edx            # imm = 0x100
callq 0xb233
jmp 0xc21d
leaq 0xd770(%rip), %rdi      # 0x19973
jmp 0xc24f
leaq -0x180(%rbp), %r15
movq %r15, %rsi
movl $0x100, %edx            # imm = 0x100
callq 0xb0c4
testb %al, %al
je 0xc248
cmpb $0x0, -0x8(%r14,%rbx)
leaq 0xbb48(%rip), %rdx      # 0x17d72
leaq 0xbb37(%rip), %rax      # 0x17d68
cmovneq %rax, %rdx
leaq 0xbb17(%rip), %rdi      # 0x17d53
movq %r15, %rsi
xorl %eax, %eax
callq 0x2050
jmp 0xc254
leaq 0xd75b(%rip), %rdi      # 0x199aa
callq 0x2260
incq %r12
movq -0x30(%rbp), %rcx
movl 0x10(%rcx), %eax
addq $0x28, %rbx
cmpq %rax, %r12
jb 0xc157
movq -0x48(%rbp), %rdi
incq %rdi
movq -0x40(%rbp), %r15
movl 0x24(%r15), %eax
addq $0x58, %r13
cmpq %rax, %rdi
jb 0xbf21
leaq 0xd689(%rip), %rdi      # 0x19917
callq 0x2260
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop