// File: /workspace/github_cpp_makefile_star2_O1/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 0xdb55(%rip), %rdi      # 0x19917
callq 0x2260
movl 0x50(%r15), %edi
callq 0xb5d3
leaq 0xbd4b(%rip), %rdi      # 0x17b22
movq %rax, %rsi
xorl %eax, %eax
callq 0x2050
leaq 0xbd46(%rip), %rdi      # 0x17b2e
xorl %eax, %eax
callq 0x2050
movl $0x4f, %r14d
leaq 0xb9d5(%rip), %rbx      # 0x177d1
movzbl (%r15,%r14), %esi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2050
decq %r14
cmpq $0x2f, %r14
jne 0xbdfc
leaq 0xdc53(%rip), %rdi      # 0x19a6e
callq 0x2260
cmpq $0x0, 0x8(%r15)
je 0xbe4e
leaq 0xbd14(%rip), %rdi      # 0x17b42
xorl %eax, %eax
callq 0x2050
movq 0x8(%r15), %rsi
movq -0x38(%rbp), %rdi
callq 0xcfa8
leaq 0xdc25(%rip), %rdi      # 0x19a6e
callq 0x2260
cmpq $0x0, 0x70(%r15)
movq -0x38(%rbp), %rbx
je 0xbe7f
leaq 0xbcf5(%rip), %rdi      # 0x17b55
xorl %eax, %eax
callq 0x2050
movq 0x70(%r15), %rsi
movq %rbx, %rdi
callq 0xcfa8
leaq 0xdbf4(%rip), %rdi      # 0x19a6e
callq 0x2260
leaq 0xbcde(%rip), %rdi      # 0x17b64
xorl %eax, %eax
callq 0x2050
movq 0x10(%r15), %rsi
movq %rbx, %rdi
callq 0xcfa8
leaq 0xdbce(%rip), %rdi      # 0x19a6e
callq 0x2260
movl 0x24(%r15), %edi
callq 0xb5d3
leaq 0xbcbd(%rip), %rdi      # 0x17b72
movq %rax, %rsi
xorl %eax, %eax
callq 0x2050
movl 0x18(%r15), %edi
callq 0xb6b4
leaq 0xbcc0(%rip), %rdi      # 0x17b8f
movq %rax, %rsi
xorl %eax, %eax
callq 0x2050
movl 0x1c(%r15), %edx
leaq 0xbcbc(%rip), %rdi      # 0x17ba0
movl %edx, %esi
xorl %eax, %eax
callq 0x2050
movl (%r15), %edi
cvtsi2ss %rdi, %xmm0
mulss 0xb8db(%rip), %xmm0     # 0x177d8
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x30(%rbp)
callq 0xb5d3
leaq 0xbca3(%rip), %rdi      # 0x17bb5
movsd -0x30(%rbp), %xmm0
movq %rax, %rsi
movb $0x1, %al
callq 0x2050
movl 0x4(%r15), %esi
leaq 0xbca8(%rip), %rdi      # 0x17bd4
xorl %eax, %eax
callq 0x2050
movl 0x20(%r15), %esi
leaq 0xbca4(%rip), %rdi      # 0x17be2
xorl %eax, %eax
callq 0x2050
movq 0x68(%r15), %rax
testq %rax, %rax
js 0xbf58
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
jmp 0xbf70
movq %rax, %rcx
shrq %rcx
andl $0x1, %eax
orq %rcx, %rax
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
addss %xmm0, %xmm0
divss 0xb798(%rip), %xmm0     # 0x17710
cvtss2sd %xmm0, %xmm0
leaq 0xbc6b(%rip), %rdi      # 0x17bee
movb $0x1, %al
callq 0x2050
movl 0x24(%r15), %edi
callq 0xb5d3
leaq 0xbc66(%rip), %rdi      # 0x17c00
movq %rax, %rsi
xorl %eax, %eax
callq 0x2050
cmpl $0x0, 0x24(%r15)
je 0xc32d
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 0xb5d3
movq %rax, %r15
movl 0x4(%rbx,%r14), %edi
callq 0xb5d3
movq %rax, %r12
movl 0x10(%rbx,%r14), %edi
callq 0xb5d3
movl (%rbx,%r14), %r8d
leaq 0xbc19(%rip), %rdi      # 0x17c12
movq %r15, %rsi
movq %r12, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x2050
leaq 0xbc7b(%rip), %rdi      # 0x17c8b
xorl %eax, %eax
callq 0x2050
movq %r13, -0x50(%rbp)
addq %r13, %rbx
xorl %r14d, %r14d
leaq 0xb7a9(%rip), %r15      # 0x177d1
movzbl (%rbx,%r14), %esi
movq %r15, %rdi
xorl %eax, %eax
callq 0x2050
decq %r14
cmpq $-0x20, %r14
jne 0xc028
leaq 0xda27(%rip), %rdi      # 0x19a6e
callq 0x2260
movq -0x30(%rbp), %rcx
cmpl $0x0, 0x4(%rcx)
je 0xc1e1
xorl %r14d, %r14d
xorl %r12d, %r12d
movq 0x8(%rcx), %r13
movl %r12d, %edi
callq 0xb5d3
movq %rax, %r15
movl 0xc(%r13,%r14), %edi
callq 0xb5d3
movq %rax, %rbx
movl 0x8(%r13,%r14), %edi
callq 0xb5d3
leaq 0xbbc0(%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 0xcfa8
leaq 0xd9b9(%rip), %rdi      # 0x19a6e
callq 0x2260
cmpl $-0x1, 0x8(%r13,%r14)
je 0xc1ca
movq (%r13,%r14), %rsi
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x18(%rax)
movl 0x8(%r13,%r14), %esi
testq %rax, %rax
je 0xc126
cmpl 0x10(%rax), %esi
jae 0xc14a
movq 0x18(%rax), %rax
leaq (%rsi,%rsi,4), %rcx
cmpq $0x0, 0x20(%rax,%rcx,8)
je 0xc153
leaq (%rax,%rcx,8), %rbx
cmpb $0x1, 0x18(%rbx)
jne 0xc15c
movq 0x20(%rbx), %rdi
leaq -0x80(%rbp), %r15
movq %r15, %rsi
callq 0xb26b
movq %r15, %rdi
leaq -0x180(%rbp), %r15
movq %r15, %rsi
movl $0x100, %edx            # imm = 0x100
callq 0xb2d1
jmp 0xc178
leaq 0xbb70(%rip), %rdi      # 0x17c9d
xorl %eax, %eax
callq 0x2050
movq (%r13,%r14), %rsi
movq %rbx, %rdi
callq 0xcfa8
leaq 0xd926(%rip), %rdi      # 0x19a6e
jmp 0xc1c5
leaq 0xd87b(%rip), %rdi      # 0x199cc
jmp 0xc1c5
leaq 0xd895(%rip), %rdi      # 0x199ef
jmp 0xc1c5
movq 0x20(%rbx), %rdi
leaq -0x180(%rbp), %r15
movq %r15, %rsi
movl $0x100, %edx            # imm = 0x100
callq 0xb162
testb %al, %al
je 0xc1be
movq (%rbx), %rax
testq %rax, %rax
js 0xc18a
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
jmp 0xc19f
movq %rax, %rcx
shrq %rcx
andl $0x1, %eax
orq %rcx, %rax
cvtsi2ss %rax, %xmm0
addss %xmm0, %xmm0
divss 0xb569(%rip), %xmm0     # 0x17710
cvtss2sd %xmm0, %xmm0
leaq 0xbb2f(%rip), %rdi      # 0x17ce1
movq %r15, %rsi
movb $0x1, %al
callq 0x2050
jmp 0xc1ca
leaq 0xd860(%rip), %rdi      # 0x19a25
callq 0x2260
incq %r12
movq -0x30(%rbp), %rcx
movl 0x4(%rcx), %eax
addq $0x20, %r14
cmpq %rax, %r12
jb 0xc060
cmpl $0x0, 0x10(%rcx)
movq -0x50(%rbp), %r13
je 0xc311
movl $0x20, %ebx
xorl %r12d, %r12d
movq 0x18(%rcx), %r14
movl %r12d, %edi
callq 0xb5d3
movq %rax, %r15
movq -0x20(%r14,%rbx), %rax
testq %rax, %rax
js 0xc21a
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
jmp 0xc232
movq %rax, %rcx
shrq %rcx
andl $0x1, %eax
orq %rcx, %rax
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
addss %xmm0, %xmm0
divss 0xb4d6(%rip), %xmm0     # 0x17710
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x58(%rbp)
movl -0x18(%r14,%rbx), %edi
callq 0xb5d3
leaq 0xbac9(%rip), %rdi      # 0x17d1d
movq %r15, %rsi
movsd -0x58(%rbp), %xmm0
movq %rax, %rdx
movb $0x1, %al
callq 0x2050
cmpq $0x0, (%r14,%rbx)
je 0xc29e
cmpb $0x1, -0x8(%r14,%rbx)
jne 0xc2a7
movq (%r14,%rbx), %rdi
leaq -0x80(%rbp), %r15
movq %r15, %rsi
callq 0xb26b
movq %r15, %rdi
leaq -0x180(%rbp), %r15
movq %r15, %rsi
movl $0x100, %edx            # imm = 0x100
callq 0xb2d1
jmp 0xc2c3
leaq 0xd6ce(%rip), %rdi      # 0x19973
jmp 0xc2f5
movq (%r14,%rbx), %rdi
leaq -0x180(%rbp), %r15
movq %r15, %rsi
movl $0x100, %edx            # imm = 0x100
callq 0xb162
testb %al, %al
je 0xc2ee
cmpb $0x0, -0x8(%r14,%rbx)
leaq 0xbaa2(%rip), %rdx      # 0x17d72
leaq 0xba91(%rip), %rax      # 0x17d68
cmovneq %rax, %rdx
leaq 0xba71(%rip), %rdi      # 0x17d53
movq %r15, %rsi
xorl %eax, %eax
callq 0x2050
jmp 0xc2fa
leaq 0xd6b5(%rip), %rdi      # 0x199aa
callq 0x2260
incq %r12
movq -0x30(%rbp), %rcx
movl 0x10(%rcx), %eax
addq $0x28, %rbx
cmpq %rax, %r12
jb 0xc1f7
movq -0x48(%rbp), %rdi
incq %rdi
movq -0x40(%rbp), %r15
movl 0x24(%r15), %eax
addq $0x58, %r13
cmpq %rax, %rdi
jb 0xbfbb
leaq 0xd5e3(%rip), %rdi      # 0x19917
callq 0x2260
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop