LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/vianna274[P]dropbox/src/Operations.cpp
// Function: Dropbox::Operations::sendUploadAll(Dropbox::WrapperSocket*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::vector<Dropbox::_FileRecord, std::allocator<Dropbox::_FileRecord>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void Operations::sendUploadAll(WrapperSocket * socket, string dirPath, vector<FileRecord> files, string username) {
	if(files.empty()) {
		this->sendNothing(socket);
        return;
    }
	MessageData packet = make_packet(TYPE_SEND_UPLOAD_ALL, 1, 1, -1, "send_upload_all");
	socket->send(&packet);
    int seq = 1;
    for(FileRecord record : files) {
		this->sendFile(socket, dirPath + record.filename, record, username);
        seq++;
    }
	packet = make_packet(TYPE_SEND_UPLOAD_ALL_DONE, 1, 1, -1, "send_upload_all_done");
	socket->send(&packet);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x21e8, %rsp           # imm = 0x21E8
movq %r8, -0x40(%rbp)
movq %rdx, -0x38(%rbp)
movq %rsi, %r15
movq (%rcx), %rax
cmpq 0x8(%rcx), %rax
je 0x6a30
movq %rcx, %rbx
leaq 0x59e1(%rip), %r9       # 0xc2f7
leaq -0x211c(%rbp), %r14
pushq $0x9
popq %rsi
pushq $0x1
popq %rcx
pushq $-0x1
popq %r8
movq %r14, %rdi
movl %ecx, %edx
callq 0x57f0
movq %r15, -0x30(%rbp)
movq %r15, %rdi
movq %r14, %rsi
callq 0xb850
movq (%rbx), %r12
movq 0x8(%rbx), %rax
movq %rax, -0x48(%rbp)
leaq -0x1148(%rbp), %r13
leaq -0x88(%rbp), %rbx
leaq -0x170(%rbp), %r14
leaq -0x68(%rbp), %r15
cmpq -0x48(%rbp), %r12
je 0x69d9
movl $0xe8, %edx
movq %r13, %rdi
movq %r12, %rsi
callq 0x3280
movq %rbx, %rdi
movq -0x38(%rbp), %rsi
movq %r13, %rdx
callq 0x6c5b
movl $0xe8, %edx
movq %r14, %rdi
movq %r13, %rsi
callq 0x3280
movq %r15, %rdi
movq -0x40(%rbp), %rsi
callq 0x33d0
pushq $0x1d
popq %rcx
movq %rsp, %rdi
movq %r14, %rsi
rep  movsq (%rsi), %es:(%rdi)
movq -0x30(%rbp), %rsi
movq %rbx, %rdx
movq %r15, %rcx
callq 0x5bd2
movq %r15, %rdi
callq 0x3170
movq %rbx, %rdi
callq 0x3170
addq $0xe8, %r12
jmp 0x6964
leaq 0x5927(%rip), %r9       # 0xc307
leaq -0x1148(%rbp), %rbx
pushq $0xa
popq %rsi
pushq $0x1
popq %rcx
pushq $-0x1
popq %r8
movq %rbx, %rdi
movl %ecx, %edx
callq 0x57f0
leaq -0x211c(%rbp), %r14
movl $0xfd4, %edx            # imm = 0xFD4
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3280
movq -0x30(%rbp), %rdi
movq %r14, %rsi
callq 0xb850
addq $0x21e8, %rsp           # imm = 0x21E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r15, %rsi
addq $0x21e8, %rsp           # imm = 0x21E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6a6e
movq %rax, %rbx
jmp 0x6a5a
movq %rax, %rbx
leaq -0x68(%rbp), %rdi
callq 0x3170
leaq -0x88(%rbp), %rdi
callq 0x3170
movq %rbx, %rdi
callq 0x3540
// File: /workspace/github_cpp_makefile_star2_O2/vianna274[P]dropbox/src/Server.cpp
// Function: Dropbox::Server::Server(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
Server::Server(string ipLocal) : connectClientSocket(SERVER_PORT), listenToServersSocket(BACKUPS_PORT)
{
    this->isMain = true;
    this->ipLocal = ipLocal;
    this->ipMain = ipLocal;
    this->backups = {};
    this->usersIp = {};
    this->backupsSockets = {};
    this->status = STATUS_NORMAL;
    initializeUsers();
    initializePorts();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %r15
movq %rdi, %rbx
callq 0x58b4
leaq 0x56f1(%rip), %rsi      # 0xc3a8
leaq -0x29(%rbp), %rdx
movq %rbx, %rdi
callq 0x3130
leaq 0x20(%rbx), %rdi
leaq 0xe8(%rbx), %r14
movl $0xc8, %edx
xorl %esi, %esi
callq 0x3220
movq %r14, %rdi
movl $0xfa0, %esi            # imm = 0xFA0
callq 0xb4da
movq %r14, -0x58(%rbp)
leaq 0x130(%rbx), %rdi
movq %rdi, -0x50(%rbp)
movl $0x2328, %esi           # imm = 0x2328
callq 0xb4da
leaq 0x958(%rbx), %rax
movq %rax, -0x48(%rbp)
leaq 0x970(%rbx), %rax
movq %rax, -0x40(%rbp)
leaq 0x988(%rbx), %rax
movq %rax, -0x38(%rbp)
leaq 0x9c8(%rbx), %rax
xorps %xmm0, %xmm0
movups %xmm0, 0x9a8(%rbx)
movups %xmm0, 0x998(%rbx)
movups %xmm0, 0x988(%rbx)
movups %xmm0, 0x978(%rbx)
movups %xmm0, 0x968(%rbx)
movups %xmm0, 0x958(%rbx)
movq %rax, 0x9b8(%rbx)
andq $0x0, 0x9c0(%rbx)
leaq 0x9a0(%rbx), %r14
xorl %eax, %eax
movb %al, 0x9c8(%rbx)
leaq 0x9e8(%rbx), %rcx
movq %rcx, 0x9d8(%rbx)
andq $0x0, 0x9e0(%rbx)
leaq 0x9b8(%rbx), %r13
leaq 0x9d8(%rbx), %r12
movb %al, 0x9e8(%rbx)
movb $0x1, 0x9f8(%rbx)
movq %r13, %rdi
movq %r15, %rsi
callq 0x3210
movq %r12, %rdi
movq %r15, %rsi
callq 0x3210
movq -0x40(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0xa036
movq -0x38(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0xa036
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0xa768
movl $0x18, 0x180(%rbx)
movq %rbx, %rdi
callq 0x6e6c
movq %rbx, %rdi
callq 0x715e
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r15
jmp 0x6e52
movq %rax, %r15
jmp 0x6e5b
movq %rax, %r15
movq %r12, %rdi
callq 0x3170
movq %r13, %rdi
callq 0x3170
movq %r14, %rdi
callq 0xa4c6
movq -0x38(%rbp), %rdi
callq 0xa056
movq -0x40(%rbp), %rdi
callq 0xa056
movq -0x48(%rbp), %rdi
callq 0xa478
movq -0x50(%rbp), %rdi
callq 0xb4c4
movq -0x58(%rbp), %rdi
callq 0xb4c4
movq %rbx, %rdi
callq 0x3170
movq %r15, %rdi
callq 0x3540
nop
// File: /workspace/github_cpp_makefile_star2_O2/vianna274[P]dropbox/src/Server.cpp
// Function: Dropbox::Server::makeConnection()
void Server::makeConnection(){
    MessageData packet = make_packet(TYPE_MAKE_BACKUP, 1, 1, -1, ipLocal.c_str());
    talkToPrimaryMtx.lock();
    talkToPrimary->send(&packet);
    talkToPrimaryMtx.unlock();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0xfd8, %rsp            # imm = 0xFD8
movq %rdi, %rbx
movq 0x9b8(%rdi), %r9
leaq -0xfec(%rbp), %r14
pushq $0x10
popq %rsi
pushq $0x1
popq %rcx
pushq $-0x1
popq %r8
movq %r14, %rdi
movl %ecx, %edx
callq 0x57f0
leaq 0xc0(%rbx), %r15
movq %r15, %rdi
callq 0x50d8
movq 0x178(%rbx), %rdi
movq %r14, %rsi
callq 0xb850
movq %r15, %rdi
callq 0x3250
addq $0xfd8, %rsp            # imm = 0xFD8
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/vianna274[P]dropbox/src/Server.cpp
// Function: Dropbox::Server::removeFromBackup(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void Server::removeFromBackup(vector<string> backups, string main) {
    vector<string>::iterator it = backups.begin();
    vector<string> newBackups;
    for(it; it != backups.end(); it++) {
        if (main.compare(*it) == 0) {
            // it = backups.erase(it);
        } else {
            newBackups.push_back(*it);
        }
    }
    this->backups.clear();
    for(string backup: newBackups) {
        this->backups.push_back(backup);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq (%rsi), %r12
xorps %xmm0, %xmm0
leaq -0x40(%rbp), %r13
movaps %xmm0, (%r13)
andq $0x0, 0x10(%r13)
cmpq 0x8(%r15), %r12
je 0x819e
movq %r14, %rdi
movq %r12, %rsi
callq 0x3040
testl %eax, %eax
je 0x8198
movq %r13, %rdi
movq %r12, %rsi
callq 0xa22e
addq $0x20, %r12
jmp 0x8178
addq $0x970, %rbx            # imm = 0x970
movq %rbx, %rdi
callq 0xa26a
movq -0x40(%rbp), %r14
movq -0x38(%rbp), %r12
leaq -0x60(%rbp), %r15
cmpq %r12, %r14
je 0x81e2
movq %r15, %rdi
movq %r14, %rsi
callq 0x33d0
movq %rbx, %rdi
movq %r15, %rsi
callq 0xa22e
movq %r15, %rdi
callq 0x3170
addq $0x20, %r14
jmp 0x81b9
leaq -0x40(%rbp), %rdi
callq 0xa056
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x820a
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
callq 0x3170
jmp 0x820d
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
callq 0xa056
movq %rbx, %rdi
callq 0x3540
// File: /workspace/github_cpp_makefile_star2_O2/vianna274[P]dropbox/src/Server.cpp
// Function: Dropbox::Server::propagateNewBoss()
void Server::propagateNewBoss() {
    for (string ip : this->usersIp) {
        WrapperSocket userSocket(ip, 10000);
        MessageData packet = make_packet(TYPE_NEW_BOSS, 1, 1, -1, this->ipLocal.c_str());
        userSocket.send(&packet);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1078, %rsp           # imm = 0x1078
movq 0x988(%rdi), %r14
movq %rdi, -0x30(%rbp)
movq 0x990(%rdi), %rax
movq %rax, -0x38(%rbp)
leaq -0x78(%rbp), %r15
leaq -0x58(%rbp), %r12
leaq -0xc0(%rbp), %r13
leaq -0x1094(%rbp), %rbx
cmpq -0x38(%rbp), %r14
je 0x838e
movq %r15, %rdi
movq %r14, %rsi
callq 0x33d0
movq %r12, %rdi
movq %r15, %rsi
callq 0x33d0
movq %r13, %rdi
movq %r12, %rsi
movl $0x2710, %edx           # imm = 0x2710
callq 0xb422
movq %r12, %rdi
callq 0x3170
movq -0x30(%rbp), %rax
movq 0x9b8(%rax), %r9
movq %rbx, %rdi
pushq $0x13
popq %rsi
pushq $0x1
popq %rcx
movl %ecx, %edx
pushq $-0x1
popq %r8
callq 0x57f0
movq %r13, %rdi
movq %rbx, %rsi
callq 0xb850
movq %r13, %rdi
callq 0xb4c4
movq %r15, %rdi
callq 0x3170
addq $0x20, %r14
jmp 0x831a
addq $0x1078, %rsp           # imm = 0x1078
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x83c2
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
callq 0x3170
jmp 0x83c2
movq %rax, %rbx
leaq -0xc0(%rbp), %rdi
callq 0xb4c4
leaq -0x78(%rbp), %rdi
callq 0x3170
movq %rbx, %rdi
callq 0x3540
nop
// File: /workspace/github_cpp_makefile_star2_O2/vianna274[P]dropbox/src/Server.cpp
// Function: Dropbox::Server::becomeMain()
void Server::becomeMain() {
    backupList.lock();
    for(string ip : this->backups) {
        WrapperSocket socket(ip, 9000);
        MessageData packet = make_packet(TYPE_COORDINATOR, 1, 1, ipLocal.size(), ipLocal.c_str());
        socket.send(&packet, 100);
    }
    backupList.unlock();
    this->isMain = true;
    this->electionMutex.lock();
    this->status = STATUS_COORDINATOR;
    this->electionMutex.unlock();
    this->propagateNewBoss();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1078, %rsp           # imm = 0x1078
movq %rdi, %rbx
addq $0x98, %rdi
movq %rdi, -0x38(%rbp)
callq 0x50d8
movq 0x970(%rbx), %r15
movq %rbx, -0x30(%rbp)
movq 0x978(%rbx), %rax
movq %rax, -0x40(%rbp)
leaq -0x80(%rbp), %r14
leaq -0xc8(%rbp), %rbx
leaq -0x109c(%rbp), %r12
cmpq -0x40(%rbp), %r15
je 0x853e
leaq -0x60(%rbp), %r13
movq %r13, %rdi
movq %r15, %rsi
callq 0x33d0
movq %r14, %rdi
movq %r13, %rsi
callq 0x33d0
movq %rbx, %rdi
movq %r14, %rsi
movl $0x2328, %edx           # imm = 0x2328
callq 0xb422
movq %r14, %rdi
callq 0x3170
movq -0x30(%rbp), %rax
movl 0x9c0(%rax), %r8d
movq 0x9b8(%rax), %r9
movq %r12, %rdi
pushq $0x15
popq %rsi
pushq $0x1
popq %rcx
movl %ecx, %edx
callq 0x57f0
movq %rbx, %rdi
movq %r12, %rsi
pushq $0x64
popq %rdx
callq 0xb5a8
movq %rbx, %rdi
callq 0xb4c4
leaq -0x60(%rbp), %rdi
callq 0x3170
addq $0x20, %r15
jmp 0x84bf
movq -0x38(%rbp), %rdi
callq 0x3250
movq -0x30(%rbp), %rbx
movb $0x1, 0x9f8(%rbx)
leaq 0x20(%rbx), %r14
movq %r14, %rdi
callq 0x50d8
movl $0x1a, 0x180(%rbx)
movq %r14, %rdi
callq 0x3250
movq %rbx, %rdi
callq 0x82da
addq $0x1078, %rsp           # imm = 0x1078
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x85ac
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
callq 0x3170
jmp 0x85ac
movq %rax, %rbx
leaq -0xc8(%rbp), %rdi
callq 0xb4c4
leaq -0x60(%rbp), %rdi
callq 0x3170
movq %rbx, %rdi
callq 0x3540
nop
// File: /workspace/github_cpp_makefile_star2_O2/vianna274[P]dropbox/src/Server.cpp
// Function: Dropbox::Server::getHighers[abi:cxx11]()
vector<string> Server::getHighers() {
    vector<string> highers;
    backupList.lock();
    removeFromBackup(this->backups, this->ipMain);
    for(string ip : this->backups) {
        if (ip > ipLocal)
            highers.push_back(ip);
    }
    backupList.unlock();
    return highers;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rsi, %r14
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
leaq 0x98(%rsi), %rdi
movq %rdi, -0x30(%rbp)
callq 0x50d8
leaq 0x970(%r14), %rsi
leaq -0x48(%rbp), %rdi
callq 0xa1da
leaq 0x9d8(%r14), %rsi
leaq -0x68(%rbp), %rdi
callq 0x33d0
leaq -0x48(%rbp), %rsi
leaq -0x68(%rbp), %rdx
movq %r14, %rdi
callq 0x814a
leaq -0x68(%rbp), %rdi
callq 0x3170
leaq -0x48(%rbp), %rdi
callq 0xa056
movq 0x970(%r14), %r12
movq 0x978(%r14), %r15
addq $0x9b8, %r14            # imm = 0x9B8
leaq -0x88(%rbp), %r13
cmpq %r15, %r12
je 0x8686
movq %r13, %rdi
movq %r12, %rsi
callq 0x33d0
movq %r13, %rdi
movq %r14, %rsi
callq 0xa2aa
testb %al, %al
je 0x8678
movq %rbx, %rdi
movq %r13, %rsi
callq 0xa22e
movq %r13, %rdi
callq 0x3170
addq $0x20, %r12
jmp 0x864e
movq -0x30(%rbp), %rdi
callq 0x3250
movq %rbx, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
leaq -0x68(%rbp), %rdi
callq 0x3170
jmp 0x86b2
movq %rax, %r14
leaq -0x48(%rbp), %rdi
callq 0xa056
jmp 0x86d3
jmp 0x86d0
movq %rax, %r14
leaq -0x88(%rbp), %rdi
callq 0x3170
jmp 0x86d3
movq %rax, %r14
movq %rbx, %rdi
callq 0xa056
movq %r14, %rdi
callq 0x3540
nop
// File: /workspace/github_cpp_makefile_star2_O2/vianna274[P]dropbox/src/Server.cpp
// Function: Dropbox::Server::sendHighersElection(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>)
void Server::sendHighersElection(vector<string> highers) {
    for(string higher : highers) {
        WrapperSocket socket(higher, 9000);
        MessageData packet = make_packet(TYPE_ELECTION, 1, 1, ipLocal.size(), ipLocal.c_str());
        socket.send(&packet);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1078, %rsp           # imm = 0x1078
movq %rdi, -0x30(%rbp)
movq (%rsi), %r14
movq 0x8(%rsi), %rax
movq %rax, -0x38(%rbp)
leaq -0x78(%rbp), %r13
leaq -0xc0(%rbp), %rbx
leaq -0x1094(%rbp), %r15
cmpq -0x38(%rbp), %r14
je 0x8795
leaq -0x58(%rbp), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0x33d0
movq %r13, %rdi
movq %r12, %rsi
callq 0x33d0
movq %rbx, %rdi
movq %r13, %rsi
movl $0x2328, %edx           # imm = 0x2328
callq 0xb422
movq %r13, %rdi
callq 0x3170
movq -0x30(%rbp), %rax
movl 0x9c0(%rax), %r8d
movq 0x9b8(%rax), %r9
movq %r15, %rdi
pushq $0x14
popq %rsi
pushq $0x1
popq %rcx
movl %ecx, %edx
callq 0x57f0
movq %rbx, %rdi
movq %r15, %rsi
callq 0xb850
movq %rbx, %rdi
callq 0xb4c4
leaq -0x58(%rbp), %rdi
callq 0x3170
addq $0x20, %r14
jmp 0x8719
addq $0x1078, %rsp           # imm = 0x1078
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x87c9
movq %rax, %rbx
leaq -0x78(%rbp), %rdi
callq 0x3170
jmp 0x87c9
movq %rax, %rbx
leaq -0xc0(%rbp), %rdi
callq 0xb4c4
leaq -0x58(%rbp), %rdi
callq 0x3170
movq %rbx, %rdi
callq 0x3540
// File: /workspace/github_cpp_makefile_star2_O2/vianna274[P]dropbox/src/Server.cpp
// Function: Dropbox::Server::startElection(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>)
void Server::startElection(vector<string> highers)
{
    this->electionMutex.lock();
    this->status = STATUS_ELECTION;
    this->electionMutex.unlock();
    this->sendHighersElection(highers);
    if (this->waitForAnswer()) {
        if (this->waitForCoordinator() || this->status == STATUS_NOT_YET)
            return;
        this->becomeMain();
    }
    this->becomeMain();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x20(%rdi), %r15
movq %r15, %rdi
callq 0x50d8
movl $0x19, 0x180(%rbx)
movq %r15, %rdi
callq 0x3250
leaq -0x30(%rbp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0xa1da
movq %rbx, %rdi
movq %r15, %rsi
callq 0x86e4
leaq -0x30(%rbp), %rdi
callq 0xa056
movq %rbx, %rdi
callq 0x887e
testb %al, %al
je 0x8857
movq %rbx, %rdi
callq 0x88fc
testb %al, %al
jne 0x885f
cmpl $0x1b, 0x180(%rbx)
je 0x885f
movq %rbx, %rdi
callq 0x8470
movq %rbx, %rdi
callq 0x8470
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0xa056
movq %rbx, %rdi
callq 0x3540
// File: /workspace/github_cpp_makefile_star2_O2/vianna274[P]dropbox/src/Server.cpp
// Function: Dropbox::Server::waitForAnswer()
bool Server::waitForAnswer()
{
    while(true) {
        MessageData * res = this->listenToServersSocket.receive(TIMEOUT_ON, 1500);
        if (res == NULL)
            return false;
        cout << res->type << endl;
        if (res->type == TYPE_ANSWER) {
            return true;
        }
        if (res->type == TYPE_COORDINATOR) {
            handleReceiveCoordinator(res);
            return true;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x130(%rdi), %r14
pushq $0x1
popq %r15
movq 0x8727(%rip), %r12      # 0x10fc8
movq %r14, %rdi
movl %r15d, %esi
movl $0x5dc, %edx            # imm = 0x5DC
callq 0xb734
movq %rax, %r13
testq %rax, %rax
je 0x88e6
movl (%r13), %esi
movq %r12, %rdi
callq 0x3500
movq %rax, %rdi
callq 0x31c0
movl (%r13), %eax
cmpl $0x16, %eax
je 0x88e6
cmpl $0x15, %eax
jne 0x88a1
movq %rbx, %rdi
movq %r13, %rsi
callq 0x8aa4
testq %r13, %r13
setne %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/vianna274[P]dropbox/src/Server.cpp
// Function: Dropbox::Server::waitForCoordinator()
bool Server::waitForCoordinator()
{
    while(true) {
        MessageData * res = this->listenToServersSocket.receive(TIMEOUT_ON, 1500);
        if (res == NULL)
            return false;
        if (res->type == TYPE_COORDINATOR) {
            handleReceiveCoordinator(res);
            return true;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
leaq 0x130(%rdi), %r14
pushq $0x1
popq %r15
movq %r14, %rdi
movl %r15d, %esi
movl $0x5dc, %edx            # imm = 0x5DC
callq 0xb734
movq %rax, %r12
testq %rax, %rax
je 0x893f
cmpl $0x15, (%r12)
jne 0x8915
movq %rbx, %rdi
movq %r12, %rsi
callq 0x8aa4
testq %r12, %r12
setne %al
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/vianna274[P]dropbox/src/Server.cpp
// Function: Dropbox::Server::createNewPortBackup(Dropbox::WrapperSocket*)
void Server::createNewPortBackup(WrapperSocket * socket)
{
    int newPort = getAvailablePort();
    MessageData packet = make_packet(TYPE_MAKE_CONNECTION, 1, 1, -1, to_string(newPort).c_str());
    WrapperSocket * newSocket = new WrapperSocket(newPort);
    socket->send(&packet);
    thread listenToBackupThread(&Server::listenToServers, this, newSocket);
    listenToBackupThread.detach();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x1010, %rsp           # imm = 0x1010
movq %rsi, %r14
movq %rdi, %rbx
callq 0x8a46
movl %eax, %r15d
leaq -0x58(%rbp), %r12
movq %r12, %rdi
movl %eax, %esi
callq 0x5249
movq (%r12), %r9
leaq -0x102c(%rbp), %rdi
pushq $0x2
popq %rsi
pushq $0x1
popq %rcx
pushq $-0x1
popq %r8
movl %ecx, %edx
callq 0x57f0
leaq -0x58(%rbp), %rdi
callq 0x3170
pushq $0x48
popq %rdi
callq 0x3320
movq %rax, %r12
movq %rax, %rdi
movl %r15d, %esi
callq 0xb4da
leaq -0x38(%rbp), %r15
movq %r12, (%r15)
leaq -0x102c(%rbp), %rsi
movq %r14, %rdi
callq 0xb850
leaq -0x1434(%rip), %rax     # 0x75a0
leaq -0x58(%rbp), %rsi
movq %rax, (%rsi)
andq $0x0, 0x8(%rsi)
leaq -0x30(%rbp), %rdx
movq %rbx, (%rdx)
leaq -0x28(%rbp), %rbx
movq %rbx, %rdi
movq %r15, %rcx
callq 0xa2c2
movq %rbx, %rdi
callq 0x3530
leaq -0x28(%rbp), %rdi
callq 0x50c8
addq $0x1010, %rsp           # imm = 0x1010
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x28(%rbp), %rdi
callq 0x50c8
jmp 0x8a3e
movq %rax, %rbx
movq %r12, %rdi
callq 0x32f0
jmp 0x8a3e
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
callq 0x3170
movq %rbx, %rdi
callq 0x3540
// File: /workspace/github_cpp_makefile_star2_O2/vianna274[P]dropbox/src/Server.cpp
// Function: Dropbox::Server::getAvailablePort()
int Server::getAvailablePort()
{
    portsMutex.lock();
    for(int p = FIRST_PORT; p <= LAST_PORT; p++){
        int i = p - FIRST_PORT;
        if(portsAvailable[i]){
            portsAvailable[i] = false;
            portsMutex.unlock();
            return p;
        }
    }
    portsMutex.unlock();
    return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
leaq 0x70(%rdi), %rbx
movq %rbx, %rdi
callq 0x50d8
xorl %eax, %eax
pushq $-0x1
popq %r15
cmpq $0x7d0, %rax            # imm = 0x7D0
je 0x8a8d
cmpb $0x0, 0x184(%r14,%rax)
jne 0x8a7d
incq %rax
jmp 0x8a65
leal 0xfa1(%rax), %r15d
movb $0x0, 0x184(%r14,%rax)
movq %rbx, %rdi
callq 0x3250
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/vianna274[P]dropbox/src/Server.cpp
// Function: Dropbox::Server::handleReceiveCoordinator(Dropbox::_MessageData*)
void Server::handleReceiveCoordinator(MessageData * res) {
    this->electionMutex.lock();
    this->status = STATUS_NOT_YET;
    this->electionMutex.unlock();
    backupList.lock();
    removeFromBackup(this->backups, this->ipMain);
    backupList.unlock();
    this->ipMain = string(res->payload);
    talkToPrimaryMtx.lock();
    this->talkToPrimary = new WrapperSocket(ipMain, 9000);
    synchronize();
    talkToPrimaryMtx.unlock();
    this->makeConnection();
    this->electionMutex.lock();
    this->status = STATUS_NORMAL;
    this->electionMutex.unlock();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rsi, %r12
movq %rdi, %r14
leaq 0x20(%rdi), %rbx
movq %rbx, %rdi
callq 0x50d8
movl $0x1b, 0x180(%r14)
movq %rbx, %rdi
callq 0x3250
leaq 0x98(%r14), %r13
movq %r13, %rdi
callq 0x50d8
leaq 0x970(%r14), %rsi
leaq -0x48(%rbp), %rdi
callq 0xa1da
leaq 0x9d8(%r14), %r15
leaq -0x88(%rbp), %rdi
movq %r15, %rsi
callq 0x33d0
leaq -0x48(%rbp), %rsi
leaq -0x88(%rbp), %rdx
movq %r14, %rdi
callq 0x814a
leaq -0x88(%rbp), %rdi
callq 0x3170
leaq -0x48(%rbp), %rdi
callq 0xa056
movq %r13, %rdi
callq 0x3250
addq $0x14, %r12
leaq -0xa8(%rbp), %r13
leaq -0x29(%rbp), %rdx
movq %r13, %rdi
movq %r12, %rsi
callq 0x3130
movq %r15, %rdi
movq %r13, %rsi
callq 0x3380
movq %r13, %rdi
callq 0x3170
leaq 0xc0(%r14), %r12
movq %r12, %rdi
callq 0x50d8
pushq $0x48
popq %rdi
callq 0x3320
movq %rax, %r13
leaq -0x68(%rbp), %rdi
movq %r15, %rsi
callq 0x33d0
leaq -0x68(%rbp), %rsi
movq %r13, %rdi
movl $0x2328, %edx           # imm = 0x2328
callq 0xb422
movq %r13, 0x178(%r14)
leaq -0x68(%rbp), %rdi
callq 0x3170
callq 0x8c38
movq %r12, %rdi
callq 0x3250
movq %r14, %rdi
callq 0x7d66
movq %rbx, %rdi
callq 0x50d8
movl $0x18, 0x180(%r14)
movq %rbx, %rdi
callq 0x3250
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x68(%rbp), %rdi
callq 0x3170
jmp 0x8c09
movq %rax, %rbx
movq %r13, %rdi
callq 0x32f0
jmp 0x8c30
movq %rax, %rbx
leaq -0x88(%rbp), %rdi
callq 0x3170
jmp 0x8c27
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
callq 0xa056
movq %rbx, %rdi
callq 0x3540
// File: /workspace/github_cpp_makefile_star2_O2/vianna274[P]dropbox/src/Server.cpp
// Function: Dropbox::Server::getUser(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
User* Server::getUser(string username)
{
    for(unsigned i = 0; i < users.size(); i++){
        if(users[i]->getUsername() == username){
            return users[i];
        }
    }
    return nullptr;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r15
movq %rdi, %r14
leaq -0x48(%rbp), %r12
xorl %eax, %eax
movl %eax, %ebx
movq 0x958(%r14), %rax
movq 0x960(%r14), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rbx, %rcx
jbe 0x8cc6
movq (%rax,%rbx,8), %rsi
movq %r12, %rdi
callq 0xb34a
movq %r12, %rdi
movq %r15, %rsi
callq 0x52a9
movl %eax, %r13d
movq %r12, %rdi
callq 0x3170
leal 0x1(%rbx), %eax
testb %r13b, %r13b
je 0x8c73
movq 0x958(%r14), %rax
movq (%rax,%rbx,8), %rax
jmp 0x8cc8
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/vianna274[P]dropbox/src/Server.cpp
// Function: Dropbox::Server::propagateConnection(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void Server::propagateConnection(string username, string userIp)
{   
    propagationMutex.lock();
    MessageData packet = make_packet(TYPE_CREATE_USER, 1, 1, -1, userIp.c_str(), username.c_str());
    for(WrapperSocket * socket : this->backupsSockets) {
        socket->send(&packet);
    }
    propagationMutex.unlock();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xfe0, %rsp            # imm = 0xFE0
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
leaq 0x48(%rdi), %rbx
movq %rbx, %rdi
callq 0x50d8
movq (%r14), %r9
movq (%r15), %rax
movq %rax, (%rsp)
leaq -0xff4(%rbp), %r14
pushq $0x12
popq %rsi
pushq $0x1
popq %rcx
pushq $-0x1
popq %r8
movq %r14, %rdi
movl %ecx, %edx
callq 0x5844
movq 0x9a0(%r12), %r15
movq 0x9a8(%r12), %r12
cmpq %r12, %r15
je 0x8e72
movq (%r15), %rdi
movq %r14, %rsi
callq 0xb850
addq $0x8, %r15
jmp 0x8e5c
movq %rbx, %rdi
callq 0x3250
addq $0xfe0, %rsp            # imm = 0xFE0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/vianna274[P]dropbox/src/Server.cpp
// Function: Dropbox::Server::propagateDelete(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void Server::propagateDelete(string filename, string username) 
{
    propagationMutex.lock();
    User * user = getUser(username);
    for(WrapperSocket * socket : this->backupsSockets) {
        this->sendDeleteFile(socket, filename.c_str(), username);
        user->removeFileRecord(filename);
    }
    propagationMutex.unlock();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rdx, %r14
movq %rsi, -0x38(%rbp)
movq %rdi, %r12
addq $0x48, %rdi
movq %rdi, -0x40(%rbp)
callq 0x50d8
leaq -0x80(%rbp), %rbx
movq %rbx, %rdi
movq %r14, -0x58(%rbp)
movq %r14, %rsi
callq 0x33d0
movq %r12, %rdi
movq %rbx, %rsi
callq 0x8c56
movq %rax, -0x48(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x3170
movq 0x9a0(%r12), %r14
movq %r12, -0x50(%rbp)
movq 0x9a8(%r12), %rax
movq %rax, -0x60(%rbp)
leaq -0xe0(%rbp), %r13
leaq -0xc0(%rbp), %rbx
leaq -0xa0(%rbp), %r12
cmpq -0x60(%rbp), %r14
je 0x9689
movq %r13, %rdi
movq (%r14), %r15
movq -0x38(%rbp), %rax
movq (%rax), %rsi
leaq -0x29(%rbp), %rdx
callq 0x3130
movq %rbx, %rdi
movq -0x58(%rbp), %rsi
callq 0x33d0
movq -0x50(%rbp), %rdi
movq %r15, %rsi
movq %r13, %rdx
movq %rbx, %rcx
callq 0x6afe
movq %rbx, %rdi
callq 0x3170
movq %r13, %rdi
callq 0x3170
movq %r12, %rdi
movq -0x38(%rbp), %rsi
callq 0x33d0
movq -0x48(%rbp), %rdi
movq %r12, %rsi
callq 0xb212
movq %r12, %rdi
callq 0x3170
addq $0x8, %r14
jmp 0x9619
movq -0x40(%rbp), %rdi
callq 0x3250
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
jmp 0x96d9
movq %rax, %rbx
jmp 0x96de
movq %rax, %rbx
jmp 0x96c6
movq %rax, %rbx
leaq -0xc0(%rbp), %rdi
callq 0x3170
leaq -0xe0(%rbp), %rdi
jmp 0x96d9
movq %rax, %rbx
leaq -0xa0(%rbp), %rdi
callq 0x3170
movq %rbx, %rdi
callq 0x3540
// File: /workspace/github_cpp_makefile_star2_O2/vianna274[P]dropbox/src/Server.cpp
// Function: Dropbox::Server::propagateFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void Server::propagateFile(string filename, string username) 
{
    propagationMutex.lock();
    User * user = getUser(username);
    for(WrapperSocket * socket : this->backupsSockets) {
        FileRecord record = this->getRecord(user->getFileRecords(),filename);
        this->sendFile(socket, user->getDirPath() + filename, record, username);
    }
    propagationMutex.unlock();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x3a8, %rsp            # imm = 0x3A8
movq %rdx, %r14
movq %rsi, -0x38(%rbp)
movq %rdi, %r13
addq $0x48, %rdi
movq %rdi, -0x40(%rbp)
callq 0x50d8
leaq -0xb8(%rbp), %rbx
movq %rbx, %rdi
movq %r14, -0x48(%rbp)
movq %r14, %rsi
callq 0x33d0
movq %r13, %rdi
movq %rbx, %rsi
callq 0x8c56
movq %rax, -0x30(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x3170
movq 0x9a0(%r13), %rcx
movq 0x9a8(%r13), %rax
movq %rax, -0x50(%rbp)
leaq -0x78(%rbp), %r15
leaq -0x2e8(%rbp), %r14
leaq -0xd8(%rbp), %r12
cmpq -0x50(%rbp), %rcx
je 0x9859
movq %r14, %rbx
movq %rcx, -0x58(%rbp)
movq (%rcx), %rax
movq %rax, -0x60(%rbp)
movq %r15, %rdi
movq -0x30(%rbp), %rsi
callq 0xb1f6
leaq -0x118(%rbp), %r14
movq %r14, %rdi
movq -0x38(%rbp), %rsi
callq 0x33d0
leaq -0x200(%rbp), %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %r14, %rcx
callq 0x5b56
movq %r14, %rdi
callq 0x3170
movq %r15, %rdi
callq 0x5508
leaq -0x98(%rbp), %r14
movq %r14, %rdi
movq -0x30(%rbp), %rsi
callq 0xb362
leaq -0xf8(%rbp), %r15
movq %r15, %rdi
movq %r14, %rsi
movq -0x38(%rbp), %rdx
callq 0xa440
movl $0xe8, %edx
movq %rbx, %r14
movq %rbx, %rdi
leaq -0x200(%rbp), %rsi
callq 0x3280
movq %r12, %rdi
movq -0x48(%rbp), %rsi
callq 0x33d0
pushq $0x1d
popq %rcx
movq %rsp, %rdi
movq %r14, %rsi
rep  movsq (%rsi), %es:(%rdi)
movq %r13, %rdi
movq -0x60(%rbp), %rsi
movq %r15, %rdx
movq %r12, %rcx
callq 0x5bd2
movq %r12, %rdi
callq 0x3170
movq %r15, %rdi
callq 0x3170
leaq -0x98(%rbp), %rdi
callq 0x3170
movq -0x58(%rbp), %rcx
addq $0x8, %rcx
leaq -0x78(%rbp), %r15
jmp 0x9766
movq -0x40(%rbp), %rdi
callq 0x3250
addq $0x3a8, %rsp            # imm = 0x3A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0xb8(%rbp), %rdi
jmp 0x98bd
movq %rax, %rbx
leaq -0x118(%rbp), %rdi
callq 0x3170
jmp 0x98c7
movq %rax, %rbx
jmp 0x98b6
movq %rax, %rbx
jmp 0x98aa
movq %rax, %rbx
leaq -0xd8(%rbp), %rdi
callq 0x3170
leaq -0xf8(%rbp), %rdi
callq 0x3170
leaq -0x98(%rbp), %rdi
callq 0x3170
jmp 0x98d0
movq %rax, %rbx
leaq -0x78(%rbp), %rdi
callq 0x5508
movq %rbx, %rdi
callq 0x3540
// File: /workspace/github_cpp_makefile_star2_O2/vianna274[P]dropbox/src/Server.cpp
// Function: Dropbox::Server::receiveAskUpdate(Dropbox::WrapperSocket*, Dropbox::User*)
void Server::receiveAskUpdate(WrapperSocket * socket, User * user) {
    vector<FileRecord> clientFiles = this->receiveFileList(socket);
    this->updateClient(this->getFileList(user->getDirPath()), clientFiles, socket, user);
    MessageData packet = make_packet(TYPE_REQUEST_UPDATE_DONE, 1, 1, sizeof("request_update_done"), "request_update_done");
	socket->send(&packet);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x1048, %rsp           # imm = 0x1048
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r15
leaq -0x60(%rbp), %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x66b4
leaq -0x80(%rbp), %rdi
movq %r14, %rsi
callq 0xb362
leaq -0x48(%rbp), %rdi
leaq -0x80(%rbp), %rdx
movq %r15, %rsi
callq 0x58ba
leaq -0x30(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x514a
leaq -0x48(%rbp), %rsi
leaq -0x30(%rbp), %rdx
movq %r15, %rdi
movq %rbx, %rcx
movq %r14, %r8
callq 0x9c58
leaq -0x30(%rbp), %rdi
callq 0x5508
leaq -0x48(%rbp), %rdi
callq 0x5508
leaq -0x80(%rbp), %rdi
callq 0x3170
leaq 0x2a5e(%rip), %r9       # 0xc477
leaq -0x1054(%rbp), %rdi
pushq $0xf
popq %rsi
pushq $0x1
popq %rcx
pushq $0x14
popq %r8
movl %ecx, %edx
callq 0x57f0
leaq -0x1054(%rbp), %rsi
movq %rbx, %rdi
callq 0xb850
leaq -0x60(%rbp), %rdi
callq 0x5508
addq $0x1048, %rsp           # imm = 0x1048
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0x5508
jmp 0x9a68
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
callq 0x5508
jmp 0x9a76
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
callq 0x3170
jmp 0x9a86
jmp 0x9a83
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
callq 0x5508
movq %rbx, %rdi
callq 0x3540
nop
// File: /workspace/github_cpp_makefile_star2_O2/vianna274[P]dropbox/src/Server.cpp
// Function: Dropbox::Server::exitUser(Dropbox::WrapperSocket*, Dropbox::User*)
void Server::exitUser(WrapperSocket *socket, User *user){
    int port = socket->getPortInt();
    user->closeDeviceSession(socket);
    setPortAvailable(port);
    cout << "User " + user->getUsername() + " ended session on device on port " << port << endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x60, %rsp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
movq %rsi, %rdi
callq 0xbc7e
movl %eax, %ebx
movq %r14, %rdi
movq %r15, %rsi
callq 0xb3b2
movq %r12, %rdi
movl %ebx, %esi
callq 0x9ffc
leaq -0x80(%rbp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0xb34a
leaq 0x29a6(%rip), %rsi      # 0xc48b
leaq -0x40(%rbp), %rdi
movq %r15, %rdx
callq 0x521b
leaq 0x2999(%rip), %rdx      # 0xc491
leaq -0x60(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x4f8a
movq 0x74bc(%rip), %rdi      # 0x10fc8
leaq -0x60(%rbp), %rsi
callq 0x32b0
movq %rax, %rdi
movl %ebx, %esi
callq 0x3500
movq %rax, %rdi
callq 0x31c0
leaq -0x60(%rbp), %rdi
callq 0x3170
leaq -0x40(%rbp), %rdi
callq 0x3170
leaq -0x80(%rbp), %rdi
callq 0x3170
addq $0x60, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x9b65
movq %rax, %rbx
jmp 0x9b6e
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
callq 0x3170
leaq -0x40(%rbp), %rdi
callq 0x3170
leaq -0x80(%rbp), %rdi
callq 0x3170
movq %rbx, %rdi
callq 0x3540
nop
// File: /workspace/github_cpp_makefile_star2_O2/vianna274[P]dropbox/src/Server.cpp
// Function: Dropbox::Server::lookForRecordAndRemove(Dropbox::_FileRecord, std::vector<Dropbox::_FileRecord, std::allocator<Dropbox::_FileRecord>>*, Dropbox::_FileRecord*)
int Server::lookForRecordAndRemove(FileRecord file, vector<FileRecord> *files, FileRecord *updatedFile) {
    vector<FileRecord>::iterator it;
    for(it = files->begin(); it != files->end(); it++) {
        if (string(it->filename) == string(file.filename)) {
            if (it->modificationTime == file.modificationTime) {
                files->erase(it);
                return OK;
            }
            else {
                *updatedFile = *it;
                files->erase(it);
                return UPDATE;
            }
        }
    }
    return DELETE;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdx, -0x38(%rbp)
movq %rsi, %rbx
movq (%rsi), %r14
leaq -0x58(%rbp), %r12
leaq -0x78(%rbp), %r13
cmpq 0x8(%rbx), %r14
je 0x9bf4
movq %r12, %rdi
movq %r14, %rsi
leaq -0x2a(%rbp), %rdx
callq 0x3130
movq %r13, %rdi
leaq 0x10(%rbp), %rsi
leaq -0x29(%rbp), %rdx
callq 0x3130
movq %r12, %rdi
movq %r13, %rsi
callq 0x52a9
movl %eax, %r15d
movq %r13, %rdi
callq 0x3170
movq %r12, %rdi
callq 0x3170
testb %r15b, %r15b
jne 0x9bfa
addq $0xe8, %r14
jmp 0x9ba3
pushq $0x1e
popq %r15
jmp 0x9c32
movq 0xd8(%r14), %rax
leaq 0x10(%rbp), %rcx
cmpq 0xd8(%rcx), %rax
jne 0x9c12
pushq $0x1d
jmp 0x9c25
movl $0xe8, %edx
movq -0x38(%rbp), %rdi
movq %r14, %rsi
callq 0x3280
pushq $0x1f
popq %r15
movq %rbx, %rdi
movq %r14, %rsi
callq 0x52cc
movl %r15d, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
callq 0x3170
movq %rbx, %rdi
callq 0x3540
// File: /workspace/github_cpp_makefile_star2_O2/vianna274[P]dropbox/src/User.cpp
// Function: Dropbox::User::createUserDir()
void User::createUserDir(){
    struct stat st;
	if(stat(dirPath.c_str(), &st) == -1) //Se não existe cria, se existe faz nada
		mkdir(dirPath.c_str(), 0777);
    DIR * dir;
    struct dirent *ent;
    struct stat filestatus;
    if ((dir = opendir (dirPath.c_str())) != NULL) {
        while ((ent = readdir (dir)) != NULL) {
            if(ent->d_type == 0x8) {
                stat((dirPath + ent->d_name).c_str(), &filestatus);
                FileRecord fileRecord = make_record(ent->d_name, filestatus.st_ctim.tv_sec, filestatus.st_atim.tv_sec, filestatus.st_mtim.tv_sec, filestatus.st_size);
				fileRecords.push_back(fileRecord);
            }
        }
        closedir(dir);
    } 
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x208, %rsp            # imm = 0x208
movq %rdi, %rbx
leaq 0x20(%rdi), %r14
movq 0x20(%rdi), %rdi
leaq -0x230(%rbp), %rsi
callq 0x32c0
cmpl $-0x1, %eax
jne 0xb14f
movq (%r14), %rdi
movl $0x1ff, %esi            # imm = 0x1FF
callq 0x3190
movq (%r14), %rdi
callq 0x3450
testq %rax, %rax
je 0xb1e4
movq %rax, %r15
addq $0x40, %rbx
leaq -0x1a0(%rbp), %r12
movq %r15, %rdi
callq 0x3470
testq %rax, %rax
je 0xb1dc
movq %rax, %r13
cmpb $0x8, 0x12(%rax)
jne 0xb16e
addq $0x13, %r13
movq %r12, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x6c5b
movq -0x1a0(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x32c0
movq %r12, %rdi
callq 0x3170
movq -0x50(%rbp), %rdx
movq -0x70(%rbp), %rcx
movq -0x60(%rbp), %r8
movl -0x88(%rbp), %r9d
movq %r12, %rdi
movq %r13, %rsi
callq 0x57a0
movq %rbx, %rdi
movq %r12, %rsi
callq 0x530c
jmp 0xb16e
movq %r15, %rdi
callq 0x34c0
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/vianna274[P]dropbox/src/User.cpp
// Function: Dropbox::User::closeDeviceSession(Dropbox::WrapperSocket*)
void User::closeDeviceSession(WrapperSocket *socket){
    for(auto it = this->devices.begin(); it != this->devices.end(); it++){
        if(*it == socket){
            this->devices.erase(it);
            break;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, %rcx
addq $0x58, %rdi
movq 0x58(%rcx), %rax
movq 0x60(%rcx), %rcx
cmpq %rcx, %rax
je 0xb3d5
cmpq %rsi, (%rax)
je 0xb3d7
addq $0x8, %rax
jmp 0xb3c5
popq %rbp
retq
movq %rax, %rsi
popq %rbp
jmp 0xb3e0
// File: /workspace/github_cpp_makefile_star2_O2/vianna274[P]dropbox/src/WrapperSocket.cpp
// Function: Dropbox::WrapperSocket::WrapperSocket(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int)
WrapperSocket::WrapperSocket (string host, int port) {
  this->localSocketHandler = socket(AF_INET, SOCK_DGRAM, 0);
  this->lastData = NULL;
  if (this->localSocketHandler == ERROR) {
    fprintf(stderr, "Error on creating socket");
    exit(1);
  }
  this->socketSeq = 0;
  this->server = gethostbyname(host.c_str());
  this->remoteSocketAddr.sin_family = AF_INET;
  this->remoteSocketAddr.sin_port = htons(port);
  this->remoteSocketAddr.sin_addr = *((struct in_addr *)this->server->h_addr);
  bzero(&(this->remoteSocketAddr.sin_zero), 8);
  this->remoteSocketLen = sizeof(struct sockaddr_in);

  this->portInt = port;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rsi, %r15
movq %rdi, %r14
pushq $0x2
popq %rdi
movl %edi, %esi
xorl %edx, %edx
callq 0x30b0
movl %eax, (%r14)
andq $0x0, 0x10(%r14)
cmpl $-0x1, %eax
je 0xb4a0
andl $0x0, 0x8(%r14)
movq (%r15), %rdi
callq 0x3350
movq %rax, 0x18(%r14)
movw $0x2, 0x20(%r14)
movl %ebx, %ecx
rolw $0x8, %cx
movw %cx, 0x22(%r14)
movq 0x18(%rax), %rax
movq (%rax), %rax
movl (%rax), %eax
movl %eax, 0x24(%r14)
leaq 0x28(%r14), %rdi
pushq $0x8
popq %rsi
callq 0x3520
movl $0x10, 0x40(%r14)
movl %ebx, 0x4(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0x5b29(%rip), %rax      # 0x10fd0
movq (%rax), %rcx
leaq 0x110f(%rip), %rdi      # 0xc5c0
pushq $0x18
popq %rsi
pushq $0x1
popq %rdx
callq 0x3580
pushq $0x1
popq %rdi
callq 0x3370
// File: /workspace/github_cpp_makefile_star2_O2/vianna274[P]dropbox/src/WrapperSocket.cpp
// Function: Dropbox::WrapperSocket::WrapperSocket(int)
WrapperSocket::WrapperSocket (int port) {
  this->socketSeq = 0;
  this->lastData = NULL;
  this->localSocketHandler = socket(AF_INET, SOCK_DGRAM, 0);
  if (this->localSocketHandler == ERROR) {
    fprintf(stderr, "Error on creating socket");
    exit(1);
  }
  this->bindSocket(port);
  this->remoteSocketLen = sizeof(struct sockaddr_in);

  this->portInt = port;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
andl $0x0, 0x8(%rdi)
movl %esi, %r14d
andq $0x0, 0x10(%rdi)
pushq $0x2
popq %rdi
movl %edi, %esi
xorl %edx, %edx
callq 0x30b0
movl %eax, (%rbx)
cmpl $-0x1, %eax
je 0xb51e
movq %rbx, %rdi
movl %r14d, %esi
callq 0xb542
movl $0x10, 0x40(%rbx)
movl %r14d, 0x4(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
movq 0x5aab(%rip), %rax      # 0x10fd0
movq (%rax), %rcx
leaq 0x1091(%rip), %rdi      # 0xc5c0
pushq $0x18
popq %rsi
pushq $0x1
popq %rdx
callq 0x3580
pushq $0x1
popq %rdi
callq 0x3370
// File: /workspace/github_cpp_makefile_star2_O2/vianna274[P]dropbox/src/WrapperSocket.cpp
// Function: Dropbox::WrapperSocket::bindSocket(int)
void WrapperSocket::bindSocket(int port) {
  this->remoteSocketAddr.sin_family = AF_INET;
	this->remoteSocketAddr.sin_port = htons(port);
	this->remoteSocketAddr.sin_addr.s_addr = INADDR_ANY;
  bzero(&(this->remoteSocketAddr.sin_zero), 8);
  if (bind(this->localSocketHandler, (struct sockaddr *) &this->remoteSocketAddr, sizeof(struct sockaddr)) < 0) {
    fprintf(stderr, "Error on binding");
    exit(1);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x20(%rdi), %r14
movw $0x2, 0x20(%rdi)
rolw $0x8, %si
movw %si, 0x22(%rdi)
andl $0x0, 0x24(%rdi)
addq $0x28, %rdi
pushq $0x8
popq %rsi
callq 0x3520
movl (%rbx), %edi
pushq $0x10
popq %rdx
movq %r14, %rsi
callq 0x3080
testl %eax, %eax
js 0xb584
popq %rbx
popq %r14
popq %rbp
retq
movq 0x5a45(%rip), %rax      # 0x10fd0
movq (%rax), %rcx
leaq 0x107e(%rip), %rdi      # 0xc613
pushq $0x10
popq %rsi
pushq $0x1
popq %rdx
callq 0x3580
pushq $0x1
popq %rdi
callq 0x3370
// File: /workspace/github_cpp_makefile_star2_O2/vianna274[P]dropbox/src/WrapperSocket.cpp
// Function: Dropbox::WrapperSocket::send(Dropbox::_MessageData*, int)
bool WrapperSocket::send(MessageData *packet, int wait) {
  set_socketSeq(packet, this->socketSeq);
  int tries = 0;
  do{

    if (sendto(this->localSocketHandler, (void *)packet, PACKET_LEN, 0,(const struct sockaddr *) &(this->remoteSocketAddr),sizeof(struct sockaddr_in)) < 0) {
      fprintf(stderr, "Error on sending");
      cout << string(packet->payload) << packet->type << " " << string(packet->username) << endl;
      exit(1);
    }
  
  }while(!this->waitAck(packet->seq, wait) && ++tries < TOTAL_TRIES);
  this->socketSeq++;
  
  if(tries == TOTAL_TRIES) return false;
  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %edx, %r15d
movq %rsi, %rbx
movq %rdi, %r14
movl 0x8(%rdi), %esi
movq %rbx, %rdi
callq 0x58aa
leaq 0x20(%r14), %r12
xorl %r13d, %r13d
movl (%r14), %edi
movl $0x1000, %edx           # imm = 0x1000
movq %rbx, %rsi
xorl %ecx, %ecx
movq %r12, %r8
pushq $0x10
popq %r9
callq 0x3060
testq %rax, %rax
js 0xb62b
movl 0x4(%rbx), %esi
movq %r14, %rdi
movl %r15d, %edx
callq 0xb6f0
testb %al, %al
jne 0xb611
incl %r13d
cmpl $0x3, %r13d
jne 0xb5d4
pushq $0x3
popq %r13
incl 0x8(%r14)
cmpl $0x3, %r13d
setne %al
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x599e(%rip), %rax      # 0x10fd0
movq (%rax), %rcx
leaq 0xf9d(%rip), %rdi       # 0xc5d9
pushq $0x10
popq %rsi
pushq $0x1
popq %rdx
callq 0x3580
leaq 0x14(%rbx), %rsi
leaq -0x70(%rbp), %r14
leaq -0x2a(%rbp), %rdx
movq %r14, %rdi
callq 0x3130
movq 0x5966(%rip), %rdi      # 0x10fc8
movq %r14, %rsi
callq 0x32b0
movl (%rbx), %esi
movq %rax, %rdi
callq 0x3500
leaq 0xd53(%rip), %rsi       # 0xc3ce
movq %rax, %rdi
callq 0x3310
movq %rax, %r14
addq $0xfb4, %rbx            # imm = 0xFB4
leaq -0x50(%rbp), %rdi
leaq -0x29(%rbp), %rdx
movq %rbx, %rsi
callq 0x3130
leaq -0x50(%rbp), %rsi
movq %r14, %rdi
callq 0x32b0
movq %rax, %rdi
callq 0x31c0
leaq -0x50(%rbp), %rdi
callq 0x3170
leaq -0x70(%rbp), %rdi
callq 0x3170
pushq $0x1
popq %rdi
callq 0x3370
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x3170
jmp 0xb6de
jmp 0xb6db
movq %rax, %rbx
leaq -0x70(%rbp), %rdi
callq 0x3170
movq %rbx, %rdi
callq 0x3540
nop
// File: /workspace/github_cpp_makefile_star2_O2/vianna274[P]dropbox/src/WrapperSocket.cpp
// Function: Dropbox::WrapperSocket::waitAck(int, int)
bool WrapperSocket::waitAck(int seq, int wait) {
  bool acked = false;
  while(!acked) {
    MessageData *response = this->receive(TIMEOUT_ON, wait);
    if(!response) {
      return false;
    } 
    if(response->type == TYPE_ACK && response->seq == seq) { 
      return true;
    }
  }
  return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edx, %ebx
movl %esi, %r14d
movq %rdi, %r15
pushq $0x1
popq %r12
movq %r15, %rdi
movl %r12d, %esi
movl %ebx, %edx
callq 0xb734
testq %rax, %rax
je 0xb724
cmpl $0x1, (%rax)
jne 0xb707
cmpl %r14d, 0x4(%rax)
jne 0xb707
testq %rax, %rax
setne %al
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/vianna274[P]dropbox/src/WrapperSocket.cpp
// Function: Dropbox::WrapperSocket::receive(int, int)
MessageData* WrapperSocket::receive(int timeout, int time) {
  if(timeout == TIMEOUT_ON) {
    struct pollfd fd;
    fd.fd = this->localSocketHandler;
    fd.events = POLLIN;
    int ret = poll(&fd, 1, time);
    switch(ret) {
      case -1: printf("Error\n");
        return NULL;
      case 0: 
        return NULL;
      default: break;
    }
  }

  char* msg = new char[PACKET_LEN];
  memset(msg, 0, PACKET_LEN);
  bool receivedCorrectly = false;
  MessageData * data;
  while(!receivedCorrectly) {

    int msgSize = recvfrom(this->localSocketHandler, (void *) msg, 
      PACKET_LEN, 0, (struct sockaddr *) &this->remoteSocketAddr, &this->remoteSocketLen);
    if (msgSize < 0) {
      fprintf(stderr, "Error on receiving\n");
      exit(1);
    }
    data = (MessageData *) msg;

    if (data->socketSeq == -1)
      break;
    if (data->socketSeq == 0)
      this->socketSeq = 0;
    if (data->socketSeq == this->socketSeq && data->type != TYPE_ACK) {
      MessageData message = make_packet(TYPE_ACK, data->seq, 1, -1, "");
      this->sendAck(&message);
      this->socketSeq = data->socketSeq + 1;
      receivedCorrectly = true;
    }
  }

  
  // TODO delete msg
  return data;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xfe0, %rsp            # imm = 0xFE0
movq %rdi, %rbx
cmpl $0x1, %esi
jne 0xb784
movl (%rbx), %eax
leaq -0xff4(%rbp), %rdi
movl %eax, (%rdi)
movw $0x1, 0x4(%rdi)
pushq $0x1
popq %rsi
callq 0x3460
testl %eax, %eax
je 0xb77c
cmpl $-0x1, %eax
jne 0xb784
leaq 0xead(%rip), %rdi       # 0xc624
callq 0x3490
xorl %r14d, %r14d
jmp 0xb818
movl $0x1000, %edi           # imm = 0x1000
callq 0x3030
movq %rax, %r14
movl $0x1000, %edx           # imm = 0x1000
movq %rax, %rdi
xorl %esi, %esi
callq 0x3220
leaq 0x20(%rbx), %r15
leaq 0x40(%rbx), %r12
movl (%rbx), %edi
movl $0x1000, %edx           # imm = 0x1000
movq %r14, %rsi
xorl %ecx, %ecx
movq %r15, %r8
movq %r12, %r9
callq 0x3260
testl %eax, %eax
js 0xb82b
movl 0x10(%r14), %eax
testl %eax, %eax
je 0xb7d7
cmpl $-0x1, %eax
je 0xb818
cmpl 0x8(%rbx), %eax
jne 0xb7a8
jmp 0xb7db
andl $0x0, 0x8(%rbx)
cmpl $0x1, (%r14)
je 0xb7a8
movl 0x4(%r14), %edx
leaq 0xe11(%rip), %r9        # 0xc5fd
leaq -0xff4(%rbp), %r15
pushq $0x1
popq %rcx
pushq $-0x1
popq %r8
movq %r15, %rdi
movl %ecx, %esi
callq 0x57f0
movq %rbx, %rdi
movq %r15, %rsi
callq 0xbc2e
movl 0x10(%r14), %eax
incl %eax
movl %eax, 0x8(%rbx)
movq %r14, %rax
addq $0xfe0, %rsp            # imm = 0xFE0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x579e(%rip), %rax      # 0x10fd0
movq (%rax), %rcx
leaq 0xdae(%rip), %rdi       # 0xc5ea
pushq $0x13
popq %rsi
pushq $0x1
popq %rdx
callq 0x3580
pushq $0x1
popq %rdi
callq 0x3370
nop