// File: /workspace/github_cpp_makefile_star2_O2/qian-jiahong[P]uvncrep017-ws/iniparser.cpp
// Function: dictionary_set(_dictionary_*, char*, char*)
static void dictionary_set(dictionary * d, char * key, char * val)
{
    int         i ;
    unsigned    hash ;

    if (d==NULL || key==NULL) return ;

    /* Compute hash for this key */
    hash = dictionary_hash(key) ;
    /* Find if value is already in blackboard */
    if (d->n>0) {
        for (i=0 ; i<d->size ; i++) {
            if (d->key[i]==NULL)
                continue ;
            if (hash==d->hash[i]) { /* Same hash value */
                if (!strcmp(key, d->key[i])) {   /* Same key */
                    /* Found a value: modify and return */
                    if (d->val[i]!=NULL)
                        free(d->val[i]);
                    d->val[i] = val ? strdup(val) : NULL ;
                    /* Value has been modified: return */
                    return ;
                }
            }
        }
    }
    /* Add a new value */
    /* See if dictionary needs to grow */
    if (d->n==d->size) {

        /* Reached maximum size: reallocate blackboard */
        d->val  = (char **)mem_double(d->val,  d->size * sizeof(char*)) ;
        d->key  = (char **)mem_double(d->key,  d->size * sizeof(char*)) ;
        d->hash = (unsigned int *)mem_double(d->hash, d->size * sizeof(unsigned)) ;

        /* Double size */
        d->size *= 2 ;
    }

    /* Insert key in the first empty slot */
    for (i=0 ; i<d->size ; i++) {
        if (d->key[i]==NULL) {
            /* Add key here */
            break ;
        }
    }
    /* Copy key */
    d->key[i]  = strdup(key);
    d->val[i]  = val ? strdup(val) : NULL ;
    d->hash[i] = hash;
    d->n ++ ;
    return ;
}

// Assembly:
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
jne 0x5b61
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r15
movq %rdi, %rbx
movq %rdx, 0x10(%rsp)
movq %rsi, %rdi
callq 0x5fbe
movl %eax, %ebp
movl (%rbx), %eax
movl 0x4(%rbx), %r13d
movl %eax, 0xc(%rsp)
testl %eax, %eax
jle 0x5ab7
xorl %r14d, %r14d
testl %r13d, %r13d
movl $0x0, %r12d
cmovgl %r13d, %r12d
cmpq %r14, %r12
je 0x5ab7
movq 0x10(%rbx), %rax
movq (%rax,%r14,8), %rsi
testq %rsi, %rsi
je 0x5ab2
movq 0x18(%rbx), %rax
cmpl (%rax,%r14,4), %ebp
jne 0x5ab2
movq %r15, %rdi
callq 0x22b0
testl %eax, %eax
je 0x5b62
incq %r14
jmp 0x5a86
movl 0xc(%rsp), %esi
cmpl %r13d, %esi
jne 0x5b01
movq 0x8(%rbx), %rdi
shll $0x3, %esi
callq 0x5fff
movq %rax, 0x8(%rbx)
movq 0x10(%rbx), %rdi
movl 0x4(%rbx), %esi
shll $0x3, %esi
callq 0x5fff
movq %rax, 0x10(%rbx)
movq 0x18(%rbx), %rdi
movl 0x4(%rbx), %esi
shll $0x2, %esi
callq 0x5fff
movq %rax, 0x18(%rbx)
movl 0x4(%rbx), %r13d
addl %r13d, %r13d
movl %r13d, 0x4(%rbx)
xorl %eax, %eax
testl %r13d, %r13d
cmovlel %eax, %r13d
movq 0x10(%rbx), %r14
cmpq %rax, %r13
je 0x5b22
cmpq $0x0, (%r14,%rax,8)
je 0x5b1f
incq %rax
jmp 0x5b0e
movq %rax, %r13
movq %r15, %rdi
callq 0x2350
movq %rax, (%r14,%r13,8)
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x5b3f
callq 0x2350
jmp 0x5b41
xorl %eax, %eax
movq 0x8(%rbx), %rcx
movq %rax, (%rcx,%r13,8)
movq 0x18(%rbx), %rax
movl %ebp, (%rax,%r13,4)
incl (%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x2250
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x5b80
callq 0x2350
jmp 0x5b82
xorl %eax, %eax
movq 0x8(%rbx), %rcx
movq %rax, (%rcx,%r14,8)
jmp 0x5b53