// File: /workspace/github_cpp_makefile_star2_O1/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 0x1b75(%rip), %rsi      # 0x50bc
movl $0x16, %edx
callq 0x21b0
movq 0x128(%rbx), %rsi
leaq 0x48(%rsp), %rdi
callq 0x2110
leaq 0x1c1e(%rip), %rsi      # 0x5187
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 0x1b41(%rip), %rsi      # 0x50d3
movl $0x1b, %edx
callq 0x21b0
movq 0xb8(%rbx), %rsi
leaq 0x48(%rsp), %rdi
callq 0x2110
leaq 0x1bd3(%rip), %rsi      # 0x5187
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 0x1b12(%rip), %rsi      # 0x50ef
movl $0x11, %edx
callq 0x21b0
cvtsi2sdq 0x148(%rbx), %xmm0
divsd 0x1a88(%rip), %xmm0     # 0x5080
leaq 0x48(%rsp), %rdi
callq 0x2240
leaq 0x1af8(%rip), %rsi      # 0x5101
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 0x1ad4(%rip), %rsi      # 0x5106
movl $0x1a, %edx
callq 0x21b0
movl 0xc(%rbx), %esi
leaq 0x48(%rsp), %rdi
callq 0x2270
leaq 0x1b37(%rip), %rsi      # 0x5187
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 0x1aa8(%rip), %rsi      # 0x5121
movl $0x1a, %edx
callq 0x21b0
movl 0x10(%rbx), %esi
leaq 0x48(%rsp), %rdi
callq 0x2270
leaq 0x1af0(%rip), %rsi      # 0x5187
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 0x1a7c(%rip), %rsi      # 0x513c
movl $0x1c, %edx
callq 0x21b0
movl 0x8(%rbx), %esi
leaq 0x48(%rsp), %rdi
callq 0x2270
leaq 0x1aa9(%rip), %rsi      # 0x5187
movl $0x2, %edx
movq %rax, %rdi
callq 0x21b0
movq 0x120(%rbx), %r15
xorl %ebp, %ebp
testq %r15, %r15
je 0x371e
leaq 0x28(%rsp), %r14
movl 0x28(%r15), %r12d
cmpl %ebp, %r12d
jle 0x3716
leaq 0x8(%r15), %rsi
movq %r14, %rdi
callq 0x20f0
movl %r12d, %ebp
movq (%r15), %r15
testq %r15, %r15
jne 0x36fe
leaq 0x48(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
movq $0x23, 0x58(%rsp,%rax)
leaq 0x1a1f(%rip), %rsi      # 0x5159
movl $0x23, %edx
callq 0x21b0
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
leaq 0x48(%rsp), %rdi
callq 0x21b0
movq %rax, %r14
leaq 0x1a1b(%rip), %rsi      # 0x517d
movl $0x2, %edx
movq %rax, %rdi
callq 0x21b0
movq %r14, %rdi
movl %ebp, %esi
callq 0x2270
leaq 0x1a00(%rip), %rsi      # 0x5180
movl $0x9, %edx
movq %rax, %rdi
callq 0x21b0
movq 0xb0(%rbx), %r15
xorl %ebp, %ebp
testq %r15, %r15
je 0x37c0
leaq 0x8(%rsp), %r14
movl 0x28(%r15), %r12d
cmpl %ebp, %r12d
jle 0x37b8
leaq 0x8(%r15), %rsi
movq %r14, %rdi
callq 0x20f0
movl %r12d, %ebp
movq (%r15), %r15
testq %r15, %r15
jne 0x37a0
leaq 0x48(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
movq $0x23, 0x58(%rsp,%rax)
leaq 0x19ae(%rip), %rsi      # 0x518a
movl $0x1f, %edx
callq 0x21b0
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
leaq 0x48(%rsp), %rdi
callq 0x21b0
movq %rax, %r14
leaq 0x1979(%rip), %rsi      # 0x517d
movl $0x2, %edx
movq %rax, %rdi
callq 0x21b0
movq %r14, %rdi
movl %ebp, %esi
callq 0x2270
leaq 0x195e(%rip), %rsi      # 0x5180
movl $0x9, %edx
movq %rax, %rdi
callq 0x21b0
leaq 0x1974(%rip), %rsi      # 0x51aa
leaq 0x48(%rsp), %rdi
movl $0xa, %edx
callq 0x21b0
leaq 0xe8(%rbx), %rbp
leaq 0x48(%rsp), %r14
leaq 0x1970(%rip), %r15      # 0x51c8
leaq 0x1929(%rip), %r12      # 0x5188
movq (%rbp), %rbp
testq %rbp, %rbp
je 0x38c1
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 0x17e1(%rip), %xmm0     # 0x5088
movq %r13, %rdi
callq 0x2240
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x21b0
jmp 0x385f
leaq 0x18ed(%rip), %rsi      # 0x51b5
leaq 0x48(%rsp), %rdi
movl $0x10, %edx
callq 0x21b0
xorl %ebp, %ebp
leaq 0x48(%rsp), %r14
leaq 0x18e1(%rip), %r15      # 0x51c6
leaq 0x189c(%rip), %r12      # 0x5188
cmpq $0x5, %rbp
je 0x394a
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 0x175b(%rip), %xmm0     # 0x5088
movq %r13, %rdi
callq 0x2240
incq %rbp
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x21b0
jmp 0x38ec
leaq 0x187b(%rip), %rsi      # 0x51cc
leaq 0x48(%rsp), %rdi
movl $0xb, %edx
callq 0x21b0
leaq 0x78(%rbx), %rbp
leaq 0x48(%rsp), %r14
leaq 0x1858(%rip), %r15      # 0x51c8
leaq 0x1811(%rip), %r12      # 0x5188
movq (%rbp), %rbp
testq %rbp, %rbp
je 0x39d4
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 0x16ce(%rip), %xmm0     # 0x5088
movq %r13, %rdi
callq 0x2240
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x21b0
jmp 0x3977
leaq 0x48(%rsp), %rdi
callq 0x21f0
movq 0x35e3(%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 0x3a2c
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2190
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x3a48
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 0x3a76
jmp 0x3a69
jmp 0x3a69
jmp 0x3a69
jmp 0x3a69
jmp 0x3a69
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 0x3a97
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2190
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x3aae
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2190
movq %rbx, %rdi
callq 0x2280