// File: luisremis[P]SDFS/FileSystem.cpp
// Function: FileSystem::deleteFromFS(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void FileSystem::deleteFromFS(std::string remoteFile)
{
    // hashing function to find the machine/s where to store the file;
    
    int fileKey = hashString(remoteFile);
    int position = findPositionByKey(fileKey);

    // cout<<"delete " << fileKey << " from "<<position<<" "<<virtualRing[position].ip_str<<" "<<virtualRing[position].key<<endl;

    bool attempt = deleteFromNode( position, remoteFile );
    if( !attempt)
    {
        std::cout << "Problem removing at position " << position << std::endl;
    }
    
    attempt = deleteFromNode( position+1, remoteFile );
    //if(attempt)
        //return;
    
    attempt = deleteFromNode( position+2, remoteFile );
    //if(attempt)
        //return;


    //std::string destAddress = "localhost";
    //put(destAddress, localFile, remoteFile);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movq %rsi, -0xd8(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xd0(%rbp)
leaq -0x38(%rbp), %rdi
movq %rdi, -0xe8(%rbp)
callq 0x41e0
movq -0xe8(%rbp), %rdi
callq 0x10600
movq -0xe8(%rbp), %rdi
movl %eax, -0xdc(%rbp)
callq 0x42a0
movl -0xdc(%rbp), %eax
movq -0xd0(%rbp), %rdi
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %esi
callq 0x11010
movq -0xd8(%rbp), %rsi
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
movl %eax, -0xc4(%rbp)
leaq -0x60(%rbp), %rdi
movq %rdi, -0xc0(%rbp)
callq 0x41e0
movq -0xd0(%rbp), %rdi
movl -0xc4(%rbp), %esi
movq -0xc0(%rbp), %rdx
callq 0x11760
movb %al, -0xb1(%rbp)
jmp 0x1319f
leaq -0x60(%rbp), %rdi
callq 0x42a0
movb -0xb1(%rbp), %al
andb $0x1, %al
movb %al, -0x3d(%rbp)
testb $0x1, -0x3d(%rbp)
jne 0x13202
movq 0x13e00(%rip), %rdi     # 0x26fc0
leaq 0x9939(%rip), %rsi      # 0x1cb00
callq 0x43f0
movq %rax, %rdi
movl -0x3c(%rbp), %esi
callq 0x4670
movq %rax, %rdi
movq 0x13dc7(%rip), %rsi     # 0x26fa8
callq 0x4410
jmp 0x13202
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x42a0
jmp 0x132f8
movq -0xd8(%rbp), %rsi
movl -0x3c(%rbp), %eax
incl %eax
movl %eax, -0xfc(%rbp)
leaq -0x90(%rbp), %rdi
movq %rdi, -0xf8(%rbp)
callq 0x41e0
movq -0xd0(%rbp), %rdi
movl -0xfc(%rbp), %esi
movq -0xf8(%rbp), %rdx
callq 0x11760
movb %al, -0xe9(%rbp)
jmp 0x13248
movb -0xe9(%rbp), %al
andb $0x1, %al
movb %al, -0x3d(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x42a0
movq -0xd8(%rbp), %rsi
movl -0x3c(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x10c(%rbp)
leaq -0xb0(%rbp), %rdi
movq %rdi, -0x108(%rbp)
callq 0x41e0
movq -0xd0(%rbp), %rdi
movl -0x10c(%rbp), %esi
movq -0x108(%rbp), %rdx
callq 0x11760
movb %al, -0xfd(%rbp)
jmp 0x132a6
movb -0xfd(%rbp), %al
andb $0x1, %al
movb %al, -0x3d(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x42a0
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x42a0
jmp 0x132f8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x42a0
movq -0x68(%rbp), %rdi
callq 0x46a0
nopw %cs:(%rax,%rax)