// File: luisremis[P]SDFS/Membership.cpp
// Function: Membership::getAdress(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void Membership::getAdress(std::string filename)
{
	logFile<<"getAdress:" << std::endl;
    std::ifstream addFile(filename);

    std::string str;
    int i=0; 

    address.clear();
    
    while(!addFile.eof())
    {
        getline(addFile, str);
        address.push_back(str);
        struct hostent *server = gethostbyname(str.c_str());

        struct in_addr addr;
        char ip[20];
        memcpy(&addr, server->h_addr_list[0], sizeof(struct in_addr)); 
        strcpy(ip,inet_ntoa(addr));
        
        std::string ip_str (ip);

        struct Node newnode;
        //newnode.name = str;
        newnode.ip_str = ip_str;

        nodes.push_back(newnode);
        
        logFile << "read node " << i++ << " from addr file: " << str << " : " << ip_str << std::endl;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x330, %rsp            # imm = 0x330
movq %rsi, -0x2d8(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x2d0(%rbp)
leaq 0x15d16(%rip), %rsi     # 0x1c3f2
callq 0x43f0
movq %rax, %rdi
movq 0x208bd(%rip), %rsi     # 0x26fa8
callq 0x4410
movq -0x2d8(%rbp), %rsi
leaq -0x218(%rbp), %rdi
movl $0x8, %edx
callq 0x45f0
leaq -0x238(%rbp), %rdi
callq 0x4520
movq -0x2d0(%rbp), %rdi
movl $0x0, -0x23c(%rbp)
addq $0x200, %rdi            # imm = 0x200
callq 0xb9c0
movq -0x218(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x218(%rbp,%rax), %rdi
callq 0x4700
movb %al, -0x2d9(%rbp)
jmp 0x6751
movb -0x2d9(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x6762
jmp 0x69c3
leaq -0x218(%rbp), %rdi
leaq -0x238(%rbp), %rsi
callq 0x40e0
jmp 0x6777
movq -0x2d0(%rbp), %rdi
addq $0x200, %rdi            # imm = 0x200
leaq -0x238(%rbp), %rsi
callq 0xb9e0
jmp 0x6793
leaq -0x238(%rbp), %rdi
callq 0x41d0
movq %rax, %rdi
callq 0x4450
movq %rax, -0x2e8(%rbp)
jmp 0x67b0
movq -0x2e8(%rbp), %rax
movq %rax, -0x258(%rbp)
movq -0x258(%rbp), %rax
movq 0x18(%rax), %rax
movq (%rax), %rax
movl (%rax), %eax
movl %eax, -0x25c(%rbp)
movl -0x25c(%rbp), %eax
movl %eax, -0x274(%rbp)
movl -0x274(%rbp), %edi
callq 0x4200
movq %rax, %rsi
leaq -0x270(%rbp), %rdi
movq %rdi, -0x2f8(%rbp)
callq 0x43b0
leaq -0x299(%rbp), %rdi
movq %rdi, -0x2f0(%rbp)
callq 0x46b0
movq -0x2f8(%rbp), %rsi
movq -0x2f0(%rbp), %rdx
leaq -0x298(%rbp), %rdi
callq 0x4510
jmp 0x6830
leaq -0x299(%rbp), %rdi
callq 0x4430
leaq -0x2c8(%rbp), %rdi
movq %rdi, -0x300(%rbp)
callq 0xb570
movq -0x300(%rbp), %rdi
leaq -0x298(%rbp), %rsi
callq 0x4050
jmp 0x6864
movq -0x2d0(%rbp), %rdi
addq $0x218, %rdi            # imm = 0x218
leaq -0x2c8(%rbp), %rsi
callq 0xba50
jmp 0x6880
movq -0x2d0(%rbp), %rdi
leaq 0x15b6f(%rip), %rsi     # 0x1c3fd
callq 0x43f0
movq %rax, -0x308(%rbp)
jmp 0x689c
movq -0x308(%rbp), %rdi
movl -0x23c(%rbp), %esi
movl %esi, %eax
incl %eax
movl %eax, -0x23c(%rbp)
callq 0x4670
movq %rax, -0x310(%rbp)
jmp 0x68c1
movq -0x310(%rbp), %rdi
leaq 0x15b39(%rip), %rsi     # 0x1c408
callq 0x43f0
movq %rax, -0x318(%rbp)
jmp 0x68dd
movq -0x318(%rbp), %rdi
leaq -0x238(%rbp), %rsi
callq 0x4370
movq %rax, -0x320(%rbp)
jmp 0x68f9
movq -0x320(%rbp), %rdi
leaq 0x15b13(%rip), %rsi     # 0x1c41a
callq 0x43f0
movq %rax, -0x328(%rbp)
jmp 0x6915
movq -0x328(%rbp), %rdi
leaq -0x298(%rbp), %rsi
callq 0x4370
movq %rax, -0x330(%rbp)
jmp 0x6931
movq -0x330(%rbp), %rdi
movq 0x20669(%rip), %rsi     # 0x26fa8
callq 0x4410
jmp 0x6946
leaq -0x2c8(%rbp), %rdi
callq 0xb7f0
leaq -0x298(%rbp), %rdi
callq 0x42a0
jmp 0x6731
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x248(%rbp)
movl %eax, -0x24c(%rbp)
jmp 0x69e4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x248(%rbp)
movl %eax, -0x24c(%rbp)
leaq -0x299(%rbp), %rdi
callq 0x4430
jmp 0x69e4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x248(%rbp)
movl %eax, -0x24c(%rbp)
leaq -0x2c8(%rbp), %rdi
callq 0xb7f0
leaq -0x298(%rbp), %rdi
callq 0x42a0
jmp 0x69e4
leaq -0x238(%rbp), %rdi
callq 0x42a0
leaq -0x218(%rbp), %rdi
callq 0x4120
addq $0x330, %rsp            # imm = 0x330
popq %rbp
retq
leaq -0x238(%rbp), %rdi
callq 0x42a0
leaq -0x218(%rbp), %rdi
callq 0x4120
movq -0x248(%rbp), %rdi
callq 0x46a0
nopl (%rax,%rax)