// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x20(%rbp), %rdi
callq 0x4b4b0
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x6, %eax
jne 0x60554
movl $0x0, -0x34(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
movl -0x34(%rbp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
leaq -0x40(%rbp), %rdx
callq 0x67a60
cmpb $0x0, %al
je 0x6054f
cmpq $0x0, -0x28(%rbp)
jne 0x60505
cmpq $0x40, -0x30(%rbp)
jle 0x60489
movl $0x40, %eax
movq %rax, -0x70(%rbp)
jmp 0x60491
movq -0x30(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
movl %eax, -0x44(%rbp)
movq -0x10(%rbp), %rdi
movl -0x44(%rbp), %edx
addl $0x2, %edx
movl $0x2a, %esi
callq 0x75eb0
cmpq $0x0, %rax
jne 0x604be
movl $0x0, -0x4(%rbp)
jmp 0x606ae
movq -0x10(%rbp), %rdi
leaq 0x84717(%rip), %rsi     # 0xe4be0
movl $0x4, %edx
callq 0x76050
cmpq $0x0, %rax
jne 0x604e5
movl $0x0, -0x4(%rbp)
jmp 0x606ae
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x60010
cmpl $0x0, %eax
jne 0x60503
movl $0x0, -0x4(%rbp)
jmp 0x606ae
jmp 0x60505
movq -0x10(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x76100
cmpq $0x0, %rax
jne 0x60524
movl $0x0, -0x4(%rbp)
jmp 0x606ae
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
cmpq $0x40, %rax
jne 0x6053e
movq $0x0, -0x28(%rbp)
movq -0x30(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x60448
jmp 0x606a7
movq -0x20(%rbp), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x2, %eax
jne 0x60683
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x241d0
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rdi
callq 0x24270
movq %rax, -0x58(%rbp)
cmpq $0x0, %rax
je 0x60678
movq -0x58(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x60632
cmpq $0x40, -0x30(%rbp)
jle 0x605b9
movl $0x40, %eax
movq %rax, -0x78(%rbp)
jmp 0x605c1
movq -0x30(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
movl %eax, -0x64(%rbp)
movq -0x10(%rbp), %rdi
movl -0x64(%rbp), %edx
addl $0x2, %edx
movl $0x2a, %esi
callq 0x75eb0
cmpq $0x0, %rax
jne 0x605ee
movl $0x0, -0x4(%rbp)
jmp 0x606ae
movq -0x10(%rbp), %rdi
leaq 0x845e7(%rip), %rsi     # 0xe4be0
movl $0x4, %edx
callq 0x76050
cmpq $0x0, %rax
jne 0x60615
movl $0x0, -0x4(%rbp)
jmp 0x606ae
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x60010
cmpl $0x0, %eax
jne 0x60630
movl $0x0, -0x4(%rbp)
jmp 0x606ae
jmp 0x60632
movq -0x10(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0x60010
cmpl $0x0, %eax
jne 0x6064d
movl $0x0, -0x4(%rbp)
jmp 0x606ae
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
cmpq $0x40, %rax
jne 0x60667
movq $0x0, -0x28(%rbp)
movq -0x30(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x6057a
movq -0x50(%rbp), %rdi
callq 0x243d0
jmp 0x606a5
leaq 0x824da(%rip), %rdi     # 0xe2b64
leaq 0x84044(%rip), %rsi     # 0xe46d5
movl $0x480, %edx            # imm = 0x480
callq 0x63d40
movl $0x1, %edi
callq 0x1f3b0
jmp 0x606a7
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
nopw (%rax,%rax)