// File: girdhari9[P]mTORRENT/ClientConnection.cpp
// Function: BitVectorRequestToServers(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int, int, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void BitVectorRequestToServers(string IPaddress, int PORT, int thread_n,int TotalPacket, string SHA){
    int sock = Connection(IPaddress,PORT);

    int BitMapRequest = 1;
    send(sock , &BitMapRequest , sizeof(int) , 0 );
    send(sock , &TotalPacket , sizeof(int) , 0 );
    send(sock, SHA.c_str(), sizeof(SHA), 0);

    char recvBuffer[TotalPacket];
    memset(&recvBuffer, '\0',TotalPacket);
    int ack = 1, AvlPack;

    read(sock, recvBuffer, TotalPacket);
    read(sock, &AvlPack, sizeof(int));
    send(sock , &ack , sizeof(int) , 0 );

    string BitString = (string)recvBuffer;
    sem_wait(&mutex1);
        TotalAvlPack.insert(make_pair(AvlPack,thread_n));
        PacketNoAvl[thread_n] = BitString;
    sem_post(&mutex1);
    return ;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movl %esi, %eax
movq %rdi, %rsi
movq %r8, -0xc0(%rbp)
movq %rsi, -0x8(%rbp)
movl %eax, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl %ecx, -0x14(%rbp)
movq %r8, -0x20(%rbp)
leaq -0x48(%rbp), %rdi
movq %rdi, -0xb8(%rbp)
callq 0x4200
movq -0xb8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0xd920
movl %eax, -0xac(%rbp)
jmp 0xca7f
leaq -0x48(%rbp), %rdi
callq 0x47e8
movl -0xac(%rbp), %eax
movl %eax, -0x24(%rbp)
movl $0x1, -0x58(%rbp)
movl -0x24(%rbp), %edi
leaq -0x58(%rbp), %rsi
movl $0x4, %edx
movq %rdx, -0xe0(%rbp)
xorl %ecx, %ecx
movl %ecx, -0xd4(%rbp)
callq 0x4230
movq -0xe0(%rbp), %rdx
movl -0xd4(%rbp), %ecx
movl -0x24(%rbp), %edi
leaq -0x14(%rbp), %rsi
callq 0x4230
movq -0xc0(%rbp), %rdi
movl -0x24(%rbp), %eax
movl %eax, -0xe4(%rbp)
callq 0x41f0
movl -0xe4(%rbp), %edi
movl -0xd4(%rbp), %ecx
movq %rax, %rsi
movl $0x20, %edx
callq 0x4230
movl -0xd4(%rbp), %esi
movl -0x14(%rbp), %eax
movq %rsp, %rcx
movq %rcx, -0x60(%rbp)
movq %rax, %rcx
addq $0xf, %rcx
andq $-0x10, %rcx
movq %rsp, %rdi
subq %rcx, %rdi
movq %rdi, -0xd0(%rbp)
movq %rdi, %rsp
movq %rax, -0x68(%rbp)
movslq -0x14(%rbp), %rdx
callq 0x4260
movq -0xd0(%rbp), %rsi
movl $0x1, -0x6c(%rbp)
movl -0x24(%rbp), %edi
movslq -0x14(%rbp), %rdx
callq 0x45c0
movq -0xe0(%rbp), %rdx
movl -0x24(%rbp), %edi
leaq -0x70(%rbp), %rsi
callq 0x45c0
movq -0xe0(%rbp), %rdx
movl -0xd4(%rbp), %ecx
movl -0x24(%rbp), %edi
leaq -0x6c(%rbp), %rsi
callq 0x4230
leaq -0x91(%rbp), %rdi
movq %rdi, -0xc8(%rbp)
callq 0x4710
movq -0xd0(%rbp), %rsi
movq -0xc8(%rbp), %rdx
leaq -0x90(%rbp), %rdi
callq 0x6d90
jmp 0xcbac
leaq -0x91(%rbp), %rdi
callq 0x4450
leaq 0x14df1(%rip), %rdi     # 0x219b0
callq 0x4280
jmp 0xcbc6
leaq -0x70(%rbp), %rdi
leaq -0x10(%rbp), %rsi
callq 0xe1e0
movq %rax, -0xf0(%rbp)
jmp 0xcbdc
movq -0xf0(%rbp), %rax
movq %rax, -0x9c(%rbp)
leaq 0x14e17(%rip), %rdi     # 0x21a08
leaq -0x9c(%rbp), %rsi
callq 0xe1b0
movq %rax, -0xf8(%rbp)
jmp 0xcc06
movq -0xf8(%rbp), %rax
movq %rax, -0xa8(%rbp)
leaq 0x14dbd(%rip), %rdi     # 0x219d8
leaq -0x10(%rbp), %rsi
callq 0xe210
movq %rax, -0x100(%rbp)
jmp 0xcc2d
movq -0x100(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x4050
jmp 0xcc42
leaq 0x14d67(%rip), %rdi     # 0x219b0
callq 0x46a0
leaq -0x90(%rbp), %rdi
callq 0x47e8
movq -0x60(%rbp), %rax
movq %rax, %rsp
movq %rbp, %rsp
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x47e8
jmp 0xccaf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x91(%rbp), %rdi
callq 0x4450
jmp 0xccaf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x47e8
movq -0x50(%rbp), %rdi
callq 0x4700
nopl (%rax,%rax)