// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/src/sentinel.c
// Function: sentinelRefreshInstanceInfo
void sentinelRefreshInstanceInfo(sentinelRedisInstance *ri, const char *info) {
    sds *lines;
    int numlines, j;
    int role = 0;

    /* The following fields must be reset to a given value in the case they
     * are not found at all in the INFO output. */
    // 将该变量重置为 0 ，避免 INFO 回复中无该值的情况
    ri->master_link_down_time = 0;

    /* Process line by line. */
    // 对 INFO 命令的回复进行逐行分析
    lines = sdssplitlen(info,strlen(info),"\r\n",2,&numlines);
    for (j = 0; j < numlines; j++) {
        sentinelRedisInstance *slave;
        sds l = lines[j];

        /* run_id:<40 hex chars>*/
        // 读取并分析 runid
        if (sdslen(l) >= 47 && !memcmp(l,"run_id:",7)) {

            // 新设置 runid
            if (ri->runid == NULL) {
                ri->runid = sdsnewlen(l+7,40);
            } else {
                // RUNID 不同，说明服务器已重启
                if (strncmp(ri->runid,l+7,40) != 0) {
                    sentinelEvent(REDIS_NOTICE,"+reboot",ri,"%@");

                    // 释放旧 ID ，设置新 ID
                    sdsfree(ri->runid);
                    ri->runid = sdsnewlen(l+7,40);
                }
            }
        }

        // 读取从服务器的 ip 和端口号
        /* old versions: slave0:<ip>,<port>,<state>
         * new versions: slave0:ip=127.0.0.1,port=9999,... */
        if ((ri->flags & SRI_MASTER) &&
            sdslen(l) >= 7 &&
            !memcmp(l,"slave",5) && isdigit(l[5]))
        {
            char *ip, *port, *end;

            if (strstr(l,"ip=") == NULL) {
                /* Old format. */
                ip = strchr(l,':'); if (!ip) continue;
                ip++; /* Now ip points to start of ip address. */
                port = strchr(ip,','); if (!port) continue;
                *port = '\0'; /* nul term for easy access. */
                port++; /* Now port points to start of port number. */
                end = strchr(port,','); if (!end) continue;
                *end = '\0'; /* nul term for easy access. */
            } else {
                /* New format. */
                ip = strstr(l,"ip="); if (!ip) continue;
                ip += 3; /* Now ip points to start of ip address. */
                port = strstr(l,"port="); if (!port) continue;
                port += 5; /* Now port points to start of port number. */
                /* Nul term both fields for easy access. */
                end = strchr(ip,','); if (end) *end = '\0';
                end = strchr(port,','); if (end) *end = '\0';
            }

            /* Check if we already have this slave into our table,
             * otherwise add it. */
            // 如果发现有新的从服务器出现，那么为它添加实例
            if (sentinelRedisInstanceLookupSlave(ri,ip,atoi(port)) == NULL) {
                if ((slave = createSentinelRedisInstance(NULL,SRI_SLAVE,ip,
                            atoi(port), ri->quorum, ri)) != NULL)
                {
                    sentinelEvent(REDIS_NOTICE,"+slave",slave,"%@");
                }
            }
        }

        /* master_link_down_since_seconds:<seconds> */
        // 读取主从服务器的断线时长
        // 这个只会在实例是从服务器，并且主从连接断开的情况下出现
        if (sdslen(l) >= 32 &&
            !memcmp(l,"master_link_down_since_seconds",30))
        {
            ri->master_link_down_time = strtoll(l+31,NULL,10)*1000;
        }

        /* role:<role> */
        // 读取实例的角色
        if (!memcmp(l,"role:master",11)) role = SRI_MASTER;
        else if (!memcmp(l,"role:slave",10)) role = SRI_SLAVE;

        // 处理从服务器
        if (role == SRI_SLAVE) {

            /* master_host:<host> */
            // 读入主服务器的 IP
            if (sdslen(l) >= 12 && !memcmp(l,"master_host:",12)) {
                if (ri->slave_master_host == NULL ||
                    strcasecmp(l+12,ri->slave_master_host))
                {
                    sdsfree(ri->slave_master_host);
                    ri->slave_master_host = sdsnew(l+12);
                    ri->slave_conf_change_time = mstime();
                }
            }

            /* master_port:<port> */
            // 读入主服务器的端口号
            if (sdslen(l) >= 12 && !memcmp(l,"master_port:",12)) {
                int slave_master_port = atoi(l+12);

                if (ri->slave_master_port != slave_master_port) {
                    ri->slave_master_port = slave_master_port;
                    ri->slave_conf_change_time = mstime();
                }
            }
            
            /* master_link_status:<status> */
            // 读入主服务器的状态
            if (sdslen(l) >= 19 && !memcmp(l,"master_link_status:",19)) {
                ri->slave_master_link_status =
                    (strcasecmp(l+19,"up") == 0) ?
                    SENTINEL_MASTER_LINK_STATUS_UP :
                    SENTINEL_MASTER_LINK_STATUS_DOWN;
            }

            /* slave_priority:<priority> */
            // 读入从服务器的优先级
            if (sdslen(l) >= 15 && !memcmp(l,"slave_priority:",15))
                ri->slave_priority = atoi(l+15);

            /* slave_repl_offset:<offset> */
            // 读入从服务器的复制偏移量
            if (sdslen(l) >= 18 && !memcmp(l,"slave_repl_offset:",18))
                ri->slave_repl_offset = strtoull(l+18,NULL,10);
        }
    }

    // 更新刷新 INFO 命令回复的时间
    ri->info_refresh = mstime();
    sdsfreesplitres(lines,numlines);

    /* ---------------------------- Acting half -----------------------------
     * Some things will not happen if sentinel.tilt is true, but some will
     * still be processed. 
     *
     * 如果 sentinel 进入了 TILT 模式，那么可能只有一部分动作会被执行
     */

    /* Remember when the role changed. */
    if (role != ri->role_reported) {
        ri->role_reported_time = mstime();
        ri->role_reported = role;
        if (role == SRI_SLAVE) ri->slave_conf_change_time = mstime();
        /* Log the event with +role-change if the new role is coherent or
         * with -role-change if there is a mismatch with the current config. */
        sentinelEvent(REDIS_VERBOSE,
            ((ri->flags & (SRI_MASTER|SRI_SLAVE)) == role) ?
            "+role-change" : "-role-change",
            ri, "%@ new reported role is %s",
            role == SRI_MASTER ? "master" : "slave",
            ri->flags & SRI_MASTER ? "master" : "slave");
    }

    /* None of the following conditions are processed when in tilt mode, so
     * return asap. */
    // 如果 Sentinel 正处于 TILT 模式，那么它不能执行以下的语句。
    if (sentinel.tilt) return;

    /* Handle master -> slave role switch. */
    // 实例被 Sentinel 标识为主服务器，但根据 INFO 命令的回复
    // 这个实例的身份为从服务器
    if ((ri->flags & SRI_MASTER) && role == SRI_SLAVE) {
        /* Nothing to do, but masters claiming to be slaves are
         * considered to be unreachable by Sentinel, so eventually
         * a failover will be triggered. */
        // 如果一个主服务器变为从服务器，那么 Sentinel 将这个主服务器看作是不可用的
    }

    /* Handle slave -> master role switch. */
    // 处理从服务器转变为主服务器的情况
    if ((ri->flags & SRI_SLAVE) && role == SRI_MASTER) {
        /* If this is a promoted slave we can change state to the
         * failover state machine. */

        // 如果这是被选中升级为新主服务器的从服务器
        // 那么更新相关的故障转移属性
        if ((ri->master->flags & SRI_FAILOVER_IN_PROGRESS) &&
            (ri->master->failover_state ==
                SENTINEL_FAILOVER_STATE_WAIT_PROMOTION))
        {
            /* Now that we are sure the slave was reconfigured as a master
             * set the master configuration epoch to the epoch we won the
             * election to perform this failover. This will force the other
             * Sentinels to update their config (assuming there is not
             * a newer one already available). */
            // 这是一个被 Sentinel 发送 SLAVEOF no one 之后由从服务器变为主服务器的实例
            // 将这个新主服务器的配置纪元设置为 Sentinel 赢得领头选举的纪元
            // 这一操作会强制其他 Sentinel 更新它们自己的配置
            // （假设没有一个更新的纪元存在的话）
            // 更新从服务器的主服务器（已下线）的配置纪元
            ri->master->config_epoch = ri->master->failover_epoch;
            // 设置从服务器的主服务器（已下线）的故障转移状态
            // 这个状态会让从服务器开始同步新的主服务器
            ri->master->failover_state = SENTINEL_FAILOVER_STATE_RECONF_SLAVES;
            // 更新从服务器的主服务器（已下线）的故障转移状态变更时间
            ri->master->failover_state_change_time = mstime();
            // 将当前 Sentinel 状态保存到配置文件里面
            sentinelFlushConfig();
            // 发送事件
            sentinelEvent(REDIS_WARNING,"+promoted-slave",ri,"%@");
            sentinelEvent(REDIS_WARNING,"+failover-state-reconf-slaves",
                ri->master,"%@");
            // 执行脚本
            sentinelCallClientReconfScript(ri->master,SENTINEL_LEADER,
                "start",ri->master->addr,ri->addr);

        // 这个实例由从服务器变为了主服务器，并且没有进入 TILT 模式
        // （可能是因为重启造成的，或者之前的下线主服务器重新上线了）
        } else {
            /* A slave turned into a master. We want to force our view and
             * reconfigure as slave. Wait some time after the change before
             * going forward, to receive new configs if any. */
            // 如果一个从服务器变为了主服务器，那么我们会考虑将它变回一个从服务器

            // 将 PUBLISH 命令的发送时间乘以 4 ，给于一定缓冲时间
            mstime_t wait_time = SENTINEL_PUBLISH_PERIOD*4;

            // 如果这个实例的主服务器运作正常
            // 并且实例在一段时间内没有进入过 SDOWN 状态或者 ODOWN 状态
            // 并且实例报告它是主服务器的时间已经超过 wait_time
            if (sentinelMasterLooksSane(ri->master) &&
               sentinelRedisInstanceNoDownFor(ri,wait_time) &&
               mstime() - ri->role_reported_time > wait_time)
            {
                // 重新将实例设置为从服务器
                int retval = sentinelSendSlaveOf(ri,
                        ri->master->addr->ip,
                        ri->master->addr->port);
                
                // 发送事件
                if (retval == REDIS_OK)
                    sentinelEvent(REDIS_NOTICE,"+convert-to-slave",ri,"%@");
            }
        }
    }

    /* Handle slaves replicating to a different master address. */
    // 让从服务器重新复制回正确的主服务器
    if ((ri->flags & SRI_SLAVE) &&
        role == SRI_SLAVE &&
        // 从服务器现在的主服务器地址和 Sentinel 保存的信息不一致
        (ri->slave_master_port != ri->master->addr->port ||
         strcasecmp(ri->slave_master_host,ri->master->addr->ip)))
    {
        mstime_t wait_time = ri->master->failover_timeout;

        /* Make sure the master is sane before reconfiguring this instance
         * into a slave. */
        // 1) 检查实例的主服务器状态是否正常
        // 2) 检查实例在给定时间内是否进入过 SDOWN 或者 ODOWN 状态
        // 3) 检查实例身份变更的时长是否已经超过了指定时长
        // 如果是的话，执行代码。。。
        if (sentinelMasterLooksSane(ri->master) &&
            sentinelRedisInstanceNoDownFor(ri,wait_time) &&
            mstime() - ri->slave_conf_change_time > wait_time)
        {
            // 重新将实例指向原本的主服务器
            int retval = sentinelSendSlaveOf(ri,
                    ri->master->addr->ip,
                    ri->master->addr->port);

            if (retval == REDIS_OK)
                sentinelEvent(REDIS_NOTICE,"+fix-slave-config",ri,"%@");
        }
    }

    /* Detect if the slave that is in the process of being reconfigured
     * changed state. */
    // Sentinel 监视的实例为从服务器，并且已经向它发送 SLAVEOF 命令
    if ((ri->flags & SRI_SLAVE) && role == SRI_SLAVE &&
        (ri->flags & (SRI_RECONF_SENT|SRI_RECONF_INPROG)))
    {
        /* SRI_RECONF_SENT -> SRI_RECONF_INPROG. */
        // 将 SENT 状态改为 INPROG 状态，表示同步正在进行
        if ((ri->flags & SRI_RECONF_SENT) &&
            ri->slave_master_host &&
            strcmp(ri->slave_master_host,
                    ri->master->promoted_slave->addr->ip) == 0 &&
            ri->slave_master_port == ri->master->promoted_slave->addr->port)
        {
            ri->flags &= ~SRI_RECONF_SENT;
            ri->flags |= SRI_RECONF_INPROG;
            sentinelEvent(REDIS_NOTICE,"+slave-reconf-inprog",ri,"%@");
        }

        /* SRI_RECONF_INPROG -> SRI_RECONF_DONE */
        // 将 INPROG 状态改为 DONE 状态，表示同步已完成
        if ((ri->flags & SRI_RECONF_INPROG) &&
            ri->slave_master_link_status == SENTINEL_MASTER_LINK_STATUS_UP)
        {
            ri->flags &= ~SRI_RECONF_INPROG;
            ri->flags |= SRI_RECONF_DONE;
            sentinelEvent(REDIS_NOTICE,"+slave-reconf-done",ri,"%@");
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x24(%rbp)
movq -0x8(%rbp), %rax
movq $0x0, 0xe0(%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x10(%rbp), %rdi
callq 0x1f4d0
movq -0x80(%rbp), %rdi
movl %eax, %esi
leaq 0x66867(%rip), %rdx     # 0xe37de
movl $0x2, %ecx
leaq -0x1c(%rbp), %r8
callq 0x2d5a0
movq %rax, -0x18(%rbp)
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x7d54d
movq -0x18(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
callq 0x788c0
cmpq $0x2f, %rax
jb 0x7d072
movq -0x38(%rbp), %rdi
leaq 0x6c534(%rip), %rsi     # 0xe94fe
movl $0x7, %edx
callq 0x1f950
cmpl $0x0, %eax
jne 0x7d072
movq -0x8(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x7d007
movq -0x38(%rbp), %rdi
addq $0x7, %rdi
movl $0x28, %esi
callq 0x2c000
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x7d070
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x38(%rbp), %rsi
addq $0x7, %rsi
movl $0x28, %edx
callq 0x1f340
cmpl $0x0, %eax
je 0x7d06e
movq -0x8(%rbp), %rdx
movl $0x2, %edi
leaq 0x6c4d0(%rip), %rsi     # 0xe9506
leaq 0x6bff5(%rip), %rcx     # 0xe9032
movb $0x0, %al
callq 0x79b10
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x2c160
movq -0x38(%rbp), %rdi
addq $0x7, %rdi
movl $0x28, %esi
callq 0x2c000
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x7d070
jmp 0x7d072
movq -0x8(%rbp), %rax
movl (%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x7d2b3
movq -0x38(%rbp), %rdi
callq 0x788c0
cmpq $0x7, %rax
jb 0x7d2b3
movq -0x38(%rbp), %rdi
leaq 0x69dc0(%rip), %rsi     # 0xe6e62
movl $0x5, %edx
callq 0x1f950
cmpl $0x0, %eax
jne 0x7d2b3
callq 0x1f530
movq (%rax), %rax
movq -0x38(%rbp), %rcx
movsbl 0x5(%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
je 0x7d2b3
movq -0x38(%rbp), %rdi
leaq 0x6c429(%rip), %rsi     # 0xe950e
callq 0x1f660
cmpq $0x0, %rax
jne 0x7d179
movq -0x38(%rbp), %rdi
movl $0x3a, %esi
callq 0x1f790
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x7d112
jmp 0x7d53f
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
movl $0x2c, %esi
callq 0x1f790
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x7d13c
jmp 0x7d53f
movq -0x48(%rbp), %rax
movb $0x0, (%rax)
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
movl $0x2c, %esi
callq 0x1f790
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
jne 0x7d16d
jmp 0x7d53f
movq -0x50(%rbp), %rax
movb $0x0, (%rax)
jmp 0x7d213
movq -0x38(%rbp), %rdi
leaq 0x6c38a(%rip), %rsi     # 0xe950e
callq 0x1f660
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x7d199
jmp 0x7d53f
movq -0x40(%rbp), %rax
addq $0x3, %rax
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rdi
leaq 0x6c362(%rip), %rsi     # 0xe9512
callq 0x1f660
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x7d1c5
jmp 0x7d53f
movq -0x48(%rbp), %rax
addq $0x5, %rax
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rdi
movl $0x2c, %esi
callq 0x1f790
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
je 0x7d1f1
movq -0x50(%rbp), %rax
movb $0x0, (%rax)
movq -0x48(%rbp), %rdi
movl $0x2c, %esi
callq 0x1f790
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
je 0x7d211
movq -0x50(%rbp), %rax
movb $0x0, (%rax)
jmp 0x7d213
movq -0x8(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x48(%rbp), %rdi
callq 0x1f700
movq -0x90(%rbp), %rdi
movq -0x88(%rbp), %rsi
movl %eax, %edx
callq 0x7af60
cmpq $0x0, %rax
jne 0x7d2b1
movq -0x40(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x48(%rbp), %rdi
callq 0x1f700
movq -0x98(%rbp), %rdx
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl 0xd0(%rax), %r8d
movq -0x8(%rbp), %r9
xorl %eax, %eax
movl %eax, %edi
movl $0x2, %esi
callq 0x7a9e0
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
je 0x7d2af
movq -0x30(%rbp), %rdx
movl $0x2, %edi
leaq 0x6bd94(%rip), %rsi     # 0xe9035
leaq 0x6bd8a(%rip), %rcx     # 0xe9032
movb $0x0, %al
callq 0x79b10
jmp 0x7d2b1
jmp 0x7d2b3
movq -0x38(%rbp), %rdi
callq 0x788c0
cmpq $0x20, %rax
jb 0x7d304
movq -0x38(%rbp), %rdi
leaq 0x6c24b(%rip), %rsi     # 0xe9518
movl $0x1e, %edx
callq 0x1f950
cmpl $0x0, %eax
jne 0x7d304
movq -0x38(%rbp), %rdi
addq $0x1f, %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0xa, %edx
callq 0x1fa80
imulq $0x3e8, %rax, %rcx      # imm = 0x3E8
movq -0x8(%rbp), %rax
movq %rcx, 0xe0(%rax)
movq -0x38(%rbp), %rdi
leaq 0x6c228(%rip), %rsi     # 0xe9537
movl $0xb, %edx
callq 0x1f950
cmpl $0x0, %eax
jne 0x7d327
movl $0x1, -0x24(%rbp)
jmp 0x7d34a
movq -0x38(%rbp), %rdi
leaq 0x6c211(%rip), %rsi     # 0xe9543
movl $0xa, %edx
callq 0x1f950
cmpl $0x0, %eax
jne 0x7d348
movl $0x2, -0x24(%rbp)
jmp 0x7d34a
cmpl $0x2, -0x24(%rbp)
jne 0x7d53d
movq -0x38(%rbp), %rdi
callq 0x788c0
cmpq $0xc, %rax
jb 0x7d3ec
movq -0x38(%rbp), %rdi
leaq 0x6c1dc(%rip), %rsi     # 0xe954e
movl $0xc, %edx
callq 0x1f950
cmpl $0x0, %eax
jne 0x7d3ec
movq -0x8(%rbp), %rax
cmpq $0x0, 0x100(%rax)
je 0x7d3ac
movq -0x38(%rbp), %rdi
addq $0xc, %rdi
movq -0x8(%rbp), %rax
movq 0x100(%rax), %rsi
callq 0x1f2f0
cmpl $0x0, %eax
je 0x7d3ea
movq -0x8(%rbp), %rax
movq 0x100(%rax), %rdi
callq 0x2c160
movq -0x38(%rbp), %rdi
addq $0xc, %rdi
callq 0x2c0e0
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x100(%rax)
callq 0x252e0
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0xb8(%rax)
jmp 0x7d3ec
movq -0x38(%rbp), %rdi
callq 0x788c0
cmpq $0xc, %rax
jb 0x7d456
movq -0x38(%rbp), %rdi
leaq 0x6c155(%rip), %rsi     # 0xe955b
movl $0xc, %edx
callq 0x1f950
cmpl $0x0, %eax
jne 0x7d456
movq -0x38(%rbp), %rdi
addq $0xc, %rdi
callq 0x1f700
movl %eax, -0x54(%rbp)
movq -0x8(%rbp), %rax
movl 0x108(%rax), %eax
cmpl -0x54(%rbp), %eax
je 0x7d454
movl -0x54(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x108(%rax)
callq 0x252e0
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0xb8(%rax)
jmp 0x7d456
movq -0x38(%rbp), %rdi
callq 0x788c0
cmpq $0x13, %rax
jb 0x7d4ac
movq -0x38(%rbp), %rdi
leaq 0x6c0f8(%rip), %rsi     # 0xe9568
movl $0x13, %edx
callq 0x1f950
cmpl $0x0, %eax
jne 0x7d4ac
movq -0x38(%rbp), %rdi
addq $0x13, %rdi
leaq 0x62858(%rip), %rsi     # 0xdfce6
callq 0x1f2f0
movl %eax, %edx
movl $0x1, %ecx
xorl %eax, %eax
cmpl $0x0, %edx
cmovel %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x10c(%rax)
movq -0x38(%rbp), %rdi
callq 0x788c0
cmpq $0xf, %rax
jb 0x7d4ee
movq -0x38(%rbp), %rdi
leaq 0x6c0b6(%rip), %rsi     # 0xe957c
movl $0xf, %edx
callq 0x1f950
cmpl $0x0, %eax
jne 0x7d4ee
movq -0x38(%rbp), %rdi
addq $0xf, %rdi
callq 0x1f700
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0xe8(%rax)
movq -0x38(%rbp), %rdi
callq 0x788c0
cmpq $0x12, %rax
jb 0x7d53b
movq -0x38(%rbp), %rdi
leaq 0x6c084(%rip), %rsi     # 0xe958c
movl $0x12, %edx
callq 0x1f950
cmpl $0x0, %eax
jne 0x7d53b
movq -0x38(%rbp), %rdi
addq $0x12, %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0xa, %edx
callq 0x1fa10
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x110(%rax)
jmp 0x7d53d
jmp 0x7d53f
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x7cf90
callq 0x252e0
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0xa0(%rax)
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x2d7d0
movl -0x24(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0xa8(%rcx), %eax
je 0x7d625
callq 0x252e0
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0xb0(%rax)
movl -0x24(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0xa8(%rax)
cmpl $0x2, -0x24(%rbp)
jne 0x7d5b8
callq 0x252e0
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0xb8(%rax)
movq -0x8(%rbp), %rax
movl (%rax), %ecx
andl $0x3, %ecx
movl -0x24(%rbp), %edx
leaq 0x6bfe1(%rip), %rsi     # 0xe95ac
leaq 0x6bfcd(%rip), %rax     # 0xe959f
cmpl %edx, %ecx
cmoveq %rax, %rsi
movq -0x8(%rbp), %rdx
movl -0x24(%rbp), %ecx
leaq 0x6987c(%rip), %r8      # 0xe6e62
leaq 0x69842(%rip), %rax     # 0xe6e2f
cmpl $0x1, %ecx
cmoveq %rax, %r8
movq -0x8(%rbp), %rax
movl (%rax), %ecx
andl $0x1, %ecx
leaq 0x6985e(%rip), %r9      # 0xe6e62
leaq 0x69824(%rip), %rax     # 0xe6e2f
cmpl $0x0, %ecx
cmovneq %rax, %r9
movl $0x1, %edi
leaq 0x6bf9b(%rip), %rcx     # 0xe95b9
movb $0x0, %al
callq 0x79b10
cmpl $0x0, 0xaac1c(%rip)     # 0x128248
je 0x7d633
jmp 0x7da53
movq -0x8(%rbp), %rax
movl (%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x7d649
cmpl $0x2, -0x24(%rbp)
jne 0x7d649
jmp 0x7d649
movq -0x8(%rbp), %rax
movl (%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x7d807
cmpl $0x1, -0x24(%rbp)
jne 0x7d807
movq -0x8(%rbp), %rax
movq 0xf8(%rax), %rax
movl (%rax), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0x7d768
movq -0x8(%rbp), %rax
movq 0xf8(%rax), %rax
cmpl $0x4, 0x130(%rax)
jne 0x7d768
movq -0x8(%rbp), %rax
movq 0xf8(%rax), %rax
movq 0x128(%rax), %rcx
movq -0x8(%rbp), %rax
movq 0xf8(%rax), %rax
movq %rcx, 0x18(%rax)
movq -0x8(%rbp), %rax
movq 0xf8(%rax), %rax
movl $0x5, 0x130(%rax)
callq 0x252e0
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq 0xf8(%rax), %rax
movq %rcx, 0x138(%rax)
callq 0x7b820
movq -0x8(%rbp), %rdx
movl $0x3, %edi
leaq 0x6bed7(%rip), %rsi     # 0xe95d4
leaq 0x6b92e(%rip), %rcx     # 0xe9032
movb $0x0, %al
callq 0x79b10
movq -0x8(%rbp), %rax
movq 0xf8(%rax), %rdx
movl $0x3, %edi
leaq 0x6bec2(%rip), %rsi     # 0xe95e4
leaq 0x6b909(%rip), %rcx     # 0xe9032
movb $0x0, %al
callq 0x79b10
movq -0x8(%rbp), %rax
movq 0xf8(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0xf8(%rax), %rax
movq 0x20(%rax), %rcx
movq -0x8(%rbp), %rax
movq 0x20(%rax), %r8
movl $0x20000, %esi          # imm = 0x20000
leaq 0x6bfb5(%rip), %rdx     # 0xe9713
callq 0x7a910
jmp 0x7d805
movq $0x1f40, -0x60(%rbp)    # imm = 0x1F40
movq -0x8(%rbp), %rax
movq 0xf8(%rax), %rdi
callq 0x7cec0
cmpl $0x0, %eax
je 0x7d803
movq -0x8(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0x7b8f0
cmpl $0x0, %eax
je 0x7d803
callq 0x252e0
movq -0x8(%rbp), %rcx
subq 0xb0(%rcx), %rax
cmpq -0x60(%rbp), %rax
jle 0x7d803
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0xf8(%rax), %rax
movq 0x20(%rax), %rax
movq (%rax), %rsi
movq -0x8(%rbp), %rax
movq 0xf8(%rax), %rax
movq 0x20(%rax), %rax
movl 0x8(%rax), %edx
callq 0x7da60
movl %eax, -0x64(%rbp)
cmpl $0x0, -0x64(%rbp)
jne 0x7d801
movq -0x8(%rbp), %rdx
movl $0x2, %edi
leaq 0x6be0f(%rip), %rsi     # 0xe9602
leaq 0x6b838(%rip), %rcx     # 0xe9032
movb $0x0, %al
callq 0x79b10
jmp 0x7d803
jmp 0x7d805
jmp 0x7d807
movq -0x8(%rbp), %rax
movl (%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x7d917
cmpl $0x2, -0x24(%rbp)
jne 0x7d917
movq -0x8(%rbp), %rax
movl 0x108(%rax), %eax
movq -0x8(%rbp), %rcx
movq 0xf8(%rcx), %rcx
movq 0x20(%rcx), %rcx
cmpl 0x8(%rcx), %eax
jne 0x7d86c
movq -0x8(%rbp), %rax
movq 0x100(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0xf8(%rax), %rax
movq 0x20(%rax), %rax
movq (%rax), %rsi
callq 0x1f2f0
cmpl $0x0, %eax
je 0x7d917
movq -0x8(%rbp), %rax
movq 0xf8(%rax), %rax
movq 0x148(%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x8(%rbp), %rax
movq 0xf8(%rax), %rdi
callq 0x7cec0
cmpl $0x0, %eax
je 0x7d915
movq -0x8(%rbp), %rdi
movq -0x70(%rbp), %rsi
callq 0x7b8f0
cmpl $0x0, %eax
je 0x7d915
callq 0x252e0
movq -0x8(%rbp), %rcx
subq 0xb8(%rcx), %rax
cmpq -0x70(%rbp), %rax
jle 0x7d915
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0xf8(%rax), %rax
movq 0x20(%rax), %rax
movq (%rax), %rsi
movq -0x8(%rbp), %rax
movq 0xf8(%rax), %rax
movq 0x20(%rax), %rax
movl 0x8(%rax), %edx
callq 0x7da60
movl %eax, -0x74(%rbp)
cmpl $0x0, -0x74(%rbp)
jne 0x7d913
movq -0x8(%rbp), %rdx
movl $0x2, %edi
leaq 0x6bd0f(%rip), %rsi     # 0xe9614
leaq 0x6b726(%rip), %rcx     # 0xe9032
movb $0x0, %al
callq 0x79b10
jmp 0x7d915
jmp 0x7d917
movq -0x8(%rbp), %rax
movl (%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x7da53
cmpl $0x2, -0x24(%rbp)
jne 0x7da53
movq -0x8(%rbp), %rax
movl (%rax), %eax
andl $0x600, %eax            # imm = 0x600
cmpl $0x0, %eax
je 0x7da53
movq -0x8(%rbp), %rax
movl (%rax), %eax
andl $0x200, %eax            # imm = 0x200
cmpl $0x0, %eax
je 0x7d9fa
movq -0x8(%rbp), %rax
cmpq $0x0, 0x100(%rax)
je 0x7d9fa
movq -0x8(%rbp), %rax
movq 0x100(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0xf8(%rax), %rax
movq 0x158(%rax), %rax
movq 0x20(%rax), %rax
movq (%rax), %rsi
callq 0x1f890
cmpl $0x0, %eax
jne 0x7d9fa
movq -0x8(%rbp), %rax
movl 0x108(%rax), %eax
movq -0x8(%rbp), %rcx
movq 0xf8(%rcx), %rcx
movq 0x158(%rcx), %rcx
movq 0x20(%rcx), %rcx
cmpl 0x8(%rcx), %eax
jne 0x7d9fa
movq -0x8(%rbp), %rax
movl (%rax), %ecx
andl $0xfffffdff, %ecx       # imm = 0xFFFFFDFF
movl %ecx, (%rax)
movq -0x8(%rbp), %rax
movl (%rax), %ecx
orl $0x400, %ecx            # imm = 0x400
movl %ecx, (%rax)
movq -0x8(%rbp), %rdx
movl $0x2, %edi
leaq 0x6bc3a(%rip), %rsi     # 0xe9626
leaq 0x6b63f(%rip), %rcx     # 0xe9032
movb $0x0, %al
callq 0x79b10
movq -0x8(%rbp), %rax
movl (%rax), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0x7da51
movq -0x8(%rbp), %rax
cmpl $0x0, 0x10c(%rax)
jne 0x7da51
movq -0x8(%rbp), %rax
movl (%rax), %ecx
andl $0xfffffbff, %ecx       # imm = 0xFFFFFBFF
movl %ecx, (%rax)
movq -0x8(%rbp), %rax
movl (%rax), %ecx
orl $0x800, %ecx            # imm = 0x800
movl %ecx, (%rax)
movq -0x8(%rbp), %rdx
movl $0x2, %edi
leaq 0x6bbf8(%rip), %rsi     # 0xe963b
leaq 0x6b5e8(%rip), %rcx     # 0xe9032
movb $0x0, %al
callq 0x79b10
jmp 0x7da53
addq $0xa0, %rsp
popq %rbp
retq
nopl (%rax)