// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/deps/hiredis/./dict.c
// Function: dictReplace
static int dictReplace(dict *ht, void *key, void *val) {
    dictEntry *entry, auxentry;

    /* Try to add the element. If the key
     * does not exists dictAdd will suceed. */
    if (dictAdd(ht, key, val) == DICT_OK)
        return 1;
    /* It already exists, get the entry */
    entry = dictFind(ht, key);
    /* Free the old value and set the new one */
    /* Set the new value and free the old one. Note that it is important
     * to do that in this order, as the value may just be exactly the same
     * as the previous one. In this context, think to reference counting,
     * you want to increment (set), and then decrement (free), and not the
     * reverse. */
    auxentry = *entry;
    dictSetHashVal(ht, entry, val);
    dictFreeEntryVal(ht, &auxentry);
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdx, %r13
movq %rsi, %r15
movq %rdi, %rbx
movq 0x10(%rdi), %rdx
movl $0x4, %ecx
movl $0x4, %eax
testq %rdx, %rdx
je 0x83059
cmpq %rdx, 0x20(%rbx)
jne 0x83158
leaq (%rdx,%rdx), %rax
movabsq $0x7ffffffffffffffe, %r12 # imm = 0x7FFFFFFFFFFFFFFE
cmpq %r12, %rax
jbe 0x83059
incq %r12
movq %rdx, %rbp
jmp 0x83068
movq %rcx, %r12
addq %rcx, %rcx
cmpq %rax, %r12
jb 0x83059
movq 0x20(%rbx), %rbp
cmpq %rax, %rbp
ja 0x831fb
movq %r13, 0x20(%rsp)
movq 0x8(%rbx), %rax
movq %rax, 0x18(%rsp)
movq 0x28(%rbx), %rax
movq %rax, 0x10(%rsp)
leaq -0x1(%r12), %r14
movl $0x8, %esi
movq %r12, %rdi
movq %rdx, %r13
callq 0x269c0
movq %r13, %rdx
movq %rax, %r13
movq %rbp, 0x8(%rsp)
movq %rbp, %rax
testq %rdx, %rdx
je 0x8311a
xorl %esi, %esi
movq 0x8(%rsp), %rax
movq %r15, 0x28(%rsp)
testq %rax, %rax
je 0x83123
movq (%rbx), %rcx
movq (%rcx,%rsi,8), %rbp
testq %rbp, %rbp
je 0x83112
movq %rsi, 0x30(%rsp)
movq (%rbp), %rdi
movq 0x10(%rbp), %r15
movq 0x8(%rbx), %rax
callq *(%rax)
andl %r14d, %eax
movq (%r13,%rax,8), %rcx
movq %rcx, 0x10(%rbp)
movq %rbp, (%r13,%rax,8)
movq 0x20(%rbx), %rax
decq %rax
movq %rax, 0x20(%rbx)
movq %r15, %rbp
testq %r15, %r15
jne 0x830d2
movq 0x10(%rbx), %rdx
movq 0x28(%rsp), %r15
movq 0x30(%rsp), %rsi
incq %rsi
cmpq %rdx, %rsi
jb 0x830bc
testq %rax, %rax
jne 0x83269
movq (%rbx), %rdi
callq 0x264d0
movq %r13, (%rbx)
movq 0x18(%rsp), %rcx
movq %rcx, 0x8(%rbx)
movq %r12, 0x10(%rbx)
movq %r14, 0x18(%rbx)
movq 0x8(%rsp), %rax
movq %rax, 0x20(%rbx)
movq 0x10(%rsp), %rax
movq %rax, 0x28(%rbx)
movq 0x20(%rsp), %r13
jmp 0x8315c
movq 0x8(%rbx), %rcx
movq %r15, %rdi
callq *(%rcx)
movl %eax, %r12d
andl 0x18(%rbx), %r12d
movq (%rbx), %rax
movq (%rax,%r12,8), %r14
testq %r14, %r14
je 0x8319e
movq 0x8(%rbx), %rax
movq 0x18(%rax), %rax
testq %rax, %rax
je 0x83193
movq 0x28(%rbx), %rdi
movq (%r14), %rdx
movq %r15, %rsi
callq *%rax
testl %eax, %eax
je 0x83198
jmp 0x831fb
cmpq %r15, (%r14)
je 0x831fb
movq 0x10(%r14), %r14
jmp 0x8316f
cmpl $-0x1, %r12d
je 0x831fb
movq %r13, %r14
movl $0x18, %edi
callq 0x26360
movq %rax, %r13
movq (%rbx), %rax
movslq %r12d, %rcx
movq (%rax,%rcx,8), %rdx
movq %rdx, 0x10(%r13)
movq %r13, (%rax,%rcx,8)
movq 0x8(%rbx), %rax
movq 0x8(%rax), %rcx
testq %rcx, %rcx
je 0x831e3
movq 0x28(%rbx), %rdi
movq %r15, %rsi
callq *%rcx
movq %rax, %r15
movq 0x8(%rbx), %rax
movq %r15, (%r13)
movq 0x10(%rax), %rax
testq %rax, %rax
je 0x8324f
movq 0x28(%rbx), %rdi
movq %r14, %rsi
callq *%rax
jmp 0x83252
movq %rbx, %rdi
movq %r15, %rsi
callq 0x82f1a
movq %rax, %r12
movq 0x8(%rax), %r15
movq 0x8(%rbx), %rax
movq 0x10(%rax), %rcx
testq %rcx, %rcx
je 0x8322a
movq 0x28(%rbx), %rdi
movq %r13, %rsi
callq *%rcx
movq %rax, %r13
movq 0x8(%rbx), %rax
movq %r13, 0x8(%r12)
movq 0x28(%rax), %rax
testq %rax, %rax
je 0x8325a
movq 0x28(%rbx), %rdi
movq %r15, %rsi
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rax
movq %r14, %rax
movq %rax, 0x8(%r13)
incq 0x20(%rbx)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4c813(%rip), %rdi     # 0xcfa83
leaq 0x4c81a(%rip), %rsi     # 0xcfa91
leaq 0x4c81c(%rip), %rcx     # 0xcfa9a
movl $0x7e, %edx
callq 0x262d0