// File: /workspace/github_cpp_makefile_star2_O3/jeffchan[P]blockchain-parser/BlockChain.cpp
// Function: BitcoinTransactionFactory::zombieReport(unsigned int, unsigned int)
void zombieReport(uint32_t zdays,uint32_t minBalance)
	{
		uint32_t zombie_count=0;
		uint32_t alive_count=0;
		uint32_t zombie_balance=0;
		uint32_t alive_balance=0;
		uint64_t mbtc = minBalance*ONE_BTC;
		time_t currentTime;
		time(&currentTime); // get the current time.
		printf("Scanning %s bitcoin addresses and looking for zombies.\r\n", formatNumber(mAddresses.size()));

		for (uint32_t i=0; i<mAddresses.size(); i++) // print one in every 10,000 addresses (just for testing right now)
		{
			BitcoinAddress *ba = mAddresses.getKey(i);
			uint64_t balance = ba->mTotalReceived-ba->mTotalSent;
			if ( balance > mbtc )
			{
				uint32_t btc = (uint32_t)((balance)/ONE_BTC);
				uint32_t lastUsed = ba->mLastInputTime; // the last time we sent money (not received because anyone can send us money).
				if ( ba->mLastInputTime == 0 ) // if it has never had a spend.. then we use the time of first receive..
				{
					lastUsed = ba->mFirstOutputTime;
				}
				double seconds = difftime(currentTime,time_t(lastUsed));
				double minutes = seconds/60;
				double hours = minutes/60;
				uint32_t days = (uint32_t) (hours/24);
				if ( days > zdays )
				{
					zombie_count++;
					zombie_balance+=btc;
				}
				else
				{
					alive_count++;
					alive_balance+=btc;
				}
			}
		}
		printf("Zombie Report:\r\n");
		printf("Found %s zombie addresses older than %s days with a total balance of %s, excluding balances less than %s\r\n",formatNumber(zombie_count),formatNumber(zdays),formatNumber(zombie_balance), formatNumber(minBalance) );
		printf("Found %s living addresses newer than %s days with a total balance of %s, excluding balances less than %s\r\n",formatNumber(alive_count),formatNumber(zdays),formatNumber(alive_balance), formatNumber(minBalance) );
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %edx, -0x3c(%rbp)
movl %esi, -0x40(%rbp)
movq %rdi, %r14
leaq -0x50(%rbp), %rdi
callq 0x2130
movl 0x2000000(%r14), %edi
callq 0xb535
leaq 0x84db(%rip), %rdi      # 0x19249
movl $0x0, -0x38(%rbp)
movq %rax, %rsi
xorl %eax, %eax
callq 0x2050
movl 0x2000000(%r14), %eax
movl $0x0, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movl $0x0, -0x2c(%rbp)
testq %rax, %rax
je 0x10e58
imull $0x5f5e100, -0x3c(%rbp), %r12d # imm = 0x5F5E100
movq 0x2000008(%r14), %r14
movq -0x50(%rbp), %rcx
movq %rcx, -0x48(%rbp)
shlq $0x4, %rax
leaq (%rax,%rax,4), %r13
xorl %ebx, %ebx
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x34(%rbp)
movl $0x0, -0x30(%rbp)
movl $0x0, -0x38(%rbp)
movq 0x28(%r14,%rbx), %rax
subq 0x20(%r14,%rbx), %rax
cmpq %r12, %rax
jbe 0x10e4f
movabsq $-0x543388ee7b9e3103, %rcx # imm = 0xABCC77118461CEFD
mulq %rcx
movq %rdx, %r15
movl 0x14(%r14,%rbx), %eax
testl %eax, %eax
jne 0x10e0e
movl 0x1c(%r14,%rbx), %eax
shrq $0x1a, %r15
movl %eax, %esi
movq -0x48(%rbp), %rdi
callq 0x20a0
movsd 0x69bb(%rip), %xmm1     # 0x177e0
divsd %xmm1, %xmm0
divsd %xmm1, %xmm0
divsd 0x69b3(%rip), %xmm0     # 0x177e8
cvttsd2si %xmm0, %rax
cmpl -0x40(%rbp), %eax
jbe 0x10e48
incl -0x2c(%rbp)
addl %r15d, -0x30(%rbp)
jmp 0x10e4f
incl -0x34(%rbp)
addl %r15d, -0x38(%rbp)
addq $0x50, %rbx
cmpq %rbx, %r13
jne 0x10de1
leaq 0x8d84(%rip), %rdi      # 0x19be3
callq 0x2260
movl -0x2c(%rbp), %edi
callq 0xb535
movq %rax, %rbx
movl -0x40(%rbp), %r13d
movl %r13d, %edi
callq 0xb535
movq %rax, %r14
movl -0x30(%rbp), %edi
callq 0xb535
movq %rax, %r15
movl -0x3c(%rbp), %r12d
movl %r12d, %edi
callq 0xb535
leaq 0x83e6(%rip), %rdi      # 0x19282
movq %rbx, %rsi
movq %r14, %rdx
movq %r15, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x2050
movl -0x34(%rbp), %edi
callq 0xb535
movq %rax, %rbx
movl %r13d, %edi
callq 0xb535
movq %rax, %r14
movl -0x38(%rbp), %edi
callq 0xb535
movq %rax, %r15
movl %r12d, %edi
callq 0xb535
leaq 0x840e(%rip), %rdi      # 0x192ed
movq %rbx, %rsi
movq %r14, %rdx
movq %r15, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x2050
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop