// File: mahdibohloul[P]SnapTrip/./Models/Hotel.cpp
// Function: Database::Hotel::booked_out(Database::User*, int, int, int, int)
Database::Hotel::v_room Database::Hotel::booked_out(User* user, int type, int quantity, int check_in, int check_out)
{
    v_room booked_rooms = v_room();
    int q = 0;
    for(auto room_itr = rooms.begin(); room_itr != rooms.end() && q < quantity; room_itr++)
    {
        if(in_range(*room_itr, check_in, check_out, type)){
            q++;
            (*room_itr)->booked(check_in, check_out);
            booked_rooms.push_back(*room_itr);
        }
    }
    int night_stay = ((check_out - check_in) < ConstNames::One_Night) ? ConstNames::One_Night : (check_out - check_in);
    user->pay_cost(night_stay * cost_to_reserve(type, quantity));
    user->add_reserve_case(this, booked_rooms, check_in, check_out, night_stay * cost_to_reserve(type, quantity));
    return booked_rooms;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdi, -0x78(%rbp)
movq %rdi, %rax
movq %rax, -0x80(%rbp)
movl 0x10(%rbp), %eax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movl %r8d, -0x20(%rbp)
movl %r9d, -0x24(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x70(%rbp)
movb $0x0, -0x25(%rbp)
xorl %esi, %esi
movl $0x18, %edx
callq 0x6250
movq -0x78(%rbp), %rdi
callq 0x5a5a0
movq -0x70(%rbp), %rdi
movl $0x0, -0x2c(%rbp)
addq $0xe0, %rdi
callq 0x5a930
movq %rax, -0x38(%rbp)
movq -0x70(%rbp), %rdi
addq $0xe0, %rdi
callq 0x5a9a0
movq %rax, -0x40(%rbp)
leaq -0x38(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x5a960
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x81(%rbp)
jne 0x5907e
jmp 0x5908d
movl -0x2c(%rbp), %eax
cmpl -0x20(%rbp), %eax
setl %al
movb %al, -0x81(%rbp)
movb -0x81(%rbp), %al
testb $0x1, %al
jne 0x5909c
jmp 0x5913d
leaq -0x38(%rbp), %rdi
callq 0x5a9d0
movq -0x70(%rbp), %rdi
movq (%rax), %rsi
movl -0x24(%rbp), %edx
movl 0x10(%rbp), %ecx
movl -0x1c(%rbp), %r8d
callq 0x58eb0
movb %al, -0x82(%rbp)
jmp 0x590c3
movb -0x82(%rbp), %al
testb $0x1, %al
jne 0x590cf
jmp 0x59127
movl -0x2c(%rbp), %eax
incl %eax
movl %eax, -0x2c(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x5a9d0
movq (%rax), %rdi
movl -0x24(%rbp), %esi
movl 0x10(%rbp), %edx
movq (%rdi), %rax
movq 0x38(%rax), %rax
callq *%rax
jmp 0x590f4
leaq -0x38(%rbp), %rdi
callq 0x5a9d0
movq -0x78(%rbp), %rdi
movq %rax, %rsi
callq 0x5a9f0
jmp 0x5910b
jmp 0x59127
movq -0x78(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
callq 0x552f0
jmp 0x59239
jmp 0x59129
leaq -0x38(%rbp), %rdi
xorl %esi, %esi
callq 0x5aa60
movq %rax, -0x58(%rbp)
jmp 0x5904c
movl 0x10(%rbp), %eax
subl -0x24(%rbp), %eax
cmpl $0x1, %eax
jge 0x59155
movl $0x1, %eax
movl %eax, -0x88(%rbp)
jmp 0x59161
movl 0x10(%rbp), %eax
subl -0x24(%rbp), %eax
movl %eax, -0x88(%rbp)
movq -0x70(%rbp), %rdi
movl -0x88(%rbp), %eax
movl %eax, -0x5c(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0xa0(%rbp)
movl -0x5c(%rbp), %eax
movl %eax, -0x60(%rbp)
fildl -0x60(%rbp)
fstpt -0x94(%rbp)
movl -0x1c(%rbp), %esi
movl -0x20(%rbp), %edx
callq 0x58f10
movq -0xa0(%rbp), %rdi
fldt -0x94(%rbp)
fmulp %st, %st(1)
movq %rsp, %rax
fstpt (%rax)
callq 0x679a0
jmp 0x591ae
movq -0x70(%rbp), %rdi
movq -0x18(%rbp), %rax
movq %rax, -0xc0(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0xb4(%rbp)
movl 0x10(%rbp), %eax
movl %eax, -0xb0(%rbp)
movl -0x5c(%rbp), %eax
movl %eax, -0x64(%rbp)
fildl -0x64(%rbp)
fstpt -0xac(%rbp)
movl -0x1c(%rbp), %esi
movl -0x20(%rbp), %edx
callq 0x58f10
movq -0xc0(%rbp), %rdi
movq -0x70(%rbp), %rsi
movq -0x78(%rbp), %rdx
movl -0xb4(%rbp), %ecx
movl -0xb0(%rbp), %r8d
fldt -0xac(%rbp)
fmulp %st, %st(1)
movq %rsp, %rax
fstpt (%rax)
callq 0x678f0
jmp 0x59219
movb $0x1, -0x25(%rbp)
testb $0x1, -0x25(%rbp)
jne 0x5922c
movq -0x78(%rbp), %rdi
callq 0x552f0
movq -0x80(%rbp), %rax
addq $0xd0, %rsp
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0x6750
nopw %cs:(%rax,%rax)