// File: jeffchan[P]blockchain-parser/BitcoinTransactions.cpp
// Function: BitcoinTransactionsImpl::processBlock(BlockChain::Block const&)
virtual void processBlock(const BlockChain::Block &block)
	{
		uint64_t btc=0;
		uint64_t oneBTC = 100000000;

		printf("%d transactions.\r\n", block.transactionCount );
		for (uint32_t i=0; i<block.transactionCount; i++)
		{
			const BlockChain::BlockTransaction &t = block.transactions[i];
#if 0
			for (uint32_t i=0; i<t.inputCount; i++)
			{
				const BlockChain::BlockInput &input = t.inputs[i];
				mBitcoinScript->executeScript(input.responseScript,input.responseScriptLength);
			}
			for (uint32_t i=0; i<t.outputCount; i++)
			{
				const BlockChain::BlockOutput &ou tput = t.outputs[i];
				mBitcoinScript->resetStack();
				mBitcoinScript->executeScript(output.challengeScript,output.challengeScriptLength);
			}
#else
			printf("Transaction #%d has %d outputs and %d inputs.\r\n", i+1, t.outputCount, t.inputCount );
			for (uint32_t i=0; i<t.inputCount; i++)
			{
				const BlockChain::BlockInput &input = t.inputs[i];
				printf("Input %d : hash(%s) Index: %d\r\n", i+1, hashString(input.transactionHash), input.transactionIndex );
				mBitcoinScript->resetStack();
				mBitcoinScript->executeScript(input.responseScript,input.responseScriptLength);
			}
			for (uint32_t i=0; i<t.outputCount; i++)
			{
				const BlockChain::BlockOutput &output = t.outputs[i];
				printf("output %d is %d BTC.\r\n", i+1, (int)(output.value / oneBTC) );
				btc+=output.value;
				mBitcoinScript->resetStack();
				mBitcoinScript->executeScript(output.challengeScript,output.challengeScriptLength);
			}
#endif
		}
		printf("OutputBTC: %0.4f\r\n", (float)btc / (float)oneBTC );
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x58(%rbp)
movq $0x0, -0x18(%rbp)
movq $0x5f5e100, -0x20(%rbp) # imm = 0x5F5E100
movq -0x10(%rbp), %rax
movl 0x24(%rax), %esi
leaq 0x21dc2(%rip), %rdi     # 0x309e8
movb $0x0, %al
callq 0x2050
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x24(%rcx), %eax
jae 0xedc0
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x24(%rbp), %ecx
imulq $0x58, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movl -0x24(%rbp), %esi
addl $0x1, %esi
movq -0x30(%rbp), %rax
movl 0x10(%rax), %edx
movq -0x30(%rbp), %rax
movl 0x4(%rax), %ecx
leaq 0x21d86(%rip), %rdi     # 0x309fb
movb $0x0, %al
callq 0x2050
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x30(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jae 0xed16
movq -0x58(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x34(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
movq -0x40(%rbp), %rax
movq (%rax), %rsi
callq 0xeeb0
movl -0x5c(%rbp), %esi
movq %rax, %rdx
movq -0x40(%rbp), %rax
movl 0x8(%rax), %ecx
leaq 0x21d55(%rip), %rdi     # 0x30a2b
movb $0x0, %al
callq 0x2050
movq -0x58(%rbp), %rax
movq 0x8(%rax), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
movq -0x58(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x40(%rbp), %rax
movl 0xc(%rax), %edx
movq (%rdi), %rax
callq *0x10(%rax)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xec83
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
movq -0x30(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jae 0xedb0
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x44(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
movl -0x44(%rbp), %esi
addl $0x1, %esi
movq -0x50(%rbp), %rax
movq (%rax), %rax
xorl %ecx, %ecx
movl %ecx, %edx
divq -0x20(%rbp)
movl %eax, %edx
leaq 0x21cea(%rip), %rdi     # 0x30a4b
movb $0x0, %al
callq 0x2050
movq -0x58(%rbp), %rax
movq -0x50(%rbp), %rcx
movq (%rcx), %rcx
addq -0x18(%rbp), %rcx
movq %rcx, -0x18(%rbp)
movq 0x8(%rax), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
movq -0x58(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x50(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x50(%rbp), %rax
movl 0x8(%rax), %edx
movq (%rdi), %rax
callq *0x10(%rax)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0xed1d
jmp 0xedb2
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xec34
movq -0x18(%rbp), %rax
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, -0x64(%rbp)
testq %rax, %rax
movss %xmm0, -0x60(%rbp)
js 0xedf9
movss -0x64(%rbp), %xmm0
movss %xmm0, -0x60(%rbp)
movss -0x60(%rbp), %xmm0
movss %xmm0, -0x70(%rbp)
movq -0x20(%rbp), %rax
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, -0x6c(%rbp)
testq %rax, %rax
movss %xmm0, -0x68(%rbp)
js 0xee3c
movss -0x6c(%rbp), %xmm0
movss %xmm0, -0x68(%rbp)
movss -0x70(%rbp), %xmm0
movss -0x68(%rbp), %xmm1
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x21c0d(%rip), %rdi     # 0x30a62
movb $0x1, %al
callq 0x2050
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)