// File: /workspace/github_cpp_makefile_star2_O2/luisremis[P]SDFS/main.cpp
// Function: listeningCin(Membership*, FileSystem*)
void listeningCin(Membership* m, FileSystem* fs)
{
    std::string input;
    while (true)
    {
        std::cout << "Type a command (help for a list): ";
        // getline(std::cin, input);
        std::cin >> input;
        //std::cout << "You entered: " << input << std::endl;

        if (input.compare("help") == 0 || input.compare("h") == 0)
        {
            std::cout << "quit      (q)     - Exit normally" << std::endl;
            std::cout << "table     (t)     - Table of Membership List" << std::endl;
            std::cout << "join      (j)     - Join the system" << std::endl;
            std::cout << "leave     (l)     - Leave the system" << std::endl;
            std::cout << "leader    (ml)    - Leave the system" << std::endl;
            std::cout << "netstat   (n)     - Network usage" << std::endl;
            std::cout << "vtable    (vt)    - List the virtual ring for the filesystem" << std::endl;
            std::cout << "put       (p)     - Insert a file (put localfile remotefile)" << std::endl;
            std::cout << "get       (g)     - Get a file  (get remotefile localfile)" << std::endl;
            std::cout << "rm        ()      - Remove a file  (rm remotefile)" << std::endl;
            std::cout << "stored    ()      - List files in the present node" << std::endl;
        }
        else if (input.compare("quit") == 0 || input.compare("q") == 0)
        {
            std::cout << "Exiting normally " << std::endl;
            break;
        }
        else if (input.compare("clear") == 0 || input.compare("c") == 0)
        {
            system("clear");
        }
        else if (input.compare("table") == 0 || input.compare("t") == 0)
        {
            std::cout << m->printMember();
        }
        else if (input.compare("leave") == 0 || input.compare("l") == 0)
        {
            m->leave();
        }
        else if (input.compare("join") == 0 || input.compare("j") == 0)
        {
            m->join();
        }
        else if (input.compare("leader") == 0 || input.compare("ml") == 0)
        {
            std::cout << m->getLeader() << std::endl;
        }
        else if (input.compare("netstat") == 0 || input.compare("n") == 0)
        {
            std::cout << "UDP Stats: Sent: " << getUDPSent();
            std::cout << " Received: " << getUDPReceived() << std::endl;
        }
        else if (input.compare("put") == 0 || input.compare("p") == 0)
        {
            std::string localfile;
            std::string remotefile;
            std::cin >> localfile;
            std::cin >> remotefile;

            fs->put(localfile, remotefile);
        }
        else if (input.compare("get") == 0 || input.compare("g") == 0)
        {
            std::string localfile;
            std::string remotefile;
            std::cin >> remotefile;
            std::cin >> localfile;

            fs->get(localfile, remotefile);
        }
        else if (input.compare("vtable") == 0 || input.compare("vt") == 0)
        {
            fs->printVirtualRing();
        }
        else if (input.compare("rm") == 0)
        {
            std::string remotefile;
            std::cin >> remotefile;
            fs->deleteFromFS(remotefile);
        }
        else if (input.compare("list") == 0)
        {
            std::string remotefile;
            std::cin >> remotefile;
            fs->where(remotefile);
        }
        else if (input.compare("stored") == 0 || input.compare("s") == 0)
        {
            std::cout << "Local Files List: " << std::endl;
            std::cout << fs->getFileList() << std::endl;
        }
        else{
            std::cout << "PLEASE CHECK AGAIN THE POSSIBLE OPTIONS" << std::endl;
        }

    }

    return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movq %rsi, -0x50(%rbp)
movq %rdi, -0x58(%rbp)
leaq -0x108(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq 0x116ce(%rip), %r15     # 0x15fc0
movq 0x116df(%rip), %r13     # 0x15fd8
leaq -0x118(%rbp), %rbx
leaq 0xa720(%rip), %r14      # 0xf027
movq %r15, %rdi
leaq 0xa6f3(%rip), %rsi      # 0xf004
callq 0x4370
movq %r13, %rdi
movq %rbx, %rsi
callq 0x43f0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4120
testl %eax, %eax
je 0x4bb5
movq %rbx, %rdi
leaq 0xa6ee(%rip), %rsi      # 0xf02c
callq 0x4120
testl %eax, %eax
je 0x4bb5
movq %rbx, %rdi
leaq 0xa8d3(%rip), %rsi      # 0xf228
callq 0x4120
testl %eax, %eax
je 0x4f38
movq %rbx, %rdi
leaq 0xa8c1(%rip), %rsi      # 0xf22d
callq 0x4120
testl %eax, %eax
je 0x4f38
movq %rbx, %rdi
leaq 0xa8be(%rip), %rsi      # 0xf241
callq 0x4120
testl %eax, %eax
je 0x4cb7
movq %rbx, %rdi
leaq 0xa8ad(%rip), %rsi      # 0xf247
callq 0x4120
testl %eax, %eax
je 0x4cb7
movq %rbx, %rdi
leaq 0xa8de(%rip), %rsi      # 0xf28f
callq 0x4120
testl %eax, %eax
je 0x4cc8
movq %rbx, %rdi
leaq 0xa89e(%rip), %rsi      # 0xf266
callq 0x4120
testl %eax, %eax
je 0x4cc8
movq %rbx, %rdi
leaq 0xa86a(%rip), %rsi      # 0xf249
callq 0x4120
testl %eax, %eax
je 0x4cf0
movq %rbx, %rdi
leaq 0xaf55(%rip), %rsi      # 0xf94b
callq 0x4120
testl %eax, %eax
je 0x4cf0
movq %rbx, %rdi
leaq 0xa842(%rip), %rsi      # 0xf24f
callq 0x4120
testl %eax, %eax
je 0x4cfe
movq %rbx, %rdi
leaq 0xa830(%rip), %rsi      # 0xf254
callq 0x4120
testl %eax, %eax
je 0x4cfe
movq %rbx, %rdi
leaq 0xa81b(%rip), %rsi      # 0xf256
callq 0x4120
testl %eax, %eax
je 0x4d0c
movq %rbx, %rdi
leaq 0xa80b(%rip), %rsi      # 0xf25d
callq 0x4120
testl %eax, %eax
je 0x4d0c
movq %rbx, %rdi
leaq 0xa7f7(%rip), %rsi      # 0xf260
callq 0x4120
testl %eax, %eax
je 0x4d3d
movq %rbx, %rdi
leaq 0xa9ae(%rip), %rsi      # 0xf42e
callq 0x4120
testl %eax, %eax
je 0x4d3d
movq %rbx, %rdi
leaq 0xa7ef(%rip), %rsi      # 0xf286
callq 0x4120
testl %eax, %eax
je 0x4d84
movq %rbx, %rdi
leaq 0xa57c(%rip), %rsi      # 0xf02a
callq 0x4120
testl %eax, %eax
je 0x4d84
movq %rbx, %rdi
leaq 0xa7c5(%rip), %rsi      # 0xf28a
callq 0x4120
testl %eax, %eax
je 0x4e01
movq %rbx, %rdi
leaq 0xa837(%rip), %rsi      # 0xf313
callq 0x4120
testl %eax, %eax
je 0x4e01
movq %rbx, %rdi
leaq 0xa79b(%rip), %rsi      # 0xf28e
callq 0x4120
testl %eax, %eax
je 0x4e97
movq %rbx, %rdi
leaq 0xa78b(%rip), %rsi      # 0xf295
callq 0x4120
testl %eax, %eax
je 0x4e97
movq %rbx, %rdi
leaq 0xa777(%rip), %rsi      # 0xf298
callq 0x4120
testl %eax, %eax
je 0x4ea5
movq %rbx, %rdi
leaq 0xa999(%rip), %rsi      # 0xf4d1
callq 0x4120
testl %eax, %eax
je 0x4eed
movq %rbx, %rdi
leaq 0xa74c(%rip), %rsi      # 0xf29b
callq 0x4120
testl %eax, %eax
je 0x4b76
movq %rbx, %rdi
leaq 0xaf14(%rip), %rsi      # 0xfa76
callq 0x4120
leaq 0xa747(%rip), %rsi      # 0xf2b5
testl %eax, %eax
jne 0x4ca2
movq %r15, %rdi
leaq 0xa722(%rip), %rsi      # 0xf2a2
callq 0x4370
movq %rax, %rdi
callq 0x41d0
leaq -0x48(%rbp), %r12
movq %r12, %rdi
movq -0x50(%rbp), %rsi
callq 0xb728
movq %r15, %rdi
movq %r12, %rsi
callq 0x4300
movq %rax, %rdi
callq 0x41d0
jmp 0x4d2f
movq %r15, %rdi
leaq 0xa46f(%rip), %rsi      # 0xf02e
callq 0x4370
movq %rax, %rdi
callq 0x41d0
movq %r15, %rdi
leaq 0xa47a(%rip), %rsi      # 0xf050
callq 0x4370
movq %rax, %rdi
callq 0x41d0
movq %r15, %rdi
leaq 0xa490(%rip), %rsi      # 0xf07d
callq 0x4370
movq %rax, %rdi
callq 0x41d0
movq %r15, %rdi
leaq 0xa49d(%rip), %rsi      # 0xf0a1
callq 0x4370
movq %rax, %rdi
callq 0x41d0
movq %r15, %rdi
leaq 0xa4ab(%rip), %rsi      # 0xf0c6
callq 0x4370
movq %rax, %rdi
callq 0x41d0
movq %r15, %rdi
leaq 0xa4b9(%rip), %rsi      # 0xf0eb
callq 0x4370
movq %rax, %rdi
callq 0x41d0
movq %r15, %rdi
leaq 0xa4c4(%rip), %rsi      # 0xf10d
callq 0x4370
movq %rax, %rdi
callq 0x41d0
movq %r15, %rdi
leaq 0xa4ea(%rip), %rsi      # 0xf14a
callq 0x4370
movq %rax, %rdi
callq 0x41d0
movq %r15, %rdi
leaq 0xa510(%rip), %rsi      # 0xf187
callq 0x4370
movq %rax, %rdi
callq 0x41d0
movq %r15, %rdi
leaq 0xa534(%rip), %rsi      # 0xf1c2
callq 0x4370
movq %rax, %rdi
callq 0x41d0
leaq 0xa553(%rip), %rsi      # 0xf1f5
movq %r15, %rdi
callq 0x4370
movq %rax, %rdi
callq 0x41d0
jmp 0x4907
leaq 0xa583(%rip), %rdi      # 0xf241
callq 0x42e0
jmp 0x4907
leaq -0x48(%rbp), %r12
movq %r12, %rdi
movq -0x58(%rbp), %rsi
callq 0x7c16
movq %r15, %rdi
movq %r12, %rsi
callq 0x4300
movq %r12, %rdi
callq 0x41b0
jmp 0x4907
movq -0x58(%rbp), %rdi
callq 0x6b30
jmp 0x4907
movq -0x58(%rbp), %rdi
callq 0x5816
jmp 0x4907
leaq -0x48(%rbp), %r12
movq %r12, %rdi
movq -0x58(%rbp), %rsi
callq 0x7fa8
movq %r15, %rdi
movq %r12, %rsi
callq 0x4300
movq %rax, %rdi
callq 0x41d0
leaq -0x48(%rbp), %rdi
callq 0x41b0
jmp 0x4907
movq %r15, %rdi
leaq 0xa521(%rip), %rsi      # 0xf268
callq 0x4370
movq %rax, %r12
callq 0xdb1b
movq %r12, %rdi
movl %eax, %esi
callq 0x45a0
movq %r15, %rdi
leaq 0xa512(%rip), %rsi      # 0xf27a
callq 0x4370
movq %rax, %r12
callq 0xdb27
movq %r12, %rdi
movl %eax, %esi
callq 0x45a0
jmp 0x4caa
leaq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
andq $0x0, -0x40(%rbp)
xorl %ecx, %ecx
movb %cl, -0x38(%rbp)
leaq -0x68(%rbp), %rax
movq %rax, -0x78(%rbp)
andq $0x0, -0x70(%rbp)
movb %cl, -0x68(%rbp)
movq %r13, %rdi
leaq -0x48(%rbp), %rsi
callq 0x43f0
movq %r13, %rdi
leaq -0x78(%rbp), %rsi
callq 0x43f0
leaq -0x158(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x4450
leaq -0xf8(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x4450
movq -0x50(%rbp), %rdi
leaq -0x158(%rbp), %r12
movq %r12, %rsi
leaq -0xf8(%rbp), %rdx
callq 0xa52a
leaq -0xf8(%rbp), %rdi
jmp 0x4e7c
leaq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
andq $0x0, -0x40(%rbp)
xorl %ecx, %ecx
movb %cl, -0x38(%rbp)
leaq -0x68(%rbp), %rax
movq %rax, -0x78(%rbp)
andq $0x0, -0x70(%rbp)
movb %cl, -0x68(%rbp)
movq %r13, %rdi
leaq -0x78(%rbp), %rsi
callq 0x43f0
movq %r13, %rdi
leaq -0x48(%rbp), %rsi
callq 0x43f0
leaq -0x138(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x4450
leaq -0xd8(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x4450
movq -0x50(%rbp), %rdi
leaq -0x138(%rbp), %r12
movq %r12, %rsi
leaq -0xd8(%rbp), %rdx
callq 0xab62
leaq -0xd8(%rbp), %rdi
callq 0x41b0
movq %r12, %rdi
callq 0x41b0
leaq -0x78(%rbp), %rdi
callq 0x41b0
jmp 0x4d2f
movq -0x50(%rbp), %rdi
callq 0xbd3a
jmp 0x4907
leaq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
andq $0x0, -0x40(%rbp)
movb $0x0, -0x38(%rbp)
movq %r13, %rdi
leaq -0x48(%rbp), %r12
movq %r12, %rsi
callq 0x43f0
leaq -0xb8(%rbp), %rdi
movq %r12, %rsi
callq 0x4450
leaq -0xb8(%rbp), %rsi
movq -0x50(%rbp), %rdi
callq 0xaeb8
leaq -0xb8(%rbp), %rdi
jmp 0x4e8d
leaq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
andq $0x0, -0x40(%rbp)
movb $0x0, -0x38(%rbp)
movq %r13, %rdi
leaq -0x48(%rbp), %r12
movq %r12, %rsi
callq 0x43f0
leaq -0x98(%rbp), %rdi
movq %r12, %rsi
callq 0x4450
leaq -0x98(%rbp), %rsi
movq -0x50(%rbp), %rdi
callq 0xa7b4
leaq -0x98(%rbp), %rdi
jmp 0x4e8d
movq 0x11081(%rip), %rdi     # 0x15fc0
leaq 0xa2e9(%rip), %rsi      # 0xf22f
callq 0x4370
movq %rax, %rdi
callq 0x41d0
leaq -0x118(%rbp), %rdi
callq 0x41b0
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x98(%rbp), %rdi
jmp 0x4fd9
jmp 0x4ff6
jmp 0x4fe6
movq %rax, %rbx
leaq -0xb8(%rbp), %rdi
jmp 0x4fd9
jmp 0x4fe6
jmp 0x4fe6
movq %rax, %rbx
leaq -0xd8(%rbp), %rdi
callq 0x41b0
jmp 0x4fa5
movq %rax, %rbx
leaq -0x138(%rbp), %rdi
jmp 0x4fc9
movq %rax, %rbx
leaq -0xf8(%rbp), %rdi
callq 0x41b0
jmp 0x4fc2
movq %rax, %rbx
leaq -0x158(%rbp), %rdi
callq 0x41b0
jmp 0x4fd5
jmp 0x4fd2
movq %rax, %rbx
leaq -0x78(%rbp), %rdi
callq 0x41b0
jmp 0x4fe9
jmp 0x4ff6
jmp 0x4fe6
jmp 0x4ff6
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
callq 0x41b0
jmp 0x4ff9
jmp 0x4ff6
movq %rax, %rbx
leaq -0x118(%rbp), %rdi
callq 0x41b0
movq %rbx, %rdi
callq 0x45d0