LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/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 $0x48, %rsp
movq %rsi, %r12
movq %rdi, %rbx
callq 0x6648
leaq 0x10(%rbx), %rax
movq %rax, -0x68(%rbp)
movq %rax, (%rbx)
leaq 0x839e(%rip), %rsi      # 0x103e0
leaq 0x83ab(%rip), %rdx      # 0x103f4
movq %rbx, %rdi
callq 0x62de
leaq 0x20(%rbx), %rdi
leaq 0xe8(%rbx), %r14
movl $0xc8, %edx
xorl %esi, %esi
callq 0x3230
movq %r14, %rdi
movl $0xfa0, %esi            # imm = 0xFA0
callq 0xe6f4
movq %r14, -0x60(%rbp)
leaq 0x130(%rbx), %rdi
movq %rdi, -0x58(%rbp)
movl $0x2328, %esi           # imm = 0x2328
callq 0xe6f4
leaq 0x958(%rbx), %rax
movq %rax, -0x50(%rbp)
leaq 0x970(%rbx), %rax
movq %rax, -0x40(%rbp)
leaq 0x988(%rbx), %rax
movq %rax, -0x38(%rbp)
leaq 0x9a0(%rbx), %rax
movq %rax, -0x30(%rbp)
leaq 0x9b8(%rbx), %r15
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, -0x48(%rbp)
movq %rax, 0x9b8(%rbx)
xorl %eax, %eax
movq %rax, 0x9c0(%rbx)
movb %al, 0x9c8(%rbx)
leaq 0x9d8(%rbx), %r13
leaq 0x9e8(%rbx), %r14
movq %r14, 0x9d8(%rbx)
movq %rax, 0x9e0(%rbx)
movb %al, 0x9e8(%rbx)
movb $0x1, 0x9f8(%rbx)
movq %r15, %rdi
movq %r12, %rsi
callq 0x3220
movq %r13, %rdi
movq %r12, %rsi
callq 0x3220
movq -0x40(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0xd470
movq -0x38(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0xd470
movq -0x30(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0xd716
movl $0x18, 0x180(%rbx)
movq %rbx, %rdi
callq 0x8234
addq $0x184, %rbx            # imm = 0x184
movl $0x7d0, %edx            # imm = 0x7D0
movq %rbx, %rdi
movl $0x1, %esi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3230
movq %rax, %r12
jmp 0x8214
movq %rax, %r12
jmp 0x821d
movq %rax, %r12
movq (%r13), %rdi
cmpq %r14, %rdi
je 0x81c9
callq 0x3320
movq (%r15), %rdi
cmpq -0x48(%rbp), %rdi
je 0x81d7
callq 0x3320
movq -0x30(%rbp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x81e8
callq 0x3320
movq -0x38(%rbp), %rdi
callq 0xcf94
movq -0x40(%rbp), %rdi
callq 0xcf94
movq -0x50(%rbp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x820b
callq 0x3320
movq -0x58(%rbp), %rdi
callq 0xe6de
movq -0x60(%rbp), %rdi
callq 0xe6de
movq (%rbx), %rdi
cmpq -0x68(%rbp), %rdi
je 0x822b
callq 0x3320
movq %r12, %rdi
callq 0x3580
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 %r14
pushq %rbx
subq $0xfe0, %rsp            # imm = 0xFE0
movq %rdi, %rbx
movq 0x9b8(%rdi), %r9
leaq -0xfe4(%rbp), %rdi
movl $0x10, %esi
movl $0x1, %edx
movl $0x1, %ecx
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
callq 0x657c
leaq 0xc0(%rbx), %r14
movq %r14, %rdi
callq 0x3470
testl %eax, %eax
jne 0x9a53
movq 0x178(%rbx), %rdi
leaq -0xfe4(%rbp), %rsi
callq 0xeae4
movq %r14, %rdi
callq 0x3280
addq $0xfe0, %rsp            # imm = 0xFE0
popq %rbx
popq %r14
popq %rbp
retq
movl %eax, %edi
callq 0x3250
// File: /workspace/github_cpp_makefile_star2_O1/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 %rdi, %rbx
movq (%rsi), %r12
xorps %xmm0, %xmm0
movaps %xmm0, -0x40(%rbp)
movq $0x0, -0x30(%rbp)
cmpq 0x8(%rsi), %r12
je 0xa046
movq %rdx, %r14
movq %rsi, %r15
leaq -0x40(%rbp), %r13
movq %r14, %rdi
movq %r12, %rsi
callq 0x3050
testl %eax, %eax
je 0xa03c
movq %r13, %rdi
movq %r12, %rsi
callq 0xd27c
addq $0x20, %r12
cmpq 0x8(%r15), %r12
jne 0xa022
addq $0x970, %rbx            # imm = 0x970
movq %rbx, %rdi
callq 0xd2c8
movq -0x40(%rbp), %r15
movq -0x38(%rbp), %r13
cmpq %r13, %r15
je 0xa0a2
leaq -0x50(%rbp), %r12
leaq -0x60(%rbp), %r14
movq %r12, -0x60(%rbp)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
movq %r14, %rdi
callq 0x6244
movq %rbx, %rdi
movq %r14, %rsi
callq 0xd27c
movq -0x60(%rbp), %rdi
cmpq %r12, %rdi
je 0xa099
callq 0x3320
addq $0x20, %r15
cmpq %r13, %r15
jne 0xa06a
leaq -0x40(%rbp), %rdi
callq 0xcf94
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xa0cf
movq %rax, %rbx
movq -0x60(%rbp), %rdi
cmpq %r12, %rdi
je 0xa0d2
callq 0x3320
jmp 0xa0d2
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
callq 0xcf94
movq %rbx, %rdi
callq 0x3580
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 $0x1068, %rsp           # imm = 0x1068
movq 0x988(%rdi), %r14
movq 0x990(%rdi), %rax
movq %rax, -0x50(%rbp)
cmpq %rax, %r14
je 0xa2f1
movq %rdi, %rbx
leaq -0xb8(%rbp), %r12
leaq -0x108c(%rbp), %r13
leaq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq -0x48(%rbp), %rdi
callq 0x6244
leaq -0x60(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
addq %rsi, %rdx
leaq -0x70(%rbp), %r15
movq %r15, %rdi
callq 0x6244
movq %r12, %rdi
movq %r15, %rsi
movl $0x2710, %edx           # imm = 0x2710
callq 0xe64e
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0xa29a
callq 0x3320
movq 0x9b8(%rbx), %r9
movq %r13, %rdi
movl $0x13, %esi
movl $0x1, %edx
movl $0x1, %ecx
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
callq 0x657c
movq %r12, %rdi
movq %r13, %rsi
callq 0xeae4
movq %r12, %rdi
callq 0xe6de
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0xa2e3
callq 0x3320
addq $0x20, %r14
cmpq -0x50(%rbp), %r14
jne 0xa23e
addq $0x1068, %rsp           # imm = 0x1068
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0xa32e
movq %rax, %rbx
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0xa32e
callq 0x3320
jmp 0xa32e
movq %rax, %rbx
leaq -0xb8(%rbp), %rdi
callq 0xe6de
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0xa340
callq 0x3320
movq %rbx, %rdi
callq 0x3580
// File: /workspace/github_cpp_makefile_star2_O1/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, -0x50(%rbp)
callq 0x3470
testl %eax, %eax
jne 0xa56b
movq 0x970(%rbx), %r15
movq 0x978(%rbx), %rax
movq %rax, -0x58(%rbp)
cmpq %rax, %r15
je 0xa51f
leaq -0xc0(%rbp), %r13
leaq -0x1094(%rbp), %r14
leaq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
leaq -0x48(%rbp), %rdi
callq 0x6244
leaq -0x68(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
addq %rsi, %rdx
leaq -0x78(%rbp), %r12
movq %r12, %rdi
callq 0x6244
movq %r13, %rdi
movq %r12, %rsi
movl $0x2328, %edx           # imm = 0x2328
callq 0xe64e
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0xa4c2
callq 0x3320
movl 0x9c0(%rbx), %r8d
movq 0x9b8(%rbx), %r9
movq %r14, %rdi
movl $0x15, %esi
movl $0x1, %edx
movl $0x1, %ecx
callq 0x657c
movq %r13, %rdi
movq %r14, %rsi
movl $0x64, %edx
callq 0xe796
movq %r13, %rdi
callq 0xe6de
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0xa511
callq 0x3320
addq $0x20, %r15
cmpq -0x58(%rbp), %r15
jne 0xa466
movq -0x50(%rbp), %rdi
callq 0x3280
movb $0x1, 0x9f8(%rbx)
leaq 0x20(%rbx), %r14
movq %r14, %rdi
callq 0x3470
testl %eax, %eax
jne 0xa56b
movl $0x1a, 0x180(%rbx)
movq %r14, %rdi
callq 0x3280
movq %rbx, %rdi
callq 0xa1fe
addq $0x1078, %rsp           # imm = 0x1078
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %edi
callq 0x3250
movq %rax, %rbx
jmp 0xa59d
movq %rax, %rbx
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0xa59d
callq 0x3320
jmp 0xa59d
movq %rax, %rbx
leaq -0xc0(%rbp), %rdi
callq 0xe6de
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0xa5af
callq 0x3320
movq %rbx, %rdi
callq 0x3580
nop
// File: /workspace/github_cpp_makefile_star2_O1/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
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq %rdi, -0x30(%rbp)
movq $0x0, 0x10(%rdi)
leaq 0x98(%rsi), %r15
movq %r15, %rdi
callq 0x3470
testl %eax, %eax
jne 0xa6e2
leaq 0x970(%r14), %rsi
leaq -0x50(%rbp), %rdi
callq 0xd1ee
leaq -0x80(%rbp), %rbx
movq %rbx, -0x10(%rbx)
movq 0x9d8(%r14), %rsi
movq 0x9e0(%r14), %rdx
addq %rsi, %rdx
leaq -0x90(%rbp), %rdi
callq 0x6244
leaq -0x50(%rbp), %rsi
leaq -0x90(%rbp), %rdx
movq %r14, %rdi
callq 0x9fec
movq %r15, -0x38(%rbp)
movq -0x90(%rbp), %rdi
cmpq %rbx, %rdi
je 0xa652
callq 0x3320
leaq -0x50(%rbp), %rdi
callq 0xcf94
movq 0x970(%r14), %r13
movq 0x978(%r14), %rbx
cmpq %rbx, %r13
je 0xa6c6
leaq -0x60(%rbp), %r15
addq $0x9b8, %r14            # imm = 0x9B8
leaq -0x70(%rbp), %r12
movq %r15, -0x70(%rbp)
movq (%r13), %rsi
movq 0x8(%r13), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x6244
movq %r12, %rdi
movq %r14, %rsi
callq 0x3050
testl %eax, %eax
jle 0xa6af
movq -0x30(%rbp), %rdi
movq %r12, %rsi
callq 0xd27c
movq -0x70(%rbp), %rdi
cmpq %r15, %rdi
je 0xa6bd
callq 0x3320
addq $0x20, %r13
cmpq %rbx, %r13
jne 0xa67d
movq -0x38(%rbp), %rdi
callq 0x3280
movq -0x30(%rbp), %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %edi
callq 0x3250
movq %rax, %r14
movq -0x90(%rbp), %rdi
cmpq %rbx, %rdi
je 0xa702
callq 0x3320
jmp 0xa702
movq %rax, %r14
leaq -0x50(%rbp), %rdi
callq 0xcf94
jmp 0xa725
jmp 0xa722
movq %rax, %r14
movq -0x70(%rbp), %rdi
cmpq %r15, %rdi
je 0xa725
callq 0x3320
jmp 0xa725
movq %rax, %r14
movq -0x30(%rbp), %rdi
callq 0xcf94
movq %r14, %rdi
callq 0x3580
movq %rax, %rdi
callq 0xd461
// File: /workspace/github_cpp_makefile_star2_O1/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 $0x1068, %rsp           # imm = 0x1068
movq (%rsi), %r14
movq 0x8(%rsi), %rax
movq %rax, -0x50(%rbp)
cmpq %rax, %r14
je 0xa82b
movq %rdi, %rbx
leaq -0xb8(%rbp), %r12
leaq -0x108c(%rbp), %r13
leaq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq -0x48(%rbp), %rdi
callq 0x6244
leaq -0x60(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
addq %rsi, %rdx
leaq -0x70(%rbp), %r15
movq %r15, %rdi
callq 0x6244
movq %r12, %rdi
movq %r15, %rsi
movl $0x2328, %edx           # imm = 0x2328
callq 0xe64e
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0xa7d3
callq 0x3320
movl 0x9c0(%rbx), %r8d
movq 0x9b8(%rbx), %r9
movq %r13, %rdi
movl $0x14, %esi
movl $0x1, %edx
movl $0x1, %ecx
callq 0x657c
movq %r12, %rdi
movq %r13, %rsi
callq 0xeae4
movq %r12, %rdi
callq 0xe6de
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0xa81d
callq 0x3320
addq $0x20, %r14
cmpq -0x50(%rbp), %r14
jne 0xa777
addq $0x1068, %rsp           # imm = 0x1068
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0xa868
movq %rax, %rbx
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0xa868
callq 0x3320
jmp 0xa868
movq %rax, %rbx
leaq -0xb8(%rbp), %rdi
callq 0xe6de
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0xa87a
callq 0x3320
movq %rbx, %rdi
callq 0x3580
// File: /workspace/github_cpp_makefile_star2_O1/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 0x3470
testl %eax, %eax
jne 0xa916
movl $0x19, 0x180(%rbx)
movq %r15, %rdi
callq 0x3280
leaq -0x30(%rbp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0xd1ee
movq %rbx, %rdi
movq %r15, %rsi
callq 0xa73e
leaq -0x30(%rbp), %rdi
callq 0xcf94
movq %rbx, %rdi
callq 0xa932
testb %al, %al
je 0xa903
movq %rbx, %rdi
callq 0xa9e4
testb %al, %al
jne 0xa90b
cmpl $0x1b, 0x180(%rbx)
je 0xa90b
movq %rbx, %rdi
callq 0xa40e
movq %rbx, %rdi
callq 0xa40e
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %edi
callq 0x3250
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0xcf94
movq %rbx, %rdi
callq 0x3580
nop
// File: /workspace/github_cpp_makefile_star2_O1/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, -0x30(%rbp)
leaq 0x130(%rdi), %r14
movq 0xa67e(%rip), %r15      # 0x14fd0
movq %r14, %rdi
movl $0x1, %esi
movl $0x5dc, %edx            # imm = 0x5DC
callq 0xe9b6
testq %rax, %rax
je 0xa9c1
movq %rax, %r13
movl (%rax), %esi
movq %r15, %rdi
callq 0x3540
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3330
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3260
movl (%r13), %eax
cmpl $0x16, %eax
je 0xa9ba
cmpl $0x15, %eax
jne 0xa9c8
movq -0x30(%rbp), %rdi
movq %r13, %rsi
callq 0xac7e
xorl %eax, %eax
movb $0x1, %r12b
jmp 0xa9ca
xorl %r12d, %r12d
xorl %eax, %eax
jmp 0xa9ca
movb $0x1, %al
testb %al, %al
jne 0xa952
andb $0x1, %r12b
movl %r12d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x130(%rdi), %r14
movq %r14, %rdi
movl $0x1, %esi
movl $0x5dc, %edx            # imm = 0x5DC
callq 0xe9b6
testq %rax, %rax
je 0xaa26
movb $0x1, %cl
cmpl $0x15, (%rax)
jne 0xaa2b
movq %rbx, %rdi
movq %rax, %rsi
callq 0xac7e
movb $0x1, %r15b
jmp 0xaa29
xorl %r15d, %r15d
xorl %ecx, %ecx
testb %cl, %cl
jne 0xa9f8
andb $0x1, %r15b
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 %r13
pushq %r12
pushq %rbx
subq $0x1028, %rsp           # imm = 0x1028
movq %rsi, -0x38(%rbp)
movq %rdi, -0x40(%rbp)
callq 0xabe8
movl %eax, %r15d
movl %eax, %r12d
negl %r12d
cmovsl %eax, %r12d
movl $0x1, %r13d
cmpl $0xa, %r12d
jb 0xaac6
movl $0x4, %r13d
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %r12d, %ecx
cmpl $0x63, %ecx
jbe 0xaabd
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0xaac3
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0xaac6
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %r13d
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0xaa8a
addl $-0x3, %r13d
jmp 0xaac6
addl $-0x2, %r13d
jmp 0xaac6
decl %r13d
movl %r15d, %r14d
shrl $0x1f, %r14d
leal (%r14,%r13), %esi
leaq -0x50(%rbp), %rax
movq %rax, -0x10(%rax)
leaq -0x60(%rbp), %rbx
movq %rbx, %rdi
movl $0x2d, %edx
callq 0x33b0
addq (%rbx), %r14
movq %r14, %rdi
movl %r13d, %esi
movl %r12d, %edx
callq 0x61d2
movq (%rbx), %r9
leaq -0x1044(%rbp), %rdi
movl $0x2, %esi
movl $0x1, %edx
movl $0x1, %ecx
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
callq 0x657c
movq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rax
cmpq %rax, %rdi
je 0xab31
callq 0x3320
movl $0x48, %edi
callq 0x3340
movq %rax, %r12
movq %rax, %rdi
movl %r15d, %esi
callq 0xe6f4
leaq -0x70(%rbp), %rbx
movq %r12, (%rbx)
leaq -0x1044(%rbp), %rsi
movq -0x38(%rbp), %rdi
callq 0xeae4
leaq -0x1e3f(%rip), %rax     # 0x8d28
leaq -0x60(%rbp), %rsi
movq %rax, (%rsi)
movq $0x0, 0x8(%rsi)
leaq -0x68(%rbp), %rdx
movq -0x40(%rbp), %rax
movq %rax, (%rdx)
leaq -0x30(%rbp), %r14
movq %r14, %rdi
movq %rbx, %rcx
callq 0xd30e
movq %r14, %rdi
callq 0x3570
cmpq $0x0, -0x30(%rbp)
jne 0xabbd
addq $0x1028, %rsp           # imm = 0x1028
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpq $0x0, -0x30(%rbp)
jne 0xabbd
movq %rax, %rbx
jmp 0xabdf
callq 0x30e0
movq %rax, %rbx
movq %r12, %rdi
jmp 0xabda
movq %rax, %rbx
movq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rax
cmpq %rax, %rdi
je 0xabdf
callq 0x3320
movq %rbx, %rdi
callq 0x3580
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
leaq 0x70(%rdi), %rbx
movq %rbx, %rdi
callq 0x3470
testl %eax, %eax
jne 0xac77
movl $0xfa1, %r12d           # imm = 0xFA1
xorl %r15d, %r15d
movb -0xe1d(%r14,%r12), %r13b
cmpb $0x1, %r13b
jne 0xac34
movb $0x0, -0xe1d(%r14,%r12)
movq %rbx, %rdi
callq 0x3280
movl %r12d, %eax
testb %r13b, %r13b
jne 0xac55
cmpq $0x1770, %r12           # imm = 0x1770
leaq 0x1(%r12), %rcx
setae %r15b
movq %rcx, %r12
cmpq $0x1771, %rcx           # imm = 0x1771
jne 0xac12
testb $0x1, %r15b
je 0xac68
movq %rbx, %rdi
callq 0x3280
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %edi
callq 0x3250
// File: /workspace/github_cpp_makefile_star2_O1/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, %r15
movq %rdi, %r14
leaq 0x20(%rdi), %rbx
movq %rbx, %rdi
callq 0x3470
testl %eax, %eax
jne 0xae4a
movl $0x1b, 0x180(%r14)
movq %rbx, -0x30(%rbp)
movq %rbx, %rdi
callq 0x3280
leaq 0x98(%r14), %r12
movq %r12, %rdi
callq 0x3470
testl %eax, %eax
jne 0xae4a
leaq 0x970(%r14), %rsi
leaq -0x48(%rbp), %rdi
callq 0xd1ee
leaq -0x78(%rbp), %rbx
movq %rbx, -0x10(%rbx)
movq 0x9d8(%r14), %rsi
movq 0x9e0(%r14), %rdx
addq %rsi, %rdx
leaq -0x88(%rbp), %rdi
callq 0x6244
leaq -0x48(%rbp), %rsi
leaq -0x88(%rbp), %rdx
movq %r14, %rdi
callq 0x9fec
leaq 0x9d8(%r14), %r13
movq -0x88(%rbp), %rdi
cmpq %rbx, %rdi
je 0xad3a
callq 0x3320
leaq -0x48(%rbp), %rdi
callq 0xcf94
movq %r12, %rdi
callq 0x3280
leaq 0x14(%r15), %r12
leaq -0x98(%rbp), %rbx
movq %rbx, -0x10(%rbx)
movq %r12, %rdi
callq 0x3170
leaq (%r15,%rax), %rdx
addq $0x14, %rdx
leaq -0xa8(%rbp), %r15
movq %r15, %rdi
movq %r12, %rsi
callq 0x62de
movq %r13, %rdi
movq %r15, %rsi
callq 0x33d0
movq (%r15), %rdi
cmpq %rbx, %rdi
je 0xad94
callq 0x3320
leaq 0xc0(%r14), %r15
movq %r15, %rdi
callq 0x3470
testl %eax, %eax
jne 0xae4a
movl $0x48, %edi
callq 0x3340
movq %rax, %r12
leaq -0x58(%rbp), %rbx
movq %rbx, -0x10(%rbx)
movq 0x9d8(%r14), %rsi
movq 0x9e0(%r14), %rdx
addq %rsi, %rdx
leaq -0x68(%rbp), %rdi
callq 0x6244
leaq -0x68(%rbp), %rsi
movq %r12, %rdi
movl $0x2328, %edx           # imm = 0x2328
callq 0xe64e
movq %r12, 0x178(%r14)
movq -0x68(%rbp), %rdi
cmpq %rbx, %rdi
je 0xae00
callq 0x3320
callq 0xae9b
movq %r15, %rdi
callq 0x3280
movq %r14, %rdi
callq 0x99e0
movq -0x30(%rbp), %rbx
movq %rbx, %rdi
callq 0x3470
testl %eax, %eax
jne 0xae4a
movl $0x18, 0x180(%r14)
movq %rbx, %rdi
callq 0x3280
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %edi
callq 0x3250
movq %rax, %r14
movq -0x68(%rbp), %rdi
cmpq %rbx, %rdi
je 0xae67
callq 0x3320
jmp 0xae67
movq %rax, %r14
movq %r12, %rdi
callq 0x3320
jmp 0xae93
movq %rax, %r14
movq -0x88(%rbp), %rdi
cmpq %rbx, %rdi
je 0xae8a
callq 0x3320
jmp 0xae8a
movq %rax, %r14
leaq -0x48(%rbp), %rdi
callq 0xcf94
movq %r14, %rdi
callq 0x3580
// File: /workspace/github_cpp_makefile_star2_O1/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, %r12
movq %rsi, %r15
movq %rdi, %r14
leaq 0x48(%rdi), %rbx
movq %rbx, %rdi
callq 0x3470
testl %eax, %eax
jne 0xb2df
movq (%r12), %r9
movq (%r15), %rax
movq %rax, (%rsp)
leaq -0xff4(%rbp), %rdi
movl $0x12, %esi
movl $0x1, %edx
movl $0x1, %ecx
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
callq 0x65d3
movq 0x9a0(%r14), %r15
movq 0x9a8(%r14), %r12
cmpq %r12, %r15
je 0xb2c7
leaq -0xff4(%rbp), %r14
movq (%r15), %rdi
movq %r14, %rsi
callq 0xeae4
addq $0x8, %r15
cmpq %r12, %r15
jne 0xb2b3
movq %rbx, %rdi
callq 0x3280
addq $0xfe0, %rsp            # imm = 0xFE0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %edi
callq 0x3250
// File: /workspace/github_cpp_makefile_star2_O1/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, %rbx
movq %rsi, %r15
movq %rdi, %r12
leaq 0x48(%rdi), %r13
movq %r13, %rdi
callq 0x3470
testl %eax, %eax
jne 0xc03c
leaq -0xa8(%rbp), %rax
movq %rax, -0x10(%rax)
movq (%rbx), %rsi
movq %rbx, -0x58(%rbp)
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq -0xb8(%rbp), %r14
movq %r14, %rdi
callq 0x6244
movq %r12, -0x38(%rbp)
movq %r12, %rdi
movq %r14, %rsi
callq 0xaed8
movq %rax, -0x50(%rbp)
movq %r13, -0x40(%rbp)
movq -0xb8(%rbp), %rdi
leaq -0xa8(%rbp), %rax
cmpq %rax, %rdi
je 0xbf2e
callq 0x3320
movq -0x38(%rbp), %rax
movq 0x9a0(%rax), %r12
movq 0x9a8(%rax), %rax
movq %rax, -0x48(%rbp)
cmpq %rax, %r12
je 0xc021
leaq -0xc8(%rbp), %r14
movq %r14, %r13
movq (%r12), %r14
movq (%r15), %rsi
leaq -0x98(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0x3150
leaq -0x68(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x58(%rbp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq -0x78(%rbp), %rbx
movq %rbx, %rdi
callq 0x6244
movq -0x38(%rbp), %rdi
movq %r14, %rsi
leaq -0x98(%rbp), %rdx
movq %rbx, %rcx
callq 0x7e4e
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0xbfb8
callq 0x3320
movq -0x98(%rbp), %rdi
leaq -0x88(%rbp), %rax
cmpq %rax, %rdi
je 0xbfd0
callq 0x3320
movq %r13, %r14
movq %r13, -0xd8(%rbp)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
leaq -0xd8(%rbp), %rbx
movq %rbx, %rdi
callq 0x6244
movq -0x50(%rbp), %rdi
movq %rbx, %rsi
callq 0xe362
movq -0xd8(%rbp), %rdi
cmpq %r14, %rdi
je 0xc013
callq 0x3320
movq %r13, %r14
addq $0x8, %r12
cmpq -0x48(%rbp), %r12
jne 0xbf54
movq -0x40(%rbp), %rdi
callq 0x3280
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %edi
callq 0x3250
movq %rax, %rbx
movq -0xb8(%rbp), %rdi
leaq -0xa8(%rbp), %rax
jmp 0xc083
movq %rax, %rbx
jmp 0xc08d
movq %rax, %rbx
jmp 0xc075
movq %rax, %rbx
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0xc075
callq 0x3320
movq -0x98(%rbp), %rdi
leaq -0x88(%rbp), %rax
cmpq %rax, %rdi
je 0xc08d
callq 0x3320
movq %rbx, %rdi
callq 0x3580
movq %rax, %rbx
movq -0xd8(%rbp), %rdi
cmpq %r14, %rdi
jne 0xc088
jmp 0xc08d
// File: /workspace/github_cpp_makefile_star2_O1/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 0x7802
leaq -0x80(%rbp), %rdi
movq %r14, %rsi
callq 0xe582
leaq -0x48(%rbp), %rdi
leaq -0x80(%rbp), %rdx
movq %r15, %rsi
callq 0x664e
leaq -0x30(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x60e0
leaq -0x48(%rbp), %rsi
leaq -0x30(%rbp), %rdx
movq %r15, %rdi
movq %rbx, %rcx
movq %r14, %r8
callq 0xc914
movq -0x30(%rbp), %rdi
testq %rdi, %rdi
je 0xc509
callq 0x3320
movq -0x48(%rbp), %rdi
testq %rdi, %rdi
je 0xc517
callq 0x3320
leaq -0x70(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xc529
callq 0x3320
leaq 0x3f7f(%rip), %r9       # 0x104af
leaq -0x1054(%rbp), %rdi
movl $0xf, %esi
movl $0x1, %edx
movl $0x1, %ecx
movl $0x14, %r8d
callq 0x657c
leaq -0x1054(%rbp), %rsi
movq %rbx, %rdi
callq 0xeae4
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0xc56e
callq 0x3320
addq $0x1048, %rsp           # imm = 0x1048
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x30(%rbp), %rdi
testq %rdi, %rdi
je 0xc592
callq 0x3320
jmp 0xc592
movq %rax, %rbx
movq -0x48(%rbp), %rdi
testq %rdi, %rdi
je 0xc5a5
callq 0x3320
jmp 0xc5a5
movq %rax, %rbx
leaq -0x70(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xc5be
callq 0x3320
jmp 0xc5be
jmp 0xc5bb
movq %rax, %rbx
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0xc5cc
callq 0x3320
movq %rbx, %rdi
callq 0x3580
// File: /workspace/github_cpp_makefile_star2_O1/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 0xf070
movl %eax, %ebx
movq %r14, %rdi
movq %r15, %rsi
callq 0xe5f8
movq %r12, %rdi
movl %ebx, %esi
callq 0xcf4e
leaq -0x80(%rbp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0xe556
leaq 0x3ea2(%rip), %rcx      # 0x104c3
movl $0x5, %r8d
movq %r15, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3370
leaq -0x50(%rbp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xc657
movq %rdx, -0x60(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x50(%rbp)
jmp 0xc65e
movups (%rcx), %xmm0
movups %xmm0, (%r14)
movq 0x8(%rax), %rdx
leaq -0x60(%rbp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x3e49(%rip), %rsi      # 0x104c9
callq 0x35c0
leaq -0x30(%rbp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xc6a9
movq %rdx, -0x40(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x30(%rbp)
jmp 0xc6b0
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
movq %rdx, -0x38(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdx
movq 0x88fa(%rip), %rdi      # 0x14fd0
callq 0x33a0
movq %rax, %rdi
movl %ebx, %esi
callq 0x3540
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3330
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3260
movq -0x40(%rbp), %rdi
cmpq %r15, %rdi
je 0xc71d
callq 0x3320
movq -0x60(%rbp), %rdi
cmpq %r14, %rdi
je 0xc72b
callq 0x3320
leaq -0x70(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xc73d
callq 0x3320
addq $0x60, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0xc765
movq %rax, %rbx
jmp 0xc773
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r15, %rdi
je 0xc765
callq 0x3320
movq -0x60(%rbp), %rdi
cmpq %r14, %rdi
je 0xc773
callq 0x3320
leaq -0x70(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xc785
callq 0x3320
movq %rbx, %rdi
callq 0x3580
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 (%rsi), %r14
movl $0x1e, %ebx
movq %rsi, -0x38(%rbp)
cmpq 0x8(%rsi), %r14
je 0xc8e5
movq %rdx, -0x40(%rbp)
leaq 0x10(%rbp), %r13
xorl %r12d, %r12d
leaq (%r14,%r12), %r15
leaq -0x80(%rbp), %rdi
movq %r15, %rsi
leaq -0x29(%rbp), %rdx
callq 0x3150
leaq -0x50(%rbp), %rax
movq %rax, -0x60(%rbp)
movq %r13, %rdi
callq 0x3170
leaq (%rax,%r13), %rdx
leaq -0x60(%rbp), %rdi
movq %r13, %rsi
callq 0x62de
movq -0x78(%rbp), %rdx
cmpq -0x58(%rbp), %rdx
jne 0xc817
testq %rdx, %rdx
je 0xc81b
movq -0x60(%rbp), %rsi
movq -0x80(%rbp), %rdi
callq 0x3350
testl %eax, %eax
sete %bl
jmp 0xc81d
xorl %ebx, %ebx
jmp 0xc81d
movb $0x1, %bl
movq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rax
cmpq %rax, %rdi
je 0xc82f
callq 0x3320
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0xc841
callq 0x3320
testb %bl, %bl
jne 0xc86b
leaq (%r14,%r12), %rax
addq $0xe8, %rax
addq $0xe8, %r12
movq -0x38(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0xc7c0
movl $0x1e, %ebx
jmp 0xc8e5
movq 0xd8(%r14,%r12), %rax
cmpq 0xd8(%r13), %rax
jne 0xc896
leaq (%r14,%r12), %rsi
addq $0xe8, %rsi
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rdx
movl $0x1d, %ebx
jmp 0xc8bf
movl $0xe8, %edx
movq -0x40(%rbp), %rdi
movq %r15, %rsi
callq 0x32b0
leaq (%r14,%r12), %rsi
addq $0xe8, %rsi
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rdx
movl $0x1f, %ebx
cmpq %rdx, %rsi
je 0xc8d9
subq %r14, %rdx
subq %r12, %rdx
addq $-0xe8, %rdx
movq %r15, %rdi
callq 0x3500
movq -0x38(%rbp), %rax
addq $-0xe8, 0x8(%rax)
movl %ebx, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0xc90b
callq 0x3320
movq %rbx, %rdi
callq 0x3580
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 $0x218, %rsp            # imm = 0x218
movq %rdi, %rbx
movq 0x20(%rdi), %rdi
leaq -0x238(%rbp), %rsi
callq 0x32f0
cmpl $-0x1, %eax
jne 0xe216
movq 0x20(%rbx), %rdi
movl $0x1ff, %esi            # imm = 0x1FF
callq 0x31a0
movq 0x20(%rbx), %rdi
callq 0x3490
testq %rax, %rax
je 0xe317
movq %rax, %r14
movq %rax, %rdi
callq 0x34b0
testq %rax, %rax
je 0xe30f
movq %rax, %r15
leaq -0x198(%rbp), %r13
leaq 0x40(%rbx), %rax
movq %rax, -0x30(%rbp)
leaq -0x1a8(%rbp), %r12
cmpb $0x8, 0x12(%r15)
jne 0xe2fb
addq $0x13, %r15
movq %r13, -0x1a8(%rbp)
movq 0x20(%rbx), %rsi
movq 0x28(%rbx), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x6244
movq %r12, %rdi
movq %r15, %rsi
callq 0x35c0
movq -0x1a8(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x32f0
movq -0x1a8(%rbp), %rdi
cmpq %r13, %rdi
je 0xe2ad
callq 0x3320
movq -0x58(%rbp), %rdx
movq -0x78(%rbp), %rcx
movq -0x68(%rbp), %r8
movl -0x90(%rbp), %r9d
movq %r12, %rdi
movq %r15, %rsi
callq 0x652c
movq 0x48(%rbx), %rsi
cmpq 0x50(%rbx), %rsi
je 0xe2ef
movl $0xe8, %edx
movq %rsi, %rdi
movq %r12, %rsi
callq 0x32b0
addq $0xe8, 0x48(%rbx)
jmp 0xe2fb
movq -0x30(%rbp), %rdi
movq %r12, %rdx
callq 0x63e0
movq %r14, %rdi
callq 0x34b0
movq %rax, %r15
testq %rax, %rax
jne 0xe255
movq %r14, %rdi
callq 0x34f0
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x1a8(%rbp), %rdi
cmpq %r13, %rdi
je 0xe33d
callq 0x3320
movq %rbx, %rdi
callq 0x3580
nop
// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x58(%rdi), %rdi
movq 0x60(%rbx), %rax
cmpq %rax, %rdi
je 0xe63f
movq %rax, %rdx
subq %rdi, %rdx
addq $-0x8, %rdx
cmpq %rsi, (%rdi)
je 0xe62c
addq $0x8, %rdi
addq $-0x8, %rdx
cmpq %rax, %rdi
jne 0xe618
jmp 0xe63f
leaq 0x8(%rdi), %rsi
cmpq %rax, %rsi
je 0xe63a
callq 0x3500
addq $-0x8, 0x60(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/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
movl $0x2, %edi
movl $0x2, %esi
xorl %edx, %edx
callq 0x30c0
movl %eax, (%r14)
movq $0x0, 0x10(%r14)
cmpl $-0x1, %eax
je 0xe6d9
movl $0x0, 0x8(%r14)
movq (%r15), %rdi
callq 0x3390
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
movl $0x8, %esi
callq 0x3560
movl $0x10, 0x40(%r14)
movl %ebx, 0x4(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
callq 0x370b
// File: /workspace/github_cpp_makefile_star2_O1/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
movl %esi, %ebx
movq %rdi, %r14
movl $0x0, 0x8(%rdi)
movq $0x0, 0x10(%rdi)
movl $0x2, %edi
movl $0x2, %esi
xorl %edx, %edx
callq 0x30c0
movl %eax, (%r14)
cmpl $-0x1, %eax
je 0xe743
movq %r14, %rdi
movl %ebx, %esi
callq 0xe748
movl $0x10, 0x40(%r14)
movl %ebx, 0x4(%r14)
popq %rbx
popq %r14
popq %rbp
retq
callq 0x3733
// File: /workspace/github_cpp_makefile_star2_O1/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
rolw $0x8, %si
movw $0x2, 0x20(%rdi)
movw %si, 0x22(%rdi)
movl $0x0, 0x24(%rdi)
addq $0x28, %rdi
movl $0x8, %esi
callq 0x3560
movl (%rbx), %edi
movq %r14, %rsi
movl $0x10, %edx
callq 0x3090
testl %eax, %eax
js 0xe791
popq %rbx
popq %r14
popq %rbp
retq
callq 0x375b
// File: /workspace/github_cpp_makefile_star2_O1/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 $0x58, %rsp
movl %edx, %r15d
movq %rsi, %rbx
movq %rdi, %r14
movl 0x8(%rdi), %esi
movq %rbx, %rdi
callq 0x663e
leaq 0x20(%r14), %rax
movq %rax, -0x38(%rbp)
xorl %r13d, %r13d
movq %rbx, -0x30(%rbp)
movl (%r14), %edi
movl $0x1000, %edx           # imm = 0x1000
movq %rbx, %rsi
xorl %ecx, %ecx
movq -0x38(%rbp), %r8
movl $0x10, %r9d
callq 0x3070
testq %rax, %rax
js 0xe851
movl 0x4(%rbx), %r12d
movq %r14, %rdi
movl $0x1, %esi
movl %r15d, %edx
callq 0xe9b6
testq %rax, %rax
je 0xe817
cmpl $0x1, (%rax)
jne 0xe813
cmpl %r12d, 0x4(%rax)
jne 0xe813
movb $0x1, %bl
jmp 0xe819
movb $0x1, %al
jmp 0xe81b
xorl %ebx, %ebx
xorl %eax, %eax
testb %al, %al
jne 0xe7ef
testb $0x1, %bl
jne 0xe837
incl %r13d
cmpl $0x3, %r13d
movq -0x30(%rbp), %rbx
jne 0xe7ca
movl $0x3, %r13d
incl 0x8(%r14)
cmpl $0x3, %r13d
setne %al
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x6780(%rip), %rax      # 0x14fd8
movq (%rax), %rcx
leaq 0x1daf(%rip), %rdi      # 0x10611
movl $0x10, %esi
movl $0x1, %edx
callq 0x35d0
leaq 0x14(%rbx), %r14
leaq -0x68(%rbp), %r12
movq %r12, -0x10(%r12)
movq %r14, %rdi
callq 0x3170
leaq (%rbx,%rax), %rdx
addq $0x14, %rdx
leaq -0x78(%rbp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x62de
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq 0x6725(%rip), %rdi      # 0x14fd0
callq 0x33a0
movl (%rbx), %esi
movq %rax, %rdi
callq 0x3540
movq %rax, %r14
leaq 0x1b42(%rip), %rsi      # 0x10406
movl $0x1, %edx
movq %rax, %rdi
callq 0x33a0
leaq 0xfb4(%rbx), %r15
leaq -0x48(%rbp), %r13
movq %r13, -0x10(%r13)
movq %r15, %rdi
callq 0x3170
leaq (%rbx,%rax), %rdx
addq $0xfb4, %rdx            # imm = 0xFB4
leaq -0x58(%rbp), %rdi
movq %r15, %rsi
callq 0x62de
movq -0x58(%rbp), %rsi
movq -0x50(%rbp), %rdx
movq %r14, %rdi
callq 0x33a0
movq %rax, %rdi
callq 0x31d0
leaq -0x58(%rbp), %rdi
callq 0x3180
leaq -0x78(%rbp), %rdi
callq 0x3180
movl $0x1, %edi
callq 0x33c0
movq %rax, %rbx
movq -0x58(%rbp), %rdi
cmpq %r13, %rdi
je 0xe94b
callq 0x3320
jmp 0xe94b
jmp 0xe948
movq %rax, %rbx
movq -0x78(%rbp), %rdi
cmpq %r12, %rdi
je 0xe959
callq 0x3320
movq %rbx, %rdi
callq 0x3580
nop
// File: /workspace/github_cpp_makefile_star2_O1/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
movq %r15, %rdi
movl $0x1, %esi
movl %ebx, %edx
callq 0xe9b6
testq %rax, %rax
je 0xe99d
cmpl $0x1, (%rax)
jne 0xe999
cmpl %r14d, 0x4(%rax)
jne 0xe999
movb $0x1, %r12b
jmp 0xe9a0
movb $0x1, %al
jmp 0xe9a2
xorl %r12d, %r12d
xorl %eax, %eax
testb %al, %al
jne 0xe975
andb $0x1, %r12b
movl %r12d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq