LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: qian-jiahong[P]uvncrep017-ws/repeater.cpp
// Function: fatal(char const*, ...)
void fatal(const char *fmt, ...)
{
    va_list args;

    logLineStart("UltraVnc FATAL");
    
    va_start(args, fmt);
   
    vfprintf(stderr, fmt, args);
    va_end(args);
 
    //Close program down cleanly (as if user just pressed ctrl+c, of course 
    //log file will show FATAL message in case program shuts down)
    stopped = true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
testb %al, %al
je 0x2645
movaps %xmm0, -0xa0(%rbp)
movaps %xmm1, -0x90(%rbp)
movaps %xmm2, -0x80(%rbp)
movaps %xmm3, -0x70(%rbp)
movaps %xmm4, -0x60(%rbp)
movaps %xmm5, -0x50(%rbp)
movaps %xmm6, -0x40(%rbp)
movaps %xmm7, -0x30(%rbp)
movq %r9, -0xa8(%rbp)
movq %r8, -0xb0(%rbp)
movq %rcx, -0xb8(%rbp)
movq %rdx, -0xc0(%rbp)
movq %rsi, -0xc8(%rbp)
movq %rdi, -0x8(%rbp)
leaq 0x799a(%rip), %rdi      # 0xa00d
callq 0x2540
leaq -0xd0(%rbp), %rax
movq %rax, -0x10(%rbp)
leaq 0x10(%rbp), %rax
movq %rax, -0x18(%rbp)
movl $0x30, -0x1c(%rbp)
movl $0x8, -0x20(%rbp)
movq 0xc940(%rip), %rax      # 0xefe0
movq (%rax), %rdi
movq -0x8(%rbp), %rsi
leaq -0x20(%rbp), %rdx
callq 0x22a0
movb $0x1, 0xd4e9(%rip)      # 0xfba0
addq $0xd0, %rsp
popq %rbp
retq
// File: qian-jiahong[P]uvncrep017-ws/repeater.cpp
// Function: openConnectionToEventListener(char const*, unsigned short, char*, int)
int openConnectionToEventListener(const char *host, unsigned short port, char *listenerIp, int listenerIpSize)
{
    int s;
    struct sockaddr_in saddr;
    struct hostent *h;
        
    h = gethostbyname(host);
    if (NULL == h) {
        debug(LEVEL_2, "openConnectionToEventListener(): can't resolve hostname: %s\n", host);
        return -1;
    }
    saddr.sin_family = AF_INET;
    saddr.sin_port = htons(port);
    
    //Interesting;-) typecast / indirection thing copied from "Beej's Guide to network programming". 
    //See http://beej.us/guide/bgnet/ for more info
    saddr.sin_addr = *((struct in_addr *)h->h_addr);

    memset(&(saddr.sin_zero), '\0', 8); // zero the rest of the struct
    
    strlcpy(listenerIp, inet_ntoa(saddr.sin_addr), listenerIpSize);
    
    debug(LEVEL_3, "openConnectionToEventListener(): connecting to %s:%u\n", listenerIp, port);

    s = socket(AF_INET, SOCK_STREAM, 0);
    
    //Trying to connect with timeout
    if (connectWithTimeout(s, (struct sockaddr *) &saddr, sizeof(saddr), TIMEOUT_10SECS) != 0) {
        debug(LEVEL_2, "openConnectionToEventListener(): connectWithTimeout() failed.\n");
        close(s);
        strlcpy(listenerIp, "", listenerIpSize);
        return -1;
    }
    else
        return s;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movw %si, %ax
movq %rdi, -0x10(%rbp)
movw %ax, -0x12(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2240
movq %rax, -0x40(%rbp)
xorl %eax, %eax
cmpq -0x40(%rbp), %rax
jne 0x2712
movq -0x10(%rbp), %rdx
movl $0x2, %edi
leaq 0x791d(%rip), %rsi      # 0xa01c
movb $0x0, %al
callq 0x2480
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x27f7
movw $0x2, -0x38(%rbp)
movzwl -0x12(%rbp), %edi
callq 0x2040
movw %ax, -0x36(%rbp)
movq -0x40(%rbp), %rax
movq 0x18(%rax), %rax
movq (%rax), %rax
movl (%rax), %eax
movl %eax, -0x34(%rbp)
leaq -0x38(%rbp), %rdi
addq $0x8, %rdi
xorl %esi, %esi
movl $0x8, %edx
callq 0x2120
movq -0x20(%rbp), %rax
movq %rax, -0x50(%rbp)
movl -0x34(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %edi
callq 0x20f0
movq -0x50(%rbp), %rdi
movq %rax, %rsi
movslq -0x24(%rbp), %rdx
callq 0x76d0
movq -0x20(%rbp), %rdx
movzwl -0x12(%rbp), %ecx
movl $0x3, %edi
leaq 0x78d6(%rip), %rsi      # 0xa059
movb $0x0, %al
callq 0x2480
movl $0x2, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x2070
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %edi
leaq -0x38(%rbp), %rsi
movl $0x10, %edx
movl $0xa, %ecx
callq 0x2800
cmpl $0x0, %eax
je 0x27f1
movl $0x2, %edi
leaq 0x78ca(%rip), %rsi      # 0xa08f
movb $0x0, %al
callq 0x2480
movl -0x28(%rbp), %edi
callq 0x2370
movq -0x20(%rbp), %rdi
movslq -0x24(%rbp), %rdx
leaq 0x8df7(%rip), %rsi      # 0xb5da
callq 0x76d0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x27f7
movl -0x28(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
// File: qian-jiahong[P]uvncrep017-ws/repeater.cpp
// Function: isConnectionTooOld(unsigned long)
bool isConnectionTooOld(unsigned long timeStamp)
{
    unsigned long tick = time(NULL);
    if ((tick - timeStamp) > MAX_IDLE_CONNECTION_TIME)
        return true;
    else
        return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
xorl %eax, %eax
movl %eax, %edi
callq 0x21e0
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
subq -0x10(%rbp), %rax
cmpq $0x258, %rax            # imm = 0x258
jbe 0x2d8f
movb $0x1, -0x1(%rbp)
jmp 0x2d93
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x20, %rsp
popq %rbp
retq
nop
// File: qian-jiahong[P]uvncrep017-ws/repeater.cpp
// Function: isPeerDisconnected(int, int)
bool isPeerDisconnected(int socket, int connectionFrom)
{
    ssize_t n;

    char buf[SIZE_RFBPROTOCOLVERSIONMSG+1];
    buf[SIZE_RFBPROTOCOLVERSIONMSG] = '\0';
    
    n = recv(socket, buf, SIZE_RFBPROTOCOLVERSIONMSG, MSG_DONTWAIT);

    if (n == 0) {
        debug(LEVEL_3, "isPeerDisconnected: recv() returned 0 (peer has disconnected orderly)\n");
        return true;    //peer has disconnected orderly
    }
    else if (n == -1) {
        //recv() returned -1 to indicate some error
        if (errno == EAGAIN) {
            //Because we use non-blocking in recv(), EAGAIN is ok
            return false;
        }
        else {
            debug(LEVEL_2, "isPeerDisconnected: recv() returned error, errno = %d (%s)\n", errno, strerror(errno));
            return true;
        }
    }
    else if (n >= 1) {
        //peer has sent data OK
        debug(LEVEL_3, "isPeerDisconnected: recv() returned: %s\n", buf);
        return false;  
    }
    else {
        //unknown error
        debug(LEVEL_2, "isPeerDisconnected: recv() returned error, errno = %d (%s)\n", errno, strerror(errno));
        return true;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movb $0x0, -0x19(%rbp)
movl -0x8(%rbp), %edi
leaq -0x25(%rbp), %rsi
movl $0xc, %edx
movl $0x40, %ecx
callq 0x20a0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x2e2f
movl $0x3, %edi
leaq 0x7377(%rip), %rsi      # 0xa196
movb $0x0, %al
callq 0x2480
movb $0x1, -0x1(%rbp)
jmp 0x2ed5
cmpq $-0x1, -0x18(%rbp)
jne 0x2e7e
callq 0x2030
cmpl $0xb, (%rax)
jne 0x2e49
movb $0x0, -0x1(%rbp)
jmp 0x2ed5
callq 0x2030
movl (%rax), %eax
movl %eax, -0x2c(%rbp)
callq 0x2030
movl (%rax), %edi
callq 0x20b0
movl -0x2c(%rbp), %edx
movq %rax, %rcx
movl $0x2, %edi
leaq 0x736c(%rip), %rsi      # 0xa1dd
movb $0x0, %al
callq 0x2480
movb $0x1, -0x1(%rbp)
jmp 0x2ed5
cmpq $0x1, -0x18(%rbp)
jl 0x2ea2
leaq -0x25(%rbp), %rdx
movl $0x3, %edi
leaq 0x7384(%rip), %rsi      # 0xa219
movb $0x0, %al
callq 0x2480
movb $0x0, -0x1(%rbp)
jmp 0x2ed5
callq 0x2030
movl (%rax), %eax
movl %eax, -0x30(%rbp)
callq 0x2030
movl (%rax), %edi
callq 0x20b0
movl -0x30(%rbp), %edx
movq %rax, %rcx
movl $0x2, %edi
leaq 0x7313(%rip), %rsi      # 0xa1dd
movb $0x0, %al
callq 0x2480
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x30, %rsp
popq %rbp
retq
// File: qian-jiahong[P]uvncrep017-ws/repeater.cpp
// Function: readPeerHandShake(int, int)
void readPeerHandShake(int socket, int index)
{
    int len;
    
    //Make sure handshake is null-terminated
    handShakes[index] -> handShake[MAX_HANDSHAKE_LEN-1] ='\0';
    
    len = nonBlockingRead(socket, handShakes[index] -> handShake, MAX_HANDSHAKE_LEN - 1, TIMEOUT_5SECS);
    if (len < 0) {
       strlcpy(handShakes[index] -> handShake, "", MAX_HANDSHAKE_LEN);
       handShakes[index] -> handShakeLength = 0;
    }
    else {
        debug(LEVEL_3, "readPeerHandShake(): len = %d\n", len);
        handShakes[index] -> handShakeLength = len;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
movslq -0x8(%rbp), %rcx
leaq 0xccb7(%rip), %rax      # 0xfbb0
movq (%rax,%rcx,8), %rax
movb $0x0, 0x63(%rax)
movl -0x4(%rbp), %edi
movslq -0x8(%rbp), %rcx
leaq 0xcca1(%rip), %rax      # 0xfbb0
movq (%rax,%rcx,8), %rsi
movl $0x63, %edx
movl $0x5, %ecx
callq 0x2fa0
movl %eax, -0xc(%rbp)
cmpl $0x0, -0xc(%rbp)
jge 0x2f63
movslq -0x8(%rbp), %rcx
leaq 0xcc7a(%rip), %rax      # 0xfbb0
movq (%rax,%rcx,8), %rdi
leaq 0x8699(%rip), %rsi      # 0xb5da
movl $0x64, %edx
callq 0x76d0
movslq -0x8(%rbp), %rcx
leaq 0xcc5a(%rip), %rax      # 0xfbb0
movq (%rax,%rcx,8), %rax
movl $0x0, 0x64(%rax)
jmp 0x2f8e
movl -0xc(%rbp), %edx
movl $0x3, %edi
leaq 0x72d0(%rip), %rsi      # 0xa242
movb $0x0, %al
callq 0x2480
movl -0xc(%rbp), %ecx
movslq -0x8(%rbp), %rdx
leaq 0xcc29(%rip), %rax      # 0xfbb0
movq (%rax,%rdx,8), %rax
movl %ecx, 0x64(%rax)
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: qian-jiahong[P]uvncrep017-ws/repeater.cpp
// Function: allocateMemoryForRepeaterLists(int)
static bool allocateMemoryForRepeaterLists(int numSessions)
{
    int ii;
    
    for(ii = 0; ii < MAX_SESSIONS_MAX; ii++) {
        handShakes[ii] = NULL;
        repeaterProcs[ii] = NULL;
        servers[ii] = NULL;
        viewers[ii] = NULL;
    }
    
    
    for(ii = 0; ii < numSessions; ii++) {
        handShakes[ii] = (handShakeInfo *) calloc(1, sizeof(handShakeInfo));
        if (handShakes[ii] == NULL)
            return false;

        repeaterProcs[ii] = (repeaterProcInfo *) calloc(1, sizeof(repeaterProcInfo));
        if (repeaterProcs[ii] == NULL)
            return false;

        servers[ii] = (repeaterInfo *) calloc(1, sizeof(repeaterInfo));
        if (servers[ii] == NULL)
            return false;

        viewers[ii] = (repeaterInfo *) calloc(1, sizeof(repeaterInfo));
        if (viewers[ii] == NULL)
            return false;
    }
    
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl %edi, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
cmpl $0x3e8, -0xc(%rbp)      # imm = 0x3E8
jge 0x3ba2
movslq -0xc(%rbp), %rcx
leaq 0xc05a(%rip), %rax      # 0xfbb0
movq $0x0, (%rax,%rcx,8)
movslq -0xc(%rbp), %rcx
leaq 0xe007(%rip), %rax      # 0x11b70
movq $0x0, (%rax,%rcx,8)
movslq -0xc(%rbp), %rcx
leaq 0xff34(%rip), %rax      # 0x13ab0
movq $0x0, (%rax,%rcx,8)
movslq -0xc(%rbp), %rcx
leaq 0x11e61(%rip), %rax     # 0x159f0
movq $0x0, (%rax,%rcx,8)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x3b42
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x3caf
movl $0x1, %edi
movl $0x68, %esi
callq 0x2160
movq %rax, %rdx
movslq -0xc(%rbp), %rcx
leaq 0xbfde(%rip), %rax      # 0xfbb0
movq %rdx, (%rax,%rcx,8)
movslq -0xc(%rbp), %rcx
leaq 0xbfcf(%rip), %rax      # 0xfbb0
cmpq $0x0, (%rax,%rcx,8)
jne 0x3bf1
movb $0x0, -0x1(%rbp)
jmp 0x3cb3
movl $0x1, %edi
movl $0x10, %esi
callq 0x2160
movq %rax, %rdx
movslq -0xc(%rbp), %rcx
leaq 0xdf62(%rip), %rax      # 0x11b70
movq %rdx, (%rax,%rcx,8)
movslq -0xc(%rbp), %rcx
leaq 0xdf53(%rip), %rax      # 0x11b70
cmpq $0x0, (%rax,%rcx,8)
jne 0x3c2d
movb $0x0, -0x1(%rbp)
jmp 0x3cb3
movl $0x1, %edi
movl $0x30, %esi
callq 0x2160
movq %rax, %rdx
movslq -0xc(%rbp), %rcx
leaq 0xfe66(%rip), %rax      # 0x13ab0
movq %rdx, (%rax,%rcx,8)
movslq -0xc(%rbp), %rcx
leaq 0xfe57(%rip), %rax      # 0x13ab0
cmpq $0x0, (%rax,%rcx,8)
jne 0x3c66
movb $0x0, -0x1(%rbp)
jmp 0x3cb3
movl $0x1, %edi
movl $0x30, %esi
callq 0x2160
movq %rax, %rdx
movslq -0xc(%rbp), %rcx
leaq 0x11d6d(%rip), %rax     # 0x159f0
movq %rdx, (%rax,%rcx,8)
movslq -0xc(%rbp), %rcx
leaq 0x11d5e(%rip), %rax     # 0x159f0
cmpq $0x0, (%rax,%rcx,8)
jne 0x3c9f
movb $0x0, -0x1(%rbp)
jmp 0x3cb3
jmp 0x3ca1
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x3ba9
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x10, %rsp
popq %rbp
retq
nop
// File: qian-jiahong[P]uvncrep017-ws/repeater.cpp
// Function: cleanLists()
static void cleanLists(void)
{
    int ii;
    for (ii = 0; ii < maxSessions; ii++) {
        memset(handShakes[ii], 0, sizeof(handShakeInfo));
        memset(repeaterProcs[ii], 0, sizeof(repeaterProcInfo));
        memset(servers[ii], 0, sizeof(repeaterInfo));
        memset(viewers[ii], 0, sizeof(repeaterInfo));
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
leaq 0xbd67(%rip), %rcx      # 0xfa40
cmpl (%rcx), %eax
jge 0x3d57
movslq -0x4(%rbp), %rcx
leaq 0xbec8(%rip), %rax      # 0xfbb0
movq (%rax,%rcx,8), %rdi
xorl %esi, %esi
movl $0x68, %edx
callq 0x2120
movslq -0x4(%rbp), %rcx
leaq 0xde6d(%rip), %rax      # 0x11b70
movq (%rax,%rcx,8), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x2120
movslq -0x4(%rbp), %rcx
leaq 0xfd92(%rip), %rax      # 0x13ab0
movq (%rax,%rcx,8), %rdi
xorl %esi, %esi
movl $0x30, %edx
callq 0x2120
movslq -0x4(%rbp), %rcx
leaq 0x11cb7(%rip), %rax     # 0x159f0
movq (%rax,%rcx,8), %rdi
xorl %esi, %esi
movl $0x30, %edx
callq 0x2120
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x3ccf
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: qian-jiahong[P]uvncrep017-ws/repeater.cpp
// Function: dropRootPrivileges()
static void dropRootPrivileges()
{
    struct passwd *pw;
    
    pw = getpwnam(runAsUser);
    debug(LEVEL_1, "Run As User: %s\n", runAsUser);

    if (pw != NULL) {
        if (0 != setgid(pw -> pw_gid)) {
            fatal("dropRootPrivileges(): setgid() failed\n");    
        }

        if (0 != setuid(pw -> pw_uid)) {
            fatal("dropRootPrivileges(): setuid() failed\n");    
        }
                                
        //We should now be mere mortal, check effective uid to be sure
        if (geteuid() == 0) {
            //Still root, was this intended ? 
            if (strcmp("root", runAsUser) == 0) {
                //Intentionally root, complain about this security violation
                debug(LEVEL_1, "dropRootPrivileges(): you seem to WANT TO run as user root, this IS VERY DANGEROUS !\n");
            }
            else
                fatal("dropRootPrivileges(): dropping privileges failed\n");
        }
        else
            debug(LEVEL_1, "dropRootPrivileges(): privileges successfully dropped, now running as user %s\n", runAsUser);
    }
    else {
        fatal("dropRootPrivileges(): getpwnam() failed, please open the file (%s) and check the 'runasuser' field\n", DEFAULT_INI_FILE_PATH_AND_NAME); 
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
leaq 0xb2a1(%rip), %rdi      # 0xf200
callq 0x21a0
movq %rax, -0x8(%rbp)
movl $0x1, %edi
leaq 0x6daf(%rip), %rsi      # 0xad23
leaq 0xb285(%rip), %rdx      # 0xf200
movb $0x0, %al
callq 0x2480
cmpq $0x0, -0x8(%rbp)
je 0x4034
movq -0x8(%rbp), %rax
movl 0x14(%rax), %edi
callq 0x2330
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
je 0x3faf
leaq 0x6d8c(%rip), %rdi      # 0xad34
movb $0x0, %al
callq 0x2610
movq -0x8(%rbp), %rax
movl 0x10(%rax), %edi
callq 0x2360
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
je 0x3fd1
leaq 0x6d91(%rip), %rdi      # 0xad5b
movb $0x0, %al
callq 0x2610
callq 0x2140
cmpl $0x0, %eax
jne 0x4018
leaq 0x6da0(%rip), %rdi      # 0xad82
leaq 0xb217(%rip), %rsi      # 0xf200
callq 0x22b0
cmpl $0x0, %eax
jne 0x4008
movl $0x1, %edi
leaq 0x6d88(%rip), %rsi      # 0xad87
movb $0x0, %al
callq 0x2480
jmp 0x4016
leaq 0x6dce(%rip), %rdi      # 0xaddd
movb $0x0, %al
callq 0x2610
jmp 0x4032
movl $0x1, %edi
leaq 0x6deb(%rip), %rsi      # 0xae0f
leaq 0xb1d5(%rip), %rdx      # 0xf200
movb $0x0, %al
callq 0x2480
jmp 0x4049
leaq 0x6e23(%rip), %rdi      # 0xae5e
leaq 0xb18e(%rip), %rsi      # 0xf1d0
movb $0x0, %al
callq 0x2610
addq $0x10, %rsp
popq %rbp
retq
nop
// File: qian-jiahong[P]uvncrep017-ws/repeater.cpp
// Function: freeMemoryOfRepeaterLists()
static void freeMemoryOfRepeaterLists(void)
{
    int ii;
    
    for(ii = 0; ii < MAX_SESSIONS_MAX; ii++) {
        if (handShakes[ii] != NULL) {
            free(handShakes[ii]);
            handShakes[ii] = NULL;
        }
        
        if (repeaterProcs[ii] != NULL) {
            free(repeaterProcs[ii]);
            repeaterProcs[ii] = NULL;
        }
        
        if (servers[ii] != NULL) {
            free(servers[ii]);
            servers[ii] = NULL;
        }
            
        if (viewers[ii] != NULL) {
            free(viewers[ii]);
            viewers[ii] = NULL;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl $0x0, -0x4(%rbp)
cmpl $0x3e8, -0x4(%rbp)      # imm = 0x3E8
jge 0x4570
movslq -0x4(%rbp), %rcx
leaq 0xb729(%rip), %rax      # 0xfbb0
cmpq $0x0, (%rax,%rcx,8)
je 0x44b5
movslq -0x4(%rbp), %rcx
leaq 0xb717(%rip), %rax      # 0xfbb0
movq (%rax,%rcx,8), %rdi
callq 0x2260
movslq -0x4(%rbp), %rcx
leaq 0xb703(%rip), %rax      # 0xfbb0
movq $0x0, (%rax,%rcx,8)
movslq -0x4(%rbp), %rcx
leaq 0xd6b0(%rip), %rax      # 0x11b70
cmpq $0x0, (%rax,%rcx,8)
je 0x44ee
movslq -0x4(%rbp), %rcx
leaq 0xd69e(%rip), %rax      # 0x11b70
movq (%rax,%rcx,8), %rdi
callq 0x2260
movslq -0x4(%rbp), %rcx
leaq 0xd68a(%rip), %rax      # 0x11b70
movq $0x0, (%rax,%rcx,8)
movslq -0x4(%rbp), %rcx
leaq 0xf5b7(%rip), %rax      # 0x13ab0
cmpq $0x0, (%rax,%rcx,8)
je 0x4527
movslq -0x4(%rbp), %rcx
leaq 0xf5a5(%rip), %rax      # 0x13ab0
movq (%rax,%rcx,8), %rdi
callq 0x2260
movslq -0x4(%rbp), %rcx
leaq 0xf591(%rip), %rax      # 0x13ab0
movq $0x0, (%rax,%rcx,8)
movslq -0x4(%rbp), %rcx
leaq 0x114be(%rip), %rax     # 0x159f0
cmpq $0x0, (%rax,%rcx,8)
je 0x4560
movslq -0x4(%rbp), %rcx
leaq 0x114ac(%rip), %rax     # 0x159f0
movq (%rax,%rcx,8), %rdi
callq 0x2260
movslq -0x4(%rbp), %rcx
leaq 0x11498(%rip), %rax     # 0x159f0
movq $0x0, (%rax,%rcx,8)
jmp 0x4562
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x446f
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: qian-jiahong[P]uvncrep017-ws/repeater.cpp
// Function: removeOldOrBrokenConnections()
static void removeOldOrBrokenConnections(void)
{
    int ii;

    for (ii = 0; ii < maxSessions; ii++) {
        //Remove old inactive viewers
        connectionRemover(CONNECTION_FROM_VIEWER, viewers[ii], ii);


        //Remove old inactive servers
        connectionRemover(CONNECTION_FROM_SERVER, servers[ii], ii);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
leaq 0xa337(%rip), %rcx      # 0xfa40
cmpl (%rcx), %eax
jge 0x574d
movslq -0x4(%rbp), %rcx
leaq 0x102d8(%rip), %rax     # 0x159f0
movq (%rax,%rcx,8), %rsi
movl -0x4(%rbp), %edx
movl $0x1, %edi
callq 0x6780
movslq -0x4(%rbp), %rcx
leaq 0xe37c(%rip), %rax      # 0x13ab0
movq (%rax,%rcx,8), %rsi
movl -0x4(%rbp), %edx
xorl %edi, %edi
callq 0x6780
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x56ff
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: qian-jiahong[P]uvncrep017-ws/repeater.cpp
// Function: cleanUpAfterRepeaterProcs()
static void cleanUpAfterRepeaterProcs(void)
{
    int status;
    pid_t pid;
    int i;
    
    for(i = 0; i < maxSessions; i++) {
        if (repeaterProcs[i] -> code != 0) {
            pid = waitpid(repeaterProcs[i] -> pid, &status, WNOHANG);
            if (pid > 0) {
                cleanUpAfterRepeaterProcExit(WEXITSTATUS(status), pid);
            }
        } 
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
leaq 0xa2c7(%rip), %rcx      # 0xfa40
cmpl (%rcx), %eax
jge 0x57de
movslq -0xc(%rbp), %rcx
leaq 0xc3e8(%rip), %rax      # 0x11b70
movq (%rax,%rcx,8), %rax
cmpq $0x0, (%rax)
je 0x57d1
movslq -0xc(%rbp), %rcx
leaq 0xc3d3(%rip), %rax      # 0x11b70
movq (%rax,%rcx,8), %rax
movl 0x8(%rax), %edi
leaq -0x4(%rbp), %rsi
movl $0x1, %edx
callq 0x2190
movl %eax, -0x8(%rbp)
cmpl $0x0, -0x8(%rbp)
jle 0x57cf
movl -0x4(%rbp), %edi
andl $0xff00, %edi           # imm = 0xFF00
sarl $0x8, %edi
movl -0x8(%rbp), %esi
callq 0x6ba0
jmp 0x57d1
jmp 0x57d3
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x576f
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: qian-jiahong[P]uvncrep017-ws/repeater.cpp
// Function: checkIdCode(char*)
static bool checkIdCode(char *IdCode)
{
    if ((IdCode[0] != 'I') || (IdCode[1] != 'D') || (IdCode[2] != ':')) {
        debug(LEVEL_3, "checkIdCode(): %s is not IdCode string\n", IdCode);
        return false;
    }
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x49, %eax
jne 0x5822
movq -0x10(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x44, %eax
jne 0x5822
movq -0x10(%rbp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x3a, %eax
je 0x583f
movq -0x10(%rbp), %rdx
movl $0x3, %edi
leaq 0x5d34(%rip), %rsi      # 0xb566
movb $0x0, %al
callq 0x2480
movb $0x0, -0x1(%rbp)
jmp 0x5843
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x10, %rsp
popq %rbp
retq
nop
// File: qian-jiahong[P]uvncrep017-ws/repeater.cpp
// Function: parseId(char*)
static long parseId(char *IdCode)
{
    unsigned int ii;
    //PFaf 20101122: Minor correction due to compiler warning
    //int retVal;
    long retVal;

    debug(LEVEL_3, "parseId(): IdCode = %s\n", IdCode);

    //Require that 1st 3 characters of IdCode are 'I','D',':'
    if (false == checkIdCode(IdCode)) {
        debug(LEVEL_3, "parseId(): IdCode format error, does not start ""ID:"" \n");
        return -1;
    }
    else {
        //Require that all other characters of IdCode are digits
        for (ii = 3; ii < strlen(IdCode); ii++) {
            if (!isdigit(IdCode[ii])) {
                debug(LEVEL_3, "parseId(): IdCode format error, code should consist of decimal digits\n");
                return -1;
            }
        }

        retVal = strtol(&(IdCode[3]), NULL, 10);
        if (retVal <= 0) {
            debug(LEVEL_3, "parseId(): IdCode format error, code should be positive long integer number\n");
            return -1;
        }
        else if (retVal == LONG_MAX) {
            debug(LEVEL_3, "parseId(): IdCode format error, code is too big\n");
            return -1;
        }

        return retVal;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdx
movl $0x3, %edi
leaq 0x5d22(%rip), %rsi      # 0xb58e
movb $0x0, %al
callq 0x2480
movq -0x10(%rbp), %rdi
callq 0x57f0
andb $0x1, %al
movzbl %al, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x58a7
movl $0x3, %edi
leaq 0x5d13(%rip), %rsi      # 0xb5a6
movb $0x0, %al
callq 0x2480
movq $-0x1, -0x8(%rbp)
jmp 0x5981
movl $0x3, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rdi
callq 0x20e0
movq %rax, %rcx
movq -0x28(%rbp), %rax
cmpq %rcx, %rax
jae 0x590c
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
movsbl (%rax,%rcx), %edi
callq 0x21d0
cmpl $0x0, %eax
jne 0x58ff
movl $0x3, %edi
leaq 0x5cf0(%rip), %rsi      # 0xb5db
movb $0x0, %al
callq 0x2480
movq $-0x1, -0x8(%rbp)
jmp 0x5981
jmp 0x5901
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x58ae
movq -0x10(%rbp), %rdi
addq $0x3, %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0xa, %edx
callq 0x22c0
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jg 0x594a
movl $0x3, %edi
leaq 0x5ce9(%rip), %rsi      # 0xb622
movb $0x0, %al
callq 0x2480
movq $-0x1, -0x8(%rbp)
jmp 0x5981
movabsq $0x7fffffffffffffff, %rax # imm = 0x7FFFFFFFFFFFFFFF
cmpq %rax, -0x20(%rbp)
jne 0x5977
movl $0x3, %edi
leaq 0x5d09(%rip), %rsi      # 0xb66f
movb $0x0, %al
callq 0x2480
movq $-0x1, -0x8(%rbp)
jmp 0x5981
jmp 0x5979
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: qian-jiahong[P]uvncrep017-ws/repeater.cpp
// Function: findDuplicateIdIndex(int, long)
static int findDuplicateIdIndex(int connectionFrom, long code)
{
    repeaterInfo *repInfo;
    int ii;
    
    for(ii = 0; ii < maxSessions; ii++) {
        if (connectionFrom == CONNECTION_FROM_VIEWER)
            repInfo = viewers[ii]; 
        else
            repInfo = servers[ii]; 

        if (repInfo -> code == code) {
            debug(LEVEL_2, "findDuplicateIdIndex(): similar %s ID already there\n",
                (connectionFrom == CONNECTION_FROM_VIEWER) ? "viewer" : "server");
            return ii;
        }
    }
    
    debug(LEVEL_3, "findDuplicateIdIndex(): similar ID not found\n");
    return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
leaq 0xa090(%rip), %rcx      # 0xfa40
cmpl (%rcx), %eax
jge 0x5a43
cmpl $0x1, -0x8(%rbp)
jne 0x59d3
movslq -0x1c(%rbp), %rcx
leaq 0x10027(%rip), %rax     # 0x159f0
movq (%rax,%rcx,8), %rax
movq %rax, -0x18(%rbp)
jmp 0x59e6
movslq -0x1c(%rbp), %rcx
leaq 0xe0d2(%rip), %rax      # 0x13ab0
movq (%rax,%rcx,8), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
cmpq -0x10(%rbp), %rax
jne 0x5a33
cmpl $0x1, -0x8(%rbp)
jne 0x5a07
leaq 0x5cd4(%rip), %rax      # 0xb6d5
movq %rax, -0x28(%rbp)
jmp 0x5a14
leaq 0x6a38(%rip), %rax      # 0xc446
movq %rax, -0x28(%rbp)
jmp 0x5a14
movq -0x28(%rbp), %rdx
movl $0x2, %edi
leaq 0x5c7c(%rip), %rsi      # 0xb6a0
movb $0x0, %al
callq 0x2480
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x5a5d
jmp 0x5a35
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x59a6
movl $0x3, %edi
leaq 0x5c8d(%rip), %rsi      # 0xb6dc
movb $0x0, %al
callq 0x2480
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: qian-jiahong[P]uvncrep017-ws/repeater.cpp
// Function: isCodeInIdList(long)
static bool isCodeInIdList(long code)
{
    int ii;
    
    for(ii = 0; ii < ID_LIST_SIZE; ii++) {
        if (code == idList[ii]) {
            debug(LEVEL_3, "isCodeInIdList(): ID code match found (%ld)\n", code);
            return true;
        }
    }

    return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
cmpl $0x64, -0x14(%rbp)
jge 0x5acb
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rdx
leaq 0x126c8(%rip), %rcx     # 0x18160
movslq (%rcx,%rdx,4), %rcx
cmpq %rcx, %rax
jne 0x5abe
movq -0x10(%rbp), %rdx
movl $0x3, %edi
leaq 0x5c59(%rip), %rsi      # 0xb70a
movb $0x0, %al
callq 0x2480
movb $0x1, -0x1(%rbp)
jmp 0x5acf
jmp 0x5ac0
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x5a83
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: qian-jiahong[P]uvncrep017-ws/repeater.cpp
// Function: addViewerList(int, long, char*)
static int addViewerList(int socket, long code, char *peerIp)
{
    int i;

    for (i = 0; i < maxSessions; i++) {
        if (viewers[i] -> code == 0) {
            debug(LEVEL_3, "addViewerList(): Viewer added to list: code = %ld, index = %d\n", code, i);
            viewers[i] -> code = code;
            viewers[i] -> socket = socket;
            viewers[i] -> peerIp = getAddrPartsFromString(peerIp);
            viewers[i] -> timeStamp = time(NULL);
            viewers[i] -> active = false;
            return i;
        }
    }

    debug(LEVEL_2, "addViewerList(): Warning, no table slots available\n");
    return -1;  //Not added
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
leaq 0x9c4c(%rip), %rcx      # 0xfa40
cmpl (%rcx), %eax
jge 0x5ed5
movslq -0x1c(%rbp), %rcx
leaq 0xfbe9(%rip), %rax      # 0x159f0
movq (%rax,%rcx,8), %rax
cmpq $0x0, 0x8(%rax)
jne 0x5ec5
movq -0x10(%rbp), %rdx
movl -0x1c(%rbp), %ecx
movl $0x3, %edi
leaq 0x5b0b(%rip), %rsi      # 0xb934
movb $0x0, %al
callq 0x2480
movq -0x10(%rbp), %rcx
movslq -0x1c(%rbp), %rdx
leaq 0xfbb1(%rip), %rax      # 0x159f0
movq (%rax,%rdx,8), %rax
movq %rcx, 0x8(%rax)
movl -0x8(%rbp), %ecx
movslq -0x1c(%rbp), %rdx
leaq 0xfb9b(%rip), %rax      # 0x159f0
movq (%rax,%rdx,8), %rax
movl %ecx, (%rax)
movq -0x18(%rbp), %rdi
callq 0x8f40
movq %rax, -0x2c(%rbp)
movq %rdx, -0x24(%rbp)
movslq -0x1c(%rbp), %rcx
leaq 0xfb79(%rip), %rax      # 0x159f0
movq (%rax,%rcx,8), %rax
movq -0x2c(%rbp), %rcx
movq %rcx, 0x18(%rax)
movq -0x24(%rbp), %rcx
movq %rcx, 0x20(%rax)
xorl %eax, %eax
movl %eax, %edi
callq 0x21e0
movq %rax, %rcx
movslq -0x1c(%rbp), %rdx
leaq 0xfb4e(%rip), %rax      # 0x159f0
movq (%rax,%rdx,8), %rax
movq %rcx, 0x10(%rax)
movslq -0x1c(%rbp), %rcx
leaq 0xfb3b(%rip), %rax      # 0x159f0
movq (%rax,%rcx,8), %rax
movb $0x0, 0x28(%rax)
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x5eef
jmp 0x5ec7
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x5dea
movl $0x2, %edi
leaq 0x5a92(%rip), %rsi      # 0xb973
movb $0x0, %al
callq 0x2480
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: qian-jiahong[P]uvncrep017-ws/repeater.cpp
// Function: setViewerActive(long)
static void setViewerActive(long code)
{
    int i;

    for (i = 0; i < maxSessions; i++) {
        if (viewers[i] -> code == code) {
            viewers[i] -> active = true;
            debug(LEVEL_3, "setViewerActive(): activated viewer at index %d, code = %ld\n", i, viewers[i] -> code);
            return;
        }
    }

    debug(LEVEL_2, "setViewerActive(): Warning, viewer not found (code = %ld)\n", code);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
leaq 0x9b23(%rip), %rcx      # 0xfa40
cmpl (%rcx), %eax
jge 0x5f85
movslq -0xc(%rbp), %rcx
leaq 0xfac4(%rip), %rax      # 0x159f0
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rax
cmpq -0x8(%rbp), %rax
jne 0x5f78
movslq -0xc(%rbp), %rcx
leaq 0xfaab(%rip), %rax      # 0x159f0
movq (%rax,%rcx,8), %rax
movb $0x1, 0x28(%rax)
movl -0xc(%rbp), %edx
movslq -0xc(%rbp), %rcx
leaq 0xfa95(%rip), %rax      # 0x159f0
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rcx
movl $0x3, %edi
leaq 0x5a38(%rip), %rsi      # 0xb9a7
movb $0x0, %al
callq 0x2480
jmp 0x5f9c
jmp 0x5f7a
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x5f13
movq -0x8(%rbp), %rdx
movl $0x2, %edi
leaq 0x5a4f(%rip), %rsi      # 0xb9e4
movb $0x0, %al
callq 0x2480
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: qian-jiahong[P]uvncrep017-ws/repeater.cpp
// Function: addServerList(int, long, char*)
static int addServerList(int socket, long code, char *peerIp)
{
    int i;

    for (i = 0; i < maxSessions; i++) {
        if (servers[i] -> code == 0) {
            debug(LEVEL_3, "addServerList(): Server added to list: code = %ld, index = %d\n", code, i);
            servers[i] -> code = code;
            servers[i] -> socket = socket;
            servers[i] -> peerIp = getAddrPartsFromString(peerIp);
            servers[i] -> timeStamp = time(NULL);  /* 1 second accuracy is enough ? */
            servers[i] -> active = false;
            return i;
        }
    }
    
    debug(LEVEL_2, "addServerList(): Warning, no table slots available\n"); 
    return -1;  //Not added
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
leaq 0x9a6c(%rip), %rcx      # 0xfa40
cmpl (%rcx), %eax
jge 0x60b5
movslq -0x1c(%rbp), %rcx
leaq 0xdac9(%rip), %rax      # 0x13ab0
movq (%rax,%rcx,8), %rax
cmpq $0x0, 0x8(%rax)
jne 0x60a5
movq -0x10(%rbp), %rdx
movl -0x1c(%rbp), %ecx
movl $0x3, %edi
leaq 0x5a16(%rip), %rsi      # 0xba1f
movb $0x0, %al
callq 0x2480
movq -0x10(%rbp), %rcx
movslq -0x1c(%rbp), %rdx
leaq 0xda91(%rip), %rax      # 0x13ab0
movq (%rax,%rdx,8), %rax
movq %rcx, 0x8(%rax)
movl -0x8(%rbp), %ecx
movslq -0x1c(%rbp), %rdx
leaq 0xda7b(%rip), %rax      # 0x13ab0
movq (%rax,%rdx,8), %rax
movl %ecx, (%rax)
movq -0x18(%rbp), %rdi
callq 0x8f40
movq %rax, -0x2c(%rbp)
movq %rdx, -0x24(%rbp)
movslq -0x1c(%rbp), %rcx
leaq 0xda59(%rip), %rax      # 0x13ab0
movq (%rax,%rcx,8), %rax
movq -0x2c(%rbp), %rcx
movq %rcx, 0x18(%rax)
movq -0x24(%rbp), %rcx
movq %rcx, 0x20(%rax)
xorl %eax, %eax
movl %eax, %edi
callq 0x21e0
movq %rax, %rcx
movslq -0x1c(%rbp), %rdx
leaq 0xda2e(%rip), %rax      # 0x13ab0
movq (%rax,%rdx,8), %rax
movq %rcx, 0x10(%rax)
movslq -0x1c(%rbp), %rcx
leaq 0xda1b(%rip), %rax      # 0x13ab0
movq (%rax,%rcx,8), %rax
movb $0x0, 0x28(%rax)
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x60cf
jmp 0x60a7
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x5fca
movl $0x2, %edi
leaq 0x599d(%rip), %rsi      # 0xba5e
movb $0x0, %al
callq 0x2480
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: qian-jiahong[P]uvncrep017-ws/repeater.cpp
// Function: setServerActive(long)
static void setServerActive(long code)
{
    int i;

    for (i = 0; i < maxSessions; i++) {
        if (servers[i] -> code == code) {
            servers[i] -> active = true;
            debug(LEVEL_3, "setServerActive(): activated server at index = %d, code = %ld\n", i, servers[i] -> code);
            return;
        }
    }
    debug(LEVEL_2, "setServerActive(): server not found (code = %ld)\n", code);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
leaq 0x9943(%rip), %rcx      # 0xfa40
cmpl (%rcx), %eax
jge 0x6165
movslq -0xc(%rbp), %rcx
leaq 0xd9a4(%rip), %rax      # 0x13ab0
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rax
cmpq -0x8(%rbp), %rax
jne 0x6158
movslq -0xc(%rbp), %rcx
leaq 0xd98b(%rip), %rax      # 0x13ab0
movq (%rax,%rcx,8), %rax
movb $0x1, 0x28(%rax)
movl -0xc(%rbp), %edx
movslq -0xc(%rbp), %rcx
leaq 0xd975(%rip), %rax      # 0x13ab0
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rcx
movl $0x3, %edi
leaq 0x5943(%rip), %rsi      # 0xba92
movb $0x0, %al
callq 0x2480
jmp 0x617c
jmp 0x615a
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x60f3
movq -0x8(%rbp), %rdx
movl $0x2, %edi
leaq 0x595c(%rip), %rsi      # 0xbad1
movb $0x0, %al
callq 0x2480
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: qian-jiahong[P]uvncrep017-ws/repeater.cpp
// Function: forkRepeater(int, int, long)
static void forkRepeater(int serverSocket, int viewerSocket, long idCode)
{
    pid_t pid;

    //fork repeater
    pid = fork();
    if (-1 == pid) {
        //fork failed. This is so unfair. Exit and blame Linus ;-)
        fatal(LEVEL_0, "forkRepeater(): fork() failed. Linus, this is *so* unfair.\n");
    }
    else if (0 == pid) {
        //child code
        debug(LEVEL_3, "forkRepeater(): in child process, starting doRepeater(%d, %d)\n", serverSocket, viewerSocket);
        exit(doRepeater(serverSocket, viewerSocket));
    }
    else {
        //parent code
        //Add necessary information of child to repeaterProcs list so we can
        //properly clean up after child has exited
        addRepeaterProcList(idCode, pid);
        
        //Close (parents copies of) repeater sockets right away here,
        //so we don't need to close them in cleanUpAfterRepeaterProcExit()
        close(serverSocket);
        close(viewerSocket);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
movq %rdx, -0x10(%rbp)
callq 0x2080
movl %eax, -0x14(%rbp)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl -0x14(%rbp), %eax
jne 0x61c8
xorl %eax, %eax
movl %eax, %edi
leaq 0x5944(%rip), %rsi      # 0xbb03
movb $0x0, %al
callq 0x2610
jmp 0x6218
xorl %eax, %eax
cmpl -0x14(%rbp), %eax
jne 0x61fa
movl -0x4(%rbp), %edx
movl -0x8(%rbp), %ecx
movl $0x3, %edi
leaq 0x595e(%rip), %rsi      # 0xbb3f
movb $0x0, %al
callq 0x2480
movl -0x4(%rbp), %edi
movl -0x8(%rbp), %esi
callq 0x6fb0
movl %eax, %edi
callq 0x2270
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x66d0
movl -0x4(%rbp), %edi
callq 0x2370
movl -0x8(%rbp), %edi
callq 0x2370
jmp 0x6218
addq $0x20, %rsp
popq %rbp
retq
nop
// File: qian-jiahong[P]uvncrep017-ws/repeater.cpp
// Function: findServerList(long)
static int findServerList(long code)
{
    int i;

    for (i = 0; i < maxSessions; i++) {
        if (servers[i] -> code == code) {
            debug(LEVEL_3, "findServerList(): server found at index %d, code = %ld\n", i, servers[i] -> code);
            return i;
        }
    }

    debug(LEVEL_2, "findServerList(): server not found (code = %ld)\n", code);
    return UNKNOWN_REPINFO_IND;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
leaq 0x9803(%rip), %rcx      # 0xfa40
cmpl (%rcx), %eax
jge 0x6298
movslq -0x14(%rbp), %rcx
leaq 0xd864(%rip), %rax      # 0x13ab0
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rax
cmpq -0x10(%rbp), %rax
jne 0x628b
movl -0x14(%rbp), %edx
movslq -0x14(%rbp), %rcx
leaq 0xd848(%rip), %rax      # 0x13ab0
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rcx
movl $0x3, %edi
leaq 0x5980(%rip), %rsi      # 0xbbfc
movb $0x0, %al
callq 0x2480
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x62b6
jmp 0x628d
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x6233
movq -0x10(%rbp), %rdx
movl $0x2, %edi
leaq 0x598c(%rip), %rsi      # 0xbc34
movb $0x0, %al
callq 0x2480
movl $0xf423f, -0x4(%rbp)    # imm = 0xF423F
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nop
// File: qian-jiahong[P]uvncrep017-ws/repeater.cpp
// Function: findViewerList(long)
static int findViewerList(long code)
{
    int i;

    for (i = 0; i < maxSessions; i++) {
        if (viewers[i] -> code == code) {
            debug(LEVEL_3, "findViewerList(): viewer found at index %d, code = %ld\n", i, viewers[i] -> code);
            return i;
        }
    }

    debug(LEVEL_2, "findViewerList(): Warning, viewer not found (code = %ld)\n", code);
    return UNKNOWN_REPINFO_IND;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
leaq 0x9763(%rip), %rcx      # 0xfa40
cmpl (%rcx), %eax
jge 0x6338
movslq -0x14(%rbp), %rcx
leaq 0xf704(%rip), %rax      # 0x159f0
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rax
cmpq -0x10(%rbp), %rax
jne 0x632b
movl -0x14(%rbp), %edx
movslq -0x14(%rbp), %rcx
leaq 0xf6e8(%rip), %rax      # 0x159f0
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rcx
movl $0x3, %edi
leaq 0x5949(%rip), %rsi      # 0xbc65
movb $0x0, %al
callq 0x2480
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x6356
jmp 0x632d
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x62d3
movq -0x10(%rbp), %rdx
movl $0x2, %edi
leaq 0x5955(%rip), %rsi      # 0xbc9d
movb $0x0, %al
callq 0x2480
movl $0xf423f, -0x4(%rbp)    # imm = 0xF423F
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nop
// File: qian-jiahong[P]uvncrep017-ws/repeater.cpp
// Function: isServerAddressDenied(addrParts)
static bool isServerAddressDenied(addrParts srvAddr)
{
    int ii;
    
    for(ii = 0; ii < SERVERS_LIST_SIZE; ii++) {
        if (((srvAddr.a == srvListDeny[ii].a) || (srvListDeny[ii].a == 0)) &&
            ((srvAddr.b == srvListDeny[ii].b) || (srvListDeny[ii].b == 0)) &&
            ((srvAddr.c == srvListDeny[ii].c) || (srvListDeny[ii].c == 0)) &&
            ((srvAddr.d == srvListDeny[ii].d) || (srvListDeny[ii].d == 0)) ) {
                debug(LEVEL_3, "isServerAddressDenied(): address is in deny list, denying (%d.%d.%d.%d)\n", 
                    srvAddr.a,srvAddr.b,srvAddr.c,srvAddr.d);
                
                return true;
        }
    }
    
    return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x14(%rbp)
movq %rsi, -0xc(%rbp)
movl $0x0, -0x18(%rbp)
cmpl $0x32, -0x18(%rbp)
jge 0x66b6
movl -0x14(%rbp), %eax
movslq -0x18(%rbp), %rdx
leaq 0x9161(%rip), %rcx      # 0xf720
shlq $0x4, %rdx
addq %rdx, %rcx
cmpl (%rcx), %eax
je 0x65e5
movslq -0x18(%rbp), %rcx
leaq 0x914b(%rip), %rax      # 0xf720
shlq $0x4, %rcx
addq %rcx, %rax
cmpl $0x0, (%rax)
jne 0x66a6
movl -0x10(%rbp), %eax
movslq -0x18(%rbp), %rdx
leaq 0x912d(%rip), %rcx      # 0xf720
shlq $0x4, %rdx
addq %rdx, %rcx
cmpl 0x4(%rcx), %eax
je 0x661b
movslq -0x18(%rbp), %rcx
leaq 0x9116(%rip), %rax      # 0xf720
shlq $0x4, %rcx
addq %rcx, %rax
cmpl $0x0, 0x4(%rax)
jne 0x66a6
movl -0xc(%rbp), %eax
movslq -0x18(%rbp), %rdx
leaq 0x90f7(%rip), %rcx      # 0xf720
shlq $0x4, %rdx
addq %rdx, %rcx
cmpl 0x8(%rcx), %eax
je 0x664d
movslq -0x18(%rbp), %rcx
leaq 0x90e0(%rip), %rax      # 0xf720
shlq $0x4, %rcx
addq %rcx, %rax
cmpl $0x0, 0x8(%rax)
jne 0x66a6
movl -0x8(%rbp), %eax
movslq -0x18(%rbp), %rdx
leaq 0x90c5(%rip), %rcx      # 0xf720
shlq $0x4, %rdx
addq %rdx, %rcx
cmpl 0xc(%rcx), %eax
je 0x667f
movslq -0x18(%rbp), %rcx
leaq 0x90ae(%rip), %rax      # 0xf720
shlq $0x4, %rcx
addq %rcx, %rax
cmpl $0x0, 0xc(%rax)
jne 0x66a6
movl -0x14(%rbp), %edx
movl -0x10(%rbp), %ecx
movl -0xc(%rbp), %r8d
movl -0x8(%rbp), %r9d
movl $0x3, %edi
leaq 0x5252(%rip), %rsi      # 0xb8eb
movb $0x0, %al
callq 0x2480
movb $0x1, -0x1(%rbp)
jmp 0x66ba
jmp 0x66a8
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x65a7
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: qian-jiahong[P]uvncrep017-ws/repeater.cpp
// Function: addRepeaterProcList(long, int)
static void addRepeaterProcList(long code, pid_t pid)
{
    int i;

    for (i = 0; i < maxSessions; i++) {
        if (repeaterProcs[i] -> code == 0) {
            debug(LEVEL_3, "addRepeaterProcList(): Added proc to index=%d, pid=%d, code=%ld\n", i, pid, code);
            repeaterProcs[i] -> code = code;
            repeaterProcs[i] -> pid = pid;
            return;
        }
    }
    debug(LEVEL_2, "addRepeaterProcList(): Warning, no free process slots found\n");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
leaq 0x9350(%rip), %rcx      # 0xfa40
cmpl (%rcx), %eax
jge 0x6760
movslq -0x10(%rbp), %rcx
leaq 0xb471(%rip), %rax      # 0x11b70
movq (%rax,%rcx,8), %rax
cmpq $0x0, (%rax)
jne 0x6753
movl -0x10(%rbp), %edx
movl -0xc(%rbp), %ecx
movq -0x8(%rbp), %r8
movl $0x3, %edi
leaq 0x545f(%rip), %rsi      # 0xbb7e
movb $0x0, %al
callq 0x2480
movq -0x8(%rbp), %rcx
movslq -0x10(%rbp), %rdx
leaq 0xb43b(%rip), %rax      # 0x11b70
movq (%rax,%rdx,8), %rax
movq %rcx, (%rax)
movl -0xc(%rbp), %ecx
movslq -0x10(%rbp), %rdx
leaq 0xb426(%rip), %rax      # 0x11b70
movq (%rax,%rdx,8), %rax
movl %ecx, 0x8(%rax)
jmp 0x6773
jmp 0x6755
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x66e6
movl $0x2, %edi
leaq 0x5453(%rip), %rsi      # 0xbbbf
movb $0x0, %al
callq 0x2480
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: qian-jiahong[P]uvncrep017-ws/repeater.cpp
// Function: removeViewerList(long)
static void removeViewerList(long code)
{
    int i;

    for (i = 0; i < maxSessions; i++) {
        if (viewers[i] -> code == code) {
            debug(LEVEL_3, "removeViewerList(): Viewer removed from list: code = %ld, index = %d\n", code, i);
            viewers[i] -> code = 0;
            viewers[i] -> active = false;
            return;
        }
    }

    debug(LEVEL_2, "removeViewerList(): Warning, viewer not found (code = %ld)\n", code);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
leaq 0x8fe3(%rip), %rcx      # 0xfa40
cmpl (%rcx), %eax
jge 0x6acd
movslq -0xc(%rbp), %rcx
leaq 0xef84(%rip), %rax      # 0x159f0
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rax
cmpq -0x8(%rbp), %rax
jne 0x6ac0
movq -0x8(%rbp), %rdx
movl -0xc(%rbp), %ecx
movl $0x3, %edi
leaq 0x52e1(%rip), %rsi      # 0xbd6e
movb $0x0, %al
callq 0x2480
movslq -0xc(%rbp), %rcx
leaq 0xef51(%rip), %rax      # 0x159f0
movq (%rax,%rcx,8), %rax
movq $0x0, 0x8(%rax)
movslq -0xc(%rbp), %rcx
leaq 0xef3a(%rip), %rax      # 0x159f0
movq (%rax,%rcx,8), %rax
movb $0x0, 0x28(%rax)
jmp 0x6ae4
jmp 0x6ac2
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x6a53
movq -0x8(%rbp), %rdx
movl $0x2, %edi
leaq 0x52d7(%rip), %rsi      # 0xbdb4
movb $0x0, %al
callq 0x2480
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: qian-jiahong[P]uvncrep017-ws/repeater.cpp
// Function: removeServerList(long)
static void removeServerList(long code)
{
    int i;

    for (i = 0; i < maxSessions; i++) {
        if (servers[i] -> code == code) {
            debug(LEVEL_3, "removeServerList(): Server Removed from list: code = %ld, index = %d\n", code, i);
            servers[i] -> code = 0;
            servers[i] -> active = false;
            return;
        }
    }
    debug(LEVEL_2, "removeServerList(): Warning, server not found (code = %ld)\n", code);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
leaq 0x8f33(%rip), %rcx      # 0xfa40
cmpl (%rcx), %eax
jge 0x6b7d
movslq -0xc(%rbp), %rcx
leaq 0xcf94(%rip), %rax      # 0x13ab0
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rax
cmpq -0x8(%rbp), %rax
jne 0x6b70
movq -0x8(%rbp), %rdx
movl -0xc(%rbp), %ecx
movl $0x3, %edi
leaq 0x52b3(%rip), %rsi      # 0xbdf0
movb $0x0, %al
callq 0x2480
movslq -0xc(%rbp), %rcx
leaq 0xcf61(%rip), %rax      # 0x13ab0
movq (%rax,%rcx,8), %rax
movq $0x0, 0x8(%rax)
movslq -0xc(%rbp), %rcx
leaq 0xcf4a(%rip), %rax      # 0x13ab0
movq (%rax,%rcx,8), %rax
movb $0x0, 0x28(%rax)
jmp 0x6b94
jmp 0x6b72
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x6b03
movq -0x8(%rbp), %rdx
movl $0x2, %edi
leaq 0x52a9(%rip), %rsi      # 0xbe36
movb $0x0, %al
callq 0x2480
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: qian-jiahong[P]uvncrep017-ws/repeater.cpp
// Function: findRepeaterProcList(int)
static int findRepeaterProcList(pid_t pid)
{
    int i;

    for (i = 0; i < maxSessions; i++) {
        if (repeaterProcs[i] -> pid == pid) {
            debug(LEVEL_3, "findRepeaterProcList(): proc found at index=%d, pid=%d, code = %ld\n", 
                i, pid, repeaterProcs[i] -> code);
            return i;
        }
    }

    debug(LEVEL_2, "findRepeaterProcList(): Warning, did not find any proc (pid=%d)\n", pid); 
    return UNKNOWN_REPINFO_IND;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl %edi, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
leaq 0x8bc4(%rip), %rcx      # 0xfa40
cmpl (%rcx), %eax
jge 0x6ed7
movslq -0xc(%rbp), %rcx
leaq 0xace5(%rip), %rax      # 0x11b70
movq (%rax,%rcx,8), %rax
movl 0x8(%rax), %eax
cmpl -0x8(%rbp), %eax
jne 0x6eca
movl -0xc(%rbp), %edx
movl -0x8(%rbp), %ecx
movslq -0xc(%rbp), %rsi
leaq 0xacc8(%rip), %rax      # 0x11b70
movq (%rax,%rsi,8), %rax
movq (%rax), %r8
movl $0x3, %edi
leaq 0x5133(%rip), %rsi      # 0xbfee
movb $0x0, %al
callq 0x2480
movl -0xc(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x6ef4
jmp 0x6ecc
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x6e72
movl -0x8(%rbp), %edx
movl $0x2, %edi
leaq 0x514c(%rip), %rsi      # 0xc032
movb $0x0, %al
callq 0x2480
movl $0xf423f, -0x4(%rbp)    # imm = 0xF423F
movl -0x4(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: qian-jiahong[P]uvncrep017-ws/repeater.cpp
// Function: removeRepeaterProcList(int)
static void removeRepeaterProcList(pid_t pid)
{
    int i;

    for (i = 0; i < maxSessions; i++) {
        if (repeaterProcs[i] -> pid == pid) {
            debug(LEVEL_3, "removeRepeaterProcList(): Removing proc from index=%d, pid=%d\n", i, pid);
            repeaterProcs[i] -> code = 0;
            repeaterProcs[i] -> pid = 0;
            return;
        }
    }
    debug(LEVEL_2, "removeRepeaterProcList(): Warning, did not find any process to remove\n");

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl %edi, -0x4(%rbp)
movl $0x0, -0x8(%rbp)
movl -0x8(%rbp), %eax
leaq 0x8b24(%rip), %rcx      # 0xfa40
cmpl (%rcx), %eax
jge 0x6f8b
movslq -0x8(%rbp), %rcx
leaq 0xac45(%rip), %rax      # 0x11b70
movq (%rax,%rcx,8), %rax
movl 0x8(%rax), %eax
cmpl -0x4(%rbp), %eax
jne 0x6f7e
movl -0x8(%rbp), %edx
movl -0x4(%rbp), %ecx
movl $0x3, %edi
leaq 0x512a(%rip), %rsi      # 0xc073
movb $0x0, %al
callq 0x2480
movslq -0x8(%rbp), %rcx
leaq 0xac15(%rip), %rax      # 0x11b70
movq (%rax,%rcx,8), %rax
movq $0x0, (%rax)
movslq -0x8(%rbp), %rcx
leaq 0xabff(%rip), %rax      # 0x11b70
movq (%rax,%rcx,8), %rax
movl $0x0, 0x8(%rax)
jmp 0x6f9e
jmp 0x6f80
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x6f12
movl $0x2, %edi
leaq 0x511b(%rip), %rsi      # 0xc0b2
movb $0x0, %al
callq 0x2480
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop