LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/renzibei[P]TSProxy/proxyserver.cpp
// Function: eraseHostFromFdSets(int, fd_set&, fd_set&, int&, int&, int&)
void eraseHostFromFdSets(int hostFd, fd_set &readSet, fd_set &writeSet, int &max_read_sd, int &max_write_sd, int &max_all_sd) {
    
    if (FD_ISSET(hostFd, &writeSet)) {
        close(hostFd);
        FD_CLR(hostFd, &writeSet);
        if (hostFd == max_write_sd) {
            while (FD_ISSET(max_write_sd, &writeSet) == 0 && max_write_sd > 0)
                max_write_sd -= 1;
        }
    }
    else {
        LogHelper::log(Warn, "hostFd :%d not in writeSet");
    }
    if (FD_ISSET(hostFd, &readSet)) {
        FD_CLR(hostFd, &readSet);
        if (hostFd == max_read_sd) {
            while (FD_ISSET(max_read_sd, &readSet) == 0)
                max_read_sd -= 1;
        }
    }
    else {
        LogHelper::log(Warn, "hostFd: %d not in readSet");
    }
    
    max_all_sd = std::max(max_read_sd, max_write_sd);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r9, 0x20(%rsp)
movq %r8, %r14
movq %rcx, 0x10(%rsp)
movq %rdx, %r13
movq %rsi, %r12
movl %edi, %ebp
pushq $0x40
popq %rbx
movl %edi, %eax
cltd
idivl %ebx
movl %edx, %ecx
cltq
pushq $0x1
popq %r15
shlq %cl, %r15
movq %rax, 0x8(%rsp)
movq (%r13,%rax,8), %rax
btq %rcx, %rax
movq %r15, 0x18(%rsp)
notq %r15
jae 0x30e4
movl %ebp, %edi
callq 0x2350
pushq $0x1
popq %r8
movq 0x8(%rsp), %rdi
andq %r15, (%r13,%rdi,8)
cmpl %ebp, (%r14)
jne 0x30fa
movl %ebp, %esi
movl %esi, %eax
cltd
idivl %ebx
movl %edx, %ecx
movq %r8, %rdx
shlq %cl, %rdx
testl %esi, %esi
jle 0x30fa
cltq
andq (%r13,%rax,8), %rdx
jne 0x30fa
decl %esi
movl %esi, (%r14)
jmp 0x30c3
leaq 0x44b8(%rip), %rsi      # 0x75a3
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x262c
movq 0x8(%rsp), %rdi
movq (%r12,%rdi,8), %rax
testq %rax, 0x18(%rsp)
je 0x312e
andq %r15, %rax
movq %rax, (%r12,%rdi,8)
movq 0x10(%rsp), %rcx
movl (%rcx), %eax
cmpl %ebp, %eax
jne 0x314a
movl %ebp, %eax
cltd
idivl %ebx
cltq
movq (%r12,%rax,8), %rax
btq %rdx, %rax
jb 0x3148
decl %ebp
movl %ebp, (%rcx)
jmp 0x3117
leaq 0x4489(%rip), %rsi      # 0x75be
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x262c
movq 0x10(%rsp), %rax
movl (%rax), %eax
jmp 0x314a
movl %ebp, %eax
movl (%r14), %ecx
cmpl %ecx, %eax
cmovgl %eax, %ecx
movq 0x20(%rsp), %rax
movl %ecx, (%rax)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/renzibei[P]TSProxy/proxyserver.cpp
// Function: eraseClientFromFdSet(int, fd_set&, int&, int, int&)
void eraseClientFromFdSet(int clientFd, fd_set &readSet, int &max_read_sd, int max_write_sd, int &max_all_sd) {
    close(clientFd);
    FD_CLR(clientFd, &readSet);
    if (clientFd == max_read_sd) {
        while (FD_ISSET(max_read_sd, &readSet) == 0)
            max_read_sd -= 1;
    }
    max_all_sd = std::max(max_read_sd, max_write_sd);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %r8, %rbx
movl %ecx, %ebp
movq %rdx, %r14
movq %rsi, %r12
movl %edi, %r15d
callq 0x2350
pushq $-0x2
popq %rsi
movl %r15d, %ecx
rolq %cl, %rsi
pushq $0x40
popq %rcx
movl %r15d, %eax
cltd
idivl %ecx
cltq
andq %rsi, (%r12,%rax,8)
movl (%r14), %eax
cmpl %r15d, %eax
jne 0x31c0
movl %r15d, %eax
cltd
idivl %ecx
cltq
movq (%r12,%rax,8), %rax
btq %rdx, %rax
jb 0x31bd
decl %r15d
movl %r15d, (%r14)
jmp 0x31a3
movl %r15d, %eax
cmpl %ebp, %eax
cmovgl %eax, %ebp
movl %ebp, (%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/renzibei[P]TSProxy/proxyserver.cpp
// Function: cleanDeadLocalFds(int, std::unordered_map<int, HostNode, std::hash<int>, std::equal_to<int>, std::allocator<std::pair<int const, HostNode>>>&, std::unordered_map<int, SocketNode, std::hash<int>, std::equal_to<int>, std::allocator<std::pair<int const, SocketNode>>>&, fd_set&, fd_set&, int&, int&, int&, bool)
void cleanDeadLocalFds(int clientFd, HostMap &h2lMap, SocketMap &sMap, fd_set &readSet, fd_set &writeSet, int &max_read_sd, int &max_write_sd, int &max_all_sd, bool forceClean = false) {
    time_t now = time(NULL);
    for (auto it = sMap.begin(); it != sMap.end();) {
        if (forceClean || now - it->second.lastTime > constants::SocketTimeOutSeconds) {
            int localFd = it->first, hostFd = it->second.sockFd;
            LogHelper::log(Debug, "Clean timeout localFd %d in clientFd: %d, forceClean: %d", localFd, clientFd, forceClean);
            eraseHostFromFdSets(hostFd, readSet, writeSet, max_read_sd, max_write_sd, max_all_sd);
            h2lMap.erase(hostFd);
            it = sMap.erase(it);
            
        }
        else it++;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r9, 0x20(%rsp)
movq %r8, 0x18(%rsp)
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %r13
movl %edi, %ebp
xorl %edi, %edi
callq 0x21a0
movq %rax, 0x10(%rsp)
movq 0x10(%r12), %r14
movzbl 0x70(%rsp), %ebx
testq %r14, %r14
je 0x328d
cmpb $0x0, 0x70(%rsp)
jne 0x3226
movq 0x10(%rsp), %rax
subq 0x18(%r14), %rax
cmpq $0xb5, %rax
jl 0x3285
movl 0x8(%r14), %edx
movl 0x10(%r14), %eax
movl %eax, 0xc(%rsp)
pushq $0x3
popq %rdi
leaq 0x439c(%rip), %rsi      # 0x75d8
movl %ebp, %ecx
movl %ebx, %r8d
xorl %eax, %eax
callq 0x262c
movl 0xc(%rsp), %edi
movq %r15, %rsi
movq 0x18(%rsp), %rdx
movq 0x20(%rsp), %rcx
movq 0x60(%rsp), %r8
movq 0x68(%rsp), %r9
callq 0x3059
movq %r13, %rdi
leaq 0xc(%rsp), %rsi
callq 0x51c2
movq %r12, %rdi
movq %r14, %rsi
callq 0x52c4
movq %rax, %r14
jmp 0x3209
movq (%r14), %r14
jmp 0x3209
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/renzibei[P]TSProxy/proxyserver.cpp
// Function: cleanDeadHosts(std::unordered_map<int, ClientNode*, std::hash<int>, std::equal_to<int>, std::allocator<std::pair<int const, ClientNode*>>>&, std::unordered_map<int, HostNode, std::hash<int>, std::equal_to<int>, std::allocator<std::pair<int const, HostNode>>>&, fd_set&, fd_set&, int&, int&, int&)
void cleanDeadHosts(ClientMap &cMap, HostMap &sMap, fd_set &readSet, fd_set &writeSet, int &max_read_sd, int &max_write_sd, int &max_all_sd) {
    time_t now = time(NULL);
    for (auto it = sMap.begin(); it != sMap.end();) {
        if (now - it->second.lastTime > constants::SocketTimeOutSeconds) {
            LogHelper::log(Debug, "Clean timeout host fd: %d, localFd: %d", it->first, it->second.localFd);
            eraseHostFromFdSets(it->first, readSet, writeSet, max_read_sd, max_write_sd, max_all_sd);
            cMap[it->second.clientFd]->sMap.erase(it->second.localFd);
            it = sMap.erase(it);
        }
        else it++;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r9, 0x10(%rsp)
movq %r8, 0x8(%rsp)
movq %rcx, (%rsp)
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %rbp
xorl %edi, %edi
callq 0x21a0
movq %rax, %rbx
movq 0x10(%r13), %r14
testq %r14, %r14
je 0x334f
movq %rbx, %rax
subq 0x18(%r14), %rax
cmpq $0xb5, %rax
jl 0x334a
leaq 0x14(%r14), %r15
movl 0x8(%r14), %edx
movl 0x14(%r14), %ecx
pushq $0x3
popq %rdi
leaq 0x4318(%rip), %rsi      # 0x7611
xorl %eax, %eax
callq 0x262c
movl 0x8(%r14), %edi
movq %r12, %rsi
movq (%rsp), %rdx
movq 0x8(%rsp), %rcx
movq 0x10(%rsp), %r8
movq 0x50(%rsp), %r9
callq 0x3059
leaq 0x10(%r14), %rsi
movq %rbp, %rdi
callq 0x473a
movq (%rax), %rdi
addq $0x18, %rdi
movq %r15, %rsi
callq 0x53c4
movq %r13, %rdi
movq %r14, %rsi
callq 0x5412
movq %rax, %r14
jmp 0x32cf
movq (%r14), %r14
jmp 0x32cf
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/renzibei[P]TSProxy/proxyserver.cpp
// Function: cleanDeadClients(std::unordered_map<int, ClientNode*, std::hash<int>, std::equal_to<int>, std::allocator<std::pair<int const, ClientNode*>>>&, std::unordered_map<int, HostNode, std::hash<int>, std::equal_to<int>, std::allocator<std::pair<int const, HostNode>>>&, fd_set&, fd_set&, int&, int&, int&)
void cleanDeadClients(ClientMap &cMap, HostMap &h2lMap, fd_set &readSet, fd_set &writeSet, int &max_read_sd, int &max_write_sd, int &max_all_sd) {
    time_t now = time(NULL);
    for (auto it = cMap.begin(); it != cMap.end(); ) {
        if (now - it->second->lastTime > constants::ClientTimeOutSeconds) {
            LogHelper::log(Debug, "Clean timeout client fd: %d", it->first);
            cleanDeadLocalFds(it->first, h2lMap, it->second->sMap, readSet, writeSet, max_read_sd, max_write_sd, max_all_sd, true);
            eraseClientFromFdSet(it->first, readSet, max_read_sd, max_write_sd, max_all_sd);
            delete it->second;
            it = cMap.erase(it);
        }
        else {
            cleanDeadLocalFds(it->first, h2lMap, it->second->sMap, readSet, writeSet, max_read_sd, max_write_sd, max_all_sd);
            it++;
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r9, 0x18(%rsp)
movq %r8, 0x10(%rsp)
movq %rcx, %r13
movq %rdx, 0x8(%rsp)
movq %rsi, %rbp
movq %rdi, %rbx
xorl %edi, %edi
callq 0x21a0
movq %rax, %r14
movq %rbx, 0x30(%rsp)
movq 0x10(%rbx), %r15
movq %rbp, 0x28(%rsp)
movq %rax, 0x20(%rsp)
movq 0x8(%rsp), %rbx
movq 0x10(%rsp), %r12
testq %r15, %r15
je 0x34a5
movq 0x10(%r15), %rdx
movq %r14, %rcx
subq 0x10(%rdx), %rcx
movl 0x8(%r15), %eax
cmpq $0x79, %rcx
jl 0x346d
pushq $0x3
popq %rdi
leaq 0x4261(%rip), %rsi      # 0x7638
movl %eax, %edx
xorl %eax, %eax
callq 0x262c
movl 0x8(%r15), %edi
movq 0x10(%r15), %rdx
addq $0x18, %rdx
subq $0x8, %rsp
movq %rbp, %rsi
movq %rbx, %rcx
movq %r13, %rbp
movq %r13, %r8
movq %r12, %r9
pushq $0x1
movq 0x80(%rsp), %r14
pushq %r14
movq 0x30(%rsp), %r13
pushq %r13
callq 0x31d0
addq $0x20, %rsp
movl 0x8(%r15), %edi
movl (%r13), %ecx
movq %rbx, %rsi
movq %r12, %rdx
movq %r14, %r8
callq 0x3168
movq 0x10(%r15), %r13
testq %r13, %r13
je 0x3443
leaq 0x18(%r13), %rdi
callq 0x446c
movq %r13, %rdi
callq 0x21b0
movq 0x30(%rsp), %rdi
movq %r15, %rsi
callq 0x5460
movq %rax, %r15
movq %rbp, %r13
movq 0x28(%rsp), %rbp
movq 0x20(%rsp), %r14
jmp 0x33ab
addq $0x18, %rdx
subq $0x8, %rsp
movl %eax, %edi
movq %rbp, %rsi
movq 0x10(%rsp), %rcx
movq %r13, %r8
movq 0x18(%rsp), %r9
pushq $0x0
pushq 0x80(%rsp)
pushq 0x30(%rsp)
callq 0x31d0
addq $0x20, %rsp
movq (%r15), %r15
jmp 0x33ab
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/renzibei[P]TSProxy/proxyserver.cpp
// Function: HostNode::readFromBuffer(unsigned char*, unsigned long)
ssize_t readFromBuffer(uint8_t *dst, size_t nbyte) {
        size_t limit = std::min(writeBuf.size(), nbyte);
        for(size_t i = 0; i < limit; ++i) {
            dst[i] = writeBuf[i];
        }
        return limit;
    }

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
addq $0x10, %rdi
callq 0x3eee
cmpq %rbx, %rax
cmovbq %rax, %rbx
addq $0x20, %r15
xorl %r12d, %r12d
cmpq %r12, %rbx
je 0x3f41
movq %r15, %rdi
movq %r12, %rsi
callq 0x44f2
movb (%rax), %al
movb %al, (%r14,%r12)
incq %r12
jmp 0x3f26
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/renzibei[P]TSProxy/utils.cpp
// Function: make_socket(unsigned short, int, int)
int make_socket(uint16_t port, int on, int bindToLoopback)
{
    int sock;
    struct sockaddr_in6 name;

    /* Create the socket. */    
    sock = socket(AF_INET6, SOCK_STREAM, 0);
    if (sock < 0)
    {
        LogHelper::log(Error, "failed to create socket, %s", strerror(errno));
        return -1;
    }

    // set reuseable
    int rc = setsockopt(sock, SOL_SOCKET,  SO_REUSEADDR,
                   (char *)&on, sizeof(on));
    if (rc < 0)
    {
        LogHelper::log(Error, "setsockopt() failed, %s", strerror(errno));
        close(sock);
        return -2;
    }

    /* Give the socket a name. */
    memset(&name, 0, sizeof(name));
    name.sin6_family = AF_INET6;
    name.sin6_port = htons (port);
    //   name.sin6_addr.s_addr = htonl (INADDR_ANY);
    
    if (bindToLoopback)
        memcpy(&name.sin6_addr, &in6addr_loopback, sizeof(in6addr_loopback));
    else
        memcpy(&name.sin6_addr, &in6addr_any, sizeof(in6addr_any));

    if (bind (sock, (struct sockaddr *) &name, sizeof (name)) < 0)
    {
        LogHelper::log(Error, "Failed to bind, %s", strerror(errno));
        return -3;
    }

    return sock;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movl %edx, %ebp
movl %edi, %r14d
movl %esi, (%rsp)
pushq $0xa
popq %rdi
pushq $0x1
popq %rsi
xorl %edx, %edx
callq 0x2080
testl %eax, %eax
js 0x58c1
movl %eax, %ebx
pushq $0x1
popq %rsi
pushq $0x2
popq %rdx
movq %rsp, %rcx
pushq $0x4
popq %r8
movl %eax, %edi
callq 0x2320
testl %eax, %eax
js 0x58e4
xorps %xmm0, %xmm0
leaq 0xc(%rsp), %rax
movups %xmm0, -0x4(%rax)
andq $0x0, 0xc(%rax)
movw $0xa, -0x8(%rax)
rolw $0x8, %r14w
movw %r14w, -0x6(%rax)
testl %ebp, %ebp
je 0x590e
movq 0x6711(%rip), %rcx      # 0xbfd0
jmp 0x5915
callq 0x2040
movl (%rax), %edi
callq 0x20d0
leaq 0x2131(%rip), %rsi      # 0x7a05
xorl %edi, %edi
movq %rax, %rdx
xorl %eax, %eax
callq 0x262c
pushq $-0x1
jmp 0x594f
callq 0x2040
movl (%rax), %edi
callq 0x20d0
leaq 0x212a(%rip), %rsi      # 0x7a21
xorl %edi, %edi
movq %rax, %rdx
xorl %eax, %eax
callq 0x262c
movl %ebx, %edi
callq 0x2350
pushq $-0x2
jmp 0x594f
movq 0x66cb(%rip), %rcx      # 0xbfe0
movups (%rcx), %xmm0
movups %xmm0, (%rax)
leaq 0x4(%rsp), %rsi
pushq $0x1c
popq %rdx
movl %ebx, %edi
callq 0x2060
testl %eax, %eax
jns 0x5950
callq 0x2040
movl (%rax), %edi
callq 0x20d0
leaq 0x20f8(%rip), %rsi      # 0x7a39
xorl %edi, %edi
movq %rax, %rdx
xorl %eax, %eax
callq 0x262c
pushq $-0x3
popq %rbx
movl %ebx, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/renzibei[P]TSProxy/utils.cpp
// Function: readNBytes(int, void*, unsigned long, int)
ssize_t readNBytes(int fd, void *buf, size_t nbyte, int isNonBlocking) {
    size_t hasRead = 0;
    char* dest = (char*)buf;
    while(hasRead < nbyte) {
        ssize_t tempLen = recv(fd, dest + hasRead, nbyte - hasRead, 0);
        if(tempLen < 0) {
            if (isNonBlocking && errno == EAGAIN) {
                continue;
            }
            LogHelper::log(Error, "Error happens when read fd , errno: %d %s", errno, strerror(errno));
            return -1;
        }
        if(isNonBlocking && tempLen == 0) {
            LogHelper::log(Error, "Connection has been closed in sockFd %d when tried to recv", fd);
            return hasRead;
        }
        hasRead += tempLen;
        
    }
    
    return hasRead;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %r14d
movq %rdx, %r12
movl %edi, %ebp
xorl %ebx, %ebx
movq %rsi, (%rsp)
leaq (%rsi,%rbx), %r13
movq %r12, %r15
subq %rbx, %r15
cmpq %rbx, %r12
jbe 0x59e2
movl %ebp, %edi
movq %r13, %rsi
movq %r15, %rdx
xorl %ecx, %ecx
callq 0x20c0
testq %rax, %rax
jns 0x59a8
callq 0x2040
testl %r14d, %r14d
je 0x59c1
cmpl $0xb, (%rax)
je 0x597e
jmp 0x59c1
testl %r14d, %r14d
sete %cl
testq %rax, %rax
setne %dl
orb %cl, %dl
je 0x59f4
addq %rax, %rbx
movq (%rsp), %rsi
jmp 0x5974
movl (%rax), %ebx
movl %ebx, %edi
callq 0x20d0
leaq 0x207b(%rip), %rsi      # 0x7a4c
xorl %edi, %edi
movl %ebx, %edx
movq %rax, %rcx
xorl %eax, %eax
callq 0x262c
pushq $-0x1
popq %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x207b(%rip), %rsi      # 0x7a76
xorl %edi, %edi
movl %ebp, %edx
xorl %eax, %eax
callq 0x262c
jmp 0x59e2
// File: /workspace/github_cpp_makefile_star2_O2/renzibei[P]TSProxy/utils.cpp
// Function: writeNBytes(int, void const*, unsigned long, int)
ssize_t writeNBytes(int fd, const void *buf, size_t nbyte, int isNonBlocking) {
    size_t hasWritten = 0;
    const char* src = (const char*)buf;
    

    while(hasWritten < nbyte) {
        ssize_t tempLen = send(fd, src + hasWritten, nbyte - hasWritten, 0);
        if(tempLen < 0) {
            if (isNonBlocking && errno == EAGAIN) {
                continue;
            }
            LogHelper::log(Error, "Errors when write fd, fd: %d, %s", fd, strerror(errno));
            return -1;
        }
        if (isNonBlocking && tempLen == 0) {
            LogHelper::log(Error, "Connection has been closed in sockFd %d when tried to send", fd);
            return hasWritten;
        }
        hasWritten += tempLen;
    }
    return hasWritten;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %ebp
movq %rdx, %r12
movl %edi, %ebx
xorl %r14d, %r14d
movq %rsi, (%rsp)
leaq (%rsi,%r14), %r13
movq %r12, %r15
subq %r14, %r15
cmpq %r14, %r12
jbe 0x5a8c
movl %ebx, %edi
movq %r13, %rsi
movq %r15, %rdx
xorl %ecx, %ecx
callq 0x2110
testq %rax, %rax
jns 0x5a54
callq 0x2040
testl %ebp, %ebp
je 0x5a6c
cmpl $0xb, (%rax)
je 0x5a2b
jmp 0x5a6c
testl %ebp, %ebp
sete %cl
testq %rax, %rax
setne %dl
orb %cl, %dl
je 0x5a9e
addq %rax, %r14
movq (%rsp), %rsi
jmp 0x5a21
movl (%rax), %edi
callq 0x20d0
leaq 0x2037(%rip), %rsi      # 0x7ab1
xorl %edi, %edi
movl %ebx, %edx
movq %rax, %rcx
xorl %eax, %eax
callq 0x262c
pushq $-0x1
popq %r14
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x202d(%rip), %rsi      # 0x7ad2
xorl %edi, %edi
movl %ebx, %edx
xorl %eax, %eax
callq 0x262c
jmp 0x5a8c
// File: /workspace/github_cpp_makefile_star2_O2/renzibei[P]TSProxy/utils.cpp
// Function: disAssembleInnerMsg(InnerMsg*, unsigned char const*, unsigned long)
int disAssembleInnerMsg(InnerMsg *msg ,const uint8_t *src_data, size_t nbyte) {
    // memset(msg, 0, sizeof(InnerMsg));
    if (nbyte < sizeof(msg->cSeq) + sizeof(msg->sSeq) + sizeof(msg->msgType) + sizeof(msg->dataLength) ) {
        LogHelper::log(Warn, "nbyte less than InnerMsg header, nbyte: %lu", nbyte); 
        return -1;
    }
    ntoh_copy8bytes(&(msg->cSeq), src_data); src_data += sizeof(msg->cSeq);
    ntoh_copy8bytes(&(msg->sSeq), src_data); src_data += sizeof(msg->sSeq);
    ntoh_copy2bytes(&(msg->msgType), src_data); src_data += sizeof(msg->msgType);
    ntoh_copy2bytes(&(msg->dataLength), src_data); src_data += sizeof(msg->dataLength);
    memcpy(msg->data, src_data, msg->dataLength);
    return 0;
}

// Assembly:
pushq %rax
cmpq $0x13, %rdx
ja 0x5acf
leaq 0x204d(%rip), %rsi      # 0x7b0d
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x262c
pushq $-0x1
popq %rax
jmp 0x5b0d
movq (%rsi), %rax
bswapq %rax
movq %rax, (%rdi)
movq 0x8(%rsi), %rax
bswapq %rax
movq %rax, 0x8(%rdi)
movzwl 0x10(%rsi), %eax
rolw $0x8, %ax
movw %ax, 0x10(%rdi)
movzwl 0x12(%rsi), %eax
rolw $0x8, %ax
movw %ax, 0x12(%rdi)
addq $0x14, %rsi
addq $0x14, %rdi
movzwl %ax, %edx
callq 0x2160
xorl %eax, %eax
popq %rcx
retq
// File: /workspace/github_cpp_makefile_star2_O2/renzibei[P]TSProxy/utils.cpp
// Function: assembleInnerMsg(unsigned char*, unsigned long, InnerMsg const*)
ssize_t assembleInnerMsg(uint8_t *dst, size_t buffer_size, const InnerMsg *src_msg) {
    uint8_t *old_dst = dst;
    if (buffer_size < sizeof(src_msg->cSeq) + sizeof(src_msg->sSeq) + sizeof(src_msg->msgType) + sizeof(src_msg->dataLength)) {
        LogHelper::log(Warn, "buffer size less than inner msg header, buffer_size: %lu");
        return -1;
    }
    hton_copy8bytes(dst, &(src_msg->cSeq)); dst += sizeof(src_msg->cSeq);
    hton_copy8bytes(dst, &(src_msg->sSeq)); dst += sizeof(src_msg->sSeq);
    hton_copy2bytes(dst, &(src_msg->msgType)); dst += sizeof(src_msg->msgType);
    hton_copy2bytes(dst, &(src_msg->dataLength)); dst += sizeof(src_msg->dataLength);
    buffer_size -= sizeof(src_msg->cSeq) + sizeof(src_msg->sSeq) + sizeof(src_msg->dataLength);
    if (buffer_size < src_msg->dataLength) {
        LogHelper::log(Warn, "buffer size less than InnerMsg dataLength, buffer_size: %lu, dataLength: %lu", buffer_size, src_msg->dataLength);
        return -2;
    }
    memcpy(dst, src_msg->data, src_msg->dataLength); dst += src_msg->dataLength;
    return dst - old_dst; 
}

// Assembly:
pushq %rbx
cmpq $0x13, %rsi
ja 0x5c45
leaq 0x1fde(%rip), %rsi      # 0x7c15
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x262c
pushq $-0x1
jmp 0x5c97
movq %rdx, %rbx
movq %rsi, %rdx
movq (%rbx), %rax
bswapq %rax
movq %rax, (%rdi)
movq 0x8(%rbx), %rax
bswapq %rax
movq %rax, 0x8(%rdi)
movzwl 0x10(%rbx), %eax
rolw $0x8, %ax
movw %ax, 0x10(%rdi)
movzwl 0x12(%rbx), %eax
rolw $0x8, %ax
movw %ax, 0x12(%rdi)
addq $-0x12, %rdx
movzwl 0x12(%rbx), %ecx
cmpq %rcx, %rdx
jae 0x5c9a
leaq 0x1fc3(%rip), %rsi      # 0x7c4e
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x262c
pushq $-0x2
popq %rax
jmp 0x5cb2
addq $0x14, %rdi
leaq 0x14(%rbx), %rsi
movq %rcx, %rdx
callq 0x2160
movzwl 0x12(%rbx), %eax
addq $0x14, %rax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/renzibei[P]TSProxy/utils.cpp
// Function: getRand63()
uint64_t getRand63() {
    uint64_t ret = 0;
    for (int i = 0; i < 63; ++i) {
        ret = (ret << 1) + (rand() & 1);
    }
    ret &= 0x7fffffffffffffffULL;
    return ret;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
pushq $0x3f
popq %rbp
xorl %ebx, %ebx
subl $0x1, %ebp
jb 0x60e2
callq 0x2090
andl $0x1, %eax
leaq (%rax,%rbx,2), %rbx
jmp 0x60cf
btrq $0x3f, %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O2/renzibei[P]TSProxy/constants.cpp
// Function: constants::getKey(char (&) [16])
int getKey(char (&dst)[16]) {
    // uuid_t id;
    if (hasParsedKey == 0) {
        int code = uuid_parse(constants::uuidKey, storedId);
        if (code != 0)
            return code;
        hasParsedKey = 1;
    }
    memcpy(dst, storedId, 16);
    return 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
cmpb $0x0, 0xb6391(%rip)     # 0xbc490
jne 0x611f
leaq 0x1de8(%rip), %rdi      # 0x7ef0
leaq 0xb6391(%rip), %rsi     # 0xbc4a0
callq 0x22e0
testl %eax, %eax
jne 0x612b
movb $0x1, 0xb6371(%rip)     # 0xbc490
movaps 0xb637a(%rip), %xmm0    # 0xbc4a0
movups %xmm0, (%rbx)
xorl %eax, %eax
popq %rbx
retq
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O2/renzibei[P]TSProxy/aes.cpp
// Function: addKey(int (&) [4][4], int)
static void addKey(int (&array)[4][4], int round) {
	int warray[4];
	int i,j;
	for(i = 0; i < 4; i++) {
		intToArray(w[round*4 + i], warray);
		for(j = 0; j < 4; j++) {
			array[j][i] = array[j][i] ^ warray[j];
		}
	}
}

// Assembly:
shll $0x2, %esi
movslq %esi, %rax
xorl %ecx, %ecx
leaq 0xb68de(%rip), %rdx     # 0xbccf0
movl $0xff, %esi
cmpq $0x4, %rcx
je 0x647a
movq %rcx, %r8
orq %rax, %r8
movl (%rdx,%r8,4), %r8d
movl %r8d, %r9d
shrl $0x18, %r9d
movl %r9d, -0x18(%rsp)
movl %r8d, %r9d
shrl $0x10, %r9d
andl %esi, %r9d
movl %r9d, -0x14(%rsp)
movl %r8d, %r9d
shrl $0x8, %r9d
andl %esi, %r9d
movl %r9d, -0x10(%rsp)
andl %esi, %r8d
movl %r8d, -0xc(%rsp)
xorl %r8d, %r8d
cmpq $0x10, %r8
je 0x6471
movl -0x18(%rsp,%r8), %r9d
xorl %r9d, (%rdi,%r8,4)
addq $0x4, %r8
jmp 0x645c
incq %rcx
addq $0x4, %rdi
jmp 0x6417
retq
// File: /workspace/github_cpp_makefile_star2_O2/renzibei[P]TSProxy/aes.cpp
// Function: subBytes(int (&) [4][4])
static void subBytes(int (&array)[4][4]){
	int i,j;
	for(i = 0; i < 4; i++)
		for(j = 0; j < 4; j++)
			array[i][j] = getNumFromBox(S, array[i][j]);
}

// Assembly:
xorl %eax, %eax
leaq 0x1adc(%rip), %rcx      # 0x7f60
cmpq $0x4, %rax
je 0x64bb
xorl %edx, %edx
cmpq $0x4, %rdx
je 0x64b2
movl (%rdi,%rdx,4), %esi
movl %esi, %r8d
andl $0xf, %r8d
andl $0xf0, %esi
leaq (%rcx,%rsi,4), %rsi
movl (%rsi,%r8,4), %esi
movl %esi, (%rdi,%rdx,4)
incq %rdx
jmp 0x648c
incq %rax
addq $0x10, %rdi
jmp 0x6484
retq
// File: /workspace/github_cpp_makefile_star2_O2/renzibei[P]TSProxy/aes.cpp
// Function: shiftRows(int (&) [4][4])
static void shiftRows(int (&array)[4][4]) {
	int i,j;
	int copy[4];
	for(i=1; i<4; i++){
		// 记录下来
		for(j=0; j<4; j++){
			copy[j] = array[i][j];
		}
		for(j=0; j<4; j++){
			// 循环左移 i 位
			array[i][j] = copy[(4+j+i)%4];
		}
	}
}

// Assembly:
addq $0x10, %rdi
movabsq $0x1, %rax
cmpq $0x4, %rax
je 0x6507
xorl %ecx, %ecx
cmpq $0x4, %rcx
je 0x64e4
movl (%rdi,%rcx,4), %edx
movl %edx, -0x18(%rsp,%rcx,4)
incq %rcx
jmp 0x64d2
xorl %ecx, %ecx
cmpq $0x4, %rcx
je 0x64fe
leal (%rax,%rcx), %edx
andl $0x3, %edx
movl -0x18(%rsp,%rdx,4), %edx
movl %edx, (%rdi,%rcx,4)
incq %rcx
jmp 0x64e6
incq %rax
addq $0x10, %rdi
jmp 0x64ca
retq
// File: /workspace/github_cpp_makefile_star2_O2/renzibei[P]TSProxy/aes.cpp
// Function: showStr(char*)
void showStr(char *str){
	int i;
	for(i=0;i<16;i++)
		printf("%02x", (unsigned char)str[i]);
		// printf("%c", (unsigned char)str[i]);
	printf("\n");
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x1eb9(%rip), %r14      # 0x83d0
xorl %r15d, %r15d
cmpq $0x10, %r15
je 0x6534
movzbl (%rbx,%r15), %esi
movq %r14, %rdi
xorl %eax, %eax
callq 0x2050
incq %r15
jmp 0x651a
pushq $0xa
popq %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x22a0
// File: /workspace/github_cpp_makefile_star2_O2/renzibei[P]TSProxy/aes.cpp
// Function: compute_hh(unsigned char (&) [16])
int compute_hh(unsigned char (&h)[16])
{//计算h<<1，h<<2，h<<3，....h<<127；p(x)=x128+ x7 + x2 +x + 1; 
		int i,msb,j;    
	memcpy(hh[0],h,16);//hh[0]=h
	for(i=1;i<128;i++)
	{
		msb=hh[i-1][0]>>7;//最高位
		for(j=0;j<15;j++)//h[i]=h[i-1]<<1 | ...
			hh[i][j] = ((hh[i-1][j]<<1) | (hh[i-1][j+1]>>7)) &255;
		hh[i][15] = hh[i-1][15]<<1;
		if(msb==1)
			hh[i][15] ^= 0x87;
	}
	return 0;
}

// Assembly:
pushq %rbx
movups (%rdi), %xmm0
movaps %xmm0, 0xb5fa4(%rip)    # 0xbc4f0
movabsq $0x1, %rax
leaq 0xb5fa3(%rip), %rcx     # 0xbc500
leaq 0xb5f8c(%rip), %rdx     # 0xbc4f0
movabsq $-0xf, %rsi
cmpq $0x80, %rax
je 0x65d4
movq %rax, %rdi
shlq $0x4, %rdi
leaq (%rdi,%rdx), %r9
addq $-0x10, %r9
movb (%r9), %r8b
movq %rsi, %r10
testq %r10, %r10
je 0x65ac
movb -0x1(%rcx,%r10), %r11b
movb (%rcx,%r10), %bl
shrb $0x7, %bl
addb %r11b, %r11b
orb %bl, %r11b
movb %r11b, 0xf(%rcx,%r10)
incq %r10
jmp 0x658b
movb 0xf(%r9), %r9b
addb %r9b, %r9b
movzbl %r9b, %r10d
xorb $-0x79, %r9b
testb %r8b, %r8b
movzbl %r9b, %r8d
cmovnsl %r10d, %r8d
movb %r8b, 0xf(%rdi,%rdx)
incq %rax
addq $0x10, %rcx
jmp 0x656e
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/renzibei[P]TSProxy/aes.cpp
// Function: mult_h(unsigned char (&) [16], unsigned char (&) [16])
static int mult_h(unsigned char (&a)[16],unsigned char (&b)[16])
{//有限域乘法G(2128);注意：a，b不能为同一个地址（b在不停的更新）
	int i,j,k,m;
	memset(b,0,16);
	for(k=0,i=15; i>=0; i--)//从低位开始，数据都是从高位开始的，所以从15开始。
	{//k为从低位开始的计数器
		for(j=0; j<8; j++,k++)
		{
			if( ((a[i]>>j)&1) == 1)//每个字节也从低位开始
			{
				for(m=0;m<16;m++)
					b[m] ^= hh[k][m] ;
			}
		}
	}
	return 0;
}

// Assembly:
pushq %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rsi)
movl $0xf, %eax
xorl %ecx, %ecx
leaq 0xb5d5e(%rip), %rdx     # 0xbc4f0
testl %eax, %eax
js 0x67e0
movl %eax, %r8d
movslq %ecx, %rcx
movq %rcx, %r9
shlq $0x4, %r9
addq %rdx, %r9
xorl %r10d, %r10d
cmpl $0x8, %r10d
je 0x67dc
movzbl (%rdi,%r8), %r11d
btl %r10d, %r11d
jae 0x67d0
xorl %r11d, %r11d
cmpq $0x10, %r11
je 0x67d0
movb (%r9,%r11), %bl
xorb %bl, (%rsi,%r11)
incq %r11
jmp 0x67bd
incl %r10d
incq %rcx
addq $0x10, %r9
jmp 0x67a9
decl %eax
jmp 0x6792
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/renzibei[P]TSProxy/aes.cpp
// Function: encrypt(char*, int, char const*, int, char const (&) [16], char (&) [16], char (&) [16])
int encrypt(char *dst, int dst_size, const char *src, int src_size, const char (&key)[16], char (&random)[16], char (&mac)[16]) {
	int valid_size = (src_size >> 4) << 4;
	if (valid_size < src_size)
		valid_size += 16;
	if (valid_size < src_size + 2) {
		valid_size += 16;
	}
	// static char buf[constants::AES_MAX_DATA_LENGTH];
	
	if (valid_size > constants::AES_MAX_DATA_LENGTH) {
		LogHelper::log(Error, "data size should be no longer than: %lu, but size is: %d", constants::AES_MAX_DATA_LENGTH, valid_size);
		return -5;
	}
	
	if (dst_size < valid_size) {
		LogHelper::log(Error, "dst_size is less than valid size, dst_size: %d, valid_size: %d", dst_size, valid_size);
		return -5;
	}
	char *buf = new char[valid_size];
	memcpy(buf, src, src_size);
	
	//Padding
	memset(buf + src_size, 0, valid_size - src_size);
	buf[src_size] = 0xf;

	int retCode = encode(dst, dst_size, buf, valid_size, key, random, mac);
	delete[] buf;
	if (retCode != 0) {
		LogHelper::log(Error, "Fail to encrypt");
		return retCode;
	}
	
	return valid_size;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %ecx, %r13d
movl %ecx, %eax
andl $-0x10, %eax
leal 0x10(%rax), %ecx
cmpl %r13d, %eax
cmovel %eax, %ecx
leal 0x2(%r13), %eax
leal 0x10(%rcx), %ebx
cmpl %eax, %ecx
cmovgel %ecx, %ebx
cmpl $0xffcd, %ebx           # imm = 0xFFCD
jb 0x69e4
leaq 0x1aa7(%rip), %rsi      # 0x8479
movl $0xffcc, %edx           # imm = 0xFFCC
xorl %edi, %edi
movl %ebx, %ecx
xorl %eax, %eax
callq 0x262c
jmp 0x69fe
movl %esi, %ebp
cmpl %esi, %ebx
jle 0x6a12
leaq 0x1ac1(%rip), %rsi      # 0x84b2
xorl %edi, %edi
movl %ebp, %edx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x262c
pushq $-0x5
popq %rbx
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rdx, %r14
movq %rdi, 0x10(%rsp)
movslq %ebx, %rdi
movq %r9, 0x20(%rsp)
movq %r8, 0x18(%rsp)
callq 0x2030
movq %rax, %r15
movslq %r13d, %r12
movq %rax, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x2160
leaq (%r15,%r12), %rdi
movl %ebx, %eax
subl %r13d, %eax
movslq %eax, %rdx
xorl %esi, %esi
callq 0x2130
movb $0xf, (%r15,%r12)
movq 0x60(%rsp), %rax
movq %rax, (%rsp)
movq 0x10(%rsp), %rdi
movl %ebp, %esi
movq %r15, %rdx
movl %ebx, %ecx
movq 0x18(%rsp), %r8
movq 0x20(%rsp), %r9
callq 0x65d8
movl %eax, %ebp
movq %r15, %rdi
callq 0x2250
testl %ebp, %ebp
je 0x6a01
leaq 0x1a5c(%rip), %rsi      # 0x84f1
xorl %edi, %edi
xorl %eax, %eax
callq 0x262c
movl %ebp, %ebx
jmp 0x6a01
// File: /workspace/github_cpp_makefile_star2_O2/renzibei[P]TSProxy/aes.cpp
// Function: decrypt(char*, int, char const*, int, char const (&) [16], char const (&) [16], char const (&) [16])
int decrypt(char *dst, int dst_size, const char *src, int src_size, const char (&key)[16], const char (&random)[16], const char (&mac)[16]) {
	if (src_size > constants::AES_MAX_DATA_LENGTH) {
		LogHelper::log(Error, "src_size size should be no longer than: %lu, but size is: %d", constants::AES_MAX_DATA_LENGTH, src_size);
		return -5;
	}
	if (dst_size < src_size - 16) {
		LogHelper::log(Error, "dst size too small, dst size: %d, src size: %d", dst_size, src_size);
		return -6;
	}
	char *buf = new char[src_size];
	int deRet = decode(buf, src_size, src, src_size, key, random, mac);
	if (deRet != 0) {
		delete[] buf;
		LogHelper::log(Error, "Fail to decrypt");
		return deRet;
	}
	int real_size = src_size;
	while (buf[real_size - 1] == 0 && buf[real_size - 2] != 0xf) {
		real_size--;
	}
	if (buf[real_size - 2] != 0xf) {
		LogHelper::log(Error, "Padding error");
		delete[] buf;
		return -7;
	}
	real_size -= 2;
	if (dst_size < real_size) {
		LogHelper::log(Error, "dst_size less than real size, dist_size: %d, real_size: %d",dst_size, real_size);
		delete[] buf;
		return -8;
	}
	memcpy(dst, buf, real_size);
	delete[] buf;
	return real_size;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %ecx, %ebx
cmpl $0xffcd, %ecx           # imm = 0xFFCD
jb 0x6ad8
leaq 0x1a3d(%rip), %rsi      # 0x8501
movl $0xffcc, %edx           # imm = 0xFFCC
xorl %edi, %edi
movl %ebx, %ecx
xorl %eax, %eax
callq 0x262c
pushq $-0x5
jmp 0x6af7
movl %esi, %ebp
leal -0x10(%rbx), %eax
cmpl %esi, %eax
jle 0x6b09
leaq 0x1a56(%rip), %rsi      # 0x853e
xorl %edi, %edi
movl %ebp, %edx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x262c
pushq $-0x6
popq %rbx
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r9, %r12
movq %r8, %r13
movq %rdx, %r14
movq %rdi, 0x8(%rsp)
movslq %ebx, %rdi
movq %rdi, 0x10(%rsp)
callq 0x2030
movq %rax, %r15
movq 0x50(%rsp), %rax
movq %rax, (%rsp)
movq %r15, %rdi
movl %ebx, %esi
movq %r14, %rdx
movl %ebx, %ecx
movq %r13, %r8
movq %r12, %r9
callq 0x67e2
testl %eax, %eax
je 0x6b69
movl %eax, %r14d
movq %r15, %rdi
callq 0x2250
leaq 0x1a12(%rip), %rsi      # 0x856d
xorl %edi, %edi
xorl %eax, %eax
callq 0x262c
movl %r14d, %ebx
jmp 0x6af8
addl $-0x2, %ebx
movq 0x10(%rsp), %rax
addq %r15, %rax
decq %rax
cmpb $0x0, (%rax)
jne 0x6b89
cmpb $0xf, -0x1(%rax)
je 0x6b89
decl %ebx
decq %rax
jmp 0x6b77
movslq %ebx, %rdx
cmpb $0xf, (%r15,%rdx)
jne 0x6bba
cmpl %ebp, %ebx
jle 0x6bd9
leaq 0x19ed(%rip), %rsi      # 0x858b
xorl %edi, %edi
movl %ebp, %edx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x262c
movq %r15, %rdi
callq 0x2250
pushq $-0x8
jmp 0x6af7
leaq 0x19bc(%rip), %rsi      # 0x857d
xorl %edi, %edi
xorl %eax, %eax
callq 0x262c
movq %r15, %rdi
callq 0x2250
pushq $-0x7
jmp 0x6af7
movq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x2160
movq %r15, %rdi
callq 0x2250
jmp 0x6af8
// File: /workspace/github_cpp_makefile_star2_O2/renzibei[P]TSProxy/aes.cpp
// Function: testEncodeAndDecode()
int testEncodeAndDecode() {
	char key[16], random[16], mac[16];
	for (int i = 0; i < 16; ++i) {
		key[i] = rand() & 0xff;
	}
	char text[30] = "12345678901234566543210987654";
	for (int i = 0; i < sizeof(text) - 1; i++) {
		text[i] -= '0';
	}
	char buf[60] = {0};
	int codeLen = encrypt(buf, sizeof(buf), text, sizeof(text) - 1, key, random, mac);
	if (codeLen < 0) {
		printf("encode error, ret :%d", codeLen);
		return codeLen;
	}
	printf("after encode:\n");
	
	for(int i = 0; i < codeLen; ++i) {
		printf("%u ", buf[i]);
	}
	printf("\n");
	memset(text, 0, sizeof(text));
	// memset(random, 0, 2);
	codeLen = decrypt(text, sizeof(text), buf, codeLen, key, random, mac);
	if (codeLen < 0) {
		printf("decode error, ret :%d", codeLen);
		return codeLen;
	}
	printf("after decode:\n");
	for(int i = 0; i < codeLen; ++i) {
		printf("%u ", text[i]);
	}
	printf("\n");
	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa0, %rsp
xorl %ebx, %ebx
cmpq $0x10, %rbx
je 0x6c19
callq 0x2090
movb %al, 0x30(%rsp,%rbx)
incq %rbx
jmp 0x6c05
movups 0x1a0e(%rip), %xmm0     # 0x862e
movups %xmm0, 0x1e(%rsp)
movaps 0x19f4(%rip), %xmm0     # 0x8620
movaps %xmm0, 0x10(%rsp)
xorl %eax, %eax
cmpq $0x1d, %rax
je 0x6c43
addb $-0x30, 0x10(%rsp,%rax)
incq %rax
jmp 0x6c33
xorps %xmm0, %xmm0
leaq 0x60(%rsp), %rdi
movups %xmm0, 0x2c(%rdi)
movaps %xmm0, 0x20(%rdi)
movaps %xmm0, 0x10(%rdi)
movaps %xmm0, (%rdi)
leaq 0x50(%rsp), %r15
movq %r15, (%rsp)
pushq $0x3c
popq %rsi
leaq 0x10(%rsp), %rdx
pushq $0x1d
popq %rcx
leaq 0x30(%rsp), %r8
leaq 0x40(%rsp), %r9
callq 0x6998
movl %eax, %ebx
testl %eax, %eax
js 0x6d33
leaq 0x1968(%rip), %rdi      # 0x85f6
callq 0x22d0
movl %ebx, %r12d
leaq 0x193f(%rip), %r14      # 0x85dc
xorl %r13d, %r13d
cmpq %r13, %r12
je 0x6cba
movsbl 0x60(%rsp,%r13), %esi
movq %r14, %rdi
xorl %eax, %eax
callq 0x2050
incq %r13
jmp 0x6ca0
pushq $0xa
popq %rdi
callq 0x22a0
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rdi
movaps %xmm0, (%rdi)
movups %xmm0, 0xe(%rdi)
movq %r15, (%rsp)
pushq $0x1e
popq %rsi
leaq 0x60(%rsp), %rdx
leaq 0x30(%rsp), %r8
leaq 0x40(%rsp), %r9
movl %ebx, %ecx
callq 0x6aa5
movl %eax, %ebx
testl %eax, %eax
js 0x6d3c
leaq 0x1909(%rip), %rdi      # 0x8604
callq 0x22d0
movl %ebx, %r14d
leaq 0x18d2(%rip), %rbx      # 0x85dc
xorl %r15d, %r15d
cmpq %r15, %r14
je 0x6d27
movsbl 0x10(%rsp,%r15), %esi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2050
incq %r15
jmp 0x6d0d
pushq $0xa
popq %rdi
callq 0x22a0
xorl %ebx, %ebx
jmp 0x6d4c
leaq 0x188c(%rip), %rdi      # 0x85c6
jmp 0x6d43
leaq 0x189d(%rip), %rdi      # 0x85e0
movl %ebx, %esi
xorl %eax, %eax
callq 0x2050
movl %ebx, %eax
addq $0xa0, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/renzibei[P]TSProxy/aes.cpp
// Function: GFMul(int, int)
static int GFMul(int n, int s) {
	int result;

	if(n == 1)
		result = s;
	else if(n == 2)
		result = GFMul2(s);
	else if(n == 3)
		result = GFMul3(s);
	else if(n == 0x9)
		result = GFMul9(s);
	else if(n == 0xb)//11
		result = GFMul11(s);
	else if(n == 0xd)//13
		result = GFMul13(s);
	else if(n == 0xe)//14
		result = GFMul14(s);

	return result;
}

// Assembly:
pushq %rbx
movl %esi, %ebx
addl $-0x2, %edi
cmpl $0xc, %edi
ja 0x6dd2
leaq 0x11af(%rip), %rax      # 0x7f20
movslq (%rax,%rdi,4), %rcx
addq %rax, %rcx
jmpq *%rcx
leal (%rbx,%rbx), %eax
movzbl %al, %ecx
xorl $0x1b, %ecx
testb %bl, %bl
cmovnsl %eax, %ecx
jmp 0x6da8
movl %ebx, %edi
popq %rbx
jmp 0x6dd6
movl %ebx, %edi
callq 0x6e1d
jmp 0x6db3
leal (%rbx,%rbx), %eax
movzbl %al, %ecx
xorl $0x1b, %ecx
testb %bl, %bl
cmovnsl %eax, %ecx
xorl %ebx, %ecx
movl %ecx, %ebx
jmp 0x6dd2
movl %ebx, %edi
callq 0x6dd6
leal (%rbx,%rbx), %ecx
movzbl %cl, %edx
xorl $0x1b, %edx
testb %bl, %bl
cmovnsl %ecx, %edx
xorl %eax, %edx
movl %edx, %ebx
jmp 0x6dd2
movl %ebx, %edi
callq 0x6e1d
xorl %ebx, %eax
movl %eax, %ebx
movl %ebx, %eax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/renzibei[P]TSProxy/aes.cpp
// Function: GFMul4(int)
static int GFMul2(int s) {
	int result = s << 1;
	int a7 = result & 0x00000100;

	if(a7 != 0) {
		result = result & 0x000000ff;
		result = result ^ 0x1b;
	}

	return result;
}

// Assembly:
leal (%rdi,%rdi), %ecx
movl $0xff, %eax
movl %ecx, %edx
andl %eax, %edx
xorl $0x1b, %edx
testb %dil, %dil
cmovnsl %ecx, %edx
leal (%rdx,%rdx), %ecx
andl %ecx, %eax
xorl $0x1b, %eax
testb %dl, %dl
cmovnsl %ecx, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O2/millanek[P]evo/./process_vcf_utils.h
// Function: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> numToString<double>(double)
std::string numToString(T i) {
    std::string ret;
    std::stringstream out;
    out << i;
    ret = out.str();
    return ret;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x1b8, %rsp            # imm = 0x1B8
movsd %xmm0, 0x8(%rsp)
movq %rdi, %rbx
leaq 0x10(%rdi), %rax
movq %rax, (%rdi)
andq $0x0, 0x8(%rdi)
movb $0x0, 0x10(%rdi)
leaq 0x30(%rsp), %rdi
callq 0x8350
leaq 0x40(%rsp), %rdi
movsd 0x8(%rsp), %xmm0
callq 0x8750
leaq 0x48(%rsp), %rsi
leaq 0x10(%rsp), %rdi
callq 0x8710
leaq 0x10(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x8550
movq %r14, %rdi
callq 0x8978
leaq 0x30(%rsp), %rdi
callq 0x83b0
movq %rbx, %rax
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r14
retq
jmp 0x37c52
movq %rax, %r14
leaq 0x30(%rsp), %rdi
callq 0x83b0
jmp 0x37c64
movq %rax, %r14
movq %rbx, %rdi
callq 0x8978
movq %r14, %rdi
callq 0x8870
// File: /workspace/github_cpp_makefile_star2_O2/millanek[P]evo/./process_vcf_annotation_tools.h
// Function: LinkedCoordsBed::getElementNames[abi:cxx11]()
std::vector<string> getElementNames() {
        std::vector<string> elementNames;
        for (int i = 0; i < (int)elementCoordsVector.size(); i++) {
            std::vector<std::vector<string> > thisElement = elementCoordsVector[i];
            //if (thisElement[0].size() < 4) {
            //    std::cerr << "thisElement[0].size()" << thisElement.size() << std::endl;
            //}
            elementNames.push_back(thisElement[0][3]);
        }
        return elementNames;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
xorl %r12d, %r12d
pushq $0x18
popq %r13
movq %rsp, %r15
xorl %ebp, %ebp
movq (%r14), %rsi
movq 0x8(%r14), %rax
subq %rsi, %rax
cqto
idivq %r13
cltq
cmpq %rax, %rbp
jge 0x28f24
addq %r12, %rsi
movq %r15, %rdi
callq 0x2a906
movq (%rsp), %rax
movq (%rax), %rsi
addq $0x60, %rsi
movq %rbx, %rdi
callq 0x2b0a4
movq %r15, %rdi
callq 0x29054
incq %rbp
addq $0x18, %r12
jmp 0x28edf
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq %rsp, %rdi
callq 0x29054
jmp 0x28f46
movq %rax, %r14
movq %rbx, %rdi
callq 0x28a08
movq %r14, %rdi
callq 0x8870
// File: /workspace/github_cpp_makefile_star2_O2/millanek[P]evo/./process_vcf_annotation_tools.h
// Function: LinkedCoordsBed::getElementOuterBoundaries[abi:cxx11]()
std::vector<std::vector<string> > getElementOuterBoundaries() {
        std::vector<std::vector<string> > allOuterBounds;
        for (int i = 0; i < (int)elementCoordsVector.size(); i++) {
            std::vector<std::vector<string> > thisElement = elementCoordsVector[i];
            //if (thisElement[0].size() < 4) {
            //    std::cerr << "thisElement[0].size()" << thisElement.size() << std::endl;
            //}
            std::vector<string> elementOuterBounds;
            elementOuterBounds.push_back(thisElement[0][0]);
            elementOuterBounds.push_back(thisElement[0][1]);
            elementOuterBounds.push_back(thisElement.back()[2]);
            allOuterBounds.push_back(elementOuterBounds);
        }
        return allOuterBounds;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %r14
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
xorl %r13d, %r13d
leaq 0x8(%rsp), %r15
leaq 0x20(%rsp), %r12
xorl %ebp, %ebp
movq (%r14), %rsi
movq 0x8(%r14), %rax
subq %rsi, %rax
cqto
pushq $0x18
popq %rcx
idivq %rcx
cltq
cmpq %rax, %rbp
jge 0x29016
addq %r13, %rsi
movq %r15, %rdi
callq 0x2a906
andq $0x0, 0x30(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movq 0x8(%rsp), %rax
movq (%rax), %rsi
movq %r12, %rdi
callq 0x2b0a4
movq 0x8(%rsp), %rax
movq (%rax), %rsi
addq $0x20, %rsi
movq %r12, %rdi
callq 0x2b0a4
movq 0x10(%rsp), %rax
movq -0x18(%rax), %rsi
addq $0x40, %rsi
movq %r12, %rdi
callq 0x2b0a4
movq %rbx, %rdi
movq %r12, %rsi
callq 0x29502
movq %r12, %rdi
callq 0x28a08
movq %r15, %rdi
callq 0x29054
incq %rbp
addq $0x18, %r13
jmp 0x28f84
movq %rbx, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
jmp 0x29044
movq %rax, %r14
leaq 0x20(%rsp), %rdi
callq 0x28a08
leaq 0x8(%rsp), %rdi
callq 0x29054
movq %rbx, %rdi
callq 0x29054
movq %r14, %rdi
callq 0x8870
// File: /workspace/github_cpp_makefile_star2_O2/millanek[P]evo/./process_vcf_utils.h
// Function: double vector_sum<std::vector<int, std::allocator<int>>>(std::vector<int, std::allocator<int>>)
double vector_sum(T vector) {
    double sum = 0;
    for (int i = 0; i < vector.size(); i++) {
        sum += vector[i];
    }
    return sum;
}

// Assembly:
movq (%rdi), %rax
movq 0x8(%rdi), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
xorpd %xmm0, %xmm0
xorl %edx, %edx
cmpq %rdx, %rcx
je 0x2c6d3
cvtsi2sdl (%rax,%rdx,4), %xmm1
addsd %xmm1, %xmm0
incq %rdx
jmp 0x2c6c0
retq
// File: /workspace/github_cpp_makefile_star2_O2/millanek[P]evo/./process_vcf_utils.h
// Function: void print_vector<std::vector<double, std::allocator<double>>>(std::vector<double, std::allocator<double>>, std::ostream&, char, bool)
void print_vector(T vector, std::ostream& outFile, char delim = '\t', bool endLine = true) {
    for (int i = 0; i < vector.size(); i++) {
        if (i == (vector.size()-1)) {
            if (endLine) outFile << vector[i] << std::endl;
            else outFile << vector[i];
        } else {
            outFile << vector[i] << delim;
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %ebx
movq %rsi, %r14
movq %rdi, %r15
xorl %r12d, %r12d
movsbl %dl, %ebp
movq (%r15), %rax
movq 0x8(%r15), %r13
subq %rax, %r13
sarq $0x3, %r13
cmpq %r12, %r13
jbe 0x4891e
decq %r13
movsd (%rax,%r12,8), %xmm0
movq %r14, %rdi
callq 0x8750
cmpq %r13, %r12
jne 0x4890f
testb %bl, %bl
je 0x48919
movq %rax, %rdi
callq 0x8230
jmp 0x48919
movq %rax, %rdi
movl %ebp, %esi
callq 0x8510
incq %r12
jmp 0x488d8
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/millanek[P]evo/evo_abba_baba.cpp
// Function: getAAfromInfo(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>>>> const&)
inline std::string getAAfromInfo(const std::vector<std::string>& info) {
    string AA = "?";
    for (std::vector<std::string>::size_type i = 0; i != info.size(); i++) {
        string infoKey = split(info[i],'=')[0];
        if (infoKey == "AA") {
            AA = split(info[i],'=')[1];
        }
    }
    return AA;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %r14
leaq 0x7b36d(%rip), %rsi     # 0xaa5a3
leaq 0x28(%rsp), %r15
movq %rdi, 0x8(%rsp)
movq %r15, %rdx
callq 0x21904
xorl %ebx, %ebx
leaq 0x10(%rsp), %r12
pushq $0x3d
popq %rbp
xorl %r13d, %r13d
movq (%r14), %rsi
movq 0x8(%r14), %rax
subq %rsi, %rax
sarq $0x5, %rax
cmpq %rax, %r13
je 0x2f2dc
addq %rbx, %rsi
movq %r12, %rdi
movl %ebp, %edx
callq 0x40349
movq 0x10(%rsp), %rsi
movq %r15, %rdi
callq 0x8600
movq %r12, %rdi
callq 0x28a08
movq %r15, %rdi
leaq 0x632eb(%rip), %rsi     # 0x9257f
callq 0x2193f
testb %al, %al
je 0x2f2c8
movq (%r14), %rsi
addq %rbx, %rsi
movq %r12, %rdi
movl %ebp, %edx
callq 0x40349
movq 0x10(%rsp), %rsi
addq $0x20, %rsi
movq 0x8(%rsp), %rdi
callq 0x82a0
movq %r12, %rdi
callq 0x28a08
movq %r15, %rdi
callq 0x8978
incq %r13
addq $0x20, %rbx
jmp 0x2f255
movq 0x8(%rsp), %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
jmp 0x2f302
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x28a08
leaq 0x28(%rsp), %rdi
callq 0x8978
jmp 0x2f320
movq %rax, %r14
jmp 0x2f320
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x28a08
movq 0x8(%rsp), %rdi
callq 0x8978
movq %r14, %rdi
callq 0x8870
// File: /workspace/github_cpp_makefile_star2_O2/millanek[P]evo/./process_vcf_stats_utils.h
// Function: copy_except(int, std::vector<double, std::allocator<double>>&, std::vector<double, std::allocator<double>>&)
inline void copy_except(int i, std::vector<double>& inVec, std::vector<double>& outVec) {
    std::copy(inVec.begin(), inVec.begin() + i, outVec.begin());
    std::copy(inVec.begin() + i + 1, inVec.end(), outVec.begin()+i);
    //std::cerr << "copying:" << i << " "; print_vector_stream(inVec, std::cerr);
    //std::cerr << "copied: " << i << " "; print_vector_stream(outVec, std::cerr);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r15
movslq %edi, %r14
testl %r14d, %r14d
je 0x2f7bb
movq (%r15), %rsi
leaq (,%r14,8), %rdx
movq (%rbx), %rdi
callq 0x8770
movq (%r15), %rax
movq 0x8(%r15), %rdx
leaq (%rax,%r14,8), %rsi
addq $0x8, %rsi
subq %rsi, %rdx
je 0x2f7e3
shlq $0x3, %r14
addq (%rbx), %r14
movq %r14, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x8770
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/millanek[P]evo/./process_vcf_utils.h
// Function: double vector_average<std::deque<int, std::allocator<int>>>(std::deque<int, std::allocator<int>>)
double vector_average(T vector) {
    double sum = 0;
    for (int i = 0; i < vector.size(); i++) {
        sum += vector[i];
    }
    double average = (double)sum / (double)vector.size();
    return average;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
leaq 0x10(%rdi), %r14
xorpd %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
xorl %r15d, %r15d
movq %rbx, %rdi
callq 0x3b056
cmpq %r15, %rax
jbe 0x3b0b4
movq %r14, %rdi
movq %r15, %rsi
callq 0x3dbd6
cvtsi2sdl (%rax), %xmm0
movsd 0x8(%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, 0x8(%rsp)
incq %r15
jmp 0x3b083
movq %rbx, %rdi
callq 0x3b056
movq %rax, %xmm0
punpckldq 0x57177(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x5717f(%rip), %xmm0    # 0x92250
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movsd 0x8(%rsp), %xmm0
divsd %xmm1, %xmm0
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
nop