// File: luisremis[P]SDFS/Membership.cpp
// Function: Membership::failMember(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int)
int Membership::failMember(std::string ip_str, int timeStamp){

    membersLock.lock();

    bool exist = false;
    int position = 0;

    for(int i=0; i<members.size(); i++){
        if( members[i].ip_str.compare( ip_str )==0 && members[i].timeStamp == timeStamp ){
            exist = true;
            position = i;
            break;
        }
    }
    
    if(exist){
        MemberUpdateMsg msg(MSG_LEAVE, members[position]);
        pushMsgToFileSysQueue(msg);

        members.erase( members.begin()+position );
    }
    
    membersLock.unlock();

    checkLeader();

    return !exist;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
movq %rsi, -0xf8(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0xf0(%rbp)
addq $0x230, %rdi            # imm = 0x230
callq 0xb5f0
movb $0x0, -0x15(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movq -0xf0(%rbp), %rdi
movslq -0x20(%rbp), %rax
movq %rax, -0x100(%rbp)
addq $0x258, %rdi            # imm = 0x258
callq 0xb990
movq %rax, %rcx
movq -0x100(%rbp), %rax
cmpq %rcx, %rax
jae 0x9019
movq -0xf0(%rbp), %rdi
addq $0x258, %rdi            # imm = 0x258
movslq -0x20(%rbp), %rsi
callq 0xb8d0
movq -0xf8(%rbp), %rsi
movq %rax, %rdi
callq 0x4040
cmpl $0x0, %eax
jne 0x9009
movq -0xf0(%rbp), %rdi
addq $0x258, %rdi            # imm = 0x258
movslq -0x20(%rbp), %rsi
callq 0xb8d0
movl 0x20(%rax), %eax
cmpl -0x14(%rbp), %eax
jne 0x9009
movb $0x1, -0x15(%rbp)
movl -0x20(%rbp), %eax
movl %eax, -0x1c(%rbp)
jmp 0x9019
jmp 0x900b
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x8f86
testb $0x1, -0x15(%rbp)
je 0x917a
movq -0xf0(%rbp), %rdi
addq $0x258, %rdi            # imm = 0x258
movslq -0x1c(%rbp), %rsi
callq 0xb8d0
movq %rax, %rsi
leaq -0x80(%rbp), %rdi
movq %rdi, -0x108(%rbp)
callq 0xb8f0
movq -0x108(%rbp), %rdx
leaq -0x58(%rbp), %rdi
movl $0x7, %esi
callq 0xb160
jmp 0x9064
leaq -0x80(%rbp), %rdi
callq 0xb7f0
leaq -0xc8(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0xb1d0
jmp 0x907f
movq -0xf0(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x8840
jmp 0x9094
leaq -0xc8(%rbp), %rdi
callq 0xb930
movq -0xf0(%rbp), %rdi
addq $0x258, %rdi            # imm = 0x258
movq %rdi, -0x118(%rbp)
callq 0xbd70
movq %rax, -0xe0(%rbp)
movslq -0x1c(%rbp), %rsi
leaq -0xe0(%rbp), %rdi
callq 0xbda0
movq %rax, -0xd8(%rbp)
leaq -0xd0(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0xbde0
movq -0x118(%rbp), %rdi
movq -0xd0(%rbp), %rsi
callq 0xbd00
movq %rax, -0x110(%rbp)
jmp 0x9107
movq -0x110(%rbp), %rax
movq %rax, -0xe8(%rbp)
leaq -0x58(%rbp), %rdi
callq 0xb930
jmp 0x917a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x80(%rbp), %rdi
callq 0xb7f0
jmp 0x91ac
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x916f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0xb930
leaq -0x58(%rbp), %rdi
callq 0xb930
jmp 0x91ac
movq -0xf0(%rbp), %rdi
addq $0x230, %rdi            # imm = 0x230
callq 0xb620
movq -0xf0(%rbp), %rdi
callq 0xa380
movb -0x15(%rbp), %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
movq -0x88(%rbp), %rdi
callq 0x46a0
nopl (%rax,%rax)