// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/src/t_hash.c
// Function: hashTypeSet
int hashTypeSet(robj *o, robj *field, robj *value) {
    int update = 0;

    if (o->encoding == OBJ_ENCODING_ZIPLIST) {
        unsigned char *zl, *fptr, *vptr;

        field = getDecodedObject(field);
        value = getDecodedObject(value);

        zl = o->ptr;
        fptr = ziplistIndex(zl, ZIPLIST_HEAD);
        if (fptr != NULL) {
            fptr = ziplistFind(fptr, field->ptr, sdslen(field->ptr), 1);
            if (fptr != NULL) {
                /* Grab pointer to the value (fptr points to the field) */
                vptr = ziplistNext(zl, fptr);
                serverAssert(vptr != NULL);
                update = 1;

                /* Delete value */
                zl = ziplistDelete(zl, &vptr);

                /* Insert new value */
                zl = ziplistInsert(zl, vptr, value->ptr, sdslen(value->ptr));
            }
        }

        if (!update) {
            /* Push new field/value pair onto the tail of the ziplist */
            zl = ziplistPush(zl, field->ptr, sdslen(field->ptr), ZIPLIST_TAIL);
            zl = ziplistPush(zl, value->ptr, sdslen(value->ptr), ZIPLIST_TAIL);
        }
        o->ptr = zl;
        decrRefCount(field);
        decrRefCount(value);

        /* Check if the ziplist needs to be converted to a hash table */
        if (hashTypeLength(o) > server.hash_max_ziplist_entries)
            hashTypeConvert(o, OBJ_ENCODING_HT);
    } else if (o->encoding == OBJ_ENCODING_HT) {
        if (dictReplace(o->ptr, field, value)) { /* Insert */
            incrRefCount(field);
        } else { /* Update */
            update = 1;
        }
        incrRefCount(value);
    } else {
        serverPanic("Unknown hash encoding");
    }
    return update;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movl (%rdi), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x2, %eax
je 0x59285
cmpl $0x5, %eax
jne 0x59451
movq %r14, %rdi
callq 0x444b2
movq %rax, %r14
movq %r15, %rdi
callq 0x444b2
movq %rax, %r15
movq 0x8(%rbx), %r13
xorl %r12d, %r12d
movq %r13, %rdi
xorl %esi, %esi
callq 0x3ea40
movb $0x1, %bpl
testq %rax, %rax
je 0x59360
movq 0x8(%r14), %rsi
movzbl -0x1(%rsi), %edx
movl %edx, %ecx
andl $0x7, %ecx
xorl %r12d, %r12d
cmpl $0x4, %ecx
ja 0x592cf
leaq 0x6d801(%rip), %rdi     # 0xc6a78
movslq (%rdi,%rcx,4), %rcx
addq %rdi, %rcx
jmpq *%rcx
shrl $0x3, %edx
jmp 0x592d1
movq 0x8(%rbx), %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x31c58
testl %eax, %eax
je 0x592a5
movq %r14, %rdi
callq 0x43c0c
xorl %r12d, %r12d
jmp 0x592ab
movl $0x1, %r12d
movq %r15, %rdi
callq 0x43c0c
jmp 0x5943f
movq -0x11(%rsi), %rdx
jmp 0x592d1
movzwl -0x5(%rsi), %edx
jmp 0x592d1
movl -0x9(%rsi), %edx
jmp 0x592d1
movzbl -0x3(%rsi), %edx
jmp 0x592d1
xorl %edx, %edx
movq %rax, %rdi
movl $0x1, %ecx
callq 0x3ece4
testq %rax, %rax
je 0x59360
movq %r13, %rdi
movq %rax, %rsi
callq 0x3ead6
movq %rax, (%rsp)
testq %rax, %rax
je 0x5946b
movq %rsp, %r12
movq %r13, %rdi
movq %r12, %rsi
callq 0x3ebf5
movq (%r12), %rsi
movq 0x8(%r15), %rdx
movzbl -0x1(%rdx), %ecx
movl %ecx, %edi
andl $0x7, %edi
cmpl $0x4, %edi
ja 0x5934b
leaq 0x6d766(%rip), %r8      # 0xc6a8c
movslq (%r8,%rdi,4), %rdi
addq %r8, %rdi
jmpq *%rdi
shrl $0x3, %ecx
jmp 0x5934d
movq -0x11(%rdx), %rcx
jmp 0x5934d
movzwl -0x5(%rdx), %ecx
jmp 0x5934d
movl -0x9(%rdx), %ecx
jmp 0x5934d
movzbl -0x3(%rdx), %ecx
jmp 0x5934d
xorl %ecx, %ecx
movq %rax, %rdi
callq 0x3ebf0
movq %rax, %r13
movl $0x1, %r12d
xorl %ebp, %ebp
testb %bpl, %bpl
je 0x59406
movq 0x8(%r14), %rsi
movzbl -0x1(%rsi), %edx
movl %edx, %eax
andl $0x7, %eax
cmpl $0x4, %eax
ja 0x593a7
leaq 0x6d71e(%rip), %rcx     # 0xc6aa0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
shrl $0x3, %edx
jmp 0x593a9
movq -0x11(%rsi), %rdx
jmp 0x593a9
movzwl -0x5(%rsi), %edx
jmp 0x593a9
movl -0x9(%rsi), %edx
jmp 0x593a9
movzbl -0x3(%rsi), %edx
jmp 0x593a9
xorl %edx, %edx
movq %r13, %rdi
movl $0x1, %ecx
callq 0x3ea1e
movq 0x8(%r15), %rsi
movzbl -0x1(%rsi), %edx
movl %edx, %ecx
andl $0x7, %ecx
cmpl $0x4, %ecx
ja 0x593f4
leaq 0x6d6e5(%rip), %rdi     # 0xc6ab4
movslq (%rdi,%rcx,4), %rcx
addq %rdi, %rcx
jmpq *%rcx
shrl $0x3, %edx
jmp 0x593f6
movq -0x11(%rsi), %rdx
jmp 0x593f6
movzwl -0x5(%rsi), %edx
jmp 0x593f6
movl -0x9(%rsi), %edx
jmp 0x593f6
movzbl -0x3(%rsi), %edx
jmp 0x593f6
xorl %edx, %edx
movq %rax, %rdi
movl $0x1, %ecx
callq 0x3ea1e
movq %rax, %r13
movq %r13, 0x8(%rbx)
movq %r14, %rdi
callq 0x440f3
movq %r15, %rdi
callq 0x440f3
movq %rbx, %rdi
callq 0x5948d
leaq 0xad42f(%rip), %rcx     # 0x106858
cmpq 0x930(%rcx), %rax
jbe 0x5943f
movq %rbx, %rdi
movl $0x2, %esi
callq 0x58e11
movl %r12d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x6c5a9(%rip), %rdi     # 0xc5a01
leaq 0x6d6a1(%rip), %rsi     # 0xc6b00
movl $0xef, %edx
callq 0x6558d
jmp 0x59483
leaq 0x6d697(%rip), %rdi     # 0xc6b09
leaq 0x6d687(%rip), %rsi     # 0xc6b00
movl $0xd0, %edx
callq 0x654e1
movl $0x1, %edi
callq 0x263d0