// File: /workspace/github_cpp_makefile_star2_O3/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 %rdx, %r15
movq %rdi, %r12
movq 0x80(%rdi), %r14
movq 0x88(%rdi), %rdi
leaq 0x4(%r14), %rdx
cmpq %rdi, %rdx
ja 0x116a0
movq %rsi, %rbx
movl (%r14), %esi
movq %rdx, 0x80(%r12)
movl %esi, (%rbx)
leal -0x1(%rsi), %eax
cmpl $0x2, %eax
jb 0x1142d
movb $0x1, 0xe3f7(%rip)      # 0x1f804
leaq 0x808e(%rip), %rdi      # 0x194a2
movl %ecx, %edx
xorl %eax, %eax
callq 0x2050
movq 0x80(%r12), %rdx
movq 0x88(%r12), %rdi
leaq 0x1(%rdx), %rsi
cmpq %rdi, %rsi
ja 0x116bf
movzbl (%rdx), %eax
movq %rsi, 0x80(%r12)
cmpl $0xfc, %eax
movq %r14, -0x38(%rbp)
movq %r15, -0x30(%rbp)
ja 0x1145d
leaq 0x4(%rbx), %r13
movl %eax, 0x4(%rbx)
jmp 0x114ae
leaq 0x3(%rdx), %rcx
cmpq %rdi, %rcx
ja 0x116fd
movzwl (%rsi), %eax
movq %rcx, 0x80(%r12)
cmpl $0xffff, %eax           # imm = 0xFFFF
jne 0x1149c
addq $0x7, %rdx
cmpq %rdi, %rdx
ja 0x116a0
movl (%rcx), %eax
movq %rdx, 0x80(%r12)
cmpl $-0x1, %eax
je 0x1175a
movl %eax, 0x4(%rbx)
cmpl $0x1000, %eax           # imm = 0x1000
jae 0x1171c
leaq 0x4(%rbx), %r13
movl 0x54(%r12), %ecx
leal (%rcx,%rax), %edx
shlq $0x5, %rcx
addq %r12, %rcx
addq $0xb0098, %rcx          # imm = 0xB0098
movq %rcx, 0x8(%rbx)
movl %edx, 0x54(%r12)
cmpl $0x7fff, %edx           # imm = 0x7FFF
ja 0x116de
testl %eax, %eax
je 0x1153f
xorl %r15d, %r15d
xorl %r14d, %r14d
movq 0x8(%rbx), %rsi
addq %r15, %rsi
movq %r12, %rdi
callq 0x11798
testb %al, %al
je 0x1153f
incq %r14
movl (%r13), %eax
addq $0x20, %r15
cmpq %rax, %r14
jb 0x114e3
movq 0x80(%r12), %rsi
movq 0x88(%r12), %rax
leaq 0x1(%rsi), %rcx
cmpq %rax, %rcx
ja 0x116bf
movzbl (%rsi), %edx
movq %rcx, 0x80(%r12)
cmpl $0xfc, %edx
ja 0x11554
leaq 0x10(%rbx), %r13
movl %edx, 0x10(%rbx)
jmp 0x115af
xorl %r13d, %r13d
movl %r13d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3(%rsi), %rdi
cmpq %rax, %rdi
ja 0x116fd
movzwl (%rcx), %edx
movq %rdi, 0x80(%r12)
cmpl $0xffff, %edx           # imm = 0xFFFF
je 0x11579
movq %rdi, %rsi
jmp 0x11599
addq $0x7, %rsi
cmpq %rax, %rsi
ja 0x116a0
movl (%rdi), %edx
movq %rsi, 0x80(%r12)
cmpl $-0x1, %edx
je 0x1175a
movl %edx, 0x10(%rbx)
cmpl $0x1000, %edx           # imm = 0x1000
jae 0x11779
leaq 0x10(%rbx), %r13
movq %rsi, %rcx
movl 0x58(%r12), %esi
leaq (%rsi,%rsi,4), %rdi
leaq (%r12,%rdi,8), %rdi
addq $0x1b0098, %rdi         # imm = 0x1B0098
movq %rdi, 0x18(%rbx)
addl %edx, %esi
movl %esi, 0x58(%r12)
cmpl $0x7fff, %esi           # imm = 0x7FFF
ja 0x1173b
testl %edx, %edx
je 0x11613
xorl %r15d, %r15d
xorl %r14d, %r14d
movl %r14d, 0xe221(%rip)     # 0x1f80c
movq 0x18(%rbx), %rsi
addq %r15, %rsi
movq %r12, %rdi
callq 0x11970
testb %al, %al
je 0x11618
incq %r14
movl (%r13), %eax
addq $0x28, %r15
cmpq %rax, %r14
jb 0x115e4
movb $0x1, %r13b
jmp 0x1161b
movb $0x1, %r13b
jmp 0x1162b
xorl %r13d, %r13d
movq 0x80(%r12), %rcx
movq 0x88(%r12), %rax
leaq 0x4(%rcx), %rdx
cmpq %rax, %rdx
ja 0x116a0
movl (%rcx), %eax
movq %rdx, 0x80(%r12)
movl %eax, 0x20(%rbx)
testb %r13b, %r13b
je 0x11542
movq -0x38(%rbp), %rdi
subl %edi, %edx
movl %edx, 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 %eax
movl %eax, (%rcx)
movl 0x44(%rbx), %esi
addq $0x24, %rbx
movq %rbx, %rdx
callq 0xa7a4
movq %rbx, %rdi
movl $0x20, %esi
movq %rbx, %rdx
callq 0xa7a4
jmp 0x11542
leaq 0x7cb1(%rip), %rdi      # 0x19358
leaq 0x6142(%rip), %rsi      # 0x177f0
leaq 0x7cce(%rip), %rcx      # 0x19383
movl $0x7ee, %edx            # imm = 0x7EE
callq 0x20c0
leaq 0x7d4d(%rip), %rdi      # 0x19413
leaq 0x6123(%rip), %rsi      # 0x177f0
leaq 0x7d69(%rip), %rcx      # 0x1943d
movl $0x7dc, %edx            # imm = 0x7DC
callq 0x20c0
leaq 0x7e9d(%rip), %rdi      # 0x19582
leaq 0x6104(%rip), %rsi      # 0x177f0
leaq 0x7e3a(%rip), %rcx      # 0x1952d
movl $0x8b1, %edx            # imm = 0x8B1
callq 0x20c0
leaq 0x7d55(%rip), %rdi      # 0x19459
leaq 0x60e5(%rip), %rsi      # 0x177f0
leaq 0x7d72(%rip), %rcx      # 0x19484
movl $0x7e5, %edx            # imm = 0x7E5
callq 0x20c0
leaq 0x7ddb(%rip), %rdi      # 0x194fe
leaq 0x60c6(%rip), %rsi      # 0x177f0
leaq 0x7dfc(%rip), %rcx      # 0x1952d
movl $0x8ae, %edx            # imm = 0x8AE
callq 0x20c0
leaq 0x7e94(%rip), %rdi      # 0x195d6
leaq 0x60a7(%rip), %rsi      # 0x177f0
leaq 0x7ddd(%rip), %rcx      # 0x1952d
movl $0x8c8, %edx            # imm = 0x8C8
callq 0x20c0
leaq 0x660f(%rip), %rdi      # 0x17d70
leaq 0x6088(%rip), %rsi      # 0x177f0
leaq 0x7c74(%rip), %rcx      # 0x193e3
movl $0x821, %edx            # imm = 0x821
callq 0x20c0
leaq 0x7e25(%rip), %rdi      # 0x195a5
leaq 0x6069(%rip), %rsi      # 0x177f0
leaq 0x7d9f(%rip), %rcx      # 0x1952d
movl $0x8c5, %edx            # imm = 0x8C5
callq 0x20c0