// File: 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
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x78(%rbp)
movl $0x0, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
imull $0x5f5e100, -0x10(%rbp), %eax # imm = 0x5F5E100
movl %eax, %eax
movq %rax, -0x28(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x2120
movq -0x78(%rbp), %rdi
callq 0x1d960
movl %eax, %edi
callq 0x19c20
movq %rax, %rsi
leaq 0xf827(%rip), %rdi      # 0x32950
movb $0x0, %al
callq 0x2050
movl $0x0, -0x34(%rbp)
movq -0x78(%rbp), %rdi
movl -0x34(%rbp), %eax
movl %eax, -0x7c(%rbp)
callq 0x1d960
movl %eax, %ecx
movl -0x7c(%rbp), %eax
cmpl %ecx, %eax
jae 0x23244
movq -0x78(%rbp), %rdi
movl -0x34(%rbp), %esi
callq 0x1d360
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x40(%rbp), %rcx
subq 0x20(%rcx), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
cmpq -0x28(%rbp), %rax
jbe 0x23234
movq -0x48(%rbp), %rax
movl $0x5f5e100, %ecx        # imm = 0x5F5E100
xorl %edx, %edx
divq %rcx
movl %eax, -0x4c(%rbp)
movq -0x40(%rbp), %rax
movl 0x14(%rax), %eax
movl %eax, -0x50(%rbp)
movq -0x40(%rbp), %rax
cmpl $0x0, 0x14(%rax)
jne 0x231b4
movq -0x40(%rbp), %rax
movl 0x1c(%rax), %eax
movl %eax, -0x50(%rbp)
movq -0x30(%rbp), %rdi
movl -0x50(%rbp), %eax
movl %eax, %esi
callq 0x20a0
movsd %xmm0, -0x58(%rbp)
movsd -0x58(%rbp), %xmm0
movsd 0xda6c(%rip), %xmm1     # 0x30c40
divsd %xmm1, %xmm0
movsd %xmm0, -0x60(%rbp)
movsd -0x60(%rbp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, -0x68(%rbp)
movsd -0x68(%rbp), %xmm0
movsd 0xda50(%rip), %xmm1     # 0x30c48
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
movl %eax, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
cmpl -0xc(%rbp), %eax
jbe 0x23220
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
movl -0x4c(%rbp), %eax
addl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
jmp 0x23232
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
movl -0x4c(%rbp), %eax
addl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
jmp 0x23234
jmp 0x23236
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x23137
leaq 0xf73e(%rip), %rdi      # 0x32989
movb $0x0, %al
callq 0x2050
movl -0x14(%rbp), %edi
callq 0x19c20
movq %rax, -0xb0(%rbp)
movl -0xc(%rbp), %edi
callq 0x19c20
movq %rax, -0xa8(%rbp)
movl -0x1c(%rbp), %edi
callq 0x19c20
movq %rax, -0xa0(%rbp)
movl -0x10(%rbp), %edi
callq 0x19c20
movq -0xb0(%rbp), %rsi
movq -0xa8(%rbp), %rdx
movq -0xa0(%rbp), %rcx
movq %rax, %r8
leaq 0xf6f4(%rip), %rdi      # 0x3299a
movb $0x0, %al
callq 0x2050
movl -0x18(%rbp), %edi
callq 0x19c20
movq %rax, -0x98(%rbp)
movl -0xc(%rbp), %edi
callq 0x19c20
movq %rax, -0x90(%rbp)
movl -0x20(%rbp), %edi
callq 0x19c20
movq %rax, -0x88(%rbp)
movl -0x10(%rbp), %edi
callq 0x19c20
movq -0x98(%rbp), %rsi
movq -0x90(%rbp), %rdx
movq -0x88(%rbp), %rcx
movq %rax, %r8
leaq 0xf704(%rip), %rdi      # 0x32a05
movb $0x0, %al
callq 0x2050
addq $0xb0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)