// File: gty980218[P]ee450/hospitalC.cpp
// Function: ready(int, Hospital&)
void ready(int sock,Hospital& hospital){
    //initialize schedular's address
    struct sockaddr_in scheaddr;
    memset(&scheaddr, 0, sizeof(scheaddr));
    scheaddr.sin_family=AF_INET;
    scheaddr.sin_port=htons(33188);
    scheaddr.sin_addr.s_addr=inet_addr("127.0.0.1");
    socklen_t schelen=sizeof(scheaddr);

    //send occupancy and capability
    char buff[8]={0};
    stringstream ss;
    ss<<hospital.capacity<<" "<<hospital.occupancy<<endl;
    string str=ss.str();
    strcpy(buff,str.c_str());
    sendto(sock, buff, sizeof(buff), 0, (struct sockaddr*)&scheaddr, schelen);

    cout<<"Hospital C is up and running using UDP on port 32188"<<endl;
    cout<<"Hospital C has total capacity "<<hospital.capacity<<" and initial occupancy "<<hospital.occupancy<<endl;
    cout<<"------------------------------------------------------------------------------------------------"<<endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x240, %rsp            # imm = 0x240
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x20(%rbp)
movw $0x2, -0x20(%rbp)
movl $0x81a4, %edi           # imm = 0x81A4
callq 0x2040
movw %ax, -0x1e(%rbp)
leaq 0x34a7(%rip), %rdi      # 0x609b
callq 0x2270
movl %eax, -0x1c(%rbp)
movl $0x10, -0x24(%rbp)
movq $0x0, -0x30(%rbp)
leaq -0x1b8(%rbp), %rdi
callq 0x21a0
leaq -0x1a8(%rbp), %rdi
movq -0x10(%rbp), %rax
movl (%rax), %esi
callq 0x23e0
movq %rax, -0x1f0(%rbp)
jmp 0x2c32
movq -0x1f0(%rbp), %rdi
leaq 0x3647(%rip), %rsi      # 0x6287
callq 0x2250
movq %rax, -0x1f8(%rbp)
jmp 0x2c4e
movq -0x1f8(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x4(%rax), %esi
callq 0x23e0
movq %rax, -0x200(%rbp)
jmp 0x2c6a
movq -0x200(%rbp), %rdi
movq 0x6348(%rip), %rsi      # 0x8fc0
callq 0x22a0
jmp 0x2c7f
leaq -0x1e8(%rbp), %rdi
leaq -0x1b8(%rbp), %rsi
callq 0x2240
jmp 0x2c94
leaq -0x1e8(%rbp), %rdi
callq 0x2110
movq %rax, %rsi
leaq -0x30(%rbp), %rdi
movq %rdi, -0x208(%rbp)
callq 0x2230
movq -0x208(%rbp), %rsi
movl -0x4(%rbp), %edi
movl -0x24(%rbp), %r9d
movl $0x8, %edx
xorl %ecx, %ecx
leaq -0x20(%rbp), %r8
callq 0x2050
jmp 0x2cd3
movq 0x62f6(%rip), %rdi      # 0x8fd0
leaq 0x33c4(%rip), %rsi      # 0x60a5
callq 0x2250
movq %rax, -0x210(%rbp)
jmp 0x2cef
movq -0x210(%rbp), %rdi
movq 0x62c3(%rip), %rsi      # 0x8fc0
callq 0x22a0
jmp 0x2d04
movq 0x62c5(%rip), %rdi      # 0x8fd0
leaq 0x33c8(%rip), %rsi      # 0x60da
callq 0x2250
movq %rax, -0x218(%rbp)
jmp 0x2d20
movq -0x218(%rbp), %rdi
movq -0x10(%rbp), %rax
movl (%rax), %esi
callq 0x23e0
movq %rax, -0x220(%rbp)
jmp 0x2d3b
movq -0x220(%rbp), %rdi
leaq 0x33b0(%rip), %rsi      # 0x60f9
callq 0x2250
movq %rax, -0x228(%rbp)
jmp 0x2d57
movq -0x228(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x4(%rax), %esi
callq 0x23e0
movq %rax, -0x230(%rbp)
jmp 0x2d73
movq -0x230(%rbp), %rdi
movq 0x623f(%rip), %rsi      # 0x8fc0
callq 0x22a0
jmp 0x2d88
movq 0x6241(%rip), %rdi      # 0x8fd0
leaq 0x337b(%rip), %rsi      # 0x6111
callq 0x2250
movq %rax, -0x238(%rbp)
jmp 0x2da4
movq -0x238(%rbp), %rdi
movq 0x620e(%rip), %rsi      # 0x8fc0
callq 0x22a0
jmp 0x2db9
leaq -0x1e8(%rbp), %rdi
callq 0x2150
leaq -0x1b8(%rbp), %rdi
callq 0x21c0
addq $0x240, %rsp            # imm = 0x240
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1c0(%rbp)
movl %eax, -0x1c4(%rbp)
jmp 0x2e0c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1c0(%rbp)
movl %eax, -0x1c4(%rbp)
leaq -0x1e8(%rbp), %rdi
callq 0x2150
leaq -0x1b8(%rbp), %rdi
callq 0x21c0
movq -0x1c0(%rbp), %rdi
callq 0x23f0
nopw %cs:(%rax,%rax)