// File: /workspace/github_cpp_makefile_star2_O2/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), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
leaq 0x18(%rsp), %rcx
movq %rcx, -0x10(%rcx)
andq $0x0, -0x8(%rcx)
xorl %edx, %edx
movb %dl, (%rax)
movb %dl, (%rcx)
leaq 0x48(%rdi), %rsi
leaq 0x48(%rsp), %rdi
pushq $0x10
popq %rdx
callq 0x2290
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 0x1079(%rip), %rsi      # 0x4084
callq 0x2170
movq 0x128(%rbx), %rsi
movq %rax, %rdi
callq 0x2120
leaq 0x1129(%rip), %rsi      # 0x414f
movq %rax, %rdi
callq 0x2170
leaq 0x48(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
movq $0x23, 0x58(%rsp,%rax)
leaq 0x1051(%rip), %rsi      # 0x409b
callq 0x2170
movq 0xb8(%rbx), %rsi
movq %rax, %rdi
callq 0x2120
leaq 0x10ea(%rip), %rsi      # 0x414f
movq %rax, %rdi
callq 0x2170
leaq 0x48(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
movq $0x23, 0x58(%rsp,%rax)
leaq 0x102e(%rip), %rsi      # 0x40b7
callq 0x2170
cvtsi2sdq 0x148(%rbx), %xmm0
divsd 0xfb1(%rip), %xmm0      # 0x4050
movq %rax, %rdi
callq 0x2220
leaq 0x101b(%rip), %rsi      # 0x40c9
movq %rax, %rdi
callq 0x2170
leaq 0x48(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
movq $0x23, 0x58(%rsp,%rax)
leaq 0xffc(%rip), %rsi       # 0x40ce
callq 0x2170
movl 0xc(%rbx), %esi
movq %rax, %rdi
callq 0x2250
leaq 0x1066(%rip), %rsi      # 0x414f
movq %rax, %rdi
callq 0x2170
leaq 0x48(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
movq $0x23, 0x58(%rsp,%rax)
leaq 0xfdc(%rip), %rsi       # 0x40e9
callq 0x2170
movl 0x10(%rbx), %esi
movq %rax, %rdi
callq 0x2250
leaq 0x102b(%rip), %rsi      # 0x414f
movq %rax, %rdi
callq 0x2170
leaq 0x48(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
movq $0x23, 0x58(%rsp,%rax)
leaq 0xfbc(%rip), %rsi       # 0x4104
callq 0x2170
movl 0x8(%rbx), %esi
movq %rax, %rdi
callq 0x2250
leaq 0xff0(%rip), %rsi       # 0x414f
movq %rax, %rdi
callq 0x2170
leaq 0x120(%rbx), %r15
xorl %ebp, %ebp
leaq 0x28(%rsp), %r14
movq (%r15), %r15
testq %r15, %r15
je 0x3197
movl 0x28(%r15), %r12d
cmpl %ebp, %r12d
jle 0x3175
leaq 0x8(%r15), %rsi
movq %r14, %rdi
callq 0x2100
movl %r12d, %ebp
jmp 0x3175
leaq 0x48(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
movq $0x23, 0x58(%rsp,%rax)
leaq 0xf6e(%rip), %rsi       # 0x4121
callq 0x2170
leaq 0x28(%rsp), %rsi
movq %rax, %rdi
callq 0x2160
leaq 0xf79(%rip), %rsi       # 0x4145
movq %rax, %rdi
callq 0x2170
movq %rax, %rdi
movl %ebp, %esi
callq 0x2250
leaq 0xf63(%rip), %rsi       # 0x4148
movq %rax, %rdi
callq 0x2170
leaq 0xb0(%rbx), %r15
xorl %ebp, %ebp
leaq 0x8(%rsp), %r14
movq (%r15), %r15
testq %r15, %r15
je 0x321d
movl 0x28(%r15), %r12d
cmpl %ebp, %r12d
jle 0x31fb
leaq 0x8(%r15), %rsi
movq %r14, %rdi
callq 0x2100
movl %r12d, %ebp
jmp 0x31fb
leaq 0x48(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
movq $0x23, 0x58(%rsp,%rax)
leaq 0xf19(%rip), %rsi       # 0x4152
callq 0x2170
leaq 0x8(%rsp), %rsi
movq %rax, %rdi
callq 0x2160
leaq 0xef3(%rip), %rsi       # 0x4145
movq %rax, %rdi
callq 0x2170
movq %rax, %rdi
movl %ebp, %esi
callq 0x2250
leaq 0xedd(%rip), %rsi       # 0x4148
movq %rax, %rdi
callq 0x2170
leaq 0xef8(%rip), %rsi       # 0x4172
leaq 0x48(%rsp), %rdi
callq 0x2170
leaq 0xe8(%rbx), %r13
leaq 0x48(%rsp), %r14
leaq 0xef9(%rip), %r15       # 0x4190
leaq 0xeb2(%rip), %r12       # 0x4150
movq (%r13), %r13
testq %r13, %r13
je 0x32ea
leaq 0x8(%r13), %rsi
movq %r14, %rdi
callq 0x2160
movq %rax, %rdi
movq %r15, %rsi
callq 0x2170
cvtsi2sdl 0x28(%r13), %xmm0
cvtsi2sdl 0x4(%rbx), %xmm1
divsd %xmm1, %xmm0
mulsd 0xd83(%rip), %xmm0      # 0x4058
movq %rax, %rdi
callq 0x2220
movq %rax, %rdi
movq %r12, %rsi
callq 0x2170
jmp 0x329e
leaq 0xe8c(%rip), %rsi       # 0x417d
leaq 0x48(%rsp), %rdi
callq 0x2170
xorl %r13d, %r13d
leaq 0x48(%rsp), %r14
leaq 0xe84(%rip), %r15       # 0x418e
leaq 0xe3f(%rip), %r12       # 0x4150
cmpq $0x5, %r13
je 0x335e
leal 0x1(%r13), %esi
movq %r14, %rdi
callq 0x2250
movq %rax, %rdi
movq %r15, %rsi
callq 0x2170
cvtsi2sdl 0x14(%rbx,%r13,4), %xmm0
cvtsi2sdl 0x4(%rbx), %xmm1
divsd %xmm1, %xmm0
mulsd 0xd12(%rip), %xmm0      # 0x4058
movq %rax, %rdi
callq 0x2220
incq %r13
movq %rax, %rdi
movq %r12, %rsi
callq 0x2170
jmp 0x3311
leaq 0xe2f(%rip), %rsi       # 0x4194
leaq 0x48(%rsp), %rdi
callq 0x2170
leaq 0x78(%rbx), %r13
leaq 0x48(%rsp), %r14
leaq 0xe11(%rip), %r15       # 0x4190
leaq 0xdca(%rip), %r12       # 0x4150
movq (%r13), %r13
testq %r13, %r13
je 0x33d2
movl 0x8(%r13), %esi
movq %r14, %rdi
callq 0x2250
movq %rax, %rdi
movq %r15, %rsi
callq 0x2170
cvtsi2sdl 0xc(%r13), %xmm0
cvtsi2sdl 0x4(%rbx), %xmm1
divsd %xmm1, %xmm0
mulsd 0xc9b(%rip), %xmm0      # 0x4058
movq %rax, %rdi
callq 0x2220
movq %rax, %rdi
movq %r12, %rsi
callq 0x2170
jmp 0x3386
leaq 0x48(%rsp), %rdi
callq 0x21e0
leaq 0x48(%rsp), %rdi
callq 0x2200
leaq 0x8(%rsp), %rdi
callq 0x20e0
leaq 0x28(%rsp), %rdi
callq 0x20e0
addq $0x248, %rsp            # imm = 0x248
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x341b
jmp 0x341b
movq %rax, %rbx
jmp 0x3428
jmp 0x341b
jmp 0x341b
jmp 0x341b
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x2200
leaq 0x8(%rsp), %rdi
callq 0x20e0
leaq 0x28(%rsp), %rdi
callq 0x20e0
movq %rbx, %rdi
callq 0x2260