// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/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 0x54555(%rip), %rsi     # 0xbdac9
movq %r14, %rdi
callq 0x262f0
testl %eax, %eax
je 0x696e9
leaq 0x50700(%rip), %rsi     # 0xb9c8b
movq %r14, %rdi
callq 0x262f0
testl %eax, %eax
je 0x69710
leaq 0x541ab(%rip), %rsi     # 0xbd74d
movq %r14, %rdi
callq 0x262f0
testl %eax, %eax
je 0x69748
leaq 0x54462(%rip), %rsi     # 0xbda1b
movq %r14, %rdi
callq 0x262f0
testl %eax, %eax
je 0x69770
leaq 0x54501(%rip), %rsi     # 0xbdad1
movq %r14, %rdi
callq 0x262f0
testl %eax, %eax
je 0x6979b
leaq 0x508bd(%rip), %rsi     # 0xb9ea4
movq %r14, %rdi
callq 0x262f0
testl %eax, %eax
je 0x6982e
leaq 0x544ea(%rip), %rsi     # 0xbdae8
movq %r14, %rdi
callq 0x262f0
testl %eax, %eax
je 0x69863
leaq 0x54704(%rip), %rsi     # 0xbdd19
movq %r14, %rdi
callq 0x262f0
testl %eax, %eax
je 0x698be
leaq 0x54551(%rip), %rsi     # 0xbdb7d
movq %r14, %rdi
callq 0x262f0
testl %eax, %eax
je 0x69921
leaq 0x53905(%rip), %rsi     # 0xbcf48
movq %r14, %rdi
callq 0x262f0
testl %eax, %eax
je 0x69941
leaq 0x5459c(%rip), %rsi     # 0xbdbf6
movq %r14, %rdi
callq 0x262f0
testl %eax, %eax
je 0x69a3b
leaq 0x54591(%rip), %rsi     # 0xbdc02
movq %r14, %rdi
callq 0x262f0
testl %eax, %eax
je 0x69a52
leaq 0x5458a(%rip), %rsi     # 0xbdc12
movq %r14, %rdi
callq 0x262f0
testl %eax, %eax
je 0x69b29
leaq 0x46116(%rip), %rsi     # 0xaf7b5
movq %r14, %rdi
callq 0x262f0
testl %eax, %eax
je 0x69b93
leaq 0x5466c(%rip), %rsi     # 0xbdd22
movq %r14, %rdi
callq 0x262f0
testl %eax, %eax
je 0x69c53
leaq 0x54a3c(%rip), %rsi     # 0xbe109
movq %r14, %rdi
callq 0x262f0
testl %eax, %eax
je 0x69c7f
leaq 0x54754(%rip), %rsi     # 0xbde38
jmp 0x69c64
cmpl $0x2, 0x38(%rbx)
jne 0x69c5d
movq 0xa5016(%rip), %rsi     # 0x10e710
movq %rbx, %rdi
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6e249
cmpl $0x3, 0x38(%rbx)
jne 0x69c5d
movq 0x10(%r15), %rsi
movq %rbx, %rdi
callq 0x6e297
testq %rax, %rax
je 0x69c44
movq %rbx, %rdi
movq %rax, %rsi
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6dba7
cmpl $0x3, 0x38(%rbx)
jne 0x69c5d
movq 0x10(%r15), %rsi
movq %rbx, %rdi
callq 0x6e297
testq %rax, %rax
je 0x69c44
movq 0x88(%rax), %rsi
jmp 0x696fa
cmpl $0x3, 0x38(%rbx)
jne 0x69c5d
movq 0x10(%r15), %rsi
movq %rbx, %rdi
callq 0x6e297
testq %rax, %rax
je 0x69c44
movq 0x80(%rax), %rsi
jmp 0x696fa
andq $0x0, (%rsp)
cmpl $0x6, 0x38(%rbx)
jne 0x69c5d
movq 0x18(%r15), %rsi
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x3ab5e
testl %eax, %eax
jne 0x69c44
movq 0x40(%rbx), %rax
movq 0x20(%rax), %rsi
leaq 0x20(%rsp), %rdx
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x3ab03
testl %eax, %eax
jne 0x69c44
movq 0xa4f25(%rip), %rdi     # 0x10e710
movq 0x40(%rbx), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rsi
movl 0x8(%rsp), %edx
xorl %ecx, %ecx
callq 0x6b382
movq %rax, %r15
cmpl $0x0, 0xa4f0c(%rip)     # 0x10e718
jne 0x69aca
testq %r15, %r15
je 0x69aca
movl (%r15), %eax
movl %eax, %ecx
notl %ecx
testb $0x9, %cl
setne %bpl
jmp 0x69ad9
cmpl $0x3, 0x38(%rbx)
jne 0x69c5d
movq 0x10(%r15), %rax
movq 0x8(%rax), %rdi
movl $0x10000, %esi          # imm = 0x10000
callq 0x6ba9f
movslq %eax, %rsi
movq %rbx, %rdi
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x370a6
cmpl $0x3, 0x38(%rbx)
jne 0x69c5d
movq 0x10(%r15), %rax
movq 0x8(%rax), %rdi
callq 0x6b8b4
testq %rax, %rax
je 0x69a2e
movq %rax, %rdi
callq 0x6bcc0
movq %rax, %r14
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0x370d9
movq (%r14), %rsi
movq %rbx, %rdi
callq 0x36f5d
movslq 0x8(%r14), %rsi
movq %rbx, %rdi
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x37206
cmpl $0x3, 0x38(%rbx)
jne 0x69c5d
movq 0x10(%r15), %rsi
movq %rbx, %rdi
callq 0x6e297
testq %rax, %rax
je 0x69c44
movq %rax, %r14
testb $0x40, (%rax)
jne 0x69a46
movq %r14, %rdi
callq 0x6e48b
testq %rax, %rax
je 0x69bbf
movq 0x8(%r14), %rdx
leaq 0x5424e(%rip), %rsi     # 0xbdb53
pushq $0x3
popq %rdi
xorl %eax, %eax
callq 0x2b699
movq %r14, %rdi
callq 0x6e5b9
orb $0x8, 0x1(%r14)
jmp 0x69aa9
cmpl $0x2, 0x38(%rbx)
jne 0x69c5d
movq %rbx, %rdi
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6af69
cmpl $0x6, 0x38(%rbx)
jne 0x69c5d
movq 0x28(%r15), %rsi
leaq 0x54237(%rip), %rcx     # 0xbdb8d
movq %rsp, %rdx
movq %rbx, %rdi
callq 0x3ab5e
testl %eax, %eax
jne 0x69c44
movq 0x40(%rbx), %rax
movq 0x20(%rax), %rsi
leaq 0x4b8b1(%rip), %rcx     # 0xb5229
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
callq 0x3ab5e
testl %eax, %eax
jne 0x69c44
cmpq $0x0, (%rsp)
jle 0x69dd7
movq 0x40(%rbx), %rax
movq 0x18(%rax), %rax
movq 0x8(%rax), %rsi
leaq 0x20(%rsp), %rdx
pushq $0x2e
popq %rcx
xorl %edi, %edi
callq 0x295db
cmpl $-0x1, %eax
je 0x69fb2
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
pushq $0x1
popq %rsi
xorl %r9d, %r9d
callq 0x6b555
testq %rax, %rax
je 0x69fe3
movq %rax, %r14
callq 0x6a604
movl 0x90(%r14), %r8d
leaq 0x53545(%rip), %rsi     # 0xbcf47
leaq 0x53547(%rip), %rcx     # 0xbcf50
pushq $0x3
popq %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x6a7bb
leaq 0x908f3(%rip), %rax     # 0xfa310
movq 0x8(%rax), %rsi
movq %rbx, %rdi
callq 0x36987
jmp 0x69c44
leaq 0x908db(%rip), %rax     # 0xfa310
movq 0x58(%rax), %rsi
jmp 0x69ab4
cmpl $0x2, 0x38(%rbx)
je 0x69aa4
jmp 0x69c5d
leaq 0x540b3(%rip), %rdi     # 0xbdb00
jmp 0x69bc6
cmpl $0x3, 0x38(%rbx)
jne 0x69c5d
movq 0x10(%r15), %rsi
movq %rbx, %rdi
callq 0x6e297
testq %rax, %rax
je 0x69c44
leaq 0x54191(%rip), %rsi     # 0xbdc09
leaq 0x536cd(%rip), %rcx     # 0xbd14c
pushq $0x3
popq %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x6a7bb
movq 0xa4c7d(%rip), %rdi     # 0x10e710
movq 0x40(%rbx), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rsi
callq 0x2a6dc
callq 0x6a604
leaq 0x90860(%rip), %rax     # 0xfa310
movq 0x8(%rax), %rsi
movq %rbx, %rdi
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x36987
testq %r15, %r15
je 0x69be4
movl (%r15), %eax
movb $0x1, %bpl
xorl %r14d, %r14d
testb $0x1, %al
je 0x69bea
movq 0x40(%rbx), %rax
movq 0x28(%rax), %rax
movq 0x8(%rax), %r14
leaq 0x44ff4(%rip), %rsi     # 0xaeaeb
movq %r14, %rdi
callq 0x262f0
testl %eax, %eax
je 0x69be7
movq 0x20(%rsp), %rsi
movq %rsp, %r12
movq %r15, %rdi
movq %r14, %rdx
movq %r12, %rcx
callq 0x6e359
movq %rax, %r15
movq (%r12), %r14
jmp 0x69bed
cmpl $0x3, 0x38(%rbx)
jne 0x69c5d
movq 0x10(%r15), %rsi
movq %rbx, %rdi
callq 0x6e297
testq %rax, %rax
je 0x69c44
leaq 0x20(%rsp), %r14
movq %rax, %rdi
movq %r14, %rsi
callq 0x6e2d0
movl %eax, %ebp
callq 0x3114c
movl (%r14), %edx
testl %ebp, %ebp
je 0x69dc4
leaq 0x540f6(%rip), %rsi     # 0xbdc67
movq %rax, %rdi
xorl %eax, %eax
callq 0x31abc
testb $0x1, %bpl
jne 0x69de3
cmpl $0x1, %ebp
jne 0x69e06
jmp 0x69e15
movl 0x38(%rbx), %eax
cmpl $0x3, %eax
setl %cl
testb $0x1, %al
sete %al
orb %cl, %al
jne 0x69c5d
movq %rbx, %rdi
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6e67b
leaq 0x53f61(%rip), %rdi     # 0xbdb27
callq 0x3115a
movq %rbx, %rdi
movq %rax, %rsi
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x36a9d
movb $0x1, %bpl
xorl %r14d, %r14d
xorl %r15d, %r15d
pushq $0x3
popq %rsi
movq %rbx, %rdi
callq 0x370d9
leaq 0x90711(%rip), %rax     # 0xfa310
notb %bpl
movzbl %bpl, %ecx
andl $0x1, %ecx
movq 0x20(%rax,%rcx,8), %rsi
movq %rbx, %rdi
callq 0x36987
testq %r15, %r15
leaq 0x44ecb(%rip), %rsi     # 0xaeaeb
cmovneq %r15, %rsi
movq %rbx, %rdi
callq 0x36f5d
movq %rbx, %rdi
movq %r14, %rsi
callq 0x370a6
testq %r15, %r15
je 0x69c44
movq %r15, %rdi
callq 0x311c8
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x2, 0x38(%rbx)
jge 0x69d3e
leaq 0x541f5(%rip), %rsi     # 0xbde59
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 0x36b96
andq $0x0, 0xa4ac1(%rip)     # 0x10e748
pushq $0x2
popq %r14
leaq 0x5409b(%rip), %r15     # 0xbdd2d
pushq $0x3
popq %rbp
leaq 0x54107(%rip), %r13     # 0xbdda3
movslq 0x38(%rbx), %rax
cmpq %rax, %r14
jge 0x69aa9
movq 0x40(%rbx), %rax
movq (%rax,%r14,8), %rax
movq 0x8(%rax), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x262f0
testl %eax, %eax
je 0x69d0d
movq %r12, %rdi
movq %r13, %rsi
callq 0x262f0
testl %eax, %eax
je 0x69d1f
movq %r12, %rdi
leaq 0x4737a(%rip), %rsi     # 0xb1057
callq 0x262f0
testl %eax, %eax
jne 0x69fc6
movq %rbx, %rdi
pushq $0x2
popq %rsi
callq 0x370d9
movq %rbx, %rdi
movq %r15, %rsi
callq 0x36f5d
movq %rbx, %rdi
movq %r13, %rsi
callq 0x36f5d
jmp 0x69d36
orb $0x1, 0xa4a34(%rip)     # 0x10e748
movl %ebp, %edi
leaq 0x54025(%rip), %rsi     # 0xbdd42
jmp 0x69d2f
orb $0x2, 0xa4a22(%rip)     # 0x10e748
movl %ebp, %edi
leaq 0x5408a(%rip), %rsi     # 0xbddb9
xorl %eax, %eax
callq 0x2b699
incq %r14
jmp 0x69c9c
callq 0x2b8ae
movq 0x8f586(%rip), %rcx     # 0xf92d0
movq %rcx, 0x40(%rsp)
movups 0x8f56a(%rip), %xmm0    # 0xf92c0
movaps %xmm0, 0x30(%rsp)
movups 0x8f54e(%rip), %xmm0    # 0xf92b0
movaps %xmm0, 0x20(%rsp)
andq $0x0, 0x48(%rsp)
movq %rax, %r14
cmpl $0x3, 0x38(%rbx)
jl 0x69e34
leaq 0x20(%rsp), %rdi
xorl %esi, %esi
callq 0x2a155
movq %rax, %r12
pushq $0x2
popq %r15
movslq 0x38(%rbx), %rax
cmpq %rax, %r15
jge 0x69e3b
movq 0x40(%rbx), %rax
movq (%rax,%r15,8), %rax
movq 0x8(%rax), %rdi
callq 0x6b8b4
testq %rax, %rax
je 0x69dbf
movq 0x8(%rax), %rsi
movq %r12, %rdi
movq %rax, %rdx
callq 0x2a3ed
incq %r15
jmp 0x69d8d
leaq 0x53e50(%rip), %rsi     # 0xbdc1b
movq %rax, %rdi
xorl %eax, %eax
callq 0x31abc
jmp 0x69e24
leaq 0x53378(%rip), %rsi     # 0xbd156
jmp 0x69fb9
leaq 0x53e9d(%rip), %rsi     # 0xbdc87
movq %rax, %rdi
callq 0x317b7
cmpl $0x1, %ebp
je 0x69e15
leaq 0x56493(%rip), %rsi     # 0xc0291
movq %rax, %rdi
callq 0x317b7
leaq 0x53ec7(%rip), %rsi     # 0xbdcd4
movq %rax, %rdi
callq 0x317b7
leaq 0x4b374(%rip), %rsi     # 0xb5190
movq %rax, %rdi
callq 0x317b7
movq %rbx, %rdi
movq %rax, %rsi
callq 0x36a9d
jmp 0x69c44
movq 0xa48d5(%rip), %r12     # 0x10e710
movq 0x48(%r12), %rsi
addq 0x28(%r12), %rsi
addq %rsi, %rsi
movq %rbx, %rdi
callq 0x370d9
movq %r12, 0x18(%rsp)
movq %r12, %rdi
callq 0x2a99f
movq %rax, 0x10(%rsp)
pushq $0x2
popq %r13
movq 0x10(%rsp), %rdi
callq 0x2a9d3
testq %rax, %rax
je 0x69f8c
movq 0x8(%rax), %r12
movq 0x8(%r12), %r15
movq %r15, %rdi
callq 0x26500
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x3716c
movq 0x88(%r12), %rax
movq 0x28(%rax), %rcx
movq 0x48(%rax), %rax
leaq (%rcx,%rax), %rsi
incq %rsi
movq %rbx, %rdi
callq 0x370d9
movq %rbx, %rdi
movq %r13, %rsi
callq 0x370d9
movq %r14, %rsi
subq 0x60(%r12), %rsi
movq %rbx, %rdi
callq 0x370a6
movq 0x130(%r12), %rbp
testq %rbp, %rbp
je 0x69ef7
movq %rbp, %rdi
callq 0x6c6ff
movq %rbx, %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0x3716c
jmp 0x69f0a
leaq 0x90412(%rip), %rax     # 0xfa310
movq 0x50(%rax), %rsi
movq %rbx, %rdi
callq 0x36987
movq 0x88(%r12), %rdi
callq 0x2a99f
movq %rax, %rbp
leaq 0x903ef(%rip), %r12     # 0xfa310
movq %rbp, %rdi
callq 0x2a9d3
testq %rax, %rax
je 0x69f7f
movq 0x8(%rax), %r15
movq %rbx, %rdi
movq %r13, %rsi
callq 0x370d9
movq %r14, %rsi
subq 0x60(%r15), %rsi
movq %rbx, %rdi
callq 0x370a6
movq 0x130(%r15), %r15
testq %r15, %r15
je 0x69f70
movq %r15, %rdi
callq 0x6c6ff
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x3716c
jmp 0x69f21
movq 0x50(%r12), %rsi
movq %rbx, %rdi
callq 0x36987
jmp 0x69f21
movq %rbp, %rdi
callq 0x2aa94
jmp 0x69e66
movq 0x10(%rsp), %rdi
callq 0x2aa94
movq 0x18(%rsp), %rdi
cmpq 0xa476e(%rip), %rdi     # 0x10e710
je 0x69c44
callq 0x2a8da
jmp 0x69c44
leaq 0x53be3(%rip), %rsi     # 0xbdb9c
movq %rbx, %rdi
callq 0x36b6f
jmp 0x69c44
leaq 0x53e46(%rip), %rsi     # 0xbde13
movq %rbx, %rdi
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x36b6f
callq 0x26880
movl (%rax), %eax
cmpl $0x16, %eax
je 0x69ffd
cmpl $0x10, %eax
jne 0x6a006
leaq 0x53bbe(%rip), %rsi     # 0xbdbb9
jmp 0x69fb9
leaq 0x531af(%rip), %rsi     # 0xbd1b3
jmp 0x69fb9
leaq 0x53bc3(%rip), %rsi     # 0xbdbd0
jmp 0x69fb9