// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/src/cluster.c
// Function: migrateCommand
void migrateCommand(client *c) {
    migrateCachedSocket *cs;
    int copy, replace, j;
    long timeout;
    long dbid;
    robj **ov = NULL; /* Objects to migrate. */
    robj **kv = NULL; /* Key names. */
    robj **newargv = NULL; /* Used to rewrite the command as DEL ... keys ... */
    rio cmd, payload;
    int may_retry = 1;
    int write_error = 0;
    int argv_rewritten = 0;

    /* To support the KEYS option we need the following additional state. */
    int first_key = 3; /* Argument index of the first key. */
    int num_keys = 1;  /* By default only migrate the 'key' argument. */

    /* Initialization */
    copy = 0;
    replace = 0;

    /* Parse additional options */
    for (j = 6; j < c->argc; j++) {
        if (!strcasecmp(c->argv[j]->ptr,"copy")) {
            copy = 1;
        } else if (!strcasecmp(c->argv[j]->ptr,"replace")) {
            replace = 1;
        } else if (!strcasecmp(c->argv[j]->ptr,"keys")) {
            if (sdslen(c->argv[3]->ptr) != 0) {
                addReplyError(c,
                    "When using MIGRATE KEYS option, the key argument"
                    " must be set to the empty string");
                return;
            }
            first_key = j+1;
            num_keys = c->argc - j - 1;
            break; /* All the remaining args are keys. */
        } else {
            addReply(c,shared.syntaxerr);
            return;
        }
    }

    /* Sanity check */
    if (getLongFromObjectOrReply(c,c->argv[5],&timeout,NULL) != C_OK ||
        getLongFromObjectOrReply(c,c->argv[4],&dbid,NULL) != C_OK)
    {
        return;
    }
    if (timeout <= 0) timeout = 1000;

    /* Check if the keys are here. If at least one key is to migrate, do it
     * otherwise if all the keys are missing reply with "NOKEY" to signal
     * the caller there was nothing to migrate. We don't return an error in
     * this case, since often this is due to a normal condition like the key
     * expiring in the meantime. */
    ov = zrealloc(ov,sizeof(robj*)*num_keys);
    kv = zrealloc(kv,sizeof(robj*)*num_keys);
    int oi = 0;

    for (j = 0; j < num_keys; j++) {
        if ((ov[oi] = lookupKeyRead(c->db,c->argv[first_key+j])) != NULL) {
            kv[oi] = c->argv[first_key+j];
            oi++;
        }
    }
    num_keys = oi;
    if (num_keys == 0) {
        zfree(ov); zfree(kv);
        addReplySds(c,sdsnew("+NOKEY\r\n"));
        return;
    }

try_again:
    write_error = 0;

    /* Connect */
    cs = migrateGetSocket(c,c->argv[1],c->argv[2],timeout);
    if (cs == NULL) {
        zfree(ov); zfree(kv);
        return; /* error sent to the client by migrateGetSocket() */
    }

    rioInitWithBuffer(&cmd,sdsempty());

    /* Send the SELECT command if the current DB is not already selected. */
    int select = cs->last_dbid != dbid; /* Should we emit SELECT? */
    if (select) {
        serverAssertWithInfo(c,NULL,rioWriteBulkCount(&cmd,'*',2));
        serverAssertWithInfo(c,NULL,rioWriteBulkString(&cmd,"SELECT",6));
        serverAssertWithInfo(c,NULL,rioWriteBulkLongLong(&cmd,dbid));
    }

    /* Create RESTORE payload and generate the protocol to call the command. */
    for (j = 0; j < num_keys; j++) {
        long long ttl = 0;
        long long expireat = getExpire(c->db,kv[j]);

        if (expireat != -1) {
            ttl = expireat-mstime();
            if (ttl < 1) ttl = 1;
        }
        serverAssertWithInfo(c,NULL,rioWriteBulkCount(&cmd,'*',replace ? 5 : 4));
        if (server.cluster_enabled)
            serverAssertWithInfo(c,NULL,
                rioWriteBulkString(&cmd,"RESTORE-ASKING",14));
        else
            serverAssertWithInfo(c,NULL,rioWriteBulkString(&cmd,"RESTORE",7));
        serverAssertWithInfo(c,NULL,sdsEncodedObject(kv[j]));
        serverAssertWithInfo(c,NULL,rioWriteBulkString(&cmd,kv[j]->ptr,
                sdslen(kv[j]->ptr)));
        serverAssertWithInfo(c,NULL,rioWriteBulkLongLong(&cmd,ttl));

        /* Emit the payload argument, that is the serialized object using
         * the DUMP format. */
        createDumpPayload(&payload,ov[j]);
        serverAssertWithInfo(c,NULL,
            rioWriteBulkString(&cmd,payload.io.buffer.ptr,
                               sdslen(payload.io.buffer.ptr)));
        sdsfree(payload.io.buffer.ptr);

        /* Add the REPLACE option to the RESTORE command if it was specified
         * as a MIGRATE option. */
        if (replace)
            serverAssertWithInfo(c,NULL,rioWriteBulkString(&cmd,"REPLACE",7));
    }

    /* Transfer the query to the other node in 64K chunks. */
    errno = 0;
    {
        sds buf = cmd.io.buffer.ptr;
        size_t pos = 0, towrite;
        int nwritten = 0;

        while ((towrite = sdslen(buf)-pos) > 0) {
            towrite = (towrite > (64*1024) ? (64*1024) : towrite);
            nwritten = syncWrite(cs->fd,buf+pos,towrite,timeout);
            if (nwritten != (signed)towrite) {
                write_error = 1;
                goto socket_err;
            }
            pos += nwritten;
        }
    }

    char buf1[1024]; /* Select reply. */
    char buf2[1024]; /* Restore reply. */

    /* Read the SELECT reply if needed. */
    if (select && syncReadLine(cs->fd, buf1, sizeof(buf1), timeout) <= 0)
        goto socket_err;

    /* Read the RESTORE replies. */
    int error_from_target = 0;
    int socket_error = 0;
    int del_idx = 1; /* Index of the key argument for the replicated DEL op. */

    if (!copy) newargv = zmalloc(sizeof(robj*)*(num_keys+1));

    for (j = 0; j < num_keys; j++) {
        if (syncReadLine(cs->fd, buf2, sizeof(buf2), timeout) <= 0) {
            socket_error = 1;
            break;
        }
        if ((select && buf1[0] == '-') || buf2[0] == '-') {
            /* On error assume that last_dbid is no longer valid. */
            if (!error_from_target) {
                cs->last_dbid = -1;
                addReplyErrorFormat(c,"Target instance replied with error: %s",
                    (select && buf1[0] == '-') ? buf1+1 : buf2+1);
                error_from_target = 1;
            }
        } else {
            if (!copy) {
                /* No COPY option: remove the local key, signal the change. */
                dbDelete(c->db,kv[j]);
                signalModifiedKey(c->db,kv[j]);
                server.dirty++;

                /* Populate the argument vector to replace the old one. */
                newargv[del_idx++] = kv[j];
                incrRefCount(kv[j]);
            }
        }
    }

    /* On socket error, if we want to retry, do it now before rewriting the
     * command vector. We only retry if we are sure nothing was processed
     * and we failed to read the first reply (j == 0 test). */
    if (!error_from_target && socket_error && j == 0 && may_retry &&
        errno != ETIMEDOUT)
    {
        goto socket_err; /* A retry is guaranteed because of tested conditions.*/
    }

    /* On socket errors, close the migration socket now that we still have
     * the original host/port in the ARGV. Later the original command may be
     * rewritten to DEL and will be too later. */
    if (socket_error) migrateCloseSocket(c->argv[1],c->argv[2]);

    if (!copy) {
        /* Translate MIGRATE as DEL for replication/AOF. Note that we do
         * this only for the keys for which we received an acknowledgement
         * from the receiving Redis server, by using the del_idx index. */
        if (del_idx > 1) {
            newargv[0] = createStringObject("DEL",3);
            /* Note that the following call takes ownership of newargv. */
            replaceClientCommandVector(c,del_idx,newargv);
            argv_rewritten = 1;
        } else {
            /* No key transfer acknowledged, no need to rewrite as DEL. */
            zfree(newargv);
        }
        newargv = NULL; /* Make it safe to call zfree() on it in the future. */
    }

    /* If we are here and a socket error happened, we don't want to retry.
     * Just signal the problem to the client, but only do it if we did not
     * already queue a different error reported by the destination server. */
    if (!error_from_target && socket_error) {
        may_retry = 0;
        goto socket_err;
    }

    if (!error_from_target) {
        /* Success! Update the last_dbid in migrateCachedSocket, so that we can
         * avoid SELECT the next time if the target DB is the same. Reply +OK.
         *
         * Note: If we reached this point, even if socket_error is true
         * still the SELECT command succeeded (otherwise the code jumps to
         * socket_err label. */
        cs->last_dbid = dbid;
        addReply(c,shared.ok);
    } else {
        /* On error we already sent it in the for loop above, and set
         * the curretly selected socket to -1 to force SELECT the next time. */
    }

    sdsfree(cmd.io.buffer.ptr);
    zfree(ov); zfree(kv); zfree(newargv);
    return;

/* On socket errors we try to close the cached socket and try again.
 * It is very common for the cached socket to get closed, if just reopening
 * it works it's a shame to notify the error to the caller. */
socket_err:
    /* Cleanup we want to perform in both the retry and no retry case.
     * Note: Closing the migrate socket will also force SELECT next time. */
    sdsfree(cmd.io.buffer.ptr);

    /* If the command was rewritten as DEL and there was a socket error,
     * we already closed the socket earlier. While migrateCloseSocket()
     * is idempotent, the host/port arguments are now gone, so don't do it
     * again. */
    if (!argv_rewritten) migrateCloseSocket(c->argv[1],c->argv[2]);
    zfree(newargv);
    newargv = NULL; /* This will get reallocated on retry. */

    /* Retry only if it's not a timeout and we never attempted a retry
     * (or the code jumping here did not set may_retry to zero). */
    if (errno != ETIMEDOUT && may_retry) {
        may_retry = 0;
        goto try_again;
    }

    /* Cleanup we want to do if no retry is attempted. */
    zfree(ov); zfree(kv);
    addReplySds(c,
        sdscatprintf(sdsempty(),
            "-IOERR error or timeout %s to target instance\r\n",
            write_error ? "writing" : "reading"));
    return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x9c0, %rsp            # imm = 0x9C0
movq %rdi, -0x8(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movl $0x1, -0x11c(%rbp)
movl $0x0, -0x120(%rbp)
movl $0x0, -0x124(%rbp)
movl $0x3, -0x128(%rbp)
movl $0x1, -0x12c(%rbp)
movl $0x0, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movl $0x6, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x38(%rcx), %eax
jge 0x861c4
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rdi
leaq 0xbcfd1(%rip), %rsi     # 0x1430aa
callq 0x26300
cmpl $0x0, %eax
jne 0x860ef
movl $0x1, -0x14(%rbp)
jmp 0x861b4
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rdi
leaq 0xbcee9(%rip), %rsi     # 0x142ff3
callq 0x26300
cmpl $0x0, %eax
jne 0x86120
movl $0x1, -0x18(%rbp)
jmp 0x861b2
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rdi
leaq 0xbcaef(%rip), %rsi     # 0x142c2a
callq 0x26300
cmpl $0x0, %eax
jne 0x86196
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x18(%rax), %rax
movq 0x8(%rax), %rdi
callq 0x7cf60
cmpq $0x0, %rax
je 0x86175
movq -0x8(%rbp), %rdi
leaq 0xbcf44(%rip), %rsi     # 0x1430af
callq 0x42f90
jmp 0x86d04
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x128(%rbp)
movq -0x8(%rbp), %rax
movl 0x38(%rax), %eax
subl -0x1c(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x12c(%rbp)
jmp 0x861c4
movq -0x8(%rbp), %rdi
leaq 0xf2a9f(%rip), %rax     # 0x178c40
movq 0x80(%rax), %rsi
callq 0x42cc0
jmp 0x86d04
jmp 0x861b4
jmp 0x861b6
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x860ae
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x28(%rax), %rsi
leaq -0x28(%rbp), %rdx
xorl %eax, %eax
movl %eax, %ecx
callq 0x49f20
cmpl $0x0, %eax
jne 0x86208
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x20(%rax), %rsi
leaq -0x30(%rbp), %rdx
xorl %eax, %eax
movl %eax, %ecx
callq 0x49f20
cmpl $0x0, %eax
je 0x8620d
jmp 0x86d04
cmpq $0x0, -0x28(%rbp)
jg 0x8621c
movq $0x3e8, -0x28(%rbp)     # imm = 0x3E8
movq -0x38(%rbp), %rdi
movslq -0x12c(%rbp), %rsi
shlq $0x3, %rsi
callq 0x3ae40
movq %rax, -0x38(%rbp)
movq -0x40(%rbp), %rdi
movslq -0x12c(%rbp), %rsi
shlq $0x3, %rsi
callq 0x3ae40
movq %rax, -0x40(%rbp)
movl $0x0, -0x130(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x12c(%rbp), %eax
jge 0x862ec
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movl -0x128(%rbp), %ecx
addl -0x1c(%rbp), %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rsi
callq 0x4a6c0
movq -0x38(%rbp), %rcx
movslq -0x130(%rbp), %rdx
movq %rax, (%rcx,%rdx,8)
cmpq $0x0, %rax
je 0x862dc
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movl -0x128(%rbp), %ecx
addl -0x1c(%rbp), %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdx
movq -0x40(%rbp), %rax
movslq -0x130(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x130(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x130(%rbp)
jmp 0x862de
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x8625d
movl -0x130(%rbp), %eax
movl %eax, -0x12c(%rbp)
cmpl $0x0, -0x12c(%rbp)
jne 0x8633e
movq -0x38(%rbp), %rdi
callq 0x3afa0
movq -0x40(%rbp), %rdi
callq 0x3afa0
movq -0x8(%rbp), %rax
movq %rax, -0x988(%rbp)
leaq 0xbcddb(%rip), %rdi     # 0x143100
callq 0x38510
movq -0x988(%rbp), %rdi
movq %rax, %rsi
callq 0x42e50
jmp 0x86d04
jmp 0x86340
movl $0x0, -0x120(%rbp)
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rsi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x10(%rax), %rdx
movq -0x28(%rbp), %rcx
callq 0x85bc0
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x86391
movq -0x38(%rbp), %rdi
callq 0x3afa0
movq -0x40(%rbp), %rdi
callq 0x3afa0
jmp 0x86d04
callq 0x384f0
movq %rax, %rsi
leaq -0xb0(%rbp), %rdi
callq 0x8e5d0
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
cmpq -0x30(%rbp), %rax
setne %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x134(%rbp)
cmpl $0x0, -0x134(%rbp)
je 0x864a5
leaq -0xb0(%rbp), %rdi
movl $0x2a, %esi
movl $0x2, %edx
callq 0x8e820
cmpq $0x0, %rax
je 0x863ea
jmp 0x86415
movq -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
leaq 0xbcd10(%rip), %rdx     # 0x143109
leaq 0xbb396(%rip), %rcx     # 0x141796
movl $0x1284, %r8d           # imm = 0x1284
callq 0x78360
movl $0x1, %edi
callq 0x263c0
leaq -0xb0(%rbp), %rdi
leaq 0xbcd04(%rip), %rsi     # 0x143127
movl $0x6, %edx
callq 0x8e9c0
cmpq $0x0, %rax
je 0x86435
jmp 0x86460
movq -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
leaq 0xbccea(%rip), %rdx     # 0x14312e
leaq 0xbb34b(%rip), %rcx     # 0x141796
movl $0x1285, %r8d           # imm = 0x1285
callq 0x78360
movl $0x1, %edi
callq 0x263c0
movq -0x30(%rbp), %rsi
leaq -0xb0(%rbp), %rdi
callq 0x8ea70
cmpq $0x0, %rax
je 0x86478
jmp 0x864a3
movq -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
leaq 0xbcccb(%rip), %rdx     # 0x143152
leaq 0xbb308(%rip), %rcx     # 0x141796
movl $0x1286, %r8d           # imm = 0x1286
callq 0x78360
movl $0x1, %edi
callq 0x263c0
jmp 0x864a5
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x12c(%rbp), %eax
jge 0x86833
movq $0x0, -0x140(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x40(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x4c430
movq %rax, -0x148(%rbp)
cmpq $-0x1, -0x148(%rbp)
je 0x8652e
movq -0x148(%rbp), %rax
movq %rax, -0x990(%rbp)
callq 0x2ff70
movq %rax, %rcx
movq -0x990(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x140(%rbp)
cmpq $0x1, -0x140(%rbp)
jge 0x8652c
movq $0x1, -0x140(%rbp)
jmp 0x8652e
movl -0x18(%rbp), %ecx
movl $0x4, %edx
movl $0x5, %eax
cmpl $0x0, %ecx
cmovnel %eax, %edx
leaq -0xb0(%rbp), %rdi
movl $0x2a, %esi
callq 0x8e820
cmpq $0x0, %rax
je 0x8655a
jmp 0x86585
movq -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
leaq 0xbcc09(%rip), %rdx     # 0x143172
leaq 0xbb226(%rip), %rcx     # 0x141796
movl $0x1292, %r8d           # imm = 0x1292
callq 0x78360
movl $0x1, %edi
callq 0x263c0
leaq 0xf1c4c(%rip), %rax     # 0x1781d8
cmpl $0x0, 0x99c(%rax)
je 0x865e2
leaq -0xb0(%rbp), %rdi
leaq 0xbcbfb(%rip), %rsi     # 0x14319e
movl $0xe, %edx
callq 0x8e9c0
cmpq $0x0, %rax
je 0x865b5
jmp 0x865e0
movq -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
leaq 0xbcbe9(%rip), %rdx     # 0x1431ad
leaq 0xbb1cb(%rip), %rcx     # 0x141796
movl $0x1295, %r8d           # imm = 0x1295
callq 0x78360
movl $0x1, %edi
callq 0x263c0
jmp 0x8662f
leaq -0xb0(%rbp), %rdi
leaq 0xbcbea(%rip), %rsi     # 0x1431da
movl $0x7, %edx
callq 0x8e9c0
cmpq $0x0, %rax
je 0x86602
jmp 0x8662d
movq -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
leaq 0xbcbd1(%rip), %rdx     # 0x1431e2
leaq 0xbb17e(%rip), %rcx     # 0x141796
movl $0x1297, %r8d           # imm = 0x1297
callq 0x78360
movl $0x1, %edi
callq 0x263c0
jmp 0x8662f
movq -0x40(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x0, %eax
je 0x86661
movq -0x40(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x8, %eax
jne 0x86663
jmp 0x8668e
movq -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
leaq 0xbcb95(%rip), %rdx     # 0x143207
leaq 0xbb11d(%rip), %rcx     # 0x141796
movl $0x1298, %r8d           # imm = 0x1298
callq 0x78360
movl $0x1, %edi
callq 0x263c0
movq -0x40(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rax
movq %rax, -0x998(%rbp)
movq -0x40(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rdi
callq 0x7cf60
movq -0x998(%rbp), %rsi
movq %rax, %rdx
leaq -0xb0(%rbp), %rdi
callq 0x8e9c0
cmpq $0x0, %rax
je 0x866d8
jmp 0x86703
movq -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
leaq 0xbcb38(%rip), %rdx     # 0x14321f
leaq 0xbb0a8(%rip), %rcx     # 0x141796
movl $0x129a, %r8d           # imm = 0x129A
callq 0x78360
movl $0x1, %edi
callq 0x263c0
movq -0x140(%rbp), %rsi
leaq -0xb0(%rbp), %rdi
callq 0x8ea70
cmpq $0x0, %rax
je 0x8671e
jmp 0x86749
movq -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
leaq 0xbcb2a(%rip), %rdx     # 0x143257
leaq 0xbb062(%rip), %rcx     # 0x141796
movl $0x129b, %r8d           # imm = 0x129B
callq 0x78360
movl $0x1, %edi
callq 0x263c0
movq -0x38(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
leaq -0x118(%rbp), %rdi
callq 0x856c0
movq -0xd8(%rbp), %rax
movq %rax, -0x9a0(%rbp)
movq -0xd8(%rbp), %rdi
callq 0x7cf60
movq -0x9a0(%rbp), %rsi
movq %rax, %rdx
leaq -0xb0(%rbp), %rdi
callq 0x8e9c0
cmpq $0x0, %rax
je 0x86799
jmp 0x867c4
movq -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
leaq 0xbcace(%rip), %rdx     # 0x143276
leaq 0xbafe7(%rip), %rcx     # 0x141796
movl $0x12a2, %r8d           # imm = 0x12A2
callq 0x78360
movl $0x1, %edi
callq 0x263c0
movq -0xd8(%rbp), %rdi
callq 0x38620
cmpl $0x0, -0x18(%rbp)
je 0x86823
leaq -0xb0(%rbp), %rdi
leaq 0xbcae0(%rip), %rsi     # 0x1432c4
movl $0x7, %edx
callq 0x8e9c0
cmpq $0x0, %rax
je 0x867f6
jmp 0x86821
movq -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
leaq 0xbcac7(%rip), %rdx     # 0x1432cc
leaq 0xbaf8a(%rip), %rcx     # 0x141796
movl $0x12a8, %r8d           # imm = 0x12A8
callq 0x78360
movl $0x1, %edi
callq 0x263c0
jmp 0x86823
jmp 0x86825
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x864ac
callq 0x26880
movl $0x0, (%rax)
movq -0x70(%rbp), %rax
movq %rax, -0x150(%rbp)
movq $0x0, -0x158(%rbp)
movl $0x0, -0x164(%rbp)
movq -0x150(%rbp), %rdi
callq 0x7cf60
subq -0x158(%rbp), %rax
movq %rax, -0x160(%rbp)
cmpq $0x0, %rax
jbe 0x8691d
cmpq $0x10000, -0x160(%rbp) # imm = 0x10000
jbe 0x8689d
movl $0x10000, %eax          # imm = 0x10000
movq %rax, -0x9a8(%rbp)
jmp 0x868ab
movq -0x160(%rbp), %rax
movq %rax, -0x9a8(%rbp)
movq -0x9a8(%rbp), %rax
movq %rax, -0x160(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %edi
movq -0x150(%rbp), %rsi
addq -0x158(%rbp), %rsi
movq -0x160(%rbp), %rdx
movq -0x28(%rbp), %rcx
callq 0x7bae0
movl %eax, -0x164(%rbp)
movl -0x164(%rbp), %eax
movq -0x160(%rbp), %rcx
cmpl %ecx, %eax
je 0x86903
movl $0x1, -0x120(%rbp)
jmp 0x86c45
movslq -0x164(%rbp), %rax
addq -0x158(%rbp), %rax
movq %rax, -0x158(%rbp)
jmp 0x8685e
cmpl $0x0, -0x134(%rbp)
je 0x8694c
movq -0x10(%rbp), %rax
movl (%rax), %edi
leaq -0x570(%rbp), %rsi
movq -0x28(%rbp), %rcx
movl $0x400, %edx            # imm = 0x400
callq 0x7bd40
cmpq $0x0, %rax
jg 0x8694c
jmp 0x86c45
movl $0x0, -0x974(%rbp)
movl $0x0, -0x978(%rbp)
movl $0x1, -0x97c(%rbp)
cmpl $0x0, -0x14(%rbp)
jne 0x86989
movl -0x12c(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdi
shlq $0x3, %rdi
callq 0x3acd0
movq %rax, -0x48(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x12c(%rbp), %eax
jge 0x86b21
movq -0x10(%rbp), %rax
movl (%rax), %edi
leaq -0x970(%rbp), %rsi
movq -0x28(%rbp), %rcx
movl $0x400, %edx            # imm = 0x400
callq 0x7bd40
cmpq $0x0, %rax
jg 0x869cf
movl $0x1, -0x978(%rbp)
jmp 0x86b21
cmpl $0x0, -0x134(%rbp)
je 0x869e4
movsbl -0x570(%rbp), %eax
cmpl $0x2d, %eax
je 0x869f4
movsbl -0x970(%rbp), %eax
cmpl $0x2d, %eax
jne 0x86a7a
cmpl $0x0, -0x974(%rbp)
jne 0x86a75
movq -0x10(%rbp), %rax
movq $-0x1, 0x8(%rax)
movq -0x8(%rbp), %rax
movq %rax, -0x9b0(%rbp)
cmpl $0x0, -0x134(%rbp)
je 0x86a3d
movsbl -0x570(%rbp), %eax
cmpl $0x2d, %eax
jne 0x86a3d
leaq -0x570(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x9b8(%rbp)
jmp 0x86a4f
leaq -0x970(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x9b8(%rbp)
movq -0x9b0(%rbp), %rdi
movq -0x9b8(%rbp), %rdx
leaq 0xbc88d(%rip), %rsi     # 0x1432f1
movb $0x0, %al
callq 0x42fd0
movl $0x1, -0x974(%rbp)
jmp 0x86b11
cmpl $0x0, -0x14(%rbp)
jne 0x86b0f
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x40(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x4ac10
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x40(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x4aa60
leaq 0xf171b(%rip), %rax     # 0x1781d8
movq 0x720(%rax), %rcx
addq $0x1, %rcx
leaq 0xf1709(%rip), %rax     # 0x1781d8
movq %rcx, 0x720(%rax)
movq -0x40(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
movq -0x48(%rbp), %rax
movl -0x97c(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x97c(%rbp)
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x40(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x487b0
jmp 0x86b11
jmp 0x86b13
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x86990
cmpl $0x0, -0x974(%rbp)
jne 0x86b51
cmpl $0x0, -0x978(%rbp)
je 0x86b51
cmpl $0x0, -0x1c(%rbp)
jne 0x86b51
cmpl $0x0, -0x11c(%rbp)
je 0x86b51
callq 0x26880
cmpl $0x6e, (%rax)
je 0x86b51
jmp 0x86c45
cmpl $0x0, -0x978(%rbp)
je 0x86b77
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x10(%rax), %rsi
callq 0x85e90
cmpl $0x0, -0x14(%rbp)
jne 0x86bd1
cmpl $0x1, -0x97c(%rbp)
jle 0x86bc0
leaq 0xb1477(%rip), %rdi     # 0x138004
movl $0x3, %esi
callq 0x486a0
movq %rax, %rcx
movq -0x48(%rbp), %rax
movq %rcx, (%rax)
movq -0x8(%rbp), %rdi
movl -0x97c(%rbp), %esi
movq -0x48(%rbp), %rdx
callq 0x46a30
movl $0x1, -0x124(%rbp)
jmp 0x86bc9
movq -0x48(%rbp), %rdi
callq 0x3afa0
movq $0x0, -0x48(%rbp)
cmpl $0x0, -0x974(%rbp)
jne 0x86bef
cmpl $0x0, -0x978(%rbp)
je 0x86bef
movl $0x0, -0x11c(%rbp)
jmp 0x86c45
cmpl $0x0, -0x974(%rbp)
jne 0x86c1a
movq -0x30(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rdi
leaq 0xf2031(%rip), %rax     # 0x178c40
movq 0x8(%rax), %rsi
callq 0x42cc0
jmp 0x86c1c
jmp 0x86c1c
movq -0x70(%rbp), %rdi
callq 0x38620
movq -0x38(%rbp), %rdi
callq 0x3afa0
movq -0x40(%rbp), %rdi
callq 0x3afa0
movq -0x48(%rbp), %rdi
callq 0x3afa0
jmp 0x86d04
movq -0x70(%rbp), %rdi
callq 0x38620
cmpl $0x0, -0x124(%rbp)
jne 0x86c74
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x10(%rax), %rsi
callq 0x85e90
movq -0x48(%rbp), %rdi
callq 0x3afa0
movq $0x0, -0x48(%rbp)
callq 0x26880
cmpl $0x6e, (%rax)
je 0x86ca7
cmpl $0x0, -0x11c(%rbp)
je 0x86ca7
movl $0x0, -0x11c(%rbp)
jmp 0x86340
movq -0x38(%rbp), %rdi
callq 0x3afa0
movq -0x40(%rbp), %rdi
callq 0x3afa0
movq -0x8(%rbp), %rax
movq %rax, -0x9c0(%rbp)
callq 0x384f0
movq %rax, %rdi
movl -0x120(%rbp), %ecx
leaq 0xbc677(%rip), %rdx     # 0x143350
leaq 0xbc668(%rip), %rax     # 0x143348
cmpl $0x0, %ecx
cmovneq %rax, %rdx
leaq 0xbc62a(%rip), %rsi     # 0x143318
movb $0x0, %al
callq 0x395b0
movq -0x9c0(%rbp), %rdi
movq %rax, %rsi
callq 0x42e50
addq $0x9c0, %rsp            # imm = 0x9C0
popq %rbp
retq
nopl (%rax)