// File: mahdibohloul[P]SnapTrip/./Models/Hotel.cpp
// Function: Database::Hotel::calculate_avg_ratings()
Database::Hotel::RatingInfo Database::Hotel::calculate_avg_ratings()
{
    RatingInfo rating_info = RatingInfo();
    for(auto rating_itr = map_ratings.begin(); rating_itr != map_ratings.end(); rating_itr++)
    {
        rating_info.location += ((*rating_itr).second->location / map_ratings.size());
        rating_info.cleanliness += ((*rating_itr).second->cleanliness / map_ratings.size());
        rating_info.staff += ((*rating_itr).second->staff / map_ratings.size());
        rating_info.facilities += ((*rating_itr).second->facilities / map_ratings.size());
        rating_info.value_for_money += ((*rating_itr).second->value_for_money / map_ratings.size());
        rating_info.overall_rating += ((*rating_itr).second->overall_rating / map_ratings.size());
    }
    return rating_info;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x78(%rbp)
movq %rdi, %rax
movq %rax, -0x70(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x68(%rbp)
movb $0x0, -0x11(%rbp)
callq 0x57fb0
movq -0x68(%rbp), %rdi
addq $0xf8, %rdi
callq 0x5aaf0
movq %rax, -0x20(%rbp)
movq -0x68(%rbp), %rdi
addq $0xf8, %rdi
callq 0x5a7d0
movq %rax, -0x28(%rbp)
leaq -0x20(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x5a7a0
testb $0x1, %al
jne 0x592fd
jmp 0x59538
leaq -0x20(%rbp), %rdi
movq %rdi, -0xa0(%rbp)
callq 0x5ab20
movq -0x68(%rbp), %rdi
movq 0x8(%rax), %rax
fldt (%rax)
fstpt -0xdc(%rbp)
addq $0xf8, %rdi
movq %rdi, -0x98(%rbp)
callq 0x5ab40
fldt -0xdc(%rbp)
movq -0xa0(%rbp), %rdi
movq %rax, %rcx
movq -0x78(%rbp), %rax
movq %rcx, -0x60(%rbp)
testq %rcx, %rcx
sets %cl
movzbl %cl, %ecx
movl %ecx, %edx
fildll -0x60(%rbp)
leaq 0x5c03b(%rip), %rcx     # 0xb5398
movq %rcx, -0x90(%rbp)
flds (%rcx,%rdx,4)
faddp %st, %st(1)
fdivrp %st, %st(1)
fldt 0x20(%rax)
faddp %st, %st(1)
fstpt 0x20(%rax)
callq 0x5ab20
movq -0x98(%rbp), %rdi
movq 0x8(%rax), %rax
fldt 0x10(%rax)
fstpt -0xd0(%rbp)
callq 0x5ab40
fldt -0xd0(%rbp)
movq -0xa0(%rbp), %rdi
movq -0x90(%rbp), %rcx
movq %rax, %rdx
movq -0x78(%rbp), %rax
movq %rdx, -0x58(%rbp)
testq %rdx, %rdx
sets %dl
movzbl %dl, %edx
fildll -0x58(%rbp)
flds (%rcx,%rdx,4)
faddp %st, %st(1)
fdivrp %st, %st(1)
fldt 0x30(%rax)
faddp %st, %st(1)
fstpt 0x30(%rax)
callq 0x5ab20
movq -0x98(%rbp), %rdi
movq 0x8(%rax), %rax
fldt 0x20(%rax)
fstpt -0xc4(%rbp)
callq 0x5ab40
fldt -0xc4(%rbp)
movq -0xa0(%rbp), %rdi
movq -0x90(%rbp), %rcx
movq %rax, %rdx
movq -0x78(%rbp), %rax
movq %rdx, -0x50(%rbp)
testq %rdx, %rdx
sets %dl
movzbl %dl, %edx
fildll -0x50(%rbp)
flds (%rcx,%rdx,4)
faddp %st, %st(1)
fdivrp %st, %st(1)
fldt 0x40(%rax)
faddp %st, %st(1)
fstpt 0x40(%rax)
callq 0x5ab20
movq -0x98(%rbp), %rdi
movq 0x8(%rax), %rax
fldt 0x30(%rax)
fstpt -0xb8(%rbp)
callq 0x5ab40
fldt -0xb8(%rbp)
movq -0xa0(%rbp), %rdi
movq -0x90(%rbp), %rcx
movq %rax, %rdx
movq -0x78(%rbp), %rax
movq %rdx, -0x48(%rbp)
testq %rdx, %rdx
sets %dl
movzbl %dl, %edx
fildll -0x48(%rbp)
flds (%rcx,%rdx,4)
faddp %st, %st(1)
fdivrp %st, %st(1)
fldt 0x50(%rax)
faddp %st, %st(1)
fstpt 0x50(%rax)
callq 0x5ab20
movq -0x98(%rbp), %rdi
movq 0x8(%rax), %rax
fldt 0x40(%rax)
fstpt -0xac(%rbp)
callq 0x5ab40
fldt -0xac(%rbp)
movq -0xa0(%rbp), %rdi
movq -0x90(%rbp), %rcx
movq %rax, %rdx
movq -0x78(%rbp), %rax
movq %rdx, -0x40(%rbp)
testq %rdx, %rdx
sets %dl
movzbl %dl, %edx
fildll -0x40(%rbp)
flds (%rcx,%rdx,4)
faddp %st, %st(1)
fdivrp %st, %st(1)
fldt 0x60(%rax)
faddp %st, %st(1)
fstpt 0x60(%rax)
callq 0x5ab20
movq -0x98(%rbp), %rdi
movq 0x8(%rax), %rax
fldt 0x50(%rax)
fstpt -0x84(%rbp)
callq 0x5ab40
movq -0x90(%rbp), %rcx
fldt -0x84(%rbp)
movq %rax, %rdx
movq -0x78(%rbp), %rax
movq %rdx, -0x38(%rbp)
testq %rdx, %rdx
sets %dl
movzbl %dl, %edx
fildll -0x38(%rbp)
flds (%rcx,%rdx,4)
faddp %st, %st(1)
fdivrp %st, %st(1)
fldt 0x70(%rax)
faddp %st, %st(1)
fstpt 0x70(%rax)
leaq -0x20(%rbp), %rdi
xorl %esi, %esi
callq 0x5ab60
movq %rax, -0x30(%rbp)
jmp 0x592d3
movb $0x1, -0x11(%rbp)
testb $0x1, -0x11(%rbp)
jne 0x5954b
movq -0x78(%rbp), %rdi
callq 0x5a6b0
movq -0x70(%rbp), %rax
addq $0xe0, %rsp
popq %rbp
retq
nopl (%rax,%rax)