// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/src/t_zset.c
// Function: zunionInterGenericCommand
void zunionInterGenericCommand(redisClient *c, robj *dstkey, int op) {
    int i, j;
    long setnum;
    int aggregate = REDIS_AGGR_SUM;
    zsetopsrc *src;
    zsetopval zval;
    robj *tmp;
    unsigned int maxelelen = 0;
    robj *dstobj;
    zset *dstzset;
    zskiplistNode *znode;
    int touched = 0;

    /* expect setnum input keys to be given */
    // 取出要处理的有序集合的个数 setnum
    if ((getLongFromObjectOrReply(c, c->argv[2], &setnum, NULL) != REDIS_OK))
        return;

    if (setnum < 1) {
        addReplyError(c,
            "at least 1 input key is needed for ZUNIONSTORE/ZINTERSTORE");
        return;
    }

    /* test if the expected number of keys would overflow */
    // setnum 参数和传入的 key 数量不相同，出错
    if (setnum > c->argc-3) {
        addReply(c,shared.syntaxerr);
        return;
    }

    /* read keys to be used for input */
    // 为每个输入 key 创建一个迭代器
    src = zcalloc(sizeof(zsetopsrc) * setnum);
    for (i = 0, j = 3; i < setnum; i++, j++) {

        // 取出 key 对象
        robj *obj = lookupKeyWrite(c->db,c->argv[j]);

        // 创建迭代器
        if (obj != NULL) {
            if (obj->type != REDIS_ZSET && obj->type != REDIS_SET) {
                zfree(src);
                addReply(c,shared.wrongtypeerr);
                return;
            }

            src[i].subject = obj;
            src[i].type = obj->type;
            src[i].encoding = obj->encoding;

        // 不存在的对象设为 NULL
        } else {
            src[i].subject = NULL;
        }

        /* Default all weights to 1. */
        // 默认权重为 1.0
        src[i].weight = 1.0;
    }

    /* parse optional extra arguments */
    // 分析并读入可选参数
    if (j < c->argc) {
        int remaining = c->argc - j;

        while (remaining) {
            if (remaining >= (setnum + 1) && !strcasecmp(c->argv[j]->ptr,"weights")) {
                j++; remaining--;
                // 权重参数
                for (i = 0; i < setnum; i++, j++, remaining--) {
                    if (getDoubleFromObjectOrReply(c,c->argv[j],&src[i].weight,
                            "weight value is not a float") != REDIS_OK)
                    {
                        zfree(src);
                        return;
                    }
                }

            } else if (remaining >= 2 && !strcasecmp(c->argv[j]->ptr,"aggregate")) {
                j++; remaining--;
                // 聚合方式
                if (!strcasecmp(c->argv[j]->ptr,"sum")) {
                    aggregate = REDIS_AGGR_SUM;
                } else if (!strcasecmp(c->argv[j]->ptr,"min")) {
                    aggregate = REDIS_AGGR_MIN;
                } else if (!strcasecmp(c->argv[j]->ptr,"max")) {
                    aggregate = REDIS_AGGR_MAX;
                } else {
                    zfree(src);
                    addReply(c,shared.syntaxerr);
                    return;
                }
                j++; remaining--;

            } else {
                zfree(src);
                addReply(c,shared.syntaxerr);
                return;
            }
        }
    }

    /* sort sets from the smallest to largest, this will improve our
     * algorithm's performance */
    // 对所有集合进行排序，以减少算法的常数项
    qsort(src,setnum,sizeof(zsetopsrc),zuiCompareByCardinality);

    // 创建结果集对象
    dstobj = createZsetObject();
    dstzset = dstobj->ptr;
    memset(&zval, 0, sizeof(zval));

    // ZINTERSTORE 命令
    if (op == REDIS_OP_INTER) {

        /* Skip everything if the smallest input is empty. */
        // 只处理非空集合
        if (zuiLength(&src[0]) > 0) {

            /* Precondition: as src[0] is non-empty and the inputs are ordered
             * by size, all src[i > 0] are non-empty too. */
            // 遍历基数最小的 src[0] 集合
            zuiInitIterator(&src[0]);
            while (zuiNext(&src[0],&zval)) {
                double score, value;

                // 计算加权分值
                score = src[0].weight * zval.score;
                if (isnan(score)) score = 0;

                // 将 src[0] 集合中的元素和其他集合中的元素做加权聚合计算
                for (j = 1; j < setnum; j++) {
                    /* It is not safe to access the zset we are
                     * iterating, so explicitly check for equal object. */
                    // 如果当前迭代到的 src[j] 的对象和 src[0] 的对象一样，
                    // 那么 src[0] 出现的元素必然也出现在 src[j]
                    // 那么我们可以直接计算聚合值，
                    // 不必进行 zuiFind 去确保元素是否出现
                    // 这种情况在某个 key 输入了两次，
                    // 并且这个 key 是所有输入集合中基数最小的集合时会出现
                    if (src[j].subject == src[0].subject) {
                        value = zval.score*src[j].weight;
                        zunionInterAggregate(&score,value,aggregate);

                    // 如果能在其他集合找到当前迭代到的元素的话
                    // 那么进行聚合计算
                    } else if (zuiFind(&src[j],&zval,&value)) {
                        value *= src[j].weight;
                        zunionInterAggregate(&score,value,aggregate);

                    // 如果当前元素没出现在某个集合，那么跳出 for 循环
                    // 处理下个元素
                    } else {
                        break;
                    }
                }

                /* Only continue when present in every input. */
                // 只在交集元素出现时，才执行以下代码
                if (j == setnum) {
                    // 取出值对象
                    tmp = zuiObjectFromValue(&zval);
                    // 加入到有序集合中
                    znode = zslInsert(dstzset->zsl,score,tmp);
                    incrRefCount(tmp); /* added to skiplist */
                    // 加入到字典中
                    dictAdd(dstzset->dict,tmp,&znode->score);
                    incrRefCount(tmp); /* added to dictionary */

                    // 更新字符串对象的最大长度
                    if (sdsEncodedObject(tmp)) {
                        if (sdslen(tmp->ptr) > maxelelen)
                            maxelelen = sdslen(tmp->ptr);
                    }
                }
            }
            zuiClearIterator(&src[0]);
        }

    // ZUNIONSTORE
    } else if (op == REDIS_OP_UNION) {

        // 遍历所有输入集合
        for (i = 0; i < setnum; i++) {

            // 跳过空集合
            if (zuiLength(&src[i]) == 0)
                continue;

            // 遍历所有集合元素
            zuiInitIterator(&src[i]);
            while (zuiNext(&src[i],&zval)) {
                double score, value;

                /* Skip an element that when already processed */
                // 跳过已处理元素
                if (dictFind(dstzset->dict,zuiObjectFromValue(&zval)) != NULL)
                    continue;

                /* Initialize score */
                // 初始化分值
                score = src[i].weight * zval.score;
                // 溢出时设为 0
                if (isnan(score)) score = 0;

                /* We need to check only next sets to see if this element
                 * exists, since we process every element just one time so
                 * it can't exist in a previous set (otherwise it would be
                 * already processed). */
                for (j = (i+1); j < setnum; j++) {
                    /* It is not safe to access the zset we are
                     * iterating, so explicitly check for equal object. */
                    // 当前元素的集合和被迭代集合一样
                    // 所以同一个元素必然出现在 src[j] 和 src[i]
                    // 程序直接计算它们的聚合值
                    // 而不必使用 zuiFind 来检查元素是否存在
                    if(src[j].subject == src[i].subject) {
                        value = zval.score*src[j].weight;
                        zunionInterAggregate(&score,value,aggregate);

                    // 检查成员是否存在
                    } else if (zuiFind(&src[j],&zval,&value)) {
                        value *= src[j].weight;
                        zunionInterAggregate(&score,value,aggregate);
                    }
                }

                // 取出成员
                tmp = zuiObjectFromValue(&zval);
                // 插入并集元素到跳跃表
                znode = zslInsert(dstzset->zsl,score,tmp);
                incrRefCount(zval.ele); /* added to skiplist */
                // 添加元素到字典
                dictAdd(dstzset->dict,tmp,&znode->score);
                incrRefCount(zval.ele); /* added to dictionary */

                // 更新字符串最大长度
                if (sdsEncodedObject(tmp)) {
                    if (sdslen(tmp->ptr) > maxelelen)
                        maxelelen = sdslen(tmp->ptr);
                }
            }
            zuiClearIterator(&src[i]);
        }
    } else {
        redisPanic("Unknown operator");
    }

    // 删除已存在的 dstkey ，等待后面用新对象代替它
    if (dbDelete(c->db,dstkey)) {
        signalModifiedKey(c->db,dstkey);
        touched = 1;
        server.dirty++;
    }

    // 如果结果集合的长度不为 0 
    if (dstzset->zsl->length) {
        /* Convert to ziplist when in limits. */
        // 看是否需要对结果集合进行编码转换
        if (dstzset->zsl->length <= server.zset_max_ziplist_entries &&
            maxelelen <= server.zset_max_ziplist_value)
                zsetConvert(dstobj,REDIS_ENCODING_ZIPLIST);

        // 将结果集合关联到数据库
        dbAdd(c->db,dstkey,dstobj);

        // 回复结果集合的长度
        addReplyLongLong(c,zsetLength(dstobj));

        if (!touched) signalModifiedKey(c->db,dstkey);

        notifyKeyspaceEvent(REDIS_NOTIFY_ZSET,
            (op == REDIS_OP_UNION) ? "zunionstore" : "zinterstore",
            dstkey,c->db->id);

        server.dirty++;

    // 结果集为空
    } else {

        decrRefCount(dstobj);

        addReply(c,shared.czero);

        if (touched)
            notifyKeyspaceEvent(REDIS_NOTIFY_GENERIC,"del",dstkey,c->db->id);
    }

    zfree(src);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl $0x1, -0x2c(%rbp)
movl $0x0, -0x94(%rbp)
movl $0x0, -0xb4(%rbp)
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movq 0x10(%rax), %rsi
leaq -0x28(%rbp), %rdx
xorl %eax, %eax
movl %eax, %ecx
callq 0x3b960
cmpl $0x0, %eax
je 0x523c8
jmp 0x52ed2
cmpq $0x1, -0x28(%rbp)
jge 0x523e4
movq -0x8(%rbp), %rdi
leaq 0x9115f(%rip), %rsi     # 0xe3539
callq 0x35d40
jmp 0x52ed2
movq -0x28(%rbp), %rax
movq -0x8(%rbp), %rcx
movl 0x30(%rcx), %ecx
subl $0x3, %ecx
movslq %ecx, %rcx
cmpq %rcx, %rax
jle 0x52416
movq -0x8(%rbp), %rdi
leaq 0xc1d4b(%rip), %rax     # 0x114150
movq 0x80(%rax), %rsi
callq 0x35a70
jmp 0x52ed2
imulq $0x30, -0x28(%rbp), %rdi
callq 0x2e1d0
movq %rax, -0x38(%rbp)
movl $0x0, -0x18(%rbp)
movl $0x3, -0x1c(%rbp)
movslq -0x18(%rbp), %rax
cmpq -0x28(%rbp), %rax
jge 0x52559
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x3c090
movq %rax, -0xc0(%rbp)
cmpq $0x0, -0xc0(%rbp)
je 0x52510
movq -0xc0(%rbp), %rax
movl (%rax), %eax
andl $0xf, %eax
cmpl $0x3, %eax
je 0x524b6
movq -0xc0(%rbp), %rax
movl (%rax), %eax
andl $0xf, %eax
cmpl $0x2, %eax
je 0x524b6
movq -0x38(%rbp), %rdi
callq 0x2e3a0
movq -0x8(%rbp), %rdi
leaq 0xc1ca8(%rip), %rax     # 0x114150
movq 0x70(%rax), %rsi
callq 0x35a70
jmp 0x52ed2
movq -0xc0(%rbp), %rcx
movq -0x38(%rbp), %rax
movslq -0x18(%rbp), %rdx
imulq $0x30, %rdx, %rdx
addq %rdx, %rax
movq %rcx, (%rax)
movq -0xc0(%rbp), %rax
movl (%rax), %ecx
andl $0xf, %ecx
movq -0x38(%rbp), %rax
movslq -0x18(%rbp), %rdx
imulq $0x30, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x8(%rax)
movq -0xc0(%rbp), %rax
movl (%rax), %ecx
shrl $0x4, %ecx
andl $0xf, %ecx
movq -0x38(%rbp), %rax
movslq -0x18(%rbp), %rdx
imulq $0x30, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0xc(%rax)
jmp 0x52526
movq -0x38(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq $0x0, (%rax)
movq -0x38(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movsd 0x8bc9b(%rip), %xmm0    # 0xde1d8
movsd %xmm0, 0x10(%rax)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x52432
movl -0x1c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x30(%rcx), %eax
jge 0x527ac
movq -0x8(%rbp), %rax
movl 0x30(%rax), %eax
subl -0x1c(%rbp), %eax
movl %eax, -0xc4(%rbp)
cmpl $0x0, -0xc4(%rbp)
je 0x527aa
movslq -0xc4(%rbp), %rax
movq -0x28(%rbp), %rcx
addq $0x1, %rcx
cmpq %rcx, %rax
jl 0x52660
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rdi
leaq 0x90fbb(%rip), %rsi     # 0xe3574
callq 0x1f2f0
cmpl $0x0, %eax
jne 0x52660
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movl -0xc4(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0xc4(%rbp)
movl $0x0, -0x18(%rbp)
movslq -0x18(%rbp), %rax
cmpq -0x28(%rbp), %rax
jge 0x5265b
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
movq -0x38(%rbp), %rdx
movslq -0x18(%rbp), %rax
imulq $0x30, %rax, %rax
addq %rax, %rdx
addq $0x10, %rdx
leaq 0x90f5e(%rip), %rcx     # 0xe357c
callq 0x3b520
cmpl $0x0, %eax
je 0x52636
movq -0x38(%rbp), %rdi
callq 0x2e3a0
jmp 0x52ed2
jmp 0x52638
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movl -0xc4(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0xc4(%rbp)
jmp 0x525e6
jmp 0x527a5
cmpl $0x2, -0xc4(%rbp)
jl 0x5277e
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rdi
leaq 0x90f10(%rip), %rsi     # 0xe3598
callq 0x1f2f0
cmpl $0x0, %eax
jne 0x5277e
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movl -0xc4(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0xc4(%rbp)
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rdi
leaq 0x91590(%rip), %rsi     # 0xe3c59
callq 0x1f2f0
cmpl $0x0, %eax
jne 0x526df
movl $0x1, -0x2c(%rbp)
jmp 0x52764
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rdi
leaq 0x90ea8(%rip), %rsi     # 0xe35a2
callq 0x1f2f0
cmpl $0x0, %eax
jne 0x5270d
movl $0x2, -0x2c(%rbp)
jmp 0x52762
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rdi
leaq 0x9baf3(%rip), %rsi     # 0xee21b
callq 0x1f2f0
cmpl $0x0, %eax
jne 0x5273b
movl $0x3, -0x2c(%rbp)
jmp 0x52760
movq -0x38(%rbp), %rdi
callq 0x2e3a0
movq -0x8(%rbp), %rdi
leaq 0xc1a01(%rip), %rax     # 0x114150
movq 0x80(%rax), %rsi
callq 0x35a70
jmp 0x52ed2
jmp 0x52762
jmp 0x52764
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movl -0xc4(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0xc4(%rbp)
jmp 0x527a3
movq -0x38(%rbp), %rdi
callq 0x2e3a0
movq -0x8(%rbp), %rdi
leaq 0xc19be(%rip), %rax     # 0x114150
movq 0x80(%rax), %rsi
callq 0x35a70
jmp 0x52ed2
jmp 0x527a5
jmp 0x52579
jmp 0x527ac
movq -0x38(%rbp), %rdi
movq -0x28(%rbp), %rsi
movl $0x30, %edx
leaq -0x490(%rip), %rcx      # 0x52330
callq 0x1f830
callq 0x3a7a0
movq %rax, -0xa0(%rbp)
movq -0xa0(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0xa8(%rbp)
leaq -0x88(%rbp), %rdi
xorl %esi, %esi
movl $0x50, %edx
callq 0x1f110
cmpl $0x2, -0x14(%rbp)
jne 0x52a3c
movq -0x38(%rbp), %rdi
callq 0x519b0
cmpl $0x0, %eax
jle 0x52a37
movq -0x38(%rbp), %rdi
callq 0x516a0
movq -0x38(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x51b00
cmpl $0x0, %eax
je 0x52a2e
movq -0x38(%rbp), %rax
movsd 0x10(%rax), %xmm0
mulsd -0x40(%rbp), %xmm0
movsd %xmm0, -0xd0(%rbp)
movsd -0xd0(%rbp), %xmm0
ucomisd %xmm0, %xmm0
setp %al
testb $0x1, %al
jne 0x5285f
jmp 0x5286a
xorps %xmm0, %xmm0
movsd %xmm0, -0xd0(%rbp)
movl $0x1, -0x1c(%rbp)
movslq -0x1c(%rbp), %rax
cmpq -0x28(%rbp), %rax
jge 0x5294c
movq -0x38(%rbp), %rax
movslq -0x1c(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq -0x38(%rbp), %rcx
cmpq (%rcx), %rax
jne 0x528d4
movsd -0x40(%rbp), %xmm0
movq -0x38(%rbp), %rax
movslq -0x1c(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
mulsd 0x10(%rax), %xmm0
movsd %xmm0, -0xd8(%rbp)
movsd -0xd8(%rbp), %xmm0
movl -0x2c(%rbp), %esi
leaq -0xd0(%rbp), %rdi
callq 0x52ee0
jmp 0x5293c
movq -0x38(%rbp), %rdi
movslq -0x1c(%rbp), %rax
imulq $0x30, %rax, %rax
addq %rax, %rdi
leaq -0x88(%rbp), %rsi
leaq -0xd8(%rbp), %rdx
callq 0x52110
cmpl $0x0, %eax
je 0x52938
movq -0x38(%rbp), %rax
movslq -0x1c(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movsd 0x10(%rax), %xmm0
mulsd -0xd8(%rbp), %xmm0
movsd %xmm0, -0xd8(%rbp)
movsd -0xd8(%rbp), %xmm0
movl -0x2c(%rbp), %esi
leaq -0xd0(%rbp), %rdi
callq 0x52ee0
jmp 0x5293a
jmp 0x5294c
jmp 0x5293c
jmp 0x5293e
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x52871
movslq -0x1c(%rbp), %rax
cmpq -0x28(%rbp), %rax
jne 0x52a29
leaq -0x88(%rbp), %rdi
callq 0x51f50
movq %rax, -0x90(%rbp)
movq -0xa8(%rbp), %rax
movq 0x8(%rax), %rdi
movsd -0xd0(%rbp), %xmm0
movq -0x90(%rbp), %rsi
callq 0x4d210
movq %rax, -0xb0(%rbp)
movq -0x90(%rbp), %rdi
callq 0x3a3f0
movq -0xa8(%rbp), %rax
movq (%rax), %rdi
movq -0x90(%rbp), %rsi
movq -0xb0(%rbp), %rdx
addq $0x8, %rdx
callq 0x236d0
movq -0x90(%rbp), %rdi
callq 0x3a3f0
movq -0x90(%rbp), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x0, %eax
je 0x529f4
movq -0x90(%rbp), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x8, %eax
jne 0x52a27
movq -0x90(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x4cfd0
movl -0x94(%rbp), %ecx
cmpq %rcx, %rax
jbe 0x52a25
movq -0x90(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x4cfd0
movl %eax, -0x94(%rbp)
jmp 0x52a27
jmp 0x52a29
jmp 0x5281b
movq -0x38(%rbp), %rdi
callq 0x518b0
jmp 0x52d25
cmpl $0x0, -0x14(%rbp)
jne 0x52d01
movl $0x0, -0x18(%rbp)
movslq -0x18(%rbp), %rax
cmpq -0x28(%rbp), %rax
jge 0x52cff
movq -0x38(%rbp), %rdi
movslq -0x18(%rbp), %rax
imulq $0x30, %rax, %rax
addq %rax, %rdi
callq 0x519b0
cmpl $0x0, %eax
jne 0x52a79
jmp 0x52cf1
movq -0x38(%rbp), %rdi
movslq -0x18(%rbp), %rax
imulq $0x30, %rax, %rax
addq %rax, %rdi
callq 0x516a0
movq -0x38(%rbp), %rdi
movslq -0x18(%rbp), %rax
imulq $0x30, %rax, %rax
addq %rax, %rdi
leaq -0x88(%rbp), %rsi
callq 0x51b00
cmpl $0x0, %eax
je 0x52cdd
movq -0xa8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0xf0(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x51f50
movq -0xf0(%rbp), %rdi
movq %rax, %rsi
callq 0x23aa0
cmpq $0x0, %rax
je 0x52ae5
jmp 0x52a8d
movq -0x38(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movsd 0x10(%rax), %xmm0
mulsd -0x40(%rbp), %xmm0
movsd %xmm0, -0xe0(%rbp)
movsd -0xe0(%rbp), %xmm0
ucomisd %xmm0, %xmm0
setp %al
testb $0x1, %al
jne 0x52b1b
jmp 0x52b26
xorps %xmm0, %xmm0
movsd %xmm0, -0xe0(%rbp)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movslq -0x1c(%rbp), %rax
cmpq -0x28(%rbp), %rax
jge 0x52c11
movq -0x38(%rbp), %rax
movslq -0x1c(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq -0x38(%rbp), %rcx
movslq -0x18(%rbp), %rdx
imulq $0x30, %rdx, %rdx
addq %rdx, %rcx
cmpq (%rcx), %rax
jne 0x52b9d
movsd -0x40(%rbp), %xmm0
movq -0x38(%rbp), %rax
movslq -0x1c(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
mulsd 0x10(%rax), %xmm0
movsd %xmm0, -0xe8(%rbp)
movsd -0xe8(%rbp), %xmm0
movl -0x2c(%rbp), %esi
leaq -0xe0(%rbp), %rdi
callq 0x52ee0
jmp 0x52c01
movq -0x38(%rbp), %rdi
movslq -0x1c(%rbp), %rax
imulq $0x30, %rax, %rax
addq %rax, %rdi
leaq -0x88(%rbp), %rsi
leaq -0xe8(%rbp), %rdx
callq 0x52110
cmpl $0x0, %eax
je 0x52bff
movq -0x38(%rbp), %rax
movslq -0x1c(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movsd 0x10(%rax), %xmm0
mulsd -0xe8(%rbp), %xmm0
movsd %xmm0, -0xe8(%rbp)
movsd -0xe8(%rbp), %xmm0
movl -0x2c(%rbp), %esi
leaq -0xe0(%rbp), %rdi
callq 0x52ee0
jmp 0x52c01
jmp 0x52c03
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x52b2f
leaq -0x88(%rbp), %rdi
callq 0x51f50
movq %rax, -0x90(%rbp)
movq -0xa8(%rbp), %rax
movq 0x8(%rax), %rdi
movsd -0xe0(%rbp), %xmm0
movq -0x90(%rbp), %rsi
callq 0x4d210
movq %rax, -0xb0(%rbp)
movq -0x60(%rbp), %rdi
callq 0x3a3f0
movq -0xa8(%rbp), %rax
movq (%rax), %rdi
movq -0x90(%rbp), %rsi
movq -0xb0(%rbp), %rdx
addq $0x8, %rdx
callq 0x236d0
movq -0x60(%rbp), %rdi
callq 0x3a3f0
movq -0x90(%rbp), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x0, %eax
je 0x52ca5
movq -0x90(%rbp), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x8, %eax
jne 0x52cd8
movq -0x90(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x4cfd0
movl -0x94(%rbp), %ecx
cmpq %rcx, %rax
jbe 0x52cd6
movq -0x90(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x4cfd0
movl %eax, -0x94(%rbp)
jmp 0x52cd8
jmp 0x52a8d
movq -0x38(%rbp), %rdi
movslq -0x18(%rbp), %rax
imulq $0x30, %rax, %rax
addq %rax, %rdi
callq 0x518b0
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x52a4d
jmp 0x52d23
leaq 0x9089e(%rip), %rdi     # 0xe35a6
leaq 0x9057f(%rip), %rsi     # 0xe328e
movl $0xb66, %edx            # imm = 0xB66
callq 0x63d40
movl $0x1, %edi
callq 0x1f3b0
jmp 0x52d25
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x10(%rbp), %rsi
callq 0x3c4f0
cmpl $0x0, %eax
je 0x52d76
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x10(%rbp), %rsi
callq 0x3c3d0
movl $0x1, -0xb4(%rbp)
leaq 0xc0b9b(%rip), %rax     # 0x1138f8
movq 0x560(%rax), %rcx
addq $0x1, %rcx
leaq 0xc0b89(%rip), %rax     # 0x1138f8
movq %rcx, 0x560(%rax)
movq -0xa8(%rbp), %rax
movq 0x8(%rax), %rax
cmpq $0x0, 0x10(%rax)
je 0x52e7e
movq -0xa8(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x10(%rax), %rax
leaq 0xc0b56(%rip), %rcx     # 0x1138f8
cmpq 0x780(%rcx), %rax
ja 0x52dd2
movl -0x94(%rbp), %eax
leaq 0xc0b40(%rip), %rcx     # 0x1138f8
cmpq 0x788(%rcx), %rax
ja 0x52dd2
movq -0xa0(%rbp), %rdi
movl $0x5, %esi
callq 0x50110
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x10(%rbp), %rsi
movq -0xa0(%rbp), %rdx
callq 0x3c160
movq -0x8(%rbp), %rax
movq %rax, -0xf8(%rbp)
movq -0xa0(%rbp), %rdi
callq 0x50080
movq -0xf8(%rbp), %rdi
movl %eax, %eax
movl %eax, %esi
callq 0x36480
cmpl $0x0, -0xb4(%rbp)
jne 0x52e2b
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x10(%rbp), %rsi
callq 0x3c3d0
movl -0x14(%rbp), %ecx
leaq 0x8b613(%rip), %rsi     # 0xde448
leaq 0x8b600(%rip), %rax     # 0xde43c
cmpl $0x0, %ecx
cmoveq %rax, %rsi
movq -0x10(%rbp), %rdx
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movl 0x30(%rax), %ecx
movl $0x80, %edi
callq 0x814a0
leaq 0xc0a95(%rip), %rax     # 0x1138f8
movq 0x560(%rax), %rcx
addq $0x1, %rcx
leaq 0xc0a83(%rip), %rax     # 0x1138f8
movq %rcx, 0x560(%rax)
jmp 0x52ec9
movq -0xa0(%rbp), %rdi
callq 0x3aaa0
movq -0x8(%rbp), %rdi
leaq 0xc12bb(%rip), %rax     # 0x114150
movq 0x20(%rax), %rsi
callq 0x35a70
cmpl $0x0, -0xb4(%rbp)
je 0x52ec7
movq -0x10(%rbp), %rdx
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movl 0x30(%rax), %ecx
movl $0x4, %edi
leaq 0x8b643(%rip), %rsi     # 0xde505
callq 0x814a0
jmp 0x52ec9
movq -0x38(%rbp), %rdi
callq 0x2e3a0
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
nopl (%rax,%rax)