// File: /workspace/github_c_makefile_star2_O3/buf1024[P]mysch/log.c
// Function: log_message
static void log_message(int lvl, const char* format, va_list ap)
{
    struct call_back* cb = _context.cb;

    int len = 0;
    char msg[LOG_DEFAULT_BUFFER_SIZE] = {0};

    while(cb){
        if (cb->log_cb_fun) {
            if (lvl >= cb->level) {
                if (!len) {
                    char head[LOG_DEFAULT_HEAD_SIZE] = { 0 };
                    log_get_header(lvl, head, LOG_DEFAULT_HEAD_SIZE);

                    char log[LOG_DEFAULT_BUFFER_SIZE] = { 0 };
                    vsnprintf(log, LOG_DEFAULT_BUFFER_SIZE, format, ap);

                    len = snprintf(msg, LOG_DEFAULT_BUFFER_SIZE, "%s%s", head, log);

                }

                if (cb->log_cb_fun(msg, len, cb->args) == LOG_FAIL) {
                    fprintf(stderr, "fail to log message!\n");
                }
            }
        }
        cb = cb->next;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2098, %rsp           # imm = 0x2098
movq %rdx, -0x38(%rbp)
movq %rsi, -0x30(%rbp)
movl %edi, %r15d
movq 0x7e42(%rip), %r14      # 0xc228
leaq -0x20c0(%rbp), %rdi
movl $0x1000, %edx           # imm = 0x1000
xorl %esi, %esi
callq 0x21a0
testq %r14, %r14
je 0x45b9
leaq -0x20c0(%rbp), %r12
xorl %ebx, %ebx
movq 0x10(%r14), %rax
testq %rax, %rax
je 0x45a3
cmpl %r15d, (%r14)
jg 0x45a3
testl %ebx, %ebx
jne 0x4593
xorps %xmm1, %xmm1
movaps %xmm1, -0x50(%rbp)
movaps %xmm1, -0x60(%rbp)
movaps %xmm1, -0x70(%rbp)
movaps %xmm1, -0x80(%rbp)
movaps %xmm1, -0x90(%rbp)
movaps %xmm1, -0xa0(%rbp)
movaps %xmm1, -0xb0(%rbp)
xorps %xmm0, %xmm0
movaps %xmm1, -0xc0(%rbp)
cmpl $0x12b, %r15d           # imm = 0x12B
jle 0x448d
cmpl $0x12c, %r15d           # imm = 0x12C
je 0x44aa
cmpl $0x190, %r15d           # imm = 0x190
je 0x44b3
movl $0x0, %eax
cmpl $0x1f4, %r15d           # imm = 0x1F4
jne 0x44c3
leaq 0x3d56(%rip), %rax      # 0x81e1
jmp 0x44c3
cmpl $0x64, %r15d
je 0x44bc
movl $0x0, %eax
cmpl $0xc8, %r15d
jne 0x44c3
leaq 0x3d2d(%rip), %rax      # 0x81d5
jmp 0x44c3
leaq 0x3d28(%rip), %rax      # 0x81d9
jmp 0x44c3
leaq 0x3d23(%rip), %rax      # 0x81dd
jmp 0x44c3
leaq 0x3d0e(%rip), %rax      # 0x81d1
movaps %xmm0, -0x10c0(%rbp)
leaq -0x10c0(%rbp), %r12
movq %r12, %rdi
xorl %esi, %esi
movq %rax, %rbx
callq 0x2190
movq %r12, %rdi
callq 0x2050
movl 0x14(%rax), %r8d
movl $0x76c, %ecx            # imm = 0x76C
addl %ecx, %r8d
movl 0x10(%rax), %r9d
incl %r9d
movl 0xc(%rax), %r10d
movl 0x8(%rax), %r11d
movl (%rax), %r13d
movl 0x4(%rax), %r12d
subq $0x8, %rsp
movl $0x80, %esi
leaq -0xc0(%rbp), %rdi
leaq 0x3cc6(%rip), %rdx      # 0x81e5
movq %rbx, %rcx
xorl %eax, %eax
pushq -0x10b8(%rbp)
pushq %r13
pushq %r12
pushq %r11
pushq %r10
callq 0x2170
addq $0x30, %rsp
movl $0x1000, %edx           # imm = 0x1000
leaq -0x10c0(%rbp), %rbx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x21a0
movl $0x1000, %esi           # imm = 0x1000
movq %rbx, %rdi
movq -0x30(%rbp), %rdx
movq -0x38(%rbp), %rcx
callq 0x20d0
movl $0x1000, %esi           # imm = 0x1000
leaq -0x20c0(%rbp), %r12
movq %r12, %rdi
leaq 0x3c3a(%rip), %rdx      # 0x81b6
leaq -0xc0(%rbp), %rcx
movq %rbx, %r8
xorl %eax, %eax
callq 0x2170
movl %eax, %ebx
movq 0x10(%r14), %rax
movq 0x28(%r14), %rdx
movq %r12, %rdi
movl %ebx, %esi
callq *%rax
cmpl $-0x1, %eax
je 0x45b2
movq 0x30(%r14), %r14
testq %r14, %r14
jne 0x440b
jmp 0x45b9
callq 0x243e
jmp 0x45a3
addq $0x2098, %rsp           # imm = 0x2098
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq