// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/src/sentinel.c
// Function: sentinelCommand
void sentinelCommand(client *c) {
    if (!strcasecmp(c->argv[1]->ptr,"masters")) {
        /* SENTINEL MASTERS */
        if (c->argc != 2) goto numargserr;
        addReplyDictOfRedisInstances(c,sentinel.masters);
    } else if (!strcasecmp(c->argv[1]->ptr,"master")) {
        /* SENTINEL MASTER <name> */
        sentinelRedisInstance *ri;

        if (c->argc != 3) goto numargserr;
        if ((ri = sentinelGetMasterByNameOrReplyError(c,c->argv[2]))
            == NULL) return;
        addReplySentinelRedisInstance(c,ri);
    } else if (!strcasecmp(c->argv[1]->ptr,"slaves")) {
        /* SENTINEL SLAVES <master-name> */
        sentinelRedisInstance *ri;

        if (c->argc != 3) goto numargserr;
        if ((ri = sentinelGetMasterByNameOrReplyError(c,c->argv[2])) == NULL)
            return;
        addReplyDictOfRedisInstances(c,ri->slaves);
    } else if (!strcasecmp(c->argv[1]->ptr,"sentinels")) {
        /* SENTINEL SENTINELS <master-name> */
        sentinelRedisInstance *ri;

        if (c->argc != 3) goto numargserr;
        if ((ri = sentinelGetMasterByNameOrReplyError(c,c->argv[2])) == NULL)
            return;
        addReplyDictOfRedisInstances(c,ri->sentinels);
    } else if (!strcasecmp(c->argv[1]->ptr,"is-master-down-by-addr")) {
        /* SENTINEL IS-MASTER-DOWN-BY-ADDR <ip> <port> <current-epoch> <runid>
         *
         * Arguments:
         *
         * ip and port are the ip and port of the master we want to be
         * checked by Sentinel. Note that the command will not check by
         * name but just by master, in theory different Sentinels may monitor
         * differnet masters with the same name.
         *
         * current-epoch is needed in order to understand if we are allowed
         * to vote for a failover leader or not. Each Sentinel can vote just
         * one time per epoch.
         *
         * runid is "*" if we are not seeking for a vote from the Sentinel
         * in order to elect the failover leader. Otherwise it is set to the
         * runid we want the Sentinel to vote if it did not already voted.
         */
        sentinelRedisInstance *ri;
        long long req_epoch;
        uint64_t leader_epoch = 0;
        char *leader = NULL;
        long port;
        int isdown = 0;

        if (c->argc != 6) goto numargserr;
        if (getLongFromObjectOrReply(c,c->argv[3],&port,NULL) != C_OK ||
            getLongLongFromObjectOrReply(c,c->argv[4],&req_epoch,NULL)
                                                              != C_OK)
            return;
        ri = getSentinelRedisInstanceByAddrAndRunID(sentinel.masters,
            c->argv[2]->ptr,port,NULL);

        /* It exists? Is actually a master? Is subjectively down? It's down.
         * Note: if we are in tilt mode we always reply with "0". */
        if (!sentinel.tilt && ri && (ri->flags & SRI_S_DOWN) &&
                                    (ri->flags & SRI_MASTER))
            isdown = 1;

        /* Vote for the master (or fetch the previous vote) if the request
         * includes a runid, otherwise the sender is not seeking for a vote. */
        if (ri && ri->flags & SRI_MASTER && strcasecmp(c->argv[5]->ptr,"*")) {
            leader = sentinelVoteLeader(ri,(uint64_t)req_epoch,
                                            c->argv[5]->ptr,
                                            &leader_epoch);
        }

        /* Reply with a three-elements multi-bulk reply:
         * down state, leader, vote epoch. */
        addReplyMultiBulkLen(c,3);
        addReply(c, isdown ? shared.cone : shared.czero);
        addReplyBulkCString(c, leader ? leader : "*");
        addReplyLongLong(c, (long long)leader_epoch);
        if (leader) sdsfree(leader);
    } else if (!strcasecmp(c->argv[1]->ptr,"reset")) {
        /* SENTINEL RESET <pattern> */
        if (c->argc != 3) goto numargserr;
        addReplyLongLong(c,sentinelResetMastersByPattern(c->argv[2]->ptr,SENTINEL_GENERATE_EVENT));
    } else if (!strcasecmp(c->argv[1]->ptr,"get-master-addr-by-name")) {
        /* SENTINEL GET-MASTER-ADDR-BY-NAME <master-name> */
        sentinelRedisInstance *ri;

        if (c->argc != 3) goto numargserr;
        ri = sentinelGetMasterByName(c->argv[2]->ptr);
        if (ri == NULL) {
            addReply(c,shared.nullmultibulk);
        } else {
            sentinelAddr *addr = sentinelGetCurrentMasterAddress(ri);

            addReplyMultiBulkLen(c,2);
            addReplyBulkCString(c,addr->ip);
            addReplyBulkLongLong(c,addr->port);
        }
    } else if (!strcasecmp(c->argv[1]->ptr,"failover")) {
        /* SENTINEL FAILOVER <master-name> */
        sentinelRedisInstance *ri;

        if (c->argc != 3) goto numargserr;
        if ((ri = sentinelGetMasterByNameOrReplyError(c,c->argv[2])) == NULL)
            return;
        if (ri->flags & SRI_FAILOVER_IN_PROGRESS) {
            addReplySds(c,sdsnew("-INPROG Failover already in progress\r\n"));
            return;
        }
        if (sentinelSelectSlave(ri) == NULL) {
            addReplySds(c,sdsnew("-NOGOODSLAVE No suitable slave to promote\r\n"));
            return;
        }
        serverLog(LL_WARNING,"Executing user requested FAILOVER of '%s'",
            ri->name);
        sentinelStartFailover(ri);
        ri->flags |= SRI_FORCE_FAILOVER;
        addReply(c,shared.ok);
    } else if (!strcasecmp(c->argv[1]->ptr,"pending-scripts")) {
        /* SENTINEL PENDING-SCRIPTS */

        if (c->argc != 2) goto numargserr;
        sentinelPendingScriptsCommand(c);
    } else if (!strcasecmp(c->argv[1]->ptr,"monitor")) {
        /* SENTINEL MONITOR <name> <ip> <port> <quorum> */
        sentinelRedisInstance *ri;
        long quorum, port;
        char ip[NET_IP_STR_LEN];

        if (c->argc != 6) goto numargserr;
        if (getLongFromObjectOrReply(c,c->argv[5],&quorum,"Invalid quorum")
            != C_OK) return;
        if (getLongFromObjectOrReply(c,c->argv[4],&port,"Invalid port")
            != C_OK) return;

        if (quorum <= 0) {
            addReplyError(c, "Quorum must be 1 or greater.");
            return;
        }

        /* Make sure the IP field is actually a valid IP before passing it
         * to createSentinelRedisInstance(), otherwise we may trigger a
         * DNS lookup at runtime. */
        if (anetResolveIP(NULL,c->argv[3]->ptr,ip,sizeof(ip)) == ANET_ERR) {
            addReplyError(c,"Invalid IP address specified");
            return;
        }

        /* Parameters are valid. Try to create the master instance. */
        ri = createSentinelRedisInstance(c->argv[2]->ptr,SRI_MASTER,
                c->argv[3]->ptr,port,quorum,NULL);
        if (ri == NULL) {
            switch(errno) {
            case EBUSY:
                addReplyError(c,"Duplicated master name");
                break;
            case EINVAL:
                addReplyError(c,"Invalid port number");
                break;
            default:
                addReplyError(c,"Unspecified error adding the instance");
                break;
            }
        } else {
            sentinelFlushConfig();
            sentinelEvent(LL_WARNING,"+monitor",ri,"%@ quorum %d",ri->quorum);
            addReply(c,shared.ok);
        }
    } else if (!strcasecmp(c->argv[1]->ptr,"flushconfig")) {
        if (c->argc != 2) goto numargserr;
        sentinelFlushConfig();
        addReply(c,shared.ok);
        return;
    } else if (!strcasecmp(c->argv[1]->ptr,"remove")) {
        /* SENTINEL REMOVE <name> */
        sentinelRedisInstance *ri;

        if (c->argc != 3) goto numargserr;
        if ((ri = sentinelGetMasterByNameOrReplyError(c,c->argv[2]))
            == NULL) return;
        sentinelEvent(LL_WARNING,"-monitor",ri,"%@");
        dictDelete(sentinel.masters,c->argv[2]->ptr);
        sentinelFlushConfig();
        addReply(c,shared.ok);
    } else if (!strcasecmp(c->argv[1]->ptr,"ckquorum")) {
        /* SENTINEL CKQUORUM <name> */
        sentinelRedisInstance *ri;
        int usable;

        if (c->argc != 3) goto numargserr;
        if ((ri = sentinelGetMasterByNameOrReplyError(c,c->argv[2]))
            == NULL) return;
        int result = sentinelIsQuorumReachable(ri,&usable);
        if (result == SENTINEL_ISQR_OK) {
            addReplySds(c, sdscatfmt(sdsempty(),
                "+OK %i usable Sentinels. Quorum and failover authorization "
                "can be reached\r\n",usable));
        } else {
            sds e = sdscatfmt(sdsempty(),
                "-NOQUORUM %i usable Sentinels. ",usable);
            if (result & SENTINEL_ISQR_NOQUORUM)
                e = sdscat(e,"Not enough available Sentinels to reach the"
                             " specified quorum for this master");
            if (result & SENTINEL_ISQR_NOAUTH) {
                if (result & SENTINEL_ISQR_NOQUORUM) e = sdscat(e,". ");
                e = sdscat(e, "Not enough available Sentinels to reach the"
                              " majority and authorize a failover");
            }
            e = sdscat(e,"\r\n");
            addReplySds(c,e);
        }
    } else if (!strcasecmp(c->argv[1]->ptr,"set")) {
        if (c->argc < 3 || c->argc % 2 == 0) goto numargserr;
        sentinelSetCommand(c);
    } else if (!strcasecmp(c->argv[1]->ptr,"info-cache")) {
        /* SENTINEL INFO-CACHE <name> */
        if (c->argc < 2) goto numargserr;
        mstime_t now = mstime();

        /* Create an ad-hoc dictionary type so that we can iterate
         * a dictionary composed of just the master groups the user
         * requested. */
        dictType copy_keeper = instancesDictType;
        copy_keeper.valDestructor = NULL;
        dict *masters_local = sentinel.masters;
        if (c->argc > 2) {
            masters_local = dictCreate(&copy_keeper, NULL);

            for (int i = 2; i < c->argc; i++) {
                sentinelRedisInstance *ri;
                ri = sentinelGetMasterByName(c->argv[i]->ptr);
                if (!ri) continue; /* ignore non-existing names */
                dictAdd(masters_local, ri->name, ri);
            }
        }

        /* Reply format:
         *   1.) master name
         *   2.) 1.) info from master
         *       2.) info from replica
         *       ...
         *   3.) other master name
         *   ...
         */
        addReplyMultiBulkLen(c,dictSize(masters_local) * 2);

        dictIterator  *di;
        dictEntry *de;
        di = dictGetIterator(masters_local);
        while ((de = dictNext(di)) != NULL) {
            sentinelRedisInstance *ri = dictGetVal(de);
            addReplyBulkCBuffer(c,ri->name,strlen(ri->name));
            addReplyMultiBulkLen(c,dictSize(ri->slaves) + 1); /* +1 for self */
            addReplyMultiBulkLen(c,2);
            addReplyLongLong(c, now - ri->info_refresh);
            if (ri->info)
                addReplyBulkCBuffer(c,ri->info,sdslen(ri->info));
            else
                addReply(c,shared.nullbulk);

            dictIterator *sdi;
            dictEntry *sde;
            sdi = dictGetIterator(ri->slaves);
            while ((sde = dictNext(sdi)) != NULL) {
                sentinelRedisInstance *sri = dictGetVal(sde);
                addReplyMultiBulkLen(c,2);
                addReplyLongLong(c, now - sri->info_refresh);
                if (sri->info)
                    addReplyBulkCBuffer(c,sri->info,sdslen(sri->info));
                else
                    addReply(c,shared.nullbulk);
            }
            dictReleaseIterator(sdi);
        }
        dictReleaseIterator(di);
        if (masters_local != sentinel.masters) dictRelease(masters_local);
    } else if (!strcasecmp(c->argv[1]->ptr,"simulate-failure")) {
        /* SENTINEL SIMULATE-FAILURE <flag> <flag> ... <flag> */
        int j;

        sentinel.simfailure_flags = SENTINEL_SIMFAILURE_NONE;
        for (j = 2; j < c->argc; j++) {
            if (!strcasecmp(c->argv[j]->ptr,"crash-after-election")) {
                sentinel.simfailure_flags |=
                    SENTINEL_SIMFAILURE_CRASH_AFTER_ELECTION;
                serverLog(LL_WARNING,"Failure simulation: this Sentinel "
                    "will crash after being successfully elected as failover "
                    "leader");
            } else if (!strcasecmp(c->argv[j]->ptr,"crash-after-promotion")) {
                sentinel.simfailure_flags |=
                    SENTINEL_SIMFAILURE_CRASH_AFTER_PROMOTION;
                serverLog(LL_WARNING,"Failure simulation: this Sentinel "
                    "will crash after promoting the selected slave to master");
            } else if (!strcasecmp(c->argv[j]->ptr,"help")) {
                addReplyMultiBulkLen(c,2);
                addReplyBulkCString(c,"crash-after-election");
                addReplyBulkCString(c,"crash-after-promotion");
            } else {
                addReplyError(c,"Unknown failure simulation specified");
                return;
            }
        }
        addReply(c,shared.ok);
    } else {
        addReplyErrorFormat(c,"Unknown sentinel subcommand '%s'",
                               (char*)c->argv[1]->ptr);
    }
    return;

numargserr:
    addReplyErrorFormat(c,"Wrong number of arguments for 'sentinel %s'",
                          (char*)c->argv[1]->ptr);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdi, %rbx
movq 0x40(%rdi), %r15
movq 0x8(%r15), %rax
movq 0x8(%rax), %r14
leaq 0x56c9a(%rip), %rsi     # 0xcfd7d
movq %r14, %rdi
callq 0x26300
testl %eax, %eax
je 0x7926e
leaq 0x52b21(%rip), %rsi     # 0xcbc1b
movq %r14, %rdi
callq 0x26300
testl %eax, %eax
je 0x79295
leaq 0x568f0(%rip), %rsi     # 0xcfa01
movq %r14, %rdi
callq 0x26300
testl %eax, %eax
je 0x792bb
leaq 0x56ba7(%rip), %rsi     # 0xcfccf
movq %r14, %rdi
callq 0x26300
testl %eax, %eax
je 0x792dd
leaq 0x56c46(%rip), %rsi     # 0xcfd85
movq %r14, %rdi
callq 0x26300
testl %eax, %eax
je 0x79336
leaq 0x52cde(%rip), %rsi     # 0xcbe34
movq %r14, %rdi
callq 0x26300
testl %eax, %eax
je 0x7940e
leaq 0x56c2f(%rip), %rsi     # 0xcfd9c
movq %r14, %rdi
callq 0x26300
testl %eax, %eax
je 0x79443
leaq 0x56e49(%rip), %rsi     # 0xcffcd
movq %r14, %rdi
callq 0x26300
testl %eax, %eax
je 0x794af
leaq 0x56c96(%rip), %rsi     # 0xcfe31
movq %r14, %rdi
callq 0x26300
testl %eax, %eax
je 0x79516
leaq 0x5604a(%rip), %rsi     # 0xcf1fc
movq %r14, %rdi
callq 0x26300
testl %eax, %eax
je 0x79536
leaq 0x56ce1(%rip), %rsi     # 0xcfeaa
movq %r14, %rdi
callq 0x26300
testl %eax, %eax
je 0x7963b
leaq 0x56cd6(%rip), %rsi     # 0xcfeb6
movq %r14, %rdi
callq 0x26300
testl %eax, %eax
je 0x796e0
leaq 0x56ccf(%rip), %rsi     # 0xcfec6
movq %r14, %rdi
callq 0x26300
testl %eax, %eax
je 0x79753
leaq 0x47645(%rip), %rsi     # 0xc0853
movq %r14, %rdi
callq 0x26300
testl %eax, %eax
je 0x797fb
leaq 0x56db1(%rip), %rsi     # 0xcffd6
movq %r14, %rdi
callq 0x26300
testl %eax, %eax
je 0x79843
leaq 0x57181(%rip), %rsi     # 0xd03bd
movq %r14, %rdi
callq 0x26300
testl %eax, %eax
je 0x798e1
leaq 0x56e99(%rip), %rsi     # 0xd00ec
movq %rbx, %rdi
movq %r14, %rdx
xorl %eax, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3fff2
cmpl $0x2, 0x38(%rbx)
jne 0x7930a
movq 0xa2431(%rip), %rsi     # 0x11b6b0
movq %rbx, %rdi
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x7e5d4
movl 0x38(%rbx), %ebp
cmpl $0x3, %ebp
jne 0x7930a
movq 0x10(%r15), %rsi
movq %rbx, %rdi
callq 0x7e622
testq %rax, %rax
je 0x79305
movq %rbx, %rdi
movq %rax, %rsi
callq 0x7def1
jmp 0x79305
movl 0x38(%rbx), %ebp
cmpl $0x3, %ebp
jne 0x7930a
movq 0x10(%r15), %rsi
movq %rbx, %rdi
callq 0x7e622
testq %rax, %rax
je 0x79305
movq 0x88(%rax), %rsi
jmp 0x792fd
movl 0x38(%rbx), %ebp
cmpl $0x3, %ebp
jne 0x7930a
movq 0x10(%r15), %rsi
movq %rbx, %rdi
callq 0x7e622
testq %rax, %rax
je 0x79305
movq 0x80(%rax), %rsi
movq %rbx, %rdi
callq 0x7e5d4
cmpl $0x3, %ebp
je 0x79327
movq 0x40(%rbx), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdx
leaq 0x56df0(%rip), %rsi     # 0xd010d
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3fff2
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq $0x0, (%rsp)
movl 0x38(%rbx), %ebp
cmpl $0x6, %ebp
jne 0x7930a
movq 0x18(%r15), %rsi
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x44ba1
testl %eax, %eax
jne 0x796c6
movq 0x40(%rbx), %rax
movq 0x20(%rax), %rsi
leaq 0x20(%rsp), %rdx
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x44b44
testl %eax, %eax
jne 0x796c6
movq 0xa2329(%rip), %rdi     # 0x11b6b0
movq 0x40(%rbx), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rsi
movl 0x8(%rsp), %edx
xorl %ecx, %ecx
callq 0x7b208
movq %rax, %r14
cmpl $0x0, 0xa2310(%rip)     # 0x11b6b8
movb $0x1, %r12b
jne 0x793bd
testq %r14, %r14
je 0x793bd
movl (%r14), %eax
notl %eax
testb $0x9, %al
setne %r12b
testq %r14, %r14
je 0x7966b
testb $0x1, (%r14)
je 0x7966b
movq 0x40(%rbx), %rax
movq 0x28(%rax), %rax
movq 0x8(%rax), %r15
leaq 0x467a6(%rip), %rsi     # 0xbfb89
movq %r15, %rdi
callq 0x26300
testl %eax, %eax
je 0x7966b
movq 0x20(%rsp), %rsi
movq %rsp, %rcx
movq %r14, %rdi
movq %r15, %rdx
callq 0x7e6e8
movq %rax, %r14
jmp 0x7966e
cmpl $0x3, 0x38(%rbx)
jne 0x7930a
movq 0x10(%r15), %rax
movq 0x8(%rax), %rdi
movl $0x10000, %esi          # imm = 0x10000
callq 0x7ba03
movslq %eax, %rsi
movq %rbx, %rdi
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x40606
movl 0x38(%rbx), %ebp
cmpl $0x3, %ebp
jne 0x7930a
movq 0x10(%r15), %rax
movq 0x8(%rax), %rdi
callq 0x7b804
testq %rax, %rax
je 0x7962b
testb $0x40, (%rax)
je 0x7947f
movq 0x118(%rax), %rcx
testq %rcx, %rcx
je 0x7947f
cmpl $0x4, 0xf0(%rax)
jg 0x79482
movq %rax, %rcx
movq 0x20(%rcx), %r14
movl $0x2, %esi
movq %rbx, %rdi
callq 0x4063b
movq (%r14), %rsi
movq %rbx, %rdi
callq 0x404b9
movslq 0x8(%r14), %rsi
movq %rbx, %rdi
callq 0x407de
jmp 0x79305
movl 0x38(%rbx), %ebp
cmpl $0x3, %ebp
jne 0x7930a
movq 0x10(%r15), %rsi
movq %rbx, %rdi
callq 0x7e622
testq %rax, %rax
je 0x79305
movq %rax, %r14
testb $0x40, (%rax)
jne 0x796d4
movq %r14, %rdi
callq 0x7e82d
testq %rax, %rax
je 0x79827
movq 0x8(%r14), %rdx
leaq 0x5690f(%rip), %rsi     # 0xcfe07
movl $0x3, %edi
xorl %eax, %eax
callq 0x32ea6
movq %r14, %rdi
callq 0x7e967
orb $0x8, 0x1(%r14)
jmp 0x7973b
cmpl $0x2, 0x38(%rbx)
jne 0x7930a
movq %rbx, %rdi
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x7ad9f
movl 0x38(%rbx), %ebp
cmpl $0x6, %ebp
jne 0x7930a
movq 0x28(%r15), %rsi
leaq 0x568f4(%rip), %rcx     # 0xcfe41
movq %rsp, %rdx
movq %rbx, %rdi
callq 0x44ba1
testl %eax, %eax
jne 0x796c6
movq 0x40(%rbx), %rax
movq 0x20(%rax), %rsi
leaq 0x4d89a(%rip), %rcx     # 0xc6e09
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
callq 0x44ba1
testl %eax, %eax
jne 0x796c6
cmpq $0x0, (%rsp)
jle 0x799e2
movq 0x40(%rbx), %rax
movq 0x18(%rax), %rax
movq 0x8(%rax), %rsi
leaq 0x20(%rsp), %rdx
movl $0x2e, %ecx
xorl %edi, %edi
callq 0x30b23
cmpl $-0x1, %eax
je 0x79baa
movq 0x40(%rbx), %rax
movq 0x10(%rax), %rcx
movq 0x18(%rax), %rax
movq 0x8(%rcx), %rdi
movq 0x8(%rax), %rdx
movl 0x8(%rsp), %ecx
movl (%rsp), %r8d
movl $0x1, %esi
xorl %r9d, %r9d
callq 0x7b48e
testq %rax, %rax
je 0x79bbe
movq %rax, %r14
callq 0x7a33b
movl 0x90(%r14), %r8d
leaq 0x55bfe(%rip), %rsi     # 0xcf1fb
leaq 0x55c00(%rip), %rcx     # 0xcf204
movl $0x3, %edi
movq %r14, %rdx
xorl %eax, %eax
callq 0x7a50c
leaq 0x8dc96(%rip), %rax     # 0x1072b0
movq 0x8(%rax), %rsi
movq %rbx, %rdi
callq 0x3fc19
jmp 0x796c6
leaq 0x8dc7e(%rip), %rax     # 0x1072b0
movq 0x58(%rax), %rsi
jmp 0x79746
cmpl $0x2, 0x38(%rbx)
jne 0x7930a
callq 0x7a33b
leaq 0x8dc5f(%rip), %rax     # 0x1072b0
movq 0x8(%rax), %rsi
movq %rbx, %rdi
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3fc19
xorl %r14d, %r14d
movl $0x3, %esi
movq %rbx, %rdi
callq 0x4063b
leaq 0x8dc2e(%rip), %rax     # 0x1072b0
xorb $0x1, %r12b
movzbl %r12b, %ecx
movq 0x20(%rax,%rcx,8), %rsi
movq %rbx, %rdi
callq 0x3fc19
testq %r14, %r14
leaq 0x464e8(%rip), %rsi     # 0xbfb89
cmovneq %r14, %rsi
movq %rbx, %rdi
callq 0x404b9
movq (%rsp), %rsi
movq %rbx, %rdi
callq 0x40606
testq %r14, %r14
je 0x796c6
movq %r14, %rdi
callq 0x392b6
cmpl $0x6, %ebp
jne 0x7930a
jmp 0x79327
leaq 0x566d9(%rip), %rdi     # 0xcfdb4
jmp 0x7982e
movl 0x38(%rbx), %ebp
cmpl $0x3, %ebp
jne 0x7930a
movq 0x10(%r15), %rsi
movq %rbx, %rdi
callq 0x7e622
testq %rax, %rax
je 0x79305
leaq 0x567b5(%rip), %rsi     # 0xcfebd
leaq 0x55cf1(%rip), %rcx     # 0xcf400
movl $0x3, %edi
movq %rax, %rdx
xorl %eax, %eax
callq 0x7a50c
movq 0xa1f8b(%rip), %rdi     # 0x11b6b0
movq 0x40(%rbx), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rsi
callq 0x31dba
callq 0x7a33b
leaq 0x8db6e(%rip), %rax     # 0x1072b0
movq 0x8(%rax), %rsi
movq %rbx, %rdi
callq 0x3fc19
jmp 0x79305
movl 0x38(%rbx), %r12d
cmpl $0x3, %r12d
jne 0x7930a
movq 0x10(%r15), %rsi
movq %rbx, %rdi
callq 0x7e622
testq %rax, %rax
je 0x799d3
leaq 0x20(%rsp), %r14
movq %rax, %rdi
movq %r14, %rsi
callq 0x7e64e
movl %eax, %ebp
callq 0x39222
movl (%r14), %edx
testl %ebp, %ebp
je 0x799b7
leaq 0x5677c(%rip), %rsi     # 0xcff1b
movq %rax, %rdi
xorl %eax, %eax
callq 0x39f3b
testb $0x1, %bpl
je 0x797be
leaq 0x56785(%rip), %rsi     # 0xcff3b
movq %rax, %rdi
callq 0x39b26
cmpl $0x1, %ebp
je 0x797e7
testb $0x1, %bpl
je 0x797d8
leaq 0x58de4(%rip), %rsi     # 0xd25b4
movq %rax, %rdi
callq 0x39b26
leaq 0x567a9(%rip), %rsi     # 0xcff88
movq %rax, %rdi
callq 0x39b26
leaq 0x4d582(%rip), %rsi     # 0xc6d70
movq %rax, %rdi
callq 0x39b26
jmp 0x799c8
movl 0x38(%rbx), %eax
cmpl $0x3, %eax
setl %cl
testb $0x1, %al
sete %al
orb %cl, %al
jne 0x7930a
movq %rbx, %rdi
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x7ea46
leaq 0x565ad(%rip), %rdi     # 0xcfddb
callq 0x39245
movq %rbx, %rdi
movq %rax, %rsi
callq 0x3fe4b
jmp 0x79305
cmpl $0x2, 0x38(%rbx)
jl 0x7930a
callq 0x330c8
movq %rax, %r14
movups 0x8c9d4(%rip), %xmm0    # 0x106230
movaps %xmm0, 0x40(%rsp)
movups 0x8c9b8(%rip), %xmm0    # 0x106220
movaps %xmm0, 0x30(%rsp)
movups 0x8c99c(%rip), %xmm0    # 0x106210
movaps %xmm0, 0x20(%rsp)
movq $0x0, 0x48(%rsp)
cmpl $0x3, 0x38(%rbx)
jl 0x799ee
leaq 0x20(%rsp), %rdi
xorl %esi, %esi
callq 0x31774
movq %rax, %r12
cmpl $0x3, 0x38(%rbx)
jl 0x799f5
movl $0x2, %r15d
movq 0x40(%rbx), %rax
movq (%rax,%r15,8), %rax
movq 0x8(%rax), %rdi
callq 0x7b804
testq %rax, %rax
je 0x798d0
movq 0x8(%rax), %rsi
movq %r12, %rdi
movq %rax, %rdx
callq 0x31a95
incq %r15
movslq 0x38(%rbx), %rax
cmpq %rax, %r15
jl 0x798ab
jmp 0x799f5
movq $0x0, 0xa1dfc(%rip) # 0x11b6e8
cmpl $0x3, 0x38(%rbx)
jl 0x7964a
movl $0x2, %r15d
leaq 0x566de(%rip), %r14     # 0xcffe1
leaq 0x5674d(%rip), %r12     # 0xd0057
leaq 0x487ea(%rip), %rbp     # 0xc20fb
movq 0x40(%rbx), %rax
movq (%rax,%r15,8), %rax
movq 0x8(%rax), %r13
movq %r13, %rdi
movq %r14, %rsi
callq 0x26300
testl %eax, %eax
je 0x79973
movq %r13, %rdi
movq %r12, %rsi
callq 0x26300
testl %eax, %eax
je 0x79988
movq %r13, %rdi
movq %rbp, %rsi
callq 0x26300
testl %eax, %eax
jne 0x79bd8
movl $0x2, %esi
movq %rbx, %rdi
callq 0x4063b
movq %rbx, %rdi
movq %r14, %rsi
callq 0x404b9
movq %rbx, %rdi
movq %r12, %rsi
callq 0x404b9
jmp 0x799a2
orb $0x1, 0xa1d6e(%rip)     # 0x11b6e8
movl $0x3, %edi
leaq 0x56670(%rip), %rsi     # 0xcfff6
jmp 0x7999b
orb $0x2, 0xa1d59(%rip)     # 0x11b6e8
movl $0x3, %edi
leaq 0x566d2(%rip), %rsi     # 0xd006d
xorl %eax, %eax
callq 0x32ea6
incq %r15
movslq 0x38(%rbx), %rax
cmpq %rax, %r15
jl 0x79911
jmp 0x7964a
leaq 0x56511(%rip), %rsi     # 0xcfecf
movq %rax, %rdi
xorl %eax, %eax
callq 0x39f3b
movq %rbx, %rdi
movq %rax, %rsi
callq 0x3fe4b
cmpl $0x3, %r12d
jne 0x7930a
jmp 0x79327
leaq 0x55a21(%rip), %rsi     # 0xcf40a
jmp 0x79bb1
movq 0xa1cbb(%rip), %r12     # 0x11b6b0
movq 0x48(%r12), %rsi
addq 0x28(%r12), %rsi
addq %rsi, %rsi
movq %rbx, %rdi
callq 0x4063b
movq %r12, 0x18(%rsp)
movq %r12, %rdi
callq 0x320bb
movq %rax, 0x10(%rsp)
movq %rax, %rdi
callq 0x32116
testq %rax, %rax
je 0x79b84
leaq 0x8d87c(%rip), %rbp     # 0x1072b0
leaq 0x5554d(%rip), %r15     # 0xcef88
movq 0x8(%rax), %r12
movq 0x8(%r12), %r13
movq %r13, %rdi
callq 0x26510
movq %rbx, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x4070f
movq 0x88(%r12), %rax
movq 0x28(%rax), %rcx
movq 0x48(%rax), %rax
leaq (%rcx,%rax), %rsi
incq %rsi
movq %rbx, %rdi
callq 0x4063b
movl $0x2, %esi
movq %rbx, %rdi
callq 0x4063b
movq %r14, %rsi
subq 0x60(%r12), %rsi
movq %rbx, %rdi
callq 0x40606
movq 0x130(%r12), %r13
testq %r13, %r13
je 0x79abb
movq %r13, %rdi
callq 0x7c786
movq %rbx, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x4070f
jmp 0x79ac7
movq 0x50(%rbp), %rsi
movq %rbx, %rdi
callq 0x3fc19
movq 0x88(%r12), %rdi
callq 0x320bb
movq %rax, %r13
movq %rax, %rdi
callq 0x32116
testq %rax, %rax
je 0x79b69
movq 0x8(%rax), %r12
movl $0x2, %esi
movq %rbx, %rdi
callq 0x4063b
movq %r14, %rsi
subq 0x60(%r12), %rsi
movq %rbx, %rdi
callq 0x40606
movq 0x130(%r12), %rsi
testq %rsi, %rsi
je 0x79b32
movzbl -0x1(%rsi), %edx
movl %edx, %eax
andl $0x7, %eax
cmpl $0x4, %eax
ja 0x79b57
movslq (%r15,%rax,4), %rax
addq %r15, %rax
jmpq *%rax
shrl $0x3, %edx
jmp 0x79b59
movq 0x50(%rbp), %rsi
movq %rbx, %rdi
callq 0x3fc19
jmp 0x79b61
movq -0x11(%rsi), %rdx
jmp 0x79b59
movzwl -0x5(%rsi), %edx
jmp 0x79b59
movl -0x9(%rsi), %edx
jmp 0x79b59
movzbl -0x3(%rsi), %edx
jmp 0x79b59
xorl %edx, %edx
movq %rbx, %rdi
callq 0x4070f
movq %r13, %rdi
jmp 0x79ada
movq %r13, %rdi
callq 0x321d3
movq 0x10(%rsp), %rdi
callq 0x32116
testq %rax, %rax
jne 0x79a3b
movq 0x10(%rsp), %rdi
callq 0x321d3
movq 0x18(%rsp), %rdi
cmpq 0xa1b16(%rip), %rdi     # 0x11b6b0
je 0x79327
callq 0x31ff3
jmp 0x79327
leaq 0x5629f(%rip), %rsi     # 0xcfe50
movq %rbx, %rdi
callq 0x3ffcb
jmp 0x796c6
callq 0x26890
movl (%rax), %eax
cmpl $0x16, %eax
je 0x79bf5
cmpl $0x10, %eax
jne 0x79bfe
leaq 0x56297(%rip), %rsi     # 0xcfe6d
jmp 0x79bb1
leaq 0x564e8(%rip), %rsi     # 0xd00c7
movq %rbx, %rdi
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3ffcb
leaq 0x5586b(%rip), %rsi     # 0xcf467
jmp 0x79bb1
leaq 0x5627f(%rip), %rsi     # 0xcfe84
jmp 0x79bb1