// File: /workspace/github_cpp_makefile_star2_O3/jeffchan[P]blockchain-parser/BlockChain.cpp
// Function: BlockChainImpl::processTransactions(BlockChain::Block const*)
virtual void processTransactions(const Block *block) // process the transactions in this block and assign them to individual wallets
	{
		if ( !block ) return;

		Transaction *transactions = mTransactionFactory.getTransactions(block->transactionCount);
		if ( !transactions ) return;

		mTransactionFactory.markBlock(transactions);

		for (uint32_t i=0; i<block->transactionCount; i++)
		{

			const BlockTransaction &t = block->transactions[i];
			Transaction &trans = transactions[i];
			trans.mBlock = block->blockIndex;
			trans.mTime = block->timeStamp;
			trans.mInputCount = t.inputCount;
			trans.mOutputCount = t.outputCount;

			trans.mInputs   = mTransactionFactory.getInputs(trans.mInputCount);
			trans.mOutputs  = mTransactionFactory.getOutputs(trans.mOutputCount);

			if ( trans.mInputs == NULL || trans.mOutputs == NULL )
			{
				break;
			}

			for (uint32_t i=0; i<t.outputCount; i++)
			{
				const BlockOutput &output = t.outputs[i];
				TransactionOutput &to = trans.mOutputs[i];

				uint32_t adr = 0;

				if ( output.publicKey )
				{
					if ( output.isRipeMD160 )
					{
						mTransactionFactory.getAddress(output.publicKey,adr);
					}
					else
					{
						uint8_t address[25];
						BLOCKCHAIN_BITCOIN_ADDRESS::bitcoinPublicKeyToAddress(output.publicKey,address);
						mTransactionFactory.getAddress(&address[1],adr);
					}
				}
				to.mAddress = adr;
				to.mValue = output.value;
			}

			for (uint32_t i=0; i<t.inputCount; i++)
			{
				const BlockInput &input = t.inputs[i];
				TransactionInput &tin = trans.mInputs[i];
				tin.mOutput = NULL;

				if ( input.transactionIndex != 0xFFFFFFFF )
				{
					Hash256 h(input.transactionHash);
					FileLocation key(h,0,0,0,0);
					FileLocation *found = mTransactionMap.find(key);
					assert(found);
					if ( found )
					{
						Transaction *previousTransaction = mTransactionFactory.getSingleTransaction(found->mTransactionIndex);
						if ( previousTransaction == NULL )
						{
							printf("ERROR: FAILED TO LOCATE TRANSACTION!\r\n");
						}
						else
						{
							assert( input.transactionIndex < previousTransaction->mOutputCount );
							if ( input.transactionIndex < previousTransaction->mOutputCount )
							{
								tin.mOutput = &previousTransaction->mOutputs[input.transactionIndex];
								mTransactionFactory.getAddress(tin.mOutput->mAddress);
							}
						}
					}
				}
			}
		}
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
testq %rsi, %rsi
je 0xc7a5
movq %rsi, %r12
movq %rdi, %r13
addq $0x3771338, %rdi        # imm = 0x3771338
movl 0x24(%rsi), %esi
movq %rdi, -0x48(%rbp)
callq 0xcf82
testq %rax, %rax
je 0xc7a5
movl 0x5771370(%r13), %edx
cmpq $0x7a120, %rdx          # imm = 0x7A120
jae 0xc830
movq 0x5771378(%r13), %rcx
movq %rax, (%rcx,%rdx,8)
leal 0x1(%rdx), %ecx
movl %ecx, 0x5771370(%r13)
cmpl $0x0, 0x24(%r12)
je 0xc7a5
xorl %r11d, %r11d
movq %r12, -0x58(%rbp)
movq %r13, -0x50(%rbp)
movq %rax, -0x60(%rbp)
movq 0x28(%r12), %rsi
movl %r11d, %r9d
imulq $0x58, %r9, %rcx
shlq $0x5, %r9
movl 0x50(%r12), %edx
movl %edx, (%rax,%r9)
movl 0x18(%r12), %edx
movl %edx, 0x4(%rax,%r9)
movl 0x4(%rsi,%rcx), %r10d
movl %r10d, 0x8(%rax,%r9)
movl 0x10(%rsi,%rcx), %edx
movl %edx, 0xc(%rax,%r9)
movl 0x577134c(%r13), %edi
leal (%rdi,%r10), %r8d
cmpl $0x5f5e100, %r8d        # imm = 0x5F5E100
jae 0xc811
movq %rsi, %rbx
addq %rax, %r9
movq 0x5771360(%r13), %rsi
movl %r8d, 0x577134c(%r13)
leaq (%rsi,%rdi,8), %rdi
movq %rdi, 0x10(%r9)
movl 0x5771350(%r13), %edi
movq %r9, %r14
leal (%rdi,%rdx), %r9d
cmpl $0x5f5e100, %r9d        # imm = 0x5F5E100
jae 0xc7f2
movq 0x5771368(%r13), %r8
movl %r9d, 0x5771350(%r13)
shlq $0x4, %rdi
addq %r8, %rdi
movq %rdi, 0x18(%r14)
testq %rsi, %rsi
je 0xc7a5
testq %r8, %r8
je 0xc7a5
movq %r14, %r9
movq %r11, -0x68(%rbp)
movq %rbx, %rdi
addq %rcx, %rdi
testl %edx, %edx
movq %rdi, -0x40(%rbp)
movq %r14, -0x38(%rbp)
je 0xc693
movl $0x20, %ebx
movl $0x8, %r14d
xorl %r15d, %r15d
movq 0x18(%rdi), %r13
movq 0x18(%r9), %r12
movl $0x0, -0x2c(%rbp)
movq (%r13,%rbx), %rsi
testq %rsi, %rsi
je 0xc663
cmpb $0x1, -0x8(%r13,%rbx)
jne 0xc638
movq -0x48(%rbp), %rdi
jmp 0xc652
movq %rsi, %rdi
leaq -0x90(%rbp), %rsi
callq 0xb039
movq -0x48(%rbp), %rdi
leaq -0x8f(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0xcfdc
movq -0x40(%rbp), %rdi
movq -0x38(%rbp), %r9
movl -0x2c(%rbp), %eax
movl %eax, (%r12,%r14)
movq -0x20(%r13,%rbx), %rax
movq %rax, -0x8(%r12,%r14)
incq %r15
movl 0x10(%rdi), %eax
addq $0x28, %rbx
addq $0x10, %r14
cmpq %rax, %r15
jb 0xc611
movl 0x4(%rdi), %r10d
movq -0x58(%rbp), %r12
movq -0x50(%rbp), %r13
testl %r10d, %r10d
je 0xc78f
xorl %ebx, %ebx
movq 0x8(%rdi), %r15
movq %rbx, %rax
shlq $0x5, %rax
movq 0x10(%r9), %r14
movq $0x0, (%r14,%rbx,8)
cmpl $-0x1, 0x8(%r15,%rax)
je 0xc780
addq %rax, %r15
movq (%r15), %rsi
movq (%rsi), %rax
movq 0x8(%rsi), %rcx
movq 0x10(%rsi), %rdx
movq 0x18(%rsi), %rsi
movq %rcx, %rdi
xorq %rax, %rdi
movq %rdx, %r8
xorq %rsi, %r8
xorq %rdi, %r8
shrq $0x20, %r8
movl %ecx, %edi
xorl %eax, %edi
movl %edx, %r9d
xorl %edi, %r9d
movl %esi, %edi
xorl %r9d, %edi
xorl %r8d, %edi
andl $0x3fffff, %edi         # imm = 0x3FFFFF
movq 0x16f12f0(%r13,%rdi,8), %rdi
testq %rdi, %rdi
je 0xc7b4
cmpq %rax, (%rdi)
jne 0xc729
cmpq %rcx, 0x8(%rdi)
jne 0xc729
cmpq %rdx, 0x10(%rdi)
jne 0xc729
cmpq %rsi, 0x18(%rdi)
je 0xc72f
movq 0x30(%rdi), %rdi
jmp 0xc709
movl 0x2c(%rdi), %esi
movq -0x48(%rbp), %rdi
callq 0xd150
testq %rax, %rax
je 0xc76c
movl 0x8(%r15), %ecx
cmpl 0xc(%rax), %ecx
jae 0xc7d3
movq 0x18(%rax), %rax
shlq $0x4, %rcx
leaq (%rax,%rcx), %rdx
movq %rdx, (%r14,%rbx,8)
movl 0x8(%rax,%rcx), %esi
movq -0x48(%rbp), %rdi
callq 0xd1b2
jmp 0xc778
leaq 0xd2d7(%rip), %rdi      # 0x19a4a
callq 0x2260
movq -0x40(%rbp), %rdi
movq -0x38(%rbp), %r9
incq %rbx
movl 0x4(%rdi), %eax
cmpq %rax, %rbx
jb 0xc69e
movq -0x68(%rbp), %r11
incl %r11d
cmpl 0x24(%r12), %r11d
movq -0x60(%rbp), %rax
jb 0xc536
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xb65b(%rip), %rdi      # 0x17e16
leaq 0xb02e(%rip), %rsi      # 0x177f0
leaq 0xb653(%rip), %rcx      # 0x17e1c
movl $0x132e, %edx           # imm = 0x132E
callq 0x20c0
leaq 0xb682(%rip), %rdi      # 0x17e5c
leaq 0xb00f(%rip), %rsi      # 0x177f0
leaq 0xb634(%rip), %rcx      # 0x17e1c
movl $0x1338, %edx           # imm = 0x1338
callq 0x20c0
leaq 0xb7d8(%rip), %rdi      # 0x17fd1
leaq 0xaff0(%rip), %rsi      # 0x177f0
leaq 0xb7f8(%rip), %rcx      # 0x17fff
movl $0xbea, %edx            # imm = 0xBEA
callq 0x20c0
leaq 0xb74c(%rip), %rdi      # 0x17f64
leaq 0xafd1(%rip), %rsi      # 0x177f0
leaq 0xb76a(%rip), %rcx      # 0x17f90
movl $0xbde, %edx            # imm = 0xBDE
callq 0x20c0
leaq 0xb6d5(%rip), %rdi      # 0x17f0c
leaq 0xafb2(%rip), %rsi      # 0x177f0
leaq 0xb6e6(%rip), %rcx      # 0x17f2b
movl $0xb8f, %edx            # imm = 0xB8F
callq 0x20c0
nop