// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/aof.c
// Function: rewriteSetObject
int rewriteSetObject(rio *r, robj *key, robj *o) {
    long long count = 0, items = setTypeSize(o);

    if (o->encoding == OBJ_ENCODING_INTSET) {
        int ii = 0;
        int64_t llval;

        while(intsetGet(o->ptr,ii++,&llval)) {
            if (count == 0) {
                int cmd_items = (items > AOF_REWRITE_ITEMS_PER_CMD) ?
                    AOF_REWRITE_ITEMS_PER_CMD : items;

                if (rioWriteBulkCount(r,'*',2+cmd_items) == 0) return 0;
                if (rioWriteBulkString(r,"SADD",4) == 0) return 0;
                if (rioWriteBulkObject(r,key) == 0) return 0;
            }
            if (rioWriteBulkLongLong(r,llval) == 0) return 0;
            if (++count == AOF_REWRITE_ITEMS_PER_CMD) count = 0;
            items--;
        }
    } else if (o->encoding == OBJ_ENCODING_HT) {
        dictIterator *di = dictGetIterator(o->ptr);
        dictEntry *de;

        while((de = dictNext(di)) != NULL) {
            robj *eleobj = dictGetKey(de);
            if (count == 0) {
                int cmd_items = (items > AOF_REWRITE_ITEMS_PER_CMD) ?
                    AOF_REWRITE_ITEMS_PER_CMD : items;

                if (rioWriteBulkCount(r,'*',2+cmd_items) == 0) return 0;
                if (rioWriteBulkString(r,"SADD",4) == 0) return 0;
                if (rioWriteBulkObject(r,key) == 0) return 0;
            }
            if (rioWriteBulkObject(r,eleobj) == 0) return 0;
            if (++count == AOF_REWRITE_ITEMS_PER_CMD) count = 0;
            items--;
        }
        dictReleaseIterator(di);
    } else {
        serverPanic("Unknown set encoding");
    }
    return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r12
movq %rsi, 0x8(%rsp)
movq %rdi, %r14
movq %rdx, %rdi
callq 0x461ae
movq %rax, %r15
movl (%r12), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x2, %eax
je 0x55174
cmpl $0x6, %eax
jne 0x55224
xorl %r13d, %r13d
leaq 0x10(%rsp), %rbp
xorl %ebx, %ebx
movq 0x8(%r12), %rdi
movl %r13d, %esi
movq %rbp, %rdx
callq 0x5a9c0
testb %al, %al
je 0x55210
testq %rbx, %rbx
jne 0x55143
cmpq $0x40, %r15
pushq $0x40
popq %rdx
cmovlq %r15, %rdx
addl $0x2, %edx
movq %r14, %rdi
pushq $0x2a
popq %rsi
callq 0x66bc1
testq %rax, %rax
je 0x55204
movq %r14, %rdi
leaq 0x6192e(%rip), %rsi     # 0xb6a4b
pushq $0x4
popq %rdx
callq 0x66c85
testq %rax, %rax
je 0x55204
movq %r14, %rdi
movq 0x8(%rsp), %rsi
callq 0x54ef3
testl %eax, %eax
je 0x55204
movq 0x10(%rsp), %rsi
movq %r14, %rdi
callq 0x66ced
testq %rax, %rax
je 0x55204
incq %rbx
cmpq $0x40, %rbx
movl $0x0, %eax
cmoveq %rax, %rbx
decq %r15
incl %r13d
jmp 0x550d4
movq 0x8(%r12), %rdi
callq 0x2a99f
movq %rax, %r12
xorl %ebx, %ebx
xorl %ebp, %ebp
movq %r12, %rdi
callq 0x2a9d3
testq %rax, %rax
je 0x55208
movq (%rax), %r13
testq %rbx, %rbx
jne 0x551e0
cmpq $0x40, %r15
pushq $0x40
popq %rdx
cmovlq %r15, %rdx
addl $0x2, %edx
movq %r14, %rdi
pushq $0x2a
popq %rsi
callq 0x66bc1
testq %rax, %rax
je 0x55213
movq %r14, %rdi
leaq 0x61889(%rip), %rsi     # 0xb6a4b
pushq $0x4
popq %rdx
callq 0x66c85
testq %rax, %rax
je 0x55213
movq %r14, %rdi
movq 0x8(%rsp), %rsi
callq 0x54ef3
testl %eax, %eax
je 0x55213
movq %r14, %rdi
movq %r13, %rsi
callq 0x54ef3
testl %eax, %eax
je 0x55204
incq %rbx
cmpq $0x40, %rbx
movl $0x0, %eax
cmoveq %rax, %rbx
decq %r15
jmp 0x55185
xorl %ebp, %ebp
jmp 0x55213
movq %r12, %rdi
callq 0x2aa94
pushq $0x1
popq %rbp
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5eeff(%rip), %rdi     # 0xb412a
leaq 0x61035(%rip), %rsi     # 0xb6267
movl $0x36e, %edx            # imm = 0x36E
callq 0x57b45
pushq $0x1
popq %rdi
callq 0x263c0