// File: /workspace/github_cpp_makefile_star2_O3/burakbugrul[P]NginxLogParser/NginxParser.cpp
// Function: NginxParser::statistics()
void NginxParser::statistics(){
	
	int current_max,w=35;
	string ip,id;
	
	ofstream output(output_file);
	output << setw(w) << left << "Number of unique IPs: " << users.size() << "\n\n";
	output << setw(w) << "Number of unique contents: " << contents.size() << "\n\n";
	output << setw(w) << "Total data sent: " << (double)total_data/1e9 << "GB\n\n";
	output << setw(w) << "Number of video requests: " << videos << "\n\n";
	output << setw(w) << "Number of audio requests: " << audios << "\n\n";
	output << setw(w) << "Number of cs hits requests: " << cs_hits << "\n\n";
	
	current_max = 0;
	for( auto &user: users )
		if( user.second > current_max ){
			current_max = user.second;
			ip = user.first;
		}
	
	output << setw(w) << "The IP that watched contents most: " << ip << " (" << current_max << " times)\n\n";
	
	current_max = 0;
	for( auto &content: contents )
		if( content.second > current_max ){
			current_max = content.second;
			id = content.first;
		}
	
	output << setw(w) << "The content that watched most: " << id << " (" << current_max << " times)\n\n";
	
	output << "Browsers:\n";
	for( auto &browser: user_agents )
		output << browser.first << ": %" << ((double)browser.second/valid_lines)*100.0 << "\n";
	
	output << "\nHTTP Statuses:\n";
	for( int i=0 ; i<5 ; i++ )
		output << i+1 << "xx: %" << ((double)http_statuses[i]/valid_lines)*100.0 << "\n";
	
	output << "\nBitrates:\n";
	for( auto &bitrate: bitrates )
		output << bitrate.first << ": %" << ((double)bitrate.second/valid_lines)*100.0 << "\n";
	
	output.close();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x248, %rsp            # imm = 0x248
movq %rdi, %rbx
leaq 0x38(%rsp), %rcx
movq %rcx, -0x10(%rcx)
xorl %eax, %eax
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x18(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x48(%rdi), %rsi
leaq 0x48(%rsp), %rdi
movl $0x10, %edx
callq 0x22b0
leaq 0x48(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rcx
movq $0x23, 0x58(%rsp,%rcx)
movq -0x18(%rax), %rax
movl $0xffffff4f, %ecx       # imm = 0xFFFFFF4F
andl 0x60(%rsp,%rax), %ecx
orl $0x20, %ecx
movl %ecx, 0x60(%rsp,%rax)
leaq 0x1bd1(%rip), %rsi      # 0x50b4
movl $0x16, %edx
callq 0x21b0
movq 0x128(%rbx), %rsi
leaq 0x48(%rsp), %rdi
callq 0x2110
leaq 0x1c7a(%rip), %rsi      # 0x517f
movl $0x2, %edx
movq %rax, %rdi
callq 0x21b0
leaq 0x48(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
movq $0x23, 0x58(%rsp,%rax)
leaq 0x1b9d(%rip), %rsi      # 0x50cb
movl $0x1b, %edx
callq 0x21b0
movq 0xb8(%rbx), %rsi
leaq 0x48(%rsp), %rdi
callq 0x2110
leaq 0x1c2f(%rip), %rsi      # 0x517f
movl $0x2, %edx
movq %rax, %rdi
callq 0x21b0
leaq 0x48(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
movq $0x23, 0x58(%rsp,%rax)
leaq 0x1b6e(%rip), %rsi      # 0x50e7
movl $0x11, %edx
callq 0x21b0
cvtsi2sdq 0x148(%rbx), %xmm0
divsd 0x1aec(%rip), %xmm0     # 0x5080
leaq 0x48(%rsp), %rdi
callq 0x2240
leaq 0x1b54(%rip), %rsi      # 0x50f9
movl $0x4, %edx
movq %rax, %rdi
callq 0x21b0
leaq 0x48(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
movq $0x23, 0x58(%rsp,%rax)
leaq 0x1b30(%rip), %rsi      # 0x50fe
movl $0x1a, %edx
callq 0x21b0
movl 0xc(%rbx), %esi
leaq 0x48(%rsp), %rdi
callq 0x2270
leaq 0x1b93(%rip), %rsi      # 0x517f
movl $0x2, %edx
movq %rax, %rdi
callq 0x21b0
leaq 0x48(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
movq $0x23, 0x58(%rsp,%rax)
leaq 0x1b04(%rip), %rsi      # 0x5119
movl $0x1a, %edx
callq 0x21b0
movl 0x10(%rbx), %esi
leaq 0x48(%rsp), %rdi
callq 0x2270
leaq 0x1b4c(%rip), %rsi      # 0x517f
movl $0x2, %edx
movq %rax, %rdi
callq 0x21b0
leaq 0x48(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
movq $0x23, 0x58(%rsp,%rax)
leaq 0x1ad8(%rip), %rsi      # 0x5134
movl $0x1c, %edx
callq 0x21b0
movl 0x8(%rbx), %esi
leaq 0x48(%rsp), %rdi
callq 0x2270
leaq 0x1b05(%rip), %rsi      # 0x517f
movl $0x2, %edx
movq %rax, %rdi
callq 0x21b0
movq 0x120(%rbx), %r15
xorl %ebp, %ebp
testq %r15, %r15
je 0x36ba
leaq 0x28(%rsp), %r14
movl 0x28(%r15), %r12d
cmpl %ebp, %r12d
jle 0x36b2
leaq 0x8(%r15), %rsi
movq %r14, %rdi
callq 0x20f0
movl %r12d, %ebp
movq (%r15), %r15
testq %r15, %r15
jne 0x369a
leaq 0x48(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
movq $0x23, 0x58(%rsp,%rax)
leaq 0x1a7b(%rip), %rsi      # 0x5151
movl $0x23, %edx
callq 0x21b0
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
leaq 0x48(%rsp), %rdi
callq 0x21b0
movq %rax, %r14
leaq 0x1a77(%rip), %rsi      # 0x5175
movl $0x2, %edx
movq %rax, %rdi
callq 0x21b0
movq %r14, %rdi
movl %ebp, %esi
callq 0x2270
leaq 0x1a5c(%rip), %rsi      # 0x5178
movl $0x9, %edx
movq %rax, %rdi
callq 0x21b0
movq 0xb0(%rbx), %r15
xorl %ebp, %ebp
testq %r15, %r15
je 0x375c
leaq 0x8(%rsp), %r14
movl 0x28(%r15), %r12d
cmpl %ebp, %r12d
jle 0x3754
leaq 0x8(%r15), %rsi
movq %r14, %rdi
callq 0x20f0
movl %r12d, %ebp
movq (%r15), %r15
testq %r15, %r15
jne 0x373c
leaq 0x48(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
movq $0x23, 0x58(%rsp,%rax)
leaq 0x1a0a(%rip), %rsi      # 0x5182
movl $0x1f, %edx
callq 0x21b0
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
leaq 0x48(%rsp), %rdi
callq 0x21b0
movq %rax, %r14
leaq 0x19d5(%rip), %rsi      # 0x5175
movl $0x2, %edx
movq %rax, %rdi
callq 0x21b0
movq %r14, %rdi
movl %ebp, %esi
callq 0x2270
leaq 0x19ba(%rip), %rsi      # 0x5178
movl $0x9, %edx
movq %rax, %rdi
callq 0x21b0
leaq 0x19d0(%rip), %rsi      # 0x51a2
leaq 0x48(%rsp), %rdi
movl $0xa, %edx
callq 0x21b0
leaq 0xe8(%rbx), %rbp
leaq 0x48(%rsp), %r14
leaq 0x19cc(%rip), %r15      # 0x51c0
leaq 0x1985(%rip), %r12      # 0x5180
movq (%rbp), %rbp
testq %rbp, %rbp
je 0x385d
movq 0x8(%rbp), %rsi
movq 0x10(%rbp), %rdx
movq %r14, %rdi
callq 0x21b0
movq %rax, %r13
movl $0x3, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x21b0
xorps %xmm0, %xmm0
cvtsi2sdl 0x28(%rbp), %xmm0
xorps %xmm1, %xmm1
cvtsi2sdl 0x4(%rbx), %xmm1
divsd %xmm1, %xmm0
mulsd 0x1845(%rip), %xmm0     # 0x5088
movq %r13, %rdi
callq 0x2240
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x21b0
jmp 0x37fb
leaq 0x1949(%rip), %rsi      # 0x51ad
leaq 0x48(%rsp), %rdi
movl $0x10, %edx
callq 0x21b0
xorl %ebp, %ebp
leaq 0x48(%rsp), %r14
leaq 0x193d(%rip), %r15      # 0x51be
leaq 0x18f8(%rip), %r12      # 0x5180
cmpq $0x5, %rbp
je 0x38e6
leal 0x1(%rbp), %esi
movq %r14, %rdi
callq 0x2270
movq %rax, %r13
movl $0x5, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x21b0
xorps %xmm0, %xmm0
cvtsi2sdl 0x14(%rbx,%rbp,4), %xmm0
xorps %xmm1, %xmm1
cvtsi2sdl 0x4(%rbx), %xmm1
divsd %xmm1, %xmm0
mulsd 0x17bf(%rip), %xmm0     # 0x5088
movq %r13, %rdi
callq 0x2240
incq %rbp
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x21b0
jmp 0x3888
leaq 0x18d7(%rip), %rsi      # 0x51c4
leaq 0x48(%rsp), %rdi
movl $0xb, %edx
callq 0x21b0
leaq 0x78(%rbx), %rbp
leaq 0x48(%rsp), %r14
leaq 0x18b4(%rip), %r15      # 0x51c0
leaq 0x186d(%rip), %r12      # 0x5180
movq (%rbp), %rbp
testq %rbp, %rbp
je 0x3970
movl 0x8(%rbp), %esi
movq %r14, %rdi
callq 0x2270
movq %rax, %r13
movl $0x3, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x21b0
xorps %xmm0, %xmm0
cvtsi2sdl 0xc(%rbp), %xmm0
xorps %xmm1, %xmm1
cvtsi2sdl 0x4(%rbx), %xmm1
divsd %xmm1, %xmm0
mulsd 0x1732(%rip), %xmm0     # 0x5088
movq %r13, %rdi
callq 0x2240
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x21b0
jmp 0x3913
leaq 0x48(%rsp), %rdi
callq 0x21f0
movq 0x3647(%rip), %rax      # 0x6fc8
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x50(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0x48(%rsp,%rcx)
callq 0x2150
leaq 0x140(%rsp), %rdi
callq 0x2080
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x39c8
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2190
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x39e4
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2190
addq $0x248, %rsp            # imm = 0x248
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x3a12
jmp 0x3a05
jmp 0x3a05
jmp 0x3a05
jmp 0x3a05
jmp 0x3a05
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x2210
leaq 0x38(%rsp), %r14
leaq 0x18(%rsp), %rax
movq 0x8(%rsp), %rdi
cmpq %rax, %rdi
je 0x3a33
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2190
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x3a4a
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2190
movq %rbx, %rdi
callq 0x2280