// File: /workspace/github_c_makefile_star2_O2/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, -0x40(%rbp)
movq %rsi, -0x38(%rbp)
movl %edi, %r15d
movq 0x71b8(%rip), %r14      # 0xb228
leaq -0x20c0(%rbp), %r12
movl $0x1000, %edx           # imm = 0x1000
movq %r12, %rdi
xorl %esi, %esi
callq 0x21a0
xorl %ebx, %ebx
testq %r14, %r14
je 0x4254
movq 0x10(%r14), %rax
testq %rax, %rax
je 0x4210
cmpl %r15d, (%r14)
jg 0x4210
testl %ebx, %ebx
jne 0x4200
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 $0x1f4, %r15d           # imm = 0x1F4
je 0x4226
cmpl $0xc8, %r15d
je 0x411c
cmpl $0x12c, %r15d           # imm = 0x12C
je 0x412e
cmpl $0x190, %r15d           # imm = 0x190
je 0x4125
cmpl $0x64, %r15d
jne 0x4219
leaq 0x30b7(%rip), %rax      # 0x71d1
jmp 0x4135
leaq 0x30b2(%rip), %rax      # 0x71d5
jmp 0x4135
leaq 0x30b1(%rip), %rax      # 0x71dd
jmp 0x4135
leaq 0x30a4(%rip), %rax      # 0x71d9
movq %rax, -0x30(%rbp)
movaps %xmm0, -0x10c0(%rbp)
leaq -0x10c0(%rbp), %rbx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2190
movq %rbx, %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), %r12d
movl 0x4(%rax), %r13d
subq $0x8, %rsp
movl $0x80, %esi
leaq -0xc0(%rbp), %rdi
leaq 0x3053(%rip), %rdx      # 0x71e5
movq -0x30(%rbp), %rcx
xorl %eax, %eax
pushq -0x10b8(%rbp)
pushq %r12
pushq %r13
pushq %r11
pushq %r10
callq 0x2170
addq $0x30, %rsp
movl $0x1000, %edx           # imm = 0x1000
movq %rbx, %rdi
xorl %esi, %esi
callq 0x21a0
movl $0x1000, %esi           # imm = 0x1000
movq %rbx, %rdi
movq -0x38(%rbp), %rdx
movq -0x40(%rbp), %rcx
callq 0x20d0
movl $0x1000, %esi           # imm = 0x1000
leaq -0x20c0(%rbp), %r12
movq %r12, %rdi
leaq 0x2fcd(%rip), %rdx      # 0x71b6
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 0x4236
movq 0x30(%r14), %r14
jmp 0x4088
movq $0x0, -0x30(%rbp)
jmp 0x4139
leaq 0x2fb4(%rip), %rbx      # 0x71e1
movq %rbx, -0x30(%rbp)
jmp 0x4139
movq 0x6dbb(%rip), %rax      # 0xaff8
movq (%rax), %rcx
leaq 0x2f74(%rip), %rdi      # 0x71bb
pushq $0x15
popq %rsi
pushq $0x1
popq %rdx
callq 0x2350
jmp 0x4210
addq $0x2098, %rsp           # imm = 0x2098
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq