// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/src/rdb.c
// Function: rdbSaveObject
ssize_t rdbSaveObject(rio *rdb, robj *o) {
    ssize_t n = 0, nwritten = 0;

    if (o->type == OBJ_STRING) {
        /* Save a string value */
        if ((n = rdbSaveStringObject(rdb,o)) == -1) return -1;
        nwritten += n;
    } else if (o->type == OBJ_LIST) {
        /* Save a list value */
        if (o->encoding == OBJ_ENCODING_QUICKLIST) {
            quicklist *ql = o->ptr;
            quicklistNode *node = ql->head;

            if ((n = rdbSaveLen(rdb,ql->len)) == -1) return -1;
            nwritten += n;

            do {
                if (quicklistNodeIsCompressed(node)) {
                    void *data;
                    size_t compress_len = quicklistGetLzf(node, &data);
                    if ((n = rdbSaveLzfBlob(rdb,data,compress_len,node->sz)) == -1) return -1;
                    nwritten += n;
                } else {
                    if ((n = rdbSaveRawString(rdb,node->zl,node->sz)) == -1) return -1;
                    nwritten += n;
                }
            } while ((node = node->next));
        } else {
            serverPanic("Unknown list encoding");
        }
    } else if (o->type == OBJ_SET) {
        /* Save a set value */
        if (o->encoding == OBJ_ENCODING_HT) {
            dict *set = o->ptr;
            dictIterator *di = dictGetIterator(set);
            dictEntry *de;

            if ((n = rdbSaveLen(rdb,dictSize(set))) == -1) return -1;
            nwritten += n;

            while((de = dictNext(di)) != NULL) {
                robj *eleobj = dictGetKey(de);
                if ((n = rdbSaveStringObject(rdb,eleobj)) == -1) return -1;
                nwritten += n;
            }
            dictReleaseIterator(di);
        } else if (o->encoding == OBJ_ENCODING_INTSET) {
            size_t l = intsetBlobLen((intset*)o->ptr);

            if ((n = rdbSaveRawString(rdb,o->ptr,l)) == -1) return -1;
            nwritten += n;
        } else {
            serverPanic("Unknown set encoding");
        }
    } else if (o->type == OBJ_ZSET) {
        /* Save a sorted set value */
        if (o->encoding == OBJ_ENCODING_ZIPLIST) {
            size_t l = ziplistBlobLen((unsigned char*)o->ptr);

            if ((n = rdbSaveRawString(rdb,o->ptr,l)) == -1) return -1;
            nwritten += n;
        } else if (o->encoding == OBJ_ENCODING_SKIPLIST) {
            zset *zs = o->ptr;
            dictIterator *di = dictGetIterator(zs->dict);
            dictEntry *de;

            if ((n = rdbSaveLen(rdb,dictSize(zs->dict))) == -1) return -1;
            nwritten += n;

            while((de = dictNext(di)) != NULL) {
                robj *eleobj = dictGetKey(de);
                double *score = dictGetVal(de);

                if ((n = rdbSaveStringObject(rdb,eleobj)) == -1) return -1;
                nwritten += n;
                if ((n = rdbSaveDoubleValue(rdb,*score)) == -1) return -1;
                nwritten += n;
            }
            dictReleaseIterator(di);
        } else {
            serverPanic("Unknown sorted set encoding");
        }
    } else if (o->type == OBJ_HASH) {
        /* Save a hash value */
        if (o->encoding == OBJ_ENCODING_ZIPLIST) {
            size_t l = ziplistBlobLen((unsigned char*)o->ptr);

            if ((n = rdbSaveRawString(rdb,o->ptr,l)) == -1) return -1;
            nwritten += n;

        } else if (o->encoding == OBJ_ENCODING_HT) {
            dictIterator *di = dictGetIterator(o->ptr);
            dictEntry *de;

            if ((n = rdbSaveLen(rdb,dictSize((dict*)o->ptr))) == -1) return -1;
            nwritten += n;

            while((de = dictNext(di)) != NULL) {
                robj *key = dictGetKey(de);
                robj *val = dictGetVal(de);

                if ((n = rdbSaveStringObject(rdb,key)) == -1) return -1;
                nwritten += n;
                if ((n = rdbSaveStringObject(rdb,val)) == -1) return -1;
                nwritten += n;
            }
            dictReleaseIterator(di);

        } else {
            serverPanic("Unknown hash encoding");
        }

    } else {
        serverPanic("Unknown object type");
    }
    return nwritten;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x18(%rbp), %rax
movl (%rax), %eax
andl $0xf, %eax
cmpl $0x0, %eax
jne 0x54128
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x53910
cltq
movq %rax, -0x20(%rbp)
cmpq $-0x1, %rax
jne 0x54117
movq $-0x1, -0x8(%rbp)
jmp 0x547af
movq -0x20(%rbp), %rax
addq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x547a7
movq -0x18(%rbp), %rax
movl (%rax), %eax
andl $0xf, %eax
cmpl $0x1, %eax
jne 0x5427b
movq -0x18(%rbp), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x9, %eax
jne 0x54254
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rax
movl 0x18(%rax), %esi
callq 0x52e00
cltq
movq %rax, -0x20(%rbp)
cmpq $-0x1, %rax
jne 0x5418f
movq $-0x1, -0x8(%rbp)
jmp 0x547af
movq -0x20(%rbp), %rax
addq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x38(%rbp), %rax
movl 0x1c(%rax), %eax
shrl $0x10, %eax
andl $0x3, %eax
cmpl $0x2, %eax
jne 0x541fd
movq -0x38(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x27b20
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq -0x38(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, %ecx
callq 0x533a0
movq %rax, -0x20(%rbp)
cmpq $-0x1, %rax
jne 0x541ef
movq $-0x1, -0x8(%rbp)
jmp 0x547af
movq -0x20(%rbp), %rax
addq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x5423a
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x38(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, %edx
callq 0x536d0
movq %rax, -0x20(%rbp)
cmpq $-0x1, %rax
jne 0x5422e
movq $-0x1, -0x8(%rbp)
jmp 0x547af
movq -0x20(%rbp), %rax
addq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x5423c
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
jne 0x5419b
jmp 0x54276
leaq 0xe8f8a(%rip), %rdi     # 0x13d1e5
leaq 0xe8f3f(%rip), %rsi     # 0x13d1a1
movl $0x257, %edx            # imm = 0x257
callq 0x76d80
movl $0x1, %edi
callq 0x263c0
jmp 0x547a5
movq -0x18(%rbp), %rax
movl (%rax), %eax
andl $0xf, %eax
cmpl $0x2, %eax
jne 0x543e0
movq -0x18(%rbp), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x2, %eax
jne 0x5435b
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rdi
callq 0x2e400
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rdi
movq -0x50(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x50(%rbp), %rcx
addq 0x48(%rcx), %rax
movl %eax, %esi
callq 0x52e00
cltq
movq %rax, -0x20(%rbp)
cmpq $-0x1, %rax
jne 0x542ef
movq $-0x1, -0x8(%rbp)
jmp 0x547af
movq -0x20(%rbp), %rax
addq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x58(%rbp), %rdi
callq 0x2e4a0
movq %rax, -0x60(%rbp)
cmpq $0x0, %rax
je 0x5434d
movq -0x60(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x68(%rbp)
movq -0x10(%rbp), %rdi
movq -0x68(%rbp), %rsi
callq 0x53910
cltq
movq %rax, -0x20(%rbp)
cmpq $-0x1, %rax
jne 0x5433f
movq $-0x1, -0x8(%rbp)
jmp 0x547af
movq -0x20(%rbp), %rax
addq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x542fb
movq -0x58(%rbp), %rdi
callq 0x2e600
jmp 0x543db
movq -0x18(%rbp), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x6, %eax
jne 0x543b7
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x7ba40
movq %rax, -0x70(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x70(%rbp), %rdx
callq 0x536d0
movq %rax, -0x20(%rbp)
cmpq $-0x1, %rax
jne 0x543a9
movq $-0x1, -0x8(%rbp)
jmp 0x547af
movq -0x20(%rbp), %rax
addq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x543d9
leaq 0xe8e3f(%rip), %rdi     # 0x13d1fd
leaq 0xe8ddc(%rip), %rsi     # 0x13d1a1
movl $0x26f, %edx            # imm = 0x26F
callq 0x76d80
movl $0x1, %edi
callq 0x263c0
jmp 0x543db
jmp 0x547a3
movq -0x18(%rbp), %rax
movl (%rax), %eax
andl $0xf, %eax
cmpl $0x3, %eax
jne 0x545b5
movq -0x18(%rbp), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x5, %eax
jne 0x54451
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x41a50
movq %rax, -0x78(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x78(%rbp), %rdx
callq 0x536d0
movq %rax, -0x20(%rbp)
cmpq $-0x1, %rax
jne 0x54440
movq $-0x1, -0x8(%rbp)
jmp 0x547af
movq -0x20(%rbp), %rax
addq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x545b0
movq -0x18(%rbp), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x7, %eax
jne 0x5458c
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rax
movq (%rax), %rdi
callq 0x2e400
movq %rax, -0x88(%rbp)
movq -0x10(%rbp), %rdi
movq -0x80(%rbp), %rax
movq (%rax), %rax
movq 0x28(%rax), %rax
movq -0x80(%rbp), %rcx
movq (%rcx), %rcx
addq 0x48(%rcx), %rax
movl %eax, %esi
callq 0x52e00
cltq
movq %rax, -0x20(%rbp)
cmpq $-0x1, %rax
jne 0x544bf
movq $-0x1, -0x8(%rbp)
jmp 0x547af
movq -0x20(%rbp), %rax
addq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x88(%rbp), %rdi
callq 0x2e4a0
movq %rax, -0x90(%rbp)
cmpq $0x0, %rax
je 0x5457e
movq -0x90(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x98(%rbp)
movq -0x90(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0xa0(%rbp)
movq -0x10(%rbp), %rdi
movq -0x98(%rbp), %rsi
callq 0x53910
cltq
movq %rax, -0x20(%rbp)
cmpq $-0x1, %rax
jne 0x54534
movq $-0x1, -0x8(%rbp)
jmp 0x547af
movq -0x20(%rbp), %rax
addq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rdi
movq -0xa0(%rbp), %rax
movsd (%rax), %xmm0
callq 0x53c20
cltq
movq %rax, -0x20(%rbp)
cmpq $-0x1, %rax
jne 0x5456d
movq $-0x1, -0x8(%rbp)
jmp 0x547af
movq -0x20(%rbp), %rax
addq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x544cb
movq -0x88(%rbp), %rdi
callq 0x2e600
jmp 0x545ae
leaq 0xe7157(%rip), %rdi     # 0x13b6ea
leaq 0xe8c07(%rip), %rsi     # 0x13d1a1
movl $0x28b, %edx            # imm = 0x28B
callq 0x76d80
movl $0x1, %edi
callq 0x263c0
jmp 0x545b0
jmp 0x547a1
movq -0x18(%rbp), %rax
movl (%rax), %eax
andl $0xf, %eax
cmpl $0x4, %eax
jne 0x5477d
movq -0x18(%rbp), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x5, %eax
jne 0x5462c
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x41a50
movq %rax, -0xa8(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0xa8(%rbp), %rdx
callq 0x536d0
movq %rax, -0x20(%rbp)
cmpq $-0x1, %rax
jne 0x5461b
movq $-0x1, -0x8(%rbp)
jmp 0x547af
movq -0x20(%rbp), %rax
addq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x5477b
movq -0x18(%rbp), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x2, %eax
jne 0x54757
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x2e400
movq %rax, -0xb0(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x28(%rax), %rax
movq -0x18(%rbp), %rcx
movq 0x8(%rcx), %rcx
addq 0x48(%rcx), %rax
movl %eax, %esi
callq 0x52e00
cltq
movq %rax, -0x20(%rbp)
cmpq $-0x1, %rax
jne 0x54691
movq $-0x1, -0x8(%rbp)
jmp 0x547af
movq -0x20(%rbp), %rax
addq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0xb0(%rbp), %rdi
callq 0x2e4a0
movq %rax, -0xb8(%rbp)
cmpq $0x0, %rax
je 0x54749
movq -0xb8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0xc0(%rbp)
movq -0xb8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0xc8(%rbp)
movq -0x10(%rbp), %rdi
movq -0xc0(%rbp), %rsi
callq 0x53910
cltq
movq %rax, -0x20(%rbp)
cmpq $-0x1, %rax
jne 0x54706
movq $-0x1, -0x8(%rbp)
jmp 0x547af
movq -0x20(%rbp), %rax
addq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rdi
movq -0xc8(%rbp), %rsi
callq 0x53910
cltq
movq %rax, -0x20(%rbp)
cmpq $-0x1, %rax
jne 0x54738
movq $-0x1, -0x8(%rbp)
jmp 0x547af
movq -0x20(%rbp), %rax
addq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x5469d
movq -0xb0(%rbp), %rdi
callq 0x2e600
jmp 0x54779
leaq 0xe8ab6(%rip), %rdi     # 0x13d214
leaq 0xe8a3c(%rip), %rsi     # 0x13d1a1
movl $0x2a8, %edx            # imm = 0x2A8
callq 0x76d80
movl $0x1, %edi
callq 0x263c0
jmp 0x5477b
jmp 0x5479f
leaq 0xe6fc6(%rip), %rdi     # 0x13b74a
leaq 0xe8a16(%rip), %rsi     # 0x13d1a1
movl $0x2ac, %edx            # imm = 0x2AC
callq 0x76d80
movl $0x1, %edi
callq 0x263c0
jmp 0x547a1
jmp 0x547a3
jmp 0x547a5
jmp 0x547a7
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0xd0, %rsp
popq %rbp
retq
nopl (%rax)