// File: /workspace/github_cpp_makefile_star2_O1/jeffchan[P]blockchain-parser/BlockChain.cpp
// Function: BlockImpl::readTransation(BlockChain::BlockTransaction&, unsigned int&, unsigned int)
bool readTransation(BlockChain::BlockTransaction &transaction,uint32_t &transactionIndex,uint32_t tindex)
	{
		bool ret = false;

		const uint8_t *transactionBegin = mBlockRead;

		transaction.transactionVersionNumber = readU32(); // read the transaction version number; always expect it to be 1
		if ( transaction.transactionVersionNumber == 1 || transaction.transactionVersionNumber == 2 )
		{
		}
		else
		{
			gIsWarning = true;
			printf("Encountered unusual and unexpected transaction version number of [%d] for transaction #%d\r\n", transaction.transactionVersionNumber, tindex );
		}
		transaction.inputCount = readVariableLengthInteger();
		assert( transaction.inputCount < MAX_REASONABLE_INPUTS );
		transaction.inputs = &mInputs[totalInputCount];
		totalInputCount+=transaction.inputCount;
		assert( totalInputCount < MAX_BLOCK_INPUTS );
		if ( totalInputCount < MAX_BLOCK_INPUTS )
		{
			for (uint32_t i=0; i<transaction.inputCount; i++)
			{
				BlockChain::BlockInput &input = transaction.inputs[i];
				ret = readInput(input);	// read the input 
				if ( !ret )
				{
					break;
				}
			}
		}
		else
		{
			ret = false;
		}
		if ( ret )
		{
			transaction.outputCount = readVariableLengthInteger();
			assert( transaction.outputCount < MAX_REASONABLE_OUTPUTS );
			transaction.outputs = &mOutputs[totalOutputCount];
			totalOutputCount+=transaction.outputCount;
			assert( totalOutputCount < MAX_BLOCK_OUTPUTS );
			if ( totalOutputCount < MAX_BLOCK_OUTPUTS )
			{
				for (uint32_t i=0; i<transaction.outputCount; i++)
				{
					gOutputIndex = i;
					BlockChain::BlockOutput &output = transaction.outputs[i];
					ret = readOutput(output);
					if ( !ret )
					{
						break;
					}
				}

				transaction.lockTime = readU32();

				if ( ret )
				{
					transaction.transactionLength = (uint32_t)(mBlockRead - transactionBegin);
					transaction.fileIndex = fileIndex;
					transaction.fileOffset = fileOffset + (uint32_t)(transactionBegin-mBlockData);
					transaction.transactionIndex = transactionIndex;
					transactionIndex++;
					BLOCKCHAIN_SHA256::computeSHA256(transactionBegin,transaction.transactionLength,transaction.transactionHash);
					BLOCKCHAIN_SHA256::computeSHA256(transaction.transactionHash,32,transaction.transactionHash);
				}

			}
		}
		return ret;
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq 0x80(%rdi), %r14
leaq 0x4(%r14), %rax
cmpq 0x88(%rdi), %rax
ja 0x117ba
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r12
movl (%r14), %esi
movq %rax, 0x80(%rdi)
movl %esi, (%rbx)
leal -0x1(%rsi), %eax
cmpl $0x2, %eax
jb 0x11567
movb $0x1, 0xe2ad(%rip)      # 0x1f804
leaq 0x7f44(%rip), %rdi      # 0x194a2
movl %ecx, %edx
xorl %eax, %eax
callq 0x2050
movq 0x80(%r12), %rcx
movq 0x88(%r12), %rdx
leaq 0x1(%rcx), %rdi
cmpq %rdx, %rdi
ja 0x117d9
movzbl (%rcx), %eax
movq %rdi, 0x80(%r12)
cmpl $0xfc, %eax
jbe 0x115d5
leaq 0x3(%rcx), %rsi
cmpq %rdx, %rsi
ja 0x11836
movzwl (%rdi), %eax
movq %rsi, 0x80(%r12)
cmpl $0xffff, %eax           # imm = 0xFFFF
jne 0x115d5
addq $0x7, %rcx
cmpq %rdx, %rcx
ja 0x117ba
movl (%rsi), %eax
movq %rcx, 0x80(%r12)
cmpl $-0x1, %eax
je 0x11893
movl %eax, 0x4(%rbx)
cmpl $0x1000, %eax           # imm = 0x1000
jae 0x117f8
movl 0x54(%r12), %ecx
addl %ecx, %eax
shlq $0x5, %rcx
addq %r12, %rcx
addq $0xb0098, %rcx          # imm = 0xB0098
movq %rcx, 0x8(%rbx)
movl %eax, 0x54(%r12)
cmpl $0x7fff, %eax           # imm = 0x7FFF
ja 0x11817
movq %r15, -0x30(%rbp)
movq %r14, -0x38(%rbp)
cmpl $0x0, 0x4(%rbx)
je 0x11647
xorl %r15d, %r15d
xorl %r14d, %r14d
movq 0x8(%rbx), %rsi
addq %r15, %rsi
movq %r12, %rdi
callq 0x118b2
movl %eax, %r13d
testb %al, %al
je 0x1164a
incq %r14
movl 0x4(%rbx), %eax
addq $0x20, %r15
cmpq %rax, %r14
jb 0x11620
jmp 0x1164a
xorl %r13d, %r13d
testb %r13b, %r13b
je 0x117a8
movq 0x80(%r12), %rcx
movq 0x88(%r12), %rdx
leaq 0x1(%rcx), %rdi
cmpq %rdx, %rdi
ja 0x117d9
movzbl (%rcx), %eax
movq %rdi, 0x80(%r12)
cmpl $0xfc, %eax
jbe 0x116c1
leaq 0x3(%rcx), %rsi
cmpq %rdx, %rsi
ja 0x11836
movzwl (%rdi), %eax
movq %rsi, 0x80(%r12)
cmpl $0xffff, %eax           # imm = 0xFFFF
jne 0x116c1
addq $0x7, %rcx
cmpq %rdx, %rcx
ja 0x117ba
movl (%rsi), %eax
movq %rcx, 0x80(%r12)
cmpl $-0x1, %eax
je 0x11893
movl %eax, 0x10(%rbx)
cmpl $0x1000, %eax           # imm = 0x1000
jae 0x11855
movl 0x58(%r12), %ecx
leaq (%rcx,%rcx,4), %rdx
leaq (%r12,%rdx,8), %rdx
addq $0x1b0098, %rdx         # imm = 0x1B0098
movq %rdx, 0x18(%rbx)
addl %ecx, %eax
movl %eax, 0x58(%r12)
cmpl $0x7fff, %eax           # imm = 0x7FFF
ja 0x11874
cmpl $0x0, 0x10(%rbx)
je 0x11731
xorl %r15d, %r15d
xorl %r14d, %r14d
movl %r14d, 0xe100(%rip)     # 0x1f80c
movq 0x18(%rbx), %rsi
addq %r15, %rsi
movq %r12, %rdi
callq 0x11a80
movl %eax, %r13d
testb %al, %al
je 0x11731
incq %r14
movl 0x10(%rbx), %eax
addq $0x28, %r15
cmpq %rax, %r14
jb 0x11705
movq 0x80(%r12), %rcx
leaq 0x4(%rcx), %rax
cmpq 0x88(%r12), %rax
ja 0x117ba
movl (%rcx), %ecx
movq %rax, 0x80(%r12)
movl %ecx, 0x20(%rbx)
testb %r13b, %r13b
je 0x117a8
movq -0x38(%rbp), %rdi
subl %edi, %eax
movl %eax, 0x44(%rbx)
movl 0x5c(%r12), %eax
movl %eax, 0x48(%rbx)
movl 0x90(%r12), %eax
movl %edi, %ecx
subl %eax, %ecx
addl 0x60(%r12), %ecx
movl %ecx, 0x4c(%rbx)
movq -0x30(%rbp), %rcx
movl (%rcx), %eax
movl %eax, 0x50(%rbx)
incl (%rcx)
movl 0x44(%rbx), %esi
addq $0x24, %rbx
movq %rbx, %rdx
callq 0xa814
movq %rbx, %rdi
movl $0x20, %esi
movq %rbx, %rdx
callq 0xa814
movl %r13d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x7b97(%rip), %rdi      # 0x19358
leaq 0x6028(%rip), %rsi      # 0x177f0
leaq 0x7bb4(%rip), %rcx      # 0x19383
movl $0x7ee, %edx            # imm = 0x7EE
callq 0x20c0
leaq 0x7c33(%rip), %rdi      # 0x19413
leaq 0x6009(%rip), %rsi      # 0x177f0
leaq 0x7c4f(%rip), %rcx      # 0x1943d
movl $0x7dc, %edx            # imm = 0x7DC
callq 0x20c0
leaq 0x7cff(%rip), %rdi      # 0x194fe
leaq 0x5fea(%rip), %rsi      # 0x177f0
leaq 0x7d20(%rip), %rcx      # 0x1952d
movl $0x8ae, %edx            # imm = 0x8AE
callq 0x20c0
leaq 0x7d64(%rip), %rdi      # 0x19582
leaq 0x5fcb(%rip), %rsi      # 0x177f0
leaq 0x7d01(%rip), %rcx      # 0x1952d
movl $0x8b1, %edx            # imm = 0x8B1
callq 0x20c0
leaq 0x7c1c(%rip), %rdi      # 0x19459
leaq 0x5fac(%rip), %rsi      # 0x177f0
leaq 0x7c39(%rip), %rcx      # 0x19484
movl $0x7e5, %edx            # imm = 0x7E5
callq 0x20c0
leaq 0x7d49(%rip), %rdi      # 0x195a5
leaq 0x5f8d(%rip), %rsi      # 0x177f0
leaq 0x7cc3(%rip), %rcx      # 0x1952d
movl $0x8c5, %edx            # imm = 0x8C5
callq 0x20c0
leaq 0x7d5b(%rip), %rdi      # 0x195d6
leaq 0x5f6e(%rip), %rsi      # 0x177f0
leaq 0x7ca4(%rip), %rcx      # 0x1952d
movl $0x8c8, %edx            # imm = 0x8C8
callq 0x20c0
leaq 0x64d6(%rip), %rdi      # 0x17d70
leaq 0x5f4f(%rip), %rsi      # 0x177f0
leaq 0x7b3b(%rip), %rcx      # 0x193e3
movl $0x821, %edx            # imm = 0x821
callq 0x20c0