// File: /workspace/github_c_makefile_star2_O0/desion[P]terminal/src/terminal.c
// Function: worker
static void* worker(void *arg)
{
    pthread_detach(pthread_self()); //detach the work thread

    hdb_t *hdb = (hdb_t *)arg;
    hdict_t *hdict;
    conn *c;
    while(1) {
        c = cq_pop(&REQ);

        struct timeval now;
        gettimeofday(&now, NULL);

        struct timeval tv;
        mytimesub(&now, &c->tv, &tv);
        
        if (settings.timeout > 0 && tv.tv_sec * 1000 + tv.tv_usec/1000 > settings.timeout) {    /* process timeout */
            pack_string(c, "SERVER_ERROR timeout");
            STATS_LOCK(stats);
            stats.timeouts++;
            STATS_UNLOCK(stats);
        } else if (strcmp(c->cmd, "stats") == 0) {      /* process stats command */
            char temp[1024];
            pid_t pid = getpid();
            char *pos = temp;

            uint32_t length = cq_length(&REQ);
            STATS_LOCK(stats);
            pos += sprintf(pos, "STAT pid %u\r\n", pid);
            pos += sprintf(pos, "STAT uptime %lld\r\n", (long long)stats.started);
            pos += sprintf(pos, "STAT curr_connections %u\r\n", stats.curr_conns - 1); /* ignore listening conn */
            pos += sprintf(pos, "STAT connection_structures %u\r\n", stats.conn_structs);
            pos += sprintf(pos, "STAT cmd_get %u\r\n", stats.get_cmds);
            pos += sprintf(pos, "STAT get_hits %u\r\n", stats.get_hits);
            pos += sprintf(pos, "STAT get_misses %u\r\n", stats.get_misses);
            pos += sprintf(pos, "STAT threads %u\r\n", settings.num_threads);
            pos += sprintf(pos, "STAT timeouts %u\r\n", stats.timeouts);
            pos += sprintf(pos, "STAT waiting_requests %u\r\n", length);
            pos += sprintf(pos, "STAT ialloc_failed %u\r\n", stats.ialloc_failed);
            pos += sprintf(pos, "END");
            STATS_UNLOCK(stats);
            pack_string(c, temp);
        } else if (strcmp(c->cmd, "stats reset") == 0) {    /* reset the status */
            STATS_LOCK(stats);
            stats.get_cmds = 0;
            stats.get_hits = 0;
            stats.get_misses = 0;
            stats.timeouts = 0;
            stats.ialloc_failed = 0;
            STATS_UNLOCK(stats);
            pack_string(c, "RESET");
        } else if (strncmp(c->cmd, "open ", 5) == 0 ||
            strncmp(c->cmd, "reopen ", 7) == 0) {   /* open or reopen the db */

            char path[256];
            int res = sscanf(c->cmd, "%*s %255s\n", path);
            if (res != 1 || strlen(path) == 0) {
                pack_string(c, "CLIENT_ERROR bad command line format");
            } else {
                int status = hdb_reopen(hdb, path);
                if (status == 0) {
                    pack_string(c, "OPENED");
                } else {
                    if (settings.verbose > 0)
                        fprintf(stderr, "failed to open %s, return %d\n",
                            path, status);
                    if (status == EHDICT_OUT_OF_MEMERY) {
                        STATS_LOCK(stats);
                        stats.ialloc_failed++;
                        STATS_UNLOCK(stats);
                    }
                    pack_string(c, "SERVER_ERROR open failed");
                }
            }
        } else if (strncmp(c->cmd, "append ", 7) == 0) {   /* open or reopen the db */
            char path[256];
            int res = sscanf(c->cmd, "%*s %255s\n", path);
            if (res != 1 || strlen(path) == 0) {
                pack_string(c, "CLIENT_ERROR bad command line format");
            } else {
                int status = hdb_append(hdb, path);
                if (status == 0) {
                    pack_string(c, "OPENED");
                } else {
                    if (settings.verbose > 0)
                        fprintf(stderr, "failed to open %s, return %d\n",path, status);
                    if (status == EHDICT_OUT_OF_MEMERY) {
                        STATS_LOCK(stats);
                        stats.ialloc_failed++;
                        STATS_UNLOCK(stats);
                    }
                    pack_string(c, "SERVER_ERROR open failed");
                }
            }
        } else if (strncmp(c->cmd, "close ", 6) == 0) {     /* close the db */
            char label[21];
            int res;
            const char* command = c->cmd + 6;
            int pos = find_index(command, ' ');
            if (pos < 0){
                res = hdb_close(hdb, command, 0);
            }else{
                strncpy(label, command, pos);
                uint32_t version = strtoul(command + pos + 1, NULL, 10);
                res = hdb_close(hdb, label, version); 
            }
            if (res >= 1) {
                pack_string(c, "CLOSED");
            } else {
                pack_string(c, "NOT_FOUND");
            }
        } else if (strncmp(c->cmd, "info", 4) == 0) {   /* show the hdb info */
            char temp[4096];
            hdb_info(hdb, temp, 4096);
            pack_string(c, temp);
        } else if (strncmp(c->cmd, "get ", 4) == 0) {   /* get the key from db */
            char *start = c->cmd + 4;
            char token[251];
            char label[21];
            int next;
            //uint64_t key;
            off_t off;
            uint32_t length;
            c->wbytes = 0;
            int res, nc;
            char *en_dash;
            while(sscanf(start, " %250s%n", token, &next) >= 1) {
                start += next;

                STATS_LOCK(stats);
                stats.get_cmds++;
                STATS_UNLOCK(stats);
                char *str_key;
                if ((en_dash = strchr(token, '-')) == NULL) {
                    //key = strtoull(token, NULL, 10);
                    str_key = token;
                } else {
                    *en_dash = '\0';
                    strcpy(label, token);
                    //key = strtoull(en_dash+1, NULL, 10);
                    str_key = en_dash+1;
                }
                if (hdict_search(hdb, label, str_key, &off, &length, &hdict)) {
                    STATS_LOCK(stats);
                    stats.get_hits++;
                    STATS_UNLOCK(stats);
                    if (length < HDICT_VALUE_LENGTH_MAX) {
                        if (c->wsize - c->wbytes < 512 + length) {
                            int relloc_length = c->wsize * 2;
                            if (relloc_length - c->wbytes < 512 + length) {
                                relloc_length = 512 + length + c->wbytes;
                                relloc_length = (relloc_length/DATA_BUFFER_SIZE + 1) * DATA_BUFFER_SIZE;
                            }
                            char *newbuf = (char *)realloc(c->wbuf, relloc_length);
                            if (newbuf) {
                                c->wbuf = newbuf;
                                c->wsize = relloc_length;
                            } else {
                                if (settings.verbose > 0)
                                    fprintf(stderr, "Couldn't realloc output buffer\n");
                            }
                        }

                        nc = sprintf(c->wbuf + c->wbytes, "VALUE %s %u %u\r\n", token, 0, length);
                        res = hdict_read(hdict, c->wbuf + c->wbytes + nc, length, off);
                        if (res != length) {
                            if (settings.verbose > 0)
                                fprintf(stderr, "Failed to read from hdict\n");
                        }

                        c->wbytes += nc;
                        c->wbytes += length;
                        c->wbytes += sprintf(c->wbuf + c->wbytes, "\r\n");
                    }
                } else {
                    STATS_LOCK(stats);
                    stats.get_misses++;
                    STATS_UNLOCK(stats);
                }
            }
            c->wbytes += sprintf(c->wbuf + c->wbytes, "END\r\n");
        } else {
            pack_string(c, "ERROR");
        }

        cq_push(&RSP, c);
        pthread_mutex_lock(&notify_lock);
        if (write(notify_send_fd, "", 1) != 1) {
            perror("Writing to thread notify pipe");
        }
        pthread_mutex_unlock(&notify_lock);
    }

    return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1830, %rsp           # imm = 0x1830
movq %rdi, -0x8(%rbp)
callq 0x2370
movq %rax, %rdi
callq 0x22f0
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
leaq 0x526d(%rip), %rdi      # 0xaa98
callq 0x43b0
movq %rax, -0x20(%rbp)
leaq -0x30(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x2180
movq -0x30(%rbp), %rax
movq -0x20(%rbp), %rcx
subq 0xd0(%rcx), %rax
movq %rax, -0x40(%rbp)
movq -0x28(%rbp), %rax
movq -0x20(%rbp), %rcx
subq 0xd8(%rcx), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jge 0x5888
movq -0x40(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rax
addq $0xf4240, %rax          # imm = 0xF4240
movq %rax, -0x38(%rbp)
jmp 0x588a
cmpl $0x0, 0x51fb(%rip)      # 0xaa8c
jle 0x590d
imulq $0x3e8, -0x40(%rbp), %rax # imm = 0x3E8
movq %rax, -0x1828(%rbp)
movq -0x38(%rbp), %rax
movl $0x3e8, %ecx            # imm = 0x3E8
cqto
idivq %rcx
movq %rax, %rcx
movq -0x1828(%rbp), %rax
addq %rcx, %rax
movslq 0x51c8(%rip), %rcx      # 0xaa8c
cmpq %rcx, %rax
jle 0x590d
movq -0x20(%rbp), %rdi
leaq 0x1f1b(%rip), %rsi      # 0x77ef
callq 0x51e0
leaq 0x52b0(%rip), %rdi      # 0xab90
addq $0x28, %rdi
callq 0x2490
movl 0x52c1(%rip), %eax      # 0xabb0
addl $0x1, %eax
movl %eax, 0x52b8(%rip)      # 0xabb0
leaq 0x5291(%rip), %rdi      # 0xab90
addq $0x28, %rdi
callq 0x22d0
jmp 0x6449
movq -0x20(%rbp), %rax
movq 0xc8(%rax), %rdi
leaq 0x1ee5(%rip), %rsi      # 0x7804
callq 0x2240
cmpl $0x0, %eax
jne 0x5bd7
callq 0x20f0
movl %eax, -0x444(%rbp)
leaq -0x440(%rbp), %rax
movq %rax, -0x450(%rbp)
leaq 0x514b(%rip), %rdi      # 0xaa98
callq 0x44f0
movl %eax, -0x454(%rbp)
leaq 0x5231(%rip), %rdi      # 0xab90
addq $0x28, %rdi
callq 0x2490
movq -0x450(%rbp), %rdi
movl -0x444(%rbp), %edx
leaq 0x1e8e(%rip), %rsi      # 0x780a
movb $0x0, %al
callq 0x2420
movl %eax, %ecx
movq -0x450(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x450(%rbp)
movq -0x450(%rbp), %rdi
movq 0x5201(%rip), %rdx      # 0xaba8
leaq 0x1e6a(%rip), %rsi      # 0x7818
movb $0x0, %al
callq 0x2420
movl %eax, %ecx
movq -0x450(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x450(%rbp)
movq -0x450(%rbp), %rdi
movl 0x51b8(%rip), %edx      # 0xab90
subl $0x1, %edx
leaq 0x1e49(%rip), %rsi      # 0x782b
movb $0x0, %al
callq 0x2420
movl %eax, %ecx
movq -0x450(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x450(%rbp)
movq -0x450(%rbp), %rdi
movl 0x5188(%rip), %edx      # 0xab94
leaq 0x1e33(%rip), %rsi      # 0x7846
movb $0x0, %al
callq 0x2420
movl %eax, %ecx
movq -0x450(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x450(%rbp)
movq -0x450(%rbp), %rdi
movl 0x515b(%rip), %edx      # 0xab98
leaq 0x1e22(%rip), %rsi      # 0x7866
movb $0x0, %al
callq 0x2420
movl %eax, %ecx
movq -0x450(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x450(%rbp)
movq -0x450(%rbp), %rdi
movl 0x512e(%rip), %edx      # 0xab9c
leaq 0x1e03(%rip), %rsi      # 0x7878
movb $0x0, %al
callq 0x2420
movl %eax, %ecx
movq -0x450(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x450(%rbp)
movq -0x450(%rbp), %rdi
movl 0x5101(%rip), %edx      # 0xaba0
leaq 0x1de5(%rip), %rsi      # 0x788b
movb $0x0, %al
callq 0x2420
movl %eax, %ecx
movq -0x450(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x450(%rbp)
movq -0x450(%rbp), %rdi
movl 0x4fb4(%rip), %edx      # 0xaa84
leaq 0x1dc9(%rip), %rsi      # 0x78a0
movb $0x0, %al
callq 0x2420
movl %eax, %ecx
movq -0x450(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x450(%rbp)
movq -0x450(%rbp), %rdi
movl 0x50af(%rip), %edx      # 0xabb0
leaq 0x1daa(%rip), %rsi      # 0x78b2
movb $0x0, %al
callq 0x2420
movl %eax, %ecx
movq -0x450(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x450(%rbp)
movq -0x450(%rbp), %rdi
movl -0x454(%rbp), %edx
leaq 0x1d8c(%rip), %rsi      # 0x78c5
movb $0x0, %al
callq 0x2420
movl %eax, %ecx
movq -0x450(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x450(%rbp)
movq -0x450(%rbp), %rdi
movl 0x5051(%rip), %edx      # 0xabb4
leaq 0x1d76(%rip), %rsi      # 0x78e0
movb $0x0, %al
callq 0x2420
movl %eax, %ecx
movq -0x450(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x450(%rbp)
movq -0x450(%rbp), %rdi
leaq 0x1d63(%rip), %rsi      # 0x78f8
movb $0x0, %al
callq 0x2420
movl %eax, %ecx
movq -0x450(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x450(%rbp)
leaq 0x4fd7(%rip), %rdi      # 0xab90
addq $0x28, %rdi
callq 0x22d0
movq -0x20(%rbp), %rdi
leaq -0x440(%rbp), %rsi
callq 0x51e0
jmp 0x6447
movq -0x20(%rbp), %rax
movq 0xc8(%rax), %rdi
leaq 0x1d13(%rip), %rsi      # 0x78fc
callq 0x2240
cmpl $0x0, %eax
jne 0x5c5a
leaq 0x4f96(%rip), %rdi      # 0xab90
addq $0x28, %rdi
callq 0x2490
movl $0x0, 0x4f8b(%rip)      # 0xab98
movl $0x0, 0x4f85(%rip)      # 0xab9c
movl $0x0, 0x4f7f(%rip)      # 0xaba0
movl $0x0, 0x4f85(%rip)      # 0xabb0
movl $0x0, 0x4f7f(%rip)      # 0xabb4
leaq 0x4f54(%rip), %rdi      # 0xab90
addq $0x28, %rdi
callq 0x22d0
movq -0x20(%rbp), %rdi
leaq 0x1cb8(%rip), %rsi      # 0x7908
callq 0x51e0
jmp 0x6445
movq -0x20(%rbp), %rax
movq 0xc8(%rax), %rdi
leaq 0x1ca4(%rip), %rsi      # 0x7910
movl $0x5, %edx
callq 0x2070
cmpl $0x0, %eax
je 0x5ca0
movq -0x20(%rbp), %rax
movq 0xc8(%rax), %rdi
leaq 0x1c81(%rip), %rsi      # 0x790e
movl $0x7, %edx
callq 0x2070
cmpl $0x0, %eax
jne 0x5da4
movq -0x20(%rbp), %rax
movq 0xc8(%rax), %rdi
leaq -0x560(%rbp), %rdx
leaq 0x1c5d(%rip), %rsi      # 0x7916
movb $0x0, %al
callq 0x2300
movl %eax, -0x564(%rbp)
cmpl $0x1, -0x564(%rbp)
jne 0x5ce1
leaq -0x560(%rbp), %rdi
callq 0x2120
cmpq $0x0, %rax
jne 0x5cf6
movq -0x20(%rbp), %rdi
leaq 0x1c35(%rip), %rsi      # 0x7921
callq 0x51e0
jmp 0x5d9f
movq -0x10(%rbp), %rdi
leaq -0x560(%rbp), %rsi
callq 0x3490
movl %eax, -0x568(%rbp)
cmpl $0x0, -0x568(%rbp)
jne 0x5d27
movq -0x20(%rbp), %rdi
leaq 0x1c26(%rip), %rsi      # 0x7946
callq 0x51e0
jmp 0x5d9d
cmpl $0x0, 0x4d5a(%rip)      # 0xaa88
jle 0x5d55
movq 0x42c1(%rip), %rax      # 0x9ff8
movq (%rax), %rdi
leaq -0x560(%rbp), %rdx
movl -0x568(%rbp), %ecx
leaq 0x1bff(%rip), %rsi      # 0x794d
movb $0x0, %al
callq 0x2260
cmpl $-0x1, -0x568(%rbp)
jne 0x5d8d
leaq 0x4e2b(%rip), %rdi      # 0xab90
addq $0x28, %rdi
callq 0x2490
movl 0x4e40(%rip), %eax      # 0xabb4
addl $0x1, %eax
movl %eax, 0x4e37(%rip)      # 0xabb4
leaq 0x4e0c(%rip), %rdi      # 0xab90
addq $0x28, %rdi
callq 0x22d0
movq -0x20(%rbp), %rdi
leaq 0x1bd3(%rip), %rsi      # 0x796b
callq 0x51e0
jmp 0x5d9f
jmp 0x6443
movq -0x20(%rbp), %rax
movq 0xc8(%rax), %rdi
leaq 0x1bce(%rip), %rsi      # 0x7984
movl $0x7, %edx
callq 0x2070
cmpl $0x0, %eax
jne 0x5ecd
movq -0x20(%rbp), %rax
movq 0xc8(%rax), %rdi
leaq -0x670(%rbp), %rdx
leaq 0x1b34(%rip), %rsi      # 0x7916
movb $0x0, %al
callq 0x2300
movl %eax, -0x674(%rbp)
cmpl $0x1, -0x674(%rbp)
jne 0x5e0a
leaq -0x670(%rbp), %rdi
callq 0x2120
cmpq $0x0, %rax
jne 0x5e1f
movq -0x20(%rbp), %rdi
leaq 0x1b0c(%rip), %rsi      # 0x7921
callq 0x51e0
jmp 0x5ec8
movq -0x10(%rbp), %rdi
leaq -0x670(%rbp), %rsi
callq 0x3250
movl %eax, -0x678(%rbp)
cmpl $0x0, -0x678(%rbp)
jne 0x5e50
movq -0x20(%rbp), %rdi
leaq 0x1afd(%rip), %rsi      # 0x7946
callq 0x51e0
jmp 0x5ec6
cmpl $0x0, 0x4c31(%rip)      # 0xaa88
jle 0x5e7e
movq 0x4198(%rip), %rax      # 0x9ff8
movq (%rax), %rdi
leaq -0x670(%rbp), %rdx
movl -0x678(%rbp), %ecx
leaq 0x1ad6(%rip), %rsi      # 0x794d
movb $0x0, %al
callq 0x2260
cmpl $-0x1, -0x678(%rbp)
jne 0x5eb6
leaq 0x4d02(%rip), %rdi      # 0xab90
addq $0x28, %rdi
callq 0x2490
movl 0x4d17(%rip), %eax      # 0xabb4
addl $0x1, %eax
movl %eax, 0x4d0e(%rip)      # 0xabb4
leaq 0x4ce3(%rip), %rdi      # 0xab90
addq $0x28, %rdi
callq 0x22d0
movq -0x20(%rbp), %rdi
leaq 0x1aaa(%rip), %rsi      # 0x796b
callq 0x51e0
jmp 0x5ec8
jmp 0x6441
movq -0x20(%rbp), %rax
movq 0xc8(%rax), %rdi
leaq 0x1aad(%rip), %rsi      # 0x798c
movl $0x6, %edx
callq 0x2070
cmpl $0x0, %eax
jne 0x5fd1
movq -0x20(%rbp), %rax
movq 0xc8(%rax), %rax
addq $0x6, %rax
movq %rax, -0x6a0(%rbp)
movq -0x6a0(%rbp), %rdi
movl $0x20, %esi
callq 0x6560
movl %eax, -0x6a4(%rbp)
cmpl $0x0, -0x6a4(%rbp)
jge 0x5f42
movq -0x10(%rbp), %rdi
movq -0x6a0(%rbp), %rsi
xorl %edx, %edx
callq 0x3750
movl %eax, -0x694(%rbp)
jmp 0x5fa1
leaq -0x690(%rbp), %rdi
movq -0x6a0(%rbp), %rsi
movslq -0x6a4(%rbp), %rdx
callq 0x2050
movq -0x6a0(%rbp), %rdi
movslq -0x6a4(%rbp), %rax
addq %rax, %rdi
addq $0x1, %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0xa, %edx
callq 0x23e0
movl %eax, -0x6a8(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x690(%rbp), %rsi
movl -0x6a8(%rbp), %edx
callq 0x3750
movl %eax, -0x694(%rbp)
cmpl $0x1, -0x694(%rbp)
jl 0x5fbc
movq -0x20(%rbp), %rdi
leaq 0x19de(%rip), %rsi      # 0x7993
callq 0x51e0
jmp 0x5fcc
movq -0x20(%rbp), %rdi
leaq 0x19d3(%rip), %rsi      # 0x799a
callq 0x51e0
jmp 0x643f
movq -0x20(%rbp), %rax
movq 0xc8(%rax), %rdi
leaq 0x19c1(%rip), %rsi      # 0x79a4
movl $0x4, %edx
callq 0x2070
cmpl $0x0, %eax
jne 0x601c
movq -0x10(%rbp), %rdi
leaq -0x16b0(%rbp), %rsi
movl $0x1000, %edx           # imm = 0x1000
callq 0x3910
movq -0x20(%rbp), %rdi
leaq -0x16b0(%rbp), %rsi
callq 0x51e0
jmp 0x643d
movq -0x20(%rbp), %rax
movq 0xc8(%rax), %rdi
leaq 0x197b(%rip), %rsi      # 0x79a9
movl $0x4, %edx
callq 0x2070
cmpl $0x0, %eax
jne 0x642b
movq -0x20(%rbp), %rax
movq 0xc8(%rax), %rax
addq $0x4, %rax
movq %rax, -0x16b8(%rbp)
movq -0x20(%rbp), %rax
movl $0x0, 0xbc(%rax)
movq -0x16b8(%rbp), %rdi
leaq -0x17c0(%rbp), %rdx
leaq 0x1934(%rip), %rsi      # 0x79ae
leaq -0x17e4(%rbp), %rcx
movb $0x0, %al
callq 0x2300
cmpl $0x1, %eax
jl 0x63f0
movl -0x17e4(%rbp), %ecx
movq -0x16b8(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x16b8(%rbp)
leaq 0x4ade(%rip), %rdi      # 0xab90
addq $0x28, %rdi
callq 0x2490
movl 0x4ad7(%rip), %eax      # 0xab98
addl $0x1, %eax
movl %eax, 0x4ace(%rip)      # 0xab98
leaq 0x4abf(%rip), %rdi      # 0xab90
addq $0x28, %rdi
callq 0x22d0
leaq -0x17c0(%rbp), %rdi
movl $0x2d, %esi
callq 0x2140
movq %rax, -0x1808(%rbp)
cmpq $0x0, %rax
jne 0x6108
leaq -0x17c0(%rbp), %rax
movq %rax, -0x1810(%rbp)
jmp 0x6137
movq -0x1808(%rbp), %rax
movb $0x0, (%rax)
leaq -0x17e0(%rbp), %rdi
leaq -0x17c0(%rbp), %rsi
callq 0x2090
movq -0x1808(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x1810(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x17e0(%rbp), %rsi
movq -0x1810(%rbp), %rdx
leaq -0x17f0(%rbp), %rcx
leaq -0x17f4(%rbp), %r8
leaq -0x18(%rbp), %r9
callq 0x2e60
cmpl $0x0, %eax
je 0x63bc
leaq 0x4a20(%rip), %rdi      # 0xab90
addq $0x28, %rdi
callq 0x2490
movl 0x4a1d(%rip), %eax      # 0xab9c
addl $0x1, %eax
movl %eax, 0x4a14(%rip)      # 0xab9c
leaq 0x4a01(%rip), %rdi      # 0xab90
addq $0x28, %rdi
callq 0x22d0
cmpl $0x32000, -0x17f4(%rbp) # imm = 0x32000
jae 0x63ba
movq -0x20(%rbp), %rax
movl 0xb8(%rax), %eax
movq -0x20(%rbp), %rcx
subl 0xbc(%rcx), %eax
movl -0x17f4(%rbp), %ecx
addl $0x200, %ecx            # imm = 0x200
cmpl %ecx, %eax
jae 0x62a8
movq -0x20(%rbp), %rax
movl 0xb8(%rax), %eax
shll %eax
movl %eax, -0x1814(%rbp)
movl -0x1814(%rbp), %eax
movq -0x20(%rbp), %rcx
subl 0xbc(%rcx), %eax
movl -0x17f4(%rbp), %ecx
addl $0x200, %ecx            # imm = 0x200
cmpl %ecx, %eax
jae 0x6237
movl -0x17f4(%rbp), %eax
addl $0x200, %eax            # imm = 0x200
movq -0x20(%rbp), %rcx
addl 0xbc(%rcx), %eax
movl %eax, -0x1814(%rbp)
movl -0x1814(%rbp), %eax
movl $0x2000, %ecx           # imm = 0x2000
cltd
idivl %ecx
addl $0x1, %eax
shll $0xd, %eax
movl %eax, -0x1814(%rbp)
movq -0x20(%rbp), %rax
movq 0xa8(%rax), %rdi
movslq -0x1814(%rbp), %rsi
callq 0x2330
movq %rax, -0x1820(%rbp)
cmpq $0x0, -0x1820(%rbp)
je 0x6283
movq -0x1820(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0xa8(%rax)
movl -0x1814(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0xb8(%rax)
jmp 0x62a6
cmpl $0x0, 0x47fe(%rip)      # 0xaa88
jle 0x62a4
movq 0x3d65(%rip), %rax      # 0x9ff8
movq (%rax), %rdi
leaq 0x171a(%rip), %rsi      # 0x79b7
movb $0x0, %al
callq 0x2260
jmp 0x62a6
jmp 0x62a8
movq -0x20(%rbp), %rax
movq 0xa8(%rax), %rdi
movq -0x20(%rbp), %rax
movslq 0xbc(%rax), %rax
addq %rax, %rdi
leaq -0x17c0(%rbp), %rdx
movl -0x17f4(%rbp), %r8d
leaq 0x1701(%rip), %rsi      # 0x79d7
xorl %ecx, %ecx
movb $0x0, %al
callq 0x2420
movl %eax, -0x17fc(%rbp)
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0xa8(%rax), %rsi
movq -0x20(%rbp), %rax
movslq 0xbc(%rax), %rax
addq %rax, %rsi
movslq -0x17fc(%rbp), %rax
addq %rax, %rsi
movl -0x17f4(%rbp), %edx
movq -0x17f0(%rbp), %rcx
callq 0x2e20
movl %eax, -0x17f8(%rbp)
movl -0x17f8(%rbp), %eax
cmpl -0x17f4(%rbp), %eax
je 0x6355
cmpl $0x0, 0x474f(%rip)      # 0xaa88
jle 0x6353
movq 0x3cb6(%rip), %rax      # 0x9ff8
movq (%rax), %rdi
leaq 0x169c(%rip), %rsi      # 0x79e8
movb $0x0, %al
callq 0x2260
jmp 0x6355
movl -0x17fc(%rbp), %ecx
movq -0x20(%rbp), %rax
addl 0xbc(%rax), %ecx
movl %ecx, 0xbc(%rax)
movl -0x17f4(%rbp), %ecx
movq -0x20(%rbp), %rax
addl 0xbc(%rax), %ecx
movl %ecx, 0xbc(%rax)
movq -0x20(%rbp), %rax
movq 0xa8(%rax), %rdi
movq -0x20(%rbp), %rax
movslq 0xbc(%rax), %rax
addq %rax, %rdi
leaq 0x1665(%rip), %rsi      # 0x7a06
movb $0x0, %al
callq 0x2420
movl %eax, %ecx
movq -0x20(%rbp), %rax
addl 0xbc(%rax), %ecx
movl %ecx, 0xbc(%rax)
jmp 0x63eb
leaq 0x47cd(%rip), %rdi      # 0xab90
addq $0x28, %rdi
callq 0x2490
movl 0x47ce(%rip), %eax      # 0xaba0
addl $0x1, %eax
movl %eax, 0x47c5(%rip)      # 0xaba0
leaq 0x47ae(%rip), %rdi      # 0xab90
addq $0x28, %rdi
callq 0x22d0
jmp 0x6065
movq -0x20(%rbp), %rax
movq 0xa8(%rax), %rdi
movq -0x20(%rbp), %rax
movslq 0xbc(%rax), %rax
addq %rax, %rdi
leaq 0x15f3(%rip), %rsi      # 0x7a03
movb $0x0, %al
callq 0x2420
movl %eax, %ecx
movq -0x20(%rbp), %rax
addl 0xbc(%rax), %ecx
movl %ecx, 0xbc(%rax)
jmp 0x643b
movq -0x20(%rbp), %rdi
leaq 0x15d3(%rip), %rsi      # 0x7a09
callq 0x51e0
jmp 0x643d
jmp 0x643f
jmp 0x6441
jmp 0x6443
jmp 0x6445
jmp 0x6447
jmp 0x6449
movq -0x20(%rbp), %rsi
leaq 0x46b4(%rip), %rdi      # 0xab08
callq 0x4310
leaq 0x4780(%rip), %rdi      # 0xabe0
callq 0x2490
movl 0x4711(%rip), %edi      # 0xab7c
leaq 0x1596(%rip), %rsi      # 0x7a08
movl $0x1, %edx
callq 0x20e0
cmpq $0x1, %rax
je 0x648e
leaq 0x1586(%rip), %rdi      # 0x7a0f
callq 0x23b0
leaq 0x474b(%rip), %rdi      # 0xabe0
callq 0x22d0
jmp 0x5824
nop