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

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

        while(intsetGet(o->ptr,ii++,&llval)) {
            if (count == 0) {
                int cmd_items = (items > REDIS_AOF_REWRITE_ITEMS_PER_CMD) ?
                    REDIS_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 == REDIS_AOF_REWRITE_ITEMS_PER_CMD) count = 0;
            items--;
        }
    } else if (o->encoding == REDIS_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 > REDIS_AOF_REWRITE_ITEMS_PER_CMD) ?
                    REDIS_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 == REDIS_AOF_REWRITE_ITEMS_PER_CMD) count = 0;
            items--;
        }
        dictReleaseIterator(di);
    } else {
        redisPanic("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 0x3bb8a
movq %rax, %r15
movl (%r12), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x2, %eax
je 0x4a848
cmpl $0x6, %eax
jne 0x4a91f
movq 0x8(%r12), %rdi
leaq 0x10(%rsp), %rdx
xorl %esi, %esi
callq 0x4f9dc
testb %al, %al
je 0x4a907
movl $0x1, %ebp
xorl %ebx, %ebx
testq %rbx, %rbx
jne 0x4a7fa
cmpq $0x40, %r15
movl $0x40, %edx
cmovlq %r15, %rdx
addl $0x2, %edx
movq %r14, %rdi
movl $0x2a, %esi
callq 0x58eae
testq %rax, %rax
je 0x4a90e
movl $0x4, %edx
movq %r14, %rdi
leaq 0x5033d(%rip), %rsi     # 0x9ab14
callq 0x58f52
testq %rax, %rax
je 0x4a90e
movq %r14, %rdi
movq 0x8(%rsp), %rsi
callq 0x4a4c3
testl %eax, %eax
je 0x4a90e
movq 0x10(%rsp), %rsi
movq %r14, %rdi
callq 0x59069
testq %rax, %rax
je 0x4a90e
incq %rbx
cmpq $0x40, %rbx
movl $0x0, %eax
cmoveq %rax, %rbx
decq %r15
movq 0x8(%r12), %rdi
leal 0x1(%rbp), %r13d
movl %ebp, %esi
leaq 0x10(%rsp), %rdx
callq 0x4f9dc
movl %r13d, %ebp
testb %al, %al
jne 0x4a79d
jmp 0x4a907
movq 0x8(%r12), %rdi
callq 0x228b5
movq %rax, %r12
xorl %ebx, %ebx
movq %r12, %rdi
callq 0x22913
movq %rax, %rbp
testq %rax, %rax
je 0x4a8f8
movq (%rbp), %r13
testq %rbx, %rbx
je 0x4a89a
movq %r14, %rdi
movq %r13, %rsi
callq 0x4a4c3
testl %eax, %eax
je 0x4a8ec
incq %rbx
cmpq $0x40, %rbx
movl $0x0, %eax
cmoveq %rax, %rbx
decq %r15
movb $0x1, %al
jmp 0x4a8ee
cmpq $0x40, %r15
movl $0x40, %edx
cmovlq %r15, %rdx
addl $0x2, %edx
movq %r14, %rdi
movl $0x2a, %esi
callq 0x58eae
testq %rax, %rax
je 0x4a8e6
movl $0x4, %edx
movq %r14, %rdi
leaq 0x50249(%rip), %rsi     # 0x9ab14
callq 0x58f52
testq %rax, %rax
je 0x4a8e6
movq %r14, %rdi
movq 0x8(%rsp), %rsi
callq 0x4a4c3
testl %eax, %eax
jne 0x4a874
xorl %eax, %eax
xorl %ebx, %ebx
jmp 0x4a8ee
xorl %eax, %eax
testb %al, %al
jne 0x4a857
jmp 0x4a900
movq %r12, %rdi
callq 0x229b9
xorl %eax, %eax
testq %rbp, %rbp
jne 0x4a910
movl $0x1, %eax
jmp 0x4a910
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4e176(%rip), %rdi     # 0x98a9c
leaq 0x4fcdc(%rip), %rsi     # 0x9a609
movl $0x480, %edx            # imm = 0x480
callq 0x4d0e5
movl $0x1, %edi
callq 0x1f3b0