LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/buf1024[P]mysch/dict.c
// Function: dict_find
dict_entry *dict_find(dict *d, const void *key, int keylen)
{
    dict_entry *he;
    unsigned int h, idx, table;

    if (d->ht[0].size == 0)
        return NULL;            /* We don't have a table at all */
    if (dict_is_rehashing(d))
        _dict_rehash_step(d);
    h = dict_gen_hash_function((const unsigned char*)key, keylen);

    unsigned int keylen_ = keylen;

    for (table = 0; table <= 1; table++)
    {
        idx = h & d->ht[table].sizemask;
        he = d->ht[table].table[idx];
        while (he)
        {
            if ((keylen_ == he->keylen) && (memcmp(key, he->key, keylen_) == 0))
            {
                return he;
            }
            he = he->next;
        }
        if (!dict_is_rehashing(d))
            return NULL;
    }
    return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
cmpq $0x0, 0x10(%rdi)
je 0x2cfc
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r13
cmpl $-0x1, 0x48(%rdi)
je 0x2c67
cmpl $0x0, 0x4c(%r13)
jne 0x2c67
movq %r13, %rdi
movl $0x1, %esi
callq 0x27fb
movl %ebx, %r12d
movl $0x1505, %r15d          # imm = 0x1505
testl %ebx, %ebx
je 0x2c8f
xorl %eax, %eax
movl %r15d, %ecx
shll $0x5, %ecx
addl %r15d, %ecx
movzbl (%r14,%rax), %r15d
addl %ecx, %r15d
incq %rax
cmpl %eax, %r12d
jne 0x2c76
movq %r13, -0x38(%rbp)
leaq 0x8(%r13), %rax
movq %rax, -0x40(%rbp)
movb $0x1, %cl
xorl %eax, %eax
movl %ecx, -0x2c(%rbp)
shlq $0x5, %rax
movq -0x40(%rbp), %rdx
movl 0x10(%rdx,%rax), %ecx
andl %r15d, %ecx
movq (%rdx,%rax), %rax
movq (%rax,%rcx,8), %r13
testq %r13, %r13
je 0x2cdd
cmpl %ebx, (%r13)
jne 0x2cd7
movq 0x8(%r13), %rsi
movq %r14, %rdi
movq %r12, %rdx
callq 0x22c0
testl %eax, %eax
je 0x2cff
movq 0x18(%r13), %r13
jmp 0x2cb9
movq -0x38(%rbp), %rax
cmpl $-0x1, 0x48(%rax)
setne %cl
movl $0x1, %eax
xorl %r13d, %r13d
testb %cl, -0x2c(%rbp)
movl $0x0, %ecx
jne 0x2c9f
jmp 0x2cff
xorl %r13d, %r13d
movq %r13, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/buf1024[P]mysch/dict.c
// Function: dict_clear
int _dict_clear(dict *d, dictht *ht)
{
    unsigned long i;

    /* Free all the elements */
    for (i = 0; i < ht->size && ht->used > 0; i++)
    {
        dict_entry *he, *next_he;

        if ((he = ht->table[i]) == NULL)
            continue;
        while (he)
        {
            next_he = he->next;

            free(he->key);
            free(he->val);
            free(he);

            ht->used--;
            he = next_he;
        }
    }
    /* Free the table and the allocated cache structure */
    free(ht->table);
    /* Re-initialize the table */
    _dict_reset(ht);

    return DICT_OK;             /* never fails */
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq 0x8(%rsi), %rcx
testq %rcx, %rcx
je 0x2eee
movq 0x18(%rbx), %rax
xorl %r15d, %r15d
testq %rax, %rax
je 0x2eee
movq (%rbx), %rdx
movq (%rdx,%r15,8), %r14
testq %r14, %r14
je 0x2ee6
movq 0x8(%r14), %rdi
movq 0x18(%r14), %r12
callq 0x2030
movq 0x10(%r14), %rdi
callq 0x2030
movq %r14, %rdi
callq 0x2030
movq 0x18(%rbx), %rax
decq %rax
movq %rax, 0x18(%rbx)
movq %r12, %r14
testq %r12, %r12
jne 0x2eb1
movq 0x8(%rbx), %rcx
incq %r15
cmpq %rcx, %r15
jb 0x2ea0
movq (%rbx), %rdi
callq 0x2030
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
movups %xmm0, (%rbx)
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/buf1024[P]mysch/dict.c
// Function: dict_next
dict_entry *dict_next(dict_iterator *iter)
{
    while (1)
    {
        if (iter->entry == NULL)
        {
            dictht *ht = &iter->d->ht[iter->table];
            if (iter->safe && iter->index == -1 && iter->table == 0)
                iter->d->iterators++;
            iter->index++;
            if (iter->index >= (signed) ht->size)
            {
                if (dict_is_rehashing(iter->d) && iter->table == 0)
                {
                    iter->table++;
                    iter->index = 0;
                    ht = &iter->d->ht[1];
                }
                else
                {
                    break;
                }
            }
            iter->entry = ht->table[iter->index];
        }
        else
        {
            iter->entry = iter->next_entry;
        }
        if (iter->entry)
        {
            /* We need to save the 'next' here, the iterator user
             * may delete the entry we are returning. */
            iter->next_entry = iter->entry->next;
            return iter->entry;
        }
    }
    return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x20(%rdi), %rcx
cmpq $0x0, 0x18(%rdi)
movq %rcx, %rdx
jne 0x3032
movq (%rdi), %rdx
movslq 0x8(%rdi), %rsi
movq %rsi, %rax
shlq $0x5, %rax
addq %rdx, %rax
addq $0x8, %rax
cmpl $0x0, 0x10(%rdi)
movl 0xc(%rdi), %r8d
je 0x2ffd
movl %r8d, %r9d
notl %r9d
orl %esi, %r9d
jne 0x2ffd
incl 0x4c(%rdx)
incl %r8d
movl %r8d, 0xc(%rdi)
cmpl 0x8(%rax), %r8d
jl 0x3028
xorl %eax, %eax
cmpl $-0x1, 0x48(%rdx)
je 0x3045
testl %esi, %esi
jne 0x3045
movq $0x1, 0x8(%rdi)
addq $0x28, %rdx
xorl %r8d, %r8d
movq %rdx, %rax
movslq %r8d, %rdx
shlq $0x3, %rdx
addq (%rax), %rdx
movq (%rdx), %rax
movq %rax, 0x18(%rdi)
testq %rax, %rax
je 0x2fd0
movq 0x18(%rax), %rdx
movq %rdx, (%rcx)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/buf1024[P]mysch/dict.c
// Function: dict_get_randomKey
dict_entry *dict_get_randomKey(dict *d)
{
    dict_entry *he, *orighe;
    unsigned int h;
    int listlen, listele;

    if (dict_size(d) == 0)
        return NULL;
    if (dict_is_rehashing(d))
        _dict_rehash_step(d);
    if (dict_is_rehashing(d))
    {
        do
        {
            h = random() % (d->ht[0].size + d->ht[1].size);
            he = (h >= d->ht[0].size) ? d->ht[1].table[h - d->ht[0].size] :
                d->ht[0].table[h];
        }
        while (he == NULL);
    }
    else
    {
        do
        {
            h = random() & d->ht[0].sizemask;
            he = d->ht[0].table[h];
        }
        while (he == NULL);
    }

    /* Now we found a non empty bucket, but it is a linked
     * list and we need to get a random element from the list.
     * The only sane way to do so is counting the elements and
     * select a random index. */
    listlen = 0;
    orighe = he;
    while (he)
    {
        he = he->next;
        listlen++;
    }
    listele = random() % listlen;
    he = orighe;
    while (listele-- && he)
        he = he->next;
    return he;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq 0x20(%rdi), %rax
addq 0x40(%rdi), %rax
jne 0x308a
xorl %r14d, %r14d
jmp 0x312f
movq %rdi, %rbx
cmpl $-0x1, 0x48(%rdi)
je 0x30ea
cmpl $0x0, 0x4c(%rbx)
jne 0x30ac
movq %rbx, %rdi
movl $0x1, %esi
callq 0x27fb
cmpl $-0x1, 0x48(%rbx)
je 0x30ea
callq 0x2280
movq 0x10(%rbx), %rsi
movq 0x30(%rbx), %rcx
addq %rsi, %rcx
xorl %edx, %edx
divq %rcx
movl %edx, %ecx
movq %rcx, %rax
subq %rsi, %rax
jae 0x30d8
shlq $0x3, %rcx
addq 0x8(%rbx), %rcx
movq %rcx, %rax
jmp 0x30e0
shlq $0x3, %rax
addq 0x28(%rbx), %rax
movq (%rax), %r14
testq %r14, %r14
je 0x30ac
jmp 0x30ff
callq 0x2280
movq 0x8(%rbx), %rcx
andl 0x18(%rbx), %eax
movq (%rcx,%rax,8), %r14
testq %r14, %r14
je 0x30ea
xorl %ebx, %ebx
movq %r14, %rax
movq 0x18(%rax), %rax
incq %rbx
testq %rax, %rax
jne 0x3104
callq 0x2280
cqto
idivq %rbx
testq %rdx, %rdx
je 0x312f
decl %edx
movq 0x18(%r14), %r14
addl $-0x1, %edx
jae 0x312f
testq %r14, %r14
jne 0x3121
movq %r14, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/buf1024[P]mysch/dict.c
// Function: dict_print_stats
void dict_print_stats(dict *d)
{
    _dict_print_stats_ht(&d->ht[0]);
    if (dict_is_rehashing(d))
    {
        printf("-- Rehashing into ht[1]:\n");
        _dict_print_stats_ht(&d->ht[1]);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
addq $0x8, %rdi
callq 0x319c
cmpl $-0x1, 0x48(%rbx)
je 0x3195
leaq 0x4f44(%rip), %rdi      # 0x80c5
callq 0x20b0
addq $0x28, %rbx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x319c
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/buf1024[P]mysch/dlist.c
// Function: list_release
void list_release(list *list, int nofree)
{
    unsigned long len;
    list_node *current, *next;

    current = list->head;
    len = list->len;
    while(len--) {
        next = current->next;
        if (AL_FREE == nofree)
            free(current->value);
        free(current);
        current = next;
    }
    free(list);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x10(%rdi), %r12
testq %r12, %r12
je 0x3479
movl %esi, %r14d
movq (%rbx), %r15
movq 0x8(%r15), %r13
testl %r14d, %r14d
jne 0x3466
movq 0x10(%r15), %rdi
callq 0x2030
decq %r12
movq %r15, %rdi
callq 0x2030
movq %r13, %r15
testq %r12, %r12
jne 0x3454
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2030
// File: /workspace/github_c_makefile_star2_O3/buf1024[P]mysch/dlist.c
// Function: list_add_node_head
list *list_add_node_head(list *list, void *value)
{
    list_node *node;

    if ((node = malloc(sizeof(*node))) == NULL)
        return NULL;
    node->value = value;
    if (list->len == 0) {
        list->head = list->tail = node;
        node->prev = node->next = NULL;
    } else {
        node->prev = NULL;
        node->next = list->head;
        list->head->prev = node;
        list->head = node;
    }
    list->len++;
    return list;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movl $0x18, %edi
callq 0x22a0
testq %rax, %rax
je 0x34c7
movq %r14, 0x10(%rax)
movq 0x10(%rbx), %rcx
testq %rcx, %rcx
je 0x34cb
movq $0x0, (%rax)
movq (%rbx), %rdx
movq %rax, (%rdx)
jmp 0x34d8
xorl %ebx, %ebx
jmp 0x34e6
movq %rax, 0x8(%rbx)
movq $0x0, (%rax)
xorl %edx, %edx
movq %rax, (%rbx)
movq %rdx, 0x8(%rax)
incq %rcx
movq %rcx, 0x10(%rbx)
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/buf1024[P]mysch/dlist.c
// Function: list_add_node_tail
list *list_add_node_tail(list *list, void *value)
{
    list_node *node;

    if ((node = malloc(sizeof(*node))) == NULL)
        return NULL;
    node->value = value;
    if (list->len == 0) {
        list->head = list->tail = node;
        node->prev = node->next = NULL;
    } else {
        node->prev = list->tail;
        node->next = NULL;
        list->tail->next = node;
        list->tail = node;
    }
    list->len++;
    return list;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movl $0x18, %edi
callq 0x22a0
testq %rax, %rax
je 0x352d
movq %r14, 0x10(%rax)
movq 0x10(%rbx), %rcx
testq %rcx, %rcx
je 0x3531
movq 0x8(%rbx), %rdx
movq $0x0, 0x8(%rax)
movq %rax, 0x8(%rdx)
movq %rax, 0x8(%rbx)
jmp 0x3542
xorl %ebx, %ebx
jmp 0x354c
movq %rax, 0x8(%rbx)
movq %rax, (%rbx)
movq $0x0, 0x8(%rax)
xorl %edx, %edx
movq %rdx, (%rax)
incq %rcx
movq %rcx, 0x10(%rbx)
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/buf1024[P]mysch/dlist.c
// Function: list_insert_node
list *list_insert_node(list *list, list_node *old_node, void *value, int after) {
    list_node *node;

    if ((node = malloc(sizeof(*node))) == NULL)
        return NULL;
    node->value = value;
    if (after) {
        node->prev = old_node;
        node->next = old_node->next;
        if (list->tail == old_node) {
            list->tail = node;
        }
    } else {
        node->next = old_node;
        node->prev = old_node->prev;
        if (list->head == old_node) {
            list->head = node;
        }
    }
    if (node->prev != NULL) {
        node->prev->next = node;
    }
    if (node->next != NULL) {
        node->next->prev = node;
    }
    list->len++;
    return list;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %ecx, %r15d
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %rbx
movl $0x18, %edi
callq 0x22a0
testq %rax, %rax
je 0x359d
movq %r12, 0x10(%rax)
testl %r15d, %r15d
je 0x35a1
movq %r14, (%rax)
movq 0x8(%r14), %rcx
movq %rcx, 0x8(%rax)
cmpq %r14, 0x8(%rbx)
jne 0x3598
movq %rax, 0x8(%rbx)
movq %r14, %rcx
jmp 0x35b8
xorl %ebx, %ebx
jmp 0x35cc
movq %r14, 0x8(%rax)
movq (%r14), %rcx
movq %rcx, (%rax)
cmpq %r14, (%rbx)
jne 0x35b3
movq %rax, (%rbx)
testq %rcx, %rcx
je 0x35c5
movq %rax, 0x8(%rcx)
movq 0x8(%rax), %r14
testq %r14, %r14
je 0x35c8
movq %rax, (%r14)
incq 0x10(%rbx)
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/buf1024[P]mysch/dlist.c
// Function: list_next
list_node *list_next(list_iter *iter)
{
    list_node *current = iter->next;

    if (current != NULL) {
        if (iter->direction == AL_START_HEAD)
            iter->next = current->next;
        else
            iter->next = current->prev;
    }
    return current;
}

// Assembly:
movq (%rdi), %rax
testq %rax, %rax
je 0x36a5
pushq %rbp
movq %rsp, %rbp
xorl %ecx, %ecx
cmpl $0x0, 0x8(%rdi)
sete %cl
movq (%rax,%rcx,8), %rcx
movq %rcx, (%rdi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/buf1024[P]mysch/dlist.c
// Function: list_search_key
list_node *list_search_key(list *list, void *key, int len)
{
    list_iter *iter;
    list_node *node;

    iter = list_get_iterator(list, AL_START_HEAD);
    while((node = list_next(iter)) != NULL) {
        if (len > 0) {
            if (memcmp(node->value, key, len) == 0) {
                list_release_iterator(iter);
                return node;
            }
        } else {
            if (key == node->value) {
                list_release_iterator(iter);
                return node;
            }
        }
    }
    list_release_iterator(iter);
    return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq (%rdi), %rbx
testq %rbx, %rbx
je 0x36f0
movl %edx, %r14d
movq %rsi, %r15
movl %edx, %r12d
movq 0x8(%rbx), %r13
movq 0x10(%rbx), %rdi
testl %r14d, %r14d
jle 0x36e3
movq %r15, %rsi
movq %r12, %rdx
callq 0x22c0
testl %eax, %eax
jne 0x36e8
jmp 0x36f2
cmpq %r15, %rdi
je 0x36f2
movq %r13, %rbx
testq %r13, %r13
jne 0x36c5
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/buf1024[P]mysch/dlist.c
// Function: list_index
list_node *list_index(list *list, long index) {
    list_node *n;

    if (index < 0) {
        index = (-index)-1;
        n = list->tail;
        while(index-- && n) n = n->prev;
    } else {
        n = list->head;
        while(index-- && n) n = n->next;
    }
    return n;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, %rax
testq %rsi, %rsi
js 0x3737
movq (%rax), %rax
setne %cl
testq %rax, %rax
setne %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x374e
decq %rsi
movq 0x8(%rax), %rax
addq $-0x1, %rsi
jae 0x374e
testq %rax, %rax
jne 0x3726
jmp 0x374e
addq $0x8, %rax
incq %rsi
movq (%rax), %rax
testq %rsi, %rsi
je 0x374e
incq %rsi
testq %rax, %rax
jne 0x373e
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/buf1024[P]mysch/dlist.c
// Function: list_rotate
void list_rotate(list *list) {
    list_node *tail = list->tail;

    if (list_length(list) <= 1) return;

    /* Detach current tail */
    list->tail = tail->prev;
    list->tail->next = NULL;
    /* Move it as head */
    list->head->prev = tail;
    tail->prev = NULL;
    tail->next = list->head;
    list->head = tail;
}

// Assembly:
cmpq $0x2, 0x10(%rdi)
jb 0x377d
pushq %rbp
movq %rsp, %rbp
movq 0x8(%rdi), %rax
movq (%rax), %rcx
movq %rcx, 0x8(%rdi)
xorl %edx, %edx
movq %rdx, 0x8(%rcx)
movq (%rdi), %rcx
movq %rax, (%rcx)
movq %rdx, (%rax)
movq %rcx, 0x8(%rax)
movq %rax, (%rdi)
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O3/buf1024[P]mysch/iniconf.c
// Function: ini_destroy
int ini_destroy(ini_conf_t* ini)
{
    dict_iterator* it = dict_get_safe_iterator(ini);
    dict_entry* de = NULL;
    while((de = dict_next(it)) != NULL) {
        dict* v = (dict*)dict_get_entry_val(de);
        dict_delete_no_free(ini, de->key, de->keylen);

        free(de->key);

        dict_release(v);
    }
    dict_release_iterator(it);
    dict_release(ini);

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
callq 0x2f85
movq %rax, %r14
movq %rax, %rdi
callq 0x2fbe
testq %rax, %rax
je 0x37da
movq %rax, %r15
movq 0x10(%r15), %r12
movq 0x8(%r15), %rsi
movl (%r15), %edx
movq %rbx, %rdi
callq 0x2e73
movq 0x8(%r15), %rdi
callq 0x2030
movq %r12, %rdi
callq 0x2f0b
movq %r14, %rdi
callq 0x2fbe
movq %rax, %r15
testq %rax, %rax
jne 0x37a6
movq %r14, %rdi
callq 0x3047
movq %rbx, %rdi
callq 0x2f0b
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/buf1024[P]mysch/iniconf.c
// Function: ini_insert_sec
ini_sec_t* ini_insert_sec(ini_conf_t* ini, const char* key)
{
    if (!ini || !key)
        return NULL ;

    int len = strlen(key);
    char* k = (char*)malloc(len + 1);
    strcpy(k, key);

    dict* v = dict_create(NULL);

    if(dict_add(ini, k, len, v, sizeof(v)) == DICT_OK){
        return v;
    }

    dict_release(v);

    return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
jne 0x3bc5
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x2130
movq %rax, %r15
incl %eax
movslq %eax, %rdi
callq 0x22a0
movq %rax, %r12
movq %rax, %rdi
movq %r14, %rsi
callq 0x2090
xorl %edi, %edi
callq 0x26f7
movq %rax, %r14
movq %rbx, %rdi
movq %r12, %rsi
movl %r15d, %edx
movq %rax, %rcx
movl $0x8, %r8d
callq 0x2a34
testl %eax, %eax
je 0x3bc8
movq %r14, %rdi
callq 0x2f0b
xorl %r14d, %r14d
movq %r14, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/buf1024[P]mysch/iniconf.c
// Function: ini_save
int ini_save(ini_conf_t* ini, const char* file)
{
    if (!ini || !file)
        return -1;

    int fd = open(file, O_RDWR | O_CREAT,
            S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH);
    if (fd == -1)
        return -1;

    dict_iterator* it = dict_get_iterator(ini);
    dict_entry* de = NULL;
    while((de = dict_next(it)) != NULL) {
        const char* k = (const char*)dict_get_entry_key(de);
        ini_sec_t* v = (ini_sec_t*)dict_get_entry_val(de);


        write(fd, "[", 1);
        write(fd, k, strlen(k));
        write(fd, "]", 1);
        write(fd, "\n", 1);

        int ret = ini_save_sec(v, fd);
        if(ret < 0){
            close(fd);
            return -1;
        }
    }
    dict_release_iterator(it);
    close(fd);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
orb %al, %cl
jne 0x3e1f
movq %rdi, %r15
movq %rsi, %rdi
movl $0x42, %esi
movl $0x1b4, %edx            # imm = 0x1B4
xorl %eax, %eax
callq 0x22f0
cmpl $-0x1, %eax
je 0x3e1f
movl %eax, -0x2c(%rbp)
movq %r15, %rdi
callq 0x2f4c
movq %rax, -0x38(%rbp)
movq %rax, %rdi
callq 0x2fbe
testq %rax, %rax
je 0x3e0b
leaq 0x44ab(%rip), %r15      # 0x8199
leaq 0x444b(%rip), %r13      # 0x8140
movq 0x8(%rax), %r14
movq 0x10(%rax), %r12
movl $0x1, %edx
movl -0x2c(%rbp), %ebx
movl %ebx, %edi
leaq 0x442a(%rip), %rsi      # 0x8138
callq 0x20f0
movq %r14, %rdi
callq 0x2130
movl %ebx, %edi
movq %r14, %rsi
movq %rax, %rdx
callq 0x20f0
movl $0x1, %edx
movl %ebx, %edi
leaq 0x449d(%rip), %rsi      # 0x81d3
callq 0x20f0
movl $0x1, %edx
movl %ebx, %edi
movq %r15, %rsi
callq 0x20f0
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
testl %ebx, %ebx
js 0x3e17
testq %r12, %r12
je 0x3e17
movq %r12, %rdi
callq 0x2f4c
movq %rax, %rbx
movq %rax, %rdi
callq 0x2fbe
testq %rax, %rax
movq %r13, %r14
movl -0x2c(%rbp), %r13d
je 0x3dee
movq %r14, %r12
movq 0x8(%rax), %r14
movq 0x10(%rax), %r15
movq %r14, %rdi
callq 0x2130
movl %r13d, %edi
movq %r14, %rsi
movq %r12, %r14
movq %rax, %rdx
callq 0x20f0
movl $0x1, %edx
movl %r13d, %edi
movq %r12, %rsi
callq 0x20f0
movq %r15, %rdi
callq 0x2130
movl %r13d, %edi
movq %r15, %rsi
leaq 0x43d0(%rip), %r15      # 0x8199
movq %rax, %rdx
callq 0x20f0
movl $0x1, %edx
movl %r13d, %edi
movq %r15, %rsi
callq 0x20f0
movq %rbx, %rdi
callq 0x2fbe
testq %rax, %rax
jne 0x3d80
movq %rbx, %rdi
callq 0x3047
movq -0x38(%rbp), %rdi
callq 0x2fbe
testq %rax, %rax
movq %r14, %r13
jne 0x3cf5
movq -0x38(%rbp), %rdi
callq 0x3047
xorl %r14d, %r14d
movl -0x2c(%rbp), %edi
callq 0x21c0
movl %r14d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/buf1024[P]mysch/iniconf.c
// Function: ini_dump
int ini_dump(ini_conf_t* ini, char* buf, size_t len)
{
    if (!ini || !buf || !ini)
        return -1;
    size_t wlen = 0;
    dict_iterator* it = dict_get_iterator(ini);
    dict_entry* de = NULL;
    while((de = dict_next(it)) != NULL) {
        const char* k = (const char*)dict_get_entry_key(de);
        ini_sec_t* v = (ini_sec_t*)dict_get_entry_val(de);

        if(wlen >= len) return -1;

        wlen += snprintf(buf + wlen, len - wlen, "[%s]\n", k);
        if(wlen >= len) return -1;

        int ret = ini_save_sec_buf(v, buf + wlen, len - wlen);
        if(ret <= 0) return -1;
        wlen += ret;
    }
    dict_release_iterator(it);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %r12
testq %rdi, %rdi
sete %dl
testq %rsi, %rsi
sete %cl
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
orb %dl, %cl
jne 0x3fbb
movq %rsi, %r13
callq 0x2f4c
movq %rax, %rbx
leaq 0x42ca(%rip), %r15      # 0x813a
xorl %r14d, %r14d
movq %r12, -0x48(%rbp)
movq %r13, -0x40(%rbp)
movq %rax, -0x38(%rbp)
movq %rbx, %rdi
callq 0x2fbe
testq %rax, %rax
je 0x3fca
movq %r12, %rsi
subq %r14, %rsi
jbe 0x3fb6
movq 0x10(%rax), %rbx
movq 0x8(%rax), %rcx
leaq (%r14,%r13), %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x2170
cltq
addq %r14, %rax
movq %r12, %r15
subq %rax, %r15
jbe 0x3fb6
testq %rbx, %rbx
je 0x3fb6
movq %rax, -0x50(%rbp)
addq %rax, %r13
movq %rbx, %rdi
callq 0x2f4c
movq %rax, -0x30(%rbp)
xorl %ebx, %ebx
movq -0x30(%rbp), %rdi
callq 0x2fbe
testq %rax, %rax
je 0x3f8b
movq 0x8(%rax), %rcx
movq 0x10(%rax), %r14
leaq (%rbx,%r13), %rdi
movq %r15, %rsi
subq %rbx, %rsi
leaq 0x42ac(%rip), %rdx      # 0x81b8
xorl %eax, %eax
callq 0x2170
movslq %eax, %r12
addq %rbx, %r12
movq %r15, %rsi
subq %r12, %rsi
jbe 0x3fb6
leaq (%r12,%r13), %rdi
leaq 0x4210(%rip), %rdx      # 0x8140
xorl %eax, %eax
callq 0x2170
movslq %eax, %rbx
addq %r12, %rbx
movq %r15, %rsi
subq %rbx, %rsi
jbe 0x3fb6
leaq (%rbx,%r13), %rdi
leaq 0x4268(%rip), %rdx      # 0x81b8
movq %r14, %rcx
xorl %eax, %eax
callq 0x2170
movslq %eax, %r14
addq %rbx, %r14
movq %r15, %rsi
subq %r14, %rsi
jbe 0x3fb6
leaq (%r14,%r13), %rdi
leaq 0x4226(%rip), %rdx      # 0x8199
xorl %eax, %eax
callq 0x2170
movslq %eax, %rbx
addq %r14, %rbx
cmpq %r15, %rbx
jb 0x3ee1
jmp 0x3fb6
movq -0x30(%rbp), %rdi
callq 0x3047
movl %ebx, %r14d
addq -0x50(%rbp), %r14
testl %ebx, %ebx
movq -0x48(%rbp), %r12
movq -0x40(%rbp), %r13
movq -0x38(%rbp), %rbx
leaq 0x418a(%rip), %r15      # 0x813a
jg 0x3e7f
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
callq 0x3047
xorl %eax, %eax
jmp 0x3fbb
// File: /workspace/github_c_makefile_star2_O3/buf1024[P]mysch/iniconf.c
// Function: ini_delete_sec
int ini_delete_sec(ini_conf_t* ini, const char* key)
{
    if (!ini || !key)
        return -1 ;

    int len = strlen(key);

    dict* v = (dict*)dict_fetch_value(ini, key, len);

    if(!v) {
        return -1;
    }

    dict_release(v);
    dict_delete(ini, key, len);

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
orb %al, %cl
jne 0x4034
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
callq 0x2130
movq %rax, %r12
movq %r14, %rdi
movq %rbx, %rsi
movl %r12d, %edx
callq 0x2f34
testq %rax, %rax
je 0x4034
movq %rax, %rdi
callq 0x2f0b
movq %r14, %rdi
movq %rbx, %rsi
movl %r12d, %edx
callq 0x2d11
xorl %r15d, %r15d
movl %r15d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/buf1024[P]mysch/log.c
// Function: log_get_level
int log_get_level(const char* lvl)
{
    if (lvl) {
        if (strcasecmp(lvl, "all") == 0) {
            return LOG_ALL;
        } else if (strcasecmp(lvl, "debug") == 0) {
            return LOG_DEBUG;
        } else if (strcasecmp(lvl, "info") == 0) {
            return LOG_INFO;
        } else if (strcasecmp(lvl, "warn") == 0) {
            return LOG_WARN;
        } else if (strcasecmp(lvl, "error") == 0) {
            return LOG_ERROR;
        } else if (strcasecmp(lvl, "fatal") == 0) {
            return LOG_FATAL;
        } else if (strcasecmp(lvl, "off") == 0) {
            return LOG_OFF;
        }
    }

    return LOG_ALL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x418c
movq %rdi, %rbx
leaq 0x4031(%rip), %rsi      # 0x8142
callq 0x2040
testl %eax, %eax
je 0x418c
leaq 0x4025(%rip), %rsi      # 0x8146
movq %rbx, %rdi
callq 0x2040
testl %eax, %eax
je 0x4195
leaq 0x4018(%rip), %rsi      # 0x814c
movq %rbx, %rdi
callq 0x2040
testl %eax, %eax
je 0x419c
leaq 0x400a(%rip), %rsi      # 0x8151
movq %rbx, %rdi
callq 0x2040
testl %eax, %eax
je 0x41a3
leaq 0x3ffc(%rip), %rsi      # 0x8156
movq %rbx, %rdi
callq 0x2040
testl %eax, %eax
je 0x41aa
leaq 0x3fef(%rip), %rsi      # 0x815c
movq %rbx, %rdi
callq 0x2040
testl %eax, %eax
je 0x41b1
leaq 0x3fe2(%rip), %rsi      # 0x8162
movq %rbx, %rdi
callq 0x2040
testl %eax, %eax
je 0x41b8
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movl $0x64, %eax
jmp 0x418e
movl $0xc8, %eax
jmp 0x418e
movl $0x12c, %eax            # imm = 0x12C
jmp 0x418e
movl $0x190, %eax            # imm = 0x190
jmp 0x418e
movl $0x1f4, %eax            # imm = 0x1F4
jmp 0x418e
movl $0x258, %eax            # imm = 0x258
jmp 0x418e
// File: /workspace/github_c_makefile_star2_O3/buf1024[P]mysch/log.c
// Function: log_reg_callback
int log_reg_callback(int lvl,
        log_callback_int_t init_cb,
        log_callback_log_t log_cb,
        log_callback_uninit_t uninit_cb,
        log_callback_flush_t flush_cb,
        void* args)
{
    pthread_mutex_lock(&_ctx_mutex);

    struct call_back* cb = (struct call_back*)malloc(sizeof(struct call_back));
    if(cb){

        memset(cb, 0, sizeof(*cb));

        cb->level = lvl;//log_get_level(lvl);
        cb->init_cb_fun = init_cb;
        cb->log_cb_fun = log_cb;
        cb->uninit_cb_fun = uninit_cb;
        cb->flush_cb_fun = flush_cb;
        cb->args = args;
        cb->next = 0;

        if(_context.cb == 0){
            _context.cb = cb;
        }else{
            struct call_back* iter_cb = _context.cb;
            while(iter_cb->next){
                iter_cb = iter_cb->next;
            }
            iter_cb->next = cb;
        }
    }
    pthread_mutex_unlock(&_ctx_mutex);

    return LOG_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, -0x30(%rbp)
movq %r8, %r14
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %r13
movl %edi, %ebx
leaq 0x801a(%rip), %rdi      # 0xc200
callq 0x23b0
movl $0x1, %edi
movl $0x38, %esi
callq 0x21f0
testq %rax, %rax
je 0x4241
movl %ebx, (%rax)
movq %r13, 0x8(%rax)
movq %r12, 0x10(%rax)
movq %r15, 0x18(%rax)
movq %r14, 0x20(%rax)
movq -0x30(%rbp), %rcx
movq %rcx, 0x28(%rax)
movq 0x8008(%rip), %rdx      # 0xc228
testq %rdx, %rdx
je 0x4237
movq %rdx, %rcx
movq 0x30(%rdx), %rdx
testq %rdx, %rdx
jne 0x4225
addq $0x30, %rcx
jmp 0x423e
leaq 0x7fea(%rip), %rcx      # 0xc228
movq %rax, (%rcx)
leaq 0x7fb8(%rip), %rdi      # 0xc200
callq 0x2290
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/buf1024[P]mysch/log.c
// Function: log_start
int log_start()
{
    struct call_back* cb = _context.cb;
    while(cb){
        if (cb->init_cb_fun) {
            if (cb->init_cb_fun(cb->args) == LOG_FAIL) {
                fprintf(stderr, "fail to init call back!\n");
                return LOG_FAIL;
            }
        }
        cb = cb->next;
    }
    return LOG_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq 0x7fbc(%rip), %r14      # 0xc228
xorl %ebx, %ebx
testq %r14, %r14
je 0x4297
movq 0x8(%r14), %rax
testq %rax, %rax
je 0x4287
movq 0x28(%r14), %rdi
callq *%rax
cmpl $-0x1, %eax
je 0x428d
movq 0x30(%r14), %r14
jmp 0x426e
callq 0x23e0
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/buf1024[P]mysch/log.c
// Function: log_flush
void log_flush()
{

    pthread_mutex_lock(&_ctx_mutex);
    struct call_back* cb = _context.cb;
    while (cb) {
        if (cb->flush_cb_fun) {
            if (cb->flush_cb_fun(cb->args) == LOG_FAIL) {
                fprintf(stderr, "fail to flush log message!\n");
            }
        }
        cb = cb->next;
    }
    pthread_mutex_unlock(&_ctx_mutex);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq 0x7f2e(%rip), %rdi      # 0xc200
callq 0x23b0
movq 0x7f4a(%rip), %rbx      # 0xc228
testq %rbx, %rbx
je 0x4304
movq 0x20(%rbx), %rax
testq %rax, %rax
je 0x42f7
movq 0x28(%rbx), %rdi
callq *%rax
cmpl $-0x1, %eax
je 0x42fd
movq 0x30(%rbx), %rbx
jmp 0x42de
callq 0x240f
jmp 0x42f7
leaq 0x7ef5(%rip), %rdi      # 0xc200
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x2290
// File: /workspace/github_c_makefile_star2_O3/buf1024[P]mysch/log.c
// Function: log_info
void log_info (const char* format, ...)
{
    va_list ap;

    pthread_mutex_lock(&_ctx_mutex);
    va_start(ap, format);
    log_message(LOG_INFO, format, ap);
    va_end(ap);
    pthread_mutex_unlock(&_ctx_mutex);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0xc8, %rsp
movq %rdi, %rbx
leaq -0xe0(%rbp), %r15
movq %rsi, 0x8(%r15)
movq %rdx, 0x10(%r15)
movq %rcx, 0x18(%r15)
movq %r8, 0x20(%r15)
movq %r9, 0x28(%r15)
testb %al, %al
je 0x4626
movaps %xmm0, -0xb0(%rbp)
movaps %xmm1, -0xa0(%rbp)
movaps %xmm2, -0x90(%rbp)
movaps %xmm3, -0x80(%rbp)
movaps %xmm4, -0x70(%rbp)
movaps %xmm5, -0x60(%rbp)
movaps %xmm6, -0x50(%rbp)
movaps %xmm7, -0x40(%rbp)
leaq 0x7bd3(%rip), %r14      # 0xc200
movq %r14, %rdi
callq 0x23b0
movabsq $0x3000000008, %rax     # imm = 0x3000000008
leaq -0x30(%rbp), %rdx
movq %rax, (%rdx)
leaq 0x10(%rbp), %rax
movq %rax, 0x8(%rdx)
movq %r15, 0x10(%rdx)
movl $0xc8, %edi
movq %rbx, %rsi
callq 0x43c0
movq %r14, %rdi
callq 0x2290
addq $0xc8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/buf1024[P]mysch/log.c
// Function: log_warn
void log_warn (const char* format, ...)
{
    va_list ap;

    pthread_mutex_lock(&_ctx_mutex);
    va_start(ap, format);
    log_message(LOG_WARN, format, ap);
    va_end(ap);
    pthread_mutex_unlock(&_ctx_mutex);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0xc8, %rsp
movq %rdi, %rbx
leaq -0xe0(%rbp), %r15
movq %rsi, 0x8(%r15)
movq %rdx, 0x10(%r15)
movq %rcx, 0x18(%r15)
movq %r8, 0x20(%r15)
movq %r9, 0x28(%r15)
testb %al, %al
je 0x46d0
movaps %xmm0, -0xb0(%rbp)
movaps %xmm1, -0xa0(%rbp)
movaps %xmm2, -0x90(%rbp)
movaps %xmm3, -0x80(%rbp)
movaps %xmm4, -0x70(%rbp)
movaps %xmm5, -0x60(%rbp)
movaps %xmm6, -0x50(%rbp)
movaps %xmm7, -0x40(%rbp)
leaq 0x7b29(%rip), %r14      # 0xc200
movq %r14, %rdi
callq 0x23b0
movabsq $0x3000000008, %rax     # imm = 0x3000000008
leaq -0x30(%rbp), %rdx
movq %rax, (%rdx)
leaq 0x10(%rbp), %rax
movq %rax, 0x8(%rdx)
movq %r15, 0x10(%rdx)
movl $0x12c, %edi            # imm = 0x12C
movq %rbx, %rsi
callq 0x43c0
movq %r14, %rdi
callq 0x2290
addq $0xc8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/buf1024[P]mysch/log.c
// Function: log_error
void log_error(const char* format, ...)
{
    va_list ap;

    pthread_mutex_lock(&_ctx_mutex);
    va_start(ap, format);
    log_message(LOG_ERROR, format, ap);
    va_end(ap);
    pthread_mutex_unlock(&_ctx_mutex);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0xc8, %rsp
movq %rdi, %rbx
leaq -0xe0(%rbp), %r15
movq %rsi, 0x8(%r15)
movq %rdx, 0x10(%r15)
movq %rcx, 0x18(%r15)
movq %r8, 0x20(%r15)
movq %r9, 0x28(%r15)
testb %al, %al
je 0x477a
movaps %xmm0, -0xb0(%rbp)
movaps %xmm1, -0xa0(%rbp)
movaps %xmm2, -0x90(%rbp)
movaps %xmm3, -0x80(%rbp)
movaps %xmm4, -0x70(%rbp)
movaps %xmm5, -0x60(%rbp)
movaps %xmm6, -0x50(%rbp)
movaps %xmm7, -0x40(%rbp)
leaq 0x7a7f(%rip), %r14      # 0xc200
movq %r14, %rdi
callq 0x23b0
movabsq $0x3000000008, %rax     # imm = 0x3000000008
leaq -0x30(%rbp), %rdx
movq %rax, (%rdx)
leaq 0x10(%rbp), %rax
movq %rax, 0x8(%rdx)
movq %r15, 0x10(%rdx)
movl $0x190, %edi            # imm = 0x190
movq %rbx, %rsi
callq 0x43c0
movq %r14, %rdi
callq 0x2290
addq $0xc8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/buf1024[P]mysch/log.c
// Function: log_fatal
void log_fatal(const char* format, ...)
{
    va_list ap;

    pthread_mutex_lock(&_ctx_mutex);
    va_start(ap, format);
    log_message(LOG_FATAL, format, ap);
    va_end(ap);
    pthread_mutex_unlock(&_ctx_mutex);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0xc8, %rsp
movq %rdi, %rbx
leaq -0xe0(%rbp), %r15
movq %rsi, 0x8(%r15)
movq %rdx, 0x10(%r15)
movq %rcx, 0x18(%r15)
movq %r8, 0x20(%r15)
movq %r9, 0x28(%r15)
testb %al, %al
je 0x4824
movaps %xmm0, -0xb0(%rbp)
movaps %xmm1, -0xa0(%rbp)
movaps %xmm2, -0x90(%rbp)
movaps %xmm3, -0x80(%rbp)
movaps %xmm4, -0x70(%rbp)
movaps %xmm5, -0x60(%rbp)
movaps %xmm6, -0x50(%rbp)
movaps %xmm7, -0x40(%rbp)
leaq 0x79d5(%rip), %r14      # 0xc200
movq %r14, %rdi
callq 0x23b0
movabsq $0x3000000008, %rax     # imm = 0x3000000008
leaq -0x30(%rbp), %rdx
movq %rax, (%rdx)
leaq 0x10(%rbp), %rax
movq %rax, 0x8(%rdx)
movq %r15, 0x10(%rdx)
movl $0x1f4, %edi            # imm = 0x1F4
movq %rbx, %rsi
callq 0x43c0
movq %r14, %rdi
callq 0x2290
addq $0xc8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/buf1024[P]mysch/log.c
// Function: log_finish
int log_finish()
{
    log_flush();

    pthread_mutex_lock(&_ctx_mutex);

    struct call_back* cb = _context.cb;
    while(cb){
        struct call_back* tmp_cb = cb;
        if (cb->uninit_cb_fun) {
            if (cb->uninit_cb_fun(cb->args) == LOG_FAIL) {
                fprintf(stderr, "fail to uninit call back!\n");
            }
        }
        cb = cb->next;
        free(tmp_cb);
    }

    pthread_mutex_unlock(&_ctx_mutex);

    return LOG_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
callq 0x42c5
leaq 0x797a(%rip), %rdi      # 0xc200
callq 0x23b0
movq 0x7996(%rip), %rbx      # 0xc228
testq %rbx, %rbx
je 0x48c8
movq 0x18(%rbx), %rax
testq %rax, %rax
je 0x48ab
movq 0x28(%rbx), %rdi
callq *%rax
cmpl $-0x1, %eax
je 0x48c1
movq 0x30(%rbx), %r14
movq %rbx, %rdi
callq 0x2030
movq %r14, %rbx
testq %r14, %r14
jne 0x4897
jmp 0x48c8
callq 0x2460
jmp 0x48ab
leaq 0x7931(%rip), %rdi      # 0xc200
callq 0x2290
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/buf1024[P]mysch/log.c
// Function: log_initialize_default
int log_initialize_default(int con_lvl, int file_lvl,
        char* file_path, char* prefix, int buf_size,
        int sw_time, int sw_size)
{
    log_clearup();

    if (log_initialize_console(con_lvl) == LOG_FAIL) {
        return LOG_FAIL;
    }

    if (log_initialize_file(file_lvl, file_path,
            prefix, buf_size, sw_time, sw_size) == LOG_FAIL) {
        return LOG_FAIL;
    }

    return log_start();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r9d, -0x2c(%rbp)
movl %r8d, %r14d
movq %rcx, %r15
movq %rdx, %r12
movl %esi, %r13d
movl 0x10(%rbp), %ebx
xorl %eax, %eax
movq %rax, 0x7923(%rip)      # 0xc228
xorps %xmm0, %xmm0
movups %xmm0, 0x78f1(%rip)     # 0xc200
movups %xmm0, 0x78fa(%rip)     # 0xc210
movq %rax, 0x7903(%rip)      # 0xc220
leaq 0x176(%rip), %rdx       # 0x4a9a
xorl %esi, %esi
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x41bf
movl %r13d, %edi
movq %r12, %rsi
movq %r15, %rdx
movl %r14d, %ecx
movl -0x2c(%rbp), %r8d
movl %ebx, %r9d
callq 0x4995
cmpl $-0x1, %eax
je 0x4963
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x425e
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/buf1024[P]mysch/log.c
// Function: log_initialize_file
int log_initialize_file(int file_lvl,
        char* file_path, char* prefix, int buf_size,
        int sw_time, int sw_size)
{
    if(!file_path || !prefix || buf_size <= 0) {
        return LOG_FAIL;
    }

    memset(&_file_log_ctx, 0, sizeof(_file_log_ctx));

    strncpy(_file_log_ctx.path, file_path, sizeof(_file_log_ctx.path) - 1);
    if(_file_log_ctx.path[strlen(_file_log_ctx.path) - 1] == '/') {
        _file_log_ctx.path[strlen(_file_log_ctx.path) - 1] = 0;
    }
    strncpy(_file_log_ctx.prefix, prefix, sizeof(_file_log_ctx.prefix) - 1);
    _file_log_ctx.buf_size = buf_size;
    _file_log_ctx.switch_size = sw_size;
    _file_log_ctx.switch_time = sw_time;
    _file_log_ctx.buf = malloc(sizeof(char)*buf_size);
    if(!_file_log_ctx.buf) {
        return LOG_FAIL;
    }
    memset(_file_log_ctx.buf, 0, sizeof(char)*buf_size);

    return log_reg_callback(file_lvl,
            log_file_init_callback_fun,
            log_file_log_callback_fun,
            log_file_uninit_callback_fun,
            log_file_flush_callback_fun,
            0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %ecx, %r15d
testq %rsi, %rsi
sete %al
testq %rdx, %rdx
sete %cl
orb %al, %cl
testl %r15d, %r15d
setle %al
orb %cl, %al
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
jne 0x4a88
movq %rdx, %rbx
movq %rsi, %r12
movl %r9d, -0x30(%rbp)
movl %r8d, -0x34(%rbp)
movl %edi, -0x2c(%rbp)
leaq 0x784d(%rip), %r13      # 0xc230
movl $0x338, %edx            # imm = 0x338
movq %r13, %rdi
xorl %esi, %esi
callq 0x21a0
movl $0xff, %edx
movq %r13, %rdi
movq %r12, %rsi
callq 0x2070
movq %r13, %rdi
callq 0x2130
cmpb $0x2f, -0x1(%rax,%r13)
jne 0x4a18
movb $0x0, -0x1(%rax,%r13)
leaq 0x7911(%rip), %rdi      # 0xc330
movl $0xff, %edx
movq %rbx, %rsi
callq 0x2070
movl %r15d, 0x7b25(%rip)     # 0xc558
movl -0x30(%rbp), %eax
movl %eax, 0x7b0c(%rip)      # 0xc548
movl -0x34(%rbp), %eax
movl %eax, 0x7aff(%rip)      # 0xc544
movl %r15d, %esi
movl $0x1, %edi
callq 0x21f0
movq %rax, 0x7af7(%rip)      # 0xc550
testq %rax, %rax
je 0x4a88
leaq 0x51(%rip), %rsi        # 0x4ab6
leaq 0x2b1(%rip), %rdx       # 0x4d1d
leaq 0x36c(%rip), %rcx       # 0x4ddf
leaq 0x4a0(%rip), %r8        # 0x4f1a
xorl %r14d, %r14d
movl -0x2c(%rbp), %edi
xorl %r9d, %r9d
callq 0x41bf
movl %r14d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/buf1024[P]mysch/log.c
// Function: log_file_log_callback_fun
int log_file_log_callback_fun(const char* log, int len, void* args)
{
    FILE* fp = _file_log_ctx.fp;
    if (fp == NULL ) {
        return LOG_FAIL;
    }

    if(log_file_switch(args) != LOG_SUCCESS) {
        return LOG_FAIL;
    }

    int m_size = len;

    if (m_size > (_file_log_ctx.buf_size - _file_log_ctx.w_pos)) {
        if (_file_log_ctx.w_pos > 0) {
            _file_log_ctx.w_size += fwrite(_file_log_ctx.buf, 1,
                    _file_log_ctx.w_pos, _file_log_ctx.fp);
            _file_log_ctx.w_pos = 0;
        }
        _file_log_ctx.w_size += fwrite(log, 1, m_size, _file_log_ctx.fp);
    } else {
        memcpy(_file_log_ctx.buf + _file_log_ctx.w_pos, log, m_size);
        _file_log_ctx.w_pos += m_size;
        _file_log_ctx.w_size += m_size;
    }
    return LOG_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
cmpq $0x0, 0x7803(%rip)      # 0xc538
je 0x4dd1
movl %esi, %ebx
movq %rdi, %r14
callq 0x4f8f
testl %eax, %eax
jne 0x4dd1
movl 0x7805(%rip), %eax      # 0xc558
movl 0x7807(%rip), %edx      # 0xc560
subl %edx, %eax
cmpl %ebx, %eax
jge 0x4da7
testl %edx, %edx
jle 0x4d8b
movq 0x77e6(%rip), %rdi      # 0xc550
movq 0x77c7(%rip), %rcx      # 0xc538
movl $0x1, %esi
callq 0x2350
addl %eax, 0x77db(%rip)      # 0xc55c
movl $0x0, 0x77d5(%rip)      # 0xc560
movslq %ebx, %rdx
movq 0x77a3(%rip), %rcx      # 0xc538
movl $0x1, %esi
movq %r14, %rdi
callq 0x2350
movq %rax, %rbx
jmp 0x4dc2
movslq %edx, %rdi
addq 0x779f(%rip), %rdi      # 0xc550
movslq %ebx, %rdx
movq %r14, %rsi
callq 0x2250
addl %ebx, 0x779e(%rip)      # 0xc560
addl 0x7794(%rip), %ebx      # 0xc55c
movl %ebx, 0x778e(%rip)      # 0xc55c
xorl %r15d, %r15d
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/buf1024[P]mysch/log.c
// Function: log_file_uninit_callback_fun
int log_file_uninit_callback_fun(void* args)
{
    FILE* fp = _file_log_ctx.fp;
    char* buf = _file_log_ctx.buf;
    if(fp) {
        if(log_file_switch(args) != LOG_SUCCESS) {
            return LOG_FAIL;
        }

        if(_file_log_ctx.buf && _file_log_ctx.w_pos > 0) {
            fwrite(_file_log_ctx.buf, 1,
                    _file_log_ctx.w_pos, _file_log_ctx.fp);
        }

        fclose(fp);

        char old_path[LOG_DEFAULT_MAX_PATH] = {0};
        char new_path[LOG_DEFAULT_MAX_PATH] = {0};

        snprintf(old_path, LOG_DEFAULT_MAX_PATH, "%s/%s.tmp",
                _file_log_ctx.path, _file_log_ctx.name);

        snprintf(new_path, LOG_DEFAULT_MAX_PATH, "%s/%s.log",
                        _file_log_ctx.path, _file_log_ctx.name);

        if(rename(old_path, new_path) != 0) {
            fprintf(stderr, "rename %s - > %s failed: %s\n", old_path, new_path, strerror(errno));
        }
    }
    if(buf) {
        free(buf);
    }
    memset(&_file_log_ctx, 0, sizeof(_file_log_ctx.buf));

    return LOG_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x208, %rsp            # imm = 0x208
movq 0x773e(%rip), %r14      # 0xc538
movq 0x774f(%rip), %rbx      # 0xc550
testq %r14, %r14
je 0x4ed9
callq 0x4f8f
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %ecx, %ecx
jne 0x4ef3
movq 0x772b(%rip), %rdi      # 0xc550
testq %rdi, %rdi
setne %cl
movl 0x772f(%rip), %eax      # 0xc560
testl %eax, %eax
setg %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x4e50
movl %eax, %edx
movq 0x76f2(%rip), %rcx      # 0xc538
movl $0x1, %esi
callq 0x2350
movq %r14, %rdi
callq 0x2110
leaq -0x230(%rbp), %r14
movl $0x100, %edx            # imm = 0x100
movq %r14, %rdi
xorl %esi, %esi
callq 0x21a0
leaq -0x130(%rbp), %r15
movl $0x100, %edx            # imm = 0x100
movq %r15, %rdi
xorl %esi, %esi
callq 0x21a0
leaq 0x337b(%rip), %rdx      # 0x8206
leaq 0x739e(%rip), %r12      # 0xc230
leaq 0x7597(%rip), %r13      # 0xc430
movl $0x100, %esi            # imm = 0x100
movq %r14, %rdi
movq %r12, %rcx
movq %r13, %r8
xorl %eax, %eax
callq 0x2170
leaq 0x335b(%rip), %rdx      # 0x8210
movl $0x100, %esi            # imm = 0x100
movq %r15, %rdi
movq %r12, %rcx
movq %r13, %r8
xorl %eax, %eax
callq 0x2170
movq %r14, %rdi
movq %r15, %rsi
callq 0x2310
testl %eax, %eax
jne 0x4f05
testq %rbx, %rbx
je 0x4ee6
movq %rbx, %rdi
callq 0x2030
movq $0x0, 0x733f(%rip) # 0xc230
xorl %eax, %eax
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq -0x230(%rbp), %rdi
leaq -0x130(%rbp), %rsi
callq 0x24da
jmp 0x4ed9
// File: /workspace/github_c_makefile_star2_O3/buf1024[P]mysch/log.c
// Function: log_file_flush_callback_fun
int log_file_flush_callback_fun(void* args)
{
    FILE* fp = _file_log_ctx.fp;
    if(fp) {
        if(log_file_switch(args) != LOG_SUCCESS) {
            return LOG_FAIL;
        }
        if(_file_log_ctx.buf && _file_log_ctx.w_pos > 0) {
            _file_log_ctx.w_size += fwrite(_file_log_ctx.buf, 1,
                    _file_log_ctx.w_pos, _file_log_ctx.fp);
            _file_log_ctx.w_pos = 0;

            fflush(fp);
        }
    }
    return LOG_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq 0x7611(%rip), %rbx      # 0xc538
testq %rbx, %rbx
je 0x4f86
callq 0x4f8f
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %ecx, %ecx
jne 0x4f88
movq 0x760d(%rip), %rdi      # 0xc550
testq %rdi, %rdi
setne %cl
movl 0x7611(%rip), %eax      # 0xc560
testl %eax, %eax
setg %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x4f86
movl %eax, %edx
movq 0x75d4(%rip), %rcx      # 0xc538
movl $0x1, %esi
callq 0x2350
addl %eax, 0x75e8(%rip)      # 0xc55c
movl $0x0, 0x75e2(%rip)      # 0xc560
movq %rbx, %rdi
callq 0x22b0
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/buf1024[P]mysch/log.c
// Function: log_file_switch
static int log_file_switch(void* args)
{
    int sw_log = 0;

    if (_file_log_ctx.switch_time > 0) {
        struct timeval tv = { 0 };
        gettimeofday(&tv, NULL );
        struct tm* tm = localtime(&tv.tv_sec);

        if(tm->tm_mday != _file_log_ctx.sw_day) {
            int seconds = tm->tm_hour * 3600 + tm->tm_min * 60 + tm->tm_sec;
            if (seconds >= _file_log_ctx.switch_time) {
                sw_log = 1;
                _file_log_ctx.sw_day = tm->tm_mday;
            }
        }
    }
    if (!sw_log) {
        if (_file_log_ctx.switch_size > 0
                && _file_log_ctx.w_size >= _file_log_ctx.switch_size) {
            sw_log = 1;
        }
    }
    if (sw_log) {

        if (log_file_init_callback_fun(&_file_log_ctx) != LOG_SUCCESS) {
            return LOG_FAIL;
        }
    }

    return LOG_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
cmpl $0x0, 0x75a3(%rip)      # 0xc544
jle 0x4ff2
xorps %xmm0, %xmm0
leaq -0x20(%rbp), %rbx
movaps %xmm0, (%rbx)
xorl %r14d, %r14d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2190
movq %rbx, %rdi
callq 0x2050
movl 0xc(%rax), %ecx
cmpl 0x7565(%rip), %ecx      # 0xc530
je 0x4ff5
imull $0xe10, 0x8(%rax), %edx # imm = 0xE10
imull $0x3c, 0x4(%rax), %esi
addl %edx, %esi
addl (%rax), %esi
cmpl 0x7562(%rip), %esi      # 0xc544
jl 0x4ff5
movl %ecx, 0x7546(%rip)      # 0xc530
movl $0x1, %r14d
jmp 0x4ff5
xorl %r14d, %r14d
movl 0x754d(%rip), %eax      # 0xc548
xorl %ecx, %ecx
cmpl %eax, 0x7559(%rip)      # 0xc55c
setge %cl
testl %eax, %eax
cmovlel %r14d, %ecx
testl %r14d, %r14d
cmovnel %r14d, %ecx
testl %ecx, %ecx
je 0x5027
callq 0x4ab6
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %ecx, %ecx
jne 0x5029
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O3/buf1024[P]mysch/util.c
// Function: make_daemon
int make_daemon()
{
    if (fork() > 0) {
        exit(0);
    }
    setsid();
    if (fork() > 0) {
        exit(0);
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
callq 0x23a0
testl %eax, %eax
jg 0x50c4
callq 0x21d0
callq 0x23a0
testl %eax, %eax
jg 0x50c4
xorl %eax, %eax
popq %rbp
retq
xorl %edi, %edi
callq 0x2340